diff --git "a/assets/index-DwQ1iJRZ.js" "b/assets/index-DwQ1iJRZ.js" new file mode 100644--- /dev/null +++ "b/assets/index-DwQ1iJRZ.js" @@ -0,0 +1,3881 @@ +var zm=Object.defineProperty;var jm=(r,e,t)=>e in r?zm(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var ac=(r,e,t)=>jm(r,typeof e!="symbol"?e+"":e,t);import{g as tu,e as Nn,f as Vm,d as De,h as le,i as Ve,j as Xo,k as nd,l as Wo,m as Gm,w as Ge,p as Jt,q as Gt,o as he,c as _e,s as rd,t as $m,v as ut,r as Eo,x as lt,y as Ue,a as Re,z as Y,A as Kt,B as ht,C as Xr,D as be,b as K,E as nt,F as id,I as od,G as Ga,M as Wr,H as Vt,V as Fe,S as qo,U as nu,J as Hm,T as Xm,K as sd,R as Wm,P as ad,L as Ti,N as qm,O as Yr,Q as Ln,Z as ru,W as Sn,X as ld,Y as ud,_ as Ym,$ as iu,a0 as Km,a1 as fn,a2 as Yo,a3 as ou,a4 as yo,a5 as bt,a6 as Zm,a7 as Bn,a8 as Jm,a9 as cd,aa as fr,ab as Lr,ac as lc,ad as ms,ae as Qm,af as eg,ag as uc,ah as tg,ai as Si,aj as su,ak as ng,al as Er,am as Co,an as Tn,ao as lr,ap as cc,aq as rg,ar as ig,as as og,at as sg,au as fd,av as hd,aw as gs,ax as Ao,ay as ag,az as ur,aA as dd,aB as $a,aC as lg,aD as ug,aE as cg,aF as au,aG as pd,aH as md,aI as Io,aJ as gd,aK as lu,aL as vd,aM as Po,aN as yd,aO as Ko,aP as fg,aQ as hg,aR as fc,n as qr,aS as dg,aT as Ha,aU as _d,aV as pg,aW as yi,aX as xd,aY as En,aZ as mg,a_ as gg,a$ as vg,b0 as Ei,b1 as mn,b2 as yg,b3 as _g,b4 as bd,b5 as xg,b6 as bg,b7 as wg,b8 as vs,b9 as Tg,ba as wd,bb as Sg,bc as Eg,bd as Cg,be as Ag,bf as Ig,bg as ys,bh as Pg,bi as Mg,bj as kg,bk as hc,bl as Og,bm as dc,bn as pc,bo as mc,bp as Rg,bq as Fg,br as Lg,bs as Zo,bt as Kr,bu as Cn,bv as Zr,bw as Ng,bx as Dg,by as Bg,bz as _i,bA as Dr,bB as Td,bC as Un,bD as mr,bE as Sd,bF as Ed,bG as Ug,bH as zg,bI as jg,bJ as Vg,bK as Cd,bL as Qt,bM as Ad,bN as Gg,bO as Id,bP as Pd,bQ as zn,bR as $g,bS as Hg,bT as Xg,bU as _o,bV as Wg,bW as qg,bX as Yg,bY as Kg,bZ as Zg,b_ as yr,b$ as Jg,c0 as Qg,c1 as ev}from"./index-B96pcwuf.js";import{E as tv,a as nv,b as rv,c as iv,d as ov,e as sv,f as Md,g as av,u as lv,h as uv,i as cv,l as fv,j as hv,k as dv,_ as pv}from"./queues-CyRDoDuR.js";import{V as mv,a as gv,c as vv,b as gc,d as yv,e as vc}from"./index-D-uBv4_e.js";import{u as _s}from"./queue-CmQ84qEv.js";import{_ as Jo}from"./_plugin-vue_export-helper-DlAUqK2U.js";/*! + * @pixi/constants - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/constants is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */var An;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(An||(An={}));var Ci;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(Ci||(Ci={}));var Mo;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(Mo||(Mo={}));var Ce;(function(r){r[r.NORMAL=0]="NORMAL",r[r.ADD=1]="ADD",r[r.MULTIPLY=2]="MULTIPLY",r[r.SCREEN=3]="SCREEN",r[r.OVERLAY=4]="OVERLAY",r[r.DARKEN=5]="DARKEN",r[r.LIGHTEN=6]="LIGHTEN",r[r.COLOR_DODGE=7]="COLOR_DODGE",r[r.COLOR_BURN=8]="COLOR_BURN",r[r.HARD_LIGHT=9]="HARD_LIGHT",r[r.SOFT_LIGHT=10]="SOFT_LIGHT",r[r.DIFFERENCE=11]="DIFFERENCE",r[r.EXCLUSION=12]="EXCLUSION",r[r.HUE=13]="HUE",r[r.SATURATION=14]="SATURATION",r[r.COLOR=15]="COLOR",r[r.LUMINOSITY=16]="LUMINOSITY",r[r.NORMAL_NPM=17]="NORMAL_NPM",r[r.ADD_NPM=18]="ADD_NPM",r[r.SCREEN_NPM=19]="SCREEN_NPM",r[r.NONE=20]="NONE",r[r.SRC_OVER=0]="SRC_OVER",r[r.SRC_IN=21]="SRC_IN",r[r.SRC_OUT=22]="SRC_OUT",r[r.SRC_ATOP=23]="SRC_ATOP",r[r.DST_OVER=24]="DST_OVER",r[r.DST_IN=25]="DST_IN",r[r.DST_OUT=26]="DST_OUT",r[r.DST_ATOP=27]="DST_ATOP",r[r.ERASE=26]="ERASE",r[r.SUBTRACT=28]="SUBTRACT",r[r.XOR=29]="XOR"})(Ce||(Ce={}));var Ai;(function(r){r[r.POINTS=0]="POINTS",r[r.LINES=1]="LINES",r[r.LINE_LOOP=2]="LINE_LOOP",r[r.LINE_STRIP=3]="LINE_STRIP",r[r.TRIANGLES=4]="TRIANGLES",r[r.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",r[r.TRIANGLE_FAN=6]="TRIANGLE_FAN"})(Ai||(Ai={}));var Te;(function(r){r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL"})(Te||(Te={}));var hr;(function(r){r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"})(hr||(hr={}));var $e;(function(r){r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT"})($e||($e={}));var ko;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(ko||(ko={}));var Bt;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(Bt||(Bt={}));var Oo;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(Oo||(Oo={}));var hn;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(hn||(hn={}));var jn;(function(r){r[r.NPM=0]="NPM",r[r.UNPACK=1]="UNPACK",r[r.PMA=2]="PMA",r[r.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",r[r.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",r[r.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",r[r.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"})(jn||(jn={}));var nn;(function(r){r[r.NO=0]="NO",r[r.YES=1]="YES",r[r.AUTO=2]="AUTO",r[r.BLEND=0]="BLEND",r[r.CLEAR=1]="CLEAR",r[r.BLIT=2]="BLIT"})(nn||(nn={}));var Ro;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(Ro||(Ro={}));var Ut;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(Ut||(Ut={}));var mt;(function(r){r[r.NONE=0]="NONE",r[r.SCISSOR=1]="SCISSOR",r[r.STENCIL=2]="STENCIL",r[r.SPRITE=3]="SPRITE",r[r.COLOR=4]="COLOR"})(mt||(mt={}));var yc;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})(yc||(yc={}));var dt;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(dt||(dt={}));var cn;(function(r){r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"})(cn||(cn={}));/*! + * @pixi/settings - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/settings is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */var _v={createCanvas:function(r,e){var t=document.createElement("canvas");return t.width=r,t.height=e,t},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var r;return(r=document.baseURI)!==null&&r!==void 0?r:window.location.href},fetch:function(r,e){return fetch(r,e)}},xs=/iPhone/i,_c=/iPod/i,xc=/iPad/i,bc=/\biOS-universal(?:.+)Mac\b/i,bs=/\bAndroid(?:.+)Mobile\b/i,wc=/Android/i,Cr=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,zi=/Silk/i,vn=/Windows Phone/i,Tc=/\bWindows(?:.+)ARM\b/i,Sc=/BlackBerry/i,Ec=/BB10/i,Cc=/Opera Mini/i,Ac=/\b(CriOS|Chrome)(?:.+)Mobile/i,Ic=/Mobile(?:.+)Firefox\b/i,Pc=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function xv(r){return function(e){return e.test(r)}}function bv(r){var e={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator<"u"?e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?e.userAgent=r:r&&r.userAgent&&(e={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var t=e.userAgent,n=t.split("[FBAN");typeof n[1]<"u"&&(t=n[0]),n=t.split("Twitter"),typeof n[1]<"u"&&(t=n[0]);var i=xv(t),o={apple:{phone:i(xs)&&!i(vn),ipod:i(_c),tablet:!i(xs)&&(i(xc)||Pc(e))&&!i(vn),universal:i(bc),device:(i(xs)||i(_c)||i(xc)||i(bc)||Pc(e))&&!i(vn)},amazon:{phone:i(Cr),tablet:!i(Cr)&&i(zi),device:i(Cr)||i(zi)},android:{phone:!i(vn)&&i(Cr)||!i(vn)&&i(bs),tablet:!i(vn)&&!i(Cr)&&!i(bs)&&(i(zi)||i(wc)),device:!i(vn)&&(i(Cr)||i(zi)||i(bs)||i(wc))||i(/\bokhttp\b/i)},windows:{phone:i(vn),tablet:i(Tc),device:i(vn)||i(Tc)},other:{blackberry:i(Sc),blackberry10:i(Ec),opera:i(Cc),firefox:i(Ic),chrome:i(Ac),device:i(Sc)||i(Ec)||i(Cc)||i(Ic)||i(Ac)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}var cr=bv(globalThis.navigator);function wv(){return!cr.apple.device}function Tv(r){var e=!0;if(cr.tablet||cr.phone){if(cr.apple.device){var t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(t){var n=parseInt(t[1],10);n<11&&(e=!1)}}if(cr.android.device){var t=navigator.userAgent.match(/Android\s([0-9.]*)/);if(t){var n=parseInt(t[1],10);n<7&&(e=!1)}}}return e?r:4}var Se={ADAPTER:_v,MIPMAP_TEXTURES:hn.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:dt.NONE,SPRITE_MAX_TEXTURES:Tv(32),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,width:800,height:600,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,antialias:!1,preserveDrawingBuffer:!1},GC_MODE:Ro.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:Oo.CLAMP,SCALE_MODE:Bt.LINEAR,PRECISION_VERTEX:Ut.HIGH,PRECISION_FRAGMENT:cr.apple.device?Ut.HIGH:Ut.MEDIUM,CAN_UPLOAD_SAME_BUFFER:wv(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},ws={exports:{}},Mc;function Sv(){return Mc||(Mc=1,function(r){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function o(l,u,c,f,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var h=new i(c,f||l,p),g=t?t+u:u;return l._events[g]?l._events[g].fn?l._events[g]=[l._events[g],h]:l._events[g].push(h):(l._events[g]=h,l._eventsCount++),l}function s(l,u){--l._eventsCount===0?l._events=new n:delete l._events[u]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],c,f;if(this._eventsCount===0)return u;for(f in c=this._events)e.call(c,f)&&u.push(t?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},a.prototype.listeners=function(u){var c=t?t+u:u,f=this._events[c];if(!f)return[];if(f.fn)return[f.fn];for(var p=0,h=f.length,g=new Array(h);p80*N){k=Q=R[0],ee=ue=R[1];for(var B=N;BQ&&(Q=de),ne>ue&&(ue=ne);O=Math.max(Q-k,ue-ee),O=O!==0?32767/O:0}return n(D,j,N,k,ee,O,0),j}function e(R,L,N,$,P){var D,j;if(P===G(R,L,N,$)>0)for(D=L;D=L;D-=$)j=S(D,R[D],R[D+1],j);return j&&C(j,j.next)&&(X(j),j=j.next),j}function t(R,L){if(!R)return R;L||(L=R);var N=R,$;do if($=!1,!N.steiner&&(C(N,N.next)||_(N.prev,N,N.next)===0)){if(X(N),N=L=N.prev,N===N.next)break;$=!0}else N=N.next;while($||N!==L);return L}function n(R,L,N,$,P,D,j){if(R){!j&&D&&h(R,$,P,D);for(var k=R,ee,Q;R.prev!==R.next;){if(ee=R.prev,Q=R.next,D?o(R,$,P,D):i(R)){L.push(ee.i/N|0),L.push(R.i/N|0),L.push(Q.i/N|0),X(R),R=Q.next,k=Q.next;continue}if(R=Q,R===k){j?j===1?(R=s(t(R),L,N),n(R,L,N,$,P,D,2)):j===2&&a(R,L,N,$,P,D):n(t(R),L,N,$,P,D,1);break}}}}function i(R){var L=R.prev,N=R,$=R.next;if(_(L,N,$)>=0)return!1;for(var P=L.x,D=N.x,j=$.x,k=L.y,ee=N.y,Q=$.y,ue=PD?P>j?P:j:D>j?D:j,O=k>ee?k>Q?k:Q:ee>Q?ee:Q,B=$.next;B!==L;){if(B.x>=ue&&B.x<=ne&&B.y>=de&&B.y<=O&&m(P,k,D,ee,j,Q,B.x,B.y)&&_(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function o(R,L,N,$){var P=R.prev,D=R,j=R.next;if(_(P,D,j)>=0)return!1;for(var k=P.x,ee=D.x,Q=j.x,ue=P.y,de=D.y,ne=j.y,O=kee?k>Q?k:Q:ee>Q?ee:Q,oe=ue>de?ue>ne?ue:ne:de>ne?de:ne,ie=v(O,B,L,N,$),T=v(W,oe,L,N,$),J=R.prevZ,H=R.nextZ;J&&J.z>=ie&&H&&H.z<=T;){if(J.x>=O&&J.x<=W&&J.y>=B&&J.y<=oe&&J!==P&&J!==j&&m(k,ue,ee,de,Q,ne,J.x,J.y)&&_(J.prev,J,J.next)>=0||(J=J.prevZ,H.x>=O&&H.x<=W&&H.y>=B&&H.y<=oe&&H!==P&&H!==j&&m(k,ue,ee,de,Q,ne,H.x,H.y)&&_(H.prev,H,H.next)>=0))return!1;H=H.nextZ}for(;J&&J.z>=ie;){if(J.x>=O&&J.x<=W&&J.y>=B&&J.y<=oe&&J!==P&&J!==j&&m(k,ue,ee,de,Q,ne,J.x,J.y)&&_(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;H&&H.z<=T;){if(H.x>=O&&H.x<=W&&H.y>=B&&H.y<=oe&&H!==P&&H!==j&&m(k,ue,ee,de,Q,ne,H.x,H.y)&&_(H.prev,H,H.next)>=0)return!1;H=H.nextZ}return!0}function s(R,L,N){var $=R;do{var P=$.prev,D=$.next.next;!C(P,D)&&x(P,$,$.next,D)&&M(P,D)&&M(D,P)&&(L.push(P.i/N|0),L.push($.i/N|0),L.push(D.i/N|0),X($),X($.next),$=R=D),$=$.next}while($!==R);return t($)}function a(R,L,N,$,P,D){var j=R;do{for(var k=j.next.next;k!==j.prev;){if(j.i!==k.i&&y(j,k)){var ee=F(j,k);j=t(j,j.next),ee=t(ee,ee.next),n(j,L,N,$,P,D,0),n(ee,L,N,$,P,D,0);return}k=k.next}j=j.next}while(j!==R)}function l(R,L,N,$){var P=[],D,j,k,ee,Q;for(D=0,j=L.length;D=N.next.y&&N.next.y!==N.y){var k=N.x+(P-N.y)*(N.next.x-N.x)/(N.next.y-N.y);if(k<=$&&k>D&&(D=k,j=N.x=N.x&&N.x>=Q&&$!==N.x&&m(Pj.x||N.x===j.x&&p(j,N)))&&(j=N,de=ne)),N=N.next;while(N!==ee);return j}function p(R,L){return _(R.prev,R,L.prev)<0&&_(L.next,R,R.next)<0}function h(R,L,N,$){var P=R;do P.z===0&&(P.z=v(P.x,P.y,L,N,$)),P.prevZ=P.prev,P.nextZ=P.next,P=P.next;while(P!==R);P.prevZ.nextZ=null,P.prevZ=null,g(P)}function g(R){var L,N,$,P,D,j,k,ee,Q=1;do{for(N=R,R=null,D=null,j=0;N;){for(j++,$=N,k=0,L=0;L0||ee>0&&$;)k!==0&&(ee===0||!$||N.z<=$.z)?(P=N,N=N.nextZ,k--):(P=$,$=$.nextZ,ee--),D?D.nextZ=P:R=P,P.prevZ=D,D=P;N=$}D.nextZ=null,Q*=2}while(j>1);return R}function v(R,L,N,$,P){return R=(R-N)*P|0,L=(L-$)*P|0,R=(R|R<<8)&16711935,R=(R|R<<4)&252645135,R=(R|R<<2)&858993459,R=(R|R<<1)&1431655765,L=(L|L<<8)&16711935,L=(L|L<<4)&252645135,L=(L|L<<2)&858993459,L=(L|L<<1)&1431655765,R|L<<1}function d(R){var L=R,N=R;do(L.x=(R-j)*(D-k)&&(R-j)*($-k)>=(N-j)*(L-k)&&(N-j)*(D-k)>=(P-j)*($-k)}function y(R,L){return R.next.i!==L.i&&R.prev.i!==L.i&&!A(R,L)&&(M(R,L)&&M(L,R)&&I(R,L)&&(_(R.prev,R,L.prev)||_(R,L.prev,L))||C(R,L)&&_(R.prev,R,R.next)>0&&_(L.prev,L,L.next)>0)}function _(R,L,N){return(L.y-R.y)*(N.x-L.x)-(L.x-R.x)*(N.y-L.y)}function C(R,L){return R.x===L.x&&R.y===L.y}function x(R,L,N,$){var P=E(_(R,L,N)),D=E(_(R,L,$)),j=E(_(N,$,R)),k=E(_(N,$,L));return!!(P!==D&&j!==k||P===0&&b(R,N,L)||D===0&&b(R,$,L)||j===0&&b(N,R,$)||k===0&&b(N,L,$))}function b(R,L,N){return L.x<=Math.max(R.x,N.x)&&L.x>=Math.min(R.x,N.x)&&L.y<=Math.max(R.y,N.y)&&L.y>=Math.min(R.y,N.y)}function E(R){return R>0?1:R<0?-1:0}function A(R,L){var N=R;do{if(N.i!==R.i&&N.next.i!==R.i&&N.i!==L.i&&N.next.i!==L.i&&x(N,N.next,R,L))return!0;N=N.next}while(N!==R);return!1}function M(R,L){return _(R.prev,R,R.next)<0?_(R,L,R.next)>=0&&_(R,R.prev,L)>=0:_(R,L,R.prev)<0||_(R,R.next,L)<0}function I(R,L){var N=R,$=!1,P=(R.x+L.x)/2,D=(R.y+L.y)/2;do N.y>D!=N.next.y>D&&N.next.y!==N.y&&P<(N.next.x-N.x)*(D-N.y)/(N.next.y-N.y)+N.x&&($=!$),N=N.next;while(N!==R);return $}function F(R,L){var N=new w(R.i,R.x,R.y),$=new w(L.i,L.x,L.y),P=R.next,D=L.prev;return R.next=L,L.prev=R,N.next=P,P.prev=N,$.next=N,N.prev=$,D.next=$,$.prev=D,$}function S(R,L,N,$){var P=new w(R,L,N);return $?(P.next=$.next,P.prev=$,$.next.prev=P,$.next=P):(P.prev=P,P.next=P),P}function X(R){R.next.prev=R.prev,R.prev.next=R.next,R.prevZ&&(R.prevZ.nextZ=R.nextZ),R.nextZ&&(R.nextZ.prevZ=R.prevZ)}function w(R,L,N){this.i=R,this.x=L,this.y=N,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}r.deviation=function(R,L,N,$){var P=L&&L.length,D=P?L[0]*N:R.length,j=Math.abs(G(R,0,D,N));if(P)for(var k=0,ee=L.length;k0&&($+=R[P-1].length,N.holes.push($))}return N},ji.exports}Cv();var Wn={},hi={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var Av=hi.exports,Oc;function Iv(){return Oc||(Oc=1,function(r,e){(function(t){var n=e&&!e.nodeType&&e,i=!r.nodeType&&r,o=typeof Nn=="object"&&Nn;(o.global===o||o.window===o||o.self===o)&&(t=o);var s,a=2147483647,l=36,u=1,c=26,f=38,p=700,h=72,g=128,v="-",d=/^xn--/,m=/[^\x20-\x7E]/,y=/[\x2E\u3002\uFF0E\uFF61]/g,_={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=l-u,x=Math.floor,b=String.fromCharCode,E;function A(P){throw new RangeError(_[P])}function M(P,D){for(var j=P.length,k=[];j--;)k[j]=D(P[j]);return k}function I(P,D){var j=P.split("@"),k="";j.length>1&&(k=j[0]+"@",P=j[1]),P=P.replace(y,".");var ee=P.split("."),Q=M(ee,D).join(".");return k+Q}function F(P){for(var D=[],j=0,k=P.length,ee,Q;j=55296&&ee<=56319&&j65535&&(D-=65536,j+=b(D>>>10&1023|55296),D=56320|D&1023),j+=b(D),j}).join("")}function X(P){return P-48<10?P-22:P-65<26?P-65:P-97<26?P-97:l}function w(P,D){return P+22+75*(P<26)-((D!=0)<<5)}function G(P,D,j){var k=0;for(P=j?x(P/p):P>>1,P+=x(P/D);P>C*c>>1;k+=l)P=x(P/C);return x(k+(C+1)*P/(P+f))}function R(P){var D=[],j=P.length,k,ee=0,Q=g,ue=h,de,ne,O,B,W,oe,ie,T,J;for(de=P.lastIndexOf(v),de<0&&(de=0),ne=0;ne=128&&A("not-basic"),D.push(P.charCodeAt(ne));for(O=de>0?de+1:0;O=j&&A("invalid-input"),ie=X(P.charCodeAt(O++)),(ie>=l||ie>x((a-ee)/W))&&A("overflow"),ee+=ie*W,T=oe<=ue?u:oe>=ue+c?c:oe-ue,!(iex(a/J)&&A("overflow"),W*=J;k=D.length+1,ue=G(ee-B,k,B==0),x(ee/k)>a-Q&&A("overflow"),Q+=x(ee/k),ee%=k,D.splice(ee++,0,Q)}return S(D)}function L(P){var D,j,k,ee,Q,ue,de,ne,O,B,W,oe=[],ie,T,J,H;for(P=F(P),ie=P.length,D=g,j=0,Q=h,ue=0;ue=D&&Wx((a-j)/T)&&A("overflow"),j+=(de-D)*T,D=de,ue=0;uea&&A("overflow"),W==D){for(ne=j,O=l;B=O<=Q?u:O>=Q+c?c:O-Q,!(ne"u"||!v?r:v(Uint8Array),y={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?r:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?r:ArrayBuffer,"%ArrayIteratorPrototype%":h&&v?v([][Symbol.iterator]()):r,"%AsyncFromSyncIteratorPrototype%":r,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":typeof Atomics>"u"?r:Atomics,"%BigInt%":typeof BigInt>"u"?r:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?r:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?r:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?r:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":e,"%eval%":eval,"%EvalError%":t,"%Float32Array%":typeof Float32Array>"u"?r:Float32Array,"%Float64Array%":typeof Float64Array>"u"?r:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?r:FinalizationRegistry,"%Function%":l,"%GeneratorFunction%":d,"%Int8Array%":typeof Int8Array>"u"?r:Int8Array,"%Int16Array%":typeof Int16Array>"u"?r:Int16Array,"%Int32Array%":typeof Int32Array>"u"?r:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":h&&v?v(v([][Symbol.iterator]())):r,"%JSON%":typeof JSON=="object"?JSON:r,"%Map%":typeof Map>"u"?r:Map,"%MapIteratorPrototype%":typeof Map>"u"||!h||!v?r:v(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?r:Promise,"%Proxy%":typeof Proxy>"u"?r:Proxy,"%RangeError%":n,"%ReferenceError%":i,"%Reflect%":typeof Reflect>"u"?r:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?r:Set,"%SetIteratorPrototype%":typeof Set>"u"||!h||!v?r:v(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?r:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":h&&v?v(""[Symbol.iterator]()):r,"%Symbol%":h?Symbol:r,"%SyntaxError%":o,"%ThrowTypeError%":p,"%TypedArray%":m,"%TypeError%":s,"%Uint8Array%":typeof Uint8Array>"u"?r:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?r:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?r:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?r:Uint32Array,"%URIError%":a,"%WeakMap%":typeof WeakMap>"u"?r:WeakMap,"%WeakRef%":typeof WeakRef>"u"?r:WeakRef,"%WeakSet%":typeof WeakSet>"u"?r:WeakSet};if(v)try{null.error}catch(L){var _=v(v(L));y["%Error.prototype%"]=_}var C=function L(N){var $;if(N==="%AsyncFunction%")$=u("async function () {}");else if(N==="%GeneratorFunction%")$=u("function* () {}");else if(N==="%AsyncGeneratorFunction%")$=u("async function* () {}");else if(N==="%AsyncGenerator%"){var P=L("%AsyncGeneratorFunction%");P&&($=P.prototype)}else if(N==="%AsyncIteratorPrototype%"){var D=L("%AsyncGenerator%");D&&v&&($=v(D.prototype))}return y[N]=$,$},x={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},b=uu(),E=Bv(),A=b.call(Function.call,Array.prototype.concat),M=b.call(Function.apply,Array.prototype.splice),I=b.call(Function.call,String.prototype.replace),F=b.call(Function.call,String.prototype.slice),S=b.call(Function.call,RegExp.prototype.exec),X=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,w=/\\(\\)?/g,G=function(N){var $=F(N,0,1),P=F(N,-1);if($==="%"&&P!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(P==="%"&&$!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var D=[];return I(N,X,function(j,k,ee,Q){D[D.length]=ee?I(Q,w,"$1"):k||j}),D},R=function(N,$){var P=N,D;if(E(x,P)&&(D=x[P],P="%"+D[0]+"%"),E(y,P)){var j=y[P];if(j===d&&(j=C(P)),typeof j>"u"&&!$)throw new s("intrinsic "+N+" exists, but is not available. Please file an issue!");return{alias:D,name:P,value:j}}throw new o("intrinsic "+N+" does not exist!")};return Ns=function(N,$){if(typeof N!="string"||N.length===0)throw new s("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof $!="boolean")throw new s('"allowMissing" argument must be a boolean');if(S(/^%?[^%]*%?$/,N)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var P=G(N),D=P.length>0?P[0]:"",j=R("%"+D+"%",$),k=j.name,ee=j.value,Q=!1,ue=j.alias;ue&&(D=ue[0],M(P,A([0,1],ue)));for(var de=1,ne=!0;de=P.length){var oe=c(ee,O);ne=!!oe,ne&&"get"in oe&&!("originalValue"in oe.get)?ee=oe.get:ee=ee[O]}else ne=E(ee,O),ee=ee[O];ne&&!Q&&(y[k]=ee)}}return ee},Ns}var Ds={exports:{}},Bs,Wc;function cu(){if(Wc)return Bs;Wc=1;var r=Jr(),e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return Bs=e,Bs}var Us,qc;function Od(){if(qc)return Us;qc=1;var r=Jr(),e=r("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return Us=e,Us}var zs,Yc;function Uv(){if(Yc)return zs;Yc=1;var r=cu(),e=kd(),t=Ri(),n=Od();return zs=function(o,s,a){if(!o||typeof o!="object"&&typeof o!="function")throw new t("`obj` must be an object or a function`");if(typeof s!="string"&&typeof s!="symbol")throw new t("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new t("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new t("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new t("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new t("`loose`, if provided, must be a boolean");var l=arguments.length>3?arguments[3]:null,u=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,p=!!n&&n(o,s);if(r)r(o,s,{configurable:c===null&&p?p.configurable:!c,enumerable:l===null&&p?p.enumerable:!l,value:a,writable:u===null&&p?p.writable:!u});else if(f||!l&&!u&&!c)o[s]=a;else throw new e("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},zs}var js,Kc;function zv(){if(Kc)return js;Kc=1;var r=cu(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},js=e,js}var Vs,Zc;function jv(){if(Zc)return Vs;Zc=1;var r=Jr(),e=Uv(),t=zv()(),n=Od(),i=Ri(),o=r("%Math.floor%");return Vs=function(a,l){if(typeof a!="function")throw new i("`fn` is not a function");if(typeof l!="number"||l<0||l>4294967295||o(l)!==l)throw new i("`length` must be a positive 32-bit integer");var u=arguments.length>2&&!!arguments[2],c=!0,f=!0;if("length"in a&&n){var p=n(a,"length");p&&!p.configurable&&(c=!1),p&&!p.writable&&(f=!1)}return(c||f||!u)&&(t?e(a,"length",l,!0,!0):e(a,"length",l)),a},Vs}var Jc;function Vv(){return Jc||(Jc=1,function(r){var e=uu(),t=Jr(),n=jv(),i=Ri(),o=t("%Function.prototype.apply%"),s=t("%Function.prototype.call%"),a=t("%Reflect.apply%",!0)||e.call(s,o),l=cu(),u=t("%Math.max%");r.exports=function(p){if(typeof p!="function")throw new i("a function is required");var h=a(e,s,arguments);return n(h,1+u(0,p.length-(arguments.length-1)),!0)};var c=function(){return a(e,o,arguments)};l?l(r.exports,"apply",{value:c}):r.exports.apply=c}(Ds)),Ds.exports}var Gs,Qc;function Gv(){if(Qc)return Gs;Qc=1;var r=Jr(),e=Vv(),t=e(r("String.prototype.indexOf"));return Gs=function(i,o){var s=r(i,!!o);return typeof s=="function"&&t(i,".prototype.")>-1?e(s):s},Gs}const $v={},Hv=Object.freeze(Object.defineProperty({__proto__:null,default:$v},Symbol.toStringTag,{value:"Module"})),Xv=Vm(Hv);var $s,ef;function Wv(){if(ef)return $s;ef=1;var r=typeof Map=="function"&&Map.prototype,e=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,t=r&&e&&typeof e.get=="function"?e.get:null,n=r&&Map.prototype.forEach,i=typeof Set=="function"&&Set.prototype,o=Object.getOwnPropertyDescriptor&&i?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,s=i&&o&&typeof o.get=="function"?o.get:null,a=i&&Set.prototype.forEach,l=typeof WeakMap=="function"&&WeakMap.prototype,u=l?WeakMap.prototype.has:null,c=typeof WeakSet=="function"&&WeakSet.prototype,f=c?WeakSet.prototype.has:null,p=typeof WeakRef=="function"&&WeakRef.prototype,h=p?WeakRef.prototype.deref:null,g=Boolean.prototype.valueOf,v=Object.prototype.toString,d=Function.prototype.toString,m=String.prototype.match,y=String.prototype.slice,_=String.prototype.replace,C=String.prototype.toUpperCase,x=String.prototype.toLowerCase,b=RegExp.prototype.test,E=Array.prototype.concat,A=Array.prototype.join,M=Array.prototype.slice,I=Math.floor,F=typeof BigInt=="function"?BigInt.prototype.valueOf:null,S=Object.getOwnPropertySymbols,X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,w=typeof Symbol=="function"&&typeof Symbol.iterator=="object",G=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===w||!0)?Symbol.toStringTag:null,R=Object.prototype.propertyIsEnumerable,L=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(U){return U.__proto__}:null);function N(U,q){if(U===1/0||U===-1/0||U!==U||U&&U>-1e3&&U<1e3||b.call(/e/,q))return q;var ve=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof U=="number"){var we=U<0?-I(-U):I(U);if(we!==U){var Ne=String(we),Ee=y.call(q,Ne.length+1);return _.call(Ne,ve,"$&_")+"."+_.call(_.call(Ee,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _.call(q,ve,"$&_")}var $=Xv,P=$.custom,D=ie(P)?P:null,j={__proto__:null,double:'"',single:"'"},k={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};$s=function U(q,ve,we,Ne){var Ee=ve||{};if(H(Ee,"quoteStyle")&&!H(j,Ee.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(H(Ee,"maxStringLength")&&(typeof Ee.maxStringLength=="number"?Ee.maxStringLength<0&&Ee.maxStringLength!==1/0:Ee.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var Ct=H(Ee,"customInspect")?Ee.customInspect:!0;if(typeof Ct!="boolean"&&Ct!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(H(Ee,"indent")&&Ee.indent!==null&&Ee.indent!==" "&&!(parseInt(Ee.indent,10)===Ee.indent&&Ee.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(H(Ee,"numericSeparator")&&typeof Ee.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var At=Ee.numericSeparator;if(typeof q>"u")return"undefined";if(q===null)return"null";if(typeof q=="boolean")return q?"true":"false";if(typeof q=="string")return re(q,Ee);if(typeof q=="number"){if(q===0)return 1/0/q>0?"0":"-0";var We=String(q);return At?N(q,We):We}if(typeof q=="bigint"){var xt=String(q)+"n";return At?N(q,xt):xt}var gn=typeof Ee.depth>"u"?5:Ee.depth;if(typeof we>"u"&&(we=0),we>=gn&&gn>0&&typeof q=="object")return ue(q)?"[Array]":"[Object]";var $t=tt(Ee,we);if(typeof Ne>"u")Ne=[];else if(Z(Ne,q)>=0)return"[Circular]";function wt(Sr,Ui,Um){if(Ui&&(Ne=M.call(Ne),Ne.push(Ui)),Um){var sc={depth:Ee.depth};return H(Ee,"quoteStyle")&&(sc.quoteStyle=Ee.quoteStyle),U(Sr,sc,we+1,Ne)}return U(Sr,Ee,we+1,Ne)}if(typeof q=="function"&&!ne(q)){var Xn=V(q),ec=ft(q,wt);return"[Function"+(Xn?": "+Xn:" (anonymous)")+"]"+(ec.length>0?" { "+A.call(ec,", ")+" }":"")}if(ie(q)){var tc=w?_.call(String(q),/^(Symbol\(.*\))_[^)]*$/,"$1"):X.call(q);return typeof q=="object"&&!w?me(tc):tc}if(pe(q)){for(var ni="<"+x.call(String(q.nodeName)),us=q.attributes||[],Bi=0;Bi",ni}if(ue(q)){if(q.length===0)return"[]";var cs=ft(q,wt);return $t&&!Xe(cs)?"["+Oe(cs,$t)+"]":"[ "+A.call(cs,", ")+" ]"}if(O(q)){var fs=ft(q,wt);return!("cause"in Error.prototype)&&"cause"in q&&!R.call(q,"cause")?"{ ["+String(q)+"] "+A.call(E.call("[cause]: "+wt(q.cause),fs),", ")+" }":fs.length===0?"["+String(q)+"]":"{ ["+String(q)+"] "+A.call(fs,", ")+" }"}if(typeof q=="object"&&Ct){if(D&&typeof q[D]=="function"&&$)return $(q,{depth:gn-we});if(Ct!=="symbol"&&typeof q.inspect=="function")return q.inspect()}if(se(q)){var nc=[];return n&&n.call(q,function(Sr,Ui){nc.push(wt(Ui,q,!0)+" => "+wt(Sr,q))}),Ae("Map",t.call(q),nc,$t)}if(fe(q)){var rc=[];return a&&a.call(q,function(Sr){rc.push(wt(Sr,q))}),Ae("Set",s.call(q),rc,$t)}if(ae(q))return xe("WeakMap");if(ye(q))return xe("WeakSet");if(te(q))return xe("WeakRef");if(W(q))return me(wt(Number(q)));if(T(q))return me(wt(F.call(q)));if(oe(q))return me(g.call(q));if(B(q))return me(wt(String(q)));if(typeof window<"u"&&q===window)return"{ [object Window] }";if(typeof globalThis<"u"&&q===globalThis||typeof Nn<"u"&&q===Nn)return"{ [object globalThis] }";if(!de(q)&&!ne(q)){var hs=ft(q,wt),ic=L?L(q)===Object.prototype:q instanceof Object||q.constructor===Object,ds=q instanceof Object?"":"null prototype",oc=!ic&&G&&Object(q)===q&&G in q?y.call(z(q),8,-1):ds?"Object":"",Bm=ic||typeof q.constructor!="function"?"":q.constructor.name?q.constructor.name+" ":"",ps=Bm+(oc||ds?"["+A.call(E.call([],oc||[],ds||[]),": ")+"] ":"");return hs.length===0?ps+"{}":$t?ps+"{"+Oe(hs,$t)+"}":ps+"{ "+A.call(hs,", ")+" }"}return String(q)};function ee(U,q,ve){var we=ve.quoteStyle||q,Ne=j[we];return Ne+U+Ne}function Q(U){return _.call(String(U),/"/g,""")}function ue(U){return z(U)==="[object Array]"&&(!G||!(typeof U=="object"&&G in U))}function de(U){return z(U)==="[object Date]"&&(!G||!(typeof U=="object"&&G in U))}function ne(U){return z(U)==="[object RegExp]"&&(!G||!(typeof U=="object"&&G in U))}function O(U){return z(U)==="[object Error]"&&(!G||!(typeof U=="object"&&G in U))}function B(U){return z(U)==="[object String]"&&(!G||!(typeof U=="object"&&G in U))}function W(U){return z(U)==="[object Number]"&&(!G||!(typeof U=="object"&&G in U))}function oe(U){return z(U)==="[object Boolean]"&&(!G||!(typeof U=="object"&&G in U))}function ie(U){if(w)return U&&typeof U=="object"&&U instanceof Symbol;if(typeof U=="symbol")return!0;if(!U||typeof U!="object"||!X)return!1;try{return X.call(U),!0}catch{}return!1}function T(U){if(!U||typeof U!="object"||!F)return!1;try{return F.call(U),!0}catch{}return!1}var J=Object.prototype.hasOwnProperty||function(U){return U in this};function H(U,q){return J.call(U,q)}function z(U){return v.call(U)}function V(U){if(U.name)return U.name;var q=m.call(d.call(U),/^function\s*([\w$]+)/);return q?q[1]:null}function Z(U,q){if(U.indexOf)return U.indexOf(q);for(var ve=0,we=U.length;veq.maxStringLength){var ve=U.length-q.maxStringLength,we="... "+ve+" more character"+(ve>1?"s":"");return re(y.call(U,0,q.maxStringLength),q)+we}var Ne=k[q.quoteStyle||"single"];Ne.lastIndex=0;var Ee=_.call(_.call(U,Ne,"\\$1"),/[\x00-\x1f]/g,ce);return ee(Ee,"single",q)}function ce(U){var q=U.charCodeAt(0),ve={8:"b",9:"t",10:"n",12:"f",13:"r"}[q];return ve?"\\"+ve:"\\x"+(q<16?"0":"")+C.call(q.toString(16))}function me(U){return"Object("+U+")"}function xe(U){return U+" { ? }"}function Ae(U,q,ve,we){var Ne=we?Oe(ve,we):A.call(ve,", ");return U+" ("+q+") {"+Ne+"}"}function Xe(U){for(var q=0;q=0)return!1;return!0}function tt(U,q){var ve;if(U.indent===" ")ve=" ";else if(typeof U.indent=="number"&&U.indent>0)ve=A.call(Array(U.indent+1)," ");else return null;return{base:ve,prev:A.call(Array(q+1),ve)}}function Oe(U,q){if(U.length===0)return"";var ve=` +`+q.prev+q.base;return ve+A.call(U,","+ve)+` +`+q.prev}function ft(U,q){var ve=ue(U),we=[];if(ve){we.length=U.length;for(var Ne=0;Ne1;){var y=m.pop(),_=y.obj[y.prop];if(t(_)){for(var C=[],x=0;x<_.length;++x)typeof _[x]<"u"&&C.push(_[x]);y.obj[y.prop]=C}}},o=function(m,y){for(var _=y&&y.plainObjects?{__proto__:null}:{},C=0;C=u?b.slice(A,A+u):b,I=[],F=0;F=48&&S<=57||S>=65&&S<=90||S>=97&&S<=122||x===r.RFC1738&&(S===40||S===41)){I[I.length]=M.charAt(F);continue}if(S<128){I[I.length]=n[S];continue}if(S<2048){I[I.length]=n[192|S>>6]+n[128|S&63];continue}if(S<55296||S>=57344){I[I.length]=n[224|S>>12]+n[128|S>>6&63]+n[128|S&63];continue}F+=1,S=65536+((S&1023)<<10|M.charCodeAt(F)&1023),I[I.length]=n[240|S>>18]+n[128|S>>12&63]+n[128|S>>6&63]+n[128|S&63]}E+=I.join("")}return E},f=function(m){for(var y=[{obj:{o:m},prop:"o"}],_=[],C=0;C"u"&&(P=0)}if(typeof M=="function"?N=M(m,N):N instanceof Date?N=S(N):y==="comma"&&o(N)&&(N=e.maybeMap(N,function(J){return J instanceof Date?S(J):J})),N===null){if(x)return A&&!G?A(m,c.encoder,R,"key",X):m;N=""}if(f(N)||e.isBuffer(N)){if(A){var k=G?m:A(m,c.encoder,R,"key",X);return[w(k)+"="+w(A(N,c.encoder,R,"value",X))]}return[w(m)+"="+w(String(N))]}var ee=[];if(typeof N>"u")return ee;var Q;if(y==="comma"&&o(N))G&&A&&(N=e.maybeMap(N,A)),Q=[{value:N.length>0?N.join(",")||null:void 0}];else if(o(M))Q=M;else{var ue=Object.keys(N);Q=I?ue.sort(I):ue}var de=E?String(m).replace(/\./g,"%2E"):String(m),ne=_&&o(N)&&N.length===1?de+"[]":de;if(C&&o(N)&&N.length===0)return ne+"[]";for(var O=0;O"u"?d.encodeDotInKeys===!0?!0:c.allowDots:!!d.allowDots;return{addQueryPrefix:typeof d.addQueryPrefix=="boolean"?d.addQueryPrefix:c.addQueryPrefix,allowDots:b,allowEmptyArrays:typeof d.allowEmptyArrays=="boolean"?!!d.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:x,charset:m,charsetSentinel:typeof d.charsetSentinel=="boolean"?d.charsetSentinel:c.charsetSentinel,commaRoundTrip:!!d.commaRoundTrip,delimiter:typeof d.delimiter>"u"?c.delimiter:d.delimiter,encode:typeof d.encode=="boolean"?d.encode:c.encode,encodeDotInKeys:typeof d.encodeDotInKeys=="boolean"?d.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof d.encoder=="function"?d.encoder:c.encoder,encodeValuesOnly:typeof d.encodeValuesOnly=="boolean"?d.encodeValuesOnly:c.encodeValuesOnly,filter:C,format:y,formatter:_,serializeDate:typeof d.serializeDate=="function"?d.serializeDate:c.serializeDate,skipNulls:typeof d.skipNulls=="boolean"?d.skipNulls:c.skipNulls,sort:typeof d.sort=="function"?d.sort:null,strictNullHandling:typeof d.strictNullHandling=="boolean"?d.strictNullHandling:c.strictNullHandling}};return qs=function(v,d){var m=v,y=g(d),_,C;typeof y.filter=="function"?(C=y.filter,m=C("",m)):o(y.filter)&&(C=y.filter,_=C);var x=[];if(typeof m!="object"||m===null)return"";var b=i[y.arrayFormat],E=b==="comma"&&y.commaRoundTrip;_||(_=Object.keys(m)),y.sort&&_.sort(y.sort);for(var A=r(),M=0;M<_.length;++M){var I=_[M],F=m[I];y.skipNulls&&F===null||a(x,h(F,I,b,E,y.allowEmptyArrays,y.strictNullHandling,y.skipNulls,y.encodeDotInKeys,y.encode?y.encoder:null,y.filter,y.sort,y.allowDots,y.serializeDate,y.format,y.formatter,y.encodeValuesOnly,y.charset,A))}var S=x.join(y.delimiter),X=y.addQueryPrefix===!0?"?":"";return y.charsetSentinel&&(y.charset==="iso-8859-1"?X+="utf8=%26%2310003%3B&":X+="utf8=%E2%9C%93&"),S.length>0?X+S:""},qs}var Ys,sf;function Kv(){if(sf)return Ys;sf=1;var r=Rd(),e=Object.prototype.hasOwnProperty,t=Array.isArray,n={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:r.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},i=function(p){return p.replace(/&#(\d+);/g,function(h,g){return String.fromCharCode(parseInt(g,10))})},o=function(p,h){return p&&typeof p=="string"&&h.comma&&p.indexOf(",")>-1?p.split(","):p},s="utf8=%26%2310003%3B",a="utf8=%E2%9C%93",l=function(h,g){var v={__proto__:null},d=g.ignoreQueryPrefix?h.replace(/^\?/,""):h;d=d.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var m=g.parameterLimit===1/0?void 0:g.parameterLimit,y=d.split(g.delimiter,m),_=-1,C,x=g.charset;if(g.charsetSentinel)for(C=0;C-1&&(I=t(I)?[I]:I);var F=e.call(v,M);F&&g.duplicates==="combine"?v[M]=r.combine(v[M],I):(!F||g.duplicates==="last")&&(v[M]=I)}return v},u=function(p,h,g,v){for(var d=v?h:o(h,g),m=p.length-1;m>=0;--m){var y,_=p[m];if(_==="[]"&&g.parseArrays)y=g.allowEmptyArrays&&(d===""||g.strictNullHandling&&d===null)?[]:[].concat(d);else{y=g.plainObjects?{__proto__:null}:{};var C=_.charAt(0)==="["&&_.charAt(_.length-1)==="]"?_.slice(1,-1):_,x=g.decodeDotInKeys?C.replace(/%2E/g,"."):C,b=parseInt(x,10);!g.parseArrays&&x===""?y={0:d}:!isNaN(b)&&_!==x&&String(b)===x&&b>=0&&g.parseArrays&&b<=g.arrayLimit?(y=[],y[b]=d):x!=="__proto__"&&(y[x]=d)}d=y}return d},c=function(h,g,v,d){if(h){var m=v.allowDots?h.replace(/\.([^.[]+)/g,"[$1]"):h,y=/(\[[^[\]]*])/,_=/(\[[^[\]]*])/g,C=v.depth>0&&y.exec(m),x=C?m.slice(0,C.index):m,b=[];if(x){if(!v.plainObjects&&e.call(Object.prototype,x)&&!v.allowPrototypes)return;b.push(x)}for(var E=0;v.depth>0&&(C=_.exec(m))!==null&&E"u"?n.charset:h.charset,v=typeof h.duplicates>"u"?n.duplicates:h.duplicates;if(v!=="combine"&&v!=="first"&&v!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var d=typeof h.allowDots>"u"?h.decodeDotInKeys===!0?!0:n.allowDots:!!h.allowDots;return{allowDots:d,allowEmptyArrays:typeof h.allowEmptyArrays=="boolean"?!!h.allowEmptyArrays:n.allowEmptyArrays,allowPrototypes:typeof h.allowPrototypes=="boolean"?h.allowPrototypes:n.allowPrototypes,allowSparse:typeof h.allowSparse=="boolean"?h.allowSparse:n.allowSparse,arrayLimit:typeof h.arrayLimit=="number"?h.arrayLimit:n.arrayLimit,charset:g,charsetSentinel:typeof h.charsetSentinel=="boolean"?h.charsetSentinel:n.charsetSentinel,comma:typeof h.comma=="boolean"?h.comma:n.comma,decodeDotInKeys:typeof h.decodeDotInKeys=="boolean"?h.decodeDotInKeys:n.decodeDotInKeys,decoder:typeof h.decoder=="function"?h.decoder:n.decoder,delimiter:typeof h.delimiter=="string"||r.isRegExp(h.delimiter)?h.delimiter:n.delimiter,depth:typeof h.depth=="number"||h.depth===!1?+h.depth:n.depth,duplicates:v,ignoreQueryPrefix:h.ignoreQueryPrefix===!0,interpretNumericEntities:typeof h.interpretNumericEntities=="boolean"?h.interpretNumericEntities:n.interpretNumericEntities,parameterLimit:typeof h.parameterLimit=="number"?h.parameterLimit:n.parameterLimit,parseArrays:h.parseArrays!==!1,plainObjects:typeof h.plainObjects=="boolean"?h.plainObjects:n.plainObjects,strictDepth:typeof h.strictDepth=="boolean"?!!h.strictDepth:n.strictDepth,strictNullHandling:typeof h.strictNullHandling=="boolean"?h.strictNullHandling:n.strictNullHandling}};return Ys=function(p,h){var g=f(h);if(p===""||p===null||typeof p>"u")return g.plainObjects?{__proto__:null}:{};for(var v=typeof p=="string"?l(p,g):p,d=g.plainObjects?{__proto__:null}:{},m=Object.keys(v),y=0;y",'"',"`"," ","\r",` +`," "],s=["{","}","|","\\","^","`"].concat(o),a=["'"].concat(s),l=["%","/","?",";","#"].concat(a),u=["/","?","#"],c=255,f=/^[+a-z0-9A-Z_-]{0,63}$/,p=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,h={javascript:!0,"javascript:":!0},g={javascript:!0,"javascript:":!0},v={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},d=Zv();function m(x,b,E){if(x&&typeof x=="object"&&x instanceof e)return x;var A=new e;return A.parse(x,b,E),A}e.prototype.parse=function(x,b,E){if(typeof x!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof x);var A=x.indexOf("?"),M=A!==-1&&A127?ue+="x":ue+=Q[de];if(!ue.match(f)){var O=k.slice(0,N),B=k.slice(N+1),W=Q.match(p);W&&(O.push(W[1]),B.unshift(W[2])),B.length&&(S="/"+B.join(".")+S),this.hostname=O.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),j||(this.hostname=r.toASCII(this.hostname));var oe=this.port?":"+this.port:"",ie=this.hostname||"";this.host=ie+oe,this.href+=this.host,j&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),S[0]!=="/"&&(S="/"+S))}if(!h[G])for(var N=0,ee=a.length;N0?E.host.split("@"):!1;ue&&(E.auth=ue.shift(),E.hostname=ue.shift(),E.host=E.hostname)}return E.search=x.search,E.query=x.query,(E.pathname!==null||E.search!==null)&&(E.path=(E.pathname?E.pathname:"")+(E.search?E.search:"")),E.href=E.format(),E}if(!k.length)return E.pathname=null,E.search?E.path="/"+E.search:E.path=null,E.href=E.format(),E;for(var de=k.slice(-1)[0],ne=(E.host||x.host||k.length>1)&&(de==="."||de==="..")||de==="",O=0,B=k.length;B>=0;B--)de=k[B],de==="."?k.splice(B,1):de===".."?(k.splice(B,1),O++):O&&(k.splice(B,1),O--);if(!D&&!j)for(;O--;O)k.unshift("..");D&&k[0]!==""&&(!k[0]||k[0].charAt(0)!=="/")&&k.unshift(""),ne&&k.join("/").substr(-1)!=="/"&&k.push("");var W=k[0]===""||k[0]&&k[0].charAt(0)==="/";if(Q){E.hostname=W?"":k.length?k.shift():"",E.host=E.hostname;var ue=E.host&&E.host.indexOf("@")>0?E.host.split("@"):!1;ue&&(E.auth=ue.shift(),E.hostname=ue.shift(),E.host=E.hostname)}return D=D||E.host&&k.length,D&&!W&&k.unshift(""),k.length>0?E.pathname=k.join("/"):(E.pathname=null,E.path=null),(E.pathname!==null||E.search!==null)&&(E.path=(E.pathname?E.pathname:"")+(E.search?E.search:"")),E.auth=x.auth||E.auth,E.slashes=E.slashes||x.slashes,E.href=E.format(),E},e.prototype.parseHost=function(){var x=this.host,b=n.exec(x);b&&(b=b[0],b!==":"&&(this.port=b.substr(1)),x=x.substr(0,x.length-b.length)),x&&(this.hostname=x)},Wn.parse=m,Wn.resolve=_,Wn.resolveObject=C,Wn.format=y,Wn.Url=e,Wn}var Zs=Jv();/*! + * @pixi/utils - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/utils is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */var Qo={parse:Zs.parse,format:Zs.format,resolve:Zs.resolve};Se.RETINA_PREFIX=/@([0-9\.]+)x/;Se.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var uf=!1,cf="6.5.10";function Qv(r){var e;if(!uf){if(Se.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var t=[` + %c %c %c PixiJS `+cf+" - ✰ "+r+` ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ + +`,"background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=globalThis.console).log.apply(e,t)}else globalThis.console&&globalThis.console.log("PixiJS "+cf+" - "+r+" - http://www.pixijs.com/");uf=!0}}var Js;function ey(){return typeof Js>"u"&&(Js=function(){var e={stencil:!0,failIfMajorPerformanceCaveat:Se.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!Se.ADAPTER.getWebGLRenderingContext())return!1;var t=Se.ADAPTER.createCanvas(),n=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),i=!!(n&&n.getContextAttributes().stencil);if(n){var o=n.getExtension("WEBGL_lose_context");o&&o.loseContext()}return n=null,i}catch{return!1}}()),Js}function en(r,e){return e===void 0&&(e=[]),e[0]=(r>>16&255)/255,e[1]=(r>>8&255)/255,e[2]=(r&255)/255,e}function ty(r){var e=r.toString(16);return e="000000".substring(0,6-e.length)+e,"#"+e}function rn(r){return(r[0]*255<<16)+(r[1]*255<<8)+(r[2]*255|0)}function ny(){for(var r=[],e=[],t=0;t<32;t++)r[t]=t,e[t]=t;r[Ce.NORMAL_NPM]=Ce.NORMAL,r[Ce.ADD_NPM]=Ce.ADD,r[Ce.SCREEN_NPM]=Ce.SCREEN,e[Ce.NORMAL]=Ce.NORMAL_NPM,e[Ce.ADD]=Ce.ADD_NPM,e[Ce.SCREEN]=Ce.SCREEN_NPM;var n=[];return n.push(e),n.push(r),n}var ry=ny();function iy(r,e){if(e===1)return(e*255<<24)+r;if(e===0)return 0;var t=r>>16&255,n=r>>8&255,i=r&255;return t=t*e+.5|0,n=n*e+.5|0,i=i*e+.5|0,(e*255<<24)+(t<<16)+(n<<8)+i}function Fd(r){if(r.BYTES_PER_ELEMENT===4)return r instanceof Float32Array?"Float32Array":r instanceof Uint32Array?"Uint32Array":"Int32Array";if(r.BYTES_PER_ELEMENT===2){if(r instanceof Uint16Array)return"Uint16Array"}else if(r.BYTES_PER_ELEMENT===1&&r instanceof Uint8Array)return"Uint8Array";return null}function Fo(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function ff(r){return!(r&r-1)&&!!r}function hf(r){var e=(r>65535?1:0)<<4;r>>>=e;var t=(r>255?1:0)<<3;return r>>>=t,e|=t,t=(r>15?1:0)<<2,r>>>=t,e|=t,t=(r>3?1:0)<<1,r>>>=t,e|=t,e|r>>1}function xo(r,e,t){var n=r.length,i;if(!(e>=n||t===0)){t=e+t>n?n-e:t;var o=n-t;for(i=e;i"u"?console.warn("PixiJS Deprecation Warning: ",e+` +Deprecated since v`+r):(n=n.split(` +`).splice(t).join(` +`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",e+` +Deprecated since v`+r),console.warn(n),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",e+` +Deprecated since v`+r),console.warn(n))),df[e]=!0}}var pf={},xn=Object.create(null),qn=Object.create(null);(function(){function r(e,t,n){this.canvas=Se.ADAPTER.createCanvas(),this.context=this.canvas.getContext("2d"),this.resolution=n||Se.RESOLUTION,this.resize(e,t)}return r.prototype.clear=function(){this.context.setTransform(1,0,0,1,0,0),this.context.clearRect(0,0,this.canvas.width,this.canvas.height)},r.prototype.resize=function(e,t){this.canvas.width=Math.round(e*this.resolution),this.canvas.height=Math.round(t*this.resolution)},r.prototype.destroy=function(){this.context=null,this.canvas=null},Object.defineProperty(r.prototype,"width",{get:function(){return this.canvas.width},set:function(e){this.canvas.width=Math.round(e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.canvas.height},set:function(e){this.canvas.height=Math.round(e)},enumerable:!1,configurable:!0}),r})();var Vi;function sy(r,e){if(e===void 0&&(e=globalThis.location),r.indexOf("data:")===0)return"";e=e||globalThis.location,Vi||(Vi=document.createElement("a")),Vi.href=r;var t=Qo.parse(Vi.href),n=!t.port&&e.port===""||t.port===e.port;return t.hostname!==e.hostname||!n||t.protocol!==e.protocol?"anonymous":""}function mf(r,e){var t=Se.RETINA_PREFIX.exec(r);return t?parseFloat(t[1]):e!==void 0?e:1}/*! + * @pixi/extensions - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/extensions is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var xi=function(){return xi=Object.assign||function(e){for(var t=arguments,n,i=1,o=arguments.length;i8)throw new Error("max arguments reached");var u=this,c=u.name,f=u.items;this._aliasCount++;for(var p=0,h=f.length;p0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},r.prototype.add=function(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this},r.prototype.remove=function(e){var t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this},r.prototype.contains=function(e){return this.items.indexOf(e)!==-1},r.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},r.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(r.prototype,"empty",{get:function(){return this.items.length===0},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),r}();Object.defineProperties(St.prototype,{dispatch:{value:St.prototype.emit},run:{value:St.prototype.emit}});/*! + * @pixi/ticker - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/ticker is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */Se.TARGET_FPMS=.06;var Pi;(function(r){r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY"})(Pi||(Pi={}));var Qs=function(){function r(e,t,n,i){t===void 0&&(t=null),n===void 0&&(n=0),i===void 0&&(i=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=n,this.once=i}return r.prototype.match=function(e,t){return t===void 0&&(t=null),this.fn===e&&this.context===t},r.prototype.emit=function(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));var t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t},r.prototype.connect=function(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this},r.prototype.destroy=function(e){e===void 0&&(e=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var t=this.next;return this.next=e?null:t,this.previous=null,t},r}(),wn=function(){function r(){var e=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new Qs(null,null,1/0),this.deltaMS=1/Se.TARGET_FPMS,this.elapsedMS=1/Se.TARGET_FPMS,this._tick=function(t){e._requestId=null,e.started&&(e.update(t),e.started&&e._requestId===null&&e._head.next&&(e._requestId=requestAnimationFrame(e._tick)))}}return r.prototype._requestIfNeeded=function(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},r.prototype._cancelIfNeeded=function(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)},r.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},r.prototype.add=function(e,t,n){return n===void 0&&(n=Pi.NORMAL),this._addListener(new Qs(e,t,n))},r.prototype.addOnce=function(e,t,n){return n===void 0&&(n=Pi.NORMAL),this._addListener(new Qs(e,t,n,!0))},r.prototype._addListener=function(e){var t=this._head.next,n=this._head;if(!t)e.connect(n);else{for(;t;){if(e.priority>t.priority){e.connect(n);break}n=t,t=t.next}e.previous||e.connect(n)}return this._startIfPossible(),this},r.prototype.remove=function(e,t){for(var n=this._head.next;n;)n.match(e,t)?n=n.destroy():n=n.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(r.prototype,"count",{get:function(){if(!this._head)return 0;for(var e=0,t=this._head;t=t.next;)e++;return e},enumerable:!1,configurable:!0}),r.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},r.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},r.prototype.destroy=function(){if(!this._protected){this.stop();for(var e=this._head.next;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}},r.prototype.update=function(e){e===void 0&&(e=performance.now());var t;if(e>this.lastTime){if(t=this.elapsedMS=e-this.lastTime,t>this._maxElapsedMS&&(t=this._maxElapsedMS),t*=this.speed,this._minElapsedMS){var n=e-this._lastFrame|0;if(n=this.x&&e=this.y&&te.right?e.right:this.right;if(i<=n)return!1;var o=this.ye.bottom?e.bottom:this.bottom;return s>o}var a=this.left,l=this.right,u=this.top,c=this.bottom;if(l<=a||c<=u)return!1;var f=Gi[0].set(e.left,e.top),p=Gi[1].set(e.left,e.bottom),h=Gi[2].set(e.right,e.top),g=Gi[3].set(e.right,e.bottom);if(h.x<=f.x||p.y<=f.y)return!1;var v=Math.sign(t.a*t.d-t.b*t.c);if(v===0||(t.apply(f,f),t.apply(p,p),t.apply(h,h),t.apply(g,g),Math.max(f.x,p.x,h.x,g.x)<=a||Math.min(f.x,p.x,h.x,g.x)>=l||Math.max(f.y,p.y,h.y,g.y)<=u||Math.min(f.y,p.y,h.y,g.y)>=c))return!1;var d=v*(p.y-f.y),m=v*(f.x-p.x),y=d*a+m*u,_=d*l+m*u,C=d*a+m*c,x=d*l+m*c;if(Math.max(y,_,C,x)<=d*f.x+m*f.y||Math.min(y,_,C,x)>=d*g.x+m*g.y)return!1;var b=v*(f.y-h.y),E=v*(h.x-f.x),A=b*a+E*u,M=b*l+E*u,I=b*a+E*c,F=b*l+E*c;return!(Math.max(A,M,I,F)<=b*f.x+E*f.y||Math.min(A,M,I,F)>=b*g.x+E*g.y)},r.prototype.pad=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this},r.prototype.fit=function(e){var t=Math.max(this.x,e.x),n=Math.min(this.x+this.width,e.x+e.width),i=Math.max(this.y,e.y),o=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(n-t,0),this.y=i,this.height=Math.max(o-i,0),this},r.prototype.ceil=function(e,t){e===void 0&&(e=1),t===void 0&&(t=.001);var n=Math.ceil((this.x+this.width-t)*e)/e,i=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=n-this.x,this.height=i-this.y,this},r.prototype.enlarge=function(e){var t=Math.min(this.x,e.x),n=Math.max(this.x+this.width,e.x+e.width),i=Math.min(this.y,e.y),o=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=n-t,this.y=i,this.height=o-i,this},r.prototype.toString=function(){return"[@pixi/math:Rectangle x="+this.x+" y="+this.y+" width="+this.width+" height="+this.height+"]"},r}(),Nr=function(){function r(e,t,n,i){n===void 0&&(n=0),i===void 0&&(i=0),this._x=n,this._y=i,this.cb=e,this.scope=t}return r.prototype.clone=function(e,t){return e===void 0&&(e=this.cb),t===void 0&&(t=this.scope),new r(e,t,this._x,this._y)},r.prototype.set=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=e),(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this},r.prototype.copyFrom=function(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this},r.prototype.copyTo=function(e){return e.set(this._x,this._y),e},r.prototype.equals=function(e){return e.x===this._x&&e.y===this._y},r.prototype.toString=function(){return"[@pixi/math:ObservablePoint x=0 y=0 scope="+this.scope+"]"},Object.defineProperty(r.prototype,"x",{get:function(){return this._x},set:function(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"y",{get:function(){return this._y},set:function(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),r}(),Et=function(){function r(e,t,n,i,o,s){e===void 0&&(e=1),t===void 0&&(t=0),n===void 0&&(n=0),i===void 0&&(i=1),o===void 0&&(o=0),s===void 0&&(s=0),this.array=null,this.a=e,this.b=t,this.c=n,this.d=i,this.tx=o,this.ty=s}return r.prototype.fromArray=function(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]},r.prototype.set=function(e,t,n,i,o,s){return this.a=e,this.b=t,this.c=n,this.d=i,this.tx=o,this.ty=s,this},r.prototype.toArray=function(e,t){this.array||(this.array=new Float32Array(9));var n=t||this.array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n},r.prototype.apply=function(e,t){t=t||new at;var n=e.x,i=e.y;return t.x=this.a*n+this.c*i+this.tx,t.y=this.b*n+this.d*i+this.ty,t},r.prototype.applyInverse=function(e,t){t=t||new at;var n=1/(this.a*this.d+this.c*-this.b),i=e.x,o=e.y;return t.x=this.d*n*i+-this.c*n*o+(this.ty*this.c-this.tx*this.d)*n,t.y=this.a*n*o+-this.b*n*i+(-this.ty*this.a+this.tx*this.b)*n,t},r.prototype.translate=function(e,t){return this.tx+=e,this.ty+=t,this},r.prototype.scale=function(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this},r.prototype.rotate=function(e){var t=Math.cos(e),n=Math.sin(e),i=this.a,o=this.c,s=this.tx;return this.a=i*t-this.b*n,this.b=i*n+this.b*t,this.c=o*t-this.d*n,this.d=o*n+this.d*t,this.tx=s*t-this.ty*n,this.ty=s*n+this.ty*t,this},r.prototype.append=function(e){var t=this.a,n=this.b,i=this.c,o=this.d;return this.a=e.a*t+e.b*i,this.b=e.a*n+e.b*o,this.c=e.c*t+e.d*i,this.d=e.c*n+e.d*o,this.tx=e.tx*t+e.ty*i+this.tx,this.ty=e.tx*n+e.ty*o+this.ty,this},r.prototype.setTransform=function(e,t,n,i,o,s,a,l,u){return this.a=Math.cos(a+u)*o,this.b=Math.sin(a+u)*o,this.c=-Math.sin(a-l)*s,this.d=Math.cos(a-l)*s,this.tx=e-(n*this.a+i*this.c),this.ty=t-(n*this.b+i*this.d),this},r.prototype.prepend=function(e){var t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){var n=this.a,i=this.c;this.a=n*e.a+this.b*e.c,this.b=n*e.b+this.b*e.d,this.c=i*e.a+this.d*e.c,this.d=i*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this},r.prototype.decompose=function(e){var t=this.a,n=this.b,i=this.c,o=this.d,s=e.pivot,a=-Math.atan2(-i,o),l=Math.atan2(n,t),u=Math.abs(a+l);return u<1e-5||Math.abs(ly-u)<1e-5?(e.rotation=l,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=a,e.skew.y=l),e.scale.x=Math.sqrt(t*t+n*n),e.scale.y=Math.sqrt(i*i+o*o),e.position.x=this.tx+(s.x*t+s.y*i),e.position.y=this.ty+(s.x*n+s.y*o),e},r.prototype.invert=function(){var e=this.a,t=this.b,n=this.c,i=this.d,o=this.tx,s=e*i-t*n;return this.a=i/s,this.b=-t/s,this.c=-n/s,this.d=e/s,this.tx=(n*this.ty-i*o)/s,this.ty=-(e*this.ty-t*o)/s,this},r.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},r.prototype.clone=function(){var e=new r;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyTo=function(e){return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},r.prototype.copyFrom=function(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this},r.prototype.toString=function(){return"[@pixi/math:Matrix a="+this.a+" b="+this.b+" c="+this.c+" d="+this.d+" tx="+this.tx+" ty="+this.ty+"]"},Object.defineProperty(r,"IDENTITY",{get:function(){return new r},enumerable:!1,configurable:!0}),Object.defineProperty(r,"TEMP_MATRIX",{get:function(){return new r},enumerable:!1,configurable:!0}),r}(),er=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],tr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],nr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],rr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Wa=[],Ld=[],$i=Math.sign;function cy(){for(var r=0;r<16;r++){var e=[];Wa.push(e);for(var t=0;t<16;t++)for(var n=$i(er[r]*er[t]+nr[r]*tr[t]),i=$i(tr[r]*er[t]+rr[r]*tr[t]),o=$i(er[r]*nr[t]+nr[r]*rr[t]),s=$i(tr[r]*nr[t]+rr[r]*rr[t]),a=0;a<16;a++)if(er[a]===n&&tr[a]===i&&nr[a]===o&&rr[a]===s){e.push(a);break}}for(var r=0;r<16;r++){var l=new Et;l.set(er[r],tr[r],nr[r],rr[r],0,0),Ld.push(l)}}cy();var ot={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(r){return er[r]},uY:function(r){return tr[r]},vX:function(r){return nr[r]},vY:function(r){return rr[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,e){return Wa[r][e]},sub:function(r,e){return Wa[r][ot.inv(e)]},rotate180:function(r){return r^4},isVertical:function(r){return(r&3)===2},byDirection:function(r,e){return Math.abs(r)*2<=Math.abs(e)?e>=0?ot.S:ot.N:Math.abs(e)*2<=Math.abs(r)?r>0?ot.E:ot.W:e>0?r>0?ot.SE:ot.SW:r>0?ot.NE:ot.NW},matrixAppendRotationInv:function(r,e,t,n){t===void 0&&(t=0),n===void 0&&(n=0);var i=Ld[ot.inv(e)];i.tx=t,i.ty=n,r.append(i)}},Nd=function(){function r(){this.worldTransform=new Et,this.localTransform=new Et,this.position=new Nr(this.onChange,this,0,0),this.scale=new Nr(this.onChange,this,1,1),this.pivot=new Nr(this.onChange,this,0,0),this.skew=new Nr(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return r.prototype.onChange=function(){this._localID++},r.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},r.prototype.toString=function(){return"[@pixi/math:Transform "+("position=("+this.position.x+", "+this.position.y+") ")+("rotation="+this.rotation+" ")+("scale=("+this.scale.x+", "+this.scale.y+") ")+("skew=("+this.skew.x+", "+this.skew.y+") ")+"]"},r.prototype.updateLocalTransform=function(){var e=this.localTransform;this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1)},r.prototype.updateTransform=function(e){var t=this.localTransform;if(this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==e._worldID){var n=e.worldTransform,i=this.worldTransform;i.a=t.a*n.a+t.b*n.c,i.b=t.a*n.b+t.b*n.d,i.c=t.c*n.a+t.d*n.c,i.d=t.c*n.b+t.d*n.d,i.tx=t.tx*n.a+t.ty*n.c+n.tx,i.ty=t.tx*n.b+t.ty*n.d+n.ty,this._parentID=e._worldID,this._worldID++}},r.prototype.setFromMatrix=function(e){e.decompose(this),this._localID++},Object.defineProperty(r.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation!==e&&(this._rotation=e,this.updateSkew())},enumerable:!1,configurable:!0}),r.IDENTITY=new r,r}();/*! + * @pixi/core - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/core is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + */Se.PREFER_ENV=cr.any?An.WEBGL:An.WEBGL2;Se.STRICT_TEXTURE_CACHE=!1;var qa=[];function Dd(r,e){if(!r)return null;var t="";if(typeof r=="string"){var n=/\.(\w{3,4})(?:$|\?|#)/i.exec(r);n&&(t=n[1].toLowerCase())}for(var i=qa.length-1;i>=0;--i){var o=qa[i];if(o.test&&o.test(r,t))return new o(r,e)}throw new Error("Unrecognized source type to auto-detect Resource")}/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Ya=function(r,e){return Ya=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Ya(r,e)};function et(r,e){Ya(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ka=function(){return Ka=Object.assign||function(e){for(var t=arguments,n,i=1,o=arguments.length;i0&&c>0,i.textureCacheIds=[],i.destroyed=!1,i.resource=null,i._batchEnabled=0,i._batchLocation=0,i.parentTextureArray=null,i.setResource(t),i}return Object.defineProperty(e.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mipmap",{get:function(){return this._mipmap},set:function(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),e.prototype.setStyle=function(t,n){var i;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,i=!0),n!==void 0&&n!==this.mipmap&&(this.mipmap=n,i=!0),i&&this.dirtyStyleId++,this},e.prototype.setSize=function(t,n,i){return i=i||this.resolution,this.setRealSize(t*i,n*i,i)},e.prototype.setRealSize=function(t,n,i){return this.resolution=i||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(n)/this.resolution,this._refreshPOT(),this.update(),this},e.prototype._refreshPOT=function(){this.isPowerOfTwo=ff(this.realWidth)&&ff(this.realHeight)},e.prototype.setResolution=function(t){var n=this.resolution;return n===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*n)/t,this.height=Math.round(this.height*n)/t,this.emit("update",this)),this._refreshPOT(),this)},e.prototype.setResource=function(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this},e.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},e.prototype.onError=function(t){this.emit("error",this,t)},e.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete qn[this.cacheId],delete xn[this.cacheId],this.cacheId=null),this.dispose(),e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},e.prototype.dispose=function(){this.emit("dispose",this)},e.prototype.castToBaseTexture=function(){return this},e.from=function(t,n,i){i===void 0&&(i=Se.STRICT_TEXTURE_CACHE);var o=typeof t=="string",s=null;if(o)s=t;else{if(!t._pixiId){var a=n&&n.pixiIdPrefix||"pixiid";t._pixiId=a+"_"+Ii()}s=t._pixiId}var l=qn[s];if(o&&i&&!l)throw new Error('The cacheId "'+s+'" does not exist in BaseTextureCache.');return l||(l=new e(t,n),l.cacheId=s,e.addToCache(l,s)),l},e.fromBuffer=function(t,n,i,o){t=t||new Float32Array(n*i*4);var s=new hu(t,{width:n,height:i}),a=t instanceof Float32Array?$e.FLOAT:$e.UNSIGNED_BYTE;return new e(s,Object.assign({},hy,o||{width:n,height:i,type:a}))},e.addToCache=function(t,n){n&&(t.textureCacheIds.indexOf(n)===-1&&t.textureCacheIds.push(n),qn[n]&&console.warn("BaseTexture added to the cache with an id ["+n+"] that already had an entry"),qn[n]=t)},e.removeFromCache=function(t){if(typeof t=="string"){var n=qn[t];if(n){var i=n.textureCacheIds.indexOf(t);return i>-1&&n.textureCacheIds.splice(i,1),delete qn[t],n}}else if(t&&t.textureCacheIds){for(var o=0;o0)if(t.resource)this.addResourceAt(t.resource,n);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=hr.TEXTURE_CUBE_MAP_POSITIVE_X+n,t.parentTextureArray=this.baseTexture,this.items[n]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[n]=t,this},e.prototype.upload=function(t,n,i){for(var o=this.itemDirtyIds,s=0;s)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(Vn),vy=function(r){et(e,r);function e(t,n){var i=this;if(n=n||{},!(t instanceof HTMLVideoElement)){var o=document.createElement("video");o.setAttribute("preload","auto"),o.setAttribute("webkit-playsinline",""),o.setAttribute("playsinline",""),typeof t=="string"&&(t=[t]);var s=t[0].src||t[0];Vn.crossOrigin(o,s,n.crossorigin);for(var a=0;a2},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(wn.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(wn.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var n=this.valid;this.resize(t.videoWidth,t.videoHeight),!n&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&(wn.shared.remove(this.update,this),this._isConnectedToTicker=!1);var t=this.source;t&&(t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),r.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(wn.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(wn.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),e.test=function(t,n){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||e.TYPES.indexOf(n)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(Vn),yy=function(r){et(e,r);function e(t){return r.call(this,t)||this}return e.test=function(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap<"u"&&t instanceof ImageBitmap},e}(Vn);qa.push(Ud,yy,py,vy,gy,hu,my,dy);var _y=function(r){et(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.upload=function(t,n,i){var o=t.gl;o.pixelStorei(o.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n.alphaMode===jn.UNPACK);var s=n.realWidth,a=n.realHeight;return i.width===s&&i.height===a?o.texSubImage2D(n.target,0,0,0,s,a,n.format,i.type,this.data):(i.width=s,i.height=a,o.texImage2D(n.target,0,i.internalFormat,s,a,0,n.format,i.type,this.data)),!0},e}(hu),Za=function(){function r(e,t){this.width=Math.round(e||100),this.height=Math.round(t||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new St("disposeFramebuffer"),this.multisample=dt.NONE}return Object.defineProperty(r.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),r.prototype.addColorTexture=function(e,t){return e===void 0&&(e=0),this.colorTextures[e]=t||new yt(null,{scaleMode:Bt.NEAREST,resolution:1,mipmap:hn.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.addDepthTexture=function(e){return this.depthTexture=e||new yt(new _y(null,{width:this.width,height:this.height}),{scaleMode:Bt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:hn.OFF,format:Te.DEPTH_COMPONENT,type:$e.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},r.prototype.resize=function(e,t){if(e=Math.round(e),t=Math.round(t),!(e===this.width&&t===this.height)){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(var n=0;n-1&&n.textureCacheIds.splice(i,1),delete xn[t],n}}else if(t&&t.textureCacheIds){for(var o=0;othis.baseTexture.width,l=i+s>this.baseTexture.height;if(a||l){var u=a&&l?"and":"or",c="X: "+n+" + "+o+" = "+(n+o)+" > "+this.baseTexture.width,f="Y: "+i+" + "+s+" = "+(i+s)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+(c+" "+u+" "+f))}this.valid=o&&s&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(e,"EMPTY",{get:function(){return e._EMPTY||(e._EMPTY=new e(new yt),Hi(e._EMPTY),Hi(e._EMPTY.baseTexture)),e._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"WHITE",{get:function(){if(!e._WHITE){var t=Se.ADAPTER.createCanvas(16,16),n=t.getContext("2d");t.width=16,t.height=16,n.fillStyle="white",n.fillRect(0,0,16,16),e._WHITE=new e(yt.from(t)),Hi(e._WHITE),Hi(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(_r),du=function(r){et(e,r);function e(t,n){var i=r.call(this,t,n)||this;return i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(t){this.framebuffer.multisample=t},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,n,i){i===void 0&&(i=!0);var o=this.baseTexture.resolution,s=Math.round(t*o)/o,a=Math.round(n*o)/o;this.valid=s>0&&a>0,this._frame.width=this.orig.width=s,this._frame.height=this.orig.height=a,i&&this.baseTexture.resize(s,a),this.updateUvs()},e.prototype.setResolution=function(t){var n=this.baseTexture;n.resolution!==t&&(n.setResolution(t),this.resize(n.width,n.height,!1))},e.create=function(t){for(var n=arguments,i=[],o=1;o>>0,i>1&&(o+=i*4294967296)):o=i>1?-i:-1,this.texturePool[o]||(this.texturePool[o]=[]);var s=this.texturePool[o].pop();return s||(s=this.createTexture(e,t,i)),s.filterPoolKey=o,s.setResolution(n),s},r.prototype.getFilterTexture=function(e,t,n){var i=this.getOptimalTexture(e.width,e.height,t||e.resolution,n||dt.NONE);return i.filterFrame=e.filterFrame,i},r.prototype.returnTexture=function(e){var t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)},r.prototype.returnFilterTexture=function(e){this.returnTexture(e)},r.prototype.clear=function(e){if(e=e!==!1,e)for(var t in this.texturePool){var n=this.texturePool[t];if(n)for(var i=0;i0&&e.height>0;for(var t in this.texturePool)if(Number(t)<0){var n=this.texturePool[t];if(n)for(var i=0;i1){for(var c=0;c1&&(f=this.getOptimalFilterTexture(c.width,c.height,t.resolution),f.filterFrame=c.filterFrame),n[p].apply(this,c,f,nn.CLEAR,t);var h=c;c=f,f=h}n[p].apply(this,c,u.renderTexture,nn.BLEND,t),p>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(f)}t.clear(),this.statePool.push(t)},r.prototype.bindAndClear=function(e,t){t===void 0&&(t=nn.CLEAR);var n=this.renderer,i=n.renderTexture,o=n.state;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e&&e.filterFrame){var s=this.tempRect;s.x=0,s.y=0,s.width=e.filterFrame.width,s.height=e.filterFrame.height,i.bind(e,e.filterFrame,s)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?i.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var a=o.stateId&1||this.forceClear;(t===nn.CLEAR||t===nn.BLIT&&a)&&this.renderer.framebuffer.clear(0,0,0,0)},r.prototype.applyFilter=function(e,t,n,i){var o=this.renderer;o.state.set(e.state),this.bindAndClear(n,i),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(Ai.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(Ai.TRIANGLE_STRIP))},r.prototype.calculateSpriteMatrix=function(e,t){var n=this.activeState,i=n.sourceFrame,o=n.destinationFrame,s=t._texture.orig,a=e.set(o.width,0,0,o.height,i.x,i.y),l=t.worldTransform.copyTo(Et.TEMP_MATRIX);return l.invert(),a.prepend(l),a.scale(1/s.width,1/s.height),a.translate(t.anchor.x,t.anchor.y),a},r.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},r.prototype.getOptimalFilterTexture=function(e,t,n,i){return n===void 0&&(n=1),i===void 0&&(i=dt.NONE),this.texturePool.getOptimalTexture(e,t,n,i)},r.prototype.getFilterTexture=function(e,t,n){if(typeof e=="number"){var i=e;e=t,t=i}e=e||this.activeState.renderTexture;var o=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,n||dt.NONE);return o.filterFrame=e.filterFrame,o},r.prototype.returnFilterTexture=function(e){this.texturePool.returnTexture(e)},r.prototype.emptyPool=function(){this.texturePool.clear(!0)},r.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},r.prototype.transformAABB=function(e,t){var n=Xi[0],i=Xi[1],o=Xi[2],s=Xi[3];n.set(t.left,t.top),i.set(t.left,t.bottom),o.set(t.right,t.top),s.set(t.right,t.bottom),e.apply(n,n),e.apply(i,i),e.apply(o,o),e.apply(s,s);var a=Math.min(n.x,i.x,o.x,s.x),l=Math.min(n.y,i.y,o.y,s.y),u=Math.max(n.x,i.x,o.x,s.x),c=Math.max(n.y,i.y,o.y,s.y);t.x=a,t.y=l,t.width=u-a,t.height=c-l},r.prototype.roundFrame=function(e,t,n,i,o){if(!(e.width<=0||e.height<=0||n.width<=0||n.height<=0)){if(o){var s=o.a,a=o.b,l=o.c,u=o.d;if((Math.abs(a)>1e-4||Math.abs(l)>1e-4)&&(Math.abs(s)>1e-4||Math.abs(u)>1e-4))return}o=o?ea.copyFrom(o):ea.identity(),o.translate(-n.x,-n.y).scale(i.width/n.width,i.height/n.height).translate(i.x,i.y),this.transformAABB(o,e),e.ceil(t),this.transformAABB(o.invert(),e)}},r}(),Vd=function(){function r(e){this.renderer=e}return r.prototype.flush=function(){},r.prototype.destroy=function(){this.renderer=null},r.prototype.start=function(){},r.prototype.stop=function(){this.flush()},r.prototype.render=function(e){},r}(),ky=function(){function r(e){this.renderer=e,this.emptyRenderer=new Vd(e),this.currentRenderer=this.emptyRenderer}return r.prototype.setObjectRenderer=function(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())},r.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},r.prototype.copyBoundTextures=function(e,t){for(var n=this.renderer.texture.boundTextures,i=t-1;i>=0;--i)e[i]=n[i]||null,e[i]&&(e[i]._batchLocation=i)},r.prototype.boundArray=function(e,t,n,i){for(var o=e.elements,s=e.ids,a=e.count,l=0,u=0;u=0&&f=An.WEBGL2&&(n=e.getContext("webgl2",t)),n)this.webGLVersion=2;else if(this.webGLVersion=1,n=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),!n)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=n,this.getExtensions(),this.gl},r.prototype.getExtensions=function(){var e=this.gl,t={loseContext:e.getExtension("WEBGL_lose_context"),anisotropicFiltering:e.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),s3tc:e.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:e.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:e.getExtension("WEBGL_compressed_texture_etc"),etc1:e.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:e.getExtension("WEBGL_compressed_texture_pvrtc")||e.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:e.getExtension("WEBGL_compressed_texture_atc"),astc:e.getExtension("WEBGL_compressed_texture_astc")};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension("WEBGL_draw_buffers"),depthTexture:e.getExtension("WEBGL_depth_texture"),vertexArrayObject:e.getExtension("OES_vertex_array_object")||e.getExtension("MOZ_OES_vertex_array_object")||e.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:e.getExtension("OES_element_index_uint"),floatTexture:e.getExtension("OES_texture_float"),floatTextureLinear:e.getExtension("OES_texture_float_linear"),textureHalfFloat:e.getExtension("OES_texture_half_float"),textureHalfFloatLinear:e.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension("EXT_color_buffer_float")})},r.prototype.handleContextLost=function(e){var t=this;e.preventDefault(),setTimeout(function(){t.gl.isContextLost()&&t.extensions.loseContext&&t.extensions.loseContext.restoreContext()},0)},r.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},r.prototype.destroy=function(){var e=this.renderer.view;this.renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},r.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},r.prototype.validateContext=function(e){var t=e.getContextAttributes(),n="WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext;n&&(this.webGLVersion=2),t&&!t.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=n||!!e.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},r}(),Ry=function(){function r(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=dt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return r}(),Fy=new pt,Ly=function(){function r(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new Za(10,10),this.msaaSamples=null}return r.prototype.contextChange=function(){this.disposeAll(!0);var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new pt,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){var t=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;Se.PREFER_ENV===An.WEBGL_LEGACY&&(t=null,n=null),t?e.drawBuffers=function(i){return t.drawBuffersWEBGL(i)}:(this.hasMRT=!1,e.drawBuffers=function(){}),n||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},r.prototype.bind=function(e,t,n){n===void 0&&(n=0);var i=this.gl;if(e){var o=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,i.bindFramebuffer(i.FRAMEBUFFER,o.framebuffer)),o.mipLevel!==n&&(e.dirtyId++,e.dirtyFormat++,o.mipLevel=n),o.dirtyId!==e.dirtyId&&(o.dirtyId=e.dirtyId,o.dirtyFormat!==e.dirtyFormat?(o.dirtyFormat=e.dirtyFormat,o.dirtySize=e.dirtySize,this.updateFramebuffer(e,n)):o.dirtySize!==e.dirtySize&&(o.dirtySize=e.dirtySize,this.resizeFramebuffer(e)));for(var s=0;s>n,u=t.height>>n,c=l/t.width;this.setViewport(t.x*c,t.y*c,l,u)}else{var l=e.width>>n,u=e.height>>n;this.setViewport(0,0,l,u)}}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},r.prototype.setViewport=function(e,t,n,i){var o=this.viewport;e=Math.round(e),t=Math.round(t),n=Math.round(n),i=Math.round(i),(o.width!==n||o.height!==i||o.x!==e||o.y!==t)&&(o.x=e,o.y=t,o.width=n,o.height=i,this.gl.viewport(e,t,n,i))},Object.defineProperty(r.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),r.prototype.clear=function(e,t,n,i,o){o===void 0&&(o=Mo.COLOR|Mo.DEPTH);var s=this.gl;s.clearColor(e,t,n,i),s.clear(o)},r.prototype.initFramebuffer=function(e){var t=this.gl,n=new Ry(t.createFramebuffer());return n.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=n,this.managedFramebuffers.push(e),e.disposeRunner.add(this),n},r.prototype.resizeFramebuffer=function(e){var t=this.gl,n=e.glFramebuffers[this.CONTEXT_UID];n.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,n.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,n.multisample,t.RGBA8,e.width,e.height)),n.stencil&&(t.bindRenderbuffer(t.RENDERBUFFER,n.stencil),n.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,n.multisample,t.DEPTH24_STENCIL8,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,t.DEPTH_STENCIL,e.width,e.height));var i=e.colorTextures,o=i.length;t.drawBuffers||(o=Math.min(o,1));for(var s=0;s1&&this.canMultisampleFramebuffer(e)?(i.msaaBuffer=i.msaaBuffer||n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,i.msaaBuffer),n.renderbufferStorageMultisample(n.RENDERBUFFER,i.multisample,n.RGBA8,e.width,e.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,i.msaaBuffer)):i.msaaBuffer&&(n.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));for(var a=[],l=0;l1&&n.drawBuffers(a),e.depthTexture){var f=this.writeDepthTexture;if(f){var p=e.depthTexture;this.renderer.texture.bind(p,0),n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,p._glTextures[this.CONTEXT_UID].texture,t)}}(e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)?(i.stencil=i.stencil||n.createRenderbuffer(),n.bindRenderbuffer(n.RENDERBUFFER,i.stencil),i.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,i.multisample,n.DEPTH24_STENCIL8,e.width,e.height):n.renderbufferStorage(n.RENDERBUFFER,n.DEPTH_STENCIL,e.width,e.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.DEPTH_STENCIL_ATTACHMENT,n.RENDERBUFFER,i.stencil)):i.stencil&&(n.deleteRenderbuffer(i.stencil),i.stencil=null)},r.prototype.canMultisampleFramebuffer=function(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture},r.prototype.detectSamples=function(e){var t=this.msaaSamples,n=dt.NONE;if(e<=1||t===null)return n;for(var i=0;i=0&&this.managedFramebuffers.splice(o,1),e.disposeRunner.remove(this),t||(i.deleteFramebuffer(n.framebuffer),n.msaaBuffer&&i.deleteRenderbuffer(n.msaaBuffer),n.stencil&&i.deleteRenderbuffer(n.stencil)),n.blitFramebuffer&&n.blitFramebuffer.dispose()}},r.prototype.disposeAll=function(e){var t=this.managedFramebuffers;this.managedFramebuffers=[];for(var n=0;n=An.WEBGL2&&(e=r.getContext("webgl2",{})),e||(e=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),ri=e}return ri}var Wi;function zy(){if(!Wi){Wi=Ut.MEDIUM;var r=Uy();if(r&&r.getShaderPrecisionFormat){var e=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);Wi=e.precision?Ut.HIGH:Ut.MEDIUM}}return Wi}function Tf(r,e,t){if(r.substring(0,9)!=="precision"){var n=e;return e===Ut.HIGH&&t!==Ut.HIGH&&(n=Ut.MEDIUM),"precision "+n+` float; +`+r}else if(t!==Ut.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var jy={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Hd(r){return jy[r]}var qi=null,Sf={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function Xd(r,e){if(!qi){var t=Object.keys(Sf);qi={};for(var n=0;n0&&(e+=` +else `),t"u"?.5:t,this.isSimple=!1}return Object.defineProperty(r.prototype,"texture",{get:function(){return this._texture},set:function(e){this._texture=e,this._textureID=-1},enumerable:!1,configurable:!0}),r.prototype.multiplyUvs=function(e,t){t===void 0&&(t=e);for(var n=this.mapCoord,i=0;i0?this.maskStack[this.maskStack.length-1]._colorMask:15;n!==t&&this.renderer.gl.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)},r.prototype.destroy=function(){this.renderer=null},r}(),qd=function(){function r(e){this.renderer=e,this.maskStack=[],this.glConst=0}return r.prototype.getStackLength=function(){return this.maskStack.length},r.prototype.setMaskStack=function(e){var t=this.renderer.gl,n=this.getStackLength();this.maskStack=e;var i=this.getStackLength();i!==n&&(i===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))},r.prototype._useCurrent=function(){},r.prototype.destroy=function(){this.renderer=null,this.maskStack=null},r}(),Cf=new Et,Af=[],o0=function(r){et(e,r);function e(t){var n=r.call(this,t)||this;return n.glConst=Se.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,n}return e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0},e.prototype.calcScissorRect=function(t){var n;if(!t._scissorRectLocal){var i=t._scissorRect,o=t.maskObject,s=this.renderer,a=s.renderTexture,l=o.getBounds(!0,(n=Af.pop())!==null&&n!==void 0?n:new pt);this.roundFrameToPixels(l,a.current?a.current.resolution:s.resolution,a.sourceFrame,a.destinationFrame,s.projection.transform),i&&l.fit(i),t._scissorRectLocal=l}},e.isMatrixRotated=function(t){if(!t)return!1;var n=t.a,i=t.b,o=t.c,s=t.d;return(Math.abs(i)>1e-4||Math.abs(o)>1e-4)&&(Math.abs(n)>1e-4||Math.abs(s)>1e-4)},e.prototype.testScissor=function(t){var n=t.maskObject;if(!n.isFastRect||!n.isFastRect()||e.isMatrixRotated(n.worldTransform)||e.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);var i=t._scissorRectLocal;return i.width>0&&i.height>0},e.prototype.roundFrameToPixels=function(t,n,i,o,s){e.isMatrixRotated(s)||(s=s?Cf.copyFrom(s):Cf.identity(),s.translate(-i.x,-i.y).scale(o.width/i.width,o.height/i.height).translate(o.x,o.y),this.renderer.filter.transformAABB(s,t),t.fit(o),t.x=Math.round(t.x*n),t.y=Math.round(t.y*n),t.width=Math.round(t.width*n),t.height=Math.round(t.height*n))},e.prototype.push=function(t){t._scissorRectLocal||this.calcScissorRect(t);var n=this.renderer.gl;t._scissorRect||n.enable(n.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()},e.prototype.pop=function(t){var n=this.renderer.gl;t&&Af.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():n.disable(n.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t=this.maskStack[this.maskStack.length-1]._scissorRect,n;this.renderer.renderTexture.current?n=t.y:n=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,n,t.width,t.height)},e}(qd),s0=function(r){et(e,r);function e(t){var n=r.call(this,t)||this;return n.glConst=Se.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,n}return e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var n=t.maskObject,i=this.renderer.gl,o=t._stencilCounter;o===0&&(this.renderer.framebuffer.forceStencil(),i.clearStencil(0),i.clear(i.STENCIL_BUFFER_BIT),i.enable(i.STENCIL_TEST)),t._stencilCounter++;var s=t._colorMask;s!==0&&(t._colorMask=0,i.colorMask(!1,!1,!1,!1)),i.stencilFunc(i.EQUAL,o,4294967295),i.stencilOp(i.KEEP,i.KEEP,i.INCR),n.renderable=!0,n.render(this.renderer),this.renderer.batch.flush(),n.renderable=!1,s!==0&&(t._colorMask=s,i.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)),this._useCurrent()},e.prototype.pop=function(t){var n=this.renderer.gl;if(this.getStackLength()===0)n.disable(n.STENCIL_TEST);else{var i=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,o=i?i._colorMask:15;o!==0&&(i._colorMask=0,n.colorMask(!1,!1,!1,!1)),n.stencilOp(n.KEEP,n.KEEP,n.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,o!==0&&(i._colorMask=o,n.colorMask((o&1)!==0,(o&2)!==0,(o&4)!==0,(o&8)!==0)),this._useCurrent()}},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e}(qd),a0=function(){function r(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Et,this.transform=null}return r.prototype.update=function(e,t,n,i){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,n,i),this.transform&&this.projectionMatrix.append(this.transform);var o=this.renderer;o.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,o.globalUniforms.update(),o.shader.shader&&o.shader.syncUniformGroup(o.shader.shader.uniforms.globals)},r.prototype.calculateProjection=function(e,t,n,i){var o=this.projectionMatrix,s=i?-1:1;o.identity(),o.a=1/t.width*2,o.d=s*(1/t.height*2),o.tx=-1-t.x*o.a,o.ty=-s-t.y*o.d},r.prototype.setTransform=function(e){},r.prototype.destroy=function(){this.renderer=null},r}(),Yn=new pt,oi=new pt,l0=function(){function r(e){this.renderer=e,this.clearColor=e._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new pt,this.destinationFrame=new pt,this.viewportFrame=new pt}return r.prototype.bind=function(e,t,n){e===void 0&&(e=null);var i=this.renderer;this.current=e;var o,s,a;e?(o=e.baseTexture,a=o.resolution,t||(Yn.width=e.frame.width,Yn.height=e.frame.height,t=Yn),n||(oi.x=e.frame.x,oi.y=e.frame.y,oi.width=t.width,oi.height=t.height,n=oi),s=o.framebuffer):(a=i.resolution,t||(Yn.width=i.screen.width,Yn.height=i.screen.height,t=Yn),n||(n=Yn,n.width=t.width,n.height=t.height));var l=this.viewportFrame;l.x=n.x*a,l.y=n.y*a,l.width=n.width*a,l.height=n.height*a,e||(l.y=i.view.height-(l.y+l.height)),l.ceil(),this.renderer.framebuffer.bind(s,l),this.renderer.projection.update(n,t,a,!s),e?this.renderer.mask.setMaskStack(o.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(n)},r.prototype.clear=function(e,t){this.current?e=e||this.current.baseTexture.clearColor:e=e||this.clearColor;var n=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer.screen,o=n.width!==i.width||n.height!==i.height;if(o){var s=this.viewportFrame,a=s.x,l=s.y,u=s.width,c=s.height;a=Math.round(a),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(a,l,u,c)}this.renderer.framebuffer.clear(e[0],e[1],e[2],e[3],t),o&&this.renderer.scissor.pop()},r.prototype.resize=function(){this.bind(null)},r.prototype.reset=function(){this.bind(null)},r.prototype.destroy=function(){this.renderer=null},r}();function u0(r,e,t,n,i){t.buffer.update(i)}var c0={float:` + data[offset] = v; + `,vec2:` + data[offset] = v[0]; + data[offset+1] = v[1]; + `,vec3:` + data[offset] = v[0]; + data[offset+1] = v[1]; + data[offset+2] = v[2]; + + `,vec4:` + data[offset] = v[0]; + data[offset+1] = v[1]; + data[offset+2] = v[2]; + data[offset+3] = v[3]; + `,mat2:` + data[offset] = v[0]; + data[offset+1] = v[1]; + + data[offset+4] = v[2]; + data[offset+5] = v[3]; + `,mat3:` + data[offset] = v[0]; + data[offset+1] = v[1]; + data[offset+2] = v[2]; + + data[offset + 4] = v[3]; + data[offset + 5] = v[4]; + data[offset + 6] = v[5]; + + data[offset + 8] = v[6]; + data[offset + 9] = v[7]; + data[offset + 10] = v[8]; + `,mat4:` + for(var i = 0; i < 16; i++) + { + data[offset + i] = v[i]; + } + `},Yd={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:16*2,mat3:16*3,mat4:16*4};function f0(r){for(var e=r.map(function(l){return{data:l,offset:0,dataLen:0,dirty:0}}),t=0,n=0,i=0,o=0;o1&&(t=Math.max(t,16)*s.data.size),s.dataLen=t,n%t!==0&&n<16){var a=n%t%16;n+=a,i+=a}n+t>16?(i=Math.ceil(i/16)*16,s.offset=i,i+=t,n=t):(s.offset=i,n+=t,i+=t)}return i=Math.ceil(i/16)*16,{uboElements:e,size:i}}function h0(r,e){var t=[];for(var n in r)e[n]&&t.push(e[n]);return t.sort(function(i,o){return i.index-o.index}),t}function d0(r,e){if(!r.autoManage)return{size:0,syncFunc:u0};for(var t=h0(r.uniforms,e),n=f0(t),i=n.uboElements,o=n.size,s=[` + var v = null; + var v2 = null; + var cv = null; + var t = 0; + var gl = renderer.gl + var index = 0; + var data = buffer.data; + `],a=0;a1){var g=Hd(l.data.type),v=Math.max(Yd[l.data.type]/16,1),d=g/v,m=(4-d%4)%4;s.push(` + cv = ud.`+c+`.value; + v = uv.`+c+`; + offset = `+l.offset/4+`; + + t = 0; + + for(var i=0; i < `+l.data.size*v+`; i++) + { + for(var j = 0; j < `+d+`; j++) + { + data[offset++] = v[t++]; + } + offset += `+m+`; + } + + `)}else{var y=c0[l.data.type];s.push(` + cv = ud.`+c+`.value; + v = uv.`+c+`; + offset = `+l.offset/4+`; + `+y+`; + `)}}return s.push(` + renderer.buffer.update(buffer); + `),{size:o,syncFunc:new Function("ud","uv","renderer","syncData","buffer",s.join(` +`))}}var p0=function(){function r(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return r.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},r}();function m0(r,e){for(var t={},n=e.getProgramParameter(r,e.ACTIVE_ATTRIBUTES),i=0;if?1:-1});for(var s=0;s>1,n++;this.stateId=e.data}for(var n=0;nthis.checkCountMax&&(this.checkCount=0,this.run())))},r.prototype.run=function(){for(var e=this.renderer.texture,t=e.managedTextures,n=!1,i=0;ithis.maxIdle&&(e.destroyTexture(o,!0),t[i]=null,n=!0)}if(n){for(var s=0,i=0;i=0;i--)this.unload(e.children[i])},r.prototype.destroy=function(){this.renderer=null},r}();function P0(r){var e,t,n,i,o,s,a,l,u,c,f,p,h,g,v,d,m,y,_,C,x,b,E;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?E=(e={},e[$e.UNSIGNED_BYTE]=(t={},t[Te.RGBA]=r.RGBA8,t[Te.RGB]=r.RGB8,t[Te.RG]=r.RG8,t[Te.RED]=r.R8,t[Te.RGBA_INTEGER]=r.RGBA8UI,t[Te.RGB_INTEGER]=r.RGB8UI,t[Te.RG_INTEGER]=r.RG8UI,t[Te.RED_INTEGER]=r.R8UI,t[Te.ALPHA]=r.ALPHA,t[Te.LUMINANCE]=r.LUMINANCE,t[Te.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,t),e[$e.BYTE]=(n={},n[Te.RGBA]=r.RGBA8_SNORM,n[Te.RGB]=r.RGB8_SNORM,n[Te.RG]=r.RG8_SNORM,n[Te.RED]=r.R8_SNORM,n[Te.RGBA_INTEGER]=r.RGBA8I,n[Te.RGB_INTEGER]=r.RGB8I,n[Te.RG_INTEGER]=r.RG8I,n[Te.RED_INTEGER]=r.R8I,n),e[$e.UNSIGNED_SHORT]=(i={},i[Te.RGBA_INTEGER]=r.RGBA16UI,i[Te.RGB_INTEGER]=r.RGB16UI,i[Te.RG_INTEGER]=r.RG16UI,i[Te.RED_INTEGER]=r.R16UI,i[Te.DEPTH_COMPONENT]=r.DEPTH_COMPONENT16,i),e[$e.SHORT]=(o={},o[Te.RGBA_INTEGER]=r.RGBA16I,o[Te.RGB_INTEGER]=r.RGB16I,o[Te.RG_INTEGER]=r.RG16I,o[Te.RED_INTEGER]=r.R16I,o),e[$e.UNSIGNED_INT]=(s={},s[Te.RGBA_INTEGER]=r.RGBA32UI,s[Te.RGB_INTEGER]=r.RGB32UI,s[Te.RG_INTEGER]=r.RG32UI,s[Te.RED_INTEGER]=r.R32UI,s[Te.DEPTH_COMPONENT]=r.DEPTH_COMPONENT24,s),e[$e.INT]=(a={},a[Te.RGBA_INTEGER]=r.RGBA32I,a[Te.RGB_INTEGER]=r.RGB32I,a[Te.RG_INTEGER]=r.RG32I,a[Te.RED_INTEGER]=r.R32I,a),e[$e.FLOAT]=(l={},l[Te.RGBA]=r.RGBA32F,l[Te.RGB]=r.RGB32F,l[Te.RG]=r.RG32F,l[Te.RED]=r.R32F,l[Te.DEPTH_COMPONENT]=r.DEPTH_COMPONENT32F,l),e[$e.HALF_FLOAT]=(u={},u[Te.RGBA]=r.RGBA16F,u[Te.RGB]=r.RGB16F,u[Te.RG]=r.RG16F,u[Te.RED]=r.R16F,u),e[$e.UNSIGNED_SHORT_5_6_5]=(c={},c[Te.RGB]=r.RGB565,c),e[$e.UNSIGNED_SHORT_4_4_4_4]=(f={},f[Te.RGBA]=r.RGBA4,f),e[$e.UNSIGNED_SHORT_5_5_5_1]=(p={},p[Te.RGBA]=r.RGB5_A1,p),e[$e.UNSIGNED_INT_2_10_10_10_REV]=(h={},h[Te.RGBA]=r.RGB10_A2,h[Te.RGBA_INTEGER]=r.RGB10_A2UI,h),e[$e.UNSIGNED_INT_10F_11F_11F_REV]=(g={},g[Te.RGB]=r.R11F_G11F_B10F,g),e[$e.UNSIGNED_INT_5_9_9_9_REV]=(v={},v[Te.RGB]=r.RGB9_E5,v),e[$e.UNSIGNED_INT_24_8]=(d={},d[Te.DEPTH_STENCIL]=r.DEPTH24_STENCIL8,d),e[$e.FLOAT_32_UNSIGNED_INT_24_8_REV]=(m={},m[Te.DEPTH_STENCIL]=r.DEPTH32F_STENCIL8,m),e):E=(y={},y[$e.UNSIGNED_BYTE]=(_={},_[Te.RGBA]=r.RGBA,_[Te.RGB]=r.RGB,_[Te.ALPHA]=r.ALPHA,_[Te.LUMINANCE]=r.LUMINANCE,_[Te.LUMINANCE_ALPHA]=r.LUMINANCE_ALPHA,_),y[$e.UNSIGNED_SHORT_5_6_5]=(C={},C[Te.RGB]=r.RGB,C),y[$e.UNSIGNED_SHORT_4_4_4_4]=(x={},x[Te.RGBA]=r.RGBA,x),y[$e.UNSIGNED_SHORT_5_5_5_1]=(b={},b[Te.RGBA]=r.RGBA,b),y),E}var ua=function(){function r(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=$e.UNSIGNED_BYTE,this.internalFormat=Te.RGBA,this.samplerType=0}return r}(),M0=function(){function r(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new yt,this.hasIntegerTextures=!1}return r.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=P0(e);var t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(var n=0;n=0;--s){var a=n[s];if(a){var l=a._glTextures[o];l.samplerType!==ko.FLOAT&&this.renderer.texture.unbind(a)}}},r.prototype.initTexture=function(e){var t=new ua(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on("dispose",this.destroyTexture,this),t},r.prototype.initTextureType=function(e,t){var n,i;t.internalFormat=(i=(n=this.internalFormats[e.type])===null||n===void 0?void 0:n[e.format])!==null&&i!==void 0?i:e.format,this.webGLVersion===2&&e.type===$e.HALF_FLOAT?t.type=this.gl.HALF_FLOAT:t.type=e.type},r.prototype.updateTexture=function(e){var t=e._glTextures[this.CONTEXT_UID];if(t){var n=this.renderer;if(this.initTextureType(e,t),e.resource&&e.resource.upload(n,e,t))t.samplerType!==ko.FLOAT&&(this.hasIntegerTextures=!0);else{var i=e.realWidth,o=e.realHeight,s=n.gl;(t.width!==i||t.height!==o||t.dirtyId<0)&&(t.width=i,t.height=o,s.texImage2D(e.target,0,t.internalFormat,i,o,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}},r.prototype.destroyTexture=function(e,t){var n=this.gl;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),n.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off("dispose",this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){var i=this.managedTextures.indexOf(e);i!==-1&&xo(this.managedTextures,i,1)}},r.prototype.updateTextureStyle=function(e){var t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===hn.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=Oo.CLAMP:t.wrapMode=e.wrapMode,e.resource&&e.resource.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)},r.prototype.setStyle=function(e,t){var n=this.gl;if(t.mipmap&&e.mipmap!==hn.ON_MANUAL&&n.generateMipmap(e.target),n.texParameteri(e.target,n.TEXTURE_WRAP_S,t.wrapMode),n.texParameteri(e.target,n.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){n.texParameteri(e.target,n.TEXTURE_MIN_FILTER,e.scaleMode===Bt.LINEAR?n.LINEAR_MIPMAP_LINEAR:n.NEAREST_MIPMAP_NEAREST);var i=this.renderer.context.extensions.anisotropicFiltering;if(i&&e.anisotropicLevel>0&&e.scaleMode===Bt.LINEAR){var o=Math.min(e.anisotropicLevel,n.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));n.texParameterf(e.target,i.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else n.texParameteri(e.target,n.TEXTURE_MIN_FILTER,e.scaleMode===Bt.LINEAR?n.LINEAR:n.NEAREST);n.texParameteri(e.target,n.TEXTURE_MAG_FILTER,e.scaleMode===Bt.LINEAR?n.LINEAR:n.NEAREST)},r.prototype.destroy=function(){this.renderer=null},r}(),ca=new Et,k0=function(r){et(e,r);function e(t,n){t===void 0&&(t=Ci.UNKNOWN);var i=r.call(this)||this;return n=Object.assign({},Se.RENDER_OPTIONS,n),i.options=n,i.type=t,i.screen=new pt(0,0,n.width,n.height),i.view=n.view||Se.ADAPTER.createCanvas(),i.resolution=n.resolution||Se.RESOLUTION,i.useContextAlpha=n.useContextAlpha,i.autoDensity=!!n.autoDensity,i.preserveDrawingBuffer=n.preserveDrawingBuffer,i.clearBeforeRender=n.clearBeforeRender,i._backgroundColor=0,i._backgroundColorRgba=[0,0,0,1],i._backgroundColorString="#000000",i.backgroundColor=n.backgroundColor||i._backgroundColor,i.backgroundAlpha=n.backgroundAlpha,n.transparent!==void 0&&(dr("6.0.0","Option transparent is deprecated, please use backgroundAlpha instead."),i.useContextAlpha=n.transparent,i.backgroundAlpha=n.transparent?0:1),i._lastObjectRendered=null,i.plugins={},i}return e.prototype.initPlugins=function(t){for(var n in t)this.plugins[n]=new t[n](this)},Object.defineProperty(e.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,n){this.view.width=Math.round(t*this.resolution),this.view.height=Math.round(n*this.resolution);var i=this.view.width/this.resolution,o=this.view.height/this.resolution;this.screen.width=i,this.screen.height=o,this.autoDensity&&(this.view.style.width=i+"px",this.view.style.height=o+"px"),this.emit("resize",i,o)},e.prototype.generateTexture=function(t,n,i,o){n===void 0&&(n={}),typeof n=="number"&&(dr("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),n={scaleMode:n,resolution:i,region:o});var s=n.region,a=fy(n,["region"]);o=s||t.getLocalBounds(null,!0),o.width===0&&(o.width=1),o.height===0&&(o.height=1);var l=du.create(Ka({width:o.width,height:o.height},a));return ca.tx=-o.x,ca.ty=-o.y,this.render(t,{renderTexture:l,clear:!1,transform:ca,skipUpdateTransform:!!t.parent}),l},e.prototype.destroy=function(t){for(var n in this.plugins)this.plugins[n].destroy(),this.plugins[n]=null;t&&this.view.parentNode&&this.view.parentNode.removeChild(this.view);var i=this;i.plugins=null,i.type=Ci.UNKNOWN,i.view=null,i.screen=null,i._tempDisplayObjectParent=null,i.options=null,this._backgroundColorRgba=null,this._backgroundColorString=null,this._lastObjectRendered=null},Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._backgroundColorString=ty(t),en(t,this._backgroundColorRgba)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"backgroundAlpha",{get:function(){return this._backgroundColorRgba[3]},set:function(t){this._backgroundColorRgba[3]=t},enumerable:!1,configurable:!0}),e}(_r),O0=function(){function r(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}return r}(),R0=function(){function r(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}return r.prototype.destroy=function(){this.renderer=null},r.prototype.contextChange=function(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID},r.prototype.bind=function(e){var t=this,n=t.gl,i=t.CONTEXT_UID,o=e._glBuffers[i]||this.createGLBuffer(e);n.bindBuffer(e.type,o.buffer)},r.prototype.bindBufferBase=function(e,t){var n=this,i=n.gl,o=n.CONTEXT_UID;if(this.boundBufferBases[t]!==e){var s=e._glBuffers[o]||this.createGLBuffer(e);this.boundBufferBases[t]=e,i.bindBufferBase(i.UNIFORM_BUFFER,t,s.buffer)}},r.prototype.bindBufferRange=function(e,t,n){var i=this,o=i.gl,s=i.CONTEXT_UID;n=n||0;var a=e._glBuffers[s]||this.createGLBuffer(e);o.bindBufferRange(o.UNIFORM_BUFFER,t||0,a.buffer,n*256,256)},r.prototype.update=function(e){var t=this,n=t.gl,i=t.CONTEXT_UID,o=e._glBuffers[i];if(e._updateID!==o.updateID)if(o.updateID=e._updateID,n.bindBuffer(e.type,o.buffer),o.byteLength>=e.data.byteLength)n.bufferSubData(e.type,0,e.data);else{var s=e.static?n.STATIC_DRAW:n.DYNAMIC_DRAW;o.byteLength=e.data.byteLength,n.bufferData(e.type,e.data,s)}},r.prototype.dispose=function(e,t){if(this.managedBuffers[e.id]){delete this.managedBuffers[e.id];var n=e._glBuffers[this.CONTEXT_UID],i=this.gl;e.disposeRunner.remove(this),n&&(t||i.deleteBuffer(n.buffer),delete e._glBuffers[this.CONTEXT_UID])}},r.prototype.disposeAll=function(e){for(var t=Object.keys(this.managedBuffers),n=0;n=dt.HIGH?this.multisample=dt.HIGH:n>=dt.MEDIUM?this.multisample=dt.MEDIUM:n>=dt.LOW?this.multisample=dt.LOW:this.multisample=dt.NONE},e.prototype.addSystem=function(t,n){var i=new t(this);if(this[n])throw new Error('Whoops! The name "'+n+'" is already in use');this[n]=i;for(var o in this.runners)this.runners[o].add(i);return this},e.prototype.render=function(t,n){var i,o,s,a;if(n&&(n instanceof du?(dr("6.0.0","Renderer#render arguments changed, use options instead."),i=n,o=arguments[2],s=arguments[3],a=arguments[4]):(i=n.renderTexture,o=n.clear,s=n.transform,a=n.skipUpdateTransform)),this.renderingToScreen=!i,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=s,!this.context.isLost){if(i||(this._lastObjectRendered=t),!a){var l=t.enableTempParent();t.updateTransform(),t.disableTempParent(l)}this.renderTexture.bind(i),this.batch.currentRenderer.start(),(o!==void 0?o:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),i&&i.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},e.prototype.generateTexture=function(t,n,i,o){n===void 0&&(n={});var s=r.prototype.generateTexture.call(this,t,n,i,o);return this.framebuffer.blit(),s},e.prototype.resize=function(t,n){r.prototype.resize.call(this,t,n),this.runners.resize.emit(this.screen.height,this.screen.width)},e.prototype.reset=function(){return this.runners.reset.emit(),this},e.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},e.prototype.destroy=function(t){this.runners.destroy.emit();for(var n in this.runners)this.runners[n].destroy();r.prototype.destroy.call(this,t),this.gl=null},Object.defineProperty(e.prototype,"extract",{get:function(){return dr("6.0.0","Renderer#extract has been deprecated, please use Renderer#plugins.extract instead."),this.plugins.extract},enumerable:!1,configurable:!0}),e.registerPlugin=function(t,n){dr("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),Qr.add({name:t,type:dn.RendererPlugin,ref:n})},e.__plugins={},e}(k0);Qr.handleByMap(dn.RendererPlugin,Kd.__plugins);function F0(r){return Kd.create(r)}var L0=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,N0=L0,D0=function(){function r(){this.texArray=null,this.blend=0,this.type=Ai.TRIANGLES,this.start=0,this.size=0,this.data=null}return r}(),B0=function(){function r(){this.elements=[],this.ids=[],this.count=0}return r.prototype.clear=function(){for(var e=0;ethis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},e.prototype.buildTexturesAndDrawCalls=function(){var t=this,n=t._bufferedTextures,i=t.MAX_TEXTURES,o=e._textureArrayPool,s=this.renderer.batch,a=this._tempBoundTextures,l=this.renderer.textureGC.count,u=++yt._globalBatch,c=0,f=o[0],p=0;s.copyBoundTextures(a,i);for(var h=0;h=i&&(s.boundArray(f,a,u,i),this.buildDrawCalls(f,p,h),p=h,f=o[++c],++u),g._batchEnabled=u,g.touched=l,f.elements[f.count++]=g)}f.count>0&&(s.boundArray(f,a,u,i),this.buildDrawCalls(f,p,this._bufferSize),++c,++u);for(var h=0;h0&&(t+=` +else `),nthis.maxX||this.minY>this.maxY},r.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},r.prototype.getRectangle=function(e){return this.minX>this.maxX||this.minY>this.maxY?pt.EMPTY:(e=e||new pt(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)},r.prototype.addPoint=function(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)},r.prototype.addPointMatrix=function(e,t){var n=e.a,i=e.b,o=e.c,s=e.d,a=e.tx,l=e.ty,u=n*t.x+o*t.y+a,c=i*t.x+s*t.y+l;this.minX=Math.min(this.minX,u),this.maxX=Math.max(this.maxX,u),this.minY=Math.min(this.minY,c),this.maxY=Math.max(this.maxY,c)},r.prototype.addQuad=function(e){var t=this.minX,n=this.minY,i=this.maxX,o=this.maxY,s=e[0],a=e[1];t=si?s:i,o=a>o?a:o,s=e[2],a=e[3],t=si?s:i,o=a>o?a:o,s=e[4],a=e[5],t=si?s:i,o=a>o?a:o,s=e[6],a=e[7],t=si?s:i,o=a>o?a:o,this.minX=t,this.minY=n,this.maxX=i,this.maxY=o},r.prototype.addFrame=function(e,t,n,i,o){this.addFrameMatrix(e.worldTransform,t,n,i,o)},r.prototype.addFrameMatrix=function(e,t,n,i,o){var s=e.a,a=e.b,l=e.c,u=e.d,c=e.tx,f=e.ty,p=this.minX,h=this.minY,g=this.maxX,v=this.maxY,d=s*t+l*n+c,m=a*t+u*n+f;p=dg?d:g,v=m>v?m:v,d=s*i+l*n+c,m=a*i+u*n+f,p=dg?d:g,v=m>v?m:v,d=s*t+l*o+c,m=a*t+u*o+f,p=dg?d:g,v=m>v?m:v,d=s*i+l*o+c,m=a*i+u*o+f,p=dg?d:g,v=m>v?m:v,this.minX=p,this.minY=h,this.maxX=g,this.maxY=v},r.prototype.addVertexData=function(e,t,n){for(var i=this.minX,o=this.minY,s=this.maxX,a=this.maxY,l=t;ls?u:s,a=c>a?c:a}this.minX=i,this.minY=o,this.maxX=s,this.maxY=a},r.prototype.addVertices=function(e,t,n,i){this.addVerticesMatrix(e.worldTransform,t,n,i)},r.prototype.addVerticesMatrix=function(e,t,n,i,o,s){o===void 0&&(o=0),s===void 0&&(s=o);for(var a=e.a,l=e.b,u=e.c,c=e.d,f=e.tx,p=e.ty,h=this.minX,g=this.minY,v=this.maxX,d=this.maxY,m=n;mi?e.maxX:i,this.maxY=e.maxY>o?e.maxY:o},r.prototype.addBoundsMask=function(e,t){var n=e.minX>t.minX?e.minX:t.minX,i=e.minY>t.minY?e.minY:t.minY,o=e.maxXu?o:u,this.maxY=s>c?s:c}},r.prototype.addBoundsMatrix=function(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)},r.prototype.addBoundsArea=function(e,t){var n=e.minX>t.x?e.minX:t.x,i=e.minY>t.y?e.minY:t.y,o=e.maxXu?o:u,this.maxY=s>c?s:c}},r.prototype.pad=function(e,t){e===void 0&&(e=0),t===void 0&&(t=e),this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)},r.prototype.addFramePad=function(e,t,n,i,o,s){e-=o,t-=s,n+=o,i+=s,this.minX=this.minXn?this.maxX:n,this.minY=this.minYi?this.maxY:i},r}();/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Ja=function(r,e){return Ja=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},Ja(r,e)};function vu(r,e){Ja(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Lo=function(r){vu(e,r);function e(){var t=r.call(this)||this;return t.tempDisplayObjectParent=null,t.transform=new Nd,t.alpha=1,t.visible=!0,t.renderable=!0,t.cullable=!1,t.cullArea=null,t.parent=null,t.worldAlpha=1,t._lastSortedIndex=0,t._zIndex=0,t.filterArea=null,t.filters=null,t._enabledFilters=null,t._bounds=new Mf,t._localBounds=null,t._boundsID=0,t._boundsRect=null,t._localBoundsRect=null,t._mask=null,t._maskRefCount=0,t._destroyed=!1,t.isSprite=!1,t.isMask=!1,t}return e.mixin=function(t){for(var n=Object.keys(t),i=0;i1)for(var o=0;othis.children.length)throw new Error(t+"addChildAt: The index "+n+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(n,0,t),this._boundsID++,this.onChildrenChange(n),t.emit("added",this),this.emit("childAdded",t,this,n),t},e.prototype.swapChildren=function(t,n){if(t!==n){var i=this.getChildIndex(t),o=this.getChildIndex(n);this.children[i]=n,this.children[o]=t,this.onChildrenChange(i=this.children.length)throw new Error("The index "+n+" supplied is out of bounds "+this.children.length);var i=this.getChildIndex(t);xo(this.children,i,1),this.children.splice(n,0,t),this.onChildrenChange(n)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.prototype.removeChild=function(){for(var t=arguments,n=[],i=0;i1)for(var o=0;o0&&s<=o){a=this.children.splice(i,s);for(var l=0;l1&&this.children.sort(X0),this.sortDirty=!1},e.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,n=this.children.length;t0&&n.height>0){var i,o;if(this.cullArea?(i=this.cullArea,o=this.worldTransform):this._render!==e.prototype._render&&(i=this.getBounds(!0)),i&&n.intersects(i,o))this._render(t);else if(this.cullArea)return;for(var s=0,a=this.children.length;s 0.0) { + c.rgb /= c.a; + + vec3 rgb = pow(c.rgb, vec3(1. / gamma)); + rgb = mix(vec3(.5), mix(vec3(dot(vec3(.2125, .7154, .0721), rgb)), rgb, saturation), contrast); + rgb.r *= red; + rgb.g *= green; + rgb.b *= blue; + c.rgb = rgb * brightness; + + c.rgb *= c.a; + } + + gl_FragColor = c * alpha; +} +`;(function(r){q0(e,r);function e(t){var n=r.call(this,Y0,K0)||this;return n.gamma=1,n.saturation=1,n.contrast=1,n.brightness=1,n.red=1,n.green=1,n.blue=1,n.alpha=1,Object.assign(n,t),n}return e.prototype.apply=function(t,n,i,o){this.uniforms.gamma=Math.max(this.gamma,1e-4),this.uniforms.saturation=this.saturation,this.uniforms.contrast=this.contrast,this.uniforms.brightness=this.brightness,this.uniforms.red=this.red,this.uniforms.green=this.green,this.uniforms.blue=this.blue,this.uniforms.alpha=this.alpha,t.applyFilter(this,n,i,o)},e})(Be);/*! + * @pixi/filter-kawase-blur - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-kawase-blur is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var el=function(r,e){return el=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},el(r,e)};function Z0(r,e){el(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var J0=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Q0=` +varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform vec2 uOffset; + +void main(void) +{ + vec4 color = vec4(0.0); + + // Sample top left pixel + color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y)); + + // Sample top right pixel + color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y)); + + // Sample bottom right pixel + color += texture2D(uSampler, vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y)); + + // Sample bottom left pixel + color += texture2D(uSampler, vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y)); + + // Average + color *= 0.25; + + gl_FragColor = color; +}`,e_=` +varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform vec2 uOffset; +uniform vec4 filterClamp; + +void main(void) +{ + vec4 color = vec4(0.0); + + // Sample top left pixel + color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw)); + + // Sample top right pixel + color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y + uOffset.y), filterClamp.xy, filterClamp.zw)); + + // Sample bottom right pixel + color += texture2D(uSampler, clamp(vec2(vTextureCoord.x + uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw)); + + // Sample bottom left pixel + color += texture2D(uSampler, clamp(vec2(vTextureCoord.x - uOffset.x, vTextureCoord.y - uOffset.y), filterClamp.xy, filterClamp.zw)); + + // Average + color *= 0.25; + + gl_FragColor = color; +} +`,Do=function(r){Z0(e,r);function e(t,n,i){t===void 0&&(t=4),n===void 0&&(n=3),i===void 0&&(i=!1);var o=r.call(this,J0,i?e_:Q0)||this;return o._kernels=[],o._blur=4,o._quality=3,o.uniforms.uOffset=new Float32Array(2),o._pixelSize=new at,o.pixelSize=1,o._clamp=i,Array.isArray(t)?o.kernels=t:(o._blur=t,o.quality=n),o}return e.prototype.apply=function(t,n,i,o){var s=this._pixelSize.x/n._frame.width,a=this._pixelSize.y/n._frame.height,l;if(this._quality===1||this._blur===0)l=this._kernels[0]+.5,this.uniforms.uOffset[0]=l*s,this.uniforms.uOffset[1]=l*a,t.applyFilter(this,n,i,o);else{for(var u=t.getFilterTexture(),c=n,f=u,p=void 0,h=this._quality-1,g=0;g0)for(var o=t,s=t/n,a=1;a0?(this._kernels=t,this._quality=t.length,this._blur=Math.max.apply(Math,t)):(this._kernels=[0],this._quality=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clamp",{get:function(){return this._clamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._pixelSize},set:function(t){typeof t=="number"?(this._pixelSize.x=t,this._pixelSize.y=t):Array.isArray(t)?(this._pixelSize.x=t[0],this._pixelSize.y=t[1]):t instanceof at?(this._pixelSize.x=t.x,this._pixelSize.y=t.y):(this._pixelSize.x=1,this._pixelSize.y=1)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=Math.max(1,Math.round(t)),this._generateKernels()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blur},set:function(t){this._blur=t,this._generateKernels()},enumerable:!1,configurable:!0}),e}(Be);/*! + * @pixi/filter-advanced-bloom - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-advanced-bloom is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var tl=function(r,e){return tl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},tl(r,e)};function Jd(r,e){tl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Qd=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,t_=` +uniform sampler2D uSampler; +varying vec2 vTextureCoord; + +uniform float threshold; + +void main() { + vec4 color = texture2D(uSampler, vTextureCoord); + + // A simple & fast algorithm for getting brightness. + // It's inaccuracy , but good enought for this feature. + float _max = max(max(color.r, color.g), color.b); + float _min = min(min(color.r, color.g), color.b); + float brightness = (_max + _min) * 0.5; + + if(brightness > threshold) { + gl_FragColor = color; + } else { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); + } +} +`,n_=function(r){Jd(e,r);function e(t){t===void 0&&(t=.5);var n=r.call(this,Qd,t_)||this;return n.threshold=t,n}return Object.defineProperty(e.prototype,"threshold",{get:function(){return this.uniforms.threshold},set:function(t){this.uniforms.threshold=t},enumerable:!1,configurable:!0}),e}(Be),r_=`uniform sampler2D uSampler; +varying vec2 vTextureCoord; + +uniform sampler2D bloomTexture; +uniform float bloomScale; +uniform float brightness; + +void main() { + vec4 color = texture2D(uSampler, vTextureCoord); + color.rgb *= brightness; + vec4 bloomColor = vec4(texture2D(bloomTexture, vTextureCoord).rgb, 0.0); + bloomColor.rgb *= bloomScale; + gl_FragColor = color + bloomColor; +} +`;(function(r){Jd(e,r);function e(t){var n=r.call(this,Qd,r_)||this;n.bloomScale=1,n.brightness=1,n._resolution=Se.FILTER_RESOLUTION,typeof t=="number"&&(t={threshold:t});var i=Object.assign(e.defaults,t);n.bloomScale=i.bloomScale,n.brightness=i.brightness;var o=i.kernels,s=i.blur,a=i.quality,l=i.pixelSize,u=i.resolution;return n._extractFilter=new n_(i.threshold),n._extractFilter.resolution=u,n._blurFilter=o?new Do(o):new Do(s,a),n.pixelSize=l,n.resolution=u,n}return e.prototype.apply=function(t,n,i,o,s){var a=t.getFilterTexture();this._extractFilter.apply(t,n,a,1,s);var l=t.getFilterTexture();this._blurFilter.apply(t,a,l,1),this.uniforms.bloomScale=this.bloomScale,this.uniforms.brightness=this.brightness,this.uniforms.bloomTexture=l,t.applyFilter(this,n,i,o),t.returnFilterTexture(l),t.returnFilterTexture(a)},Object.defineProperty(e.prototype,"resolution",{get:function(){return this._resolution},set:function(t){this._resolution=t,this._extractFilter&&(this._extractFilter.resolution=t),this._blurFilter&&(this._blurFilter.resolution=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"threshold",{get:function(){return this._extractFilter.threshold},set:function(t){this._extractFilter.threshold=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"kernels",{get:function(){return this._blurFilter.kernels},set:function(t){this._blurFilter.kernels=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blur",{get:function(){return this._blurFilter.blur},set:function(t){this._blurFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"quality",{get:function(){return this._blurFilter.quality},set:function(t){this._blurFilter.quality=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pixelSize",{get:function(){return this._blurFilter.pixelSize},set:function(t){this._blurFilter.pixelSize=t},enumerable:!1,configurable:!0}),e.defaults={threshold:.5,bloomScale:1,brightness:1,kernels:null,blur:8,quality:4,pixelSize:1,resolution:Se.FILTER_RESOLUTION},e})(Be);/*! + * @pixi/filter-ascii - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-ascii is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var nl=function(r,e){return nl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},nl(r,e)};function i_(r,e){nl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var o_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,s_=`varying vec2 vTextureCoord; + +uniform vec4 filterArea; +uniform float pixelSize; +uniform sampler2D uSampler; + +vec2 mapCoord( vec2 coord ) +{ + coord *= filterArea.xy; + coord += filterArea.zw; + + return coord; +} + +vec2 unmapCoord( vec2 coord ) +{ + coord -= filterArea.zw; + coord /= filterArea.xy; + + return coord; +} + +vec2 pixelate(vec2 coord, vec2 size) +{ + return floor( coord / size ) * size; +} + +vec2 getMod(vec2 coord, vec2 size) +{ + return mod( coord , size) / size; +} + +float character(float n, vec2 p) +{ + p = floor(p*vec2(4.0, -4.0) + 2.5); + + if (clamp(p.x, 0.0, 4.0) == p.x) + { + if (clamp(p.y, 0.0, 4.0) == p.y) + { + if (int(mod(n/exp2(p.x + 5.0*p.y), 2.0)) == 1) return 1.0; + } + } + return 0.0; +} + +void main() +{ + vec2 coord = mapCoord(vTextureCoord); + + // get the rounded color.. + vec2 pixCoord = pixelate(coord, vec2(pixelSize)); + pixCoord = unmapCoord(pixCoord); + + vec4 color = texture2D(uSampler, pixCoord); + + // determine the character to use + float gray = (color.r + color.g + color.b) / 3.0; + + float n = 65536.0; // . + if (gray > 0.2) n = 65600.0; // : + if (gray > 0.3) n = 332772.0; // * + if (gray > 0.4) n = 15255086.0; // o + if (gray > 0.5) n = 23385164.0; // & + if (gray > 0.6) n = 15252014.0; // 8 + if (gray > 0.7) n = 13199452.0; // @ + if (gray > 0.8) n = 11512810.0; // # + + // get the mod.. + vec2 modd = getMod(coord, vec2(pixelSize)); + + gl_FragColor = color * character( n, vec2(-1.0) + modd * 2.0); + +} +`;(function(r){i_(e,r);function e(t){t===void 0&&(t=8);var n=r.call(this,o_,s_)||this;return n.size=t,n}return Object.defineProperty(e.prototype,"size",{get:function(){return this.uniforms.pixelSize},set:function(t){this.uniforms.pixelSize=t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-bevel - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-bevel is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var rl=function(r,e){return rl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},rl(r,e)};function a_(r,e){rl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var l_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,u_=`precision mediump float; + +varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform vec4 filterArea; + +uniform float transformX; +uniform float transformY; +uniform vec3 lightColor; +uniform float lightAlpha; +uniform vec3 shadowColor; +uniform float shadowAlpha; + +void main(void) { + vec2 transform = vec2(1.0 / filterArea) * vec2(transformX, transformY); + vec4 color = texture2D(uSampler, vTextureCoord); + float light = texture2D(uSampler, vTextureCoord - transform).a; + float shadow = texture2D(uSampler, vTextureCoord + transform).a; + + color.rgb = mix(color.rgb, lightColor, clamp((color.a - light) * lightAlpha, 0.0, 1.0)); + color.rgb = mix(color.rgb, shadowColor, clamp((color.a - shadow) * shadowAlpha, 0.0, 1.0)); + gl_FragColor = vec4(color.rgb * color.a, color.a); +} +`;(function(r){a_(e,r);function e(t){var n=r.call(this,l_,u_)||this;return n._thickness=2,n._angle=0,n.uniforms.lightColor=new Float32Array(3),n.uniforms.shadowColor=new Float32Array(3),Object.assign(n,{rotation:45,thickness:2,lightColor:16777215,lightAlpha:.7,shadowColor:0,shadowAlpha:.7},t),n.padding=1,n}return e.prototype._updateTransform=function(){this.uniforms.transformX=this._thickness*Math.cos(this._angle),this.uniforms.transformY=this._thickness*Math.sin(this._angle)},Object.defineProperty(e.prototype,"rotation",{get:function(){return this._angle/gr},set:function(t){this._angle=t*gr,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness=t,this._updateTransform()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lightColor",{get:function(){return rn(this.uniforms.lightColor)},set:function(t){en(t,this.uniforms.lightColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lightAlpha",{get:function(){return this.uniforms.lightAlpha},set:function(t){this.uniforms.lightAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowColor",{get:function(){return rn(this.uniforms.shadowColor)},set:function(t){en(t,this.uniforms.shadowColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shadowAlpha",{get:function(){return this.uniforms.shadowAlpha},set:function(t){this.uniforms.shadowAlpha=t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-alpha - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/filter-alpha is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var il=function(r,e){return il=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},il(r,e)};function c_(r,e){il(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var f_=`varying vec2 vTextureCoord; + +uniform sampler2D uSampler; +uniform float uAlpha; + +void main(void) +{ + gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha; +} +`,h_=function(r){c_(e,r);function e(t){t===void 0&&(t=1);var n=r.call(this,N0,f_,{uAlpha:1})||this;return n.alpha=t,n}return Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(Be);/*! + * @pixi/filter-blur - v6.5.10 + * Compiled Thu, 06 Jul 2023 15:25:11 UTC + * + * @pixi/filter-blur is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var ol=function(r,e){return ol=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])},ol(r,e)};function ep(r,e){ol(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var d_=` + attribute vec2 aVertexPosition; + + uniform mat3 projectionMatrix; + + uniform float strength; + + varying vec2 vBlurTexCoords[%size%]; + + uniform vec4 inputSize; + uniform vec4 outputFrame; + + vec4 filterVertexPosition( void ) + { + vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + + return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + } + + vec2 filterTextureCoord( void ) + { + return aVertexPosition * (outputFrame.zw * inputSize.zw); + } + + void main(void) + { + gl_Position = filterVertexPosition(); + + vec2 textureCoord = filterTextureCoord(); + %blur% + }`;function p_(r,e){var t=Math.ceil(r/2),n=d_,i="",o;e?o="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);":o="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);";for(var s=0;s=t&&(s=r-a-1),l=l.replace("%value%",e[s].toString()),i+=l,i+=` +`}return n=n.replace("%blur%",i),n=n.replace("%size%",r.toString()),n}var Bo=function(r){ep(e,r);function e(t,n,i,o,s){n===void 0&&(n=8),i===void 0&&(i=4),o===void 0&&(o=Se.FILTER_RESOLUTION),s===void 0&&(s=5);var a=this,l=p_(s,t),u=v_(s);return a=r.call(this,l,u)||this,a.horizontal=t,a.resolution=o,a._quality=0,a.quality=i,a.blur=n,a}return e.prototype.apply=function(t,n,i,o){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/n.width):this.uniforms.strength=1/i.height*(i.height/n.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/n.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/n.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)t.applyFilter(this,n,i,o);else{var s=t.getFilterTexture(),a=t.renderer,l=n,u=s;this.state.blend=!1,t.applyFilter(this,l,u,nn.CLEAR);for(var c=1;c 0.0) { + coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75); + } else { + coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent); + } + } + coord += center * dimensions.xy; + coord /= filterArea.xy; + vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw); + vec4 color = texture2D(uSampler, clampedCoord); + if (coord != clampedCoord) { + color *= max(0.0, 1.0 - length(coord - clampedCoord)); + } + + gl_FragColor = color; +} +`;(function(r){__(e,r);function e(t){var n=r.call(this,x_,b_)||this;return n.uniforms.dimensions=new Float32Array(2),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,o){var s=n.filterFrame,a=s.width,l=s.height;this.uniforms.dimensions[0]=a,this.uniforms.dimensions[1]=l,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.strength},set:function(t){this.uniforms.strength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.center},set:function(t){this.uniforms.center=t},enumerable:!1,configurable:!0}),e.defaults={center:[.5,.5],radius:100,strength:1},e})(Be);/*! + * @pixi/filter-color-map - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-color-map is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var ll=function(r,e){return ll=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},ll(r,e)};function w_(r,e){ll(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var T_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,S_=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform sampler2D colorMap; +uniform float _mix; +uniform float _size; +uniform float _sliceSize; +uniform float _slicePixelSize; +uniform float _sliceInnerSize; +void main() { + vec4 color = texture2D(uSampler, vTextureCoord.xy); + + vec4 adjusted; + if (color.a > 0.0) { + color.rgb /= color.a; + float innerWidth = _size - 1.0; + float zSlice0 = min(floor(color.b * innerWidth), innerWidth); + float zSlice1 = min(zSlice0 + 1.0, innerWidth); + float xOffset = _slicePixelSize * 0.5 + color.r * _sliceInnerSize; + float s0 = xOffset + (zSlice0 * _sliceSize); + float s1 = xOffset + (zSlice1 * _sliceSize); + float yOffset = _sliceSize * 0.5 + color.g * (1.0 - _sliceSize); + vec4 slice0Color = texture2D(colorMap, vec2(s0,yOffset)); + vec4 slice1Color = texture2D(colorMap, vec2(s1,yOffset)); + float zOffset = fract(color.b * innerWidth); + adjusted = mix(slice0Color, slice1Color, zOffset); + + color.rgb *= color.a; + } + gl_FragColor = vec4(mix(color, adjusted, _mix).rgb, color.a); + +}`;(function(r){w_(e,r);function e(t,n,i){n===void 0&&(n=!1),i===void 0&&(i=1);var o=r.call(this,T_,S_)||this;return o.mix=1,o._size=0,o._sliceSize=0,o._slicePixelSize=0,o._sliceInnerSize=0,o._nearest=!1,o._scaleMode=null,o._colorMap=null,o._scaleMode=null,o.nearest=n,o.mix=i,o.colorMap=t,o}return e.prototype.apply=function(t,n,i,o){this.uniforms._mix=this.mix,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"colorSize",{get:function(){return this._size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"colorMap",{get:function(){return this._colorMap},set:function(t){var n;t&&(t instanceof pr||(t=pr.from(t)),!((n=t)===null||n===void 0)&&n.baseTexture&&(t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=hn.OFF,this._size=t.height,this._sliceSize=1/this._size,this._slicePixelSize=this._sliceSize/this._size,this._sliceInnerSize=this._slicePixelSize*(this._size-1),this.uniforms._size=this._size,this.uniforms._sliceSize=this._sliceSize,this.uniforms._slicePixelSize=this._slicePixelSize,this.uniforms._sliceInnerSize=this._sliceInnerSize,this.uniforms.colorMap=t),this._colorMap=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"nearest",{get:function(){return this._nearest},set:function(t){this._nearest=t,this._scaleMode=t?Bt.NEAREST:Bt.LINEAR;var n=this._colorMap;n&&n.baseTexture&&(n.baseTexture._glTextures={},n.baseTexture.scaleMode=this._scaleMode,n.baseTexture.mipmap=hn.OFF,n._updateID++,n.baseTexture.emit("update",n.baseTexture))},enumerable:!1,configurable:!0}),e.prototype.updateColorMap=function(){var t=this._colorMap;t&&t.baseTexture&&(t._updateID++,t.baseTexture.emit("update",t.baseTexture),this.colorMap=t)},e.prototype.destroy=function(t){t===void 0&&(t=!1),this._colorMap&&this._colorMap.destroy(t),r.prototype.destroy.call(this)},e})(Be);/*! + * @pixi/filter-color-overlay - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-color-overlay is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var ul=function(r,e){return ul=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},ul(r,e)};function E_(r,e){ul(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var C_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,A_=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform vec3 color; +uniform float alpha; + +void main(void) { + vec4 currentColor = texture2D(uSampler, vTextureCoord); + gl_FragColor = vec4(mix(currentColor.rgb, color.rgb, currentColor.a * alpha), currentColor.a); +} +`;(function(r){E_(e,r);function e(t,n){t===void 0&&(t=0),n===void 0&&(n=1);var i=r.call(this,C_,A_)||this;return i._color=0,i._alpha=1,i.uniforms.color=new Float32Array(3),i.color=t,i.alpha=n,i}return Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){var n=this.uniforms.color;typeof t=="number"?(en(t,n),this._color=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._color=rn(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this.uniforms.alpha=t,this._alpha=t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-color-replace - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-color-replace is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var cl=function(r,e){return cl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},cl(r,e)};function I_(r,e){cl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var P_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,M_=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform vec3 originalColor; +uniform vec3 newColor; +uniform float epsilon; +void main(void) { + vec4 currentColor = texture2D(uSampler, vTextureCoord); + vec3 colorDiff = originalColor - (currentColor.rgb / max(currentColor.a, 0.0000000001)); + float colorDistance = length(colorDiff); + float doReplace = step(colorDistance, epsilon); + gl_FragColor = vec4(mix(currentColor.rgb, (newColor + colorDiff) * currentColor.a, doReplace), currentColor.a); +} +`;(function(r){I_(e,r);function e(t,n,i){t===void 0&&(t=16711680),n===void 0&&(n=0),i===void 0&&(i=.4);var o=r.call(this,P_,M_)||this;return o._originalColor=16711680,o._newColor=0,o.uniforms.originalColor=new Float32Array(3),o.uniforms.newColor=new Float32Array(3),o.originalColor=t,o.newColor=n,o.epsilon=i,o}return Object.defineProperty(e.prototype,"originalColor",{get:function(){return this._originalColor},set:function(t){var n=this.uniforms.originalColor;typeof t=="number"?(en(t,n),this._originalColor=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._originalColor=rn(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"newColor",{get:function(){return this._newColor},set:function(t){var n=this.uniforms.newColor;typeof t=="number"?(en(t,n),this._newColor=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._newColor=rn(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"epsilon",{get:function(){return this.uniforms.epsilon},set:function(t){this.uniforms.epsilon=t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-convolution - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-convolution is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var fl=function(r,e){return fl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},fl(r,e)};function k_(r,e){fl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var O_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,R_=`precision mediump float; + +varying mediump vec2 vTextureCoord; + +uniform sampler2D uSampler; +uniform vec2 texelSize; +uniform float matrix[9]; + +void main(void) +{ + vec4 c11 = texture2D(uSampler, vTextureCoord - texelSize); // top left + vec4 c12 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y - texelSize.y)); // top center + vec4 c13 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y - texelSize.y)); // top right + + vec4 c21 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y)); // mid left + vec4 c22 = texture2D(uSampler, vTextureCoord); // mid center + vec4 c23 = texture2D(uSampler, vec2(vTextureCoord.x + texelSize.x, vTextureCoord.y)); // mid right + + vec4 c31 = texture2D(uSampler, vec2(vTextureCoord.x - texelSize.x, vTextureCoord.y + texelSize.y)); // bottom left + vec4 c32 = texture2D(uSampler, vec2(vTextureCoord.x, vTextureCoord.y + texelSize.y)); // bottom center + vec4 c33 = texture2D(uSampler, vTextureCoord + texelSize); // bottom right + + gl_FragColor = + c11 * matrix[0] + c12 * matrix[1] + c13 * matrix[2] + + c21 * matrix[3] + c22 * matrix[4] + c23 * matrix[5] + + c31 * matrix[6] + c32 * matrix[7] + c33 * matrix[8]; + + gl_FragColor.a = c22.a; +} +`;(function(r){k_(e,r);function e(t,n,i){n===void 0&&(n=200),i===void 0&&(i=200);var o=r.call(this,O_,R_)||this;return o.uniforms.texelSize=new Float32Array(2),o.uniforms.matrix=new Float32Array(9),t!==void 0&&(o.matrix=t),o.width=n,o.height=i,o}return Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.matrix},set:function(t){var n=this;t.forEach(function(i,o){n.uniforms.matrix[o]=i})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return 1/this.uniforms.texelSize[0]},set:function(t){this.uniforms.texelSize[0]=1/t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return 1/this.uniforms.texelSize[1]},set:function(t){this.uniforms.texelSize[1]=1/t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-cross-hatch - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-cross-hatch is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var hl=function(r,e){return hl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},hl(r,e)};function F_(r,e){hl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var L_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,N_=`precision mediump float; + +varying vec2 vTextureCoord; + +uniform sampler2D uSampler; + +void main(void) +{ + float lum = length(texture2D(uSampler, vTextureCoord.xy).rgb); + + gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); + + if (lum < 1.00) + { + if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) + { + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + } + } + + if (lum < 0.75) + { + if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) + { + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + } + } + + if (lum < 0.50) + { + if (mod(gl_FragCoord.x + gl_FragCoord.y - 5.0, 10.0) == 0.0) + { + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + } + } + + if (lum < 0.3) + { + if (mod(gl_FragCoord.x - gl_FragCoord.y - 5.0, 10.0) == 0.0) + { + gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); + } + } +} +`;(function(r){F_(e,r);function e(){return r.call(this,L_,N_)||this}return e})(Be);/*! + * @pixi/filter-crt - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-crt is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var dl=function(r,e){return dl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},dl(r,e)};function D_(r,e){dl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var B_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,U_=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform vec4 filterArea; +uniform vec2 dimensions; + +const float SQRT_2 = 1.414213; + +const float light = 1.0; + +uniform float curvature; +uniform float lineWidth; +uniform float lineContrast; +uniform bool verticalLine; +uniform float noise; +uniform float noiseSize; + +uniform float vignetting; +uniform float vignettingAlpha; +uniform float vignettingBlur; + +uniform float seed; +uniform float time; + +float rand(vec2 co) { + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + +void main(void) +{ + vec2 pixelCoord = vTextureCoord.xy * filterArea.xy; + vec2 dir = vec2(vTextureCoord.xy * filterArea.xy / dimensions - vec2(0.5, 0.5)); + + gl_FragColor = texture2D(uSampler, vTextureCoord); + vec3 rgb = gl_FragColor.rgb; + + if (noise > 0.0 && noiseSize > 0.0) + { + pixelCoord.x = floor(pixelCoord.x / noiseSize); + pixelCoord.y = floor(pixelCoord.y / noiseSize); + float _noise = rand(pixelCoord * noiseSize * seed) - 0.5; + rgb += _noise * noise; + } + + if (lineWidth > 0.0) + { + float _c = curvature > 0. ? curvature : 1.; + float k = curvature > 0. ?(length(dir * dir) * 0.25 * _c * _c + 0.935 * _c) : 1.; + vec2 uv = dir * k; + + float v = (verticalLine ? uv.x * dimensions.x : uv.y * dimensions.y) * min(1.0, 2.0 / lineWidth ) / _c; + float j = 1. + cos(v * 1.2 - time) * 0.5 * lineContrast; + rgb *= j; + float segment = verticalLine ? mod((dir.x + .5) * dimensions.x, 4.) : mod((dir.y + .5) * dimensions.y, 4.); + rgb *= 0.99 + ceil(segment) * 0.015; + } + + if (vignetting > 0.0) + { + float outter = SQRT_2 - vignetting * SQRT_2; + float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0); + rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha); + } + + gl_FragColor.rgb = rgb; +} +`;(function(r){D_(e,r);function e(t){var n=r.call(this,B_,U_)||this;return n.time=0,n.seed=0,n.uniforms.dimensions=new Float32Array(2),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,o){var s=n.filterFrame,a=s.width,l=s.height;this.uniforms.dimensions[0]=a,this.uniforms.dimensions[1]=l,this.uniforms.seed=this.seed,this.uniforms.time=this.time,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"curvature",{get:function(){return this.uniforms.curvature},set:function(t){this.uniforms.curvature=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this.uniforms.lineWidth},set:function(t){this.uniforms.lineWidth=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lineContrast",{get:function(){return this.uniforms.lineContrast},set:function(t){this.uniforms.lineContrast=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"verticalLine",{get:function(){return this.uniforms.verticalLine},set:function(t){this.uniforms.verticalLine=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.noise},set:function(t){this.uniforms.noise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noiseSize",{get:function(){return this.uniforms.noiseSize},set:function(t){this.uniforms.noiseSize=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetting",{get:function(){return this.uniforms.vignetting},set:function(t){this.uniforms.vignetting=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingAlpha",{get:function(){return this.uniforms.vignettingAlpha},set:function(t){this.uniforms.vignettingAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingBlur",{get:function(){return this.uniforms.vignettingBlur},set:function(t){this.uniforms.vignettingBlur=t},enumerable:!1,configurable:!0}),e.defaults={curvature:1,lineWidth:1,lineContrast:.25,verticalLine:!1,noise:0,noiseSize:1,seed:0,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3,time:0},e})(Be);/*! + * @pixi/filter-dot - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-dot is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var pl=function(r,e){return pl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},pl(r,e)};function z_(r,e){pl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var j_=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,V_=`precision mediump float; + +varying vec2 vTextureCoord; +varying vec4 vColor; + +uniform vec4 filterArea; +uniform sampler2D uSampler; + +uniform float angle; +uniform float scale; + +float pattern() +{ + float s = sin(angle), c = cos(angle); + vec2 tex = vTextureCoord * filterArea.xy; + vec2 point = vec2( + c * tex.x - s * tex.y, + s * tex.x + c * tex.y + ) * scale; + return (sin(point.x) * sin(point.y)) * 4.0; +} + +void main() +{ + vec4 color = texture2D(uSampler, vTextureCoord); + float average = (color.r + color.g + color.b) / 3.0; + gl_FragColor = vec4(vec3(average * 10.0 - 5.0 + pattern()), color.a); +} +`;(function(r){z_(e,r);function e(t,n){t===void 0&&(t=1),n===void 0&&(n=5);var i=r.call(this,j_,V_)||this;return i.scale=t,i.angle=n,i}return Object.defineProperty(e.prototype,"scale",{get:function(){return this.uniforms.scale},set:function(t){this.uniforms.scale=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.uniforms.angle},set:function(t){this.uniforms.angle=t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-drop-shadow - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-drop-shadow is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var ml=function(r,e){return ml=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},ml(r,e)};function G_(r,e){ml(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Uo=function(){return Uo=Object.assign||function(e){for(var t=arguments,n,i=1,o=arguments.length;i 1.0 || coord.y > 1.0) { + return; + } + + float cx = coord.x - 0.5; + float cy = (coord.y - 0.5) * aspect; + float ny = (-sinDir * cx + cosDir * cy) / aspect + 0.5; + + // displacementMap: repeat + // ny = ny > 1.0 ? ny - 1.0 : (ny < 0.0 ? 1.0 + ny : ny); + + // displacementMap: mirror + ny = ny > 1.0 ? 2.0 - ny : (ny < 0.0 ? -ny : ny); + + vec4 dc = texture2D(displacementMap, vec2(0.5, ny)); + + float displacement = (dc.r - dc.g) * (offset / filterArea.x); + + coord = vTextureCoord + vec2(cosDir * displacement, sinDir * displacement * aspect); + + if (fillMode == CLAMP) { + coord = clamp(coord, filterClamp.xy, filterClamp.zw); + } else { + if( coord.x > filterClamp.z ) { + if (fillMode == TRANSPARENT) { + discard; + } else if (fillMode == LOOP) { + coord.x -= filterClamp.z; + } else if (fillMode == MIRROR) { + coord.x = filterClamp.z * 2.0 - coord.x; + } + } else if( coord.x < filterClamp.x ) { + if (fillMode == TRANSPARENT) { + discard; + } else if (fillMode == LOOP) { + coord.x += filterClamp.z; + } else if (fillMode == MIRROR) { + coord.x *= -filterClamp.z; + } + } + + if( coord.y > filterClamp.w ) { + if (fillMode == TRANSPARENT) { + discard; + } else if (fillMode == LOOP) { + coord.y -= filterClamp.w; + } else if (fillMode == MIRROR) { + coord.y = filterClamp.w * 2.0 - coord.y; + } + } else if( coord.y < filterClamp.y ) { + if (fillMode == TRANSPARENT) { + discard; + } else if (fillMode == LOOP) { + coord.y += filterClamp.w; + } else if (fillMode == MIRROR) { + coord.y *= -filterClamp.w; + } + } + } + + gl_FragColor.r = texture2D(uSampler, coord + red * (1.0 - seed * 0.4) / filterArea.xy).r; + gl_FragColor.g = texture2D(uSampler, coord + green * (1.0 - seed * 0.3) / filterArea.xy).g; + gl_FragColor.b = texture2D(uSampler, coord + blue * (1.0 - seed * 0.2) / filterArea.xy).b; + gl_FragColor.a = texture2D(uSampler, coord).a; +} +`;(function(r){K_(e,r);function e(t){var n=r.call(this,Z_,J_)||this;return n.offset=100,n.fillMode=e.TRANSPARENT,n.average=!1,n.seed=0,n.minSize=8,n.sampleSize=512,n._slices=0,n._offsets=new Float32Array(1),n._sizes=new Float32Array(1),n._direction=-1,n.uniforms.dimensions=new Float32Array(2),n._canvas=document.createElement("canvas"),n._canvas.width=4,n._canvas.height=n.sampleSize,n.texture=pr.from(n._canvas,{scaleMode:Bt.NEAREST}),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,o){var s=n.filterFrame,a=s.width,l=s.height;this.uniforms.dimensions[0]=a,this.uniforms.dimensions[1]=l,this.uniforms.aspect=l/a,this.uniforms.seed=this.seed,this.uniforms.offset=this.offset,this.uniforms.fillMode=this.fillMode,t.applyFilter(this,n,i,o)},e.prototype._randomizeSizes=function(){var t=this._sizes,n=this._slices-1,i=this.sampleSize,o=Math.min(this.minSize/i,.9/this._slices);if(this.average){for(var s=this._slices,a=1,l=0;l0;i--){var o=Math.random()*i>>0,s=t[i];t[i]=t[o],t[o]=s}},e.prototype._randomizeOffsets=function(){for(var t=0;t0?o:0,c=o<0?-o:0;i.fillStyle="rgba("+u+", "+c+", 0, 1)",i.fillRect(0,s>>0,t,l+1>>0),s+=l}n.baseTexture.update(),this.uniforms.displacementMap=n},Object.defineProperty(e.prototype,"sizes",{get:function(){return this._sizes},set:function(t){for(var n=Math.min(this._slices,t.length),i=0;i>0)+1},Object.defineProperty(e.prototype,"offset",{get:function(){return this.uniforms.uOffset},set:function(t){this.uniforms.uOffset=t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-multi-color-replace - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-multi-color-replace is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var bl=function(r,e){return bl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},bl(r,e)};function ux(r,e){bl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var cx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,fx=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform float epsilon; + +const int MAX_COLORS = %maxColors%; + +uniform vec3 originalColors[MAX_COLORS]; +uniform vec3 targetColors[MAX_COLORS]; + +void main(void) +{ + gl_FragColor = texture2D(uSampler, vTextureCoord); + + float alpha = gl_FragColor.a; + if (alpha < 0.0001) + { + return; + } + + vec3 color = gl_FragColor.rgb / alpha; + + for(int i = 0; i < MAX_COLORS; i++) + { + vec3 origColor = originalColors[i]; + if (origColor.r < 0.0) + { + break; + } + vec3 colorDiff = origColor - color; + if (length(colorDiff) < epsilon) + { + vec3 targetColor = targetColors[i]; + gl_FragColor = vec4((targetColor + colorDiff) * alpha, alpha); + return; + } + } +} +`;(function(r){ux(e,r);function e(t,n,i){n===void 0&&(n=.05),i===void 0&&(i=t.length);var o=r.call(this,cx,fx.replace(/%maxColors%/g,i.toFixed(0)))||this;return o._replacements=[],o._maxColors=0,o.epsilon=n,o._maxColors=i,o.uniforms.originalColors=new Float32Array(i*3),o.uniforms.targetColors=new Float32Array(i*3),o.replacements=t,o}return Object.defineProperty(e.prototype,"replacements",{get:function(){return this._replacements},set:function(t){var n=this.uniforms.originalColors,i=this.uniforms.targetColors,o=t.length;if(o>this._maxColors)throw new Error("Length of replacements ("+o+") exceeds the maximum colors length ("+this._maxColors+")");n[o*3]=-1;for(var s=0;s 0.5) then: 1 - 2 * (1 - dst) * (1 - src) + return vec3((dst.x <= 0.5) ? (2.0 * src.x * dst.x) : (1.0 - 2.0 * (1.0 - dst.x) * (1.0 - src.x)), + (dst.y <= 0.5) ? (2.0 * src.y * dst.y) : (1.0 - 2.0 * (1.0 - dst.y) * (1.0 - src.y)), + (dst.z <= 0.5) ? (2.0 * src.z * dst.z) : (1.0 - 2.0 * (1.0 - dst.z) * (1.0 - src.z))); +} + + +void main() +{ + gl_FragColor = texture2D(uSampler, vTextureCoord); + vec3 color = gl_FragColor.rgb; + + if (sepia > 0.0) + { + float gray = (color.x + color.y + color.z) / 3.0; + vec3 grayscale = vec3(gray); + + color = Overlay(SEPIA_RGB, grayscale); + + color = grayscale + sepia * (color - grayscale); + } + + vec2 coord = vTextureCoord * filterArea.xy / dimensions.xy; + + if (vignetting > 0.0) + { + float outter = SQRT_2 - vignetting * SQRT_2; + vec2 dir = vec2(vec2(0.5, 0.5) - coord); + dir.y *= dimensions.y / dimensions.x; + float darker = clamp((outter - length(dir) * SQRT_2) / ( 0.00001 + vignettingBlur * SQRT_2), 0.0, 1.0); + color.rgb *= darker + (1.0 - darker) * (1.0 - vignettingAlpha); + } + + if (scratchDensity > seed && scratch != 0.0) + { + float phase = seed * 256.0; + float s = mod(floor(phase), 2.0); + float dist = 1.0 / scratchDensity; + float d = distance(coord, vec2(seed * dist, abs(s - seed * dist))); + if (d < seed * 0.6 + 0.4) + { + highp float period = scratchDensity * 10.0; + + float xx = coord.x * period + phase; + float aa = abs(mod(xx, 0.5) * 4.0); + float bb = mod(floor(xx / 0.5), 2.0); + float yy = (1.0 - bb) * aa + bb * (2.0 - aa); + + float kk = 2.0 * period; + float dw = scratchWidth / dimensions.x * (0.75 + seed); + float dh = dw * kk; + + float tine = (yy - (2.0 - dh)); + + if (tine > 0.0) { + float _sign = sign(scratch); + + tine = s * tine / period + scratch + 0.1; + tine = clamp(tine + 1.0, 0.5 + _sign * 0.5, 1.5 + _sign * 0.5); + + color.rgb *= tine; + } + } + } + + if (noise > 0.0 && noiseSize > 0.0) + { + vec2 pixelCoord = vTextureCoord.xy * filterArea.xy; + pixelCoord.x = floor(pixelCoord.x / noiseSize); + pixelCoord.y = floor(pixelCoord.y / noiseSize); + // vec2 d = pixelCoord * noiseSize * vec2(1024.0 + seed * 512.0, 1024.0 - seed * 512.0); + // float _noise = snoise(d) * 0.5; + float _noise = rand(pixelCoord * noiseSize * seed) - 0.5; + color += _noise * noise; + } + + gl_FragColor.rgb = color; +} +`;(function(r){hx(e,r);function e(t,n){n===void 0&&(n=0);var i=r.call(this,dx,px)||this;return i.seed=0,i.uniforms.dimensions=new Float32Array(2),typeof t=="number"?(i.seed=t,t=void 0):i.seed=n,Object.assign(i,e.defaults,t),i}return e.prototype.apply=function(t,n,i,o){var s,a;this.uniforms.dimensions[0]=(s=n.filterFrame)===null||s===void 0?void 0:s.width,this.uniforms.dimensions[1]=(a=n.filterFrame)===null||a===void 0?void 0:a.height,this.uniforms.seed=this.seed,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"sepia",{get:function(){return this.uniforms.sepia},set:function(t){this.uniforms.sepia=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.noise},set:function(t){this.uniforms.noise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"noiseSize",{get:function(){return this.uniforms.noiseSize},set:function(t){this.uniforms.noiseSize=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratch",{get:function(){return this.uniforms.scratch},set:function(t){this.uniforms.scratch=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratchDensity",{get:function(){return this.uniforms.scratchDensity},set:function(t){this.uniforms.scratchDensity=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scratchWidth",{get:function(){return this.uniforms.scratchWidth},set:function(t){this.uniforms.scratchWidth=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignetting",{get:function(){return this.uniforms.vignetting},set:function(t){this.uniforms.vignetting=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingAlpha",{get:function(){return this.uniforms.vignettingAlpha},set:function(t){this.uniforms.vignettingAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"vignettingBlur",{get:function(){return this.uniforms.vignettingBlur},set:function(t){this.uniforms.vignettingBlur=t},enumerable:!1,configurable:!0}),e.defaults={sepia:.3,noise:.3,noiseSize:1,scratch:.5,scratchDensity:.3,scratchWidth:1,vignetting:.3,vignettingAlpha:1,vignettingBlur:.3},e})(Be);/*! + * @pixi/filter-outline - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-outline is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Tl=function(r,e){return Tl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Tl(r,e)};function mx(r,e){Tl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var gx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,vx=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform vec2 thickness; +uniform vec4 outlineColor; +uniform vec4 filterClamp; + +const float DOUBLE_PI = 3.14159265358979323846264 * 2.; + +void main(void) { + vec4 ownColor = texture2D(uSampler, vTextureCoord); + vec4 curColor; + float maxAlpha = 0.; + vec2 displaced; + for (float angle = 0.; angle <= DOUBLE_PI; angle += \${angleStep}) { + displaced.x = vTextureCoord.x + thickness.x * cos(angle); + displaced.y = vTextureCoord.y + thickness.y * sin(angle); + curColor = texture2D(uSampler, clamp(displaced, filterClamp.xy, filterClamp.zw)); + maxAlpha = max(maxAlpha, curColor.a); + } + float resultAlpha = max(maxAlpha, ownColor.a); + gl_FragColor = vec4((ownColor.rgb + outlineColor.rgb * (1. - ownColor.a)) * resultAlpha, resultAlpha); +} +`;(function(r){mx(e,r);function e(t,n,i){t===void 0&&(t=1),n===void 0&&(n=0),i===void 0&&(i=.1);var o=r.call(this,gx,vx.replace(/\$\{angleStep\}/,e.getAngleStep(i)))||this;return o._thickness=1,o.uniforms.thickness=new Float32Array([0,0]),o.uniforms.outlineColor=new Float32Array([0,0,0,1]),Object.assign(o,{thickness:t,color:n,quality:i}),o}return e.getAngleStep=function(t){var n=Math.max(t*e.MAX_SAMPLES,e.MIN_SAMPLES);return(Math.PI*2/n).toFixed(7)},e.prototype.apply=function(t,n,i,o){this.uniforms.thickness[0]=this._thickness/n._frame.width,this.uniforms.thickness[1]=this._thickness/n._frame.height,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"color",{get:function(){return rn(this.uniforms.outlineColor)},set:function(t){en(t,this.uniforms.outlineColor)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness=t,this.padding=t},enumerable:!1,configurable:!0}),e.MIN_SAMPLES=1,e.MAX_SAMPLES=100,e})(Be);/*! + * @pixi/filter-pixelate - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-pixelate is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Sl=function(r,e){return Sl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Sl(r,e)};function yx(r,e){Sl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var _x=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,xx=`precision mediump float; + +varying vec2 vTextureCoord; + +uniform vec2 size; +uniform sampler2D uSampler; + +uniform vec4 filterArea; + +vec2 mapCoord( vec2 coord ) +{ + coord *= filterArea.xy; + coord += filterArea.zw; + + return coord; +} + +vec2 unmapCoord( vec2 coord ) +{ + coord -= filterArea.zw; + coord /= filterArea.xy; + + return coord; +} + +vec2 pixelate(vec2 coord, vec2 size) +{ + return floor( coord / size ) * size; +} + +void main(void) +{ + vec2 coord = mapCoord(vTextureCoord); + + coord = pixelate(coord, size); + + coord = unmapCoord(coord); + + gl_FragColor = texture2D(uSampler, coord); +} +`;(function(r){yx(e,r);function e(t){t===void 0&&(t=10);var n=r.call(this,_x,xx)||this;return n.size=t,n}return Object.defineProperty(e.prototype,"size",{get:function(){return this.uniforms.size},set:function(t){typeof t=="number"&&(t=[t,t]),this.uniforms.size=t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-radial-blur - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-radial-blur is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var El=function(r,e){return El=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},El(r,e)};function bx(r,e){El(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var wx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Tx=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform vec4 filterArea; + +uniform float uRadian; +uniform vec2 uCenter; +uniform float uRadius; +uniform int uKernelSize; + +const int MAX_KERNEL_SIZE = 2048; + +void main(void) +{ + vec4 color = texture2D(uSampler, vTextureCoord); + + if (uKernelSize == 0) + { + gl_FragColor = color; + return; + } + + float aspect = filterArea.y / filterArea.x; + vec2 center = uCenter.xy / filterArea.xy; + float gradient = uRadius / filterArea.x * 0.3; + float radius = uRadius / filterArea.x - gradient * 0.5; + int k = uKernelSize - 1; + + vec2 coord = vTextureCoord; + vec2 dir = vec2(center - coord); + float dist = length(vec2(dir.x, dir.y * aspect)); + + float radianStep = uRadian; + if (radius >= 0.0 && dist > radius) { + float delta = dist - radius; + float gap = gradient; + float scale = 1.0 - abs(delta / gap); + if (scale <= 0.0) { + gl_FragColor = color; + return; + } + radianStep *= scale; + } + radianStep /= float(k); + + float s = sin(radianStep); + float c = cos(radianStep); + mat2 rotationMatrix = mat2(vec2(c, -s), vec2(s, c)); + + for(int i = 0; i < MAX_KERNEL_SIZE - 1; i++) { + if (i == k) { + break; + } + + coord -= center; + coord.y *= aspect; + coord = rotationMatrix * coord; + coord.y /= aspect; + coord += center; + + vec4 sample = texture2D(uSampler, coord); + + // switch to pre-multiplied alpha to correctly blur transparent images + // sample.rgb *= sample.a; + + color += sample; + } + + gl_FragColor = color / float(uKernelSize); +} +`;(function(r){bx(e,r);function e(t,n,i,o){t===void 0&&(t=0),n===void 0&&(n=[0,0]),i===void 0&&(i=5),o===void 0&&(o=-1);var s=r.call(this,wx,Tx)||this;return s._angle=0,s.angle=t,s.center=n,s.kernelSize=i,s.radius=o,s}return e.prototype.apply=function(t,n,i,o){this.uniforms.uKernelSize=this._angle!==0?this.kernelSize:0,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=t,this.uniforms.uRadian=t*Math.PI/180},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.uCenter},set:function(t){this.uniforms.uCenter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.uRadius},set:function(t){(t<0||t===1/0)&&(t=-1),this.uniforms.uRadius=t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-reflection - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-reflection is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Cl=function(r,e){return Cl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Cl(r,e)};function Sx(r,e){Cl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ex=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Cx=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; + +uniform vec4 filterArea; +uniform vec4 filterClamp; +uniform vec2 dimensions; + +uniform bool mirror; +uniform float boundary; +uniform vec2 amplitude; +uniform vec2 waveLength; +uniform vec2 alpha; +uniform float time; + +float rand(vec2 co) { + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + +void main(void) +{ + vec2 pixelCoord = vTextureCoord.xy * filterArea.xy; + vec2 coord = pixelCoord / dimensions; + + if (coord.y < boundary) { + gl_FragColor = texture2D(uSampler, vTextureCoord); + return; + } + + float k = (coord.y - boundary) / (1. - boundary + 0.0001); + float areaY = boundary * dimensions.y / filterArea.y; + float v = areaY + areaY - vTextureCoord.y; + float y = mirror ? v : vTextureCoord.y; + + float _amplitude = ((amplitude.y - amplitude.x) * k + amplitude.x ) / filterArea.x; + float _waveLength = ((waveLength.y - waveLength.x) * k + waveLength.x) / filterArea.y; + float _alpha = (alpha.y - alpha.x) * k + alpha.x; + + float x = vTextureCoord.x + cos(v * 6.28 / _waveLength - time) * _amplitude; + x = clamp(x, filterClamp.x, filterClamp.z); + + vec4 color = texture2D(uSampler, vec2(x, y)); + + gl_FragColor = color * _alpha; +} +`;(function(r){Sx(e,r);function e(t){var n=r.call(this,Ex,Cx)||this;return n.time=0,n.uniforms.amplitude=new Float32Array(2),n.uniforms.waveLength=new Float32Array(2),n.uniforms.alpha=new Float32Array(2),n.uniforms.dimensions=new Float32Array(2),Object.assign(n,e.defaults,t),n}return e.prototype.apply=function(t,n,i,o){var s,a;this.uniforms.dimensions[0]=(s=n.filterFrame)===null||s===void 0?void 0:s.width,this.uniforms.dimensions[1]=(a=n.filterFrame)===null||a===void 0?void 0:a.height,this.uniforms.time=this.time,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"mirror",{get:function(){return this.uniforms.mirror},set:function(t){this.uniforms.mirror=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"boundary",{get:function(){return this.uniforms.boundary},set:function(t){this.uniforms.boundary=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"amplitude",{get:function(){return this.uniforms.amplitude},set:function(t){this.uniforms.amplitude[0]=t[0],this.uniforms.amplitude[1]=t[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"waveLength",{get:function(){return this.uniforms.waveLength},set:function(t){this.uniforms.waveLength[0]=t[0],this.uniforms.waveLength[1]=t[1]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.alpha},set:function(t){this.uniforms.alpha[0]=t[0],this.uniforms.alpha[1]=t[1]},enumerable:!1,configurable:!0}),e.defaults={mirror:!0,boundary:.5,amplitude:[0,20],waveLength:[30,100],alpha:[1,1],time:0},e})(Be);/*! + * @pixi/filter-rgb-split - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-rgb-split is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Al=function(r,e){return Al=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Al(r,e)};function Ax(r,e){Al(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ix=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Px=`precision mediump float; + +varying vec2 vTextureCoord; + +uniform sampler2D uSampler; +uniform vec4 filterArea; +uniform vec2 red; +uniform vec2 green; +uniform vec2 blue; + +void main(void) +{ + gl_FragColor.r = texture2D(uSampler, vTextureCoord + red/filterArea.xy).r; + gl_FragColor.g = texture2D(uSampler, vTextureCoord + green/filterArea.xy).g; + gl_FragColor.b = texture2D(uSampler, vTextureCoord + blue/filterArea.xy).b; + gl_FragColor.a = texture2D(uSampler, vTextureCoord).a; +} +`;(function(r){Ax(e,r);function e(t,n,i){t===void 0&&(t=[-10,0]),n===void 0&&(n=[0,10]),i===void 0&&(i=[0,0]);var o=r.call(this,Ix,Px)||this;return o.red=t,o.green=n,o.blue=i,o}return Object.defineProperty(e.prototype,"red",{get:function(){return this.uniforms.red},set:function(t){this.uniforms.red=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"green",{get:function(){return this.uniforms.green},set:function(t){this.uniforms.green=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"blue",{get:function(){return this.uniforms.blue},set:function(t){this.uniforms.blue=t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-shockwave - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-shockwave is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Il=function(r,e){return Il=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Il(r,e)};function Mx(r,e){Il(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var kx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Ox=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform vec4 filterArea; +uniform vec4 filterClamp; + +uniform vec2 center; + +uniform float amplitude; +uniform float wavelength; +// uniform float power; +uniform float brightness; +uniform float speed; +uniform float radius; + +uniform float time; + +const float PI = 3.14159; + +void main() +{ + float halfWavelength = wavelength * 0.5 / filterArea.x; + float maxRadius = radius / filterArea.x; + float currentRadius = time * speed / filterArea.x; + + float fade = 1.0; + + if (maxRadius > 0.0) { + if (currentRadius > maxRadius) { + gl_FragColor = texture2D(uSampler, vTextureCoord); + return; + } + fade = 1.0 - pow(currentRadius / maxRadius, 2.0); + } + + vec2 dir = vec2(vTextureCoord - center / filterArea.xy); + dir.y *= filterArea.y / filterArea.x; + float dist = length(dir); + + if (dist <= 0.0 || dist < currentRadius - halfWavelength || dist > currentRadius + halfWavelength) { + gl_FragColor = texture2D(uSampler, vTextureCoord); + return; + } + + vec2 diffUV = normalize(dir); + + float diff = (dist - currentRadius) / halfWavelength; + + float p = 1.0 - pow(abs(diff), 2.0); + + // float powDiff = diff * pow(p, 2.0) * ( amplitude * fade ); + float powDiff = 1.25 * sin(diff * PI) * p * ( amplitude * fade ); + + vec2 offset = diffUV * powDiff / filterArea.xy; + + // Do clamp : + vec2 coord = vTextureCoord + offset; + vec2 clampedCoord = clamp(coord, filterClamp.xy, filterClamp.zw); + vec4 color = texture2D(uSampler, clampedCoord); + if (coord != clampedCoord) { + color *= max(0.0, 1.0 - length(coord - clampedCoord)); + } + + // No clamp : + // gl_FragColor = texture2D(uSampler, vTextureCoord + offset); + + color.rgb *= 1.0 + (brightness - 1.0) * p * fade; + + gl_FragColor = color; +} +`;(function(r){Mx(e,r);function e(t,n,i){t===void 0&&(t=[0,0]),i===void 0&&(i=0);var o=r.call(this,kx,Ox)||this;return o.center=t,Object.assign(o,e.defaults,n),o.time=i,o}return e.prototype.apply=function(t,n,i,o){this.uniforms.time=this.time,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.center},set:function(t){this.uniforms.center=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"amplitude",{get:function(){return this.uniforms.amplitude},set:function(t){this.uniforms.amplitude=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"wavelength",{get:function(){return this.uniforms.wavelength},set:function(t){this.uniforms.wavelength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"brightness",{get:function(){return this.uniforms.brightness},set:function(t){this.uniforms.brightness=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"speed",{get:function(){return this.uniforms.speed},set:function(t){this.uniforms.speed=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),e.defaults={amplitude:30,wavelength:160,brightness:1,speed:500,radius:-1},e})(Be);/*! + * @pixi/filter-simple-lightmap - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-simple-lightmap is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Pl=function(r,e){return Pl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Pl(r,e)};function Rx(r,e){Pl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Fx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Lx=`varying vec2 vTextureCoord; +uniform sampler2D uSampler; +uniform sampler2D uLightmap; +uniform vec4 filterArea; +uniform vec2 dimensions; +uniform vec4 ambientColor; +void main() { + vec4 diffuseColor = texture2D(uSampler, vTextureCoord); + vec2 lightCoord = (vTextureCoord * filterArea.xy) / dimensions; + vec4 light = texture2D(uLightmap, lightCoord); + vec3 ambient = ambientColor.rgb * ambientColor.a; + vec3 intensity = ambient + light.rgb; + vec3 finalColor = diffuseColor.rgb * intensity; + gl_FragColor = vec4(finalColor, diffuseColor.a); +} +`;(function(r){Rx(e,r);function e(t,n,i){n===void 0&&(n=0),i===void 0&&(i=1);var o=r.call(this,Fx,Lx)||this;return o._color=0,o.uniforms.dimensions=new Float32Array(2),o.uniforms.ambientColor=new Float32Array([0,0,0,i]),o.texture=t,o.color=n,o}return e.prototype.apply=function(t,n,i,o){var s,a;this.uniforms.dimensions[0]=(s=n.filterFrame)===null||s===void 0?void 0:s.width,this.uniforms.dimensions[1]=(a=n.filterFrame)===null||a===void 0?void 0:a.height,t.applyFilter(this,n,i,o)},Object.defineProperty(e.prototype,"texture",{get:function(){return this.uniforms.uLightmap},set:function(t){this.uniforms.uLightmap=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"color",{get:function(){return this._color},set:function(t){var n=this.uniforms.ambientColor;typeof t=="number"?(en(t,n),this._color=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],this._color=rn(n))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.ambientColor[3]},set:function(t){this.uniforms.ambientColor[3]=t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-tilt-shift - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-tilt-shift is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Ml=function(r,e){return Ml=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Ml(r,e)};function es(r,e){Ml(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Nx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Dx=`varying vec2 vTextureCoord; + +uniform sampler2D uSampler; +uniform float blur; +uniform float gradientBlur; +uniform vec2 start; +uniform vec2 end; +uniform vec2 delta; +uniform vec2 texSize; + +float random(vec3 scale, float seed) +{ + return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed); +} + +void main(void) +{ + vec4 color = vec4(0.0); + float total = 0.0; + + float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0); + vec2 normal = normalize(vec2(start.y - end.y, end.x - start.x)); + float radius = smoothstep(0.0, 1.0, abs(dot(vTextureCoord * texSize - start, normal)) / gradientBlur) * blur; + + for (float t = -30.0; t <= 30.0; t++) + { + float percent = (t + offset - 0.5) / 30.0; + float weight = 1.0 - abs(percent); + vec4 sample = texture2D(uSampler, vTextureCoord + delta / texSize * percent * radius); + sample.rgb *= sample.a; + color += sample * weight; + total += weight; + } + + color /= total; + color.rgb /= color.a + 0.00001; + + gl_FragColor = color; +} +`,tp=function(r){es(e,r);function e(t,n,i,o){t===void 0&&(t=100),n===void 0&&(n=600);var s=r.call(this,Nx,Dx)||this;return s.uniforms.blur=t,s.uniforms.gradientBlur=n,s.uniforms.start=i||new at(0,window.innerHeight/2),s.uniforms.end=o||new at(600,window.innerHeight/2),s.uniforms.delta=new at(30,30),s.uniforms.texSize=new at(window.innerWidth,window.innerHeight),s.updateDelta(),s}return e.prototype.updateDelta=function(){this.uniforms.delta.x=0,this.uniforms.delta.y=0},Object.defineProperty(e.prototype,"blur",{get:function(){return this.uniforms.blur},set:function(t){this.uniforms.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gradientBlur",{get:function(){return this.uniforms.gradientBlur},set:function(t){this.uniforms.gradientBlur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.uniforms.start},set:function(t){this.uniforms.start=t,this.updateDelta()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.uniforms.end},set:function(t){this.uniforms.end=t,this.updateDelta()},enumerable:!1,configurable:!0}),e}(Be),Bx=function(r){es(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,n=this.uniforms.end.y-this.uniforms.start.y,i=Math.sqrt(t*t+n*n);this.uniforms.delta.x=t/i,this.uniforms.delta.y=n/i},e}(tp),Ux=function(r){es(e,r);function e(){return r!==null&&r.apply(this,arguments)||this}return e.prototype.updateDelta=function(){var t=this.uniforms.end.x-this.uniforms.start.x,n=this.uniforms.end.y-this.uniforms.start.y,i=Math.sqrt(t*t+n*n);this.uniforms.delta.x=-n/i,this.uniforms.delta.y=t/i},e}(tp);(function(r){es(e,r);function e(t,n,i,o){t===void 0&&(t=100),n===void 0&&(n=600);var s=r.call(this)||this;return s.tiltShiftXFilter=new Bx(t,n,i,o),s.tiltShiftYFilter=new Ux(t,n,i,o),s}return e.prototype.apply=function(t,n,i,o){var s=t.getFilterTexture();this.tiltShiftXFilter.apply(t,n,s,1),this.tiltShiftYFilter.apply(t,s,i,o),t.returnFilterTexture(s)},Object.defineProperty(e.prototype,"blur",{get:function(){return this.tiltShiftXFilter.blur},set:function(t){this.tiltShiftXFilter.blur=this.tiltShiftYFilter.blur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"gradientBlur",{get:function(){return this.tiltShiftXFilter.gradientBlur},set:function(t){this.tiltShiftXFilter.gradientBlur=this.tiltShiftYFilter.gradientBlur=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){return this.tiltShiftXFilter.start},set:function(t){this.tiltShiftXFilter.start=this.tiltShiftYFilter.start=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.tiltShiftXFilter.end},set:function(t){this.tiltShiftXFilter.end=this.tiltShiftYFilter.end=t},enumerable:!1,configurable:!0}),e})(Be);/*! + * @pixi/filter-twist - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-twist is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var kl=function(r,e){return kl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},kl(r,e)};function zx(r,e){kl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var jx=`attribute vec2 aVertexPosition; +attribute vec2 aTextureCoord; + +uniform mat3 projectionMatrix; + +varying vec2 vTextureCoord; + +void main(void) +{ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; +}`,Vx=`varying vec2 vTextureCoord; + +uniform sampler2D uSampler; +uniform float radius; +uniform float angle; +uniform vec2 offset; +uniform vec4 filterArea; + +vec2 mapCoord( vec2 coord ) +{ + coord *= filterArea.xy; + coord += filterArea.zw; + + return coord; +} + +vec2 unmapCoord( vec2 coord ) +{ + coord -= filterArea.zw; + coord /= filterArea.xy; + + return coord; +} + +vec2 twist(vec2 coord) +{ + coord -= offset; + + float dist = length(coord); + + if (dist < radius) + { + float ratioDist = (radius - dist) / radius; + float angleMod = ratioDist * ratioDist * angle; + float s = sin(angleMod); + float c = cos(angleMod); + coord = vec2(coord.x * c - coord.y * s, coord.x * s + coord.y * c); + } + + coord += offset; + + return coord; +} + +void main(void) +{ + + vec2 coord = mapCoord(vTextureCoord); + + coord = twist(coord); + + coord = unmapCoord(coord); + + gl_FragColor = texture2D(uSampler, coord ); + +} +`;(function(r){zx(e,r);function e(t){var n=r.call(this,jx,Vx)||this;return Object.assign(n,e.defaults,t),n}return Object.defineProperty(e.prototype,"offset",{get:function(){return this.uniforms.offset},set:function(t){this.uniforms.offset=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.radius},set:function(t){this.uniforms.radius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"angle",{get:function(){return this.uniforms.angle},set:function(t){this.uniforms.angle=t},enumerable:!1,configurable:!0}),e.defaults={radius:200,angle:4,padding:20,offset:new at},e})(Be);/*! + * @pixi/filter-zoom-blur - v4.2.0 + * Compiled Fri, 05 Aug 2022 19:53:35 UTC + * + * @pixi/filter-zoom-blur is licensed under the MIT License. + * http://www.opensource.org/licenses/mit-license + *//*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Ol=function(r,e){return Ol=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Ol(r,e)};function Gx(r,e){Ol(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function $x(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i= 0.0 && dist > radius) { // radius < 0 means it's infinity + delta = dist - radius; + gap = gradient; + } + + if (delta > 0.0) { + float normalCount = gap / filterArea.x; + delta = (normalCount - delta) / normalCount; + countLimit *= delta; + strength *= delta; + if (countLimit < 1.0) + { + gl_FragColor = texture2D(uSampler, vTextureCoord); + return; + } + } + + // randomize the lookup values to hide the fixed number of samples + float offset = rand(vTextureCoord, 0.0); + + float total = 0.0; + vec4 color = vec4(0.0); + + dir *= strength; + + for (float t = 0.0; t < MAX_KERNEL_SIZE; t++) { + float percent = (t + offset) / MAX_KERNEL_SIZE; + float weight = 4.0 * (percent - percent * percent); + vec2 p = vTextureCoord + dir * percent; + vec4 sample = texture2D(uSampler, p); + + // switch to pre-multiplied alpha to correctly blur transparent images + // sample.rgb *= sample.a; + + color += sample * weight; + total += weight; + + if (t > countLimit){ + break; + } + } + + color /= total; + // switch back from pre-multiplied alpha + // color.rgb /= color.a + 0.00001; + + gl_FragColor = color; +} +`;(function(r){Gx(e,r);function e(t){var n=this,i=Object.assign(e.defaults,t),o=i.maxKernelSize,s=$x(i,["maxKernelSize"]);return n=r.call(this,Hx,Xx.replace("${maxKernelSize}",o.toFixed(1)))||this,Object.assign(n,s),n}return Object.defineProperty(e.prototype,"center",{get:function(){return this.uniforms.uCenter},set:function(t){this.uniforms.uCenter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"strength",{get:function(){return this.uniforms.uStrength},set:function(t){this.uniforms.uStrength=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"innerRadius",{get:function(){return this.uniforms.uInnerRadius},set:function(t){this.uniforms.uInnerRadius=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"radius",{get:function(){return this.uniforms.uRadius},set:function(t){(t<0||t===1/0)&&(t=-1),this.uniforms.uRadius=t},enumerable:!1,configurable:!0}),e.defaults={strength:.1,center:[0,0],innerRadius:0,radius:-1,maxKernelSize:32},e})(Be);var Kn=Math.pow,st=(r,e,t)=>new Promise((n,i)=>{var o=l=>{try{a(t.next(l))}catch(u){i(u)}},s=l=>{try{a(t.throw(l))}catch(u){i(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,s);a((t=t.apply(r,e)).next())});class yu{constructor(){this._breathParameters=[],this._currentTime=0}static create(){return new yu}setParameters(e){this._breathParameters=e}getParameters(){return this._breathParameters}updateParameters(e,t){this._currentTime+=t;const n=this._currentTime*2*3.14159;for(let i=0;i=1&&(n=1,this._blinkingState=Xt.EyeState_Closed,this._stateStartTimeSeconds=this._userTimeSeconds),t=1-n;break;case Xt.EyeState_Closed:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds,n>=1&&(this._blinkingState=Xt.EyeState_Opening,this._stateStartTimeSeconds=this._userTimeSeconds),t=0;break;case Xt.EyeState_Opening:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds,n>=1&&(n=1,this._blinkingState=Xt.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming()),t=n;break;case Xt.EyeState_Interval:this._nextBlinkingTime(r[r.EyeState_First=0]="EyeState_First",r[r.EyeState_Interval=1]="EyeState_Interval",r[r.EyeState_Closing=2]="EyeState_Closing",r[r.EyeState_Closed=3]="EyeState_Closed",r[r.EyeState_Opening=4]="EyeState_Opening",r))(Xt||{});const Wx=.001,kf=.5;class _u{static create(e){const t=new _u;typeof e.FadeInTime=="number"&&(t._fadeTimeSeconds=e.FadeInTime,t._fadeTimeSeconds<=0&&(t._fadeTimeSeconds=kf));const n=e.Groups,i=n.length;for(let o=0;oWx){if(o>=0)break;o=u,s=e.getPartOpacityByIndex(c),s+=t/this._fadeTimeSeconds,s>1&&(s=1)}}o<0&&(o=0,s=1);for(let u=n;ul&&(p=1-l/(1-s)),f>p&&(f=p),e.setPartOpacityByIndex(c,f)}}}constructor(){this._fadeTimeSeconds=kf,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class zo{constructor(e){this.parameterIndex=0,this.partIndex=0,this.partId="",this.link=[],e!=null&&this.assignment(e)}assignment(e){return this.partId=e.partId,this.link=e.link.map(t=>t.clone()),this}initialize(e){this.parameterIndex=e.getParameterIndex(this.partId),this.partIndex=e.getPartIndex(this.partId),e.setParameterValueByIndex(this.parameterIndex,1)}clone(){const e=new zo;return e.partId=this.partId,e.parameterIndex=this.parameterIndex,e.partIndex=this.partIndex,e.link=this.link.map(t=>t.clone()),e}}class ke{constructor(e,t){this.x=e||0,this.y=t||0}add(e){const t=new ke(0,0);return t.x=this.x+e.x,t.y=this.y+e.y,t}substract(e){const t=new ke(0,0);return t.x=this.x-e.x,t.y=this.y-e.y,t}multiply(e){const t=new ke(0,0);return t.x=this.x*e.x,t.y=this.y*e.y,t}multiplyByScaler(e){return this.multiply(new ke(e,e))}division(e){const t=new ke(0,0);return t.x=this.x/e.x,t.y=this.y/e.y,t}divisionByScalar(e){return this.division(new ke(e,e))}getLength(){return Math.sqrt(this.x*this.x+this.y*this.y)}getDistanceWith(e){return Math.sqrt((this.x-e.x)*(this.x-e.x)+(this.y-e.y)*(this.y-e.y))}dot(e){return this.x*e.x+this.y*e.y}normalize(){const e=Math.pow(this.x*this.x+this.y*this.y,.5);this.x=this.x/e,this.y=this.y/e}isEqual(e){return this.x==e.x&&this.y==e.y}isNotEqual(e){return!this.isEqual(e)}}const bo=class{static range(r,e,t){return rt&&(r=t),r}static sin(r){return Math.sin(r)}static cos(r){return Math.cos(r)}static abs(r){return Math.abs(r)}static sqrt(r){return Math.sqrt(r)}static cbrt(r){if(r===0)return r;let e=r;const t=e<0;t&&(e=-e);let n;return e===1/0?n=1/0:(n=Math.exp(Math.log(e)/3),n=(e/(n*n)+2*n)/3),t?-n:n}static getEasingSine(r){return r<0?0:r>1?1:.5-.5*this.cos(r*Math.PI)}static max(r,e){return r>e?r:e}static min(r,e){return r>e?e:r}static degreesToRadian(r){return r/180*Math.PI}static radianToDegrees(r){return r*180/Math.PI}static directionToRadian(r,e){const t=Math.atan2(e.y,e.x),n=Math.atan2(r.y,r.x);let i=t-n;for(;i<-Math.PI;)i+=Math.PI*2;for(;i>Math.PI;)i-=Math.PI*2;return i}static directionToDegrees(r,e){const t=this.directionToRadian(r,e);let n=this.radianToDegrees(t);return e.x-r.x>0&&(n=-n),n}static radianToDirection(r){const e=new ke;return e.x=this.sin(r),e.y=this.cos(r),e}static quadraticEquation(r,e,t){return this.abs(r)1&&(e=1),t<0?t=0:t>1&&(t=1),n<0?n=0:n>1&&(n=1),i<0?i=0:i>1&&(i=1),this._modelColor.R=e,this._modelColor.G=t,this._modelColor.B=n,this._modelColor.A=i}getModelColor(){return Object.assign({},this._modelColor)}setIsPremultipliedAlpha(e){this._isPremultipliedAlpha=e}isPremultipliedAlpha(){return this._isPremultipliedAlpha}setIsCulling(e){this._isCulling=e}isCulling(){return this._isCulling}setAnisotropy(e){this._anisortopy=e}getAnisotropy(){return this._anisortopy}getModel(){return this._model}constructor(){this._isCulling=!1,this._isPremultipliedAlpha=!1,this._anisortopy=0,this._modelColor=new di,this._mvpMatrix4x4=new Zt,this._mvpMatrix4x4.loadIdentity()}}var Dn=(r=>(r[r.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",r[r.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",r[r.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative",r))(Dn||{});class di{constructor(){this.R=1,this.G=1,this.B=1,this.A=1}}let on=!1,Ar=!1,Ir;const fa={vertexOffset:0,vertexStep:2};class ki{static startUp(e){if(on)return ai("CubismFramework.startUp() is already done."),on;if(Live2DCubismCore._isStarted)return on=!0,!0;if(Live2DCubismCore._isStarted=!0,Ir=e,Ir&&Live2DCubismCore.Logging.csmSetLogFunction(Ir.logFunction),on=!0,on){const t=Live2DCubismCore.Version.csmGetVersion(),n=(t&4278190080)>>24,i=(t&16711680)>>16,o=t&65535,s=t;ai("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+n).slice(-2),("00"+i).slice(-2),("0000"+o).slice(-4),s)}return ai("CubismFramework.startUp() is complete."),on}static cleanUp(){on=!1,Ar=!1,Ir=void 0}static initialize(){if(!on){pi("CubismFramework is not started.");return}if(Ar){pi("CubismFramework.initialize() skipped, already initialized.");return}Ar=!0,ai("CubismFramework.initialize() is complete.")}static dispose(){if(!on){pi("CubismFramework is not started.");return}if(!Ar){pi("CubismFramework.dispose() skipped, not initialized.");return}xu.staticRelease(),Ar=!1,ai("CubismFramework.dispose() is complete.")}static isStarted(){return on}static isInitialized(){return Ar}static coreLogFunction(e){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(e)}static getLoggingLevel(){return Ir!=null?Ir.loggingLevel:xr.LogLevel_Off}constructor(){}}var xr=(r=>(r[r.LogLevel_Verbose=0]="LogLevel_Verbose",r[r.LogLevel_Debug=1]="LogLevel_Debug",r[r.LogLevel_Info=2]="LogLevel_Info",r[r.LogLevel_Warning=3]="LogLevel_Warning",r[r.LogLevel_Error=4]="LogLevel_Error",r[r.LogLevel_Off=5]="LogLevel_Off",r))(xr||{});const Zi=()=>{};function Of(r,...e){ts.print(xr.LogLevel_Debug,"[CSM][D]"+r+` +`,e)}function ai(r,...e){ts.print(xr.LogLevel_Info,"[CSM][I]"+r+` +`,e)}function pi(r,...e){ts.print(xr.LogLevel_Warning,"[CSM][W]"+r+` +`,e)}function Fr(r,...e){ts.print(xr.LogLevel_Error,"[CSM][E]"+r+` +`,e)}class ts{static print(e,t,n){if(en[a]);i(o)}static dumpBytes(e,t,n){for(let i=0;i0?this.print(e,` +`):i%8==0&&i>0&&this.print(e," "),this.print(e,"{0} ",[t[i]&255]);this.print(e,` +`)}constructor(){}}class qx{update(){this._model.update(),this._model.drawables.resetDynamicFlags()}getCanvasWidth(){return this._model==null?0:this._model.canvasinfo.CanvasWidth/this._model.canvasinfo.PixelsPerUnit}getCanvasHeight(){return this._model==null?0:this._model.canvasinfo.CanvasHeight/this._model.canvasinfo.PixelsPerUnit}saveParameters(){const e=this._model.parameters.count,t=this._savedParameters.length;for(let n=0;nt&&(t=this._model.parameters.minimumValues[e]),this._parameterValues[e]=n==1?t:this._parameterValues[e]=this._parameterValues[e]*(1-n)+t*n}setParameterValueById(e,t,n=1){const i=this.getParameterIndex(e);this.setParameterValueByIndex(i,t,n)}addParameterValueByIndex(e,t,n=1){this.setParameterValueByIndex(e,this.getParameterValueByIndex(e)+t*n)}addParameterValueById(e,t,n=1){const i=this.getParameterIndex(e);this.addParameterValueByIndex(i,t,n)}multiplyParameterValueById(e,t,n=1){const i=this.getParameterIndex(e);this.multiplyParameterValueByIndex(i,t,n)}multiplyParameterValueByIndex(e,t,n=1){this.setParameterValueByIndex(e,this.getParameterValueByIndex(e)*(1+(t-1)*n))}getDrawableIds(){return this._drawableIds.slice()}getDrawableIndex(e){const t=this._model.drawables.count;for(let n=0;nt&&(e=t);for(let n=0;n0&&t.getEndTime()(r[r.ExpressionBlendType_Add=0]="ExpressionBlendType_Add",r[r.ExpressionBlendType_Multiply=1]="ExpressionBlendType_Multiply",r[r.ExpressionBlendType_Overwrite=2]="ExpressionBlendType_Overwrite",r))(ir||{}),Oi;(r=>{r.supportMoreMaskDivisions=!0,r.setOpacityFromMotion=!1})(Oi||(Oi={}));var or=(r=>(r[r.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",r[r.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",r[r.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity",r))(or||{}),sn=(r=>(r[r.CubismMotionSegmentType_Linear=0]="CubismMotionSegmentType_Linear",r[r.CubismMotionSegmentType_Bezier=1]="CubismMotionSegmentType_Bezier",r[r.CubismMotionSegmentType_Stepped=2]="CubismMotionSegmentType_Stepped",r[r.CubismMotionSegmentType_InverseStepped=3]="CubismMotionSegmentType_InverseStepped",r))(sn||{});class Rn{constructor(e=0,t=0){this.time=e,this.value=t}}class Yx{constructor(){this.basePointIndex=0,this.segmentType=0}}class Kx{constructor(){this.id="",this.type=0,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0}}class Zx{constructor(){this.fireTime=0,this.value=""}}class Jx{constructor(){this.duration=0,this.loop=!1,this.curveCount=0,this.eventCount=0,this.fps=0,this.curves=[],this.segments=[],this.points=[],this.events=[]}}class ip{constructor(e){this._json=e}release(){this._json=void 0}getMotionDuration(){return this._json.Meta.Duration}isMotionLoop(){return this._json.Meta.Loop||!1}getEvaluationOptionFlag(e){return Tu.EvaluationOptionFlag_AreBeziersRistricted==e?!!this._json.Meta.AreBeziersRestricted:!1}getMotionCurveCount(){return this._json.Meta.CurveCount}getMotionFps(){return this._json.Meta.Fps}getMotionTotalSegmentCount(){return this._json.Meta.TotalSegmentCount}getMotionTotalPointCount(){return this._json.Meta.TotalPointCount}getMotionFadeInTime(){return this._json.Meta.FadeInTime}getMotionFadeOutTime(){return this._json.Meta.FadeOutTime}getMotionCurveTarget(e){return this._json.Curves[e].Target}getMotionCurveId(e){return this._json.Curves[e].Id}getMotionCurveFadeInTime(e){return this._json.Curves[e].FadeInTime}getMotionCurveFadeOutTime(e){return this._json.Curves[e].FadeOutTime}getMotionCurveSegmentCount(e){return this._json.Curves[e].Segments.length}getMotionCurveSegment(e,t){return this._json.Curves[e].Segments[t]}getEventCount(){return this._json.Meta.UserDataCount||0}getTotalEventValueSize(){return this._json.Meta.TotalUserDataSize}getEventTime(e){return this._json.UserData[e].Time}getEventValue(e){return this._json.UserData[e].Value}}var Tu=(r=>(r[r.EvaluationOptionFlag_AreBeziersRistricted=0]="EvaluationOptionFlag_AreBeziersRistricted",r))(Tu||{});const Qx="EyeBlink",eb="LipSync",tb="Model",nb="Parameter",rb="PartOpacity",ib=!1;function qt(r,e,t){const n=new Rn;return n.time=r.time+(e.time-r.time)*t,n.value=r.value+(e.value-r.value)*t,n}function ob(r,e){let t=(e-r[0].time)/(r[1].time-r[0].time);return t<0&&(t=0),r[0].value+(r[1].value-r[0].value)*t}function sb(r,e){let t=(e-r[0].time)/(r[3].time-r[0].time);t<0&&(t=0);const n=qt(r[0],r[1],t),i=qt(r[1],r[2],t),o=qt(r[2],r[3],t),s=qt(n,i,t),a=qt(i,o,t);return qt(s,a,t).value}function ab(r,e){const t=e,n=r[0].time,i=r[3].time,o=r[1].time,s=r[2].time,a=i-3*s+3*o-n,l=3*s-6*o+3*n,u=3*o-3*n,c=n-t,f=Je.cardanoAlgorithmForBezier(a,l,u,c),p=qt(r[0],r[1],f),h=qt(r[1],r[2],f),g=qt(r[2],r[3],f),v=qt(p,h,f),d=qt(h,g,f);return qt(v,d,f).value}function lb(r,e){return r[0].value}function ub(r,e){return r[1].value}function ha(r,e,t){const n=r.curves[e];let i=-1;const o=n.baseSegmentIndex+n.segmentCount;let s=0;for(let l=n.baseSegmentIndex;lt){i=l;break}if(i==-1)return r.points[s].value;const a=r.segments[i];return a.evaluate(r.points.slice(a.basePointIndex),t)}class Su extends rp{constructor(){super(),this._eyeBlinkParameterIds=[],this._lipSyncParameterIds=[],this._sourceFrameRate=30,this._loopDurationSeconds=-1,this._isLoop=!1,this._isLoopFadeIn=!0,this._lastWeight=0}static create(e,t){const n=new Su;return n.parse(e),n._sourceFrameRate=n._motionData.fps,n._loopDurationSeconds=n._motionData.duration,n._onFinishedMotion=t,n}doUpdateParameters(e,t,n,i){this._modelCurveIdEyeBlink==null&&(this._modelCurveIdEyeBlink=Qx),this._modelCurveIdLipSync==null&&(this._modelCurveIdLipSync=eb);let o=t-i.getStartTime();o<0&&(o=0);let s=Number.MAX_VALUE,a=Number.MAX_VALUE;const l=64;let u=0,c=0;this._eyeBlinkParameterIds.length>l&&Of("too many eye blink targets : {0}",this._eyeBlinkParameterIds.length),this._lipSyncParameterIds.length>l&&Of("too many lip sync targets : {0}",this._lipSyncParameterIds.length);const f=this._fadeInSeconds<=0?1:Je.getEasingSine((t-i.getFadeInStartTime())/this._fadeInSeconds),p=this._fadeOutSeconds<=0||i.getEndTime()<0?1:Je.getEasingSine((i.getEndTime()-t)/this._fadeOutSeconds);let h,g,v,d=o;if(this._isLoop)for(;d>this._motionData.duration;)d-=this._motionData.duration;const m=this._motionData.curves;for(g=0;g>y&1)continue;const C=_+(a-_)*n;e.setParameterValueById(this._eyeBlinkParameterIds[y],C)}if(s!=Number.MAX_VALUE)for(let y=0;y>y&1)continue;const C=_+(s-_)*n;e.setParameterValueById(this._lipSyncParameterIds[y],C)}}for(;g=this._motionData.duration&&(this._isLoop?(i.setStartTime(t),this._isLoopFadeIn&&i.setFadeInStartTime(t)):(this._onFinishedMotion&&this._onFinishedMotion(this),i.setIsFinished(!0))),this._lastWeight=n}setIsLoop(e){this._isLoop=e}isLoop(){return this._isLoop}setIsLoopFadeIn(e){this._isLoopFadeIn=e}isLoopFadeIn(){return this._isLoopFadeIn}getDuration(){return this._isLoop?-1:this._loopDurationSeconds}getLoopDuration(){return this._loopDurationSeconds}setParameterFadeInTime(e,t){const n=this._motionData.curves;for(let i=0;inew Kx),this._motionData.segments=Array.from({length:t.getMotionTotalSegmentCount()}).map(()=>new Yx),this._motionData.events=Array.from({length:this._motionData.eventCount}).map(()=>new Zx),this._motionData.points=[];let s=0,a=0;for(let l=0;le&&this._motionData.events[n].fireTime<=t&&this._firedEventValues.push(this._motionData.events[n].value);return this._firedEventValues}}class cb{constructor(){this._autoDelete=!1,this._available=!0,this._finished=!1,this._started=!1,this._startTimeSeconds=-1,this._fadeInStartTimeSeconds=0,this._endTimeSeconds=-1,this._stateTimeSeconds=0,this._stateWeight=0,this._lastEventCheckSeconds=0,this._motionQueueEntryHandle=this,this._fadeOutSeconds=0,this._isTriggeredFadeOut=!1}release(){this._autoDelete&&this._motion&&this._motion.release()}setFadeOut(e){this._fadeOutSeconds=e,this._isTriggeredFadeOut=!0}startFadeOut(e,t){const n=t+e;this._isTriggeredFadeOut=!0,(this._endTimeSeconds<0||nt!=null&&t._motionQueueEntryHandle==e)}setEventCallback(e,t=null){this._eventCallBack=e,this._eventCustomData=t}doUpdateMotion(e,t){let n=!1,i=0;for(;i(r[r.CubismPhysicsTargetType_Parameter=0]="CubismPhysicsTargetType_Parameter",r))(Fl||{}),sr=(r=>(r[r.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",r[r.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",r[r.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",r))(sr||{});class hb{constructor(){this.initialPosition=new ke(0,0),this.position=new ke(0,0),this.lastPosition=new ke(0,0),this.lastGravity=new ke(0,0),this.force=new ke(0,0),this.velocity=new ke(0,0)}}class db{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class pb{constructor(){this.source={}}}class mb{constructor(){this.destination={},this.translationScale=new ke(0,0)}}class gb{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new ke(0,0),this.wind=new ke(0,0)}}class vb{constructor(e){this._json=e}release(){this._json=void 0}getGravity(){const e=new ke(0,0);return e.x=this._json.Meta.EffectiveForces.Gravity.X,e.y=this._json.Meta.EffectiveForces.Gravity.Y,e}getWind(){const e=new ke(0,0);return e.x=this._json.Meta.EffectiveForces.Wind.X,e.y=this._json.Meta.EffectiveForces.Wind.Y,e}getSubRigCount(){return this._json.Meta.PhysicsSettingCount}getTotalInputCount(){return this._json.Meta.TotalInputCount}getTotalOutputCount(){return this._json.Meta.TotalOutputCount}getVertexCount(){return this._json.Meta.VertexCount}getNormalizationPositionMinimumValue(e){return this._json.PhysicsSettings[e].Normalization.Position.Minimum}getNormalizationPositionMaximumValue(e){return this._json.PhysicsSettings[e].Normalization.Position.Maximum}getNormalizationPositionDefaultValue(e){return this._json.PhysicsSettings[e].Normalization.Position.Default}getNormalizationAngleMinimumValue(e){return this._json.PhysicsSettings[e].Normalization.Angle.Minimum}getNormalizationAngleMaximumValue(e){return this._json.PhysicsSettings[e].Normalization.Angle.Maximum}getNormalizationAngleDefaultValue(e){return this._json.PhysicsSettings[e].Normalization.Angle.Default}getInputCount(e){return this._json.PhysicsSettings[e].Input.length}getInputWeight(e,t){return this._json.PhysicsSettings[e].Input[t].Weight}getInputReflect(e,t){return this._json.PhysicsSettings[e].Input[t].Reflect}getInputType(e,t){return this._json.PhysicsSettings[e].Input[t].Type}getInputSourceId(e,t){return this._json.PhysicsSettings[e].Input[t].Source.Id}getOutputCount(e){return this._json.PhysicsSettings[e].Output.length}getOutputVertexIndex(e,t){return this._json.PhysicsSettings[e].Output[t].VertexIndex}getOutputAngleScale(e,t){return this._json.PhysicsSettings[e].Output[t].Scale}getOutputWeight(e,t){return this._json.PhysicsSettings[e].Output[t].Weight}getOutputDestinationId(e,t){return this._json.PhysicsSettings[e].Output[t].Destination.Id}getOutputType(e,t){return this._json.PhysicsSettings[e].Output[t].Type}getOutputReflect(e,t){return this._json.PhysicsSettings[e].Output[t].Reflect}getParticleCount(e){return this._json.PhysicsSettings[e].Vertices.length}getParticleMobility(e,t){return this._json.PhysicsSettings[e].Vertices[t].Mobility}getParticleDelay(e,t){return this._json.PhysicsSettings[e].Vertices[t].Delay}getParticleAcceleration(e,t){return this._json.PhysicsSettings[e].Vertices[t].Acceleration}getParticleRadius(e,t){return this._json.PhysicsSettings[e].Vertices[t].Radius}getParticlePosition(e,t){const n=new ke(0,0);return n.x=this._json.PhysicsSettings[e].Vertices[t].Position.X,n.y=this._json.PhysicsSettings[e].Vertices[t].Position.Y,n}}const Ff="X",Lf="Y",Nf="Angle",yb=5,sp=100,_b=.001;class Eu{static create(e){const t=new Eu;return t.parse(e),t._physicsRig.gravity.y=0,t}evaluate(e,t){let n,i,o,s;const a=new ke;let l,u,c,f,p,h,g,v;p=e.getModel().parameters.values,h=e.getModel().parameters.maximumValues,g=e.getModel().parameters.minimumValues,v=e.getModel().parameters.defaultValues;for(let d=0;d=l.particleCount)break;c[m].destinationParameterIndex==-1&&(c[m].destinationParameterIndex=e.getParameterIndex(c[m].destination.id));const _=new ke;_.x=f[y].position.x-f[y-1].position.x,_.y=f[y].position.y-f[y-1].position.y,s=c[m].getValue(_,f,y,c[m].reflect,this._options.gravity);const C=c[m].destinationParameterIndex,x=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(p.subarray(C))):p.slice(C);Rb(x,g[C],h[C],s,c[m]);for(let b=C,E=0;b=2?i=e[t-1].position.substract(e[t-2].position):i=i.multiplyByScaler(-1),o=Je.directionToRadian(i,r),n&&(o*=-1),o}function Ab(r,e){return Math.abs(Math.max(r,e)-Math.min(r,e))}function Ib(r,e){return Math.min(r,e)+Ab(r,e)/2}function Pb(r,e){return r.x}function Mb(r,e){return r.y}function kb(r,e){return e}function Ob(r,e,t,n,i,o,s,a){let l,u,c,f,p=new ke(0,0),h=new ke(0,0),g=new ke(0,0),v=new ke(0,0);r[0].position=new ke(t.x,t.y),l=Je.degreesToRadian(n),f=Je.radianToDirection(l),f.normalize();for(let d=1;dt&&(s>i.valueExceededMaximum&&(i.valueExceededMaximum=s),s=t),a=i.weight/sp,a>=1||(s=r[0]*(1-a)+s*a),r[0]=s}function Cu(r,e,t,n,i,o,s,a){let l=0;const u=Je.max(t,e);ur&&(r=c);const f=Je.min(i,o),p=Je.max(i,o),h=s,g=Ib(c,u),v=r-g;switch(Math.sign(v)){case 1:{const d=p-h,m=u-g;m!=0&&(l=v*(d/m),l+=h);break}case-1:{const d=f-h,m=c-g;m!=0&&(l=v*(d/m),l+=h);break}case 0:{l=h;break}}return a?l:l*-1}class Ll{constructor(e=0,t=0,n=0,i=0){this.x=e,this.y=t,this.width=n,this.height=i}getCenterX(){return this.x+.5*this.width}getCenterY(){return this.y+.5*this.height}getRight(){return this.x+this.width}getBottom(){return this.y+this.height}setRect(e){this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height}expand(e,t){this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2}}const da=4,Fb=10;let Zn,mi,Nl;class pa{getChannelFlagAsColor(e){return this._channelColors[e]}getMaskRenderTexture(){let e=0;if(this._maskTexture&&this._maskTexture.texture!=0&&(this._maskTexture.frameNo=this._currentFrameNo,e=this._maskTexture.texture),e==0){const t=this._clippingMaskBufferSize;this._colorBuffer=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this._colorBuffer),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,t,t,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.gl.bindTexture(this.gl.TEXTURE_2D,null),e=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,e),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,this._colorBuffer,0),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,Nl),this._maskTexture=new Lb(this._currentFrameNo,e)}return e}setGL(e){this.gl=e}calcClippedDrawTotalBounds(e,t){let n=Number.MAX_VALUE,i=Number.MAX_VALUE,o=Number.MIN_VALUE,s=Number.MIN_VALUE;const a=t._clippedDrawableIndexList.length;for(let l=0;lg&&(g=y),_v&&(v=_)}if(p!=Number.MAX_VALUE)if(po&&(o=g),v>s&&(s=v),n==Number.MAX_VALUE)t._allClippedDrawRect.x=0,t._allClippedDrawRect.y=0,t._allClippedDrawRect.width=0,t._allClippedDrawRect.height=0,t._isUsing=!1;else{t._isUsing=!0;const m=o-n,y=s-i;t._allClippedDrawRect.x=n,t._allClippedDrawRect.y=i,t._allClippedDrawRect.width=m,t._allClippedDrawRect.height=y}}}constructor(){this._maskRenderTexture=null,this._colorBuffer=null,this._currentFrameNo=0,this._clippingMaskBufferSize=256,this._clippingContextListForMask=[],this._clippingContextListForDraw=[],this._channelColors=[],this._tmpBoundsOnModel=new Ll,this._tmpMatrix=new Zt,this._tmpMatrixForMask=new Zt,this._tmpMatrixForDraw=new Zt;let e=new di;e.R=1,e.G=0,e.B=0,e.A=0,this._channelColors.push(e),e=new di,e.R=0,e.G=1,e.B=0,e.A=0,this._channelColors.push(e),e=new di,e.R=0,e.G=0,e.B=1,e.A=0,this._channelColors.push(e),e=new di,e.R=0,e.G=0,e.B=0,e.A=1,this._channelColors.push(e)}release(){var e,t,n;const i=this;for(let o=0;o0){this.gl.viewport(0,0,this._clippingMaskBufferSize,this._clippingMaskBufferSize),this._maskRenderTexture=this.getMaskRenderTexture(),t.getMvpMatrix(),t.preDraw(),this.setupLayoutBounds(n),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this._maskRenderTexture),this.gl.clearColor(1,1,1,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT);for(let i=0;i(r[r.ShaderNames_SetupMask=0]="ShaderNames_SetupMask",r[r.ShaderNames_NormalPremultipliedAlpha=1]="ShaderNames_NormalPremultipliedAlpha",r[r.ShaderNames_NormalMaskedPremultipliedAlpha=2]="ShaderNames_NormalMaskedPremultipliedAlpha",r[r.ShaderNames_NomralMaskedInvertedPremultipliedAlpha=3]="ShaderNames_NomralMaskedInvertedPremultipliedAlpha",r[r.ShaderNames_AddPremultipliedAlpha=4]="ShaderNames_AddPremultipliedAlpha",r[r.ShaderNames_AddMaskedPremultipliedAlpha=5]="ShaderNames_AddMaskedPremultipliedAlpha",r[r.ShaderNames_AddMaskedPremultipliedAlphaInverted=6]="ShaderNames_AddMaskedPremultipliedAlphaInverted",r[r.ShaderNames_MultPremultipliedAlpha=7]="ShaderNames_MultPremultipliedAlpha",r[r.ShaderNames_MultMaskedPremultipliedAlpha=8]="ShaderNames_MultMaskedPremultipliedAlpha",r[r.ShaderNames_MultMaskedPremultipliedAlphaInverted=9]="ShaderNames_MultMaskedPremultipliedAlphaInverted",r))(gi||{});const Db="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_myPos;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_clipMatrix * a_position; v_myPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",Bb="precision mediump float;varying vec2 v_texCoord;varying vec4 v_myPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;void main(){ float isInside = step(u_baseColor.x, v_myPos.x/v_myPos.w) * step(u_baseColor.y, v_myPos.y/v_myPos.w) * step(v_myPos.x/v_myPos.w, u_baseColor.z) * step(v_myPos.y/v_myPos.w, u_baseColor.w); gl_FragColor = u_channelFlag * texture2D(s_texture0, v_texCoord).a * isInside;}",Ub="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;uniform mat4 u_matrix;void main(){ gl_Position = u_matrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",Df="attribute vec4 a_position;attribute vec2 a_texCoord;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform mat4 u_matrix;uniform mat4 u_clipMatrix;void main(){ gl_Position = u_matrix * a_position; v_clipPos = u_clipMatrix * a_position; v_texCoord = a_texCoord; v_texCoord.y = 1.0 - v_texCoord.y;}",zb="precision mediump float;varying vec2 v_texCoord;uniform vec4 u_baseColor;uniform sampler2D s_texture0;void main(){ gl_FragColor = texture2D(s_texture0 , v_texCoord) * u_baseColor;}",jb="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform vec4 u_baseColor;uniform vec4 u_channelFlag;uniform sampler2D s_texture0;uniform sampler2D s_texture1;void main(){ vec4 col_formask = texture2D(s_texture0 , v_texCoord) * u_baseColor; vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag; float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a; col_formask = col_formask * maskVal; gl_FragColor = col_formask;}",Vb="precision mediump float;varying vec2 v_texCoord;varying vec4 v_clipPos;uniform sampler2D s_texture0;uniform sampler2D s_texture1;uniform vec4 u_channelFlag;uniform vec4 u_baseColor;void main(){vec4 col_formask = texture2D(s_texture0, v_texCoord) * u_baseColor;vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;col_formask = col_formask * (1.0 - maskVal);gl_FragColor = col_formask;}";class ap extends xu{constructor(){super(),this._clippingContextBufferForMask=null,this._clippingContextBufferForDraw=null,this._clippingManager=new pa,this.firstDraw=!0,this._textures={},this._sortedDrawableIndexList=[],this._bufferData={vertex:null,uv:null,index:null}}initialize(e){e.isUsingMasking()&&(this._clippingManager=new pa,this._clippingManager.initialize(e,e.getDrawableCount(),e.getDrawableMasks(),e.getDrawableMaskCounts()));for(let t=e.getDrawableCount()-1;t>=0;t--)this._sortedDrawableIndexList[t]=0;super.initialize(e)}bindTexture(e,t){this._textures[e]=t}getBindedTextures(){return this._textures}setClippingMaskBufferSize(e){this._clippingManager.release(),this._clippingManager=new pa,this._clippingManager.setClippingMaskBufferSize(e),this._clippingManager.initialize(this.getModel(),this.getModel().getDrawableCount(),this.getModel().getDrawableMasks(),this.getModel().getDrawableMaskCounts())}getClippingMaskBufferSize(){return this._clippingManager.getClippingMaskBufferSize()}release(){var e,t,n;const i=this;this._clippingManager.release(),i._clippingManager=void 0,(e=this.gl)==null||e.deleteBuffer(this._bufferData.vertex),this._bufferData.vertex=null,(t=this.gl)==null||t.deleteBuffer(this._bufferData.uv),this._bufferData.uv=null,(n=this.gl)==null||n.deleteBuffer(this._bufferData.index),this._bufferData.index=null,i._bufferData=void 0,i._textures=void 0}doDrawModel(){this.preDraw(),this._clippingManager!=null&&this._clippingManager.setupClippingContext(this.getModel(),this);const e=this.getModel().getDrawableCount(),t=this.getModel().getDrawableRenderOrders();for(let n=0;n{ap.doStaticRelease()};class lp{constructor(e){this.groups=e.Groups,this.hitAreas=e.HitAreas,this.layout=e.Layout,this.moc=e.FileReferences.Moc,this.expressions=e.FileReferences.Expressions,this.motions=e.FileReferences.Motions,this.textures=e.FileReferences.Textures,this.physics=e.FileReferences.Physics,this.pose=e.FileReferences.Pose}getEyeBlinkParameters(){var e,t;return(t=(e=this.groups)==null?void 0:e.find(n=>n.Name==="EyeBlink"))==null?void 0:t.Ids}getLipSyncParameters(){var e,t;return(t=(e=this.groups)==null?void 0:e.find(n=>n.Name==="LipSync"))==null?void 0:t.Ids}}const Gb="ParamAngleX",$b="ParamAngleY",Hb="ParamAngleZ",Xb="ParamEyeBallX",Wb="ParamEyeBallY",qb="ParamBodyAngleX",Yb="ParamBreath",Bf=2,Uf=2;var Dt;(r=>{r.LOG_LEVEL_VERBOSE=0,r.LOG_LEVEL_WARNING=1,r.LOG_LEVEL_ERROR=2,r.LOG_LEVEL_NONE=999,r.logLevel=r.LOG_LEVEL_WARNING,r.sound=!0,r.motionSync=!0,r.motionFadingDuration=500,r.idleMotionFadingDuration=2e3,r.expressionFadingDuration=500,r.preserveExpressionOnMotion=!0,r.cubism4=Oi})(Dt||(Dt={}));const Ke={log(r,...e){Dt.logLevel<=Dt.LOG_LEVEL_VERBOSE&&console.log(`[${r}]`,...e)},warn(r,...e){Dt.logLevel<=Dt.LOG_LEVEL_WARNING&&console.warn(`[${r}]`,...e)},error(r,...e){Dt.logLevel<=Dt.LOG_LEVEL_ERROR&&console.error(`[${r}]`,...e)}};function zf(r,e,t){return rt?t:r}function up(r,e){e.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(n=>{n!=="constructor"&&Object.defineProperty(r.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})})}function Kb(r){let e=r.lastIndexOf("/");return e!=-1&&(r=r.slice(0,e)),e=r.lastIndexOf("/"),e!==-1&&(r=r.slice(e+1)),r}function Zb(r,e){const t=r.indexOf(e);t!==-1&&r.splice(t,1)}class cp extends _r{constructor(e,t){super(),this.expressions=[],this.reserveExpressionIndex=-1,this.destroyed=!1,this.settings=e,this.tag=`ExpressionManager(${e.name})`}init(){this.defaultExpression=this.createExpression({},void 0),this.currentExpression=this.defaultExpression,this.stopAllExpressions()}loadExpression(e){return st(this,null,function*(){if(!this.definitions[e]){Ke.warn(this.tag,`Undefined expression at [${e}]`);return}if(this.expressions[e]===null){Ke.warn(this.tag,`Cannot set expression at [${e}] because it's already failed in loading.`);return}if(this.expressions[e])return this.expressions[e];const t=yield this._loadExpression(e);return this.expressions[e]=t,t})}_loadExpression(e){throw new Error("Not implemented.")}setRandomExpression(){return st(this,null,function*(){if(this.definitions.length){const e=[];for(let t=0;t-1&&eu&&(s*=u/l,a*=u/l),this.vx+=s,this.vy+=a;const c=Math.sqrt(Kn(this.vx,2)+Kn(this.vy,2)),f=.5*(Math.sqrt(Kn(u,2)+8*u*i)-u);c>f&&(this.vx*=f/c,this.vy*=f/c),this.x+=this.vx,this.y+=this.vy}}class Au{constructor(e){this.json=e;let t=e.url;if(typeof t!="string")throw new TypeError("The `url` field in settings JSON must be defined as a string.");this.url=t,this.name=Kb(this.url)}resolveURL(e){return Qo.resolve(this.url,e)}replaceFiles(e){this.moc=e(this.moc,"moc"),this.pose!==void 0&&(this.pose=e(this.pose,"pose")),this.physics!==void 0&&(this.physics=e(this.physics,"physics"));for(let t=0;t(e.push(t),t)),e}validateFiles(e){const t=(o,s)=>{const a=this.resolveURL(o);if(!e.includes(a)){if(s)throw new Error(`File "${o}" is defined in settings, but doesn't exist in given files`);return!1}return!0};return[this.moc,...this.textures].forEach(o=>t(o,!0)),this.getDefinedFiles().filter(o=>t(o,!1))}}var jo=(r=>(r[r.NONE=0]="NONE",r[r.IDLE=1]="IDLE",r[r.NORMAL=2]="NORMAL",r[r.FORCE=3]="FORCE",r))(jo||{});class t1{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(e,t,n){if(n<=0)return Ke.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(e===this.currentGroup&&t===this.currentIndex)return Ke.log(this.tag,"Motion is already playing.",this.dump(e,t)),!1;if(e===this.reservedGroup&&t===this.reservedIndex||e===this.reservedIdleGroup&&t===this.reservedIdleIndex)return Ke.log(this.tag,"Motion is already reserved.",this.dump(e,t)),!1;if(n===1){if(this.currentPriority!==0)return Ke.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,t)),!1;if(this.reservedIdleGroup!==void 0)return Ke.log(this.tag,"Cannot start idle motion because another idle motion has reserved.",this.dump(e,t)),!1;this.setReservedIdle(e,t)}else{if(n<3){if(n<=this.currentPriority)return Ke.log(this.tag,"Cannot start motion because another motion is playing as an equivalent or higher priority.",this.dump(e,t)),!1;if(n<=this.reservePriority)return Ke.log(this.tag,"Cannot start motion because another motion has reserved as an equivalent or higher priority.",this.dump(e,t)),!1}this.setReserved(e,t,n)}return!0}start(e,t,n,i){if(i===1){if(this.setReservedIdle(void 0,void 0),this.currentPriority!==0)return Ke.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(t,n)),!1}else{if(t!==this.reservedGroup||n!==this.reservedIndex)return Ke.log(this.tag,"Cannot start motion because another motion has taken the place.",this.dump(t,n)),!1;this.setReserved(void 0,void 0,0)}return e?(this.setCurrent(t,n,i),!0):!1}complete(){this.setCurrent(void 0,void 0,0)}setCurrent(e,t,n){this.currentPriority=n,this.currentGroup=e,this.currentIndex=t}setReserved(e,t,n){this.reservePriority=n,this.reservedGroup=e,this.reservedIndex=t}setReservedIdle(e,t){this.reservedIdleGroup=e,this.reservedIdleIndex=t}isActive(e,t){return e===this.currentGroup&&t===this.currentIndex||e===this.reservedGroup&&t===this.reservedIndex||e===this.reservedIdleGroup&&t===this.reservedIdleIndex}reset(){this.setCurrent(void 0,void 0,0),this.setReserved(void 0,void 0,0),this.setReservedIdle(void 0,void 0)}shouldRequestIdleMotion(){return this.currentGroup===void 0&&this.reservedIdleGroup===void 0}shouldOverrideExpression(){return!Dt.preserveExpressionOnMotion&&this.currentPriority>1}dump(e,t){if(this.debug){const n=["currentPriority","reservePriority","currentGroup","currentIndex","reservedGroup","reservedIndex","reservedIdleGroup","reservedIdleIndex"];return` + group = "${e}", index = ${t} +`+n.map(i=>"["+i+"] "+this[i]).join(` +`)}return""}}const n1="SoundManager",r1=.5;class ar{static get volume(){return this._volume}static set volume(e){this._volume=(e>1?1:e<0?0:e)||0,this.audios.forEach(t=>t.volume=this._volume)}static add(e,t,n){const i=new Audio(e);return i.volume=this._volume,i.preload="auto",i.addEventListener("ended",()=>{this.dispose(i),t==null||t()}),i.addEventListener("error",o=>{this.dispose(i),Ke.warn(n1,`Error occurred on "${e}"`,o.error),n==null||n(o.error)}),this.audios.push(i),i}static play(e){return new Promise((t,n)=>{var i;(i=e.play())==null||i.catch(o=>{e.dispatchEvent(new ErrorEvent("error",{error:o})),n(o)}),e.readyState===e.HAVE_ENOUGH_DATA?t():e.addEventListener("canplaythrough",t)})}static dispose(e){e.pause(),e.removeAttribute("src"),Zb(this.audios,e)}static destroy(){for(let e=this.audios.length-1;e>=0;e--)this.dispose(this.audios[e])}}ar.audios=[];ar._volume=r1;var fp=(r=>(r.ALL="ALL",r.IDLE="IDLE",r.NONE="NONE",r))(fp||{});class Iu extends _r{constructor(e,t){super(),this.motionGroups={},this.state=new t1,this.playing=!1,this.destroyed=!1,this.settings=e,this.tag=`MotionManager(${e.name})`,this.state.tag=this.tag}init(e){e!=null&&e.idleMotionGroup&&(this.groups.idle=e.idleMotionGroup),this.setupMotions(e),this.stopAllMotions()}setupMotions(e){for(const n of Object.keys(this.definitions))this.motionGroups[n]=[];let t;switch(e==null?void 0:e.motionPreload){case"NONE":return;case"ALL":t=Object.keys(this.definitions);break;case"IDLE":default:t=[this.groups.idle];break}for(const n of t)if(this.definitions[n])for(let i=0;ithis.currentAudio=void 0,()=>this.currentAudio=void 0),this.currentAudio=l}catch(f){Ke.warn(this.tag,"Failed to create audio",c,f)}}const u=yield this.loadMotion(n,i);if(l){const c=ar.play(l).catch(f=>Ke.warn(this.tag,"Failed to play audio",l.src,f));Dt.motionSync&&(yield c)}return this.state.start(u,n,i,o)?(Ke.log(this.tag,"Start motion:",this.getMotionName(a)),this.emit("motionStart",n,i,l),this.state.shouldOverrideExpression()&&this.expressionManager&&this.expressionManager.resetExpression(),this.playing=!0,this._startMotion(u),!0):(l&&(ar.dispose(l),this.currentAudio=void 0),!1)})}startRandomMotion(e,t){return st(this,null,function*(){const n=this.definitions[e];if(n!=null&&n.length){const i=[];for(let o=0;ot.index>=0);for(const t of e)this.hitAreas[t.name]=t}hitTest(e,t){return Object.keys(this.hitAreas).filter(n=>this.isHit(n,e,t))}isHit(e,t,n){if(!this.hitAreas[e])return!1;const i=this.hitAreas[e].index,o=this.getDrawableBounds(i,i1);return o.x<=t&&t<=o.x+o.width&&o.y<=n&&n<=o.y+o.height}getDrawableBounds(e,t){const n=this.getDrawableVertices(e);let i=n[0],o=n[0],s=n[1],a=n[1];for(let l=0;l{(o.status===200||o.status===0)&&o.response?n(o.response):o.onerror()},o.onerror=()=>{Ke.warn(s1,`Failed to load resource as ${o.responseType} (Status ${o.status}): ${e}`),i(new Vf("Network error.",e,o.status))},o.onabort=()=>i(new Vf("Aborted.",e,o.status,!0)),o.onloadend=()=>{var s;It.allXhrSet.delete(o),r&&((s=It.xhrMap.get(r))==null||s.delete(o))},o}static cancelXHRs(){var r;(r=It.xhrMap.get(this))==null||r.forEach(e=>{e.abort(),It.allXhrSet.delete(e)}),It.xhrMap.delete(this)}static release(){It.allXhrSet.forEach(r=>r.abort()),It.allXhrSet.clear(),It.xhrMap=new WeakMap}};let ns=It;ns.xhrMap=new WeakMap;ns.allXhrSet=new Set;ns.loader=(r,e)=>new Promise((t,n)=>{It.createXHR(r.target,r.settings?r.settings.resolveURL(r.url):r.url,r.type,o=>{r.result=o,t()},n).send()});function hp(r,e){let t=-1;return n(0);function n(i,o){if(o)return Promise.reject(o);if(i<=t)return Promise.reject(new Error("next() called multiple times"));t=i;const s=r[i];if(!s)return Promise.resolve();try{return Promise.resolve(s(e,n.bind(null,i+1)))}catch(a){return Promise.reject(a)}}}class Gn{static load(e){return hp(this.middlewares,e).then(()=>e.result)}}Gn.middlewares=[ns.loader];function a1(r,e={}){var t;const n={resourceOptions:{crossorigin:e.crossOrigin}};if(pr.fromURL)return pr.fromURL(r,n).catch(s=>{if(s instanceof Error)throw s;const a=new Error("Texture loading error");throw a.event=s,a});n.resourceOptions.autoLoad=!1;const i=pr.from(r,n);if(i.baseTexture.valid)return Promise.resolve(i);const o=i.baseTexture.resource;return(t=o._live2d_load)!=null||(o._live2d_load=new Promise((s,a)=>{const l=u=>{o.source.removeEventListener("error",l);const c=new Error("Texture loading error");c.event=u,a(c)};o.source.addEventListener("error",l),o.load().then(()=>s(i)).catch(l)})),o._live2d_load}const Gf="Live2DFactory",dp=(r,e)=>st(void 0,null,function*(){if(typeof r.source=="string"){const t=yield Gn.load({url:r.source,type:"json",target:r.live2dModel});t.url=r.source,r.source=t,r.live2dModel.emit("settingsJSONLoaded",t)}return e()}),pp=(r,e)=>st(void 0,null,function*(){if(r.source instanceof Au)return r.settings=r.source,e();if(typeof r.source=="object"){const t=ct.findRuntime(r.source);if(t){const n=t.createModelSettings(r.source);return r.settings=n,r.live2dModel.emit("settingsLoaded",n),e()}}throw new TypeError("Unknown settings format.")}),mp=(r,e)=>{if(r.settings){const t=ct.findRuntime(r.settings);if(t)return t.ready().then(e)}return e()},gp=(r,e)=>st(void 0,null,function*(){yield e();const t=r.internalModel;if(t){const n=r.settings,i=ct.findRuntime(n);if(i){const o=[];n.pose&&o.push(Gn.load({settings:n,url:n.pose,type:"json",target:t}).then(s=>{t.pose=i.createPose(t.coreModel,s),r.live2dModel.emit("poseLoaded",t.pose)}).catch(s=>{r.live2dModel.emit("poseLoadError",s),Ke.warn(Gf,"Failed to load pose.",s)})),n.physics&&o.push(Gn.load({settings:n,url:n.physics,type:"json",target:t}).then(s=>{t.physics=i.createPhysics(t.coreModel,s),r.live2dModel.emit("physicsLoaded",t.physics)}).catch(s=>{r.live2dModel.emit("physicsLoadError",s),Ke.warn(Gf,"Failed to load physics.",s)})),o.length&&(yield Promise.all(o))}}}),vp=(r,e)=>st(void 0,null,function*(){if(r.settings){const t=r.live2dModel,n=r.settings.textures.map(i=>{const o=r.settings.resolveURL(i);return a1(o,{crossOrigin:r.options.crossOrigin})});if(yield e(),r.internalModel)t.internalModel=r.internalModel,t.emit("modelLoaded",r.internalModel);else throw new TypeError("Missing internal model.");t.textures=yield Promise.all(n),t.emit("textureLoaded",t.textures)}else throw new TypeError("Missing settings.")}),yp=(r,e)=>st(void 0,null,function*(){const t=r.settings;if(t instanceof Au){const n=ct.findRuntime(t);if(!n)throw new TypeError("Unknown model settings.");const i=yield Gn.load({settings:t,url:t.moc,type:"arraybuffer",target:r.live2dModel});if(!n.isValidMoc(i))throw new Error("Invalid moc data");const o=n.createCoreModel(i);return r.internalModel=n.createInternalModel(o,t,r.options),e()}throw new TypeError("Missing settings.")}),Tt=class{static registerRuntime(r){Tt.runtimes.push(r),Tt.runtimes.sort((e,t)=>t.version-e.version)}static findRuntime(r){for(const e of Tt.runtimes)if(e.test(r))return e}static setupLive2DModel(r,e,t){return st(this,null,function*(){const n=new Promise(s=>r.once("textureLoaded",s)),i=new Promise(s=>r.once("modelLoaded",s)),o=Promise.all([n,i]).then(()=>r.emit("ready"));yield hp(Tt.live2DModelMiddlewares,{live2dModel:r,source:e,options:t||{}}),yield o,r.emit("load")})}static loadMotion(r,e,t){var n,i;const o=s=>r.emit("motionLoadError",e,t,s);try{const s=(n=r.definitions[e])==null?void 0:n[t];if(!s)return Promise.resolve(void 0);r.listeners("destroy").includes(Tt.releaseTasks)||r.once("destroy",Tt.releaseTasks);let a=Tt.motionTasksMap.get(r);a||(a={},Tt.motionTasksMap.set(r,a));let l=a[e];l||(l=[],a[e]=l);const u=r.getMotionFile(s);return(i=l[t])!=null||(l[t]=Gn.load({url:u,settings:r.settings,type:r.motionDataType,target:r}).then(c=>{var f;const p=(f=Tt.motionTasksMap.get(r))==null?void 0:f[e];p&&delete p[t];const h=r.createMotion(c,e,s);return r.emit("motionLoaded",e,t,h),h}).catch(c=>{Ke.warn(r.tag,`Failed to load motion: ${u} +`,c),o(c)})),l[t]}catch(s){Ke.warn(r.tag,`Failed to load motion at "${e}"[${t}] +`,s),o(s)}return Promise.resolve(void 0)}static loadExpression(r,e){var t;const n=i=>r.emit("expressionLoadError",e,i);try{const i=r.definitions[e];if(!i)return Promise.resolve(void 0);r.listeners("destroy").includes(Tt.releaseTasks)||r.once("destroy",Tt.releaseTasks);let o=Tt.expressionTasksMap.get(r);o||(o=[],Tt.expressionTasksMap.set(r,o));const s=r.getExpressionFile(i);return(t=o[e])!=null||(o[e]=Gn.load({url:s,settings:r.settings,type:"json",target:r}).then(a=>{const l=Tt.expressionTasksMap.get(r);l&&delete l[e];const u=r.createExpression(a,i);return r.emit("expressionLoaded",e,u),u}).catch(a=>{Ke.warn(r.tag,`Failed to load expression: ${s} +`,a),n(a)})),o[e]}catch(i){Ke.warn(r.tag,`Failed to load expression at [${e}] +`,i),n(i)}return Promise.resolve(void 0)}static releaseTasks(){this instanceof Iu?Tt.motionTasksMap.delete(this):Tt.expressionTasksMap.delete(this)}};let ct=Tt;ct.runtimes=[];ct.urlToJSON=dp;ct.jsonToSettings=pp;ct.waitUntilReady=mp;ct.setupOptionals=gp;ct.setupEssentials=vp;ct.createInternalModel=yp;ct.live2DModelMiddlewares=[dp,pp,mp,gp,vp,yp];ct.motionTasksMap=new WeakMap;ct.expressionTasksMap=new WeakMap;Iu.prototype._loadMotion=function(r,e){return ct.loadMotion(this,r,e)};cp.prototype._loadExpression=function(r){return ct.loadExpression(this,r)};class l1{constructor(){this._autoInteract=!1}get autoInteract(){return this._autoInteract}set autoInteract(e){e!==this._autoInteract&&(e?this.on("pointertap",$f,this):this.off("pointertap",$f,this),this._autoInteract=e)}registerInteraction(e){e!==this.interactionManager&&(this.unregisterInteraction(),this._autoInteract&&e&&(this.interactionManager=e,e.on("pointermove",Hf,this)))}unregisterInteraction(){var e;this.interactionManager&&((e=this.interactionManager)==null||e.off("pointermove",Hf,this),this.interactionManager=void 0)}}function $f(r){this.tap(r.data.global.x,r.data.global.y)}function Hf(r){this.focus(r.data.global.x,r.data.global.y)}class u1 extends Nd{}const Ht=new at,c1=new Et;let Pn;class Dl extends No{constructor(e){super(),this.tag="Live2DModel(uninitialized)",this.textures=[],this.transform=new u1,this.anchor=new Nr(this.onAnchorChange,this,0,0),this.glContextID=-1,this.elapsedTime=performance.now(),this.deltaTime=0,this._autoUpdate=!1,this.once("modelLoaded",()=>this.init(e))}static from(e,t){const n=new this(t);return ct.setupLive2DModel(n,e,t).then(()=>n)}static fromSync(e,t){const n=new this(t);return ct.setupLive2DModel(n,e,t).then(t==null?void 0:t.onLoad).catch(t==null?void 0:t.onError),n}static registerTicker(e){Pn=e}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){var t;Pn||(Pn=(t=window.PIXI)==null?void 0:t.Ticker),e?this._destroyed||(Pn?(Pn.shared.add(this.onTickerUpdate,this),this._autoUpdate=!0):Ke.warn(this.tag,"No Ticker registered, please call Live2DModel.registerTicker(Ticker).")):(Pn==null||Pn.shared.remove(this.onTickerUpdate,this),this._autoUpdate=!1)}init(e){this.tag=`Live2DModel(${this.internalModel.settings.name})`;const t=Object.assign({autoUpdate:!0,autoInteract:!0},e);t.autoInteract&&(this.interactive=!0),this.autoInteract=t.autoInteract,this.autoUpdate=t.autoUpdate}onAnchorChange(){this.pivot.set(this.anchor.x*this.internalModel.width,this.anchor.y*this.internalModel.height)}motion(e,t,n){return t===void 0?this.internalModel.motionManager.startRandomMotion(e,n):this.internalModel.motionManager.startMotion(e,t,n)}expression(e){return this.internalModel.motionManager.expressionManager?e===void 0?this.internalModel.motionManager.expressionManager.setRandomExpression():this.internalModel.motionManager.expressionManager.setExpression(e):Promise.resolve(!1)}focus(e,t,n=!1){Ht.x=e,Ht.y=t,this.toModelPosition(Ht,Ht,!0);let i=Ht.x/this.internalModel.originalWidth*2-1,o=Ht.y/this.internalModel.originalHeight*2-1,s=Math.atan2(o,i);this.internalModel.focusController.focus(Math.cos(s),-Math.sin(s),n)}tap(e,t){const n=this.hitTest(e,t);n.length&&(Ke.log(this.tag,"Hit",n),this.emit("hit",n))}hitTest(e,t){return Ht.x=e,Ht.y=t,this.toModelPosition(Ht,Ht),this.internalModel.hitTest(Ht.x,Ht.y)}toModelPosition(e,t=e.clone(),n){return n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.transform.worldTransform.applyInverse(e,t),this.internalModel.localTransform.applyInverse(t,t),t}containsPoint(e){return this.getBounds(!0).contains(e.x,e.y)}_calculateBounds(){this._bounds.addFrame(this.transform,0,0,this.internalModel.width,this.internalModel.height)}onTickerUpdate(){this.update(Pn.shared.deltaMS)}update(e){this.deltaTime+=e,this.elapsedTime+=e}_render(e){this.registerInteraction(e.plugins.interaction),e.batch.reset(),e.geometry.reset(),e.shader.reset(),e.state.reset();let t=!1;this.glContextID!==e.CONTEXT_UID&&(this.glContextID=e.CONTEXT_UID,this.internalModel.updateWebGLContext(e.gl,this.glContextID),t=!0);for(let o=0;ot.destroy(e.baseTexture)),this.internalModel.destroy(),super.destroy(e)}}up(Dl,[l1]);const ln=class{static resolveURL(r,e){var t;const n=(t=ln.filesMap[r])==null?void 0:t[e];if(n===void 0)throw new Error("Cannot find this file from uploaded files: "+e);return n}static upload(r,e){return st(this,null,function*(){const t={};for(const n of e.getDefinedFiles()){const i=decodeURI(Qo.resolve(e.url,n)),o=r.find(s=>s.webkitRelativePath===i);o&&(t[n]=URL.createObjectURL(o))}ln.filesMap[e._objectURL]=t})}static createSettings(r){return st(this,null,function*(){const e=r.find(s=>s.name.endsWith("model.json")||s.name.endsWith("model3.json"));if(!e)throw new TypeError("Settings file not found");const t=yield ln.readText(e),n=JSON.parse(t);n.url=e.webkitRelativePath;const i=ct.findRuntime(n);if(!i)throw new Error("Unknown settings JSON");const o=i.createModelSettings(n);return o._objectURL=URL.createObjectURL(e),o})}static readText(r){return st(this,null,function*(){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>e(n.result),n.onerror=t,n.readAsText(r,"utf8")})})}};let Pu=ln;Pu.filesMap={};Pu.factory=(r,e)=>st(void 0,null,function*(){if(Array.isArray(r.source)&&r.source[0]instanceof File){const t=r.source;let n=t.settings;if(!n)n=yield ln.createSettings(t);else if(!n._objectURL)throw new Error('"_objectURL" must be specified in ModelSettings');n.validateFiles(t.map(i=>encodeURI(i.webkitRelativePath))),yield ln.upload(t,n),n.resolveURL=function(i){return ln.resolveURL(this._objectURL,i)},r.source=n,r.live2dModel.once("modelLoaded",i=>{i.once("destroy",function(){const o=this.settings._objectURL;if(URL.revokeObjectURL(o),ln.filesMap[o])for(const s of Object.values(ln.filesMap[o]))URL.revokeObjectURL(s);delete ln.filesMap[o]})})}return e()});ct.live2DModelMiddlewares.unshift(Pu.factory);const Ot=class{static unzip(r,e){return st(this,null,function*(){const t=yield Ot.getFilePaths(r),n=[];for(const o of e.getDefinedFiles()){const s=decodeURI(Qo.resolve(e.url,o));t.includes(s)&&n.push(s)}const i=yield Ot.getFiles(r,n);for(let o=0;os.endsWith("model.json")||s.endsWith("model3.json"));if(!t)throw new Error("Settings file not found");const n=yield Ot.readText(r,t);if(!n)throw new Error("Empty settings file: "+t);const i=JSON.parse(n);i.url=t;const o=ct.findRuntime(i);if(!o)throw new Error("Unknown settings JSON");return o.createModelSettings(i)})}static zipReader(r,e){return st(this,null,function*(){throw new Error("Not implemented")})}static getFilePaths(r){return st(this,null,function*(){throw new Error("Not implemented")})}static getFiles(r,e){return st(this,null,function*(){throw new Error("Not implemented")})}static readText(r,e){return st(this,null,function*(){throw new Error("Not implemented")})}static releaseReader(r){}};let $n=Ot;$n.ZIP_PROTOCOL="zip://";$n.uid=0;$n.factory=(r,e)=>st(void 0,null,function*(){const t=r.source;let n,i,o;if(typeof t=="string"&&(t.endsWith(".zip")||t.startsWith(Ot.ZIP_PROTOCOL))?(t.startsWith(Ot.ZIP_PROTOCOL)?n=t.slice(Ot.ZIP_PROTOCOL.length):n=t,i=yield Gn.load({url:n,type:"blob",target:r.live2dModel})):Array.isArray(t)&&t.length===1&&t[0]instanceof File&&t[0].name.endsWith(".zip")&&(i=t[0],n=URL.createObjectURL(i),o=t.settings),i){if(!i.size)throw new Error("Empty zip file");const s=yield Ot.zipReader(i,n);o||(o=yield Ot.createSettings(s)),o._objectURL=Ot.ZIP_PROTOCOL+Ot.uid+"/"+o.url;const a=yield Ot.unzip(s,o);a.settings=o,r.source=a,n.startsWith("blob:")&&r.live2dModel.once("modelLoaded",l=>{l.once("destroy",function(){URL.revokeObjectURL(n)})}),Ot.releaseReader(s)}return e()});ct.live2DModelMiddlewares.unshift($n.factory);if(!window.Live2DCubismCore)throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded.");class f1 extends cp{constructor(e,t){var n;super(e,t),this.queueManager=new op,this.definitions=(n=e.expressions)!=null?n:[],this.init()}isFinished(){return this.queueManager.isFinished()}getExpressionIndex(e){return this.definitions.findIndex(t=>t.Name===e)}getExpressionFile(e){return e.File}createExpression(e,t){return wu.create(e)}_setExpression(e){return this.queueManager.startMotion(e,!1,performance.now())}stopAllExpressions(){this.queueManager.stopAllMotions()}updateParameters(e,t){return this.queueManager.doUpdateMotion(e,t)}}class jr extends Au{constructor(e){if(super(e),!jr.isValidJSON(e))throw new TypeError("Invalid JSON.");Object.assign(this,new lp(e))}static isValidJSON(e){var t;return!!(e!=null&&e.FileReferences)&&typeof e.FileReferences.Moc=="string"&&((t=e.FileReferences.Textures)==null?void 0:t.length)>0&&e.FileReferences.Textures.every(n=>typeof n=="string")}replaceFiles(e){if(super.replaceFiles(e),this.motions)for(const[t,n]of Object.entries(this.motions))for(let i=0;i{this.emit("motion:"+n)})}isFinished(){return this.queueManager.isFinished()}_startMotion(e,t){return e.setFinishedMotionHandler(t),this.queueManager.stopAllMotions(),this.queueManager.startMotion(e,!1,performance.now())}_stopAllMotions(){this.queueManager.stopAllMotions()}createMotion(e,t,n){const i=Su.create(e),o=new ip(e),s=(t===this.groups.idle?Dt.idleMotionFadingDuration:Dt.motionFadingDuration)/1e3;return o.getMotionFadeInTime()===void 0&&i.setFadeInTime(n.FadeInTime>0?n.FadeInTime:s),o.getMotionFadeOutTime()===void 0&&i.setFadeOutTime(n.FadeOutTime>0?n.FadeOutTime:s),i.setEffectIds(this.eyeBlinkIds,this.lipSyncIds),i}getMotionFile(e){return e.File}getMotionName(e){return e.File}getSoundFile(e){return e.Sound}updateParameters(e,t){return this.queueManager.doUpdateMotion(e,t)}destroy(){super.destroy(),this.queueManager.release(),this.queueManager=void 0}}const Xf=new Zt;class d1 extends o1{constructor(e,t,n){super(),this.lipSync=!0,this.breath=yu.create(),this.renderer=new ap,this.idParamAngleX=Gb,this.idParamAngleY=$b,this.idParamAngleZ=Hb,this.idParamEyeBallX=Xb,this.idParamEyeBallY=Wb,this.idParamBodyAngleX=qb,this.idParamBreath=Yb,this.pixelsPerUnit=1,this.centeringTransform=new Et,this.coreModel=e,this.settings=t,this.motionManager=new h1(t,n),this.init()}init(){var e;super.init(),((e=this.settings.getEyeBlinkParameters())==null?void 0:e.length)>0&&(this.eyeBlink=np.create(this.settings)),this.breath.setParameters([new si(this.idParamAngleX,0,15,6.5345,.5),new si(this.idParamAngleY,0,8,3.5345,.5),new si(this.idParamAngleZ,0,10,5.5345,.5),new si(this.idParamBodyAngleX,0,4,15.5345,.5),new si(this.idParamBreath,0,.5,3.2345,.5)]),this.renderer.initialize(this.coreModel),this.renderer.setIsPremultipliedAlpha(!0)}getSize(){return[this.coreModel.getModel().canvasinfo.CanvasWidth,this.coreModel.getModel().canvasinfo.CanvasHeight]}getLayout(){const e={};if(this.settings.layout)for(const t of Object.keys(this.settings.layout)){const n=t.charAt(0).toLowerCase()+t.slice(1);e[n]=this.settings.layout[t]}return e}setupLayout(){super.setupLayout(),this.pixelsPerUnit=this.coreModel.getModel().canvasinfo.PixelsPerUnit,this.centeringTransform.scale(this.pixelsPerUnit,this.pixelsPerUnit).translate(this.originalWidth/2,this.originalHeight/2)}updateWebGLContext(e,t){this.renderer.firstDraw=!0,this.renderer._bufferData={vertex:null,uv:null,index:null},this.renderer.startUp(e),this.renderer._clippingManager._currentFrameNo=t,this.renderer._clippingManager._maskTexture=void 0,zr.getInstance()._shaderSets=[]}bindTexture(e,t){this.renderer.bindTexture(e,t)}getHitAreaDefs(){var e,t;return(t=(e=this.settings.hitAreas)==null?void 0:e.map(n=>({id:n.Id,name:n.Name,index:this.coreModel.getDrawableIndex(n.Id)})))!=null?t:[]}getDrawableIDs(){return this.coreModel.getDrawableIds()}getDrawableIndex(e){return this.coreModel.getDrawableIndex(e)}getDrawableVertices(e){if(typeof e=="string"&&(e=this.coreModel.getDrawableIndex(e),e===-1))throw new TypeError("Unable to find drawable ID: "+e);const t=this.coreModel.getDrawableVertices(e).slice();for(let n=0;n{function t(){try{m1(),r()}catch(n){if(Wf--,Wf<0){const i=new Error("Failed to start up Cubism 4 framework.");i.cause=n,e(i);return}Ke.log("Cubism4","Startup failed, retrying 10ms later..."),setTimeout(t,10)}}t()})),Ji)}function m1(r){r=Object.assign({logFunction:console.log,loggingLevel:xr.LogLevel_Verbose},r),ki.startUp(r),ki.initialize()}ct.registerRuntime({version:4,ready:p1,test(r){return r instanceof jr||jr.isValidJSON(r)},isValidMoc(r){if(r.byteLength<4)return!1;const e=new Int8Array(r,0,4);return String.fromCharCode(...e)==="MOC3"},createModelSettings(r){return new jr(r)},createCoreModel(r){const e=bu.create(r);try{const t=e.createModel();return t.__moc=e,t}catch(t){try{e.release()}catch{}throw t}},createInternalModel(r,e,t){const n=new d1(r,e,t),i=r;return i.__moc&&(n.__moc=i.__moc,delete i.__moc,n.once("destroy",g1)),n},createPhysics(r,e){return Eu.create(e)},createPose(r,e){return _u.create(e)}});function g1(){var r;(r=this.__moc)==null||r.release()}const v1=De({__name:"Viewer",props:{model:null,mouthOpenSize:{default:0}},setup(r,{expose:e}){const t=r,n=le(),i=le(),o=le(),s=le(),a=le(0),l=le(0),u=Ve(()=>Math.max(0,Math.min(100,t.mouthOpenSize))),c=Xo(),f=nd(rd),p=Ve(()=>f.between("sm","md").value||f.smaller("sm").value),{height:h,width:g}=Wo(n,{immediate:!0,windowResize:!0,reset:!0});function v(){return s.value.internalModel.coreModel}function d(x){if(!x.value)return;let b=2.2;p.value&&(b=2.2);const E=h.value*.95/l.value*b,A=g.value*.95/a.value*b,M=Math.min(E,A);x.value.scale.set(M,M)}async function m(x){Dl.registerTicker(wn),Qr.add(ay),i.value=new Zd({width:g.value,height:h.value,backgroundAlpha:0}),o.value=i.value.view,o.value.style.objectFit="contain",x.appendChild(i.value.view),s.value=await Dl.from(t.model,{motionPreload:fp.ALL}),i.value.stage.addChild(s.value),a.value=s.value.width,l.value=s.value.height,s.value.x=g.value/2,s.value.y=h.value,s.value.rotation=Math.PI,s.value.skew.x=Math.PI,s.value.anchor.set(.5,.5),d(s),s.value.on("hit",E=>{s.value&&E.includes("body")&&s.value.motion("tap_body")}),s.value.internalModel.coreModel.setParameterValueById("ParamMouthOpenY",u.value)}async function y(x){await s.value.motion(x,void 0,jo.FORCE)}const _=Gm(()=>{i.value&&i.value.renderer.resize(g.value,h.value),o.value&&(o.value.width=g.value,o.value.height=h.value),s.value&&(s.value.x=g.value/2,s.value.y=h.value,d(s))},100);function C(){s.value&&(s.value.filters=[new X_({color:c.value?10053247:14662098,alpha:.3,blur:0,distance:20,rotation:45})])}return Ge([g,h],()=>{_()}),Ge(c,C,{immediate:!0}),Ge(s,C),Jt(C),Jt(async()=>{n.value&&await m(n.value)}),Gt(()=>{var x;(x=i.value)==null||x.destroy()}),Ge(u,x=>{v().setParameterValueById("ParamMouthOpenY",x)}),e({setMotion:y}),(x,b)=>(he(),_e("div",{ref_key:"containerRef",ref:n,"h-full":"","w-full":""},null,512))}}),_p=De({__name:"Screen",setup(r){const e=le(),t=nd(rd),{width:n,height:i}=$m(),o=Wo(e,{immediate:!0,windowResize:!0,reset:!0}),s=Ve(()=>t.between("sm","md").value||t.smaller("sm").value),a=Ve(()=>t.between("md","lg").value),l=Ve(()=>t.greaterOrEqual("lg").value),u=Ve(()=>l.value?o.width.value:s.value||a.value?n.value-16:o.width.value),c=le(0);return Ge([n,i,e],()=>{var p,h;const f=(h=(p=e.value)==null?void 0:p.parentElement)==null?void 0:h.getBoundingClientRect();l.value||s.value||a.value?c.value=(f==null?void 0:f.height)||0:c.value=600}),Ge([o.width,o.height],()=>{l.value||s.value||a.value?c.value=o.height.value:c.value=600}),Jt(async()=>{e.value&&o.update()}),(f,p)=>(he(),_e("div",{ref_key:"containerRef",ref:e,"h-full":"","w-full":""},[ut(f.$slots,"default",{width:u.value,height:c.value})],512))}}),y1={absolute:"",bottom:"2",right:"2"},_1={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","h-fit":"","w-fit":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":""},x1=["checked","aria-checked"],b1={key:0,absolute:"","w-full":"","min-w":"50vw",z:"{var o;await((o=t.value)==null?void 0:o.setMotion(i))}}),(i,o)=>{const s=Eo("TransitionVertical");return he(),lt(_p,{relative:""},{default:Ue(({width:a,height:l})=>[Re(v1,{ref_key:"modelRef",ref:t,"canvas-width":a,"canvas-height":l,model:r.model,"mouth-open-size":r.mouthOpenSize},null,8,["canvas-width","canvas-height","model","mouth-open-size"]),Y("div",y1,[Y("div",_1,[Y("label",{"h-fit":"","cursor-pointer":"",class:Kt([n.value?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),transition:"all ease-in-out duration-500","rounded-md":"","px-2":"","py-2":"",z:"n.value=u),checked:n.value,"aria-checked":n.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,x1),[[Xr,n.value]]),o[8]||(o[8]=Y("div",{"select-none":""},[Y("div",{"i-solar:bug-bold-duotone":"",text:"text-zinc-900 dark:text-zinc-800"})],-1))],2)]),Re(s,null,{default:Ue(()=>[n.value?(he(),_e("div",b1,[Y("div",w1,[Y("div",T1,[Y("span",null,be(i.$t("stage.viewers.debug-menu.emotions")),1)]),Y("div",S1,[Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[1]||(o[1]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(tv))})},be(i.$t("stage.viewers.debug-menu.emotions-btn.surprised")),1),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[2]||(o[2]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(nv))})},be(i.$t("stage.viewers.debug-menu.emotions-btn.sad")),1),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[3]||(o[3]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(rv))})},be(i.$t("stage.viewers.debug-menu.emotions-btn.angry")),1),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[4]||(o[4]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(iv))})},be(i.$t("stage.viewers.debug-menu.emotions-btn.happy")),1),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[5]||(o[5]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(ov))})},be(i.$t("stage.viewers.debug-menu.emotions-btn.awkward")),1),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[6]||(o[6]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(sv))})},be(i.$t("stage.viewers.debug-menu.emotions-btn.question")),1),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:o[7]||(o[7]=u=>{var c;return(c=t.value)==null?void 0:c.setMotion(K(Md))})},be(i.$t("stage.viewers.debug-menu.emotions-btn.think")),1)])])])):nt("",!0)]),_:1})])]),_:1})}}});function C1(r){return fd()?(hd(r),!0):!1}function xp(r){return typeof r=="function"?r():K(r)}const A1=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const I1=Object.prototype.toString,P1=r=>I1.call(r)==="[object Object]",M1=()=>{};function k1(r){var e;const t=xp(r);return(e=t==null?void 0:t.$el)!=null?e:t}const O1=A1?window:void 0;function ma(...r){let e,t,n,i;if(typeof r[0]=="string"||Array.isArray(r[0])?([t,n,i]=r,e=O1):[e,t,n,i]=r,!e)return M1;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const o=[],s=()=>{o.forEach(c=>c()),o.length=0},a=(c,f,p,h)=>(c.addEventListener(f,p,h),()=>c.removeEventListener(f,p,h)),l=Ge(()=>[k1(e),xp(i)],([c,f])=>{if(s(),!c)return;const p=P1(f)?{...f}:f;o.push(...t.flatMap(h=>n.map(g=>a(c,h,g,p))))},{immediate:!0,flush:"post"}),u=()=>{l(),s()};return C1(u),u}class Vo extends fr{constructor(){super(Vo.Geometry,new Lr({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const e=new Fe,t=new Fe,n=new lc(16,16),i=new lc(16,16);let o=uc;const s=Vo.Geometry,a=new ms({uniforms:{scale:{value:null},screenPosition:{value:null}},vertexShader:` + + precision highp float; + + uniform vec3 screenPosition; + uniform vec2 scale; + + attribute vec3 position; + + void main() { + + gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); + + }`,fragmentShader:` + + precision highp float; + + void main() { + + gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 ); + + }`,depthTest:!0,depthWrite:!1,transparent:!1}),l=new ms({uniforms:{map:{value:n},scale:{value:null},screenPosition:{value:null}},vertexShader:` + + precision highp float; + + uniform vec3 screenPosition; + uniform vec2 scale; + + attribute vec3 position; + attribute vec2 uv; + + varying vec2 vUV; + + void main() { + + vUV = uv; + + gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 ); + + }`,fragmentShader:` + + precision highp float; + + uniform sampler2D map; + + varying vec2 vUV; + + void main() { + + gl_FragColor = texture2D( map, vUV ); + + }`,depthTest:!1,depthWrite:!1,transparent:!1}),u=new fr(s,a),c=[],f=bp.Shader,p=new ms({name:f.name,uniforms:{map:{value:null},occlusionMap:{value:i},color:{value:new Vt(16777215)},scale:{value:new bt},screenPosition:{value:new Fe}},vertexShader:f.vertexShader,fragmentShader:f.fragmentShader,blending:Qm,transparent:!0,depthWrite:!1}),h=new fr(s,p);this.addElement=function(y){c.push(y)};const g=new bt,v=new bt,d=new eg,m=new Bn;this.onBeforeRender=function(y,_,C){y.getCurrentViewport(m);const x=y.getRenderTarget(),b=x!==null?x.texture.type:uc;o!==b&&(n.dispose(),i.dispose(),n.type=i.type=b,o=b);const E=m.w/m.z,A=m.z/2,M=m.w/2;let I=16/m.w;if(g.set(I*E,I),d.min.set(m.x,m.y),d.max.set(m.x+(m.z-16),m.y+(m.w-16)),t.setFromMatrixPosition(this.matrixWorld),t.applyMatrix4(C.matrixWorldInverse),!(t.z>0)&&(e.copy(t).applyMatrix4(C.projectionMatrix),v.x=m.x+e.x*A+A-8,v.y=m.y+e.y*M+M-8,d.containsPoint(v))){y.copyFramebufferToTexture(n,v);let F=a.uniforms;F.scale.value=g,F.screenPosition.value=e,y.renderBufferDirect(C,null,s,a,u,null),y.copyFramebufferToTexture(i,v),F=l.uniforms,F.scale.value=g,F.screenPosition.value=e,y.renderBufferDirect(C,null,s,l,u,null);const S=-e.x*2,X=-e.y*2;for(let w=0,G=c.length;we in r?R1(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,L1=(r,e,t)=>(F1(r,e+"",t),t);async function qf(r){const e=await r.arrayBuffer(),t=btoa(String.fromCharCode(...new Uint8Array(e)));return`data:${r.type||""};base64,${t}`}let Qi,ga,Pr,eo;function va(r,e=1/0,t=null){ga||(ga=new ld(2,2,1,1)),Pr||(Pr=new qo({uniforms:{blitTexture:new ug(r)},vertexShader:` + varying vec2 vUv; + void main(){ + vUv = uv; + gl_Position = vec4(position.xy * 1.0,0.,.999999); + } + `,fragmentShader:` + uniform sampler2D blitTexture; + varying vec2 vUv; + + void main(){ + gl_FragColor = vec4(vUv.xy, 0, 1); + + #ifdef IS_SRGB + gl_FragColor = LinearTosRGB( texture2D( blitTexture, vUv) ); + #else + gl_FragColor = texture2D( blitTexture, vUv); + #endif + } + `})),Pr.uniforms.blitTexture.value=r,Pr.defines.IS_SRGB="colorSpace"in r?r.colorSpace==="srgb":r.encoding===3001,Pr.needsUpdate=!0,eo||(eo=new fr(ga,Pr),eo.frustrumCulled=!1);const n=new Tn,i=new $a;i.add(eo),t||(t=Qi=new cg({antialias:!1})),t.setSize(Math.min(r.image.width,e),Math.min(r.image.height,e)),t.clear(),t.render(i,n);const o=new Ao(t.domElement);return o.minFilter=r.minFilter,o.magFilter=r.magFilter,o.wrapS=r.wrapS,o.wrapT=r.wrapT,o.name=r.name,Qi&&(Qi.dispose(),Qi=null),o}const Yf={POSITION:["byte","byte normalized","unsigned byte","unsigned byte normalized","short","short normalized","unsigned short","unsigned short normalized"],NORMAL:["byte normalized","short normalized"],TANGENT:["byte normalized","short normalized"],TEXCOORD:["byte","byte normalized","unsigned byte","short","short normalized","unsigned short"]};class wp{constructor(){this.pluginCallbacks=[],this.register(function(e){return new H1(e)}),this.register(function(e){return new X1(e)}),this.register(function(e){return new Y1(e)}),this.register(function(e){return new K1(e)}),this.register(function(e){return new Z1(e)}),this.register(function(e){return new J1(e)}),this.register(function(e){return new W1(e)}),this.register(function(e){return new q1(e)}),this.register(function(e){return new Q1(e)}),this.register(function(e){return new ew(e)}),this.register(function(e){return new tw(e)})}register(e){return this.pluginCallbacks.indexOf(e)===-1&&this.pluginCallbacks.push(e),this}unregister(e){return this.pluginCallbacks.indexOf(e)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(e),1),this}parse(e,t,n,i){const o=new $1,s=[];for(let a=0,l=this.pluginCallbacks.length;ar.times[r.times.length-1]){if(Math.abs(r.times[r.times.length-1]-e)<.001)return r.times.length-1;n[n.length-1]=e,n.set(r.times,0),i.set(r.values,0),i.set(o.evaluate(e),r.values.length),s=n.length-1}else for(let a=0;ae){n.set(r.times.slice(0,a+1),0),n[a+1]=e,n.set(r.times.slice(a+1),a+2),i.set(r.values.slice(0,(a+1)*t),0),i.set(o.evaluate(e),(a+1)*t),i.set(r.values.slice((a+1)*t),(a+2)*t),s=a+1;break}}return r.times=n,r.values=i,s},mergeMorphTargetTracks:function(r,e){const t=[],n={},i=r.tracks;for(let o=0;o4?s=r.array[i*r.itemSize+o]:(o===0?s=r.getX(i):o===1?s=r.getY(i):o===2?s=r.getZ(i):o===3&&(s=r.getW(i)),r.normalized===!0&&(s=Wr.normalize(s,r.array))),n.min[o]=Math.min(n.min[o],s),n.max[o]=Math.max(n.max[o],s)}return n}function Tp(r){return Math.ceil(r/4)*4}function _a(r,e=0){const t=Tp(r.byteLength);if(t!==r.byteLength){const n=new Uint8Array(t);if(n.set(new Uint8Array(r)),e!==0)for(let i=r.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function eh(r,e){if(r.toBlob!==void 0)return new Promise(n=>r.toBlob(n,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),r.convertToBlob({type:e,quality:t})}class $1{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.extensionsRequired={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,n={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},n),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,o=i.buffers,s=i.json;n=i.options;const a=i.extensionsUsed,l=i.extensionsRequired,u=new Blob(o,{type:"application/octet-stream"}),c=Object.keys(a),f=Object.keys(l);c.length>0&&(s.extensionsUsed=c),f.length>0&&(s.extensionsRequired=f),s.buffers&&s.buffers.length>0&&(s.buffers[0].byteLength=u.size),n.binary===!0?u.arrayBuffer().then(p=>{const h=_a(p),g=new DataView(new ArrayBuffer(Jf));g.setUint32(0,h.byteLength,!0),g.setUint32(4,z1,!0);const v=_a(j1(JSON.stringify(s)),32),d=new DataView(new ArrayBuffer(Jf));d.setUint32(0,v.byteLength,!0),d.setUint32(4,U1,!0);const m=new ArrayBuffer(Zf),y=new DataView(m);y.setUint32(0,D1,!0),y.setUint32(4,B1,!0);const _=Zf+d.byteLength+v.byteLength+g.byteLength+h.byteLength;y.setUint32(8,_,!0),new Blob([m,d,v,g,h],{type:"application/octet-stream"}).arrayBuffer().then(t)}):s.buffers&&s.buffers.length>0?qf(u).then(p=>{s.buffers[0].uri=p,t(s)}):t(s)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const n=this.options,i=this.extensionsUsed;try{const o=JSON.parse(JSON.stringify(e.userData));if(n.includeCustomExtensions&&o.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const s in o.gltfExtensions)t.extensions[s]=o.gltfExtensions[s],i[s]=!0;delete o.gltfExtensions}Object.keys(o).length>0&&(t.extras=o)}catch(o){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+o.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const n=new Map;n.set(!0,this.uid++),n.set(!1,this.uid++),this.uids.set(e,n)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const t=new Fe;for(let n=0,i=e.count;n5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const n=e.clone(),i=new Fe;for(let o=0,s=n.count;o4?g=e.array[p*e.itemSize+h]:(h===0?g=e.getX(p):h===1?g=e.getY(p):h===2?g=e.getZ(p):h===3&&(g=e.getW(p)),e.normalized===!0&&(g=Wr.normalize(g,e.array))),t===je.FLOAT?u.setFloat32(c,g,!0):t===je.INT?u.setInt32(c,g,!0):t===je.UNSIGNED_INT?u.setUint32(c,g,!0):t===je.SHORT?u.setInt16(c,g,!0):t===je.UNSIGNED_SHORT?u.setUint16(c,g,!0):t===je.BYTE?u.setInt8(c,g):t===je.UNSIGNED_BYTE&&u.setUint8(c,g),c+=a}const f={buffer:this.processBuffer(u.buffer),byteOffset:this.byteOffset,byteLength:l};return o!==void 0&&(f.target=o),o===je.ARRAY_BUFFER&&(f.byteStride=e.itemSize*a),this.byteOffset+=l,s.bufferViews.push(f),{id:s.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,n=t.json;return n.bufferViews||(n.bufferViews=[]),e.arrayBuffer().then(i=>{const o=_a(i),s={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};return t.byteOffset+=o.byteLength,n.bufferViews.push(s)-1})}processAccessor(e,t,n,i){const o=this.json,s={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=je.FLOAT;else if(e.array.constructor===Int32Array)a=je.INT;else if(e.array.constructor===Uint32Array)a=je.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=je.SHORT;else if(e.array.constructor===Uint16Array)a=je.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=je.BYTE;else if(e.array.constructor===Uint8Array)a=je.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(n===void 0&&(n=0),i===void 0&&(i=e.count),i===0)return null;const l=G1(e,n,i);let u;t!==void 0&&(u=e===t.index?je.ELEMENT_ARRAY_BUFFER:je.ARRAY_BUFFER);const c=this.processBufferView(e,a,n,i,u),f={bufferView:c.id,byteOffset:c.byteOffset,componentType:a,count:i,max:l.max,min:l.min,type:s[e.itemSize]};return e.normalized===!0&&(f.normalized=!0),o.accessors||(o.accessors=[]),o.accessors.push(f)-1}processImage(e,t,n,i="image/png"){if(e!==null){const o=this,s=o.cache,a=o.json,l=o.options,u=o.pending;s.images.has(e)||s.images.set(e,{});const c=s.images.get(e),f=i+":flipY/"+n.toString();if(c[f]!==void 0)return c[f];a.images||(a.images=[]);const p={mimeType:i},h=Qf();h.width=Math.min(e.width,l.maxTextureSize),h.height=Math.min(e.height,l.maxTextureSize);const g=h.getContext("2d");if(n===!0&&(g.translate(0,h.height),g.scale(1,-1)),e.data!==void 0){t!==ag&&console.error("GLTFExporter: Only RGBAFormat is supported.",t),(e.width>l.maxTextureSize||e.height>l.maxTextureSize)&&console.warn("GLTFExporter: Image size is bigger than maxTextureSize",e);const d=new Uint8ClampedArray(e.height*e.width*4);for(let m=0;mo.processBufferViewImage(d)).then(d=>{p.bufferView=d})):h.toDataURL!==void 0?p.uri=h.toDataURL(i):u.push(eh(h,i).then(qf).then(d=>{p.uri=d}));const v=a.images.push(p)-1;return c[f]=v,v}else throw new Error("THREE.GLTFExporter: No valid image data found. Unable to process texture.")}processSampler(e){const t=this.json;t.samplers||(t.samplers=[]);const n={magFilter:zt[e.magFilter],minFilter:zt[e.minFilter],wrapS:zt[e.wrapS],wrapT:zt[e.wrapT]};return t.samplers.push(n)-1}processTexture(e){const t=this.options,n=this.cache,i=this.json;if(n.textures.has(e))return n.textures.get(e);i.textures||(i.textures=[]),e instanceof gs&&(e=va(e,t.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const s={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(s.name=e.name),this._invokeAll(function(l){l.writeTexture&&l.writeTexture(e,s)});const a=i.textures.push(s)-1;return n.textures.set(e,a),a}processMaterial(e){const t=this.cache,n=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;n.materials||(n.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const o=e.color.toArray().concat([e.opacity]);if(vi(o,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=o),e.isMeshStandardMaterial?(i.pbrMetallicRoughness.metallicFactor=e.metalness,i.pbrMetallicRoughness.roughnessFactor=e.roughness):(i.pbrMetallicRoughness.metallicFactor=.5,i.pbrMetallicRoughness.roughnessFactor=.5),e.metalnessMap||e.roughnessMap){const a=this.buildMetalRoughTexture(e.metalnessMap,e.roughnessMap),l={index:this.processTexture(a),channel:a.channel};this.applyTextureTransform(l,a),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const a={index:this.processTexture(e.map),texCoord:e.map.channel};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive;if(Math.max(a.r,a.g,a.b)>0&&(i.emissiveFactor=e.emissive.toArray()),e.emissiveMap){const l={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(l,e.emissiveMap),i.emissiveTexture=l}}if(e.normalMap){const a={index:this.processTexture(e.normalMap),texCoord:e.normalMap.channel};e.normalScale&&e.normalScale.x!==1&&(a.scale=e.normalScale.x),this.applyTextureTransform(a,e.normalMap),i.normalTexture=a}if(e.aoMap){const a={index:this.processTexture(e.aoMap),texCoord:e.aoMap.channel};e.aoMapIntensity!==1&&(a.strength=e.aoMapIntensity),this.applyTextureTransform(a,e.aoMap),i.occlusionTexture=a}e.transparent?i.alphaMode="BLEND":e.alphaTest>0&&(i.alphaMode="MASK",i.alphaCutoff=e.alphaTest),e.side===Yo&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});const s=n.materials.push(i)-1;return t.materials.set(e,s),s}processMesh(e){const t=this.cache,n=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let _=0,C=e.material.length;_=152?{uv:"TEXCOORD_0",uv1:"TEXCOORD_1",uv2:"TEXCOORD_2",uv3:"TEXCOORD_3"}:{uv:"TEXCOORD_0",uv2:"TEXCOORD_1"},color:"COLOR_0",skinWeight:"WEIGHTS_0",skinIndex:"JOINTS_0"},h=s.getAttribute("normal");h!==void 0&&!this.isNormalizedNormalAttribute(h)&&(console.warn("THREE.GLTFExporter: Creating normalized normal attribute from the non-normalized one."),s.setAttribute("normal",this.createNormalizedNormalAttribute(h)));let g=null;for(let _ in s.attributes){if(_.slice(0,5)==="morph")continue;const C=s.attributes[_];if(_=p[_]||_.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(_)||(_="_"+_),t.attributes.has(this.getUID(C))){u[_]=t.attributes.get(this.getUID(C));continue}g=null;const x=C.array;_==="JOINTS_0"&&!(x instanceof Uint16Array)&&!(x instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),g=new ur(new Uint16Array(x),C.itemSize,C.normalized));const b=this.processAccessor(g||C,s);b!==null&&(_.startsWith("_")||this.detectMeshQuantization(_,C),u[_]=b,t.attributes.set(this.getUID(C),b))}if(h!==void 0&&s.setAttribute("normal",h),Object.keys(u).length===0)return null;if(e.morphTargetInfluences!==void 0&&e.morphTargetInfluences.length>0){const _=[],C=[],x={};if(e.morphTargetDictionary!==void 0)for(const b in e.morphTargetDictionary)x[e.morphTargetDictionary[b]]=b;for(let b=0;b0&&(l.extras={},l.extras.targetNames=C)}const v=Array.isArray(e.material);if(v&&s.groups.length===0)return null;const d=v?e.material:[e.material],m=v?s.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let _=0,C=m.length;_0&&(x.targets=f),s.index!==null){let E=this.getUID(s.index);(m[_].start!==void 0||m[_].count!==void 0)&&(E+=":"+m[_].start+":"+m[_].count),t.attributes.has(E)?x.indices=t.attributes.get(E):(x.indices=this.processAccessor(s.index,s,m[_].start,m[_].count),t.attributes.set(E,x.indices)),x.indices===null&&delete x.indices}const b=this.processMaterial(d[m[_].materialIndex]);b!==null&&(x.material=b),c.push(x)}l.primitives=c,n.meshes||(n.meshes=[]),this._invokeAll(function(_){_.writeMesh&&_.writeMesh(e,l)});const y=n.meshes.push(l)-1;return t.meshes.set(o,y),y}detectMeshQuantization(e,t){if(this.extensionsUsed[ya])return;let n;switch(t.array.constructor){case Int8Array:n="byte";break;case Uint8Array:n="unsigned byte";break;case Int16Array:n="short";break;case Uint16Array:n="unsigned short";break;default:return}t.normalized&&(n+=" normalized");const i=e.split("_",1)[0];Yf[i]&&Yf[i].includes(n)&&(this.extensionsUsed[ya]=!0,this.extensionsRequired[ya]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const n=e.isOrthographicCamera,i={type:n?"orthographic":"perspective"};return n?i.orthographic={xmag:e.right*2,ymag:e.top*2,zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near}:i.perspective={aspectRatio:e.aspect,yfov:Wr.degToRad(e.fov),zfar:e.far<=0?.001:e.far,znear:e.near<0?0:e.near},e.name!==""&&(i.name=e.type),t.cameras.push(i)-1}processAnimation(e,t){const n=this.json,i=this.nodeMap;n.animations||(n.animations=[]),e=wp.Utils.mergeMorphTargetTracks(e.clone(),t);const o=e.tracks,s=[],a=[];for(let l=0;l0){const a=[];for(let l=0,u=e.children.length;l0&&(o.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,o)});const s=t.nodes.push(o)-1;return i.set(e,s),s}processScene(e){const t=this.json,n=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const o=[];for(let s=0,a=e.children.length;s0&&(i.nodes=o),this.serializeUserData(e,i)}processObjects(e){const t=new $a;t.name="AuxScene";for(let n=0;n0&&this.processObjects(n);for(let i=0;i0&&(s.range=e.distance)):e.isSpotLight&&(s.type="spot",e.distance>0&&(s.range=e.distance),s.spot={},s.spot.innerConeAngle=(e.penumbra-1)*e.angle*-1,s.spot.outerConeAngle=e.angle),e.decay!==void 0&&e.decay!==2&&console.warn("THREE.GLTFExporter: Light decay may be lost. glTF is physically-based, and expects light.decay=2."),e.target&&(e.target.parent!==e||e.target.position.x!==0||e.target.position.y!==0||e.target.position.z!==-1)&&console.warn("THREE.GLTFExporter: Light direction may be lost. For best results, make light.target a child of the light with position 0,0,-1."),o[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},o[this.name]=!0);const a=i.extensions[this.name].lights;a.push(s),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}let X1=class{constructor(r){this.writer=r,this.name="KHR_materials_unlit"}writeMaterial(r,e){if(!r.isMeshBasicMaterial)return;const t=this.writer.extensionsUsed;e.extensions=e.extensions||{},e.extensions[this.name]={},t[this.name]=!0,e.pbrMetallicRoughness.metallicFactor=0,e.pbrMetallicRoughness.roughnessFactor=.9}},W1=class{constructor(r){this.writer=r,this.name="KHR_materials_clearcoat"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.clearcoat===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.clearcoatFactor=r.clearcoat,r.clearcoatMap){const o={index:t.processTexture(r.clearcoatMap),texCoord:r.clearcoatMap.channel};t.applyTextureTransform(o,r.clearcoatMap),i.clearcoatTexture=o}if(i.clearcoatRoughnessFactor=r.clearcoatRoughness,r.clearcoatRoughnessMap){const o={index:t.processTexture(r.clearcoatRoughnessMap),texCoord:r.clearcoatRoughnessMap.channel};t.applyTextureTransform(o,r.clearcoatRoughnessMap),i.clearcoatRoughnessTexture=o}if(r.clearcoatNormalMap){const o={index:t.processTexture(r.clearcoatNormalMap),texCoord:r.clearcoatNormalMap.channel};t.applyTextureTransform(o,r.clearcoatNormalMap),i.clearcoatNormalTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},q1=class{constructor(r){this.writer=r,this.name="KHR_materials_iridescence"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.iridescence===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.iridescenceFactor=r.iridescence,r.iridescenceMap){const o={index:t.processTexture(r.iridescenceMap),texCoord:r.iridescenceMap.channel};t.applyTextureTransform(o,r.iridescenceMap),i.iridescenceTexture=o}if(i.iridescenceIor=r.iridescenceIOR,i.iridescenceThicknessMinimum=r.iridescenceThicknessRange[0],i.iridescenceThicknessMaximum=r.iridescenceThicknessRange[1],r.iridescenceThicknessMap){const o={index:t.processTexture(r.iridescenceThicknessMap),texCoord:r.iridescenceThicknessMap.channel};t.applyTextureTransform(o,r.iridescenceThicknessMap),i.iridescenceThicknessTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},Y1=class{constructor(r){this.writer=r,this.name="KHR_materials_transmission"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.transmission===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.transmissionFactor=r.transmission,r.transmissionMap){const o={index:t.processTexture(r.transmissionMap),texCoord:r.transmissionMap.channel};t.applyTextureTransform(o,r.transmissionMap),i.transmissionTexture=o}e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},K1=class{constructor(r){this.writer=r,this.name="KHR_materials_volume"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.transmission===0)return;const t=this.writer,n=t.extensionsUsed,i={};if(i.thicknessFactor=r.thickness,r.thicknessMap){const o={index:t.processTexture(r.thicknessMap),texCoord:r.thicknessMap.channel};t.applyTextureTransform(o,r.thicknessMap),i.thicknessTexture=o}i.attenuationDistance=r.attenuationDistance,i.attenuationColor=r.attenuationColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},Z1=class{constructor(r){this.writer=r,this.name="KHR_materials_ior"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.ior===1.5)return;const t=this.writer.extensionsUsed,n={};n.ior=r.ior,e.extensions=e.extensions||{},e.extensions[this.name]=n,t[this.name]=!0}},J1=class{constructor(r){this.writer=r,this.name="KHR_materials_specular"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.specularIntensity===1&&r.specularColor.equals(N1)&&!r.specularIntensityMap&&!r.specularColorTexture)return;const t=this.writer,n=t.extensionsUsed,i={};if(r.specularIntensityMap){const o={index:t.processTexture(r.specularIntensityMap),texCoord:r.specularIntensityMap.channel};t.applyTextureTransform(o,r.specularIntensityMap),i.specularTexture=o}if(r.specularColorMap){const o={index:t.processTexture(r.specularColorMap),texCoord:r.specularColorMap.channel};t.applyTextureTransform(o,r.specularColorMap),i.specularColorTexture=o}i.specularFactor=r.specularIntensity,i.specularColorFactor=r.specularColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},Q1=class{constructor(r){this.writer=r,this.name="KHR_materials_sheen"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.sheen==0)return;const t=this.writer,n=t.extensionsUsed,i={};if(r.sheenRoughnessMap){const o={index:t.processTexture(r.sheenRoughnessMap),texCoord:r.sheenRoughnessMap.channel};t.applyTextureTransform(o,r.sheenRoughnessMap),i.sheenRoughnessTexture=o}if(r.sheenColorMap){const o={index:t.processTexture(r.sheenColorMap),texCoord:r.sheenColorMap.channel};t.applyTextureTransform(o,r.sheenColorMap),i.sheenColorTexture=o}i.sheenRoughnessFactor=r.sheenRoughness,i.sheenColorFactor=r.sheenColor.toArray(),e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},ew=class{constructor(r){this.writer=r,this.name="KHR_materials_anisotropy"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.anisotropy==0)return;const t=this.writer,n=t.extensionsUsed,i={};if(r.anisotropyMap){const o={index:t.processTexture(r.anisotropyMap)};t.applyTextureTransform(o,r.anisotropyMap),i.anisotropyTexture=o}i.anisotropyStrength=r.anisotropy,i.anisotropyRotation=r.anisotropyRotation,e.extensions=e.extensions||{},e.extensions[this.name]=i,n[this.name]=!0}},tw=class{constructor(r){this.writer=r,this.name="KHR_materials_emissive_strength"}writeMaterial(r,e){if(!r.isMeshStandardMaterial||r.emissiveIntensity===1)return;const t=this.writer.extensionsUsed,n={};n.emissiveStrength=r.emissiveIntensity,e.extensions=e.extensions||{},e.extensions[this.name]=n,t[this.name]=!0}};var Fi=Uint8Array,Sp=Uint16Array,nw=Uint32Array,rw=new Fi([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),iw=new Fi([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Ep=function(r,e){for(var t=new Sp(31),n=0;n<31;++n)t[n]=e+=1<>>1|(rt&21845)<<1;Mn=(Mn&52428)>>>2|(Mn&13107)<<2,Mn=(Mn&61680)>>>4|(Mn&3855)<<4,aw[rt]=((Mn&65280)>>>8|(Mn&255)<<8)>>>1}var rs=new Fi(288);for(var rt=0;rt<144;++rt)rs[rt]=8;for(var rt=144;rt<256;++rt)rs[rt]=9;for(var rt=256;rt<280;++rt)rs[rt]=7;for(var rt=280;rt<288;++rt)rs[rt]=8;var lw=new Fi(32);for(var rt=0;rt<32;++rt)lw[rt]=5;var uw=new Fi(0),cw=typeof TextDecoder<"u"&&new TextDecoder,fw=0;try{cw.decode(uw,{stream:!0}),fw=1}catch{}var hw=Object.defineProperty,dw=(r,e,t)=>e in r?hw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pw=(r,e,t)=>(dw(r,e+"",t),t);const Ap=class extends fr{constructor(e,t={}){super(e),this.isReflector=!0,this.type="Reflector",this.camera=new Tn;const n=this,i=t.color!==void 0?new Vt(t.color):new Vt(8355711),o=t.textureWidth||512,s=t.textureHeight||512,a=t.clipBias||0,l=t.shader||Ap.ReflectorShader,u=t.multisample!==void 0?t.multisample:4,c=new ad,f=new Fe,p=new Fe,h=new Fe,g=new Sn,v=new Fe(0,0,-1),d=new Bn,m=new Fe,y=new Fe,_=new Bn,C=new Sn,x=this.camera,b=new rg(o,s,{samples:u,type:ig}),E=new qo({uniforms:nu.clone(l.uniforms),fragmentShader:l.fragmentShader,vertexShader:l.vertexShader});E.uniforms.tDiffuse.value=b.texture,E.uniforms.color.value=i,E.uniforms.textureMatrix.value=C,this.material=E,this.onBeforeRender=function(A,M,I){if(p.setFromMatrixPosition(n.matrixWorld),h.setFromMatrixPosition(I.matrixWorld),g.extractRotation(n.matrixWorld),f.set(0,0,1),f.applyMatrix4(g),m.subVectors(p,h),m.dot(f)>0)return;m.reflect(f).negate(),m.add(p),g.extractRotation(I.matrixWorld),v.set(0,0,-1),v.applyMatrix4(g),v.add(h),y.subVectors(p,v),y.reflect(f).negate(),y.add(p),x.position.copy(m),x.up.set(0,1,0),x.up.applyMatrix4(g),x.up.reflect(f),x.lookAt(y),x.far=I.far,x.updateMatrixWorld(),x.projectionMatrix.copy(I.projectionMatrix),C.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),C.multiply(x.projectionMatrix),C.multiply(x.matrixWorldInverse),C.multiply(n.matrixWorld),c.setFromNormalAndCoplanarPoint(f,p),c.applyMatrix4(x.matrixWorldInverse),d.set(c.normal.x,c.normal.y,c.normal.z,c.constant);const F=x.projectionMatrix;_.x=(Math.sign(d.x)+F.elements[8])/F.elements[0],_.y=(Math.sign(d.y)+F.elements[9])/F.elements[5],_.z=-1,_.w=(1+F.elements[10])/F.elements[14],d.multiplyScalar(2/d.dot(_)),F.elements[2]=d.x,F.elements[6]=d.y,F.elements[10]=d.z+1-a,F.elements[14]=d.w,n.visible=!1;const S=A.getRenderTarget(),X=A.xr.enabled,w=A.shadowMap.autoUpdate,G=A.toneMapping;let R=!1;"outputColorSpace"in A?R=A.outputColorSpace==="srgb":R=A.outputEncoding===3001,A.xr.enabled=!1,A.shadowMap.autoUpdate=!1,"outputColorSpace"in A?A.outputColorSpace="srgb-linear":A.outputEncoding=3e3,A.toneMapping=og,A.setRenderTarget(b),A.state.buffers.depth.setMask(!0),A.autoClear===!1&&A.clear(),A.render(M,x),A.xr.enabled=X,A.shadowMap.autoUpdate=w,A.toneMapping=G,"outputColorSpace"in A?A.outputColorSpace=R?"srgb":"srgb-linear":A.outputEncoding=R?3001:3e3,A.setRenderTarget(S);const L=I.viewport;L!==void 0&&A.state.viewport(L),n.visible=!0},this.getRenderTarget=function(){return b},this.dispose=function(){b.dispose(),n.material.dispose()}}};let Bl=Ap;pw(Bl,"ReflectorShader",{uniforms:{color:{value:null},tDiffuse:{value:null},textureMatrix:{value:null}},vertexShader:` + uniform mat4 textureMatrix; + varying vec4 vUv; + + #include + #include + + void main() { + + vUv = textureMatrix * vec4( position, 1.0 ); + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + + #include + + }`,fragmentShader:` + uniform vec3 color; + uniform sampler2D tDiffuse; + varying vec4 vUv; + + #include + + float blendOverlay( float base, float blend ) { + + return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) ); + + } + + vec3 blendOverlay( vec3 base, vec3 blend ) { + + return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) ); + + } + + void main() { + + #include + + vec4 base = texture2DProj( tDiffuse, vUv ); + gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 ); + + #include + #include <${Mu>=154?"colorspace_fragment":"encodings_fragment"}> + + }`});var mw=Object.defineProperty,gw=(r,e,t)=>e in r?mw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ip=(r,e,t)=>(gw(r,typeof e!="symbol"?e+"":e,t),t);const wo={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new Fe},up:{value:new Fe(0,1,0)}},vertexShader:` + uniform vec3 sunPosition; + uniform float rayleigh; + uniform float turbidity; + uniform float mieCoefficient; + uniform vec3 up; + + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + // constants for atmospheric scattering + const float e = 2.71828182845904523536028747135266249775724709369995957; + const float pi = 3.141592653589793238462643383279502884197169; + + // wavelength of used primaries, according to preetham + const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 ); + // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function: + // (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn)) + const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 ); + + // mie stuff + // K coefficient for the primaries + const float v = 4.0; + const vec3 K = vec3( 0.686, 0.678, 0.666 ); + // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K + const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 ); + + // earth shadow hack + // cutoffAngle = pi / 1.95; + const float cutoffAngle = 1.6110731556870734; + const float steepness = 1.5; + const float EE = 1000.0; + + float sunIntensity( float zenithAngleCos ) { + zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 ); + return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) ); + } + + vec3 totalMie( float T ) { + float c = ( 0.2 * T ) * 10E-18; + return 0.434 * c * MieConst; + } + + void main() { + + vec4 worldPosition = modelMatrix * vec4( position, 1.0 ); + vWorldPosition = worldPosition.xyz; + + gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 ); + gl_Position.z = gl_Position.w; // set z to camera.far + + vSunDirection = normalize( sunPosition ); + + vSunE = sunIntensity( dot( vSunDirection, up ) ); + + vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 ); + + float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) ); + + // extinction (absorbtion + out scattering) + // rayleigh coefficients + vBetaR = totalRayleigh * rayleighCoefficient; + + // mie coefficients + vBetaM = totalMie( turbidity ) * mieCoefficient; + + } + `,fragmentShader:` + varying vec3 vWorldPosition; + varying vec3 vSunDirection; + varying float vSunfade; + varying vec3 vBetaR; + varying vec3 vBetaM; + varying float vSunE; + + uniform float mieDirectionalG; + uniform vec3 up; + + const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 ); + + // constants for atmospheric scattering + const float pi = 3.141592653589793238462643383279502884197169; + + const float n = 1.0003; // refractive index of air + const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius) + + // optical length at zenith for molecules + const float rayleighZenithLength = 8.4E3; + const float mieZenithLength = 1.25E3; + // 66 arc seconds -> degrees, and the cosine of that + const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324; + + // 3.0 / ( 16.0 * pi ) + const float THREE_OVER_SIXTEENPI = 0.05968310365946075; + // 1.0 / ( 4.0 * pi ) + const float ONE_OVER_FOURPI = 0.07957747154594767; + + float rayleighPhase( float cosTheta ) { + return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) ); + } + + float hgPhase( float cosTheta, float g ) { + float g2 = pow( g, 2.0 ); + float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 ); + return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse ); + } + + void main() { + + vec3 direction = normalize( vWorldPosition - cameraPos ); + + // optical length + // cutoff angle at 90 to avoid singularity in next formula. + float zenithAngle = acos( max( 0.0, dot( up, direction ) ) ); + float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) ); + float sR = rayleighZenithLength * inverse; + float sM = mieZenithLength * inverse; + + // combined extinction factor + vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) ); + + // in scattering + float cosTheta = dot( direction, vSunDirection ); + + float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 ); + vec3 betaRTheta = vBetaR * rPhase; + + float mPhase = hgPhase( cosTheta, mieDirectionalG ); + vec3 betaMTheta = vBetaM * mPhase; + + vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) ); + Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) ); + + // nightsky + float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2] + float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2] + vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 ); + vec3 L0 = vec3( 0.1 ) * Fex; + + // composition + solar disc + float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta ); + L0 += ( vSunE * 19000.0 * Fex ) * sundisk; + + vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 ); + + vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) ); + + gl_FragColor = vec4( retColor, 1.0 ); + + #include + #include <${Mu>=154?"colorspace_fragment":"encodings_fragment"}> + + } + `},Pp=new qo({name:"SkyShader",fragmentShader:wo.fragmentShader,vertexShader:wo.vertexShader,uniforms:nu.clone(wo.uniforms),side:Hm,depthWrite:!1});class Mp extends fr{constructor(){super(new sg(1,1,1),Pp)}}Ip(Mp,"SkyShader",wo);Ip(Mp,"material",Pp);new Xm;new Fe;new sd(0,0,0,"YXZ");new Fe;var vw=Object.defineProperty,yw=(r,e,t)=>e in r?vw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ie=(r,e,t)=>(yw(r,typeof e!="symbol"?e+"":e,t),t);const to=new Wm,th=new ad,_w=Math.cos(70*(Math.PI/180)),nh=(r,e)=>(r%e+e)%e;class xw extends ng{constructor(e,t){super(),Ie(this,"object"),Ie(this,"domElement"),Ie(this,"enabled",!0),Ie(this,"target",new Fe),Ie(this,"minDistance",0),Ie(this,"maxDistance",1/0),Ie(this,"minZoom",0),Ie(this,"maxZoom",1/0),Ie(this,"minPolarAngle",0),Ie(this,"maxPolarAngle",Math.PI),Ie(this,"minAzimuthAngle",-1/0),Ie(this,"maxAzimuthAngle",1/0),Ie(this,"enableDamping",!1),Ie(this,"dampingFactor",.05),Ie(this,"enableZoom",!0),Ie(this,"zoomSpeed",1),Ie(this,"enableRotate",!0),Ie(this,"rotateSpeed",1),Ie(this,"enablePan",!0),Ie(this,"panSpeed",1),Ie(this,"screenSpacePanning",!0),Ie(this,"keyPanSpeed",7),Ie(this,"zoomToCursor",!1),Ie(this,"autoRotate",!1),Ie(this,"autoRotateSpeed",2),Ie(this,"reverseOrbit",!1),Ie(this,"reverseHorizontalOrbit",!1),Ie(this,"reverseVerticalOrbit",!1),Ie(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Ie(this,"mouseButtons",{LEFT:Er.ROTATE,MIDDLE:Er.DOLLY,RIGHT:Er.PAN}),Ie(this,"touches",{ONE:Ln.ROTATE,TWO:Ln.DOLLY_PAN}),Ie(this,"target0"),Ie(this,"position0"),Ie(this,"zoom0"),Ie(this,"_domElementKeyEvents",null),Ie(this,"getPolarAngle"),Ie(this,"getAzimuthalAngle"),Ie(this,"setPolarAngle"),Ie(this,"setAzimuthalAngle"),Ie(this,"getDistance"),Ie(this,"listenToKeyEvents"),Ie(this,"stopListenToKeyEvents"),Ie(this,"saveState"),Ie(this,"reset"),Ie(this,"update"),Ie(this,"connect"),Ie(this,"dispose"),this.object=e,this.domElement=t,this.target0=this.target.clone(),this.position0=this.object.position.clone(),this.zoom0=this.object.zoom,this.getPolarAngle=()=>c.phi,this.getAzimuthalAngle=()=>c.theta,this.setPolarAngle=U=>{let q=nh(U,2*Math.PI),ve=c.phi;ve<0&&(ve+=2*Math.PI),q<0&&(q+=2*Math.PI);let we=Math.abs(q-ve);2*Math.PI-we{let q=nh(U,2*Math.PI),ve=c.theta;ve<0&&(ve+=2*Math.PI),q<0&&(q+=2*Math.PI);let we=Math.abs(q-ve);2*Math.PI-wen.object.position.distanceTo(n.target),this.listenToKeyEvents=U=>{U.addEventListener("keydown",ce),this._domElementKeyEvents=U},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ce),this._domElementKeyEvents=null},this.saveState=()=>{n.target0.copy(n.target),n.position0.copy(n.object.position),n.zoom0=n.object.zoom},this.reset=()=>{n.target.copy(n.target0),n.object.position.copy(n.position0),n.object.zoom=n.zoom0,n.object.updateProjectionMatrix(),n.dispatchEvent(i),n.update(),l=a.NONE},this.update=(()=>{const U=new Fe,q=new Fe(0,1,0),ve=new Co().setFromUnitVectors(e.up,q),we=ve.clone().invert(),Ne=new Fe,Ee=new Co,Ct=2*Math.PI;return function(){const At=n.object.position;ve.setFromUnitVectors(e.up,q),we.copy(ve).invert(),U.copy(At).sub(n.target),U.applyQuaternion(ve),c.setFromVector3(U),n.autoRotate&&l===a.NONE&&w(S()),n.enableDamping?(c.theta+=f.theta*n.dampingFactor,c.phi+=f.phi*n.dampingFactor):(c.theta+=f.theta,c.phi+=f.phi);let We=n.minAzimuthAngle,xt=n.maxAzimuthAngle;isFinite(We)&&isFinite(xt)&&(We<-Math.PI?We+=Ct:We>Math.PI&&(We-=Ct),xt<-Math.PI?xt+=Ct:xt>Math.PI&&(xt-=Ct),We<=xt?c.theta=Math.max(We,Math.min(xt,c.theta)):c.theta=c.theta>(We+xt)/2?Math.max(We,c.theta):Math.min(xt,c.theta)),c.phi=Math.max(n.minPolarAngle,Math.min(n.maxPolarAngle,c.phi)),c.makeSafe(),n.enableDamping===!0?n.target.addScaledVector(h,n.dampingFactor):n.target.add(h),n.zoomToCursor&&M||n.object.isOrthographicCamera?c.radius=j(c.radius):c.radius=j(c.radius*p),U.setFromSpherical(c),U.applyQuaternion(we),At.copy(n.target).add(U),n.object.matrixAutoUpdate||n.object.updateMatrix(),n.object.lookAt(n.target),n.enableDamping===!0?(f.theta*=1-n.dampingFactor,f.phi*=1-n.dampingFactor,h.multiplyScalar(1-n.dampingFactor)):(f.set(0,0,0),h.set(0,0,0));let gn=!1;if(n.zoomToCursor&&M){let $t=null;if(n.object instanceof Tn&&n.object.isPerspectiveCamera){const wt=U.length();$t=j(wt*p);const Xn=wt-$t;n.object.position.addScaledVector(E,Xn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const wt=new Fe(A.x,A.y,0);wt.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/p)),n.object.updateProjectionMatrix(),gn=!0;const Xn=new Fe(A.x,A.y,0);Xn.unproject(n.object),n.object.position.sub(Xn).add(wt),n.object.updateMatrixWorld(),$t=U.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;$t!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar($t).add(n.object.position):(to.origin.copy(n.object.position),to.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(to.direction))<_w?e.lookAt(n.target):(th.setFromNormalAndCoplanarPoint(n.object.up,n.target),to.intersectPlane(th,n.target))))}else n.object instanceof lr&&n.object.isOrthographicCamera&&(gn=p!==1,gn&&(n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/p)),n.object.updateProjectionMatrix()));return p=1,M=!1,gn||Ne.distanceToSquared(n.object.position)>u||8*(1-Ee.dot(n.object.quaternion))>u?(n.dispatchEvent(i),Ne.copy(n.object.position),Ee.copy(n.object.quaternion),gn=!1,!0):!1}})(),this.connect=U=>{n.domElement=U,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Ae),n.domElement.addEventListener("pointerdown",ae),n.domElement.addEventListener("pointercancel",fe),n.domElement.addEventListener("wheel",re)},this.dispose=()=>{var U,q,ve,we,Ne,Ee;n.domElement&&(n.domElement.style.touchAction="auto"),(U=n.domElement)==null||U.removeEventListener("contextmenu",Ae),(q=n.domElement)==null||q.removeEventListener("pointerdown",ae),(ve=n.domElement)==null||ve.removeEventListener("pointercancel",fe),(we=n.domElement)==null||we.removeEventListener("wheel",re),(Ne=n.domElement)==null||Ne.ownerDocument.removeEventListener("pointermove",te),(Ee=n.domElement)==null||Ee.ownerDocument.removeEventListener("pointerup",fe),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",ce)};const n=this,i={type:"change"},o={type:"start"},s={type:"end"},a={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let l=a.NONE;const u=1e-6,c=new cc,f=new cc;let p=1;const h=new Fe,g=new bt,v=new bt,d=new bt,m=new bt,y=new bt,_=new bt,C=new bt,x=new bt,b=new bt,E=new Fe,A=new bt;let M=!1;const I=[],F={};function S(){return 2*Math.PI/60/60*n.autoRotateSpeed}function X(){return Math.pow(.95,n.zoomSpeed)}function w(U){n.reverseOrbit||n.reverseHorizontalOrbit?f.theta+=U:f.theta-=U}function G(U){n.reverseOrbit||n.reverseVerticalOrbit?f.phi+=U:f.phi-=U}const R=(()=>{const U=new Fe;return function(q,ve){U.setFromMatrixColumn(ve,0),U.multiplyScalar(-q),h.add(U)}})(),L=(()=>{const U=new Fe;return function(q,ve){n.screenSpacePanning===!0?U.setFromMatrixColumn(ve,1):(U.setFromMatrixColumn(ve,0),U.crossVectors(n.object.up,U)),U.multiplyScalar(q),h.add(U)}})(),N=(()=>{const U=new Fe;return function(q,ve){const we=n.domElement;if(we&&n.object instanceof Tn&&n.object.isPerspectiveCamera){const Ne=n.object.position;U.copy(Ne).sub(n.target);let Ee=U.length();Ee*=Math.tan(n.object.fov/2*Math.PI/180),R(2*q*Ee/we.clientHeight,n.object.matrix),L(2*ve*Ee/we.clientHeight,n.object.matrix)}else we&&n.object instanceof lr&&n.object.isOrthographicCamera?(R(q*(n.object.right-n.object.left)/n.object.zoom/we.clientWidth,n.object.matrix),L(ve*(n.object.top-n.object.bottom)/n.object.zoom/we.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function $(U){n.object instanceof Tn&&n.object.isPerspectiveCamera||n.object instanceof lr&&n.object.isOrthographicCamera?p/=U:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function P(U){n.object instanceof Tn&&n.object.isPerspectiveCamera||n.object instanceof lr&&n.object.isOrthographicCamera?p*=U:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function D(U){if(!n.zoomToCursor||!n.domElement)return;M=!0;const q=n.domElement.getBoundingClientRect(),ve=U.clientX-q.left,we=U.clientY-q.top,Ne=q.width,Ee=q.height;A.x=ve/Ne*2-1,A.y=-(we/Ee)*2+1,E.set(A.x,A.y,1).unproject(n.object).sub(n.object.position).normalize()}function j(U){return Math.max(n.minDistance,Math.min(n.maxDistance,U))}function k(U){g.set(U.clientX,U.clientY)}function ee(U){D(U),C.set(U.clientX,U.clientY)}function Q(U){m.set(U.clientX,U.clientY)}function ue(U){v.set(U.clientX,U.clientY),d.subVectors(v,g).multiplyScalar(n.rotateSpeed);const q=n.domElement;q&&(w(2*Math.PI*d.x/q.clientHeight),G(2*Math.PI*d.y/q.clientHeight)),g.copy(v),n.update()}function de(U){x.set(U.clientX,U.clientY),b.subVectors(x,C),b.y>0?$(X()):b.y<0&&P(X()),C.copy(x),n.update()}function ne(U){y.set(U.clientX,U.clientY),_.subVectors(y,m).multiplyScalar(n.panSpeed),N(_.x,_.y),m.copy(y),n.update()}function O(U){D(U),U.deltaY<0?P(X()):U.deltaY>0&&$(X()),n.update()}function B(U){let q=!1;switch(U.code){case n.keys.UP:N(0,n.keyPanSpeed),q=!0;break;case n.keys.BOTTOM:N(0,-n.keyPanSpeed),q=!0;break;case n.keys.LEFT:N(n.keyPanSpeed,0),q=!0;break;case n.keys.RIGHT:N(-n.keyPanSpeed,0),q=!0;break}q&&(U.preventDefault(),n.update())}function W(){if(I.length==1)g.set(I[0].pageX,I[0].pageY);else{const U=.5*(I[0].pageX+I[1].pageX),q=.5*(I[0].pageY+I[1].pageY);g.set(U,q)}}function oe(){if(I.length==1)m.set(I[0].pageX,I[0].pageY);else{const U=.5*(I[0].pageX+I[1].pageX),q=.5*(I[0].pageY+I[1].pageY);m.set(U,q)}}function ie(){const U=I[0].pageX-I[1].pageX,q=I[0].pageY-I[1].pageY,ve=Math.sqrt(U*U+q*q);C.set(0,ve)}function T(){n.enableZoom&&ie(),n.enablePan&&oe()}function J(){n.enableZoom&&ie(),n.enableRotate&&W()}function H(U){if(I.length==1)v.set(U.pageX,U.pageY);else{const ve=ft(U),we=.5*(U.pageX+ve.x),Ne=.5*(U.pageY+ve.y);v.set(we,Ne)}d.subVectors(v,g).multiplyScalar(n.rotateSpeed);const q=n.domElement;q&&(w(2*Math.PI*d.x/q.clientHeight),G(2*Math.PI*d.y/q.clientHeight)),g.copy(v)}function z(U){if(I.length==1)y.set(U.pageX,U.pageY);else{const q=ft(U),ve=.5*(U.pageX+q.x),we=.5*(U.pageY+q.y);y.set(ve,we)}_.subVectors(y,m).multiplyScalar(n.panSpeed),N(_.x,_.y),m.copy(y)}function V(U){const q=ft(U),ve=U.pageX-q.x,we=U.pageY-q.y,Ne=Math.sqrt(ve*ve+we*we);x.set(0,Ne),b.set(0,Math.pow(x.y/C.y,n.zoomSpeed)),$(b.y),C.copy(x)}function Z(U){n.enableZoom&&V(U),n.enablePan&&z(U)}function se(U){n.enableZoom&&V(U),n.enableRotate&&H(U)}function ae(U){var q,ve;n.enabled!==!1&&(I.length===0&&((q=n.domElement)==null||q.ownerDocument.addEventListener("pointermove",te),(ve=n.domElement)==null||ve.ownerDocument.addEventListener("pointerup",fe)),Xe(U),U.pointerType==="touch"?me(U):ye(U))}function te(U){n.enabled!==!1&&(U.pointerType==="touch"?xe(U):pe(U))}function fe(U){var q,ve,we;tt(U),I.length===0&&((q=n.domElement)==null||q.releasePointerCapture(U.pointerId),(ve=n.domElement)==null||ve.ownerDocument.removeEventListener("pointermove",te),(we=n.domElement)==null||we.ownerDocument.removeEventListener("pointerup",fe)),n.dispatchEvent(s),l=a.NONE}function ye(U){let q;switch(U.button){case 0:q=n.mouseButtons.LEFT;break;case 1:q=n.mouseButtons.MIDDLE;break;case 2:q=n.mouseButtons.RIGHT;break;default:q=-1}switch(q){case Er.DOLLY:if(n.enableZoom===!1)return;ee(U),l=a.DOLLY;break;case Er.ROTATE:if(U.ctrlKey||U.metaKey||U.shiftKey){if(n.enablePan===!1)return;Q(U),l=a.PAN}else{if(n.enableRotate===!1)return;k(U),l=a.ROTATE}break;case Er.PAN:if(U.ctrlKey||U.metaKey||U.shiftKey){if(n.enableRotate===!1)return;k(U),l=a.ROTATE}else{if(n.enablePan===!1)return;Q(U),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(o)}function pe(U){if(n.enabled!==!1)switch(l){case a.ROTATE:if(n.enableRotate===!1)return;ue(U);break;case a.DOLLY:if(n.enableZoom===!1)return;de(U);break;case a.PAN:if(n.enablePan===!1)return;ne(U);break}}function re(U){n.enabled===!1||n.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(U.preventDefault(),n.dispatchEvent(o),O(U),n.dispatchEvent(s))}function ce(U){n.enabled===!1||n.enablePan===!1||B(U)}function me(U){switch(Oe(U),I.length){case 1:switch(n.touches.ONE){case Ln.ROTATE:if(n.enableRotate===!1)return;W(),l=a.TOUCH_ROTATE;break;case Ln.PAN:if(n.enablePan===!1)return;oe(),l=a.TOUCH_PAN;break;default:l=a.NONE}break;case 2:switch(n.touches.TWO){case Ln.DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;T(),l=a.TOUCH_DOLLY_PAN;break;case Ln.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;J(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(o)}function xe(U){switch(Oe(U),l){case a.TOUCH_ROTATE:if(n.enableRotate===!1)return;H(U),n.update();break;case a.TOUCH_PAN:if(n.enablePan===!1)return;z(U),n.update();break;case a.TOUCH_DOLLY_PAN:if(n.enableZoom===!1&&n.enablePan===!1)return;Z(U),n.update();break;case a.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;se(U),n.update();break;default:l=a.NONE}}function Ae(U){n.enabled!==!1&&U.preventDefault()}function Xe(U){I.push(U)}function tt(U){delete F[U.pointerId];for(let q=0;qe in r?bw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ku=(r,e,t)=>(ww(r,typeof e!="symbol"?e+"":e,t),t);class kp{constructor(e){ku(this,"data"),this.data=e}generateShapes(e,t=100,n){const i=[],o={letterSpacing:0,lineHeight:1,...n},s=Tw(e,t,this.data,o);for(let a=0,l=s.length;a[0,0,0]},enableDamping:{type:Boolean,default:!0},dampingFactor:{default:.05},autoRotate:{type:Boolean,default:!1},autoRotateSpeed:{default:2},enablePan:{type:Boolean,default:!0},keyPanSpeed:{default:7},keys:{},maxAzimuthAngle:{default:Number.POSITIVE_INFINITY},minAzimuthAngle:{default:Number.NEGATIVE_INFINITY},maxPolarAngle:{default:Math.PI},minPolarAngle:{default:0},minDistance:{default:0},maxDistance:{default:Number.POSITIVE_INFINITY},minZoom:{default:0},maxZoom:{default:Number.POSITIVE_INFINITY},touches:{default:()=>({ONE:Ln.ROTATE,TWO:Ln.DOLLY_PAN})},enableZoom:{type:Boolean,default:!0},zoomSpeed:{default:1},enableRotate:{type:Boolean,default:!0},rotateSpeed:{default:1}},emits:["change","start","end"],setup(r,{expose:e,emit:t}){const n=r,i=t,{makeDefault:o,autoRotate:s,autoRotateSpeed:a,enableDamping:l,dampingFactor:u,enablePan:c,keyPanSpeed:f,maxAzimuthAngle:p,minAzimuthAngle:h,maxPolarAngle:g,minPolarAngle:v,minDistance:d,maxDistance:m,minZoom:y,maxZoom:_,enableZoom:C,zoomSpeed:x,enableRotate:b,touches:E,rotateSpeed:A,target:M}=Yr(n),{camera:I,renderer:F,extend:S,controls:X,invalidate:w}=Ti(),G=le(null);S({OrbitControls:xw}),Ge(G,N=>{R(),N&&o.value?X.value=N:X.value=null});function R(){ma(G.value,"change",()=>{i("change",G.value),w()}),ma(G.value,"start",()=>i("start",G.value)),ma(G.value,"end",()=>i("end",G.value))}const{onBeforeRender:L}=ru();return L(({invalidate:N})=>{G.value&&(l.value||s.value)&&(G.value.update(),s.value&&N())}),Gt(()=>{G.value&&G.value.dispose()}),e({instance:G}),(N,$)=>(N.camera||K(I))&&(N.domElement||K(F))?(he(),_e("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:G,target:K(M),"auto-rotate":K(s),"auto-rotate-speed":K(a),"enable-damping":K(l),"damping-factor":K(u),"enable-pan":K(c),"key-pan-speed":K(f),keys:N.keys,"max-azimuth-angle":K(p),"min-azimuth-angle":K(h),"max-polar-angle":K(g),"min-polar-angle":K(v),"min-distance":K(d),"max-distance":K(m),"min-zoom":K(y),"max-zoom":K(_),touches:K(E),"enable-zoom":K(C),"zoom-speed":K(x),"enable-rotate":K(b),"rotate-speed":K(A),args:[N.camera||K(I),N.domElement||K(F).domElement]},null,8,Cw)):nt("",!0)}});new Sn;var Iw=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function no(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Pw={exports:{}};(function(r,e){(function(t){r.exports=t()})(function(){return function t(n,i,o){function s(u,c){if(!i[u]){if(!n[u]){var f=typeof no=="function"&&no;if(!c&&f)return f(u,!0);if(a)return a(u,!0);throw new Error("Cannot find module '"+u+"'")}c=i[u]={exports:{}},n[u][0].call(c.exports,function(p){var h=n[u][1][p];return s(h||p)},c,c.exports,t,n,i,o)}return i[u].exports}for(var a=typeof no=="function"&&no,l=0;l>16),G((65280&I)>>8),G(255&I);return F==2?G(255&(I=E(A.charAt(M))<<2|E(A.charAt(M+1))>>4)):F==1&&(G((I=E(A.charAt(M))<<10|E(A.charAt(M+1))<<4|E(A.charAt(M+2))>>2)>>8&255),G(255&I)),S},g.fromByteArray=function(A){var M,I,F,S,X=A.length%3,w="";function G(R){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(R)}for(M=0,F=A.length-X;M>18&63)+G(S>>12&63)+G(S>>6&63)+G(63&S);switch(X){case 1:w=(w+=G((I=A[A.length-1])>>2))+G(I<<4&63)+"==";break;case 2:w=(w=(w+=G((I=(A[A.length-2]<<8)+A[A.length-1])>>10))+G(I>>4&63))+G(I<<2&63)+"="}return w}})(i===void 0?this.base64js={}:i)}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(t,n,i){(function(o,s,d,l,u,c,f,p,h){var g=t("base64-js"),v=t("ieee754");function d(O,B,W){if(!(this instanceof d))return new d(O,B,W);var oe,ie,T,J,H=typeof O;if(B==="base64"&&H=="string")for(O=(J=O).trim?J.trim():J.replace(/^\s+|\s+$/g,"");O.length%4!=0;)O+="=";if(H=="number")oe=N(O);else if(H=="string")oe=d.byteLength(O,B);else{if(H!="object")throw new Error("First argument needs to be a number, array or string.");oe=N(O.length)}if(d._useTypedArrays?ie=d._augment(new Uint8Array(oe)):((ie=this).length=oe,ie._isBuffer=!0),d._useTypedArrays&&typeof O.byteLength=="number")ie._set(O);else if($(J=O)||d.isBuffer(J)||J&&typeof J=="object"&&typeof J.length=="number")for(T=0;T>8,J=J%256,H.push(J),H.push(T);return H}(B),O,W,oe)}function _(O,B,W){var oe="";W=Math.min(O.length,W);for(var ie=B;ie>>0)):(B+1>>0),ie}function b(O,B,W,oe){if(oe||(ne(typeof W=="boolean","missing or invalid endian"),ne(B!=null,"missing offset"),ne(B+1>>8*(oe?T:1-T)}function F(O,B,W,oe,ie){if(ie||(ne(B!=null,"missing value"),ne(typeof oe=="boolean","missing or invalid endian"),ne(W!=null,"missing offset"),ne(W+3>>8*(oe?T:3-T)&255}function S(O,B,W,oe,ie){ie||(ne(B!=null,"missing value"),ne(typeof oe=="boolean","missing or invalid endian"),ne(W!=null,"missing offset"),ne(W+1this.length&&(oe=this.length);var ie=(oe=O.length-B=this.length))return this[O]},d.prototype.readUInt16LE=function(O,B){return C(this,O,!0,B)},d.prototype.readUInt16BE=function(O,B){return C(this,O,!1,B)},d.prototype.readUInt32LE=function(O,B){return x(this,O,!0,B)},d.prototype.readUInt32BE=function(O,B){return x(this,O,!1,B)},d.prototype.readInt8=function(O,B){if(B||(ne(O!=null,"missing offset"),ne(O=this.length))return 128&this[O]?-1*(255-this[O]+1):this[O]},d.prototype.readInt16LE=function(O,B){return b(this,O,!0,B)},d.prototype.readInt16BE=function(O,B){return b(this,O,!1,B)},d.prototype.readInt32LE=function(O,B){return E(this,O,!0,B)},d.prototype.readInt32BE=function(O,B){return E(this,O,!1,B)},d.prototype.readFloatLE=function(O,B){return A(this,O,!0,B)},d.prototype.readFloatBE=function(O,B){return A(this,O,!1,B)},d.prototype.readDoubleLE=function(O,B){return M(this,O,!0,B)},d.prototype.readDoubleBE=function(O,B){return M(this,O,!1,B)},d.prototype.writeUInt8=function(O,B,W){W||(ne(O!=null,"missing value"),ne(B!=null,"missing offset"),ne(B=this.length||(this[B]=O)},d.prototype.writeUInt16LE=function(O,B,W){I(this,O,B,!0,W)},d.prototype.writeUInt16BE=function(O,B,W){I(this,O,B,!1,W)},d.prototype.writeUInt32LE=function(O,B,W){F(this,O,B,!0,W)},d.prototype.writeUInt32BE=function(O,B,W){F(this,O,B,!1,W)},d.prototype.writeInt8=function(O,B,W){W||(ne(O!=null,"missing value"),ne(B!=null,"missing offset"),ne(B=this.length||(0<=O?this.writeUInt8(O,B,W):this.writeUInt8(255+O+1,B,W))},d.prototype.writeInt16LE=function(O,B,W){S(this,O,B,!0,W)},d.prototype.writeInt16BE=function(O,B,W){S(this,O,B,!1,W)},d.prototype.writeInt32LE=function(O,B,W){X(this,O,B,!0,W)},d.prototype.writeInt32BE=function(O,B,W){X(this,O,B,!1,W)},d.prototype.writeFloatLE=function(O,B,W){w(this,O,B,!0,W)},d.prototype.writeFloatBE=function(O,B,W){w(this,O,B,!1,W)},d.prototype.writeDoubleLE=function(O,B,W){G(this,O,B,!0,W)},d.prototype.writeDoubleBE=function(O,B,W){G(this,O,B,!1,W)},d.prototype.fill=function(O,B,W){if(B=B||0,W=W||this.length,ne(typeof(O=typeof(O=O||0)=="string"?O.charCodeAt(0):O)=="number"&&!isNaN(O),"value is not a number"),ne(B<=W,"end < start"),W!==B&&this.length!==0){ne(0<=B&&B"},d.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(d._useTypedArrays)return new d(this).buffer;for(var O=new Uint8Array(this.length),B=0,W=O.length;B=B.length||ie>=O.length);ie++)B[ie+W]=O[ie];return ie}function ee(O){try{return decodeURIComponent(O)}catch{return"�"}}function Q(O,B){ne(typeof O=="number","cannot write a non-number as a number"),ne(0<=O,"specified a negative value for writing an unsigned value"),ne(O<=B,"value is larger than maximum value for type"),ne(Math.floor(O)===O,"value has a fractional component")}function ue(O,B,W){ne(typeof O=="number","cannot write a non-number as a number"),ne(O<=B,"value larger than maximum allowed value"),ne(W<=O,"value smaller than minimum allowed value"),ne(Math.floor(O)===O,"value has a fractional component")}function de(O,B,W){ne(typeof O=="number","cannot write a non-number as a number"),ne(O<=B,"value larger than maximum allowed value"),ne(W<=O,"value smaller than minimum allowed value")}function ne(O,B){if(!O)throw new Error(B||"Failed assertion")}d._augment=function(O){return O._isBuffer=!0,O._get=O.get,O._set=O.set,O.get=R.get,O.set=R.set,O.write=R.write,O.toString=R.toString,O.toLocaleString=R.toString,O.toJSON=R.toJSON,O.copy=R.copy,O.slice=R.slice,O.readUInt8=R.readUInt8,O.readUInt16LE=R.readUInt16LE,O.readUInt16BE=R.readUInt16BE,O.readUInt32LE=R.readUInt32LE,O.readUInt32BE=R.readUInt32BE,O.readInt8=R.readInt8,O.readInt16LE=R.readInt16LE,O.readInt16BE=R.readInt16BE,O.readInt32LE=R.readInt32LE,O.readInt32BE=R.readInt32BE,O.readFloatLE=R.readFloatLE,O.readFloatBE=R.readFloatBE,O.readDoubleLE=R.readDoubleLE,O.readDoubleBE=R.readDoubleBE,O.writeUInt8=R.writeUInt8,O.writeUInt16LE=R.writeUInt16LE,O.writeUInt16BE=R.writeUInt16BE,O.writeUInt32LE=R.writeUInt32LE,O.writeUInt32BE=R.writeUInt32BE,O.writeInt8=R.writeInt8,O.writeInt16LE=R.writeInt16LE,O.writeInt16BE=R.writeInt16BE,O.writeInt32LE=R.writeInt32LE,O.writeInt32BE=R.writeInt32BE,O.writeFloatLE=R.writeFloatLE,O.writeFloatBE=R.writeFloatBE,O.writeDoubleLE=R.writeDoubleLE,O.writeDoubleBE=R.writeDoubleBE,O.fill=R.fill,O.inspect=R.inspect,O.toArrayBuffer=R.toArrayBuffer,O}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(t,n,i){(function(o,s,g,l,u,c,f,p,h){var g=t("buffer").Buffer,v=4,d=new g(v);d.fill(0),n.exports={hash:function(m,y,_,C){for(var x=y(function(I,F){I.length%v!=0&&(S=I.length+(v-I.length%v),I=g.concat([I,d],S));for(var S,X=[],w=F?I.readInt32BE:I.readInt32LE,G=0;G_?L=R(L):L.length<_&&(L=g.concat([L,C],_));for(var $=new g(_),P=new g(_),D=0;D<_;D++)$[D]=54^L[D],P[D]=92^L[D];return N=R(g.concat([$,N])),R(g.concat([P,N]))}(S,F,G):S(G);return X=null,w?G.toString(w):G}}}function b(){var I=[].slice.call(arguments).join(" ");throw new Error([I,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(` +`))}C.fill(0),i.createHash=function(I){return x(I)},i.createHmac=x,i.randomBytes=function(I,F){if(!F||!F.call)return new g(m(I));try{F.call(this,void 0,new g(m(I)))}catch(S){F(S)}};var E,A=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],M=function(I){i[I]=function(){b("sorry,",I,"is not implemented yet")}};for(E in A)M(A[E])}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(t,n,i){(function(o,s,a,l,u,c,f,p,h){var g=t("./helpers");function v(b,E){b[E>>5]|=128<>>9<<4)]=E;for(var A=1732584193,M=-271733879,I=-1732584194,F=271733878,S=0;S>>32-I,A)}function m(b,E,A,M,I,F,S){return d(E&A|~E&M,b,E,I,F,S)}function y(b,E,A,M,I,F,S){return d(E&M|A&~M,b,E,I,F,S)}function _(b,E,A,M,I,F,S){return d(E^A^M,b,E,I,F,S)}function C(b,E,A,M,I,F,S){return d(A^(E|~M),b,E,I,F,S)}function x(b,E){var A=(65535&b)+(65535&E);return(b>>16)+(E>>16)+(A>>16)<<16|65535&A}n.exports=function(b){return g.hash(b,v,16)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(t,n,i){(function(o,s,a,l,u,c,f,p,h){n.exports=function(g){for(var v,d=new Array(g),m=0;m>>((3&m)<<3)&255;return d}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(t,n,i){(function(o,s,a,l,u,c,f,p,h){var g=t("./helpers");function v(y,_){y[_>>5]|=128<<24-_%32,y[15+(_+64>>9<<4)]=_;for(var C,x,b,E=Array(80),A=1732584193,M=-271733879,I=-1732584194,F=271733878,S=-1009589776,X=0;X>16)+(_>>16)+(C>>16)<<16|65535&C}function m(y,_){return y<<_|y>>>32-_}n.exports=function(y){return g.hash(y,v,20,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(t,n,i){(function(o,s,a,l,u,c,f,p,h){function g(_,C){var x=(65535&_)+(65535&C);return(_>>16)+(C>>16)+(x>>16)<<16|65535&x}function v(_,C){var x,b=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),E=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),A=new Array(64);_[C>>5]|=128<<24-C%32,_[15+(C+64>>9<<4)]=C;for(var M,I,F=0;F<_.length;F+=16){for(var S=E[0],X=E[1],w=E[2],G=E[3],R=E[4],L=E[5],N=E[6],$=E[7],P=0;P<64;P++)A[P]=P<16?_[P+F]:g(g(g((I=A[P-2],m(I,17)^m(I,19)^y(I,10)),A[P-7]),(I=A[P-15],m(I,7)^m(I,18)^y(I,3))),A[P-16]),x=g(g(g(g($,m(I=R,6)^m(I,11)^m(I,25)),R&L^~R&N),b[P]),A[P]),M=g(m(M=S,2)^m(M,13)^m(M,22),S&X^S&w^X&w),$=N,N=L,L=R,R=g(G,x),G=w,w=X,X=S,S=g(x,M);E[0]=g(S,E[0]),E[1]=g(X,E[1]),E[2]=g(w,E[2]),E[3]=g(G,E[3]),E[4]=g(R,E[4]),E[5]=g(L,E[5]),E[6]=g(N,E[6]),E[7]=g($,E[7])}return E}var d=t("./helpers"),m=function(_,C){return _>>>C|_<<32-C},y=function(_,C){return _>>>C};n.exports=function(_){return d.hash(_,v,32,!0)}}).call(this,t("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(t,n,i){(function(o,s,a,l,u,c,f,p,h){i.read=function(g,v,d,m,F){var _,C,x=8*F-m-1,b=(1<>1,A=-7,M=d?F-1:0,I=d?-1:1,F=g[v+M];for(M+=I,_=F&(1<<-A)-1,F>>=-A,A+=x;0>=-A,A+=m;0>1,M=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=m?0:S-1,F=m?1:-1,S=v<0||v===0&&1/v<0?1:0;for(v=Math.abs(v),isNaN(v)||v===1/0?(x=isNaN(v)?1:0,C=E):(C=Math.floor(Math.log(v)/Math.LN2),v*(m=Math.pow(2,-C))<1&&(C--,m*=2),2<=(v+=1<=C+A?M/m:M*Math.pow(2,1-A))*m&&(C++,m/=2),E<=C+A?(x=0,C=E):1<=C+A?(x=(v*m-1)*Math.pow(2,y),C+=A):(x=v*Math.pow(2,A-1)*Math.pow(2,y),C=0));8<=y;g[d+I]=255&x,I+=F,x/=256,y-=8);for(C=C<":` + vec3 objectNormal = `.concat(Me.normal,`; + #ifdef USE_TANGENT + vec3 objectTangent = vec3( tangent.xyz ); + #endif + `)}),qe(Pt,"".concat(Me.position),{"#include ":` + vec3 transformed = `.concat(Me.position,`; + `)}),qe(Pt,"".concat(Me.positionRaw),{"#include ":` + vec4 csm_internal_positionUnprojected = `.concat(Me.positionRaw,`; + mat4x4 csm_internal_unprojectMatrix = projectionMatrix * modelViewMatrix; + #ifdef USE_INSTANCING + csm_internal_unprojectMatrix = csm_internal_unprojectMatrix * instanceMatrix; + #endif + csm_internal_positionUnprojected = inverse(csm_internal_unprojectMatrix) * csm_internal_positionUnprojected; + vec3 transformed = csm_internal_positionUnprojected.xyz; + `)}),qe(Pt,"".concat(Me.pointSize),{"gl_PointSize = size;":` + gl_PointSize = `.concat(Me.pointSize,`; + `)}),qe(Pt,"".concat(Me.diffuseColor),{"#include ":` + #include + diffuseColor = `.concat(Me.diffuseColor,`; + `)}),qe(Pt,"".concat(Me.fragColor),{"#include ":` + #include + gl_FragColor = `.concat(Me.fragColor,`; + `)}),qe(Pt,"".concat(Me.emissive),{"vec3 totalEmissiveRadiance = emissive;":` + vec3 totalEmissiveRadiance = `.concat(Me.emissive,`; + `)}),qe(Pt,"".concat(Me.roughness),{"#include ":` + #include + roughnessFactor = `.concat(Me.roughness,`; + `)}),qe(Pt,"".concat(Me.metalness),{"#include ":` + #include + metalnessFactor = `.concat(Me.metalness,`; + `)}),qe(Pt,"".concat(Me.ao),{"#include ":` + #include + reflectedLight.indirectDiffuse *= 1. - `.concat(Me.ao,`; + `)}),qe(Pt,"".concat(Me.bump),{"#include ":` + #include + + vec3 csm_internal_orthogonal = `.concat(Me.bump," - (dot(").concat(Me.bump,`, normal) * normal); + vec3 csm_internal_projectedbump = mat3(csm_internal_vModelViewMatrix) * csm_internal_orthogonal; + normal = normalize(normal - csm_internal_projectedbump); + `)}),qe(Pt,"".concat(Me.depthAlpha),{"gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );":` + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity * `.concat(Me.depthAlpha,` ); + `),"gl_FragColor = packDepthToRGBA( fragCoordZ );":` + gl_FragColor = packDepthToRGBA( fragCoordZ ); + gl_FragColor.a *= `.concat(Me.depthAlpha,`; + `)});Mr={},qe(Mr,"".concat(Me.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = projectionMatrix * modelViewMatrix * vec4( `.concat(Me.position,`, 1.0 ); + `)}),qe(Mr,"".concat(Me.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = `.concat(Me.position,`; + `)}),qe(Mr,"".concat(Me.diffuseColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(Me.diffuseColor,`; + `)}),qe(Mr,"".concat(Me.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(Me.fragColor,`; + `)});var Mt;Mt={},qe(Mt,"".concat(Me.position),"*"),qe(Mt,"".concat(Me.positionRaw),"*"),qe(Mt,"".concat(Me.normal),"*"),qe(Mt,"".concat(Me.pointSize),["PointsMaterial"]),qe(Mt,"".concat(Me.diffuseColor),"*"),qe(Mt,"".concat(Me.fragColor),"*"),qe(Mt,"".concat(Me.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),qe(Mt,"".concat(Me.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),qe(Mt,"".concat(Me.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),qe(Mt,"".concat(Me.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),qe(Mt,"".concat(Me.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),qe(Mt,"".concat(Me.depthAlpha),"*");var Rw=`void main() { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); +}`,Fw=`#include + +void main() { + vec2 center = vec2(0., 1.); + float rotation = 0.0; + + + + float size = 0.03; + + vec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 ); + vec2 scale; + scale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) ); + scale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) ); + + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale * size; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + + gl_Position = projectionMatrix * mvPosition; +}`;const Li=new Fe(0,0,0),Ou=new Fe(0,0,0),Lw=new Fe(0,0,0);function rh(r,e,t){const n=Li.setFromMatrixPosition(r.matrixWorld);n.project(e);const i=t.width/2,o=t.height/2;return[(Number.isNaN(n.x)?0:n.x)*i+i,-(n.y*o)+o]}function Nw(r,e){const t=Li.setFromMatrixPosition(r.matrixWorld),n=Ou.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),o=e.getWorldDirection(Lw);return i.angleTo(o)>Math.PI/2}function Dw(r,e,t,n){const i=Li.setFromMatrixPosition(r.matrixWorld),o=i.clone();o.project(e),t.setFromCamera(new bt(o.x,o.y),e);const s=t.intersectObjects(n,!0);if(s.length>0){const a=s[0].distance;return i.distanceTo(t.ray.origin)Math.abs(r)<1e-10?0:r;function Op(r,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=zl(e[i]*r.elements[i])+(i!==15?",":")");return t+n}const zw=(r=>e=>Op(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),jw=(r=>(e,t)=>Op(e,r(t),"translate(-50%,-50%)"))(r=>[1/r,1/r,1/r,1,-1/r,-1/r,-1/r,-1,1/r,1/r,1/r,1,1,1,1,1]),Vw=["geometry","material"];new ld;var Gw={exports:{}};(function(r,e){(function(t,n){r.exports=n()})(Iw,function(){var t=function(){function n(h){return s.appendChild(h.dom),h}function i(h){for(var g=0;gl+1e3&&(c.update(1e3*u/(h-l),100),l=h,u=0,p)){var g=performance.memory;p.update(g.usedJSHeapSize/1048576,g.jsHeapSizeLimit/1048576)}return h},update:function(){a=this.end()},domElement:s,setMode:i}};return t.Panel=function(n,i,o){var s=1/0,a=0,l=Math.round,u=l(window.devicePixelRatio||1),c=80*u,f=48*u,p=3*u,h=2*u,g=3*u,v=15*u,d=74*u,m=30*u,y=document.createElement("canvas");y.width=c,y.height=f,y.style.cssText="width:80px;height:48px";var _=y.getContext("2d");return _.font="bold "+9*u+"px Helvetica,Arial,sans-serif",_.textBaseline="top",_.fillStyle=o,_.fillRect(0,0,c,f),_.fillStyle=i,_.fillText(n,p,h),_.fillRect(g,v,d,m),_.fillStyle=o,_.globalAlpha=.9,_.fillRect(g,v,d,m),{dom:y,update:function(C,x){s=Math.min(s,C),a=Math.max(a,C),_.fillStyle=o,_.globalAlpha=1,_.fillRect(0,0,c,v),_.fillStyle=i,_.fillText(l(C)+" "+n+" ("+l(s)+"-"+l(a)+")",p,h),_.drawImage(y,g+u,v,d-u,m,g,v,d-u,m),_.fillRect(g+d-u,v,u,m),_.fillStyle=o,_.globalAlpha=.9,_.fillRect(g+d-u,v,u,l((1-C/x)*m))}}},t})})(Gw);new ou;new Fe;yo.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new bt(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};Zm.line={uniforms:nu.merge([yo.common,yo.fog,yo.line]),vertexShader:` + #include + #include + #include + #include + #include + + uniform float linewidth; + uniform vec2 resolution; + + attribute vec3 instanceStart; + attribute vec3 instanceEnd; + + attribute vec3 instanceColorStart; + attribute vec3 instanceColorEnd; + + #ifdef WORLD_UNITS + + varying vec4 worldPos; + varying vec3 worldStart; + varying vec3 worldEnd; + + #ifdef USE_DASH + + varying vec2 vUv; + + #endif + + #else + + varying vec2 vUv; + + #endif + + #ifdef USE_DASH + + uniform float dashScale; + attribute float instanceDistanceStart; + attribute float instanceDistanceEnd; + varying float vLineDistance; + + #endif + + void trimSegment( const in vec4 start, inout vec4 end ) { + + // trim end segment so it terminates between the camera plane and the near plane + + // conservative estimate of the near plane + float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column + float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column + float nearEstimate = - 0.5 * b / a; + + float alpha = ( nearEstimate - start.z ) / ( end.z - start.z ); + + end.xyz = mix( start.xyz, end.xyz, alpha ); + + } + + void main() { + + #ifdef USE_COLOR + + vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd; + + #endif + + #ifdef USE_DASH + + vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd; + vUv = uv; + + #endif + + float aspect = resolution.x / resolution.y; + + // camera space + vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 ); + vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 ); + + #ifdef WORLD_UNITS + + worldStart = start.xyz; + worldEnd = end.xyz; + + #else + + vUv = uv; + + #endif + + // special case for perspective projection, and segments that terminate either in, or behind, the camera plane + // clearly the gpu firmware has a way of addressing this issue when projecting into ndc space + // but we need to perform ndc-space calculations in the shader, so we must address this issue directly + // perhaps there is a more elegant solution -- WestLangley + + bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column + + if ( perspective ) { + + if ( start.z < 0.0 && end.z >= 0.0 ) { + + trimSegment( start, end ); + + } else if ( end.z < 0.0 && start.z >= 0.0 ) { + + trimSegment( end, start ); + + } + + } + + // clip space + vec4 clipStart = projectionMatrix * start; + vec4 clipEnd = projectionMatrix * end; + + // ndc space + vec3 ndcStart = clipStart.xyz / clipStart.w; + vec3 ndcEnd = clipEnd.xyz / clipEnd.w; + + // direction + vec2 dir = ndcEnd.xy - ndcStart.xy; + + // account for clip-space aspect ratio + dir.x *= aspect; + dir = normalize( dir ); + + #ifdef WORLD_UNITS + + vec3 worldDir = normalize( end.xyz - start.xyz ); + vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) ); + vec3 worldUp = normalize( cross( worldDir, tmpFwd ) ); + vec3 worldFwd = cross( worldDir, worldUp ); + worldPos = position.y < 0.5 ? start: end; + + // height offset + float hw = linewidth * 0.5; + worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp; + + // don't extend the line if we're rendering dashes because we + // won't be rendering the endcaps + #ifndef USE_DASH + + // cap extension + worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir; + + // add width to the box + worldPos.xyz += worldFwd * hw; + + // endcaps + if ( position.y > 1.0 || position.y < 0.0 ) { + + worldPos.xyz -= worldFwd * 2.0 * hw; + + } + + #endif + + // project the worldpos + vec4 clip = projectionMatrix * worldPos; + + // shift the depth of the projected points so the line + // segments overlap neatly + vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd; + clip.z = clipPose.z * clip.w; + + #else + + vec2 offset = vec2( dir.y, - dir.x ); + // undo aspect ratio adjustment + dir.x /= aspect; + offset.x /= aspect; + + // sign flip + if ( position.x < 0.0 ) offset *= - 1.0; + + // endcaps + if ( position.y < 0.0 ) { + + offset += - dir; + + } else if ( position.y > 1.0 ) { + + offset += dir; + + } + + // adjust for linewidth + offset *= linewidth; + + // adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ... + offset /= resolution.y; + + // select end + vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd; + + // back to clip space + offset *= clip.w; + + clip.xy += offset; + + #endif + + gl_Position = clip; + + vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation + + #include + #include + #include + + } + `,fragmentShader:` + uniform vec3 diffuse; + uniform float opacity; + uniform float linewidth; + + #ifdef USE_DASH + + uniform float dashOffset; + uniform float dashSize; + uniform float gapSize; + + #endif + + varying float vLineDistance; + + #ifdef WORLD_UNITS + + varying vec4 worldPos; + varying vec3 worldStart; + varying vec3 worldEnd; + + #ifdef USE_DASH + + varying vec2 vUv; + + #endif + + #else + + varying vec2 vUv; + + #endif + + #include + #include + #include + #include + #include + + vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) { + + float mua; + float mub; + + vec3 p13 = p1 - p3; + vec3 p43 = p4 - p3; + + vec3 p21 = p2 - p1; + + float d1343 = dot( p13, p43 ); + float d4321 = dot( p43, p21 ); + float d1321 = dot( p13, p21 ); + float d4343 = dot( p43, p43 ); + float d2121 = dot( p21, p21 ); + + float denom = d2121 * d4343 - d4321 * d4321; + + float numer = d1343 * d4321 - d1321 * d4343; + + mua = numer / denom; + mua = clamp( mua, 0.0, 1.0 ); + mub = ( d1343 + d4321 * ( mua ) ) / d4343; + mub = clamp( mub, 0.0, 1.0 ); + + return vec2( mua, mub ); + + } + + void main() { + + #include + + #ifdef USE_DASH + + if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps + + if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX + + #endif + + float alpha = opacity; + + #ifdef WORLD_UNITS + + // Find the closest points on the view ray and the line segment + vec3 rayEnd = normalize( worldPos.xyz ) * 1e5; + vec3 lineDir = worldEnd - worldStart; + vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd ); + + vec3 p1 = worldStart + lineDir * params.x; + vec3 p2 = rayEnd * params.y; + vec3 delta = p1 - p2; + float len = length( delta ); + float norm = len / linewidth; + + #ifndef USE_DASH + + #ifdef USE_ALPHA_TO_COVERAGE + + float dnorm = fwidth( norm ); + alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm ); + + #else + + if ( norm > 0.5 ) { + + discard; + + } + + #endif + + #endif + + #else + + #ifdef USE_ALPHA_TO_COVERAGE + + // artifacts appear on some hardware if a derivative is taken within a conditional + float a = vUv.x; + float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; + float len2 = a * a + b * b; + float dlen = fwidth( len2 ); + + if ( abs( vUv.y ) > 1.0 ) { + + alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 ); + + } + + #else + + if ( abs( vUv.y ) > 1.0 ) { + + float a = vUv.x; + float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0; + float len2 = a * a + b * b; + + if ( len2 > 1.0 ) discard; + + } + + #endif + + #endif + + vec4 diffuseColor = vec4( diffuse, alpha ); + + #include + #include + + gl_FragColor = vec4( diffuseColor.rgb, alpha ); + + #include + #include + #include + #include + + } + `};new Bn;new Fe;new Fe;new Bn;new Bn;new Bn;new Fe;new Sn;new Jm;new Fe;new ou;new cd;new Bn;const $w={key:0,args:[0,1,64]},Hw={key:1,args:[.5,1,64]},Xw={key:2},Ww=["tone-mapped","map","side","color"];new Vt(16777215);const yn="0px",Rp=De({__name:"TransitionVertical",props:{duration:{default:250},easingEnter:{default:"ease-in-out"},easingLeave:{default:"ease-in-out"},opacityClosed:{default:0},opacityOpened:{default:1}},setup(r){const e=r;function t(l){return{height:l.style.height,width:l.style.width,position:l.style.position,visibility:l.style.visibility,overflow:l.style.overflow,paddingTop:l.style.paddingTop,paddingBottom:l.style.paddingBottom,borderTopWidth:l.style.borderTopWidth,borderBottomWidth:l.style.borderBottomWidth,marginTop:l.style.marginTop,marginBottom:l.style.marginBottom}}function n(l,u){const{width:c}=getComputedStyle(l);l.style.width=c,l.style.position="absolute",l.style.visibility="hidden",l.style.height="";const{height:f}=getComputedStyle(l);return l.style.width=u.width,l.style.position=u.position,l.style.visibility=u.visibility,l.style.height=yn,l.style.overflow="hidden",u.height&&u.height!==yn?u.height:f}function i(l,u,c,f,p){const h=l.animate(f,p);l.style.height=u.height,h.onfinish=()=>{l.style.overflow=u.overflow,c()}}function o(l,u){return[{height:yn,opacity:e.opacityClosed,paddingTop:yn,paddingBottom:yn,borderTopWidth:yn,borderBottomWidth:yn,marginTop:yn,marginBottom:yn},{height:l,opacity:e.opacityOpened,paddingTop:u.paddingTop,paddingBottom:u.paddingBottom,borderTopWidth:u.borderTopWidth,borderBottomWidth:u.borderBottomWidth,marginTop:u.marginTop,marginBottom:u.marginBottom}]}function s(l,u){const c=l,f=t(c),p=n(c,f),h=o(p,f),g={duration:e.duration,easing:e.easingEnter};i(c,f,u,h,g)}function a(l,u){const c=l,f=t(c),{height:p}=getComputedStyle(c);c.style.height=p,c.style.overflow="hidden";const h=o(p,f).reverse(),g={duration:e.duration,easing:e.easingLeave};i(c,f,u,h,g)}return(l,u)=>(he(),lt(Ko,{css:!1,onEnter:s,onLeave:a},{default:Ue(()=>[ut(l.$slots,"default")]),_:3}))}}),qw={flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},Yw={op50:""},Kw={key:0,"w-full":""},ih=De({__name:"Collapsable",props:fg({default:{type:Boolean},label:null},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const e=r,t=hg(r,"modelValue");return fn(()=>{e.default!=null&&(t.value=!!e.default)}),(n,i)=>(he(),_e("div",qw,[Y("button",{sticky:"","top-0":"","z-10":"",flex:"","items-center":"","justify-between":"",px2:"",py1:"","text-sm":"","backdrop-blur-xl":"",onClick:i[0]||(i[0]=o=>t.value=!t.value)},[Y("span",null,[ut(n.$slots,"label",{},()=>[fc(be(e.label??"Collapsable"),1)])]),i[1]||(i[1]=fc()),Y("span",Yw,be(t.value?"▲":"▼"),1)]),Re(Rp,null,{default:Ue(()=>[t.value?(he(),_e("div",Kw,[ut(n.$slots,"default")])):nt("",!0)]),_:3})]))}}),kr=De({__name:"Range",props:{modelValue:null,min:{default:0},max:{default:100},step:{default:1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue","mousedown"],setup(r,{emit:e}){const t=r,n=e,i=le(null);function o(g,v,d){return Math.min(Math.max(g,v),d)}function s(g){const v=g.toString();return v.includes("e-")?Number.parseInt(v.split("e-")[1],10):v.includes(".")?v.split(".")[1].length:0}function a(g,v){const d=s(v),m=10**(d+3);return Number.parseFloat((g*m/m).toFixed(d))}const l=Ve(()=>a(o(t.modelValue,t.min,t.max),t.step)),u=Ve(()=>{const g=(l.value-t.min)/(t.max-t.min)*100;return{width:`${g}%`,backgroundSize:`${g}% 100%`}});function c(g){if(!i.value)return l.value;const v=i.value.getBoundingClientRect(),m=(g.clientX-v.left)/v.width,y=t.max-t.min,_=t.min+y*m,C=Math.round(_/t.step)*t.step;return Math.min(Math.max(C,t.min),t.max)}function f(g){if(t.disabled)return;const v=c(g);n("update:modelValue",v)}function p(g){if(t.disabled)return;g.preventDefault();const v=c(g);n("update:modelValue",v),window.addEventListener("mousemove",f),window.addEventListener("mouseup",h)}function h(g){window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",h)}return Gt(()=>{window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",h)}),(g,v)=>(he(),_e("span",{ref_key:"sliderRef",ref:i,class:Kt(["range-slider disabled:pointer-events-none disabled:cursor-default disabled:opacity-50",{disabled:r.disabled}]),bg:"[#e6e1fc] dark:[#676085]","touch-action-none":"",relative:"","inline-block":"","w-full":"","cursor-ew-resize":"","rounded-sm":"",onMousedown:p},[Y("span",{style:qr(u.value),bg:"[#cabeff] dark:[#4e34b9]",relative:"",block:"","rounded-sm":"",h:"[14px]"},null,4),Y("span",{role:"slider",class:"slider-thumb",style:qr({left:`${(l.value-r.min)/(r.max-r.min)*100}%`}),absolute:"","rounded-sm":"",w:"[1px]",h:"[14px]",bg:"zinc-100 dark:zinc-400",top:"50%",transform:"translate-x-[50%] translate-y-[-50%]"},null,4)],34))}});function oh(r,e){if(e===dg)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===Ha||e===_d){let t=r.getIndex();if(t===null){const s=[],a=r.getAttribute("position");if(a!==void 0){for(let l=0;l=2.0 are supported."));return}const u=new MT(o,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});u.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&a[f]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+f+'".')}}u.setExtensions(s),u.setPlugins(a),u.parse(n,i)}parseAsync(e,t){const n=this;return new Promise(function(i,o){n.parse(e,t,i,o)})}}function Jw(){let r={};return{get:function(e){return r[e]},add:function(e,t){r[e]=t},remove:function(e){delete r[e]},removeAll:function(){r={}}}}const ze={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Qw{constructor(e){this.parser=e,this.name=ze.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let n=0,i=t.length;n=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,o.source,s)}}class dT{constructor(e){this.parser=e,this.name=ze.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const s=o.extensions[t],a=i.images[s.source];let l=n.textureLoader;if(a.uri){const u=n.options.manager.getHandler(a.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return n.loadTextureImage(e,s.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class pT{constructor(e){this.parser=e,this.name=ze.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,n=this.parser,i=n.json,o=i.textures[e];if(!o.extensions||!o.extensions[t])return null;const s=o.extensions[t],a=i.images[s.source];let l=n.textureLoader;if(a.uri){const u=n.options.manager.getHandler(a.uri);u!==null&&(l=u)}return this.detectSupport().then(function(u){if(u)return n.loadTextureImage(e,s.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return n.loadTexture(e)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(e){const t=new Image;t.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",t.onload=t.onerror=function(){e(t.height===1)}})),this.isSupported}}class mT{constructor(e){this.name=ze.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){const i=n.extensions[this.name],o=this.parser.getDependency("buffer",i.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return o.then(function(a){const l=i.byteOffset||0,u=i.byteLength||0,c=i.count,f=i.byteStride,p=new Uint8Array(a,l,u);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(c,f,p,i.mode,i.filter).then(function(h){return h.buffer}):s.ready.then(function(){const h=new ArrayBuffer(c*f);return s.decodeGltfBuffer(new Uint8Array(h),c,f,p,i.mode,i.filter),h})})}else return null}}class gT{constructor(e){this.name=ze.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;const i=t.meshes[n.mesh];for(const u of i.primitives)if(u.mode!==Wt.TRIANGLES&&u.mode!==Wt.TRIANGLE_STRIP&&u.mode!==Wt.TRIANGLE_FAN&&u.mode!==void 0)return null;const s=n.extensions[this.name].attributes,a=[],l={};for(const u in s)a.push(this.parser.getDependency("accessor",s[u]).then(c=>(l[u]=c,l[u])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(u=>{const c=u.pop(),f=c.isGroup?c.children:[c],p=u[0].count,h=[];for(const g of f){const v=new Sn,d=new Fe,m=new Co,y=new Fe(1,1,1),_=new yg(g.geometry,g.material,p);for(let C=0;C0||r.search(/^data\:image\/jpeg/)===0?"image/jpeg":r.search(/\.webp($|\?)/i)>0||r.search(/^data\:image\/webp/)===0?"image/webp":r.search(/\.ktx2($|\?)/i)>0||r.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const PT=new Sn;class MT{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Jw,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,i=-1,o=!1,s=-1;if(typeof navigator<"u"){const a=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=n&&l?parseInt(l[1],10):-1,o=a.indexOf("Firefox")>-1,s=o?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||n&&i<17||o&&s<98?this.textureLoader=new xg(this.options.manager):this.textureLoader=new bg(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new xd(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){const n=this,i=this.json,o=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([n.getDependencies("scene"),n.getDependencies("animation"),n.getDependencies("camera")])}).then(function(s){const a={scene:s[0][i.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:i.asset,parser:n,userData:{}};return Jn(o,a,i),bn(a,i),Promise.all(n._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){for(const l of a.scenes)l.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){const e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let i=0,o=t.length;i{const l=this.associations.get(s);l!=null&&this.associations.set(a,l);for(const[u,c]of s.children.entries())o(c,a.children[u])};return o(n,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&d.setY(M,b[E*l+1]),l>=3&&d.setZ(M,b[E*l+2]),l>=4&&d.setW(M,b[E*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}d.normalized=g}return d})}loadTexture(e){const t=this.json,n=this.options,o=t.textures[e].source,s=t.images[o];let a=this.textureLoader;if(s.uri){const l=n.manager.getHandler(s.uri);l!==null&&(a=l)}return this.loadTextureImage(e,o,a)}loadTextureImage(e,t,n){const i=this,o=this.json,s=o.textures[e],a=o.images[t],l=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[l])return this.textureCache[l];const u=this.loadImageSource(t,n).then(function(c){c.flipY=!1,c.name=s.name||a.name||"",c.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(c.name=a.uri);const p=(o.samplers||{})[s.sampler]||{};return c.magFilter=ah[p.magFilter]||Io,c.minFilter=ah[p.minFilter]||lu,c.wrapS=lh[p.wrapS]||Po,c.wrapT=lh[p.wrapT]||Po,c.generateMipmaps=!c.isCompressedTexture&&c.minFilter!==au&&c.minFilter!==Io,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=u,u}loadImageSource(e,t){const n=this,i=this.json,o=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(f=>f.clone());const s=i.images[e],a=self.URL||self.webkitURL;let l=s.uri||"",u=!1;if(s.bufferView!==void 0)l=n.getDependency("bufferView",s.bufferView).then(function(f){u=!0;const p=new Blob([f],{type:s.mimeType});return l=a.createObjectURL(p),l});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const c=Promise.resolve(l).then(function(f){return new Promise(function(p,h){let g=p;t.isImageBitmapLoader===!0&&(g=function(v){const d=new Ao(v);d.needsUpdate=!0,p(d)}),t.load(yi.resolveURL(f,o.path),g,void 0,h)})}).then(function(f){return u===!0&&a.revokeObjectURL(l),bn(f,s),f.userData.mimeType=s.mimeType||IT(s.uri),f}).catch(function(f){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),f});return this.sourceCache[e]=c,c}assignTexture(e,t,n,i){const o=this;return this.getDependency("texture",n.index).then(function(s){if(!s)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(s=s.clone(),s.channel=n.texCoord),o.extensions[ze.KHR_TEXTURE_TRANSFORM]){const a=n.extensions!==void 0?n.extensions[ze.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=o.associations.get(s);s=o.extensions[ze.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),o.associations.set(s,l)}}return i!==void 0&&(s.colorSpace=i),e[t]=s,s})}assignFinalMaterial(e){const t=e.geometry;let n=e.material;const i=t.attributes.tangent===void 0,o=t.attributes.color!==void 0,s=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new wg,vs.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,l.sizeAttenuation=!1,this.cache.add(a,l)),n=l}else if(e.isLine){const a="LineBasicMaterial:"+n.uuid;let l=this.cache.get(a);l||(l=new Tg,vs.prototype.copy.call(l,n),l.color.copy(n.color),l.map=n.map,this.cache.add(a,l)),n=l}if(i||o||s){let a="ClonedMaterial:"+n.uuid+":";i&&(a+="derivative-tangents:"),o&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=n.clone(),o&&(l.vertexColors=!0),s&&(l.flatShading=!0),i&&(l.normalScale&&(l.normalScale.y*=-1),l.clearcoatNormalScale&&(l.clearcoatNormalScale.y*=-1)),this.cache.add(a,l),this.associations.set(l,this.associations.get(n))),n=l}e.material=n}getMaterialType(){return wd}loadMaterial(e){const t=this,n=this.json,i=this.extensions,o=n.materials[e];let s;const a={},l=o.extensions||{},u=[];if(l[ze.KHR_MATERIALS_UNLIT]){const f=i[ze.KHR_MATERIALS_UNLIT];s=f.getMaterialType(),u.push(f.extendParams(a,o,t))}else{const f=o.pbrMetallicRoughness||{};if(a.color=new Vt(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const p=f.baseColorFactor;a.color.setRGB(p[0],p[1],p[2],En),a.opacity=p[3]}f.baseColorTexture!==void 0&&u.push(t.assignTexture(a,"map",f.baseColorTexture,Ei)),a.metalness=f.metallicFactor!==void 0?f.metallicFactor:1,a.roughness=f.roughnessFactor!==void 0?f.roughnessFactor:1,f.metallicRoughnessTexture!==void 0&&(u.push(t.assignTexture(a,"metalnessMap",f.metallicRoughnessTexture)),u.push(t.assignTexture(a,"roughnessMap",f.metallicRoughnessTexture))),s=this._invokeOne(function(p){return p.getMaterialType&&p.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(p){return p.extendMaterialParams&&p.extendMaterialParams(e,a)})))}o.doubleSided===!0&&(a.side=Yo);const c=o.alphaMode||wa.OPAQUE;if(c===wa.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===wa.MASK&&(a.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&s!==Lr&&(u.push(t.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new bt(1,1),o.normalTexture.scale!==void 0)){const f=o.normalTexture.scale;a.normalScale.set(f,f)}if(o.occlusionTexture!==void 0&&s!==Lr&&(u.push(t.assignTexture(a,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&s!==Lr){const f=o.emissiveFactor;a.emissive=new Vt().setRGB(f[0],f[1],f[2],En)}return o.emissiveTexture!==void 0&&s!==Lr&&u.push(t.assignTexture(a,"emissiveMap",o.emissiveTexture,Ei)),Promise.all(u).then(function(){const f=new s(a);return o.name&&(f.name=o.name),bn(f,o),t.associations.set(f,{materials:e}),o.extensions&&Jn(i,f,o),f})}createUniqueName(e){const t=Si.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,n=this.extensions,i=this.primitiveCache;function o(a){return n[ze.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return uh(l,a,t)})}const s=[];for(let a=0,l=e.length;a0&&CT(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),bn(m,o),d.extensions&&Jn(i,m,d),t.assignFinalMaterial(m),f.push(m)}for(let h=0,g=f.length;h1?c=new ys:u.length===1?c=u[0]:c=new bd,c!==u[0])for(let f=0,p=u.length;f{const f=new Map;for(const[p,h]of i.associations)(p instanceof vs||p instanceof Ao)&&f.set(p,h);return c.traverse(p=>{const h=i.associations.get(p);h!=null&&f.set(p,h)}),f};return i.associations=u(o),o})}_createAnimationTracks(e,t,n,i,o){const s=[],a=e.name?e.name:e.uuid,l=[];kn[o.path]===kn.weights?e.traverse(function(p){p.morphTargetInfluences&&l.push(p.name?p.name:p.uuid)}):l.push(a);let u;switch(kn[o.path]){case kn.weights:u=pc;break;case kn.rotation:u=mc;break;case kn.position:case kn.scale:u=dc;break;default:switch(n.itemSize){case 1:u=pc;break;case 2:case 3:default:u=dc;break}break}const c=i.interpolation!==void 0?TT[i.interpolation]:su,f=this._getArrayFromAccessor(n);for(let p=0,h=l.length;pnew mv(r)),Qn.register(r=>new gv(r)),Qn)}async function OT(r){const n=(await Np().loadAsync(r)).userData;if(!n.vrmAnimations){console.warn("No VRM animations found in the .vrma file");return}if(n.vrmAnimations.length===0){console.warn("No VRM animations found in the .vrma file");return}return n.vrmAnimations[0]}async function RT(r,e){if(!r){console.warn("No VRM found");return}if(e)return vv(e,r)}function FT(){const r=le(!1),e=le(0),t=le(0),n=.2,i=1,o=6,s=le(Math.random()*(o-i)+i);function a(l,u){if(l!=null&&l.expressionManager&&(t.value+=u,!r.value&&t.value>=s.value&&(r.value=!0,e.value=0),r.value)){e.value+=u/n;const c=Math.sin(Math.PI*e.value);l.expressionManager.setValue("blink",c),e.value>=1&&(r.value=!1,t.value=0,l.expressionManager.setValue("blink",0),s.value=Math.random()*(o-i)+i)}}return{update:a}}async function LT(r,e){const i=(await Np().loadAsync(r,s=>{var a;return(a=e==null?void 0:e.onProgress)==null?void 0:a.call(e,s)})).userData;if(!i.vrm)return;const o=i.vrm;if(gc.removeUnnecessaryVertices(o.scene),gc.combineSkeletons(o.scene),o.scene.traverse(s=>{s.frustumCulled=!1}),o.lookAt){const s=new yv(o.lookAt);s.name="lookAtQuaternionProxy",o.scene.add(s)}return e!=null&&e.scene&&e.scene.add(o.scene),e!=null&&e.position&&o.scene.position.set(...e.position),o}function NT(r){const e=le(null),t=le(!1),n=le(0),i=le(new Map),o=le(new Map),s=le(),a=(m,y,_)=>m+(y-m)*_,l=m=>m<.5?4*m*m*m:1-(-2*m+2)**3/2,u=new Map([["happy",{expression:[{name:"happy",value:1,duration:.3},{name:"aa",value:.3}],blendDuration:.3}],["sad",{expression:[{name:"sad",value:1},{name:"oh",value:.2}],blendDuration:.3}],["angry",{expression:[{name:"angry",value:1},{name:"ee",value:.4}],blendDuration:.2}],["surprised",{expression:[{name:"Surprised",value:1},{name:"oh",value:.6}],blendDuration:.1}],["neutral",{expression:[{name:"neutral",value:1}],blendDuration:.5}]]),c=()=>{s.value&&(clearTimeout(s.value),s.value=void 0)},f=m=>{var _;if(c(),!u.has(m)){console.warn(`Emotion ${m} not found`);return}const y=u.get(m);if(e.value=m,t.value=!0,n.value=0,r.expressionManager){const C=Object.keys(r.expressionManager.expressionMap);for(const x of C)r.expressionManager.setValue(x,0)}i.value.clear(),o.value.clear();for(const C of y.expression||[]){const x=((_=r.expressionManager)==null?void 0:_.getValue(C.name))||0;i.value.set(C.name,x),o.value.set(C.name,C.value)}};return{currentEmotion:e,isTransitioning:t,setEmotion:f,setEmotionWithResetAfter:(m,y)=>{c(),f(m),s.value=setTimeout(()=>{f("neutral"),s.value=void 0},y)},update:m=>{var C;if(!t.value||!e.value)return;const _=u.get(e.value).blendDuration||.3;n.value+=m/_,n.value>=1&&(n.value=1,t.value=!1);for(const[x,b]of o.value){const E=i.value.get(x)||0,A=a(E,b,l(n.value));(C=r.expressionManager)==null||C.setValue(x,A)}},addEmotionState:(m,y)=>{u.set(m,y)},removeEmotionState:m=>{u.delete(m)},dispose:()=>{c()}}}const DT=De({__name:"Model",props:{model:null,idleAnimation:null,loadAnimations:null,position:null},emits:["loadModelProgress","error"],setup(r,{expose:e,emit:t}){const n=r,i=t,o=le(),s=le(),{scene:a}=Ti(),{onBeforeRender:l}=ru(),u=FT(),c=le();return Ge(()=>n.position,([f,p,h])=>{o.value&&o.value.scene.position.set(f,p,h)}),Jt(async()=>{if(a.value)try{const f=await LT(n.model,{scene:a.value,lookAt:!0,position:n.position,onProgress:g=>i("loadModelProgress",Number.parseFloat((100*(g.loaded/g.total)).toFixed(2)))});if(!f){console.warn("No VRM model loaded");return}const p=await OT(n.idleAnimation),h=await RT(f,p);if(!h){console.warn("No VRM animation loaded");return}s.value=new Fg(f.scene),s.value.clipAction(h).play(),c.value=NT(f),l(({delta:g})=>{var v,d,m;(v=s.value)==null||v.update(g),(d=o.value)==null||d.update(g),u.update(o.value,g),(m=c.value)==null||m.update(g)}),o.value=f}catch(f){i("error",f)}}),Gt(()=>{if(o.value){const{scene:f}=Ti();f.value.remove(o.value.scene)}}),e({setExpression(f){var p;(p=c.value)==null||p.setEmotionWithResetAfter(f,1e3)}}),(f,p)=>ut(f.$slots,"default")}}),BT=["position"],UT={absolute:"",bottom:"2",right:"2"},zT={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","h-fit":"","w-fit":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":""},jT=["checked","aria-checked"],VT={key:0,absolute:"","w-full":"","min-w":"50vw",z:"{var g;(g=p.value)==null||g.setExpression(h)}}),(h,g)=>{const v=Eo("TransitionVertical");return he(),lt(_p,{relative:""},{default:Ue(({height:d,width:m})=>[Re(K(Lg),{alpha:!0,antialias:!0,width:m,height:d},{default:Ue(()=>[Re(K(Aw)),Y("TresPerspectiveCamera",{position:[s.value,a.value,l.value]},null,8,BT),g[14]||(g[14]=Y("TresDirectionalLight",{color:16777215,intensity:1.2,position:[1,1,1]},null,-1)),g[15]||(g[15]=Y("TresAmbientLight",{color:16777215,intensity:1.5},null,-1)),Re(DT,{ref_key:"modelRef",ref:p,model:n.model,"idle-animation":n.idleAnimation,position:[u.value,c.value,f.value],onLoadModelProgress:g[0]||(g[0]=y=>i("loadModelProgress",y)),onError:g[1]||(g[1]=y=>i("error",y))},null,8,["model","idle-animation","position"])]),_:2},1032,["width","height"]),Y("div",UT,[Y("div",zT,[Y("label",{"h-fit":"","cursor-pointer":"",class:Kt([o.value?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),transition:"all ease-in-out duration-500","rounded-md":"","px-2":"","py-2":"",z:"o.value=y),checked:o.value,"aria-checked":o.value,name:"showLive2DViewerInspector",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,jT),[[Xr,o.value]]),g[16]||(g[16]=Y("div",{"select-none":""},[Y("div",{"i-solar:bug-bold-duotone":"",text:"text-zinc-900 dark:text-zinc-800"})],-1))],2)]),Re(v,null,{default:Ue(()=>[o.value?(he(),_e("div",VT,[Y("div",GT,[Y("div",$T,[Y("span",null,be(h.$t("stage.viewers.debug-menu.vrm.model.title")),1)]),Re(ih,{"h-fit":"","w-full":""},{label:Ue(()=>[Y("span",HT,be(h.$t("stage.viewers.debug-menu.vrm.camera")),1)]),default:Ue(()=>[Y("div",XT,[g[17]||(g[17]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"X")],-1)),Y("label",WT,[Re(kr,{modelValue:s.value,"onUpdate:modelValue":g[3]||(g[3]=y=>s.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",qT,[Y("span",null,be(s.value),1)]),g[18]||(g[18]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Y")],-1)),Y("label",YT,[Re(kr,{modelValue:a.value,"onUpdate:modelValue":g[4]||(g[4]=y=>a.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",KT,[Y("span",null,be(a.value),1)]),g[19]||(g[19]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Z")],-1)),Y("label",ZT,[Re(kr,{modelValue:l.value,"onUpdate:modelValue":g[5]||(g[5]=y=>l.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",JT,[Y("span",null,be(l.value),1)])])]),_:1}),Re(ih,{"h-fit":"","w-full":""},{label:Ue(()=>[Y("span",QT,be(h.$t("stage.viewers.debug-menu.vrm.model.title")),1)]),default:Ue(()=>[Y("div",eS,[g[20]||(g[20]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"X")],-1)),Y("label",tS,[Re(kr,{modelValue:u.value,"onUpdate:modelValue":g[6]||(g[6]=y=>u.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",nS,[Y("span",null,be(u.value),1)]),g[21]||(g[21]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Y")],-1)),Y("label",rS,[Re(kr,{modelValue:c.value,"onUpdate:modelValue":g[7]||(g[7]=y=>c.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",iS,[Y("span",null,be(c.value),1)]),g[22]||(g[22]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Z")],-1)),Y("label",oS,[Re(kr,{modelValue:f.value,"onUpdate:modelValue":g[8]||(g[8]=y=>f.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",sS,[Y("span",null,be(f.value),1)])])]),_:1}),Y("div",aS,[Y("span",null,be(h.$t("stage.viewers.debug-menu.emotions")),1)]),Y("div",lS,[Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:g[9]||(g[9]=y=>{var _;return(_=p.value)==null?void 0:_.setExpression("neutral")})},be(h.$t("stage.viewers.debug-menu.emotions-btn.neutral")),1),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:g[10]||(g[10]=y=>{var _;return(_=p.value)==null?void 0:_.setExpression("surprised")})},be(h.$t("stage.viewers.debug-menu.emotions-btn.surprised")),1),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:g[11]||(g[11]=y=>{var _;return(_=p.value)==null?void 0:_.setExpression("sad")})},be(h.$t("stage.viewers.debug-menu.emotions-btn.sad")),1),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:g[12]||(g[12]=y=>{var _;return(_=p.value)==null?void 0:_.setExpression("angry")})},be(h.$t("stage.viewers.debug-menu.emotions-btn.angry")),1),Y("button",{"rounded-lg":"",bg:"zinc-100/70 dark:zinc-800/50","px-2":"","py-1":"","backdrop-blur-sm":"",onClick:g[13]||(g[13]=y=>{var _;return(_=p.value)==null?void 0:_.setExpression("happy")})},be(h.$t("stage.viewers.debug-menu.emotions-btn.happy")),1)])])])):nt("",!0)]),_:1})])]),_:1})}}});class Sa extends Error{constructor(t,n){super(t);ac(this,"response");this.name="XSAIError",this.response=n}}const cS=r=>r.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`),To=r=>Object.fromEntries(Object.entries(r).map(([e,t])=>[cS(e),t])),Dp=r=>Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0)),Bp=r=>JSON.stringify(To(Dp({...r,abortSignal:void 0,apiKey:void 0,baseURL:void 0,fetch:void 0,headers:void 0}))),Ru=(r,e)=>Dp({Authorization:e?`Bearer ${e}`:void 0,...r}),Fu=(r,e)=>{const t=e.toString();return new URL(r,t.endsWith("/")?t:`${t}/`)},Lu=async r=>{if(!r.ok){const e=new Sa(`Remote sent ${r.status} response`,r);throw e.cause=new Error(await r.text()),e}if(!r.body)throw new Sa("Response body is empty from remote server",r);if(!(r.body instanceof ReadableStream)){const e=new Sa(`Expected Response body to be a ReadableStream, but got ${String(r.body)}`,r);throw e.cause=new Error(`Content-Type is ${r.headers.get("Content-Type")}`),e}return r},fS=async r=>Lu(r).then(e=>e.json()),hS=async r=>await(r.fetch??globalThis.fetch)(Fu("audio/speech",r.baseURL),{body:Bp(r),headers:Ru({"Content-Type":"application/json",...r.headers},r.apiKey),method:"POST",signal:r.abortSignal}).then(Lu).then(e=>e.arrayBuffer()),Up=(r,{apiKey:e,baseURL:t,headers:n})=>({apiKey:e,baseURL:t,headers:n,model:r}),dS=r=>{const e={...r,baseURL:new URL("http://localhost:11434/v1/")},t=n=>Up(n,e);return{chat:t,embed:t,model:()=>e}};dS();const pS=r=>{const e=({applyTextNormalization:t,languageCode:n,nextRequestIds:i,nextText:o,previousRequestIds:s,previousText:a,pronunciationDictionaryLocators:l,seed:u,voiceSettings:c})=>({extraBody:To({applyTextNormalization:t,languageCode:n,nextRequestIds:i,nextText:o,previousRequestIds:s,previousText:a,pronunciationDictionaryLocators:l?l.map(f=>To(f)):void 0,seed:u,voiceSettings:c?To(c):void 0})});return{speech:(t,n)=>({...n?e(n):{},...Up(`elevenlabs/${t}`,{...r,baseURL:(r==null?void 0:r.baseURL)??new URL("http://localhost:5933/v1/")})})}},mS=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Ni{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}}Ni.prototype.property={};Ni.prototype.normal={};Ni.prototype.space=null;function zp(r,e){const t={},n={};let i=-1;for(;++i4&&t.slice(0,4)==="data"&&xS.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(fh,SS);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!fh.test(o)){let s=o.replace(bS,TS);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=Nu}return new i(n,e)}function TS(r){return"-"+r.toLowerCase()}function SS(r){return r.charAt(1).toUpperCase()}const ES=zp([Gp,Vp,Xp,Wp,yS],"html"),qp=zp([Gp,Vp,Xp,Wp,_S],"svg"),hh={}.hasOwnProperty;function CS(r,e){const t=e;function n(i,...o){let s=n.invalid;const a=n.handlers;if(i&&hh.call(i,r)){const l=String(i[r]);s=hh.call(a,l)?a[l]:n.unknown}if(s)return s.call(this,i,...o)}return n.handlers=t.handlers||{},n.invalid=t.invalid,n.unknown=t.unknown,n}const AS=/["&'<>`]/g,IS=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,PS=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,MS=/[|\\{}()[\]^$+*?.]/g,dh=new WeakMap;function kS(r,e){if(r=r.replace(e.subset?OS(e.subset):AS,n),e.subset||e.escapeOnly)return r;return r.replace(IS,t).replace(PS,n);function t(i,o,s){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,s.charCodeAt(o+2),e)}function n(i,o,s){return e.format(i.charCodeAt(0),s.charCodeAt(o+1),e)}}function OS(r){let e=dh.get(r);return e||(e=RS(r),dh.set(r,e)),e}function RS(r){const e=[];let t=-1;for(;++t",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},US=["cent","copy","divide","gt","lt","not","para","times"],Yp={}.hasOwnProperty,Hl={};let ro;for(ro in Ca)Yp.call(Ca,ro)&&(Hl[Ca[ro]]=ro);const zS=/[^\dA-Za-z]/;function jS(r,e,t,n){const i=String.fromCharCode(r);if(Yp.call(Hl,i)){const o=Hl[i],s="&"+o;return t&&BS.includes(o)&&!US.includes(o)&&(!n||e&&e!==61&&zS.test(String.fromCharCode(e)))?s:s+";"}return""}function VS(r,e,t){let n=LS(r,e,t.omitOptionalSemicolons),i;if((t.useNamedReferences||t.useShortestReferences)&&(i=jS(r,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!i)&&t.useShortestReferences){const o=DS(r,e,t.omitOptionalSemicolons);o.length|^->||--!>|"],HS=["<",">"];function XS(r,e,t,n){return n.settings.bogusComments?"":"";function i(o){return $r(o,Object.assign({},n.settings.characterReferences,{subset:HS}))}}function WS(r,e,t,n){return""}function ph(r,e){const t=String(r);if(typeof e!="string")throw new TypeError("Expected character");let n=0,i=t.indexOf(e);for(;i!==-1;)n++,i=t.indexOf(e,i+e.length);return n}function qS(r,e){const t=e||{};return(r[r.length-1]===""?[...r,""]:r).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}function YS(r){return r.join(" ").trim()}const KS=/[ \t\n\f\r]/g;function Du(r){return typeof r=="object"?r.type==="text"?mh(r.value):!1:mh(r)}function mh(r){return r.replace(KS,"")===""}const _t=Zp(1),Kp=Zp(-1),ZS=[];function Zp(r){return e;function e(t,n,i){const o=t?t.children:ZS;let s=(n||0)+r,a=o[s];if(!i)for(;a&&Du(a);)s+=r,a=o[s];return a}}const JS={}.hasOwnProperty;function Jp(r){return e;function e(t,n,i){return JS.call(r,t.tagName)&&r[t.tagName](t,n,i)}}const Bu=Jp({body:e2,caption:Aa,colgroup:Aa,dd:i2,dt:r2,head:Aa,html:QS,li:n2,optgroup:o2,option:s2,p:t2,rp:gh,rt:gh,tbody:l2,td:vh,tfoot:u2,th:vh,thead:a2,tr:c2});function Aa(r,e,t){const n=_t(t,e,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&Du(n.value.charAt(0)))}function QS(r,e,t){const n=_t(t,e);return!n||n.type!=="comment"}function e2(r,e,t){const n=_t(t,e);return!n||n.type!=="comment"}function t2(r,e,t){const n=_t(t,e);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!t||!(t.type==="element"&&(t.tagName==="a"||t.tagName==="audio"||t.tagName==="del"||t.tagName==="ins"||t.tagName==="map"||t.tagName==="noscript"||t.tagName==="video"))}function n2(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&n.tagName==="li"}function r2(r,e,t){const n=_t(t,e);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function i2(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function gh(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function o2(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&n.tagName==="optgroup"}function s2(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function a2(r,e,t){const n=_t(t,e);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function l2(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function u2(r,e,t){return!_t(t,e)}function c2(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&n.tagName==="tr"}function vh(r,e,t){const n=_t(t,e);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}const f2=Jp({body:p2,colgroup:m2,head:d2,html:h2,tbody:g2});function h2(r){const e=_t(r,-1);return!e||e.type!=="comment"}function d2(r){const e=new Set;for(const n of r.children)if(n.type==="element"&&(n.tagName==="base"||n.tagName==="title")){if(e.has(n.tagName))return!1;e.add(n.tagName)}const t=r.children[0];return!t||t.type==="element"}function p2(r){const e=_t(r,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Du(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function m2(r,e,t){const n=Kp(t,e),i=_t(r,-1,!0);return t&&n&&n.type==="element"&&n.tagName==="colgroup"&&Bu(n,t.children.indexOf(n),t)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function g2(r,e,t){const n=Kp(t,e),i=_t(r,-1);return t&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&Bu(n,t.children.indexOf(n),t)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const io={name:[[` +\f\r &/=>`.split(""),` +\f\r "&'/=>\``.split("")],[`\0 +\f\r "&'/<=>`.split(""),`\0 +\f\r "&'/<=>\``.split("")]],unquoted:[[` +\f\r &>`.split(""),`\0 +\f\r "&'<=>\``.split("")],[`\0 +\f\r "&'<=>\``.split(""),`\0 +\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function v2(r,e,t,n){const i=n.schema,o=i.space==="svg"?!1:n.settings.omitOptionalTags;let s=i.space==="svg"?n.settings.closeEmptyElements:n.settings.voids.includes(r.tagName.toLowerCase());const a=[];let l;i.space==="html"&&r.tagName==="svg"&&(n.schema=qp);const u=y2(n,r.properties),c=n.all(i.space==="html"&&r.tagName==="template"?r.content:r);return n.schema=i,c&&(s=!1),(u||!o||!f2(r,e,t))&&(a.push("<",r.tagName,u?" "+u:""),s&&(i.space==="svg"||n.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!n.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(c),!s&&(!o||!Bu(r,e,t))&&a.push(""),a.join("")}function y2(r,e){const t=[];let n=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const o=_2(r,i,e[i]);o&&t.push(o)}}for(;++nph(t,r.alternative)&&(s=r.alternative),a=s+$r(t,Object.assign({},r.settings.characterReferences,{subset:(s==="'"?io.single:io.double)[i][o],attribute:!0}))+s),l+(a&&"="+a))}const x2=["<","&"];function Qp(r,e,t,n){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?r.value:$r(r.value,Object.assign({},n.settings.characterReferences,{subset:x2}))}function b2(r,e,t,n){return n.settings.allowDangerousHtml?r.value:Qp(r,e,t,n)}function w2(r,e,t,n){return n.all(r)}const T2=CS("type",{invalid:S2,unknown:E2,handlers:{comment:XS,doctype:WS,element:v2,raw:b2,root:w2,text:Qp}});function S2(r){throw new Error("Expected node, not `"+r+"`")}function E2(r){const e=r;throw new Error("Cannot compile unknown node `"+e.type+"`")}const C2={},A2=[];function I2(r,e){const t=e,n=t.quote||'"',i=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:P2,all:M2,settings:{omitOptionalTags:t.omitOptionalTags||!1,allowParseErrors:t.allowParseErrors||!1,allowDangerousCharacters:t.allowDangerousCharacters||!1,quoteSmart:t.quoteSmart||!1,preferUnquoted:t.preferUnquoted||!1,tightAttributes:t.tightAttributes||!1,upperDoctype:t.upperDoctype||!1,tightDoctype:t.tightDoctype||!1,bogusComments:t.bogusComments||!1,tightCommaSeparatedLists:t.tightCommaSeparatedLists||!1,tightSelfClosing:t.tightSelfClosing||!1,collapseEmptyAttributes:t.collapseEmptyAttributes||!1,allowDangerousHtml:t.allowDangerousHtml||!1,voids:t.voids||mS,characterReferences:t.characterReferences||C2,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?qp:ES,quote:n,alternative:i}.one(Array.isArray(r)?{type:"root",children:r}:r,void 0,void 0)}function P2(r,e,t){return T2(r,e,t,this)}function M2(r){const e=[],t=r&&r.children||A2;let n=-1;for(;++ni?0:i+e:e=e>i?i:e,t=t>0?t:0,n.length<1e4)s=Array.from(n),s.unshift(e,t),r.splice(...s);else for(t&&r.splice(e,t);o0?(pn(r,r.length,0,e),r):e}const xh={}.hasOwnProperty;function L2(r){const e={};let t=-1;for(;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function Hr(r){return r.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const un=Hn(/[A-Za-z]/),jt=Hn(/[\dA-Za-z]/),B2=Hn(/[#-'*+\--9=?A-Z^-~]/);function Xl(r){return r!==null&&(r<32||r===127)}const Wl=Hn(/\d/),U2=Hn(/[\dA-Fa-f]/),z2=Hn(/[!-/:-@[-`{-~]/);function Pe(r){return r!==null&&r<-2}function Rt(r){return r!==null&&(r<0||r===32)}function He(r){return r===-2||r===-1||r===32}const j2=Hn(new RegExp("\\p{P}|\\p{S}","u")),V2=Hn(/\s/);function Hn(r){return e;function e(t){return t!==null&&t>-1&&r.test(String.fromCharCode(t))}}function ti(r){const e=[];let t=-1,n=0,i=0;for(;++t55295&&o<57344){const a=r.charCodeAt(t+1);o<56320&&a>56319&&a<57344?(s=String.fromCharCode(o,a),i=1):s="�"}else s=String.fromCharCode(o);s&&(e.push(r.slice(n,t),encodeURIComponent(s)),n=t+i+1,s=""),i&&(t+=i,i=0)}return e.join("")+r.slice(n)}function Qe(r,e,t,n){const i=n?n-1:Number.POSITIVE_INFINITY;let o=0;return s;function s(l){return He(l)?(r.enter(t),a(l)):e(l)}function a(l){return He(l)&&o++s))return;const E=e.events.length;let A=E,M,I;for(;A--;)if(e.events[A][0]==="exit"&&e.events[A][1].type==="chunkFlow"){if(M){I=e.events[A][1].end;break}M=!0}for(m(n),b=E;b_;){const x=t[C];e.containerState=x[1],x[0].exit.call(e,r)}t.length=_}function y(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function W2(r,e,t){return Qe(r,r.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function wh(r){if(r===null||Rt(r)||V2(r))return 1;if(j2(r))return 2}function zu(r,e,t){const n=[];let i=-1;for(;++i1&&r[t][1].end.offset-r[t][1].start.offset>1?2:1;const f={...r[n][1].end},p={...r[t][1].start};Th(f,-l),Th(p,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...r[n][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...r[t][1].start},end:p},o={type:l>1?"strongText":"emphasisText",start:{...r[n][1].end},end:{...r[t][1].start}},i={type:l>1?"strong":"emphasis",start:{...s.start},end:{...a.end}},r[n][1].end={...s.start},r[t][1].start={...a.end},u=[],r[n][1].end.offset-r[n][1].start.offset&&(u=Yt(u,[["enter",r[n][1],e],["exit",r[n][1],e]])),u=Yt(u,[["enter",i,e],["enter",s,e],["exit",s,e],["enter",o,e]]),u=Yt(u,zu(e.parser.constructs.insideSpan.null,r.slice(n+1,t),e)),u=Yt(u,[["exit",o,e],["enter",a,e],["exit",a,e],["exit",i,e]]),r[t][1].end.offset-r[t][1].start.offset?(c=2,u=Yt(u,[["enter",r[t][1],e],["exit",r[t][1],e]])):c=0,pn(r,n-1,t-n+3,u),t=n+u.length-c-2;break}}for(t=-1;++t0&&He(b)?Qe(r,y,"linePrefix",o+1)(b):y(b)}function y(b){return b===null||Pe(b)?r.check(Sh,v,C)(b):(r.enter("codeFlowValue"),_(b))}function _(b){return b===null||Pe(b)?(r.exit("codeFlowValue"),y(b)):(r.consume(b),_)}function C(b){return r.exit("codeFenced"),e(b)}function x(b,E,A){let M=0;return I;function I(G){return b.enter("lineEnding"),b.consume(G),b.exit("lineEnding"),F}function F(G){return b.enter("codeFencedFence"),He(G)?Qe(b,S,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):S(G)}function S(G){return G===a?(b.enter("codeFencedFenceSequence"),X(G)):A(G)}function X(G){return G===a?(M++,b.consume(G),X):M>=s?(b.exit("codeFencedFenceSequence"),He(G)?Qe(b,w,"whitespace")(G):w(G)):A(G)}function w(G){return G===null||Pe(G)?(b.exit("codeFencedFence"),E(G)):A(G)}}}function oE(r,e,t){const n=this;return i;function i(s){return s===null?t(s):(r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),o)}function o(s){return n.parser.lazy[n.now().line]?t(s):e(s)}}const Ia={name:"codeIndented",tokenize:aE},sE={partial:!0,tokenize:lE};function aE(r,e,t){const n=this;return i;function i(u){return r.enter("codeIndented"),Qe(r,o,"linePrefix",5)(u)}function o(u){const c=n.events[n.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):t(u)}function s(u){return u===null?l(u):Pe(u)?r.attempt(sE,s,l)(u):(r.enter("codeFlowValue"),a(u))}function a(u){return u===null||Pe(u)?(r.exit("codeFlowValue"),s(u)):(r.consume(u),a)}function l(u){return r.exit("codeIndented"),e(u)}}function lE(r,e,t){const n=this;return i;function i(s){return n.parser.lazy[n.now().line]?t(s):Pe(s)?(r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),i):Qe(r,o,"linePrefix",5)(s)}function o(s){const a=n.events[n.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):Pe(s)?i(s):t(s)}}const uE={name:"codeText",previous:fE,resolve:cE,tokenize:hE};function cE(r){let e=r.length-4,t=3,n,i;if((r[t][1].type==="lineEnding"||r[t][1].type==="space")&&(r[e][1].type==="lineEnding"||r[e][1].type==="space")){for(n=t;++n=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length)return this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse();const i=this.left.slice(e);return i.push(...this.right.slice(this.right.length-n+this.left.length).reverse()),i}splice(e,t,n){const i=t||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return n&&ui(this.left,n),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),ui(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),ui(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(s):r.interrupt(n.parser.constructs.flow,t,e)(s)}}function sm(r,e,t,n,i,o,s,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return f;function f(m){return m===60?(r.enter(n),r.enter(i),r.enter(o),r.consume(m),r.exit(o),p):m===null||m===32||m===41||Xl(m)?t(m):(r.enter(n),r.enter(s),r.enter(a),r.enter("chunkString",{contentType:"string"}),v(m))}function p(m){return m===62?(r.enter(o),r.consume(m),r.exit(o),r.exit(i),r.exit(n),e):(r.enter(a),r.enter("chunkString",{contentType:"string"}),h(m))}function h(m){return m===62?(r.exit("chunkString"),r.exit(a),p(m)):m===null||m===60||Pe(m)?t(m):(r.consume(m),m===92?g:h)}function g(m){return m===60||m===62||m===92?(r.consume(m),h):h(m)}function v(m){return!c&&(m===null||m===41||Rt(m))?(r.exit("chunkString"),r.exit(a),r.exit(s),r.exit(n),e(m)):c999||h===null||h===91||h===93&&!l||h===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?t(h):h===93?(r.exit(o),r.enter(i),r.consume(h),r.exit(i),r.exit(n),e):Pe(h)?(r.enter("lineEnding"),r.consume(h),r.exit("lineEnding"),c):(r.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||Pe(h)||a++>999?(r.exit("chunkString"),c(h)):(r.consume(h),l||(l=!He(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(r.consume(h),a++,f):f(h)}}function lm(r,e,t,n,i,o){let s;return a;function a(p){return p===34||p===39||p===40?(r.enter(n),r.enter(i),r.consume(p),r.exit(i),s=p===40?41:p,l):t(p)}function l(p){return p===s?(r.enter(i),r.consume(p),r.exit(i),r.exit(n),e):(r.enter(o),u(p))}function u(p){return p===s?(r.exit(o),l(s)):p===null?t(p):Pe(p)?(r.enter("lineEnding"),r.consume(p),r.exit("lineEnding"),Qe(r,u,"linePrefix")):(r.enter("chunkString",{contentType:"string"}),c(p))}function c(p){return p===s||p===null||Pe(p)?(r.exit("chunkString"),u(p)):(r.consume(p),p===92?f:c)}function f(p){return p===s||p===92?(r.consume(p),c):c(p)}}function bi(r,e){let t;return n;function n(i){return Pe(i)?(r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),t=!0,n):He(i)?Qe(r,n,t?"linePrefix":"lineSuffix")(i):e(i)}}const xE={name:"definition",tokenize:wE},bE={partial:!0,tokenize:TE};function wE(r,e,t){const n=this;let i;return o;function o(h){return r.enter("definition"),s(h)}function s(h){return am.call(n,r,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=Hr(n.sliceSerialize(n.events[n.events.length-1][1]).slice(1,-1)),h===58?(r.enter("definitionMarker"),r.consume(h),r.exit("definitionMarker"),l):t(h)}function l(h){return Rt(h)?bi(r,u)(h):u(h)}function u(h){return sm(r,c,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function c(h){return r.attempt(bE,f,f)(h)}function f(h){return He(h)?Qe(r,p,"whitespace")(h):p(h)}function p(h){return h===null||Pe(h)?(r.exit("definition"),n.parser.defined.push(i),e(h)):t(h)}}function TE(r,e,t){return n;function n(a){return Rt(a)?bi(r,i)(a):t(a)}function i(a){return lm(r,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return He(a)?Qe(r,s,"whitespace")(a):s(a)}function s(a){return a===null||Pe(a)?e(a):t(a)}}const SE={name:"hardBreakEscape",tokenize:EE};function EE(r,e,t){return n;function n(o){return r.enter("hardBreakEscape"),r.consume(o),i}function i(o){return Pe(o)?(r.exit("hardBreakEscape"),e(o)):t(o)}}const CE={name:"headingAtx",resolve:AE,tokenize:IE};function AE(r,e){let t=r.length-2,n=3,i,o;return r[n][1].type==="whitespace"&&(n+=2),t-2>n&&r[t][1].type==="whitespace"&&(t-=2),r[t][1].type==="atxHeadingSequence"&&(n===t-1||t-4>n&&r[t-2][1].type==="whitespace")&&(t-=n+1===t?2:4),t>n&&(i={type:"atxHeadingText",start:r[n][1].start,end:r[t][1].end},o={type:"chunkText",start:r[n][1].start,end:r[t][1].end,contentType:"text"},pn(r,n,t-n+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),r}function IE(r,e,t){let n=0;return i;function i(c){return r.enter("atxHeading"),o(c)}function o(c){return r.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&n++<6?(r.consume(c),s):c===null||Rt(c)?(r.exit("atxHeadingSequence"),a(c)):t(c)}function a(c){return c===35?(r.enter("atxHeadingSequence"),l(c)):c===null||Pe(c)?(r.exit("atxHeading"),e(c)):He(c)?Qe(r,a,"whitespace")(c):(r.enter("atxHeadingText"),u(c))}function l(c){return c===35?(r.consume(c),l):(r.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||Rt(c)?(r.exit("atxHeadingText"),a(c)):(r.consume(c),u)}}const PE=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Ch=["pre","script","style","textarea"],ME={concrete:!0,name:"htmlFlow",resolveTo:RE,tokenize:FE},kE={partial:!0,tokenize:NE},OE={partial:!0,tokenize:LE};function RE(r){let e=r.length;for(;e--&&!(r[e][0]==="enter"&&r[e][1].type==="htmlFlow"););return e>1&&r[e-2][1].type==="linePrefix"&&(r[e][1].start=r[e-2][1].start,r[e+1][1].start=r[e-2][1].start,r.splice(e-2,2)),r}function FE(r,e,t){const n=this;let i,o,s,a,l;return u;function u(k){return c(k)}function c(k){return r.enter("htmlFlow"),r.enter("htmlFlowData"),r.consume(k),f}function f(k){return k===33?(r.consume(k),p):k===47?(r.consume(k),o=!0,v):k===63?(r.consume(k),i=3,n.interrupt?e:P):un(k)?(r.consume(k),s=String.fromCharCode(k),d):t(k)}function p(k){return k===45?(r.consume(k),i=2,h):k===91?(r.consume(k),i=5,a=0,g):un(k)?(r.consume(k),i=4,n.interrupt?e:P):t(k)}function h(k){return k===45?(r.consume(k),n.interrupt?e:P):t(k)}function g(k){const ee="CDATA[";return k===ee.charCodeAt(a++)?(r.consume(k),a===ee.length?n.interrupt?e:S:g):t(k)}function v(k){return un(k)?(r.consume(k),s=String.fromCharCode(k),d):t(k)}function d(k){if(k===null||k===47||k===62||Rt(k)){const ee=k===47,Q=s.toLowerCase();return!ee&&!o&&Ch.includes(Q)?(i=1,n.interrupt?e(k):S(k)):PE.includes(s.toLowerCase())?(i=6,ee?(r.consume(k),m):n.interrupt?e(k):S(k)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?t(k):o?y(k):_(k))}return k===45||jt(k)?(r.consume(k),s+=String.fromCharCode(k),d):t(k)}function m(k){return k===62?(r.consume(k),n.interrupt?e:S):t(k)}function y(k){return He(k)?(r.consume(k),y):I(k)}function _(k){return k===47?(r.consume(k),I):k===58||k===95||un(k)?(r.consume(k),C):He(k)?(r.consume(k),_):I(k)}function C(k){return k===45||k===46||k===58||k===95||jt(k)?(r.consume(k),C):x(k)}function x(k){return k===61?(r.consume(k),b):He(k)?(r.consume(k),x):_(k)}function b(k){return k===null||k===60||k===61||k===62||k===96?t(k):k===34||k===39?(r.consume(k),l=k,E):He(k)?(r.consume(k),b):A(k)}function E(k){return k===l?(r.consume(k),l=null,M):k===null||Pe(k)?t(k):(r.consume(k),E)}function A(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||Rt(k)?x(k):(r.consume(k),A)}function M(k){return k===47||k===62||He(k)?_(k):t(k)}function I(k){return k===62?(r.consume(k),F):t(k)}function F(k){return k===null||Pe(k)?S(k):He(k)?(r.consume(k),F):t(k)}function S(k){return k===45&&i===2?(r.consume(k),R):k===60&&i===1?(r.consume(k),L):k===62&&i===4?(r.consume(k),D):k===63&&i===3?(r.consume(k),P):k===93&&i===5?(r.consume(k),$):Pe(k)&&(i===6||i===7)?(r.exit("htmlFlowData"),r.check(kE,j,X)(k)):k===null||Pe(k)?(r.exit("htmlFlowData"),X(k)):(r.consume(k),S)}function X(k){return r.check(OE,w,j)(k)}function w(k){return r.enter("lineEnding"),r.consume(k),r.exit("lineEnding"),G}function G(k){return k===null||Pe(k)?X(k):(r.enter("htmlFlowData"),S(k))}function R(k){return k===45?(r.consume(k),P):S(k)}function L(k){return k===47?(r.consume(k),s="",N):S(k)}function N(k){if(k===62){const ee=s.toLowerCase();return Ch.includes(ee)?(r.consume(k),D):S(k)}return un(k)&&s.length<8?(r.consume(k),s+=String.fromCharCode(k),N):S(k)}function $(k){return k===93?(r.consume(k),P):S(k)}function P(k){return k===62?(r.consume(k),D):k===45&&i===2?(r.consume(k),P):S(k)}function D(k){return k===null||Pe(k)?(r.exit("htmlFlowData"),j(k)):(r.consume(k),D)}function j(k){return r.exit("htmlFlow"),e(k)}}function LE(r,e,t){const n=this;return i;function i(s){return Pe(s)?(r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),o):t(s)}function o(s){return n.parser.lazy[n.now().line]?t(s):e(s)}}function NE(r,e,t){return n;function n(i){return r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),r.attempt(is,e,t)}}const DE={name:"htmlText",tokenize:BE};function BE(r,e,t){const n=this;let i,o,s;return a;function a(P){return r.enter("htmlText"),r.enter("htmlTextData"),r.consume(P),l}function l(P){return P===33?(r.consume(P),u):P===47?(r.consume(P),x):P===63?(r.consume(P),_):un(P)?(r.consume(P),A):t(P)}function u(P){return P===45?(r.consume(P),c):P===91?(r.consume(P),o=0,g):un(P)?(r.consume(P),y):t(P)}function c(P){return P===45?(r.consume(P),h):t(P)}function f(P){return P===null?t(P):P===45?(r.consume(P),p):Pe(P)?(s=f,L(P)):(r.consume(P),f)}function p(P){return P===45?(r.consume(P),h):f(P)}function h(P){return P===62?R(P):P===45?p(P):f(P)}function g(P){const D="CDATA[";return P===D.charCodeAt(o++)?(r.consume(P),o===D.length?v:g):t(P)}function v(P){return P===null?t(P):P===93?(r.consume(P),d):Pe(P)?(s=v,L(P)):(r.consume(P),v)}function d(P){return P===93?(r.consume(P),m):v(P)}function m(P){return P===62?R(P):P===93?(r.consume(P),m):v(P)}function y(P){return P===null||P===62?R(P):Pe(P)?(s=y,L(P)):(r.consume(P),y)}function _(P){return P===null?t(P):P===63?(r.consume(P),C):Pe(P)?(s=_,L(P)):(r.consume(P),_)}function C(P){return P===62?R(P):_(P)}function x(P){return un(P)?(r.consume(P),b):t(P)}function b(P){return P===45||jt(P)?(r.consume(P),b):E(P)}function E(P){return Pe(P)?(s=E,L(P)):He(P)?(r.consume(P),E):R(P)}function A(P){return P===45||jt(P)?(r.consume(P),A):P===47||P===62||Rt(P)?M(P):t(P)}function M(P){return P===47?(r.consume(P),R):P===58||P===95||un(P)?(r.consume(P),I):Pe(P)?(s=M,L(P)):He(P)?(r.consume(P),M):R(P)}function I(P){return P===45||P===46||P===58||P===95||jt(P)?(r.consume(P),I):F(P)}function F(P){return P===61?(r.consume(P),S):Pe(P)?(s=F,L(P)):He(P)?(r.consume(P),F):M(P)}function S(P){return P===null||P===60||P===61||P===62||P===96?t(P):P===34||P===39?(r.consume(P),i=P,X):Pe(P)?(s=S,L(P)):He(P)?(r.consume(P),S):(r.consume(P),w)}function X(P){return P===i?(r.consume(P),i=void 0,G):P===null?t(P):Pe(P)?(s=X,L(P)):(r.consume(P),X)}function w(P){return P===null||P===34||P===39||P===60||P===61||P===96?t(P):P===47||P===62||Rt(P)?M(P):(r.consume(P),w)}function G(P){return P===47||P===62||Rt(P)?M(P):t(P)}function R(P){return P===62?(r.consume(P),r.exit("htmlTextData"),r.exit("htmlText"),e):t(P)}function L(P){return r.exit("htmlTextData"),r.enter("lineEnding"),r.consume(P),r.exit("lineEnding"),N}function N(P){return He(P)?Qe(r,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):$(P)}function $(P){return r.enter("htmlTextData"),s(P)}}const ju={name:"labelEnd",resolveAll:VE,resolveTo:GE,tokenize:$E},UE={tokenize:HE},zE={tokenize:XE},jE={tokenize:WE};function VE(r){let e=-1;const t=[];for(;++e=3&&(u===null||Pe(u))?(r.exit("thematicBreak"),e(u)):t(u)}function l(u){return u===i?(r.consume(u),n++,l):(r.exit("thematicBreakSequence"),He(u)?Qe(r,a,"whitespace")(u):a(u))}}const kt={continuation:{tokenize:rC},exit:oC,name:"list",tokenize:nC},eC={partial:!0,tokenize:sC},tC={partial:!0,tokenize:iC};function nC(r,e,t){const n=this,i=n.events[n.events.length-1];let o=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,s=0;return a;function a(h){const g=n.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!n.containerState.marker||h===n.containerState.marker:Wl(h)){if(n.containerState.type||(n.containerState.type=g,r.enter(g,{_container:!0})),g==="listUnordered")return r.enter("listItemPrefix"),h===42||h===45?r.check(So,t,u)(h):u(h);if(!n.interrupt||h===49)return r.enter("listItemPrefix"),r.enter("listItemValue"),l(h)}return t(h)}function l(h){return Wl(h)&&++s<10?(r.consume(h),l):(!n.interrupt||s<2)&&(n.containerState.marker?h===n.containerState.marker:h===41||h===46)?(r.exit("listItemValue"),u(h)):t(h)}function u(h){return r.enter("listItemMarker"),r.consume(h),r.exit("listItemMarker"),n.containerState.marker=n.containerState.marker||h,r.check(is,n.interrupt?t:c,r.attempt(eC,p,f))}function c(h){return n.containerState.initialBlankLine=!0,o++,p(h)}function f(h){return He(h)?(r.enter("listItemPrefixWhitespace"),r.consume(h),r.exit("listItemPrefixWhitespace"),p):t(h)}function p(h){return n.containerState.size=o+n.sliceSerialize(r.exit("listItemPrefix"),!0).length,e(h)}}function rC(r,e,t){const n=this;return n.containerState._closeFlow=void 0,r.check(is,i,o);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Qe(r,e,"listItemIndent",n.containerState.size+1)(a)}function o(a){return n.containerState.furtherBlankLines||!He(a)?(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,s(a)):(n.containerState.furtherBlankLines=void 0,n.containerState.initialBlankLine=void 0,r.attempt(tC,e,s)(a))}function s(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Qe(r,r.attempt(kt,e,t),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function iC(r,e,t){const n=this;return Qe(r,i,"listItemIndent",n.containerState.size+1);function i(o){const s=n.events[n.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===n.containerState.size?e(o):t(o)}}function oC(r){r.exit(this.containerState.type)}function sC(r,e,t){const n=this;return Qe(r,i,"listItemPrefixWhitespace",n.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(o){const s=n.events[n.events.length-1];return!He(o)&&s&&s[1].type==="listItemPrefixWhitespace"?e(o):t(o)}}const Ah={name:"setextUnderline",resolveTo:aC,tokenize:lC};function aC(r,e){let t=r.length,n,i,o;for(;t--;)if(r[t][0]==="enter"){if(r[t][1].type==="content"){n=t;break}r[t][1].type==="paragraph"&&(i=t)}else r[t][1].type==="content"&&r.splice(t,1),!o&&r[t][1].type==="definition"&&(o=t);const s={type:"setextHeading",start:{...r[i][1].start},end:{...r[r.length-1][1].end}};return r[i][1].type="setextHeadingText",o?(r.splice(i,0,["enter",s,e]),r.splice(o+1,0,["exit",r[n][1],e]),r[n][1].end={...r[o][1].end}):r[n][1]=s,r.push(["exit",s,e]),r}function lC(r,e,t){const n=this;let i;return o;function o(u){let c=n.events.length,f;for(;c--;)if(n.events[c][1].type!=="lineEnding"&&n.events[c][1].type!=="linePrefix"&&n.events[c][1].type!=="content"){f=n.events[c][1].type==="paragraph";break}return!n.parser.lazy[n.now().line]&&(n.interrupt||f)?(r.enter("setextHeadingLine"),i=u,s(u)):t(u)}function s(u){return r.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(r.consume(u),a):(r.exit("setextHeadingLineSequence"),He(u)?Qe(r,l,"lineSuffix")(u):l(u))}function l(u){return u===null||Pe(u)?(r.exit("setextHeadingLine"),e(u)):t(u)}}const uC={tokenize:cC};function cC(r){const e=this,t=r.attempt(is,n,r.attempt(this.parser.constructs.flowInitial,i,Qe(r,r.attempt(this.parser.constructs.flow,i,r.attempt(mE,i)),"linePrefix")));return t;function n(o){if(o===null){r.consume(o);return}return r.enter("lineEndingBlank"),r.consume(o),r.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function i(o){if(o===null){r.consume(o);return}return r.enter("lineEnding"),r.consume(o),r.exit("lineEnding"),e.currentConstruct=void 0,t}}const fC={resolveAll:cm()},hC=um("string"),dC=um("text");function um(r){return{resolveAll:cm(r==="text"?pC:void 0),tokenize:e};function e(t){const n=this,i=this.parser.constructs[r],o=t.attempt(i,s,a);return s;function s(c){return u(c)?o(c):a(c)}function a(c){if(c===null){t.consume(c);return}return t.enter("data"),t.consume(c),l}function l(c){return u(c)?(t.exit("data"),o(c)):(t.consume(c),l)}function u(c){if(c===null)return!0;const f=i[c];let p=-1;if(f)for(;++p-1){const a=s[0];typeof a=="string"?s[0]=a.slice(n):s.shift()}o>0&&s.push(r[i].slice(0,o))}return s}function AC(r,e){let t=-1;const n=[];let i;for(;++t0){const Xe=me.tokenStack[me.tokenStack.length-1];(Xe[1]||kh).call(me,void 0,Xe[0])}for(ce.position={start:On(re.length>0?re[0][1].start:{line:1,column:1,offset:0}),end:On(re.length>0?re[re.length-2][1].end:{line:1,column:1,offset:0})},Ae=-1;++Ae1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(s)}]};r.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return r.patch(e,u),r.applyData(e,u)}function $C(r,e){const t={type:"element",tagName:"h"+e.depth,properties:{},children:r.all(e)};return r.patch(e,t),r.applyData(e,t)}function HC(r,e){if(r.options.allowDangerousHtml){const t={type:"raw",value:e.value};return r.patch(e,t),r.applyData(e,t)}}function dm(r,e){const t=e.referenceType;let n="]";if(t==="collapsed"?n+="[]":t==="full"&&(n+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+n}];const i=r.all(e),o=i[0];o&&o.type==="text"?o.value="["+o.value:i.unshift({type:"text",value:"["});const s=i[i.length-1];return s&&s.type==="text"?s.value+=n:i.push({type:"text",value:n}),i}function XC(r,e){const t=String(e.identifier).toUpperCase(),n=r.definitionById.get(t);if(!n)return dm(r,e);const i={src:ti(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(i.title=n.title);const o={type:"element",tagName:"img",properties:i,children:[]};return r.patch(e,o),r.applyData(e,o)}function WC(r,e){const t={src:ti(e.url)};e.alt!==null&&e.alt!==void 0&&(t.alt=e.alt),e.title!==null&&e.title!==void 0&&(t.title=e.title);const n={type:"element",tagName:"img",properties:t,children:[]};return r.patch(e,n),r.applyData(e,n)}function qC(r,e){const t={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};r.patch(e,t);const n={type:"element",tagName:"code",properties:{},children:[t]};return r.patch(e,n),r.applyData(e,n)}function YC(r,e){const t=String(e.identifier).toUpperCase(),n=r.definitionById.get(t);if(!n)return dm(r,e);const i={href:ti(n.url||"")};n.title!==null&&n.title!==void 0&&(i.title=n.title);const o={type:"element",tagName:"a",properties:i,children:r.all(e)};return r.patch(e,o),r.applyData(e,o)}function KC(r,e){const t={href:ti(e.url)};e.title!==null&&e.title!==void 0&&(t.title=e.title);const n={type:"element",tagName:"a",properties:t,children:r.all(e)};return r.patch(e,n),r.applyData(e,n)}function ZC(r,e,t){const n=r.all(e),i=t?JC(t):pm(e),o={},s=[];if(typeof e.checked=="boolean"){const c=n[0];let f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},n.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let a=-1;for(;++a1}function QC(r,e){const t={},n=r.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(t.start=e.start);++i0&&typeof n.column=="number"&&n.column>0)return{line:n.line,column:n.column,offset:typeof n.offset=="number"&&n.offset>-1?n.offset:void 0}}}function rA(r){const e=gm(r),t=mm(r);if(e&&t)return{start:e,end:t}}function iA(r,e){const t=r.all(e),n=t.shift(),i=[];if(n){const s={type:"element",tagName:"thead",properties:{},children:r.wrap([n],!0)};r.patch(e.children[0],s),i.push(s)}if(t.length>0){const s={type:"element",tagName:"tbody",properties:{},children:r.wrap(t,!0)},a=gm(e.children[1]),l=mm(e.children[e.children.length-1]);a&&l&&(s.position={start:a,end:l}),i.push(s)}const o={type:"element",tagName:"table",properties:{},children:r.wrap(i,!0)};return r.patch(e,o),r.applyData(e,o)}function oA(r,e,t){const n=t?t.children:void 0,o=(n?n.indexOf(e):1)===0?"th":"td",s=t&&t.type==="table"?t.align:void 0,a=s?s.length:e.children.length;let l=-1;const u=[];for(;++l0,!0),n[0]),i=n.index+n[0].length,n=t.exec(e);return o.push(Fh(e.slice(i),i>0,!1)),o.join("")}function Fh(r,e,t){let n=0,i=r.length;if(e){let o=r.codePointAt(n);for(;o===Oh||o===Rh;)n++,o=r.codePointAt(n)}if(t){let o=r.codePointAt(i-1);for(;o===Oh||o===Rh;)i--,o=r.codePointAt(i-1)}return i>n?r.slice(n,i):""}function lA(r,e){const t={type:"text",value:aA(String(e.value))};return r.patch(e,t),r.applyData(e,t)}function uA(r,e){const t={type:"element",tagName:"hr",properties:{},children:[]};return r.patch(e,t),r.applyData(e,t)}const cA={blockquote:BC,break:UC,code:zC,delete:jC,emphasis:VC,footnoteReference:GC,heading:$C,html:HC,imageReference:XC,image:WC,inlineCode:qC,linkReference:YC,link:KC,listItem:ZC,list:QC,paragraph:eA,root:tA,strong:nA,table:iA,tableCell:sA,tableRow:oA,text:lA,thematicBreak:uA,toml:oo,yaml:oo,definition:oo,footnoteDefinition:oo};function oo(){}const ym=-1,os=0,Go=1,$o=2,Vu=3,Gu=4,$u=5,Hu=6,_m=7,xm=8,Lh=typeof self=="object"?self:globalThis,fA=(r,e)=>{const t=(i,o)=>(r.set(o,i),i),n=i=>{if(r.has(i))return r.get(i);const[o,s]=e[i];switch(o){case os:case ym:return t(s,i);case Go:{const a=t([],i);for(const l of s)a.push(n(l));return a}case $o:{const a=t({},i);for(const[l,u]of s)a[n(l)]=n(u);return a}case Vu:return t(new Date(s),i);case Gu:{const{source:a,flags:l}=s;return t(new RegExp(a,l),i)}case $u:{const a=t(new Map,i);for(const[l,u]of s)a.set(n(l),n(u));return a}case Hu:{const a=t(new Set,i);for(const l of s)a.add(n(l));return a}case _m:{const{name:a,message:l}=s;return t(new Lh[a](l),i)}case xm:return t(BigInt(s),i);case"BigInt":return t(Object(BigInt(s)),i)}return t(new Lh[o](s),i)};return n},Nh=r=>fA(new Map,r)(0),Or="",{toString:hA}={},{keys:dA}=Object,ci=r=>{const e=typeof r;if(e!=="object"||!r)return[os,e];const t=hA.call(r).slice(8,-1);switch(t){case"Array":return[Go,Or];case"Object":return[$o,Or];case"Date":return[Vu,Or];case"RegExp":return[Gu,Or];case"Map":return[$u,Or];case"Set":return[Hu,Or]}return t.includes("Array")?[Go,t]:t.includes("Error")?[_m,t]:[$o,t]},so=([r,e])=>r===os&&(e==="function"||e==="symbol"),pA=(r,e,t,n)=>{const i=(s,a)=>{const l=n.push(s)-1;return t.set(a,l),l},o=s=>{if(t.has(s))return t.get(s);let[a,l]=ci(s);switch(a){case os:{let c=s;switch(l){case"bigint":a=xm,c=s.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([ym],s)}return i([a,c],s)}case Go:{if(l)return i([l,[...s]],s);const c=[],f=i([a,c],s);for(const p of s)c.push(o(p));return f}case $o:{if(l)switch(l){case"BigInt":return i([l,s.toString()],s);case"Boolean":case"Number":case"String":return i([l,s.valueOf()],s)}if(e&&"toJSON"in s)return o(s.toJSON());const c=[],f=i([a,c],s);for(const p of dA(s))(r||!so(ci(s[p])))&&c.push([o(p),o(s[p])]);return f}case Vu:return i([a,s.toISOString()],s);case Gu:{const{source:c,flags:f}=s;return i([a,{source:c,flags:f}],s)}case $u:{const c=[],f=i([a,c],s);for(const[p,h]of s)(r||!(so(ci(p))||so(ci(h))))&&c.push([o(p),o(h)]);return f}case Hu:{const c=[],f=i([a,c],s);for(const p of s)(r||!so(ci(p)))&&c.push(o(p));return f}}const{message:u}=s;return i([a,{name:l,message:u}],s)};return o},Dh=(r,{json:e,lossy:t}={})=>{const n=[];return pA(!(e||t),!!e,new Map,n)(r),n},Ho=typeof structuredClone=="function"?(r,e)=>e&&("json"in e||"lossy"in e)?Nh(Dh(r,e)):structuredClone(r):(r,e)=>Nh(Dh(r,e));function mA(r,e){const t=[{type:"text",value:"↩"}];return e>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),t}function gA(r,e){return"Back to reference "+(r+1)+(e>1?"-"+e:"")}function vA(r){const e=typeof r.options.clobberPrefix=="string"?r.options.clobberPrefix:"user-content-",t=r.options.footnoteBackContent||mA,n=r.options.footnoteBackLabel||gA,i=r.options.footnoteLabel||"Footnotes",o=r.options.footnoteLabelTagName||"h2",s=r.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l0&&g.push({type:"text",value:" "});let y=typeof t=="string"?t:t(l,h);typeof y=="string"&&(y={type:"text",value:y}),g.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+p+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,h),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const d=c[c.length-1];if(d&&d.type==="element"&&d.tagName==="p"){const y=d.children[d.children.length-1];y&&y.type==="text"?y.value+=" ":d.children.push({type:"text",value:" "}),d.children.push(...g)}else c.push(...g);const m={type:"element",tagName:"li",properties:{id:e+"fn-"+p},children:r.wrap(c,!0)};r.patch(u,m),a.push(m)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Ho(s),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:r.wrap(a,!0)},{type:"text",value:` +`}]}}const bm=function(r){if(r==null)return bA;if(typeof r=="function")return ss(r);if(typeof r=="object")return Array.isArray(r)?yA(r):_A(r);if(typeof r=="string")return xA(r);throw new Error("Expected function, string, or object as test")};function yA(r){const e=[];let t=-1;for(;++t":""))+")"})}return p;function p(){let h=wm,g,v,d;if((!e||o(l,u,c[c.length-1]||void 0))&&(h=CA(t(l,c)),h[0]===Bh))return h;if("children"in l&&l.children){const m=l;if(m.children&&h[0]!==SA)for(v=(n?m.children.length:-1)+s,d=c.concat(m);v>-1&&v0&&t.push({type:"text",value:` +`}),t}function Uh(r){let e=0,t=r.charCodeAt(e);for(;t===9||t===32;)e++,t=r.charCodeAt(e);return r.slice(e)}function zh(r,e){const t=PA(r,e),n=t.one(r,void 0),i=vA(t),o=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&o.children.push({type:"text",value:` +`},i),o}function FA(r,e){return r&&"run"in r?async function(t,n){const i=zh(t,{file:n,...e});await r.run(i,n)}:function(t,n){return zh(t,{file:n,...r||e})}}function jh(r){if(r)throw r}var Ma,Vh;function LA(){if(Vh)return Ma;Vh=1;var r=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):e.call(u)==="[object Array]"},o=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=r.call(u,"constructor"),f=u.constructor&&u.constructor.prototype&&r.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!f)return!1;var p;for(p in u);return typeof p>"u"||r.call(u,p)},s=function(u,c){t&&c.name==="__proto__"?t(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},a=function(u,c){if(c==="__proto__")if(r.call(u,c)){if(n)return n(u,c).value}else return;return u[c]};return Ma=function l(){var u,c,f,p,h,g,v=arguments[0],d=1,m=arguments.length,y=!1;for(typeof v=="boolean"&&(y=v,v=arguments[1]||{},d=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});ds.length;let l;a&&s.push(i);try{l=r.apply(this,s)}catch(u){const c=u;if(a&&t)throw c;return i(c)}a||(l&&l.then&&typeof l.then=="function"?l.then(o,i):l instanceof Error?i(l):o(l))}function i(s,...a){t||(t=!0,e(s,...a))}function o(s){i(null,s)}}class Ft extends Error{constructor(e,t,n){super(),typeof t=="string"&&(n=t,t=void 0);let i="",o={},s=!1;if(t&&("line"in t&&"column"in t?o={place:t}:"start"in t&&"end"in t?o={place:t}:"type"in t?o={ancestors:[t],place:t.position}:o={...t}),typeof e=="string"?i=e:!o.cause&&e&&(s=!0,i=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof n=="string"){const l=n.indexOf(":");l===-1?o.ruleId=n:(o.source=n.slice(0,l),o.ruleId=n.slice(l+1))}if(!o.place&&o.ancestors&&o.ancestors){const l=o.ancestors[o.ancestors.length-1];l&&(o.place=l.position)}const a=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file,this.message=i,this.line=a?a.line:void 0,this.name=wi(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=s&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual,this.expected,this.note,this.url}}Ft.prototype.file="";Ft.prototype.name="";Ft.prototype.reason="";Ft.prototype.message="";Ft.prototype.stack="";Ft.prototype.column=void 0;Ft.prototype.line=void 0;Ft.prototype.ancestors=void 0;Ft.prototype.cause=void 0;Ft.prototype.fatal=void 0;Ft.prototype.place=void 0;Ft.prototype.ruleId=void 0;Ft.prototype.source=void 0;const an={basename:UA,dirname:zA,extname:jA,join:VA,sep:"/"};function UA(r,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Di(r);let t=0,n=-1,i=r.length,o;if(e===void 0||e.length===0||e.length>r.length){for(;i--;)if(r.codePointAt(i)===47){if(o){t=i+1;break}}else n<0&&(o=!0,n=i+1);return n<0?"":r.slice(t,n)}if(e===r)return"";let s=-1,a=e.length-1;for(;i--;)if(r.codePointAt(i)===47){if(o){t=i+1;break}}else s<0&&(o=!0,s=i+1),a>-1&&(r.codePointAt(i)===e.codePointAt(a--)?a<0&&(n=i):(a=-1,n=s));return t===n?n=s:n<0&&(n=r.length),r.slice(t,n)}function zA(r){if(Di(r),r.length===0)return".";let e=-1,t=r.length,n;for(;--t;)if(r.codePointAt(t)===47){if(n){e=t;break}}else n||(n=!0);return e<0?r.codePointAt(0)===47?"/":".":e===1&&r.codePointAt(0)===47?"//":r.slice(0,e)}function jA(r){Di(r);let e=r.length,t=-1,n=0,i=-1,o=0,s;for(;e--;){const a=r.codePointAt(e);if(a===47){if(s){n=e+1;break}continue}t<0&&(s=!0,t=e+1),a===46?i<0?i=e:o!==1&&(o=1):i>-1&&(o=-1)}return i<0||t<0||o===0||o===1&&i===t-1&&i===n+1?"":r.slice(i,t)}function VA(...r){let e=-1,t;for(;++e0&&r.codePointAt(r.length-1)===47&&(t+="/"),e?"/"+t:t}function $A(r,e){let t="",n=0,i=-1,o=0,s=-1,a,l;for(;++s<=r.length;){if(s2){if(l=t.lastIndexOf("/"),l!==t.length-1){l<0?(t="",n=0):(t=t.slice(0,l),n=t.length-1-t.lastIndexOf("/")),i=s,o=0;continue}}else if(t.length>0){t="",n=0,i=s,o=0;continue}}e&&(t=t.length>0?t+"/..":"..",n=2)}else t.length>0?t+="/"+r.slice(i+1,s):t=r.slice(i+1,s),n=s-i-1;i=s,o=0}else a===46&&o>-1?o++:o=-1}return t}function Di(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}const HA={cwd:XA};function XA(){return"/"}function Jl(r){return!!(r!==null&&typeof r=="object"&&"href"in r&&r.href&&"protocol"in r&&r.protocol&&r.auth===void 0)}function WA(r){if(typeof r=="string")r=new URL(r);else if(!Jl(r)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+r+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(r.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return qA(r)}function qA(r){if(r.hostname!==""){const n=new TypeError('File URL host must be "localhost" or empty on darwin');throw n.code="ERR_INVALID_FILE_URL_HOST",n}const e=r.pathname;let t=-1;for(;++t0){let[h,...g]=c;const v=n[p][1];Zl(v)&&Zl(h)&&(h=ka(!0,v,h)),n[p]=[u,h,...g]}}}}const QA=new Xu().freeze();function La(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `parser`")}function Na(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `compiler`")}function Da(r,e){if(e)throw new Error("Cannot call `"+r+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $h(r){if(!Zl(r)||typeof r.type!="string")throw new TypeError("Expected node, got `"+r+"`")}function Hh(r,e,t){if(!t)throw new Error("`"+r+"` finished async. Use `"+e+"` instead")}function ao(r){return eI(r)?r:new YA(r)}function eI(r){return!!(r&&typeof r=="object"&&"message"in r&&"messages"in r)}function tI(r){return typeof r=="string"||nI(r)}function nI(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}function Wu(){const r=QA().use(DC).use(FA).use(k2);return{process:e=>r.processSync(e).toString()}}function rI(r,e){return{role:"system",content:[r,av.map(t=>`- ${t}`).join(` +`),e].join(` + +`)}}function iI(r){const e=new Uint8Array(r.frequencyBinCount);r.getByteFrequencyData(e);const t=[];for(let i=0;i<700;i+=80)t.push(e[i]);return e.map(i=>i**1.2).map(i=>i*1.2).reduce((i,o)=>i+o,0)/e.length/100}function oI(r){const e=new Uint8Array(r.frequencyBinCount);r.getByteFrequencyData(e);const t=[];for(let u=0;u<700;u+=80)t.push(e[u]);const n=e.map(u=>u**1.5),i=Math.min(...n),s=Math.max(...n)-i;let a;return s===0?a=n.map(()=>0):a=n.map(u=>(u-i)/s),a.reduce((u,c)=>u+c,0)/e.length}function sI(r,e="linear"){switch(e){case"linear":return iI(r);case"minmax":return oI(r)}}const Tm=Zo("AudioContext",()=>({audioContext:new AudioContext,calculateVolume:sI})),aI=Zo("SpeakingStore",()=>{const t=le(0),n=le(!1),i=Ve(()=>n.value?(30+70*t.value)/100:30);return{mouthOpenSize:t,nowSpeaking:n,nowSpeakingAvatarBorderOpacity:i}});function lo(r,e,t){return e+t<0||e+t>=r.length-1?"":r[e+t]}function lI(r){let e="literal",t="";return{async consume(n){var i,o,s;for(let a=0;a"?(l+=lo(n,a,1),u="literal",a++):l==="<"?u="special":l===">"&&(u="literal"),e==="literal"&&u==="special"?t!==""&&(await((i=r.onLiteral)==null?void 0:i.call(r,t)),t=""):e==="special"&&u==="literal"&&t!==""&&(t+=l,await((o=r.onSpecial)==null?void 0:o.call(r,t)),t=""),e==="literal"&&u==="literal"?(await((s=r.onLiteral)==null?void 0:s.call(r,l)),t=""):e==="special"&&u==="literal"?t="":t+=l,e=u}},async end(){var n,i;t!==""&&(e==="literal"?await((n=r.onLiteral)==null?void 0:n.call(r,t)):t.endsWith("|>")&&await((i=r.onSpecial)==null?void 0:i.call(r,t)))}}}const uI=async r=>await(r.fetch??globalThis.fetch)(Fu("models",r.baseURL),{headers:Ru({"Content-Type":"application/json",...r.headers},r.apiKey),signal:r.abortSignal}).then(fS).then(({data:e})=>e),cI=async r=>{var e;return await(r.fetch??globalThis.fetch)(Fu("chat/completions",r.baseURL),{body:Bp({...r,tools:(e=r.tools)==null?void 0:e.map(t=>({function:t.function,type:"function"}))}),headers:Ru({"Content-Type":"application/json",...r.headers},r.apiKey),method:"POST",signal:r.abortSignal}).then(Lu)},Xh="data: ",fI='{"error":',hI=async r=>await cI({...r,stream:!0}).then(async e=>{const t=new TextDecoder;let n,i,o="";const s=e.body.pipeThrough(new TransformStream({transform:(c,f)=>{o+=t.decode(c);const p=o.split(` + +`);o=p.pop()||"";for(const h of p){if(!h||!h.startsWith(Xh))continue;if(h.startsWith(fI)){f.error(new Error(`Error from server: ${h}`));break}const g=h.slice(Xh.length);if(g==="[DONE]"){f.terminate();break}const v=JSON.parse(g);f.enqueue(v),v.choices[0].finish_reason&&(n=v.choices[0].finish_reason),v.usage&&(i=v.usage)}}})),[a,l]=s.tee(),u=l.pipeThrough(new TransformStream({transform:(c,f)=>f.enqueue(c.choices[0].delta.content)}));return{chunkStream:a,finishReason:n,textStream:u,usage:i}}),qu=Zo("llm",()=>{async function r(t,n,i,o){return await hI({baseURL:t.endsWith("/")?t:`${t}/`,apiKey:n,model:i,messages:o,streamOptions:{usage:!0}})}async function e(t,n){if(t==="")return[];try{return await uI({baseURL:t.endsWith("/")?t:`${t}/`,apiKey:n})}catch(i){if(String(i).includes("Failed to construct 'URL': Invalid URL"))return[];throw i}}return{models:e,stream:r}});async function*dI(r,e){const t=r.getReader();try{for(;;){const{done:n,value:i}=await t.read();if(n)return;yield e(i)}}finally{t.releaseLock()}}const vr=Zo("chat",()=>{const{stream:r}=qu(),{t:e}=Kr(),{openAiApiBaseURL:t,openAiApiKey:n,openAiModel:i}=Cn(Zr()),o=le([]),s=le([]),a=le([]),l=le([]),u=le([]),c=le([]),f=le([]);function p(b){o.value.push(b)}function h(b){s.value.push(b)}function g(b){a.value.push(b)}function v(b){l.value.push(b)}function d(b){u.value.push(b)}function m(b){c.value.push(b)}function y(b){f.value.push(b)}const _=le([rI(e("prompt.prefix"),e("prompt.suffix"))]),C=le({role:"assistant",content:""});async function x(b,E){if(!b)return;for(const G of o.value)await G(b);const{baseUrl:A=t.value,apiKey:M=n.value,model:I=i.value}=E??{};C.value={role:"assistant",content:""},_.value.push({role:"user",content:b}),_.value.push(C.value);const F=_.value.slice(0,_.value.length-1);for(const G of s.value)await G(b);for(const G of a.value)await G(b);const S=await r(A,M,I.id,F);for(const G of l.value)await G(b);let X="";const w=lI({onLiteral:async G=>{for(const R of u.value)await R(G);C.value.content+=G},onSpecial:async G=>{for(const R of c.value)await R(G)}});for await(const G of dI(S.textStream,async R=>R))X+=G,await w.consume(G);await w.end();for(const G of f.value)await G();console.debug("LLM output:",X)}return{messages:_,streamingMessage:C,send:x,onBeforeMessageComposed:p,onAfterMessageComposed:h,onBeforeSend:g,onAfterSend:v,onTokenLiteral:d,onTokenSpecial:m,onStreamEnd:y}});function uo(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Ba={exports:{}};/*! + +JSZip v3.10.1 - A JavaScript class for generating and reading zip files + + +(c) 2009-2016 Stuart Knightley +Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/main/LICENSE.markdown. + +JSZip uses the library pako released under the MIT license : +https://github.com/nodeca/pako/blob/main/LICENSE +*/var Wh;function pI(){return Wh||(Wh=1,function(r,e){(function(t){r.exports=t()})(function(){return function t(n,i,o){function s(u,c){if(!i[u]){if(!n[u]){var f=typeof uo=="function"&&uo;if(!c&&f)return f(u,!0);if(a)return a(u,!0);var p=new Error("Cannot find module '"+u+"'");throw p.code="MODULE_NOT_FOUND",p}var h=i[u]={exports:{}};n[u][0].call(h.exports,function(g){var v=n[u][1][g];return s(v||g)},h,h.exports,t,n,i,o)}return i[u].exports}for(var a=typeof uo=="function"&&uo,l=0;l>2,h=(3&u)<<4|c>>4,g=1<_?(15&c)<<2|f>>6:64,v=2<_?63&f:64,d.push(a.charAt(p)+a.charAt(h)+a.charAt(g)+a.charAt(v));return d.join("")},i.decode=function(l){var u,c,f,p,h,g,v=0,d=0,m="data:";if(l.substr(0,m.length)===m)throw new Error("Invalid base64 input, it looks like a data url.");var y,_=3*(l=l.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(l.charAt(l.length-1)===a.charAt(64)&&_--,l.charAt(l.length-2)===a.charAt(64)&&_--,_%1!=0)throw new Error("Invalid base64 input, bad content length.");for(y=s.uint8array?new Uint8Array(0|_):new Array(0|_);v>4,c=(15&p)<<4|(h=a.indexOf(l.charAt(v++)))>>2,f=(3&h)<<6|(g=a.indexOf(l.charAt(v++))),y[d++]=u,h!==64&&(y[d++]=c),g!==64&&(y[d++]=f);return y}},{"./support":30,"./utils":32}],2:[function(t,n,i){var o=t("./external"),s=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function u(c,f,p,h,g){this.compressedSize=c,this.uncompressedSize=f,this.crc32=p,this.compression=h,this.compressedContent=g}u.prototype={getContentWorker:function(){var c=new s(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),f=this;return c.on("end",function(){if(this.streamInfo.data_length!==f.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},getCompressedWorker:function(){return new s(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},u.createWorkerFrom=function(c,f,p){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(f.compressWorker(p)).pipe(new l("compressedSize")).withStreamInfo("compression",f)},n.exports=u},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,n,i){var o=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,n,i){var o=t("./utils"),s=function(){for(var a,l=[],u=0;u<256;u++){a=u;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[u]=a}return l}();n.exports=function(a,l){return a!==void 0&&a.length?o.getTypeOf(a)!=="string"?function(u,c,f,p){var h=s,g=p+f;u^=-1;for(var v=p;v>>8^h[255&(u^c[v])];return-1^u}(0|l,a,a.length,0):function(u,c,f,p){var h=s,g=p+f;u^=-1;for(var v=p;v>>8^h[255&(u^c.charCodeAt(v))];return-1^u}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(t,n,i){i.base64=!1,i.binary=!1,i.dir=!1,i.createFolders=!0,i.date=null,i.compression=null,i.compressionOptions=null,i.comment=null,i.unixPermissions=null,i.dosPermissions=null},{}],6:[function(t,n,i){var o=null;o=typeof Promise<"u"?Promise:t("lie"),n.exports={Promise:o}},{lie:37}],7:[function(t,n,i){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",s=t("pako"),a=t("./utils"),l=t("./stream/GenericWorker"),u=o?"uint8array":"array";function c(f,p){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=p,this.meta={}}i.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(f){this.meta=f.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(u,f.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new s[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var f=this;this._pako.onData=function(p){f.push({data:p,meta:f.meta})}},i.compressWorker=function(f){return new c("Deflate",f)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,n,i){function o(h,g){var v,d="";for(v=0;v>>=8;return d}function s(h,g,v,d,m,y){var _,C,x=h.file,b=h.compression,E=y!==u.utf8encode,A=a.transformTo("string",y(x.name)),M=a.transformTo("string",u.utf8encode(x.name)),I=x.comment,F=a.transformTo("string",y(I)),S=a.transformTo("string",u.utf8encode(I)),X=M.length!==x.name.length,w=S.length!==I.length,G="",R="",L="",N=x.dir,$=x.date,P={crc32:0,compressedSize:0,uncompressedSize:0};g&&!v||(P.crc32=h.crc32,P.compressedSize=h.compressedSize,P.uncompressedSize=h.uncompressedSize);var D=0;g&&(D|=8),E||!X&&!w||(D|=2048);var j=0,k=0;N&&(j|=16),m==="UNIX"?(k=798,j|=function(Q,ue){var de=Q;return Q||(de=ue?16893:33204),(65535&de)<<16}(x.unixPermissions,N)):(k=20,j|=function(Q){return 63&(Q||0)}(x.dosPermissions)),_=$.getUTCHours(),_<<=6,_|=$.getUTCMinutes(),_<<=5,_|=$.getUTCSeconds()/2,C=$.getUTCFullYear()-1980,C<<=4,C|=$.getUTCMonth()+1,C<<=5,C|=$.getUTCDate(),X&&(R=o(1,1)+o(c(A),4)+M,G+="up"+o(R.length,2)+R),w&&(L=o(1,1)+o(c(F),4)+S,G+="uc"+o(L.length,2)+L);var ee="";return ee+=` +\0`,ee+=o(D,2),ee+=b.magic,ee+=o(_,2),ee+=o(C,2),ee+=o(P.crc32,4),ee+=o(P.compressedSize,4),ee+=o(P.uncompressedSize,4),ee+=o(A.length,2),ee+=o(G.length,2),{fileRecord:f.LOCAL_FILE_HEADER+ee+A+G,dirRecord:f.CENTRAL_FILE_HEADER+o(k,2)+ee+o(F.length,2)+"\0\0\0\0"+o(j,4)+o(d,4)+A+G+F}}var a=t("../utils"),l=t("../stream/GenericWorker"),u=t("../utf8"),c=t("../crc32"),f=t("../signature");function p(h,g,v,d){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=v,this.encodeFileName=d,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(p,l),p.prototype.push=function(h){var g=h.meta.percent||0,v=this.entriesCount,d=this._sources.length;this.accumulate?this.contentBuffer.push(h):(this.bytesWritten+=h.data.length,l.prototype.push.call(this,{data:h.data,meta:{currentFile:this.currentFile,percent:v?(g+100*(v-d-1))/v:100}}))},p.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var g=this.streamFiles&&!h.file.dir;if(g){var v=s(h,g,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:v.fileRecord,meta:{percent:0}})}else this.accumulate=!0},p.prototype.closedSource=function(h){this.accumulate=!1;var g=this.streamFiles&&!h.file.dir,v=s(h,g,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(v.dirRecord),g)this.push({data:function(d){return f.DATA_DESCRIPTOR+o(d.crc32,4)+o(d.compressedSize,4)+o(d.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:v.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},p.prototype.flush=function(){for(var h=this.bytesWritten,g=0;g=this.index;l--)u=(u<<8)+this.byteAt(l);return this.index+=a,u},readString:function(a){return o.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date(Date.UTC(1980+(a>>25&127),(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1))}},n.exports=s},{"../utils":32}],19:[function(t,n,i){var o=t("./Uint8ArrayReader");function s(a){o.call(this,a)}t("../utils").inherits(s,o),s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=s},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,n,i){var o=t("./DataReader");function s(a){o.call(this,a)}t("../utils").inherits(s,o),s.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},s.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},s.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},s.prototype.readData=function(a){this.checkOffset(a);var l=this.data.slice(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=s},{"../utils":32,"./DataReader":18}],21:[function(t,n,i){var o=t("./ArrayReader");function s(a){o.call(this,a)}t("../utils").inherits(s,o),s.prototype.readData=function(a){if(this.checkOffset(a),a===0)return new Uint8Array(0);var l=this.data.subarray(this.zero+this.index,this.zero+this.index+a);return this.index+=a,l},n.exports=s},{"../utils":32,"./ArrayReader":17}],22:[function(t,n,i){var o=t("../utils"),s=t("../support"),a=t("./ArrayReader"),l=t("./StringReader"),u=t("./NodeBufferReader"),c=t("./Uint8ArrayReader");n.exports=function(f){var p=o.getTypeOf(f);return o.checkSupport(p),p!=="string"||s.uint8array?p==="nodebuffer"?new u(f):s.uint8array?new c(o.transformTo("uint8array",f)):new a(o.transformTo("array",f)):new l(f)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,n,i){i.LOCAL_FILE_HEADER="PK",i.CENTRAL_FILE_HEADER="PK",i.CENTRAL_DIRECTORY_END="PK",i.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",i.ZIP64_CENTRAL_DIRECTORY_END="PK",i.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(t,n,i){var o=t("./GenericWorker"),s=t("../utils");function a(l){o.call(this,"ConvertWorker to "+l),this.destType=l}s.inherits(a,o),a.prototype.processChunk=function(l){this.push({data:s.transformTo(this.destType,l.data),meta:l.meta})},n.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,n,i){var o=t("./GenericWorker"),s=t("../crc32");function a(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,o),a.prototype.processChunk=function(l){this.streamInfo.crc32=s(l.data,this.streamInfo.crc32||0),this.push(l)},n.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,n,i){var o=t("../utils"),s=t("./GenericWorker");function a(l){s.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}o.inherits(a,s),a.prototype.processChunk=function(l){if(l){var u=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=u+l.data.length}s.prototype.processChunk.call(this,l)},n.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,n,i){var o=t("../utils"),s=t("./GenericWorker");function a(l){s.call(this,"DataWorker");var u=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){u.dataIsReady=!0,u.data=c,u.max=c&&c.length||0,u.type=o.getTypeOf(c),u.isPaused||u._tickAndRepeat()},function(c){u.error(c)})}o.inherits(a,s),a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!s.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,u=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":l=this.data.substring(this.index,u);break;case"uint8array":l=this.data.subarray(this.index,u);break;case"array":case"nodebuffer":l=this.data.slice(this.index,u)}return this.index=u,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},n.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,n,i){function o(s){this.name=s||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(s){this.emit("data",s)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(s){this.emit("error",s)}return!0},error:function(s){return!this.isFinished&&(this.isPaused?this.generatedError=s:(this.isFinished=!0,this.emit("error",s),this.previous&&this.previous.error(s),this.cleanUp()),!0)},on:function(s,a){return this._listeners[s].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(s,a){if(this._listeners[s])for(var l=0;l "+s:s}},n.exports=o},{}],29:[function(t,n,i){var o=t("../utils"),s=t("./ConvertWorker"),a=t("./GenericWorker"),l=t("../base64"),u=t("../support"),c=t("../external"),f=null;if(u.nodestream)try{f=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function p(g,v){return new c.Promise(function(d,m){var y=[],_=g._internalType,C=g._outputType,x=g._mimeType;g.on("data",function(b,E){y.push(b),v&&v(E)}).on("error",function(b){y=[],m(b)}).on("end",function(){try{var b=function(E,A,M){switch(E){case"blob":return o.newBlob(o.transformTo("arraybuffer",A),M);case"base64":return l.encode(A);default:return o.transformTo(E,A)}}(C,function(E,A){var M,I=0,F=null,S=0;for(M=0;M"u")i.blob=!1;else{var o=new ArrayBuffer(0);try{i.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(o),i.blob=s.getBlob("application/zip").size===0}catch{i.blob=!1}}}try{i.nodestream=!!t("readable-stream").Readable}catch{i.nodestream=!1}},{"readable-stream":16}],31:[function(t,n,i){for(var o=t("./utils"),s=t("./support"),a=t("./nodejsUtils"),l=t("./stream/GenericWorker"),u=new Array(256),c=0;c<256;c++)u[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;u[254]=u[254]=1;function f(){l.call(this,"utf-8 decode"),this.leftOver=null}function p(){l.call(this,"utf-8 encode")}i.utf8encode=function(h){return s.nodebuffer?a.newBufferFrom(h,"utf-8"):function(g){var v,d,m,y,_,C=g.length,x=0;for(y=0;y>>6:(d<65536?v[_++]=224|d>>>12:(v[_++]=240|d>>>18,v[_++]=128|d>>>12&63),v[_++]=128|d>>>6&63),v[_++]=128|63&d);return v}(h)},i.utf8decode=function(h){return s.nodebuffer?o.transformTo("nodebuffer",h).toString("utf-8"):function(g){var v,d,m,y,_=g.length,C=new Array(2*_);for(v=d=0;v<_;)if((m=g[v++])<128)C[d++]=m;else if(4<(y=u[m]))C[d++]=65533,v+=y-1;else{for(m&=y===2?31:y===3?15:7;1>10&1023,C[d++]=56320|1023&m)}return C.length!==d&&(C.subarray?C=C.subarray(0,d):C.length=d),o.applyFromCharCode(C)}(h=o.transformTo(s.uint8array?"uint8array":"array",h))},o.inherits(f,l),f.prototype.processChunk=function(h){var g=o.transformTo(s.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(s.uint8array){var v=g;(g=new Uint8Array(v.length+this.leftOver.length)).set(this.leftOver,0),g.set(v,this.leftOver.length)}else g=this.leftOver.concat(g);this.leftOver=null}var d=function(y,_){var C;for((_=_||y.length)>y.length&&(_=y.length),C=_-1;0<=C&&(192&y[C])==128;)C--;return C<0||C===0?_:C+u[y[C]]>_?C:_}(g),m=g;d!==g.length&&(s.uint8array?(m=g.subarray(0,d),this.leftOver=g.subarray(d,g.length)):(m=g.slice(0,d),this.leftOver=g.slice(d,g.length))),this.push({data:i.utf8decode(m),meta:h.meta})},f.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=f,o.inherits(p,l),p.prototype.processChunk=function(h){this.push({data:i.utf8encode(h.data),meta:h.meta})},i.Utf8EncodeWorker=p},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,n,i){var o=t("./support"),s=t("./base64"),a=t("./nodejsUtils"),l=t("./external");function u(v){return v}function c(v,d){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=o(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var g,v,d,m=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?p[d++]=224|h>>>12:(p[d++]=240|h>>>18,p[d++]=128|h>>>12&63),p[d++]=128|h>>>6&63),p[d++]=128|63&h);return p},i.buf2binstring=function(f){return c(f,f.length)},i.binstring2buf=function(f){for(var p=new o.Buf8(f.length),h=0,g=p.length;h>10&1023,y[g++]=56320|1023&v)}return c(y,g)},i.utf8border=function(f,p){var h;for((p=p||f.length)>f.length&&(p=f.length),h=p-1;0<=h&&(192&f[h])==128;)h--;return h<0||h===0?p:h+l[f[h]]>p?h:p}},{"./common":41}],43:[function(t,n,i){n.exports=function(o,s,a,l){for(var u=65535&o|0,c=o>>>16&65535|0,f=0;a!==0;){for(a-=f=2e3>>1:s>>>1;a[l]=s}return a}();n.exports=function(s,a,l,u){var c=o,f=u+l;s^=-1;for(var p=u;p>>8^c[255&(s^a[p])];return-1^s}},{}],46:[function(t,n,i){var o,s=t("../utils/common"),a=t("./trees"),l=t("./adler32"),u=t("./crc32"),c=t("./messages"),f=0,p=4,h=0,g=-2,v=-1,d=4,m=2,y=8,_=9,C=286,x=30,b=19,E=2*C+1,A=15,M=3,I=258,F=I+M+1,S=42,X=113,w=1,G=2,R=3,L=4;function N(T,J){return T.msg=c[J],J}function $(T){return(T<<1)-(4T.avail_out&&(H=T.avail_out),H!==0&&(s.arraySet(T.output,J.pending_buf,J.pending_out,H,T.next_out),T.next_out+=H,J.pending_out+=H,T.total_out+=H,T.avail_out-=H,J.pending-=H,J.pending===0&&(J.pending_out=0))}function j(T,J){a._tr_flush_block(T,0<=T.block_start?T.block_start:-1,T.strstart-T.block_start,J),T.block_start=T.strstart,D(T.strm)}function k(T,J){T.pending_buf[T.pending++]=J}function ee(T,J){T.pending_buf[T.pending++]=J>>>8&255,T.pending_buf[T.pending++]=255&J}function Q(T,J){var H,z,V=T.max_chain_length,Z=T.strstart,se=T.prev_length,ae=T.nice_match,te=T.strstart>T.w_size-F?T.strstart-(T.w_size-F):0,fe=T.window,ye=T.w_mask,pe=T.prev,re=T.strstart+I,ce=fe[Z+se-1],me=fe[Z+se];T.prev_length>=T.good_match&&(V>>=2),ae>T.lookahead&&(ae=T.lookahead);do if(fe[(H=J)+se]===me&&fe[H+se-1]===ce&&fe[H]===fe[Z]&&fe[++H]===fe[Z+1]){Z+=2,H++;do;while(fe[++Z]===fe[++H]&&fe[++Z]===fe[++H]&&fe[++Z]===fe[++H]&&fe[++Z]===fe[++H]&&fe[++Z]===fe[++H]&&fe[++Z]===fe[++H]&&fe[++Z]===fe[++H]&&fe[++Z]===fe[++H]&&Zte&&--V!=0);return se<=T.lookahead?se:T.lookahead}function ue(T){var J,H,z,V,Z,se,ae,te,fe,ye,pe=T.w_size;do{if(V=T.window_size-T.lookahead-T.strstart,T.strstart>=pe+(pe-F)){for(s.arraySet(T.window,T.window,pe,pe,0),T.match_start-=pe,T.strstart-=pe,T.block_start-=pe,J=H=T.hash_size;z=T.head[--J],T.head[J]=pe<=z?z-pe:0,--H;);for(J=H=pe;z=T.prev[--J],T.prev[J]=pe<=z?z-pe:0,--H;);V+=pe}if(T.strm.avail_in===0)break;if(se=T.strm,ae=T.window,te=T.strstart+T.lookahead,fe=V,ye=void 0,ye=se.avail_in,fe=M)for(Z=T.strstart-T.insert,T.ins_h=T.window[Z],T.ins_h=(T.ins_h<=M&&(T.ins_h=(T.ins_h<=M)if(z=a._tr_tally(T,T.strstart-T.match_start,T.match_length-M),T.lookahead-=T.match_length,T.match_length<=T.max_lazy_match&&T.lookahead>=M){for(T.match_length--;T.strstart++,T.ins_h=(T.ins_h<=M&&(T.ins_h=(T.ins_h<=M&&T.match_length<=T.prev_length){for(V=T.strstart+T.lookahead-M,z=a._tr_tally(T,T.strstart-1-T.prev_match,T.prev_length-M),T.lookahead-=T.prev_length-1,T.prev_length-=2;++T.strstart<=V&&(T.ins_h=(T.ins_h<T.pending_buf_size-5&&(H=T.pending_buf_size-5);;){if(T.lookahead<=1){if(ue(T),T.lookahead===0&&J===f)return w;if(T.lookahead===0)break}T.strstart+=T.lookahead,T.lookahead=0;var z=T.block_start+H;if((T.strstart===0||T.strstart>=z)&&(T.lookahead=T.strstart-z,T.strstart=z,j(T,!1),T.strm.avail_out===0)||T.strstart-T.block_start>=T.w_size-F&&(j(T,!1),T.strm.avail_out===0))return w}return T.insert=0,J===p?(j(T,!0),T.strm.avail_out===0?R:L):(T.strstart>T.block_start&&(j(T,!1),T.strm.avail_out),w)}),new O(4,4,8,4,de),new O(4,5,16,8,de),new O(4,6,32,32,de),new O(4,4,16,16,ne),new O(8,16,32,32,ne),new O(8,16,128,128,ne),new O(8,32,128,256,ne),new O(32,128,258,1024,ne),new O(32,258,258,4096,ne)],i.deflateInit=function(T,J){return ie(T,J,y,15,8,0)},i.deflateInit2=ie,i.deflateReset=oe,i.deflateResetKeep=W,i.deflateSetHeader=function(T,J){return T&&T.state?T.state.wrap!==2?g:(T.state.gzhead=J,h):g},i.deflate=function(T,J){var H,z,V,Z;if(!T||!T.state||5>8&255),k(z,z.gzhead.time>>16&255),k(z,z.gzhead.time>>24&255),k(z,z.level===9?2:2<=z.strategy||z.level<2?4:0),k(z,255&z.gzhead.os),z.gzhead.extra&&z.gzhead.extra.length&&(k(z,255&z.gzhead.extra.length),k(z,z.gzhead.extra.length>>8&255)),z.gzhead.hcrc&&(T.adler=u(T.adler,z.pending_buf,z.pending,0)),z.gzindex=0,z.status=69):(k(z,0),k(z,0),k(z,0),k(z,0),k(z,0),k(z,z.level===9?2:2<=z.strategy||z.level<2?4:0),k(z,3),z.status=X);else{var se=y+(z.w_bits-8<<4)<<8;se|=(2<=z.strategy||z.level<2?0:z.level<6?1:z.level===6?2:3)<<6,z.strstart!==0&&(se|=32),se+=31-se%31,z.status=X,ee(z,se),z.strstart!==0&&(ee(z,T.adler>>>16),ee(z,65535&T.adler)),T.adler=1}if(z.status===69)if(z.gzhead.extra){for(V=z.pending;z.gzindex<(65535&z.gzhead.extra.length)&&(z.pending!==z.pending_buf_size||(z.gzhead.hcrc&&z.pending>V&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),D(T),V=z.pending,z.pending!==z.pending_buf_size));)k(z,255&z.gzhead.extra[z.gzindex]),z.gzindex++;z.gzhead.hcrc&&z.pending>V&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),z.gzindex===z.gzhead.extra.length&&(z.gzindex=0,z.status=73)}else z.status=73;if(z.status===73)if(z.gzhead.name){V=z.pending;do{if(z.pending===z.pending_buf_size&&(z.gzhead.hcrc&&z.pending>V&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),D(T),V=z.pending,z.pending===z.pending_buf_size)){Z=1;break}Z=z.gzindexV&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),Z===0&&(z.gzindex=0,z.status=91)}else z.status=91;if(z.status===91)if(z.gzhead.comment){V=z.pending;do{if(z.pending===z.pending_buf_size&&(z.gzhead.hcrc&&z.pending>V&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),D(T),V=z.pending,z.pending===z.pending_buf_size)){Z=1;break}Z=z.gzindexV&&(T.adler=u(T.adler,z.pending_buf,z.pending-V,V)),Z===0&&(z.status=103)}else z.status=103;if(z.status===103&&(z.gzhead.hcrc?(z.pending+2>z.pending_buf_size&&D(T),z.pending+2<=z.pending_buf_size&&(k(z,255&T.adler),k(z,T.adler>>8&255),T.adler=0,z.status=X)):z.status=X),z.pending!==0){if(D(T),T.avail_out===0)return z.last_flush=-1,h}else if(T.avail_in===0&&$(J)<=$(H)&&J!==p)return N(T,-5);if(z.status===666&&T.avail_in!==0)return N(T,-5);if(T.avail_in!==0||z.lookahead!==0||J!==f&&z.status!==666){var ae=z.strategy===2?function(te,fe){for(var ye;;){if(te.lookahead===0&&(ue(te),te.lookahead===0)){if(fe===f)return w;break}if(te.match_length=0,ye=a._tr_tally(te,0,te.window[te.strstart]),te.lookahead--,te.strstart++,ye&&(j(te,!1),te.strm.avail_out===0))return w}return te.insert=0,fe===p?(j(te,!0),te.strm.avail_out===0?R:L):te.last_lit&&(j(te,!1),te.strm.avail_out===0)?w:G}(z,J):z.strategy===3?function(te,fe){for(var ye,pe,re,ce,me=te.window;;){if(te.lookahead<=I){if(ue(te),te.lookahead<=I&&fe===f)return w;if(te.lookahead===0)break}if(te.match_length=0,te.lookahead>=M&&0te.lookahead&&(te.match_length=te.lookahead)}if(te.match_length>=M?(ye=a._tr_tally(te,1,te.match_length-M),te.lookahead-=te.match_length,te.strstart+=te.match_length,te.match_length=0):(ye=a._tr_tally(te,0,te.window[te.strstart]),te.lookahead--,te.strstart++),ye&&(j(te,!1),te.strm.avail_out===0))return w}return te.insert=0,fe===p?(j(te,!0),te.strm.avail_out===0?R:L):te.last_lit&&(j(te,!1),te.strm.avail_out===0)?w:G}(z,J):o[z.level].func(z,J);if(ae!==R&&ae!==L||(z.status=666),ae===w||ae===R)return T.avail_out===0&&(z.last_flush=-1),h;if(ae===G&&(J===1?a._tr_align(z):J!==5&&(a._tr_stored_block(z,0,0,!1),J===3&&(P(z.head),z.lookahead===0&&(z.strstart=0,z.block_start=0,z.insert=0))),D(T),T.avail_out===0))return z.last_flush=-1,h}return J!==p?h:z.wrap<=0?1:(z.wrap===2?(k(z,255&T.adler),k(z,T.adler>>8&255),k(z,T.adler>>16&255),k(z,T.adler>>24&255),k(z,255&T.total_in),k(z,T.total_in>>8&255),k(z,T.total_in>>16&255),k(z,T.total_in>>24&255)):(ee(z,T.adler>>>16),ee(z,65535&T.adler)),D(T),0=H.w_size&&(Z===0&&(P(H.head),H.strstart=0,H.block_start=0,H.insert=0),fe=new s.Buf8(H.w_size),s.arraySet(fe,J,ye-H.w_size,H.w_size,0),J=fe,ye=H.w_size),se=T.avail_in,ae=T.next_in,te=T.input,T.avail_in=ye,T.next_in=0,T.input=J,ue(H);H.lookahead>=M;){for(z=H.strstart,V=H.lookahead-(M-1);H.ins_h=(H.ins_h<>>=M=A>>>24,_-=M,(M=A>>>16&255)===0)G[c++]=65535&A;else{if(!(16&M)){if(!(64&M)){A=C[(65535&A)+(y&(1<>>=M,_-=M),_<15&&(y+=w[l++]<<_,_+=8,y+=w[l++]<<_,_+=8),A=x[y&E];n:for(;;){if(y>>>=M=A>>>24,_-=M,!(16&(M=A>>>16&255))){if(!(64&M)){A=x[(65535&A)+(y&(1<>>=M,_-=M,(M=c-f)>3,y&=(1<<(_-=I<<3))-1,o.next_in=l,o.next_out=c,o.avail_in=l>>24&255)+(S>>>8&65280)+((65280&S)<<8)+((255&S)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(S){var X;return S&&S.state?(X=S.state,S.total_in=S.total_out=X.total=0,S.msg="",X.wrap&&(S.adler=1&X.wrap),X.mode=g,X.last=0,X.havedict=0,X.dmax=32768,X.head=null,X.hold=0,X.bits=0,X.lencode=X.lendyn=new o.Buf32(v),X.distcode=X.distdyn=new o.Buf32(d),X.sane=1,X.back=-1,p):h}function C(S){var X;return S&&S.state?((X=S.state).wsize=0,X.whave=0,X.wnext=0,_(S)):h}function x(S,X){var w,G;return S&&S.state?(G=S.state,X<0?(w=0,X=-X):(w=1+(X>>4),X<48&&(X&=15)),X&&(X<8||15=L.wsize?(o.arraySet(L.window,X,w-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(G<(R=L.wsize-L.wnext)&&(R=G),o.arraySet(L.window,X,w-G,R,L.wnext),(G-=R)?(o.arraySet(L.window,X,w-G,G,0),L.wnext=G,L.whave=L.wsize):(L.wnext+=R,L.wnext===L.wsize&&(L.wnext=0),L.whave>>8&255,w.check=a(w.check,Z,2,0),j=D=0,w.mode=2;break}if(w.flags=0,w.head&&(w.head.done=!1),!(1&w.wrap)||(((255&D)<<8)+(D>>8))%31){S.msg="incorrect header check",w.mode=30;break}if((15&D)!=8){S.msg="unknown compression method",w.mode=30;break}if(j-=4,T=8+(15&(D>>>=4)),w.wbits===0)w.wbits=T;else if(T>w.wbits){S.msg="invalid window size",w.mode=30;break}w.dmax=1<>8&1),512&w.flags&&(Z[0]=255&D,Z[1]=D>>>8&255,w.check=a(w.check,Z,2,0)),j=D=0,w.mode=3;case 3:for(;j<32;){if($===0)break e;$--,D+=G[L++]<>>8&255,Z[2]=D>>>16&255,Z[3]=D>>>24&255,w.check=a(w.check,Z,4,0)),j=D=0,w.mode=4;case 4:for(;j<16;){if($===0)break e;$--,D+=G[L++]<>8),512&w.flags&&(Z[0]=255&D,Z[1]=D>>>8&255,w.check=a(w.check,Z,2,0)),j=D=0,w.mode=5;case 5:if(1024&w.flags){for(;j<16;){if($===0)break e;$--,D+=G[L++]<>>8&255,w.check=a(w.check,Z,2,0)),j=D=0}else w.head&&(w.head.extra=null);w.mode=6;case 6:if(1024&w.flags&&($<(Q=w.length)&&(Q=$),Q&&(w.head&&(T=w.head.extra_len-w.length,w.head.extra||(w.head.extra=new Array(w.head.extra_len)),o.arraySet(w.head.extra,G,L,Q,T)),512&w.flags&&(w.check=a(w.check,G,Q,L)),$-=Q,L+=Q,w.length-=Q),w.length))break e;w.length=0,w.mode=7;case 7:if(2048&w.flags){if($===0)break e;for(Q=0;T=G[L+Q++],w.head&&T&&w.length<65536&&(w.head.name+=String.fromCharCode(T)),T&&Q<$;);if(512&w.flags&&(w.check=a(w.check,G,Q,L)),$-=Q,L+=Q,T)break e}else w.head&&(w.head.name=null);w.length=0,w.mode=8;case 8:if(4096&w.flags){if($===0)break e;for(Q=0;T=G[L+Q++],w.head&&T&&w.length<65536&&(w.head.comment+=String.fromCharCode(T)),T&&Q<$;);if(512&w.flags&&(w.check=a(w.check,G,Q,L)),$-=Q,L+=Q,T)break e}else w.head&&(w.head.comment=null);w.mode=9;case 9:if(512&w.flags){for(;j<16;){if($===0)break e;$--,D+=G[L++]<>9&1,w.head.done=!0),S.adler=w.check=0,w.mode=12;break;case 10:for(;j<32;){if($===0)break e;$--,D+=G[L++]<>>=7&j,j-=7&j,w.mode=27;break}for(;j<3;){if($===0)break e;$--,D+=G[L++]<>>=1)){case 0:w.mode=14;break;case 1:if(I(w),w.mode=20,X!==6)break;D>>>=2,j-=2;break e;case 2:w.mode=17;break;case 3:S.msg="invalid block type",w.mode=30}D>>>=2,j-=2;break;case 14:for(D>>>=7&j,j-=7&j;j<32;){if($===0)break e;$--,D+=G[L++]<>>16^65535)){S.msg="invalid stored block lengths",w.mode=30;break}if(w.length=65535&D,j=D=0,w.mode=15,X===6)break e;case 15:w.mode=16;case 16:if(Q=w.length){if($>>=5,j-=5,w.ndist=1+(31&D),D>>>=5,j-=5,w.ncode=4+(15&D),D>>>=4,j-=4,286>>=3,j-=3}for(;w.have<19;)w.lens[se[w.have++]]=0;if(w.lencode=w.lendyn,w.lenbits=7,H={bits:w.lenbits},J=u(0,w.lens,0,19,w.lencode,0,w.work,H),w.lenbits=H.bits,J){S.msg="invalid code lengths set",w.mode=30;break}w.have=0,w.mode=19;case 19:for(;w.have>>16&255,B=65535&V,!((ne=V>>>24)<=j);){if($===0)break e;$--,D+=G[L++]<>>=ne,j-=ne,w.lens[w.have++]=B;else{if(B===16){for(z=ne+2;j>>=ne,j-=ne,w.have===0){S.msg="invalid bit length repeat",w.mode=30;break}T=w.lens[w.have-1],Q=3+(3&D),D>>>=2,j-=2}else if(B===17){for(z=ne+3;j>>=ne)),D>>>=3,j-=3}else{for(z=ne+7;j>>=ne)),D>>>=7,j-=7}if(w.have+Q>w.nlen+w.ndist){S.msg="invalid bit length repeat",w.mode=30;break}for(;Q--;)w.lens[w.have++]=T}}if(w.mode===30)break;if(w.lens[256]===0){S.msg="invalid code -- missing end-of-block",w.mode=30;break}if(w.lenbits=9,H={bits:w.lenbits},J=u(c,w.lens,0,w.nlen,w.lencode,0,w.work,H),w.lenbits=H.bits,J){S.msg="invalid literal/lengths set",w.mode=30;break}if(w.distbits=6,w.distcode=w.distdyn,H={bits:w.distbits},J=u(f,w.lens,w.nlen,w.ndist,w.distcode,0,w.work,H),w.distbits=H.bits,J){S.msg="invalid distances set",w.mode=30;break}if(w.mode=20,X===6)break e;case 20:w.mode=21;case 21:if(6<=$&&258<=P){S.next_out=N,S.avail_out=P,S.next_in=L,S.avail_in=$,w.hold=D,w.bits=j,l(S,ee),N=S.next_out,R=S.output,P=S.avail_out,L=S.next_in,G=S.input,$=S.avail_in,D=w.hold,j=w.bits,w.mode===12&&(w.back=-1);break}for(w.back=0;O=(V=w.lencode[D&(1<>>16&255,B=65535&V,!((ne=V>>>24)<=j);){if($===0)break e;$--,D+=G[L++]<>W)])>>>16&255,B=65535&V,!(W+(ne=V>>>24)<=j);){if($===0)break e;$--,D+=G[L++]<>>=W,j-=W,w.back+=W}if(D>>>=ne,j-=ne,w.back+=ne,w.length=B,O===0){w.mode=26;break}if(32&O){w.back=-1,w.mode=12;break}if(64&O){S.msg="invalid literal/length code",w.mode=30;break}w.extra=15&O,w.mode=22;case 22:if(w.extra){for(z=w.extra;j>>=w.extra,j-=w.extra,w.back+=w.extra}w.was=w.length,w.mode=23;case 23:for(;O=(V=w.distcode[D&(1<>>16&255,B=65535&V,!((ne=V>>>24)<=j);){if($===0)break e;$--,D+=G[L++]<>W)])>>>16&255,B=65535&V,!(W+(ne=V>>>24)<=j);){if($===0)break e;$--,D+=G[L++]<>>=W,j-=W,w.back+=W}if(D>>>=ne,j-=ne,w.back+=ne,64&O){S.msg="invalid distance code",w.mode=30;break}w.offset=B,w.extra=15&O,w.mode=24;case 24:if(w.extra){for(z=w.extra;j>>=w.extra,j-=w.extra,w.back+=w.extra}if(w.offset>w.dmax){S.msg="invalid distance too far back",w.mode=30;break}w.mode=25;case 25:if(P===0)break e;if(Q=ee-P,w.offset>Q){if((Q=w.offset-Q)>w.whave&&w.sane){S.msg="invalid distance too far back",w.mode=30;break}ue=Q>w.wnext?(Q-=w.wnext,w.wsize-Q):w.wnext-Q,Q>w.length&&(Q=w.length),de=w.window}else de=R,ue=N-w.offset,Q=w.length;for(PE?(M=ue[de+d[X]],j[k+d[X]]):(M=96,0),y=1<>N)+(_-=y)]=A<<24|M<<16|I|0,_!==0;);for(y=1<>=1;if(y!==0?(D&=y-1,D+=y):D=0,X++,--ee[S]==0){if(S===G)break;S=f[p+d[X]]}if(R>>7)]}function k(V,Z){V.pending_buf[V.pending++]=255&Z,V.pending_buf[V.pending++]=Z>>>8&255}function ee(V,Z,se){V.bi_valid>m-se?(V.bi_buf|=Z<>m-V.bi_valid,V.bi_valid+=se-m):(V.bi_buf|=Z<>>=1,se<<=1,0<--Z;);return se>>>1}function de(V,Z,se){var ae,te,fe=new Array(d+1),ye=0;for(ae=1;ae<=d;ae++)fe[ae]=ye=ye+se[ae-1]<<1;for(te=0;te<=Z;te++){var pe=V[2*te+1];pe!==0&&(V[2*te]=ue(fe[pe]++,pe))}}function ne(V){var Z;for(Z=0;Z>1;1<=se;se--)W(V,fe,se);for(te=re;se=V.heap[1],V.heap[1]=V.heap[V.heap_len--],W(V,fe,1),ae=V.heap[1],V.heap[--V.heap_max]=se,V.heap[--V.heap_max]=ae,fe[2*te]=fe[2*se]+fe[2*ae],V.depth[te]=(V.depth[se]>=V.depth[ae]?V.depth[se]:V.depth[ae])+1,fe[2*se+1]=fe[2*ae+1]=te,V.heap[1]=te++,W(V,fe,1),2<=V.heap_len;);V.heap[--V.heap_max]=V.heap[1],function(me,xe){var Ae,Xe,tt,Oe,ft,U,q=xe.dyn_tree,ve=xe.max_code,we=xe.stat_desc.static_tree,Ne=xe.stat_desc.has_stree,Ee=xe.stat_desc.extra_bits,Ct=xe.stat_desc.extra_base,At=xe.stat_desc.max_length,We=0;for(Oe=0;Oe<=d;Oe++)me.bl_count[Oe]=0;for(q[2*me.heap[me.heap_max]+1]=0,Ae=me.heap_max+1;Ae>=7;te>>=1)if(1&ce&&pe.dyn_ltree[2*re]!==0)return s;if(pe.dyn_ltree[18]!==0||pe.dyn_ltree[20]!==0||pe.dyn_ltree[26]!==0)return a;for(re=32;re>>3,(fe=V.static_len+3+7>>>3)<=te&&(te=fe)):te=fe=se+5,se+4<=te&&Z!==-1?z(V,Z,se,ae):V.strategy===4||fe===te?(ee(V,2+(ae?1:0),3),oe(V,F,S)):(ee(V,4+(ae?1:0),3),function(pe,re,ce,me){var xe;for(ee(pe,re-257,5),ee(pe,ce-1,5),ee(pe,me-4,4),xe=0;xe>>8&255,V.pending_buf[V.d_buf+2*V.last_lit+1]=255&Z,V.pending_buf[V.l_buf+V.last_lit]=255&se,V.last_lit++,Z===0?V.dyn_ltree[2*se]++:(V.matches++,Z--,V.dyn_ltree[2*(w[se]+f+1)]++,V.dyn_dtree[2*j(Z)]++),V.last_lit===V.lit_bufsize-1},i._tr_align=function(V){ee(V,2,3),Q(V,_,F),function(Z){Z.bi_valid===16?(k(Z,Z.bi_buf),Z.bi_buf=0,Z.bi_valid=0):8<=Z.bi_valid&&(Z.pending_buf[Z.pending++]=255&Z.bi_buf,Z.bi_buf>>=8,Z.bi_valid-=8)}(V)}},{"../utils/common":41}],53:[function(t,n,i){n.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(t,n,i){(function(o){(function(s,a){if(!s.setImmediate){var l,u,c,f,p=1,h={},g=!1,v=s.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(s);d=d&&d.setTimeout?d:s,l={}.toString.call(s.process)==="[object process]"?function(C){process.nextTick(function(){y(C)})}:function(){if(s.postMessage&&!s.importScripts){var C=!0,x=s.onmessage;return s.onmessage=function(){C=!1},s.postMessage("","*"),s.onmessage=x,C}}()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",_,!1):s.attachEvent("onmessage",_),function(C){s.postMessage(f+C,"*")}):s.MessageChannel?((c=new MessageChannel).port1.onmessage=function(C){y(C.data)},function(C){c.port2.postMessage(C)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(C){var x=v.createElement("script");x.onreadystatechange=function(){y(C),x.onreadystatechange=null,u.removeChild(x),x=null},u.appendChild(x)}):function(C){setTimeout(y,0,C)},d.setImmediate=function(C){typeof C!="function"&&(C=new Function(""+C));for(var x=new Array(arguments.length-1),b=0;b"u"?o===void 0?this:o:self)}).call(this,typeof Nn<"u"?Nn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}(Ba)),Ba.exports}var mI=pI();const gI=tu(mI);$n.zipReader=(r,e)=>gI.loadAsync(r);$n.readText=(r,e)=>{const t=r.file(e);if(!t)throw new Error(`Cannot find file: ${e}`);return t.async("text")};$n.getFilePaths=r=>{const e=[];return r.forEach(t=>e.push(t)),Promise.resolve(e)};$n.getFiles=(r,e)=>Promise.all(e.map(async t=>{const n=t.slice(t.lastIndexOf("/")+1),i=await r.file(t).async("blob");return new File([i],n)}));const vI={relative:""},yI={"h-full":"","w-full":""},_I={key:0,class:"animate-stripe",absolute:"",left:"1/2",bottom:"20%",z:"20","rounded-2xl":"",text:"pink-600","px-2":"","py-2":"",transform:"translate-x--1/2"},xI={bg:"pink-50","rounded-xl":"","px-10":"","py-6":""},bI=["innerHTML"],wI=De({__name:"Stage",setup(r){const e=le(),t=le(),{stageView:n,elevenLabsApiKey:i,elevenlabsVoiceEnglish:o,elevenlabsVoiceJapanese:s}=Cn(Zr()),{mouthOpenSize:a}=Cn(aI()),{audioContext:l,calculateVolume:u}=Tm(),{onBeforeMessageComposed:c,onBeforeSend:f,onTokenLiteral:p,onTokenSpecial:h,onStreamEnd:g,streamingMessage:v}=vr(),{process:d}=Wu(),{locale:m}=Kr(),y=le(),_=le(!1),C=le(!1),x=_s({handlers:[w=>new Promise(G=>{const R=l.createBufferSource();R.buffer=w.data.audioBuffer,R.connect(l.destination),R.connect(y.value),_.value=!0,R.start(0),R.onended=()=>{_.value=!1,G()}})]}),b=_s({handlers:[async w=>{let G=Ng.Camilla_KM;m.value==="jp"||m.value==="jp-JP"?G=s.value:G=o.value;const R=Date.now(),L=pS({apiKey:i.value,baseURL:"https://unspeech.hyp3r.link/v1/"}),N=await hS({...L.speech("eleven_multilingual_v2",{voiceSettings:{stability:.4,similarityBoost:.5}}),input:w.data,voice:Dg[G]}),$=Date.now()-R;console.debug("TTS took",$,"ms");const P=await l.decodeAudioData(N);await x.add({audioBuffer:P,text:w.data})}]});b.on("add",w=>{console.debug("ttsQueue added",w)});const E=lv(b),A=_s({handlers:[async w=>{if(n.value==="3d"){const G=hv[w.data];if(!G)return;await t.value.setExpression(G)}else n.value==="2d"&&await e.value.setMotion(dv[w.data])}]}),M=uv(A);M.onHandlerEvent("emotion",w=>{console.debug("emotion detected",w)});const I=cv();I.onHandlerEvent("delay",w=>{console.debug("delay detected",w)});function F(){requestAnimationFrame(F),_.value&&(a.value=u(y.value,"linear"))}function S(){C.value||(F(),l.resume(),C.value=!0)}function X(){y.value||(y.value=l.createAnalyser())}return c(async()=>{X(),S()}),f(async()=>{var w;(w=e.value)==null||w.setMotion(Md)}),p(async w=>{await E.add(w)}),h(async w=>{await I.add(w),await M.add(w)}),g(async()=>{await I.add(fv)}),Gt(()=>{C.value=!1}),(w,G)=>(he(),_e("div",vI,[Y("div",yI,[K(n)==="2d"?(he(),lt(E1,{key:0,ref_key:"live2DViewerRef",ref:e,"mouth-open-size":K(a),model:"./assets/live2d/models/hiyori_pro_zh.zip","min-w":"50% =a.value&&(v.value+=a.value),n.value&&(n.value.style.transform=`translateX(${v.value}px)`),h=requestAnimationFrame(d)}return Ge(()=>[e.height,e.amplitude,e.waveLength,e.fillColor,e.direction],()=>{o.value=e.height,s.value=e.amplitude,a.value=e.waveLength,u.value=e.fillColor,c.value=e.direction,p()},{immediate:!0}),Bg("resize",p),Jt(()=>{p(),d()}),Gt(()=>{cancelAnimationFrame(h)}),(m,y)=>(he(),_e("div",II,[ut(m.$slots,"default"),Y("div",{ref_key:"container",ref:t,absolute:"","left-0":"","right-0":"","top-0":"","w-full":"","overflow-hidden":""},[c.value==="down"?(he(),_e("div",{key:0,style:qr({backgroundColor:u.value,height:`${o.value}px`}),"w-full":""},null,4)):nt("",!0),(he(),_e("svg",{ref_key:"svg",ref:n,width:a.value*Math.ceil(i.value*2/a.value),height:o.value,viewBox:`0 0 ${a.value*Math.ceil(i.value*2/a.value)} ${o.value}`,xmlns:"http://www.w3.org/2000/svg",h:"[100%]",w:"[200%]",style:{willChange:"transform"}},[Y("path",{d:l.value,fill:u.value},null,8,MI)],8,PI)),c.value==="up"?(he(),_e("div",{key:1,style:qr({backgroundColor:u.value,height:`${o.value}px`}),"w-full":""},null,4)):nt("",!0)],512)]))}}),OI={flex:"~","gap-2":""},RI={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-1":""},FI=["checked","aria-checked"],LI=["checked","aria-checked"],NI={relative:""},DI={flex:"~ row",bg:"zinc-100 dark:zinc-700",text:"sm zinc-400 dark:zinc-500","h-fit":"","w-fit":"","appearance-none":"","gap-1":"","rounded-lg":"","rounded-md":"","border-none":"","p-1":""},BI=["checked","aria-checked"],UI={key:0,w:"120 y.id===d.value);if(!m){l.value=void 0;return}l.value=m}function g(v){const d=v.target.value;switch(t.value){case"en":case"en-US":f.value=d;break;case"zh":case"zh-CN":case"zh-TW":case"zh-HK":f.value=d;break;case"jp":case"jp-JP":p.value=d;break}}return Ge([u,c],async([v,d])=>{if(!v||!d){s.value=[];return}s.value=await a(v,d)}),Jt(async()=>{!u.value||!c.value||(s.value=await a(u.value,c.value))}),(v,d)=>(he(),_e("div",OI,[Y("fieldset",RI,[Y("label",{"h-fit":"","cursor-pointer":"",class:Kt([K(n).stageView==="2d"?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),"rounded-md":"","px-4":"","py-2":""},[ht(Y("input",{"onUpdate:modelValue":d[0]||(d[0]=m=>K(n).stageView=m),checked:K(n).stageView==="2d","aria-checked":K(n).stageView==="2d",name:"settings.stageView",type:"radio",role:"radio",value:"2d",hidden:"","appearance-none":"","outline-none":""},null,8,FI),[[_i,K(n).stageView]]),Y("div",{"select-none":"",class:Kt([K(n).stageView==="2d"?"font-semibold":""])}," 2D ",2)],2),Y("label",{"h-fit":"","cursor-pointer":"",class:Kt([K(n).stageView==="3d"?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),"rounded-md":"","px-4":"","py-2":""},[ht(Y("input",{"onUpdate:modelValue":d[1]||(d[1]=m=>K(n).stageView=m),checked:K(n).stageView==="3d","aria-checked":K(n).stageView==="3d",name:"stageView",type:"radio",role:"radio",value:"3d",hidden:"","appearance-none":"","outline-none":""},null,8,LI),[[_i,K(n).stageView]]),Y("div",{"select-none":"",class:Kt([K(n).stageView==="3d"?"font-semibold":""])}," 3D ",2)],2)]),Y("div",NI,[Y("div",DI,[Y("label",{"h-fit":"","cursor-pointer":"",class:Kt([i.value?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),transition:"all ease-in-out duration-500","rounded-md":"","px-2":"","py-2":""},[ht(Y("input",{"onUpdate:modelValue":d[2]||(d[2]=m=>i.value=m),checked:i.value,"aria-checked":i.value,name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,BI),[[Xr,i.value]]),d[8]||(d[8]=Y("div",{"select-none":""},[Y("div",{"i-solar:settings-minimalistic-bold-duotone":"",text:"text-zinc-900 dark:text-zinc-800 lg"})],-1))],2)]),Re(K(Rp),null,{default:Ue(()=>[i.value?(he(),_e("div",UI,[Y("div",zI,[Y("span",null,be(K(e)("settings.openai-base-url.label")),1)]),Y("div",jI,[ht(Y("input",{"onUpdate:modelValue":d[3]||(d[3]=m=>K(n).openAiApiBaseURL=m),type:"text",placeholder:K(e)("settings.openai-base-url.placeholder"),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},null,8,VI),[[Dr,K(n).openAiApiBaseURL]])]),Y("div",GI,[Y("span",null,be(K(e)("settings.openai-api-key.label")),1)]),Y("div",$I,[ht(Y("input",{"onUpdate:modelValue":d[4]||(d[4]=m=>K(n).openAiApiKey=m),type:"text",placeholder:K(e)("settings.openai-api-key.placeholder"),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},null,8,HI),[[Dr,K(n).openAiApiKey]])]),Y("div",XI,[Y("span",null,be(K(e)("settings.elevenlabs-api-key.label")),1)]),Y("div",WI,[ht(Y("input",{"onUpdate:modelValue":d[5]||(d[5]=m=>K(n).elevenLabsApiKey=m),type:"text",placeholder:K(e)("settings.elevenlabs-api-key.placeholder"),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},null,8,qI),[[Dr,K(n).elevenLabsApiKey]])]),Y("div",YI,[Y("span",null,be(K(e)("settings.language.title")),1)]),Y("div",KI,[ht(Y("select",{"onUpdate:modelValue":d[6]||(d[6]=m=>K(n).language=m),bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":""},[Y("option",ZI,be(v.$t("settings.language.english")),1),Y("option",JI,be(v.$t("settings.language.chinese")),1)],512),[[Td,K(n).language]])]),Y("div",QI,[Y("span",null,be(K(e)("settings.models")),1)]),Y("div",eP,[Y("select",{bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":"",onChange:h},[Y("option",tP,be(K(e)("stage.select-a-model")),1),K(n).openAiModel?(he(),_e("option",{key:0,value:K(n).openAiModel.id},be("name"in K(n).openAiModel?`${K(n).openAiModel.name} (${K(n).openAiModel.id})`:K(n).openAiModel.id),9,nP)):nt("",!0),(he(!0),_e(Un,null,mr(s.value,m=>(he(),_e("option",{key:m.id,value:m.id},be("name"in m?`${m.name} (${m.id})`:m.id),9,rP))),128))],32)]),Y("div",iP,[Y("span",null,be(K(e)("settings.voices")),1)]),Y("div",oP,[Y("select",{bg:"zinc-200 dark:zinc-800/50","w-full":"","rounded-md":"","px-2":"","py-1":"","font-mono":"","outline-none":"",onChange:g},[Y("option",sP,be(K(e)("stage.select-a-voice")),1),["en","en-US"].indexOf(K(t))!==-1&&K(f)?(he(),_e("option",{key:0,value:K(f)},be(K(f)),9,aP)):nt("",!0),["zh","zh-CN","zh-TW","zh-HK"].indexOf(K(t))!==-1&&K(f)?(he(),_e("option",{key:1,value:K(f)},be(K(f)),9,lP)):nt("",!0),["jp","jp-JP"].indexOf(K(t))!==-1&&K(p)?(he(),_e("option",{key:2,value:K(p)},be(K(p)),9,uP)):nt("",!0),(he(!0),_e(Un,null,mr(K(Sd)[K(t)],(m,y)=>(he(),_e("option",{key:y,value:m},be(m),9,cP))),128))],32)])])):nt("",!0)]),_:1})]),Y("div",null,[Y("div",fP,[Y("label",hP,[ht(Y("input",{"onUpdate:modelValue":d[7]||(d[7]=m=>iu(o)?o.value=m:null),checked:K(o),"aria-checked":K(o),name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,dP),[[Xr,K(o)]]),Y("div",pP,[Re(Ko,{name:"slide-away",mode:"out-in"},{default:Ue(()=>[K(o)?(he(),_e("div",mP)):(he(),_e("div",gP))]),_:1})])])])])]))}}),yP={"mb-1":"","w-full":"","gap-2":""},_P=De({__name:"Header",setup(r){return(e,t)=>(he(),_e("header",yP,[t[0]||(t[0]=Y("div",{flex:"~ 1","w-full":"","items-center":"","gap-2":"","px-2":"","text-nowrap":"","text-2xl":""},[Y("div",{"i-solar:cat-outline":"",text:"[#ed869d]"}),Y("div",{"font-cute":""},[Y("span",null,"アイリ")])],-1)),Re(vP)]))}});function Sm(r,e){const t=Ed(e??{},{...vc.getDefaultRealTimeVADOptions("v5"),preSpeechPadFrames:30,positiveSpeechThreshold:.5,negativeSpeechThreshold:.35,minSpeechFrames:30,auto:!0}),n=le(),i=Ug("microphone");async function o(){if(n.value&&(n.value.destroy(),n.value=void 0,console.warn("existing MicVAD destroyed")),!i.value)return;const s=K(r);if(!s)return;const a=await navigator.mediaDevices.getUserMedia({audio:{deviceId:s}});n.value=await vc.MicVAD.new({...t,stream:a}),t.auto&&n.value.start()}return Ge(i,o,{immediate:!0}),Ge(zg(r),o,{immediate:!0}),jg(o),Gt(()=>{n.value&&(n.value.destroy(),n.value=void 0)}),{destroy:()=>{n.value&&(n.value.destroy(),n.value=void 0)},start:()=>{n.value&&n.value.start()}}}function xP(r,e){const t=Ed(e,{onLoading:()=>{},onInitiate:()=>{},onProgress:()=>{},onDone:()=>{},onReady:()=>{},onStart:()=>{},onUpdate:()=>{},onComplete:()=>{}}),{post:n,data:i,terminate:o}=Vg(r,{type:"module"}),s=le(null),a=le(""),l=le([]),u=le(!1),c=le(0),f=le("");return Ge(i,p=>{var h,g,v,d,m,y,_,C;switch(p.status){case"loading":s.value="loading",a.value=p.data,(h=t.onLoading)==null||h.call(t,p.data);break;case"initiate":l.value.push(p),(g=t.onInitiate)==null||g.call(t,p);break;case"progress":l.value=l.value.map(x=>x.file===p.file?{...x,...p}:x),(v=t.onProgress)==null||v.call(t,p);break;case"done":l.value=l.value.filter(x=>x.file!==p.file),(d=t.onDone)==null||d.call(t,p);break;case"ready":s.value="ready",(m=t.onReady)==null||m.call(t);break;case"start":u.value=!0,(y=t.onStart)==null||y.call(t);break;case"update":c.value=p.tps,(_=t.onUpdate)==null||_.call(t,p.tps);break;case"complete":u.value=!1,f.value=p.output[0]||"",console.debug("Whisper result:",f.value),(C=t.onComplete)==null||C.call(t,p.output[0]);break}}),Gt(()=>{o()}),{transcribe:p=>n(p),status:s,loadingMessage:a,loadingProgress:l,transcribing:u,tps:c,result:f,load:()=>n({type:"load"}),terminate:o}}const bP="/assets/worker-CcO7UzBT.js";async function wP(r,e){const t=new ArrayBuffer(44+r.length*2),n=new DataView(t);co(n,0,"RIFF"),n.setUint32(4,36+r.length*2,!0),co(n,8,"WAVE"),co(n,12,"fmt "),n.setUint32(16,16,!0),n.setUint16(20,1,!0),n.setUint16(22,1,!0),n.setUint32(24,e,!0),n.setUint32(28,e*2,!0),n.setUint16(32,2,!0),n.setUint16(34,16,!0),co(n,36,"data"),n.setUint32(40,r.length*2,!0),TP(n,44,r);const i=new Blob([n],{type:"audio/wav"});return new Promise((o,s)=>{const a=new FileReader;a.onload=()=>{const l=a.result.split(",")[1];o(l)},a.onerror=s,a.readAsDataURL(i)})}function co(r,e,t){for(let n=0;n{Qt().then(()=>{n.update(),i.value=n.height.value})}),a(async()=>{Qt().then(()=>{n.update(),i.value=n.height.value})}),(l,u)=>{const c=Ad("auto-animate");return he(),_e("div",SP,[u[1]||(u[1]=Y("div",{"flex-1":""},null,-1)),ht((he(),_e("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"",flex:"~ col","overflow-scroll":""},[u[0]||(u[0]=Y("div",{"flex-1":""},null,-1)),(he(!0),_e(Un,null,mr(K(t),(f,p)=>(he(),_e("div",{key:p,"mb-2":""},[f.role==="assistant"?(he(),_e("div",EP,[Y("div",CP,[Y("div",null,[Y("span",AP,be(l.$t("stage.chat.message.character-name.airi")),1)]),f.content?(he(),_e("div",{key:0,class:"markdown-content",text:"base {await u(E)}});async function m(){await u(e.value)}const{destroy:y,start:_}=Sm(l,{onSpeechStart:()=>{t.value=!0},onVADMisfire:()=>{t.value=!1},onSpeechEnd:E=>{t.value=!1,x(E)},auto:!1});function C(){v.value!=="loading"&&(g(),_())}async function x(E){await f.resume();const A=await wP(E,f.sampleRate);h({type:"generate",data:{audio:A,language:"en"}})}async function b(E){const A=E.target,M=o.value.find(I=>I.deviceId===A.value);if(!M){s.value=void 0;return}s.value=M}return Ge(a,async E=>{E==="false"&&(y(),d())}),c(async()=>{e.value=""}),(E,A)=>{const M=Eo("BasicTextarea"),I=Eo("TransitionVertical");return he(),_e("div",NP,[Y("fieldset",DP,[Y("label",{class:Kt([n.value==="chat"?"bg-pink-100 dark:bg-[#3c2632]":"bg-white dark:bg-[#121212]",n.value==="chat"?"text-pink-500 dark:text-pink-500":""]),flex:"~ row",checked:n.value==="chat","aria-checked":n.value==="chat",border:"solid l-2 t-2 b-2 pink-100 dark:[#3c2632]",bg:"hover:pink-100 dark:hover:[#3c2632]",text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-l-lg":"","px-2":""},[ht(Y("input",{"onUpdate:modelValue":A[0]||(A[0]=F=>n.value=F),type:"radio",name:"tab",value:"chat",hidden:""},null,512),[[_i,n.value]]),A[5]||(A[5]=Y("div",{"i-solar:dialog-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),Y("div",UP,[Y("span",zP,be(E.$t("stage.chat.tabs.chat")),1)])],10,BP),Y("label",{class:Kt([n.value==="custom"?"bg-pink-100 dark:bg-[#3c2632]":"bg-white dark:bg-[#121212]",n.value==="custom"?"text-pink-500 dark:text-pink-500":""]),flex:"~ row",checked:n.value==="custom","aria-checked":n.value==="custom",border:"solid t-2 b-2 pink-100 dark:[#3c2632]",bg:"hover:pink-100 dark:hover:[#3c2632]",text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","px-2":""},[ht(Y("input",{"onUpdate:modelValue":A[1]||(A[1]=F=>n.value=F),type:"radio",name:"tab",value:"custom",hidden:""},null,512),[[_i,n.value]]),A[6]||(A[6]=Y("div",{"i-solar:star-fall-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),Y("div",VP,[Y("span",null,be(E.$t("stage.chat.tabs.custom")),1)])],10,jP),Y("label",{class:Kt([n.value==="clothes"?"bg-pink-100 dark:bg-[#3c2632]":"bg-white dark:bg-[#121212]",n.value==="clothes"?"text-pink-500 dark:text-pink-500":""]),flex:"~ row",checked:n.value==="clothes","aria-checked":n.value==="clothes",border:"solid r-2 t-2 b-2 pink-100 dark:[#3c2632]",bg:"hover:pink-100 dark:hover:[#3c2632]",text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500",transition:"all duration-250 ease-in-out","cursor-pointer":"","items-center":"","gap-1":"","rounded-r-lg":"","px-2":""},[ht(Y("input",{"onUpdate:modelValue":A[2]||(A[2]=F=>n.value=F),type:"radio",name:"tab",value:"clothes",hidden:""},null,512),[[_i,n.value]]),A[7]||(A[7]=Y("div",{"i-solar:magic-stick-3-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),Y("div",$P,[Y("span",null,be(E.$t("stage.chat.tabs.clothes")),1)])],10,GP)]),Y("div",HP,[Y("div",XP,[Re(LP,{"h-full":"","flex-1":"","p-4":"",w:"full","max-h":"e.value=F),placeholder:K(p)("stage.message"),text:"pink-300 hover:pink-500 dark:pink-300/50 dark:hover:pink-500 placeholder:pink-300 placeholder:hover:pink-500 placeholder:dark:pink-300/50 placeholder:dark:hover:pink-500",bg:"pink-100 dark:pink-400/20","min-h":"[100px]","w-full":"","rounded-t-xl":"","p-4":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",onSubmit:m},null,8,["modelValue","placeholder"])])])]),Y("div",qP,[Y("button",{bg:"cyan-100 hover:cyan-200 dark:cyan-800 dark:hover:cyan-700",transition:"all duration-250 ease-in-out",text:"cyan-400","mb-6":"",flex:"","cursor-pointer":"","items-center":"","justify-center":"","gap-2":"","rounded-full":"","px-4":"","py-2":"",onClick:C},[Re(Ko,{mode:"out-in"},{default:Ue(()=>[K(v)===null?(he(),_e("div",YP,be(E.$t("stage.operations.load-models")),1)):K(v)==="loading"?(he(),_e("div",KP,[A[8]||(A[8]=Y("div",{"i-svg-spinners:bouncing-ball":"",class:"text-cyan"},null,-1)),Y("span",null,be(E.$t("stage.operations.load-models-status.loading")),1)])):K(v)==="ready"?(he(),_e("div",ZP,[A[9]||(A[9]=Y("div",{"i-lucide:check":"",class:"text-cyan"},null,-1)),Y("span",null,be(E.$t("stage.operations.load-models-status.ready")),1)])):nt("",!0)]),_:1})]),Y("div",JP,[Re(I,null,{default:Ue(()=>[i.value?(he(),_e("fieldset",QP,[(he(!0),_e(Un,null,mr(K(o),(F,S)=>(he(),_e("label",{key:S,class:"[&_div_span]:dark:hover:bg-cyan-300 [&_div_span]:dark:hover:bg-cyan-900"},[Y("input",{type:"radio",name:"audioInput",value:F.deviceId,hidden:"",onChange:b},null,40,eM),Y("div",tM,[Y("div",nM,[F.deviceId===K(l)?(he(),_e("div",rM)):nt("",!0)]),Y("span",{"inline-block":"",class:Kt([F.deviceId===K(l)?"cyan-400 dark:text-white":"cyan-400/50 dark:text-white/50"]),transition:"all duration-250 ease-in-out"},be(F.label),3)])]))),128))])):nt("",!0)]),_:1}),Y("label",iM,[ht(Y("input",{"onUpdate:modelValue":A[4]||(A[4]=F=>i.value=F),type:"checkbox",hidden:""},null,512),[[Xr,i.value]]),A[10]||(A[10]=Y("div",{"i-solar:microphone-2-bold-duotone":""},null,-1)),Y("div",null,[t.value?(he(),_e("span",sM,"Listening...")):(he(),_e("span",oM,be(E.$t("settings.microphone")),1))])])])])])}}}),lM=Jo(aM,[["__scopeId","data-v-f0ce09b3"]]),uM={},cM={"mb-1":"","w-full":"","gap-2":""};function fM(r,e){return he(),_e("header",cM,e[0]||(e[0]=[Y("div",{flex:"~ 1","w-full":"","items-center":"","justify-center":"","gap-2":"","px-2":"","text-nowrap":"","text-lg":""},[Y("div",{"i-solar:cat-outline":"",text:"[#ed869d]"}),Y("div",{"font-cute":""},[Y("span",null,"アイリ")])],-1)]))}const hM=Jo(uM,[["render",fM]]);function Yu(r,e){const t=typeof r=="string"&&!e?`${r}Context`:e,n=Symbol(t);return[i=>{const o=qg(n,i);if(o||o===null)return o;throw new Error(`Injection \`${n.toString()}\` not found. Component must be used within ${Array.isArray(r)?`one of the following components: ${r.join(", ")}`:`\`${r}\``}`)},i=>(Yg(n,i),i)]}function Em(r,e,t){const n=t.originalEvent.target,i=new CustomEvent(r,{bubbles:!1,cancelable:!0,detail:t});e&&n.addEventListener(r,e,{once:!0}),n.dispatchEvent(i)}function Cm(r){return fd()?(hd(r),!0):!1}function dM(r){let e=!1,t;const n=Pd(!0);return(...i)=>(e||(t=n.run(()=>r(...i)),e=!0),t)}function pM(r){let e=0,t,n;const i=()=>{e-=1,n&&e<=0&&(n.stop(),t=void 0,n=void 0)};return(...o)=>(e+=1,t||(n=Pd(!0),t=n.run(()=>r(...o))),Cm(i),t)}function Ku(r){return typeof r=="function"?r():K(r)}const wr=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const mM=r=>typeof r<"u",gM=Object.prototype.toString,vM=r=>gM.call(r)==="[object Object]",yM=()=>{},qh=_M();function _M(){var r,e;return wr&&((r=window==null?void 0:window.navigator)==null?void 0:r.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function xM(r){return yr()}function bM(r,e){xM()&&ev(r,e)}function as(r){var e;const t=Ku(r);return(e=t==null?void 0:t.$el)!=null?e:t}const Zu=wr?window:void 0;function Am(...r){let e,t,n,i;if(typeof r[0]=="string"||Array.isArray(r[0])?([t,n,i]=r,e=Zu):[e,t,n,i]=r,!e)return yM;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const o=[],s=()=>{o.forEach(c=>c()),o.length=0},a=(c,f,p,h)=>(c.addEventListener(f,p,h),()=>c.removeEventListener(f,p,h)),l=Ge(()=>[as(e),Ku(i)],([c,f])=>{if(s(),!c)return;const p=vM(f)?{...f}:f;o.push(...t.flatMap(h=>n.map(g=>a(c,h,g,p))))},{immediate:!0,flush:"post"}),u=()=>{l(),s()};return Cm(u),u}function wM(r){return typeof r=="function"?r:typeof r=="string"?e=>e.key===r:Array.isArray(r)?e=>r.includes(e.key):()=>!0}function TM(...r){let e,t,n={};r.length===3?(e=r[0],t=r[1],n=r[2]):r.length===2?typeof r[1]=="object"?(e=!0,t=r[0],n=r[1]):(e=r[0],t=r[1]):(e=!0,t=r[0]);const{target:i=Zu,eventName:o="keydown",passive:s=!1,dedupe:a=!1}=n,l=wM(e);return Am(i,o,u=>{u.repeat&&Ku(a)||l(u)&&t(u)},s)}function SM(){const r=le(!1),e=yr();return e&&Jt(()=>{r.value=!0},e),r}function EM(r){return JSON.parse(JSON.stringify(r))}function CM(r,e,t,n={}){var i,o,s;const{clone:a=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:f,shouldEmit:p}=n,h=yr(),g=t||(h==null?void 0:h.emit)||((i=h==null?void 0:h.$emit)==null?void 0:i.bind(h))||((s=(o=h==null?void 0:h.proxy)==null?void 0:o.$emit)==null?void 0:s.bind(h==null?void 0:h.proxy));let v=u;v=v||`update:${e.toString()}`;const d=_=>a?typeof a=="function"?a(_):EM(_):_,m=()=>mM(r[e])?d(r[e]):f,y=_=>{p?p(_)&&g(v,_):g(v,_)};if(l){const _=m(),C=le(_);let x=!1;return Ge(()=>r[e],b=>{x||(x=!0,C.value=d(b),Qt(()=>x=!1))}),Ge(C,b=>{!x&&(b!==r[e]||c)&&y(b)},{deep:c}),C}else return Ve({get(){return m()},set(_){y(_)}})}function Ju(r){return r?r.flatMap(e=>e.type===Un?Ju(e.children):[e]):[]}function Ua(r){if(r===null||typeof r!="object")return!1;const e=Object.getPrototypeOf(r);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in r?!1:Symbol.toStringTag in r?Object.prototype.toString.call(r)==="[object Module]":!0}function Ql(r,e,t=".",n){if(!Ua(e))return Ql(r,{},t);const i=Object.assign({},e);for(const o in r){if(o==="__proto__"||o==="constructor")continue;const s=r[o];s!=null&&(Array.isArray(s)&&Array.isArray(i[o])?i[o]=[...s,...i[o]]:Ua(s)&&Ua(i[o])?i[o]=Ql(s,i[o],(t?`${t}.`:"")+o.toString()):i[o]=s)}return i}function AM(r){return(...e)=>e.reduce((t,n)=>Ql(t,n,""),{})}const IM=AM(),[Im,LO]=Yu("ConfigProvider");let PM="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",MM=(r=21)=>{let e="",t=r;for(;t--;)e+=PM[Math.random()*64|0];return e};const kM=pM(()=>{const r=le(new Map),e=le(),t=Ve(()=>{for(const s of r.value.values())if(s)return!0;return!1}),n=Im({scrollBody:le(!0)});let i=null;const o=()=>{document.body.style.paddingRight="",document.body.style.marginRight="",document.body.style.pointerEvents="",document.body.style.removeProperty("--scrollbar-width"),document.body.style.overflow=e.value??"",qh&&(i==null||i()),e.value=void 0};return Ge(t,(s,a)=>{var l;if(!wr)return;if(!s){a&&o();return}e.value===void 0&&(e.value=document.body.style.overflow);const u=window.innerWidth-document.documentElement.clientWidth,c={padding:u,margin:0},f=(l=n.scrollBody)!=null&&l.value?typeof n.scrollBody.value=="object"?IM({padding:n.scrollBody.value.padding===!0?u:n.scrollBody.value.padding,margin:n.scrollBody.value.margin===!0?u:n.scrollBody.value.margin},c):c:{padding:0,margin:0};u>0&&(document.body.style.paddingRight=typeof f.padding=="number"?`${f.padding}px`:String(f.padding),document.body.style.marginRight=typeof f.margin=="number"?`${f.margin}px`:String(f.margin),document.body.style.setProperty("--scrollbar-width",`${u}px`),document.body.style.overflow="hidden"),qh&&(i=Am(document,"touchmove",p=>RM(p),{passive:!1})),Qt(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})},{immediate:!0,flush:"sync"}),r});function OM(r){const e=MM(6),t=kM();t.value.set(e,r);const n=Ve({get:()=>t.value.get(e)??!1,set:i=>t.value.set(e,i)});return bM(()=>{t.value.delete(e)}),n}function Pm(r){const e=window.getComputedStyle(r);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&r.clientWidth1?!0:(e.preventDefault&&e.cancelable&&e.preventDefault(),!1)}function Qu(r){const e=yr(),t=e==null?void 0:e.type.emits,n={};return t!=null&&t.length||console.warn(`No emitted event found. Please check component: ${e==null?void 0:e.type.__name}`),t==null||t.forEach(i=>{n[Kg(Zg(i))]=(...o)=>r(i,...o)}),n}function In(){const r=yr(),e=le(),t=Ve(()=>{var s,a;return["#text","#comment"].includes((s=e.value)==null?void 0:s.$el.nodeName)?(a=e.value)==null?void 0:a.$el.nextElementSibling:as(e)}),n=Object.assign({},r.exposed),i={};for(const s in r.props)Object.defineProperty(i,s,{enumerable:!0,configurable:!0,get:()=>r.props[s]});if(Object.keys(n).length>0)for(const s in n)Object.defineProperty(i,s,{enumerable:!0,configurable:!0,get:()=>n[s]});Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>r.vnode.el}),r.exposed=i;function o(s){e.value=s,!(s instanceof Element||!s)&&(Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>s.$el}),r.exposed=i)}return{forwardRef:o,currentRef:e,currentElement:t}}var FM=function(r){if(typeof document>"u")return null;var e=Array.isArray(r)?r[0]:r;return e.ownerDocument.body},Rr=new WeakMap,fo=new WeakMap,ho={},za=0,Mm=function(r){return r&&(r.host||Mm(r.parentNode))},LM=function(r,e){return e.map(function(t){if(r.contains(t))return t;var n=Mm(t);return n&&r.contains(n)?n:(console.error("aria-hidden",t,"in not contained inside",r,". Doing nothing"),null)}).filter(function(t){return!!t})},NM=function(r,e,t,n){var i=LM(e,Array.isArray(r)?r:[r]);ho[t]||(ho[t]=new WeakMap);var o=ho[t],s=[],a=new Set,l=new Set(i),u=function(f){!f||a.has(f)||(a.add(f),u(f.parentNode))};i.forEach(u);var c=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(p){if(a.has(p))c(p);else try{var h=p.getAttribute(n),g=h!==null&&h!=="false",v=(Rr.get(p)||0)+1,d=(o.get(p)||0)+1;Rr.set(p,v),o.set(p,d),s.push(p),v===1&&g&&fo.set(p,!0),d===1&&p.setAttribute(t,"true"),g||p.setAttribute(n,"true")}catch(m){console.error("aria-hidden: cannot operate on ",p,m)}})};return c(e),a.clear(),za++,function(){s.forEach(function(f){var p=Rr.get(f)-1,h=o.get(f)-1;Rr.set(f,p),o.set(f,h),p||(fo.has(f)||f.removeAttribute(n),fo.delete(f)),h||f.removeAttribute(t)}),za--,za||(Rr=new WeakMap,Rr=new WeakMap,fo=new WeakMap,ho={})}},DM=function(r,e,t){t===void 0&&(t="data-aria-hidden");var n=Array.from(Array.isArray(r)?r:[r]),i=FM(r);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),NM(n,i,t,"aria-hidden")):function(){return null}};function BM(r){let e;Ge(()=>as(r),t=>{t?e=DM(t):e&&e()}),Gt(()=>{e&&e()})}function eu(r,e="radix"){return Im({useId:void 0}),`${e}-${Xg()}`}function UM(r,e){const t=le(r);function n(i){return e[t.value][i]??t.value}return{state:t,dispatch:i=>{t.value=n(i)}}}const zM=De({name:"PrimitiveSlot",inheritAttrs:!1,setup(r,{attrs:e,slots:t}){return()=>{var n,i;if(!t.default)return null;const o=Ju(t.default()),s=o.findIndex(c=>c.type!==Jg);if(s===-1)return o;const a=o[s];(n=a.props)==null||delete n.ref;const l=a.props?zn(e,a.props):e;e.class&&(i=a.props)!=null&&i.class&&delete a.props.class;const u=Qg(a,l);for(const c in l)c.startsWith("on")&&(u.props||(u.props={}),u.props[c]=l[c]);return o.length===1?u:(o[s]=u,o)}}}),ls=De({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(r,{attrs:e,slots:t}){const n=r.asChild?"template":r.as;return typeof n=="string"&&["area","img","input"].includes(n)?()=>_o(n,e):n!=="template"?()=>_o(r.as,e,{default:t.default}):()=>_o(zM,e,{default:t.default})}});function jM(r,e){var t;const n=le({}),i=le("none"),o=le(r),s=r.value?"mounted":"unmounted";let a;const l=((t=e.value)==null?void 0:t.ownerDocument.defaultView)??Zu,{state:u,dispatch:c}=UM(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),f=d=>{var m;if(wr){const y=new CustomEvent(d,{bubbles:!1,cancelable:!1});(m=e.value)==null||m.dispatchEvent(y)}};Ge(r,async(d,m)=>{var y;const _=m!==d;if(await Qt(),_){const C=i.value,x=po(e.value);d?(c("MOUNT"),f("enter"),x==="none"&&f("after-enter")):x==="none"||((y=n.value)==null?void 0:y.display)==="none"?(c("UNMOUNT"),f("leave"),f("after-leave")):m&&C!==x?(c("ANIMATION_OUT"),f("leave")):(c("UNMOUNT"),f("after-leave"))}},{immediate:!0});const p=d=>{const m=po(e.value),y=m.includes(d.animationName),_=u.value==="mounted"?"enter":"leave";if(d.target===e.value&&y&&(f(`after-${_}`),c("ANIMATION_END"),!o.value)){const C=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",a=l==null?void 0:l.setTimeout(()=>{var x;((x=e.value)==null?void 0:x.style.animationFillMode)==="forwards"&&(e.value.style.animationFillMode=C)})}d.target===e.value&&m==="none"&&c("ANIMATION_END")},h=d=>{d.target===e.value&&(i.value=po(e.value))},g=Ge(e,(d,m)=>{d?(n.value=getComputedStyle(d),d.addEventListener("animationstart",h),d.addEventListener("animationcancel",p),d.addEventListener("animationend",p)):(c("ANIMATION_END"),l==null||l.clearTimeout(a),m==null||m.removeEventListener("animationstart",h),m==null||m.removeEventListener("animationcancel",p),m==null||m.removeEventListener("animationend",p))},{immediate:!0}),v=Ge(u,()=>{const d=po(e.value);i.value=u.value==="mounted"?d:"none"});return Gt(()=>{g(),v()}),{isPresent:Ve(()=>["mounted","unmountSuspended"].includes(u.value))}}function po(r){return r&&getComputedStyle(r).animationName||"none"}const km=De({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(r,{slots:e,expose:t}){var n;const{present:i,forceMount:o}=Yr(r),s=le(),{isPresent:a}=jM(i,s);t({present:a});let l=e.default({present:a});l=Ju(l||[]);const u=yr();if(l&&(l==null?void 0:l.length)>1){const c=(n=u==null?void 0:u.parent)!=null&&n.type.name?`<${u.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${c}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(f=>` - ${f}`).join(` +`)].join(` +`))}return()=>o.value||i.value||a.value?_o(e.default({present:a})[0],{ref:c=>{const f=as(c);return typeof(f==null?void 0:f.hasAttribute)>"u"||(f!=null&&f.hasAttribute("data-radix-popper-content-wrapper")?s.value=f.firstElementChild:s.value=f),f}}):null}}),[Tr,VM]=Yu("DialogRoot"),GM=De({inheritAttrs:!1,__name:"DialogRoot",props:{open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:!1},modal:{type:Boolean,default:!0}},emits:["update:open"],setup(r,{emit:e}){const t=r,n=CM(t,"open",e,{defaultValue:t.defaultOpen,passive:t.open===void 0}),i=le(),o=le(),{modal:s}=Yr(t);return VM({open:n,modal:s,openModal:()=>{n.value=!0},onOpenChange:a=>{n.value=a},onOpenToggle:()=>{n.value=!n.value},contentId:"",titleId:"",descriptionId:"",triggerElement:i,contentElement:o}),(a,l)=>ut(a.$slots,"default",{open:K(n)})}}),$M=De({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{default:"button"}},setup(r){const e=r,t=Tr(),{forwardRef:n,currentElement:i}=In();return t.contentId||(t.contentId=eu(void 0,"radix-vue-dialog-content")),Jt(()=>{t.triggerElement.value=i.value}),(o,s)=>(he(),lt(K(ls),zn(e,{ref:K(n),type:o.as==="button"?"button":void 0,"aria-haspopup":"dialog","aria-expanded":K(t).open.value||!1,"aria-controls":K(t).open.value?K(t).contentId:void 0,"data-state":K(t).open.value?"open":"closed",onClick:K(t).onOpenToggle}),{default:Ue(()=>[ut(o.$slots,"default")]),_:3},16,["type","aria-expanded","aria-controls","data-state","onClick"]))}}),HM=De({__name:"Teleport",props:{to:{default:"body"},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(r){const e=SM();return(t,n)=>K(e)||t.forceMount?(he(),lt(Wg,{key:0,to:t.to,disabled:t.disabled},[ut(t.$slots,"default")],8,["to","disabled"])):nt("",!0)}}),XM=De({__name:"DialogPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(r){const e=r;return(t,n)=>(he(),lt(K(HM),$g(Hg(e)),{default:Ue(()=>[ut(t.$slots,"default")]),_:3},16))}}),WM="dismissableLayer.pointerDownOutside",qM="dismissableLayer.focusOutside";function Om(r,e){const t=e.closest("[data-dismissable-layer]"),n=r.dataset.dismissableLayer===""?r:r.querySelector("[data-dismissable-layer]"),i=Array.from(r.ownerDocument.querySelectorAll("[data-dismissable-layer]"));return!!(t&&n===t||i.indexOf(n){});return fn(s=>{if(!wr)return;const a=async u=>{const c=u.target;if(e!=null&&e.value){if(Om(e.value,c)){i.value=!1;return}if(u.target&&!i.value){let f=function(){Em(WM,r,p)};const p={originalEvent:u};u.pointerType==="touch"?(n.removeEventListener("click",o.value),o.value=f,n.addEventListener("click",o.value,{once:!0})):f()}else n.removeEventListener("click",o.value);i.value=!1}},l=window.setTimeout(()=>{n.addEventListener("pointerdown",a)},0);s(()=>{window.clearTimeout(l),n.removeEventListener("pointerdown",a),n.removeEventListener("click",o.value)})}),{onPointerDownCapture:()=>i.value=!0}}function KM(r,e){var t;const n=((t=e==null?void 0:e.value)==null?void 0:t.ownerDocument)??(globalThis==null?void 0:globalThis.document),i=le(!1);return fn(o=>{if(!wr)return;const s=async a=>{e!=null&&e.value&&(await Qt(),!(!e.value||Om(e.value,a.target))&&a.target&&!i.value&&Em(qM,r,{originalEvent:a}))};n.addEventListener("focusin",s),o(()=>n.removeEventListener("focusin",s))}),{onFocusCapture:()=>i.value=!0,onBlurCapture:()=>i.value=!1}}const _n=Id({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ZM=De({__name:"DismissableLayer",props:{disableOutsidePointerEvents:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","dismiss"],setup(r,{emit:e}){const t=r,n=e,{forwardRef:i,currentElement:o}=In(),s=Ve(()=>{var g;return((g=o.value)==null?void 0:g.ownerDocument)??globalThis.document}),a=Ve(()=>_n.layersRoot),l=Ve(()=>o.value?Array.from(a.value).indexOf(o.value):-1),u=Ve(()=>_n.layersWithOutsidePointerEventsDisabled.size>0),c=Ve(()=>{const g=Array.from(a.value),[v]=[..._n.layersWithOutsidePointerEventsDisabled].slice(-1),d=g.indexOf(v);return l.value>=d}),f=YM(async g=>{const v=[..._n.branches].some(d=>d==null?void 0:d.contains(g.target));!c.value||v||(n("pointerDownOutside",g),n("interactOutside",g),await Qt(),g.defaultPrevented||n("dismiss"))},o),p=KM(g=>{[..._n.branches].some(v=>v==null?void 0:v.contains(g.target))||(n("focusOutside",g),n("interactOutside",g),g.defaultPrevented||n("dismiss"))},o);TM("Escape",g=>{l.value===a.value.size-1&&(n("escapeKeyDown",g),g.defaultPrevented||n("dismiss"))});let h;return fn(g=>{o.value&&(t.disableOutsidePointerEvents&&(_n.layersWithOutsidePointerEventsDisabled.size===0&&(h=s.value.body.style.pointerEvents,s.value.body.style.pointerEvents="none"),_n.layersWithOutsidePointerEventsDisabled.add(o.value)),a.value.add(o.value),g(()=>{t.disableOutsidePointerEvents&&_n.layersWithOutsidePointerEventsDisabled.size===1&&(s.value.body.style.pointerEvents=h)}))}),fn(g=>{g(()=>{o.value&&(a.value.delete(o.value),_n.layersWithOutsidePointerEventsDisabled.delete(o.value))})}),(g,v)=>(he(),lt(K(ls),{ref:K(i),"as-child":g.asChild,as:g.as,"data-dismissable-layer":"",style:qr({pointerEvents:u.value?c.value?"auto":"none":void 0}),onFocusCapture:K(p).onFocusCapture,onBlurCapture:K(p).onBlurCapture,onPointerdownCapture:K(f).onPointerDownCapture},{default:Ue(()=>[ut(g.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),ja="focusScope.autoFocusOnMount",Va="focusScope.autoFocusOnUnmount",Yh={bubbles:!1,cancelable:!0};function JM(r,{select:e=!1}={}){const t=document.activeElement;for(const n of r)if(Fn(n,{select:e}),document.activeElement!==t)return!0}function QM(r){const e=Rm(r),t=Kh(e,r),n=Kh(e.reverse(),r);return[t,n]}function Rm(r){const e=[],t=document.createTreeWalker(r,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const i=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||i?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)e.push(t.currentNode);return e}function Kh(r,e){for(const t of r)if(!ek(t,{upTo:e}))return t}function ek(r,{upTo:e}){if(getComputedStyle(r).visibility==="hidden")return!0;for(;r;){if(e!==void 0&&r===e)return!1;if(getComputedStyle(r).display==="none")return!0;r=r.parentElement}return!1}function tk(r){return r instanceof HTMLInputElement&&"select"in r}function Fn(r,{select:e=!1}={}){if(r&&r.focus){const t=document.activeElement;r.focus({preventScroll:!0}),r!==t&&tk(r)&&e&&r.select()}}const nk=dM(()=>le([]));function rk(){const r=nk();return{add(e){const t=r.value[0];e!==t&&(t==null||t.pause()),r.value=Zh(r.value,e),r.value.unshift(e)},remove(e){var t;r.value=Zh(r.value,e),(t=r.value[0])==null||t.resume()}}}function Zh(r,e){const t=[...r],n=t.indexOf(e);return n!==-1&&t.splice(n,1),t}function ik(r){return r.filter(e=>e.tagName!=="A")}const ok=De({__name:"FocusScope",props:{loop:{type:Boolean,default:!1},trapped:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["mountAutoFocus","unmountAutoFocus"],setup(r,{emit:e}){const t=r,n=e,{currentRef:i,currentElement:o}=In(),s=le(null),a=rk(),l=Id({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});fn(c=>{if(!wr)return;const f=o.value;if(!t.trapped)return;function p(d){if(l.paused||!f)return;const m=d.target;f.contains(m)?s.value=m:Fn(s.value,{select:!0})}function h(d){if(l.paused||!f)return;const m=d.relatedTarget;m!==null&&(f.contains(m)||Fn(s.value,{select:!0}))}function g(d){f.contains(s.value)||Fn(f)}document.addEventListener("focusin",p),document.addEventListener("focusout",h);const v=new MutationObserver(g);f&&v.observe(f,{childList:!0,subtree:!0}),c(()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",h),v.disconnect()})}),fn(async c=>{const f=o.value;if(await Qt(),!f)return;a.add(l);const p=document.activeElement;if(!f.contains(p)){const h=new CustomEvent(ja,Yh);f.addEventListener(ja,g=>n("mountAutoFocus",g)),f.dispatchEvent(h),h.defaultPrevented||(JM(ik(Rm(f)),{select:!0}),document.activeElement===p&&Fn(f))}c(()=>{f.removeEventListener(ja,v=>n("mountAutoFocus",v));const h=new CustomEvent(Va,Yh),g=v=>{n("unmountAutoFocus",v)};f.addEventListener(Va,g),f.dispatchEvent(h),setTimeout(()=>{h.defaultPrevented||Fn(p??document.body,{select:!0}),f.removeEventListener(Va,g),a.remove(l)},0)})});function u(c){if(!t.loop&&!t.trapped||l.paused)return;const f=c.key==="Tab"&&!c.altKey&&!c.ctrlKey&&!c.metaKey,p=document.activeElement;if(f&&p){const h=c.currentTarget,[g,v]=QM(h);g&&v?!c.shiftKey&&p===v?(c.preventDefault(),t.loop&&Fn(g,{select:!0})):c.shiftKey&&p===g&&(c.preventDefault(),t.loop&&Fn(v,{select:!0})):p===h&&c.preventDefault()}}return(c,f)=>(he(),lt(K(ls),{ref_key:"currentRef",ref:i,tabindex:"-1","as-child":c.asChild,as:c.as,onKeydown:u},{default:Ue(()=>[ut(c.$slots,"default")]),_:3},8,["as-child","as"]))}});function sk(r){return r?"open":"closed"}const Fm=De({__name:"DialogContentImpl",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=e,i=Tr(),{forwardRef:o,currentElement:s}=In();return i.titleId||(i.titleId=eu(void 0,"radix-vue-dialog-title")),i.descriptionId||(i.descriptionId=eu(void 0,"radix-vue-dialog-description")),Jt(()=>{i.contentElement=s,document.activeElement!==document.body&&(i.triggerElement.value=document.activeElement)}),(a,l)=>(he(),lt(K(ok),{"as-child":"",loop:"",trapped:t.trapFocus,onMountAutoFocus:l[5]||(l[5]=u=>n("openAutoFocus",u)),onUnmountAutoFocus:l[6]||(l[6]=u=>n("closeAutoFocus",u))},{default:Ue(()=>[Re(K(ZM),zn({id:K(i).contentId,ref:K(o),as:a.as,"as-child":a.asChild,"disable-outside-pointer-events":a.disableOutsidePointerEvents,role:"dialog","aria-describedby":K(i).descriptionId,"aria-labelledby":K(i).titleId,"data-state":K(sk)(K(i).open.value)},a.$attrs,{onDismiss:l[0]||(l[0]=u=>K(i).onOpenChange(!1)),onEscapeKeyDown:l[1]||(l[1]=u=>n("escapeKeyDown",u)),onFocusOutside:l[2]||(l[2]=u=>n("focusOutside",u)),onInteractOutside:l[3]||(l[3]=u=>n("interactOutside",u)),onPointerDownOutside:l[4]||(l[4]=u=>n("pointerDownOutside",u))}),{default:Ue(()=>[ut(a.$slots,"default")]),_:3},16,["id","as","as-child","disable-outside-pointer-events","aria-describedby","aria-labelledby","data-state"])]),_:3},8,["trapped"]))}}),ak=De({__name:"DialogContentModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=e,i=Tr(),o=Qu(n),{forwardRef:s,currentElement:a}=In();return BM(a),(l,u)=>(he(),lt(Fm,zn({...t,...K(o)},{ref:K(s),"trap-focus":K(i).open.value,"disable-outside-pointer-events":!0,onCloseAutoFocus:u[0]||(u[0]=c=>{var f;c.defaultPrevented||(c.preventDefault(),(f=K(i).triggerElement.value)==null||f.focus())}),onPointerDownOutside:u[1]||(u[1]=c=>{const f=c.detail.originalEvent,p=f.button===0&&f.ctrlKey===!0;(f.button===2||p)&&c.preventDefault()}),onFocusOutside:u[2]||(u[2]=c=>{c.preventDefault()})}),{default:Ue(()=>[ut(l.$slots,"default")]),_:3},16,["trap-focus"]))}}),lk=De({__name:"DialogContentNonModal",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=Qu(e);In();const i=Tr(),o=le(!1),s=le(!1);return(a,l)=>(he(),lt(Fm,zn({...t,...K(n)},{"trap-focus":!1,"disable-outside-pointer-events":!1,onCloseAutoFocus:l[0]||(l[0]=u=>{var c;u.defaultPrevented||(o.value||(c=K(i).triggerElement.value)==null||c.focus(),u.preventDefault()),o.value=!1,s.value=!1}),onInteractOutside:l[1]||(l[1]=u=>{var c;u.defaultPrevented||(o.value=!0,u.detail.originalEvent.type==="pointerdown"&&(s.value=!0));const f=u.target;(c=K(i).triggerElement.value)!=null&&c.contains(f)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&s.value&&u.preventDefault()})}),{default:Ue(()=>[ut(a.$slots,"default")]),_:3},16))}}),uk=De({__name:"DialogContent",props:{forceMount:{type:Boolean},trapFocus:{type:Boolean},disableOutsidePointerEvents:{type:Boolean},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","openAutoFocus","closeAutoFocus"],setup(r,{emit:e}){const t=r,n=e,i=Tr(),o=Qu(n),{forwardRef:s}=In();return(a,l)=>(he(),lt(K(km),{present:a.forceMount||K(i).open.value},{default:Ue(()=>[K(i).modal.value?(he(),lt(ak,zn({key:0,ref:K(s)},{...t,...K(o),...a.$attrs}),{default:Ue(()=>[ut(a.$slots,"default")]),_:3},16)):(he(),lt(lk,zn({key:1,ref:K(s)},{...t,...K(o),...a.$attrs}),{default:Ue(()=>[ut(a.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),ck=De({__name:"DialogOverlayImpl",props:{asChild:{type:Boolean},as:{}},setup(r){const e=Tr();return OM(!0),In(),(t,n)=>(he(),lt(K(ls),{as:t.as,"as-child":t.asChild,"data-state":K(e).open.value?"open":"closed",style:{"pointer-events":"auto"}},{default:Ue(()=>[ut(t.$slots,"default")]),_:3},8,["as","as-child","data-state"]))}}),fk=De({__name:"DialogOverlay",props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(r){const e=Tr(),{forwardRef:t}=In();return(n,i)=>{var o;return(o=K(e))!=null&&o.modal.value?(he(),lt(K(km),{key:0,present:n.forceMount||K(e).open.value},{default:Ue(()=>[Re(ck,zn(n.$attrs,{ref:K(t),as:n.as,"as-child":n.asChild}),{default:Ue(()=>[ut(n.$slots,"default")]),_:3},16,["as","as-child"])]),_:3},8,["present"])):nt("",!0)}}});function hk(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}hk();(function(){try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode('[vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32,.72,0,1)}[vaul-drawer][vaul-drawer-direction=bottom]{transform:translate3d(0,100%,0)}[vaul-drawer][vaul-drawer-direction=top]{transform:translate3d(0,-100%,0)}[vaul-drawer][vaul-drawer-direction=left]{transform:translate3d(-100%,0,0)}[vaul-drawer][vaul-drawer-direction=right]{transform:translate3d(100%,0,0)}.vaul-dragging .vaul-scrollable [vault-drawer-direction=top],.vaul-dragging .vaul-scrollable [vault-drawer-direction=bottom]{overflow-y:hidden!important}.vaul-dragging .vaul-scrollable [vault-drawer-direction=left],.vaul-dragging .vaul-scrollable [vault-drawer-direction=right]{overflow-x:hidden!important}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=top],[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height, 0),0)}[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=left],[vaul-drawer][vaul-drawer-visible=true][vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height, 0),0,0)}[vaul-overlay]{opacity:0;transition:opacity .5s cubic-bezier(.32,.72,0,1)}[vaul-overlay][vaul-drawer-visible=true]{opacity:1}[vaul-drawer]:after{content:"";position:absolute;background:inherit;background-color:inherit}[vaul-drawer][vaul-drawer-direction=top]:after{top:initial;bottom:100%;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=bottom]:after{top:100%;bottom:initial;left:0;right:0;height:200%}[vaul-drawer][vaul-drawer-direction=left]:after{left:initial;right:100%;top:0;bottom:0;width:200%}[vaul-drawer][vaul-drawer-direction=right]:after{left:100%;right:initial;top:0;bottom:0;width:200%}[vaul-overlay][vaul-snap-points=true]:not([vaul-snap-points-overlay=true]):not([data-state=closed]){opacity:0}[vaul-overlay][vaul-snap-points-overlay=true]:not([vaul-drawer-visible=false]){opacity:1}@keyframes fake-animation{}@media (hover: hover) and (pointer: fine){[vaul-drawer]{-webkit-user-select:none;user-select:none}}')),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();const dk=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const pk=r=>typeof r<"u";function mk(r){return JSON.parse(JSON.stringify(r))}function Jh(r,e,t,n={}){var i,o,s;const{clone:a=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:f,shouldEmit:p}=n,h=yr(),g=t||(h==null?void 0:h.emit)||((i=h==null?void 0:h.$emit)==null?void 0:i.bind(h))||((s=(o=h==null?void 0:h.proxy)==null?void 0:o.$emit)==null?void 0:s.bind(h==null?void 0:h.proxy));let v=u;e||(e="modelValue"),v=v||`update:${e.toString()}`;const d=_=>a?typeof a=="function"?a(_):mk(_):_,m=()=>pk(r[e])?d(r[e]):f,y=_=>{p?p(_)&&g(v,_):g(v,_)};if(l){const _=m(),C=le(_);let x=!1;return Ge(()=>r[e],b=>{x||(x=!0,C.value=d(b),Qt(()=>x=!1))}),Ge(C,b=>{!x&&(b!==r[e]||c)&&y(b)},{deep:c}),C}else return Ve({get(){return m()},set(_){y(_)}})}const[Lm,gk]=Yu("DrawerRoot"),Nm=new WeakMap;function it(r,e,t=!1){if(!r||!(r instanceof HTMLElement)||!e)return;const n={};Object.entries(e).forEach(([i,o])=>{if(i.startsWith("--")){r.style.setProperty(i,o);return}n[i]=r.style[i],r.style[i]=o}),!t&&Nm.set(r,n)}function mo(r,e){if(!r||!(r instanceof HTMLElement))return;const t=Nm.get(r);t&&(e?r.style[e]=t[e]:Object.entries(t).forEach(([n,i])=>{r.style[n]=i}))}function go(r,e){const t=window.getComputedStyle(r),n=t.transform||t.webkitTransform||t.mozTransform;let i=n.match(/^matrix3d\((.+)\)$/);return i?Number.parseFloat(i[1].split(", ")[vt(e)?13:12]):(i=n.match(/^matrix\((.+)\)$/),i?Number.parseFloat(i[1].split(", ")[vt(e)?5:4]):null)}function vk(r){return 8*(Math.log(r+1)-2)}function vt(r){switch(r){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return r}}const Ye={DURATION:.5,EASE:[.32,.72,0,1]},Dm=.4;function yk({activeSnapPoint:r,snapPoints:e,drawerRef:t,overlayRef:n,fadeFromIndex:i,onSnapPointChange:o,direction:s}){const a=Ve(()=>(e.value&&r.value===e.value[e.value.length-1])??null),l=Ve(()=>e.value&&e.value.length>0&&((i==null?void 0:i.value)||(i==null?void 0:i.value)===0)&&!Number.isNaN(i==null?void 0:i.value)&&e.value[(i==null?void 0:i.value)??-1]===r.value||!e.value),u=Ve(()=>{var d;return((d=e.value)==null?void 0:d.findIndex(m=>m===r.value))??null}),c=Ve(()=>{var d;return((d=e.value)==null?void 0:d.map(m=>{const y=typeof window<"u",_=typeof m=="string";let C=0;if(_&&(C=Number.parseInt(m,10)),vt(s.value)){const b=_?C:y?m*window.innerHeight:0;return y?s.value==="bottom"?window.innerHeight-b:-window.innerHeight+b:b}const x=_?C:y?m*window.innerWidth:0;return y?s.value==="right"?window.innerWidth-x:-window.innerWidth+x:x}))??[]}),f=Ve(()=>{var d;return u.value!==null?(d=c.value)==null?void 0:d[u.value]:null}),p=d=>{var m,y,_,C;const x=((m=c.value)==null?void 0:m.findIndex(b=>b===d))??null;Qt(()=>{var b;o(x,c.value),it((b=t.value)==null?void 0:b.$el,{transition:`transform ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,transform:vt(s.value)?`translate3d(0, ${d}px, 0)`:`translate3d(${d}px, 0, 0)`})}),c.value&&x!==c.value.length-1&&x!==(i==null?void 0:i.value)?it((y=n.value)==null?void 0:y.$el,{transition:`opacity ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,opacity:"0"}):it((_=n.value)==null?void 0:_.$el,{transition:`opacity ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,opacity:"1"}),r.value=x!==null?((C=e.value)==null?void 0:C[x])??null:null};Ge([r,c,e],()=>{var d;if(r.value){const m=((d=e.value)==null?void 0:d.findIndex(y=>y===r.value))??-1;c.value&&m!==-1&&typeof c.value[m]=="number"&&p(c.value[m])}},{immediate:!0});function h({draggedDistance:d,closeDrawer:m,velocity:y,dismissible:_}){var C,x,b;if(i===void 0)return;const E=s.value==="bottom"||s.value==="right"?(f.value??0)-d:(f.value??0)+d,A=u.value===(i.value??0)-1,M=u.value===0,I=d>0;if(A&&it((C=n.value)==null?void 0:C.$el,{transition:`opacity ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`}),y>2&&!I){_?m():p(c.value[0]);return}if(y>2&&I&&c&&e.value){p(c.value[e.value.length-1]);return}const F=(x=c.value)==null?void 0:x.reduce((X,w)=>typeof X!="number"||typeof w!="number"?X:Math.abs(w-E)Dm&&Math.abs(d)0&&a){p(c.value[(((b=e.value)==null?void 0:b.length)??0)-1]);return}if(M&&X<0&&_&&m(),u.value===null)return;p(c.value[u.value+X]);return}p(F)}function g({draggedDistance:d}){var m;if(f.value===null)return;const y=s.value==="bottom"||s.value==="right"?(f.value??0)-d:(f.value??0)+d;(s.value==="bottom"||s.value==="right")&&yc.value[c.value.length-1]||it((m=t.value)==null?void 0:m.$el,{transform:vt(s.value)?`translate3d(0, ${y}px, 0)`:`translate3d(${y}px, 0, 0)`})}function v(d,m){if(!e||typeof u.value!="number"||!c.value||i===void 0)return null;const y=u.value===(i.value??0)-1;if(u.value>=(i.value??0)&&m)return 0;if(y&&!m)return 1;if(!l.value&&!y)return null;const _=y?u.value+1:u.value-1,C=y?c.value[_]-c.value[_-1]:c.value[_+1]-c.value[_],x=d/Math.abs(C);return y?1-x:x}return{isLastSnapPoint:a,shouldFade:l,getPercentageDragged:v,activeSnapPointIndex:u,onRelease:h,onDrag:g,snapPointsOffset:c}}let fi=null;function _k(r){const{isOpen:e,modal:t,nested:n,hasBeenOpened:i}=r,o=le(typeof window<"u"?window.location.href:""),s=le(0);function a(){if(fi===null&&e.value){fi={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height};const{scrollX:u,innerHeight:c}=window;document.body.style.position="fixed",document.body.style.top=`-${s.value}px`,document.body.style.left=`-${u}px`,document.body.style.right="0px",document.body.style.height="auto",setTimeout(()=>{requestAnimationFrame(()=>{const f=c-window.innerHeight;f&&s.value>=c&&(document.body.style.top=`-${s.value+f}px`)})},300)}}function l(){if(fi!==null){const u=-Number.parseInt(document.body.style.top,10),c=-Number.parseInt(document.body.style.left,10);Object.assign(document.body.style,fi),requestAnimationFrame(()=>{if(o.value!==window.location.href){o.value=window.location.href;return}window.scrollTo(c,u)}),fi=null}}return Jt(()=>{function u(){s.value=window.scrollY}u(),window.addEventListener("scroll",u),Gt(()=>{window.removeEventListener("scroll",u)})}),Ge([e,i,o],()=>{n.value||!i.value||(e.value?(!window.matchMedia("(display-mode: standalone)").matches&&a(),t.value||setTimeout(()=>{l()},500)):l())}),{restorePositionSetting:l}}const xk=.25,bk=100,Qh=8,vo=16,wk=26,ed="vaul-dragging";function Tk(r,e){return r&&r.value?r:e}function Sk(r){const{emitDrag:e,emitRelease:t,emitClose:n,emitOpenChange:i,open:o,dismissible:s,nested:a,fixed:l,modal:u,shouldScaleBackground:c,scrollLockTimeout:f,closeThreshold:p,activeSnapPoint:h,fadeFromIndex:g,direction:v}=r,d=le(o.value??!1),m=le(!1),y=le(!1),_=le(!1),C=le(!1),x=le(null),b=le(null),E=le(null),A=le(null),M=le(null),I=le(!0),F=le(null),S=le(0),X=le(!1);le(0);const w=le(null);le(0);const G=Ve(()=>{var H;return((H=w.value)==null?void 0:H.$el.getBoundingClientRect().height)||0}),R=Tk(r.snapPoints,le(void 0)),{activeSnapPointIndex:L,onRelease:N,snapPointsOffset:$,onDrag:P,shouldFade:D,getPercentageDragged:j}=yk({snapPoints:R,activeSnapPoint:h,drawerRef:w,fadeFromIndex:g,overlayRef:x,onSnapPointChange:k,direction:v});function k(H,z){R.value&&H===z.length-1&&(b.value=new Date)}const{restorePositionSetting:ee}=_k({isOpen:d,modal:u,nested:a,hasBeenOpened:m});function Q(){return(window.innerWidth-wk)/window.innerWidth}function ue(H,z){var V;if(!H)return!1;let Z=H;const se=(V=window.getSelection())==null?void 0:V.toString(),ae=w.value?go(w.value.$el,v.value):null,te=new Date;if(Z.hasAttribute("data-vaul-no-drag")||Z.closest("[data-vaul-no-drag]"))return!1;if(v.value==="right"||v.value==="left")return!0;if(b.value&&te.getTime()-b.value.getTime()<500)return!1;if(ae!==null&&(v.value==="bottom"?ae>0:ae<0))return!0;if(se&&se.length>0)return!1;if(M.value&&te.getTime()-M.value.getTime()Z.clientHeight){if(Z.scrollTop!==0)return M.value=new Date,!1;if(Z.getAttribute("role")==="dialog")return!0}Z=Z.parentNode}return!0}function de(H){!s.value&&!R.value||w.value&&!w.value.$el.contains(H.target)||(_.value=!0,E.value=new Date,H.target.setPointerCapture(H.pointerId),S.value=vt(v.value)?H.clientY:H.clientX)}function ne(H){var z,V,Z,se,ae,te;if(w.value&&_.value){const fe=v.value==="bottom"||v.value==="right"?1:-1,ye=(S.value-(vt(v.value)?H.clientY:H.clientX))*fe,pe=ye>0,re=R.value&&!s.value&&!pe;if(re&&L.value===0)return;const ce=Math.abs(ye),me=document.querySelector("[vaul-drawer-wrapper]");let xe=ce/G.value;const Ae=j(ce,pe);if(Ae!==null&&(xe=Ae),re&&xe>=1||!I.value&&!ue(H.target,pe))return;if((z=w==null?void 0:w.value)==null||z.$el.classList.add(ed),I.value=!0,it((V=w.value)==null?void 0:V.$el,{transition:"none"}),it((Z=x.value)==null?void 0:Z.$el,{transition:"none"}),R.value&&P({draggedDistance:ye}),pe&&!R.value){const tt=vk(ye),Oe=Math.min(tt*-1,0)*fe;it((se=w.value)==null?void 0:se.$el,{transform:vt(v.value)?`translate3d(0, ${Oe}px, 0)`:`translate3d(${Oe}px, 0, 0)`});return}const Xe=1-xe;if((D.value||g.value&&L.value===g.value-1)&&(e(xe),it((ae=x.value)==null?void 0:ae.$el,{opacity:`${Xe}`,transition:"none"},!0)),me&&x.value&&c.value){const tt=Math.min(Q()+xe*(1-Q()),1),Oe=8-xe*8,ft=Math.max(0,14-xe*14);it(me,{borderRadius:`${Oe}px`,transform:vt(v.value)?`scale(${tt}) translate3d(0, ${ft}px, 0)`:`scale(${tt}) translate3d(${ft}px, 0, 0)`,transition:"none"},!0)}if(!R.value){const tt=ce*fe;it((te=w.value)==null?void 0:te.$el,{transform:vt(v.value)?`translate3d(0, ${tt}px, 0)`:`translate3d(${tt}px, 0, 0)`})}}}function O(){var H;if(!w.value)return;const z=document.querySelector("[vaul-drawer-wrapper]"),V=go(w.value.$el,v.value);it(w.value.$el,{transform:"translate3d(0, 0, 0)",transition:`transform ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`}),it((H=x.value)==null?void 0:H.$el,{transition:`opacity ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,opacity:"1"}),c.value&&V&&V>0&&d.value&&it(z,{borderRadius:`${Qh}px`,overflow:"hidden",...vt(v.value)?{transform:`scale(${Q()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Q()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ye.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ye.EASE.join(",")})`},!0)}function B(){var H;w.value&&(it(w.value.$el,{transform:vt(v.value)?`translate3d(0, ${v.value==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${v.value==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`}),it((H=x.value)==null?void 0:H.$el,{opacity:"0",transition:`opacity ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`}),oe(!1),window.setTimeout(()=>{y.value=!1,d.value=!1},300),window.setTimeout(()=>{R.value&&(h.value=R.value[0])},Ye.DURATION*1e3))}fn(()=>{if(!d.value&&c.value&&dk){const H=setTimeout(()=>{mo(document.body)},200);return()=>clearTimeout(H)}}),Gt(()=>{oe(!1),ee()});function W(H){if(!_.value||!w.value)return;w.value.$el.classList.remove(ed),I.value=!1,_.value=!1,A.value=new Date;const z=go(w.value.$el,v.value);if(!ue(H.target,!1)||!z||Number.isNaN(z)||E.value===null)return;const V=A.value.getTime()-E.value.getTime(),Z=S.value-(vt(v.value)?H.clientY:H.clientX),se=Math.abs(Z)/V;if(se>.05&&(C.value=!0,window.setTimeout(()=>{C.value=!1},200)),R.value){const te=v.value==="bottom"||v.value==="right"?1:-1;N({draggedDistance:Z*te,closeDrawer:B,velocity:se,dismissible:s.value}),t(!0);return}if(v.value==="bottom"||v.value==="right"?Z>0:Z<0){O(),t(!0);return}if(se>Dm){B(),t(!1);return}const ae=Math.min(w.value.$el.getBoundingClientRect().height??0,window.innerHeight);if(z>=ae*p.value){B(),t(!1);return}t(!0),O()}Ge(d,H=>{H&&(b.value=new Date,oe(!0)),i(H)},{immediate:!0}),Ge(o,H=>{H?(d.value=H,m.value=!0):B()},{immediate:!0});function oe(H){const z=document.querySelector("[vaul-drawer-wrapper]");!z||!c.value||(H?(it(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),it(document.body,{background:"black"},!0),it(z,{borderRadius:`${Qh}px`,overflow:"hidden",...vt(v.value)?{transform:`scale(${Q()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${Q()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Ye.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ye.EASE.join(",")})`})):(mo(z,"overflow"),mo(z,"transform"),mo(z,"borderRadius"),it(z,{transitionProperty:"transform, border-radius",transitionDuration:`${Ye.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Ye.EASE.join(",")})`})))}function ie(H){var z,V;const Z=H?(window.innerWidth-vo)/window.innerWidth:1,se=H?-16:0;F.value&&window.clearTimeout(F.value),it((z=w.value)==null?void 0:z.$el,{transition:`transform ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,transform:`scale(${Z}) translate3d(0, ${se}px, 0)`}),!H&&(V=w.value)!=null&&V.$el&&(F.value=window.setTimeout(()=>{var ae,te;const fe=go((ae=w.value)==null?void 0:ae.$el,v.value);it((te=w.value)==null?void 0:te.$el,{transition:"none",transform:vt(v.value)?`translate3d(0, ${fe}px, 0)`:`translate3d(${fe}px, 0, 0)`})},500))}function T(H){var z;if(H<0)return;const V=vt(v.value)?window.innerHeight:window.innerWidth,Z=(V-vo)/V,se=Z+H*(1-Z),ae=-16+H*vo;it((z=w.value)==null?void 0:z.$el,{transform:vt(v.value)?`scale(${se}) translate3d(0, ${ae}px, 0)`:`scale(${se}) translate3d(${ae}px, 0, 0)`,transition:"none"})}function J(H){var z;const V=vt(v.value)?window.innerHeight:window.innerWidth,Z=H?(V-vo)/V:1,se=H?-16:0;H&&it((z=w.value)==null?void 0:z.$el,{transition:`transform ${Ye.DURATION}s cubic-bezier(${Ye.EASE.join(",")})`,transform:vt(v.value)?`scale(${Z}) translate3d(0, ${se}px, 0)`:`scale(${Z}) translate3d(${se}px, 0, 0)`})}return{open:o,isOpen:d,modal:u,keyboardIsOpen:X,hasBeenOpened:m,isVisible:y,drawerRef:w,drawerHeightRef:G,overlayRef:x,isDragging:_,dragStartTime:E,isAllowedToDrag:I,snapPoints:R,activeSnapPoint:h,pointerStart:S,dismissible:s,snapPointsOffset:$,direction:v,shouldFade:D,fadeFromIndex:g,shouldScaleBackground:c,onPress:de,onDrag:ne,onRelease:W,closeDrawer:B,onNestedDrag:T,onNestedRelease:J,onNestedOpenChange:ie,emitClose:n,emitDrag:e,emitRelease:t,emitOpenChange:i,nested:a}}const Ek=De({__name:"DrawerRoot",props:{activeSnapPoint:{default:void 0},closeThreshold:{default:xk},shouldScaleBackground:{type:Boolean,default:void 0},scrollLockTimeout:{default:bk},fixed:{type:Boolean,default:void 0},dismissible:{type:Boolean,default:!0},modal:{type:Boolean,default:!0},open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:void 0},nested:{type:Boolean,default:!1},direction:{default:"bottom"},snapPoints:{default:void 0},fadeFromIndex:{default:void 0}},emits:["drag","release","close","update:open","update:activeSnapPoint"],setup(r,{expose:e,emit:t}){const n=r,i=t;ud();const o=Ve(()=>n.fadeFromIndex??(n.snapPoints&&n.snapPoints.length-1)),s=Jh(n,"open",i,{defaultValue:n.defaultOpen,passive:n.open===void 0}),a=Jh(n,"activeSnapPoint",i,{passive:n.activeSnapPoint===void 0}),l={emitDrag:g=>i("drag",g),emitRelease:g=>i("release",g),emitClose:()=>i("close"),emitOpenChange:g=>{i("update:open",g)}},{closeDrawer:u,hasBeenOpened:c,modal:f,isOpen:p}=gk(Sk({...l,...Yr(n),activeSnapPoint:a,fadeFromIndex:o,open:s}));function h(g){if(s.value!==void 0){l.emitOpenChange(g);return}g?(c.value=!0,p.value=g):u()}return e({open:p}),(g,v)=>(he(),lt(K(GM),{open:K(p),modal:K(f),"onUpdate:open":h},{default:Ue(()=>[ut(g.$slots,"default",{open:K(p)})]),_:3},8,["open","modal"]))}}),Ck=De({__name:"DrawerOverlay",setup(r){const{overlayRef:e,snapPoints:t,isVisible:n,isOpen:i,shouldFade:o}=Lm(),s=Ve(()=>{var a;return t&&(((a=t.value)==null?void 0:a.length)??0)>0});return(a,l)=>(he(),lt(K(fk),{ref_key:"overlayRef",ref:e,"vaul-drawer-visible":K(n)?"true":"false","vaul-overlay":"","vaul-snap-points":K(i)&&s.value?"true":"false","vaul-snap-points-overlay":K(i)&&K(o)?"true":"false"},null,8,["vaul-drawer-visible","vaul-snap-points","vaul-snap-points-overlay"]))}}),Ak=De({__name:"DrawerContent",setup(r){const{open:e,isOpen:t,isVisible:n,snapPointsOffset:i,drawerRef:o,onPress:s,onDrag:a,onRelease:l,modal:u,emitOpenChange:c,dismissible:f,keyboardIsOpen:p,closeDrawer:h,direction:g}=Lm(),v=Ve(()=>i.value&&i.value.length>0?`${i.value[0]}px`:"0");function d(m){if(!u.value||m.defaultPrevented){m.preventDefault();return}p.value&&(p.value=!1),m.preventDefault(),f.value&&c(!1),!(!f.value||e.value!==void 0)&&h()}return Ge(t,m=>{m&&setTimeout(()=>{n.value=!0},1)},{immediate:!0}),(m,y)=>(he(),lt(K(uk),{ref_key:"drawerRef",ref:o,"vaul-drawer":"","vaul-drawer-direction":K(g),"vaul-drawer-visible":K(n)?"true":"false",style:qr({"--snap-point-height":v.value}),onPointerdown:K(s),onPointermove:K(a),onPointerup:K(l),onPointerDownOutside:d,onEscapeKeyDown:y[0]||(y[0]=_=>{K(f)||_.preventDefault()})},{default:Ue(()=>[ut(m.$slots,"default")]),_:3},8,["vaul-drawer-direction","vaul-drawer-visible","style","onPointerdown","onPointermove","onPointerup"]))}}),Ik={py:"1",flex:"~ col",rounded:"lg","overflow-hidden":""},Pk={key:0,flex:"",mr:"12"},Mk={flex:"~ col",border:"4 solid pink-200/50 dark:pink-500/50",shadow:"md pink-200/50 dark:none","min-w-20":"","rounded-lg":"","px-2":"","py-1":"",h:"unset {Qt().then(()=>{n.update(),i.value=n.height.value})}),a(async()=>{Qt().then(()=>{n.update(),i.value=n.height.value})}),(l,u)=>{const c=Ad("auto-animate");return he(),_e("div",Ik,[u[1]||(u[1]=Y("div",{"flex-1":""},null,-1)),ht((he(),_e("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"","max-h":"30vh",flex:"~ col","overflow-scroll":""},[u[0]||(u[0]=Y("div",{"flex-1":""},null,-1)),(he(!0),_e(Un,null,mr(K(t),(f,p)=>(he(),_e("div",{key:p,"mb-2":""},[f.role==="assistant"?(he(),_e("div",Pk,[Y("div",Mk,[Y("div",null,[Y("span",kk,be(l.$t("stage.chat.message.character-name.airi")),1)]),f.content?(he(),_e("div",{key:0,class:"markdown-content",text:"base y.id===d.value);if(!m){a.value=void 0;return}a.value=m}function h(v){const d=v.target;n.stageView=d.value}function g(v){const d=v.target.value;switch(t.value){case"en":case"en-US":c.value=d;break;case"zh":case"zh-CN":case"zh-TW":case"zh-HK":c.value=d;break;case"jp":case"jp-JP":f.value=d;break}}return Ge([l,u],async([v,d])=>{if(!v||!d){o.value=[];return}o.value=await s(v,d)}),Jt(async()=>{!l.value||!u.value||(o.value=await s(l.value,u.value))}),(v,d)=>(he(),_e("div",null,[Y("h2",zk,be(K(e)("settings.title")),1),Y("div",null,[Y("div",jk,[Y("div",Vk,[Y("span",null,be(K(e)("settings.openai-base-url.label")),1)]),Y("div",Gk,[ht(Y("input",{"onUpdate:modelValue":d[0]||(d[0]=m=>K(n).openAiApiBaseURL=m),type:"text",placeholder:K(e)("settings.openai-base-url.placeholder_mobile"),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},null,8,$k),[[Dr,K(n).openAiApiBaseURL]])]),Y("div",Hk,[Y("span",null,be(K(e)("settings.openai-api-key.label")),1)]),Y("div",Xk,[ht(Y("input",{"onUpdate:modelValue":d[1]||(d[1]=m=>K(n).openAiApiKey=m),type:"text",placeholder:K(e)("settings.openai-api-key.placeholder_mobile"),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},null,8,Wk),[[Dr,K(n).openAiApiKey]])]),Y("div",qk,[Y("span",null,be(K(e)("settings.elevenlabs-api-key.label")),1)]),Y("div",Yk,[ht(Y("input",{"onUpdate:modelValue":d[2]||(d[2]=m=>K(n).elevenLabsApiKey=m),type:"text",placeholder:K(e)("settings.elevenlabs-api-key.placeholder_mobile"),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},null,8,Kk),[[Dr,K(n).elevenLabsApiKey]])]),Y("div",Zk,[Y("span",null,be(K(e)("settings.language.title")),1)]),Y("div",Jk,[ht(Y("select",{"onUpdate:modelValue":d[3]||(d[3]=m=>K(n).language=m),"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":""},[Y("option",Qk,be(K(e)("settings.language.english")),1),Y("option",eO,be(K(e)("settings.language.chinese")),1)],512),[[Td,K(n).language]])]),Y("div",tO,[Y("span",null,be(K(e)("settings.models")),1)]),Y("div",nO,[Y("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:p},[Y("option",rO,be(K(e)("stage.select-a-model")),1),K(n).openAiModel?(he(),_e("option",{key:0,value:K(n).openAiModel.id},be("name"in K(n).openAiModel?`${K(n).openAiModel.name} (${K(n).openAiModel.id})`:K(n).openAiModel.id),9,iO)):nt("",!0),(he(!0),_e(Un,null,mr(o.value,m=>(he(),_e("option",{key:m.id,value:m.id},be("name"in m?`${m.name} (${m.id})`:m.id),9,oO))),128))],32)]),Y("div",sO,[Y("span",null,be(K(e)("settings.voices")),1)]),Y("div",aO,[Y("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:g},[Y("option",lO,be(K(e)("stage.select-a-voice")),1),["en","en-US"].indexOf(K(t))!==-1&&K(c)?(he(),_e("option",{key:0,value:K(c)},be(K(c)),9,uO)):nt("",!0),["zh","zh-CN","zh-TW","zh-HK"].indexOf(K(t))!==-1&&K(c)?(he(),_e("option",{key:1,value:K(c)},be(K(c)),9,cO)):nt("",!0),["jp","jp-JP"].indexOf(K(t))!==-1&&K(f)?(he(),_e("option",{key:2,value:K(f)},be(K(f)),9,fO)):nt("",!0),(he(!0),_e(Un,null,mr(K(Sd)[K(t)],(m,y)=>(he(),_e("option",{key:y,value:m},be(m),9,hO))),128))],32)])])]),d[8]||(d[8]=Y("h2",{text:"slate-800/80 dark:slate-200/80 xl","font-bold":""}," View ",-1)),Y("div",null,[Y("div",dO,[d[6]||(d[6]=Y("div",{text:"sm pink-500"},[Y("span",null,"Viewer")],-1)),Y("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:h},d[5]||(d[5]=[Y("option",{value:"2d"}," 2D ",-1),Y("option",{value:"3d"}," 3D ",-1)]),32),d[7]||(d[7]=Y("div",{text:"sm pink-500"},[Y("span",null,"Theme")],-1)),Y("label",pO,[ht(Y("input",{"onUpdate:modelValue":d[4]||(d[4]=m=>iu(i)?i.value=m:null),checked:K(i),"aria-checked":K(i),name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,mO),[[Xr,K(i)]]),Y("div",gO,[Re(Ko,{name:"slide-away",mode:"out-in"},{default:Ue(()=>[K(i)?(he(),_e("div",vO)):(he(),_e("div",yO))]),_:1})])])])])]))}}),xO={relative:"","w-full":"",flex:"","gap-1":""},bO={flex:"","flex-1":""},wO={class:"flex flex-1 flex-col rounded-t-lg p-5",bg:"[#fffbff] dark:[#1f1a1d]","gap-2":""},TO=De({__name:"MobileInteractiveArea",setup(r){const e=le(""),t=le(!1),{isAudioInputOn:n,selectedAudioDeviceId:i}=Cn(Zr()),{send:o,onAfterSend:s}=vr(),{t:a}=Kr();async function l(){e.value.trim()&&await o(e.value)}const{destroy:u,start:c}=Sm(i,{onSpeechStart:()=>{t.value=!0},onVADMisfire:()=>{t.value=!1},onSpeechEnd:p=>{t.value=!1,f()},auto:!1});function f(p){alert("Transcription is not implemented yet")}return Ge(n,async p=>{p==="false"&&u()}),s(async()=>{e.value=""}),Jt(()=>{c()}),(p,h)=>(he(),_e("div",null,[Y("div",xO,[Re(Uk,{absolute:"","left-0":"","top-0":"",transform:"translate-y-[-100%]","w-full":""}),Y("div",bO,[Re(K(pv),{modelValue:e.value,"onUpdate:modelValue":h[0]||(h[0]=g=>e.value=g),placeholder:K(a)("stage.message"),border:"solid 2 pink-100 dark:pink-400/20",text:"pink-400 hover:pink-600 dark:[#905073] dark:hover:pink-600 placeholder:pink-400 placeholder:hover:pink-600 placeholder:dark:[#905073] placeholder:dark:hover:pink-600",bg:"pink-50 dark:[#3c2632]","max-h":"[10lh]","min-h":"[1lh]","w-full":"","resize-none":"","overflow-y-scroll":"","rounded-l-xl":"","p-2":"","font-medium":"","outline-none":"",transition:"all duration-250 ease-in-out placeholder:all placeholder:duration-250 placeholder:ease-in-out",onSubmit:l},null,8,["modelValue","placeholder"])]),Re(K(Ek),{"should-scale-background":""},{default:Ue(()=>[Re(K($M),{class:"px-4 py-2.5",border:"solid 2 pink-100 dark:pink-400/20",text:"lg pink-400 hover:pink-600 dark:[#905073] dark:hover:pink-600 placeholder:pink-400 placeholder:hover:pink-600 placeholder:dark:[#905073] placeholder:dark:hover:pink-600",bg:"pink-50 dark:[#3c2632]","max-h":"[10lh]","min-h":"[1lh]","rounded-r-xl":""},{default:Ue(()=>h[1]||(h[1]=[Y("div",{"i-solar:settings-bold-duotone":""},null,-1)])),_:1}),Re(K(XM),null,{default:Ue(()=>[Re(K(Ck),{class:"fixed inset-0 z-50 bg-black/40"}),Re(K(Ak),{"max-h":"[75%]",fixed:"","bottom-0":"","left-0":"","right-0":"","z-50":"","mt-24":"","h-full":"",flex:"","flex-col":"","rounded-t-lg":"",bg:"[#fffbff] dark:[#1f1a1d]"},{default:Ue(()=>[Y("div",wO,[Re(_O)])]),_:1})]),_:1})]),_:1})])]))}}),SO={relative:"","max-h":"[100vh]","max-w":"[100vw]",p:"2",flex:"~ col","z-2":"","h-full":"","overflow-hidden":""},EO={flex:"~ 1 row (he(),lt(AI,{"h-full":"","w-full":""},{default:Ue(()=>[Re(kI,{"h-full":"","w-full":"","fill-color":K(e)?"#563544":"#f8e8f2"},{default:Ue(()=>[Y("div",SO,[Re(_P,{class:"flex