diff --git "a/assets/index-Cv4Zshkj.js" "b/assets/index-Cv4Zshkj.js" new file mode 100644--- /dev/null +++ "b/assets/index-Cv4Zshkj.js" @@ -0,0 +1,3608 @@ +var cg=Object.defineProperty;var fg=(r,e,t)=>e in r?cg(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var dc=(r,e,t)=>fg(r,typeof e!="symbol"?e+"":e,t);import{g as lu,e as Nn,f as hg,d as De,h as le,i as Ve,j as qo,k as xd,l as Yo,m as dg,w as Ge,p as $t,q as Ht,o as de,c as xe,s as bd,t as pg,v as ut,r as Io,x as lt,y as Ue,a as Fe,z as Y,A as Jt,B as dt,C as Kr,D as we,b as K,E as tt,F as It,G as wd,I as Td,H as uu,V as Re,S as Ni,U as cu,J as mg,T as gg,K as Sd,R as vg,P as Ed,M as Tn,L as fu,N as Un,O as yg,Q as Cd,W as gr,X as _t,Y as Ci,Z as Ad,_ as Jr,$ as Ln,a0 as hu,a1 as Id,a2 as Md,a3 as _g,a4 as du,a5 as xg,a6 as hn,a7 as Ko,a8 as bg,a9 as Ai,aa as pu,ab as wg,ac as Ar,ad as Mo,ae as Dn,af as zr,ag as pc,ah as hr,ai as Tg,aj as Sg,ak as Eg,al as Cg,am as kd,an as Pd,ao as vs,ap as ko,aq as Ya,ar as ur,as as Rd,at as Ka,au as Dr,av as mc,aw as cr,ax as Br,ay as ys,az as Ag,aA as Ig,aB as Mg,aC as kg,aD as Pg,aE as Od,aF as Fd,aG as Po,aH as Ld,aI as mu,aJ as Ro,aK as Nd,aL as Zo,aM as Rg,aN as Og,aO as gc,n as Zr,aP as Fg,aQ as Za,aR as Dd,aS as Lg,aT as bi,aU as Bd,aV as Sn,aW as Ng,aX as Dg,aY as Bg,aZ as Ii,a_ as gn,a$ as Ug,b0 as zg,b1 as Ud,b2 as jg,b3 as Vg,b4 as Gg,b5 as _s,b6 as $g,b7 as zd,b8 as Hg,b9 as Xg,ba as Wg,bb as qg,bc as Yg,bd as xs,be as Kg,bf as Zg,bg as Jg,bh as vc,bi as Qg,bj as yc,bk as _c,bl as xc,bm as ev,bn as tv,bo as nv,bp as Jo,bq as Qr,br as En,bs as ei,bt as rv,bu as iv,bv as ov,bw as wi,bx as jr,by as jd,bz as zn,bA as vr,bB as Vd,bC as Gd,bD as sv,bE as av,bF as lv,bG as uv,bH as $d,bI as en,bJ as Hd,bK as cv,bL as Xd,bM as Wd,bN as jn,bO as fv,bP as hv,bQ as dv,bR as wo,bS as pv,bT as mv,bU as gv,bV as vv,bW as yv,bX as xr,bY as _v,bZ as xv,b_ as qd}from"./index-Dq5Soe4V.js";import{E as bv,a as wv,b as Tv,c as Sv,d as Ev,e as Cv,f as Yd,g as Av,u as Iv,h as Mv,i as kv,l as Pv,j as Rv,k as Ov,_ as Fv}from"./queues-BE_d_S5r.js";import{V as Lv,a as Nv,c as Dv,b as bc,d as Bv,e as wc}from"./index-aMALcyU0.js";import{u as bs}from"./queue-DznLIPR5.js";import{_ as Qo}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 Cn;(function(r){r[r.WEBGL_LEGACY=0]="WEBGL_LEGACY",r[r.WEBGL=1]="WEBGL",r[r.WEBGL2=2]="WEBGL2"})(Cn||(Cn={}));var Mi;(function(r){r[r.UNKNOWN=0]="UNKNOWN",r[r.WEBGL=1]="WEBGL",r[r.CANVAS=2]="CANVAS"})(Mi||(Mi={}));var Oo;(function(r){r[r.COLOR=16384]="COLOR",r[r.DEPTH=256]="DEPTH",r[r.STENCIL=1024]="STENCIL"})(Oo||(Oo={}));var Ie;(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"})(Ie||(Ie={}));var ki;(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"})(ki||(ki={}));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 dr;(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"})(dr||(dr={}));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 Fo;(function(r){r[r.FLOAT=0]="FLOAT",r[r.INT=1]="INT",r[r.UINT=2]="UINT"})(Fo||(Fo={}));var zt;(function(r){r[r.NEAREST=0]="NEAREST",r[r.LINEAR=1]="LINEAR"})(zt||(zt={}));var Lo;(function(r){r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"})(Lo||(Lo={}));var dn;(function(r){r[r.OFF=0]="OFF",r[r.POW2=1]="POW2",r[r.ON=2]="ON",r[r.ON_MANUAL=3]="ON_MANUAL"})(dn||(dn={}));var Vn;(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"})(Vn||(Vn={}));var rn;(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"})(rn||(rn={}));var No;(function(r){r[r.AUTO=0]="AUTO",r[r.MANUAL=1]="MANUAL"})(No||(No={}));var jt;(function(r){r.LOW="lowp",r.MEDIUM="mediump",r.HIGH="highp"})(jt||(jt={}));var gt;(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"})(gt||(gt={}));var Tc;(function(r){r[r.RED=1]="RED",r[r.GREEN=2]="GREEN",r[r.BLUE=4]="BLUE",r[r.ALPHA=8]="ALPHA"})(Tc||(Tc={}));var pt;(function(r){r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH"})(pt||(pt={}));var fn;(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"})(fn||(fn={}));/*! + * @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 Uv={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)}},ws=/iPhone/i,Sc=/iPod/i,Ec=/iPad/i,Cc=/\biOS-universal(?:.+)Mac\b/i,Ts=/\bAndroid(?:.+)Mobile\b/i,Ac=/Android/i,Ir=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,$i=/Silk/i,vn=/Windows Phone/i,Ic=/\bWindows(?:.+)ARM\b/i,Mc=/BlackBerry/i,kc=/BB10/i,Pc=/Opera Mini/i,Rc=/\b(CriOS|Chrome)(?:.+)Mobile/i,Oc=/Mobile(?:.+)Firefox\b/i,Fc=function(r){return typeof r<"u"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream>"u"};function zv(r){return function(e){return e.test(r)}}function jv(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=zv(t),o={apple:{phone:i(ws)&&!i(vn),ipod:i(Sc),tablet:!i(ws)&&(i(Ec)||Fc(e))&&!i(vn),universal:i(Cc),device:(i(ws)||i(Sc)||i(Ec)||i(Cc)||Fc(e))&&!i(vn)},amazon:{phone:i(Ir),tablet:!i(Ir)&&i($i),device:i(Ir)||i($i)},android:{phone:!i(vn)&&i(Ir)||!i(vn)&&i(Ts),tablet:!i(vn)&&!i(Ir)&&!i(Ts)&&(i($i)||i(Ac)),device:!i(vn)&&(i(Ir)||i($i)||i(Ts)||i(Ac))||i(/\bokhttp\b/i)},windows:{phone:i(vn),tablet:i(Ic),device:i(vn)||i(Ic)},other:{blackberry:i(Mc),blackberry10:i(kc),opera:i(Pc),firefox:i(Oc),chrome:i(Rc),device:i(Mc)||i(kc)||i(Pc)||i(Oc)||i(Rc)},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 fr=jv(globalThis.navigator);function Vv(){return!fr.apple.device}function Gv(r){var e=!0;if(fr.tablet||fr.phone){if(fr.apple.device){var t=navigator.userAgent.match(/OS (\d+)_(\d+)?/);if(t){var n=parseInt(t[1],10);n<11&&(e=!1)}}if(fr.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:Uv,MIPMAP_TEXTURES:dn.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:pt.NONE,SPRITE_MAX_TEXTURES:Gv(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:No.AUTO,GC_MAX_IDLE:60*60,GC_MAX_CHECK_COUNT:60*10,WRAP_MODE:Lo.CLAMP,SCALE_MODE:zt.LINEAR,PRECISION_VERTEX:jt.HIGH,PRECISION_FRAGMENT:fr.apple.device?jt.HIGH:jt.MEDIUM,CAN_UPLOAD_SAME_BUFFER:Vv(),CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},Ss={exports:{}},Lc;function $v(){return Lc||(Lc=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,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var h=new i(c,f||l,d),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 d=0,h=f.length,g=new Array(h);d80*L){P=Q=F[0],J=ce=F[1];for(var B=L;BQ&&(Q=pe),te>ce&&(ce=te);R=Math.max(Q-P,ce-J),R=R!==0?32767/R:0}return n(N,V,L,P,J,R,0),V}function e(F,D,L,$,k){var N,V;if(k===G(F,D,L,$)>0)for(N=D;N=D;N-=$)V=C(N,F[N],F[N+1],V);return V&&A(V,V.next)&&(X(V),V=V.next),V}function t(F,D){if(!F)return F;D||(D=F);var L=F,$;do if($=!1,!L.steiner&&(A(L,L.next)||_(L.prev,L,L.next)===0)){if(X(L),L=D=L.prev,L===L.next)break;$=!0}else L=L.next;while($||L!==D);return D}function n(F,D,L,$,k,N,V){if(F){!V&&N&&h(F,$,k,N);for(var P=F,J,Q;F.prev!==F.next;){if(J=F.prev,Q=F.next,N?o(F,$,k,N):i(F)){D.push(J.i/L|0),D.push(F.i/L|0),D.push(Q.i/L|0),X(F),F=Q.next,P=Q.next;continue}if(F=Q,F===P){V?V===1?(F=s(t(F),D,L),n(F,D,L,$,k,N,2)):V===2&&a(F,D,L,$,k,N):n(t(F),D,L,$,k,N,1);break}}}}function i(F){var D=F.prev,L=F,$=F.next;if(_(D,L,$)>=0)return!1;for(var k=D.x,N=L.x,V=$.x,P=D.y,J=L.y,Q=$.y,ce=kN?k>V?k:V:N>V?N:V,R=P>J?P>Q?P:Q:J>Q?J:Q,B=$.next;B!==D;){if(B.x>=ce&&B.x<=te&&B.y>=pe&&B.y<=R&&m(k,P,N,J,V,Q,B.x,B.y)&&_(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function o(F,D,L,$){var k=F.prev,N=F,V=F.next;if(_(k,N,V)>=0)return!1;for(var P=k.x,J=N.x,Q=V.x,ce=k.y,pe=N.y,te=V.y,R=PJ?P>Q?P:Q:J>Q?J:Q,oe=ce>pe?ce>te?ce:te:pe>te?pe:te,ie=v(R,B,D,L,$),S=v(W,oe,D,L,$),Z=F.prevZ,H=F.nextZ;Z&&Z.z>=ie&&H&&H.z<=S;){if(Z.x>=R&&Z.x<=W&&Z.y>=B&&Z.y<=oe&&Z!==k&&Z!==V&&m(P,ce,J,pe,Q,te,Z.x,Z.y)&&_(Z.prev,Z,Z.next)>=0||(Z=Z.prevZ,H.x>=R&&H.x<=W&&H.y>=B&&H.y<=oe&&H!==k&&H!==V&&m(P,ce,J,pe,Q,te,H.x,H.y)&&_(H.prev,H,H.next)>=0))return!1;H=H.nextZ}for(;Z&&Z.z>=ie;){if(Z.x>=R&&Z.x<=W&&Z.y>=B&&Z.y<=oe&&Z!==k&&Z!==V&&m(P,ce,J,pe,Q,te,Z.x,Z.y)&&_(Z.prev,Z,Z.next)>=0)return!1;Z=Z.prevZ}for(;H&&H.z<=S;){if(H.x>=R&&H.x<=W&&H.y>=B&&H.y<=oe&&H!==k&&H!==V&&m(P,ce,J,pe,Q,te,H.x,H.y)&&_(H.prev,H,H.next)>=0)return!1;H=H.nextZ}return!0}function s(F,D,L){var $=F;do{var k=$.prev,N=$.next.next;!A(k,N)&&b(k,$,$.next,N)&&E(k,N)&&E(N,k)&&(D.push(k.i/L|0),D.push($.i/L|0),D.push(N.i/L|0),X($),X($.next),$=F=N),$=$.next}while($!==F);return t($)}function a(F,D,L,$,k,N){var V=F;do{for(var P=V.next.next;P!==V.prev;){if(V.i!==P.i&&y(V,P)){var J=O(V,P);V=t(V,V.next),J=t(J,J.next),n(V,D,L,$,k,N,0),n(J,D,L,$,k,N,0);return}P=P.next}V=V.next}while(V!==F)}function l(F,D,L,$){var k=[],N,V,P,J,Q;for(N=0,V=D.length;N=L.next.y&&L.next.y!==L.y){var P=L.x+(k-L.y)*(L.next.x-L.x)/(L.next.y-L.y);if(P<=$&&P>N&&(N=P,V=L.x=L.x&&L.x>=Q&&$!==L.x&&m(kV.x||L.x===V.x&&d(V,L)))&&(V=L,pe=te)),L=L.next;while(L!==J);return V}function d(F,D){return _(F.prev,F,D.prev)<0&&_(D.next,F,F.next)<0}function h(F,D,L,$){var k=F;do k.z===0&&(k.z=v(k.x,k.y,D,L,$)),k.prevZ=k.prev,k.nextZ=k.next,k=k.next;while(k!==F);k.prevZ.nextZ=null,k.prevZ=null,g(k)}function g(F){var D,L,$,k,N,V,P,J,Q=1;do{for(L=F,F=null,N=null,V=0;L;){for(V++,$=L,P=0,D=0;D0||J>0&&$;)P!==0&&(J===0||!$||L.z<=$.z)?(k=L,L=L.nextZ,P--):(k=$,$=$.nextZ,J--),N?N.nextZ=k:F=k,k.prevZ=N,N=k;L=$}N.nextZ=null,Q*=2}while(V>1);return F}function v(F,D,L,$,k){return F=(F-L)*k|0,D=(D-$)*k|0,F=(F|F<<8)&16711935,F=(F|F<<4)&252645135,F=(F|F<<2)&858993459,F=(F|F<<1)&1431655765,D=(D|D<<8)&16711935,D=(D|D<<4)&252645135,D=(D|D<<2)&858993459,D=(D|D<<1)&1431655765,F|D<<1}function p(F){var D=F,L=F;do(D.x=(F-V)*(N-P)&&(F-V)*($-P)>=(L-V)*(D-P)&&(L-V)*(N-P)>=(k-V)*($-P)}function y(F,D){return F.next.i!==D.i&&F.prev.i!==D.i&&!M(F,D)&&(E(F,D)&&E(D,F)&&I(F,D)&&(_(F.prev,F,D.prev)||_(F,D.prev,D))||A(F,D)&&_(F.prev,F,F.next)>0&&_(D.prev,D,D.next)>0)}function _(F,D,L){return(D.y-F.y)*(L.x-D.x)-(D.x-F.x)*(L.y-D.y)}function A(F,D){return F.x===D.x&&F.y===D.y}function b(F,D,L,$){var k=w(_(F,D,L)),N=w(_(F,D,$)),V=w(_(L,$,F)),P=w(_(L,$,D));return!!(k!==N&&V!==P||k===0&&x(F,L,D)||N===0&&x(F,$,D)||V===0&&x(L,F,$)||P===0&&x(L,D,$))}function x(F,D,L){return D.x<=Math.max(F.x,L.x)&&D.x>=Math.min(F.x,L.x)&&D.y<=Math.max(F.y,L.y)&&D.y>=Math.min(F.y,L.y)}function w(F){return F>0?1:F<0?-1:0}function M(F,D){var L=F;do{if(L.i!==F.i&&L.next.i!==F.i&&L.i!==D.i&&L.next.i!==D.i&&b(L,L.next,F,D))return!0;L=L.next}while(L!==F);return!1}function E(F,D){return _(F.prev,F,F.next)<0?_(F,D,F.next)>=0&&_(F,F.prev,D)>=0:_(F,D,F.prev)<0||_(F,F.next,D)<0}function I(F,D){var L=F,$=!1,k=(F.x+D.x)/2,N=(F.y+D.y)/2;do L.y>N!=L.next.y>N&&L.next.y!==L.y&&k<(L.next.x-L.x)*(N-L.y)/(L.next.y-L.y)+L.x&&($=!$),L=L.next;while(L!==F);return $}function O(F,D){var L=new T(F.i,F.x,F.y),$=new T(D.i,D.x,D.y),k=F.next,N=D.prev;return F.next=D,D.prev=F,L.next=k,k.prev=L,$.next=L,L.prev=$,N.next=$,$.prev=N,$}function C(F,D,L,$){var k=new T(F,D,L);return $?(k.next=$.next,k.prev=$,$.next.prev=k,$.next=k):(k.prev=k,k.next=k),k}function X(F){F.next.prev=F.prev,F.prev.next=F.next,F.prevZ&&(F.prevZ.nextZ=F.nextZ),F.nextZ&&(F.nextZ.prevZ=F.prevZ)}function T(F,D,L){this.i=F,this.x=D,this.y=L,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}r.deviation=function(F,D,L,$){var k=D&&D.length,N=k?D[0]*L:F.length,V=Math.abs(G(F,0,N,L));if(k)for(var P=0,J=D.length;P0&&($+=F[k-1].length,L.holes.push($))}return L},Hi.exports}Xv();var qn={},mi={exports:{}};/*! https://mths.be/punycode v1.4.1 by @mathias */var Wv=mi.exports,Dc;function qv(){return Dc||(Dc=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,d=700,h=72,g=128,v="-",p=/^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"},A=l-u,b=Math.floor,x=String.fromCharCode,w;function M(k){throw new RangeError(_[k])}function E(k,N){for(var V=k.length,P=[];V--;)P[V]=N(k[V]);return P}function I(k,N){var V=k.split("@"),P="";V.length>1&&(P=V[0]+"@",k=V[1]),k=k.replace(y,".");var J=k.split("."),Q=E(J,N).join(".");return P+Q}function O(k){for(var N=[],V=0,P=k.length,J,Q;V=55296&&J<=56319&&V65535&&(N-=65536,V+=x(N>>>10&1023|55296),N=56320|N&1023),V+=x(N),V}).join("")}function X(k){return k-48<10?k-22:k-65<26?k-65:k-97<26?k-97:l}function T(k,N){return k+22+75*(k<26)-((N!=0)<<5)}function G(k,N,V){var P=0;for(k=V?b(k/d):k>>1,k+=b(k/N);k>A*c>>1;P+=l)k=b(k/A);return b(P+(A+1)*k/(k+f))}function F(k){var N=[],V=k.length,P,J=0,Q=g,ce=h,pe,te,R,B,W,oe,ie,S,Z;for(pe=k.lastIndexOf(v),pe<0&&(pe=0),te=0;te=128&&M("not-basic"),N.push(k.charCodeAt(te));for(R=pe>0?pe+1:0;R=V&&M("invalid-input"),ie=X(k.charCodeAt(R++)),(ie>=l||ie>b((a-J)/W))&&M("overflow"),J+=ie*W,S=oe<=ce?u:oe>=ce+c?c:oe-ce,!(ieb(a/Z)&&M("overflow"),W*=Z;P=N.length+1,ce=G(J-B,P,B==0),b(J/P)>a-Q&&M("overflow"),Q+=b(J/P),J%=P,N.splice(J++,0,Q)}return C(N)}function D(k){var N,V,P,J,Q,ce,pe,te,R,B,W,oe=[],ie,S,Z,H;for(k=O(k),ie=k.length,N=g,V=0,Q=h,ce=0;ce=N&&Wb((a-V)/S)&&M("overflow"),V+=(pe-N)*S,N=pe,ce=0;cea&&M("overflow"),W==N){for(te=V,R=l;B=R<=Q?u:R>=Q+c?c:R-Q,!(te"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%":p,"%AsyncGenerator%":p,"%AsyncGeneratorFunction%":p,"%AsyncIteratorPrototype%":p,"%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%":p,"%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%":d,"%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(D){var _=v(v(D));y["%Error.prototype%"]=_}var A=function D(L){var $;if(L==="%AsyncFunction%")$=u("async function () {}");else if(L==="%GeneratorFunction%")$=u("function* () {}");else if(L==="%AsyncGeneratorFunction%")$=u("async function* () {}");else if(L==="%AsyncGenerator%"){var k=D("%AsyncGeneratorFunction%");k&&($=k.prototype)}else if(L==="%AsyncIteratorPrototype%"){var N=D("%AsyncGenerator%");N&&v&&($=v(N.prototype))}return y[L]=$,$},b={__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"]},x=gu(),w=iy(),M=x.call(Function.call,Array.prototype.concat),E=x.call(Function.apply,Array.prototype.splice),I=x.call(Function.call,String.prototype.replace),O=x.call(Function.call,String.prototype.slice),C=x.call(Function.call,RegExp.prototype.exec),X=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,T=/\\(\\)?/g,G=function(L){var $=O(L,0,1),k=O(L,-1);if($==="%"&&k!=="%")throw new o("invalid intrinsic syntax, expected closing `%`");if(k==="%"&&$!=="%")throw new o("invalid intrinsic syntax, expected opening `%`");var N=[];return I(L,X,function(V,P,J,Q){N[N.length]=J?I(Q,T,"$1"):P||V}),N},F=function(L,$){var k=L,N;if(w(b,k)&&(N=b[k],k="%"+N[0]+"%"),w(y,k)){var V=y[k];if(V===p&&(V=A(k)),typeof V>"u"&&!$)throw new s("intrinsic "+L+" exists, but is not available. Please file an issue!");return{alias:N,name:k,value:V}}throw new o("intrinsic "+L+" does not exist!")};return Bs=function(L,$){if(typeof L!="string"||L.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(C(/^%?[^%]*%?$/,L)===null)throw new o("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var k=G(L),N=k.length>0?k[0]:"",V=F("%"+N+"%",$),P=V.name,J=V.value,Q=!1,ce=V.alias;ce&&(N=ce[0],E(k,M([0,1],ce)));for(var pe=1,te=!0;pe=k.length){var oe=c(J,R);te=!!oe,te&&"get"in oe&&!("originalValue"in oe.get)?J=oe.get:J=J[R]}else te=w(J,R),J=J[R];te&&!Q&&(y[P]=J)}}return J},Bs}var Us={exports:{}},zs,Jc;function vu(){if(Jc)return zs;Jc=1;var r=ti(),e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return zs=e,zs}var js,Qc;function Zd(){if(Qc)return js;Qc=1;var r=ti(),e=r("%Object.getOwnPropertyDescriptor%",!0);if(e)try{e([],"length")}catch{e=null}return js=e,js}var Vs,ef;function oy(){if(ef)return Vs;ef=1;var r=vu(),e=Kd(),t=Di(),n=Zd();return Vs=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,d=!!n&&n(o,s);if(r)r(o,s,{configurable:c===null&&d?d.configurable:!c,enumerable:l===null&&d?d.enumerable:!l,value:a,writable:u===null&&d?d.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.")},Vs}var Gs,tf;function sy(){if(tf)return Gs;tf=1;var r=vu(),e=function(){return!!r};return e.hasArrayLengthDefineBug=function(){if(!r)return null;try{return r([],"length",{value:1}).length!==1}catch{return!0}},Gs=e,Gs}var $s,nf;function ay(){if(nf)return $s;nf=1;var r=ti(),e=oy(),t=sy()(),n=Zd(),i=Di(),o=r("%Math.floor%");return $s=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 d=n(a,"length");d&&!d.configurable&&(c=!1),d&&!d.writable&&(f=!1)}return(c||f||!u)&&(t?e(a,"length",l,!0,!0):e(a,"length",l)),a},$s}var rf;function ly(){return rf||(rf=1,function(r){var e=gu(),t=ti(),n=ay(),i=Di(),o=t("%Function.prototype.apply%"),s=t("%Function.prototype.call%"),a=t("%Reflect.apply%",!0)||e.call(s,o),l=vu(),u=t("%Math.max%");r.exports=function(d){if(typeof d!="function")throw new i("a function is required");var h=a(e,s,arguments);return n(h,1+u(0,d.length-(arguments.length-1)),!0)};var c=function(){return a(e,o,arguments)};l?l(r.exports,"apply",{value:c}):r.exports.apply=c}(Us)),Us.exports}var Hs,of;function uy(){if(of)return Hs;of=1;var r=ti(),e=ly(),t=e(r("String.prototype.indexOf"));return Hs=function(i,o){var s=r(i,!!o);return typeof s=="function"&&t(i,".prototype.")>-1?e(s):s},Hs}const cy={},fy=Object.freeze(Object.defineProperty({__proto__:null,default:cy},Symbol.toStringTag,{value:"Module"})),hy=hg(fy);var Xs,sf;function dy(){if(sf)return Xs;sf=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,d=typeof WeakRef=="function"&&WeakRef.prototype,h=d?WeakRef.prototype.deref:null,g=Boolean.prototype.valueOf,v=Object.prototype.toString,p=Function.prototype.toString,m=String.prototype.match,y=String.prototype.slice,_=String.prototype.replace,A=String.prototype.toUpperCase,b=String.prototype.toLowerCase,x=RegExp.prototype.test,w=Array.prototype.concat,M=Array.prototype.join,E=Array.prototype.slice,I=Math.floor,O=typeof BigInt=="function"?BigInt.prototype.valueOf:null,C=Object.getOwnPropertySymbols,X=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,T=typeof Symbol=="function"&&typeof Symbol.iterator=="object",G=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===T||!0)?Symbol.toStringTag:null,F=Object.prototype.propertyIsEnumerable,D=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(re){return re.__proto__}:null);function L(re,U){if(re===1/0||re===-1/0||re!==re||re&&re>-1e3&&re<1e3||x.call(/e/,U))return U;var ue=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof re=="number"){var _e=re<0?-I(-re):I(re);if(_e!==re){var Ee=String(_e),Ce=y.call(U,Ee.length+1);return _.call(Ee,ue,"$&_")+"."+_.call(_.call(Ce,/([0-9]{3})/g,"$&_"),/_$/,"")}}return _.call(U,ue,"$&_")}var $=hy,k=$.custom,N=ie(k)?k:null,V={__proto__:null,double:'"',single:"'"},P={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};Xs=function re(U,ue,_e,Ee){var Ce=ue||{};if(H(Ce,"quoteStyle")&&!H(V,Ce.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(H(Ce,"maxStringLength")&&(typeof Ce.maxStringLength=="number"?Ce.maxStringLength<0&&Ce.maxStringLength!==1/0:Ce.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var it=H(Ce,"customInspect")?Ce.customInspect:!0;if(typeof it!="boolean"&&it!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(H(Ce,"indent")&&Ce.indent!==null&&Ce.indent!==" "&&!(parseInt(Ce.indent,10)===Ce.indent&&Ce.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(H(Ce,"numericSeparator")&&typeof Ce.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var wt=Ce.numericSeparator;if(typeof U>"u")return"undefined";if(U===null)return"null";if(typeof U=="boolean")return U?"true":"false";if(typeof U=="string")return ne(U,Ce);if(typeof U=="number"){if(U===0)return 1/0/U>0?"0":"-0";var ht=String(U);return wt?L(U,ht):ht}if(typeof U=="bigint"){var Tt=String(U)+"n";return wt?L(U,Tt):Tt}var Nt=typeof Ce.depth>"u"?5:Ce.depth;if(typeof _e>"u"&&(_e=0),_e>=Nt&&Nt>0&&typeof U=="object")return ce(U)?"[Array]":"[Object]";var Xt=et(Ce,_e);if(typeof Ee>"u")Ee=[];else if(q(Ee,U)>=0)return"[Circular]";function St(Cr,Gi,ug){if(Gi&&(Ee=E.call(Ee),Ee.push(Gi)),ug){var hc={depth:Ce.depth};return H(Ce,"quoteStyle")&&(hc.quoteStyle=Ce.quoteStyle),re(Cr,hc,_e+1,Ee)}return re(Cr,Ce,_e+1,Ee)}if(typeof U=="function"&&!te(U)){var In=z(U),Wn=ft(U,St);return"[Function"+(In?": "+In:" (anonymous)")+"]"+(Wn.length>0?" { "+M.call(Wn,", ")+" }":"")}if(ie(U)){var ac=T?_.call(String(U),/^(Symbol\(.*\))_[^)]*$/,"$1"):X.call(U);return typeof U=="object"&&!T?ge(ac):ac}if(me(U)){for(var oi="<"+b.call(String(U.nodeName)),fs=U.attributes||[],Vi=0;Vi",oi}if(ce(U)){if(U.length===0)return"[]";var hs=ft(U,St);return Xt&&!Xe(hs)?"["+Le(hs,Xt)+"]":"[ "+M.call(hs,", ")+" ]"}if(R(U)){var ds=ft(U,St);return!("cause"in Error.prototype)&&"cause"in U&&!F.call(U,"cause")?"{ ["+String(U)+"] "+M.call(w.call("[cause]: "+St(U.cause),ds),", ")+" }":ds.length===0?"["+String(U)+"]":"{ ["+String(U)+"] "+M.call(ds,", ")+" }"}if(typeof U=="object"&&it){if(N&&typeof U[N]=="function"&&$)return $(U,{depth:Nt-_e});if(it!=="symbol"&&typeof U.inspect=="function")return U.inspect()}if(se(U)){var lc=[];return n&&n.call(U,function(Cr,Gi){lc.push(St(Gi,U,!0)+" => "+St(Cr,U))}),ke("Map",t.call(U),lc,Xt)}if(he(U)){var uc=[];return a&&a.call(U,function(Cr){uc.push(St(Cr,U))}),ke("Set",s.call(U),uc,Xt)}if(ae(U))return be("WeakMap");if(ye(U))return be("WeakSet");if(ee(U))return be("WeakRef");if(W(U))return ge(St(Number(U)));if(S(U))return ge(St(O.call(U)));if(oe(U))return ge(g.call(U));if(B(U))return ge(St(String(U)));if(typeof window<"u"&&U===window)return"{ [object Window] }";if(typeof globalThis<"u"&&U===globalThis||typeof Nn<"u"&&U===Nn)return"{ [object globalThis] }";if(!pe(U)&&!te(U)){var ps=ft(U,St),cc=D?D(U)===Object.prototype:U instanceof Object||U.constructor===Object,ms=U instanceof Object?"":"null prototype",fc=!cc&&G&&Object(U)===U&&G in U?y.call(j(U),8,-1):ms?"Object":"",lg=cc||typeof U.constructor!="function"?"":U.constructor.name?U.constructor.name+" ":"",gs=lg+(fc||ms?"["+M.call(w.call([],fc||[],ms||[]),": ")+"] ":"");return ps.length===0?gs+"{}":Xt?gs+"{"+Le(ps,Xt)+"}":gs+"{ "+M.call(ps,", ")+" }"}return String(U)};function J(re,U,ue){var _e=ue.quoteStyle||U,Ee=V[_e];return Ee+re+Ee}function Q(re){return _.call(String(re),/"/g,""")}function ce(re){return j(re)==="[object Array]"&&(!G||!(typeof re=="object"&&G in re))}function pe(re){return j(re)==="[object Date]"&&(!G||!(typeof re=="object"&&G in re))}function te(re){return j(re)==="[object RegExp]"&&(!G||!(typeof re=="object"&&G in re))}function R(re){return j(re)==="[object Error]"&&(!G||!(typeof re=="object"&&G in re))}function B(re){return j(re)==="[object String]"&&(!G||!(typeof re=="object"&&G in re))}function W(re){return j(re)==="[object Number]"&&(!G||!(typeof re=="object"&&G in re))}function oe(re){return j(re)==="[object Boolean]"&&(!G||!(typeof re=="object"&&G in re))}function ie(re){if(T)return re&&typeof re=="object"&&re instanceof Symbol;if(typeof re=="symbol")return!0;if(!re||typeof re!="object"||!X)return!1;try{return X.call(re),!0}catch{}return!1}function S(re){if(!re||typeof re!="object"||!O)return!1;try{return O.call(re),!0}catch{}return!1}var Z=Object.prototype.hasOwnProperty||function(re){return re in this};function H(re,U){return Z.call(re,U)}function j(re){return v.call(re)}function z(re){if(re.name)return re.name;var U=m.call(p.call(re),/^function\s*([\w$]+)/);return U?U[1]:null}function q(re,U){if(re.indexOf)return re.indexOf(U);for(var ue=0,_e=re.length;ue<_e;ue++)if(re[ue]===U)return ue;return-1}function se(re){if(!t||!re||typeof re!="object")return!1;try{t.call(re);try{s.call(re)}catch{return!0}return re instanceof Map}catch{}return!1}function ae(re){if(!u||!re||typeof re!="object")return!1;try{u.call(re,u);try{f.call(re,f)}catch{return!0}return re instanceof WeakMap}catch{}return!1}function ee(re){if(!h||!re||typeof re!="object")return!1;try{return h.call(re),!0}catch{}return!1}function he(re){if(!s||!re||typeof re!="object")return!1;try{s.call(re);try{t.call(re)}catch{return!0}return re instanceof Set}catch{}return!1}function ye(re){if(!f||!re||typeof re!="object")return!1;try{f.call(re,f);try{u.call(re,u)}catch{return!0}return re instanceof WeakSet}catch{}return!1}function me(re){return!re||typeof re!="object"?!1:typeof HTMLElement<"u"&&re instanceof HTMLElement?!0:typeof re.nodeName=="string"&&typeof re.getAttribute=="function"}function ne(re,U){if(re.length>U.maxStringLength){var ue=re.length-U.maxStringLength,_e="... "+ue+" more character"+(ue>1?"s":"");return ne(y.call(re,0,U.maxStringLength),U)+_e}var Ee=P[U.quoteStyle||"single"];Ee.lastIndex=0;var Ce=_.call(_.call(re,Ee,"\\$1"),/[\x00-\x1f]/g,fe);return J(Ce,"single",U)}function fe(re){var U=re.charCodeAt(0),ue={8:"b",9:"t",10:"n",12:"f",13:"r"}[U];return ue?"\\"+ue:"\\x"+(U<16?"0":"")+A.call(U.toString(16))}function ge(re){return"Object("+re+")"}function be(re){return re+" { ? }"}function ke(re,U,ue,_e){var Ee=_e?Le(ue,_e):M.call(ue,", ");return re+" ("+U+") {"+Ee+"}"}function Xe(re){for(var U=0;U=0)return!1;return!0}function et(re,U){var ue;if(re.indent===" ")ue=" ";else if(typeof re.indent=="number"&&re.indent>0)ue=M.call(Array(re.indent+1)," ");else return null;return{base:ue,prev:M.call(Array(U+1),ue)}}function Le(re,U){if(re.length===0)return"";var ue=` +`+U.prev+U.base;return ue+M.call(re,","+ue)+` +`+U.prev}function ft(re,U){var ue=ce(re),_e=[];if(ue){_e.length=re.length;for(var Ee=0;Ee1;){var y=m.pop(),_=y.obj[y.prop];if(t(_)){for(var A=[],b=0;b<_.length;++b)typeof _[b]<"u"&&A.push(_[b]);y.obj[y.prop]=A}}},o=function(m,y){for(var _=y&&y.plainObjects?{__proto__:null}:{},A=0;A=u?x.slice(M,M+u):x,I=[],O=0;O=48&&C<=57||C>=65&&C<=90||C>=97&&C<=122||b===r.RFC1738&&(C===40||C===41)){I[I.length]=E.charAt(O);continue}if(C<128){I[I.length]=n[C];continue}if(C<2048){I[I.length]=n[192|C>>6]+n[128|C&63];continue}if(C<55296||C>=57344){I[I.length]=n[224|C>>12]+n[128|C>>6&63]+n[128|C&63];continue}O+=1,C=65536+((C&1023)<<10|E.charCodeAt(O)&1023),I[I.length]=n[240|C>>18]+n[128|C>>12&63]+n[128|C>>6&63]+n[128|C&63]}w+=I.join("")}return w},f=function(m){for(var y=[{obj:{o:m},prop:"o"}],_=[],A=0;A"u"&&(k=0)}if(typeof E=="function"?L=E(m,L):L instanceof Date?L=C(L):y==="comma"&&o(L)&&(L=e.maybeMap(L,function(Z){return Z instanceof Date?C(Z):Z})),L===null){if(b)return M&&!G?M(m,c.encoder,F,"key",X):m;L=""}if(f(L)||e.isBuffer(L)){if(M){var P=G?m:M(m,c.encoder,F,"key",X);return[T(P)+"="+T(M(L,c.encoder,F,"value",X))]}return[T(m)+"="+T(String(L))]}var J=[];if(typeof L>"u")return J;var Q;if(y==="comma"&&o(L))G&&M&&(L=e.maybeMap(L,M)),Q=[{value:L.length>0?L.join(",")||null:void 0}];else if(o(E))Q=E;else{var ce=Object.keys(L);Q=I?ce.sort(I):ce}var pe=w?String(m).replace(/\./g,"%2E"):String(m),te=_&&o(L)&&L.length===1?pe+"[]":pe;if(A&&o(L)&&L.length===0)return te+"[]";for(var R=0;R"u"?p.encodeDotInKeys===!0?!0:c.allowDots:!!p.allowDots;return{addQueryPrefix:typeof p.addQueryPrefix=="boolean"?p.addQueryPrefix:c.addQueryPrefix,allowDots:x,allowEmptyArrays:typeof p.allowEmptyArrays=="boolean"?!!p.allowEmptyArrays:c.allowEmptyArrays,arrayFormat:b,charset:m,charsetSentinel:typeof p.charsetSentinel=="boolean"?p.charsetSentinel:c.charsetSentinel,commaRoundTrip:!!p.commaRoundTrip,delimiter:typeof p.delimiter>"u"?c.delimiter:p.delimiter,encode:typeof p.encode=="boolean"?p.encode:c.encode,encodeDotInKeys:typeof p.encodeDotInKeys=="boolean"?p.encodeDotInKeys:c.encodeDotInKeys,encoder:typeof p.encoder=="function"?p.encoder:c.encoder,encodeValuesOnly:typeof p.encodeValuesOnly=="boolean"?p.encodeValuesOnly:c.encodeValuesOnly,filter:A,format:y,formatter:_,serializeDate:typeof p.serializeDate=="function"?p.serializeDate:c.serializeDate,skipNulls:typeof p.skipNulls=="boolean"?p.skipNulls:c.skipNulls,sort:typeof p.sort=="function"?p.sort:null,strictNullHandling:typeof p.strictNullHandling=="boolean"?p.strictNullHandling:c.strictNullHandling}};return Ks=function(v,p){var m=v,y=g(p),_,A;typeof y.filter=="function"?(A=y.filter,m=A("",m)):o(y.filter)&&(A=y.filter,_=A);var b=[];if(typeof m!="object"||m===null)return"";var x=i[y.arrayFormat],w=x==="comma"&&y.commaRoundTrip;_||(_=Object.keys(m)),y.sort&&_.sort(y.sort);for(var M=r(),E=0;E<_.length;++E){var I=_[E],O=m[I];y.skipNulls&&O===null||a(b,h(O,I,x,w,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,M))}var C=b.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&"),C.length>0?X+C:""},Ks}var Zs,ff;function gy(){if(ff)return Zs;ff=1;var r=Jd(),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(d){return d.replace(/&#(\d+);/g,function(h,g){return String.fromCharCode(parseInt(g,10))})},o=function(d,h){return d&&typeof d=="string"&&h.comma&&d.indexOf(",")>-1?d.split(","):d},s="utf8=%26%2310003%3B",a="utf8=%E2%9C%93",l=function(h,g){var v={__proto__:null},p=g.ignoreQueryPrefix?h.replace(/^\?/,""):h;p=p.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var m=g.parameterLimit===1/0?void 0:g.parameterLimit,y=p.split(g.delimiter,m),_=-1,A,b=g.charset;if(g.charsetSentinel)for(A=0;A-1&&(I=t(I)?[I]:I);var O=e.call(v,E);O&&g.duplicates==="combine"?v[E]=r.combine(v[E],I):(!O||g.duplicates==="last")&&(v[E]=I)}return v},u=function(d,h,g,v){for(var p=v?h:o(h,g),m=d.length-1;m>=0;--m){var y,_=d[m];if(_==="[]"&&g.parseArrays)y=g.allowEmptyArrays&&(p===""||g.strictNullHandling&&p===null)?[]:[].concat(p);else{y=g.plainObjects?{__proto__:null}:{};var A=_.charAt(0)==="["&&_.charAt(_.length-1)==="]"?_.slice(1,-1):_,b=g.decodeDotInKeys?A.replace(/%2E/g,"."):A,x=parseInt(b,10);!g.parseArrays&&b===""?y={0:p}:!isNaN(x)&&_!==b&&String(x)===b&&x>=0&&g.parseArrays&&x<=g.arrayLimit?(y=[],y[x]=p):b!=="__proto__"&&(y[b]=p)}p=y}return p},c=function(h,g,v,p){if(h){var m=v.allowDots?h.replace(/\.([^.[]+)/g,"[$1]"):h,y=/(\[[^[\]]*])/,_=/(\[[^[\]]*])/g,A=v.depth>0&&y.exec(m),b=A?m.slice(0,A.index):m,x=[];if(b){if(!v.plainObjects&&e.call(Object.prototype,b)&&!v.allowPrototypes)return;x.push(b)}for(var w=0;v.depth>0&&(A=_.exec(m))!==null&&w"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 p=typeof h.allowDots>"u"?h.decodeDotInKeys===!0?!0:n.allowDots:!!h.allowDots;return{allowDots:p,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 Zs=function(d,h){var g=f(h);if(d===""||d===null||typeof d>"u")return g.plainObjects?{__proto__:null}:{};for(var v=typeof d=="string"?l(d,g):d,p=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}$/,d=/^([+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},p=vy();function m(b,x,w){if(b&&typeof b=="object"&&b instanceof e)return b;var M=new e;return M.parse(b,x,w),M}e.prototype.parse=function(b,x,w){if(typeof b!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof b);var M=b.indexOf("?"),E=M!==-1&&M127?ce+="x":ce+=Q[pe];if(!ce.match(f)){var R=P.slice(0,L),B=P.slice(L+1),W=Q.match(d);W&&(R.push(W[1]),B.unshift(W[2])),B.length&&(C="/"+B.join(".")+C),this.hostname=R.join(".");break}}}this.hostname.length>c?this.hostname="":this.hostname=this.hostname.toLowerCase(),V||(this.hostname=r.toASCII(this.hostname));var oe=this.port?":"+this.port:"",ie=this.hostname||"";this.host=ie+oe,this.href+=this.host,V&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),C[0]!=="/"&&(C="/"+C))}if(!h[G])for(var L=0,J=a.length;L0?w.host.split("@"):!1;ce&&(w.auth=ce.shift(),w.hostname=ce.shift(),w.host=w.hostname)}return w.search=b.search,w.query=b.query,(w.pathname!==null||w.search!==null)&&(w.path=(w.pathname?w.pathname:"")+(w.search?w.search:"")),w.href=w.format(),w}if(!P.length)return w.pathname=null,w.search?w.path="/"+w.search:w.path=null,w.href=w.format(),w;for(var pe=P.slice(-1)[0],te=(w.host||b.host||P.length>1)&&(pe==="."||pe==="..")||pe==="",R=0,B=P.length;B>=0;B--)pe=P[B],pe==="."?P.splice(B,1):pe===".."?(P.splice(B,1),R++):R&&(P.splice(B,1),R--);if(!N&&!V)for(;R--;R)P.unshift("..");N&&P[0]!==""&&(!P[0]||P[0].charAt(0)!=="/")&&P.unshift(""),te&&P.join("/").substr(-1)!=="/"&&P.push("");var W=P[0]===""||P[0]&&P[0].charAt(0)==="/";if(Q){w.hostname=W?"":P.length?P.shift():"",w.host=w.hostname;var ce=w.host&&w.host.indexOf("@")>0?w.host.split("@"):!1;ce&&(w.auth=ce.shift(),w.hostname=ce.shift(),w.host=w.hostname)}return N=N||w.host&&P.length,N&&!W&&P.unshift(""),P.length>0?w.pathname=P.join("/"):(w.pathname=null,w.path=null),(w.pathname!==null||w.search!==null)&&(w.path=(w.pathname?w.pathname:"")+(w.search?w.search:"")),w.auth=b.auth||w.auth,w.slashes=w.slashes||b.slashes,w.href=w.format(),w},e.prototype.parseHost=function(){var b=this.host,x=n.exec(b);x&&(x=x[0],x!==":"&&(this.port=x.substr(1)),b=b.substr(0,b.length-x.length)),b&&(this.hostname=b)},qn.parse=m,qn.resolve=_,qn.resolveObject=A,qn.format=y,qn.Url=e,qn}var Qs=yy();/*! + * @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 es={parse:Qs.parse,format:Qs.format,resolve:Qs.resolve};Se.RETINA_PREFIX=/@([0-9\.]+)x/;Se.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var pf=!1,mf="6.5.10";function _y(r){var e;if(!pf){if(Se.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var t=[` + %c %c %c PixiJS `+mf+" - ✰ "+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 "+mf+" - "+r+" - http://www.pixijs.com/");pf=!0}}var ea;function xy(){return typeof ea>"u"&&(ea=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}}()),ea}function tn(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 by(r){var e=r.toString(16);return e="000000".substring(0,6-e.length)+e,"#"+e}function on(r){return(r[0]*255<<16)+(r[1]*255<<8)+(r[2]*255|0)}function wy(){for(var r=[],e=[],t=0;t<32;t++)r[t]=t,e[t]=t;r[Ie.NORMAL_NPM]=Ie.NORMAL,r[Ie.ADD_NPM]=Ie.ADD,r[Ie.SCREEN_NPM]=Ie.SCREEN,e[Ie.NORMAL]=Ie.NORMAL_NPM,e[Ie.ADD]=Ie.ADD_NPM,e[Ie.SCREEN]=Ie.SCREEN_NPM;var n=[];return n.push(e),n.push(r),n}var Ty=wy();function Sy(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 Qd(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 Do(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 gf(r){return!(r&r-1)&&!!r}function vf(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 To(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))),yf[e]=!0}}var _f={},xn=Object.create(null),Yn=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 Xi;function Cy(r,e){if(e===void 0&&(e=globalThis.location),r.indexOf("data:")===0)return"";e=e||globalThis.location,Xi||(Xi=document.createElement("a")),Xi.href=r;var t=es.parse(Xi.href),n=!t.port&&e.port===""||t.port===e.port;return t.hostname!==e.hostname||!n||t.protocol!==e.protocol?"anonymous":""}function xf(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 Ti=function(){return Ti=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 d=0,h=f.length;d0&&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(Ct.prototype,{dispatch:{value:Ct.prototype.emit},run:{value:Ct.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 Ri;(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"})(Ri||(Ri={}));var ta=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 ta(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=Ri.NORMAL),this._addListener(new ta(e,t,n))},r.prototype.addOnce=function(e,t,n){return n===void 0&&(n=Ri.NORMAL),this._addListener(new ta(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=Wi[0].set(e.left,e.top),d=Wi[1].set(e.left,e.bottom),h=Wi[2].set(e.right,e.top),g=Wi[3].set(e.right,e.bottom);if(h.x<=f.x||d.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(d,d),t.apply(h,h),t.apply(g,g),Math.max(f.x,d.x,h.x,g.x)<=a||Math.min(f.x,d.x,h.x,g.x)>=l||Math.max(f.y,d.y,h.y,g.y)<=u||Math.min(f.y,d.y,h.y,g.y)>=c))return!1;var p=v*(d.y-f.y),m=v*(f.x-d.x),y=p*a+m*u,_=p*l+m*u,A=p*a+m*c,b=p*l+m*c;if(Math.max(y,_,A,b)<=p*f.x+m*f.y||Math.min(y,_,A,b)>=p*g.x+m*g.y)return!1;var x=v*(f.y-h.y),w=v*(h.x-f.x),M=x*a+w*u,E=x*l+w*u,I=x*a+w*c,O=x*l+w*c;return!(Math.max(M,E,I,O)<=x*f.x+w*f.y||Math.min(M,E,I,O)>=x*g.x+w*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}(),Ur=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}(),At=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(Iy-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}(),tr=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],nr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],rr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],ir=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Qa=[],ep=[],qi=Math.sign;function ky(){for(var r=0;r<16;r++){var e=[];Qa.push(e);for(var t=0;t<16;t++)for(var n=qi(tr[r]*tr[t]+rr[r]*nr[t]),i=qi(nr[r]*tr[t]+ir[r]*nr[t]),o=qi(tr[r]*rr[t]+rr[r]*ir[t]),s=qi(nr[r]*rr[t]+ir[r]*ir[t]),a=0;a<16;a++)if(tr[a]===n&&nr[a]===i&&rr[a]===o&&ir[a]===s){e.push(a);break}}for(var r=0;r<16;r++){var l=new At;l.set(tr[r],nr[r],rr[r],ir[r],0,0),ep.push(l)}}ky();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 tr[r]},uY:function(r){return nr[r]},vX:function(r){return rr[r]},vY:function(r){return ir[r]},inv:function(r){return r&8?r&15:-r&7},add:function(r,e){return Qa[r][e]},sub:function(r,e){return Qa[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=ep[ot.inv(e)];i.tx=t,i.ty=n,r.append(i)}},tp=function(){function r(){this.worldTransform=new At,this.localTransform=new At,this.position=new Ur(this.onChange,this,0,0),this.scale=new Ur(this.onChange,this,1,1),this.pivot=new Ur(this.onChange,this,0,0),this.skew=new Ur(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=fr.any?Cn.WEBGL:Cn.WEBGL2;Se.STRICT_TEXTURE_CACHE=!1;var el=[];function np(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=el.length-1;i>=0;--i){var o=el[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 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)n.hasOwnProperty(i)&&(t[i]=n[i])},tl(r,e)};function Qe(r,e){tl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var nl=function(){return nl=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=gf(this.realWidth)&&gf(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 Yn[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+"_"+Pi()}s=t._pixiId}var l=Yn[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 _u(t,{width:n,height:i}),a=t instanceof Float32Array?$e.FLOAT:$e.UNSIGNED_BYTE;return new e(s,Object.assign({},Ry,o||{width:n,height:i,type:a}))},e.addToCache=function(t,n){n&&(t.textureCacheIds.indexOf(n)===-1&&t.textureCacheIds.push(n),Yn[n]&&console.warn("BaseTexture added to the cache with an id ["+n+"] that already had an entry"),Yn[n]=t)},e.removeFromCache=function(t){if(typeof t=="string"){var n=Yn[t];if(n){var i=n.textureCacheIds.indexOf(t);return i>-1&&n.textureCacheIds.splice(i,1),delete Yn[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=dr.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}(Gn),Dy=function(r){Qe(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];Gn.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}(Gn),By=function(r){Qe(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}(Gn);el.push(ip,By,Fy,Dy,Ny,_u,Ly,Oy);var Uy=function(r){Qe(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===Vn.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}(_u),rl=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 Ct("disposeFramebuffer"),this.multisample=pt.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 xt(null,{scaleMode:zt.NEAREST,resolution:1,mipmap:dn.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},r.prototype.addDepthTexture=function(e){return this.depthTexture=e||new xt(new Uy(null,{width:this.width,height:this.height}),{scaleMode:zt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:dn.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 xt),Yi(e._EMPTY),Yi(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(xt.from(t)),Yi(e._WHITE),Yi(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(br),xu=function(r){Qe(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||pt.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[d].apply(this,c,f,rn.CLEAR,t);var h=c;c=f,f=h}n[d].apply(this,c,u.renderTexture,rn.BLEND,t),d>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=rn.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===rn.CLEAR||t===rn.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(ki.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(ki.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(At.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=pt.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||pt.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=Ki[0],i=Ki[1],o=Ki[2],s=Ki[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?na.copyFrom(o):na.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}(),ap=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}(),Zy=function(){function r(e){this.renderer=e,this.emptyRenderer=new ap(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=Cn.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}(),Qy=function(){function r(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=pt.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}return r}(),e0=new mt,t0=function(){function r(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new rl(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 mt,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===Cn.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=Oo.COLOR|Oo.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 Qy(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 d=e.depthTexture;this.renderer.texture.bind(d,0),n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,d._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=pt.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=Cn.WEBGL2&&(e=r.getContext("webgl2",{})),e||(e=r.getContext("webgl",{})||r.getContext("experimental-webgl",{}),e?e.getExtension("WEBGL_draw_buffers"):e=null),si=e}return si}var Zi;function s0(){if(!Zi){Zi=jt.MEDIUM;var r=o0();if(r&&r.getShaderPrecisionFormat){var e=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT);Zi=e.precision?jt.HIGH:jt.MEDIUM}}return Zi}function If(r,e,t){if(r.substring(0,9)!=="precision"){var n=e;return e===jt.HIGH&&t!==jt.HIGH&&(n=jt.MEDIUM),"precision "+n+` float; +`+r}else if(t!==jt.HIGH&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}var a0={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 cp(r){return a0[r]}var Ji=null,Mf={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 fp(r,e){if(!Ji){var t=Object.keys(Mf);Ji={};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}(),dp=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}(),Pf=new At,Rf=[],E0=function(r){Qe(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=Rf.pop())!==null&&n!==void 0?n:new mt);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?Pf.copyFrom(s):Pf.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&&Rf.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}(dp),C0=function(r){Qe(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}(dp),A0=function(){function r(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new At,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}(),Kn=new mt,li=new mt,I0=function(){function r(e){this.renderer=e,this.clearColor=e._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new mt,this.destinationFrame=new mt,this.viewportFrame=new mt}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||(Kn.width=e.frame.width,Kn.height=e.frame.height,t=Kn),n||(li.x=e.frame.x,li.y=e.frame.y,li.width=t.width,li.height=t.height,n=li),s=o.framebuffer):(a=i.resolution,t||(Kn.width=i.screen.width,Kn.height=i.screen.height,t=Kn),n||(n=Kn,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 M0(r,e,t,n,i){t.buffer.update(i)}var k0={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]; + } + `},pp={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 P0(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 R0(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 O0(r,e){if(!r.autoManage)return{size:0,syncFunc:M0};for(var t=R0(r.uniforms,e),n=P0(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=cp(l.data.type),v=Math.max(pp[l.data.type]/16,1),p=g/v,m=(4-p%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 < `+p+`; j++) + { + data[offset++] = v[t++]; + } + offset += `+m+`; + } + + `)}else{var y=k0[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 F0=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 L0(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 Y0(r){var e,t,n,i,o,s,a,l,u,c,f,d,h,g,v,p,m,y,_,A,b,x,w;return"WebGL2RenderingContext"in globalThis&&r instanceof globalThis.WebGL2RenderingContext?w=(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]=(d={},d[Te.RGBA]=r.RGB5_A1,d),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]=(p={},p[Te.DEPTH_STENCIL]=r.DEPTH24_STENCIL8,p),e[$e.FLOAT_32_UNSIGNED_INT_24_8_REV]=(m={},m[Te.DEPTH_STENCIL]=r.DEPTH32F_STENCIL8,m),e):w=(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]=(A={},A[Te.RGB]=r.RGB,A),y[$e.UNSIGNED_SHORT_4_4_4_4]=(b={},b[Te.RGBA]=r.RGBA,b),y[$e.UNSIGNED_SHORT_5_5_5_1]=(x={},x[Te.RGBA]=r.RGBA,x),y),w}var fa=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}(),K0=function(){function r(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new xt,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=Y0(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!==Fo.FLOAT&&this.renderer.texture.unbind(a)}}},r.prototype.initTexture=function(e){var t=new fa(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!==Fo.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&&To(this.managedTextures,i,1)}},r.prototype.updateTextureStyle=function(e){var t=e._glTextures[this.CONTEXT_UID];t&&((e.mipmap===dn.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?t.mipmap=!1:t.mipmap=e.mipmap>=1,this.webGLVersion!==2&&!e.isPowerOfTwo?t.wrapMode=Lo.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!==dn.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===zt.LINEAR?n.LINEAR_MIPMAP_LINEAR:n.NEAREST_MIPMAP_NEAREST);var i=this.renderer.context.extensions.anisotropicFiltering;if(i&&e.anisotropicLevel>0&&e.scaleMode===zt.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===zt.LINEAR?n.LINEAR:n.NEAREST);n.texParameteri(e.target,n.TEXTURE_MAG_FILTER,e.scaleMode===zt.LINEAR?n.LINEAR:n.NEAREST)},r.prototype.destroy=function(){this.renderer=null},r}(),ha=new At,Z0=function(r){Qe(e,r);function e(t,n){t===void 0&&(t=Mi.UNKNOWN);var i=r.call(this)||this;return n=Object.assign({},Se.RENDER_OPTIONS,n),i.options=n,i.type=t,i.screen=new mt(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&&(pr("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"&&(pr("6.1.0","generateTexture options (scaleMode, resolution, region) are now object options."),n={scaleMode:n,resolution:i,region:o});var s=n.region,a=Py(n,["region"]);o=s||t.getLocalBounds(null,!0),o.width===0&&(o.width=1),o.height===0&&(o.height=1);var l=xu.create(nl({width:o.width,height:o.height},a));return ha.tx=-o.x,ha.ty=-o.y,this.render(t,{renderTexture:l,clear:!1,transform:ha,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=Mi.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=by(t),tn(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}(br),J0=function(){function r(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}return r}(),Q0=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=pt.HIGH?this.multisample=pt.HIGH:n>=pt.MEDIUM?this.multisample=pt.MEDIUM:n>=pt.LOW?this.multisample=pt.LOW:this.multisample=pt.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 xu?(pr("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 pr("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){pr("6.5.0","Renderer.registerPlugin() has been deprecated, please use extensions.add() instead."),ni.add({name:t,type:pn.RendererPlugin,ref:n})},e.__plugins={},e}(Z0);ni.handleByMap(pn.RendererPlugin,mp.__plugins);function e_(r){return mp.create(r)}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; +}`,n_=t_,r_=function(){function r(){this.texArray=null,this.blend=0,this.type=ki.TRIANGLES,this.start=0,this.size=0,this.data=null}return r}(),i_=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=++xt._globalBatch,c=0,f=o[0],d=0;s.copyBoundTextures(a,i);for(var h=0;h=i&&(s.boundArray(f,a,u,i),this.buildDrawCalls(f,d,h),d=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,d,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?mt.EMPTY:(e=e||new mt(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,d=this.minX,h=this.minY,g=this.maxX,v=this.maxY,p=s*t+l*n+c,m=a*t+u*n+f;d=pg?p:g,v=m>v?m:v,p=s*i+l*n+c,m=a*i+u*n+f,d=pg?p:g,v=m>v?m:v,p=s*t+l*o+c,m=a*t+u*o+f,d=pg?p:g,v=m>v?m:v,p=s*i+l*o+c,m=a*i+u*o+f,d=pg?p:g,v=m>v?m:v,this.minX=d,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,d=e.ty,h=this.minX,g=this.minY,v=this.maxX,p=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 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 Su(r,e){il(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Bo=function(r){Su(e,r);function e(){var t=r.call(this)||this;return t.tempDisplayObjectParent=null,t.transform=new tp,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 Lf,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);To(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(h_),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){p_(e,r);function e(t){var n=r.call(this,m_,g_)||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 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 v_(r,e){sl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var y_=`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; +}`,__=` +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; +}`,x_=` +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; +} +`,zo=function(r){v_(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,y_,i?x_:__)||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,d=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 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 vp(r,e){al(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var yp=`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; +}`,b_=` +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); + } +} +`,w_=function(r){vp(e,r);function e(t){t===void 0&&(t=.5);var n=r.call(this,yp,b_)||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),T_=`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){vp(e,r);function e(t){var n=r.call(this,yp,T_)||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 w_(i.threshold),n._extractFilter.resolution=u,n._blurFilter=o?new zo(o):new zo(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 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 S_(r,e){ll(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var E_=`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; +}`,C_=`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){S_(e,r);function e(t){t===void 0&&(t=8);var n=r.call(this,E_,C_)||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 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 A_(r,e){ul(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var I_=`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_=`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,I_,M_)||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/yr},set:function(t){this._angle=t*yr,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 on(this.uniforms.lightColor)},set:function(t){tn(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 on(this.uniforms.shadowColor)},set:function(t){tn(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 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)n.hasOwnProperty(i)&&(t[i]=n[i])},cl(r,e)};function k_(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_=`varying vec2 vTextureCoord; + +uniform sampler2D uSampler; +uniform float uAlpha; + +void main(void) +{ + gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha; +} +`,R_=function(r){k_(e,r);function e(t){t===void 0&&(t=1);var n=r.call(this,n_,P_,{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 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)n.hasOwnProperty(i)&&(t[i]=n[i])},fl(r,e)};function _p(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; + + 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 F_(r,e){var t=Math.ceil(r/2),n=O_,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 jo=function(r){_p(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=F_(s,t),u=D_(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,rn.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){U_(e,r);function e(t){var n=r.call(this,z_,j_)||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 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 V_(r,e){pl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var G_=`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; +}`,$_=`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){V_(e,r);function e(t,n,i){n===void 0&&(n=!1),i===void 0&&(i=1);var o=r.call(this,G_,$_)||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 mr||(t=mr.from(t)),!((n=t)===null||n===void 0)&&n.baseTexture&&(t.baseTexture.scaleMode=this._scaleMode,t.baseTexture.mipmap=dn.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?zt.NEAREST:zt.LINEAR;var n=this._colorMap;n&&n.baseTexture&&(n.baseTexture._glTextures={},n.baseTexture.scaleMode=this._scaleMode,n.baseTexture.mipmap=dn.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 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 H_(r,e){ml(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; +}`,W_=`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){H_(e,r);function e(t,n){t===void 0&&(t=0),n===void 0&&(n=1);var i=r.call(this,X_,W_)||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"?(tn(t,n),this._color=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._color=on(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 gl=function(r,e){return gl=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])},gl(r,e)};function q_(r,e){gl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Y_=`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; +}`,K_=`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){q_(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,Y_,K_)||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"?(tn(t,n),this._originalColor=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._originalColor=on(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"?(tn(t,n),this._newColor=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],this._newColor=on(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 vl=function(r,e){return vl=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])},vl(r,e)};function Z_(r,e){vl(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; +}`,Q_=`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){Z_(e,r);function e(t,n,i){n===void 0&&(n=200),i===void 0&&(i=200);var o=r.call(this,J_,Q_)||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 yl=function(r,e){return yl=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])},yl(r,e)};function ex(r,e){yl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var tx=`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; +}`,nx=`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){ex(e,r);function e(){return r.call(this,tx,nx)||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 _l=function(r,e){return _l=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])},_l(r,e)};function rx(r,e){_l(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; +}`,ox=`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){rx(e,r);function e(t){var n=r.call(this,ix,ox)||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 xl=function(r,e){return xl=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])},xl(r,e)};function sx(r,e){xl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ax=`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=`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){sx(e,r);function e(t,n){t===void 0&&(t=1),n===void 0&&(n=5);var i=r.call(this,ax,lx)||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 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 Vo=function(){return Vo=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){gx(e,r);function e(t){var n=r.call(this,vx,yx)||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=mr.from(n._canvas,{scaleMode:zt.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 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 Mx(r,e){Al(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; +}`,Px=`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){Mx(e,r);function e(t,n,i){n===void 0&&(n=.05),i===void 0&&(i=t.length);var o=r.call(this,kx,Px.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){Rx(e,r);function e(t,n){n===void 0&&(n=0);var i=r.call(this,Ox,Fx)||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 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 Lx(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 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){Lx(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,Nx,Dx.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 on(this.uniforms.outlineColor)},set:function(t){tn(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 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 Bx(r,e){kl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Ux=`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; +}`,zx=`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){Bx(e,r);function e(t){t===void 0&&(t=10);var n=r.call(this,Ux,zx)||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 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 jx(r,e){Pl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Vx=`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; +}`,Gx=`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){jx(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,Vx,Gx)||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 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 $x(r,e){Rl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Hx=`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=`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){$x(e,r);function e(t){var n=r.call(this,Hx,Xx)||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 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 Wx(r,e){Ol(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var qx=`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; +}`,Yx=`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){Wx(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,qx,Yx)||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 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 Kx(r,e){Fl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var Zx=`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; +}`,Jx=`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){Kx(e,r);function e(t,n,i){t===void 0&&(t=[0,0]),i===void 0&&(i=0);var o=r.call(this,Zx,Jx)||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 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 Qx(r,e){Ll(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var eb=`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; +}`,tb=`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){Qx(e,r);function e(t,n,i){n===void 0&&(n=0),i===void 0&&(i=1);var o=r.call(this,eb,tb)||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"?(tn(t,n),this._color=t):(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],this._color=on(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 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 ts(r,e){Nl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var nb=`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; +}`,rb=`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; +} +`,xp=function(r){ts(e,r);function e(t,n,i,o){t===void 0&&(t=100),n===void 0&&(n=600);var s=r.call(this,nb,rb)||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),ib=function(r){ts(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}(xp),ob=function(r){ts(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}(xp);(function(r){ts(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 ib(t,n,i,o),s.tiltShiftYFilter=new ob(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 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 sb(r,e){Dl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var ab=`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; +}`,lb=`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){sb(e,r);function e(t){var n=r.call(this,ab,lb)||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 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 ub(r,e){Bl(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function cb(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){ub(e,r);function e(t){var n=this,i=Object.assign(e.defaults,t),o=i.maxKernelSize,s=cb(i,["maxKernelSize"]);return n=r.call(this,fb,hb.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 Zn=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 Eu{constructor(){this._breathParameters=[],this._currentTime=0}static create(){return new Eu}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=qt.EyeState_Closed,this._stateStartTimeSeconds=this._userTimeSeconds),t=1-n;break;case qt.EyeState_Closed:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._closedSeconds,n>=1&&(this._blinkingState=qt.EyeState_Opening,this._stateStartTimeSeconds=this._userTimeSeconds),t=0;break;case qt.EyeState_Opening:n=(this._userTimeSeconds-this._stateStartTimeSeconds)/this._openingSeconds,n>=1&&(n=1,this._blinkingState=qt.EyeState_Interval,this._nextBlinkingTime=this.determinNextBlinkingTiming()),t=n;break;case qt.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))(qt||{});const db=.001,Nf=.5;class Cu{static create(e){const t=new Cu;typeof e.FadeInTime=="number"&&(t._fadeTimeSeconds=e.FadeInTime,t._fadeTimeSeconds<=0&&(t._fadeTimeSeconds=Nf));const n=e.Groups,i=n.length;for(let o=0;odb){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&&(d=1-l/(1-s)),f>d&&(f=d),e.setPartOpacityByIndex(c,f)}}}constructor(){this._fadeTimeSeconds=Nf,this._lastModel=void 0,this._partGroups=[],this._partGroupCounts=[]}}class Go{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 Go;return e.partId=this.partId,e.parameterIndex=this.parameterIndex,e.partIndex=this.partIndex,e.link=this.link.map(t=>t.clone()),e}}class Oe{constructor(e,t){this.x=e||0,this.y=t||0}add(e){const t=new Oe(0,0);return t.x=this.x+e.x,t.y=this.y+e.y,t}substract(e){const t=new Oe(0,0);return t.x=this.x-e.x,t.y=this.y-e.y,t}multiply(e){const t=new Oe(0,0);return t.x=this.x*e.x,t.y=this.y*e.y,t}multiplyByScaler(e){return this.multiply(new Oe(e,e))}division(e){const t=new Oe(0,0);return t.x=this.x/e.x,t.y=this.y/e.y,t}divisionByScalar(e){return this.division(new Oe(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 So=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 Oe;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 gi,this._mvpMatrix4x4=new Qt,this._mvpMatrix4x4.loadIdentity()}}var Bn=(r=>(r[r.CubismBlendMode_Normal=0]="CubismBlendMode_Normal",r[r.CubismBlendMode_Additive=1]="CubismBlendMode_Additive",r[r.CubismBlendMode_Multiplicative=2]="CubismBlendMode_Multiplicative",r))(Bn||{});class gi{constructor(){this.R=1,this.G=1,this.B=1,this.A=1}}let sn=!1,Mr=!1,kr;const da={vertexOffset:0,vertexStep:2};class Fi{static startUp(e){if(sn)return ci("CubismFramework.startUp() is already done."),sn;if(Live2DCubismCore._isStarted)return sn=!0,!0;if(Live2DCubismCore._isStarted=!0,kr=e,kr&&Live2DCubismCore.Logging.csmSetLogFunction(kr.logFunction),sn=!0,sn){const t=Live2DCubismCore.Version.csmGetVersion(),n=(t&4278190080)>>24,i=(t&16711680)>>16,o=t&65535,s=t;ci("Live2D Cubism Core version: {0}.{1}.{2} ({3})",("00"+n).slice(-2),("00"+i).slice(-2),("0000"+o).slice(-4),s)}return ci("CubismFramework.startUp() is complete."),sn}static cleanUp(){sn=!1,Mr=!1,kr=void 0}static initialize(){if(!sn){vi("CubismFramework is not started.");return}if(Mr){vi("CubismFramework.initialize() skipped, already initialized.");return}Mr=!0,ci("CubismFramework.initialize() is complete.")}static dispose(){if(!sn){vi("CubismFramework is not started.");return}if(!Mr){vi("CubismFramework.dispose() skipped, not initialized.");return}Au.staticRelease(),Mr=!1,ci("CubismFramework.dispose() is complete.")}static isStarted(){return sn}static isInitialized(){return Mr}static coreLogFunction(e){Live2DCubismCore.Logging.csmGetLogFunction()&&Live2DCubismCore.Logging.csmGetLogFunction()(e)}static getLoggingLevel(){return kr!=null?kr.loggingLevel:wr.LogLevel_Off}constructor(){}}var wr=(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))(wr||{});const to=()=>{};function Df(r,...e){ns.print(wr.LogLevel_Debug,"[CSM][D]"+r+` +`,e)}function ci(r,...e){ns.print(wr.LogLevel_Info,"[CSM][I]"+r+` +`,e)}function vi(r,...e){ns.print(wr.LogLevel_Warning,"[CSM][W]"+r+` +`,e)}function Nr(r,...e){ns.print(wr.LogLevel_Error,"[CSM][E]"+r+` +`,e)}class ns{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 pb{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))(or||{}),Li;(r=>{r.supportMoreMaskDivisions=!0,r.setOpacityFromMotion=!1})(Li||(Li={}));var sr=(r=>(r[r.CubismMotionCurveTarget_Model=0]="CubismMotionCurveTarget_Model",r[r.CubismMotionCurveTarget_Parameter=1]="CubismMotionCurveTarget_Parameter",r[r.CubismMotionCurveTarget_PartOpacity=2]="CubismMotionCurveTarget_PartOpacity",r))(sr||{}),an=(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))(an||{});class On{constructor(e=0,t=0){this.time=e,this.value=t}}class mb{constructor(){this.basePointIndex=0,this.segmentType=0}}class gb{constructor(){this.id="",this.type=0,this.segmentCount=0,this.baseSegmentIndex=0,this.fadeInTime=0,this.fadeOutTime=0}}class vb{constructor(){this.fireTime=0,this.value=""}}class yb{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 Tp{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 ku.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 ku=(r=>(r[r.EvaluationOptionFlag_AreBeziersRistricted=0]="EvaluationOptionFlag_AreBeziersRistricted",r))(ku||{});const _b="EyeBlink",xb="LipSync",bb="Model",wb="Parameter",Tb="PartOpacity",Sb=!1;function Kt(r,e,t){const n=new On;return n.time=r.time+(e.time-r.time)*t,n.value=r.value+(e.value-r.value)*t,n}function Eb(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 Cb(r,e){let t=(e-r[0].time)/(r[3].time-r[0].time);t<0&&(t=0);const n=Kt(r[0],r[1],t),i=Kt(r[1],r[2],t),o=Kt(r[2],r[3],t),s=Kt(n,i,t),a=Kt(i,o,t);return Kt(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=Ze.cardanoAlgorithmForBezier(a,l,u,c),d=Kt(r[0],r[1],f),h=Kt(r[1],r[2],f),g=Kt(r[2],r[3],f),v=Kt(d,h,f),p=Kt(h,g,f);return Kt(v,p,f).value}function Ib(r,e){return r[0].value}function Mb(r,e){return r[1].value}function pa(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 Pu extends wp{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 Pu;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=_b),this._modelCurveIdLipSync==null&&(this._modelCurveIdLipSync=xb);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&&Df("too many eye blink targets : {0}",this._eyeBlinkParameterIds.length),this._lipSyncParameterIds.length>l&&Df("too many lip sync targets : {0}",this._lipSyncParameterIds.length);const f=this._fadeInSeconds<=0?1:Ze.getEasingSine((t-i.getFadeInStartTime())/this._fadeInSeconds),d=this._fadeOutSeconds<=0||i.getEndTime()<0?1:Ze.getEasingSine((i.getEndTime()-t)/this._fadeOutSeconds);let h,g,v,p=o;if(this._isLoop)for(;p>this._motionData.duration;)p-=this._motionData.duration;const m=this._motionData.curves;for(g=0;g>y&1)continue;const A=_+(a-_)*n;e.setParameterValueById(this._eyeBlinkParameterIds[y],A)}if(s!=Number.MAX_VALUE)for(let y=0;y>y&1)continue;const A=_+(s-_)*n;e.setParameterValueById(this._lipSyncParameterIds[y],A)}}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 gb),this._motionData.segments=Array.from({length:t.getMotionTotalSegmentCount()}).map(()=>new mb),this._motionData.events=Array.from({length:this._motionData.eventCount}).map(()=>new vb),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 kb{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))(zl||{}),ar=(r=>(r[r.CubismPhysicsSource_X=0]="CubismPhysicsSource_X",r[r.CubismPhysicsSource_Y=1]="CubismPhysicsSource_Y",r[r.CubismPhysicsSource_Angle=2]="CubismPhysicsSource_Angle",r))(ar||{});class Rb{constructor(){this.initialPosition=new Oe(0,0),this.position=new Oe(0,0),this.lastPosition=new Oe(0,0),this.lastGravity=new Oe(0,0),this.force=new Oe(0,0),this.velocity=new Oe(0,0)}}class Ob{constructor(){this.normalizationPosition={},this.normalizationAngle={}}}class Fb{constructor(){this.source={}}}class Lb{constructor(){this.destination={},this.translationScale=new Oe(0,0)}}class Nb{constructor(){this.settings=[],this.inputs=[],this.outputs=[],this.particles=[],this.gravity=new Oe(0,0),this.wind=new Oe(0,0)}}class Db{constructor(e){this._json=e}release(){this._json=void 0}getGravity(){const e=new Oe(0,0);return e.x=this._json.Meta.EffectiveForces.Gravity.X,e.y=this._json.Meta.EffectiveForces.Gravity.Y,e}getWind(){const e=new Oe(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 Oe(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 Uf="X",zf="Y",jf="Angle",Bb=5,Ep=100,Ub=.001;class Ru{static create(e){const t=new Ru;return t.parse(e),t._physicsRig.gravity.y=0,t}evaluate(e,t){let n,i,o,s;const a=new Oe;let l,u,c,f,d,h,g,v;d=e.getModel().parameters.values,h=e.getModel().parameters.maximumValues,g=e.getModel().parameters.minimumValues,v=e.getModel().parameters.defaultValues;for(let p=0;p=l.particleCount)break;c[m].destinationParameterIndex==-1&&(c[m].destinationParameterIndex=e.getParameterIndex(c[m].destination.id));const _=new Oe;_.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 A=c[m].destinationParameterIndex,b=!Float32Array.prototype.slice&&"subarray"in Float32Array.prototype?JSON.parse(JSON.stringify(d.subarray(A))):d.slice(A);Qb(b,g[A],h[A],s,c[m]);for(let x=A,w=0;x=2?i=e[t-1].position.substract(e[t-2].position):i=i.multiplyByScaler(-1),o=Ze.directionToRadian(i,r),n&&(o*=-1),o}function Wb(r,e){return Math.abs(Math.max(r,e)-Math.min(r,e))}function qb(r,e){return Math.min(r,e)+Wb(r,e)/2}function Yb(r,e){return r.x}function Kb(r,e){return r.y}function Zb(r,e){return e}function Jb(r,e,t,n,i,o,s,a){let l,u,c,f,d=new Oe(0,0),h=new Oe(0,0),g=new Oe(0,0),v=new Oe(0,0);r[0].position=new Oe(t.x,t.y),l=Ze.degreesToRadian(n),f=Ze.radianToDirection(l),f.normalize();for(let p=1;pt&&(s>i.valueExceededMaximum&&(i.valueExceededMaximum=s),s=t),a=i.weight/Ep,a>=1||(s=r[0]*(1-a)+s*a),r[0]=s}function Ou(r,e,t,n,i,o,s,a){let l=0;const u=Ze.max(t,e);ur&&(r=c);const f=Ze.min(i,o),d=Ze.max(i,o),h=s,g=qb(c,u),v=r-g;switch(Math.sign(v)){case 1:{const p=d-h,m=u-g;m!=0&&(l=v*(p/m),l+=h);break}case-1:{const p=f-h,m=c-g;m!=0&&(l=v*(p/m),l+=h);break}case 0:{l=h;break}}return a?l:l*-1}class jl{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 ma=4,e1=10;let Jn,yi,Vl;class ga{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,Vl),this._maskTexture=new t1(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(d!=Number.MAX_VALUE)if(do&&(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 jl,this._tmpMatrix=new Qt,this._tmpMatrixForMask=new Qt,this._tmpMatrixForDraw=new Qt;let e=new gi;e.R=1,e.G=0,e.B=0,e.A=0,this._channelColors.push(e),e=new gi,e.R=0,e.G=1,e.B=0,e.A=0,this._channelColors.push(e),e=new gi,e.R=0,e.G=0,e.B=1,e.A=0,this._channelColors.push(e),e=new gi,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))(_i||{});const r1="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;}",i1="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;}",o1="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;}",Vf="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;}",s1="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;}",a1="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;}",l1="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 Cp extends Au{constructor(){super(),this._clippingContextBufferForMask=null,this._clippingContextBufferForDraw=null,this._clippingManager=new ga,this.firstDraw=!0,this._textures={},this._sortedDrawableIndexList=[],this._bufferData={vertex:null,uv:null,index:null}}initialize(e){e.isUsingMasking()&&(this._clippingManager=new ga,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 ga,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{Cp.doStaticRelease()};class Ap{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 u1="ParamAngleX",c1="ParamAngleY",f1="ParamAngleZ",h1="ParamEyeBallX",d1="ParamEyeBallY",p1="ParamBodyAngleX",m1="ParamBreath",Gf=2,$f=2;var Ut;(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=Li})(Ut||(Ut={}));const Ye={log(r,...e){Ut.logLevel<=Ut.LOG_LEVEL_VERBOSE&&console.log(`[${r}]`,...e)},warn(r,...e){Ut.logLevel<=Ut.LOG_LEVEL_WARNING&&console.warn(`[${r}]`,...e)},error(r,...e){Ut.logLevel<=Ut.LOG_LEVEL_ERROR&&console.error(`[${r}]`,...e)}};function Hf(r,e,t){return rt?t:r}function Ip(r,e){e.forEach(t=>{Object.getOwnPropertyNames(t.prototype).forEach(n=>{n!=="constructor"&&Object.defineProperty(r.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))})})}function g1(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 v1(r,e){const t=r.indexOf(e);t!==-1&&r.splice(t,1)}class Mp extends br{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]){Ye.warn(this.tag,`Undefined expression at [${e}]`);return}if(this.expressions[e]===null){Ye.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(Zn(this.vx,2)+Zn(this.vy,2)),f=.5*(Math.sqrt(Zn(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 Fu{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=g1(this.url)}resolveURL(e){return es.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 $o=(r=>(r[r.NONE=0]="NONE",r[r.IDLE=1]="IDLE",r[r.NORMAL=2]="NORMAL",r[r.FORCE=3]="FORCE",r))($o||{});class b1{constructor(){this.debug=!1,this.currentPriority=0,this.reservePriority=0}reserve(e,t,n){if(n<=0)return Ye.log(this.tag,"Cannot start a motion with MotionPriority.NONE."),!1;if(e===this.currentGroup&&t===this.currentIndex)return Ye.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 Ye.log(this.tag,"Motion is already reserved.",this.dump(e,t)),!1;if(n===1){if(this.currentPriority!==0)return Ye.log(this.tag,"Cannot start idle motion because another motion is playing.",this.dump(e,t)),!1;if(this.reservedIdleGroup!==void 0)return Ye.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 Ye.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 Ye.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 Ye.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 Ye.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!Ut.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 w1="SoundManager",T1=.5;class lr{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),Ye.warn(w1,`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"),v1(this.audios,e)}static destroy(){for(let e=this.audios.length-1;e>=0;e--)this.dispose(this.audios[e])}}lr.audios=[];lr._volume=T1;var kp=(r=>(r.ALL="ALL",r.IDLE="IDLE",r.NONE="NONE",r))(kp||{});class Lu extends br{constructor(e,t){super(),this.motionGroups={},this.state=new b1,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){Ye.warn(this.tag,"Failed to create audio",c,f)}}const u=yield this.loadMotion(n,i);if(l){const c=lr.play(l).catch(f=>Ye.warn(this.tag,"Failed to play audio",l.src,f));Ut.motionSync&&(yield c)}return this.state.start(u,n,i,o)?(Ye.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&&(lr.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,S1);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=()=>{Ye.warn(C1,`Failed to load resource as ${o.responseType} (Status ${o.status}): ${e}`),i(new Wf("Network error.",e,o.status))},o.onabort=()=>i(new Wf("Aborted.",e,o.status,!0)),o.onloadend=()=>{var s;Mt.allXhrSet.delete(o),r&&((s=Mt.xhrMap.get(r))==null||s.delete(o))},o}static cancelXHRs(){var r;(r=Mt.xhrMap.get(this))==null||r.forEach(e=>{e.abort(),Mt.allXhrSet.delete(e)}),Mt.xhrMap.delete(this)}static release(){Mt.allXhrSet.forEach(r=>r.abort()),Mt.allXhrSet.clear(),Mt.xhrMap=new WeakMap}};let rs=Mt;rs.xhrMap=new WeakMap;rs.allXhrSet=new Set;rs.loader=(r,e)=>new Promise((t,n)=>{Mt.createXHR(r.target,r.settings?r.settings.resolveURL(r.url):r.url,r.type,o=>{r.result=o,t()},n).send()});function Pp(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 $n{static load(e){return Pp(this.middlewares,e).then(()=>e.result)}}$n.middlewares=[rs.loader];function A1(r,e={}){var t;const n={resourceOptions:{crossorigin:e.crossOrigin}};if(mr.fromURL)return mr.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=mr.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 qf="Live2DFactory",Rp=(r,e)=>st(void 0,null,function*(){if(typeof r.source=="string"){const t=yield $n.load({url:r.source,type:"json",target:r.live2dModel});t.url=r.source,r.source=t,r.live2dModel.emit("settingsJSONLoaded",t)}return e()}),Op=(r,e)=>st(void 0,null,function*(){if(r.source instanceof Fu)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.")}),Fp=(r,e)=>{if(r.settings){const t=ct.findRuntime(r.settings);if(t)return t.ready().then(e)}return e()},Lp=(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($n.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),Ye.warn(qf,"Failed to load pose.",s)})),n.physics&&o.push($n.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),Ye.warn(qf,"Failed to load physics.",s)})),o.length&&(yield Promise.all(o))}}}),Np=(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.")}),Dp=(r,e)=>st(void 0,null,function*(){const t=r.settings;if(t instanceof Fu){const n=ct.findRuntime(t);if(!n)throw new TypeError("Unknown model settings.");const i=yield $n.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.")}),Et=class{static registerRuntime(r){Et.runtimes.push(r),Et.runtimes.sort((e,t)=>t.version-e.version)}static findRuntime(r){for(const e of Et.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 Pp(Et.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(Et.releaseTasks)||r.once("destroy",Et.releaseTasks);let a=Et.motionTasksMap.get(r);a||(a={},Et.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]=$n.load({url:u,settings:r.settings,type:r.motionDataType,target:r}).then(c=>{var f;const d=(f=Et.motionTasksMap.get(r))==null?void 0:f[e];d&&delete d[t];const h=r.createMotion(c,e,s);return r.emit("motionLoaded",e,t,h),h}).catch(c=>{Ye.warn(r.tag,`Failed to load motion: ${u} +`,c),o(c)})),l[t]}catch(s){Ye.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(Et.releaseTasks)||r.once("destroy",Et.releaseTasks);let o=Et.expressionTasksMap.get(r);o||(o=[],Et.expressionTasksMap.set(r,o));const s=r.getExpressionFile(i);return(t=o[e])!=null||(o[e]=$n.load({url:s,settings:r.settings,type:"json",target:r}).then(a=>{const l=Et.expressionTasksMap.get(r);l&&delete l[e];const u=r.createExpression(a,i);return r.emit("expressionLoaded",e,u),u}).catch(a=>{Ye.warn(r.tag,`Failed to load expression: ${s} +`,a),n(a)})),o[e]}catch(i){Ye.warn(r.tag,`Failed to load expression at [${e}] +`,i),n(i)}return Promise.resolve(void 0)}static releaseTasks(){this instanceof Lu?Et.motionTasksMap.delete(this):Et.expressionTasksMap.delete(this)}};let ct=Et;ct.runtimes=[];ct.urlToJSON=Rp;ct.jsonToSettings=Op;ct.waitUntilReady=Fp;ct.setupOptionals=Lp;ct.setupEssentials=Np;ct.createInternalModel=Dp;ct.live2DModelMiddlewares=[Rp,Op,Fp,Lp,Np,Dp];ct.motionTasksMap=new WeakMap;ct.expressionTasksMap=new WeakMap;Lu.prototype._loadMotion=function(r,e){return ct.loadMotion(this,r,e)};Mp.prototype._loadExpression=function(r){return ct.loadExpression(this,r)};class I1{constructor(){this._autoInteract=!1}get autoInteract(){return this._autoInteract}set autoInteract(e){e!==this._autoInteract&&(e?this.on("pointertap",Yf,this):this.off("pointertap",Yf,this),this._autoInteract=e)}registerInteraction(e){e!==this.interactionManager&&(this.unregisterInteraction(),this._autoInteract&&e&&(this.interactionManager=e,e.on("pointermove",Kf,this)))}unregisterInteraction(){var e;this.interactionManager&&((e=this.interactionManager)==null||e.off("pointermove",Kf,this),this.interactionManager=void 0)}}function Yf(r){this.tap(r.data.global.x,r.data.global.y)}function Kf(r){this.focus(r.data.global.x,r.data.global.y)}class M1 extends tp{}const Wt=new at,k1=new At;let Mn;class Gl extends Uo{constructor(e){super(),this.tag="Live2DModel(uninitialized)",this.textures=[],this.transform=new M1,this.anchor=new Ur(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){Mn=e}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){var t;Mn||(Mn=(t=window.PIXI)==null?void 0:t.Ticker),e?this._destroyed||(Mn?(Mn.shared.add(this.onTickerUpdate,this),this._autoUpdate=!0):Ye.warn(this.tag,"No Ticker registered, please call Live2DModel.registerTicker(Ticker).")):(Mn==null||Mn.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){Wt.x=e,Wt.y=t,this.toModelPosition(Wt,Wt,!0);let i=Wt.x/this.internalModel.originalWidth*2-1,o=Wt.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&&(Ye.log(this.tag,"Hit",n),this.emit("hit",n))}hitTest(e,t){return Wt.x=e,Wt.y=t,this.toModelPosition(Wt,Wt),this.internalModel.hitTest(Wt.x,Wt.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(Mn.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)}}Ip(Gl,[I1]);const un=class{static resolveURL(r,e){var t;const n=(t=un.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(es.resolve(e.url,n)),o=r.find(s=>s.webkitRelativePath===i);o&&(t[n]=URL.createObjectURL(o))}un.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 un.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 Nu=un;Nu.filesMap={};Nu.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 un.createSettings(t);else if(!n._objectURL)throw new Error('"_objectURL" must be specified in ModelSettings');n.validateFiles(t.map(i=>encodeURI(i.webkitRelativePath))),yield un.upload(t,n),n.resolveURL=function(i){return un.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),un.filesMap[o])for(const s of Object.values(un.filesMap[o]))URL.revokeObjectURL(s);delete un.filesMap[o]})})}return e()});ct.live2DModelMiddlewares.unshift(Nu.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(es.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 Hn=Ot;Hn.ZIP_PROTOCOL="zip://";Hn.uid=0;Hn.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 $n.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(Hn.factory);if(!window.Live2DCubismCore)throw new Error("Could not find Cubism 4 runtime. This plugin requires live2dcubismcore.js to be loaded.");class P1 extends Mp{constructor(e,t){var n;super(e,t),this.queueManager=new Sp,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 Mu.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 Hr extends Fu{constructor(e){if(super(e),!Hr.isValidJSON(e))throw new TypeError("Invalid JSON.");Object.assign(this,new Ap(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=Pu.create(e),o=new Tp(e),s=(t===this.groups.idle?Ut.idleMotionFadingDuration:Ut.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 Zf=new Qt;class O1 extends E1{constructor(e,t,n){super(),this.lipSync=!0,this.breath=Eu.create(),this.renderer=new Cp,this.idParamAngleX=u1,this.idParamAngleY=c1,this.idParamAngleZ=f1,this.idParamEyeBallX=h1,this.idParamEyeBallY=d1,this.idParamBodyAngleX=p1,this.idParamBreath=m1,this.pixelsPerUnit=1,this.centeringTransform=new At,this.coreModel=e,this.settings=t,this.motionManager=new R1(t,n),this.init()}init(){var e;super.init(),((e=this.settings.getEyeBlinkParameters())==null?void 0:e.length)>0&&(this.eyeBlink=bp.create(this.settings)),this.breath.setParameters([new ui(this.idParamAngleX,0,15,6.5345,.5),new ui(this.idParamAngleY,0,8,3.5345,.5),new ui(this.idParamAngleZ,0,10,5.5345,.5),new ui(this.idParamBodyAngleX,0,4,15.5345,.5),new ui(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,$r.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{L1(),r()}catch(n){if(Jf--,Jf<0){const i=new Error("Failed to start up Cubism 4 framework.");i.cause=n,e(i);return}Ye.log("Cubism4","Startup failed, retrying 10ms later..."),setTimeout(t,10)}}t()})),no)}function L1(r){r=Object.assign({logFunction:console.log,loggingLevel:wr.LogLevel_Verbose},r),Fi.startUp(r),Fi.initialize()}ct.registerRuntime({version:4,ready:F1,test(r){return r instanceof Hr||Hr.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 Hr(r)},createCoreModel(r){const e=Iu.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 O1(r,e,t),i=r;return i.__moc&&(n.__moc=i.__moc,delete i.__moc,n.once("destroy",N1)),n},createPhysics(r,e){return Ru.create(e)},createPose(r,e){return Cu.create(e)}});function N1(){var r;(r=this.__moc)==null||r.release()}const D1=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=qo(),f=xd(bd),d=Ve(()=>f.between("sm","md").value||f.smaller("sm").value),{height:h,width:g}=Yo(n,{immediate:!0,windowResize:!0,reset:!0});function v(){return s.value.internalModel.coreModel}function p(b){if(!b.value)return;let x=2.2;d.value&&(x=2.2);const w=h.value*.95/l.value*x,M=g.value*.95/a.value*x,E=Math.min(w,M);b.value.scale.set(E,E)}async function m(b){Gl.registerTicker(wn),ni.add(Ay),i.value=new gp({width:g.value,height:h.value,backgroundAlpha:0}),o.value=i.value.view,o.value.style.objectFit="contain",b.appendChild(i.value.view),s.value=await Gl.from(t.model,{motionPreload:kp.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),p(s),s.value.on("hit",w=>{s.value&&w.includes("body")&&s.value.motion("tap_body")}),s.value.internalModel.coreModel.setParameterValueById("ParamMouthOpenY",u.value)}async function y(b){await s.value.motion(b,void 0,$o.FORCE)}const _=dg(()=>{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,p(s))},100);function A(){s.value&&(s.value.filters=[new hx({color:c.value?10053247:14662098,alpha:.3,blur:0,distance:20,rotation:45})])}return Ge([g,h],()=>{_()}),Ge(c,A,{immediate:!0}),Ge(s,A),$t(A),$t(async()=>{n.value&&await m(n.value)}),Ht(()=>{var b;(b=i.value)==null||b.destroy()}),Ge(u,b=>{v().setParameterValueById("ParamMouthOpenY",b)}),e({setMotion:y}),(b,x)=>(de(),xe("div",{ref_key:"containerRef",ref:n,"h-full":"","w-full":""},null,512))}}),Bp=De({__name:"Screen",setup(r){const e=le(),t=xd(bd),{width:n,height:i}=pg(),o=Yo(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 d,h;const f=(h=(d=e.value)==null?void 0:d.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}),$t(async()=>{e.value&&o.update()}),(f,d)=>(de(),xe("div",{ref_key:"containerRef",ref:e,"h-full":"","w-full":""},[ut(f.$slots,"default",{width:u.value,height:c.value})],512))}}),B1={absolute:"",bottom:"2",right:"2"},U1={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":""},z1=["checked","aria-checked"],j1={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=Io("TransitionVertical");return de(),lt(Bp,{relative:""},{default:Ue(({width:a,height:l})=>[Fe(D1,{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",B1,[Y("div",U1,[Y("label",{"h-fit":"","cursor-pointer":"",class:Jt([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,z1),[[Kr,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)]),Fe(s,null,{default:Ue(()=>[n.value?(de(),xe("div",j1,[Y("div",V1,[Y("div",G1,[Y("span",null,we(i.$t("stage.viewers.debug-menu.emotions")),1)]),Y("div",$1,[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(bv))})},we(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(wv))})},we(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(Tv))})},we(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(Sv))})},we(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(Ev))})},we(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(Cv))})},we(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(Yd))})},we(i.$t("stage.viewers.debug-menu.emotions-btn.think")),1)])])])):tt("",!0)]),_:1})])]),_:1})}}});var X1=Object.defineProperty,W1=(r,e,t)=>e in r?X1(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,q1=(r,e,t)=>W1(r,e+"",t);function Y1(r){return kd()?(Pd(r),!0):!1}function Up(r){return typeof r=="function"?r():K(r)}const K1=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Z1=Object.prototype.toString,J1=r=>Z1.call(r)==="[object Object]",Q1=()=>{},ew=K1?window:void 0;function tw(r){var e;const t=Up(r);return(e=t==null?void 0:t.$el)!=null?e:t}function va(...r){let e,t,n,i;if(typeof r[0]=="string"||Array.isArray(r[0])?([t,n,i]=r,e=ew):[e,t,n,i]=r,!e)return Q1;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const o=[],s=()=>{o.forEach(c=>c()),o.length=0},a=(c,f,d,h)=>(c.addEventListener(f,d,h),()=>c.removeEventListener(f,d,h)),l=Ge(()=>[tw(e),Up(i)],([c,f])=>{if(s(),!c)return;const d=J1(f)?{...f}:f;o.push(...t.flatMap(h=>n.map(g=>a(c,h,g,d))))},{immediate:!0,flush:"post"}),u=()=>{l(),s()};return Y1(u),u}function zp(r,e,t,n){const i=class extends Ni{constructor(o={}){const s=Object.entries(r);super({uniforms:s.reduce((a,[l,u])=>{const c=cu.clone({[l]:{value:u}});return{...a,...c}},{}),vertexShader:e,fragmentShader:t}),q1(this,"key",""),s.forEach(([a])=>Object.defineProperty(this,a,{get:()=>this.uniforms[a].value,set:l=>this.uniforms[a].value=l})),Object.assign(this,o)}};return i.key=gr.generateUUID(),i}zp({color:new It("white"),scale:new _t(1,1),imageBounds:new _t(1,1),resolution:1024,map:null,zoom:1,radius:0,grayscale:0,opacity:1},` + varying vec2 vUv; + varying vec2 vPos; + void main() { + gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(position, 1.); + vUv = uv; + vPos = position.xy; + } + `,` + // mostly from https://gist.github.com/statico/df64c5d167362ecf7b34fca0b1459a44 + varying vec2 vUv; + varying vec2 vPos; + uniform vec2 scale; + uniform vec2 imageBounds; + uniform float resolution; + uniform vec3 color; + uniform sampler2D map; + uniform float radius; + uniform float zoom; + uniform float grayscale; + uniform float opacity; + const vec3 luma = vec3(.299, 0.587, 0.114); + vec4 toGrayscale(vec4 color, float intensity) { + return vec4(mix(color.rgb, vec3(dot(color.rgb, luma)), intensity), color.a); + } + vec2 aspect(vec2 size) { + return size / min(size.x, size.y); + } + + const float PI = 3.14159265; + + // from https://iquilezles.org/articles/distfunctions + float udRoundBox( vec2 p, vec2 b, float r ) { + return length(max(abs(p)-b+r,0.0))-r; + } + + void main() { + vec2 s = aspect(scale); + vec2 i = aspect(imageBounds); + float rs = s.x / s.y; + float ri = i.x / i.y; + vec2 new = rs < ri ? vec2(i.x * s.y / i.y, s.y) : vec2(s.x, i.y * s.x / i.x); + vec2 offset = (rs < ri ? vec2((new.x - s.x) / 2.0, 0.0) : vec2(0.0, (new.y - s.y) / 2.0)) / new; + vec2 uv = vUv * s / new + offset; + vec2 zUv = (uv - vec2(0.5, 0.5)) / zoom + vec2(0.5, 0.5); + + vec2 res = vec2(scale * resolution); + vec2 halfRes = 0.5 * res; + float b = udRoundBox(vUv.xy * res - halfRes, halfRes, resolution * radius); + vec3 a = mix(vec3(1.0,0.0,0.0), vec3(0.0,0.0,0.0), smoothstep(0.0, 1.0, b)); + gl_FragColor = toGrayscale(texture2D(map, zUv) * vec4(color, opacity * a), grayscale); + + #include + #include + } + `);const Du=parseInt(bg.replace(/\D+/g,""));var nw=Object.defineProperty,rw=(r,e,t)=>e in r?nw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,iw=(r,e,t)=>(rw(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 ro,ya,Pr,io;function _a(r,e=1/0,t=null){ya||(ya=new Id(2,2,1,1)),Pr||(Pr=new Ni({uniforms:{blitTexture:new kg(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,io||(io=new hr(ya,Pr),io.frustrumCulled=!1);const n=new Dn,i=new Ka;i.add(io),t||(t=ro=new Pg({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 ko(t.domElement);return o.minFilter=r.minFilter,o.magFilter=r.magFilter,o.wrapS=r.wrapS,o.wrapT=r.wrapT,o.name=r.name,ro&&(ro.dispose(),ro=null),o}const eh={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 jp{constructor(){this.pluginCallbacks=[],this.register(function(e){return new pw(e)}),this.register(function(e){return new mw(e)}),this.register(function(e){return new yw(e)}),this.register(function(e){return new _w(e)}),this.register(function(e){return new xw(e)}),this.register(function(e){return new bw(e)}),this.register(function(e){return new gw(e)}),this.register(function(e){return new vw(e)}),this.register(function(e){return new ww(e)}),this.register(function(e){return new Tw(e)}),this.register(function(e){return new Sw(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 dw,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=gr.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 Vp(r){return Math.ceil(r/4)*4}function ba(r,e=0){const t=Vp(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 oh(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})}let dw=class{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(d=>{const h=ba(d),g=new DataView(new ArrayBuffer(rh));g.setUint32(0,h.byteLength,!0),g.setUint32(4,uw,!0);const v=ba(cw(JSON.stringify(s)),32),p=new DataView(new ArrayBuffer(rh));p.setUint32(0,v.byteLength,!0),p.setUint32(4,lw,!0);const m=new ArrayBuffer(nh),y=new DataView(m);y.setUint32(0,sw,!0),y.setUint32(4,aw,!0);const _=nh+p.byteLength+v.byteLength+g.byteLength+h.byteLength;y.setUint32(8,_,!0),new Blob([m,p,v,g,h],{type:"application/octet-stream"}).arrayBuffer().then(t)}):s.buffers&&s.buffers.length>0?Qf(u).then(d=>{s.buffers[0].uri=d,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 Re;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 Re;for(let o=0,s=n.count;o4?g=e.array[d*e.itemSize+h]:(h===0?g=e.getX(d):h===1?g=e.getY(d):h===2?g=e.getZ(d):h===3&&(g=e.getW(d)),e.normalized===!0&&(g=gr.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=ba(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=hw(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 d={mimeType:i},h=ih();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!==Ya&&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 p=new Uint8ClampedArray(e.height*e.width*4);for(let m=0;mo.processBufferViewImage(p)).then(p=>{d.bufferView=p})):h.toDataURL!==void 0?d.uri=h.toDataURL(i):u.push(oh(h,i).then(Qf).then(p=>{d.uri=p}));const v=a.images.push(d)-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:Vt[e.magFilter],minFilter:Vt[e.minFilter],wrapS:Vt[e.wrapS],wrapT:Vt[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 vs&&(e=_a(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(xi(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===Ko&&(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,A=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 A=s.attributes[_];if(_=d[_]||_.toUpperCase(),/^(POSITION|NORMAL|TANGENT|TEXCOORD_\d+|COLOR_\d+|JOINTS_\d+|WEIGHTS_\d+)$/.test(_)||(_="_"+_),t.attributes.has(this.getUID(A))){u[_]=t.attributes.get(this.getUID(A));continue}g=null;const b=A.array;_==="JOINTS_0"&&!(b instanceof Uint16Array)&&!(b instanceof Uint8Array)&&(console.warn('GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.'),g=new ur(new Uint16Array(b),A.itemSize,A.normalized));const x=this.processAccessor(g||A,s);x!==null&&(_.startsWith("_")||this.detectMeshQuantization(_,A),u[_]=x,t.attributes.set(this.getUID(A),x))}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 _=[],A=[],b={};if(e.morphTargetDictionary!==void 0)for(const x in e.morphTargetDictionary)b[e.morphTargetDictionary[x]]=x;for(let x=0;x0&&(l.extras={},l.extras.targetNames=A)}const v=Array.isArray(e.material);if(v&&s.groups.length===0)return null;const p=v?e.material:[e.material],m=v?s.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let _=0,A=m.length;_0&&(b.targets=f),s.index!==null){let w=this.getUID(s.index);(m[_].start!==void 0||m[_].count!==void 0)&&(w+=":"+m[_].start+":"+m[_].count),t.attributes.has(w)?b.indices=t.attributes.get(w):(b.indices=this.processAccessor(s.index,s,m[_].start,m[_].count),t.attributes.set(w,b.indices)),b.indices===null&&delete b.indices}const x=this.processMaterial(p[m[_].materialIndex]);x!==null&&(b.material=x),c.push(b)}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[xa])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];eh[i]&&eh[i].includes(n)&&(this.extensionsUsed[xa]=!0,this.extensionsRequired[xa]=!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:gr.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=jp.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 Ka;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 mw=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}},gw=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}},vw=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}},yw=class{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const n=this.writer,i=n.extensionsUsed,o={};if(o.transmissionFactor=e.transmission,e.transmissionMap){const s={index:n.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};n.applyTextureTransform(s,e.transmissionMap),o.transmissionTexture=s}t.extensions=t.extensions||{},t.extensions[this.name]=o,i[this.name]=!0}},_w=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}},xw=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}},bw=class{constructor(r){this.writer=r,this.name="KHR_materials_specular"}writeMaterial(r,e){if(!r.isMeshPhysicalMaterial||r.specularIntensity===1&&r.specularColor.equals(ow)&&!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}},ww=class{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const n=this.writer,i=n.extensionsUsed,o={};if(e.sheenRoughnessMap){const s={index:n.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};n.applyTextureTransform(s,e.sheenRoughnessMap),o.sheenRoughnessTexture=s}if(e.sheenColorMap){const s={index:n.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};n.applyTextureTransform(s,e.sheenColorMap),o.sheenColorTexture=s}o.sheenRoughnessFactor=e.sheenRoughness,o.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=o,i[this.name]=!0}},Tw=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}},Sw=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 Bi=Uint8Array,Gp=Uint16Array,Ew=Uint32Array,Cw=new Bi([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]),Aw=new Bi([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]),$p=function(r,e){for(var t=new Gp(31),n=0;n<31;++n)t[n]=e+=1<>>1|(nt&21845)<<1;kn=(kn&52428)>>>2|(kn&13107)<<2,kn=(kn&61680)>>>4|(kn&3855)<<4,kw[nt]=((kn&65280)>>>8|(kn&255)<<8)>>>1}var is=new Bi(288);for(var nt=0;nt<144;++nt)is[nt]=8;for(var nt=144;nt<256;++nt)is[nt]=9;for(var nt=256;nt<280;++nt)is[nt]=7;for(var nt=280;nt<288;++nt)is[nt]=8;var Pw=new Bi(32);for(var nt=0;nt<32;++nt)Pw[nt]=5;var Rw=new Bi(0),Ow=typeof TextDecoder<"u"&&new TextDecoder,Fw=0;try{Ow.decode(Rw,{stream:!0}),Fw=1}catch{}var Lw=Object.defineProperty,Nw=(r,e,t)=>e in r?Lw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Dw=(r,e,t)=>(Nw(r,e+"",t),t);const Xp=class extends hr{constructor(r,e={}){super(r),this.isReflector=!0,this.type="Reflector",this.camera=new Dn;const t=this,n=e.color!==void 0?new It(e.color):new It(8355711),i=e.textureWidth||512,o=e.textureHeight||512,s=e.clipBias||0,a=e.shader||Xp.ReflectorShader,l=e.multisample!==void 0?e.multisample:4,u=new Ed,c=new Re,f=new Re,d=new Re,h=new Tn,g=new Re(0,0,-1),v=new Un,p=new Re,m=new Re,y=new Un,_=new Tn,A=this.camera,b=new Tg(i,o,{samples:l,type:Sg}),x=new Ni({uniforms:cu.clone(a.uniforms),fragmentShader:a.fragmentShader,vertexShader:a.vertexShader});x.uniforms.tDiffuse.value=b.texture,x.uniforms.color.value=n,x.uniforms.textureMatrix.value=_,this.material=x,this.onBeforeRender=function(w,M,E){if(f.setFromMatrixPosition(t.matrixWorld),d.setFromMatrixPosition(E.matrixWorld),h.extractRotation(t.matrixWorld),c.set(0,0,1),c.applyMatrix4(h),p.subVectors(f,d),p.dot(c)>0)return;p.reflect(c).negate(),p.add(f),h.extractRotation(E.matrixWorld),g.set(0,0,-1),g.applyMatrix4(h),g.add(d),m.subVectors(f,g),m.reflect(c).negate(),m.add(f),A.position.copy(p),A.up.set(0,1,0),A.up.applyMatrix4(h),A.up.reflect(c),A.lookAt(m),A.far=E.far,A.updateMatrixWorld(),A.projectionMatrix.copy(E.projectionMatrix),_.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),_.multiply(A.projectionMatrix),_.multiply(A.matrixWorldInverse),_.multiply(t.matrixWorld),u.setFromNormalAndCoplanarPoint(c,f),u.applyMatrix4(A.matrixWorldInverse),v.set(u.normal.x,u.normal.y,u.normal.z,u.constant);const I=A.projectionMatrix;y.x=(Math.sign(v.x)+I.elements[8])/I.elements[0],y.y=(Math.sign(v.y)+I.elements[9])/I.elements[5],y.z=-1,y.w=(1+I.elements[10])/I.elements[14],v.multiplyScalar(2/v.dot(y)),I.elements[2]=v.x,I.elements[6]=v.y,I.elements[10]=v.z+1-s,I.elements[14]=v.w,t.visible=!1;const O=w.getRenderTarget(),C=w.xr.enabled,X=w.shadowMap.autoUpdate,T=w.toneMapping;let G=!1;"outputColorSpace"in w?G=w.outputColorSpace==="srgb":G=w.outputEncoding===3001,w.xr.enabled=!1,w.shadowMap.autoUpdate=!1,"outputColorSpace"in w?w.outputColorSpace="srgb-linear":w.outputEncoding=3e3,w.toneMapping=Eg,w.setRenderTarget(b),w.state.buffers.depth.setMask(!0),w.autoClear===!1&&w.clear(),w.render(M,A),w.xr.enabled=C,w.shadowMap.autoUpdate=X,w.toneMapping=T,"outputColorSpace"in w?w.outputColorSpace=G?"srgb":"srgb-linear":w.outputEncoding=G?3001:3e3,w.setRenderTarget(O);const F=E.viewport;F!==void 0&&w.state.viewport(F),t.visible=!0},this.getRenderTarget=function(){return b},this.dispose=function(){b.dispose(),t.material.dispose()}}};let $l=Xp;Dw($l,"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 <${Du>=154?"colorspace_fragment":"encodings_fragment"}> + + }`});var Bw=Object.defineProperty,Uw=(r,e,t)=>e in r?Bw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Wp=(r,e,t)=>(Uw(r,typeof e!="symbol"?e+"":e,t),t);const os=new wd,zw=new Float32Array([-1,-1,0,0,0,1,-1,0,1,0,1,1,0,1,1,-1,1,0,0,1]),qp=new Td(zw,5);os.setIndex([0,1,2,0,2,3]);os.setAttribute("position",new uu(qp,3,0,!1));os.setAttribute("uv",new uu(qp,2,3,!1));const Hl=class extends hr{constructor(){super(Hl.Geometry,new Dr({opacity:0,transparent:!0})),this.isLensflare=!0,this.type="Lensflare",this.frustumCulled=!1,this.renderOrder=1/0;const r=new Re,e=new Re,t=new mc(new Uint8Array(16*16*3),16,16,Ya);t.minFilter=cr,t.magFilter=cr,t.wrapS=Br,t.wrapT=Br;const n=new mc(new Uint8Array(16*16*3),16,16,Ya);n.minFilter=cr,n.magFilter=cr,n.wrapS=Br,n.wrapT=Br;const i=Hl.Geometry,o=new ys({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}),s=new ys({uniforms:{map:{value:t},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}),a=new hr(i,o),l=[],u=Yp.Shader,c=new ys({uniforms:{map:{value:null},occlusionMap:{value:n},color:{value:new It(16777215)},scale:{value:new _t},screenPosition:{value:new Re}},vertexShader:u.vertexShader,fragmentShader:u.fragmentShader,blending:Ag,transparent:!0,depthWrite:!1}),f=new hr(i,c);this.addElement=function(p){l.push(p)};const d=new _t,h=new _t,g=new Ig,v=new Un;this.onBeforeRender=function(p,m,y){p.getCurrentViewport(v);const _=v.w/v.z,A=v.z/2,b=v.w/2;let x=16/v.w;if(d.set(x*_,x),g.min.set(v.x,v.y),g.max.set(v.x+(v.z-16),v.y+(v.w-16)),e.setFromMatrixPosition(this.matrixWorld),e.applyMatrix4(y.matrixWorldInverse),!(e.z>0)&&(r.copy(e).applyMatrix4(y.projectionMatrix),h.x=v.x+r.x*A+A-8,h.y=v.y+r.y*b+b-8,g.containsPoint(h))){p.copyFramebufferToTexture(h,t);let w=o.uniforms;w.scale.value=d,w.screenPosition.value=r,p.renderBufferDirect(y,null,i,o,a,null),p.copyFramebufferToTexture(h,n),w=s.uniforms,w.scale.value=d,w.screenPosition.value=r,p.renderBufferDirect(y,null,i,s,a,null);const M=-r.x*2,E=-r.y*2;for(let I=0,O=l.length;Ie in r?Vw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Kp=(r,e,t)=>(Gw(r,typeof e!="symbol"?e+"":e,t),t);const Eo={uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new Re},up:{value:new Re(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 <${Du>=154?"colorspace_fragment":"encodings_fragment"}> + + } + `},Zp=new Ni({name:"SkyShader",fragmentShader:Eo.fragmentShader,vertexShader:Eo.vertexShader,uniforms:cu.clone(Eo.uniforms),side:mg,depthWrite:!1});let Jp=class extends hr{constructor(){super(new Cg(1,1,1),Zp)}};Kp(Jp,"SkyShader",Eo);Kp(Jp,"material",Zp);new gg;new Re;new Sd(0,0,0,"YXZ");new Re;var $w=Object.defineProperty,Hw=(r,e,t)=>e in r?$w(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Ae=(r,e,t)=>(Hw(r,typeof e!="symbol"?e+"":e,t),t);const oo=new vg,sh=new Ed,Xw=Math.cos(70*(Math.PI/180)),ah=(r,e)=>(r%e+e)%e;class Ww extends wg{constructor(e,t){super(),Ae(this,"object"),Ae(this,"domElement"),Ae(this,"enabled",!0),Ae(this,"target",new Re),Ae(this,"minDistance",0),Ae(this,"maxDistance",1/0),Ae(this,"minZoom",0),Ae(this,"maxZoom",1/0),Ae(this,"minPolarAngle",0),Ae(this,"maxPolarAngle",Math.PI),Ae(this,"minAzimuthAngle",-1/0),Ae(this,"maxAzimuthAngle",1/0),Ae(this,"enableDamping",!1),Ae(this,"dampingFactor",.05),Ae(this,"enableZoom",!0),Ae(this,"zoomSpeed",1),Ae(this,"enableRotate",!0),Ae(this,"rotateSpeed",1),Ae(this,"enablePan",!0),Ae(this,"panSpeed",1),Ae(this,"screenSpacePanning",!0),Ae(this,"keyPanSpeed",7),Ae(this,"zoomToCursor",!1),Ae(this,"autoRotate",!1),Ae(this,"autoRotateSpeed",2),Ae(this,"reverseOrbit",!1),Ae(this,"reverseHorizontalOrbit",!1),Ae(this,"reverseVerticalOrbit",!1),Ae(this,"keys",{LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",BOTTOM:"ArrowDown"}),Ae(this,"mouseButtons",{LEFT:Ar.ROTATE,MIDDLE:Ar.DOLLY,RIGHT:Ar.PAN}),Ae(this,"touches",{ONE:Ln.ROTATE,TWO:Ln.DOLLY_PAN}),Ae(this,"target0"),Ae(this,"position0"),Ae(this,"zoom0"),Ae(this,"_domElementKeyEvents",null),Ae(this,"getPolarAngle"),Ae(this,"getAzimuthalAngle"),Ae(this,"setPolarAngle"),Ae(this,"setAzimuthalAngle"),Ae(this,"getDistance"),Ae(this,"getZoomScale"),Ae(this,"listenToKeyEvents"),Ae(this,"stopListenToKeyEvents"),Ae(this,"saveState"),Ae(this,"reset"),Ae(this,"update"),Ae(this,"connect"),Ae(this,"dispose"),Ae(this,"dollyIn"),Ae(this,"dollyOut"),Ae(this,"getScale"),Ae(this,"setScale"),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 ue=ah(U,2*Math.PI),_e=c.phi;_e<0&&(_e+=2*Math.PI),ue<0&&(ue+=2*Math.PI);let Ee=Math.abs(ue-_e);2*Math.PI-Ee{let ue=ah(U,2*Math.PI),_e=c.theta;_e<0&&(_e+=2*Math.PI),ue<0&&(ue+=2*Math.PI);let Ee=Math.abs(ue-_e);2*Math.PI-Een.object.position.distanceTo(n.target),this.listenToKeyEvents=U=>{U.addEventListener("keydown",ge),this._domElementKeyEvents=U},this.stopListenToKeyEvents=()=>{this._domElementKeyEvents.removeEventListener("keydown",ge),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 Re,ue=new Re(0,1,0),_e=new Mo().setFromUnitVectors(e.up,ue),Ee=_e.clone().invert(),Ce=new Re,it=new Mo,wt=2*Math.PI;return function(){const ht=n.object.position;_e.setFromUnitVectors(e.up,ue),Ee.copy(_e).invert(),U.copy(ht).sub(n.target),U.applyQuaternion(_e),c.setFromVector3(U),n.autoRotate&&l===a.NONE&&T(C()),n.enableDamping?(c.theta+=f.theta*n.dampingFactor,c.phi+=f.phi*n.dampingFactor):(c.theta+=f.theta,c.phi+=f.phi);let Tt=n.minAzimuthAngle,Nt=n.maxAzimuthAngle;isFinite(Tt)&&isFinite(Nt)&&(Tt<-Math.PI?Tt+=wt:Tt>Math.PI&&(Tt-=wt),Nt<-Math.PI?Nt+=wt:Nt>Math.PI&&(Nt-=wt),Tt<=Nt?c.theta=Math.max(Tt,Math.min(Nt,c.theta)):c.theta=c.theta>(Tt+Nt)/2?Math.max(Tt,c.theta):Math.min(Nt,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&&E||n.object.isOrthographicCamera?c.radius=P(c.radius):c.radius=P(c.radius*d),U.setFromSpherical(c),U.applyQuaternion(Ee),ht.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 Xt=!1;if(n.zoomToCursor&&E){let St=null;if(n.object instanceof Dn&&n.object.isPerspectiveCamera){const In=U.length();St=P(In*d);const Wn=In-St;n.object.position.addScaledVector(w,Wn),n.object.updateMatrixWorld()}else if(n.object.isOrthographicCamera){const In=new Re(M.x,M.y,0);In.unproject(n.object),n.object.zoom=Math.max(n.minZoom,Math.min(n.maxZoom,n.object.zoom/d)),n.object.updateProjectionMatrix(),Xt=!0;const Wn=new Re(M.x,M.y,0);Wn.unproject(n.object),n.object.position.sub(Wn).add(In),n.object.updateMatrixWorld(),St=U.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),n.zoomToCursor=!1;St!==null&&(n.screenSpacePanning?n.target.set(0,0,-1).transformDirection(n.object.matrix).multiplyScalar(St).add(n.object.position):(oo.origin.copy(n.object.position),oo.direction.set(0,0,-1).transformDirection(n.object.matrix),Math.abs(n.object.up.dot(oo.direction))u||8*(1-it.dot(n.object.quaternion))>u?(n.dispatchEvent(i),Ce.copy(n.object.position),it.copy(n.object.quaternion),Xt=!1,!0):!1}})(),this.connect=U=>{n.domElement=U,n.domElement.style.touchAction="none",n.domElement.addEventListener("contextmenu",Xe),n.domElement.addEventListener("pointerdown",ee),n.domElement.addEventListener("pointercancel",ye),n.domElement.addEventListener("wheel",fe)},this.dispose=()=>{var U,ue,_e,Ee,Ce,it;n.domElement&&(n.domElement.style.touchAction="auto"),(U=n.domElement)==null||U.removeEventListener("contextmenu",Xe),(ue=n.domElement)==null||ue.removeEventListener("pointerdown",ee),(_e=n.domElement)==null||_e.removeEventListener("pointercancel",ye),(Ee=n.domElement)==null||Ee.removeEventListener("wheel",fe),(Ce=n.domElement)==null||Ce.ownerDocument.removeEventListener("pointermove",he),(it=n.domElement)==null||it.ownerDocument.removeEventListener("pointerup",ye),n._domElementKeyEvents!==null&&n._domElementKeyEvents.removeEventListener("keydown",ge)};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 pc,f=new pc;let d=1;const h=new Re,g=new _t,v=new _t,p=new _t,m=new _t,y=new _t,_=new _t,A=new _t,b=new _t,x=new _t,w=new Re,M=new _t;let E=!1;const I=[],O={};function C(){return 2*Math.PI/60/60*n.autoRotateSpeed}function X(){return Math.pow(.95,n.zoomSpeed)}function T(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 F=(()=>{const U=new Re;return function(ue,_e){U.setFromMatrixColumn(_e,0),U.multiplyScalar(-ue),h.add(U)}})(),D=(()=>{const U=new Re;return function(ue,_e){n.screenSpacePanning===!0?U.setFromMatrixColumn(_e,1):(U.setFromMatrixColumn(_e,0),U.crossVectors(n.object.up,U)),U.multiplyScalar(ue),h.add(U)}})(),L=(()=>{const U=new Re;return function(ue,_e){const Ee=n.domElement;if(Ee&&n.object instanceof Dn&&n.object.isPerspectiveCamera){const Ce=n.object.position;U.copy(Ce).sub(n.target);let it=U.length();it*=Math.tan(n.object.fov/2*Math.PI/180),F(2*ue*it/Ee.clientHeight,n.object.matrix),D(2*_e*it/Ee.clientHeight,n.object.matrix)}else Ee&&n.object instanceof zr&&n.object.isOrthographicCamera?(F(ue*(n.object.right-n.object.left)/n.object.zoom/Ee.clientWidth,n.object.matrix),D(_e*(n.object.top-n.object.bottom)/n.object.zoom/Ee.clientHeight,n.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),n.enablePan=!1)}})();function $(U){n.object instanceof Dn&&n.object.isPerspectiveCamera||n.object instanceof zr&&n.object.isOrthographicCamera?d=U:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),n.enableZoom=!1)}function k(U){$(d/U)}function N(U){$(d*U)}function V(U){if(!n.zoomToCursor||!n.domElement)return;E=!0;const ue=n.domElement.getBoundingClientRect(),_e=U.clientX-ue.left,Ee=U.clientY-ue.top,Ce=ue.width,it=ue.height;M.x=_e/Ce*2-1,M.y=-(Ee/it)*2+1,w.set(M.x,M.y,1).unproject(n.object).sub(n.object.position).normalize()}function P(U){return Math.max(n.minDistance,Math.min(n.maxDistance,U))}function J(U){g.set(U.clientX,U.clientY)}function Q(U){V(U),A.set(U.clientX,U.clientY)}function ce(U){m.set(U.clientX,U.clientY)}function pe(U){v.set(U.clientX,U.clientY),p.subVectors(v,g).multiplyScalar(n.rotateSpeed);const ue=n.domElement;ue&&(T(2*Math.PI*p.x/ue.clientHeight),G(2*Math.PI*p.y/ue.clientHeight)),g.copy(v),n.update()}function te(U){b.set(U.clientX,U.clientY),x.subVectors(b,A),x.y>0?k(X()):x.y<0&&N(X()),A.copy(b),n.update()}function R(U){y.set(U.clientX,U.clientY),_.subVectors(y,m).multiplyScalar(n.panSpeed),L(_.x,_.y),m.copy(y),n.update()}function B(U){V(U),U.deltaY<0?N(X()):U.deltaY>0&&k(X()),n.update()}function W(U){let ue=!1;switch(U.code){case n.keys.UP:L(0,n.keyPanSpeed),ue=!0;break;case n.keys.BOTTOM:L(0,-n.keyPanSpeed),ue=!0;break;case n.keys.LEFT:L(n.keyPanSpeed,0),ue=!0;break;case n.keys.RIGHT:L(-n.keyPanSpeed,0),ue=!0;break}ue&&(U.preventDefault(),n.update())}function oe(){if(I.length==1)g.set(I[0].pageX,I[0].pageY);else{const U=.5*(I[0].pageX+I[1].pageX),ue=.5*(I[0].pageY+I[1].pageY);g.set(U,ue)}}function ie(){if(I.length==1)m.set(I[0].pageX,I[0].pageY);else{const U=.5*(I[0].pageX+I[1].pageX),ue=.5*(I[0].pageY+I[1].pageY);m.set(U,ue)}}function S(){const U=I[0].pageX-I[1].pageX,ue=I[0].pageY-I[1].pageY,_e=Math.sqrt(U*U+ue*ue);A.set(0,_e)}function Z(){n.enableZoom&&S(),n.enablePan&&ie()}function H(){n.enableZoom&&S(),n.enableRotate&&oe()}function j(U){if(I.length==1)v.set(U.pageX,U.pageY);else{const _e=re(U),Ee=.5*(U.pageX+_e.x),Ce=.5*(U.pageY+_e.y);v.set(Ee,Ce)}p.subVectors(v,g).multiplyScalar(n.rotateSpeed);const ue=n.domElement;ue&&(T(2*Math.PI*p.x/ue.clientHeight),G(2*Math.PI*p.y/ue.clientHeight)),g.copy(v)}function z(U){if(I.length==1)y.set(U.pageX,U.pageY);else{const ue=re(U),_e=.5*(U.pageX+ue.x),Ee=.5*(U.pageY+ue.y);y.set(_e,Ee)}_.subVectors(y,m).multiplyScalar(n.panSpeed),L(_.x,_.y),m.copy(y)}function q(U){const ue=re(U),_e=U.pageX-ue.x,Ee=U.pageY-ue.y,Ce=Math.sqrt(_e*_e+Ee*Ee);b.set(0,Ce),x.set(0,Math.pow(b.y/A.y,n.zoomSpeed)),k(x.y),A.copy(b)}function se(U){n.enableZoom&&q(U),n.enablePan&&z(U)}function ae(U){n.enableZoom&&q(U),n.enableRotate&&j(U)}function ee(U){var ue,_e;n.enabled!==!1&&(I.length===0&&((ue=n.domElement)==null||ue.ownerDocument.addEventListener("pointermove",he),(_e=n.domElement)==null||_e.ownerDocument.addEventListener("pointerup",ye)),et(U),U.pointerType==="touch"?be(U):me(U))}function he(U){n.enabled!==!1&&(U.pointerType==="touch"?ke(U):ne(U))}function ye(U){var ue,_e,Ee;Le(U),I.length===0&&((ue=n.domElement)==null||ue.releasePointerCapture(U.pointerId),(_e=n.domElement)==null||_e.ownerDocument.removeEventListener("pointermove",he),(Ee=n.domElement)==null||Ee.ownerDocument.removeEventListener("pointerup",ye)),n.dispatchEvent(s),l=a.NONE}function me(U){let ue;switch(U.button){case 0:ue=n.mouseButtons.LEFT;break;case 1:ue=n.mouseButtons.MIDDLE;break;case 2:ue=n.mouseButtons.RIGHT;break;default:ue=-1}switch(ue){case Ar.DOLLY:if(n.enableZoom===!1)return;Q(U),l=a.DOLLY;break;case Ar.ROTATE:if(U.ctrlKey||U.metaKey||U.shiftKey){if(n.enablePan===!1)return;ce(U),l=a.PAN}else{if(n.enableRotate===!1)return;J(U),l=a.ROTATE}break;case Ar.PAN:if(U.ctrlKey||U.metaKey||U.shiftKey){if(n.enableRotate===!1)return;J(U),l=a.ROTATE}else{if(n.enablePan===!1)return;ce(U),l=a.PAN}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(o)}function ne(U){if(n.enabled!==!1)switch(l){case a.ROTATE:if(n.enableRotate===!1)return;pe(U);break;case a.DOLLY:if(n.enableZoom===!1)return;te(U);break;case a.PAN:if(n.enablePan===!1)return;R(U);break}}function fe(U){n.enabled===!1||n.enableZoom===!1||l!==a.NONE&&l!==a.ROTATE||(U.preventDefault(),n.dispatchEvent(o),B(U),n.dispatchEvent(s))}function ge(U){n.enabled===!1||n.enablePan===!1||W(U)}function be(U){switch(ft(U),I.length){case 1:switch(n.touches.ONE){case Ln.ROTATE:if(n.enableRotate===!1)return;oe(),l=a.TOUCH_ROTATE;break;case Ln.PAN:if(n.enablePan===!1)return;ie(),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;Z(),l=a.TOUCH_DOLLY_PAN;break;case Ln.DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;H(),l=a.TOUCH_DOLLY_ROTATE;break;default:l=a.NONE}break;default:l=a.NONE}l!==a.NONE&&n.dispatchEvent(o)}function ke(U){switch(ft(U),l){case a.TOUCH_ROTATE:if(n.enableRotate===!1)return;j(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;se(U),n.update();break;case a.TOUCH_DOLLY_ROTATE:if(n.enableZoom===!1&&n.enableRotate===!1)return;ae(U),n.update();break;default:l=a.NONE}}function Xe(U){n.enabled!==!1&&U.preventDefault()}function et(U){I.push(U)}function Le(U){delete O[U.pointerId];for(let ue=0;ue{N(U),n.update()},this.dollyOut=(U=X())=>{k(U),n.update()},this.getScale=()=>d,this.setScale=U=>{$(U),n.update()},this.getZoomScale=()=>X(),t!==void 0&&this.connect(t),this.update()}}new Tn;new Re;new Sd;new Re;var qw=Object.defineProperty,Yw=(r,e,t)=>e in r?qw(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Bu=(r,e,t)=>(Yw(r,typeof e!="symbol"?e+"":e,t),t);class Qp{constructor(e){Bu(this,"data"),this.data=e}generateShapes(e,t=100,n){const i=[],o={letterSpacing:0,lineHeight:1,...n},s=Kw(e,t,this.data,o);for(let a=0,l=s.length;a + #include + #include + uniform float thickness; + uniform bool screenspace; + uniform vec2 size; + void main() { + #if defined (USE_SKINNING) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + vec4 tNormal = vec4(normal, 0.0); + vec4 tPosition = vec4(transformed, 1.0); + #ifdef USE_INSTANCING + tNormal = instanceMatrix * tNormal; + tPosition = instanceMatrix * tPosition; + #endif + if (screenspace) { + vec3 newPosition = tPosition.xyz + tNormal.xyz * thickness; + gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0); + } else { + vec4 clipPosition = projectionMatrix * modelViewMatrix * tPosition; + vec4 clipNormal = projectionMatrix * modelViewMatrix * tNormal; + vec2 offset = normalize(clipNormal.xy) * thickness / size * clipPosition.w * 2.0; + clipPosition.xy += offset; + gl_Position = clipPosition; + } + }`,`uniform vec3 color; + uniform float opacity; + void main(){ + gl_FragColor = vec4(color, opacity); + #include + #include + }`);const Jw=["args","material-uniforms-color-value"];$l.ReflectorShader;new Re;new Re;new Re;var wa;/Mac/.test((wa=globalThis==null?void 0:globalThis.navigator)===null||wa===void 0?void 0:wa.platform);const Qw=["target","auto-rotate","auto-rotate-speed","enable-damping","damping-factor","enable-pan","key-pan-speed","keys","max-azimuth-angle","min-azimuth-angle","max-polar-angle","min-polar-angle","min-distance","max-distance","min-zoom","max-zoom","touches","enable-zoom","zoom-speed","enable-rotate","rotate-speed","args"],eT=De({__name:"OrbitControls",props:{makeDefault:{type:Boolean,default:!1},camera:{},domElement:{},target:{default:()=>[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:d,minAzimuthAngle:h,maxPolarAngle:g,minPolarAngle:v,minDistance:p,maxDistance:m,minZoom:y,maxZoom:_,enableZoom:A,zoomSpeed:b,enableRotate:x,touches:w,rotateSpeed:M,target:E}=Jr(n),{camera:I,renderer:O,extend:C,controls:X,invalidate:T}=Ci(),G=Ad(null);C({OrbitControls:Ww}),Ge(G,L=>{F(),L&&o.value?X.value=L:X.value=null});function F(){va(G.value,"change",()=>{i("change",G.value),T()}),va(G.value,"start",()=>i("start",G.value)),va(G.value,"end",()=>i("end",G.value))}const{onBeforeRender:D}=hu();return D(({invalidate:L})=>{G.value&&(l.value||s.value)&&(G.value.update(),s.value&&L())}),Ht(()=>{G.value&&G.value.dispose()}),e({instance:G}),(L,$)=>(L.camera||K(I))&&(L.domElement||K(O))?(de(),xe("TresOrbitControls",{key:0,ref_key:"controlsRef",ref:G,target:K(E),"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:L.keys,"max-azimuth-angle":K(d),"min-azimuth-angle":K(h),"max-polar-angle":K(g),"min-polar-angle":K(v),"min-distance":K(p),"max-distance":K(m),"min-zoom":K(y),"max-zoom":K(_),touches:K(w),"enable-zoom":K(A),"zoom-speed":K(b),"enable-rotate":K(x),"rotate-speed":K(M),args:[L.camera||K(I),L.domElement||K(O).domElement]},null,8,Qw)):tt("",!0)}});function so(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 lh={exports:{}},uh;function tT(){return uh||(uh=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 so=="function"&&so;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(d){var h=n[u][1][d];return s(h||d)},c,c.exports,t,n,i,o)}return i[u].exports}for(var a=typeof so=="function"&&so,l=0;l>16),G((65280&I)>>8),G(255&I);return O==2?G(255&(I=w(M.charAt(E))<<2|w(M.charAt(E+1))>>4)):O==1&&(G((I=w(M.charAt(E))<<10|w(M.charAt(E+1))<<4|w(M.charAt(E+2))>>2)>>8&255),G(255&I)),C},g.fromByteArray=function(M){var E,I,O,C,X=M.length%3,T="";function G(F){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(F)}for(E=0,O=M.length-X;E>18&63)+G(C>>12&63)+G(C>>6&63)+G(63&C);switch(X){case 1:T=(T+=G((I=M[M.length-1])>>2))+G(I<<4&63)+"==";break;case 2:T=(T=(T+=G((I=(M[M.length-2]<<8)+M[M.length-1])>>10))+G(I>>4&63))+G(I<<2&63)+"="}return T}})(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,p,l,u,c,f,d,h){var g=t("base64-js"),v=t("ieee754");function p(R,B,W){if(!(this instanceof p))return new p(R,B,W);var oe,ie,S,Z,H=typeof R;if(B==="base64"&&H=="string")for(R=(Z=R).trim?Z.trim():Z.replace(/^\s+|\s+$/g,"");R.length%4!=0;)R+="=";if(H=="number")oe=L(R);else if(H=="string")oe=p.byteLength(R,B);else{if(H!="object")throw new Error("First argument needs to be a number, array or string.");oe=L(R.length)}if(p._useTypedArrays?ie=p._augment(new Uint8Array(oe)):((ie=this).length=oe,ie._isBuffer=!0),p._useTypedArrays&&typeof R.byteLength=="number")ie._set(R);else if($(Z=R)||p.isBuffer(Z)||Z&&typeof Z=="object"&&typeof Z.length=="number")for(S=0;S>8,Z=Z%256,H.push(Z),H.push(S);return H}(B),R,W,oe)}function _(R,B,W){var oe="";W=Math.min(R.length,W);for(var ie=B;ie>>0)):(B+1>>0),ie}function x(R,B,W,oe){if(oe||(te(typeof W=="boolean","missing or invalid endian"),te(B!=null,"missing offset"),te(B+1>>8*(oe?S:1-S)}function O(R,B,W,oe,ie){if(ie||(te(B!=null,"missing value"),te(typeof oe=="boolean","missing or invalid endian"),te(W!=null,"missing offset"),te(W+3>>8*(oe?S:3-S)&255}function C(R,B,W,oe,ie){ie||(te(B!=null,"missing value"),te(typeof oe=="boolean","missing or invalid endian"),te(W!=null,"missing offset"),te(W+1this.length&&(oe=this.length);var ie=(oe=R.length-B=this.length))return this[R]},p.prototype.readUInt16LE=function(R,B){return A(this,R,!0,B)},p.prototype.readUInt16BE=function(R,B){return A(this,R,!1,B)},p.prototype.readUInt32LE=function(R,B){return b(this,R,!0,B)},p.prototype.readUInt32BE=function(R,B){return b(this,R,!1,B)},p.prototype.readInt8=function(R,B){if(B||(te(R!=null,"missing offset"),te(R=this.length))return 128&this[R]?-1*(255-this[R]+1):this[R]},p.prototype.readInt16LE=function(R,B){return x(this,R,!0,B)},p.prototype.readInt16BE=function(R,B){return x(this,R,!1,B)},p.prototype.readInt32LE=function(R,B){return w(this,R,!0,B)},p.prototype.readInt32BE=function(R,B){return w(this,R,!1,B)},p.prototype.readFloatLE=function(R,B){return M(this,R,!0,B)},p.prototype.readFloatBE=function(R,B){return M(this,R,!1,B)},p.prototype.readDoubleLE=function(R,B){return E(this,R,!0,B)},p.prototype.readDoubleBE=function(R,B){return E(this,R,!1,B)},p.prototype.writeUInt8=function(R,B,W){W||(te(R!=null,"missing value"),te(B!=null,"missing offset"),te(B=this.length||(this[B]=R)},p.prototype.writeUInt16LE=function(R,B,W){I(this,R,B,!0,W)},p.prototype.writeUInt16BE=function(R,B,W){I(this,R,B,!1,W)},p.prototype.writeUInt32LE=function(R,B,W){O(this,R,B,!0,W)},p.prototype.writeUInt32BE=function(R,B,W){O(this,R,B,!1,W)},p.prototype.writeInt8=function(R,B,W){W||(te(R!=null,"missing value"),te(B!=null,"missing offset"),te(B=this.length||(0<=R?this.writeUInt8(R,B,W):this.writeUInt8(255+R+1,B,W))},p.prototype.writeInt16LE=function(R,B,W){C(this,R,B,!0,W)},p.prototype.writeInt16BE=function(R,B,W){C(this,R,B,!1,W)},p.prototype.writeInt32LE=function(R,B,W){X(this,R,B,!0,W)},p.prototype.writeInt32BE=function(R,B,W){X(this,R,B,!1,W)},p.prototype.writeFloatLE=function(R,B,W){T(this,R,B,!0,W)},p.prototype.writeFloatBE=function(R,B,W){T(this,R,B,!1,W)},p.prototype.writeDoubleLE=function(R,B,W){G(this,R,B,!0,W)},p.prototype.writeDoubleBE=function(R,B,W){G(this,R,B,!1,W)},p.prototype.fill=function(R,B,W){if(B=B||0,W=W||this.length,te(typeof(R=typeof(R=R||0)=="string"?R.charCodeAt(0):R)=="number"&&!isNaN(R),"value is not a number"),te(B<=W,"end < start"),W!==B&&this.length!==0){te(0<=B&&B"},p.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(p._useTypedArrays)return new p(this).buffer;for(var R=new Uint8Array(this.length),B=0,W=R.length;B=B.length||ie>=R.length);ie++)B[ie+W]=R[ie];return ie}function J(R){try{return decodeURIComponent(R)}catch{return"�"}}function Q(R,B){te(typeof R=="number","cannot write a non-number as a number"),te(0<=R,"specified a negative value for writing an unsigned value"),te(R<=B,"value is larger than maximum value for type"),te(Math.floor(R)===R,"value has a fractional component")}function ce(R,B,W){te(typeof R=="number","cannot write a non-number as a number"),te(R<=B,"value larger than maximum allowed value"),te(W<=R,"value smaller than minimum allowed value"),te(Math.floor(R)===R,"value has a fractional component")}function pe(R,B,W){te(typeof R=="number","cannot write a non-number as a number"),te(R<=B,"value larger than maximum allowed value"),te(W<=R,"value smaller than minimum allowed value")}function te(R,B){if(!R)throw new Error(B||"Failed assertion")}p._augment=function(R){return R._isBuffer=!0,R._get=R.get,R._set=R.set,R.get=F.get,R.set=F.set,R.write=F.write,R.toString=F.toString,R.toLocaleString=F.toString,R.toJSON=F.toJSON,R.copy=F.copy,R.slice=F.slice,R.readUInt8=F.readUInt8,R.readUInt16LE=F.readUInt16LE,R.readUInt16BE=F.readUInt16BE,R.readUInt32LE=F.readUInt32LE,R.readUInt32BE=F.readUInt32BE,R.readInt8=F.readInt8,R.readInt16LE=F.readInt16LE,R.readInt16BE=F.readInt16BE,R.readInt32LE=F.readInt32LE,R.readInt32BE=F.readInt32BE,R.readFloatLE=F.readFloatLE,R.readFloatBE=F.readFloatBE,R.readDoubleLE=F.readDoubleLE,R.readDoubleBE=F.readDoubleBE,R.writeUInt8=F.writeUInt8,R.writeUInt16LE=F.writeUInt16LE,R.writeUInt16BE=F.writeUInt16BE,R.writeUInt32LE=F.writeUInt32LE,R.writeUInt32BE=F.writeUInt32BE,R.writeInt8=F.writeInt8,R.writeInt16LE=F.writeInt16LE,R.writeInt16BE=F.writeInt16BE,R.writeInt32LE=F.writeInt32LE,R.writeInt32BE=F.writeInt32BE,R.writeFloatLE=F.writeFloatLE,R.writeFloatBE=F.writeFloatBE,R.writeDoubleLE=F.writeDoubleLE,R.writeDoubleBE=F.writeDoubleBE,R.fill=F.fill,R.inspect=F.inspect,R.toArrayBuffer=F.toArrayBuffer,R}}).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,d,h){var g=t("buffer").Buffer,v=4,p=new g(v);p.fill(0),n.exports={hash:function(m,y,_,A){for(var b=y(function(I,O){I.length%v!=0&&(C=I.length+(v-I.length%v),I=g.concat([I,p],C));for(var C,X=[],T=O?I.readInt32BE:I.readInt32LE,G=0;G_?D=F(D):D.length<_&&(D=g.concat([D,A],_));for(var $=new g(_),k=new g(_),N=0;N<_;N++)$[N]=54^D[N],k[N]=92^D[N];return L=F(g.concat([$,L])),F(g.concat([k,L]))}(C,O,G):C(G);return X=null,T?G.toString(T):G}}}function x(){var I=[].slice.call(arguments).join(" ");throw new Error([I,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(` +`))}A.fill(0),i.createHash=function(I){return b(I)},i.createHmac=b,i.randomBytes=function(I,O){if(!O||!O.call)return new g(m(I));try{O.call(this,void 0,new g(m(I)))}catch(C){O(C)}};var w,M=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],E=function(I){i[I]=function(){x("sorry,",I,"is not implemented yet")}};for(w in M)E(M[w])}).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,d,h){var g=t("./helpers");function v(x,w){x[w>>5]|=128<>>9<<4)]=w;for(var M=1732584193,E=-271733879,I=-1732584194,O=271733878,C=0;C>>32-I,M)}function m(x,w,M,E,I,O,C){return p(w&M|~w&E,x,w,I,O,C)}function y(x,w,M,E,I,O,C){return p(w&E|M&~E,x,w,I,O,C)}function _(x,w,M,E,I,O,C){return p(w^M^E,x,w,I,O,C)}function A(x,w,M,E,I,O,C){return p(M^(w|~E),x,w,I,O,C)}function b(x,w){var M=(65535&x)+(65535&w);return(x>>16)+(w>>16)+(M>>16)<<16|65535&M}n.exports=function(x){return g.hash(x,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,d,h){n.exports=function(g){for(var v,p=new Array(g),m=0;m>>((3&m)<<3)&255;return p}}).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,d,h){var g=t("./helpers");function v(y,_){y[_>>5]|=128<<24-_%32,y[15+(_+64>>9<<4)]=_;for(var A,b,x,w=Array(80),M=1732584193,E=-271733879,I=-1732584194,O=271733878,C=-1009589776,X=0;X>16)+(_>>16)+(A>>16)<<16|65535&A}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,d,h){function g(_,A){var b=(65535&_)+(65535&A);return(_>>16)+(A>>16)+(b>>16)<<16|65535&b}function v(_,A){var b,x=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),w=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),M=new Array(64);_[A>>5]|=128<<24-A%32,_[15+(A+64>>9<<4)]=A;for(var E,I,O=0;O<_.length;O+=16){for(var C=w[0],X=w[1],T=w[2],G=w[3],F=w[4],D=w[5],L=w[6],$=w[7],k=0;k<64;k++)M[k]=k<16?_[k+O]:g(g(g((I=M[k-2],m(I,17)^m(I,19)^y(I,10)),M[k-7]),(I=M[k-15],m(I,7)^m(I,18)^y(I,3))),M[k-16]),b=g(g(g(g($,m(I=F,6)^m(I,11)^m(I,25)),F&D^~F&L),x[k]),M[k]),E=g(m(E=C,2)^m(E,13)^m(E,22),C&X^C&T^X&T),$=L,L=D,D=F,F=g(G,b),G=T,T=X,X=C,C=g(b,E);w[0]=g(C,w[0]),w[1]=g(X,w[1]),w[2]=g(T,w[2]),w[3]=g(G,w[3]),w[4]=g(F,w[4]),w[5]=g(D,w[5]),w[6]=g(L,w[6]),w[7]=g($,w[7])}return w}var p=t("./helpers"),m=function(_,A){return _>>>A|_<<32-A},y=function(_,A){return _>>>A};n.exports=function(_){return p.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,d,h){i.read=function(g,v,p,m,O){var _,A,b=8*O-m-1,x=(1<>1,M=-7,E=p?O-1:0,I=p?-1:1,O=g[v+E];for(E+=I,_=O&(1<<-M)-1,O>>=-M,M+=b;0>=-M,M+=m;0>1,E=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,I=m?0:C-1,O=m?1:-1,C=v<0||v===0&&1/v<0?1:0;for(v=Math.abs(v),isNaN(v)||v===1/0?(b=isNaN(v)?1:0,A=w):(A=Math.floor(Math.log(v)/Math.LN2),v*(m=Math.pow(2,-A))<1&&(A--,m*=2),2<=(v+=1<=A+M?E/m:E*Math.pow(2,1-M))*m&&(A++,m/=2),w<=A+M?(b=0,A=w):1<=A+M?(b=(v*m-1)*Math.pow(2,y),A+=M):(b=v*Math.pow(2,M-1)*Math.pow(2,y),A=0));8<=y;g[p+I]=255&b,I+=O,b/=256,y-=8);for(A=A<>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]),hh}var ph,mh;function tm(){return mh||(mh=1,ph=["abs","acos","all","any","asin","atan","ceil","clamp","cos","cross","dFdx","dFdy","degrees","distance","dot","equal","exp","exp2","faceforward","floor","fract","gl_BackColor","gl_BackLightModelProduct","gl_BackLightProduct","gl_BackMaterial","gl_BackSecondaryColor","gl_ClipPlane","gl_ClipVertex","gl_Color","gl_DepthRange","gl_DepthRangeParameters","gl_EyePlaneQ","gl_EyePlaneR","gl_EyePlaneS","gl_EyePlaneT","gl_Fog","gl_FogCoord","gl_FogFragCoord","gl_FogParameters","gl_FragColor","gl_FragCoord","gl_FragData","gl_FragDepth","gl_FragDepthEXT","gl_FrontColor","gl_FrontFacing","gl_FrontLightModelProduct","gl_FrontLightProduct","gl_FrontMaterial","gl_FrontSecondaryColor","gl_LightModel","gl_LightModelParameters","gl_LightModelProducts","gl_LightProducts","gl_LightSource","gl_LightSourceParameters","gl_MaterialParameters","gl_MaxClipPlanes","gl_MaxCombinedTextureImageUnits","gl_MaxDrawBuffers","gl_MaxFragmentUniformComponents","gl_MaxLights","gl_MaxTextureCoords","gl_MaxTextureImageUnits","gl_MaxTextureUnits","gl_MaxVaryingFloats","gl_MaxVertexAttribs","gl_MaxVertexTextureImageUnits","gl_MaxVertexUniformComponents","gl_ModelViewMatrix","gl_ModelViewMatrixInverse","gl_ModelViewMatrixInverseTranspose","gl_ModelViewMatrixTranspose","gl_ModelViewProjectionMatrix","gl_ModelViewProjectionMatrixInverse","gl_ModelViewProjectionMatrixInverseTranspose","gl_ModelViewProjectionMatrixTranspose","gl_MultiTexCoord0","gl_MultiTexCoord1","gl_MultiTexCoord2","gl_MultiTexCoord3","gl_MultiTexCoord4","gl_MultiTexCoord5","gl_MultiTexCoord6","gl_MultiTexCoord7","gl_Normal","gl_NormalMatrix","gl_NormalScale","gl_ObjectPlaneQ","gl_ObjectPlaneR","gl_ObjectPlaneS","gl_ObjectPlaneT","gl_Point","gl_PointCoord","gl_PointParameters","gl_PointSize","gl_Position","gl_ProjectionMatrix","gl_ProjectionMatrixInverse","gl_ProjectionMatrixInverseTranspose","gl_ProjectionMatrixTranspose","gl_SecondaryColor","gl_TexCoord","gl_TextureEnvColor","gl_TextureMatrix","gl_TextureMatrixInverse","gl_TextureMatrixInverseTranspose","gl_TextureMatrixTranspose","gl_Vertex","greaterThan","greaterThanEqual","inversesqrt","length","lessThan","lessThanEqual","log","log2","matrixCompMult","max","min","mix","mod","normalize","not","notEqual","pow","radians","reflect","refract","sign","sin","smoothstep","sqrt","step","tan","texture2D","texture2DLod","texture2DProj","texture2DProjLod","textureCube","textureCubeLod","texture2DLodEXT","texture2DProjLodEXT","textureCubeLodEXT","texture2DGradEXT","texture2DProjGradEXT","textureCubeGradEXT"]),ph}var Ta,gh;function rT(){if(gh)return Ta;gh=1;var r=em();return Ta=r.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"]),Ta}var Sa,vh;function iT(){if(vh)return Sa;vh=1;var r=tm();return r=r.slice().filter(function(e){return!/^(gl\_|texture)/.test(e)}),Sa=r.concat(["gl_VertexID","gl_InstanceID","gl_Position","gl_PointSize","gl_FragCoord","gl_FrontFacing","gl_FragDepth","gl_PointCoord","gl_MaxVertexAttribs","gl_MaxVertexUniformVectors","gl_MaxVertexOutputVectors","gl_MaxFragmentInputVectors","gl_MaxVertexTextureImageUnits","gl_MaxCombinedTextureImageUnits","gl_MaxTextureImageUnits","gl_MaxFragmentUniformVectors","gl_MaxDrawBuffers","gl_MinProgramTexelOffset","gl_MaxProgramTexelOffset","gl_DepthRangeParameters","gl_DepthRange","trunc","round","roundEven","isnan","isinf","floatBitsToInt","floatBitsToUint","intBitsToFloat","uintBitsToFloat","packSnorm2x16","unpackSnorm2x16","packUnorm2x16","unpackUnorm2x16","packHalf2x16","unpackHalf2x16","outerProduct","transpose","determinant","inverse","texture","textureSize","textureProj","textureLod","textureOffset","texelFetch","texelFetchOffset","textureProjOffset","textureLodOffset","textureProjLod","textureProjLodOffset","textureGrad","textureGradOffset","textureProjGrad","textureProjGradOffset"]),Sa}var Ea,yh;function oT(){if(yh)return Ea;yh=1,Ea=A;var r=em(),e=nT(),t=tm(),n=rT(),i=iT(),o=999,s=9999,a=0,l=1,u=2,c=3,f=4,d=5,h=6,g=7,v=8,p=9,m=10,y=11,_=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];function A(b){var x=0,w=0,M=o,E,I,O=[],C=[],X=1,T=0,G=0,F=!1,D=!1,L="",$;b=b||{};var k=t,N=r;b.version==="300 es"&&(k=i,N=n);for(var V={},P={},x=0;x0)continue;ae=z.slice(0,1).join("")}return J(ae),G+=ae.length,O=O.slice(ae.length),O.length}while(!0)}function S(){return/[^a-fA-F0-9]/.test(E)?(J(O.join("")),M=o,x):(O.push(E),I=E,x+1)}function Z(){return E==="."||/[eE]/.test(E)?(O.push(E),M=d,I=E,x+1):E==="x"&&O.length===1&&O[0]==="0"?(M=y,O.push(E),I=E,x+1):/[^\d]/.test(E)?(J(O.join("")),M=o,x):(O.push(E),I=E,x+1)}function H(){return E==="f"&&(O.push(E),I=E,x+=1),/[eE]/.test(E)||(E==="-"||E==="+")&&/[eE]/.test(I)?(O.push(E),I=E,x+1):/[^\d]/.test(E)?(J(O.join("")),M=o,x):(O.push(E),I=E,x+1)}function j(){if(/[^\d\w_]/.test(E)){var z=O.join("");return P[z]?M=v:V[z]?M=g:M=h,J(O.join("")),M=o,x}return O.push(E),I=E,x+1}}return Ea}var Ca,_h;function sT(){if(_h)return Ca;_h=1;var r=oT();Ca=e;function e(t,n){var i=r(n),o=[];return o=o.concat(i(t)),o=o.concat(i(null)),o}return Ca}sT();function aT(r,e){if(typeof r!="object"||r===null)return r;var t=r[Symbol.toPrimitive];if(t!==void 0){var n=t.call(r,e||"default");if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(r)}function lT(r){var e=aT(r,"string");return typeof e=="symbol"?e:String(e)}function qe(r,e,t){return e=lT(e),e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}var Pe={position:"csm_Position",positionRaw:"csm_PositionRaw",pointSize:"csm_PointSize",fragColor:"csm_FragColor",diffuseColor:"csm_DiffuseColor",normal:"csm_Normal",roughness:"csm_Roughness",metalness:"csm_Metalness",emissive:"csm_Emissive",ao:"csm_AO",bump:"csm_Bump",depthAlpha:"csm_DepthAlpha"},kt,Rr;kt={},qe(kt,"".concat(Pe.normal),{"#include ":` + vec3 objectNormal = `.concat(Pe.normal,`; + #ifdef USE_TANGENT + vec3 objectTangent = vec3( tangent.xyz ); + #endif + `)}),qe(kt,"".concat(Pe.position),{"#include ":` + vec3 transformed = `.concat(Pe.position,`; + `)}),qe(kt,"".concat(Pe.positionRaw),{"#include ":` + vec4 csm_internal_positionUnprojected = `.concat(Pe.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(kt,"".concat(Pe.pointSize),{"gl_PointSize = size;":` + gl_PointSize = `.concat(Pe.pointSize,`; + `)}),qe(kt,"".concat(Pe.diffuseColor),{"#include ":` + #include + diffuseColor = `.concat(Pe.diffuseColor,`; + `)}),qe(kt,"".concat(Pe.fragColor),{"#include ":` + #include + gl_FragColor = `.concat(Pe.fragColor,`; + `)}),qe(kt,"".concat(Pe.emissive),{"vec3 totalEmissiveRadiance = emissive;":` + vec3 totalEmissiveRadiance = `.concat(Pe.emissive,`; + `)}),qe(kt,"".concat(Pe.roughness),{"#include ":` + #include + roughnessFactor = `.concat(Pe.roughness,`; + `)}),qe(kt,"".concat(Pe.metalness),{"#include ":` + #include + metalnessFactor = `.concat(Pe.metalness,`; + `)}),qe(kt,"".concat(Pe.ao),{"#include ":` + #include + reflectedLight.indirectDiffuse *= 1. - `.concat(Pe.ao,`; + `)}),qe(kt,"".concat(Pe.bump),{"#include ":` + #include + + vec3 csm_internal_orthogonal = `.concat(Pe.bump," - (dot(").concat(Pe.bump,`, normal) * normal); + vec3 csm_internal_projectedbump = mat3(csm_internal_vModelViewMatrix) * csm_internal_orthogonal; + normal = normalize(normal - csm_internal_projectedbump); + `)}),qe(kt,"".concat(Pe.depthAlpha),{"gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );":` + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity * `.concat(Pe.depthAlpha,` ); + `),"gl_FragColor = packDepthToRGBA( fragCoordZ );":` + gl_FragColor = packDepthToRGBA( fragCoordZ ); + gl_FragColor.a *= `.concat(Pe.depthAlpha,`; + `)});Rr={},qe(Rr,"".concat(Pe.position),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = projectionMatrix * modelViewMatrix * vec4( `.concat(Pe.position,`, 1.0 ); + `)}),qe(Rr,"".concat(Pe.positionRaw),{"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );":` + gl_Position = `.concat(Pe.position,`; + `)}),qe(Rr,"".concat(Pe.diffuseColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(Pe.diffuseColor,`; + `)}),qe(Rr,"".concat(Pe.fragColor),{"gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );":` + gl_FragColor = `.concat(Pe.fragColor,`; + `)});var Pt;Pt={},qe(Pt,"".concat(Pe.position),"*"),qe(Pt,"".concat(Pe.positionRaw),"*"),qe(Pt,"".concat(Pe.normal),"*"),qe(Pt,"".concat(Pe.pointSize),["PointsMaterial"]),qe(Pt,"".concat(Pe.diffuseColor),"*"),qe(Pt,"".concat(Pe.fragColor),"*"),qe(Pt,"".concat(Pe.emissive),["MeshStandardMaterial","MeshPhysicalMaterial"]),qe(Pt,"".concat(Pe.roughness),["MeshStandardMaterial","MeshPhysicalMaterial"]),qe(Pt,"".concat(Pe.metalness),["MeshStandardMaterial","MeshPhysicalMaterial"]),qe(Pt,"".concat(Pe.ao),["MeshStandardMaterial","MeshPhysicalMaterial","MeshBasicMaterial","MeshLambertMaterial","MeshPhongMaterial","MeshToonMaterial"]),qe(Pt,"".concat(Pe.bump),["MeshLambertMaterial","MeshMatcapMaterial","MeshNormalMaterial","MeshPhongMaterial","MeshPhysicalMaterial","MeshStandardMaterial","MeshToonMaterial","ShadowMaterial"]),qe(Pt,"".concat(Pe.depthAlpha),"*");var uT=`void main() { + gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); +}`,cT=`#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 Ui=new Re(0,0,0),Uu=new Re(0,0,0),fT=new Re(0,0,0);function xh(r,e,t){const n=Ui.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 hT(r,e){const t=Ui.setFromMatrixPosition(r.matrixWorld),n=Uu.setFromMatrixPosition(e.matrixWorld),i=t.sub(n),o=e.getWorldDirection(fT);return i.angleTo(o)>Math.PI/2}function dT(r,e,t,n){const i=Ui.setFromMatrixPosition(r.matrixWorld),o=i.clone();o.project(e),t.setFromCamera(new _t(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 nm(r,e,t=""){let n="matrix3d(";for(let i=0;i!==16;i++)n+=Xl(e[i]*r.elements[i])+(i!==15?",":")");return t+n}const gT=(r=>e=>nm(e,r))([1,-1,1,1,1,-1,1,1,1,-1,1,1,1,-1,1,1]),vT=(r=>(e,t)=>nm(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]),yT=["geometry","material"];new Id;var Wl={exports:{}},_T=Wl.exports,bh;function xT(){return bh||(bh=1,function(r,e){(function(t,n){r.exports=n()})(_T,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,d)){var g=performance.memory;d.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,d=3*u,h=2*u,g=3*u,v=15*u,p=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,d,h),_.fillRect(g,v,p,m),_.fillStyle=o,_.globalAlpha=.9,_.fillRect(g,v,p,m),{dom:y,update:function(A,b){s=Math.min(s,A),a=Math.max(a,A),_.fillStyle=o,_.globalAlpha=1,_.fillRect(0,0,c,v),_.fillStyle=i,_.fillText(l(A)+" "+n+" ("+l(s)+"-"+l(a)+")",d,h),_.drawImage(y,g+u,v,p-u,m,g,v,p-u,m),_.fillRect(g+p-u,v,u,m),_.fillStyle=o,_.globalAlpha=.9,_.fillRect(g+p-u,v,u,l((1-A/b)*m))}}},t})}(Wl)),Wl.exports}xT();const bT={key:0,args:[0,1,64]},wT={key:1,args:[.5,1,64]},TT={key:2},ST=["tone-mapped","map","side","color"];new It(16777215);const yn="0px",rm=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,d){const h=l.animate(f,d);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),d=n(c,f),h=o(d,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:d}=getComputedStyle(c);c.style.height=d,c.style.overflow="hidden";const h=o(d,f).reverse(),g={duration:e.duration,easing:e.easingLeave};i(c,f,u,h,g)}return(l,u)=>(de(),lt(Zo,{css:!1,onEnter:s,onLeave:a},{default:Ue(()=>[ut(l.$slots,"default")]),_:3}))}}),ET={flex:"~ col",border:"~ gray/25 rounded-lg",divide:"y dashed gray/25","of-clip":"","shadow-sm":""},CT={op50:""},AT={key:0,"w-full":""},wh=De({__name:"Collapsable",props:Rg({default:{type:Boolean},label:null},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const e=r,t=Og(r,"modelValue");return hn(()=>{e.default!=null&&(t.value=!!e.default)}),(n,i)=>(de(),xe("div",ET,[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",{},()=>[gc(we(e.label??"Collapsable"),1)])]),i[1]||(i[1]=gc()),Y("span",CT,we(t.value?"▲":"▼"),1)]),Fe(rm,null,{default:Ue(()=>[t.value?(de(),xe("div",AT,[ut(n.$slots,"default")])):tt("",!0)]),_:3})]))}}),Or=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,p){return Math.min(Math.max(g,v),p)}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 p=s(v),m=10**(p+3);return Number.parseFloat((g*m/m).toFixed(p))}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,A=Math.round(_/t.step)*t.step;return Math.min(Math.max(A,t.min),t.max)}function f(g){if(t.disabled)return;const v=c(g);n("update:modelValue",v)}function d(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 Ht(()=>{window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",h)}),(g,v)=>(de(),xe("span",{ref_key:"sliderRef",ref:i,class:Jt(["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:d},[Y("span",{style:Zr(u.value),bg:"[#cabeff] dark:[#4e34b9]",relative:"",block:"","rounded-sm":"",h:"[14px]"},null,4),Y("span",{role:"slider",class:"slider-thumb",style:Zr({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 Th(r,e){if(e===Fg)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),r;if(e===Za||e===Dd){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 a2(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 MT(){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 kT{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 $T{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 HT{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 XT{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,d=new Uint8Array(a,l,u);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(c,f,d,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,d,i.mode,i.filter),h})})}else return null}}class WT{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!==Yt.TRIANGLES&&u.mode!==Yt.TRIANGLE_STRIP&&u.mode!==Yt.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],d=u[0].count,h=[];for(const g of f){const v=new Tn,p=new Re,m=new Mo,y=new Re(1,1,1),_=new Ug(g.geometry,g.material,d);for(let A=0;A0||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 s2=new Tn;class a2{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new MT,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 jg(this.options.manager):this.textureLoader=new Vg(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Bd(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 Qn(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&&p.setY(E,x[w*l+1]),l>=3&&p.setZ(E,x[w*l+2]),l>=4&&p.setW(E,x[w*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}p.normalized=g}return p})}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 d=(o.samplers||{})[s.sampler]||{};return c.magFilter=Eh[d.magFilter]||Po,c.minFilter=Eh[d.minFilter]||mu,c.wrapS=Ch[d.wrapS]||Ro,c.wrapT=Ch[d.wrapT]||Ro,c.generateMipmaps=!c.isCompressedTexture&&c.minFilter!==cr&&c.minFilter!==Po,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 d=new Blob([f],{type:s.mimeType});return l=a.createObjectURL(d),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(d,h){let g=d;t.isImageBitmapLoader===!0&&(g=function(v){const p=new ko(v);p.needsUpdate=!0,d(p)}),t.load(bi.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||o2(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 Gg,_s.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 $g,_s.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 zd}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 It(1,1,1),a.opacity=1,Array.isArray(f.baseColorFactor)){const d=f.baseColorFactor;a.color.setRGB(d[0],d[1],d[2],Sn),a.opacity=d[3]}f.baseColorTexture!==void 0&&u.push(t.assignTexture(a,"map",f.baseColorTexture,Ii)),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(d){return d.getMaterialType&&d.getMaterialType(e)}),u.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(e,a)})))}o.doubleSided===!0&&(a.side=Ko);const c=o.alphaMode||Ia.OPAQUE;if(c===Ia.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===Ia.MASK&&(a.alphaTest=o.alphaCutoff!==void 0?o.alphaCutoff:.5)),o.normalTexture!==void 0&&s!==Dr&&(u.push(t.assignTexture(a,"normalMap",o.normalTexture)),a.normalScale=new _t(1,1),o.normalTexture.scale!==void 0)){const f=o.normalTexture.scale;a.normalScale.set(f,f)}if(o.occlusionTexture!==void 0&&s!==Dr&&(u.push(t.assignTexture(a,"aoMap",o.occlusionTexture)),o.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=o.occlusionTexture.strength)),o.emissiveFactor!==void 0&&s!==Dr){const f=o.emissiveFactor;a.emissive=new It().setRGB(f[0],f[1],f[2],Sn)}return o.emissiveTexture!==void 0&&s!==Dr&&u.push(t.assignTexture(a,"emissiveMap",o.emissiveTexture,Ii)),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&&Qn(i,f,o),f})}createUniqueName(e){const t=Ai.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 Ah(l,a,t)})}const s=[];for(let a=0,l=e.length;a0&&r2(m,o),m.name=t.createUniqueName(o.name||"mesh_"+e),bn(m,o),p.extensions&&Qn(i,m,p),t.assignFinalMaterial(m),f.push(m)}for(let h=0,g=f.length;h1?c=new xs:u.length===1?c=u[0]:c=new Ud,c!==u[0])for(let f=0,d=u.length;f{const f=new Map;for(const[d,h]of i.associations)(d instanceof _s||d instanceof ko)&&f.set(d,h);return c.traverse(d=>{const h=i.associations.get(d);h!=null&&f.set(d,h)}),f};return i.associations=u(o),o})}_createAnimationTracks(e,t,n,i,o){const s=[],a=e.name?e.name:e.uuid,l=[];Pn[o.path]===Pn.weights?e.traverse(function(d){d.morphTargetInfluences&&l.push(d.name?d.name:d.uuid)}):l.push(a);let u;switch(Pn[o.path]){case Pn.weights:u=_c;break;case Pn.rotation:u=xc;break;case Pn.position:case Pn.scale:u=yc;break;default:switch(n.itemSize){case 1:u=_c;break;case 2:case 3:default:u=yc;break}break}const c=i.interpolation!==void 0?e2[i.interpolation]:pu,f=this._getArrayFromAccessor(n);for(let d=0,h=l.length;dnew Lv(r)),er.register(r=>new Nv(r)),er)}async function u2(r){const n=(await sm().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 c2(r,e){if(!r){console.warn("No VRM found");return}if(e)return Dv(e,r)}function f2(){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 h2(r,e){const i=(await sm().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(bc.removeUnnecessaryVertices(o.scene),bc.combineSkeletons(o.scene),o.scene.traverse(s=>{s.frustumCulled=!1}),o.lookAt){const s=new Bv(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 d2(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 A=Object.keys(r.expressionManager.expressionMap);for(const b of A)r.expressionManager.setValue(b,0)}i.value.clear(),o.value.clear();for(const A of y.expression||[]){const b=((_=r.expressionManager)==null?void 0:_.getValue(A.name))||0;i.value.set(A.name,b),o.value.set(A.name,A.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 A;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[b,x]of o.value){const w=i.value.get(b)||0,M=a(w,x,l(n.value));(A=r.expressionManager)==null||A.setValue(b,M)}},addEmotionState:(m,y)=>{u.set(m,y)},removeEmotionState:m=>{u.delete(m)},dispose:()=>{c()}}}const p2=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}=Ci(),{onBeforeRender:l}=hu(),u=f2(),c=le();return Ge(()=>n.position,([f,d,h])=>{o.value&&o.value.scene.position.set(f,d,h)}),$t(async()=>{if(a.value)try{const f=await h2(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 d=await u2(n.idleAnimation),h=await c2(f,d);if(!h){console.warn("No VRM animation loaded");return}s.value=new tv(f.scene),s.value.clipAction(h).play(),c.value=d2(f),l(({delta:g})=>{var v,p,m;(v=s.value)==null||v.update(g),(p=o.value)==null||p.update(g),u.update(o.value,g),(m=c.value)==null||m.update(g)}),o.value=f}catch(f){i("error",f)}}),Ht(()=>{if(o.value){const{scene:f}=Ci();f.value.remove(o.value.scene)}}),e({setExpression(f){var d;(d=c.value)==null||d.setEmotionWithResetAfter(f,1e3)}}),(f,d)=>ut(f.$slots,"default")}}),m2=["position"],g2={absolute:"",bottom:"2",right:"2"},v2={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":""},y2=["checked","aria-checked"],_2={key:0,absolute:"","w-full":"","min-w":"50vw",z:"{var g;(g=d.value)==null||g.setExpression(h)}}),(h,g)=>{const v=Io("TransitionVertical");return de(),lt(Bp,{relative:""},{default:Ue(({height:p,width:m})=>[Fe(K(nv),{alpha:!0,antialias:!0,width:m,height:p},{default:Ue(()=>[Fe(K(eT)),Y("TresPerspectiveCamera",{position:[s.value,a.value,l.value]},null,8,m2),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)),Fe(p2,{ref_key:"modelRef",ref:d,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",g2,[Y("div",v2,[Y("label",{"h-fit":"","cursor-pointer":"",class:Jt([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,y2),[[Kr,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)]),Fe(v,null,{default:Ue(()=>[o.value?(de(),xe("div",_2,[Y("div",x2,[Y("div",b2,[Y("span",null,we(h.$t("stage.viewers.debug-menu.vrm.model.title")),1)]),Fe(wh,{"h-fit":"","w-full":""},{label:Ue(()=>[Y("span",w2,we(h.$t("stage.viewers.debug-menu.vrm.camera")),1)]),default:Ue(()=>[Y("div",T2,[g[17]||(g[17]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"X")],-1)),Y("label",S2,[Fe(Or,{modelValue:s.value,"onUpdate:modelValue":g[3]||(g[3]=y=>s.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",E2,[Y("span",null,we(s.value),1)]),g[18]||(g[18]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Y")],-1)),Y("label",C2,[Fe(Or,{modelValue:a.value,"onUpdate:modelValue":g[4]||(g[4]=y=>a.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",A2,[Y("span",null,we(a.value),1)]),g[19]||(g[19]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Z")],-1)),Y("label",I2,[Fe(Or,{modelValue:l.value,"onUpdate:modelValue":g[5]||(g[5]=y=>l.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",M2,[Y("span",null,we(l.value),1)])])]),_:1}),Fe(wh,{"h-fit":"","w-full":""},{label:Ue(()=>[Y("span",k2,we(h.$t("stage.viewers.debug-menu.vrm.model.title")),1)]),default:Ue(()=>[Y("div",P2,[g[20]||(g[20]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"X")],-1)),Y("label",R2,[Fe(Or,{modelValue:u.value,"onUpdate:modelValue":g[6]||(g[6]=y=>u.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",O2,[Y("span",null,we(u.value),1)]),g[21]||(g[21]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Y")],-1)),Y("label",F2,[Fe(Or,{modelValue:c.value,"onUpdate:modelValue":g[7]||(g[7]=y=>c.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",L2,[Y("span",null,we(c.value),1)]),g[22]||(g[22]=Y("div",{text:"zinc-400 dark:zinc-500"},[Y("span",null,"Z")],-1)),Y("label",N2,[Fe(Or,{modelValue:f.value,"onUpdate:modelValue":g[8]||(g[8]=y=>f.value=y),min:-10,max:10,step:.01},null,8,["modelValue"])]),Y("div",D2,[Y("span",null,we(f.value),1)])])]),_:1}),Y("div",B2,[Y("span",null,we(h.$t("stage.viewers.debug-menu.emotions")),1)]),Y("div",U2,[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(_=d.value)==null?void 0:_.setExpression("neutral")})},we(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(_=d.value)==null?void 0:_.setExpression("surprised")})},we(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(_=d.value)==null?void 0:_.setExpression("sad")})},we(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(_=d.value)==null?void 0:_.setExpression("angry")})},we(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(_=d.value)==null?void 0:_.setExpression("happy")})},we(h.$t("stage.viewers.debug-menu.emotions-btn.happy")),1)])])])):tt("",!0)]),_:1})])]),_:1})}}});class ka extends Error{constructor(t,n){super(t);dc(this,"response");this.name="XSAIError",this.response=n}}const j2=r=>r.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`),Co=r=>Object.fromEntries(Object.entries(r).map(([e,t])=>[j2(e),t])),am=r=>Object.fromEntries(Object.entries(r).filter(([,e])=>e!==void 0)),lm=r=>JSON.stringify(Co(am({...r,abortSignal:void 0,apiKey:void 0,baseURL:void 0,fetch:void 0,headers:void 0}))),zu=(r,e)=>am({Authorization:e!==void 0?`Bearer ${e}`:void 0,...r}),ju=(r,e)=>{const t=e.toString();return new URL(r,t.endsWith("/")?t:`${t}/`)},Vu=async r=>{if(!r.ok){const e=new ka(`Remote sent ${r.status} response`,r);throw e.cause=new Error(await r.text()),e}if(!r.body)throw new ka("Response body is empty from remote server",r);if(!(r.body instanceof ReadableStream)){const e=new ka(`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},V2=async r=>Vu(r).then(async e=>e.json()),G2=async r=>(r.fetch??globalThis.fetch)(ju("audio/speech",r.baseURL),{body:lm(r),headers:zu({"Content-Type":"application/json",...r.headers},r.apiKey),method:"POST",signal:r.abortSignal}).then(Vu).then(async e=>e.arrayBuffer()),um=(r,{apiKey:e,baseURL:t,headers:n})=>({apiKey:e,baseURL:t,headers:n,model:r}),$2=r=>{const e={...r,baseURL:new URL("http://localhost:11434/v1/")},t=n=>um(n,e);return{chat:t,embed:t,model:()=>e}};$2();const H2=r=>{const e=({applyTextNormalization:t,languageCode:n,nextRequestIds:i,nextText:o,previousRequestIds:s,previousText:a,pronunciationDictionaryLocators:l,seed:u,voiceSettings:c})=>({extraBody:Co({applyTextNormalization:t,languageCode:n,nextRequestIds:i,nextText:o,previousRequestIds:s,previousText:a,pronunciationDictionaryLocators:l?l.map(f=>Co(f)):void 0,seed:u,voiceSettings:c?Co(c):void 0})});return{speech:(t,n)=>({...n?e(n):{},...um(`elevenlabs/${t}`,{...r,baseURL:(r==null?void 0:r.baseURL)??new URL("http://localhost:5933/v1/")})})}},X2=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class zi{constructor(e,t,n){this.property=e,this.normal=t,n&&(this.space=n)}}zi.prototype.property={};zi.prototype.normal={};zi.prototype.space=null;function cm(r,e){const t={},n={};let i=-1;for(;++i4&&t.slice(0,4)==="data"&&Z2.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(Mh,tS);n="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!Mh.test(o)){let s=o.replace(J2,eS);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}i=Gu}return new i(n,e)}function eS(r){return"-"+r.toLowerCase()}function tS(r){return r.charAt(1).toUpperCase()}const nS=cm([dm,hm,gm,vm,Y2],"html"),ym=cm([dm,hm,gm,vm,K2],"svg"),kh={}.hasOwnProperty;function rS(r,e){const t=e;function n(i,...o){let s=n.invalid;const a=n.handlers;if(i&&kh.call(i,r)){const l=String(i[r]);s=kh.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 iS=/["&'<>`]/g,oS=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,sS=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,aS=/[|\\{}()[\]^$+*?.]/g,Ph=new WeakMap;function lS(r,e){if(r=r.replace(e.subset?uS(e.subset):iS,n),e.subset||e.escapeOnly)return r;return r.replace(oS,t).replace(sS,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 uS(r){let e=Ph.get(r);return e||(e=cS(r),Ph.set(r,e)),e}function cS(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:"€"},gS=["cent","copy","divide","gt","lt","not","para","times"],_m={}.hasOwnProperty,Jl={};let ao;for(ao in Ra)_m.call(Ra,ao)&&(Jl[Ra[ao]]=ao);const vS=/[^\dA-Za-z]/;function yS(r,e,t,n){const i=String.fromCharCode(r);if(_m.call(Jl,i)){const o=Jl[i],s="&"+o;return t&&mS.includes(o)&&!gS.includes(o)&&(!n||e&&e!==61&&vS.test(String.fromCharCode(e)))?s:s+";"}return""}function _S(r,e,t){let n=hS(r,e,t.omitOptionalSemicolons),i;if((t.useNamedReferences||t.useShortestReferences)&&(i=yS(r,e,t.omitOptionalSemicolons,t.attribute)),(t.useShortestReferences||!i)&&t.useShortestReferences){const o=pS(r,e,t.omitOptionalSemicolons);o.length|^->||--!>|"],wS=["<",">"];function TS(r,e,t,n){return n.settings.bogusComments?"":"";function i(o){return qr(o,Object.assign({},n.settings.characterReferences,{subset:wS}))}}function SS(r,e,t,n){return""}function Rh(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 ES(r,e){const t=e||{};return(r[r.length-1]===""?[...r,""]:r).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}function CS(r){return r.join(" ").trim()}const AS=/[ \t\n\f\r]/g;function $u(r){return typeof r=="object"?r.type==="text"?Oh(r.value):!1:Oh(r)}function Oh(r){return r.replace(AS,"")===""}const bt=bm(1),xm=bm(-1),IS=[];function bm(r){return e;function e(t,n,i){const o=t?t.children:IS;let s=(n||0)+r,a=o[s];if(!i)for(;a&&$u(a);)s+=r,a=o[s];return a}}const MS={}.hasOwnProperty;function wm(r){return e;function e(t,n,i){return MS.call(r,t.tagName)&&r[t.tagName](t,n,i)}}const Hu=wm({body:PS,caption:Oa,colgroup:Oa,dd:LS,dt:FS,head:Oa,html:kS,li:OS,optgroup:NS,option:DS,p:RS,rp:Fh,rt:Fh,tbody:US,td:Lh,tfoot:zS,th:Lh,thead:BS,tr:jS});function Oa(r,e,t){const n=bt(t,e,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&$u(n.value.charAt(0)))}function kS(r,e,t){const n=bt(t,e);return!n||n.type!=="comment"}function PS(r,e,t){const n=bt(t,e);return!n||n.type!=="comment"}function RS(r,e,t){const n=bt(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 OS(r,e,t){const n=bt(t,e);return!n||n.type==="element"&&n.tagName==="li"}function FS(r,e,t){const n=bt(t,e);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function LS(r,e,t){const n=bt(t,e);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function Fh(r,e,t){const n=bt(t,e);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function NS(r,e,t){const n=bt(t,e);return!n||n.type==="element"&&n.tagName==="optgroup"}function DS(r,e,t){const n=bt(t,e);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function BS(r,e,t){const n=bt(t,e);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function US(r,e,t){const n=bt(t,e);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function zS(r,e,t){return!bt(t,e)}function jS(r,e,t){const n=bt(t,e);return!n||n.type==="element"&&n.tagName==="tr"}function Lh(r,e,t){const n=bt(t,e);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}const VS=wm({body:HS,colgroup:XS,head:$S,html:GS,tbody:WS});function GS(r){const e=bt(r,-1);return!e||e.type!=="comment"}function $S(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 HS(r){const e=bt(r,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&$u(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function XS(r,e,t){const n=xm(t,e),i=bt(r,-1,!0);return t&&n&&n.type==="element"&&n.tagName==="colgroup"&&Hu(n,t.children.indexOf(n),t)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function WS(r,e,t){const n=xm(t,e),i=bt(r,-1);return t&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&Hu(n,t.children.indexOf(n),t)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const lo={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 qS(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=ym);const u=YS(n,r.properties),c=n.all(i.space==="html"&&r.tagName==="template"?r.content:r);return n.schema=i,c&&(s=!1),(u||!o||!VS(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||!Hu(r,e,t))&&a.push(""),a.join("")}function YS(r,e){const t=[];let n=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const o=KS(r,i,e[i]);o&&t.push(o)}}for(;++nRh(t,r.alternative)&&(s=r.alternative),a=s+qr(t,Object.assign({},r.settings.characterReferences,{subset:(s==="'"?lo.single:lo.double)[i][o],attribute:!0}))+s),l+(a&&"="+a))}const ZS=["<","&"];function Tm(r,e,t,n){return t&&t.type==="element"&&(t.tagName==="script"||t.tagName==="style")?r.value:qr(r.value,Object.assign({},n.settings.characterReferences,{subset:ZS}))}function JS(r,e,t,n){return n.settings.allowDangerousHtml?r.value:Tm(r,e,t,n)}function QS(r,e,t,n){return n.all(r)}const eE=rS("type",{invalid:tE,unknown:nE,handlers:{comment:TS,doctype:SS,element:qS,raw:JS,root:QS,text:Tm}});function tE(r){throw new Error("Expected node, not `"+r+"`")}function nE(r){const e=r;throw new Error("Cannot compile unknown node `"+e.type+"`")}const rE={},iE=[];function oE(r,e){const t=e,n=t.quote||'"',i=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:sE,all:aE,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||X2,characterReferences:t.characterReferences||rE,closeSelfClosing:t.closeSelfClosing||!1,closeEmptyElements:t.closeEmptyElements||!1},schema:t.space==="svg"?ym:nS,quote:n,alternative:i}.one(Array.isArray(r)?{type:"root",children:r}:r,void 0,void 0)}function sE(r,e,t){return eE(r,e,t,this)}function aE(r){const e=[],t=r&&r.children||iE;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?(mn(r,r.length,0,e),r):e}const Bh={}.hasOwnProperty;function hE(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 Yr(r){return r.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const cn=Xn(/[A-Za-z]/),Gt=Xn(/[\dA-Za-z]/),mE=Xn(/[#-'*+\--9=?A-Z^-~]/);function Ql(r){return r!==null&&(r<32||r===127)}const eu=Xn(/\d/),gE=Xn(/[\dA-Fa-f]/),vE=Xn(/[!-/:-@[-`{-~]/);function Me(r){return r!==null&&r<-2}function Ft(r){return r!==null&&(r<0||r===32)}function He(r){return r===-2||r===-1||r===32}const yE=Xn(new RegExp("\\p{P}|\\p{S}","u")),_E=Xn(/\s/);function Xn(r){return e;function e(t){return t!==null&&t>-1&&r.test(String.fromCharCode(t))}}function ii(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 Je(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 w=e.events.length;let M=w,E,I;for(;M--;)if(e.events[M][0]==="exit"&&e.events[M][1].type==="chunkFlow"){if(E){I=e.events[M][1].end;break}E=!0}for(m(n),x=w;x_;){const b=t[A];e.containerState=b[1],b[0].exit.call(e,r)}t.length=_}function y(){i.write([null]),o=void 0,i=void 0,e.containerState._closeFlow=void 0}}function SE(r,e,t){return Je(r,r.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function zh(r){if(r===null||Ft(r)||_E(r))return 1;if(yE(r))return 2}function Wu(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},d={...r[t][1].start};jh(f,-l),jh(d,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:d},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=Zt(u,[["enter",r[n][1],e],["exit",r[n][1],e]])),u=Zt(u,[["enter",i,e],["enter",s,e],["exit",s,e],["enter",o,e]]),u=Zt(u,Wu(e.parser.constructs.insideSpan.null,r.slice(n+1,t),e)),u=Zt(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=Zt(u,[["enter",r[t][1],e],["exit",r[t][1],e]])):c=0,mn(r,n-1,t-n+3,u),t=n+u.length-c-2;break}}for(t=-1;++t0&&He(x)?Je(r,y,"linePrefix",o+1)(x):y(x)}function y(x){return x===null||Me(x)?r.check(Vh,v,A)(x):(r.enter("codeFlowValue"),_(x))}function _(x){return x===null||Me(x)?(r.exit("codeFlowValue"),y(x)):(r.consume(x),_)}function A(x){return r.exit("codeFenced"),e(x)}function b(x,w,M){let E=0;return I;function I(G){return x.enter("lineEnding"),x.consume(G),x.exit("lineEnding"),O}function O(G){return x.enter("codeFencedFence"),He(G)?Je(x,C,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(G):C(G)}function C(G){return G===a?(x.enter("codeFencedFenceSequence"),X(G)):M(G)}function X(G){return G===a?(E++,x.consume(G),X):E>=s?(x.exit("codeFencedFenceSequence"),He(G)?Je(x,T,"whitespace")(G):T(G)):M(G)}function T(G){return G===null||Me(G)?(x.exit("codeFencedFence"),w(G)):M(G)}}}function NE(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 Fa={name:"codeIndented",tokenize:BE},DE={partial:!0,tokenize:UE};function BE(r,e,t){const n=this;return i;function i(u){return r.enter("codeIndented"),Je(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):Me(u)?r.attempt(DE,s,l)(u):(r.enter("codeFlowValue"),a(u))}function a(u){return u===null||Me(u)?(r.exit("codeFlowValue"),s(u)):(r.consume(u),a)}function l(u){return r.exit("codeIndented"),e(u)}}function UE(r,e,t){const n=this;return i;function i(s){return n.parser.lazy[n.now().line]?t(s):Me(s)?(r.enter("lineEnding"),r.consume(s),r.exit("lineEnding"),i):Je(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):Me(s)?i(s):t(s)}}const zE={name:"codeText",previous:VE,resolve:jE,tokenize:GE};function jE(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&&hi(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),hi(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),hi(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 km(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),d):m===null||m===32||m===41||Ql(m)?t(m):(r.enter(n),r.enter(s),r.enter(a),r.enter("chunkString",{contentType:"string"}),v(m))}function d(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),d(m)):m===null||m===60||Me(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||Ft(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):Me(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||Me(h)||a++>999?(r.exit("chunkString"),c(h)):(r.consume(h),l||(l=!He(h)),h===92?d:f)}function d(h){return h===91||h===92||h===93?(r.consume(h),a++,f):f(h)}}function Rm(r,e,t,n,i,o){let s;return a;function a(d){return d===34||d===39||d===40?(r.enter(n),r.enter(i),r.consume(d),r.exit(i),s=d===40?41:d,l):t(d)}function l(d){return d===s?(r.enter(i),r.consume(d),r.exit(i),r.exit(n),e):(r.enter(o),u(d))}function u(d){return d===s?(r.exit(o),l(s)):d===null?t(d):Me(d)?(r.enter("lineEnding"),r.consume(d),r.exit("lineEnding"),Je(r,u,"linePrefix")):(r.enter("chunkString",{contentType:"string"}),c(d))}function c(d){return d===s||d===null||Me(d)?(r.exit("chunkString"),u(d)):(r.consume(d),d===92?f:c)}function f(d){return d===s||d===92?(r.consume(d),c):c(d)}}function Si(r,e){let t;return n;function n(i){return Me(i)?(r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),t=!0,n):He(i)?Je(r,n,t?"linePrefix":"lineSuffix")(i):e(i)}}const ZE={name:"definition",tokenize:QE},JE={partial:!0,tokenize:eC};function QE(r,e,t){const n=this;let i;return o;function o(h){return r.enter("definition"),s(h)}function s(h){return Pm.call(n,r,a,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=Yr(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 Ft(h)?Si(r,u)(h):u(h)}function u(h){return km(r,c,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function c(h){return r.attempt(JE,f,f)(h)}function f(h){return He(h)?Je(r,d,"whitespace")(h):d(h)}function d(h){return h===null||Me(h)?(r.exit("definition"),n.parser.defined.push(i),e(h)):t(h)}}function eC(r,e,t){return n;function n(a){return Ft(a)?Si(r,i)(a):t(a)}function i(a){return Rm(r,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function o(a){return He(a)?Je(r,s,"whitespace")(a):s(a)}function s(a){return a===null||Me(a)?e(a):t(a)}}const tC={name:"hardBreakEscape",tokenize:nC};function nC(r,e,t){return n;function n(o){return r.enter("hardBreakEscape"),r.consume(o),i}function i(o){return Me(o)?(r.exit("hardBreakEscape"),e(o)):t(o)}}const rC={name:"headingAtx",resolve:iC,tokenize:oC};function iC(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"},mn(r,n,t-n+1,[["enter",i,e],["enter",o,e],["exit",o,e],["exit",i,e]])),r}function oC(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||Ft(c)?(r.exit("atxHeadingSequence"),a(c)):t(c)}function a(c){return c===35?(r.enter("atxHeadingSequence"),l(c)):c===null||Me(c)?(r.exit("atxHeading"),e(c)):He(c)?Je(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||Ft(c)?(r.exit("atxHeadingText"),a(c)):(r.consume(c),u)}}const sC=["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"],$h=["pre","script","style","textarea"],aC={concrete:!0,name:"htmlFlow",resolveTo:cC,tokenize:fC},lC={partial:!0,tokenize:dC},uC={partial:!0,tokenize:hC};function cC(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 fC(r,e,t){const n=this;let i,o,s,a,l;return u;function u(P){return c(P)}function c(P){return r.enter("htmlFlow"),r.enter("htmlFlowData"),r.consume(P),f}function f(P){return P===33?(r.consume(P),d):P===47?(r.consume(P),o=!0,v):P===63?(r.consume(P),i=3,n.interrupt?e:k):cn(P)?(r.consume(P),s=String.fromCharCode(P),p):t(P)}function d(P){return P===45?(r.consume(P),i=2,h):P===91?(r.consume(P),i=5,a=0,g):cn(P)?(r.consume(P),i=4,n.interrupt?e:k):t(P)}function h(P){return P===45?(r.consume(P),n.interrupt?e:k):t(P)}function g(P){const J="CDATA[";return P===J.charCodeAt(a++)?(r.consume(P),a===J.length?n.interrupt?e:C:g):t(P)}function v(P){return cn(P)?(r.consume(P),s=String.fromCharCode(P),p):t(P)}function p(P){if(P===null||P===47||P===62||Ft(P)){const J=P===47,Q=s.toLowerCase();return!J&&!o&&$h.includes(Q)?(i=1,n.interrupt?e(P):C(P)):sC.includes(s.toLowerCase())?(i=6,J?(r.consume(P),m):n.interrupt?e(P):C(P)):(i=7,n.interrupt&&!n.parser.lazy[n.now().line]?t(P):o?y(P):_(P))}return P===45||Gt(P)?(r.consume(P),s+=String.fromCharCode(P),p):t(P)}function m(P){return P===62?(r.consume(P),n.interrupt?e:C):t(P)}function y(P){return He(P)?(r.consume(P),y):I(P)}function _(P){return P===47?(r.consume(P),I):P===58||P===95||cn(P)?(r.consume(P),A):He(P)?(r.consume(P),_):I(P)}function A(P){return P===45||P===46||P===58||P===95||Gt(P)?(r.consume(P),A):b(P)}function b(P){return P===61?(r.consume(P),x):He(P)?(r.consume(P),b):_(P)}function x(P){return P===null||P===60||P===61||P===62||P===96?t(P):P===34||P===39?(r.consume(P),l=P,w):He(P)?(r.consume(P),x):M(P)}function w(P){return P===l?(r.consume(P),l=null,E):P===null||Me(P)?t(P):(r.consume(P),w)}function M(P){return P===null||P===34||P===39||P===47||P===60||P===61||P===62||P===96||Ft(P)?b(P):(r.consume(P),M)}function E(P){return P===47||P===62||He(P)?_(P):t(P)}function I(P){return P===62?(r.consume(P),O):t(P)}function O(P){return P===null||Me(P)?C(P):He(P)?(r.consume(P),O):t(P)}function C(P){return P===45&&i===2?(r.consume(P),F):P===60&&i===1?(r.consume(P),D):P===62&&i===4?(r.consume(P),N):P===63&&i===3?(r.consume(P),k):P===93&&i===5?(r.consume(P),$):Me(P)&&(i===6||i===7)?(r.exit("htmlFlowData"),r.check(lC,V,X)(P)):P===null||Me(P)?(r.exit("htmlFlowData"),X(P)):(r.consume(P),C)}function X(P){return r.check(uC,T,V)(P)}function T(P){return r.enter("lineEnding"),r.consume(P),r.exit("lineEnding"),G}function G(P){return P===null||Me(P)?X(P):(r.enter("htmlFlowData"),C(P))}function F(P){return P===45?(r.consume(P),k):C(P)}function D(P){return P===47?(r.consume(P),s="",L):C(P)}function L(P){if(P===62){const J=s.toLowerCase();return $h.includes(J)?(r.consume(P),N):C(P)}return cn(P)&&s.length<8?(r.consume(P),s+=String.fromCharCode(P),L):C(P)}function $(P){return P===93?(r.consume(P),k):C(P)}function k(P){return P===62?(r.consume(P),N):P===45&&i===2?(r.consume(P),k):C(P)}function N(P){return P===null||Me(P)?(r.exit("htmlFlowData"),V(P)):(r.consume(P),N)}function V(P){return r.exit("htmlFlow"),e(P)}}function hC(r,e,t){const n=this;return i;function i(s){return Me(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 dC(r,e,t){return n;function n(i){return r.enter("lineEnding"),r.consume(i),r.exit("lineEnding"),r.attempt(ss,e,t)}}const pC={name:"htmlText",tokenize:mC};function mC(r,e,t){const n=this;let i,o,s;return a;function a(k){return r.enter("htmlText"),r.enter("htmlTextData"),r.consume(k),l}function l(k){return k===33?(r.consume(k),u):k===47?(r.consume(k),b):k===63?(r.consume(k),_):cn(k)?(r.consume(k),M):t(k)}function u(k){return k===45?(r.consume(k),c):k===91?(r.consume(k),o=0,g):cn(k)?(r.consume(k),y):t(k)}function c(k){return k===45?(r.consume(k),h):t(k)}function f(k){return k===null?t(k):k===45?(r.consume(k),d):Me(k)?(s=f,D(k)):(r.consume(k),f)}function d(k){return k===45?(r.consume(k),h):f(k)}function h(k){return k===62?F(k):k===45?d(k):f(k)}function g(k){const N="CDATA[";return k===N.charCodeAt(o++)?(r.consume(k),o===N.length?v:g):t(k)}function v(k){return k===null?t(k):k===93?(r.consume(k),p):Me(k)?(s=v,D(k)):(r.consume(k),v)}function p(k){return k===93?(r.consume(k),m):v(k)}function m(k){return k===62?F(k):k===93?(r.consume(k),m):v(k)}function y(k){return k===null||k===62?F(k):Me(k)?(s=y,D(k)):(r.consume(k),y)}function _(k){return k===null?t(k):k===63?(r.consume(k),A):Me(k)?(s=_,D(k)):(r.consume(k),_)}function A(k){return k===62?F(k):_(k)}function b(k){return cn(k)?(r.consume(k),x):t(k)}function x(k){return k===45||Gt(k)?(r.consume(k),x):w(k)}function w(k){return Me(k)?(s=w,D(k)):He(k)?(r.consume(k),w):F(k)}function M(k){return k===45||Gt(k)?(r.consume(k),M):k===47||k===62||Ft(k)?E(k):t(k)}function E(k){return k===47?(r.consume(k),F):k===58||k===95||cn(k)?(r.consume(k),I):Me(k)?(s=E,D(k)):He(k)?(r.consume(k),E):F(k)}function I(k){return k===45||k===46||k===58||k===95||Gt(k)?(r.consume(k),I):O(k)}function O(k){return k===61?(r.consume(k),C):Me(k)?(s=O,D(k)):He(k)?(r.consume(k),O):E(k)}function C(k){return k===null||k===60||k===61||k===62||k===96?t(k):k===34||k===39?(r.consume(k),i=k,X):Me(k)?(s=C,D(k)):He(k)?(r.consume(k),C):(r.consume(k),T)}function X(k){return k===i?(r.consume(k),i=void 0,G):k===null?t(k):Me(k)?(s=X,D(k)):(r.consume(k),X)}function T(k){return k===null||k===34||k===39||k===60||k===61||k===96?t(k):k===47||k===62||Ft(k)?E(k):(r.consume(k),T)}function G(k){return k===47||k===62||Ft(k)?E(k):t(k)}function F(k){return k===62?(r.consume(k),r.exit("htmlTextData"),r.exit("htmlText"),e):t(k)}function D(k){return r.exit("htmlTextData"),r.enter("lineEnding"),r.consume(k),r.exit("lineEnding"),L}function L(k){return He(k)?Je(r,$,"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(k):$(k)}function $(k){return r.enter("htmlTextData"),s(k)}}const qu={name:"labelEnd",resolveAll:_C,resolveTo:xC,tokenize:bC},gC={tokenize:wC},vC={tokenize:TC},yC={tokenize:SC};function _C(r){let e=-1;const t=[];for(;++e=3&&(u===null||Me(u))?(r.exit("thematicBreak"),e(u)):t(u)}function l(u){return u===i?(r.consume(u),n++,l):(r.exit("thematicBreakSequence"),He(u)?Je(r,a,"whitespace")(u):a(u))}}const Rt={continuation:{tokenize:FC},exit:NC,name:"list",tokenize:OC},PC={partial:!0,tokenize:DC},RC={partial:!0,tokenize:LC};function OC(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:eu(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(Ao,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 eu(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(ss,n.interrupt?t:c,r.attempt(PC,d,f))}function c(h){return n.containerState.initialBlankLine=!0,o++,d(h)}function f(h){return He(h)?(r.enter("listItemPrefixWhitespace"),r.consume(h),r.exit("listItemPrefixWhitespace"),d):t(h)}function d(h){return n.containerState.size=o+n.sliceSerialize(r.exit("listItemPrefix"),!0).length,e(h)}}function FC(r,e,t){const n=this;return n.containerState._closeFlow=void 0,r.check(ss,i,o);function i(a){return n.containerState.furtherBlankLines=n.containerState.furtherBlankLines||n.containerState.initialBlankLine,Je(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(RC,e,s)(a))}function s(a){return n.containerState._closeFlow=!0,n.interrupt=void 0,Je(r,r.attempt(Rt,e,t),"linePrefix",n.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function LC(r,e,t){const n=this;return Je(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 NC(r){r.exit(this.containerState.type)}function DC(r,e,t){const n=this;return Je(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 Hh={name:"setextUnderline",resolveTo:BC,tokenize:UC};function BC(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 UC(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)?Je(r,l,"lineSuffix")(u):l(u))}function l(u){return u===null||Me(u)?(r.exit("setextHeadingLine"),e(u)):t(u)}}const zC={tokenize:jC};function jC(r){const e=this,t=r.attempt(ss,n,r.attempt(this.parser.constructs.flowInitial,i,Je(r,r.attempt(this.parser.constructs.flow,i,r.attempt(XE,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 VC={resolveAll:Fm()},GC=Om("string"),$C=Om("text");function Om(r){return{resolveAll:Fm(r==="text"?HC: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 d=-1;if(f)for(;++d-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 iA(r,e){let t=-1;const n=[];let i;for(;++t0){const Xe=ge.tokenStack[ge.tokenStack.length-1];(Xe[1]||Yh).call(ge,void 0,Xe[0])}for(fe.position={start:Rn(ne.length>0?ne[0][1].start:{line:1,column:1,offset:0}),end:Rn(ne.length>0?ne[ne.length-2][1].end:{line:1,column:1,offset:0})},ke=-1;++ke1?"-"+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 bA(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 wA(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 TA(r,e){const t=String(e.identifier).toUpperCase(),n=r.definitionById.get(t);if(!n)return Dm(r,e);const i={src:ii(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 SA(r,e){const t={src:ii(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 EA(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 CA(r,e){const t=String(e.identifier).toUpperCase(),n=r.definitionById.get(t);if(!n)return Dm(r,e);const i={href:ii(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 AA(r,e){const t={href:ii(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 IA(r,e,t){const n=r.all(e),i=t?MA(t):Bm(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 kA(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 FA(r){const e=zm(r),t=Um(r);if(e&&t)return{start:e,end:t}}function LA(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=zm(e.children[1]),l=Um(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 NA(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(Jh(e.slice(i),i>0,!1)),o.join("")}function Jh(r,e,t){let n=0,i=r.length;if(e){let o=r.codePointAt(n);for(;o===Kh||o===Zh;)n++,o=r.codePointAt(n)}if(t){let o=r.codePointAt(i-1);for(;o===Kh||o===Zh;)i--,o=r.codePointAt(i-1)}return i>n?r.slice(n,i):""}function UA(r,e){const t={type:"text",value:BA(String(e.value))};return r.patch(e,t),r.applyData(e,t)}function zA(r,e){const t={type:"element",tagName:"hr",properties:{},children:[]};return r.patch(e,t),r.applyData(e,t)}const jA={blockquote:mA,break:gA,code:vA,delete:yA,emphasis:_A,footnoteReference:xA,heading:bA,html:wA,imageReference:TA,image:SA,inlineCode:EA,linkReference:CA,link:AA,listItem:IA,list:kA,paragraph:PA,root:RA,strong:OA,table:LA,tableCell:DA,tableRow:NA,text:UA,thematicBreak:zA,toml:uo,yaml:uo,definition:uo,footnoteDefinition:uo};function uo(){}const Vm=-1,as=0,Ho=1,Xo=2,Yu=3,Ku=4,Zu=5,Ju=6,Gm=7,$m=8,Qh=typeof self=="object"?self:globalThis,VA=(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 as:case Vm:return t(s,i);case Ho:{const a=t([],i);for(const l of s)a.push(n(l));return a}case Xo:{const a=t({},i);for(const[l,u]of s)a[n(l)]=n(u);return a}case Yu:return t(new Date(s),i);case Ku:{const{source:a,flags:l}=s;return t(new RegExp(a,l),i)}case Zu:{const a=t(new Map,i);for(const[l,u]of s)a.set(n(l),n(u));return a}case Ju:{const a=t(new Set,i);for(const l of s)a.add(n(l));return a}case Gm:{const{name:a,message:l}=s;return t(new Qh[a](l),i)}case $m:return t(BigInt(s),i);case"BigInt":return t(Object(BigInt(s)),i)}return t(new Qh[o](s),i)};return n},ed=r=>VA(new Map,r)(0),Fr="",{toString:GA}={},{keys:$A}=Object,di=r=>{const e=typeof r;if(e!=="object"||!r)return[as,e];const t=GA.call(r).slice(8,-1);switch(t){case"Array":return[Ho,Fr];case"Object":return[Xo,Fr];case"Date":return[Yu,Fr];case"RegExp":return[Ku,Fr];case"Map":return[Zu,Fr];case"Set":return[Ju,Fr]}return t.includes("Array")?[Ho,t]:t.includes("Error")?[Gm,t]:[Xo,t]},co=([r,e])=>r===as&&(e==="function"||e==="symbol"),HA=(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]=di(s);switch(a){case as:{let c=s;switch(l){case"bigint":a=$m,c=s.toString();break;case"function":case"symbol":if(r)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([Vm],s)}return i([a,c],s)}case Ho:{if(l)return i([l,[...s]],s);const c=[],f=i([a,c],s);for(const d of s)c.push(o(d));return f}case Xo:{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 d of $A(s))(r||!co(di(s[d])))&&c.push([o(d),o(s[d])]);return f}case Yu:return i([a,s.toISOString()],s);case Ku:{const{source:c,flags:f}=s;return i([a,{source:c,flags:f}],s)}case Zu:{const c=[],f=i([a,c],s);for(const[d,h]of s)(r||!(co(di(d))||co(di(h))))&&c.push([o(d),o(h)]);return f}case Ju:{const c=[],f=i([a,c],s);for(const d of s)(r||!co(di(d)))&&c.push(o(d));return f}}const{message:u}=s;return i([a,{name:l,message:u}],s)};return o},td=(r,{json:e,lossy:t}={})=>{const n=[];return HA(!(e||t),!!e,new Map,n)(r),n},Wo=typeof structuredClone=="function"?(r,e)=>e&&("json"in e||"lossy"in e)?ed(td(r,e)):structuredClone(r):(r,e)=>ed(td(r,e));function XA(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 WA(r,e){return"Back to reference "+(r+1)+(e>1?"-"+e:"")}function qA(r){const e=typeof r.options.clobberPrefix=="string"?r.options.clobberPrefix:"user-content-",t=r.options.footnoteBackContent||XA,n=r.options.footnoteBackLabel||WA,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-"+d+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof n=="string"?n:n(l,h),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}const p=c[c.length-1];if(p&&p.type==="element"&&p.tagName==="p"){const y=p.children[p.children.length-1];y&&y.type==="text"?y.value+=" ":p.children.push({type:"text",value:" "}),p.children.push(...g)}else c.push(...g);const m={type:"element",tagName:"li",properties:{id:e+"fn-"+d},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:{...Wo(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 Hm=function(r){if(r==null)return JA;if(typeof r=="function")return ls(r);if(typeof r=="object")return Array.isArray(r)?YA(r):KA(r);if(typeof r=="string")return ZA(r);throw new Error("Expected function, string, or object as test")};function YA(r){const e=[];let t=-1;for(;++t":""))+")"})}return d;function d(){let h=Xm,g,v,p;if((!e||o(l,u,c[c.length-1]||void 0))&&(h=rI(t(l,c)),h[0]===nd))return h;if("children"in l&&l.children){const m=l;if(m.children&&h[0]!==tI)for(v=(n?m.children.length:-1)+s,p=c.concat(m);v>-1&&v0&&t.push({type:"text",value:` +`}),t}function rd(r){let e=0,t=r.charCodeAt(e);for(;t===9||t===32;)e++,t=r.charCodeAt(e);return r.slice(e)}function id(r,e){const t=sI(r,e),n=t.one(r,void 0),i=qA(t),o=Array.isArray(n)?{type:"root",children:n}:n||{type:"root",children:[]};return i&&o.children.push({type:"text",value:` +`},i),o}function fI(r,e){return r&&"run"in r?async function(t,n){const i=id(t,{file:n,...e});await r.run(i,n)}:function(t,n){return id(t,{file:n,...r||e})}}function od(r){if(r)throw r}var Na,sd;function hI(){if(sd)return Na;sd=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 d;for(d in u);return typeof d>"u"||r.call(u,d)},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 Na=function l(){var u,c,f,d,h,g,v=arguments[0],p=1,m=arguments.length,y=!1;for(typeof v=="boolean"&&(y=v,v=arguments[1]||{},p=2),(v==null||typeof v!="object"&&typeof v!="function")&&(v={});ps.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 Lt 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=Ei(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}}Lt.prototype.file="";Lt.prototype.name="";Lt.prototype.reason="";Lt.prototype.message="";Lt.prototype.stack="";Lt.prototype.column=void 0;Lt.prototype.line=void 0;Lt.prototype.ancestors=void 0;Lt.prototype.cause=void 0;Lt.prototype.fatal=void 0;Lt.prototype.place=void 0;Lt.prototype.ruleId=void 0;Lt.prototype.source=void 0;const ln={basename:gI,dirname:vI,extname:yI,join:_I,sep:"/"};function gI(r,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ji(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 vI(r){if(ji(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 yI(r){ji(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 _I(...r){let e=-1,t;for(;++e0&&r.codePointAt(r.length-1)===47&&(t+="/"),e?"/"+t:t}function bI(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 ji(r){if(typeof r!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(r))}const wI={cwd:TI};function TI(){return"/"}function ou(r){return!!(r!==null&&typeof r=="object"&&"href"in r&&r.href&&"protocol"in r&&r.protocol&&r.auth===void 0)}function SI(r){if(typeof r=="string")r=new URL(r);else if(!ou(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 EI(r)}function EI(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[d][1];iu(v)&&iu(h)&&(h=Da(!0,v,h)),n[d]=[u,h,...g]}}}}const kI=new Qu().freeze();function ja(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `parser`")}function Va(r,e){if(typeof e!="function")throw new TypeError("Cannot `"+r+"` without `compiler`")}function Ga(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 ld(r){if(!iu(r)||typeof r.type!="string")throw new TypeError("Expected node, got `"+r+"`")}function ud(r,e,t){if(!t)throw new Error("`"+r+"` finished async. Use `"+e+"` instead")}function fo(r){return PI(r)?r:new CI(r)}function PI(r){return!!(r&&typeof r=="object"&&"message"in r&&"messages"in r)}function RI(r){return typeof r=="string"||OI(r)}function OI(r){return!!(r&&typeof r=="object"&&"byteLength"in r&&"byteOffset"in r)}function ec(){const r=kI().use(pA).use(fI).use(lE);return{process:e=>r.processSync(e).toString()}}function FI(r,e){return{role:"system",content:[r,Av.map(t=>`- ${t}`).join(` +`),e].join(` + +`)}}function LI(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 NI(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 DI(r,e="linear"){switch(e){case"linear":return LI(r);case"minmax":return NI(r)}}const Wm=Jo("AudioContext",()=>({audioContext:new AudioContext,calculateVolume:DI})),BI=Jo("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 ho(r,e,t){return e+t<0||e+t>=r.length-1?"":r[e+t]}function UI(r){let e="literal",t="";return{async consume(n){var i,o,s;for(let a=0;a"?(l+=ho(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 zI=async r=>(r.fetch??globalThis.fetch)(ju("models",r.baseURL),{headers:zu({"Content-Type":"application/json",...r.headers},r.apiKey),signal:r.abortSignal}).then(V2).then(({data:e})=>e),jI=async r=>{var e;return(r.fetch??globalThis.fetch)(ju("chat/completions",r.baseURL),{body:lm({...r,tools:(e=r.tools)==null?void 0:e.map(t=>({function:t.function,type:"function"}))}),headers:zu({"Content-Type":"application/json",...r.headers},r.apiKey),method:"POST",signal:r.abortSignal}).then(Vu)},cd="data:",VI=async r=>jI({...r,stream:!0}).then(async e=>{const t=new TextDecoder;let n,i;const o=async(f,d)=>{if(!f||!f.startsWith(cd))return;const h=f.slice(cd.length),g=h.startsWith(" ")?h.slice(1):h;if(g==="[DONE]")return d.terminate(),!0;if(g.startsWith("{")&&g.includes('"error":'))return d.error(new Error(`Error from server: ${g}`)),!0;const v=JSON.parse(g);d.enqueue(v),r.onChunk&&await r.onChunk(v),v.choices[0].finish_reason!==void 0&&(n=v.choices[0].finish_reason),v.usage!==void 0&&(i=v.usage)};let s="";const a=e.body.pipeThrough(new TransformStream({transform:async(f,d)=>{const h=t.decode(f,{stream:!0});s+=h;const g=s.split(` +`);s=g.pop()??"";for(const v of g)if(await o(v,d))break}})),[l,u]=a.tee(),c=u.pipeThrough(new TransformStream({transform:(f,d)=>d.enqueue(f.choices[0].delta.content)}));return{chunkStream:l,finishReason:n,textStream:c,usage:i}}),tc=Jo("llm",()=>{async function r(t,n,i,o){return await VI({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 zI({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*GI(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 _r=Jo("chat",()=>{const{stream:r}=tc(),{t:e}=Qr(),{openAiApiBaseURL:t,openAiApiKey:n,openAiModel:i}=En(ei()),o=le([]),s=le([]),a=le([]),l=le([]),u=le([]),c=le([]),f=le([]);function d(x){o.value.push(x)}function h(x){s.value.push(x)}function g(x){a.value.push(x)}function v(x){l.value.push(x)}function p(x){u.value.push(x)}function m(x){c.value.push(x)}function y(x){f.value.push(x)}const _=le([FI(e("prompt.prefix"),e("prompt.suffix"))]),A=le({role:"assistant",content:""});async function b(x,w){if(!x)return;for(const G of o.value)await G(x);const{baseUrl:M=t.value,apiKey:E=n.value,model:I=i.value}=w??{};A.value={role:"assistant",content:""},_.value.push({role:"user",content:x}),_.value.push(A.value);const O=_.value.slice(0,_.value.length-1);for(const G of s.value)await G(x);for(const G of a.value)await G(x);const C=await r(M,E,I.id,O);for(const G of l.value)await G(x);let X="";const T=UI({onLiteral:async G=>{for(const F of u.value)await F(G);A.value.content+=G},onSpecial:async G=>{for(const F of c.value)await F(G)}});for await(const G of GI(C.textStream,async F=>F))X+=G,await T.consume(G);await T.end();for(const G of f.value)await G();console.debug("LLM output:",X)}return{messages:_,streamingMessage:A,send:b,onBeforeMessageComposed:d,onAfterMessageComposed:h,onBeforeSend:g,onAfterSend:v,onTokenLiteral:p,onTokenSpecial:m,onStreamEnd:y}});function po(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 $a={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 fd;function $I(){return fd||(fd=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 po=="function"&&po;if(!c&&f)return f(u,!0);if(a)return a(u,!0);var d=new Error("Cannot find module '"+u+"'");throw d.code="MODULE_NOT_FOUND",d}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 po=="function"&&po,l=0;l>2,h=(3&u)<<4|c>>4,g=1<_?(15&c)<<2|f>>6:64,v=2<_?63&f:64,p.push(a.charAt(d)+a.charAt(h)+a.charAt(g)+a.charAt(v));return p.join("")},i.decode=function(l){var u,c,f,d,h,g,v=0,p=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&d)<<4|(h=a.indexOf(l.charAt(v++)))>>2,f=(3&h)<<6|(g=a.indexOf(l.charAt(v++))),y[p++]=u,h!==64&&(y[p++]=c),g!==64&&(y[p++]=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,d,h,g){this.compressedSize=c,this.uncompressedSize=f,this.crc32=d,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,d){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(f.compressWorker(d)).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,d){var h=s,g=d+f;u^=-1;for(var v=d;v>>8^h[255&(u^c[v])];return-1^u}(0|l,a,a.length,0):function(u,c,f,d){var h=s,g=d+f;u^=-1;for(var v=d;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,d){l.call(this,"FlateWorker/"+f),this._pako=null,this._pakoAction=f,this._pakoOptions=d,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(d){f.push({data:d,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,p="";for(v=0;v>>=8;return p}function s(h,g,v,p,m,y){var _,A,b=h.file,x=h.compression,w=y!==u.utf8encode,M=a.transformTo("string",y(b.name)),E=a.transformTo("string",u.utf8encode(b.name)),I=b.comment,O=a.transformTo("string",y(I)),C=a.transformTo("string",u.utf8encode(I)),X=E.length!==b.name.length,T=C.length!==I.length,G="",F="",D="",L=b.dir,$=b.date,k={crc32:0,compressedSize:0,uncompressedSize:0};g&&!v||(k.crc32=h.crc32,k.compressedSize=h.compressedSize,k.uncompressedSize=h.uncompressedSize);var N=0;g&&(N|=8),w||!X&&!T||(N|=2048);var V=0,P=0;L&&(V|=16),m==="UNIX"?(P=798,V|=function(Q,ce){var pe=Q;return Q||(pe=ce?16893:33204),(65535&pe)<<16}(b.unixPermissions,L)):(P=20,V|=function(Q){return 63&(Q||0)}(b.dosPermissions)),_=$.getUTCHours(),_<<=6,_|=$.getUTCMinutes(),_<<=5,_|=$.getUTCSeconds()/2,A=$.getUTCFullYear()-1980,A<<=4,A|=$.getUTCMonth()+1,A<<=5,A|=$.getUTCDate(),X&&(F=o(1,1)+o(c(M),4)+E,G+="up"+o(F.length,2)+F),T&&(D=o(1,1)+o(c(O),4)+C,G+="uc"+o(D.length,2)+D);var J="";return J+=` +\0`,J+=o(N,2),J+=x.magic,J+=o(_,2),J+=o(A,2),J+=o(k.crc32,4),J+=o(k.compressedSize,4),J+=o(k.uncompressedSize,4),J+=o(M.length,2),J+=o(G.length,2),{fileRecord:f.LOCAL_FILE_HEADER+J+M+G,dirRecord:f.CENTRAL_FILE_HEADER+o(P,2)+J+o(O.length,2)+"\0\0\0\0"+o(V,4)+o(p,4)+M+G+O}}var a=t("../utils"),l=t("../stream/GenericWorker"),u=t("../utf8"),c=t("../crc32"),f=t("../signature");function d(h,g,v,p){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=g,this.zipPlatform=v,this.encodeFileName=p,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(d,l),d.prototype.push=function(h){var g=h.meta.percent||0,v=this.entriesCount,p=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-p-1))/v:100}}))},d.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},d.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(p){return f.DATA_DESCRIPTOR+o(p.crc32,4)+o(p.compressedSize,4)+o(p.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},d.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 d=o.getTypeOf(f);return o.checkSupport(d),d!=="string"||s.uint8array?d==="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 d(g,v){return new c.Promise(function(p,m){var y=[],_=g._internalType,A=g._outputType,b=g._mimeType;g.on("data",function(x,w){y.push(x),v&&v(w)}).on("error",function(x){y=[],m(x)}).on("end",function(){try{var x=function(w,M,E){switch(w){case"blob":return o.newBlob(o.transformTo("arraybuffer",M),E);case"base64":return l.encode(M);default:return o.transformTo(w,M)}}(A,function(w,M){var E,I=0,O=null,C=0;for(E=0;E"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 d(){l.call(this,"utf-8 encode")}i.utf8encode=function(h){return s.nodebuffer?a.newBufferFrom(h,"utf-8"):function(g){var v,p,m,y,_,A=g.length,b=0;for(y=0;y>>6:(p<65536?v[_++]=224|p>>>12:(v[_++]=240|p>>>18,v[_++]=128|p>>>12&63),v[_++]=128|p>>>6&63),v[_++]=128|63&p);return v}(h)},i.utf8decode=function(h){return s.nodebuffer?o.transformTo("nodebuffer",h).toString("utf-8"):function(g){var v,p,m,y,_=g.length,A=new Array(2*_);for(v=p=0;v<_;)if((m=g[v++])<128)A[p++]=m;else if(4<(y=u[m]))A[p++]=65533,v+=y-1;else{for(m&=y===2?31:y===3?15:7;1>10&1023,A[p++]=56320|1023&m)}return A.length!==p&&(A.subarray?A=A.subarray(0,p):A.length=p),o.applyFromCharCode(A)}(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 p=function(y,_){var A;for((_=_||y.length)>y.length&&(_=y.length),A=_-1;0<=A&&(192&y[A])==128;)A--;return A<0||A===0?_:A+u[y[A]]>_?A:_}(g),m=g;p!==g.length&&(s.uint8array?(m=g.subarray(0,p),this.leftOver=g.subarray(p,g.length)):(m=g.slice(0,p),this.leftOver=g.slice(p,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(d,l),d.prototype.processChunk=function(h){this.push({data:i.utf8encode(h.data),meta:h.meta})},i.Utf8EncodeWorker=d},{"./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,p){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,p,m=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?d[p++]=224|h>>>12:(d[p++]=240|h>>>18,d[p++]=128|h>>>12&63),d[p++]=128|h>>>6&63),d[p++]=128|63&h);return d},i.buf2binstring=function(f){return c(f,f.length)},i.binstring2buf=function(f){for(var d=new o.Buf8(f.length),h=0,g=d.length;h>10&1023,y[g++]=56320|1023&v)}return c(y,g)},i.utf8border=function(f,d){var h;for((d=d||f.length)>f.length&&(d=f.length),h=d-1;0<=h&&(192&f[h])==128;)h--;return h<0||h===0?d:h+l[f[h]]>d?h:d}},{"./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 d=u;d>>8^c[255&(s^a[d])];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,d=4,h=0,g=-2,v=-1,p=4,m=2,y=8,_=9,A=286,b=30,x=19,w=2*A+1,M=15,E=3,I=258,O=I+E+1,C=42,X=113,T=1,G=2,F=3,D=4;function L(S,Z){return S.msg=c[Z],Z}function $(S){return(S<<1)-(4S.avail_out&&(H=S.avail_out),H!==0&&(s.arraySet(S.output,Z.pending_buf,Z.pending_out,H,S.next_out),S.next_out+=H,Z.pending_out+=H,S.total_out+=H,S.avail_out-=H,Z.pending-=H,Z.pending===0&&(Z.pending_out=0))}function V(S,Z){a._tr_flush_block(S,0<=S.block_start?S.block_start:-1,S.strstart-S.block_start,Z),S.block_start=S.strstart,N(S.strm)}function P(S,Z){S.pending_buf[S.pending++]=Z}function J(S,Z){S.pending_buf[S.pending++]=Z>>>8&255,S.pending_buf[S.pending++]=255&Z}function Q(S,Z){var H,j,z=S.max_chain_length,q=S.strstart,se=S.prev_length,ae=S.nice_match,ee=S.strstart>S.w_size-O?S.strstart-(S.w_size-O):0,he=S.window,ye=S.w_mask,me=S.prev,ne=S.strstart+I,fe=he[q+se-1],ge=he[q+se];S.prev_length>=S.good_match&&(z>>=2),ae>S.lookahead&&(ae=S.lookahead);do if(he[(H=Z)+se]===ge&&he[H+se-1]===fe&&he[H]===he[q]&&he[++H]===he[q+1]){q+=2,H++;do;while(he[++q]===he[++H]&&he[++q]===he[++H]&&he[++q]===he[++H]&&he[++q]===he[++H]&&he[++q]===he[++H]&&he[++q]===he[++H]&&he[++q]===he[++H]&&he[++q]===he[++H]&&qee&&--z!=0);return se<=S.lookahead?se:S.lookahead}function ce(S){var Z,H,j,z,q,se,ae,ee,he,ye,me=S.w_size;do{if(z=S.window_size-S.lookahead-S.strstart,S.strstart>=me+(me-O)){for(s.arraySet(S.window,S.window,me,me,0),S.match_start-=me,S.strstart-=me,S.block_start-=me,Z=H=S.hash_size;j=S.head[--Z],S.head[Z]=me<=j?j-me:0,--H;);for(Z=H=me;j=S.prev[--Z],S.prev[Z]=me<=j?j-me:0,--H;);z+=me}if(S.strm.avail_in===0)break;if(se=S.strm,ae=S.window,ee=S.strstart+S.lookahead,he=z,ye=void 0,ye=se.avail_in,he=E)for(q=S.strstart-S.insert,S.ins_h=S.window[q],S.ins_h=(S.ins_h<=E&&(S.ins_h=(S.ins_h<=E)if(j=a._tr_tally(S,S.strstart-S.match_start,S.match_length-E),S.lookahead-=S.match_length,S.match_length<=S.max_lazy_match&&S.lookahead>=E){for(S.match_length--;S.strstart++,S.ins_h=(S.ins_h<=E&&(S.ins_h=(S.ins_h<=E&&S.match_length<=S.prev_length){for(z=S.strstart+S.lookahead-E,j=a._tr_tally(S,S.strstart-1-S.prev_match,S.prev_length-E),S.lookahead-=S.prev_length-1,S.prev_length-=2;++S.strstart<=z&&(S.ins_h=(S.ins_h<S.pending_buf_size-5&&(H=S.pending_buf_size-5);;){if(S.lookahead<=1){if(ce(S),S.lookahead===0&&Z===f)return T;if(S.lookahead===0)break}S.strstart+=S.lookahead,S.lookahead=0;var j=S.block_start+H;if((S.strstart===0||S.strstart>=j)&&(S.lookahead=S.strstart-j,S.strstart=j,V(S,!1),S.strm.avail_out===0)||S.strstart-S.block_start>=S.w_size-O&&(V(S,!1),S.strm.avail_out===0))return T}return S.insert=0,Z===d?(V(S,!0),S.strm.avail_out===0?F:D):(S.strstart>S.block_start&&(V(S,!1),S.strm.avail_out),T)}),new R(4,4,8,4,pe),new R(4,5,16,8,pe),new R(4,6,32,32,pe),new R(4,4,16,16,te),new R(8,16,32,32,te),new R(8,16,128,128,te),new R(8,32,128,256,te),new R(32,128,258,1024,te),new R(32,258,258,4096,te)],i.deflateInit=function(S,Z){return ie(S,Z,y,15,8,0)},i.deflateInit2=ie,i.deflateReset=oe,i.deflateResetKeep=W,i.deflateSetHeader=function(S,Z){return S&&S.state?S.state.wrap!==2?g:(S.state.gzhead=Z,h):g},i.deflate=function(S,Z){var H,j,z,q;if(!S||!S.state||5>8&255),P(j,j.gzhead.time>>16&255),P(j,j.gzhead.time>>24&255),P(j,j.level===9?2:2<=j.strategy||j.level<2?4:0),P(j,255&j.gzhead.os),j.gzhead.extra&&j.gzhead.extra.length&&(P(j,255&j.gzhead.extra.length),P(j,j.gzhead.extra.length>>8&255)),j.gzhead.hcrc&&(S.adler=u(S.adler,j.pending_buf,j.pending,0)),j.gzindex=0,j.status=69):(P(j,0),P(j,0),P(j,0),P(j,0),P(j,0),P(j,j.level===9?2:2<=j.strategy||j.level<2?4:0),P(j,3),j.status=X);else{var se=y+(j.w_bits-8<<4)<<8;se|=(2<=j.strategy||j.level<2?0:j.level<6?1:j.level===6?2:3)<<6,j.strstart!==0&&(se|=32),se+=31-se%31,j.status=X,J(j,se),j.strstart!==0&&(J(j,S.adler>>>16),J(j,65535&S.adler)),S.adler=1}if(j.status===69)if(j.gzhead.extra){for(z=j.pending;j.gzindex<(65535&j.gzhead.extra.length)&&(j.pending!==j.pending_buf_size||(j.gzhead.hcrc&&j.pending>z&&(S.adler=u(S.adler,j.pending_buf,j.pending-z,z)),N(S),z=j.pending,j.pending!==j.pending_buf_size));)P(j,255&j.gzhead.extra[j.gzindex]),j.gzindex++;j.gzhead.hcrc&&j.pending>z&&(S.adler=u(S.adler,j.pending_buf,j.pending-z,z)),j.gzindex===j.gzhead.extra.length&&(j.gzindex=0,j.status=73)}else j.status=73;if(j.status===73)if(j.gzhead.name){z=j.pending;do{if(j.pending===j.pending_buf_size&&(j.gzhead.hcrc&&j.pending>z&&(S.adler=u(S.adler,j.pending_buf,j.pending-z,z)),N(S),z=j.pending,j.pending===j.pending_buf_size)){q=1;break}q=j.gzindexz&&(S.adler=u(S.adler,j.pending_buf,j.pending-z,z)),q===0&&(j.gzindex=0,j.status=91)}else j.status=91;if(j.status===91)if(j.gzhead.comment){z=j.pending;do{if(j.pending===j.pending_buf_size&&(j.gzhead.hcrc&&j.pending>z&&(S.adler=u(S.adler,j.pending_buf,j.pending-z,z)),N(S),z=j.pending,j.pending===j.pending_buf_size)){q=1;break}q=j.gzindexz&&(S.adler=u(S.adler,j.pending_buf,j.pending-z,z)),q===0&&(j.status=103)}else j.status=103;if(j.status===103&&(j.gzhead.hcrc?(j.pending+2>j.pending_buf_size&&N(S),j.pending+2<=j.pending_buf_size&&(P(j,255&S.adler),P(j,S.adler>>8&255),S.adler=0,j.status=X)):j.status=X),j.pending!==0){if(N(S),S.avail_out===0)return j.last_flush=-1,h}else if(S.avail_in===0&&$(Z)<=$(H)&&Z!==d)return L(S,-5);if(j.status===666&&S.avail_in!==0)return L(S,-5);if(S.avail_in!==0||j.lookahead!==0||Z!==f&&j.status!==666){var ae=j.strategy===2?function(ee,he){for(var ye;;){if(ee.lookahead===0&&(ce(ee),ee.lookahead===0)){if(he===f)return T;break}if(ee.match_length=0,ye=a._tr_tally(ee,0,ee.window[ee.strstart]),ee.lookahead--,ee.strstart++,ye&&(V(ee,!1),ee.strm.avail_out===0))return T}return ee.insert=0,he===d?(V(ee,!0),ee.strm.avail_out===0?F:D):ee.last_lit&&(V(ee,!1),ee.strm.avail_out===0)?T:G}(j,Z):j.strategy===3?function(ee,he){for(var ye,me,ne,fe,ge=ee.window;;){if(ee.lookahead<=I){if(ce(ee),ee.lookahead<=I&&he===f)return T;if(ee.lookahead===0)break}if(ee.match_length=0,ee.lookahead>=E&&0ee.lookahead&&(ee.match_length=ee.lookahead)}if(ee.match_length>=E?(ye=a._tr_tally(ee,1,ee.match_length-E),ee.lookahead-=ee.match_length,ee.strstart+=ee.match_length,ee.match_length=0):(ye=a._tr_tally(ee,0,ee.window[ee.strstart]),ee.lookahead--,ee.strstart++),ye&&(V(ee,!1),ee.strm.avail_out===0))return T}return ee.insert=0,he===d?(V(ee,!0),ee.strm.avail_out===0?F:D):ee.last_lit&&(V(ee,!1),ee.strm.avail_out===0)?T:G}(j,Z):o[j.level].func(j,Z);if(ae!==F&&ae!==D||(j.status=666),ae===T||ae===F)return S.avail_out===0&&(j.last_flush=-1),h;if(ae===G&&(Z===1?a._tr_align(j):Z!==5&&(a._tr_stored_block(j,0,0,!1),Z===3&&(k(j.head),j.lookahead===0&&(j.strstart=0,j.block_start=0,j.insert=0))),N(S),S.avail_out===0))return j.last_flush=-1,h}return Z!==d?h:j.wrap<=0?1:(j.wrap===2?(P(j,255&S.adler),P(j,S.adler>>8&255),P(j,S.adler>>16&255),P(j,S.adler>>24&255),P(j,255&S.total_in),P(j,S.total_in>>8&255),P(j,S.total_in>>16&255),P(j,S.total_in>>24&255)):(J(j,S.adler>>>16),J(j,65535&S.adler)),N(S),0=H.w_size&&(q===0&&(k(H.head),H.strstart=0,H.block_start=0,H.insert=0),he=new s.Buf8(H.w_size),s.arraySet(he,Z,ye-H.w_size,H.w_size,0),Z=he,ye=H.w_size),se=S.avail_in,ae=S.next_in,ee=S.input,S.avail_in=ye,S.next_in=0,S.input=Z,ce(H);H.lookahead>=E;){for(j=H.strstart,z=H.lookahead-(E-1);H.ins_h=(H.ins_h<>>=E=M>>>24,_-=E,(E=M>>>16&255)===0)G[c++]=65535&M;else{if(!(16&E)){if(!(64&E)){M=A[(65535&M)+(y&(1<>>=E,_-=E),_<15&&(y+=T[l++]<<_,_+=8,y+=T[l++]<<_,_+=8),M=b[y&w];n:for(;;){if(y>>>=E=M>>>24,_-=E,!(16&(E=M>>>16&255))){if(!(64&E)){M=b[(65535&M)+(y&(1<>>=E,_-=E,(E=c-f)>3,y&=(1<<(_-=I<<3))-1,o.next_in=l,o.next_out=c,o.avail_in=l>>24&255)+(C>>>8&65280)+((65280&C)<<8)+((255&C)<<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 _(C){var X;return C&&C.state?(X=C.state,C.total_in=C.total_out=X.total=0,C.msg="",X.wrap&&(C.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(p),X.sane=1,X.back=-1,d):h}function A(C){var X;return C&&C.state?((X=C.state).wsize=0,X.whave=0,X.wnext=0,_(C)):h}function b(C,X){var T,G;return C&&C.state?(G=C.state,X<0?(T=0,X=-X):(T=1+(X>>4),X<48&&(X&=15)),X&&(X<8||15=D.wsize?(o.arraySet(D.window,X,T-D.wsize,D.wsize,0),D.wnext=0,D.whave=D.wsize):(G<(F=D.wsize-D.wnext)&&(F=G),o.arraySet(D.window,X,T-G,F,D.wnext),(G-=F)?(o.arraySet(D.window,X,T-G,G,0),D.wnext=G,D.whave=D.wsize):(D.wnext+=F,D.wnext===D.wsize&&(D.wnext=0),D.whave>>8&255,T.check=a(T.check,q,2,0),V=N=0,T.mode=2;break}if(T.flags=0,T.head&&(T.head.done=!1),!(1&T.wrap)||(((255&N)<<8)+(N>>8))%31){C.msg="incorrect header check",T.mode=30;break}if((15&N)!=8){C.msg="unknown compression method",T.mode=30;break}if(V-=4,S=8+(15&(N>>>=4)),T.wbits===0)T.wbits=S;else if(S>T.wbits){C.msg="invalid window size",T.mode=30;break}T.dmax=1<>8&1),512&T.flags&&(q[0]=255&N,q[1]=N>>>8&255,T.check=a(T.check,q,2,0)),V=N=0,T.mode=3;case 3:for(;V<32;){if($===0)break e;$--,N+=G[D++]<>>8&255,q[2]=N>>>16&255,q[3]=N>>>24&255,T.check=a(T.check,q,4,0)),V=N=0,T.mode=4;case 4:for(;V<16;){if($===0)break e;$--,N+=G[D++]<>8),512&T.flags&&(q[0]=255&N,q[1]=N>>>8&255,T.check=a(T.check,q,2,0)),V=N=0,T.mode=5;case 5:if(1024&T.flags){for(;V<16;){if($===0)break e;$--,N+=G[D++]<>>8&255,T.check=a(T.check,q,2,0)),V=N=0}else T.head&&(T.head.extra=null);T.mode=6;case 6:if(1024&T.flags&&($<(Q=T.length)&&(Q=$),Q&&(T.head&&(S=T.head.extra_len-T.length,T.head.extra||(T.head.extra=new Array(T.head.extra_len)),o.arraySet(T.head.extra,G,D,Q,S)),512&T.flags&&(T.check=a(T.check,G,Q,D)),$-=Q,D+=Q,T.length-=Q),T.length))break e;T.length=0,T.mode=7;case 7:if(2048&T.flags){if($===0)break e;for(Q=0;S=G[D+Q++],T.head&&S&&T.length<65536&&(T.head.name+=String.fromCharCode(S)),S&&Q<$;);if(512&T.flags&&(T.check=a(T.check,G,Q,D)),$-=Q,D+=Q,S)break e}else T.head&&(T.head.name=null);T.length=0,T.mode=8;case 8:if(4096&T.flags){if($===0)break e;for(Q=0;S=G[D+Q++],T.head&&S&&T.length<65536&&(T.head.comment+=String.fromCharCode(S)),S&&Q<$;);if(512&T.flags&&(T.check=a(T.check,G,Q,D)),$-=Q,D+=Q,S)break e}else T.head&&(T.head.comment=null);T.mode=9;case 9:if(512&T.flags){for(;V<16;){if($===0)break e;$--,N+=G[D++]<>9&1,T.head.done=!0),C.adler=T.check=0,T.mode=12;break;case 10:for(;V<32;){if($===0)break e;$--,N+=G[D++]<>>=7&V,V-=7&V,T.mode=27;break}for(;V<3;){if($===0)break e;$--,N+=G[D++]<>>=1)){case 0:T.mode=14;break;case 1:if(I(T),T.mode=20,X!==6)break;N>>>=2,V-=2;break e;case 2:T.mode=17;break;case 3:C.msg="invalid block type",T.mode=30}N>>>=2,V-=2;break;case 14:for(N>>>=7&V,V-=7&V;V<32;){if($===0)break e;$--,N+=G[D++]<>>16^65535)){C.msg="invalid stored block lengths",T.mode=30;break}if(T.length=65535&N,V=N=0,T.mode=15,X===6)break e;case 15:T.mode=16;case 16:if(Q=T.length){if($>>=5,V-=5,T.ndist=1+(31&N),N>>>=5,V-=5,T.ncode=4+(15&N),N>>>=4,V-=4,286>>=3,V-=3}for(;T.have<19;)T.lens[se[T.have++]]=0;if(T.lencode=T.lendyn,T.lenbits=7,H={bits:T.lenbits},Z=u(0,T.lens,0,19,T.lencode,0,T.work,H),T.lenbits=H.bits,Z){C.msg="invalid code lengths set",T.mode=30;break}T.have=0,T.mode=19;case 19:for(;T.have>>16&255,B=65535&z,!((te=z>>>24)<=V);){if($===0)break e;$--,N+=G[D++]<>>=te,V-=te,T.lens[T.have++]=B;else{if(B===16){for(j=te+2;V>>=te,V-=te,T.have===0){C.msg="invalid bit length repeat",T.mode=30;break}S=T.lens[T.have-1],Q=3+(3&N),N>>>=2,V-=2}else if(B===17){for(j=te+3;V>>=te)),N>>>=3,V-=3}else{for(j=te+7;V>>=te)),N>>>=7,V-=7}if(T.have+Q>T.nlen+T.ndist){C.msg="invalid bit length repeat",T.mode=30;break}for(;Q--;)T.lens[T.have++]=S}}if(T.mode===30)break;if(T.lens[256]===0){C.msg="invalid code -- missing end-of-block",T.mode=30;break}if(T.lenbits=9,H={bits:T.lenbits},Z=u(c,T.lens,0,T.nlen,T.lencode,0,T.work,H),T.lenbits=H.bits,Z){C.msg="invalid literal/lengths set",T.mode=30;break}if(T.distbits=6,T.distcode=T.distdyn,H={bits:T.distbits},Z=u(f,T.lens,T.nlen,T.ndist,T.distcode,0,T.work,H),T.distbits=H.bits,Z){C.msg="invalid distances set",T.mode=30;break}if(T.mode=20,X===6)break e;case 20:T.mode=21;case 21:if(6<=$&&258<=k){C.next_out=L,C.avail_out=k,C.next_in=D,C.avail_in=$,T.hold=N,T.bits=V,l(C,J),L=C.next_out,F=C.output,k=C.avail_out,D=C.next_in,G=C.input,$=C.avail_in,N=T.hold,V=T.bits,T.mode===12&&(T.back=-1);break}for(T.back=0;R=(z=T.lencode[N&(1<>>16&255,B=65535&z,!((te=z>>>24)<=V);){if($===0)break e;$--,N+=G[D++]<>W)])>>>16&255,B=65535&z,!(W+(te=z>>>24)<=V);){if($===0)break e;$--,N+=G[D++]<>>=W,V-=W,T.back+=W}if(N>>>=te,V-=te,T.back+=te,T.length=B,R===0){T.mode=26;break}if(32&R){T.back=-1,T.mode=12;break}if(64&R){C.msg="invalid literal/length code",T.mode=30;break}T.extra=15&R,T.mode=22;case 22:if(T.extra){for(j=T.extra;V>>=T.extra,V-=T.extra,T.back+=T.extra}T.was=T.length,T.mode=23;case 23:for(;R=(z=T.distcode[N&(1<>>16&255,B=65535&z,!((te=z>>>24)<=V);){if($===0)break e;$--,N+=G[D++]<>W)])>>>16&255,B=65535&z,!(W+(te=z>>>24)<=V);){if($===0)break e;$--,N+=G[D++]<>>=W,V-=W,T.back+=W}if(N>>>=te,V-=te,T.back+=te,64&R){C.msg="invalid distance code",T.mode=30;break}T.offset=B,T.extra=15&R,T.mode=24;case 24:if(T.extra){for(j=T.extra;V>>=T.extra,V-=T.extra,T.back+=T.extra}if(T.offset>T.dmax){C.msg="invalid distance too far back",T.mode=30;break}T.mode=25;case 25:if(k===0)break e;if(Q=J-k,T.offset>Q){if((Q=T.offset-Q)>T.whave&&T.sane){C.msg="invalid distance too far back",T.mode=30;break}ce=Q>T.wnext?(Q-=T.wnext,T.wsize-Q):T.wnext-Q,Q>T.length&&(Q=T.length),pe=T.window}else pe=F,ce=L-T.offset,Q=T.length;for(kw?(E=ce[pe+p[X]],V[P+p[X]]):(E=96,0),y=1<>L)+(_-=y)]=M<<24|E<<16|I|0,_!==0;);for(y=1<>=1;if(y!==0?(N&=y-1,N+=y):N=0,X++,--J[C]==0){if(C===G)break;C=f[d+p[X]]}if(F>>7)]}function P(z,q){z.pending_buf[z.pending++]=255&q,z.pending_buf[z.pending++]=q>>>8&255}function J(z,q,se){z.bi_valid>m-se?(z.bi_buf|=q<>m-z.bi_valid,z.bi_valid+=se-m):(z.bi_buf|=q<>>=1,se<<=1,0<--q;);return se>>>1}function pe(z,q,se){var ae,ee,he=new Array(p+1),ye=0;for(ae=1;ae<=p;ae++)he[ae]=ye=ye+se[ae-1]<<1;for(ee=0;ee<=q;ee++){var me=z[2*ee+1];me!==0&&(z[2*ee]=ce(he[me]++,me))}}function te(z){var q;for(q=0;q>1;1<=se;se--)W(z,he,se);for(ee=ne;se=z.heap[1],z.heap[1]=z.heap[z.heap_len--],W(z,he,1),ae=z.heap[1],z.heap[--z.heap_max]=se,z.heap[--z.heap_max]=ae,he[2*ee]=he[2*se]+he[2*ae],z.depth[ee]=(z.depth[se]>=z.depth[ae]?z.depth[se]:z.depth[ae])+1,he[2*se+1]=he[2*ae+1]=ee,z.heap[1]=ee++,W(z,he,1),2<=z.heap_len;);z.heap[--z.heap_max]=z.heap[1],function(ge,be){var ke,Xe,et,Le,ft,re,U=be.dyn_tree,ue=be.max_code,_e=be.stat_desc.static_tree,Ee=be.stat_desc.has_stree,Ce=be.stat_desc.extra_bits,it=be.stat_desc.extra_base,wt=be.stat_desc.max_length,ht=0;for(Le=0;Le<=p;Le++)ge.bl_count[Le]=0;for(U[2*ge.heap[ge.heap_max]+1]=0,ke=ge.heap_max+1;ke>=7;ee>>=1)if(1&fe&&me.dyn_ltree[2*ne]!==0)return s;if(me.dyn_ltree[18]!==0||me.dyn_ltree[20]!==0||me.dyn_ltree[26]!==0)return a;for(ne=32;ne>>3,(he=z.static_len+3+7>>>3)<=ee&&(ee=he)):ee=he=se+5,se+4<=ee&&q!==-1?j(z,q,se,ae):z.strategy===4||he===ee?(J(z,2+(ae?1:0),3),oe(z,O,C)):(J(z,4+(ae?1:0),3),function(me,ne,fe,ge){var be;for(J(me,ne-257,5),J(me,fe-1,5),J(me,ge-4,4),be=0;be>>8&255,z.pending_buf[z.d_buf+2*z.last_lit+1]=255&q,z.pending_buf[z.l_buf+z.last_lit]=255&se,z.last_lit++,q===0?z.dyn_ltree[2*se]++:(z.matches++,q--,z.dyn_ltree[2*(T[se]+f+1)]++,z.dyn_dtree[2*V(q)]++),z.last_lit===z.lit_bufsize-1},i._tr_align=function(z){J(z,2,3),Q(z,_,O),function(q){q.bi_valid===16?(P(q,q.bi_buf),q.bi_buf=0,q.bi_valid=0):8<=q.bi_valid&&(q.pending_buf[q.pending++]=255&q.bi_buf,q.bi_buf>>=8,q.bi_valid-=8)}(z)}},{"../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,d=1,h={},g=!1,v=s.document,p=Object.getPrototypeOf&&Object.getPrototypeOf(s);p=p&&p.setTimeout?p:s,l={}.toString.call(s.process)==="[object process]"?function(A){process.nextTick(function(){y(A)})}:function(){if(s.postMessage&&!s.importScripts){var A=!0,b=s.onmessage;return s.onmessage=function(){A=!1},s.postMessage("","*"),s.onmessage=b,A}}()?(f="setImmediate$"+Math.random()+"$",s.addEventListener?s.addEventListener("message",_,!1):s.attachEvent("onmessage",_),function(A){s.postMessage(f+A,"*")}):s.MessageChannel?((c=new MessageChannel).port1.onmessage=function(A){y(A.data)},function(A){c.port2.postMessage(A)}):v&&"onreadystatechange"in v.createElement("script")?(u=v.documentElement,function(A){var b=v.createElement("script");b.onreadystatechange=function(){y(A),b.onreadystatechange=null,u.removeChild(b),b=null},u.appendChild(b)}):function(A){setTimeout(y,0,A)},p.setImmediate=function(A){typeof A!="function"&&(A=new Function(""+A));for(var b=new Array(arguments.length-1),x=0;x"u"?o===void 0?this:o:self)}).call(this,typeof Nn<"u"?Nn:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})}($a)),$a.exports}var HI=$I();const XI=lu(HI);Hn.zipReader=(r,e)=>XI.loadAsync(r);Hn.readText=(r,e)=>{const t=r.file(e);if(!t)throw new Error(`Cannot find file: ${e}`);return t.async("text")};Hn.getFilePaths=r=>{const e=[];return r.forEach(t=>e.push(t)),Promise.resolve(e)};Hn.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 WI={relative:""},qI={"h-full":"","w-full":""},YI={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"},KI={bg:"pink-50","rounded-xl":"","px-10":"","py-6":""},ZI=["innerHTML"],JI=De({__name:"Stage",setup(r){const e=le(),t=le(),{stageView:n,elevenLabsApiKey:i,elevenlabsVoiceEnglish:o,elevenlabsVoiceJapanese:s}=En(ei()),{mouthOpenSize:a}=En(BI()),{audioContext:l,calculateVolume:u}=Wm(),{onBeforeMessageComposed:c,onBeforeSend:f,onTokenLiteral:d,onTokenSpecial:h,onStreamEnd:g,streamingMessage:v}=_r(),{process:p}=ec(),{locale:m}=Qr(),y=le(),_=le(!1),A=le(!1),b=bs({handlers:[T=>new Promise(G=>{const F=l.createBufferSource();F.buffer=T.data.audioBuffer,F.connect(l.destination),F.connect(y.value),_.value=!0,F.start(0),F.onended=()=>{_.value=!1,G()}})]}),x=bs({handlers:[async T=>{let G=rv.Camilla_KM;m.value==="jp"||m.value==="jp-JP"?G=s.value:G=o.value;const F=Date.now(),D=H2({apiKey:i.value,baseURL:"https://unspeech.hyp3r.link/v1/"}),L=await G2({...D.speech("eleven_multilingual_v2",{voiceSettings:{stability:.4,similarityBoost:.5}}),input:T.data,voice:iv[G]}),$=Date.now()-F;console.debug("TTS took",$,"ms");const k=await l.decodeAudioData(L);await b.add({audioBuffer:k,text:T.data})}]});x.on("add",T=>{console.debug("ttsQueue added",T)});const w=Iv(x),M=bs({handlers:[async T=>{if(n.value==="3d"){const G=Rv[T.data];if(!G)return;await t.value.setExpression(G)}else n.value==="2d"&&await e.value.setMotion(Ov[T.data])}]}),E=Mv(M);E.onHandlerEvent("emotion",T=>{console.debug("emotion detected",T)});const I=kv();I.onHandlerEvent("delay",T=>{console.debug("delay detected",T)});function O(){requestAnimationFrame(O),_.value&&(a.value=u(y.value,"linear"))}function C(){A.value||(O(),l.resume(),A.value=!0)}function X(){y.value||(y.value=l.createAnalyser())}return c(async()=>{X(),C()}),f(async()=>{var T;(T=e.value)==null||T.setMotion(Yd)}),d(async T=>{await w.add(T)}),h(async T=>{await I.add(T),await E.add(T)}),g(async()=>{await I.add(Pv)}),Ht(()=>{A.value=!1}),(T,G)=>(de(),xe("div",WI,[Y("div",qI,[K(n)==="2d"?(de(),lt(H1,{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(p)}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,d()},{immediate:!0}),ov("resize",d),$t(()=>{d(),p()}),Ht(()=>{cancelAnimationFrame(h)}),(m,y)=>(de(),xe("div",iM,[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"?(de(),xe("div",{key:0,style:Zr({backgroundColor:u.value,height:`${o.value}px`}),"w-full":""},null,4)):tt("",!0),(de(),xe("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,sM)],8,oM)),c.value==="up"?(de(),xe("div",{key:1,style:Zr({backgroundColor:u.value,height:`${o.value}px`}),"w-full":""},null,4)):tt("",!0)],512)]))}}),lM={flex:"~","gap-2":""},uM={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":""},cM=["checked","aria-checked"],fM=["checked","aria-checked"],hM={relative:""},dM={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":""},pM=["checked","aria-checked"],mM={key:0,w:"120 y.id===p.value);if(!m){l.value=void 0;return}l.value=m}function g(v){const p=v.target.value;switch(t.value){case"en":case"en-US":f.value=p;break;case"zh":case"zh-CN":case"zh-TW":case"zh-HK":f.value=p;break;case"jp":case"jp-JP":d.value=p;break}}return Ge([u,c],async([v,p])=>{if(!v||!p){s.value=[];return}s.value=await a(v,p)}),$t(async()=>{!u.value||!c.value||(s.value=await a(u.value,c.value))}),(v,p)=>(de(),xe("div",lM,[Y("fieldset",uM,[Y("label",{"h-fit":"","cursor-pointer":"",class:Jt([K(n).stageView==="2d"?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),"rounded-md":"","px-4":"","py-2":""},[dt(Y("input",{"onUpdate:modelValue":p[0]||(p[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,cM),[[wi,K(n).stageView]]),Y("div",{"select-none":"",class:Jt([K(n).stageView==="2d"?"font-semibold":""])}," 2D ",2)],2),Y("label",{"h-fit":"","cursor-pointer":"",class:Jt([K(n).stageView==="3d"?"bg-zinc-300 text-zinc-900 dark:bg-zinc-200 dark:text-zinc-800":""]),"rounded-md":"","px-4":"","py-2":""},[dt(Y("input",{"onUpdate:modelValue":p[1]||(p[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,fM),[[wi,K(n).stageView]]),Y("div",{"select-none":"",class:Jt([K(n).stageView==="3d"?"font-semibold":""])}," 3D ",2)],2)]),Y("div",hM,[Y("div",dM,[Y("label",{"h-fit":"","cursor-pointer":"",class:Jt([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":""},[dt(Y("input",{"onUpdate:modelValue":p[2]||(p[2]=m=>i.value=m),checked:i.value,"aria-checked":i.value,name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,pM),[[Kr,i.value]]),p[8]||(p[8]=Y("div",{"select-none":""},[Y("div",{"i-solar:settings-minimalistic-bold-duotone":"",text:"text-zinc-900 dark:text-zinc-800 lg"})],-1))],2)]),Fe(K(rm),null,{default:Ue(()=>[i.value?(de(),xe("div",mM,[Y("div",gM,[Y("span",null,we(K(e)("settings.openai-base-url.label")),1)]),Y("div",vM,[dt(Y("input",{"onUpdate:modelValue":p[3]||(p[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,yM),[[jr,K(n).openAiApiBaseURL]])]),Y("div",_M,[Y("span",null,we(K(e)("settings.openai-api-key.label")),1)]),Y("div",xM,[dt(Y("input",{"onUpdate:modelValue":p[4]||(p[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,bM),[[jr,K(n).openAiApiKey]])]),Y("div",wM,[Y("span",null,we(K(e)("settings.elevenlabs-api-key.label")),1)]),Y("div",TM,[dt(Y("input",{"onUpdate:modelValue":p[5]||(p[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,SM),[[jr,K(n).elevenLabsApiKey]])]),Y("div",EM,[Y("span",null,we(K(e)("settings.language.title")),1)]),Y("div",CM,[dt(Y("select",{"onUpdate:modelValue":p[6]||(p[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",AM,we(v.$t("settings.language.english")),1),Y("option",IM,we(v.$t("settings.language.chinese")),1)],512),[[jd,K(n).language]])]),Y("div",MM,[Y("span",null,we(K(e)("settings.models")),1)]),Y("div",kM,[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",PM,we(K(e)("stage.select-a-model")),1),K(n).openAiModel?(de(),xe("option",{key:0,value:K(n).openAiModel.id},we("name"in K(n).openAiModel?`${K(n).openAiModel.name} (${K(n).openAiModel.id})`:K(n).openAiModel.id),9,RM)):tt("",!0),(de(!0),xe(zn,null,vr(s.value,m=>(de(),xe("option",{key:m.id,value:m.id},we("name"in m?`${m.name} (${m.id})`:m.id),9,OM))),128))],32)]),Y("div",FM,[Y("span",null,we(K(e)("settings.voices")),1)]),Y("div",LM,[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",NM,we(K(e)("stage.select-a-voice")),1),["en","en-US"].indexOf(K(t))!==-1&&K(f)?(de(),xe("option",{key:0,value:K(f)},we(K(f)),9,DM)):tt("",!0),["zh","zh-CN","zh-TW","zh-HK"].indexOf(K(t))!==-1&&K(f)?(de(),xe("option",{key:1,value:K(f)},we(K(f)),9,BM)):tt("",!0),["jp","jp-JP"].indexOf(K(t))!==-1&&K(d)?(de(),xe("option",{key:2,value:K(d)},we(K(d)),9,UM)):tt("",!0),(de(!0),xe(zn,null,vr(K(Vd)[K(t)],(m,y)=>(de(),xe("option",{key:y,value:m},we(m),9,zM))),128))],32)])])):tt("",!0)]),_:1})]),Y("div",null,[Y("div",jM,[Y("label",VM,[dt(Y("input",{"onUpdate:modelValue":p[7]||(p[7]=m=>du(o)?o.value=m:null),checked:K(o),"aria-checked":K(o),name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,GM),[[Kr,K(o)]]),Y("div",$M,[Fe(Zo,{name:"slide-away",mode:"out-in"},{default:Ue(()=>[K(o)?(de(),xe("div",HM)):(de(),xe("div",XM))]),_:1})])])])])]))}}),qM={"mb-1":"","w-full":"","gap-2":""},YM=De({__name:"Header",setup(r){return(e,t)=>(de(),xe("header",qM,[t[0]||(t[0]=Y("a",{href:"https://github.com/moeru-ai/airi",rel:"noreferrer noopener",target:"_blank",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)),Fe(WM)]))}});function qm(r,e){const t=Gd(e??{},{...wc.getDefaultRealTimeVADOptions("v5"),preSpeechPadFrames:30,positiveSpeechThreshold:.5,negativeSpeechThreshold:.35,minSpeechFrames:30,auto:!0}),n=le(),i=sv("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 wc.MicVAD.new({...t,stream:a}),t.auto&&n.value.start()}return Ge(i,o,{immediate:!0}),Ge(av(r),o,{immediate:!0}),lv(o),Ht(()=>{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 KM(r,e){const t=Gd(e,{onLoading:()=>{},onInitiate:()=>{},onProgress:()=>{},onDone:()=>{},onReady:()=>{},onStart:()=>{},onUpdate:()=>{},onComplete:()=>{}}),{post:n,data:i,terminate:o}=uv(r,{type:"module"}),s=le(null),a=le(""),l=le([]),u=le(!1),c=le(0),f=le("");return Ge(i,d=>{var h,g,v,p,m,y,_,A;switch(d.status){case"loading":s.value="loading",a.value=d.data,(h=t.onLoading)==null||h.call(t,d.data);break;case"initiate":l.value.push(d),(g=t.onInitiate)==null||g.call(t,d);break;case"progress":l.value=l.value.map(b=>b.file===d.file?{...b,...d}:b),(v=t.onProgress)==null||v.call(t,d);break;case"done":l.value=l.value.filter(b=>b.file!==d.file),(p=t.onDone)==null||p.call(t,d);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=d.tps,(_=t.onUpdate)==null||_.call(t,d.tps);break;case"complete":u.value=!1,f.value=d.output[0]||"",console.debug("Whisper result:",f.value),(A=t.onComplete)==null||A.call(t,d.output[0]);break}}),Ht(()=>{o()}),{transcribe:d=>n(d),status:s,loadingMessage:a,loadingProgress:l,transcribing:u,tps:c,result:f,load:()=>n({type:"load"}),terminate:o}}const ZM="/assets/worker-Dc_51xfg.js";async function JM(r,e){const t=new ArrayBuffer(44+r.length*2),n=new DataView(t);mo(n,0,"RIFF"),n.setUint32(4,36+r.length*2,!0),mo(n,8,"WAVE"),mo(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),mo(n,36,"data"),n.setUint32(40,r.length*2,!0),QM(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 mo(r,e,t){for(let n=0;n{en().then(()=>{n.update(),i.value=n.height.value})}),a(async()=>{en().then(()=>{n.update(),i.value=n.height.value})}),(l,u)=>{const c=Hd("auto-animate");return de(),xe("div",ek,[u[1]||(u[1]=Y("div",{"flex-1":""},null,-1)),dt((de(),xe("div",{ref_key:"chatHistoryRef",ref:e,"h-full":"","w-full":"",flex:"~ col","overflow-scroll":""},[u[0]||(u[0]=Y("div",{"flex-1":""},null,-1)),(de(!0),xe(zn,null,vr(K(t),(f,d)=>(de(),xe("div",{key:d,"mb-2":""},[f.role==="assistant"?(de(),xe("div",tk,[Y("div",nk,[Y("div",null,[Y("span",rk,we(l.$t("stage.chat.message.character-name.airi")),1)]),f.content?(de(),xe("div",{key:0,class:"markdown-content",text:"base {await u(w)}});async function m(){await u(e.value)}const{destroy:y,start:_}=qm(l,{onSpeechStart:()=>{t.value=!0},onVADMisfire:()=>{t.value=!1},onSpeechEnd:w=>{t.value=!1,b(w)},auto:!1});function A(){v.value!=="loading"&&(g(),_())}async function b(w){await f.resume();const M=await JM(w,f.sampleRate);h({type:"generate",data:{audio:M,language:"en"}})}async function x(w){const M=w.target,E=o.value.find(I=>I.deviceId===M.value);if(!E){s.value=void 0;return}s.value=E}return Ge(a,async w=>{w==="false"&&(y(),p())}),c(async()=>{e.value=""}),(w,M)=>{const E=Io("BasicTextarea"),I=Io("TransitionVertical");return de(),xe("div",hk,[Y("fieldset",dk,[Y("label",{class:Jt([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":""},[dt(Y("input",{"onUpdate:modelValue":M[0]||(M[0]=O=>n.value=O),type:"radio",name:"tab",value:"chat",hidden:""},null,512),[[wi,n.value]]),M[5]||(M[5]=Y("div",{"i-solar:dialog-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),Y("div",mk,[Y("span",gk,we(w.$t("stage.chat.tabs.chat")),1)])],10,pk),Y("label",{class:Jt([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":""},[dt(Y("input",{"onUpdate:modelValue":M[1]||(M[1]=O=>n.value=O),type:"radio",name:"tab",value:"custom",hidden:""},null,512),[[wi,n.value]]),M[6]||(M[6]=Y("div",{"i-solar:star-fall-2-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),Y("div",yk,[Y("span",null,we(w.$t("stage.chat.tabs.custom")),1)])],10,vk),Y("label",{class:Jt([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":""},[dt(Y("input",{"onUpdate:modelValue":M[2]||(M[2]=O=>n.value=O),type:"radio",name:"tab",value:"clothes",hidden:""},null,512),[[wi,n.value]]),M[7]||(M[7]=Y("div",{"i-solar:magic-stick-3-bold-duotone":"",text:"2xl",transform:"translate-y--2"},null,-1)),Y("div",xk,[Y("span",null,we(w.$t("stage.chat.tabs.clothes")),1)])],10,_k)]),Y("div",bk,[Y("div",wk,[Fe(fk,{"h-full":"","flex-1":"","p-4":"",w:"full","max-h":"e.value=O),placeholder:K(d)("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",Sk,[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:A},[Fe(Zo,{mode:"out-in"},{default:Ue(()=>[K(v)===null?(de(),xe("div",Ek,we(w.$t("stage.operations.load-models")),1)):K(v)==="loading"?(de(),xe("div",Ck,[M[8]||(M[8]=Y("div",{"i-svg-spinners:bouncing-ball":"",class:"text-cyan"},null,-1)),Y("span",null,we(w.$t("stage.operations.load-models-status.loading")),1)])):K(v)==="ready"?(de(),xe("div",Ak,[M[9]||(M[9]=Y("div",{"i-lucide:check":"",class:"text-cyan"},null,-1)),Y("span",null,we(w.$t("stage.operations.load-models-status.ready")),1)])):tt("",!0)]),_:1})]),Y("div",Ik,[Fe(I,null,{default:Ue(()=>[i.value?(de(),xe("fieldset",Mk,[(de(!0),xe(zn,null,vr(K(o),(O,C)=>(de(),xe("label",{key:C,class:"[&_div_span]:dark:hover:bg-cyan-300 [&_div_span]:dark:hover:bg-cyan-900"},[Y("input",{type:"radio",name:"audioInput",value:O.deviceId,hidden:"",onChange:x},null,40,kk),Y("div",Pk,[Y("div",Rk,[O.deviceId===K(l)?(de(),xe("div",Ok)):tt("",!0)]),Y("span",{"inline-block":"",class:Jt([O.deviceId===K(l)?"cyan-400 dark:text-white":"cyan-400/50 dark:text-white/50"]),transition:"all duration-250 ease-in-out"},we(O.label),3)])]))),128))])):tt("",!0)]),_:1}),Y("label",Fk,[dt(Y("input",{"onUpdate:modelValue":M[4]||(M[4]=O=>i.value=O),type:"checkbox",hidden:""},null,512),[[Kr,i.value]]),M[10]||(M[10]=Y("div",{"i-solar:microphone-2-bold-duotone":""},null,-1)),Y("div",null,[t.value?(de(),xe("span",Nk,"Listening...")):(de(),xe("span",Lk,we(w.$t("settings.microphone")),1))])])])])])}}}),Bk=Qo(Dk,[["__scopeId","data-v-f0ce09b3"]]),Uk={},zk={"mb-1":"","w-full":"","gap-2":""};function jk(r,e){return de(),xe("header",zk,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 Vk=Qo(Uk,[["render",jk]]);function nc(r,e){const t=typeof r=="string"&&!e?`${r}Context`:e,n=Symbol(t);return[i=>{const o=mv(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=>(gv(n,i),i)]}function Ym(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 Km(r){return kd()?(Pd(r),!0):!1}function Gk(r){let e=!1,t;const n=Wd(!0);return(...i)=>(e||(t=n.run(()=>r(...i)),e=!0),t)}function $k(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=Wd(!0),t=n.run(()=>r(...o))),Km(i),t)}function rc(r){return typeof r=="function"?r():K(r)}const Sr=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Hk=r=>typeof r<"u",Xk=Object.prototype.toString,Wk=r=>Xk.call(r)==="[object Object]",qk=()=>{},hd=Yk();function Yk(){var r,e;return Sr&&((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 Kk(r){return xr()}function Zk(r,e){Kk()&&qd(r,e)}function us(r){var e;const t=rc(r);return(e=t==null?void 0:t.$el)!=null?e:t}const ic=Sr?window:void 0;function Zm(...r){let e,t,n,i;if(typeof r[0]=="string"||Array.isArray(r[0])?([t,n,i]=r,e=ic):[e,t,n,i]=r,!e)return qk;Array.isArray(t)||(t=[t]),Array.isArray(n)||(n=[n]);const o=[],s=()=>{o.forEach(c=>c()),o.length=0},a=(c,f,d,h)=>(c.addEventListener(f,d,h),()=>c.removeEventListener(f,d,h)),l=Ge(()=>[us(e),rc(i)],([c,f])=>{if(s(),!c)return;const d=Wk(f)?{...f}:f;o.push(...t.flatMap(h=>n.map(g=>a(c,h,g,d))))},{immediate:!0,flush:"post"}),u=()=>{l(),s()};return Km(u),u}function Jk(r){return typeof r=="function"?r:typeof r=="string"?e=>e.key===r:Array.isArray(r)?e=>r.includes(e.key):()=>!0}function Qk(...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=ic,eventName:o="keydown",passive:s=!1,dedupe:a=!1}=n,l=Jk(e);return Zm(i,o,u=>{u.repeat&&rc(a)||l(u)&&t(u)},s)}function eP(){const r=le(!1),e=xr();return e&&$t(()=>{r.value=!0},e),r}function tP(r){return JSON.parse(JSON.stringify(r))}function nP(r,e,t,n={}){var i,o,s;const{clone:a=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:f,shouldEmit:d}=n,h=xr(),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 p=_=>a?typeof a=="function"?a(_):tP(_):_,m=()=>Hk(r[e])?p(r[e]):f,y=_=>{d?d(_)&&g(v,_):g(v,_)};if(l){const _=m(),A=le(_);let b=!1;return Ge(()=>r[e],x=>{b||(b=!0,A.value=p(x),en(()=>b=!1))}),Ge(A,x=>{!b&&(x!==r[e]||c)&&y(x)},{deep:c}),A}else return Ve({get(){return m()},set(_){y(_)}})}function oc(r){return r?r.flatMap(e=>e.type===zn?oc(e.children):[e]):[]}function Ha(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 su(r,e,t=".",n){if(!Ha(e))return su(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]]:Ha(s)&&Ha(i[o])?i[o]=su(s,i[o],(t?`${t}.`:"")+o.toString()):i[o]=s)}return i}function rP(r){return(...e)=>e.reduce((t,n)=>su(t,n,""),{})}const iP=rP(),[Jm,dO]=nc("ConfigProvider");let oP="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",sP=(r=21)=>{let e="",t=r;for(;t--;)e+=oP[Math.random()*64|0];return e};const aP=$k(()=>{const r=le(new Map),e=le(),t=Ve(()=>{for(const s of r.value.values())if(s)return!0;return!1}),n=Jm({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??"",hd&&(i==null||i()),e.value=void 0};return Ge(t,(s,a)=>{var l;if(!Sr)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"?iP({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"),hd&&(i=Zm(document,"touchmove",d=>uP(d),{passive:!1})),en(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})},{immediate:!0,flush:"sync"}),r});function lP(r){const e=sP(6),t=aP();t.value.set(e,r);const n=Ve({get:()=>t.value.get(e)??!1,set:i=>t.value.set(e,i)});return Zk(()=>{t.value.delete(e)}),n}function Qm(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 sc(r){const e=xr(),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[vv(yv(i))]=(...o)=>r(i,...o)}),n}function An(){const r=xr(),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:us(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 cP=function(r){if(typeof document>"u")return null;var e=Array.isArray(r)?r[0]:r;return e.ownerDocument.body},Lr=new WeakMap,go=new WeakMap,vo={},Xa=0,eg=function(r){return r&&(r.host||eg(r.parentNode))},fP=function(r,e){return e.map(function(t){if(r.contains(t))return t;var n=eg(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})},hP=function(r,e,t,n){var i=fP(e,Array.isArray(r)?r:[r]);vo[t]||(vo[t]=new WeakMap);var o=vo[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(d){if(a.has(d))c(d);else try{var h=d.getAttribute(n),g=h!==null&&h!=="false",v=(Lr.get(d)||0)+1,p=(o.get(d)||0)+1;Lr.set(d,v),o.set(d,p),s.push(d),v===1&&g&&go.set(d,!0),p===1&&d.setAttribute(t,"true"),g||d.setAttribute(n,"true")}catch(m){console.error("aria-hidden: cannot operate on ",d,m)}})};return c(e),a.clear(),Xa++,function(){s.forEach(function(f){var d=Lr.get(f)-1,h=o.get(f)-1;Lr.set(f,d),o.set(f,h),d||(go.has(f)||f.removeAttribute(n),go.delete(f)),h||f.removeAttribute(t)}),Xa--,Xa||(Lr=new WeakMap,Lr=new WeakMap,go=new WeakMap,vo={})}},dP=function(r,e,t){t===void 0&&(t="data-aria-hidden");var n=Array.from(Array.isArray(r)?r:[r]),i=cP(r);return i?(n.push.apply(n,Array.from(i.querySelectorAll("[aria-live]"))),hP(n,i,t,"aria-hidden")):function(){return null}};function pP(r){let e;Ge(()=>us(r),t=>{t?e=dP(t):e&&e()}),Ht(()=>{e&&e()})}function au(r,e="radix"){return Jm({useId:void 0}),`${e}-${dv()}`}function mP(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 gP=De({name:"PrimitiveSlot",inheritAttrs:!1,setup(r,{attrs:e,slots:t}){return()=>{var n,i;if(!t.default)return null;const o=oc(t.default()),s=o.findIndex(c=>c.type!==_v);if(s===-1)return o;const a=o[s];(n=a.props)==null||delete n.ref;const l=a.props?jn(e,a.props):e;e.class&&(i=a.props)!=null&&i.class&&delete a.props.class;const u=xv(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)}}}),cs=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)?()=>wo(n,e):n!=="template"?()=>wo(r.as,e,{default:t.default}):()=>wo(gP,e,{default:t.default})}});function vP(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)??ic,{state:u,dispatch:c}=mP(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),f=p=>{var m;if(Sr){const y=new CustomEvent(p,{bubbles:!1,cancelable:!1});(m=e.value)==null||m.dispatchEvent(y)}};Ge(r,async(p,m)=>{var y;const _=m!==p;if(await en(),_){const A=i.value,b=yo(e.value);p?(c("MOUNT"),f("enter"),b==="none"&&f("after-enter")):b==="none"||((y=n.value)==null?void 0:y.display)==="none"?(c("UNMOUNT"),f("leave"),f("after-leave")):m&&A!==b?(c("ANIMATION_OUT"),f("leave")):(c("UNMOUNT"),f("after-leave"))}},{immediate:!0});const d=p=>{const m=yo(e.value),y=m.includes(p.animationName),_=u.value==="mounted"?"enter":"leave";if(p.target===e.value&&y&&(f(`after-${_}`),c("ANIMATION_END"),!o.value)){const A=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",a=l==null?void 0:l.setTimeout(()=>{var b;((b=e.value)==null?void 0:b.style.animationFillMode)==="forwards"&&(e.value.style.animationFillMode=A)})}p.target===e.value&&m==="none"&&c("ANIMATION_END")},h=p=>{p.target===e.value&&(i.value=yo(e.value))},g=Ge(e,(p,m)=>{p?(n.value=getComputedStyle(p),p.addEventListener("animationstart",h),p.addEventListener("animationcancel",d),p.addEventListener("animationend",d)):(c("ANIMATION_END"),l==null||l.clearTimeout(a),m==null||m.removeEventListener("animationstart",h),m==null||m.removeEventListener("animationcancel",d),m==null||m.removeEventListener("animationend",d))},{immediate:!0}),v=Ge(u,()=>{const p=yo(e.value);i.value=u.value==="mounted"?p:"none"});return Ht(()=>{g(),v()}),{isPresent:Ve(()=>["mounted","unmountSuspended"].includes(u.value))}}function yo(r){return r&&getComputedStyle(r).animationName||"none"}const tg=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}=Jr(r),s=le(),{isPresent:a}=vP(i,s);t({present:a});let l=e.default({present:a});l=oc(l||[]);const u=xr();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?wo(e.default({present:a})[0],{ref:c=>{const f=us(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}}),[Er,yP]=nc("DialogRoot"),_P=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=nP(t,"open",e,{defaultValue:t.defaultOpen,passive:t.open===void 0}),i=le(),o=le(),{modal:s}=Jr(t);return yP({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)})}}),xP=De({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{default:"button"}},setup(r){const e=r,t=Er(),{forwardRef:n,currentElement:i}=An();return t.contentId||(t.contentId=au(void 0,"radix-vue-dialog-content")),$t(()=>{t.triggerElement.value=i.value}),(o,s)=>(de(),lt(K(cs),jn(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"]))}}),bP=De({__name:"Teleport",props:{to:{default:"body"},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(r){const e=eP();return(t,n)=>K(e)||t.forceMount?(de(),lt(pv,{key:0,to:t.to,disabled:t.disabled},[ut(t.$slots,"default")],8,["to","disabled"])):tt("",!0)}}),wP=De({__name:"DialogPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(r){const e=r;return(t,n)=>(de(),lt(K(bP),fv(hv(e)),{default:Ue(()=>[ut(t.$slots,"default")]),_:3},16))}}),TP="dismissableLayer.pointerDownOutside",SP="dismissableLayer.focusOutside";function ng(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 hn(s=>{if(!Sr)return;const a=async u=>{const c=u.target;if(e!=null&&e.value){if(ng(e.value,c)){i.value=!1;return}if(u.target&&!i.value){let f=function(){Ym(TP,r,d)};const d={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 CP(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 hn(o=>{if(!Sr)return;const s=async a=>{e!=null&&e.value&&(await en(),!(!e.value||ng(e.value,a.target))&&a.target&&!i.value&&Ym(SP,r,{originalEvent:a}))};n.addEventListener("focusin",s),o(()=>n.removeEventListener("focusin",s))}),{onFocusCapture:()=>i.value=!0,onBlurCapture:()=>i.value=!1}}const _n=Xd({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),AP=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}=An(),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),p=g.indexOf(v);return l.value>=p}),f=EP(async g=>{const v=[..._n.branches].some(p=>p==null?void 0:p.contains(g.target));!c.value||v||(n("pointerDownOutside",g),n("interactOutside",g),await en(),g.defaultPrevented||n("dismiss"))},o),d=CP(g=>{[..._n.branches].some(v=>v==null?void 0:v.contains(g.target))||(n("focusOutside",g),n("interactOutside",g),g.defaultPrevented||n("dismiss"))},o);Qk("Escape",g=>{l.value===a.value.size-1&&(n("escapeKeyDown",g),g.defaultPrevented||n("dismiss"))});let h;return hn(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)}))}),hn(g=>{g(()=>{o.value&&(a.value.delete(o.value),_n.layersWithOutsidePointerEventsDisabled.delete(o.value))})}),(g,v)=>(de(),lt(K(cs),{ref:K(i),"as-child":g.asChild,as:g.as,"data-dismissable-layer":"",style:Zr({pointerEvents:u.value?c.value?"auto":"none":void 0}),onFocusCapture:K(d).onFocusCapture,onBlurCapture:K(d).onBlurCapture,onPointerdownCapture:K(f).onPointerDownCapture},{default:Ue(()=>[ut(g.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),Wa="focusScope.autoFocusOnMount",qa="focusScope.autoFocusOnUnmount",dd={bubbles:!1,cancelable:!0};function IP(r,{select:e=!1}={}){const t=document.activeElement;for(const n of r)if(Fn(n,{select:e}),document.activeElement!==t)return!0}function MP(r){const e=rg(r),t=pd(e,r),n=pd(e.reverse(),r);return[t,n]}function rg(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 pd(r,e){for(const t of r)if(!kP(t,{upTo:e}))return t}function kP(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 PP(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&&PP(r)&&e&&r.select()}}const RP=Gk(()=>le([]));function OP(){const r=RP();return{add(e){const t=r.value[0];e!==t&&(t==null||t.pause()),r.value=md(r.value,e),r.value.unshift(e)},remove(e){var t;r.value=md(r.value,e),(t=r.value[0])==null||t.resume()}}}function md(r,e){const t=[...r],n=t.indexOf(e);return n!==-1&&t.splice(n,1),t}function FP(r){return r.filter(e=>e.tagName!=="A")}const LP=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}=An(),s=le(null),a=OP(),l=Xd({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});hn(c=>{if(!Sr)return;const f=o.value;if(!t.trapped)return;function d(p){if(l.paused||!f)return;const m=p.target;f.contains(m)?s.value=m:Fn(s.value,{select:!0})}function h(p){if(l.paused||!f)return;const m=p.relatedTarget;m!==null&&(f.contains(m)||Fn(s.value,{select:!0}))}function g(p){f.contains(s.value)||Fn(f)}document.addEventListener("focusin",d),document.addEventListener("focusout",h);const v=new MutationObserver(g);f&&v.observe(f,{childList:!0,subtree:!0}),c(()=>{document.removeEventListener("focusin",d),document.removeEventListener("focusout",h),v.disconnect()})}),hn(async c=>{const f=o.value;if(await en(),!f)return;a.add(l);const d=document.activeElement;if(!f.contains(d)){const h=new CustomEvent(Wa,dd);f.addEventListener(Wa,g=>n("mountAutoFocus",g)),f.dispatchEvent(h),h.defaultPrevented||(IP(FP(rg(f)),{select:!0}),document.activeElement===d&&Fn(f))}c(()=>{f.removeEventListener(Wa,v=>n("mountAutoFocus",v));const h=new CustomEvent(qa,dd),g=v=>{n("unmountAutoFocus",v)};f.addEventListener(qa,g),f.dispatchEvent(h),setTimeout(()=>{h.defaultPrevented||Fn(d??document.body,{select:!0}),f.removeEventListener(qa,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,d=document.activeElement;if(f&&d){const h=c.currentTarget,[g,v]=MP(h);g&&v?!c.shiftKey&&d===v?(c.preventDefault(),t.loop&&Fn(g,{select:!0})):c.shiftKey&&d===g&&(c.preventDefault(),t.loop&&Fn(v,{select:!0})):d===h&&c.preventDefault()}}return(c,f)=>(de(),lt(K(cs),{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 NP(r){return r?"open":"closed"}const ig=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=Er(),{forwardRef:o,currentElement:s}=An();return i.titleId||(i.titleId=au(void 0,"radix-vue-dialog-title")),i.descriptionId||(i.descriptionId=au(void 0,"radix-vue-dialog-description")),$t(()=>{i.contentElement=s,document.activeElement!==document.body&&(i.triggerElement.value=document.activeElement)}),(a,l)=>(de(),lt(K(LP),{"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(()=>[Fe(K(AP),jn({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(NP)(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"]))}}),DP=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=Er(),o=sc(n),{forwardRef:s,currentElement:a}=An();return pP(a),(l,u)=>(de(),lt(ig,jn({...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,d=f.button===0&&f.ctrlKey===!0;(f.button===2||d)&&c.preventDefault()}),onFocusOutside:u[2]||(u[2]=c=>{c.preventDefault()})}),{default:Ue(()=>[ut(l.$slots,"default")]),_:3},16,["trap-focus"]))}}),BP=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=sc(e);An();const i=Er(),o=le(!1),s=le(!1);return(a,l)=>(de(),lt(ig,jn({...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))}}),UP=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=Er(),o=sc(n),{forwardRef:s}=An();return(a,l)=>(de(),lt(K(tg),{present:a.forceMount||K(i).open.value},{default:Ue(()=>[K(i).modal.value?(de(),lt(DP,jn({key:0,ref:K(s)},{...t,...K(o),...a.$attrs}),{default:Ue(()=>[ut(a.$slots,"default")]),_:3},16)):(de(),lt(BP,jn({key:1,ref:K(s)},{...t,...K(o),...a.$attrs}),{default:Ue(()=>[ut(a.$slots,"default")]),_:3},16))]),_:3},8,["present"]))}}),zP=De({__name:"DialogOverlayImpl",props:{asChild:{type:Boolean},as:{}},setup(r){const e=Er();return lP(!0),An(),(t,n)=>(de(),lt(K(cs),{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"]))}}),jP=De({__name:"DialogOverlay",props:{forceMount:{type:Boolean},asChild:{type:Boolean},as:{}},setup(r){const e=Er(),{forwardRef:t}=An();return(n,i)=>{var o;return(o=K(e))!=null&&o.modal.value?(de(),lt(K(tg),{key:0,present:n.forceMount||K(e).open.value},{default:Ue(()=>[Fe(zP,jn(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"])):tt("",!0)}}});function VP(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}VP();(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 GP=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const $P=r=>typeof r<"u";function HP(r){return JSON.parse(JSON.stringify(r))}function gd(r,e,t,n={}){var i,o,s;const{clone:a=!1,passive:l=!1,eventName:u,deep:c=!1,defaultValue:f,shouldEmit:d}=n,h=xr(),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 p=_=>a?typeof a=="function"?a(_):HP(_):_,m=()=>$P(r[e])?p(r[e]):f,y=_=>{d?d(_)&&g(v,_):g(v,_)};if(l){const _=m(),A=le(_);let b=!1;return Ge(()=>r[e],x=>{b||(b=!0,A.value=p(x),en(()=>b=!1))}),Ge(A,x=>{!b&&(x!==r[e]||c)&&y(x)},{deep:c}),A}else return Ve({get(){return m()},set(_){y(_)}})}const[og,XP]=nc("DrawerRoot"),sg=new WeakMap;function rt(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&&sg.set(r,n)}function _o(r,e){if(!r||!(r instanceof HTMLElement))return;const t=sg.get(r);t&&(e?r.style[e]=t[e]:Object.entries(t).forEach(([n,i])=>{r.style[n]=i}))}function xo(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(", ")[yt(e)?13:12]):(i=n.match(/^matrix\((.+)\)$/),i?Number.parseFloat(i[1].split(", ")[yt(e)?5:4]):null)}function WP(r){return 8*(Math.log(r+1)-2)}function yt(r){switch(r){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return r}}const We={DURATION:.5,EASE:[.32,.72,0,1]},ag=.4;function qP({activeSnapPoint:r,snapPoints:e,drawerRef:t,overlayRef:n,fadeFromIndex:i,onSnapPointChange:o,direction:s}){const a=le(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);function l(){a.value={innerWidth:window.innerWidth,innerHeight:window.innerHeight}}$t(()=>{typeof window<"u"&&window.addEventListener("resize",l)}),qd(()=>{typeof window<"u"&&window.removeEventListener("resize",l)});const u=Ve(()=>(e.value&&r.value===e.value[e.value.length-1])??null),c=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),f=Ve(()=>{var y;return((y=e.value)==null?void 0:y.findIndex(_=>_===r.value))??null}),d=Ve(()=>{var y;return((y=e.value)==null?void 0:y.map(_=>{const A=typeof _=="string";let b=0;if(A&&(b=Number.parseInt(_,10)),yt(s.value)){const w=A?b:a.value?_*a.value.innerHeight:0;return a.value?s.value==="bottom"?a.value.innerHeight-w:-a.value.innerHeight+w:w}const x=A?b:a.value?_*a.value.innerWidth:0;return a.value?s.value==="right"?a.value.innerWidth-x:-a.value.innerWidth+x:x}))??[]}),h=Ve(()=>{var y;return f.value!==null?(y=d.value)==null?void 0:y[f.value]:null}),g=y=>{var _,A,b,x;const w=((_=d.value)==null?void 0:_.findIndex(M=>M===y))??null;en(()=>{var M;o(w,d.value),rt((M=t.value)==null?void 0:M.$el,{transition:`transform ${We.DURATION}s cubic-bezier(${We.EASE.join(",")})`,transform:yt(s.value)?`translate3d(0, ${y}px, 0)`:`translate3d(${y}px, 0, 0)`})}),d.value&&w!==d.value.length-1&&w!==(i==null?void 0:i.value)?rt((A=n.value)==null?void 0:A.$el,{transition:`opacity ${We.DURATION}s cubic-bezier(${We.EASE.join(",")})`,opacity:"0"}):rt((b=n.value)==null?void 0:b.$el,{transition:`opacity ${We.DURATION}s cubic-bezier(${We.EASE.join(",")})`,opacity:"1"}),r.value=w!==null?((x=e.value)==null?void 0:x[w])??null:null};Ge([r,d,e],()=>{var y;if(r.value){const _=((y=e.value)==null?void 0:y.findIndex(A=>A===r.value))??-1;d.value&&_!==-1&&typeof d.value[_]=="number"&&g(d.value[_])}},{immediate:!0});function v({draggedDistance:y,closeDrawer:_,velocity:A,dismissible:b}){var x,w,M;if(i.value===void 0)return;const E=s.value==="bottom"||s.value==="right"?(h.value??0)-y:(h.value??0)+y,I=f.value===i.value-1,O=f.value===0,C=y>0;if(I&&rt((x=n.value)==null?void 0:x.$el,{transition:`opacity ${We.DURATION}s cubic-bezier(${We.EASE.join(",")})`}),A>2&&!C){b?_():g(d.value[0]);return}if(A>2&&C&&d&&e.value){g(d.value[e.value.length-1]);return}const X=(w=d.value)==null?void 0:w.reduce((G,F)=>typeof G!="number"||typeof F!="number"?G:Math.abs(F-E)ag&&Math.abs(y)0&&u){g(d.value[(((M=e.value)==null?void 0:M.length)??0)-1]);return}if(O&&G<0&&b&&_(),f.value===null)return;g(d.value[f.value+G]);return}g(X)}function p({draggedDistance:y}){var _;if(h.value===null)return;const A=s.value==="bottom"||s.value==="right"?h.value-y:h.value+y;(s.value==="bottom"||s.value==="right")&&Ad.value[d.value.length-1]||rt((_=t.value)==null?void 0:_.$el,{transform:yt(s.value)?`translate3d(0, ${A}px, 0)`:`translate3d(${A}px, 0, 0)`})}function m(y,_){if(!e.value||typeof f.value!="number"||!d.value||i.value===void 0)return null;const A=f.value===i.value-1;if(f.value>=i.value&&_)return 0;if(A&&!_)return 1;if(!c.value&&!A)return null;const b=A?f.value+1:f.value-1,x=A?d.value[b]-d.value[b-1]:d.value[b+1]-d.value[b],w=y/Math.abs(x);return A?1-w:w}return{isLastSnapPoint:u,shouldFade:c,getPercentageDragged:m,activeSnapPointIndex:f,onRelease:v,onDrag:p,snapPointsOffset:d}}let pi=null;function YP(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(pi===null&&e.value){pi={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(pi!==null){const u=-Number.parseInt(document.body.style.top,10),c=-Number.parseInt(document.body.style.left,10);Object.assign(document.body.style,pi),requestAnimationFrame(()=>{if(o.value!==window.location.href){o.value=window.location.href;return}window.scrollTo(c,u)}),pi=null}}return $t(()=>{function u(){s.value=window.scrollY}u(),window.addEventListener("scroll",u),Ht(()=>{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 KP=.25,ZP=100,vd=8,bo=16,JP=26,yd="vaul-dragging";function QP(r,e){return r&&r.value?r:e}function eR(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:d,activeSnapPoint:h,fadeFromIndex:g,direction:v}=r,p=le(o.value??!1),m=le(!1),y=le(!1),_=le(!1),A=le(!1),b=le(null),x=le(null),w=le(null),M=le(null),E=le(null),I=le(!0),O=le(null),C=le(0),X=le(!1);le(0);const T=le(null);le(0);const G=Ve(()=>{var H;return((H=T.value)==null?void 0:H.$el.getBoundingClientRect().height)||0}),F=QP(r.snapPoints,le(void 0)),{activeSnapPointIndex:D,onRelease:L,snapPointsOffset:$,onDrag:k,shouldFade:N,getPercentageDragged:V}=qP({snapPoints:F,activeSnapPoint:h,drawerRef:T,fadeFromIndex:g,overlayRef:b,onSnapPointChange:P,direction:v});function P(H,j){F.value&&H===j.length-1&&(x.value=new Date)}const{restorePositionSetting:J}=YP({isOpen:p,modal:u,nested:a,hasBeenOpened:m});function Q(){return(window.innerWidth-JP)/window.innerWidth}function ce(H,j){var z;if(!H)return!1;let q=H;const se=(z=window.getSelection())==null?void 0:z.toString(),ae=T.value?xo(T.value.$el,v.value):null,ee=new Date;if(q.hasAttribute("data-vaul-no-drag")||q.closest("[data-vaul-no-drag]"))return!1;if(v.value==="right"||v.value==="left")return!0;if(x.value&&ee.getTime()-x.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(E.value&&ee.getTime()-E.value.getTime()q.clientHeight){if(q.scrollTop!==0)return E.value=new Date,!1;if(q.getAttribute("role")==="dialog")return!0}q=q.parentNode}return!0}function pe(H){!s.value&&!F.value||T.value&&!T.value.$el.contains(H.target)||(_.value=!0,w.value=new Date,H.target.setPointerCapture(H.pointerId),C.value=yt(v.value)?H.clientY:H.clientX)}function te(H){var j,z,q,se,ae,ee;if(T.value&&_.value){const he=v.value==="bottom"||v.value==="right"?1:-1,ye=(C.value-(yt(v.value)?H.clientY:H.clientX))*he,me=ye>0,ne=F.value&&!s.value&&!me;if(ne&&D.value===0)return;const fe=Math.abs(ye),ge=document.querySelector("[vaul-drawer-wrapper]");let be=fe/G.value;const ke=V(fe,me);if(ke!==null&&(be=ke),ne&&be>=1||!I.value&&!ce(H.target,me))return;if((j=T==null?void 0:T.value)==null||j.$el.classList.add(yd),I.value=!0,rt((z=T.value)==null?void 0:z.$el,{transition:"none"}),rt((q=b.value)==null?void 0:q.$el,{transition:"none"}),F.value&&k({draggedDistance:ye}),me&&!F.value){const et=WP(ye),Le=Math.min(et*-1,0)*he;rt((se=T.value)==null?void 0:se.$el,{transform:yt(v.value)?`translate3d(0, ${Le}px, 0)`:`translate3d(${Le}px, 0, 0)`});return}const Xe=1-be;if((N.value||g.value&&D.value===g.value-1)&&(e(be),rt((ae=b.value)==null?void 0:ae.$el,{opacity:`${Xe}`,transition:"none"},!0)),ge&&b.value&&c.value){const et=Math.min(Q()+be*(1-Q()),1),Le=8-be*8,ft=Math.max(0,14-be*14);rt(ge,{borderRadius:`${Le}px`,transform:yt(v.value)?`scale(${et}) translate3d(0, ${ft}px, 0)`:`scale(${et}) translate3d(${ft}px, 0, 0)`,transition:"none"},!0)}if(!F.value){const et=fe*he;rt((ee=T.value)==null?void 0:ee.$el,{transform:yt(v.value)?`translate3d(0, ${et}px, 0)`:`translate3d(${et}px, 0, 0)`})}}}function R(){var H;if(!T.value)return;const j=document.querySelector("[vaul-drawer-wrapper]"),z=xo(T.value.$el,v.value);rt(T.value.$el,{transform:"translate3d(0, 0, 0)",transition:`transform ${We.DURATION}s cubic-bezier(${We.EASE.join(",")})`}),rt((H=b.value)==null?void 0:H.$el,{transition:`opacity ${We.DURATION}s cubic-bezier(${We.EASE.join(",")})`,opacity:"1"}),c.value&&z&&z>0&&p.value&&rt(j,{borderRadius:`${vd}px`,overflow:"hidden",...yt(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:`${We.DURATION}s`,transitionTimingFunction:`cubic-bezier(${We.EASE.join(",")})`},!0)}function B(){var H;T.value&&(n(),rt(T.value.$el,{transform:yt(v.value)?`translate3d(0, ${v.value==="bottom"?"100%":"-100%"}, 0)`:`translate3d(${v.value==="right"?"100%":"-100%"}, 0, 0)`,transition:`transform ${We.DURATION}s cubic-bezier(${We.EASE.join(",")})`}),rt((H=b.value)==null?void 0:H.$el,{opacity:"0",transition:`opacity ${We.DURATION}s cubic-bezier(${We.EASE.join(",")})`}),oe(!1),window.setTimeout(()=>{y.value=!1,p.value=!1},300),window.setTimeout(()=>{F.value&&(h.value=F.value[0])},We.DURATION*1e3))}hn(()=>{if(!p.value&&c.value&&GP){const H=setTimeout(()=>{_o(document.body)},200);return()=>clearTimeout(H)}}),Ht(()=>{oe(!1),J()});function W(H){if(!_.value||!T.value)return;T.value.$el.classList.remove(yd),I.value=!1,_.value=!1,M.value=new Date;const j=xo(T.value.$el,v.value);if(!ce(H.target,!1)||!j||Number.isNaN(j)||w.value===null)return;const z=M.value.getTime()-w.value.getTime(),q=C.value-(yt(v.value)?H.clientY:H.clientX),se=Math.abs(q)/z;if(se>.05&&(A.value=!0,window.setTimeout(()=>{A.value=!1},200)),F.value){const ee=v.value==="bottom"||v.value==="right"?1:-1;L({draggedDistance:q*ee,closeDrawer:B,velocity:se,dismissible:s.value}),t(!0);return}if(v.value==="bottom"||v.value==="right"?q>0:q<0){R(),t(!0);return}if(se>ag){B(),t(!1);return}const ae=Math.min(T.value.$el.getBoundingClientRect().height??0,window.innerHeight);if(j>=ae*d.value){B(),t(!1);return}t(!0),R()}Ge(p,H=>{H&&(x.value=new Date,oe(!0)),i(H)},{immediate:!0}),Ge(o,H=>{H?(p.value=H,m.value=!0):B()},{immediate:!0});function oe(H){const j=document.querySelector("[vaul-drawer-wrapper]");!j||!c.value||(H?(rt(document.body,{background:document.body.style.backgroundColor||document.body.style.background}),rt(document.body,{background:"black"},!0),rt(j,{borderRadius:`${vd}px`,overflow:"hidden",...yt(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:`${We.DURATION}s`,transitionTimingFunction:`cubic-bezier(${We.EASE.join(",")})`})):(_o(j,"overflow"),_o(j,"transform"),_o(j,"borderRadius"),rt(j,{transitionProperty:"transform, border-radius",transitionDuration:`${We.DURATION}s`,transitionTimingFunction:`cubic-bezier(${We.EASE.join(",")})`})))}function ie(H){var j,z;const q=H?(window.innerWidth-bo)/window.innerWidth:1,se=H?-16:0;O.value&&window.clearTimeout(O.value),rt((j=T.value)==null?void 0:j.$el,{transition:`transform ${We.DURATION}s cubic-bezier(${We.EASE.join(",")})`,transform:`scale(${q}) translate3d(0, ${se}px, 0)`}),!H&&(z=T.value)!=null&&z.$el&&(O.value=window.setTimeout(()=>{var ae,ee;const he=xo((ae=T.value)==null?void 0:ae.$el,v.value);rt((ee=T.value)==null?void 0:ee.$el,{transition:"none",transform:yt(v.value)?`translate3d(0, ${he}px, 0)`:`translate3d(${he}px, 0, 0)`})},500))}function S(H){var j;if(H<0)return;const z=yt(v.value)?window.innerHeight:window.innerWidth,q=(z-bo)/z,se=q+H*(1-q),ae=-16+H*bo;rt((j=T.value)==null?void 0:j.$el,{transform:yt(v.value)?`scale(${se}) translate3d(0, ${ae}px, 0)`:`scale(${se}) translate3d(${ae}px, 0, 0)`,transition:"none"})}function Z(H){var j;const z=yt(v.value)?window.innerHeight:window.innerWidth,q=H?(z-bo)/z:1,se=H?-16:0;H&&rt((j=T.value)==null?void 0:j.$el,{transition:`transform ${We.DURATION}s cubic-bezier(${We.EASE.join(",")})`,transform:yt(v.value)?`scale(${q}) translate3d(0, ${se}px, 0)`:`scale(${q}) translate3d(${se}px, 0, 0)`})}return{open:o,isOpen:p,modal:u,keyboardIsOpen:X,hasBeenOpened:m,isVisible:y,drawerRef:T,drawerHeightRef:G,overlayRef:b,isDragging:_,dragStartTime:w,isAllowedToDrag:I,snapPoints:F,activeSnapPoint:h,pointerStart:C,dismissible:s,snapPointsOffset:$,direction:v,shouldFade:N,fadeFromIndex:g,shouldScaleBackground:c,onPress:pe,onDrag:te,onRelease:W,closeDrawer:B,onNestedDrag:S,onNestedRelease:Z,onNestedOpenChange:ie,emitClose:n,emitDrag:e,emitRelease:t,emitOpenChange:i,nested:a}}const tR=De({__name:"DrawerRoot",props:{activeSnapPoint:{default:void 0},closeThreshold:{default:KP},shouldScaleBackground:{type:Boolean,default:void 0},scrollLockTimeout:{default:ZP},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","animationEnd"],setup(r,{expose:e,emit:t}){const n=r,i=t;Md();const o=Ve(()=>n.fadeFromIndex??(n.snapPoints&&n.snapPoints.length-1)),s=gd(n,"open",i,{defaultValue:n.defaultOpen,passive:n.open===void 0}),a=gd(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),setTimeout(()=>{i("animationEnd",g)},We.DURATION*1e3)}},{closeDrawer:u,hasBeenOpened:c,modal:f,isOpen:d}=XP(eR({...l,...Jr(n),activeSnapPoint:a,fadeFromIndex:o,open:s}));function h(g){if(s.value!==void 0){l.emitOpenChange(g);return}g?(c.value=!0,d.value=g):u()}return e({open:d}),(g,v)=>(de(),lt(K(_P),{open:K(d),modal:K(f),"onUpdate:open":h},{default:Ue(()=>[ut(g.$slots,"default",{open:K(d)})]),_:3},8,["open","modal"]))}}),nR=De({__name:"DrawerOverlay",setup(r){const{overlayRef:e,snapPoints:t,isVisible:n,isOpen:i,shouldFade:o}=og(),s=Ve(()=>{var a;return t&&(((a=t.value)==null?void 0:a.length)??0)>0});return(a,l)=>(de(),lt(K(jP),{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"]))}}),rR=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:d,closeDrawer:h,direction:g}=og(),v=Ve(()=>i.value&&i.value.length>0?`${i.value[0]}px`:"0");function p(m){if(!u.value||m.defaultPrevented){m.preventDefault();return}d.value&&(d.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)=>(de(),lt(K(UP),{ref_key:"drawerRef",ref:o,"vaul-drawer":"","vaul-drawer-direction":K(g),"vaul-drawer-visible":K(n)?"true":"false",style:Zr({"--snap-point-height":v.value}),onPointerdown:K(s),onPointermove:K(a),onPointerup:K(l),onPointerDownOutside:p,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"]))}}),iR={py:"1",flex:"~ col",rounded:"lg","overflow-hidden":""},oR={key:0,flex:"",mr:"12"},sR={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 {en().then(()=>{n.update(),i.value=n.height.value})}),a(async()=>{en().then(()=>{n.update(),i.value=n.height.value})}),(l,u)=>{const c=Hd("auto-animate");return de(),xe("div",iR,[u[1]||(u[1]=Y("div",{"flex-1":""},null,-1)),dt((de(),xe("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)),(de(!0),xe(zn,null,vr(K(t),(f,d)=>(de(),xe("div",{key:d,"mb-2":""},[f.role==="assistant"?(de(),xe("div",oR,[Y("div",sR,[Y("div",null,[Y("span",aR,we(l.$t("stage.chat.message.character-name.airi")),1)]),f.content?(de(),xe("div",{key:0,class:"markdown-content",text:"base y.id===p.value);if(!m){a.value=void 0;return}a.value=m}function h(v){const p=v.target;n.stageView=p.value}function g(v){const p=v.target.value;switch(t.value){case"en":case"en-US":c.value=p;break;case"zh":case"zh-CN":case"zh-TW":case"zh-HK":c.value=p;break;case"jp":case"jp-JP":f.value=p;break}}return Ge([l,u],async([v,p])=>{if(!v||!p){o.value=[];return}o.value=await s(v,p)}),$t(async()=>{!l.value||!u.value||(o.value=await s(l.value,u.value))}),(v,p)=>(de(),xe("div",null,[Y("h2",gR,we(K(e)("settings.title")),1),Y("div",null,[Y("div",vR,[Y("div",yR,[Y("span",null,we(K(e)("settings.openai-base-url.label")),1)]),Y("div",_R,[dt(Y("input",{"onUpdate:modelValue":p[0]||(p[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,xR),[[jr,K(n).openAiApiBaseURL]])]),Y("div",bR,[Y("span",null,we(K(e)("settings.openai-api-key.label")),1)]),Y("div",wR,[dt(Y("input",{"onUpdate:modelValue":p[1]||(p[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,TR),[[jr,K(n).openAiApiKey]])]),Y("div",SR,[Y("span",null,we(K(e)("settings.elevenlabs-api-key.label")),1)]),Y("div",ER,[dt(Y("input",{"onUpdate:modelValue":p[2]||(p[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,CR),[[jr,K(n).elevenLabsApiKey]])]),Y("div",AR,[Y("span",null,we(K(e)("settings.language.title")),1)]),Y("div",IR,[dt(Y("select",{"onUpdate:modelValue":p[3]||(p[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",MR,we(K(e)("settings.language.english")),1),Y("option",kR,we(K(e)("settings.language.chinese")),1)],512),[[jd,K(n).language]])]),Y("div",PR,[Y("span",null,we(K(e)("settings.models")),1)]),Y("div",RR,[Y("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:d},[Y("option",OR,we(K(e)("stage.select-a-model")),1),K(n).openAiModel?(de(),xe("option",{key:0,value:K(n).openAiModel.id},we("name"in K(n).openAiModel?`${K(n).openAiModel.name} (${K(n).openAiModel.id})`:K(n).openAiModel.id),9,FR)):tt("",!0),(de(!0),xe(zn,null,vr(o.value,m=>(de(),xe("option",{key:m.id,value:m.id},we("name"in m?`${m.name} (${m.id})`:m.id),9,LR))),128))],32)]),Y("div",NR,[Y("span",null,we(K(e)("settings.voices")),1)]),Y("div",DR,[Y("select",{"h-8":"","w-full":"","rounded-md":"","bg-transparent":"","px-2":"","py-1":"","text-right":"","font-mono":"","outline-none":"",onChange:g},[Y("option",BR,we(K(e)("stage.select-a-voice")),1),["en","en-US"].indexOf(K(t))!==-1&&K(c)?(de(),xe("option",{key:0,value:K(c)},we(K(c)),9,UR)):tt("",!0),["zh","zh-CN","zh-TW","zh-HK"].indexOf(K(t))!==-1&&K(c)?(de(),xe("option",{key:1,value:K(c)},we(K(c)),9,zR)):tt("",!0),["jp","jp-JP"].indexOf(K(t))!==-1&&K(f)?(de(),xe("option",{key:2,value:K(f)},we(K(f)),9,jR)):tt("",!0),(de(!0),xe(zn,null,vr(K(Vd)[K(t)],(m,y)=>(de(),xe("option",{key:y,value:m},we(m),9,VR))),128))],32)])])]),p[8]||(p[8]=Y("h2",{text:"slate-800/80 dark:slate-200/80 xl","font-bold":""}," View ",-1)),Y("div",null,[Y("div",GR,[p[6]||(p[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},p[5]||(p[5]=[Y("option",{value:"2d"}," 2D ",-1),Y("option",{value:"3d"}," 3D ",-1)]),32),p[7]||(p[7]=Y("div",{text:"sm pink-500"},[Y("span",null,"Theme")],-1)),Y("label",$R,[dt(Y("input",{"onUpdate:modelValue":p[4]||(p[4]=m=>du(i)?i.value=m:null),checked:K(i),"aria-checked":K(i),name:"stageView",type:"checkbox",hidden:"","appearance-none":"","outline-none":""},null,8,HR),[[Kr,K(i)]]),Y("div",XR,[Fe(Zo,{name:"slide-away",mode:"out-in"},{default:Ue(()=>[K(i)?(de(),xe("div",WR)):(de(),xe("div",qR))]),_:1})])])])])]))}}),KR={relative:"","w-full":"",flex:"","gap-1":""},ZR={flex:"","flex-1":""},JR={class:"flex flex-1 flex-col rounded-t-lg p-5",bg:"[#fffbff] dark:[#1f1a1d]","gap-2":""},QR=De({__name:"MobileInteractiveArea",setup(r){const e=le(""),t=le(!1),{isAudioInputOn:n,selectedAudioDeviceId:i}=En(ei()),{send:o,onAfterSend:s}=_r(),{t:a}=Qr();async function l(){e.value.trim()&&await o(e.value)}const{destroy:u,start:c}=qm(i,{onSpeechStart:()=>{t.value=!0},onVADMisfire:()=>{t.value=!1},onSpeechEnd:d=>{t.value=!1,f()},auto:!1});function f(d){alert("Transcription is not implemented yet")}return Ge(n,async d=>{d==="false"&&u()}),s(async()=>{e.value=""}),$t(()=>{c()}),(d,h)=>(de(),xe("div",null,[Y("div",KR,[Fe(mR,{absolute:"","left-0":"","top-0":"",transform:"translate-y-[-100%]","w-full":""}),Y("div",ZR,[Fe(K(Fv),{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"])]),Fe(K(tR),{"should-scale-background":""},{default:Ue(()=>[Fe(K(xP),{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}),Fe(K(wP),null,{default:Ue(()=>[Fe(K(nR),{class:"fixed inset-0 z-50 bg-black/40"}),Fe(K(rR),{"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",JR,[Fe(YR)])]),_:1})]),_:1})]),_:1})])]))}}),eO={relative:"","max-h":"[100vh]","max-w":"[100vw]",p:"2",flex:"~ col","z-2":"","h-full":"","overflow-hidden":""},tO={flex:"~ 1 row (de(),lt(rM,{"h-full":"","w-full":""},{default:Ue(()=>[Fe(aM,{"h-full":"","w-full":"","fill-color":K(e)?"#563544":"#f8e8f2"},{default:Ue(()=>[Y("div",eO,[Fe(YM,{class:"flex