diff --git a/assets/howler-cc775aca.js b/assets/howler-5a5bbb27.js similarity index 99% rename from assets/howler-cc775aca.js rename to assets/howler-5a5bbb27.js index dd7473f0..5240d4bb 100644 --- a/assets/howler-cc775aca.js +++ b/assets/howler-5a5bbb27.js @@ -1,4 +1,4 @@ -import{g as L,c as S}from"./index-9d31aa10.js";function D(b,g){for(var r=0;ru[i]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var O={};/*! +import{g as L,c as S}from"./index-bf91fa46.js";function D(b,g){for(var r=0;ru[i]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var O={};/*! * howler.js v2.2.4 * howlerjs.com * diff --git a/assets/index-9d31aa10.js b/assets/index-bf91fa46.js similarity index 62% rename from assets/index-9d31aa10.js rename to assets/index-bf91fa46.js index c0fe8cce..8402c3ce 100644 --- a/assets/index-9d31aa10.js +++ b/assets/index-bf91fa46.js @@ -1,4 +1,4 @@ -var bW=Object.defineProperty;var EW=(n,e,t)=>e in n?bW(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var jt=(n,e,t)=>(EW(n,typeof e!="symbol"?e+"":e,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var Pa=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ic(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function BW(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var D4={exports:{}},Sx={},N4={exports:{}},Pt={};/** +var BW=Object.defineProperty;var SW=(n,e,t)=>e in n?BW(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var jt=(n,e,t)=>(SW(n,typeof e!="symbol"?e+"":e,t),t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function t(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=t(i);fetch(i.href,s)}})();var La=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function oc(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function MW(n){if(n.__esModule)return n;var e=n.default;if(typeof e=="function"){var t=function r(){return this instanceof r?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(n).forEach(function(r){var i=Object.getOwnPropertyDescriptor(n,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return n[r]}})}),t}var O4={exports:{}},Cx={},k4={exports:{}},Pt={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var bW=Object.defineProperty;var EW=(n,e,t)=>e in n?bW(n,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var r0=Symbol.for("react.element"),SW=Symbol.for("react.portal"),MW=Symbol.for("react.fragment"),CW=Symbol.for("react.strict_mode"),TW=Symbol.for("react.profiler"),IW=Symbol.for("react.provider"),RW=Symbol.for("react.context"),UW=Symbol.for("react.forward_ref"),FW=Symbol.for("react.suspense"),PW=Symbol.for("react.memo"),LW=Symbol.for("react.lazy"),wU=Symbol.iterator;function DW(n){return n===null||typeof n!="object"?null:(n=wU&&n[wU]||n["@@iterator"],typeof n=="function"?n:null)}var O4={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k4=Object.assign,H4={};function Nd(n,e,t){this.props=n,this.context=e,this.refs=H4,this.updater=t||O4}Nd.prototype.isReactComponent={};Nd.prototype.setState=function(n,e){if(typeof n!="object"&&typeof n!="function"&&n!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,n,e,"setState")};Nd.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function Q4(){}Q4.prototype=Nd.prototype;function qT(n,e,t){this.props=n,this.context=e,this.refs=H4,this.updater=t||O4}var JT=qT.prototype=new Q4;JT.constructor=qT;k4(JT,Nd.prototype);JT.isPureReactComponent=!0;var _U=Array.isArray,z4=Object.prototype.hasOwnProperty,eI={current:null},G4={key:!0,ref:!0,__self:!0,__source:!0};function V4(n,e,t){var r,i={},s=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(s=""+e.key),e)z4.call(e,r)&&!G4.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1e in n?bW(n,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var QW=xe,zW=Symbol.for("react.element"),GW=Symbol.for("react.fragment"),VW=Object.prototype.hasOwnProperty,jW=QW.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,WW={key:!0,ref:!0,__self:!0,__source:!0};function W4(n,e,t){var r,i={},s=null,o=null;t!==void 0&&(s=""+t),e.key!==void 0&&(s=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)VW.call(e,r)&&!WW.hasOwnProperty(r)&&(i[r]=e[r]);if(n&&n.defaultProps)for(r in e=n.defaultProps,e)i[r]===void 0&&(i[r]=e[r]);return{$$typeof:zW,type:n,key:s,ref:o,props:i,_owner:jW.current}}Sx.Fragment=GW;Sx.jsx=W4;Sx.jsxs=W4;D4.exports=Sx;var Q=D4.exports,nI={exports:{}};const KW={},XW=Object.freeze(Object.defineProperty({__proto__:null,default:KW},Symbol.toStringTag,{value:"Module"})),YW=BW(XW);nI.exports;(function(n){(function(e,t){function r(T,y){if(!T)throw new Error(y||"Assertion failed")}function i(T,y){T.super_=y;var E=function(){};E.prototype=y.prototype,T.prototype=new E,T.prototype.constructor=T}function s(T,y,E){if(s.isBN(T))return T;this.negative=0,this.words=null,this.length=0,this.red=null,T!==null&&((y==="le"||y==="be")&&(E=y,y=10),this._init(T||0,y||10,E||"be"))}typeof e=="object"?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=YW.Buffer}catch{}s.isBN=function(y){return y instanceof s?!0:y!==null&&typeof y=="object"&&y.constructor.wordSize===s.wordSize&&Array.isArray(y.words)},s.max=function(y,E){return y.cmp(E)>0?y:E},s.min=function(y,E){return y.cmp(E)<0?y:E},s.prototype._init=function(y,E,U){if(typeof y=="number")return this._initNumber(y,E,U);if(typeof y=="object")return this._initArray(y,E,U);E==="hex"&&(E=16),r(E===(E|0)&&E>=2&&E<=36),y=y.toString().replace(/\s+/g,"");var P=0;y[0]==="-"&&(P++,this.negative=1),P=0;P-=3)z=y[P]|y[P-1]<<8|y[P-2]<<16,this.words[N]|=z<>>26-W&67108863,W+=24,W>=26&&(W-=26,N++);else if(U==="le")for(P=0,N=0;P>>26-W&67108863,W+=24,W>=26&&(W-=26,N++);return this._strip()};function a(T,y){var E=T.charCodeAt(y);if(E>=48&&E<=57)return E-48;if(E>=65&&E<=70)return E-55;if(E>=97&&E<=102)return E-87;r(!1,"Invalid character in "+T)}function l(T,y,E){var U=a(T,E);return E-1>=y&&(U|=a(T,E-1)<<4),U}s.prototype._parseHex=function(y,E,U){this.length=Math.ceil((y.length-E)/6),this.words=new Array(this.length);for(var P=0;P=E;P-=2)W=l(y,E,P)<=18?(N-=18,z+=1,this.words[z]|=W>>>26):N+=8;else{var H=y.length-E;for(P=H%2===0?E+1:E;P=18?(N-=18,z+=1,this.words[z]|=W>>>26):N+=8}this._strip()};function c(T,y,E,U){for(var P=0,N=0,z=Math.min(T.length,E),W=y;W=49?N=H-49+10:H>=17?N=H-17+10:N=H,r(H>=0&&N1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(y,E){y=y||10,E=E|0||1;var U;if(y===16||y==="hex"){U="";for(var P=0,N=0,z=0;z>>24-P&16777215,P+=2,P>=26&&(P-=26,z--),N!==0||z!==this.length-1?U=f[6-H.length]+H+U:U=H+U}for(N!==0&&(U=N.toString(16)+U);U.length%E!==0;)U="0"+U;return this.negative!==0&&(U="-"+U),U}if(y===(y|0)&&y>=2&&y<=36){var C=h[y],K=d[y];U="";var te=this.clone();for(te.negative=0;!te.isZero();){var F=te.modrn(K).toString(y);te=te.idivn(K),te.isZero()?U=F+U:U=f[C-F.length]+F+U}for(this.isZero()&&(U="0"+U);U.length%E!==0;)U="0"+U;return this.negative!==0&&(U="-"+U),U}r(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var y=this.words[0];return this.length===2?y+=this.words[1]*67108864:this.length===3&&this.words[2]===1?y+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-y:y},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(y,E){return this.toArrayLike(o,y,E)}),s.prototype.toArray=function(y,E){return this.toArrayLike(Array,y,E)};var m=function(y,E){return y.allocUnsafe?y.allocUnsafe(E):new y(E)};s.prototype.toArrayLike=function(y,E,U){this._strip();var P=this.byteLength(),N=U||Math.max(1,P);r(P<=N,"byte array longer than desired length"),r(N>0,"Requested array length <= 0");var z=m(y,N),W=E==="le"?"LE":"BE";return this["_toArrayLike"+W](z,P),z},s.prototype._toArrayLikeLE=function(y,E){for(var U=0,P=0,N=0,z=0;N>8&255),U>16&255),z===6?(U>24&255),P=0,z=0):(P=W>>>24,z+=2)}if(U=0&&(y[U--]=W>>8&255),U>=0&&(y[U--]=W>>16&255),z===6?(U>=0&&(y[U--]=W>>24&255),P=0,z=0):(P=W>>>24,z+=2)}if(U>=0)for(y[U--]=P;U>=0;)y[U--]=0},Math.clz32?s.prototype._countBits=function(y){return 32-Math.clz32(y)}:s.prototype._countBits=function(y){var E=y,U=0;return E>=4096&&(U+=13,E>>>=13),E>=64&&(U+=7,E>>>=7),E>=8&&(U+=4,E>>>=4),E>=2&&(U+=2,E>>>=2),U+E},s.prototype._zeroBits=function(y){if(y===0)return 26;var E=y,U=0;return E&8191||(U+=13,E>>>=13),E&127||(U+=7,E>>>=7),E&15||(U+=4,E>>>=4),E&3||(U+=2,E>>>=2),E&1||U++,U},s.prototype.bitLength=function(){var y=this.words[this.length-1],E=this._countBits(y);return(this.length-1)*26+E};function g(T){for(var y=new Array(T.bitLength()),E=0;E>>P&1}return y}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var y=0,E=0;Ey.length?this.clone().ior(y):y.clone().ior(this)},s.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},s.prototype.iuand=function(y){var E;this.length>y.length?E=y:E=this;for(var U=0;Uy.length?this.clone().iand(y):y.clone().iand(this)},s.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},s.prototype.iuxor=function(y){var E,U;this.length>y.length?(E=this,U=y):(E=y,U=this);for(var P=0;Py.length?this.clone().ixor(y):y.clone().ixor(this)},s.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},s.prototype.inotn=function(y){r(typeof y=="number"&&y>=0);var E=Math.ceil(y/26)|0,U=y%26;this._expand(E),U>0&&E--;for(var P=0;P0&&(this.words[P]=~this.words[P]&67108863>>26-U),this._strip()},s.prototype.notn=function(y){return this.clone().inotn(y)},s.prototype.setn=function(y,E){r(typeof y=="number"&&y>=0);var U=y/26|0,P=y%26;return this._expand(U+1),E?this.words[U]=this.words[U]|1<y.length?(U=this,P=y):(U=y,P=this);for(var N=0,z=0;z>>26;for(;N!==0&&z>>26;if(this.length=U.length,N!==0)this.words[this.length]=N,this.length++;else if(U!==this)for(;zy.length?this.clone().iadd(y):y.clone().iadd(this)},s.prototype.isub=function(y){if(y.negative!==0){y.negative=0;var E=this.iadd(y);return y.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var U=this.cmp(y);if(U===0)return this.negative=0,this.length=1,this.words[0]=0,this;var P,N;U>0?(P=this,N=y):(P=y,N=this);for(var z=0,W=0;W>26,this.words[W]=E&67108863;for(;z!==0&&W>26,this.words[W]=E&67108863;if(z===0&&W>>26,te=H&67108863,F=Math.min(C,y.length-1),re=Math.max(0,C-T.length+1);re<=F;re++){var ce=C-re|0;P=T.words[ce]|0,N=y.words[re]|0,z=P*N+te,K+=z/67108864|0,te=z&67108863}E.words[C]=te|0,H=K|0}return H!==0?E.words[C]=H|0:E.length--,E._strip()}var v=function(y,E,U){var P=y.words,N=E.words,z=U.words,W=0,H,C,K,te=P[0]|0,F=te&8191,re=te>>>13,ce=P[1]|0,oe=ce&8191,ge=ce>>>13,me=P[2]|0,ve=me&8191,be=me>>>13,ne=P[3]|0,k=ne&8191,ae=ne>>>13,le=P[4]|0,Z=le&8191,J=le>>>13,ue=P[5]|0,Y=ue&8191,G=ue>>>13,j=P[6]|0,se=j&8191,fe=j>>>13,he=P[7]|0,Be=he&8191,V=he>>>13,R=P[8]|0,D=R&8191,X=R>>>13,ie=P[9]|0,pe=ie&8191,de=ie>>>13,Ie=N[0]|0,Le=Ie&8191,Ue=Ie>>>13,Ye=N[1]|0,Ae=Ye&8191,Fe=Ye>>>13,Me=N[2]|0,Ce=Me&8191,Re=Me>>>13,Oe=N[3]|0,$e=Oe&8191,dt=Oe>>>13,Fn=N[4]|0,nt=Fn&8191,_t=Fn>>>13,Cr=N[5]|0,en=Cr&8191,qt=Cr>>>13,$r=N[6]|0,Jt=$r&8191,tn=$r>>>13,js=N[7]|0,Kt=js&8191,Xt=js>>>13,Ci=N[8]|0,nn=Ci&8191,rn=Ci>>>13,ua=N[9]|0,An=ua&8191,sn=ua>>>13;U.negative=y.negative^E.negative,U.length=19,H=Math.imul(F,Le),C=Math.imul(F,Ue),C=C+Math.imul(re,Le)|0,K=Math.imul(re,Ue);var ee=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(ee>>>26)|0,ee&=67108863,H=Math.imul(oe,Le),C=Math.imul(oe,Ue),C=C+Math.imul(ge,Le)|0,K=Math.imul(ge,Ue),H=H+Math.imul(F,Ae)|0,C=C+Math.imul(F,Fe)|0,C=C+Math.imul(re,Ae)|0,K=K+Math.imul(re,Fe)|0;var ye=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(ye>>>26)|0,ye&=67108863,H=Math.imul(ve,Le),C=Math.imul(ve,Ue),C=C+Math.imul(be,Le)|0,K=Math.imul(be,Ue),H=H+Math.imul(oe,Ae)|0,C=C+Math.imul(oe,Fe)|0,C=C+Math.imul(ge,Ae)|0,K=K+Math.imul(ge,Fe)|0,H=H+Math.imul(F,Ce)|0,C=C+Math.imul(F,Re)|0,C=C+Math.imul(re,Ce)|0,K=K+Math.imul(re,Re)|0;var Ee=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,H=Math.imul(k,Le),C=Math.imul(k,Ue),C=C+Math.imul(ae,Le)|0,K=Math.imul(ae,Ue),H=H+Math.imul(ve,Ae)|0,C=C+Math.imul(ve,Fe)|0,C=C+Math.imul(be,Ae)|0,K=K+Math.imul(be,Fe)|0,H=H+Math.imul(oe,Ce)|0,C=C+Math.imul(oe,Re)|0,C=C+Math.imul(ge,Ce)|0,K=K+Math.imul(ge,Re)|0,H=H+Math.imul(F,$e)|0,C=C+Math.imul(F,dt)|0,C=C+Math.imul(re,$e)|0,K=K+Math.imul(re,dt)|0;var Se=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Se>>>26)|0,Se&=67108863,H=Math.imul(Z,Le),C=Math.imul(Z,Ue),C=C+Math.imul(J,Le)|0,K=Math.imul(J,Ue),H=H+Math.imul(k,Ae)|0,C=C+Math.imul(k,Fe)|0,C=C+Math.imul(ae,Ae)|0,K=K+Math.imul(ae,Fe)|0,H=H+Math.imul(ve,Ce)|0,C=C+Math.imul(ve,Re)|0,C=C+Math.imul(be,Ce)|0,K=K+Math.imul(be,Re)|0,H=H+Math.imul(oe,$e)|0,C=C+Math.imul(oe,dt)|0,C=C+Math.imul(ge,$e)|0,K=K+Math.imul(ge,dt)|0,H=H+Math.imul(F,nt)|0,C=C+Math.imul(F,_t)|0,C=C+Math.imul(re,nt)|0,K=K+Math.imul(re,_t)|0;var we=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(we>>>26)|0,we&=67108863,H=Math.imul(Y,Le),C=Math.imul(Y,Ue),C=C+Math.imul(G,Le)|0,K=Math.imul(G,Ue),H=H+Math.imul(Z,Ae)|0,C=C+Math.imul(Z,Fe)|0,C=C+Math.imul(J,Ae)|0,K=K+Math.imul(J,Fe)|0,H=H+Math.imul(k,Ce)|0,C=C+Math.imul(k,Re)|0,C=C+Math.imul(ae,Ce)|0,K=K+Math.imul(ae,Re)|0,H=H+Math.imul(ve,$e)|0,C=C+Math.imul(ve,dt)|0,C=C+Math.imul(be,$e)|0,K=K+Math.imul(be,dt)|0,H=H+Math.imul(oe,nt)|0,C=C+Math.imul(oe,_t)|0,C=C+Math.imul(ge,nt)|0,K=K+Math.imul(ge,_t)|0,H=H+Math.imul(F,en)|0,C=C+Math.imul(F,qt)|0,C=C+Math.imul(re,en)|0,K=K+Math.imul(re,qt)|0;var Ne=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,H=Math.imul(se,Le),C=Math.imul(se,Ue),C=C+Math.imul(fe,Le)|0,K=Math.imul(fe,Ue),H=H+Math.imul(Y,Ae)|0,C=C+Math.imul(Y,Fe)|0,C=C+Math.imul(G,Ae)|0,K=K+Math.imul(G,Fe)|0,H=H+Math.imul(Z,Ce)|0,C=C+Math.imul(Z,Re)|0,C=C+Math.imul(J,Ce)|0,K=K+Math.imul(J,Re)|0,H=H+Math.imul(k,$e)|0,C=C+Math.imul(k,dt)|0,C=C+Math.imul(ae,$e)|0,K=K+Math.imul(ae,dt)|0,H=H+Math.imul(ve,nt)|0,C=C+Math.imul(ve,_t)|0,C=C+Math.imul(be,nt)|0,K=K+Math.imul(be,_t)|0,H=H+Math.imul(oe,en)|0,C=C+Math.imul(oe,qt)|0,C=C+Math.imul(ge,en)|0,K=K+Math.imul(ge,qt)|0,H=H+Math.imul(F,Jt)|0,C=C+Math.imul(F,tn)|0,C=C+Math.imul(re,Jt)|0,K=K+Math.imul(re,tn)|0;var Ke=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,H=Math.imul(Be,Le),C=Math.imul(Be,Ue),C=C+Math.imul(V,Le)|0,K=Math.imul(V,Ue),H=H+Math.imul(se,Ae)|0,C=C+Math.imul(se,Fe)|0,C=C+Math.imul(fe,Ae)|0,K=K+Math.imul(fe,Fe)|0,H=H+Math.imul(Y,Ce)|0,C=C+Math.imul(Y,Re)|0,C=C+Math.imul(G,Ce)|0,K=K+Math.imul(G,Re)|0,H=H+Math.imul(Z,$e)|0,C=C+Math.imul(Z,dt)|0,C=C+Math.imul(J,$e)|0,K=K+Math.imul(J,dt)|0,H=H+Math.imul(k,nt)|0,C=C+Math.imul(k,_t)|0,C=C+Math.imul(ae,nt)|0,K=K+Math.imul(ae,_t)|0,H=H+Math.imul(ve,en)|0,C=C+Math.imul(ve,qt)|0,C=C+Math.imul(be,en)|0,K=K+Math.imul(be,qt)|0,H=H+Math.imul(oe,Jt)|0,C=C+Math.imul(oe,tn)|0,C=C+Math.imul(ge,Jt)|0,K=K+Math.imul(ge,tn)|0,H=H+Math.imul(F,Kt)|0,C=C+Math.imul(F,Xt)|0,C=C+Math.imul(re,Kt)|0,K=K+Math.imul(re,Xt)|0;var qe=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(qe>>>26)|0,qe&=67108863,H=Math.imul(D,Le),C=Math.imul(D,Ue),C=C+Math.imul(X,Le)|0,K=Math.imul(X,Ue),H=H+Math.imul(Be,Ae)|0,C=C+Math.imul(Be,Fe)|0,C=C+Math.imul(V,Ae)|0,K=K+Math.imul(V,Fe)|0,H=H+Math.imul(se,Ce)|0,C=C+Math.imul(se,Re)|0,C=C+Math.imul(fe,Ce)|0,K=K+Math.imul(fe,Re)|0,H=H+Math.imul(Y,$e)|0,C=C+Math.imul(Y,dt)|0,C=C+Math.imul(G,$e)|0,K=K+Math.imul(G,dt)|0,H=H+Math.imul(Z,nt)|0,C=C+Math.imul(Z,_t)|0,C=C+Math.imul(J,nt)|0,K=K+Math.imul(J,_t)|0,H=H+Math.imul(k,en)|0,C=C+Math.imul(k,qt)|0,C=C+Math.imul(ae,en)|0,K=K+Math.imul(ae,qt)|0,H=H+Math.imul(ve,Jt)|0,C=C+Math.imul(ve,tn)|0,C=C+Math.imul(be,Jt)|0,K=K+Math.imul(be,tn)|0,H=H+Math.imul(oe,Kt)|0,C=C+Math.imul(oe,Xt)|0,C=C+Math.imul(ge,Kt)|0,K=K+Math.imul(ge,Xt)|0,H=H+Math.imul(F,nn)|0,C=C+Math.imul(F,rn)|0,C=C+Math.imul(re,nn)|0,K=K+Math.imul(re,rn)|0;var et=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(et>>>26)|0,et&=67108863,H=Math.imul(pe,Le),C=Math.imul(pe,Ue),C=C+Math.imul(de,Le)|0,K=Math.imul(de,Ue),H=H+Math.imul(D,Ae)|0,C=C+Math.imul(D,Fe)|0,C=C+Math.imul(X,Ae)|0,K=K+Math.imul(X,Fe)|0,H=H+Math.imul(Be,Ce)|0,C=C+Math.imul(Be,Re)|0,C=C+Math.imul(V,Ce)|0,K=K+Math.imul(V,Re)|0,H=H+Math.imul(se,$e)|0,C=C+Math.imul(se,dt)|0,C=C+Math.imul(fe,$e)|0,K=K+Math.imul(fe,dt)|0,H=H+Math.imul(Y,nt)|0,C=C+Math.imul(Y,_t)|0,C=C+Math.imul(G,nt)|0,K=K+Math.imul(G,_t)|0,H=H+Math.imul(Z,en)|0,C=C+Math.imul(Z,qt)|0,C=C+Math.imul(J,en)|0,K=K+Math.imul(J,qt)|0,H=H+Math.imul(k,Jt)|0,C=C+Math.imul(k,tn)|0,C=C+Math.imul(ae,Jt)|0,K=K+Math.imul(ae,tn)|0,H=H+Math.imul(ve,Kt)|0,C=C+Math.imul(ve,Xt)|0,C=C+Math.imul(be,Kt)|0,K=K+Math.imul(be,Xt)|0,H=H+Math.imul(oe,nn)|0,C=C+Math.imul(oe,rn)|0,C=C+Math.imul(ge,nn)|0,K=K+Math.imul(ge,rn)|0,H=H+Math.imul(F,An)|0,C=C+Math.imul(F,sn)|0,C=C+Math.imul(re,An)|0,K=K+Math.imul(re,sn)|0;var ct=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(ct>>>26)|0,ct&=67108863,H=Math.imul(pe,Ae),C=Math.imul(pe,Fe),C=C+Math.imul(de,Ae)|0,K=Math.imul(de,Fe),H=H+Math.imul(D,Ce)|0,C=C+Math.imul(D,Re)|0,C=C+Math.imul(X,Ce)|0,K=K+Math.imul(X,Re)|0,H=H+Math.imul(Be,$e)|0,C=C+Math.imul(Be,dt)|0,C=C+Math.imul(V,$e)|0,K=K+Math.imul(V,dt)|0,H=H+Math.imul(se,nt)|0,C=C+Math.imul(se,_t)|0,C=C+Math.imul(fe,nt)|0,K=K+Math.imul(fe,_t)|0,H=H+Math.imul(Y,en)|0,C=C+Math.imul(Y,qt)|0,C=C+Math.imul(G,en)|0,K=K+Math.imul(G,qt)|0,H=H+Math.imul(Z,Jt)|0,C=C+Math.imul(Z,tn)|0,C=C+Math.imul(J,Jt)|0,K=K+Math.imul(J,tn)|0,H=H+Math.imul(k,Kt)|0,C=C+Math.imul(k,Xt)|0,C=C+Math.imul(ae,Kt)|0,K=K+Math.imul(ae,Xt)|0,H=H+Math.imul(ve,nn)|0,C=C+Math.imul(ve,rn)|0,C=C+Math.imul(be,nn)|0,K=K+Math.imul(be,rn)|0,H=H+Math.imul(oe,An)|0,C=C+Math.imul(oe,sn)|0,C=C+Math.imul(ge,An)|0,K=K+Math.imul(ge,sn)|0;var ht=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(ht>>>26)|0,ht&=67108863,H=Math.imul(pe,Ce),C=Math.imul(pe,Re),C=C+Math.imul(de,Ce)|0,K=Math.imul(de,Re),H=H+Math.imul(D,$e)|0,C=C+Math.imul(D,dt)|0,C=C+Math.imul(X,$e)|0,K=K+Math.imul(X,dt)|0,H=H+Math.imul(Be,nt)|0,C=C+Math.imul(Be,_t)|0,C=C+Math.imul(V,nt)|0,K=K+Math.imul(V,_t)|0,H=H+Math.imul(se,en)|0,C=C+Math.imul(se,qt)|0,C=C+Math.imul(fe,en)|0,K=K+Math.imul(fe,qt)|0,H=H+Math.imul(Y,Jt)|0,C=C+Math.imul(Y,tn)|0,C=C+Math.imul(G,Jt)|0,K=K+Math.imul(G,tn)|0,H=H+Math.imul(Z,Kt)|0,C=C+Math.imul(Z,Xt)|0,C=C+Math.imul(J,Kt)|0,K=K+Math.imul(J,Xt)|0,H=H+Math.imul(k,nn)|0,C=C+Math.imul(k,rn)|0,C=C+Math.imul(ae,nn)|0,K=K+Math.imul(ae,rn)|0,H=H+Math.imul(ve,An)|0,C=C+Math.imul(ve,sn)|0,C=C+Math.imul(be,An)|0,K=K+Math.imul(be,sn)|0;var it=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(it>>>26)|0,it&=67108863,H=Math.imul(pe,$e),C=Math.imul(pe,dt),C=C+Math.imul(de,$e)|0,K=Math.imul(de,dt),H=H+Math.imul(D,nt)|0,C=C+Math.imul(D,_t)|0,C=C+Math.imul(X,nt)|0,K=K+Math.imul(X,_t)|0,H=H+Math.imul(Be,en)|0,C=C+Math.imul(Be,qt)|0,C=C+Math.imul(V,en)|0,K=K+Math.imul(V,qt)|0,H=H+Math.imul(se,Jt)|0,C=C+Math.imul(se,tn)|0,C=C+Math.imul(fe,Jt)|0,K=K+Math.imul(fe,tn)|0,H=H+Math.imul(Y,Kt)|0,C=C+Math.imul(Y,Xt)|0,C=C+Math.imul(G,Kt)|0,K=K+Math.imul(G,Xt)|0,H=H+Math.imul(Z,nn)|0,C=C+Math.imul(Z,rn)|0,C=C+Math.imul(J,nn)|0,K=K+Math.imul(J,rn)|0,H=H+Math.imul(k,An)|0,C=C+Math.imul(k,sn)|0,C=C+Math.imul(ae,An)|0,K=K+Math.imul(ae,sn)|0;var Vt=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,H=Math.imul(pe,nt),C=Math.imul(pe,_t),C=C+Math.imul(de,nt)|0,K=Math.imul(de,_t),H=H+Math.imul(D,en)|0,C=C+Math.imul(D,qt)|0,C=C+Math.imul(X,en)|0,K=K+Math.imul(X,qt)|0,H=H+Math.imul(Be,Jt)|0,C=C+Math.imul(Be,tn)|0,C=C+Math.imul(V,Jt)|0,K=K+Math.imul(V,tn)|0,H=H+Math.imul(se,Kt)|0,C=C+Math.imul(se,Xt)|0,C=C+Math.imul(fe,Kt)|0,K=K+Math.imul(fe,Xt)|0,H=H+Math.imul(Y,nn)|0,C=C+Math.imul(Y,rn)|0,C=C+Math.imul(G,nn)|0,K=K+Math.imul(G,rn)|0,H=H+Math.imul(Z,An)|0,C=C+Math.imul(Z,sn)|0,C=C+Math.imul(J,An)|0,K=K+Math.imul(J,sn)|0;var un=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(un>>>26)|0,un&=67108863,H=Math.imul(pe,en),C=Math.imul(pe,qt),C=C+Math.imul(de,en)|0,K=Math.imul(de,qt),H=H+Math.imul(D,Jt)|0,C=C+Math.imul(D,tn)|0,C=C+Math.imul(X,Jt)|0,K=K+Math.imul(X,tn)|0,H=H+Math.imul(Be,Kt)|0,C=C+Math.imul(Be,Xt)|0,C=C+Math.imul(V,Kt)|0,K=K+Math.imul(V,Xt)|0,H=H+Math.imul(se,nn)|0,C=C+Math.imul(se,rn)|0,C=C+Math.imul(fe,nn)|0,K=K+Math.imul(fe,rn)|0,H=H+Math.imul(Y,An)|0,C=C+Math.imul(Y,sn)|0,C=C+Math.imul(G,An)|0,K=K+Math.imul(G,sn)|0;var yn=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(yn>>>26)|0,yn&=67108863,H=Math.imul(pe,Jt),C=Math.imul(pe,tn),C=C+Math.imul(de,Jt)|0,K=Math.imul(de,tn),H=H+Math.imul(D,Kt)|0,C=C+Math.imul(D,Xt)|0,C=C+Math.imul(X,Kt)|0,K=K+Math.imul(X,Xt)|0,H=H+Math.imul(Be,nn)|0,C=C+Math.imul(Be,rn)|0,C=C+Math.imul(V,nn)|0,K=K+Math.imul(V,rn)|0,H=H+Math.imul(se,An)|0,C=C+Math.imul(se,sn)|0,C=C+Math.imul(fe,An)|0,K=K+Math.imul(fe,sn)|0;var Zr=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Zr>>>26)|0,Zr&=67108863,H=Math.imul(pe,Kt),C=Math.imul(pe,Xt),C=C+Math.imul(de,Kt)|0,K=Math.imul(de,Xt),H=H+Math.imul(D,nn)|0,C=C+Math.imul(D,rn)|0,C=C+Math.imul(X,nn)|0,K=K+Math.imul(X,rn)|0,H=H+Math.imul(Be,An)|0,C=C+Math.imul(Be,sn)|0,C=C+Math.imul(V,An)|0,K=K+Math.imul(V,sn)|0;var Gt=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,H=Math.imul(pe,nn),C=Math.imul(pe,rn),C=C+Math.imul(de,nn)|0,K=Math.imul(de,rn),H=H+Math.imul(D,An)|0,C=C+Math.imul(D,sn)|0,C=C+Math.imul(X,An)|0,K=K+Math.imul(X,sn)|0;var ot=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(ot>>>26)|0,ot&=67108863,H=Math.imul(pe,An),C=Math.imul(pe,sn),C=C+Math.imul(de,An)|0,K=Math.imul(de,sn);var sr=(W+H|0)+((C&8191)<<13)|0;return W=(K+(C>>>13)|0)+(sr>>>26)|0,sr&=67108863,z[0]=ee,z[1]=ye,z[2]=Ee,z[3]=Se,z[4]=we,z[5]=Ne,z[6]=Ke,z[7]=qe,z[8]=et,z[9]=ct,z[10]=ht,z[11]=it,z[12]=Vt,z[13]=un,z[14]=yn,z[15]=Zr,z[16]=Gt,z[17]=ot,z[18]=sr,W!==0&&(z[19]=W,U.length++),U};Math.imul||(v=p);function w(T,y,E){E.negative=y.negative^T.negative,E.length=T.length+y.length;for(var U=0,P=0,N=0;N>>26)|0,P+=z>>>26,z&=67108863}E.words[N]=W,U=z,z=P}return U!==0?E.words[N]=U:E.length--,E._strip()}function _(T,y,E){return w(T,y,E)}s.prototype.mulTo=function(y,E){var U,P=this.length+y.length;return this.length===10&&y.length===10?U=v(this,y,E):P<63?U=p(this,y,E):P<1024?U=w(this,y,E):U=_(this,y,E),U},s.prototype.mul=function(y){var E=new s(null);return E.words=new Array(this.length+y.length),this.mulTo(y,E)},s.prototype.mulf=function(y){var E=new s(null);return E.words=new Array(this.length+y.length),_(this,y,E)},s.prototype.imul=function(y){return this.clone().mulTo(y,this)},s.prototype.imuln=function(y){var E=y<0;E&&(y=-y),r(typeof y=="number"),r(y<67108864);for(var U=0,P=0;P>=26,U+=N/67108864|0,U+=z>>>26,this.words[P]=z&67108863}return U!==0&&(this.words[P]=U,this.length++),E?this.ineg():this},s.prototype.muln=function(y){return this.clone().imuln(y)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(y){var E=g(y);if(E.length===0)return new s(1);for(var U=this,P=0;P=0);var E=y%26,U=(y-E)/26,P=67108863>>>26-E<<26-E,N;if(E!==0){var z=0;for(N=0;N>>26-E}z&&(this.words[N]=z,this.length++)}if(U!==0){for(N=this.length-1;N>=0;N--)this.words[N+U]=this.words[N];for(N=0;N=0);var P;E?P=(E-E%26)/26:P=0;var N=y%26,z=Math.min((y-N)/26,this.length),W=67108863^67108863>>>N<z)for(this.length-=z,C=0;C=0&&(K!==0||C>=P);C--){var te=this.words[C]|0;this.words[C]=K<<26-N|te>>>N,K=te&W}return H&&K!==0&&(H.words[H.length++]=K),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(y,E,U){return r(this.negative===0),this.iushrn(y,E,U)},s.prototype.shln=function(y){return this.clone().ishln(y)},s.prototype.ushln=function(y){return this.clone().iushln(y)},s.prototype.shrn=function(y){return this.clone().ishrn(y)},s.prototype.ushrn=function(y){return this.clone().iushrn(y)},s.prototype.testn=function(y){r(typeof y=="number"&&y>=0);var E=y%26,U=(y-E)/26,P=1<=0);var E=y%26,U=(y-E)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=U)return this;if(E!==0&&U++,this.length=Math.min(U,this.length),E!==0){var P=67108863^67108863>>>E<=67108864;E++)this.words[E]-=67108864,E===this.length-1?this.words[E+1]=1:this.words[E+1]++;return this.length=Math.max(this.length,E+1),this},s.prototype.isubn=function(y){if(r(typeof y=="number"),r(y<67108864),y<0)return this.iaddn(-y);if(this.negative!==0)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var E=0;E>26)-(H/67108864|0),this.words[N+U]=z&67108863}for(;N>26,this.words[N+U]=z&67108863;if(W===0)return this._strip();for(r(W===-1),W=0,N=0;N>26,this.words[N]=z&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(y,E){var U=this.length-y.length,P=this.clone(),N=y,z=N.words[N.length-1]|0,W=this._countBits(z);U=26-W,U!==0&&(N=N.ushln(U),P.iushln(U),z=N.words[N.length-1]|0);var H=P.length-N.length,C;if(E!=="mod"){C=new s(null),C.length=H+1,C.words=new Array(C.length);for(var K=0;K=0;F--){var re=(P.words[N.length+F]|0)*67108864+(P.words[N.length+F-1]|0);for(re=Math.min(re/z|0,67108863),P._ishlnsubmul(N,re,F);P.negative!==0;)re--,P.negative=0,P._ishlnsubmul(N,1,F),P.isZero()||(P.negative^=1);C&&(C.words[F]=re)}return C&&C._strip(),P._strip(),E!=="div"&&U!==0&&P.iushrn(U),{div:C||null,mod:P}},s.prototype.divmod=function(y,E,U){if(r(!y.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var P,N,z;return this.negative!==0&&y.negative===0?(z=this.neg().divmod(y,E),E!=="mod"&&(P=z.div.neg()),E!=="div"&&(N=z.mod.neg(),U&&N.negative!==0&&N.iadd(y)),{div:P,mod:N}):this.negative===0&&y.negative!==0?(z=this.divmod(y.neg(),E),E!=="mod"&&(P=z.div.neg()),{div:P,mod:z.mod}):this.negative&y.negative?(z=this.neg().divmod(y.neg(),E),E!=="div"&&(N=z.mod.neg(),U&&N.negative!==0&&N.isub(y)),{div:z.div,mod:N}):y.length>this.length||this.cmp(y)<0?{div:new s(0),mod:this}:y.length===1?E==="div"?{div:this.divn(y.words[0]),mod:null}:E==="mod"?{div:null,mod:new s(this.modrn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new s(this.modrn(y.words[0]))}:this._wordDiv(y,E)},s.prototype.div=function(y){return this.divmod(y,"div",!1).div},s.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},s.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},s.prototype.divRound=function(y){var E=this.divmod(y);if(E.mod.isZero())return E.div;var U=E.div.negative!==0?E.mod.isub(y):E.mod,P=y.ushrn(1),N=y.andln(1),z=U.cmp(P);return z<0||N===1&&z===0?E.div:E.div.negative!==0?E.div.isubn(1):E.div.iaddn(1)},s.prototype.modrn=function(y){var E=y<0;E&&(y=-y),r(y<=67108863);for(var U=(1<<26)%y,P=0,N=this.length-1;N>=0;N--)P=(U*P+(this.words[N]|0))%y;return E?-P:P},s.prototype.modn=function(y){return this.modrn(y)},s.prototype.idivn=function(y){var E=y<0;E&&(y=-y),r(y<=67108863);for(var U=0,P=this.length-1;P>=0;P--){var N=(this.words[P]|0)+U*67108864;this.words[P]=N/y|0,U=N%y}return this._strip(),E?this.ineg():this},s.prototype.divn=function(y){return this.clone().idivn(y)},s.prototype.egcd=function(y){r(y.negative===0),r(!y.isZero());var E=this,U=y.clone();E.negative!==0?E=E.umod(y):E=E.clone();for(var P=new s(1),N=new s(0),z=new s(0),W=new s(1),H=0;E.isEven()&&U.isEven();)E.iushrn(1),U.iushrn(1),++H;for(var C=U.clone(),K=E.clone();!E.isZero();){for(var te=0,F=1;!(E.words[0]&F)&&te<26;++te,F<<=1);if(te>0)for(E.iushrn(te);te-- >0;)(P.isOdd()||N.isOdd())&&(P.iadd(C),N.isub(K)),P.iushrn(1),N.iushrn(1);for(var re=0,ce=1;!(U.words[0]&ce)&&re<26;++re,ce<<=1);if(re>0)for(U.iushrn(re);re-- >0;)(z.isOdd()||W.isOdd())&&(z.iadd(C),W.isub(K)),z.iushrn(1),W.iushrn(1);E.cmp(U)>=0?(E.isub(U),P.isub(z),N.isub(W)):(U.isub(E),z.isub(P),W.isub(N))}return{a:z,b:W,gcd:U.iushln(H)}},s.prototype._invmp=function(y){r(y.negative===0),r(!y.isZero());var E=this,U=y.clone();E.negative!==0?E=E.umod(y):E=E.clone();for(var P=new s(1),N=new s(0),z=U.clone();E.cmpn(1)>0&&U.cmpn(1)>0;){for(var W=0,H=1;!(E.words[0]&H)&&W<26;++W,H<<=1);if(W>0)for(E.iushrn(W);W-- >0;)P.isOdd()&&P.iadd(z),P.iushrn(1);for(var C=0,K=1;!(U.words[0]&K)&&C<26;++C,K<<=1);if(C>0)for(U.iushrn(C);C-- >0;)N.isOdd()&&N.iadd(z),N.iushrn(1);E.cmp(U)>=0?(E.isub(U),P.isub(N)):(U.isub(E),N.isub(P))}var te;return E.cmpn(1)===0?te=P:te=N,te.cmpn(0)<0&&te.iadd(y),te},s.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var E=this.clone(),U=y.clone();E.negative=0,U.negative=0;for(var P=0;E.isEven()&&U.isEven();P++)E.iushrn(1),U.iushrn(1);do{for(;E.isEven();)E.iushrn(1);for(;U.isEven();)U.iushrn(1);var N=E.cmp(U);if(N<0){var z=E;E=U,U=z}else if(N===0||U.cmpn(1)===0)break;E.isub(U)}while(!0);return U.iushln(P)},s.prototype.invm=function(y){return this.egcd(y).a.umod(y)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(y){return this.words[0]&y},s.prototype.bincn=function(y){r(typeof y=="number");var E=y%26,U=(y-E)/26,P=1<>>26,W&=67108863,this.words[z]=W}return N!==0&&(this.words[z]=N,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(y){var E=y<0;if(this.negative!==0&&!E)return-1;if(this.negative===0&&E)return 1;this._strip();var U;if(this.length>1)U=1;else{E&&(y=-y),r(y<=67108863,"Number is too big");var P=this.words[0]|0;U=P===y?0:Py.length)return 1;if(this.length=0;U--){var P=this.words[U]|0,N=y.words[U]|0;if(P!==N){PN&&(E=1);break}}return E},s.prototype.gtn=function(y){return this.cmpn(y)===1},s.prototype.gt=function(y){return this.cmp(y)===1},s.prototype.gten=function(y){return this.cmpn(y)>=0},s.prototype.gte=function(y){return this.cmp(y)>=0},s.prototype.ltn=function(y){return this.cmpn(y)===-1},s.prototype.lt=function(y){return this.cmp(y)===-1},s.prototype.lten=function(y){return this.cmpn(y)<=0},s.prototype.lte=function(y){return this.cmp(y)<=0},s.prototype.eqn=function(y){return this.cmpn(y)===0},s.prototype.eq=function(y){return this.cmp(y)===0},s.red=function(y){return new L(y)},s.prototype.toRed=function(y){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),y.convertTo(this)._forceRed(y)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(y){return this.red=y,this},s.prototype.forceRed=function(y){return r(!this.red,"Already a number in reduction context"),this._forceRed(y)},s.prototype.redAdd=function(y){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},s.prototype.redIAdd=function(y){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},s.prototype.redSub=function(y){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},s.prototype.redISub=function(y){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},s.prototype.redShl=function(y){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},s.prototype.redMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},s.prototype.redIMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},s.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(y){return r(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var x={k256:null,p224:null,p192:null,p25519:null};function b(T,y){this.name=T,this.p=new s(y,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}b.prototype._tmp=function(){var y=new s(null);return y.words=new Array(Math.ceil(this.n/13)),y},b.prototype.ireduce=function(y){var E=y,U;do this.split(E,this.tmp),E=this.imulK(E),E=E.iadd(this.tmp),U=E.bitLength();while(U>this.n);var P=U0?E.isub(this.p):E.strip!==void 0?E.strip():E._strip(),E},b.prototype.split=function(y,E){y.iushrn(this.n,0,E)},b.prototype.imulK=function(y){return y.imul(this.k)};function B(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(B,b),B.prototype.split=function(y,E){for(var U=4194303,P=Math.min(y.length,9),N=0;N>>22,z=W}z>>>=22,y.words[N-10]=z,z===0&&y.length>10?y.length-=10:y.length-=9},B.prototype.imulK=function(y){y.words[y.length]=0,y.words[y.length+1]=0,y.length+=2;for(var E=0,U=0;U>>=26,y.words[U]=N,E=P}return E!==0&&(y.words[y.length++]=E),y},s._prime=function(y){if(x[y])return x[y];var E;if(y==="k256")E=new B;else if(y==="p224")E=new M;else if(y==="p192")E=new I;else if(y==="p25519")E=new S;else throw new Error("Unknown prime "+y);return x[y]=E,E};function L(T){if(typeof T=="string"){var y=s._prime(T);this.m=y.p,this.prime=y}else r(T.gtn(1),"modulus must be greater than 1"),this.m=T,this.prime=null}L.prototype._verify1=function(y){r(y.negative===0,"red works only with positives"),r(y.red,"red works only with red numbers")},L.prototype._verify2=function(y,E){r((y.negative|E.negative)===0,"red works only with positives"),r(y.red&&y.red===E.red,"red works only with red numbers")},L.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):(A(y,y.umod(this.m)._forceRed(this)),y)},L.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},L.prototype.add=function(y,E){this._verify2(y,E);var U=y.add(E);return U.cmp(this.m)>=0&&U.isub(this.m),U._forceRed(this)},L.prototype.iadd=function(y,E){this._verify2(y,E);var U=y.iadd(E);return U.cmp(this.m)>=0&&U.isub(this.m),U},L.prototype.sub=function(y,E){this._verify2(y,E);var U=y.sub(E);return U.cmpn(0)<0&&U.iadd(this.m),U._forceRed(this)},L.prototype.isub=function(y,E){this._verify2(y,E);var U=y.isub(E);return U.cmpn(0)<0&&U.iadd(this.m),U},L.prototype.shl=function(y,E){return this._verify1(y),this.imod(y.ushln(E))},L.prototype.imul=function(y,E){return this._verify2(y,E),this.imod(y.imul(E))},L.prototype.mul=function(y,E){return this._verify2(y,E),this.imod(y.mul(E))},L.prototype.isqr=function(y){return this.imul(y,y.clone())},L.prototype.sqr=function(y){return this.mul(y,y)},L.prototype.sqrt=function(y){if(y.isZero())return y.clone();var E=this.m.andln(3);if(r(E%2===1),E===3){var U=this.m.add(new s(1)).iushrn(2);return this.pow(y,U)}for(var P=this.m.subn(1),N=0;!P.isZero()&&P.andln(1)===0;)N++,P.iushrn(1);r(!P.isZero());var z=new s(1).toRed(this),W=z.redNeg(),H=this.m.subn(1).iushrn(1),C=this.m.bitLength();for(C=new s(2*C*C).toRed(this);this.pow(C,H).cmp(W)!==0;)C.redIAdd(W);for(var K=this.pow(C,P),te=this.pow(y,P.addn(1).iushrn(1)),F=this.pow(y,P),re=N;F.cmp(z)!==0;){for(var ce=F,oe=0;ce.cmp(z)!==0;oe++)ce=ce.redSqr();r(oe=0;N--){for(var K=E.words[N],te=C-1;te>=0;te--){var F=K>>te&1;if(z!==P[0]&&(z=this.sqr(z)),F===0&&W===0){H=0;continue}W<<=1,W|=F,H++,!(H!==U&&(N!==0||te!==0))&&(z=this.mul(z,P[W]),H=0,W=0)}C=26}return z},L.prototype.convertTo=function(y){var E=y.umod(this.m);return E===y?E.clone():E},L.prototype.convertFrom=function(y){var E=y.clone();return E.red=null,E},s.mont=function(y){return new O(y)};function O(T){L.call(this,T),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(O,L),O.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},O.prototype.convertFrom=function(y){var E=this.imod(y.mul(this.rinv));return E.red=null,E},O.prototype.imul=function(y,E){if(y.isZero()||E.isZero())return y.words[0]=0,y.length=1,y;var U=y.imul(E),P=U.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),N=U.isub(P).iushrn(this.shift),z=N;return N.cmp(this.m)>=0?z=N.isub(this.m):N.cmpn(0)<0&&(z=N.iadd(this.m)),z._forceRed(this)},O.prototype.mul=function(y,E){if(y.isZero()||E.isZero())return new s(0)._forceRed(this);var U=y.mul(E),P=U.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),N=U.isub(P).iushrn(this.shift),z=N;return N.cmp(this.m)>=0?z=N.isub(this.m):N.cmpn(0)<0&&(z=N.iadd(this.m)),z._forceRed(this)},O.prototype.invm=function(y){var E=this.imod(y._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(n,Pa)})(nI);var $W=nI.exports;const wt=ic($W),ZW="logger/5.7.0";let bU=!1,EU=!1;const Zy={debug:1,default:2,info:2,warning:3,error:4,off:5};let BU=Zy.default,ab=null;function qW(){try{const n=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{n.push(e)}}),n.length)throw new Error("missing "+n.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(n){return n.message}return null}const SU=qW();var xS;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(xS||(xS={}));var Go;(function(n){n.UNKNOWN_ERROR="UNKNOWN_ERROR",n.NOT_IMPLEMENTED="NOT_IMPLEMENTED",n.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",n.NETWORK_ERROR="NETWORK_ERROR",n.SERVER_ERROR="SERVER_ERROR",n.TIMEOUT="TIMEOUT",n.BUFFER_OVERRUN="BUFFER_OVERRUN",n.NUMERIC_FAULT="NUMERIC_FAULT",n.MISSING_NEW="MISSING_NEW",n.INVALID_ARGUMENT="INVALID_ARGUMENT",n.MISSING_ARGUMENT="MISSING_ARGUMENT",n.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",n.CALL_EXCEPTION="CALL_EXCEPTION",n.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",n.NONCE_EXPIRED="NONCE_EXPIRED",n.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",n.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",n.TRANSACTION_REPLACED="TRANSACTION_REPLACED",n.ACTION_REJECTED="ACTION_REJECTED"})(Go||(Go={}));const MU="0123456789abcdef";let _e=class Ir{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();Zy[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(BU>Zy[r])&&console.log.apply(console,t)}debug(...e){this._log(Ir.levels.DEBUG,e)}info(...e){this._log(Ir.levels.INFO,e)}warn(...e){this._log(Ir.levels.WARNING,e)}makeError(e,t,r){if(EU)return this.makeError("censored error",t,{});t||(t=Ir.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(l=>{const c=r[l];try{if(c instanceof Uint8Array){let A="";for(let u=0;u>4],A+=MU[c[u]&15];i.push(l+"=Uint8Array(0x"+A+")")}else i.push(l+"="+JSON.stringify(c))}catch{i.push(l+"="+JSON.stringify(r[l].toString()))}}),i.push(`code=${t}`),i.push(`version=${this.version}`);const s=e;let o="";switch(t){case Go.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Go.CALL_EXCEPTION:case Go.INSUFFICIENT_FUNDS:case Go.MISSING_NEW:case Go.NONCE_EXPIRED:case Go.REPLACEMENT_UNDERPRICED:case Go.TRANSACTION_REPLACED:case Go.UNPREDICTABLE_GAS_LIMIT:o=t;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=t,Object.keys(r).forEach(function(l){a[l]=r[l]}),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Ir.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,i){e||this.throwError(t,r,i)}assertArgument(e,t,r,i){e||this.throwArgumentError(t,r,i)}checkNormalize(e){SU&&this.throwError("platform missing String.prototype.normalize",Ir.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:SU})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Ir.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Ir.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r?r=": "+r:r="",et&&this.throwError("too many arguments"+r,Ir.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",Ir.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Ir.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Ir.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return ab||(ab=new Ir(ZW)),ab}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Ir.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),bU){if(!e)return;this.globalLogger().throwError("error censorship permanent",Ir.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}EU=!!e,bU=!!t}static setLogLevel(e){const t=Zy[e.toLowerCase()];if(t==null){Ir.globalLogger().warn("invalid log level - "+e);return}BU=t}static from(e){return new Ir(e)}};_e.errors=Go;_e.levels=xS;const JW="bytes/5.7.0",Zn=new _e(JW);function K4(n){return!!n.toHexString}function zh(n){return n.slice||(n.slice=function(){const e=Array.prototype.slice.call(arguments);return zh(new Uint8Array(Array.prototype.slice.apply(n,e)))}),n}function rI(n){return Tt(n)&&!(n.length%2)||Mx(n)}function CU(n){return typeof n=="number"&&n==n&&n%1===0}function Mx(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!CU(n.length)||n.length<0)return!1;for(let e=0;e=256)return!1}return!0}function ft(n,e){if(e||(e={}),typeof n=="number"){Zn.checkSafeUint53(n,"invalid arrayify value");const t=[];for(;n;)t.unshift(n&255),n=parseInt(String(n/256));return t.length===0&&t.push(0),zh(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),K4(n)&&(n=n.toHexString()),Tt(n)){let t=n.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Zn.throwArgumentError("hex data is odd-length","value",n));const r=[];for(let i=0;ift(i)),t=e.reduce((i,s)=>i+s.length,0),r=new Uint8Array(t);return e.reduce((i,s)=>(r.set(s,i),i+s.length),0),zh(r)}function Ad(n){let e=ft(n);if(e.length===0)return e;let t=0;for(;te&&Zn.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(n,e-n.length),zh(t)}function Tt(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||e&&n.length!==2+2*e)}const lb="0123456789abcdef";function at(n,e){if(e||(e={}),typeof n=="number"){Zn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=lb[n&15]+t,n=Math.floor(n/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof n=="bigint")return n=n.toString(16),n.length%2?"0x0"+n:"0x"+n;if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),K4(n))return n.toHexString();if(Tt(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Zn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(Mx(n)){let t="0x";for(let r=0;r>4]+lb[i&15]}return t}return Zn.throwArgumentError("invalid hexlify value","value",n)}function _u(n){if(typeof n!="string")n=at(n);else if(!Tt(n)||n.length%2)return null;return(n.length-2)/2}function pi(n,e,t){return typeof n!="string"?n=at(n):(!Tt(n)||n.length%2)&&Zn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function Ki(n){let e="0x";return n.forEach(t=>{e+=at(t).substring(2)}),e}function Cx(n){const e=t9(at(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function t9(n){typeof n!="string"&&(n=at(n)),Tt(n)||Zn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Zn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function Tx(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(rI(n)){let t=ft(n);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=at(t.slice(0,32)),e.s=at(t.slice(32,64))):t.length===65?(e.r=at(t.slice(0,32)),e.s=at(t.slice(32,64)),e.v=t[64]):Zn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Zn.throwArgumentError("signature invalid v byte","signature",n)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=at(t.slice(32,64))}else{if(e.r=n.r,e.s=n.s,e.v=n.v,e.recoveryParam=n.recoveryParam,e._vs=n._vs,e._vs!=null){const i=e9(ft(e._vs),32);e._vs=at(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Zn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=at(i);e.s==null?e.s=o:e.s!==o&&Zn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Zn.throwArgumentError("signature missing v and recoveryParam","signature",n):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Zn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!Tt(e.r)?Zn.throwArgumentError("signature missing or invalid r","signature",n):e.r=rr(e.r,32),e.s==null||!Tt(e.s)?Zn.throwArgumentError("signature missing or invalid s","signature",n):e.s=rr(e.s,32);const t=ft(e.s);t[0]>=128&&Zn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=at(t);e._vs&&(Tt(e._vs)||Zn.throwArgumentError("signature invalid _vs","signature",n),e._vs=rr(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Zn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const n9="bignumber/5.7.0";var Gw=wt.BN;const Bl=new _e(n9),cb={},TU=9007199254740991;let IU=!1;class Ve{constructor(e,t){e!==cb&&Bl.throwError("cannot call constructor directly; use BigNumber.from",_e.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Qi(Lt(this).fromTwos(e))}toTwos(e){return Qi(Lt(this).toTwos(e))}abs(){return this._hex[0]==="-"?Ve.from(this._hex.substring(1)):this}add(e){return Qi(Lt(this).add(Lt(e)))}sub(e){return Qi(Lt(this).sub(Lt(e)))}div(e){return Ve.from(e).isZero()&&Ks("division-by-zero","div"),Qi(Lt(this).div(Lt(e)))}mul(e){return Qi(Lt(this).mul(Lt(e)))}mod(e){const t=Lt(e);return t.isNeg()&&Ks("division-by-zero","mod"),Qi(Lt(this).umod(t))}pow(e){const t=Lt(e);return t.isNeg()&&Ks("negative-power","pow"),Qi(Lt(this).pow(t))}and(e){const t=Lt(e);return(this.isNegative()||t.isNeg())&&Ks("unbound-bitwise-result","and"),Qi(Lt(this).and(t))}or(e){const t=Lt(e);return(this.isNegative()||t.isNeg())&&Ks("unbound-bitwise-result","or"),Qi(Lt(this).or(t))}xor(e){const t=Lt(e);return(this.isNegative()||t.isNeg())&&Ks("unbound-bitwise-result","xor"),Qi(Lt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Ks("negative-width","mask"),Qi(Lt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Ks("negative-width","shl"),Qi(Lt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Ks("negative-width","shr"),Qi(Lt(this).shrn(e))}eq(e){return Lt(this).eq(Lt(e))}lt(e){return Lt(this).lt(Lt(e))}lte(e){return Lt(this).lte(Lt(e))}gt(e){return Lt(this).gt(Lt(e))}gte(e){return Lt(this).gte(Lt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Lt(this).isZero()}toNumber(){try{return Lt(this).toNumber()}catch{Ks("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Bl.throwError("this platform does not support BigInt",_e.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?IU||(IU=!0,Bl.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Bl.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",_e.errors.UNEXPECTED_ARGUMENT,{}):Bl.throwError("BigNumber.toString does not accept parameters",_e.errors.UNEXPECTED_ARGUMENT,{})),Lt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Ve)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Ve(cb,ag(e)):e.match(/^-?[0-9]+$/)?new Ve(cb,ag(new Gw(e))):Bl.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Ks("underflow","BigNumber.from",e),(e>=TU||e<=-TU)&&Ks("overflow","BigNumber.from",e),Ve.from(String(e));const t=e;if(typeof t=="bigint")return Ve.from(t.toString());if(Mx(t))return Ve.from(at(t));if(t)if(t.toHexString){const r=t.toHexString();if(typeof r=="string")return Ve.from(r)}else{let r=t._hex;if(r==null&&t.type==="BigNumber"&&(r=t.hex),typeof r=="string"&&(Tt(r)||r[0]==="-"&&Tt(r.substring(1))))return Ve.from(r)}return Bl.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function ag(n){if(typeof n!="string")return ag(n.toString(16));if(n[0]==="-")return n=n.substring(1),n[0]==="-"&&Bl.throwArgumentError("invalid hex","value",n),n=ag(n),n==="0x00"?n:"-"+n;if(n.substring(0,2)!=="0x"&&(n="0x"+n),n==="0x")return"0x00";for(n.length%2&&(n="0x0"+n.substring(2));n.length>4&&n.substring(0,4)==="0x00";)n="0x"+n.substring(4);return n}function Qi(n){return Ve.from(ag(n))}function Lt(n){const e=Ve.from(n).toHexString();return e[0]==="-"?new Gw("-"+e.substring(3),16):new Gw(e.substring(2),16)}function Ks(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),Bl.throwError(n,_e.errors.NUMERIC_FAULT,r)}function r9(n){return new Gw(n,36).toString(16)}const i9="properties/5.7.0";var s9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Vw=new _e(i9);function Pe(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function Ss(n,e){for(let t=0;t<32;t++){if(n[e])return n[e];if(!n.prototype||typeof n.prototype!="object")break;n=Object.getPrototypeOf(n.prototype).constructor}return null}function yr(n){return s9(this,void 0,void 0,function*(){const e=Object.keys(n).map(r=>{const i=n[r];return Promise.resolve(i).then(s=>({key:r,value:s}))});return(yield Promise.all(e)).reduce((r,i)=>(r[i.key]=i.value,r),{})})}function o9(n,e){(!n||typeof n!="object")&&Vw.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||Vw.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function kn(n){const e={};for(const t in n)e[t]=n[t];return e}const a9={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function X4(n){if(n==null||a9[typeof n])return!0;if(Array.isArray(n)||typeof n=="object"){if(!Object.isFrozen(n))return!1;const e=Object.keys(n);for(let t=0;tUs(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Pe(e,t,Us(r))}return e}return Vw.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function Us(n){return l9(n)}class i0{constructor(e){for(const t in e)this[t]=Us(e[t])}}const c9="abstract-provider/5.7.0";var A9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const u9=new _e(c9);class f9 extends i0{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class s0{constructor(){u9.checkAbstract(new.target,s0),Pe(this,"_isProvider",!0)}getFeeData(){return A9(this,void 0,void 0,function*(){const{block:e,gasPrice:t}=yield yr({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(o=>null)});let r=null,i=null,s=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,s=Ve.from("1500000000"),i=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:r,maxFeePerGas:i,maxPriorityFeePerGas:s,gasPrice:t}})}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!!(e&&e._isProvider)}}const h9="networks/5.7.1",RU=new _e(h9);function d9(n){return n&&typeof n.renetwork=="function"}function Il(n){const e=function(t,r){r==null&&(r={});const i=[];if(t.InfuraProvider&&r.infura!=="-")try{i.push(new t.InfuraProvider(n,r.infura))}catch{}if(t.EtherscanProvider&&r.etherscan!=="-")try{i.push(new t.EtherscanProvider(n,r.etherscan))}catch{}if(t.AlchemyProvider&&r.alchemy!=="-")try{i.push(new t.AlchemyProvider(n,r.alchemy))}catch{}if(t.PocketProvider&&r.pocket!=="-"){const s=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(n,r.pocket);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}}if(t.CloudflareProvider&&r.cloudflare!=="-")try{i.push(new t.CloudflareProvider(n))}catch{}if(t.AnkrProvider&&r.ankr!=="-")try{const s=["ropsten"],o=new t.AnkrProvider(n,r.ankr);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}if(i.length===0)return null;if(t.FallbackProvider){let s=1;return r.quorum!=null?s=r.quorum:n==="homestead"&&(s=2),new t.FallbackProvider(i,s)}return i[0]};return e.renetwork=function(t){return Il(t)},e}function jw(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return jw(n,r)},t}const UU={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Il("homestead")},FU={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Il("ropsten")},PU={chainId:63,name:"classicMordor",_defaultProvider:jw("https://www.ethercluster.com/mordor","classicMordor")},N0={unspecified:{chainId:0,name:"unspecified"},homestead:UU,mainnet:UU,morden:{chainId:2,name:"morden"},ropsten:FU,testnet:FU,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Il("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Il("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Il("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Il("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:jw("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:PU,classicTestnet:PU,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:jw("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Il("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Il("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Y4(n){if(n==null)return null;if(typeof n=="number"){for(const r in N0){const i=N0[r];if(i.chainId===n)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:n,name:"unknown"}}if(typeof n=="string"){const r=N0[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=N0[n.name];if(!e)return typeof n.chainId!="number"&&RU.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&RU.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(d9(e._defaultProvider)?t=e._defaultProvider.renetwork(n):t=e._defaultProvider),{name:n.name,chainId:e.chainId,ensAddress:n.ensAddress||e.ensAddress||null,_defaultProvider:t}}function $4(n){n=atob(n);const e=[];for(let t=0;t0;)r.push(o%this.base),o=o/this.base|0}let i="";for(let s=0;t[s]===0&&s=0;--s)i+=this.alphabet[r[s]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let t=[];if(e.length===0)return new Uint8Array(t);t.push(0);for(let r=0;r>=8;for(;s>0;)t.push(s&255),s>>=8}for(let r=0;e[r]===this._leader&&r0?y:E},s.min=function(y,E){return y.cmp(E)<0?y:E},s.prototype._init=function(y,E,R){if(typeof y=="number")return this._initNumber(y,E,R);if(typeof y=="object")return this._initArray(y,E,R);E==="hex"&&(E=16),r(E===(E|0)&&E>=2&&E<=36),y=y.toString().replace(/\s+/g,"");var L=0;y[0]==="-"&&(L++,this.negative=1),L=0;L-=3)z=y[L]|y[L-1]<<8|y[L-2]<<16,this.words[N]|=z<>>26-W&67108863,W+=24,W>=26&&(W-=26,N++);else if(R==="le")for(L=0,N=0;L>>26-W&67108863,W+=24,W>=26&&(W-=26,N++);return this._strip()};function a(T,y){var E=T.charCodeAt(y);if(E>=48&&E<=57)return E-48;if(E>=65&&E<=70)return E-55;if(E>=97&&E<=102)return E-87;r(!1,"Invalid character in "+T)}function l(T,y,E){var R=a(T,E);return E-1>=y&&(R|=a(T,E-1)<<4),R}s.prototype._parseHex=function(y,E,R){this.length=Math.ceil((y.length-E)/6),this.words=new Array(this.length);for(var L=0;L=E;L-=2)W=l(y,E,L)<=18?(N-=18,z+=1,this.words[z]|=W>>>26):N+=8;else{var H=y.length-E;for(L=H%2===0?E+1:E;L=18?(N-=18,z+=1,this.words[z]|=W>>>26):N+=8}this._strip()};function c(T,y,E,R){for(var L=0,N=0,z=Math.min(T.length,E),W=y;W=49?N=H-49+10:H>=17?N=H-17+10:N=H,r(H>=0&&N1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch{s.prototype.inspect=u}else s.prototype.inspect=u;function u(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],h=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],d=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(y,E){y=y||10,E=E|0||1;var R;if(y===16||y==="hex"){R="";for(var L=0,N=0,z=0;z>>24-L&16777215,L+=2,L>=26&&(L-=26,z--),N!==0||z!==this.length-1?R=f[6-H.length]+H+R:R=H+R}for(N!==0&&(R=N.toString(16)+R);R.length%E!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}if(y===(y|0)&&y>=2&&y<=36){var C=h[y],K=d[y];R="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var F=ee.modrn(K).toString(y);ee=ee.idivn(K),ee.isZero()?R=F+R:R=f[C-F.length]+F+R}for(this.isZero()&&(R="0"+R);R.length%E!==0;)R="0"+R;return this.negative!==0&&(R="-"+R),R}r(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var y=this.words[0];return this.length===2?y+=this.words[1]*67108864:this.length===3&&this.words[2]===1?y+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-y:y},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(y,E){return this.toArrayLike(o,y,E)}),s.prototype.toArray=function(y,E){return this.toArrayLike(Array,y,E)};var m=function(y,E){return y.allocUnsafe?y.allocUnsafe(E):new y(E)};s.prototype.toArrayLike=function(y,E,R){this._strip();var L=this.byteLength(),N=R||Math.max(1,L);r(L<=N,"byte array longer than desired length"),r(N>0,"Requested array length <= 0");var z=m(y,N),W=E==="le"?"LE":"BE";return this["_toArrayLike"+W](z,L),z},s.prototype._toArrayLikeLE=function(y,E){for(var R=0,L=0,N=0,z=0;N>8&255),R>16&255),z===6?(R>24&255),L=0,z=0):(L=W>>>24,z+=2)}if(R=0&&(y[R--]=W>>8&255),R>=0&&(y[R--]=W>>16&255),z===6?(R>=0&&(y[R--]=W>>24&255),L=0,z=0):(L=W>>>24,z+=2)}if(R>=0)for(y[R--]=L;R>=0;)y[R--]=0},Math.clz32?s.prototype._countBits=function(y){return 32-Math.clz32(y)}:s.prototype._countBits=function(y){var E=y,R=0;return E>=4096&&(R+=13,E>>>=13),E>=64&&(R+=7,E>>>=7),E>=8&&(R+=4,E>>>=4),E>=2&&(R+=2,E>>>=2),R+E},s.prototype._zeroBits=function(y){if(y===0)return 26;var E=y,R=0;return E&8191||(R+=13,E>>>=13),E&127||(R+=7,E>>>=7),E&15||(R+=4,E>>>=4),E&3||(R+=2,E>>>=2),E&1||R++,R},s.prototype.bitLength=function(){var y=this.words[this.length-1],E=this._countBits(y);return(this.length-1)*26+E};function g(T){for(var y=new Array(T.bitLength()),E=0;E>>L&1}return y}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var y=0,E=0;Ey.length?this.clone().ior(y):y.clone().ior(this)},s.prototype.uor=function(y){return this.length>y.length?this.clone().iuor(y):y.clone().iuor(this)},s.prototype.iuand=function(y){var E;this.length>y.length?E=y:E=this;for(var R=0;Ry.length?this.clone().iand(y):y.clone().iand(this)},s.prototype.uand=function(y){return this.length>y.length?this.clone().iuand(y):y.clone().iuand(this)},s.prototype.iuxor=function(y){var E,R;this.length>y.length?(E=this,R=y):(E=y,R=this);for(var L=0;Ly.length?this.clone().ixor(y):y.clone().ixor(this)},s.prototype.uxor=function(y){return this.length>y.length?this.clone().iuxor(y):y.clone().iuxor(this)},s.prototype.inotn=function(y){r(typeof y=="number"&&y>=0);var E=Math.ceil(y/26)|0,R=y%26;this._expand(E),R>0&&E--;for(var L=0;L0&&(this.words[L]=~this.words[L]&67108863>>26-R),this._strip()},s.prototype.notn=function(y){return this.clone().inotn(y)},s.prototype.setn=function(y,E){r(typeof y=="number"&&y>=0);var R=y/26|0,L=y%26;return this._expand(R+1),E?this.words[R]=this.words[R]|1<y.length?(R=this,L=y):(R=y,L=this);for(var N=0,z=0;z>>26;for(;N!==0&&z>>26;if(this.length=R.length,N!==0)this.words[this.length]=N,this.length++;else if(R!==this)for(;zy.length?this.clone().iadd(y):y.clone().iadd(this)},s.prototype.isub=function(y){if(y.negative!==0){y.negative=0;var E=this.iadd(y);return y.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(y),this.negative=1,this._normSign();var R=this.cmp(y);if(R===0)return this.negative=0,this.length=1,this.words[0]=0,this;var L,N;R>0?(L=this,N=y):(L=y,N=this);for(var z=0,W=0;W>26,this.words[W]=E&67108863;for(;z!==0&&W>26,this.words[W]=E&67108863;if(z===0&&W>>26,ee=H&67108863,F=Math.min(C,y.length-1),re=Math.max(0,C-T.length+1);re<=F;re++){var ce=C-re|0;L=T.words[ce]|0,N=y.words[re]|0,z=L*N+ee,K+=z/67108864|0,ee=z&67108863}E.words[C]=ee|0,H=K|0}return H!==0?E.words[C]=H|0:E.length--,E._strip()}var v=function(y,E,R){var L=y.words,N=E.words,z=R.words,W=0,H,C,K,ee=L[0]|0,F=ee&8191,re=ee>>>13,ce=L[1]|0,oe=ce&8191,ge=ce>>>13,me=L[2]|0,ve=me&8191,be=me>>>13,ne=L[3]|0,k=ne&8191,ae=ne>>>13,le=L[4]|0,Z=le&8191,J=le>>>13,ue=L[5]|0,Y=ue&8191,G=ue>>>13,j=L[6]|0,se=j&8191,fe=j>>>13,he=L[7]|0,Be=he&8191,V=he>>>13,U=L[8]|0,O=U&8191,X=U>>>13,ie=L[9]|0,pe=ie&8191,de=ie>>>13,Ie=N[0]|0,Le=Ie&8191,Ue=Ie>>>13,Ye=N[1]|0,Ae=Ye&8191,Fe=Ye>>>13,Me=N[2]|0,Ce=Me&8191,Re=Me>>>13,Oe=N[3]|0,$e=Oe&8191,dt=Oe>>>13,Fn=N[4]|0,nt=Fn&8191,_t=Fn>>>13,Tr=N[5]|0,en=Tr&8191,qt=Tr>>>13,Zr=N[6]|0,Jt=Zr&8191,tn=Zr>>>13,Ws=N[7]|0,Kt=Ws&8191,Xt=Ws>>>13,Ii=N[8]|0,nn=Ii&8191,rn=Ii>>>13,fa=N[9]|0,An=fa&8191,sn=fa>>>13;R.negative=y.negative^E.negative,R.length=19,H=Math.imul(F,Le),C=Math.imul(F,Ue),C=C+Math.imul(re,Le)|0,K=Math.imul(re,Ue);var te=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(te>>>26)|0,te&=67108863,H=Math.imul(oe,Le),C=Math.imul(oe,Ue),C=C+Math.imul(ge,Le)|0,K=Math.imul(ge,Ue),H=H+Math.imul(F,Ae)|0,C=C+Math.imul(F,Fe)|0,C=C+Math.imul(re,Ae)|0,K=K+Math.imul(re,Fe)|0;var ye=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(ye>>>26)|0,ye&=67108863,H=Math.imul(ve,Le),C=Math.imul(ve,Ue),C=C+Math.imul(be,Le)|0,K=Math.imul(be,Ue),H=H+Math.imul(oe,Ae)|0,C=C+Math.imul(oe,Fe)|0,C=C+Math.imul(ge,Ae)|0,K=K+Math.imul(ge,Fe)|0,H=H+Math.imul(F,Ce)|0,C=C+Math.imul(F,Re)|0,C=C+Math.imul(re,Ce)|0,K=K+Math.imul(re,Re)|0;var Ee=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,H=Math.imul(k,Le),C=Math.imul(k,Ue),C=C+Math.imul(ae,Le)|0,K=Math.imul(ae,Ue),H=H+Math.imul(ve,Ae)|0,C=C+Math.imul(ve,Fe)|0,C=C+Math.imul(be,Ae)|0,K=K+Math.imul(be,Fe)|0,H=H+Math.imul(oe,Ce)|0,C=C+Math.imul(oe,Re)|0,C=C+Math.imul(ge,Ce)|0,K=K+Math.imul(ge,Re)|0,H=H+Math.imul(F,$e)|0,C=C+Math.imul(F,dt)|0,C=C+Math.imul(re,$e)|0,K=K+Math.imul(re,dt)|0;var Se=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Se>>>26)|0,Se&=67108863,H=Math.imul(Z,Le),C=Math.imul(Z,Ue),C=C+Math.imul(J,Le)|0,K=Math.imul(J,Ue),H=H+Math.imul(k,Ae)|0,C=C+Math.imul(k,Fe)|0,C=C+Math.imul(ae,Ae)|0,K=K+Math.imul(ae,Fe)|0,H=H+Math.imul(ve,Ce)|0,C=C+Math.imul(ve,Re)|0,C=C+Math.imul(be,Ce)|0,K=K+Math.imul(be,Re)|0,H=H+Math.imul(oe,$e)|0,C=C+Math.imul(oe,dt)|0,C=C+Math.imul(ge,$e)|0,K=K+Math.imul(ge,dt)|0,H=H+Math.imul(F,nt)|0,C=C+Math.imul(F,_t)|0,C=C+Math.imul(re,nt)|0,K=K+Math.imul(re,_t)|0;var we=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(we>>>26)|0,we&=67108863,H=Math.imul(Y,Le),C=Math.imul(Y,Ue),C=C+Math.imul(G,Le)|0,K=Math.imul(G,Ue),H=H+Math.imul(Z,Ae)|0,C=C+Math.imul(Z,Fe)|0,C=C+Math.imul(J,Ae)|0,K=K+Math.imul(J,Fe)|0,H=H+Math.imul(k,Ce)|0,C=C+Math.imul(k,Re)|0,C=C+Math.imul(ae,Ce)|0,K=K+Math.imul(ae,Re)|0,H=H+Math.imul(ve,$e)|0,C=C+Math.imul(ve,dt)|0,C=C+Math.imul(be,$e)|0,K=K+Math.imul(be,dt)|0,H=H+Math.imul(oe,nt)|0,C=C+Math.imul(oe,_t)|0,C=C+Math.imul(ge,nt)|0,K=K+Math.imul(ge,_t)|0,H=H+Math.imul(F,en)|0,C=C+Math.imul(F,qt)|0,C=C+Math.imul(re,en)|0,K=K+Math.imul(re,qt)|0;var Ne=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,H=Math.imul(se,Le),C=Math.imul(se,Ue),C=C+Math.imul(fe,Le)|0,K=Math.imul(fe,Ue),H=H+Math.imul(Y,Ae)|0,C=C+Math.imul(Y,Fe)|0,C=C+Math.imul(G,Ae)|0,K=K+Math.imul(G,Fe)|0,H=H+Math.imul(Z,Ce)|0,C=C+Math.imul(Z,Re)|0,C=C+Math.imul(J,Ce)|0,K=K+Math.imul(J,Re)|0,H=H+Math.imul(k,$e)|0,C=C+Math.imul(k,dt)|0,C=C+Math.imul(ae,$e)|0,K=K+Math.imul(ae,dt)|0,H=H+Math.imul(ve,nt)|0,C=C+Math.imul(ve,_t)|0,C=C+Math.imul(be,nt)|0,K=K+Math.imul(be,_t)|0,H=H+Math.imul(oe,en)|0,C=C+Math.imul(oe,qt)|0,C=C+Math.imul(ge,en)|0,K=K+Math.imul(ge,qt)|0,H=H+Math.imul(F,Jt)|0,C=C+Math.imul(F,tn)|0,C=C+Math.imul(re,Jt)|0,K=K+Math.imul(re,tn)|0;var Ke=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,H=Math.imul(Be,Le),C=Math.imul(Be,Ue),C=C+Math.imul(V,Le)|0,K=Math.imul(V,Ue),H=H+Math.imul(se,Ae)|0,C=C+Math.imul(se,Fe)|0,C=C+Math.imul(fe,Ae)|0,K=K+Math.imul(fe,Fe)|0,H=H+Math.imul(Y,Ce)|0,C=C+Math.imul(Y,Re)|0,C=C+Math.imul(G,Ce)|0,K=K+Math.imul(G,Re)|0,H=H+Math.imul(Z,$e)|0,C=C+Math.imul(Z,dt)|0,C=C+Math.imul(J,$e)|0,K=K+Math.imul(J,dt)|0,H=H+Math.imul(k,nt)|0,C=C+Math.imul(k,_t)|0,C=C+Math.imul(ae,nt)|0,K=K+Math.imul(ae,_t)|0,H=H+Math.imul(ve,en)|0,C=C+Math.imul(ve,qt)|0,C=C+Math.imul(be,en)|0,K=K+Math.imul(be,qt)|0,H=H+Math.imul(oe,Jt)|0,C=C+Math.imul(oe,tn)|0,C=C+Math.imul(ge,Jt)|0,K=K+Math.imul(ge,tn)|0,H=H+Math.imul(F,Kt)|0,C=C+Math.imul(F,Xt)|0,C=C+Math.imul(re,Kt)|0,K=K+Math.imul(re,Xt)|0;var qe=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(qe>>>26)|0,qe&=67108863,H=Math.imul(O,Le),C=Math.imul(O,Ue),C=C+Math.imul(X,Le)|0,K=Math.imul(X,Ue),H=H+Math.imul(Be,Ae)|0,C=C+Math.imul(Be,Fe)|0,C=C+Math.imul(V,Ae)|0,K=K+Math.imul(V,Fe)|0,H=H+Math.imul(se,Ce)|0,C=C+Math.imul(se,Re)|0,C=C+Math.imul(fe,Ce)|0,K=K+Math.imul(fe,Re)|0,H=H+Math.imul(Y,$e)|0,C=C+Math.imul(Y,dt)|0,C=C+Math.imul(G,$e)|0,K=K+Math.imul(G,dt)|0,H=H+Math.imul(Z,nt)|0,C=C+Math.imul(Z,_t)|0,C=C+Math.imul(J,nt)|0,K=K+Math.imul(J,_t)|0,H=H+Math.imul(k,en)|0,C=C+Math.imul(k,qt)|0,C=C+Math.imul(ae,en)|0,K=K+Math.imul(ae,qt)|0,H=H+Math.imul(ve,Jt)|0,C=C+Math.imul(ve,tn)|0,C=C+Math.imul(be,Jt)|0,K=K+Math.imul(be,tn)|0,H=H+Math.imul(oe,Kt)|0,C=C+Math.imul(oe,Xt)|0,C=C+Math.imul(ge,Kt)|0,K=K+Math.imul(ge,Xt)|0,H=H+Math.imul(F,nn)|0,C=C+Math.imul(F,rn)|0,C=C+Math.imul(re,nn)|0,K=K+Math.imul(re,rn)|0;var et=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(et>>>26)|0,et&=67108863,H=Math.imul(pe,Le),C=Math.imul(pe,Ue),C=C+Math.imul(de,Le)|0,K=Math.imul(de,Ue),H=H+Math.imul(O,Ae)|0,C=C+Math.imul(O,Fe)|0,C=C+Math.imul(X,Ae)|0,K=K+Math.imul(X,Fe)|0,H=H+Math.imul(Be,Ce)|0,C=C+Math.imul(Be,Re)|0,C=C+Math.imul(V,Ce)|0,K=K+Math.imul(V,Re)|0,H=H+Math.imul(se,$e)|0,C=C+Math.imul(se,dt)|0,C=C+Math.imul(fe,$e)|0,K=K+Math.imul(fe,dt)|0,H=H+Math.imul(Y,nt)|0,C=C+Math.imul(Y,_t)|0,C=C+Math.imul(G,nt)|0,K=K+Math.imul(G,_t)|0,H=H+Math.imul(Z,en)|0,C=C+Math.imul(Z,qt)|0,C=C+Math.imul(J,en)|0,K=K+Math.imul(J,qt)|0,H=H+Math.imul(k,Jt)|0,C=C+Math.imul(k,tn)|0,C=C+Math.imul(ae,Jt)|0,K=K+Math.imul(ae,tn)|0,H=H+Math.imul(ve,Kt)|0,C=C+Math.imul(ve,Xt)|0,C=C+Math.imul(be,Kt)|0,K=K+Math.imul(be,Xt)|0,H=H+Math.imul(oe,nn)|0,C=C+Math.imul(oe,rn)|0,C=C+Math.imul(ge,nn)|0,K=K+Math.imul(ge,rn)|0,H=H+Math.imul(F,An)|0,C=C+Math.imul(F,sn)|0,C=C+Math.imul(re,An)|0,K=K+Math.imul(re,sn)|0;var ct=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(ct>>>26)|0,ct&=67108863,H=Math.imul(pe,Ae),C=Math.imul(pe,Fe),C=C+Math.imul(de,Ae)|0,K=Math.imul(de,Fe),H=H+Math.imul(O,Ce)|0,C=C+Math.imul(O,Re)|0,C=C+Math.imul(X,Ce)|0,K=K+Math.imul(X,Re)|0,H=H+Math.imul(Be,$e)|0,C=C+Math.imul(Be,dt)|0,C=C+Math.imul(V,$e)|0,K=K+Math.imul(V,dt)|0,H=H+Math.imul(se,nt)|0,C=C+Math.imul(se,_t)|0,C=C+Math.imul(fe,nt)|0,K=K+Math.imul(fe,_t)|0,H=H+Math.imul(Y,en)|0,C=C+Math.imul(Y,qt)|0,C=C+Math.imul(G,en)|0,K=K+Math.imul(G,qt)|0,H=H+Math.imul(Z,Jt)|0,C=C+Math.imul(Z,tn)|0,C=C+Math.imul(J,Jt)|0,K=K+Math.imul(J,tn)|0,H=H+Math.imul(k,Kt)|0,C=C+Math.imul(k,Xt)|0,C=C+Math.imul(ae,Kt)|0,K=K+Math.imul(ae,Xt)|0,H=H+Math.imul(ve,nn)|0,C=C+Math.imul(ve,rn)|0,C=C+Math.imul(be,nn)|0,K=K+Math.imul(be,rn)|0,H=H+Math.imul(oe,An)|0,C=C+Math.imul(oe,sn)|0,C=C+Math.imul(ge,An)|0,K=K+Math.imul(ge,sn)|0;var ht=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(ht>>>26)|0,ht&=67108863,H=Math.imul(pe,Ce),C=Math.imul(pe,Re),C=C+Math.imul(de,Ce)|0,K=Math.imul(de,Re),H=H+Math.imul(O,$e)|0,C=C+Math.imul(O,dt)|0,C=C+Math.imul(X,$e)|0,K=K+Math.imul(X,dt)|0,H=H+Math.imul(Be,nt)|0,C=C+Math.imul(Be,_t)|0,C=C+Math.imul(V,nt)|0,K=K+Math.imul(V,_t)|0,H=H+Math.imul(se,en)|0,C=C+Math.imul(se,qt)|0,C=C+Math.imul(fe,en)|0,K=K+Math.imul(fe,qt)|0,H=H+Math.imul(Y,Jt)|0,C=C+Math.imul(Y,tn)|0,C=C+Math.imul(G,Jt)|0,K=K+Math.imul(G,tn)|0,H=H+Math.imul(Z,Kt)|0,C=C+Math.imul(Z,Xt)|0,C=C+Math.imul(J,Kt)|0,K=K+Math.imul(J,Xt)|0,H=H+Math.imul(k,nn)|0,C=C+Math.imul(k,rn)|0,C=C+Math.imul(ae,nn)|0,K=K+Math.imul(ae,rn)|0,H=H+Math.imul(ve,An)|0,C=C+Math.imul(ve,sn)|0,C=C+Math.imul(be,An)|0,K=K+Math.imul(be,sn)|0;var it=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(it>>>26)|0,it&=67108863,H=Math.imul(pe,$e),C=Math.imul(pe,dt),C=C+Math.imul(de,$e)|0,K=Math.imul(de,dt),H=H+Math.imul(O,nt)|0,C=C+Math.imul(O,_t)|0,C=C+Math.imul(X,nt)|0,K=K+Math.imul(X,_t)|0,H=H+Math.imul(Be,en)|0,C=C+Math.imul(Be,qt)|0,C=C+Math.imul(V,en)|0,K=K+Math.imul(V,qt)|0,H=H+Math.imul(se,Jt)|0,C=C+Math.imul(se,tn)|0,C=C+Math.imul(fe,Jt)|0,K=K+Math.imul(fe,tn)|0,H=H+Math.imul(Y,Kt)|0,C=C+Math.imul(Y,Xt)|0,C=C+Math.imul(G,Kt)|0,K=K+Math.imul(G,Xt)|0,H=H+Math.imul(Z,nn)|0,C=C+Math.imul(Z,rn)|0,C=C+Math.imul(J,nn)|0,K=K+Math.imul(J,rn)|0,H=H+Math.imul(k,An)|0,C=C+Math.imul(k,sn)|0,C=C+Math.imul(ae,An)|0,K=K+Math.imul(ae,sn)|0;var Vt=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,H=Math.imul(pe,nt),C=Math.imul(pe,_t),C=C+Math.imul(de,nt)|0,K=Math.imul(de,_t),H=H+Math.imul(O,en)|0,C=C+Math.imul(O,qt)|0,C=C+Math.imul(X,en)|0,K=K+Math.imul(X,qt)|0,H=H+Math.imul(Be,Jt)|0,C=C+Math.imul(Be,tn)|0,C=C+Math.imul(V,Jt)|0,K=K+Math.imul(V,tn)|0,H=H+Math.imul(se,Kt)|0,C=C+Math.imul(se,Xt)|0,C=C+Math.imul(fe,Kt)|0,K=K+Math.imul(fe,Xt)|0,H=H+Math.imul(Y,nn)|0,C=C+Math.imul(Y,rn)|0,C=C+Math.imul(G,nn)|0,K=K+Math.imul(G,rn)|0,H=H+Math.imul(Z,An)|0,C=C+Math.imul(Z,sn)|0,C=C+Math.imul(J,An)|0,K=K+Math.imul(J,sn)|0;var un=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(un>>>26)|0,un&=67108863,H=Math.imul(pe,en),C=Math.imul(pe,qt),C=C+Math.imul(de,en)|0,K=Math.imul(de,qt),H=H+Math.imul(O,Jt)|0,C=C+Math.imul(O,tn)|0,C=C+Math.imul(X,Jt)|0,K=K+Math.imul(X,tn)|0,H=H+Math.imul(Be,Kt)|0,C=C+Math.imul(Be,Xt)|0,C=C+Math.imul(V,Kt)|0,K=K+Math.imul(V,Xt)|0,H=H+Math.imul(se,nn)|0,C=C+Math.imul(se,rn)|0,C=C+Math.imul(fe,nn)|0,K=K+Math.imul(fe,rn)|0,H=H+Math.imul(Y,An)|0,C=C+Math.imul(Y,sn)|0,C=C+Math.imul(G,An)|0,K=K+Math.imul(G,sn)|0;var yn=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(yn>>>26)|0,yn&=67108863,H=Math.imul(pe,Jt),C=Math.imul(pe,tn),C=C+Math.imul(de,Jt)|0,K=Math.imul(de,tn),H=H+Math.imul(O,Kt)|0,C=C+Math.imul(O,Xt)|0,C=C+Math.imul(X,Kt)|0,K=K+Math.imul(X,Xt)|0,H=H+Math.imul(Be,nn)|0,C=C+Math.imul(Be,rn)|0,C=C+Math.imul(V,nn)|0,K=K+Math.imul(V,rn)|0,H=H+Math.imul(se,An)|0,C=C+Math.imul(se,sn)|0,C=C+Math.imul(fe,An)|0,K=K+Math.imul(fe,sn)|0;var qr=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(qr>>>26)|0,qr&=67108863,H=Math.imul(pe,Kt),C=Math.imul(pe,Xt),C=C+Math.imul(de,Kt)|0,K=Math.imul(de,Xt),H=H+Math.imul(O,nn)|0,C=C+Math.imul(O,rn)|0,C=C+Math.imul(X,nn)|0,K=K+Math.imul(X,rn)|0,H=H+Math.imul(Be,An)|0,C=C+Math.imul(Be,sn)|0,C=C+Math.imul(V,An)|0,K=K+Math.imul(V,sn)|0;var Gt=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,H=Math.imul(pe,nn),C=Math.imul(pe,rn),C=C+Math.imul(de,nn)|0,K=Math.imul(de,rn),H=H+Math.imul(O,An)|0,C=C+Math.imul(O,sn)|0,C=C+Math.imul(X,An)|0,K=K+Math.imul(X,sn)|0;var ot=(W+H|0)+((C&8191)<<13)|0;W=(K+(C>>>13)|0)+(ot>>>26)|0,ot&=67108863,H=Math.imul(pe,An),C=Math.imul(pe,sn),C=C+Math.imul(de,An)|0,K=Math.imul(de,sn);var sr=(W+H|0)+((C&8191)<<13)|0;return W=(K+(C>>>13)|0)+(sr>>>26)|0,sr&=67108863,z[0]=te,z[1]=ye,z[2]=Ee,z[3]=Se,z[4]=we,z[5]=Ne,z[6]=Ke,z[7]=qe,z[8]=et,z[9]=ct,z[10]=ht,z[11]=it,z[12]=Vt,z[13]=un,z[14]=yn,z[15]=qr,z[16]=Gt,z[17]=ot,z[18]=sr,W!==0&&(z[19]=W,R.length++),R};Math.imul||(v=p);function w(T,y,E){E.negative=y.negative^T.negative,E.length=T.length+y.length;for(var R=0,L=0,N=0;N>>26)|0,L+=z>>>26,z&=67108863}E.words[N]=W,R=z,z=L}return R!==0?E.words[N]=R:E.length--,E._strip()}function _(T,y,E){return w(T,y,E)}s.prototype.mulTo=function(y,E){var R,L=this.length+y.length;return this.length===10&&y.length===10?R=v(this,y,E):L<63?R=p(this,y,E):L<1024?R=w(this,y,E):R=_(this,y,E),R},s.prototype.mul=function(y){var E=new s(null);return E.words=new Array(this.length+y.length),this.mulTo(y,E)},s.prototype.mulf=function(y){var E=new s(null);return E.words=new Array(this.length+y.length),_(this,y,E)},s.prototype.imul=function(y){return this.clone().mulTo(y,this)},s.prototype.imuln=function(y){var E=y<0;E&&(y=-y),r(typeof y=="number"),r(y<67108864);for(var R=0,L=0;L>=26,R+=N/67108864|0,R+=z>>>26,this.words[L]=z&67108863}return R!==0&&(this.words[L]=R,this.length++),E?this.ineg():this},s.prototype.muln=function(y){return this.clone().imuln(y)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(y){var E=g(y);if(E.length===0)return new s(1);for(var R=this,L=0;L=0);var E=y%26,R=(y-E)/26,L=67108863>>>26-E<<26-E,N;if(E!==0){var z=0;for(N=0;N>>26-E}z&&(this.words[N]=z,this.length++)}if(R!==0){for(N=this.length-1;N>=0;N--)this.words[N+R]=this.words[N];for(N=0;N=0);var L;E?L=(E-E%26)/26:L=0;var N=y%26,z=Math.min((y-N)/26,this.length),W=67108863^67108863>>>N<z)for(this.length-=z,C=0;C=0&&(K!==0||C>=L);C--){var ee=this.words[C]|0;this.words[C]=K<<26-N|ee>>>N,K=ee&W}return H&&K!==0&&(H.words[H.length++]=K),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(y,E,R){return r(this.negative===0),this.iushrn(y,E,R)},s.prototype.shln=function(y){return this.clone().ishln(y)},s.prototype.ushln=function(y){return this.clone().iushln(y)},s.prototype.shrn=function(y){return this.clone().ishrn(y)},s.prototype.ushrn=function(y){return this.clone().iushrn(y)},s.prototype.testn=function(y){r(typeof y=="number"&&y>=0);var E=y%26,R=(y-E)/26,L=1<=0);var E=y%26,R=(y-E)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=R)return this;if(E!==0&&R++,this.length=Math.min(R,this.length),E!==0){var L=67108863^67108863>>>E<=67108864;E++)this.words[E]-=67108864,E===this.length-1?this.words[E+1]=1:this.words[E+1]++;return this.length=Math.max(this.length,E+1),this},s.prototype.isubn=function(y){if(r(typeof y=="number"),r(y<67108864),y<0)return this.iaddn(-y);if(this.negative!==0)return this.negative=0,this.iaddn(y),this.negative=1,this;if(this.words[0]-=y,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var E=0;E>26)-(H/67108864|0),this.words[N+R]=z&67108863}for(;N>26,this.words[N+R]=z&67108863;if(W===0)return this._strip();for(r(W===-1),W=0,N=0;N>26,this.words[N]=z&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(y,E){var R=this.length-y.length,L=this.clone(),N=y,z=N.words[N.length-1]|0,W=this._countBits(z);R=26-W,R!==0&&(N=N.ushln(R),L.iushln(R),z=N.words[N.length-1]|0);var H=L.length-N.length,C;if(E!=="mod"){C=new s(null),C.length=H+1,C.words=new Array(C.length);for(var K=0;K=0;F--){var re=(L.words[N.length+F]|0)*67108864+(L.words[N.length+F-1]|0);for(re=Math.min(re/z|0,67108863),L._ishlnsubmul(N,re,F);L.negative!==0;)re--,L.negative=0,L._ishlnsubmul(N,1,F),L.isZero()||(L.negative^=1);C&&(C.words[F]=re)}return C&&C._strip(),L._strip(),E!=="div"&&R!==0&&L.iushrn(R),{div:C||null,mod:L}},s.prototype.divmod=function(y,E,R){if(r(!y.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var L,N,z;return this.negative!==0&&y.negative===0?(z=this.neg().divmod(y,E),E!=="mod"&&(L=z.div.neg()),E!=="div"&&(N=z.mod.neg(),R&&N.negative!==0&&N.iadd(y)),{div:L,mod:N}):this.negative===0&&y.negative!==0?(z=this.divmod(y.neg(),E),E!=="mod"&&(L=z.div.neg()),{div:L,mod:z.mod}):this.negative&y.negative?(z=this.neg().divmod(y.neg(),E),E!=="div"&&(N=z.mod.neg(),R&&N.negative!==0&&N.isub(y)),{div:z.div,mod:N}):y.length>this.length||this.cmp(y)<0?{div:new s(0),mod:this}:y.length===1?E==="div"?{div:this.divn(y.words[0]),mod:null}:E==="mod"?{div:null,mod:new s(this.modrn(y.words[0]))}:{div:this.divn(y.words[0]),mod:new s(this.modrn(y.words[0]))}:this._wordDiv(y,E)},s.prototype.div=function(y){return this.divmod(y,"div",!1).div},s.prototype.mod=function(y){return this.divmod(y,"mod",!1).mod},s.prototype.umod=function(y){return this.divmod(y,"mod",!0).mod},s.prototype.divRound=function(y){var E=this.divmod(y);if(E.mod.isZero())return E.div;var R=E.div.negative!==0?E.mod.isub(y):E.mod,L=y.ushrn(1),N=y.andln(1),z=R.cmp(L);return z<0||N===1&&z===0?E.div:E.div.negative!==0?E.div.isubn(1):E.div.iaddn(1)},s.prototype.modrn=function(y){var E=y<0;E&&(y=-y),r(y<=67108863);for(var R=(1<<26)%y,L=0,N=this.length-1;N>=0;N--)L=(R*L+(this.words[N]|0))%y;return E?-L:L},s.prototype.modn=function(y){return this.modrn(y)},s.prototype.idivn=function(y){var E=y<0;E&&(y=-y),r(y<=67108863);for(var R=0,L=this.length-1;L>=0;L--){var N=(this.words[L]|0)+R*67108864;this.words[L]=N/y|0,R=N%y}return this._strip(),E?this.ineg():this},s.prototype.divn=function(y){return this.clone().idivn(y)},s.prototype.egcd=function(y){r(y.negative===0),r(!y.isZero());var E=this,R=y.clone();E.negative!==0?E=E.umod(y):E=E.clone();for(var L=new s(1),N=new s(0),z=new s(0),W=new s(1),H=0;E.isEven()&&R.isEven();)E.iushrn(1),R.iushrn(1),++H;for(var C=R.clone(),K=E.clone();!E.isZero();){for(var ee=0,F=1;!(E.words[0]&F)&&ee<26;++ee,F<<=1);if(ee>0)for(E.iushrn(ee);ee-- >0;)(L.isOdd()||N.isOdd())&&(L.iadd(C),N.isub(K)),L.iushrn(1),N.iushrn(1);for(var re=0,ce=1;!(R.words[0]&ce)&&re<26;++re,ce<<=1);if(re>0)for(R.iushrn(re);re-- >0;)(z.isOdd()||W.isOdd())&&(z.iadd(C),W.isub(K)),z.iushrn(1),W.iushrn(1);E.cmp(R)>=0?(E.isub(R),L.isub(z),N.isub(W)):(R.isub(E),z.isub(L),W.isub(N))}return{a:z,b:W,gcd:R.iushln(H)}},s.prototype._invmp=function(y){r(y.negative===0),r(!y.isZero());var E=this,R=y.clone();E.negative!==0?E=E.umod(y):E=E.clone();for(var L=new s(1),N=new s(0),z=R.clone();E.cmpn(1)>0&&R.cmpn(1)>0;){for(var W=0,H=1;!(E.words[0]&H)&&W<26;++W,H<<=1);if(W>0)for(E.iushrn(W);W-- >0;)L.isOdd()&&L.iadd(z),L.iushrn(1);for(var C=0,K=1;!(R.words[0]&K)&&C<26;++C,K<<=1);if(C>0)for(R.iushrn(C);C-- >0;)N.isOdd()&&N.iadd(z),N.iushrn(1);E.cmp(R)>=0?(E.isub(R),L.isub(N)):(R.isub(E),N.isub(L))}var ee;return E.cmpn(1)===0?ee=L:ee=N,ee.cmpn(0)<0&&ee.iadd(y),ee},s.prototype.gcd=function(y){if(this.isZero())return y.abs();if(y.isZero())return this.abs();var E=this.clone(),R=y.clone();E.negative=0,R.negative=0;for(var L=0;E.isEven()&&R.isEven();L++)E.iushrn(1),R.iushrn(1);do{for(;E.isEven();)E.iushrn(1);for(;R.isEven();)R.iushrn(1);var N=E.cmp(R);if(N<0){var z=E;E=R,R=z}else if(N===0||R.cmpn(1)===0)break;E.isub(R)}while(!0);return R.iushln(L)},s.prototype.invm=function(y){return this.egcd(y).a.umod(y)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(y){return this.words[0]&y},s.prototype.bincn=function(y){r(typeof y=="number");var E=y%26,R=(y-E)/26,L=1<>>26,W&=67108863,this.words[z]=W}return N!==0&&(this.words[z]=N,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(y){var E=y<0;if(this.negative!==0&&!E)return-1;if(this.negative===0&&E)return 1;this._strip();var R;if(this.length>1)R=1;else{E&&(y=-y),r(y<=67108863,"Number is too big");var L=this.words[0]|0;R=L===y?0:Ly.length)return 1;if(this.length=0;R--){var L=this.words[R]|0,N=y.words[R]|0;if(L!==N){LN&&(E=1);break}}return E},s.prototype.gtn=function(y){return this.cmpn(y)===1},s.prototype.gt=function(y){return this.cmp(y)===1},s.prototype.gten=function(y){return this.cmpn(y)>=0},s.prototype.gte=function(y){return this.cmp(y)>=0},s.prototype.ltn=function(y){return this.cmpn(y)===-1},s.prototype.lt=function(y){return this.cmp(y)===-1},s.prototype.lten=function(y){return this.cmpn(y)<=0},s.prototype.lte=function(y){return this.cmp(y)<=0},s.prototype.eqn=function(y){return this.cmpn(y)===0},s.prototype.eq=function(y){return this.cmp(y)===0},s.red=function(y){return new P(y)},s.prototype.toRed=function(y){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),y.convertTo(this)._forceRed(y)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(y){return this.red=y,this},s.prototype.forceRed=function(y){return r(!this.red,"Already a number in reduction context"),this._forceRed(y)},s.prototype.redAdd=function(y){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,y)},s.prototype.redIAdd=function(y){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,y)},s.prototype.redSub=function(y){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,y)},s.prototype.redISub=function(y){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,y)},s.prototype.redShl=function(y){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,y)},s.prototype.redMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.mul(this,y)},s.prototype.redIMul=function(y){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,y),this.red.imul(this,y)},s.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(y){return r(this.red&&!y.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,y)};var x={k256:null,p224:null,p192:null,p25519:null};function b(T,y){this.name=T,this.p=new s(y,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}b.prototype._tmp=function(){var y=new s(null);return y.words=new Array(Math.ceil(this.n/13)),y},b.prototype.ireduce=function(y){var E=y,R;do this.split(E,this.tmp),E=this.imulK(E),E=E.iadd(this.tmp),R=E.bitLength();while(R>this.n);var L=R0?E.isub(this.p):E.strip!==void 0?E.strip():E._strip(),E},b.prototype.split=function(y,E){y.iushrn(this.n,0,E)},b.prototype.imulK=function(y){return y.imul(this.k)};function B(){b.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(B,b),B.prototype.split=function(y,E){for(var R=4194303,L=Math.min(y.length,9),N=0;N>>22,z=W}z>>>=22,y.words[N-10]=z,z===0&&y.length>10?y.length-=10:y.length-=9},B.prototype.imulK=function(y){y.words[y.length]=0,y.words[y.length+1]=0,y.length+=2;for(var E=0,R=0;R>>=26,y.words[R]=N,E=L}return E!==0&&(y.words[y.length++]=E),y},s._prime=function(y){if(x[y])return x[y];var E;if(y==="k256")E=new B;else if(y==="p224")E=new S;else if(y==="p192")E=new I;else if(y==="p25519")E=new M;else throw new Error("Unknown prime "+y);return x[y]=E,E};function P(T){if(typeof T=="string"){var y=s._prime(T);this.m=y.p,this.prime=y}else r(T.gtn(1),"modulus must be greater than 1"),this.m=T,this.prime=null}P.prototype._verify1=function(y){r(y.negative===0,"red works only with positives"),r(y.red,"red works only with red numbers")},P.prototype._verify2=function(y,E){r((y.negative|E.negative)===0,"red works only with positives"),r(y.red&&y.red===E.red,"red works only with red numbers")},P.prototype.imod=function(y){return this.prime?this.prime.ireduce(y)._forceRed(this):(A(y,y.umod(this.m)._forceRed(this)),y)},P.prototype.neg=function(y){return y.isZero()?y.clone():this.m.sub(y)._forceRed(this)},P.prototype.add=function(y,E){this._verify2(y,E);var R=y.add(E);return R.cmp(this.m)>=0&&R.isub(this.m),R._forceRed(this)},P.prototype.iadd=function(y,E){this._verify2(y,E);var R=y.iadd(E);return R.cmp(this.m)>=0&&R.isub(this.m),R},P.prototype.sub=function(y,E){this._verify2(y,E);var R=y.sub(E);return R.cmpn(0)<0&&R.iadd(this.m),R._forceRed(this)},P.prototype.isub=function(y,E){this._verify2(y,E);var R=y.isub(E);return R.cmpn(0)<0&&R.iadd(this.m),R},P.prototype.shl=function(y,E){return this._verify1(y),this.imod(y.ushln(E))},P.prototype.imul=function(y,E){return this._verify2(y,E),this.imod(y.imul(E))},P.prototype.mul=function(y,E){return this._verify2(y,E),this.imod(y.mul(E))},P.prototype.isqr=function(y){return this.imul(y,y.clone())},P.prototype.sqr=function(y){return this.mul(y,y)},P.prototype.sqrt=function(y){if(y.isZero())return y.clone();var E=this.m.andln(3);if(r(E%2===1),E===3){var R=this.m.add(new s(1)).iushrn(2);return this.pow(y,R)}for(var L=this.m.subn(1),N=0;!L.isZero()&&L.andln(1)===0;)N++,L.iushrn(1);r(!L.isZero());var z=new s(1).toRed(this),W=z.redNeg(),H=this.m.subn(1).iushrn(1),C=this.m.bitLength();for(C=new s(2*C*C).toRed(this);this.pow(C,H).cmp(W)!==0;)C.redIAdd(W);for(var K=this.pow(C,L),ee=this.pow(y,L.addn(1).iushrn(1)),F=this.pow(y,L),re=N;F.cmp(z)!==0;){for(var ce=F,oe=0;ce.cmp(z)!==0;oe++)ce=ce.redSqr();r(oe=0;N--){for(var K=E.words[N],ee=C-1;ee>=0;ee--){var F=K>>ee&1;if(z!==L[0]&&(z=this.sqr(z)),F===0&&W===0){H=0;continue}W<<=1,W|=F,H++,!(H!==R&&(N!==0||ee!==0))&&(z=this.mul(z,L[W]),H=0,W=0)}C=26}return z},P.prototype.convertTo=function(y){var E=y.umod(this.m);return E===y?E.clone():E},P.prototype.convertFrom=function(y){var E=y.clone();return E.red=null,E},s.mont=function(y){return new D(y)};function D(T){P.call(this,T),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(D,P),D.prototype.convertTo=function(y){return this.imod(y.ushln(this.shift))},D.prototype.convertFrom=function(y){var E=this.imod(y.mul(this.rinv));return E.red=null,E},D.prototype.imul=function(y,E){if(y.isZero()||E.isZero())return y.words[0]=0,y.length=1,y;var R=y.imul(E),L=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),N=R.isub(L).iushrn(this.shift),z=N;return N.cmp(this.m)>=0?z=N.isub(this.m):N.cmpn(0)<0&&(z=N.iadd(this.m)),z._forceRed(this)},D.prototype.mul=function(y,E){if(y.isZero()||E.isZero())return new s(0)._forceRed(this);var R=y.mul(E),L=R.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),N=R.isub(L).iushrn(this.shift),z=N;return N.cmp(this.m)>=0?z=N.isub(this.m):N.cmpn(0)<0&&(z=N.iadd(this.m)),z._forceRed(this)},D.prototype.invm=function(y){var E=this.imod(y._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(n,La)})(sI);var qW=sI.exports;const wt=oc(qW),JW="logger/5.7.0";let BU=!1,SU=!1;const ew={debug:1,default:2,info:2,warning:3,error:4,off:5};let MU=ew.default,Ab=null;function e9(){try{const n=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{n.push(e)}}),n.length)throw new Error("missing "+n.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(n){return n.message}return null}const CU=e9();var BS;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(BS||(BS={}));var Vo;(function(n){n.UNKNOWN_ERROR="UNKNOWN_ERROR",n.NOT_IMPLEMENTED="NOT_IMPLEMENTED",n.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",n.NETWORK_ERROR="NETWORK_ERROR",n.SERVER_ERROR="SERVER_ERROR",n.TIMEOUT="TIMEOUT",n.BUFFER_OVERRUN="BUFFER_OVERRUN",n.NUMERIC_FAULT="NUMERIC_FAULT",n.MISSING_NEW="MISSING_NEW",n.INVALID_ARGUMENT="INVALID_ARGUMENT",n.MISSING_ARGUMENT="MISSING_ARGUMENT",n.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",n.CALL_EXCEPTION="CALL_EXCEPTION",n.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",n.NONCE_EXPIRED="NONCE_EXPIRED",n.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",n.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",n.TRANSACTION_REPLACED="TRANSACTION_REPLACED",n.ACTION_REJECTED="ACTION_REJECTED"})(Vo||(Vo={}));const TU="0123456789abcdef";let _e=class Rr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();ew[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(MU>ew[r])&&console.log.apply(console,t)}debug(...e){this._log(Rr.levels.DEBUG,e)}info(...e){this._log(Rr.levels.INFO,e)}warn(...e){this._log(Rr.levels.WARNING,e)}makeError(e,t,r){if(SU)return this.makeError("censored error",t,{});t||(t=Rr.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(l=>{const c=r[l];try{if(c instanceof Uint8Array){let A="";for(let u=0;u>4],A+=TU[c[u]&15];i.push(l+"=Uint8Array(0x"+A+")")}else i.push(l+"="+JSON.stringify(c))}catch{i.push(l+"="+JSON.stringify(r[l].toString()))}}),i.push(`code=${t}`),i.push(`version=${this.version}`);const s=e;let o="";switch(t){case Vo.NUMERIC_FAULT:{o="NUMERIC_FAULT";const l=e;switch(l){case"overflow":case"underflow":case"division-by-zero":o+="-"+l;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result";break}break}case Vo.CALL_EXCEPTION:case Vo.INSUFFICIENT_FUNDS:case Vo.MISSING_NEW:case Vo.NONCE_EXPIRED:case Vo.REPLACEMENT_UNDERPRICED:case Vo.TRANSACTION_REPLACED:case Vo.UNPREDICTABLE_GAS_LIMIT:o=t;break}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const a=new Error(e);return a.reason=s,a.code=t,Object.keys(r).forEach(function(l){a[l]=r[l]}),a}throwError(e,t,r){throw this.makeError(e,t,r)}throwArgumentError(e,t,r){return this.throwError(e,Rr.errors.INVALID_ARGUMENT,{argument:t,value:r})}assert(e,t,r,i){e||this.throwError(t,r,i)}assertArgument(e,t,r,i){e||this.throwArgumentError(t,r,i)}checkNormalize(e){CU&&this.throwError("platform missing String.prototype.normalize",Rr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:CU})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,Rr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,Rr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,r){r?r=": "+r:r="",et&&this.throwError("too many arguments"+r,Rr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",Rr.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",Rr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Rr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return Ab||(Ab=new Rr(JW)),Ab}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",Rr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),BU){if(!e)return;this.globalLogger().throwError("error censorship permanent",Rr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}SU=!!e,BU=!!t}static setLogLevel(e){const t=ew[e.toLowerCase()];if(t==null){Rr.globalLogger().warn("invalid log level - "+e);return}MU=t}static from(e){return new Rr(e)}};_e.errors=Vo;_e.levels=BS;const t9="bytes/5.7.0",Zn=new _e(t9);function Y4(n){return!!n.toHexString}function jh(n){return n.slice||(n.slice=function(){const e=Array.prototype.slice.call(arguments);return jh(new Uint8Array(Array.prototype.slice.apply(n,e)))}),n}function oI(n){return Tt(n)&&!(n.length%2)||Tx(n)}function IU(n){return typeof n=="number"&&n==n&&n%1===0}function Tx(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!IU(n.length)||n.length<0)return!1;for(let e=0;e=256)return!1}return!0}function ft(n,e){if(e||(e={}),typeof n=="number"){Zn.checkSafeUint53(n,"invalid arrayify value");const t=[];for(;n;)t.unshift(n&255),n=parseInt(String(n/256));return t.length===0&&t.push(0),jh(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),Y4(n)&&(n=n.toHexString()),Tt(n)){let t=n.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Zn.throwArgumentError("hex data is odd-length","value",n));const r=[];for(let i=0;ift(i)),t=e.reduce((i,s)=>i+s.length,0),r=new Uint8Array(t);return e.reduce((i,s)=>(r.set(s,i),i+s.length),0),jh(r)}function fd(n){let e=ft(n);if(e.length===0)return e;let t=0;for(;te&&Zn.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(n,e-n.length),jh(t)}function Tt(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||e&&n.length!==2+2*e)}const ub="0123456789abcdef";function at(n,e){if(e||(e={}),typeof n=="number"){Zn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=ub[n&15]+t,n=Math.floor(n/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if(typeof n=="bigint")return n=n.toString(16),n.length%2?"0x0"+n:"0x"+n;if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),Y4(n))return n.toHexString();if(Tt(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Zn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(Tx(n)){let t="0x";for(let r=0;r>4]+ub[i&15]}return t}return Zn.throwArgumentError("invalid hexlify value","value",n)}function Eu(n){if(typeof n!="string")n=at(n);else if(!Tt(n)||n.length%2)return null;return(n.length-2)/2}function mi(n,e,t){return typeof n!="string"?n=at(n):(!Tt(n)||n.length%2)&&Zn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function Yi(n){let e="0x";return n.forEach(t=>{e+=at(t).substring(2)}),e}function Ix(n){const e=r9(at(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function r9(n){typeof n!="string"&&(n=at(n)),Tt(n)||Zn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Zn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function Rx(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(oI(n)){let t=ft(n);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=at(t.slice(0,32)),e.s=at(t.slice(32,64))):t.length===65?(e.r=at(t.slice(0,32)),e.s=at(t.slice(32,64)),e.v=t[64]):Zn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Zn.throwArgumentError("signature invalid v byte","signature",n)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=at(t.slice(32,64))}else{if(e.r=n.r,e.s=n.s,e.v=n.v,e.recoveryParam=n.recoveryParam,e._vs=n._vs,e._vs!=null){const i=n9(ft(e._vs),32);e._vs=at(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Zn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=at(i);e.s==null?e.s=o:e.s!==o&&Zn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Zn.throwArgumentError("signature missing v and recoveryParam","signature",n):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&Zn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!Tt(e.r)?Zn.throwArgumentError("signature missing or invalid r","signature",n):e.r=rr(e.r,32),e.s==null||!Tt(e.s)?Zn.throwArgumentError("signature missing or invalid s","signature",n):e.s=rr(e.s,32);const t=ft(e.s);t[0]>=128&&Zn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=at(t);e._vs&&(Tt(e._vs)||Zn.throwArgumentError("signature invalid _vs","signature",n),e._vs=rr(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Zn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const i9="bignumber/5.7.0";var Ww=wt.BN;const Ml=new _e(i9),fb={},RU=9007199254740991;let UU=!1;class Ve{constructor(e,t){e!==fb&&Ml.throwError("cannot call constructor directly; use BigNumber.from",_e.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Gi(Lt(this).fromTwos(e))}toTwos(e){return Gi(Lt(this).toTwos(e))}abs(){return this._hex[0]==="-"?Ve.from(this._hex.substring(1)):this}add(e){return Gi(Lt(this).add(Lt(e)))}sub(e){return Gi(Lt(this).sub(Lt(e)))}div(e){return Ve.from(e).isZero()&&Xs("division-by-zero","div"),Gi(Lt(this).div(Lt(e)))}mul(e){return Gi(Lt(this).mul(Lt(e)))}mod(e){const t=Lt(e);return t.isNeg()&&Xs("division-by-zero","mod"),Gi(Lt(this).umod(t))}pow(e){const t=Lt(e);return t.isNeg()&&Xs("negative-power","pow"),Gi(Lt(this).pow(t))}and(e){const t=Lt(e);return(this.isNegative()||t.isNeg())&&Xs("unbound-bitwise-result","and"),Gi(Lt(this).and(t))}or(e){const t=Lt(e);return(this.isNegative()||t.isNeg())&&Xs("unbound-bitwise-result","or"),Gi(Lt(this).or(t))}xor(e){const t=Lt(e);return(this.isNegative()||t.isNeg())&&Xs("unbound-bitwise-result","xor"),Gi(Lt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Xs("negative-width","mask"),Gi(Lt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Xs("negative-width","shl"),Gi(Lt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Xs("negative-width","shr"),Gi(Lt(this).shrn(e))}eq(e){return Lt(this).eq(Lt(e))}lt(e){return Lt(this).lt(Lt(e))}lte(e){return Lt(this).lte(Lt(e))}gt(e){return Lt(this).gt(Lt(e))}gte(e){return Lt(this).gte(Lt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Lt(this).isZero()}toNumber(){try{return Lt(this).toNumber()}catch{Xs("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ml.throwError("this platform does not support BigInt",_e.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?UU||(UU=!0,Ml.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ml.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",_e.errors.UNEXPECTED_ARGUMENT,{}):Ml.throwError("BigNumber.toString does not accept parameters",_e.errors.UNEXPECTED_ARGUMENT,{})),Lt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Ve)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Ve(fb,lg(e)):e.match(/^-?[0-9]+$/)?new Ve(fb,lg(new Ww(e))):Ml.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Xs("underflow","BigNumber.from",e),(e>=RU||e<=-RU)&&Xs("overflow","BigNumber.from",e),Ve.from(String(e));const t=e;if(typeof t=="bigint")return Ve.from(t.toString());if(Tx(t))return Ve.from(at(t));if(t)if(t.toHexString){const r=t.toHexString();if(typeof r=="string")return Ve.from(r)}else{let r=t._hex;if(r==null&&t.type==="BigNumber"&&(r=t.hex),typeof r=="string"&&(Tt(r)||r[0]==="-"&&Tt(r.substring(1))))return Ve.from(r)}return Ml.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function lg(n){if(typeof n!="string")return lg(n.toString(16));if(n[0]==="-")return n=n.substring(1),n[0]==="-"&&Ml.throwArgumentError("invalid hex","value",n),n=lg(n),n==="0x00"?n:"-"+n;if(n.substring(0,2)!=="0x"&&(n="0x"+n),n==="0x")return"0x00";for(n.length%2&&(n="0x0"+n.substring(2));n.length>4&&n.substring(0,4)==="0x00";)n="0x"+n.substring(4);return n}function Gi(n){return Ve.from(lg(n))}function Lt(n){const e=Ve.from(n).toHexString();return e[0]==="-"?new Ww("-"+e.substring(3),16):new Ww(e.substring(2),16)}function Xs(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),Ml.throwError(n,_e.errors.NUMERIC_FAULT,r)}function s9(n){return new Ww(n,36).toString(16)}const o9="properties/5.7.0";var a9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Kw=new _e(o9);function Pe(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function Ms(n,e){for(let t=0;t<32;t++){if(n[e])return n[e];if(!n.prototype||typeof n.prototype!="object")break;n=Object.getPrototypeOf(n.prototype).constructor}return null}function wr(n){return a9(this,void 0,void 0,function*(){const e=Object.keys(n).map(r=>{const i=n[r];return Promise.resolve(i).then(s=>({key:r,value:s}))});return(yield Promise.all(e)).reduce((r,i)=>(r[i.key]=i.value,r),{})})}function l9(n,e){(!n||typeof n!="object")&&Kw.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||Kw.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function kn(n){const e={};for(const t in n)e[t]=n[t];return e}const c9={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function $4(n){if(n==null||c9[typeof n])return!0;if(Array.isArray(n)||typeof n=="object"){if(!Object.isFrozen(n))return!1;const e=Object.keys(n);for(let t=0;tFs(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Pe(e,t,Fs(r))}return e}return Kw.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function Fs(n){return A9(n)}class o0{constructor(e){for(const t in e)this[t]=Fs(e[t])}}const u9="abstract-provider/5.7.0";var f9=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const h9=new _e(u9);class d9 extends o0{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class a0{constructor(){h9.checkAbstract(new.target,a0),Pe(this,"_isProvider",!0)}getFeeData(){return f9(this,void 0,void 0,function*(){const{block:e,gasPrice:t}=yield wr({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(o=>null)});let r=null,i=null,s=null;return e&&e.baseFeePerGas&&(r=e.baseFeePerGas,s=Ve.from("1500000000"),i=e.baseFeePerGas.mul(2).add(s)),{lastBaseFeePerGas:r,maxFeePerGas:i,maxPriorityFeePerGas:s,gasPrice:t}})}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!!(e&&e._isProvider)}}const p9="networks/5.7.1",FU=new _e(p9);function m9(n){return n&&typeof n.renetwork=="function"}function Ul(n){const e=function(t,r){r==null&&(r={});const i=[];if(t.InfuraProvider&&r.infura!=="-")try{i.push(new t.InfuraProvider(n,r.infura))}catch{}if(t.EtherscanProvider&&r.etherscan!=="-")try{i.push(new t.EtherscanProvider(n,r.etherscan))}catch{}if(t.AlchemyProvider&&r.alchemy!=="-")try{i.push(new t.AlchemyProvider(n,r.alchemy))}catch{}if(t.PocketProvider&&r.pocket!=="-"){const s=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(n,r.pocket);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}}if(t.CloudflareProvider&&r.cloudflare!=="-")try{i.push(new t.CloudflareProvider(n))}catch{}if(t.AnkrProvider&&r.ankr!=="-")try{const s=["ropsten"],o=new t.AnkrProvider(n,r.ankr);o.network&&s.indexOf(o.network.name)===-1&&i.push(o)}catch{}if(i.length===0)return null;if(t.FallbackProvider){let s=1;return r.quorum!=null?s=r.quorum:n==="homestead"&&(s=2),new t.FallbackProvider(i,s)}return i[0]};return e.renetwork=function(t){return Ul(t)},e}function Xw(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return Xw(n,r)},t}const PU={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Ul("homestead")},LU={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Ul("ropsten")},DU={chainId:63,name:"classicMordor",_defaultProvider:Xw("https://www.ethercluster.com/mordor","classicMordor")},k0={unspecified:{chainId:0,name:"unspecified"},homestead:PU,mainnet:PU,morden:{chainId:2,name:"morden"},ropsten:LU,testnet:LU,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Ul("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Ul("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Ul("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Ul("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:Xw("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:DU,classicTestnet:DU,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Xw("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Ul("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Ul("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Z4(n){if(n==null)return null;if(typeof n=="number"){for(const r in k0){const i=k0[r];if(i.chainId===n)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:n,name:"unknown"}}if(typeof n=="string"){const r=k0[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=k0[n.name];if(!e)return typeof n.chainId!="number"&&FU.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&FU.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(m9(e._defaultProvider)?t=e._defaultProvider.renetwork(n):t=e._defaultProvider),{name:n.name,chainId:e.chainId,ensAddress:n.ensAddress||e.ensAddress||null,_defaultProvider:t}}function q4(n){n=atob(n);const e=[];for(let t=0;t0;)r.push(o%this.base),o=o/this.base|0}let i="";for(let s=0;t[s]===0&&s=0;--s)i+=this.alphabet[r[s]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let t=[];if(e.length===0)return new Uint8Array(t);t.push(0);for(let r=0;r>=8;for(;s>0;)t.push(s&255),s>>=8}for(let r=0;e[r]===this._leader&&r>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ce>>5,this.extraBytes=(ce&31)>>3;for(var oe=0;oe<50;++oe)this.s[oe]=0}C.prototype.update=function(F){if(this.finalized)throw new Error(t);var re,ce=typeof F;if(ce!=="string"){if(ce==="object"){if(F===null)throw new Error(e);if(l&&F.constructor===ArrayBuffer)F=new Uint8Array(F);else if(!Array.isArray(F)&&(!l||!ArrayBuffer.isView(F)))throw new Error(e)}else throw new Error(e);re=!0}for(var oe=this.blocks,ge=this.byteCount,me=F.length,ve=this.blockCount,be=0,ne=this.s,k,ae;be>2]|=F[be]<>2]|=ae<>2]|=(192|ae>>6)<>2]|=(128|ae&63)<=57344?(oe[k>>2]|=(224|ae>>12)<>2]|=(128|ae>>6&63)<>2]|=(128|ae&63)<>2]|=(240|ae>>18)<>2]|=(128|ae>>12&63)<>2]|=(128|ae>>6&63)<>2]|=(128|ae&63)<=ge){for(this.start=k-ge,this.block=oe[ve],k=0;k>8,ce=F&255;ce>0;)ge.unshift(ce),F=F>>8,ce=F&255,++oe;return re?ge.push(oe):ge.unshift(oe),this.update(ge),ge.length},C.prototype.encodeString=function(F){var re,ce=typeof F;if(ce!=="string"){if(ce==="object"){if(F===null)throw new Error(e);if(l&&F.constructor===ArrayBuffer)F=new Uint8Array(F);else if(!Array.isArray(F)&&(!l||!ArrayBuffer.isView(F)))throw new Error(e)}else throw new Error(e);re=!0}var oe=0,ge=F.length;if(re)oe=ge;else for(var me=0;me=57344?oe+=3:(ve=65536+((ve&1023)<<10|F.charCodeAt(++me)&1023),oe+=4)}return oe+=this.encode(oe*8),this.update(F),oe},C.prototype.bytepad=function(F,re){for(var ce=this.encode(re),oe=0;oe>2]|=this.padding[re&3],this.lastByteIndex===this.byteCount)for(F[0]=F[ce],re=1;re>4&15]+c[be&15]+c[be>>12&15]+c[be>>8&15]+c[be>>20&15]+c[be>>16&15]+c[be>>28&15]+c[be>>24&15];me%F===0&&(te(re),ge=0)}return oe&&(be=re[ge],ve+=c[be>>4&15]+c[be&15],oe>1&&(ve+=c[be>>12&15]+c[be>>8&15]),oe>2&&(ve+=c[be>>20&15]+c[be>>16&15])),ve},C.prototype.arrayBuffer=function(){this.finalize();var F=this.blockCount,re=this.s,ce=this.outputBlocks,oe=this.extraBytes,ge=0,me=0,ve=this.outputBits>>3,be;oe?be=new ArrayBuffer(ce+1<<2):be=new ArrayBuffer(ve);for(var ne=new Uint32Array(be);me>8&255,ve[be+2]=ne>>16&255,ve[be+3]=ne>>24&255;me%F===0&&te(re)}return oe&&(be=me<<2,ne=re[ge],ve[be]=ne&255,oe>1&&(ve[be+1]=ne>>8&255),oe>2&&(ve[be+2]=ne>>16&255)),ve};function K(F,re,ce){C.call(this,F,re,ce)}K.prototype=new C,K.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var te=function(F){var re,ce,oe,ge,me,ve,be,ne,k,ae,le,Z,J,ue,Y,G,j,se,fe,he,Be,V,R,D,X,ie,pe,de,Ie,Le,Ue,Ye,Ae,Fe,Me,Ce,Re,Oe,$e,dt,Fn,nt,_t,Cr,en,qt,$r,Jt,tn,js,Kt,Xt,Ci,nn,rn,ua,An,sn,ee,ye,Ee,Se,we;for(oe=0;oe<48;oe+=2)ge=F[0]^F[10]^F[20]^F[30]^F[40],me=F[1]^F[11]^F[21]^F[31]^F[41],ve=F[2]^F[12]^F[22]^F[32]^F[42],be=F[3]^F[13]^F[23]^F[33]^F[43],ne=F[4]^F[14]^F[24]^F[34]^F[44],k=F[5]^F[15]^F[25]^F[35]^F[45],ae=F[6]^F[16]^F[26]^F[36]^F[46],le=F[7]^F[17]^F[27]^F[37]^F[47],Z=F[8]^F[18]^F[28]^F[38]^F[48],J=F[9]^F[19]^F[29]^F[39]^F[49],re=Z^(ve<<1|be>>>31),ce=J^(be<<1|ve>>>31),F[0]^=re,F[1]^=ce,F[10]^=re,F[11]^=ce,F[20]^=re,F[21]^=ce,F[30]^=re,F[31]^=ce,F[40]^=re,F[41]^=ce,re=ge^(ne<<1|k>>>31),ce=me^(k<<1|ne>>>31),F[2]^=re,F[3]^=ce,F[12]^=re,F[13]^=ce,F[22]^=re,F[23]^=ce,F[32]^=re,F[33]^=ce,F[42]^=re,F[43]^=ce,re=ve^(ae<<1|le>>>31),ce=be^(le<<1|ae>>>31),F[4]^=re,F[5]^=ce,F[14]^=re,F[15]^=ce,F[24]^=re,F[25]^=ce,F[34]^=re,F[35]^=ce,F[44]^=re,F[45]^=ce,re=ne^(Z<<1|J>>>31),ce=k^(J<<1|Z>>>31),F[6]^=re,F[7]^=ce,F[16]^=re,F[17]^=ce,F[26]^=re,F[27]^=ce,F[36]^=re,F[37]^=ce,F[46]^=re,F[47]^=ce,re=ae^(ge<<1|me>>>31),ce=le^(me<<1|ge>>>31),F[8]^=re,F[9]^=ce,F[18]^=re,F[19]^=ce,F[28]^=re,F[29]^=ce,F[38]^=re,F[39]^=ce,F[48]^=re,F[49]^=ce,ue=F[0],Y=F[1],qt=F[11]<<4|F[10]>>>28,$r=F[10]<<4|F[11]>>>28,de=F[20]<<3|F[21]>>>29,Ie=F[21]<<3|F[20]>>>29,ye=F[31]<<9|F[30]>>>23,Ee=F[30]<<9|F[31]>>>23,nt=F[40]<<18|F[41]>>>14,_t=F[41]<<18|F[40]>>>14,Fe=F[2]<<1|F[3]>>>31,Me=F[3]<<1|F[2]>>>31,G=F[13]<<12|F[12]>>>20,j=F[12]<<12|F[13]>>>20,Jt=F[22]<<10|F[23]>>>22,tn=F[23]<<10|F[22]>>>22,Le=F[33]<<13|F[32]>>>19,Ue=F[32]<<13|F[33]>>>19,Se=F[42]<<2|F[43]>>>30,we=F[43]<<2|F[42]>>>30,nn=F[5]<<30|F[4]>>>2,rn=F[4]<<30|F[5]>>>2,Ce=F[14]<<6|F[15]>>>26,Re=F[15]<<6|F[14]>>>26,se=F[25]<<11|F[24]>>>21,fe=F[24]<<11|F[25]>>>21,js=F[34]<<15|F[35]>>>17,Kt=F[35]<<15|F[34]>>>17,Ye=F[45]<<29|F[44]>>>3,Ae=F[44]<<29|F[45]>>>3,D=F[6]<<28|F[7]>>>4,X=F[7]<<28|F[6]>>>4,ua=F[17]<<23|F[16]>>>9,An=F[16]<<23|F[17]>>>9,Oe=F[26]<<25|F[27]>>>7,$e=F[27]<<25|F[26]>>>7,he=F[36]<<21|F[37]>>>11,Be=F[37]<<21|F[36]>>>11,Xt=F[47]<<24|F[46]>>>8,Ci=F[46]<<24|F[47]>>>8,Cr=F[8]<<27|F[9]>>>5,en=F[9]<<27|F[8]>>>5,ie=F[18]<<20|F[19]>>>12,pe=F[19]<<20|F[18]>>>12,sn=F[29]<<7|F[28]>>>25,ee=F[28]<<7|F[29]>>>25,dt=F[38]<<8|F[39]>>>24,Fn=F[39]<<8|F[38]>>>24,V=F[48]<<14|F[49]>>>18,R=F[49]<<14|F[48]>>>18,F[0]=ue^~G&se,F[1]=Y^~j&fe,F[10]=D^~ie&de,F[11]=X^~pe&Ie,F[20]=Fe^~Ce&Oe,F[21]=Me^~Re&$e,F[30]=Cr^~qt&Jt,F[31]=en^~$r&tn,F[40]=nn^~ua&sn,F[41]=rn^~An&ee,F[2]=G^~se&he,F[3]=j^~fe&Be,F[12]=ie^~de&Le,F[13]=pe^~Ie&Ue,F[22]=Ce^~Oe&dt,F[23]=Re^~$e&Fn,F[32]=qt^~Jt&js,F[33]=$r^~tn&Kt,F[42]=ua^~sn&ye,F[43]=An^~ee&Ee,F[4]=se^~he&V,F[5]=fe^~Be&R,F[14]=de^~Le&Ye,F[15]=Ie^~Ue&Ae,F[24]=Oe^~dt&nt,F[25]=$e^~Fn&_t,F[34]=Jt^~js&Xt,F[35]=tn^~Kt&Ci,F[44]=sn^~ye&Se,F[45]=ee^~Ee&we,F[6]=he^~V&ue,F[7]=Be^~R&Y,F[16]=Le^~Ye&D,F[17]=Ue^~Ae&X,F[26]=dt^~nt&Fe,F[27]=Fn^~_t&Me,F[36]=js^~Xt&Cr,F[37]=Kt^~Ci&en,F[46]=ye^~Se&nn,F[47]=Ee^~we&rn,F[8]=V^~ue&G,F[9]=R^~Y&j,F[18]=Ye^~D&ie,F[19]=Ae^~X&pe,F[28]=nt^~Fe&Ce,F[29]=_t^~Me&Re,F[38]=Xt^~Cr&qt,F[39]=Ci^~en&$r,F[48]=Se^~nn&ua,F[49]=we^~rn&An,F[0]^=m[oe],F[1]^=m[oe+1]};if(a)n.exports=y;else for(U=0;U>6===2;o++)s++;return s}return n===_s.OVERRUN?t.length-e-1:0}function E9(n,e,t,r,i){return n===_s.OVERLONG?(r.push(i),0):(r.push(65533),nH(n,e,t))}const B9=Object.freeze({error:b9,ignore:nH,replace:E9});function rH(n,e){e==null&&(e=B9.error),n=ft(n);const t=[];let r=0;for(;r>7)){t.push(i);continue}let s=null,o=null;if((i&224)===192)s=1,o=127;else if((i&240)===224)s=2,o=2047;else if((i&248)===240)s=3,o=65535;else{(i&192)===128?r+=e(_s.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(_s.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(_s.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(_s.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(_s.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(_s.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function Wa(n,e=lg.current){e!=lg.current&&(tH.checkNormalize(),n=n.normalize(e));let t=[];for(let r=0;r>6|192),t.push(i&63|128);else if((i&64512)==55296){r++;const s=n.charCodeAt(r);if(r>=n.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(i>>12|224),t.push(i>>6&63|128),t.push(i&63|128)}return ft(t)}function S9(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function o0(n,e){return S9(rH(n,e))}function M9(n,e=lg.current){return rH(Wa(n,e))}function uh(n){return Er(Wa(n))}const iH="hash/5.7.0";function sH(n,e){e==null&&(e=1);const t=[],r=t.forEach,i=function(s,o){r.call(s,function(a){o>0&&Array.isArray(a)?i(a,o-1):t.push(a)})};return i(n,e),t}function C9(n){const e={};for(let t=0;t>--l&1}const u=31,f=Math.pow(2,u),h=f>>>1,d=h>>1,m=f-1;let g=0;for(let x=0;x1;){let S=b+B>>>1;x>>1|A(),M=M<<1^h,I=(I^h)<<1|h|1;v=M,w=1+I-M}let _=r-4;return p.map(x=>{switch(x-_){case 3:return _+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return _+256+(n[a++]<<8|n[a++]);case 1:return _+n[a++];default:return x-1}})}function I9(n){let e=0;return()=>n[e++]}function R9(n){return I9(T9(n))}function U9(n){return n&1?~n>>1:n>>1}function F9(n,e){let t=Array(n);for(let r=0;re[o]):t}function L9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(N9(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(O9(t,n))}return C9(sH(e))}function D9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function oH(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function N9(n,e){let t=1+e(),r=e(),i=D9(e),s=oH(i.length,1+n,e);return sH(s.map((o,a)=>{const l=o[0],c=o.slice(1);return Array(i[a]).fill(void 0).map((A,u)=>{let f=u*r;return[l+u*t,c.map(h=>h+f)]})}))}function O9(n,e){let t=1+e();return oH(t,1+n,e).map(i=>[i[0],i.slice(1)])}function k9(n){let e=Ww(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let c=Ww(n,e);if(c.length==0)break;r.push({set:new Set(c),node:t()})}r.sort((c,A)=>A.set.size-c.set.size);let i=n(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let a=i==1,l=i==2;return{branches:r,valid:s,fe0f:o,save:a,check:l}}}function H9(){return R9($4("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Ix=H9(),Q9=new Set(Ww(Ix)),z9=new Set(Ww(Ix)),G9=L9(Ix),V9=k9(Ix),DU=45,NU=95;function aH(n){return M9(n)}function j9(n){return n.filter(e=>e!=65039)}function lH(n){for(let e of n.split(".")){let t=aH(e);try{for(let r=t.lastIndexOf(NU)-1;r>=0;r--)if(t[r]!==NU)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===DU&&t[3]===DU)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function W9(n){return lH(K9(n,j9))}function K9(n,e){let t=aH(n).reverse(),r=[];for(;t.length;){let i=Y9(t);if(i){r.push(...e(i));continue}let s=t.pop();if(Q9.has(s)){r.push(s);continue}if(z9.has(s))continue;let o=G9[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return lH(X9(String.fromCodePoint(...r)))}function X9(n){return n.normalize("NFC")}function Y9(n,e){var t;let r=V9,i,s,o=[],a=n.length;for(e&&(e.length=0);a;){let l=n[--a];if(r=(t=r.branches.find(c=>c.set.has(l)))===null||t===void 0?void 0:t.node,!r)break;if(r.save)s=l;else if(r.check&&l===s)break;o.push(l),r.fe0f&&(o.push(65039),a>0&&n[a-1]==65039&&a--),r.valid&&(i=o.slice(),r.valid==2&&i.splice(1,1),e&&e.push(...n.slice(a).reverse()),n.length=a)}return i}const $9=new _e(iH),cH=new Uint8Array(32);cH.fill(0);function OU(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function AH(n){const e=Wa(W9(n)),t=[];if(n.length===0)return t;let r=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return t.push(OU(e.slice(r))),t}function qy(n){typeof n!="string"&&$9.throwArgumentError("invalid ENS name; not a string","name",n);let e=cH;const t=AH(n);for(;t.length;)e=Er(Bs([e,Er(t.pop())]));return at(e)}function Z9(n){return at(Bs(AH(n).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t})))+"00"}const q9="rlp/5.7.0",ba=new _e(q9);function kU(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function HU(n,e,t){let r=0;for(let i=0;ie+1+r&&ba.throwError("child data too short",_e.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function fH(n,e){if(n.length===0&&ba.throwError("data too short",_e.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&ba.throwError("data short segment too short",_e.errors.BUFFER_OVERRUN,{});const r=HU(n,e+1,t);return e+1+t+r>n.length&&ba.throwError("data long segment too short",_e.errors.BUFFER_OVERRUN,{}),QU(n,e,e+1+t,t+r)}else if(n[e]>=192){const t=n[e]-192;return e+1+t>n.length&&ba.throwError("data array too short",_e.errors.BUFFER_OVERRUN,{}),QU(n,e,e+1,t)}else if(n[e]>=184){const t=n[e]-183;e+1+t>n.length&&ba.throwError("data array too short",_e.errors.BUFFER_OVERRUN,{});const r=HU(n,e+1,t);e+1+t+r>n.length&&ba.throwError("data array too short",_e.errors.BUFFER_OVERRUN,{});const i=at(n.slice(e+1+t,e+1+t+r));return{consumed:1+t+r,result:i}}else if(n[e]>=128){const t=n[e]-128;e+1+t>n.length&&ba.throwError("data too short",_e.errors.BUFFER_OVERRUN,{});const r=at(n.slice(e+1,e+1+t));return{consumed:1+t,result:r}}return{consumed:1,result:at(n[e])}}function iI(n){const e=ft(n),t=fH(e,0);return t.consumed!==e.length&&ba.throwArgumentError("invalid rlp data","data",n),t.result}const J9="address/5.7.0",fh=new _e(J9);function zU(n){Tt(n,20)||fh.throwArgumentError("invalid address","address",n),n=n.toLowerCase();const e=n.substring(2).split(""),t=new Uint8Array(40);for(let i=0;i<40;i++)t[i]=e[i].charCodeAt(0);const r=ft(Er(t));for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(r[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const eK=9007199254740991;function tK(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const sI={};for(let n=0;n<10;n++)sI[String(n)]=String(n);for(let n=0;n<26;n++)sI[String.fromCharCode(65+n)]=String(10+n);const GU=Math.floor(tK(eK));function nK(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>sI[r]).join("");for(;e.length>=GU;){let r=e.substring(0,GU);e=parseInt(r,10)%97+e.substring(r.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function oi(n){let e=null;if(typeof n!="string"&&fh.throwArgumentError("invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/))n.substring(0,2)!=="0x"&&(n="0x"+n),e=zU(n),n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==n&&fh.throwArgumentError("bad address checksum","address",n);else if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(n.substring(2,4)!==nK(n)&&fh.throwArgumentError("bad icap checksum","address",n),e=r9(n.substring(4));e.length<40;)e="0"+e;e=zU("0x"+e)}else fh.throwArgumentError("invalid address","address",n);return e}function hH(n){let e=null;try{e=oi(n.from)}catch{fh.throwArgumentError("missing from address","transaction",n)}const t=Ad(ft(Ve.from(n.nonce).toHexString()));return oi(pi(Er(Rx([e,t])),12))}var rK=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Gn=new _e(iH),dH=new Uint8Array(32);dH.fill(0);const iK=Ve.from(-1),pH=Ve.from(0),mH=Ve.from(1),sK=Ve.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function oK(n){const e=ft(n),t=e.length%32;return t?Ki([e,dH.slice(t)]):at(e)}const aK=rr(mH.toHexString(),32),lK=rr(pH.toHexString(),32),VU={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Ab=["name","version","chainId","verifyingContract","salt"];function jU(n){return function(e){return typeof e!="string"&&Gn.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const cK={name:jU("name"),version:jU("version"),chainId:function(n){try{return Ve.from(n).toString()}catch{}return Gn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return oi(n).toLowerCase()}catch{}return Gn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){try{const e=ft(n);if(e.length!==32)throw new Error("bad length");return at(e)}catch{}return Gn.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function ub(n){{const e=n.match(/^(u?)int(\d*)$/);if(e){const t=e[1]==="",r=parseInt(e[2]||"256");(r%8!==0||r>256||e[2]&&e[2]!==String(r))&&Gn.throwArgumentError("invalid numeric width","type",n);const i=sK.mask(t?r-1:r),s=t?i.add(mH).mul(iK):pH;return function(o){const a=Ve.from(o);return(a.lt(s)||a.gt(i))&&Gn.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),rr(a.toTwos(256).toHexString(),32)}}}{const e=n.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return(t===0||t>32||e[1]!==String(t))&&Gn.throwArgumentError("invalid bytes width","type",n),function(r){return ft(r).length!==t&&Gn.throwArgumentError(`invalid length for ${n}`,"value",r),oK(r)}}}switch(n){case"address":return function(e){return rr(oi(e),32)};case"bool":return function(e){return e?aK:lK};case"bytes":return function(e){return Er(e)};case"string":return function(e){return uh(e)}}return null}function WU(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class vs{constructor(e){Pe(this,"types",Object.freeze(Us(e))),Pe(this,"_encoderCache",{}),Pe(this,"_types",{});const t={},r={},i={};Object.keys(e).forEach(a=>{t[a]={},r[a]=[],i[a]={}});for(const a in e){const l={};e[a].forEach(c=>{l[c.name]&&Gn.throwArgumentError(`duplicate variable name ${JSON.stringify(c.name)} in ${JSON.stringify(a)}`,"types",e),l[c.name]=!0;const A=c.type.match(/^([^\x5b]*)(\x5b|$)/)[1];A===a&&Gn.throwArgumentError(`circular type reference to ${JSON.stringify(A)}`,"types",e),!ub(A)&&(r[A]||Gn.throwArgumentError(`unknown type ${JSON.stringify(A)}`,"types",e),r[A].push(a),t[a][A]=!0)})}const s=Object.keys(r).filter(a=>r[a].length===0);s.length===0?Gn.throwArgumentError("missing primary type","types",e):s.length>1&&Gn.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),Pe(this,"primaryType",s[0]);function o(a,l){l[a]&&Gn.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(t[a]).forEach(c=>{r[c]&&(o(c,l),Object.keys(l).forEach(A=>{i[A][c]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=WU(a,e[a])+l.map(c=>WU(c,e[c])).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const i=ub(e);if(i)return i}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const i=t[1],s=this.getEncoder(i),o=parseInt(t[3]);return a=>{o>=0&&a.length!==o&&Gn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(Er)),Er(Ki(l))}}const r=this.types[e];if(r){const i=uh(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const c=this.getEncoder(l)(s[a]);return this._types[l]?Er(c):c});return o.unshift(i),Ki(o)}}return Gn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Gn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Er(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(ub(e))return r(e,t);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const o=i[1],a=parseInt(i[3]);return a>=0&&t.length!==a&&Gn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map(l=>this._visit(o,l,r))}const s=this.types[e];return s?s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,t[a],r),o),{}):Gn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new vs(e)}static getPrimaryType(e){return vs.from(e).primaryType}static hashStruct(e,t,r){return vs.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=VU[r];i||Gn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>Ab.indexOf(r.name)-Ab.indexOf(i.name)),vs.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return Ki(["0x1901",vs.hashDomain(e),vs.from(t).hash(r)])}static hash(e,t,r){return Er(vs.encode(e,t,r))}static resolveNames(e,t,r,i){return rK(this,void 0,void 0,function*(){e=kn(e);const s={};e.verifyingContract&&!Tt(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=vs.from(t);o.visit(r,(a,l)=>(a==="address"&&!Tt(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=yield i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:r}})}static getPayload(e,t,r){vs.hashDomain(e);const i={},s=[];Ab.forEach(l=>{const c=e[l];c!=null&&(i[l]=cK[l](c),s.push({name:l,type:VU[l]}))});const o=vs.from(t),a=kn(t);return a.EIP712Domain?Gn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):a.EIP712Domain=s,o.encode(r),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(r,(l,c)=>{if(l.match(/^bytes(\d*)/))return at(ft(c));if(l.match(/^u?int/))return Ve.from(c).toString();switch(l){case"address":return c.toLowerCase();case"bool":return!!c;case"string":return typeof c!="string"&&Gn.throwArgumentError("invalid string","value",c),c}return Gn.throwArgumentError("unsupported type","type",l)})}}}var gH={},Nt={},a0=vH;function vH(n,e){if(!n)throw new Error(e||"Assertion failed")}vH.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var ES={exports:{}};typeof Object.create=="function"?ES.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ES.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var AK=ES.exports,uK=a0,fK=AK;Nt.inherits=fK;function hK(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function dK(n,e){if(Array.isArray(n))return n.slice();if(!n)return[];var t=[];if(typeof n=="string")if(e){if(e==="hex")for(n=n.replace(/[^a-z0-9]+/ig,""),n.length%2!==0&&(n="0"+n),i=0;i>6|192,t[r++]=s&63|128):hK(n,i)?(s=65536+((s&1023)<<10)+(n.charCodeAt(++i)&1023),t[r++]=s>>18|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128,t[r++]=s&63|128):(t[r++]=s>>12|224,t[r++]=s>>6&63|128,t[r++]=s&63|128)}else for(i=0;i>>24|n>>>8&65280|n<<8&16711680|(n&255)<<24;return e>>>0}Nt.htonl=yH;function mK(n,e){for(var t="",r=0;r>>0}return s}Nt.join32=gK;function vK(n,e){for(var t=new Array(n.length*4),r=0,i=0;r>>24,t[i+1]=s>>>16&255,t[i+2]=s>>>8&255,t[i+3]=s&255):(t[i+3]=s>>>24,t[i+2]=s>>>16&255,t[i+1]=s>>>8&255,t[i]=s&255)}return t}Nt.split32=vK;function yK(n,e){return n>>>e|n<<32-e}Nt.rotr32=yK;function wK(n,e){return n<>>32-e}Nt.rotl32=wK;function _K(n,e){return n+e>>>0}Nt.sum32=_K;function xK(n,e,t){return n+e+t>>>0}Nt.sum32_3=xK;function bK(n,e,t,r){return n+e+t+r>>>0}Nt.sum32_4=bK;function EK(n,e,t,r,i){return n+e+t+r+i>>>0}Nt.sum32_5=EK;function BK(n,e,t,r){var i=n[e],s=n[e+1],o=r+s>>>0,a=(o>>0,n[e+1]=o}Nt.sum64=BK;function SK(n,e,t,r){var i=e+r>>>0,s=(i>>0}Nt.sum64_hi=SK;function MK(n,e,t,r){var i=e+r;return i>>>0}Nt.sum64_lo=MK;function CK(n,e,t,r,i,s,o,a){var l=0,c=e;c=c+r>>>0,l+=c>>0,l+=c>>0,l+=c>>0}Nt.sum64_4_hi=CK;function TK(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}Nt.sum64_4_lo=TK;function IK(n,e,t,r,i,s,o,a,l,c){var A=0,u=e;u=u+r>>>0,A+=u>>0,A+=u>>0,A+=u>>0,A+=u>>0}Nt.sum64_5_hi=IK;function RK(n,e,t,r,i,s,o,a,l,c){var A=e+r+s+a+c;return A>>>0}Nt.sum64_5_lo=RK;function UK(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}Nt.rotr64_hi=UK;function FK(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Nt.rotr64_lo=FK;function PK(n,e,t){return n>>>t}Nt.shr64_hi=PK;function LK(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Nt.shr64_lo=LK;var Od={},KU=Nt,DK=a0;function Ux(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Od.BlockHash=Ux;Ux.prototype.update=function(e,t){if(e=KU.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=KU.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}tl.g0_256=QK;function zK(n){return Oa(n,17)^Oa(n,19)^n>>>10}tl.g1_256=zK;var ud=Nt,GK=Od,VK=tl,fb=ud.rotl32,fp=ud.sum32,jK=ud.sum32_5,WK=VK.ft_1,BH=GK.BlockHash,KK=[1518500249,1859775393,2400959708,3395469782];function Ka(){if(!(this instanceof Ka))return new Ka;BH.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ud.inherits(Ka,BH);var XK=Ka;Ka.blockSize=512;Ka.outSize=160;Ka.hmacStrength=80;Ka.padLength=64;Ka.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),L7(e.length<=this.blockSize);for(var t=e.length;t{s[a.toLowerCase()]=o}):r.headers.keys().forEach(o=>{s[o.toLowerCase()]=r.headers.get(o)}),{headers:s,statusCode:r.status,statusMessage:r.statusText,body:ft(new Uint8Array(i))}})}var H7=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Oo=new _e(N7);function qU(n){return new Promise(e=>{setTimeout(e,n)})}function pc(n,e){if(n==null)return null;if(typeof n=="string")return n;if(rI(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return o0(n)}catch{}return at(n)}return n}function Q7(n){return Wa(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function z7(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;Oo.assertArgument(r>0&&r%1===0,"invalid connection throttle limit","connection.throttleLimit",r);const i=typeof n=="object"?n.throttleCallback:null,s=typeof n=="object"&&typeof n.throttleSlotInterval=="number"?n.throttleSlotInterval:100;Oo.assertArgument(s>0&&s%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o=typeof n=="object"?!!n.errorPassThrough:!1,a={};let l=null;const c={method:"GET"};let A=!1,u=2*60*1e3;if(typeof n=="string")l=n;else if(typeof n=="object"){if((n==null||n.url==null)&&Oo.throwArgumentError("missing URL","connection.url",n),l=n.url,typeof n.timeout=="number"&&n.timeout>0&&(u=n.timeout),n.headers)for(const p in n.headers)a[p.toLowerCase()]={key:p,value:String(n.headers[p])},["if-none-match","if-modified-since"].indexOf(p.toLowerCase())>=0&&(A=!0);if(c.allowGzip=!!n.allowGzip,n.user!=null&&n.password!=null){l.substring(0,6)!=="https:"&&n.allowInsecureAuthentication!==!0&&Oo.throwError("basic authentication requires a secure https url",_e.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const p=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+Z4(Wa(p))}}n.skipFetchSetup!=null&&(c.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(c.fetchOptions=kn(n.fetchOptions))}const f=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=l?l.match(f):null;if(h)try{const p={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?$4(h[3]):Q7(h[3])};let v=p.body;return t&&(v=t(p.body,p)),Promise.resolve(v)}catch(p){Oo.throwError("processing response error",_e.errors.SERVER_ERROR,{body:pc(h[1],h[2]),error:p,requestBody:null,requestMethod:"GET",url:l})}e&&(c.method="POST",c.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const d={};Object.keys(a).forEach(p=>{const v=a[p];d[v.key]=v.value}),c.headers=d;const m=function(){let p=null;return{promise:new Promise(function(_,x){u&&(p=setTimeout(()=>{p!=null&&(p=null,x(Oo.makeError("timeout",_e.errors.TIMEOUT,{requestBody:pc(c.body,d["content-type"]),requestMethod:c.method,timeout:u,url:l})))},u))}),cancel:function(){p!=null&&(clearTimeout(p),p=null)}}}(),g=function(){return H7(this,void 0,void 0,function*(){for(let p=0;p=300)&&(m.cancel(),Oo.throwError("bad response",_e.errors.SERVER_ERROR,{status:v.statusCode,headers:v.headers,body:pc(w,v.headers?v.headers["content-type"]:null),requestBody:pc(c.body,d["content-type"]),requestMethod:c.method,url:l})),t)try{const _=yield t(w,v);return m.cancel(),_}catch(_){if(_.throttleRetry&&p{let a=null;if(s!=null)try{a=JSON.parse(o0(s))}catch(l){Oo.throwError("invalid JSON",_e.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=Wa(e);const s=typeof n=="string"?{url:n}:kn(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=kn(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return z7(n,i,r)}function hh(n,e){return e||(e={}),e=kn(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(t,r){let i=null,s=!1;const o=()=>s?!1:(s=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{o()&&r(new Error("timeout"))},e.timeout));const a=e.retryLimit;let l=0;function c(){return n().then(function(A){if(A!==void 0)o()&&t(A);else if(e.oncePoll)e.oncePoll.once("poll",c);else if(e.onceBlock)e.onceBlock.once("block",c);else if(!s){if(l++,l>a){o()&&r(new Error("retry limit reached"));return}let u=e.interval*parseInt(String(Math.random()*Math.pow(2,l)));ue.ceiling&&(u=e.ceiling),setTimeout(c,u)}return null},function(A){o()&&r(A)})}c()})}var Kw="qpzry9x8gf2tvdw0s3jn54khce6mua7l",MS={};for(var k0=0;k0>25;return(n&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function DH(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=Gh(e)^r>>5}for(e=Gh(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=DH(n);if(typeof r=="string")throw new Error(r);for(var i=n+"1",s=0;s>5)throw new Error("Non 5-bit word");r=Gh(r)^o,i+=Kw.charAt(o)}for(s=0;s<6;++s)r=Gh(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=Kw.charAt(a)}return i}function NH(n,e){if(e=e||90,n.length<8)return n+" too short";if(n.length>e)return"Exceeds length limit";var t=n.toLowerCase(),r=n.toUpperCase();if(n!==t&&n!==r)return"Mixed-case string "+n;n=t;var i=n.lastIndexOf("1");if(i===-1)return"No separator character for "+n;if(i===0)return"Missing prefix for "+n;var s=n.slice(0,i),o=n.slice(i+1);if(o.length<6)return"Data too short";var a=DH(s);if(typeof a=="string")return a;for(var l=[],c=0;c=o.length)&&l.push(u)}return a!==1?"Invalid checksum for "+n:{prefix:s,words:l}}function V7(){var n=NH.apply(null,arguments);if(typeof n=="object")return n}function j7(n){var e=NH.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Px(n,e,t,r){for(var i=0,s=0,o=(1<=t;)s-=t,a.push(i>>s&o);if(r)s>0&&a.push(i<=e)return"Excess padding";if(i<>8,f=A&255;u?l.push(u,f):l.push(f)}return l}t.toArray=r;function i(o){return o.length===1?"0"+o:o}t.zero2=i;function s(o){for(var a="",l=0;l(f>>1)-1?m=(f>>1)-g:m=g,h.isubn(m)):m=0,u[d]=m,h.iushrn(1)}return u}t.getNAF=r;function i(l,c){var A=[[],[]];l=l.clone(),c=c.clone();for(var u=0,f=0,h;l.cmpn(-u)>0||c.cmpn(-f)>0;){var d=l.andln(3)+u&3,m=c.andln(3)+f&3;d===3&&(d=-1),m===3&&(m=-1);var g;d&1?(h=l.andln(7)+u&7,(h===3||h===5)&&m===2?g=-d:g=d):g=0,A[0].push(g);var p;m&1?(h=c.andln(7)+f&7,(h===3||h===5)&&d===2?p=-m:p=m):p=0,A[1].push(p),2*u===g+1&&(u=1-u),2*f===p+1&&(f=1-f),l.iushrn(1),c.iushrn(1)}return A}t.getJSF=i;function s(l,c,A){var u="_"+c;l.prototype[c]=function(){return this[u]!==void 0?this[u]:this[u]=A.call(this)}}t.cachedProperty=s;function o(l){return typeof l=="string"?t.toArray(l,"hex"):l}t.parseBytes=o;function a(l){return new wt(l,"hex","le")}t.intFromLE=a}),Xw=zs.getNAF,q7=zs.getJSF,Yw=zs.assert;function bA(n,e){this.type=n,this.p=new wt(e.p,16),this.red=e.prime?wt.red(e.prime):wt.mont(this.p),this.zero=new wt(0).toRed(this.red),this.one=new wt(1).toRed(this.red),this.two=new wt(2).toRed(this.red),this.n=e.n&&new wt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var ku=bA;bA.prototype.point=function(){throw new Error("Not implemented")};bA.prototype.validate=function(){throw new Error("Not implemented")};bA.prototype._fixedNafMul=function(e,t){Yw(e.precomputed);var r=e._getDoubles(),i=Xw(t,1,this._bitLength),s=(1<=a;c--)l=(l<<1)+i[c];o.push(l)}for(var A=this.jpoint(null,null,null),u=this.jpoint(null,null,null),f=s;f>0;f--){for(a=0;a=0;l--){for(var c=0;l>=0&&o[l]===0;l--)c++;if(l>=0&&c++,a=a.dblp(c),l<0)break;var A=o[l];Yw(A!==0),e.type==="affine"?A>0?a=a.mixedAdd(s[A-1>>1]):a=a.mixedAdd(s[-A-1>>1].neg()):A>0?a=a.add(s[A-1>>1]):a=a.add(s[-A-1>>1].neg())}return e.type==="affine"?a.toP():a};bA.prototype._wnafMulAdd=function(e,t,r,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,c=0,A,u,f;for(A=0;A=1;A-=2){var d=A-1,m=A;if(o[d]!==1||o[m]!==1){l[d]=Xw(r[d],o[d],this._bitLength),l[m]=Xw(r[m],o[m],this._bitLength),c=Math.max(l[d].length,c),c=Math.max(l[m].length,c);continue}var g=[t[d],null,null,t[m]];t[d].y.cmp(t[m].y)===0?(g[1]=t[d].add(t[m]),g[2]=t[d].toJ().mixedAdd(t[m].neg())):t[d].y.cmp(t[m].y.redNeg())===0?(g[1]=t[d].toJ().mixedAdd(t[m]),g[2]=t[d].add(t[m].neg())):(g[1]=t[d].toJ().mixedAdd(t[m]),g[2]=t[d].toJ().mixedAdd(t[m].neg()));var p=[-3,-1,-5,-7,0,7,5,1,3],v=q7(r[d],r[m]);for(c=Math.max(v[0].length,c),l[d]=new Array(c),l[m]=new Array(c),u=0;u=0;A--){for(var B=0;A>=0;){var M=!0;for(u=0;u=0&&B++,x=x.dblp(B),A<0)break;for(u=0;u0?f=a[u][I-1>>1]:I<0&&(f=a[u][-I-1>>1].neg()),f.type==="affine"?x=x.mixedAdd(f):x=x.add(f))}}for(A=0;A=Math.ceil((e.bitLength()+1)/t.step):!1};bo.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,s=0;s=0&&(h=c,d=A),u.negative&&(u=u.neg(),f=f.neg()),h.negative&&(h=h.neg(),d=d.neg()),[{a:u,b:f},{a:h,b:d}]};Eo.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],s=i.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=s.mul(r.a),l=o.mul(i.a),c=s.mul(r.b),A=o.mul(i.b),u=e.sub(a).sub(l),f=c.add(A).neg();return{k1:u,k2:f}};Eo.prototype.pointFromX=function(e,t){e=new wt(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(i.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)};Eo.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return r.redSqr().redISub(s).cmpn(0)===0};Eo.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Yr.prototype.isInfinity=function(){return this.inf};Yr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)};Yr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),s=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};Yr.prototype.getX=function(){return this.x.fromRed()};Yr.prototype.getY=function(){return this.y.fromRed()};Yr.prototype.mul=function(e){return e=new wt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Yr.prototype.mulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};Yr.prototype.jmulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};Yr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Yr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(s){return s.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t};Yr.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function li(n,e,t,r){ku.BasePoint.call(this,n,"jacobian"),e===null&&t===null&&r===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new wt(0)):(this.x=new wt(e,16),this.y=new wt(t,16),this.z=new wt(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}aI(li,ku.BasePoint);Eo.prototype.jpoint=function(e,t,r){return new li(this,e,t,r)};li.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)};li.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};li.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),s=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),l=i.redSub(s),c=o.redSub(a);if(l.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var A=l.redSqr(),u=A.redMul(l),f=i.redMul(A),h=c.redSqr().redIAdd(u).redISub(f).redISub(f),d=c.redMul(f.redISub(h)).redISub(o.redMul(u)),m=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(h,d,m)};li.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),s=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(i),l=s.redSub(o);if(a.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),A=c.redMul(a),u=r.redMul(c),f=l.redSqr().redIAdd(A).redISub(u).redISub(u),h=l.redMul(u.redISub(f)).redISub(s.redMul(A)),d=this.z.redMul(a);return this.curve.jpoint(f,h,d)};li.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(s),this.x.cmp(r)===0)return!0}};li.prototype.inspect=function(){return this.isInfinity()?"":""};li.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Jy=Qd(function(n,e){var t=e;t.base=ku,t.short=eX,t.mont=null,t.edwards=null}),ew=Qd(function(n,e){var t=e,r=zs.assert;function i(a){a.type==="short"?this.curve=new Jy.short(a):a.type==="edwards"?this.curve=new Jy.edwards(a):this.curve=new Jy.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,r(this.g.validate(),"Invalid curve"),r(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=i;function s(a,l){Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){var c=new i(l);return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,value:c}),c}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:wa.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:wa.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:wa.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:wa.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:wa.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wa.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:wa.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:wa.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function fA(n){if(!(this instanceof fA))return new fA(n);this.hash=n.hash,this.predResist=!!n.predResist,this.outLen=this.hash.outSize,this.minEntropy=n.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=$o.toArray(n.entropy,n.entropyEnc||"hex"),t=$o.toArray(n.nonce,n.nonceEnc||"hex"),r=$o.toArray(n.pers,n.persEnc||"hex");oI(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var kH=fA;fA.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1};fA.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=r,r=t,t=null),r&&(r=$o.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var tX=zs.assert;function Lx(n,e){if(n instanceof Lx)return n;this._importDER(n,e)||(tX(n.r&&n.s,"Signature without r or s"),this.r=new wt(n.r,16),this.s=new wt(n.s,16),n.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=n.recoveryParam)}var Dx=Lx;function nX(){this.place=0}function mb(n,e){var t=n[e.place++];if(!(t&128))return t;var r=t&15;if(r===0||r>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function eF(n){for(var e=0,t=n.length-1;!n[e]&&!(n[e+1]&128)&&e>>3);for(n.push(t|128);--t;)n.push(e>>>(t<<3)&255);n.push(e)}Lx.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),r[0]&128&&(r=[0].concat(r)),t=eF(t),r=eF(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];gb(i,t.length),i=i.concat(t),i.push(2),gb(i,r.length);var s=i.concat(r),o=[48];return gb(o,s.length),o=o.concat(s),zs.encode(o,e)};var rX=function(){throw new Error("unsupported")},HH=zs.assert;function vo(n){if(!(this instanceof vo))return new vo(n);typeof n=="string"&&(HH(Object.prototype.hasOwnProperty.call(ew,n),"Unknown curve "+n),n=ew[n]),n instanceof ew.PresetCurve&&(n={curve:n}),this.curve=n.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=n.curve.g,this.g.precompute(n.curve.n.bitLength()+1),this.hash=n.hash||n.curve.hash}var iX=vo;vo.prototype.keyPair=function(e){return new lI(this,e)};vo.prototype.keyFromPrivate=function(e,t){return lI.fromPrivate(this,e,t)};vo.prototype.keyFromPublic=function(e,t){return lI.fromPublic(this,e,t)};vo.prototype.genKeyPair=function(e){e||(e={});for(var t=new kH({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||rX(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new wt(2));;){var s=new wt(t.generate(r));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};vo.prototype._truncateToN=function(e,t){var r=e.byteLength()*8-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};vo.prototype.sign=function(e,t,r,i){typeof r=="object"&&(i=r,r=null),i||(i={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new wt(e,16));for(var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new kH({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),c=this.n.sub(new wt(1)),A=0;;A++){var u=i.k?i.k(A):new wt(l.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(c)>=0)){var f=this.g.mul(u);if(!f.isInfinity()){var h=f.getX(),d=h.umod(this.n);if(d.cmpn(0)!==0){var m=u.invm(this.n).mul(d.mul(t.getPrivate()).iadd(e));if(m=m.umod(this.n),m.cmpn(0)!==0){var g=(f.getY().isOdd()?1:0)|(h.cmp(d)!==0?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new Dx({r:d,s:m,recoveryParam:g})}}}}}};vo.prototype.verify=function(e,t,r,i){e=this._truncateToN(new wt(e,16)),r=this.keyFromPublic(r,i),t=new Dx(t,"hex");var s=t.r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),l=a.mul(e).umod(this.n),c=a.mul(s).umod(this.n),A;return this.curve._maxwellTrick?(A=this.g.jmulAdd(l,r.getPublic(),c),A.isInfinity()?!1:A.eqXToP(s)):(A=this.g.mulAdd(l,r.getPublic(),c),A.isInfinity()?!1:A.getX().umod(this.n).cmp(s)===0)};vo.prototype.recoverPubKey=function(n,e,t,r){HH((3&t)===t,"The recovery param is more than two bits"),e=new Dx(e,r);var i=this.n,s=new wt(n),o=e.r,a=e.s,l=t&1,c=t>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");c?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var A=e.r.invm(i),u=i.sub(s).mul(A).umod(i),f=a.mul(A).umod(i);return this.g.mulAdd(u,o,f)};vo.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new Dx(e,r),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(n,e,i)}catch{continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")};var sX=Qd(function(n,e){var t=e;t.version="6.5.4",t.utils=zs,t.rand=function(){throw new Error("unsupported")},t.curve=Jy,t.curves=ew,t.ec=iX,t.eddsa=null}),oX=sX.ec;const aX="signing-key/5.7.0",TS=new _e(aX);let vb=null;function Ba(){return vb||(vb=new oX("secp256k1")),vb}class lX{constructor(e){Pe(this,"curve","secp256k1"),Pe(this,"privateKey",at(e)),_u(this.privateKey)!==32&&TS.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Ba().keyFromPrivate(ft(this.privateKey));Pe(this,"publicKey","0x"+t.getPublic(!1,"hex")),Pe(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Pe(this,"_isSigningKey",!0)}_addPoint(e){const t=Ba().keyFromPublic(ft(this.publicKey)),r=Ba().keyFromPublic(ft(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=Ba().keyFromPrivate(ft(this.privateKey)),r=ft(e);r.length!==32&&TS.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return Tx({recoveryParam:i.recoveryParam,r:rr("0x"+i.r.toString(16),32),s:rr("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=Ba().keyFromPrivate(ft(this.privateKey)),r=Ba().keyFromPublic(ft(QH(e)));return rr("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function cX(n,e){const t=Tx(e),r={r:ft(t.r),s:ft(t.s)};return"0x"+Ba().recoverPubKey(ft(n),r,t.recoveryParam).encode("hex",!1)}function QH(n,e){const t=ft(n);if(t.length===32){const r=new lX(t);return e?"0x"+Ba().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?at(t):"0x"+Ba().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Ba().keyFromPublic(t).getPublic(!0,"hex"):at(t)}return TS.throwArgumentError("invalid public or private key","key","[REDACTED]")}const AX="transactions/5.7.0",sc=new _e(AX);var tF;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(tF||(tF={}));function cI(n){return n==="0x"?null:oi(n)}function gi(n){return n==="0x"?J4:Ve.from(n)}function uX(n){const e=QH(n);return oi(pi(Er(pi(e,1)),12))}function zH(n,e){return uX(cX(ft(n),e))}function xs(n,e){const t=Ad(Ve.from(n).toHexString());return t.length>32&&sc.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function yb(n,e){return{address:oi(n),storageKeys:(e||[]).map((t,r)=>(_u(t)!==32&&sc.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function Hu(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(t.length>2&&sc.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${r}]`,t),yb(t[0],t[1])):yb(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return yb(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function GH(n){return Hu(n).map(e=>[e.address,e.storageKeys])}function fX(n,e){if(n.gasPrice!=null){const r=Ve.from(n.gasPrice),i=Ve.from(n.maxFeePerGas||0);r.eq(i)||sc.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:i})}const t=[xs(n.chainId||0,"chainId"),xs(n.nonce||0,"nonce"),xs(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),xs(n.maxFeePerGas||0,"maxFeePerGas"),xs(n.gasLimit||0,"gasLimit"),n.to!=null?oi(n.to):"0x",xs(n.value||0,"value"),n.data||"0x",GH(n.accessList||[])];if(e){const r=Tx(e);t.push(xs(r.recoveryParam,"recoveryParam")),t.push(Ad(r.r)),t.push(Ad(r.s))}return Ki(["0x02",Rx(t)])}function hX(n,e){const t=[xs(n.chainId||0,"chainId"),xs(n.nonce||0,"nonce"),xs(n.gasPrice||0,"gasPrice"),xs(n.gasLimit||0,"gasLimit"),n.to!=null?oi(n.to):"0x",xs(n.value||0,"value"),n.data||"0x",GH(n.accessList||[])];if(e){const r=Tx(e);t.push(xs(r.recoveryParam,"recoveryParam")),t.push(Ad(r.r)),t.push(Ad(r.s))}return Ki(["0x01",Rx(t)])}function VH(n,e,t){try{const r=gi(e[0]).toNumber();if(r!==0&&r!==1)throw new Error("bad recid");n.v=r}catch{sc.throwArgumentError("invalid v for transaction type: 1","v",e[0])}n.r=rr(e[1],32),n.s=rr(e[2],32);try{const r=Er(t(n));n.from=zH(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function dX(n){const e=iI(n.slice(1));e.length!==9&&e.length!==12&&sc.throwArgumentError("invalid component count for transaction type: 2","payload",at(n));const t=gi(e[2]),r=gi(e[3]),i={type:2,chainId:gi(e[0]).toNumber(),nonce:gi(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:gi(e[4]),to:cI(e[5]),value:gi(e[6]),data:e[7],accessList:Hu(e[8])};return e.length===9||(i.hash=Er(n),VH(i,e.slice(9),fX)),i}function pX(n){const e=iI(n.slice(1));e.length!==8&&e.length!==11&&sc.throwArgumentError("invalid component count for transaction type: 1","payload",at(n));const t={type:1,chainId:gi(e[0]).toNumber(),nonce:gi(e[1]).toNumber(),gasPrice:gi(e[2]),gasLimit:gi(e[3]),to:cI(e[4]),value:gi(e[5]),data:e[6],accessList:Hu(e[7])};return e.length===8||(t.hash=Er(n),VH(t,e.slice(8),hX)),t}function mX(n){const e=iI(n);e.length!==9&&e.length!==6&&sc.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:gi(e[0]).toNumber(),gasPrice:gi(e[1]),gasLimit:gi(e[2]),to:cI(e[3]),value:gi(e[4]),data:e[5],chainId:0};if(e.length===6)return t;try{t.v=Ve.from(e[6]).toNumber()}catch{return t}if(t.r=rr(e[7],32),t.s=rr(e[8],32),Ve.from(t.r).isZero()&&Ve.from(t.s).isZero())t.chainId=t.v,t.v=0;else{t.chainId=Math.floor((t.v-35)/2),t.chainId<0&&(t.chainId=0);let r=t.v-27;const i=e.slice(0,6);t.chainId!==0&&(i.push(at(t.chainId)),i.push("0x"),i.push("0x"),r-=t.chainId*2+8);const s=Er(Rx(i));try{t.from=zH(s,{r:at(t.r),s:at(t.s),recoveryParam:r})}catch{}t.hash=Er(n)}return t.type=null,t}function gX(n){const e=ft(n);if(e[0]>127)return mX(e);switch(e[0]){case 1:return pX(e);case 2:return dX(e)}return sc.throwError(`unsupported transaction type: ${e[0]}`,_e.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const dp=new _e(Si);let nF=class rt{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),i=this.blockTag.bind(this),s=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),l=this.number.bind(this),c=this.type.bind(this),A=u=>this.data(u,!0);return e.transaction={hash:o,type:c,accessList:rt.allowNull(this.accessList.bind(this),null),blockHash:rt.allowNull(o,null),blockNumber:rt.allowNull(l,null),transactionIndex:rt.allowNull(l,null),confirmations:rt.allowNull(l,null),from:t,gasPrice:rt.allowNull(r),maxPriorityFeePerGas:rt.allowNull(r),maxFeePerGas:rt.allowNull(r),gasLimit:r,to:rt.allowNull(t,null),value:r,nonce:l,data:s,r:rt.allowNull(this.uint256),s:rt.allowNull(this.uint256),v:rt.allowNull(l),creates:rt.allowNull(t,null),raw:rt.allowNull(s)},e.transactionRequest={from:rt.allowNull(t),nonce:rt.allowNull(l),gasLimit:rt.allowNull(r),gasPrice:rt.allowNull(r),maxPriorityFeePerGas:rt.allowNull(r),maxFeePerGas:rt.allowNull(r),to:rt.allowNull(t),value:rt.allowNull(r),data:rt.allowNull(A),type:rt.allowNull(l),accessList:rt.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:t,topics:rt.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:rt.allowNull(this.address,null),from:rt.allowNull(this.address,null),contractAddress:rt.allowNull(t,null),transactionIndex:l,root:rt.allowNull(a),gasUsed:r,logsBloom:rt.allowNull(s),blockHash:o,transactionHash:o,logs:rt.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:rt.allowNull(l,null),cumulativeGasUsed:r,effectiveGasPrice:rt.allowNull(r),status:rt.allowNull(l),type:c},e.block={hash:rt.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:rt.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:rt.allowNull(t),extraData:s,transactions:rt.allowNull(rt.arrayOf(o)),baseFeePerGas:rt.allowNull(r)},e.blockWithTransactions=kn(e.block),e.blockWithTransactions.transactions=rt.allowNull(rt.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:rt.allowNull(i,void 0),toBlock:rt.allowNull(i,void 0),blockHash:rt.allowNull(o,void 0),address:rt.allowNull(t,void 0),topics:rt.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:rt.allowNull(l),blockHash:rt.allowNull(o),transactionIndex:l,removed:rt.allowNull(this.boolean.bind(this)),address:t,data:rt.allowFalsish(s,"0x"),topics:rt.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return Hu(e||[])}number(e){return e==="0x"?0:Ve.from(e).toNumber()}type(e){return e==="0x"||e==null?0:Ve.from(e).toNumber()}bigNumber(e){return Ve.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return typeof e=="string"&&(!t&&e.substring(0,2)!=="0x"&&(e="0x"+e),Tt(e))?e.toLowerCase():dp.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!==0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return oi(e)}callAddress(e){if(!Tt(e,32))return null;const t=oi(pi(e,12));return t===p9?null:t}contractAddress(e){return hH(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||Tt(e))return Cx(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return _u(r)!==32?dp.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(e==null)return null;const t=Ve.from(e);try{return t.toNumber()}catch{}return null}uint256(e){if(!Tt(e))throw new Error("invalid uint256");return rr(e,32)}_block(e,t){e.author!=null&&e.miner==null&&(e.miner=e.author);const r=e._difficulty!=null?e._difficulty:e.difficulty,i=rt.check(t,e);return i._difficulty=r==null?null:Ve.from(r),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return rt.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&Ve.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const t=rt.check(this.formats.transaction,e);if(e.chainId!=null){let r=e.chainId;Tt(r)&&(r=Ve.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;r==null&&t.v==null&&(r=e.chainId),Tt(r)&&(r=Ve.from(r).toNumber()),typeof r!="number"&&t.v!=null&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),typeof r!="number"&&(r=0),t.chainId=r}return t.blockHash&&t.blockHash.replace(/0/g,"")==="x"&&(t.blockHash=null),t}transaction(e){return gX(e)}receiptLog(e){return rt.check(this.formats.receiptLog,e)}receipt(e){const t=rt.check(this.formats.receipt,e);if(t.root!=null)if(t.root.length<=4){const r=Ve.from(t.root).toNumber();r===0||r===1?(t.status!=null&&t.status!==r&&dp.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):dp.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&dp.throwArgumentError("invalid root hash","value.root",t.root);return t.status!=null&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map(t=>this.topics(t)):e!=null?this.hash(e,!0):null}filter(e){return rt.check(this.formats.filter,e)}filterLog(e){return rt.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const i in e)try{const s=e[i](t[i]);s!==void 0&&(r[i]=s)}catch(s){throw s.checkKey=i,s.checkValue=t[i],s}return r}static allowNull(e,t){return function(r){return r==null?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach(function(i){r.push(e(i))}),r}}};function vX(n){return n&&typeof n.isCommunityResource=="function"}function rF(n){return vX(n)&&n.isCommunityResource()}let iF=!1;function Nx(){iF||(iF=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var vt=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Ct=new _e(Si),yX=10;function sF(n){return n==null?"null":(_u(n)!==32&&Ct.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function oF(n){for(n=n.slice();n.length>0&&n[n.length-1]==null;)n.pop();return n.map(e=>{if(Array.isArray(e)){const t={};e.forEach(i=>{t[sF(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return sF(e)}).join("&")}function wX(n){return n===""?[]:n.split(/&/g).map(e=>{if(e==="")return[];const t=e.split("|").map(r=>r==="null"?null:r);return t.length===1?t[0]:t})}function ef(n){if(typeof n=="string"){if(n=n.toLowerCase(),_u(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+oF(n);if(f9.isForkEvent(n))throw Ct.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+oF(n.topics||[])}throw new Error("invalid event - "+n)}function pp(){return new Date().getTime()}function aF(n){return new Promise(e=>{setTimeout(e,n)})}const _X=["block","network","pending","poll"];let xX=class{constructor(e,t,r){Pe(this,"tag",e),Pe(this,"listener",t),Pe(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const t=e[1],r=wX(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||_X.indexOf(this.tag)>=0}};const bX={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function wb(n){return rr(Ve.from(n).toHexString(),32)}function lF(n){return bS.encode(Bs([n,pi(ZU(ZU(n)),0,4)]))}const jH=new RegExp("^(ipfs)://(.*)$","i"),cF=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),jH,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function tw(n,e){try{return o0(cg(n,e))}catch{}return null}function cg(n,e){if(n==="0x")return null;const t=Ve.from(pi(n,e,e+32)).toNumber(),r=Ve.from(pi(n,t,t+32)).toNumber();return pi(n,t+32,t+32+r)}function _b(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):Ct.throwArgumentError("unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}function AF(n){const e=ft(n);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function EX(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function WH(n){const e=[];let t=0;for(let r=0;rVe.from(e).eq(1)).catch(e=>{if(e.code===_e.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return vt(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:Ki([e,qy(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=Ki(["0x9061b923",WH([Z9(this.name),r.data])]));try{let s=yield this.provider.call(r);return ft(s).length%32===4&&Ct.throwError("resolver threw error",_e.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=cg(s,0)),s}catch(s){if(s.code===_e.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return vt(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?cg(r,0):null})}_getAddress(e,t){const r=bX[String(e)];if(r==null&&Ct.throwError(`unsupported coin type: ${e}`,_e.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),r.ilk==="eth")return this.provider.formatter.address(t);const i=ft(t);if(r.p2pkh!=null){const s=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return lF(Bs([[r.p2pkh],"0x"+s[2]]))}}if(r.p2sh!=null){const s=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return lF(Bs([[r.p2sh],"0x"+s[2]]))}}if(r.prefix!=null){const s=i[1];let o=i[0];if(o===0?s!==20&&s!==32&&(o=-1):o=-1,o>=0&&i.length===2+s&&s>=1&&s<=75){const a=JU.toWords(i.slice(2));return a.unshift(o),JU.encode(r.prefix,a)}}return null}getAddress(e){return vt(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===y9?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===_e.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",wb(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&Ct.throwError("invalid or unsupported coin data",_e.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return vt(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(t==null)return null;for(let r=0;ro[l])}return Ct.throwError("invalid or unsupported content hash data",_e.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return vt(this,void 0,void 0,function*(){let t=Wa(e);t=Bs([wb(64),wb(t.length),t]),t.length%32!==0&&(t=Bs([t,rr("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",at(t));return r==null||r==="0x"?null:o0(r)})}}let xb=null,BX=1;class AI extends s0{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Pe(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(t=>{}),this._ready().catch(t=>{});else{const t=Ss(new.target,"getNetwork")(e);t?(Pe(this,"_network",t),this.emit("network",t,null)):Ct.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return vt(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||Ct.throwError("no network detected",_e.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:Pe(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return hh(()=>this._ready().then(e=>e,e=>{if(!(e.code===_e.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return xb==null&&(xb=new nF),xb}static getNetwork(e){return Y4(e??"homestead")}ccipReadFetch(e,t,r){return vt(this,void 0,void 0,function*(){if(this.disableCcipRead||r.length===0)return null;const i=e.to.toLowerCase(),s=t.toLowerCase(),o=[];for(let a=0;a=0?null:JSON.stringify({data:s,sender:i}),u=yield Fx({url:c,errorPassThrough:!0},A,(h,d)=>(h.status=d.statusCode,h));if(u.data)return u.data;const f=u.message||"unknown error";if(u.status>=400&&u.status<500)return Ct.throwError(`response not found during CCIP fetch: ${f}`,_e.errors.SERVER_ERROR,{url:l,errorMessage:f});o.push(f)}return Ct.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,_e.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return vt(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const s=yield i;if(pp()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=pp(),r=yr({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:s})=>{if(s)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),s;const o=pp();return i=Ve.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return vt(this,void 0,void 0,function*(){const e=BX++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)Ct.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Ct.makeError("network block skew detected",_e.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let i=this._emitted.block+1;i<=r;i++)this.emit("block",i);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const s=this._emitted[i];s!=="pending"&&r-s>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=r-1),this._events.forEach(i=>{switch(i.type){case"tx":{const s=i.hash;let o=this.getTransactionReceipt(s).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+s]=a.blockNumber,this.emit(s,a)),null)).catch(a=>{this.emit("error",a)});t.push(o);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=r-1);const s=i.filter;s.fromBlock=i._lastBlockNumber+1,s.toBlock=r;const o=s.toBlock-this._maxFilterBlockRange;o>s.fromBlock&&(s.fromBlock=o),s.fromBlock<0&&(s.fromBlock=0);const a=this.getLogs(s).then(l=>{i._inflight=!1,l.length!==0&&l.forEach(c=>{c.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=c.blockNumber),this._emitted["b:"+c.blockHash]=c.blockNumber,this._emitted["t:"+c.transactionHash]=c.blockNumber,this.emit(s,c)})}).catch(l=>{this.emit("error",l),i._inflight=!1});t.push(a)}break}}}),this._lastBlockNumber=r,Promise.all(t).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return vt(this,void 0,void 0,function*(){return Ct.throwError("provider does not support network detection",_e.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return vt(this,void 0,void 0,function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield aF(0),this._network;const r=Ct.makeError("underlying network changed",_e.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=pp();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(t=>((this._fastBlockNumber==null||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return vt(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return vt(this,void 0,void 0,function*(){const s=yield this.getTransactionReceipt(e);return(s?s.confirmations:0)>=t?s:new Promise((o,a)=>{const l=[];let c=!1;const A=function(){return c?!0:(c=!0,l.forEach(f=>{f()}),!1)},u=f=>{f.confirmations{this.removeListener(e,u)}),i){let f=i.startBlock,h=null;const d=m=>vt(this,void 0,void 0,function*(){c||(yield aF(1e3),this.getTransactionCount(i.from).then(g=>vt(this,void 0,void 0,function*(){if(!c){if(g<=i.nonce)f=m;else{{const p=yield this.getTransaction(e);if(p&&p.blockNumber!=null)return}for(h==null&&(h=f-3,h{c||this.once("block",d)}))});if(c)return;this.once("block",d),l.push(()=>{this.removeListener("block",d)})}if(typeof r=="number"&&r>0){const f=setTimeout(()=>{A()||a(Ct.makeError("timeout exceeded",_e.errors.TIMEOUT,{timeout:r}))},r);f.unref&&f.unref(),l.push(()=>{clearTimeout(f)})}})})}getBlockNumber(){return vt(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Ve.from(e)}catch(t){return Ct.throwError("bad result from backend",_e.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getBalance",r);try{return Ve.from(i)}catch(s){return Ct.throwError("bad result from backend",_e.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getTransactionCount",r);try{return Ve.from(i).toNumber()}catch(s){return Ct.throwError("bad result from backend",_e.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getCode",r);try{return at(i)}catch(s){return Ct.throwError("bad result from backend",_e.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield yr({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then(o=>Cx(o))}),s=yield this.perform("getStorageAt",i);try{return at(s)}catch(o){return Ct.throwError("bad result from backend",_e.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&_u(t)!==32)throw new Error("invalid response - sendTransaction");const i=e;return t!=null&&e.hash!==t&&Ct.throwError("Transaction hash mismatch from Provider.sendTransaction.",_e.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>vt(this,void 0,void 0,function*(){s==null&&(s=1),o==null&&(o=0);let a;s!==0&&r!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const l=yield this._waitForTransaction(e.hash,s,o,a);return l==null&&s===0?null:(this._emitted["t:"+e.hash]=l.blockNumber,l.status===0&&Ct.throwError("transaction failed",_e.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then(s=>at(s)),r=this.formatter.transaction(e);r.confirmations==null&&(r.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const s=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,s,i)}catch(s){throw s.transaction=r,s.transactionHash=r.hash,s}})}_getTransactionRequest(e){return vt(this,void 0,void 0,function*(){const t=yield e,r={};return["from","to"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?this._getAddress(s):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?Ve.from(s):null))}),["type"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s??null))}),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?at(s):null))}),this.formatter.transactionRequest(yield yr(r))})}_getFilter(e){return vt(this,void 0,void 0,function*(){e=yield e;const t={};return e.address!=null&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach(r=>{e[r]!=null&&(t[r]=e[r])}),["fromBlock","toBlock"].forEach(r=>{e[r]!=null&&(t[r]=this._getBlockTag(e[r]))}),this.formatter.filter(yield yr(t))})}_call(e,t,r){return vt(this,void 0,void 0,function*(){r>=yX&&Ct.throwError("CCIP read exceeded maximum redirections",_e.errors.SERVER_ERROR,{redirects:r,transaction:e});const i=e.to,s=yield this.perform("call",{transaction:e,blockTag:t});if(r>=0&&t==="latest"&&i!=null&&s.substring(0,10)==="0x556f1830"&&_u(s)%32===4)try{const o=pi(s,4),a=pi(o,0,32);Ve.from(a).eq(i)||Ct.throwError("CCIP Read sender did not match",_e.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],c=Ve.from(pi(o,32,64)).toNumber(),A=Ve.from(pi(o,c,c+32)).toNumber(),u=pi(o,c+32);for(let p=0;pvt(this,void 0,void 0,function*(){const s=yield this.perform("getBlock",i);if(s==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&r>this._emitted.block?null:void 0;if(t){let o=null;for(let l=0;lthis._wrapTransaction(l)),a}return this.formatter.block(s)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return vt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return hh(()=>vt(this,void 0,void 0,function*(){const r=yield this.perform("getTransaction",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return vt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return hh(()=>vt(this,void 0,void 0,function*(){const r=yield this.perform("getTransactionReceipt",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;if(r.blockHash==null)return;const i=this.formatter.receipt(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return i}),{oncePoll:this})})}getLogs(e){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield yr({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach(i=>{i.removed==null&&(i.removed=!1)}),nF.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return vt(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return vt(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Ct.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)})}getResolver(e){return vt(this,void 0,void 0,function*(){let t=e;for(;;){if(t===""||t==="."||e!=="eth"&&t==="eth")return null;const r=yield this._getResolver(t,"getResolver");if(r!=null){const i=new uF(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return vt(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Ct.throwError("network does not support ENS",_e.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+qy(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return vt(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(r){if(Tt(e))throw r}typeof e!="string"&&Ct.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return vt(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const t=e.substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t,"lookupAddress");if(r==null)return null;const i=tw(yield this.call({to:r,data:"0x691f3431"+qy(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return vt(this,void 0,void 0,function*(){let t=null;if(Tt(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;t=new uF(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==_e.errors.CALL_EXCEPTION)throw a}try{const a=tw(yield this.call({to:o,data:"0x691f3431"+qy(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==_e.errors.CALL_EXCEPTION)throw a;return null}}else if(t=yield this.getResolver(e),!t)return null;const r=yield t.getAvatar();return r==null?null:r.url})}perform(e,t){return Ct.throwError(e+" not implemented",_e.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_addEventListener(e,t,r){const i=new xX(ef(e),t,r);return this._events.push(i),this._startEvent(i),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,i=[],s=ef(e);return this._events=this._events.filter(o=>o.tag!==s?!0:(setTimeout(()=>{o.listener.apply(this,t)},0),r=!0,o.once?(i.push(o),!1):!0)),i.forEach(o=>{this._stopEvent(o)}),r}listenerCount(e){if(!e)return this._events.length;let t=ef(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=ef(e);return this._events.filter(r=>r.tag===t).map(r=>r.listener)}off(e,t){if(t==null)return this.removeAllListeners(e);const r=[];let i=!1,s=ef(e);return this._events=this._events.filter(o=>o.tag!==s||o.listener!=t||i?!0:(i=!0,r.push(o),!1)),r.forEach(o=>{this._stopEvent(o)}),this}removeAllListeners(e){let t=[];if(e==null)t=this._events,this._events=[];else{const r=ef(e);this._events=this._events.filter(i=>i.tag!==r?!0:(t.push(i),!1))}return t.forEach(r=>{this._stopEvent(r)}),this}}const SX="abstract-signer/5.7.0";var Ro=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const $s=new _e(SX),MX=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],CX=[_e.errors.INSUFFICIENT_FUNDS,_e.errors.NONCE_EXPIRED,_e.errors.REPLACEMENT_UNDERPRICED];class l0{constructor(){$s.checkAbstract(new.target,l0),Pe(this,"_isSigner",!0)}getBalance(e){return Ro(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Ro(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Ro(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const t=yield yr(this.checkTransaction(e));return yield this.provider.estimateGas(t)})}call(e,t){return Ro(this,void 0,void 0,function*(){this._checkProvider("call");const r=yield yr(this.checkTransaction(e));return yield this.provider.call(r,t)})}sendTransaction(e){return Ro(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)})}getChainId(){return Ro(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Ro(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Ro(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Ro(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const r in e)MX.indexOf(r)===-1&&$s.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=kn(e);return t.from==null?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then(r=>(r[0].toLowerCase()!==r[1].toLowerCase()&&$s.throwArgumentError("from address mismatch","transaction",e),r[0])),t}populateTransaction(e){return Ro(this,void 0,void 0,function*(){const t=yield yr(this.checkTransaction(e));t.to!=null&&(t.to=Promise.resolve(t.to).then(i=>Ro(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&$s.throwArgumentError("provided ENS name resolves to null","tx.to",i),s})),t.to.catch(i=>{}));const r=t.maxFeePerGas!=null||t.maxPriorityFeePerGas!=null;if(t.gasPrice!=null&&(t.type===2||r)?$s.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(t.type===0||t.type===1)&&r&&$s.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(t.type===2||t.type==null)&&t.maxFeePerGas!=null&&t.maxPriorityFeePerGas!=null)t.type=2;else if(t.type===0||t.type===1)t.gasPrice==null&&(t.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(t.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(t.type=2,t.gasPrice!=null){const s=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=s,t.maxPriorityFeePerGas=s}else t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(r&&$s.throwError("network does not support EIP-1559",_e.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):$s.throwError("failed to get consistent fee data",_e.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else t.type===2&&(t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return t.nonce==null&&(t.nonce=this.getTransactionCount("pending")),t.gasLimit==null&&(t.gasLimit=this.estimateGas(t).catch(i=>{if(CX.indexOf(i.code)>=0)throw i;return $s.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",_e.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:t})})),t.chainId==null?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&$s.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield yr(t)})}_checkProvider(e){this.provider||$s.throwError("missing provider",_e.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class uI extends l0{constructor(e,t){super(),Pe(this,"address",e),Pe(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{$s.throwError(e,_e.errors.UNSUPPORTED_OPERATION,{operation:t})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new uI(this.address,e)}}var Sl=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const wr=new _e(Si),TX=["call","estimateGas"];function Nm(n,e){if(n==null)return null;if(typeof n.message=="string"&&n.message.match("reverted")){const t=Tt(n.data)?n.data:null;if(!e||t)return{message:n.message,data:t}}if(typeof n=="object"){for(const t in n){const r=Nm(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return Nm(JSON.parse(n),e)}catch{}return null}function KH(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=Nm(e,!0);if(s)return s.data;wr.throwError("missing revert data in call exception; Transaction reverted without a reason string",_e.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=Nm(e.body,!1);s==null&&(s=Nm(e,!1)),s&&wr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",_e.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===_e.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&wr.throwError("insufficient funds for intrinsic transaction cost",_e.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&wr.throwError("nonce has already been used",_e.errors.NONCE_EXPIRED,{error:e,method:n,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&wr.throwError("replacement fee too low",_e.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&wr.throwError("legacy pre-eip-155 transactions not supported",_e.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),TX.indexOf(n)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&wr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",_e.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function fF(n){return new Promise(function(e){setTimeout(e,n)})}function IX(n){if(n.error){const e=new Error(n.error.message);throw e.code=n.error.code,e.data=n.error.data,e}return n.result}function mp(n){return n&&n.toLowerCase()}const IS={};class XH extends l0{constructor(e,t,r){if(super(),e!==IS)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Pe(this,"provider",t),r==null&&(r=0),typeof r=="string"?(Pe(this,"_address",this.provider.formatter.address(r)),Pe(this,"_index",null)):typeof r=="number"?(Pe(this,"_index",r),Pe(this,"_address",null)):wr.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return wr.throwError("cannot alter JSON-RPC Signer connection",_e.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new RX(IS,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&wr.throwError("unknown account #"+this._index,_e.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=kn(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=kn(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>Sl(this,void 0,void 0,function*(){if(r==null)return null;const i=yield this.provider.resolveName(r);return i==null&&wr.throwArgumentError("provided ENS name resolves to null","tx.to",r),i}))),yr({tx:yr(e),sender:t}).then(({tx:r,sender:i})=>{r.from!=null?r.from.toLowerCase()!==i&&wr.throwArgumentError("from address mismatch","transaction",e):r.from=i;const s=this.provider.constructor.hexlifyTransaction(r,{from:!0});return this.provider.send("eth_sendTransaction",[s]).then(o=>o,o=>(typeof o.message=="string"&&o.message.match(/user denied/i)&&wr.throwError("user rejected transaction",_e.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),KH("sendTransaction",o,s)))})}signTransaction(e){return wr.throwError("signing transactions is unsupported",_e.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Sl(this,void 0,void 0,function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield hh(()=>Sl(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(r);if(i!==null)return this.provider._wrapTransaction(i,r,t)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=r,i}})}signMessage(e){return Sl(this,void 0,void 0,function*(){const t=typeof e=="string"?Wa(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[at(t),r.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wr.throwError("user rejected signing",_e.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return Sl(this,void 0,void 0,function*(){const t=typeof e=="string"?Wa(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),at(t)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wr.throwError("user rejected signing",_e.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return Sl(this,void 0,void 0,function*(){const i=yield vs.resolveNames(e,t,r,o=>this.provider.resolveName(o)),s=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[s.toLowerCase(),JSON.stringify(vs.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&wr.throwError("user rejected signing",_e.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return Sl(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class RX extends XH{sendTransaction(e){return this.sendUncheckedTransaction(e).then(t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:r=>this.provider.waitForTransaction(t,r)}))}}const UX={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class Ag extends AI{constructor(e,t){let r=t;r==null&&(r=new Promise((i,s)=>{setTimeout(()=>{this.detectNetwork().then(o=>{i(o)},o=>{s(o)})},0)})),super(r),e||(e=Ss(this.constructor,"defaultUrl")()),typeof e=="string"?Pe(this,"connection",Object.freeze({url:e})):Pe(this,"connection",Object.freeze(kn(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Sl(this,void 0,void 0,function*(){yield fF(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const t=Ss(this.constructor,"getNetwork");try{return t(Ve.from(e).toNumber())}catch(r){return wr.throwError("could not detect network",_e.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return wr.throwError("could not detect network",_e.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new XH(IS,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(t=>this.formatter.address(t)))}send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Us(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=Fx(this.connection,JSON.stringify(r),IX).then(o=>(this.emit("debug",{action:"response",request:r,response:o,provider:this}),o),o=>{throw this.emit("debug",{action:"response",error:o,request:r,provider:this}),o});return i&&(this._cache[e]=s,setTimeout(()=>{this._cache[e]=null},0)),s}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[mp(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[mp(t.address),t.blockTag]];case"getCode":return["eth_getCode",[mp(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[mp(t.address),rr(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[Ss(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[Ss(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=mp(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Sl(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=t.transaction;if(i&&i.type!=null&&Ve.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(t=kn(t),t.transaction=kn(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&wr.throwError(e+" not implemented",_e.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return KH(e,i,t)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then(function(r){function i(){e.send("eth_getFilterChanges",[r]).then(function(s){if(e._pendingFilter!=t)return null;let o=Promise.resolve();return s.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",o=o.then(function(){return e.getTransaction(a).then(function(l){return e.emit("pending",l),null})})}),o.then(function(){return fF(1e3)})}).then(function(){if(e._pendingFilter!=t){e.send("eth_uninstallFilter",[r]);return}return setTimeout(function(){i()},0),null}).catch(s=>{})}return i(),r}).catch(r=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=kn(UX);if(t)for(const s in t)t[s]&&(r[s]=!0);o9(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=Cx(Ve.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=at(e[s]))}),e.accessList&&(i.accessList=Hu(e.accessList)),i}}let Om=null;try{if(Om=WebSocket,Om==null)throw new Error("inject please")}catch{const e=new _e(Si);Om=function(){e.throwError("WebSockets not supported in this environment",_e.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var bb=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const H0=new _e(Si);let FX=1;class fI extends Ag{constructor(e,t){t==="any"&&H0.throwError("WebSocketProvider does not support 'any' network yet",_e.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,t):super("_websocket",t),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?Pe(this,"_websocket",new Om(this.connection.url)):Pe(this,"_websocket",e),Pe(this,"_requests",{}),Pe(this,"_subs",{}),Pe(this,"_subIds",{}),Pe(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const s=i.data,o=JSON.parse(s);if(o.id!=null){const a=String(o.id),l=this._requests[a];if(delete this._requests[a],o.result!==void 0)l.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(l.payload),response:o.result,provider:this});else{let c=null;o.error?(c=new Error(o.error.message||"unknown error"),Pe(c,"code",o.error.code||null),Pe(c,"response",s)):c=new Error("unknown error"),l.callback(c,void 0),this.emit("debug",{action:"response",error:c,request:JSON.parse(l.payload),provider:this})}}else if(o.method==="eth_subscription"){const a=this._subs[o.params.subscription];a&&a.processFunc(o.params.result)}else console.warn("this should not happen")};const r=setInterval(()=>{this.emit("poll")},1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){H0.throwError("cannot reset events block on WebSocketProvider",_e.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){H0.throwError("cannot set polling interval on WebSocketProvider",_e.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return bb(this,void 0,void 0,function*(){return null})}set polling(e){e&&H0.throwError("cannot set polling on WebSocketProvider",_e.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=FX++;return new Promise((i,s)=>{function o(l,c){return l?s(l):i(c)}const a=JSON.stringify({method:e,params:t,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(r)]={callback:o,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,t,r){return bb(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(t).then(o=>this.send("eth_subscribe",o)),this._subIds[e]=i);const s=yield i;this._subs[s]={tag:e,processFunc:r}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],t=>{const r=Ve.from(t.number).toNumber();this._emitted.block=r,this.emit("block",r)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],t=>{this.emit("pending",t)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],t=>{t.removed==null&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))});break;case"tx":{const t=r=>{const i=r.hash;this.getTransactionReceipt(i).then(s=>{s&&this.emit(i,s)})};t(e),this._subscribe("tx",["newHeads"],r=>{this._events.filter(i=>i.type==="tx").forEach(t)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let t=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;t="tx"}else if(this.listenerCount(e.event))return;const r=this._subIds[t];r&&(delete this._subIds[t],r.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return bb(this,void 0,void 0,function*(){this.websocket.readyState===Om.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var PX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const fm=new _e(Si);class YH extends Ag{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return PX(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||fm.throwError("no network detected",_e.errors.UNKNOWN_ERROR,{}),this._network==null&&(Pe(this,"_network",t),this.emit("network",t,null))),t})}}class EA extends YH{constructor(e,t){fm.checkAbstract(new.target,EA),e=Ss(new.target,"getNetwork")(e),t=Ss(new.target,"getApiKey")(t);const r=Ss(new.target,"getUrl")(e,t);super(r,e),typeof t=="string"?Pe(this,"apiKey",t):t!=null&&Object.keys(t).forEach(i=>{Pe(this,i,t[i])})}_startPending(){fm.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return fm.throwError("API provider does not support signing",_e.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return fm.throwError("not implemented; sub-classes must override getUrl",_e.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const hF=new _e(Si),nw="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class LX extends fI{constructor(e,t){const r=new $H(e,t),i=r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,r.network),Pe(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===nw}}class $H extends EA{static getWebSocketProvider(e,t){return new LX(e,t)}static getApiKey(e){return e==null?nw:(e&&typeof e!="string"&&hF.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;default:hF.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===nw&&Nx(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===nw}}const DX=new _e(Si),Q0="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function NX(n){switch(n){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return DX.throwArgumentError("unsupported network","name",n)}class OX extends EA{isCommunityResource(){return this.apiKey===Q0}static getApiKey(e){return e??Q0}static getUrl(e,t){t==null&&(t=Q0);const r={allowGzip:!0,url:"https://"+NX(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===Q0&&Nx(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var kX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const dF=new _e(Si);class HX extends EA{static getApiKey(e){return e!=null&&dF.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="https://cloudflare-eth.com/";break;default:dF.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return kX(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,e,t)})}}var z0=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Oc=new _e(Si);function pF(n){const e={};for(let t in n){if(n[t]==null)continue;let r=n[t];t==="type"&&r===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[t]?r=Cx(at(r)):t==="accessList"?r="["+Hu(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=at(r),e[t]=r)}return e}function QX(n){if(n.status==0&&(n.message==="No records found"||n.message==="No transactions found"))return n.result;if(n.status!=1||typeof n.message!="string"||!n.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(n),(n.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return n.result}function mF(n){if(n&&n.status==0&&n.message=="NOTOK"&&(n.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(n),e.throttleRetry=!0,e}if(n.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(n),e}if(n.error){const e=new Error(n.error.message||"unknown error");throw n.error.code&&(e.code=n.error.code),n.error.data&&(e.data=n.error.data),e}return n.result}function gF(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function Eb(n,e,t){if(n==="call"&&e.code===_e.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let s=i.data;if(s&&(s="0x"+s.replace(/^.*0x/i,"")),Tt(s))return s;Oc.throwError("missing revert data in call exception",_e.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===_e.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?r=e.error.message:typeof e.body=="string"?r=e.body:typeof e.responseText=="string"&&(r=e.responseText)),r=(r||"").toLowerCase(),r.match(/insufficient funds/)&&Oc.throwError("insufficient funds for intrinsic transaction cost",_e.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:t}),r.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&Oc.throwError("nonce has already been used",_e.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&Oc.throwError("replacement fee too low",_e.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:t}),r.match(/execution failed due to an exception|execution reverted/)&&Oc.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",_e.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class zX extends AI{constructor(e,t){super(e),Pe(this,"baseUrl",this.getBaseUrl()),Pe(this,"apiKey",t||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return Oc.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,t){const r=Object.keys(t).reduce((s,o)=>{const a=t[o];return a!=null&&(s+=`&${o}=${a}`),s},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${r}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,t){return t.module=e,t.apikey=this.apiKey,t}fetch(e,t,r){return z0(this,void 0,void 0,function*(){const i=r?this.getPostUrl():this.getUrl(e,t),s=r?this.getPostData(e,t):null,o=e==="proxy"?mF:QX;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(A,u)=>(this.isCommunityResource()&&Nx(),Promise.resolve(!0))};let l=null;s&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},l=Object.keys(s).map(A=>`${A}=${s[A]}`).join("&"));const c=yield Fx(a,l,o||mF);return this.emit("debug",{action:"response",request:i,response:Us(c),provider:this}),c})}detectNetwork(){return z0(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return z0(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch(i=>Eb("sendTransaction",i,t.signedTransaction));case"getBlock":if(t.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash});case"call":{if(t.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=pF(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return Eb("call",s,t.transaction)}}case"estimateGas":{const i=pF(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return Eb("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=gF(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=gF(t.filter.toBlock)),t.filter.address&&(i.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&Oc.throwError("unsupported topic count",_e.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),t.filter.topics.length===1)){const a=t.filter.topics[0];(typeof a!="string"||a.length!==66)&&Oc.throwError("unsupported topic format",_e.errors.UNSUPPORTED_OPERATION,{topic0:a}),i.topic0=a}const s=yield this.fetch("logs",i);let o={};for(let a=0;a{["contractAddress","to"].forEach(function(l){o[l]==""&&delete o[l]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const a=this.formatter.transactionResponse(o);return o.timeStamp&&(a.timestamp=parseInt(o.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}}function GX(n){n=n.slice();for(let e=n.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1)),r=n[e];n[e]=n[t],n[t]=r}return n}var $w=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const nu=new _e(Si);function G0(){return new Date().getTime()}function vF(n){let e=null;for(let t=0;te?null:(r+i)/2}function dh(n){if(n===null)return"null";if(typeof n=="number"||typeof n=="boolean")return JSON.stringify(n);if(typeof n=="string")return n;if(Ve.isBigNumber(n))return n.toString();if(Array.isArray(n))return JSON.stringify(n.map(e=>dh(e)));if(typeof n=="object"){const e=Object.keys(n);return e.sort(),"{"+e.map(t=>{let r=n[t];return typeof r=="function"?r="[function]":r=dh(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let VX=1;function wF(n){let e=null,t=null,r=new Promise(o=>{e=function(){t&&(clearTimeout(t),t=null),o()},t=setTimeout(e,n)});const i=o=>(r=r.then(o),r);function s(){return r}return{cancel:e,getPromise:s,wait:i}}const jX=[_e.errors.CALL_EXCEPTION,_e.errors.INSUFFICIENT_FUNDS,_e.errors.NONCE_EXPIRED,_e.errors.REPLACEMENT_UNDERPRICED,_e.errors.UNPREDICTABLE_GAS_LIMIT],WX=["address","args","errorArgs","errorSignature","method","transaction"];function V0(n,e){const t={weight:n.weight};return Object.defineProperty(t,"provider",{get:()=>n.provider}),n.start&&(t.start=n.start),e&&(t.duration=e-n.start),n.done&&(n.error?t.error=n.error:t.result=n.result||null),t}function KX(n,e){return function(t){const r={};t.forEach(s=>{const o=n(s.result);r[o]||(r[o]={count:0,result:s.result}),r[o].count++});const i=Object.keys(r);for(let s=0;s=e)return o.result}}}function XX(n,e,t){let r=dh;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=yF(i.map(a=>a.result),2);if(o!=null)return o=Math.ceil(o),s.indexOf(o+1)>=0&&o++,o>=n._highestBlockNumber&&(n._highestBlockNumber=o),n._highestBlockNumber};case"getGasPrice":return function(i){const s=i.map(o=>o.result);return s.sort(),s[Math.floor(s.length/2)]};case"getEtherPrice":return function(i){return yF(i.map(s=>s.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":r=function(i){return i==null?null:(i=kn(i),i.confirmations=-1,dh(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=kn(i),i.transactions=i.transactions.map(s=>(s=kn(s),s.confirmations=-1,s)),dh(i))}:r=function(i){return i==null?null:dh(i)};break;default:throw new Error("unknown method: "+e)}return KX(r,n.quorum)}function gp(n,e){return $w(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:hh(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function YX(n,e,t,r){return $w(this,void 0,void 0,function*(){let i=n.provider;switch(t){case"getBlockNumber":case"getGasPrice":return i[t]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return r.blockTag&&Tt(r.blockTag)&&(i=yield gp(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&Tt(r.blockTag)&&(i=yield gp(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&Tt(r.blockTag)&&(i=yield gp(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&Tt(r.blockTag)&&(i=yield gp(n,e)),t==="call"&&r.blockTag?i[t](r.transaction,r.blockTag):i[t](r.transaction);case"getTransaction":case"getTransactionReceipt":return i[t](r.transactionHash);case"getLogs":{let s=r.filter;return(s.fromBlock&&Tt(s.fromBlock)||s.toBlock&&Tt(s.toBlock))&&(i=yield gp(n,e)),i.getLogs(s)}}return nu.throwError("unknown method error",_e.errors.UNKNOWN_ERROR,{method:t,params:r})})}class $X extends AI{constructor(e,t){e.length===0&&nu.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(s0.isProvider(o)){const A=rF(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:A,priority:1})}const l=kn(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=rF(o)?2e3:750),l.weight==null&&(l.weight=1);const c=l.weight;return(c%1||c>512||c<1)&&nu.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,c),Object.freeze(l)}),i=r.reduce((o,a)=>o+a.weight,0);t==null?t=i/2:t>i&&nu.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=vF(r.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),Pe(this,"providerConfigs",Object.freeze(r)),Pe(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return $w(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return vF(e)})}perform(e,t){return $w(this,void 0,void 0,function*(){if(e==="sendTransaction"){const l=yield Promise.all(this.providerConfigs.map(c=>c.provider.sendTransaction(t.signedTransaction).then(A=>A.hash,A=>A)));for(let c=0;cl.priority-c.priority);const s=this._highestBlockNumber;let o=0,a=!0;for(;;){const l=G0();let c=i.filter(h=>h.runner&&l-h.starth+d.weight,0);for(;c{h.staller=null}),h.runner=YX(h,s,e,t).then(m=>{h.done=!0,h.result=m,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:V0(h,G0()),request:{method:e,params:Us(t)},provider:this})},m=>{h.done=!0,h.error=m,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:V0(h,G0()),request:{method:e,params:Us(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:V0(h,null),request:{method:e,params:Us(t)},provider:this}),c+=h.weight}const A=[];i.forEach(h=>{h.done||!h.runner||(A.push(h.runner),h.staller&&A.push(h.staller.getPromise()))}),A.length&&(yield Promise.race(A));const u=i.filter(h=>h.done&&h.error==null);if(u.length>=this.quorum){const h=r(u);if(h!==void 0)return i.forEach(d=>{d.staller&&d.staller.cancel(),d.cancelled=!0}),h;a||(yield wF(100).getPromise()),a=!1}const f=i.reduce((h,d)=>{if(!d.done||d.error==null)return h;const m=d.error.code;return jX.indexOf(m)>=0&&(h[m]||(h[m]={error:d.error,weight:0}),h[m].weight+=d.weight),h},{});if(Object.keys(f).forEach(h=>{const d=f[h];if(d.weight{p.staller&&p.staller.cancel(),p.cancelled=!0});const m=d.error,g={};WX.forEach(p=>{m[p]!=null&&(g[p]=m[p])}),nu.throwError(m.reason||m.message,h,g)}),i.filter(h=>!h.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),nu.throwError("failed to meet quorum",_e.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>V0(l)),provider:this})})}}const ZX=null,rw=new _e(Si),hm="84842078b09946638c03157f83405213";class qX extends fI{constructor(e,t){const r=new ZH(e,t),i=r.connection;i.password&&rw.throwError("INFURA WebSocket project secrets unsupported",_e.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),Pe(this,"apiKey",r.projectId),Pe(this,"projectId",r.projectId),Pe(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===hm}}class ZH extends EA{static getWebSocketProvider(e,t){return new qX(e,t)}static getApiKey(e){const t={apiKey:hm,projectId:hm,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(rw.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),rw.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),t.projectId=e.projectId,t.projectSecret=e.projectSecret):e.projectId&&(t.projectId=e.projectId),t.apiKey=t.projectId),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;default:rw.throwError("unsupported network",_e.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===hm&&Nx(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===hm}}const Bb=new _e(Si),JX="ETHERS_JS_SHARED";class eY extends EA{static getApiKey(e){return e&&typeof e!="string"&&Bb.throwArgumentError("invalid apiKey","apiKey",e),e||JX}static getUrl(e,t){Bb.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(e.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:Bb.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const _F=new _e(Si),xF="62e1ad51b37b8e00394bda3b";class tY extends EA{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=xF:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:_F.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:_F.throwError("unsupported network",_e.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${r}/v1/lb/${t.applicationId}`,s={headers:{},url:i};return t.applicationSecretKey!=null&&(s.user="",s.password=t.applicationSecretKey),s}isCommunityResource(){return this.applicationId===xF}}const bF=new _e(Si);let nY=1;function EF(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:nY++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:Us(s),provider:this}),e(s,(l,c)=>{if(l)return this.emit("debug",{action:"response",fetcher:t,error:l,request:s,provider:this}),a(l);if(this.emit("debug",{action:"response",fetcher:t,request:s,response:c,provider:this}),c.error){const A=new Error(c.error.message);return A.code=c.error.code,A.data=c.error.data,a(A)}o(c.result)})})}}function rY(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:Us(r),provider:this}),n.request(r).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:i,provider:this}),i})}}class hI extends Ag{constructor(e,t){e==null&&bF.throwArgumentError("missing provider","provider",e);let r=null,i=null,s=null;typeof e=="function"?(r="unknown:",i=e):(r=e.host||e.path||"",!r&&e.isMetaMask&&(r="metamask"),s=e,e.request?(r===""&&(r="eip-1193:"),i=rY(e)):e.sendAsync?i=EF(e,e.sendAsync.bind(e)):e.send?i=EF(e,e.send.bind(e)):bF.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),Pe(this,"jsonRpcFetchFunc",i),Pe(this,"provider",s)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const BF=new _e(Si);function iY(n,e){if(n==null&&(n="homestead"),typeof n=="string"){const r=n.match(/^(ws|http)s?:/i);if(r)switch(r[1].toLowerCase()){case"http":case"https":return new Ag(n);case"ws":case"wss":return new fI(n);default:BF.throwArgumentError("unsupported URL scheme","network",n)}}const t=Y4(n);return(!t||!t._defaultProvider)&&BF.throwError("unsupported getDefaultProvider network",_e.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:$X,AlchemyProvider:$H,AnkrProvider:OX,CloudflareProvider:HX,EtherscanProvider:zX,InfuraProvider:ZH,JsonRpcProvider:Ag,NodesmithProvider:eY,PocketProvider:tY,Web3Provider:hI,IpcProvider:ZX},e)}var sY=!0,Sb="Invariant failed";function Ll(n,e){if(!n){if(sY)throw new Error(Sb);var t=typeof e=="function"?e():e,r=t?"".concat(Sb,": ").concat(t):Sb;throw new Error(r)}}var Ko;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(Ko||(Ko={}));function ug(){return ug=Object.assign||function(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function iw(n,e,t){return oY()?iw=Reflect.construct:iw=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),c=new l;return o&&fg(c,o.prototype),c},iw.apply(null,arguments)}function aY(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Zw(n){var e=typeof Map=="function"?new Map:void 0;return Zw=function(r){if(r===null||!aY(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return iw(r,arguments,RS(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),fg(i,r)},Zw(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function SF(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function JH(n){if(typeof n=="string"){n=n.replace(/^Ox/,"0x");var e=Number.parseInt(n,n.trim().substring(0,2)==="0x"?16:10);return Number.isNaN(e)&&Ll(!1),e}else return Number.isInteger(n)||Ll(!1),n}function eQ(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||Ll(!1);for(var e=n.substring(0,2)==="0x"?n:"0x"+n,t=e.toLowerCase().substring(2).split(""),r=new Uint8Array(40),i=0;i<40;i++)r[i]=t[i].charCodeAt(0);for(var s=ft(Er(r)),o=0;o<40;o+=2)s[o>>1]>>4>=8&&(t[o]=t[o].toUpperCase()),(s[o>>1]&15)>=8&&(t[o+1]=t[o+1].toUpperCase());var a="0x"+t.join("");return e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==a&&Ll(!1),a}var MF=function(e,t){try{var r=function(o){return Promise.resolve(Promise.all([t.chainId===void 0?e.getChainId():t.chainId,t.account===void 0?e.getAccount():t.account])).then(function(a){var l=a[0],c=a[1],A=JH(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(A))throw new tQ(A,e.supportedChainIds);var u=c===null?c:eQ(c);return{provider:o,chainId:A,account:u}})},i=t.provider===void 0;return Promise.resolve(i?Promise.resolve(e.getProvider()).then(r):r(t.provider))}catch(s){return Promise.reject(s)}},j0=function(n){qH(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(Zw(Error)),tQ=function(n){qH(e,n);function e(t,r){var i;return i=n.call(this)||this,i.name=i.constructor.name,i.message="Unsupported chain id: "+t+". Supported chain ids are: "+r+".",i}return e}(Zw(Error)),Hr;(function(n){n[n.ACTIVATE_CONNECTOR=0]="ACTIVATE_CONNECTOR",n[n.UPDATE=1]="UPDATE",n[n.UPDATE_FROM_ERROR=2]="UPDATE_FROM_ERROR",n[n.ERROR=3]="ERROR",n[n.ERROR_FROM_ACTIVATION=4]="ERROR_FROM_ACTIVATION",n[n.DEACTIVATE_CONNECTOR=5]="DEACTIVATE_CONNECTOR"})(Hr||(Hr={}));function lY(n,e){var t=e.type,r=e.payload;switch(t){case Hr.ACTIVATE_CONNECTOR:{var i=r.connector,s=r.provider,o=r.chainId,a=r.account,l=r.onError;return{connector:i,provider:s,chainId:o,account:a,onError:l}}case Hr.UPDATE:{var c=r.provider,A=r.chainId,u=r.account;return ug({},n,c===void 0?{}:{provider:c},A===void 0?{}:{chainId:A},u===void 0?{}:{account:u})}case Hr.UPDATE_FROM_ERROR:{var f=r.provider,h=r.chainId,d=r.account;return ug({},n,f===void 0?{}:{provider:f},h===void 0?{}:{chainId:h},d===void 0?{}:{account:d},{error:void 0})}case Hr.ERROR:{var m=r.error,g=n.connector,p=n.onError;return{connector:g,error:m,onError:p}}case Hr.ERROR_FROM_ACTIVATION:{var v=r.connector,w=r.error;return{connector:v,error:w}}case Hr.DEACTIVATE_CONNECTOR:return{}}}function cY(){var n=xe.useReducer(lY,{}),e=n[0],t=n[1],r=e.connector,i=e.provider,s=e.chainId,o=e.account,a=e.onError,l=e.error,c=xe.useRef(-1);c.current+=1;var A=xe.useCallback(function(g,p,v){v===void 0&&(v=!1);try{var w=c.current,_=!1;return Promise.resolve(SF(function(){return Promise.resolve(g.activate().then(function(x){return _=!0,x})).then(function(x){return Promise.resolve(MF(g,x)).then(function(b){if(c.current>w)throw new j0;t({type:Hr.ACTIVATE_CONNECTOR,payload:ug({connector:g},b,{onError:p})})})})},function(x){if(x instanceof j0)_&&g.deactivate();else{if(v)throw _&&g.deactivate(),x;p?(_&&g.deactivate(),p(x)):t({type:Hr.ERROR_FROM_ACTIVATION,payload:{connector:g,error:x}})}}))}catch(x){return Promise.reject(x)}},[]),u=xe.useCallback(function(g){t({type:Hr.ERROR,payload:{error:g}})},[]),f=xe.useCallback(function(){t({type:Hr.DEACTIVATE_CONNECTOR})},[]),h=xe.useCallback(function(g){try{if(!r)throw Error("This should never happen, it's just so Typescript stops complaining");var p=c.current;return Promise.resolve(function(){if(l)return SF(function(){return Promise.resolve(MF(r,g)).then(function(x){if(c.current>p)throw new j0;t({type:Hr.UPDATE_FROM_ERROR,payload:x})})},function(x){x instanceof j0||(a?a(x):t({type:Hr.ERROR,payload:{error:x}}))});var v=g.chainId===void 0?void 0:JH(g.chainId);if(v!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(v)){var w=new tQ(v,r.supportedChainIds);a?a(w):t({type:Hr.ERROR,payload:{error:w}})}else{var _=typeof g.account=="string"?eQ(g.account):g.account;t({type:Hr.UPDATE,payload:{provider:g.provider,chainId:v,account:_}})}}())}catch(v){return Promise.reject(v)}},[r,l,a]),d=xe.useCallback(function(g){a?a(g):t({type:Hr.ERROR,payload:{error:g}})},[a]),m=xe.useCallback(function(){t({type:Hr.DEACTIVATE_CONNECTOR})},[]);return xe.useEffect(function(){return function(){r&&r.deactivate()}},[r]),xe.useEffect(function(){return r&&r.on(Ko.Update,h).on(Ko.Error,d).on(Ko.Deactivate,m),function(){r&&r.off(Ko.Update,h).off(Ko.Error,d).off(Ko.Deactivate,m)}},[r,h,d,m]),{connector:r,provider:i,chainId:s,account:o,activate:A,setError:u,deactivate:f,error:l}}var nQ="primary",ph={};function AY(n){ph[n]&&Ll(!1),ph[n]=xe.createContext({activate:function(){try{return Ll(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){Ll(!1)},deactivate:function(){Ll(!1)},active:!1}),ph[n].displayName="Web3ReactContext - "+n;var e=ph[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=cY(),a=o.connector,l=o.provider,c=o.chainId,A=o.account,u=o.activate,f=o.setError,h=o.deactivate,d=o.error,m=a!==void 0&&c!==void 0&&A!==void 0&&!d,g=xe.useMemo(function(){return m&&c!==void 0&&Number.isInteger(c)&&a?i(l,a):void 0},[m,i,l,a,c]),p={connector:a,library:g,chainId:c,account:A,activate:u,setError:f,deactivate:h,active:m,error:d};return q.createElement(e,{value:p},s)}}var uY=AY(nQ);function fY(n){return n===void 0&&(n=nQ),Object.keys(ph).includes(n)||Ll(!1),ph[n]}function hY(n){return xe.useContext(fY(n))}var US={},rQ={exports:{}},Gs={},iQ={exports:{}},sQ={};/** + */(function(n){(function(){var e="input is invalid type",t="finalize already called",r=typeof window=="object",i=r?window:{};i.JS_SHA3_NO_WINDOW&&(r=!1);var s=!r&&typeof self=="object",o=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;o?i=La:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&n.exports,l=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",c="0123456789abcdef".split(""),A=[31,7936,2031616,520093696],u=[4,1024,262144,67108864],f=[1,256,65536,16777216],h=[6,1536,393216,100663296],d=[0,8,16,24],m=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],g=[224,256,384,512],p=[128,256],v=["hex","buffer","arrayBuffer","array","digest"],w={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(F){return Object.prototype.toString.call(F)==="[object Array]"}),l&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(F){return typeof F=="object"&&F.buffer&&F.buffer.constructor===ArrayBuffer});for(var _=function(F,re,ce){return function(oe){return new C(F,re,F).update(oe)[ce]()}},x=function(F,re,ce){return function(oe,ge){return new C(F,re,ge).update(oe)[ce]()}},b=function(F,re,ce){return function(oe,ge,me,ve){return y["cshake"+F].update(oe,ge,me,ve)[ce]()}},B=function(F,re,ce){return function(oe,ge,me,ve){return y["kmac"+F].update(oe,ge,me,ve)[ce]()}},S=function(F,re,ce,oe){for(var ge=0;ge>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ce>>5,this.extraBytes=(ce&31)>>3;for(var oe=0;oe<50;++oe)this.s[oe]=0}C.prototype.update=function(F){if(this.finalized)throw new Error(t);var re,ce=typeof F;if(ce!=="string"){if(ce==="object"){if(F===null)throw new Error(e);if(l&&F.constructor===ArrayBuffer)F=new Uint8Array(F);else if(!Array.isArray(F)&&(!l||!ArrayBuffer.isView(F)))throw new Error(e)}else throw new Error(e);re=!0}for(var oe=this.blocks,ge=this.byteCount,me=F.length,ve=this.blockCount,be=0,ne=this.s,k,ae;be>2]|=F[be]<>2]|=ae<>2]|=(192|ae>>6)<>2]|=(128|ae&63)<=57344?(oe[k>>2]|=(224|ae>>12)<>2]|=(128|ae>>6&63)<>2]|=(128|ae&63)<>2]|=(240|ae>>18)<>2]|=(128|ae>>12&63)<>2]|=(128|ae>>6&63)<>2]|=(128|ae&63)<=ge){for(this.start=k-ge,this.block=oe[ve],k=0;k>8,ce=F&255;ce>0;)ge.unshift(ce),F=F>>8,ce=F&255,++oe;return re?ge.push(oe):ge.unshift(oe),this.update(ge),ge.length},C.prototype.encodeString=function(F){var re,ce=typeof F;if(ce!=="string"){if(ce==="object"){if(F===null)throw new Error(e);if(l&&F.constructor===ArrayBuffer)F=new Uint8Array(F);else if(!Array.isArray(F)&&(!l||!ArrayBuffer.isView(F)))throw new Error(e)}else throw new Error(e);re=!0}var oe=0,ge=F.length;if(re)oe=ge;else for(var me=0;me=57344?oe+=3:(ve=65536+((ve&1023)<<10|F.charCodeAt(++me)&1023),oe+=4)}return oe+=this.encode(oe*8),this.update(F),oe},C.prototype.bytepad=function(F,re){for(var ce=this.encode(re),oe=0;oe>2]|=this.padding[re&3],this.lastByteIndex===this.byteCount)for(F[0]=F[ce],re=1;re>4&15]+c[be&15]+c[be>>12&15]+c[be>>8&15]+c[be>>20&15]+c[be>>16&15]+c[be>>28&15]+c[be>>24&15];me%F===0&&(ee(re),ge=0)}return oe&&(be=re[ge],ve+=c[be>>4&15]+c[be&15],oe>1&&(ve+=c[be>>12&15]+c[be>>8&15]),oe>2&&(ve+=c[be>>20&15]+c[be>>16&15])),ve},C.prototype.arrayBuffer=function(){this.finalize();var F=this.blockCount,re=this.s,ce=this.outputBlocks,oe=this.extraBytes,ge=0,me=0,ve=this.outputBits>>3,be;oe?be=new ArrayBuffer(ce+1<<2):be=new ArrayBuffer(ve);for(var ne=new Uint32Array(be);me>8&255,ve[be+2]=ne>>16&255,ve[be+3]=ne>>24&255;me%F===0&&ee(re)}return oe&&(be=me<<2,ne=re[ge],ve[be]=ne&255,oe>1&&(ve[be+1]=ne>>8&255),oe>2&&(ve[be+2]=ne>>16&255)),ve};function K(F,re,ce){C.call(this,F,re,ce)}K.prototype=new C,K.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var ee=function(F){var re,ce,oe,ge,me,ve,be,ne,k,ae,le,Z,J,ue,Y,G,j,se,fe,he,Be,V,U,O,X,ie,pe,de,Ie,Le,Ue,Ye,Ae,Fe,Me,Ce,Re,Oe,$e,dt,Fn,nt,_t,Tr,en,qt,Zr,Jt,tn,Ws,Kt,Xt,Ii,nn,rn,fa,An,sn,te,ye,Ee,Se,we;for(oe=0;oe<48;oe+=2)ge=F[0]^F[10]^F[20]^F[30]^F[40],me=F[1]^F[11]^F[21]^F[31]^F[41],ve=F[2]^F[12]^F[22]^F[32]^F[42],be=F[3]^F[13]^F[23]^F[33]^F[43],ne=F[4]^F[14]^F[24]^F[34]^F[44],k=F[5]^F[15]^F[25]^F[35]^F[45],ae=F[6]^F[16]^F[26]^F[36]^F[46],le=F[7]^F[17]^F[27]^F[37]^F[47],Z=F[8]^F[18]^F[28]^F[38]^F[48],J=F[9]^F[19]^F[29]^F[39]^F[49],re=Z^(ve<<1|be>>>31),ce=J^(be<<1|ve>>>31),F[0]^=re,F[1]^=ce,F[10]^=re,F[11]^=ce,F[20]^=re,F[21]^=ce,F[30]^=re,F[31]^=ce,F[40]^=re,F[41]^=ce,re=ge^(ne<<1|k>>>31),ce=me^(k<<1|ne>>>31),F[2]^=re,F[3]^=ce,F[12]^=re,F[13]^=ce,F[22]^=re,F[23]^=ce,F[32]^=re,F[33]^=ce,F[42]^=re,F[43]^=ce,re=ve^(ae<<1|le>>>31),ce=be^(le<<1|ae>>>31),F[4]^=re,F[5]^=ce,F[14]^=re,F[15]^=ce,F[24]^=re,F[25]^=ce,F[34]^=re,F[35]^=ce,F[44]^=re,F[45]^=ce,re=ne^(Z<<1|J>>>31),ce=k^(J<<1|Z>>>31),F[6]^=re,F[7]^=ce,F[16]^=re,F[17]^=ce,F[26]^=re,F[27]^=ce,F[36]^=re,F[37]^=ce,F[46]^=re,F[47]^=ce,re=ae^(ge<<1|me>>>31),ce=le^(me<<1|ge>>>31),F[8]^=re,F[9]^=ce,F[18]^=re,F[19]^=ce,F[28]^=re,F[29]^=ce,F[38]^=re,F[39]^=ce,F[48]^=re,F[49]^=ce,ue=F[0],Y=F[1],qt=F[11]<<4|F[10]>>>28,Zr=F[10]<<4|F[11]>>>28,de=F[20]<<3|F[21]>>>29,Ie=F[21]<<3|F[20]>>>29,ye=F[31]<<9|F[30]>>>23,Ee=F[30]<<9|F[31]>>>23,nt=F[40]<<18|F[41]>>>14,_t=F[41]<<18|F[40]>>>14,Fe=F[2]<<1|F[3]>>>31,Me=F[3]<<1|F[2]>>>31,G=F[13]<<12|F[12]>>>20,j=F[12]<<12|F[13]>>>20,Jt=F[22]<<10|F[23]>>>22,tn=F[23]<<10|F[22]>>>22,Le=F[33]<<13|F[32]>>>19,Ue=F[32]<<13|F[33]>>>19,Se=F[42]<<2|F[43]>>>30,we=F[43]<<2|F[42]>>>30,nn=F[5]<<30|F[4]>>>2,rn=F[4]<<30|F[5]>>>2,Ce=F[14]<<6|F[15]>>>26,Re=F[15]<<6|F[14]>>>26,se=F[25]<<11|F[24]>>>21,fe=F[24]<<11|F[25]>>>21,Ws=F[34]<<15|F[35]>>>17,Kt=F[35]<<15|F[34]>>>17,Ye=F[45]<<29|F[44]>>>3,Ae=F[44]<<29|F[45]>>>3,O=F[6]<<28|F[7]>>>4,X=F[7]<<28|F[6]>>>4,fa=F[17]<<23|F[16]>>>9,An=F[16]<<23|F[17]>>>9,Oe=F[26]<<25|F[27]>>>7,$e=F[27]<<25|F[26]>>>7,he=F[36]<<21|F[37]>>>11,Be=F[37]<<21|F[36]>>>11,Xt=F[47]<<24|F[46]>>>8,Ii=F[46]<<24|F[47]>>>8,Tr=F[8]<<27|F[9]>>>5,en=F[9]<<27|F[8]>>>5,ie=F[18]<<20|F[19]>>>12,pe=F[19]<<20|F[18]>>>12,sn=F[29]<<7|F[28]>>>25,te=F[28]<<7|F[29]>>>25,dt=F[38]<<8|F[39]>>>24,Fn=F[39]<<8|F[38]>>>24,V=F[48]<<14|F[49]>>>18,U=F[49]<<14|F[48]>>>18,F[0]=ue^~G&se,F[1]=Y^~j&fe,F[10]=O^~ie&de,F[11]=X^~pe&Ie,F[20]=Fe^~Ce&Oe,F[21]=Me^~Re&$e,F[30]=Tr^~qt&Jt,F[31]=en^~Zr&tn,F[40]=nn^~fa&sn,F[41]=rn^~An&te,F[2]=G^~se&he,F[3]=j^~fe&Be,F[12]=ie^~de&Le,F[13]=pe^~Ie&Ue,F[22]=Ce^~Oe&dt,F[23]=Re^~$e&Fn,F[32]=qt^~Jt&Ws,F[33]=Zr^~tn&Kt,F[42]=fa^~sn&ye,F[43]=An^~te&Ee,F[4]=se^~he&V,F[5]=fe^~Be&U,F[14]=de^~Le&Ye,F[15]=Ie^~Ue&Ae,F[24]=Oe^~dt&nt,F[25]=$e^~Fn&_t,F[34]=Jt^~Ws&Xt,F[35]=tn^~Kt&Ii,F[44]=sn^~ye&Se,F[45]=te^~Ee&we,F[6]=he^~V&ue,F[7]=Be^~U&Y,F[16]=Le^~Ye&O,F[17]=Ue^~Ae&X,F[26]=dt^~nt&Fe,F[27]=Fn^~_t&Me,F[36]=Ws^~Xt&Tr,F[37]=Kt^~Ii&en,F[46]=ye^~Se&nn,F[47]=Ee^~we&rn,F[8]=V^~ue&G,F[9]=U^~Y&j,F[18]=Ye^~O&ie,F[19]=Ae^~X&pe,F[28]=nt^~Fe&Ce,F[29]=_t^~Me&Re,F[38]=Xt^~Tr&qt,F[39]=Ii^~en&Zr,F[48]=Se^~nn&fa,F[49]=we^~rn&An,F[0]^=m[oe],F[1]^=m[oe+1]};if(a)n.exports=y;else for(R=0;R>6===2;o++)s++;return s}return n===xs.OVERRUN?t.length-e-1:0}function S9(n,e,t,r,i){return n===xs.OVERLONG?(r.push(i),0):(r.push(65533),iH(n,e,t))}const M9=Object.freeze({error:B9,ignore:iH,replace:S9});function sH(n,e){e==null&&(e=M9.error),n=ft(n);const t=[];let r=0;for(;r>7)){t.push(i);continue}let s=null,o=null;if((i&224)===192)s=1,o=127;else if((i&240)===224)s=2,o=2047;else if((i&248)===240)s=3,o=65535;else{(i&192)===128?r+=e(xs.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(xs.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(xs.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(xs.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(xs.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(xs.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function Ka(n,e=cg.current){e!=cg.current&&(rH.checkNormalize(),n=n.normalize(e));let t=[];for(let r=0;r>6|192),t.push(i&63|128);else if((i&64512)==55296){r++;const s=n.charCodeAt(r);if(r>=n.length||(s&64512)!==56320)throw new Error("invalid utf-8 string");const o=65536+((i&1023)<<10)+(s&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(i>>12|224),t.push(i>>6&63|128),t.push(i&63|128)}return ft(t)}function C9(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function l0(n,e){return C9(sH(n,e))}function T9(n,e=cg.current){return sH(Ka(n,e))}function dh(n){return Er(Ka(n))}const oH="hash/5.7.0";function aH(n,e){e==null&&(e=1);const t=[],r=t.forEach,i=function(s,o){r.call(s,function(a){o>0&&Array.isArray(a)?i(a,o-1):t.push(a)})};return i(n,e),t}function I9(n){const e={};for(let t=0;t>--l&1}const u=31,f=Math.pow(2,u),h=f>>>1,d=h>>1,m=f-1;let g=0;for(let x=0;x1;){let M=b+B>>>1;x>>1|A(),S=S<<1^h,I=(I^h)<<1|h|1;v=S,w=1+I-S}let _=r-4;return p.map(x=>{switch(x-_){case 3:return _+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return _+256+(n[a++]<<8|n[a++]);case 1:return _+n[a++];default:return x-1}})}function U9(n){let e=0;return()=>n[e++]}function F9(n){return U9(R9(n))}function P9(n){return n&1?~n>>1:n>>1}function L9(n,e){let t=Array(n);for(let r=0;re[o]):t}function N9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(k9(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(H9(t,n))}return I9(aH(e))}function O9(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function lH(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function k9(n,e){let t=1+e(),r=e(),i=O9(e),s=lH(i.length,1+n,e);return aH(s.map((o,a)=>{const l=o[0],c=o.slice(1);return Array(i[a]).fill(void 0).map((A,u)=>{let f=u*r;return[l+u*t,c.map(h=>h+f)]})}))}function H9(n,e){let t=1+e();return lH(t,1+n,e).map(i=>[i[0],i.slice(1)])}function Q9(n){let e=Yw(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let c=Yw(n,e);if(c.length==0)break;r.push({set:new Set(c),node:t()})}r.sort((c,A)=>A.set.size-c.set.size);let i=n(),s=i%3;i=i/3|0;let o=!!(i&1);i>>=1;let a=i==1,l=i==2;return{branches:r,valid:s,fe0f:o,save:a,check:l}}}function z9(){return F9(q4("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Ux=z9(),G9=new Set(Yw(Ux)),V9=new Set(Yw(Ux)),j9=N9(Ux),W9=Q9(Ux),OU=45,kU=95;function cH(n){return T9(n)}function K9(n){return n.filter(e=>e!=65039)}function AH(n){for(let e of n.split(".")){let t=cH(e);try{for(let r=t.lastIndexOf(kU)-1;r>=0;r--)if(t[r]!==kU)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===OU&&t[3]===OU)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function X9(n){return AH(Y9(n,K9))}function Y9(n,e){let t=cH(n).reverse(),r=[];for(;t.length;){let i=Z9(t);if(i){r.push(...e(i));continue}let s=t.pop();if(G9.has(s)){r.push(s);continue}if(V9.has(s))continue;let o=j9[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return AH($9(String.fromCodePoint(...r)))}function $9(n){return n.normalize("NFC")}function Z9(n,e){var t;let r=W9,i,s,o=[],a=n.length;for(e&&(e.length=0);a;){let l=n[--a];if(r=(t=r.branches.find(c=>c.set.has(l)))===null||t===void 0?void 0:t.node,!r)break;if(r.save)s=l;else if(r.check&&l===s)break;o.push(l),r.fe0f&&(o.push(65039),a>0&&n[a-1]==65039&&a--),r.valid&&(i=o.slice(),r.valid==2&&i.splice(1,1),e&&e.push(...n.slice(a).reverse()),n.length=a)}return i}const q9=new _e(oH),uH=new Uint8Array(32);uH.fill(0);function HU(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function fH(n){const e=Ka(X9(n)),t=[];if(n.length===0)return t;let r=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return t.push(HU(e.slice(r))),t}function tw(n){typeof n!="string"&&q9.throwArgumentError("invalid ENS name; not a string","name",n);let e=uH;const t=fH(n);for(;t.length;)e=Er(Ss([e,Er(t.pop())]));return at(e)}function J9(n){return at(Ss(fH(n).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t})))+"00"}const eK="rlp/5.7.0",Ea=new _e(eK);function QU(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function zU(n,e,t){let r=0;for(let i=0;ie+1+r&&Ea.throwError("child data too short",_e.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function dH(n,e){if(n.length===0&&Ea.throwError("data too short",_e.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&Ea.throwError("data short segment too short",_e.errors.BUFFER_OVERRUN,{});const r=zU(n,e+1,t);return e+1+t+r>n.length&&Ea.throwError("data long segment too short",_e.errors.BUFFER_OVERRUN,{}),GU(n,e,e+1+t,t+r)}else if(n[e]>=192){const t=n[e]-192;return e+1+t>n.length&&Ea.throwError("data array too short",_e.errors.BUFFER_OVERRUN,{}),GU(n,e,e+1,t)}else if(n[e]>=184){const t=n[e]-183;e+1+t>n.length&&Ea.throwError("data array too short",_e.errors.BUFFER_OVERRUN,{});const r=zU(n,e+1,t);e+1+t+r>n.length&&Ea.throwError("data array too short",_e.errors.BUFFER_OVERRUN,{});const i=at(n.slice(e+1+t,e+1+t+r));return{consumed:1+t+r,result:i}}else if(n[e]>=128){const t=n[e]-128;e+1+t>n.length&&Ea.throwError("data too short",_e.errors.BUFFER_OVERRUN,{});const r=at(n.slice(e+1,e+1+t));return{consumed:1+t,result:r}}return{consumed:1,result:at(n[e])}}function aI(n){const e=ft(n),t=dH(e,0);return t.consumed!==e.length&&Ea.throwArgumentError("invalid rlp data","data",n),t.result}const tK="address/5.7.0",ph=new _e(tK);function VU(n){Tt(n,20)||ph.throwArgumentError("invalid address","address",n),n=n.toLowerCase();const e=n.substring(2).split(""),t=new Uint8Array(40);for(let i=0;i<40;i++)t[i]=e[i].charCodeAt(0);const r=ft(Er(t));for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(r[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const nK=9007199254740991;function rK(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const lI={};for(let n=0;n<10;n++)lI[String(n)]=String(n);for(let n=0;n<26;n++)lI[String.fromCharCode(65+n)]=String(10+n);const jU=Math.floor(rK(nK));function iK(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>lI[r]).join("");for(;e.length>=jU;){let r=e.substring(0,jU);e=parseInt(r,10)%97+e.substring(r.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}function ai(n){let e=null;if(typeof n!="string"&&ph.throwArgumentError("invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/))n.substring(0,2)!=="0x"&&(n="0x"+n),e=VU(n),n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==n&&ph.throwArgumentError("bad address checksum","address",n);else if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(n.substring(2,4)!==iK(n)&&ph.throwArgumentError("bad icap checksum","address",n),e=s9(n.substring(4));e.length<40;)e="0"+e;e=VU("0x"+e)}else ph.throwArgumentError("invalid address","address",n);return e}function pH(n){let e=null;try{e=ai(n.from)}catch{ph.throwArgumentError("missing from address","transaction",n)}const t=fd(ft(Ve.from(n.nonce).toHexString()));return ai(mi(Er(Fx([e,t])),12))}var sK=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Gn=new _e(oH),mH=new Uint8Array(32);mH.fill(0);const oK=Ve.from(-1),gH=Ve.from(0),vH=Ve.from(1),aK=Ve.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function lK(n){const e=ft(n),t=e.length%32;return t?Yi([e,mH.slice(t)]):at(e)}const cK=rr(vH.toHexString(),32),AK=rr(gH.toHexString(),32),WU={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},hb=["name","version","chainId","verifyingContract","salt"];function KU(n){return function(e){return typeof e!="string"&&Gn.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const uK={name:KU("name"),version:KU("version"),chainId:function(n){try{return Ve.from(n).toString()}catch{}return Gn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return ai(n).toLowerCase()}catch{}return Gn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){try{const e=ft(n);if(e.length!==32)throw new Error("bad length");return at(e)}catch{}return Gn.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function db(n){{const e=n.match(/^(u?)int(\d*)$/);if(e){const t=e[1]==="",r=parseInt(e[2]||"256");(r%8!==0||r>256||e[2]&&e[2]!==String(r))&&Gn.throwArgumentError("invalid numeric width","type",n);const i=aK.mask(t?r-1:r),s=t?i.add(vH).mul(oK):gH;return function(o){const a=Ve.from(o);return(a.lt(s)||a.gt(i))&&Gn.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),rr(a.toTwos(256).toHexString(),32)}}}{const e=n.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return(t===0||t>32||e[1]!==String(t))&&Gn.throwArgumentError("invalid bytes width","type",n),function(r){return ft(r).length!==t&&Gn.throwArgumentError(`invalid length for ${n}`,"value",r),lK(r)}}}switch(n){case"address":return function(e){return rr(ai(e),32)};case"bool":return function(e){return e?cK:AK};case"bytes":return function(e){return Er(e)};case"string":return function(e){return dh(e)}}return null}function XU(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class ys{constructor(e){Pe(this,"types",Object.freeze(Fs(e))),Pe(this,"_encoderCache",{}),Pe(this,"_types",{});const t={},r={},i={};Object.keys(e).forEach(a=>{t[a]={},r[a]=[],i[a]={}});for(const a in e){const l={};e[a].forEach(c=>{l[c.name]&&Gn.throwArgumentError(`duplicate variable name ${JSON.stringify(c.name)} in ${JSON.stringify(a)}`,"types",e),l[c.name]=!0;const A=c.type.match(/^([^\x5b]*)(\x5b|$)/)[1];A===a&&Gn.throwArgumentError(`circular type reference to ${JSON.stringify(A)}`,"types",e),!db(A)&&(r[A]||Gn.throwArgumentError(`unknown type ${JSON.stringify(A)}`,"types",e),r[A].push(a),t[a][A]=!0)})}const s=Object.keys(r).filter(a=>r[a].length===0);s.length===0?Gn.throwArgumentError("missing primary type","types",e):s.length>1&&Gn.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),Pe(this,"primaryType",s[0]);function o(a,l){l[a]&&Gn.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(t[a]).forEach(c=>{r[c]&&(o(c,l),Object.keys(l).forEach(A=>{i[A][c]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=XU(a,e[a])+l.map(c=>XU(c,e[c])).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const i=db(e);if(i)return i}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const i=t[1],s=this.getEncoder(i),o=parseInt(t[3]);return a=>{o>=0&&a.length!==o&&Gn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(Er)),Er(Yi(l))}}const r=this.types[e];if(r){const i=dh(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const c=this.getEncoder(l)(s[a]);return this._types[l]?Er(c):c});return o.unshift(i),Yi(o)}}return Gn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Gn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Er(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(db(e))return r(e,t);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const o=i[1],a=parseInt(i[3]);return a>=0&&t.length!==a&&Gn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map(l=>this._visit(o,l,r))}const s=this.types[e];return s?s.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,t[a],r),o),{}):Gn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new ys(e)}static getPrimaryType(e){return ys.from(e).primaryType}static hashStruct(e,t,r){return ys.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=WU[r];i||Gn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>hb.indexOf(r.name)-hb.indexOf(i.name)),ys.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return Yi(["0x1901",ys.hashDomain(e),ys.from(t).hash(r)])}static hash(e,t,r){return Er(ys.encode(e,t,r))}static resolveNames(e,t,r,i){return sK(this,void 0,void 0,function*(){e=kn(e);const s={};e.verifyingContract&&!Tt(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=ys.from(t);o.visit(r,(a,l)=>(a==="address"&&!Tt(l,20)&&(s[l]="0x"),l));for(const a in s)s[a]=yield i(a);return e.verifyingContract&&s[e.verifyingContract]&&(e.verifyingContract=s[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&s[l]?s[l]:l),{domain:e,value:r}})}static getPayload(e,t,r){ys.hashDomain(e);const i={},s=[];hb.forEach(l=>{const c=e[l];c!=null&&(i[l]=uK[l](c),s.push({name:l,type:WU[l]}))});const o=ys.from(t),a=kn(t);return a.EIP712Domain?Gn.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):a.EIP712Domain=s,o.encode(r),{types:a,domain:i,primaryType:o.primaryType,message:o.visit(r,(l,c)=>{if(l.match(/^bytes(\d*)/))return at(ft(c));if(l.match(/^u?int/))return Ve.from(c).toString();switch(l){case"address":return c.toLowerCase();case"bool":return!!c;case"string":return typeof c!="string"&&Gn.throwArgumentError("invalid string","value",c),c}return Gn.throwArgumentError("unsupported type","type",l)})}}}var yH={},Nt={},c0=wH;function wH(n,e){if(!n)throw new Error(e||"Assertion failed")}wH.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var MS={exports:{}};typeof Object.create=="function"?MS.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:MS.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}};var fK=MS.exports,hK=c0,dK=fK;Nt.inherits=dK;function pK(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function mK(n,e){if(Array.isArray(n))return n.slice();if(!n)return[];var t=[];if(typeof n=="string")if(e){if(e==="hex")for(n=n.replace(/[^a-z0-9]+/ig,""),n.length%2!==0&&(n="0"+n),i=0;i>6|192,t[r++]=s&63|128):pK(n,i)?(s=65536+((s&1023)<<10)+(n.charCodeAt(++i)&1023),t[r++]=s>>18|240,t[r++]=s>>12&63|128,t[r++]=s>>6&63|128,t[r++]=s&63|128):(t[r++]=s>>12|224,t[r++]=s>>6&63|128,t[r++]=s&63|128)}else for(i=0;i>>24|n>>>8&65280|n<<8&16711680|(n&255)<<24;return e>>>0}Nt.htonl=_H;function vK(n,e){for(var t="",r=0;r>>0}return s}Nt.join32=yK;function wK(n,e){for(var t=new Array(n.length*4),r=0,i=0;r>>24,t[i+1]=s>>>16&255,t[i+2]=s>>>8&255,t[i+3]=s&255):(t[i+3]=s>>>24,t[i+2]=s>>>16&255,t[i+1]=s>>>8&255,t[i]=s&255)}return t}Nt.split32=wK;function _K(n,e){return n>>>e|n<<32-e}Nt.rotr32=_K;function xK(n,e){return n<>>32-e}Nt.rotl32=xK;function bK(n,e){return n+e>>>0}Nt.sum32=bK;function EK(n,e,t){return n+e+t>>>0}Nt.sum32_3=EK;function BK(n,e,t,r){return n+e+t+r>>>0}Nt.sum32_4=BK;function SK(n,e,t,r,i){return n+e+t+r+i>>>0}Nt.sum32_5=SK;function MK(n,e,t,r){var i=n[e],s=n[e+1],o=r+s>>>0,a=(o>>0,n[e+1]=o}Nt.sum64=MK;function CK(n,e,t,r){var i=e+r>>>0,s=(i>>0}Nt.sum64_hi=CK;function TK(n,e,t,r){var i=e+r;return i>>>0}Nt.sum64_lo=TK;function IK(n,e,t,r,i,s,o,a){var l=0,c=e;c=c+r>>>0,l+=c>>0,l+=c>>0,l+=c>>0}Nt.sum64_4_hi=IK;function RK(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}Nt.sum64_4_lo=RK;function UK(n,e,t,r,i,s,o,a,l,c){var A=0,u=e;u=u+r>>>0,A+=u>>0,A+=u>>0,A+=u>>0,A+=u>>0}Nt.sum64_5_hi=UK;function FK(n,e,t,r,i,s,o,a,l,c){var A=e+r+s+a+c;return A>>>0}Nt.sum64_5_lo=FK;function PK(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}Nt.rotr64_hi=PK;function LK(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Nt.rotr64_lo=LK;function DK(n,e,t){return n>>>t}Nt.shr64_hi=DK;function NK(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Nt.shr64_lo=NK;var Hd={},YU=Nt,OK=c0;function Px(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Hd.BlockHash=Px;Px.prototype.update=function(e,t){if(e=YU.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=YU.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,i[s++]=e>>>16&255,i[s++]=e>>>8&255,i[s++]=e&255}else for(i[s++]=e&255,i[s++]=e>>>8&255,i[s++]=e>>>16&255,i[s++]=e>>>24&255,i[s++]=0,i[s++]=0,i[s++]=0,i[s++]=0,o=8;o>>3}rl.g0_256=GK;function VK(n){return ka(n,17)^ka(n,19)^n>>>10}rl.g1_256=VK;var hd=Nt,jK=Hd,WK=rl,pb=hd.rotl32,hp=hd.sum32,KK=hd.sum32_5,XK=WK.ft_1,MH=jK.BlockHash,YK=[1518500249,1859775393,2400959708,3395469782];function Xa(){if(!(this instanceof Xa))return new Xa;MH.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}hd.inherits(Xa,MH);var $K=Xa;Xa.blockSize=512;Xa.outSize=160;Xa.hmacStrength=80;Xa.padLength=64;Xa.prototype._update=function(e,t){for(var r=this.W,i=0;i<16;i++)r[i]=e[t+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),N7(e.length<=this.blockSize);for(var t=e.length;t{s[a.toLowerCase()]=o}):r.headers.keys().forEach(o=>{s[o.toLowerCase()]=r.headers.get(o)}),{headers:s,statusCode:r.status,statusMessage:r.statusText,body:ft(new Uint8Array(i))}})}var z7=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const ko=new _e(k7);function eF(n){return new Promise(e=>{setTimeout(e,n)})}function gc(n,e){if(n==null)return null;if(typeof n=="string")return n;if(oI(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return l0(n)}catch{}return at(n)}return n}function G7(n){return Ka(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function V7(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;ko.assertArgument(r>0&&r%1===0,"invalid connection throttle limit","connection.throttleLimit",r);const i=typeof n=="object"?n.throttleCallback:null,s=typeof n=="object"&&typeof n.throttleSlotInterval=="number"?n.throttleSlotInterval:100;ko.assertArgument(s>0&&s%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",s);const o=typeof n=="object"?!!n.errorPassThrough:!1,a={};let l=null;const c={method:"GET"};let A=!1,u=2*60*1e3;if(typeof n=="string")l=n;else if(typeof n=="object"){if((n==null||n.url==null)&&ko.throwArgumentError("missing URL","connection.url",n),l=n.url,typeof n.timeout=="number"&&n.timeout>0&&(u=n.timeout),n.headers)for(const p in n.headers)a[p.toLowerCase()]={key:p,value:String(n.headers[p])},["if-none-match","if-modified-since"].indexOf(p.toLowerCase())>=0&&(A=!0);if(c.allowGzip=!!n.allowGzip,n.user!=null&&n.password!=null){l.substring(0,6)!=="https:"&&n.allowInsecureAuthentication!==!0&&ko.throwError("basic authentication requires a secure https url",_e.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const p=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+J4(Ka(p))}}n.skipFetchSetup!=null&&(c.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(c.fetchOptions=kn(n.fetchOptions))}const f=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=l?l.match(f):null;if(h)try{const p={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?q4(h[3]):G7(h[3])};let v=p.body;return t&&(v=t(p.body,p)),Promise.resolve(v)}catch(p){ko.throwError("processing response error",_e.errors.SERVER_ERROR,{body:gc(h[1],h[2]),error:p,requestBody:null,requestMethod:"GET",url:l})}e&&(c.method="POST",c.body=e,a["content-type"]==null&&(a["content-type"]={key:"Content-Type",value:"application/octet-stream"}),a["content-length"]==null&&(a["content-length"]={key:"Content-Length",value:String(e.length)}));const d={};Object.keys(a).forEach(p=>{const v=a[p];d[v.key]=v.value}),c.headers=d;const m=function(){let p=null;return{promise:new Promise(function(_,x){u&&(p=setTimeout(()=>{p!=null&&(p=null,x(ko.makeError("timeout",_e.errors.TIMEOUT,{requestBody:gc(c.body,d["content-type"]),requestMethod:c.method,timeout:u,url:l})))},u))}),cancel:function(){p!=null&&(clearTimeout(p),p=null)}}}(),g=function(){return z7(this,void 0,void 0,function*(){for(let p=0;p=300)&&(m.cancel(),ko.throwError("bad response",_e.errors.SERVER_ERROR,{status:v.statusCode,headers:v.headers,body:gc(w,v.headers?v.headers["content-type"]:null),requestBody:gc(c.body,d["content-type"]),requestMethod:c.method,url:l})),t)try{const _=yield t(w,v);return m.cancel(),_}catch(_){if(_.throttleRetry&&p{let a=null;if(s!=null)try{a=JSON.parse(l0(s))}catch(l){ko.throwError("invalid JSON",_e.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=Ka(e);const s=typeof n=="string"?{url:n}:kn(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=kn(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return V7(n,i,r)}function mh(n,e){return e||(e={}),e=kn(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(t,r){let i=null,s=!1;const o=()=>s?!1:(s=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{o()&&r(new Error("timeout"))},e.timeout));const a=e.retryLimit;let l=0;function c(){return n().then(function(A){if(A!==void 0)o()&&t(A);else if(e.oncePoll)e.oncePoll.once("poll",c);else if(e.onceBlock)e.onceBlock.once("block",c);else if(!s){if(l++,l>a){o()&&r(new Error("retry limit reached"));return}let u=e.interval*parseInt(String(Math.random()*Math.pow(2,l)));ue.ceiling&&(u=e.ceiling),setTimeout(c,u)}return null},function(A){o()&&r(A)})}c()})}var $w="qpzry9x8gf2tvdw0s3jn54khce6mua7l",IS={};for(var Q0=0;Q0<$w.length;Q0++){var vb=$w.charAt(Q0);if(IS[vb]!==void 0)throw new TypeError(vb+" is ambiguous");IS[vb]=Q0}function Wh(n){var e=n>>25;return(n&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function OH(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=Wh(e)^r>>5}for(e=Wh(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=OH(n);if(typeof r=="string")throw new Error(r);for(var i=n+"1",s=0;s>5)throw new Error("Non 5-bit word");r=Wh(r)^o,i+=$w.charAt(o)}for(s=0;s<6;++s)r=Wh(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=$w.charAt(a)}return i}function kH(n,e){if(e=e||90,n.length<8)return n+" too short";if(n.length>e)return"Exceeds length limit";var t=n.toLowerCase(),r=n.toUpperCase();if(n!==t&&n!==r)return"Mixed-case string "+n;n=t;var i=n.lastIndexOf("1");if(i===-1)return"No separator character for "+n;if(i===0)return"Missing prefix for "+n;var s=n.slice(0,i),o=n.slice(i+1);if(o.length<6)return"Data too short";var a=OH(s);if(typeof a=="string")return a;for(var l=[],c=0;c=o.length)&&l.push(u)}return a!==1?"Invalid checksum for "+n:{prefix:s,words:l}}function W7(){var n=kH.apply(null,arguments);if(typeof n=="object")return n}function K7(n){var e=kH.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Dx(n,e,t,r){for(var i=0,s=0,o=(1<=t;)s-=t,a.push(i>>s&o);if(r)s>0&&a.push(i<=e)return"Excess padding";if(i<>8,f=A&255;u?l.push(u,f):l.push(f)}return l}t.toArray=r;function i(o){return o.length===1?"0"+o:o}t.zero2=i;function s(o){for(var a="",l=0;l(f>>1)-1?m=(f>>1)-g:m=g,h.isubn(m)):m=0,u[d]=m,h.iushrn(1)}return u}t.getNAF=r;function i(l,c){var A=[[],[]];l=l.clone(),c=c.clone();for(var u=0,f=0,h;l.cmpn(-u)>0||c.cmpn(-f)>0;){var d=l.andln(3)+u&3,m=c.andln(3)+f&3;d===3&&(d=-1),m===3&&(m=-1);var g;d&1?(h=l.andln(7)+u&7,(h===3||h===5)&&m===2?g=-d:g=d):g=0,A[0].push(g);var p;m&1?(h=c.andln(7)+f&7,(h===3||h===5)&&d===2?p=-m:p=m):p=0,A[1].push(p),2*u===g+1&&(u=1-u),2*f===p+1&&(f=1-f),l.iushrn(1),c.iushrn(1)}return A}t.getJSF=i;function s(l,c,A){var u="_"+c;l.prototype[c]=function(){return this[u]!==void 0?this[u]:this[u]=A.call(this)}}t.cachedProperty=s;function o(l){return typeof l=="string"?t.toArray(l,"hex"):l}t.parseBytes=o;function a(l){return new wt(l,"hex","le")}t.intFromLE=a}),Zw=Gs.getNAF,eX=Gs.getJSF,qw=Gs.assert;function BA(n,e){this.type=n,this.p=new wt(e.p,16),this.red=e.prime?wt.red(e.prime):wt.mont(this.p),this.zero=new wt(0).toRed(this.red),this.one=new wt(1).toRed(this.red),this.two=new wt(2).toRed(this.red),this.n=e.n&&new wt(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var t=this.n&&this.p.div(this.n);!t||t.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var zu=BA;BA.prototype.point=function(){throw new Error("Not implemented")};BA.prototype.validate=function(){throw new Error("Not implemented")};BA.prototype._fixedNafMul=function(e,t){qw(e.precomputed);var r=e._getDoubles(),i=Zw(t,1,this._bitLength),s=(1<=a;c--)l=(l<<1)+i[c];o.push(l)}for(var A=this.jpoint(null,null,null),u=this.jpoint(null,null,null),f=s;f>0;f--){for(a=0;a=0;l--){for(var c=0;l>=0&&o[l]===0;l--)c++;if(l>=0&&c++,a=a.dblp(c),l<0)break;var A=o[l];qw(A!==0),e.type==="affine"?A>0?a=a.mixedAdd(s[A-1>>1]):a=a.mixedAdd(s[-A-1>>1].neg()):A>0?a=a.add(s[A-1>>1]):a=a.add(s[-A-1>>1].neg())}return e.type==="affine"?a.toP():a};BA.prototype._wnafMulAdd=function(e,t,r,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,c=0,A,u,f;for(A=0;A=1;A-=2){var d=A-1,m=A;if(o[d]!==1||o[m]!==1){l[d]=Zw(r[d],o[d],this._bitLength),l[m]=Zw(r[m],o[m],this._bitLength),c=Math.max(l[d].length,c),c=Math.max(l[m].length,c);continue}var g=[t[d],null,null,t[m]];t[d].y.cmp(t[m].y)===0?(g[1]=t[d].add(t[m]),g[2]=t[d].toJ().mixedAdd(t[m].neg())):t[d].y.cmp(t[m].y.redNeg())===0?(g[1]=t[d].toJ().mixedAdd(t[m]),g[2]=t[d].add(t[m].neg())):(g[1]=t[d].toJ().mixedAdd(t[m]),g[2]=t[d].toJ().mixedAdd(t[m].neg()));var p=[-3,-1,-5,-7,0,7,5,1,3],v=eX(r[d],r[m]);for(c=Math.max(v[0].length,c),l[d]=new Array(c),l[m]=new Array(c),u=0;u=0;A--){for(var B=0;A>=0;){var S=!0;for(u=0;u=0&&B++,x=x.dblp(B),A<0)break;for(u=0;u0?f=a[u][I-1>>1]:I<0&&(f=a[u][-I-1>>1].neg()),f.type==="affine"?x=x.mixedAdd(f):x=x.add(f))}}for(A=0;A=Math.ceil((e.bitLength()+1)/t.step):!1};Eo.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],i=this,s=0;s=0&&(h=c,d=A),u.negative&&(u=u.neg(),f=f.neg()),h.negative&&(h=h.neg(),d=d.neg()),[{a:u,b:f},{a:h,b:d}]};Bo.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],i=t[1],s=i.b.mul(e).divRound(this.n),o=r.b.neg().mul(e).divRound(this.n),a=s.mul(r.a),l=o.mul(i.a),c=s.mul(r.b),A=o.mul(i.b),u=e.sub(a).sub(l),f=c.add(A).neg();return{k1:u,k2:f}};Bo.prototype.pointFromX=function(e,t){e=new wt(e,16),e.red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=r.redSqrt();if(i.redSqr().redSub(r).cmp(this.zero)!==0)throw new Error("invalid point");var s=i.fromRed().isOdd();return(t&&!s||!t&&s)&&(i=i.redNeg()),this.point(e,i)};Bo.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,i=this.a.redMul(t),s=t.redSqr().redMul(t).redIAdd(i).redIAdd(this.b);return r.redSqr().redISub(s).cmpn(0)===0};Bo.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};$r.prototype.isInfinity=function(){return this.inf};$r.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),i=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,i)};$r.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),i=e.redInvm(),s=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(i),o=s.redSqr().redISub(this.x.redAdd(this.x)),a=s.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)};$r.prototype.getX=function(){return this.x.fromRed()};$r.prototype.getY=function(){return this.y.fromRed()};$r.prototype.mul=function(e){return e=new wt(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};$r.prototype.mulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s):this.curve._wnafMulAdd(1,i,s,2)};$r.prototype.jmulAdd=function(e,t,r){var i=[this,t],s=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(i,s,!0):this.curve._wnafMulAdd(1,i,s,2,!0)};$r.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};$r.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,i=function(s){return s.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(i)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(i)}}}return t};$r.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function ci(n,e,t,r){zu.BasePoint.call(this,n,"jacobian"),e===null&&t===null&&r===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new wt(0)):(this.x=new wt(e,16),this.y=new wt(t,16),this.z=new wt(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}AI(ci,zu.BasePoint);Bo.prototype.jpoint=function(e,t,r){return new ci(this,e,t,r)};ci.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),i=this.y.redMul(t).redMul(e);return this.curve.point(r,i)};ci.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};ci.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),i=this.x.redMul(t),s=e.x.redMul(r),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(r.redMul(this.z)),l=i.redSub(s),c=o.redSub(a);if(l.cmpn(0)===0)return c.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var A=l.redSqr(),u=A.redMul(l),f=i.redMul(A),h=c.redSqr().redIAdd(u).redISub(f).redISub(f),d=c.redMul(f.redISub(h)).redISub(o.redMul(u)),m=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(h,d,m)};ci.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,i=e.x.redMul(t),s=this.y,o=e.y.redMul(t).redMul(this.z),a=r.redSub(i),l=s.redSub(o);if(a.cmpn(0)===0)return l.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),A=c.redMul(a),u=r.redMul(c),f=l.redSqr().redIAdd(A).redISub(u).redISub(u),h=l.redMul(u.redISub(f)).redISub(s.redMul(A)),d=this.z.redMul(a);return this.curve.jpoint(f,h,d)};ci.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(s),this.x.cmp(r)===0)return!0}};ci.prototype.inspect=function(){return this.isInfinity()?"":""};ci.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var nw=Gd(function(n,e){var t=e;t.base=zu,t.short=nX,t.mont=null,t.edwards=null}),rw=Gd(function(n,e){var t=e,r=Gs.assert;function i(a){a.type==="short"?this.curve=new nw.short(a):a.type==="edwards"?this.curve=new nw.edwards(a):this.curve=new nw.mont(a),this.g=this.curve.g,this.n=this.curve.n,this.hash=a.hash,r(this.g.validate(),"Invalid curve"),r(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}t.PresetCurve=i;function s(a,l){Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){var c=new i(l);return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,value:c}),c}})}s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:_a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:_a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:_a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:_a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:_a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_a.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var o;try{o=null.crash()}catch{o=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:_a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function dA(n){if(!(this instanceof dA))return new dA(n);this.hash=n.hash,this.predResist=!!n.predResist,this.outLen=this.hash.outSize,this.minEntropy=n.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Zo.toArray(n.entropy,n.entropyEnc||"hex"),t=Zo.toArray(n.nonce,n.nonceEnc||"hex"),r=Zo.toArray(n.pers,n.persEnc||"hex");cI(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var QH=dA;dA.prototype._init=function(e,t,r){var i=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1};dA.prototype.generate=function(e,t,r,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof t!="string"&&(i=r,r=t,t=null),r&&(r=Zo.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var rX=Gs.assert;function Nx(n,e){if(n instanceof Nx)return n;this._importDER(n,e)||(rX(n.r&&n.s,"Signature without r or s"),this.r=new wt(n.r,16),this.s=new wt(n.s,16),n.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=n.recoveryParam)}var Ox=Nx;function iX(){this.place=0}function yb(n,e){var t=n[e.place++];if(!(t&128))return t;var r=t&15;if(r===0||r>4)return!1;for(var i=0,s=0,o=e.place;s>>=0;return i<=127?!1:(e.place=o,i)}function nF(n){for(var e=0,t=n.length-1;!n[e]&&!(n[e+1]&128)&&e>>3);for(n.push(t|128);--t;)n.push(e>>>(t<<3)&255);n.push(e)}Nx.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),r[0]&128&&(r=[0].concat(r)),t=nF(t),r=nF(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];wb(i,t.length),i=i.concat(t),i.push(2),wb(i,r.length);var s=i.concat(r),o=[48];return wb(o,s.length),o=o.concat(s),Gs.encode(o,e)};var sX=function(){throw new Error("unsupported")},zH=Gs.assert;function yo(n){if(!(this instanceof yo))return new yo(n);typeof n=="string"&&(zH(Object.prototype.hasOwnProperty.call(rw,n),"Unknown curve "+n),n=rw[n]),n instanceof rw.PresetCurve&&(n={curve:n}),this.curve=n.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=n.curve.g,this.g.precompute(n.curve.n.bitLength()+1),this.hash=n.hash||n.curve.hash}var oX=yo;yo.prototype.keyPair=function(e){return new uI(this,e)};yo.prototype.keyFromPrivate=function(e,t){return uI.fromPrivate(this,e,t)};yo.prototype.keyFromPublic=function(e,t){return uI.fromPublic(this,e,t)};yo.prototype.genKeyPair=function(e){e||(e={});for(var t=new QH({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||sX(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new wt(2));;){var s=new wt(t.generate(r));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};yo.prototype._truncateToN=function(e,t){var r=e.byteLength()*8-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e};yo.prototype.sign=function(e,t,r,i){typeof r=="object"&&(i=r,r=null),i||(i={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new wt(e,16));for(var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new QH({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),c=this.n.sub(new wt(1)),A=0;;A++){var u=i.k?i.k(A):new wt(l.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(c)>=0)){var f=this.g.mul(u);if(!f.isInfinity()){var h=f.getX(),d=h.umod(this.n);if(d.cmpn(0)!==0){var m=u.invm(this.n).mul(d.mul(t.getPrivate()).iadd(e));if(m=m.umod(this.n),m.cmpn(0)!==0){var g=(f.getY().isOdd()?1:0)|(h.cmp(d)!==0?2:0);return i.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),g^=1),new Ox({r:d,s:m,recoveryParam:g})}}}}}};yo.prototype.verify=function(e,t,r,i){e=this._truncateToN(new wt(e,16)),r=this.keyFromPublic(r,i),t=new Ox(t,"hex");var s=t.r,o=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a=o.invm(this.n),l=a.mul(e).umod(this.n),c=a.mul(s).umod(this.n),A;return this.curve._maxwellTrick?(A=this.g.jmulAdd(l,r.getPublic(),c),A.isInfinity()?!1:A.eqXToP(s)):(A=this.g.mulAdd(l,r.getPublic(),c),A.isInfinity()?!1:A.getX().umod(this.n).cmp(s)===0)};yo.prototype.recoverPubKey=function(n,e,t,r){zH((3&t)===t,"The recovery param is more than two bits"),e=new Ox(e,r);var i=this.n,s=new wt(n),o=e.r,a=e.s,l=t&1,c=t>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");c?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var A=e.r.invm(i),u=i.sub(s).mul(A).umod(i),f=a.mul(A).umod(i);return this.g.mulAdd(u,o,f)};yo.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new Ox(e,r),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var s;try{s=this.recoverPubKey(n,e,i)}catch{continue}if(s.eq(t))return i}throw new Error("Unable to find valid recovery factor")};var aX=Gd(function(n,e){var t=e;t.version="6.5.4",t.utils=Gs,t.rand=function(){throw new Error("unsupported")},t.curve=nw,t.curves=rw,t.ec=oX,t.eddsa=null}),lX=aX.ec;const cX="signing-key/5.7.0",US=new _e(cX);let _b=null;function Sa(){return _b||(_b=new lX("secp256k1")),_b}class AX{constructor(e){Pe(this,"curve","secp256k1"),Pe(this,"privateKey",at(e)),Eu(this.privateKey)!==32&&US.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Sa().keyFromPrivate(ft(this.privateKey));Pe(this,"publicKey","0x"+t.getPublic(!1,"hex")),Pe(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Pe(this,"_isSigningKey",!0)}_addPoint(e){const t=Sa().keyFromPublic(ft(this.publicKey)),r=Sa().keyFromPublic(ft(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=Sa().keyFromPrivate(ft(this.privateKey)),r=ft(e);r.length!==32&&US.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return Rx({recoveryParam:i.recoveryParam,r:rr("0x"+i.r.toString(16),32),s:rr("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=Sa().keyFromPrivate(ft(this.privateKey)),r=Sa().keyFromPublic(ft(GH(e)));return rr("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function uX(n,e){const t=Rx(e),r={r:ft(t.r),s:ft(t.s)};return"0x"+Sa().recoverPubKey(ft(n),r,t.recoveryParam).encode("hex",!1)}function GH(n,e){const t=ft(n);if(t.length===32){const r=new AX(t);return e?"0x"+Sa().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?at(t):"0x"+Sa().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Sa().keyFromPublic(t).getPublic(!0,"hex"):at(t)}return US.throwArgumentError("invalid public or private key","key","[REDACTED]")}const fX="transactions/5.7.0",ac=new _e(fX);var rF;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(rF||(rF={}));function fI(n){return n==="0x"?null:ai(n)}function vi(n){return n==="0x"?tH:Ve.from(n)}function hX(n){const e=GH(n);return ai(mi(Er(mi(e,1)),12))}function VH(n,e){return hX(uX(ft(n),e))}function bs(n,e){const t=fd(Ve.from(n).toHexString());return t.length>32&&ac.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function xb(n,e){return{address:ai(n),storageKeys:(e||[]).map((t,r)=>(Eu(t)!==32&&ac.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function Gu(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(t.length>2&&ac.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${r}]`,t),xb(t[0],t[1])):xb(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return xb(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function jH(n){return Gu(n).map(e=>[e.address,e.storageKeys])}function dX(n,e){if(n.gasPrice!=null){const r=Ve.from(n.gasPrice),i=Ve.from(n.maxFeePerGas||0);r.eq(i)||ac.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:i})}const t=[bs(n.chainId||0,"chainId"),bs(n.nonce||0,"nonce"),bs(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),bs(n.maxFeePerGas||0,"maxFeePerGas"),bs(n.gasLimit||0,"gasLimit"),n.to!=null?ai(n.to):"0x",bs(n.value||0,"value"),n.data||"0x",jH(n.accessList||[])];if(e){const r=Rx(e);t.push(bs(r.recoveryParam,"recoveryParam")),t.push(fd(r.r)),t.push(fd(r.s))}return Yi(["0x02",Fx(t)])}function pX(n,e){const t=[bs(n.chainId||0,"chainId"),bs(n.nonce||0,"nonce"),bs(n.gasPrice||0,"gasPrice"),bs(n.gasLimit||0,"gasLimit"),n.to!=null?ai(n.to):"0x",bs(n.value||0,"value"),n.data||"0x",jH(n.accessList||[])];if(e){const r=Rx(e);t.push(bs(r.recoveryParam,"recoveryParam")),t.push(fd(r.r)),t.push(fd(r.s))}return Yi(["0x01",Fx(t)])}function WH(n,e,t){try{const r=vi(e[0]).toNumber();if(r!==0&&r!==1)throw new Error("bad recid");n.v=r}catch{ac.throwArgumentError("invalid v for transaction type: 1","v",e[0])}n.r=rr(e[1],32),n.s=rr(e[2],32);try{const r=Er(t(n));n.from=VH(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function mX(n){const e=aI(n.slice(1));e.length!==9&&e.length!==12&&ac.throwArgumentError("invalid component count for transaction type: 2","payload",at(n));const t=vi(e[2]),r=vi(e[3]),i={type:2,chainId:vi(e[0]).toNumber(),nonce:vi(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:vi(e[4]),to:fI(e[5]),value:vi(e[6]),data:e[7],accessList:Gu(e[8])};return e.length===9||(i.hash=Er(n),WH(i,e.slice(9),dX)),i}function gX(n){const e=aI(n.slice(1));e.length!==8&&e.length!==11&&ac.throwArgumentError("invalid component count for transaction type: 1","payload",at(n));const t={type:1,chainId:vi(e[0]).toNumber(),nonce:vi(e[1]).toNumber(),gasPrice:vi(e[2]),gasLimit:vi(e[3]),to:fI(e[4]),value:vi(e[5]),data:e[6],accessList:Gu(e[7])};return e.length===8||(t.hash=Er(n),WH(t,e.slice(8),pX)),t}function vX(n){const e=aI(n);e.length!==9&&e.length!==6&&ac.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:vi(e[0]).toNumber(),gasPrice:vi(e[1]),gasLimit:vi(e[2]),to:fI(e[3]),value:vi(e[4]),data:e[5],chainId:0};if(e.length===6)return t;try{t.v=Ve.from(e[6]).toNumber()}catch{return t}if(t.r=rr(e[7],32),t.s=rr(e[8],32),Ve.from(t.r).isZero()&&Ve.from(t.s).isZero())t.chainId=t.v,t.v=0;else{t.chainId=Math.floor((t.v-35)/2),t.chainId<0&&(t.chainId=0);let r=t.v-27;const i=e.slice(0,6);t.chainId!==0&&(i.push(at(t.chainId)),i.push("0x"),i.push("0x"),r-=t.chainId*2+8);const s=Er(Fx(i));try{t.from=VH(s,{r:at(t.r),s:at(t.s),recoveryParam:r})}catch{}t.hash=Er(n)}return t.type=null,t}function yX(n){const e=ft(n);if(e[0]>127)return vX(e);switch(e[0]){case 1:return gX(e);case 2:return mX(e)}return ac.throwError(`unsupported transaction type: ${e[0]}`,_e.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const pp=new _e(Ci);let iF=class rt{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),r=this.bigNumber.bind(this),i=this.blockTag.bind(this),s=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),l=this.number.bind(this),c=this.type.bind(this),A=u=>this.data(u,!0);return e.transaction={hash:o,type:c,accessList:rt.allowNull(this.accessList.bind(this),null),blockHash:rt.allowNull(o,null),blockNumber:rt.allowNull(l,null),transactionIndex:rt.allowNull(l,null),confirmations:rt.allowNull(l,null),from:t,gasPrice:rt.allowNull(r),maxPriorityFeePerGas:rt.allowNull(r),maxFeePerGas:rt.allowNull(r),gasLimit:r,to:rt.allowNull(t,null),value:r,nonce:l,data:s,r:rt.allowNull(this.uint256),s:rt.allowNull(this.uint256),v:rt.allowNull(l),creates:rt.allowNull(t,null),raw:rt.allowNull(s)},e.transactionRequest={from:rt.allowNull(t),nonce:rt.allowNull(l),gasLimit:rt.allowNull(r),gasPrice:rt.allowNull(r),maxPriorityFeePerGas:rt.allowNull(r),maxFeePerGas:rt.allowNull(r),to:rt.allowNull(t),value:rt.allowNull(r),data:rt.allowNull(A),type:rt.allowNull(l),accessList:rt.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:t,topics:rt.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:rt.allowNull(this.address,null),from:rt.allowNull(this.address,null),contractAddress:rt.allowNull(t,null),transactionIndex:l,root:rt.allowNull(a),gasUsed:r,logsBloom:rt.allowNull(s),blockHash:o,transactionHash:o,logs:rt.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:rt.allowNull(l,null),cumulativeGasUsed:r,effectiveGasPrice:rt.allowNull(r),status:rt.allowNull(l),type:c},e.block={hash:rt.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:rt.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:rt.allowNull(t),extraData:s,transactions:rt.allowNull(rt.arrayOf(o)),baseFeePerGas:rt.allowNull(r)},e.blockWithTransactions=kn(e.block),e.blockWithTransactions.transactions=rt.allowNull(rt.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:rt.allowNull(i,void 0),toBlock:rt.allowNull(i,void 0),blockHash:rt.allowNull(o,void 0),address:rt.allowNull(t,void 0),topics:rt.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:rt.allowNull(l),blockHash:rt.allowNull(o),transactionIndex:l,removed:rt.allowNull(this.boolean.bind(this)),address:t,data:rt.allowFalsish(s,"0x"),topics:rt.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return Gu(e||[])}number(e){return e==="0x"?0:Ve.from(e).toNumber()}type(e){return e==="0x"||e==null?0:Ve.from(e).toNumber()}bigNumber(e){return Ve.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return typeof e=="string"&&(!t&&e.substring(0,2)!=="0x"&&(e="0x"+e),Tt(e))?e.toLowerCase():pp.throwArgumentError("invalid hash","value",e)}data(e,t){const r=this.hex(e,t);if(r.length%2!==0)throw new Error("invalid data; odd-length - "+e);return r}address(e){return ai(e)}callAddress(e){if(!Tt(e,32))return null;const t=ai(mi(e,12));return t===g9?null:t}contractAddress(e){return pH(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||Tt(e))return Ix(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return Eu(r)!==32?pp.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(e==null)return null;const t=Ve.from(e);try{return t.toNumber()}catch{}return null}uint256(e){if(!Tt(e))throw new Error("invalid uint256");return rr(e,32)}_block(e,t){e.author!=null&&e.miner==null&&(e.miner=e.author);const r=e._difficulty!=null?e._difficulty:e.difficulty,i=rt.check(t,e);return i._difficulty=r==null?null:Ve.from(r),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return rt.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&Ve.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const t=rt.check(this.formats.transaction,e);if(e.chainId!=null){let r=e.chainId;Tt(r)&&(r=Ve.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;r==null&&t.v==null&&(r=e.chainId),Tt(r)&&(r=Ve.from(r).toNumber()),typeof r!="number"&&t.v!=null&&(r=(t.v-35)/2,r<0&&(r=0),r=parseInt(r)),typeof r!="number"&&(r=0),t.chainId=r}return t.blockHash&&t.blockHash.replace(/0/g,"")==="x"&&(t.blockHash=null),t}transaction(e){return yX(e)}receiptLog(e){return rt.check(this.formats.receiptLog,e)}receipt(e){const t=rt.check(this.formats.receipt,e);if(t.root!=null)if(t.root.length<=4){const r=Ve.from(t.root).toNumber();r===0||r===1?(t.status!=null&&t.status!==r&&pp.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):pp.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&pp.throwArgumentError("invalid root hash","value.root",t.root);return t.status!=null&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map(t=>this.topics(t)):e!=null?this.hash(e,!0):null}filter(e){return rt.check(this.formats.filter,e)}filterLog(e){return rt.check(this.formats.filterLog,e)}static check(e,t){const r={};for(const i in e)try{const s=e[i](t[i]);s!==void 0&&(r[i]=s)}catch(s){throw s.checkKey=i,s.checkValue=t[i],s}return r}static allowNull(e,t){return function(r){return r==null?t:e(r)}}static allowFalsish(e,t){return function(r){return r?e(r):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const r=[];return t.forEach(function(i){r.push(e(i))}),r}}};function wX(n){return n&&typeof n.isCommunityResource=="function"}function sF(n){return wX(n)&&n.isCommunityResource()}let oF=!1;function kx(){oF||(oF=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var vt=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Ct=new _e(Ci),_X=10;function aF(n){return n==null?"null":(Eu(n)!==32&&Ct.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function lF(n){for(n=n.slice();n.length>0&&n[n.length-1]==null;)n.pop();return n.map(e=>{if(Array.isArray(e)){const t={};e.forEach(i=>{t[aF(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return aF(e)}).join("&")}function xX(n){return n===""?[]:n.split(/&/g).map(e=>{if(e==="")return[];const t=e.split("|").map(r=>r==="null"?null:r);return t.length===1?t[0]:t})}function rf(n){if(typeof n=="string"){if(n=n.toLowerCase(),Eu(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+lF(n);if(d9.isForkEvent(n))throw Ct.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+lF(n.topics||[])}throw new Error("invalid event - "+n)}function mp(){return new Date().getTime()}function cF(n){return new Promise(e=>{setTimeout(e,n)})}const bX=["block","network","pending","poll"];let EX=class{constructor(e,t,r){Pe(this,"tag",e),Pe(this,"listener",t),Pe(this,"once",r),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const t=e[1],r=xX(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||bX.indexOf(this.tag)>=0}};const BX={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function bb(n){return rr(Ve.from(n).toHexString(),32)}function AF(n){return SS.encode(Ss([n,mi(JU(JU(n)),0,4)]))}const KH=new RegExp("^(ipfs)://(.*)$","i"),uF=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),KH,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function iw(n,e){try{return l0(Ag(n,e))}catch{}return null}function Ag(n,e){if(n==="0x")return null;const t=Ve.from(mi(n,e,e+32)).toNumber(),r=Ve.from(mi(n,t,t+32)).toNumber();return mi(n,t+32,t+32+r)}function Eb(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):Ct.throwArgumentError("unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}function fF(n){const e=ft(n);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function SX(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function XH(n){const e=[];let t=0;for(let r=0;rVe.from(e).eq(1)).catch(e=>{if(e.code===_e.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return vt(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:Yi([e,tw(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=Yi(["0x9061b923",XH([J9(this.name),r.data])]));try{let s=yield this.provider.call(r);return ft(s).length%32===4&&Ct.throwError("resolver threw error",_e.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=Ag(s,0)),s}catch(s){if(s.code===_e.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return vt(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?Ag(r,0):null})}_getAddress(e,t){const r=BX[String(e)];if(r==null&&Ct.throwError(`unsupported coin type: ${e}`,_e.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),r.ilk==="eth")return this.provider.formatter.address(t);const i=ft(t);if(r.p2pkh!=null){const s=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return AF(Ss([[r.p2pkh],"0x"+s[2]]))}}if(r.p2sh!=null){const s=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(s){const o=parseInt(s[1],16);if(s[2].length===o*2&&o>=1&&o<=75)return AF(Ss([[r.p2sh],"0x"+s[2]]))}}if(r.prefix!=null){const s=i[1];let o=i[0];if(o===0?s!==20&&s!==32&&(o=-1):o=-1,o>=0&&i.length===2+s&&s>=1&&s<=75){const a=tF.toWords(i.slice(2));return a.unshift(o),tF.encode(r.prefix,a)}}return null}getAddress(e){return vt(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===_9?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===_e.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",bb(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&Ct.throwError("invalid or unsupported coin data",_e.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return vt(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(t==null)return null;for(let r=0;ro[l])}return Ct.throwError("invalid or unsupported content hash data",_e.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return vt(this,void 0,void 0,function*(){let t=Ka(e);t=Ss([bb(64),bb(t.length),t]),t.length%32!==0&&(t=Ss([t,rr("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",at(t));return r==null||r==="0x"?null:l0(r)})}}let Bb=null,MX=1;class hI extends a0{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Pe(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(t=>{}),this._ready().catch(t=>{});else{const t=Ms(new.target,"getNetwork")(e);t?(Pe(this,"_network",t),this.emit("network",t,null)):Ct.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return vt(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||Ct.throwError("no network detected",_e.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:Pe(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return mh(()=>this._ready().then(e=>e,e=>{if(!(e.code===_e.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Bb==null&&(Bb=new iF),Bb}static getNetwork(e){return Z4(e??"homestead")}ccipReadFetch(e,t,r){return vt(this,void 0,void 0,function*(){if(this.disableCcipRead||r.length===0)return null;const i=e.to.toLowerCase(),s=t.toLowerCase(),o=[];for(let a=0;a=0?null:JSON.stringify({data:s,sender:i}),u=yield Lx({url:c,errorPassThrough:!0},A,(h,d)=>(h.status=d.statusCode,h));if(u.data)return u.data;const f=u.message||"unknown error";if(u.status>=400&&u.status<500)return Ct.throwError(`response not found during CCIP fetch: ${f}`,_e.errors.SERVER_ERROR,{url:l,errorMessage:f});o.push(f)}return Ct.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,_e.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return vt(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const s=yield i;if(mp()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=mp(),r=wr({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:s})=>{if(s)throw this._internalBlockNumber===r&&(this._internalBlockNumber=null),s;const o=mp();return i=Ve.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return vt(this,void 0,void 0,function*(){const e=MX++,t=[];let r=null;try{r=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(r),this.emit("poll",e,r),r===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=r-1),Math.abs(this._emitted.block-r)>1e3)Ct.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Ct.makeError("network block skew detected",_e.errors.NETWORK_ERROR,{blockNumber:r,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",r);else for(let i=this._emitted.block+1;i<=r;i++)this.emit("block",i);this._emitted.block!==r&&(this._emitted.block=r,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const s=this._emitted[i];s!=="pending"&&r-s>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=r-1),this._events.forEach(i=>{switch(i.type){case"tx":{const s=i.hash;let o=this.getTransactionReceipt(s).then(a=>(!a||a.blockNumber==null||(this._emitted["t:"+s]=a.blockNumber,this.emit(s,a)),null)).catch(a=>{this.emit("error",a)});t.push(o);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=r-1);const s=i.filter;s.fromBlock=i._lastBlockNumber+1,s.toBlock=r;const o=s.toBlock-this._maxFilterBlockRange;o>s.fromBlock&&(s.fromBlock=o),s.fromBlock<0&&(s.fromBlock=0);const a=this.getLogs(s).then(l=>{i._inflight=!1,l.length!==0&&l.forEach(c=>{c.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=c.blockNumber),this._emitted["b:"+c.blockHash]=c.blockNumber,this._emitted["t:"+c.transactionHash]=c.blockNumber,this.emit(s,c)})}).catch(l=>{this.emit("error",l),i._inflight=!1});t.push(a)}break}}}),this._lastBlockNumber=r,Promise.all(t).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return vt(this,void 0,void 0,function*(){return Ct.throwError("provider does not support network detection",_e.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return vt(this,void 0,void 0,function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield cF(0),this._network;const r=Ct.makeError("underlying network changed",_e.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",r),r}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=mp();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(t=>((this._fastBlockNumber==null||t>this._fastBlockNumber)&&(this._fastBlockNumber=t),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,r){return vt(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return vt(this,void 0,void 0,function*(){const s=yield this.getTransactionReceipt(e);return(s?s.confirmations:0)>=t?s:new Promise((o,a)=>{const l=[];let c=!1;const A=function(){return c?!0:(c=!0,l.forEach(f=>{f()}),!1)},u=f=>{f.confirmations{this.removeListener(e,u)}),i){let f=i.startBlock,h=null;const d=m=>vt(this,void 0,void 0,function*(){c||(yield cF(1e3),this.getTransactionCount(i.from).then(g=>vt(this,void 0,void 0,function*(){if(!c){if(g<=i.nonce)f=m;else{{const p=yield this.getTransaction(e);if(p&&p.blockNumber!=null)return}for(h==null&&(h=f-3,h{c||this.once("block",d)}))});if(c)return;this.once("block",d),l.push(()=>{this.removeListener("block",d)})}if(typeof r=="number"&&r>0){const f=setTimeout(()=>{A()||a(Ct.makeError("timeout exceeded",_e.errors.TIMEOUT,{timeout:r}))},r);f.unref&&f.unref(),l.push(()=>{clearTimeout(f)})}})})}getBlockNumber(){return vt(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Ve.from(e)}catch(t){return Ct.throwError("bad result from backend",_e.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getBalance",r);try{return Ve.from(i)}catch(s){return Ct.throwError("bad result from backend",_e.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getTransactionCount",r);try{return Ve.from(i).toNumber()}catch(s){return Ct.throwError("bad result from backend",_e.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getCode",r);try{return at(i)}catch(s){return Ct.throwError("bad result from backend",_e.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield wr({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then(o=>Ix(o))}),s=yield this.perform("getStorageAt",i);try{return at(s)}catch(o){return Ct.throwError("bad result from backend",_e.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&Eu(t)!==32)throw new Error("invalid response - sendTransaction");const i=e;return t!=null&&e.hash!==t&&Ct.throwError("Transaction hash mismatch from Provider.sendTransaction.",_e.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>vt(this,void 0,void 0,function*(){s==null&&(s=1),o==null&&(o=0);let a;s!==0&&r!=null&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r});const l=yield this._waitForTransaction(e.hash,s,o,a);return l==null&&s===0?null:(this._emitted["t:"+e.hash]=l.blockNumber,l.status===0&&Ct.throwError("transaction failed",_e.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then(s=>at(s)),r=this.formatter.transaction(e);r.confirmations==null&&(r.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const s=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(r,s,i)}catch(s){throw s.transaction=r,s.transactionHash=r.hash,s}})}_getTransactionRequest(e){return vt(this,void 0,void 0,function*(){const t=yield e,r={};return["from","to"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?this._getAddress(s):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?Ve.from(s):null))}),["type"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s??null))}),t.accessList&&(r.accessList=this.formatter.accessList(t.accessList)),["data"].forEach(i=>{t[i]!=null&&(r[i]=Promise.resolve(t[i]).then(s=>s?at(s):null))}),this.formatter.transactionRequest(yield wr(r))})}_getFilter(e){return vt(this,void 0,void 0,function*(){e=yield e;const t={};return e.address!=null&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach(r=>{e[r]!=null&&(t[r]=e[r])}),["fromBlock","toBlock"].forEach(r=>{e[r]!=null&&(t[r]=this._getBlockTag(e[r]))}),this.formatter.filter(yield wr(t))})}_call(e,t,r){return vt(this,void 0,void 0,function*(){r>=_X&&Ct.throwError("CCIP read exceeded maximum redirections",_e.errors.SERVER_ERROR,{redirects:r,transaction:e});const i=e.to,s=yield this.perform("call",{transaction:e,blockTag:t});if(r>=0&&t==="latest"&&i!=null&&s.substring(0,10)==="0x556f1830"&&Eu(s)%32===4)try{const o=mi(s,4),a=mi(o,0,32);Ve.from(a).eq(i)||Ct.throwError("CCIP Read sender did not match",_e.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],c=Ve.from(mi(o,32,64)).toNumber(),A=Ve.from(mi(o,c,c+32)).toNumber(),u=mi(o,c+32);for(let p=0;pvt(this,void 0,void 0,function*(){const s=yield this.perform("getBlock",i);if(s==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&r>this._emitted.block?null:void 0;if(t){let o=null;for(let l=0;lthis._wrapTransaction(l)),a}return this.formatter.block(s)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return vt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return mh(()=>vt(this,void 0,void 0,function*(){const r=yield this.perform("getTransaction",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return vt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return mh(()=>vt(this,void 0,void 0,function*(){const r=yield this.perform("getTransactionReceipt",t);if(r==null)return this._emitted["t:"+e]==null?null:void 0;if(r.blockHash==null)return;const i=this.formatter.receipt(r);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let o=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;o<=0&&(o=1),i.confirmations=o}return i}),{oncePoll:this})})}getLogs(e){return vt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield wr({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach(i=>{i.removed==null&&(i.removed=!1)}),iF.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return vt(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return vt(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Ct.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)})}getResolver(e){return vt(this,void 0,void 0,function*(){let t=e;for(;;){if(t===""||t==="."||e!=="eth"&&t==="eth")return null;const r=yield this._getResolver(t,"getResolver");if(r!=null){const i=new hF(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return vt(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Ct.throwError("network does not support ENS",_e.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+tw(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return vt(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(r){if(Tt(e))throw r}typeof e!="string"&&Ct.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return vt(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const t=e.substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(t,"lookupAddress");if(r==null)return null;const i=iw(yield this.call({to:r,data:"0x691f3431"+tw(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return vt(this,void 0,void 0,function*(){let t=null;if(Tt(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;t=new hF(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==_e.errors.CALL_EXCEPTION)throw a}try{const a=iw(yield this.call({to:o,data:"0x691f3431"+tw(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==_e.errors.CALL_EXCEPTION)throw a;return null}}else if(t=yield this.getResolver(e),!t)return null;const r=yield t.getAvatar();return r==null?null:r.url})}perform(e,t){return Ct.throwError(e+" not implemented",_e.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(t=>t.pollable()).length>0}_addEventListener(e,t,r){const i=new EX(rf(e),t,r);return this._events.push(i),this._startEvent(i),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let r=!1,i=[],s=rf(e);return this._events=this._events.filter(o=>o.tag!==s?!0:(setTimeout(()=>{o.listener.apply(this,t)},0),r=!0,o.once?(i.push(o),!1):!0)),i.forEach(o=>{this._stopEvent(o)}),r}listenerCount(e){if(!e)return this._events.length;let t=rf(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=rf(e);return this._events.filter(r=>r.tag===t).map(r=>r.listener)}off(e,t){if(t==null)return this.removeAllListeners(e);const r=[];let i=!1,s=rf(e);return this._events=this._events.filter(o=>o.tag!==s||o.listener!=t||i?!0:(i=!0,r.push(o),!1)),r.forEach(o=>{this._stopEvent(o)}),this}removeAllListeners(e){let t=[];if(e==null)t=this._events,this._events=[];else{const r=rf(e);this._events=this._events.filter(i=>i.tag!==r?!0:(t.push(i),!1))}return t.forEach(r=>{this._stopEvent(r)}),this}}const CX="abstract-signer/5.7.0";var Uo=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Zs=new _e(CX),TX=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],IX=[_e.errors.INSUFFICIENT_FUNDS,_e.errors.NONCE_EXPIRED,_e.errors.REPLACEMENT_UNDERPRICED];class A0{constructor(){Zs.checkAbstract(new.target,A0),Pe(this,"_isSigner",!0)}getBalance(e){return Uo(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Uo(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Uo(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const t=yield wr(this.checkTransaction(e));return yield this.provider.estimateGas(t)})}call(e,t){return Uo(this,void 0,void 0,function*(){this._checkProvider("call");const r=yield wr(this.checkTransaction(e));return yield this.provider.call(r,t)})}sendTransaction(e){return Uo(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),r=yield this.signTransaction(t);return yield this.provider.sendTransaction(r)})}getChainId(){return Uo(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Uo(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Uo(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Uo(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const r in e)TX.indexOf(r)===-1&&Zs.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=kn(e);return t.from==null?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then(r=>(r[0].toLowerCase()!==r[1].toLowerCase()&&Zs.throwArgumentError("from address mismatch","transaction",e),r[0])),t}populateTransaction(e){return Uo(this,void 0,void 0,function*(){const t=yield wr(this.checkTransaction(e));t.to!=null&&(t.to=Promise.resolve(t.to).then(i=>Uo(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&Zs.throwArgumentError("provided ENS name resolves to null","tx.to",i),s})),t.to.catch(i=>{}));const r=t.maxFeePerGas!=null||t.maxPriorityFeePerGas!=null;if(t.gasPrice!=null&&(t.type===2||r)?Zs.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(t.type===0||t.type===1)&&r&&Zs.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(t.type===2||t.type==null)&&t.maxFeePerGas!=null&&t.maxPriorityFeePerGas!=null)t.type=2;else if(t.type===0||t.type===1)t.gasPrice==null&&(t.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(t.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(t.type=2,t.gasPrice!=null){const s=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=s,t.maxPriorityFeePerGas=s}else t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(r&&Zs.throwError("network does not support EIP-1559",_e.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):Zs.throwError("failed to get consistent fee data",_e.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else t.type===2&&(t.maxFeePerGas==null&&(t.maxFeePerGas=i.maxFeePerGas),t.maxPriorityFeePerGas==null&&(t.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return t.nonce==null&&(t.nonce=this.getTransactionCount("pending")),t.gasLimit==null&&(t.gasLimit=this.estimateGas(t).catch(i=>{if(IX.indexOf(i.code)>=0)throw i;return Zs.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",_e.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:t})})),t.chainId==null?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Zs.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield wr(t)})}_checkProvider(e){this.provider||Zs.throwError("missing provider",_e.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class dI extends A0{constructor(e,t){super(),Pe(this,"address",e),Pe(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{Zs.throwError(e,_e.errors.UNSUPPORTED_OPERATION,{operation:t})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new dI(this.address,e)}}var Cl=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const _r=new _e(Ci),RX=["call","estimateGas"];function Om(n,e){if(n==null)return null;if(typeof n.message=="string"&&n.message.match("reverted")){const t=Tt(n.data)?n.data:null;if(!e||t)return{message:n.message,data:t}}if(typeof n=="object"){for(const t in n){const r=Om(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return Om(JSON.parse(n),e)}catch{}return null}function YH(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=Om(e,!0);if(s)return s.data;_r.throwError("missing revert data in call exception; Transaction reverted without a reason string",_e.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=Om(e.body,!1);s==null&&(s=Om(e,!1)),s&&_r.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",_e.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===_e.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&_r.throwError("insufficient funds for intrinsic transaction cost",_e.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&_r.throwError("nonce has already been used",_e.errors.NONCE_EXPIRED,{error:e,method:n,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&_r.throwError("replacement fee too low",_e.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&_r.throwError("legacy pre-eip-155 transactions not supported",_e.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),RX.indexOf(n)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&_r.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",_e.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function dF(n){return new Promise(function(e){setTimeout(e,n)})}function UX(n){if(n.error){const e=new Error(n.error.message);throw e.code=n.error.code,e.data=n.error.data,e}return n.result}function gp(n){return n&&n.toLowerCase()}const FS={};class $H extends A0{constructor(e,t,r){if(super(),e!==FS)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Pe(this,"provider",t),r==null&&(r=0),typeof r=="string"?(Pe(this,"_address",this.provider.formatter.address(r)),Pe(this,"_index",null)):typeof r=="number"?(Pe(this,"_index",r),Pe(this,"_address",null)):_r.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return _r.throwError("cannot alter JSON-RPC Signer connection",_e.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new FX(FS,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&_r.throwError("unknown account #"+this._index,_e.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=kn(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=kn(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>Cl(this,void 0,void 0,function*(){if(r==null)return null;const i=yield this.provider.resolveName(r);return i==null&&_r.throwArgumentError("provided ENS name resolves to null","tx.to",r),i}))),wr({tx:wr(e),sender:t}).then(({tx:r,sender:i})=>{r.from!=null?r.from.toLowerCase()!==i&&_r.throwArgumentError("from address mismatch","transaction",e):r.from=i;const s=this.provider.constructor.hexlifyTransaction(r,{from:!0});return this.provider.send("eth_sendTransaction",[s]).then(o=>o,o=>(typeof o.message=="string"&&o.message.match(/user denied/i)&&_r.throwError("user rejected transaction",_e.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),YH("sendTransaction",o,s)))})}signTransaction(e){return _r.throwError("signing transactions is unsupported",_e.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Cl(this,void 0,void 0,function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),r=yield this.sendUncheckedTransaction(e);try{return yield mh(()=>Cl(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(r);if(i!==null)return this.provider._wrapTransaction(i,r,t)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=r,i}})}signMessage(e){return Cl(this,void 0,void 0,function*(){const t=typeof e=="string"?Ka(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[at(t),r.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&_r.throwError("user rejected signing",_e.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return Cl(this,void 0,void 0,function*(){const t=typeof e=="string"?Ka(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),at(t)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&_r.throwError("user rejected signing",_e.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return Cl(this,void 0,void 0,function*(){const i=yield ys.resolveNames(e,t,r,o=>this.provider.resolveName(o)),s=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[s.toLowerCase(),JSON.stringify(ys.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&_r.throwError("user rejected signing",_e.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return Cl(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class FX extends $H{sendTransaction(e){return this.sendUncheckedTransaction(e).then(t=>({hash:t,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:r=>this.provider.waitForTransaction(t,r)}))}}const PX={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class ug extends hI{constructor(e,t){let r=t;r==null&&(r=new Promise((i,s)=>{setTimeout(()=>{this.detectNetwork().then(o=>{i(o)},o=>{s(o)})},0)})),super(r),e||(e=Ms(this.constructor,"defaultUrl")()),typeof e=="string"?Pe(this,"connection",Object.freeze({url:e})):Pe(this,"connection",Object.freeze(kn(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return Cl(this,void 0,void 0,function*(){yield dF(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const t=Ms(this.constructor,"getNetwork");try{return t(Ve.from(e).toNumber())}catch(r){return _r.throwError("could not detect network",_e.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return _r.throwError("could not detect network",_e.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new $H(FS,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(t=>this.formatter.address(t)))}send(e,t){const r={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:Fs(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=Lx(this.connection,JSON.stringify(r),UX).then(o=>(this.emit("debug",{action:"response",request:r,response:o,provider:this}),o),o=>{throw this.emit("debug",{action:"response",error:o,request:r,provider:this}),o});return i&&(this._cache[e]=s,setTimeout(()=>{this._cache[e]=null},0)),s}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[gp(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[gp(t.address),t.blockTag]];case"getCode":return["eth_getCode",[gp(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[gp(t.address),rr(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[Ms(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[Ms(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=gp(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Cl(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=t.transaction;if(i&&i.type!=null&&Ve.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(t=kn(t),t.transaction=kn(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&_r.throwError(e+" not implemented",_e.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return YH(e,i,t)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then(function(r){function i(){e.send("eth_getFilterChanges",[r]).then(function(s){if(e._pendingFilter!=t)return null;let o=Promise.resolve();return s.forEach(function(a){e._emitted["t:"+a.toLowerCase()]="pending",o=o.then(function(){return e.getTransaction(a).then(function(l){return e.emit("pending",l),null})})}),o.then(function(){return dF(1e3)})}).then(function(){if(e._pendingFilter!=t){e.send("eth_uninstallFilter",[r]);return}return setTimeout(function(){i()},0),null}).catch(s=>{})}return i(),r}).catch(r=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const r=kn(PX);if(t)for(const s in t)t[s]&&(r[s]=!0);l9(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=Ix(Ve.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=at(e[s]))}),e.accessList&&(i.accessList=Gu(e.accessList)),i}}let km=null;try{if(km=WebSocket,km==null)throw new Error("inject please")}catch{const e=new _e(Ci);km=function(){e.throwError("WebSockets not supported in this environment",_e.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var Sb=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const z0=new _e(Ci);let LX=1;class pI extends ug{constructor(e,t){t==="any"&&z0.throwError("WebSocketProvider does not support 'any' network yet",_e.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,t):super("_websocket",t),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?Pe(this,"_websocket",new km(this.connection.url)):Pe(this,"_websocket",e),Pe(this,"_requests",{}),Pe(this,"_subs",{}),Pe(this,"_subIds",{}),Pe(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const s=i.data,o=JSON.parse(s);if(o.id!=null){const a=String(o.id),l=this._requests[a];if(delete this._requests[a],o.result!==void 0)l.callback(null,o.result),this.emit("debug",{action:"response",request:JSON.parse(l.payload),response:o.result,provider:this});else{let c=null;o.error?(c=new Error(o.error.message||"unknown error"),Pe(c,"code",o.error.code||null),Pe(c,"response",s)):c=new Error("unknown error"),l.callback(c,void 0),this.emit("debug",{action:"response",error:c,request:JSON.parse(l.payload),provider:this})}}else if(o.method==="eth_subscription"){const a=this._subs[o.params.subscription];a&&a.processFunc(o.params.result)}else console.warn("this should not happen")};const r=setInterval(()=>{this.emit("poll")},1e3);r.unref&&r.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){z0.throwError("cannot reset events block on WebSocketProvider",_e.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){z0.throwError("cannot set polling interval on WebSocketProvider",_e.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return Sb(this,void 0,void 0,function*(){return null})}set polling(e){e&&z0.throwError("cannot set polling on WebSocketProvider",_e.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=LX++;return new Promise((i,s)=>{function o(l,c){return l?s(l):i(c)}const a=JSON.stringify({method:e,params:t,id:r,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(a),provider:this}),this._requests[String(r)]={callback:o,payload:a},this._wsReady&&this.websocket.send(a)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,t,r){return Sb(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(t).then(o=>this.send("eth_subscribe",o)),this._subIds[e]=i);const s=yield i;this._subs[s]={tag:e,processFunc:r}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],t=>{const r=Ve.from(t.number).toNumber();this._emitted.block=r,this.emit("block",r)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],t=>{this.emit("pending",t)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],t=>{t.removed==null&&(t.removed=!1),this.emit(e.filter,this.formatter.filterLog(t))});break;case"tx":{const t=r=>{const i=r.hash;this.getTransactionReceipt(i).then(s=>{s&&this.emit(i,s)})};t(e),this._subscribe("tx",["newHeads"],r=>{this._events.filter(i=>i.type==="tx").forEach(t)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let t=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;t="tx"}else if(this.listenerCount(e.event))return;const r=this._subIds[t];r&&(delete this._subIds[t],r.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return Sb(this,void 0,void 0,function*(){this.websocket.readyState===km.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var DX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const hm=new _e(Ci);class ZH extends ug{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return DX(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||hm.throwError("no network detected",_e.errors.UNKNOWN_ERROR,{}),this._network==null&&(Pe(this,"_network",t),this.emit("network",t,null))),t})}}class SA extends ZH{constructor(e,t){hm.checkAbstract(new.target,SA),e=Ms(new.target,"getNetwork")(e),t=Ms(new.target,"getApiKey")(t);const r=Ms(new.target,"getUrl")(e,t);super(r,e),typeof t=="string"?Pe(this,"apiKey",t):t!=null&&Object.keys(t).forEach(i=>{Pe(this,i,t[i])})}_startPending(){hm.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return hm.throwError("API provider does not support signing",_e.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return hm.throwError("not implemented; sub-classes must override getUrl",_e.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const pF=new _e(Ci),sw="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class NX extends pI{constructor(e,t){const r=new qH(e,t),i=r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,r.network),Pe(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===sw}}class qH extends SA{static getWebSocketProvider(e,t){return new NX(e,t)}static getApiKey(e){return e==null?sw:(e&&typeof e!="string"&&pF.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":r="eth-goerli.g.alchemy.com/v2/";break;case"matic":r="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":r="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":r="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":r="arb-goerli.g.alchemy.com/v2/";break;case"optimism":r="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":r="opt-goerli.g.alchemy.com/v2/";break;default:pF.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===sw&&kx(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===sw}}const OX=new _e(Ci),G0="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function kX(n){switch(n){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return OX.throwArgumentError("unsupported network","name",n)}class HX extends SA{isCommunityResource(){return this.apiKey===G0}static getApiKey(e){return e??G0}static getUrl(e,t){t==null&&(t=G0);const r={allowGzip:!0,url:"https://"+kX(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===G0&&kx(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var QX=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const mF=new _e(Ci);class zX extends SA{static getApiKey(e){return e!=null&&mF.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,t){let r=null;switch(e.name){case"homestead":r="https://cloudflare-eth.com/";break;default:mF.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return QX(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield r.perform.call(this,"getBlock",{blockTag:"latest"})).number:r.perform.call(this,e,t)})}}var V0=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const Hc=new _e(Ci);function gF(n){const e={};for(let t in n){if(n[t]==null)continue;let r=n[t];t==="type"&&r===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[t]?r=Ix(at(r)):t==="accessList"?r="["+Gu(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=at(r),e[t]=r)}return e}function GX(n){if(n.status==0&&(n.message==="No records found"||n.message==="No transactions found"))return n.result;if(n.status!=1||typeof n.message!="string"||!n.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(n),(n.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return n.result}function vF(n){if(n&&n.status==0&&n.message=="NOTOK"&&(n.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(n),e.throttleRetry=!0,e}if(n.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(n),e}if(n.error){const e=new Error(n.error.message||"unknown error");throw n.error.code&&(e.code=n.error.code),n.error.data&&(e.data=n.error.data),e}return n.result}function yF(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function Mb(n,e,t){if(n==="call"&&e.code===_e.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let s=i.data;if(s&&(s="0x"+s.replace(/^.*0x/i,"")),Tt(s))return s;Hc.throwError("missing revert data in call exception",_e.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===_e.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?r=e.error.message:typeof e.body=="string"?r=e.body:typeof e.responseText=="string"&&(r=e.responseText)),r=(r||"").toLowerCase(),r.match(/insufficient funds/)&&Hc.throwError("insufficient funds for intrinsic transaction cost",_e.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:t}),r.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&Hc.throwError("nonce has already been used",_e.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&Hc.throwError("replacement fee too low",_e.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:t}),r.match(/execution failed due to an exception|execution reverted/)&&Hc.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",_e.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class VX extends hI{constructor(e,t){super(e),Pe(this,"baseUrl",this.getBaseUrl()),Pe(this,"apiKey",t||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return Hc.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,t){const r=Object.keys(t).reduce((s,o)=>{const a=t[o];return a!=null&&(s+=`&${o}=${a}`),s},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${r}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,t){return t.module=e,t.apikey=this.apiKey,t}fetch(e,t,r){return V0(this,void 0,void 0,function*(){const i=r?this.getPostUrl():this.getUrl(e,t),s=r?this.getPostData(e,t):null,o=e==="proxy"?vF:GX;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(A,u)=>(this.isCommunityResource()&&kx(),Promise.resolve(!0))};let l=null;s&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},l=Object.keys(s).map(A=>`${A}=${s[A]}`).join("&"));const c=yield Lx(a,l,o||vF);return this.emit("debug",{action:"response",request:i,response:Fs(c),provider:this}),c})}detectNetwork(){return V0(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return V0(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch(i=>Mb("sendTransaction",i,t.signedTransaction));case"getBlock":if(t.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash});case"call":{if(t.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=gF(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return Mb("call",s,t.transaction)}}case"estimateGas":{const i=gF(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return Mb("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=yF(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=yF(t.filter.toBlock)),t.filter.address&&(i.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&Hc.throwError("unsupported topic count",_e.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),t.filter.topics.length===1)){const a=t.filter.topics[0];(typeof a!="string"||a.length!==66)&&Hc.throwError("unsupported topic format",_e.errors.UNSUPPORTED_OPERATION,{topic0:a}),i.topic0=a}const s=yield this.fetch("logs",i);let o={};for(let a=0;a{["contractAddress","to"].forEach(function(l){o[l]==""&&delete o[l]}),o.creates==null&&o.contractAddress!=null&&(o.creates=o.contractAddress);const a=this.formatter.transactionResponse(o);return o.timeStamp&&(a.timestamp=parseInt(o.timeStamp)),a})})}isCommunityResource(){return this.apiKey==null}}function jX(n){n=n.slice();for(let e=n.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1)),r=n[e];n[e]=n[t],n[t]=r}return n}var Jw=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const iu=new _e(Ci);function j0(){return new Date().getTime()}function wF(n){let e=null;for(let t=0;te?null:(r+i)/2}function gh(n){if(n===null)return"null";if(typeof n=="number"||typeof n=="boolean")return JSON.stringify(n);if(typeof n=="string")return n;if(Ve.isBigNumber(n))return n.toString();if(Array.isArray(n))return JSON.stringify(n.map(e=>gh(e)));if(typeof n=="object"){const e=Object.keys(n);return e.sort(),"{"+e.map(t=>{let r=n[t];return typeof r=="function"?r="[function]":r=gh(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let WX=1;function xF(n){let e=null,t=null,r=new Promise(o=>{e=function(){t&&(clearTimeout(t),t=null),o()},t=setTimeout(e,n)});const i=o=>(r=r.then(o),r);function s(){return r}return{cancel:e,getPromise:s,wait:i}}const KX=[_e.errors.CALL_EXCEPTION,_e.errors.INSUFFICIENT_FUNDS,_e.errors.NONCE_EXPIRED,_e.errors.REPLACEMENT_UNDERPRICED,_e.errors.UNPREDICTABLE_GAS_LIMIT],XX=["address","args","errorArgs","errorSignature","method","transaction"];function W0(n,e){const t={weight:n.weight};return Object.defineProperty(t,"provider",{get:()=>n.provider}),n.start&&(t.start=n.start),e&&(t.duration=e-n.start),n.done&&(n.error?t.error=n.error:t.result=n.result||null),t}function YX(n,e){return function(t){const r={};t.forEach(s=>{const o=n(s.result);r[o]||(r[o]={count:0,result:s.result}),r[o].count++});const i=Object.keys(r);for(let s=0;s=e)return o.result}}}function $X(n,e,t){let r=gh;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=_F(i.map(a=>a.result),2);if(o!=null)return o=Math.ceil(o),s.indexOf(o+1)>=0&&o++,o>=n._highestBlockNumber&&(n._highestBlockNumber=o),n._highestBlockNumber};case"getGasPrice":return function(i){const s=i.map(o=>o.result);return s.sort(),s[Math.floor(s.length/2)]};case"getEtherPrice":return function(i){return _F(i.map(s=>s.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":r=function(i){return i==null?null:(i=kn(i),i.confirmations=-1,gh(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=kn(i),i.transactions=i.transactions.map(s=>(s=kn(s),s.confirmations=-1,s)),gh(i))}:r=function(i){return i==null?null:gh(i)};break;default:throw new Error("unknown method: "+e)}return YX(r,n.quorum)}function vp(n,e){return Jw(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:mh(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function ZX(n,e,t,r){return Jw(this,void 0,void 0,function*(){let i=n.provider;switch(t){case"getBlockNumber":case"getGasPrice":return i[t]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return r.blockTag&&Tt(r.blockTag)&&(i=yield vp(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&Tt(r.blockTag)&&(i=yield vp(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&Tt(r.blockTag)&&(i=yield vp(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&Tt(r.blockTag)&&(i=yield vp(n,e)),t==="call"&&r.blockTag?i[t](r.transaction,r.blockTag):i[t](r.transaction);case"getTransaction":case"getTransactionReceipt":return i[t](r.transactionHash);case"getLogs":{let s=r.filter;return(s.fromBlock&&Tt(s.fromBlock)||s.toBlock&&Tt(s.toBlock))&&(i=yield vp(n,e)),i.getLogs(s)}}return iu.throwError("unknown method error",_e.errors.UNKNOWN_ERROR,{method:t,params:r})})}class qX extends hI{constructor(e,t){e.length===0&&iu.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(a0.isProvider(o)){const A=sF(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:A,priority:1})}const l=kn(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=sF(o)?2e3:750),l.weight==null&&(l.weight=1);const c=l.weight;return(c%1||c>512||c<1)&&iu.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,c),Object.freeze(l)}),i=r.reduce((o,a)=>o+a.weight,0);t==null?t=i/2:t>i&&iu.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=wF(r.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),Pe(this,"providerConfigs",Object.freeze(r)),Pe(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return Jw(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return wF(e)})}perform(e,t){return Jw(this,void 0,void 0,function*(){if(e==="sendTransaction"){const l=yield Promise.all(this.providerConfigs.map(c=>c.provider.sendTransaction(t.signedTransaction).then(A=>A.hash,A=>A)));for(let c=0;cl.priority-c.priority);const s=this._highestBlockNumber;let o=0,a=!0;for(;;){const l=j0();let c=i.filter(h=>h.runner&&l-h.starth+d.weight,0);for(;c{h.staller=null}),h.runner=ZX(h,s,e,t).then(m=>{h.done=!0,h.result=m,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:W0(h,j0()),request:{method:e,params:Fs(t)},provider:this})},m=>{h.done=!0,h.error=m,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:W0(h,j0()),request:{method:e,params:Fs(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:d,backend:W0(h,null),request:{method:e,params:Fs(t)},provider:this}),c+=h.weight}const A=[];i.forEach(h=>{h.done||!h.runner||(A.push(h.runner),h.staller&&A.push(h.staller.getPromise()))}),A.length&&(yield Promise.race(A));const u=i.filter(h=>h.done&&h.error==null);if(u.length>=this.quorum){const h=r(u);if(h!==void 0)return i.forEach(d=>{d.staller&&d.staller.cancel(),d.cancelled=!0}),h;a||(yield xF(100).getPromise()),a=!1}const f=i.reduce((h,d)=>{if(!d.done||d.error==null)return h;const m=d.error.code;return KX.indexOf(m)>=0&&(h[m]||(h[m]={error:d.error,weight:0}),h[m].weight+=d.weight),h},{});if(Object.keys(f).forEach(h=>{const d=f[h];if(d.weight{p.staller&&p.staller.cancel(),p.cancelled=!0});const m=d.error,g={};XX.forEach(p=>{m[p]!=null&&(g[p]=m[p])}),iu.throwError(m.reason||m.message,h,g)}),i.filter(h=>!h.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),iu.throwError("failed to meet quorum",_e.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>W0(l)),provider:this})})}}const JX=null,ow=new _e(Ci),dm="84842078b09946638c03157f83405213";class eY extends pI{constructor(e,t){const r=new JH(e,t),i=r.connection;i.password&&ow.throwError("INFURA WebSocket project secrets unsupported",_e.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),Pe(this,"apiKey",r.projectId),Pe(this,"projectId",r.projectId),Pe(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===dm}}class JH extends SA{static getWebSocketProvider(e,t){return new eY(e,t)}static getApiKey(e){const t={apiKey:dm,projectId:dm,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(ow.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),ow.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),t.projectId=e.projectId,t.projectSecret=e.projectSecret):e.projectId&&(t.projectId=e.projectId),t.apiKey=t.projectId),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"homestead":r="mainnet.infura.io";break;case"goerli":r="goerli.infura.io";break;case"sepolia":r="sepolia.infura.io";break;case"matic":r="polygon-mainnet.infura.io";break;case"maticmum":r="polygon-mumbai.infura.io";break;case"optimism":r="optimism-mainnet.infura.io";break;case"optimism-goerli":r="optimism-goerli.infura.io";break;case"arbitrum":r="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":r="arbitrum-goerli.infura.io";break;default:ow.throwError("unsupported network",_e.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===dm&&kx(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===dm}}const Cb=new _e(Ci),tY="ETHERS_JS_SHARED";class nY extends SA{static getApiKey(e){return e&&typeof e!="string"&&Cb.throwArgumentError("invalid apiKey","apiKey",e),e||tY}static getUrl(e,t){Cb.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let r=null;switch(e.name){case"homestead":r="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":r="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":r="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":r="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":r="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:Cb.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const bF=new _e(Ci),EF="62e1ad51b37b8e00394bda3b";class rY extends SA{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=EF:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:bF.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),t}static getUrl(e,t){let r=null;switch(e?e.name:"unknown"){case"goerli":r="eth-goerli.gateway.pokt.network";break;case"homestead":r="eth-mainnet.gateway.pokt.network";break;case"kovan":r="poa-kovan.gateway.pokt.network";break;case"matic":r="poly-mainnet.gateway.pokt.network";break;case"maticmum":r="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":r="eth-rinkeby.gateway.pokt.network";break;case"ropsten":r="eth-ropsten.gateway.pokt.network";break;default:bF.throwError("unsupported network",_e.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${r}/v1/lb/${t.applicationId}`,s={headers:{},url:i};return t.applicationSecretKey!=null&&(s.user="",s.password=t.applicationSecretKey),s}isCommunityResource(){return this.applicationId===EF}}const BF=new _e(Ci);let iY=1;function SF(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:iY++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:Fs(s),provider:this}),e(s,(l,c)=>{if(l)return this.emit("debug",{action:"response",fetcher:t,error:l,request:s,provider:this}),a(l);if(this.emit("debug",{action:"response",fetcher:t,request:s,response:c,provider:this}),c.error){const A=new Error(c.error.message);return A.code=c.error.code,A.data=c.error.data,a(A)}o(c.result)})})}}function sY(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:Fs(r),provider:this}),n.request(r).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:i,provider:this}),i})}}class mI extends ug{constructor(e,t){e==null&&BF.throwArgumentError("missing provider","provider",e);let r=null,i=null,s=null;typeof e=="function"?(r="unknown:",i=e):(r=e.host||e.path||"",!r&&e.isMetaMask&&(r="metamask"),s=e,e.request?(r===""&&(r="eip-1193:"),i=sY(e)):e.sendAsync?i=SF(e,e.sendAsync.bind(e)):e.send?i=SF(e,e.send.bind(e)):BF.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),Pe(this,"jsonRpcFetchFunc",i),Pe(this,"provider",s)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const MF=new _e(Ci);function oY(n,e){if(n==null&&(n="homestead"),typeof n=="string"){const r=n.match(/^(ws|http)s?:/i);if(r)switch(r[1].toLowerCase()){case"http":case"https":return new ug(n);case"ws":case"wss":return new pI(n);default:MF.throwArgumentError("unsupported URL scheme","network",n)}}const t=Z4(n);return(!t||!t._defaultProvider)&&MF.throwError("unsupported getDefaultProvider network",_e.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:qX,AlchemyProvider:qH,AnkrProvider:HX,CloudflareProvider:zX,EtherscanProvider:VX,InfuraProvider:JH,JsonRpcProvider:ug,NodesmithProvider:nY,PocketProvider:rY,Web3Provider:mI,IpcProvider:JX},e)}var aY=!0,Tb="Invariant failed";function Ol(n,e){if(!n){if(aY)throw new Error(Tb);var t=typeof e=="function"?e():e,r=t?"".concat(Tb,": ").concat(t):Tb;throw new Error(r)}}var Xo;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(Xo||(Xo={}));function fg(){return fg=Object.assign||function(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function aw(n,e,t){return lY()?aw=Reflect.construct:aw=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),c=new l;return o&&hg(c,o.prototype),c},aw.apply(null,arguments)}function cY(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function e_(n){var e=typeof Map=="function"?new Map:void 0;return e_=function(r){if(r===null||!cY(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return aw(r,arguments,PS(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),hg(i,r)},e_(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function CF(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function tQ(n){if(typeof n=="string"){n=n.replace(/^Ox/,"0x");var e=Number.parseInt(n,n.trim().substring(0,2)==="0x"?16:10);return Number.isNaN(e)&&Ol(!1),e}else return Number.isInteger(n)||Ol(!1),n}function nQ(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||Ol(!1);for(var e=n.substring(0,2)==="0x"?n:"0x"+n,t=e.toLowerCase().substring(2).split(""),r=new Uint8Array(40),i=0;i<40;i++)r[i]=t[i].charCodeAt(0);for(var s=ft(Er(r)),o=0;o<40;o+=2)s[o>>1]>>4>=8&&(t[o]=t[o].toUpperCase()),(s[o>>1]&15)>=8&&(t[o+1]=t[o+1].toUpperCase());var a="0x"+t.join("");return e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==a&&Ol(!1),a}var TF=function(e,t){try{var r=function(o){return Promise.resolve(Promise.all([t.chainId===void 0?e.getChainId():t.chainId,t.account===void 0?e.getAccount():t.account])).then(function(a){var l=a[0],c=a[1],A=tQ(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(A))throw new rQ(A,e.supportedChainIds);var u=c===null?c:nQ(c);return{provider:o,chainId:A,account:u}})},i=t.provider===void 0;return Promise.resolve(i?Promise.resolve(e.getProvider()).then(r):r(t.provider))}catch(s){return Promise.reject(s)}},K0=function(n){eQ(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(e_(Error)),rQ=function(n){eQ(e,n);function e(t,r){var i;return i=n.call(this)||this,i.name=i.constructor.name,i.message="Unsupported chain id: "+t+". Supported chain ids are: "+r+".",i}return e}(e_(Error)),zr;(function(n){n[n.ACTIVATE_CONNECTOR=0]="ACTIVATE_CONNECTOR",n[n.UPDATE=1]="UPDATE",n[n.UPDATE_FROM_ERROR=2]="UPDATE_FROM_ERROR",n[n.ERROR=3]="ERROR",n[n.ERROR_FROM_ACTIVATION=4]="ERROR_FROM_ACTIVATION",n[n.DEACTIVATE_CONNECTOR=5]="DEACTIVATE_CONNECTOR"})(zr||(zr={}));function AY(n,e){var t=e.type,r=e.payload;switch(t){case zr.ACTIVATE_CONNECTOR:{var i=r.connector,s=r.provider,o=r.chainId,a=r.account,l=r.onError;return{connector:i,provider:s,chainId:o,account:a,onError:l}}case zr.UPDATE:{var c=r.provider,A=r.chainId,u=r.account;return fg({},n,c===void 0?{}:{provider:c},A===void 0?{}:{chainId:A},u===void 0?{}:{account:u})}case zr.UPDATE_FROM_ERROR:{var f=r.provider,h=r.chainId,d=r.account;return fg({},n,f===void 0?{}:{provider:f},h===void 0?{}:{chainId:h},d===void 0?{}:{account:d},{error:void 0})}case zr.ERROR:{var m=r.error,g=n.connector,p=n.onError;return{connector:g,error:m,onError:p}}case zr.ERROR_FROM_ACTIVATION:{var v=r.connector,w=r.error;return{connector:v,error:w}}case zr.DEACTIVATE_CONNECTOR:return{}}}function uY(){var n=xe.useReducer(AY,{}),e=n[0],t=n[1],r=e.connector,i=e.provider,s=e.chainId,o=e.account,a=e.onError,l=e.error,c=xe.useRef(-1);c.current+=1;var A=xe.useCallback(function(g,p,v){v===void 0&&(v=!1);try{var w=c.current,_=!1;return Promise.resolve(CF(function(){return Promise.resolve(g.activate().then(function(x){return _=!0,x})).then(function(x){return Promise.resolve(TF(g,x)).then(function(b){if(c.current>w)throw new K0;t({type:zr.ACTIVATE_CONNECTOR,payload:fg({connector:g},b,{onError:p})})})})},function(x){if(x instanceof K0)_&&g.deactivate();else{if(v)throw _&&g.deactivate(),x;p?(_&&g.deactivate(),p(x)):t({type:zr.ERROR_FROM_ACTIVATION,payload:{connector:g,error:x}})}}))}catch(x){return Promise.reject(x)}},[]),u=xe.useCallback(function(g){t({type:zr.ERROR,payload:{error:g}})},[]),f=xe.useCallback(function(){t({type:zr.DEACTIVATE_CONNECTOR})},[]),h=xe.useCallback(function(g){try{if(!r)throw Error("This should never happen, it's just so Typescript stops complaining");var p=c.current;return Promise.resolve(function(){if(l)return CF(function(){return Promise.resolve(TF(r,g)).then(function(x){if(c.current>p)throw new K0;t({type:zr.UPDATE_FROM_ERROR,payload:x})})},function(x){x instanceof K0||(a?a(x):t({type:zr.ERROR,payload:{error:x}}))});var v=g.chainId===void 0?void 0:tQ(g.chainId);if(v!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(v)){var w=new rQ(v,r.supportedChainIds);a?a(w):t({type:zr.ERROR,payload:{error:w}})}else{var _=typeof g.account=="string"?nQ(g.account):g.account;t({type:zr.UPDATE,payload:{provider:g.provider,chainId:v,account:_}})}}())}catch(v){return Promise.reject(v)}},[r,l,a]),d=xe.useCallback(function(g){a?a(g):t({type:zr.ERROR,payload:{error:g}})},[a]),m=xe.useCallback(function(){t({type:zr.DEACTIVATE_CONNECTOR})},[]);return xe.useEffect(function(){return function(){r&&r.deactivate()}},[r]),xe.useEffect(function(){return r&&r.on(Xo.Update,h).on(Xo.Error,d).on(Xo.Deactivate,m),function(){r&&r.off(Xo.Update,h).off(Xo.Error,d).off(Xo.Deactivate,m)}},[r,h,d,m]),{connector:r,provider:i,chainId:s,account:o,activate:A,setError:u,deactivate:f,error:l}}var iQ="primary",vh={};function fY(n){vh[n]&&Ol(!1),vh[n]=xe.createContext({activate:function(){try{return Ol(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){Ol(!1)},deactivate:function(){Ol(!1)},active:!1}),vh[n].displayName="Web3ReactContext - "+n;var e=vh[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=uY(),a=o.connector,l=o.provider,c=o.chainId,A=o.account,u=o.activate,f=o.setError,h=o.deactivate,d=o.error,m=a!==void 0&&c!==void 0&&A!==void 0&&!d,g=xe.useMemo(function(){return m&&c!==void 0&&Number.isInteger(c)&&a?i(l,a):void 0},[m,i,l,a,c]),p={connector:a,library:g,chainId:c,account:A,activate:u,setError:f,deactivate:h,active:m,error:d};return q.createElement(e,{value:p},s)}}var hY=fY(iQ);function dY(n){return n===void 0&&(n=iQ),Object.keys(vh).includes(n)||Ol(!1),vh[n]}function pY(n){return xe.useContext(dY(n))}var LS={},sQ={exports:{}},Vs={},oQ={exports:{}},aQ={};/** * @license React * scheduler.production.min.js * @@ -29,7 +29,7 @@ var bW=Object.defineProperty;var EW=(n,e,t)=>e in n?bW(n,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(n){function e(N,z){var W=N.length;N.push(z);e:for(;0>>1,C=N[H];if(0>>1;Hi(F,W))rei(ce,F)?(N[H]=ce,N[re]=W,H=re):(N[H]=F,N[te]=W,H=te);else if(rei(ce,W))N[H]=ce,N[re]=W,H=re;else break e}}return z}function i(N,z){var W=N.sortIndex-z.sortIndex;return W!==0?W:N.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],A=1,u=null,f=3,h=!1,d=!1,m=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(N){for(var z=t(c);z!==null;){if(z.callback===null)r(c);else if(z.startTime<=N)r(c),z.sortIndex=z.expirationTime,e(l,z);else break;z=t(c)}}function _(N){if(m=!1,w(N),!d)if(t(l)!==null)d=!0,U(x);else{var z=t(c);z!==null&&P(_,z.startTime-N)}}function x(N,z){d=!1,m&&(m=!1,p(M),M=-1),h=!0;var W=f;try{for(w(z),u=t(l);u!==null&&(!(u.expirationTime>z)||N&&!L());){var H=u.callback;if(typeof H=="function"){u.callback=null,f=u.priorityLevel;var C=H(u.expirationTime<=z);z=n.unstable_now(),typeof C=="function"?u.callback=C:u===t(l)&&r(l),w(z)}else r(l);u=t(l)}if(u!==null)var K=!0;else{var te=t(c);te!==null&&P(_,te.startTime-z),K=!1}return K}finally{u=null,f=W,h=!1}}var b=!1,B=null,M=-1,I=5,S=-1;function L(){return!(n.unstable_now()-SN||125H?(N.sortIndex=W,e(c,N),t(l)===null&&N===t(c)&&(m?(p(M),M=-1):m=!0,P(_,W-H))):(N.sortIndex=C,e(l,N),d||h||(d=!0,U(x))),N},n.unstable_shouldYield=L,n.unstable_wrapCallback=function(N){var z=f;return function(){var W=f;f=z;try{return N.apply(this,arguments)}finally{f=W}}}})(sQ);iQ.exports=sQ;var dY=iQ.exports;/** + */(function(n){function e(N,z){var W=N.length;N.push(z);e:for(;0>>1,C=N[H];if(0>>1;Hi(F,W))rei(ce,F)?(N[H]=ce,N[re]=W,H=re):(N[H]=F,N[ee]=W,H=ee);else if(rei(ce,W))N[H]=ce,N[re]=W,H=re;else break e}}return z}function i(N,z){var W=N.sortIndex-z.sortIndex;return W!==0?W:N.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],c=[],A=1,u=null,f=3,h=!1,d=!1,m=!1,g=typeof setTimeout=="function"?setTimeout:null,p=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(N){for(var z=t(c);z!==null;){if(z.callback===null)r(c);else if(z.startTime<=N)r(c),z.sortIndex=z.expirationTime,e(l,z);else break;z=t(c)}}function _(N){if(m=!1,w(N),!d)if(t(l)!==null)d=!0,R(x);else{var z=t(c);z!==null&&L(_,z.startTime-N)}}function x(N,z){d=!1,m&&(m=!1,p(S),S=-1),h=!0;var W=f;try{for(w(z),u=t(l);u!==null&&(!(u.expirationTime>z)||N&&!P());){var H=u.callback;if(typeof H=="function"){u.callback=null,f=u.priorityLevel;var C=H(u.expirationTime<=z);z=n.unstable_now(),typeof C=="function"?u.callback=C:u===t(l)&&r(l),w(z)}else r(l);u=t(l)}if(u!==null)var K=!0;else{var ee=t(c);ee!==null&&L(_,ee.startTime-z),K=!1}return K}finally{u=null,f=W,h=!1}}var b=!1,B=null,S=-1,I=5,M=-1;function P(){return!(n.unstable_now()-MN||125H?(N.sortIndex=W,e(c,N),t(l)===null&&N===t(c)&&(m?(p(S),S=-1):m=!0,L(_,W-H))):(N.sortIndex=C,e(l,N),d||h||(d=!0,R(x))),N},n.unstable_shouldYield=P,n.unstable_wrapCallback=function(N){var z=f;return function(){var W=f;f=z;try{return N.apply(this,arguments)}finally{f=W}}}})(aQ);oQ.exports=aQ;var mY=oQ.exports;/** * @license React * react-dom.production.min.js * @@ -37,14 +37,14 @@ var bW=Object.defineProperty;var EW=(n,e,t)=>e in n?bW(n,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var pY=xe,Ns=dY;function De(n){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+n,t=1;t"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),FS=Object.prototype.hasOwnProperty,mY=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,CF={},TF={};function gY(n){return FS.call(TF,n)?!0:FS.call(CF,n)?!1:mY.test(n)?TF[n]=!0:(CF[n]=!0,!1)}function vY(n,e,t,r){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function yY(n,e,t,r){if(e===null||typeof e>"u"||vY(n,e,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function ki(n,e,t,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var ai={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){ai[n]=new ki(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];ai[e]=new ki(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){ai[n]=new ki(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){ai[n]=new ki(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){ai[n]=new ki(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){ai[n]=new ki(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){ai[n]=new ki(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){ai[n]=new ki(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){ai[n]=new ki(n,5,!1,n.toLowerCase(),null,!1,!1)});var dI=/[\-:]([a-z])/g;function pI(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(dI,pI);ai[e]=new ki(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(dI,pI);ai[e]=new ki(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(dI,pI);ai[e]=new ki(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){ai[n]=new ki(n,1,!1,n.toLowerCase(),null,!1,!1)});ai.xlinkHref=new ki("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){ai[n]=new ki(n,1,!1,n.toLowerCase(),null,!0,!0)});function mI(n,e,t,r){var i=ai.hasOwnProperty(e)?ai[e]:null;(i!==null?i.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),DS=Object.prototype.hasOwnProperty,vY=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,IF={},RF={};function yY(n){return DS.call(RF,n)?!0:DS.call(IF,n)?!1:vY.test(n)?RF[n]=!0:(IF[n]=!0,!1)}function wY(n,e,t,r){if(t!==null&&t.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:t!==null?!t.acceptsBooleans:(n=n.toLowerCase().slice(0,5),n!=="data-"&&n!=="aria-");default:return!1}}function _Y(n,e,t,r){if(e===null||typeof e>"u"||wY(n,e,t,r))return!0;if(r)return!1;if(t!==null)switch(t.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Qi(n,e,t,r,i,s,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=t,this.propertyName=n,this.type=e,this.sanitizeURL=s,this.removeEmptyString=o}var li={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){li[n]=new Qi(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];li[e]=new Qi(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){li[n]=new Qi(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){li[n]=new Qi(n,2,!1,n,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(n){li[n]=new Qi(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){li[n]=new Qi(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){li[n]=new Qi(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){li[n]=new Qi(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){li[n]=new Qi(n,5,!1,n.toLowerCase(),null,!1,!1)});var gI=/[\-:]([a-z])/g;function vI(n){return n[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(n){var e=n.replace(gI,vI);li[e]=new Qi(e,1,!1,n,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(n){var e=n.replace(gI,vI);li[e]=new Qi(e,1,!1,n,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(n){var e=n.replace(gI,vI);li[e]=new Qi(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){li[n]=new Qi(n,1,!1,n.toLowerCase(),null,!1,!1)});li.xlinkHref=new Qi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){li[n]=new Qi(n,1,!1,n.toLowerCase(),null,!0,!0)});function yI(n,e,t,r){var i=li.hasOwnProperty(e)?li[e]:null;(i!==null?i.type!==0:r||!(2a||i[o]!==s[a]){var l=` -`+i[o].replace(" at new "," at ");return n.displayName&&l.includes("")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{Cb=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?dm(n):""}function wY(n){switch(n.tag){case 5:return dm(n.type);case 16:return dm("Lazy");case 13:return dm("Suspense");case 19:return dm("SuspenseList");case 0:case 2:case 15:return n=Tb(n.type,!1),n;case 11:return n=Tb(n.type.render,!1),n;case 1:return n=Tb(n.type,!0),n;default:return""}}function NS(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case gh:return"Fragment";case mh:return"Portal";case PS:return"Profiler";case gI:return"StrictMode";case LS:return"Suspense";case DS:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case lQ:return(n.displayName||"Context")+".Consumer";case aQ:return(n._context.displayName||"Context")+".Provider";case vI:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case yI:return e=n.displayName||null,e!==null?e:NS(n.type)||"Memo";case Fc:e=n._payload,n=n._init;try{return NS(n(e))}catch{}}return null}function _Y(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return NS(e);case 8:return e===gI?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function hA(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function AQ(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function xY(n){var e=AQ(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function K0(n){n._valueTracker||(n._valueTracker=xY(n))}function uQ(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=AQ(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function qw(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function OS(n,e){var t=e.checked;return Yn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function RF(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=hA(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function fQ(n,e){e=e.checked,e!=null&&mI(n,"checked",e,!1)}function kS(n,e){fQ(n,e);var t=hA(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?HS(n,e.type,t):e.hasOwnProperty("defaultValue")&&HS(n,e.type,hA(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function UF(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function HS(n,e,t){(e!=="number"||qw(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var pm=Array.isArray;function Vh(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=X0.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function dg(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var km={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},bY=["Webkit","ms","Moz","O"];Object.keys(km).forEach(function(n){bY.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),km[e]=km[n]})});function mQ(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||km.hasOwnProperty(n)&&km[n]?(""+e).trim():e+"px"}function gQ(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=mQ(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var EY=Yn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function GS(n,e){if(e){if(EY[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(De(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(De(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(De(61))}if(e.style!=null&&typeof e.style!="object")throw Error(De(62))}}function VS(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var jS=null;function wI(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var WS=null,jh=null,Wh=null;function LF(n){if(n=u0(n)){if(typeof WS!="function")throw Error(De(280));var e=n.stateNode;e&&(e=zx(e),WS(n.stateNode,n.type,e))}}function vQ(n){jh?Wh?Wh.push(n):Wh=[n]:jh=n}function yQ(){if(jh){var n=jh,e=Wh;if(Wh=jh=null,LF(n),e)for(n=0;n>>=0,n===0?32:31-(LY(n)/DY|0)|0}var Y0=64,$0=4194304;function mm(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function n_(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,i=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~i;a!==0?r=mm(a):(s&=o,s!==0&&(r=mm(s)))}else o=t&~i,o!==0?r=mm(o):s!==0&&(r=mm(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0t;t++)e.push(n);return e}function c0(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-Jo(e),n[e]=t}function HY(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var r=n.eventTimes;for(n=n.expirationTimes;0=Qm),VF=String.fromCharCode(32),jF=!1;function kQ(n,e){switch(n){case"keyup":return d$.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function HQ(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var vh=!1;function m$(n,e){switch(n){case"compositionend":return HQ(e);case"keypress":return e.which!==32?null:(jF=!0,VF);case"textInput":return n=e.data,n===VF&&jF?null:n;default:return null}}function g$(n,e){if(vh)return n==="compositionend"||!CI&&kQ(n,e)?(n=NQ(),ow=BI=zc=null,vh=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=YF(t)}}function VQ(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?VQ(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function jQ(){for(var n=window,e=qw();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=qw(n.document)}return e}function TI(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function S$(n){var e=jQ(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&VQ(t.ownerDocument.documentElement,t)){if(r!==null&&TI(t)){if(e=r.start,n=r.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!n.extend&&s>r&&(i=r,r=s,s=i),i=$F(t,s);var o=$F(t,r);i&&o&&(n.rangeCount!==1||n.anchorNode!==i.node||n.anchorOffset!==i.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),n.removeAllRanges(),s>r?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,yh=null,qS=null,Gm=null,JS=!1;function ZF(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;JS||yh==null||yh!==qw(r)||(r=yh,"selectionStart"in r&&TI(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Gm&&wg(Gm,r)||(Gm=r,r=s_(qS,"onSelect"),0xh||(n.current=sM[xh],sM[xh]=null,xh--)}function En(n,e){xh++,sM[xh]=n.current,n.current=e}var dA={},Bi=SA(dA),qi=SA(!1),bu=dA;function pd(n,e){var t=n.type.contextTypes;if(!t)return dA;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=e[s];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=i),i}function Ji(n){return n=n.childContextTypes,n!=null}function a_(){In(qi),In(Bi)}function iP(n,e,t){if(Bi.current!==dA)throw Error(De(168));En(Bi,e),En(qi,t)}function e5(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(De(108,_Y(n)||"Unknown",i));return Yn({},t,r)}function l_(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||dA,bu=Bi.current,En(Bi,n),En(qi,qi.current),!0}function sP(n,e,t){var r=n.stateNode;if(!r)throw Error(De(169));t?(n=e5(n,e,bu),r.__reactInternalMemoizedMergedChildContext=n,In(qi),In(Bi),En(Bi,n)):In(qi),En(qi,t)}var Rl=null,Gx=!1,Gb=!1;function t5(n){Rl===null?Rl=[n]:Rl.push(n)}function O$(n){Gx=!0,t5(n)}function MA(){if(!Gb&&Rl!==null){Gb=!0;var n=0,e=dn;try{var t=Rl;for(dn=1;n>=o,i-=o,Dl=1<<32-Jo(e)+i|t<M?(I=B,B=null):I=B.sibling;var S=f(p,B,w[M],_);if(S===null){B===null&&(B=I);break}n&&B&&S.alternate===null&&e(p,B),v=s(S,v,M),b===null?x=S:b.sibling=S,b=S,B=I}if(M===w.length)return t(p,B),Nn&&$A(p,M),x;if(B===null){for(;MM?(I=B,B=null):I=B.sibling;var L=f(p,B,S.value,_);if(L===null){B===null&&(B=I);break}n&&B&&L.alternate===null&&e(p,B),v=s(L,v,M),b===null?x=L:b.sibling=L,b=L,B=I}if(S.done)return t(p,B),Nn&&$A(p,M),x;if(B===null){for(;!S.done;M++,S=w.next())S=u(p,S.value,_),S!==null&&(v=s(S,v,M),b===null?x=S:b.sibling=S,b=S);return Nn&&$A(p,M),x}for(B=r(p,B);!S.done;M++,S=w.next())S=h(B,p,M,S.value,_),S!==null&&(n&&S.alternate!==null&&B.delete(S.key===null?M:S.key),v=s(S,v,M),b===null?x=S:b.sibling=S,b=S);return n&&B.forEach(function(O){return e(p,O)}),Nn&&$A(p,M),x}function g(p,v,w,_){if(typeof w=="object"&&w!==null&&w.type===gh&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case W0:e:{for(var x=w.key,b=v;b!==null;){if(b.key===x){if(x=w.type,x===gh){if(b.tag===7){t(p,b.sibling),v=i(b,w.props.children),v.return=p,p=v;break e}}else if(b.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Fc&&lP(x)===b.type){t(p,b.sibling),v=i(b,w.props),v.ref=bp(p,b,w),v.return=p,p=v;break e}t(p,b);break}else e(p,b);b=b.sibling}w.type===gh?(v=du(w.props.children,p.mode,_,w.key),v.return=p,p=v):(_=dw(w.type,w.key,w.props,null,p.mode,_),_.ref=bp(p,v,w),_.return=p,p=_)}return o(p);case mh:e:{for(b=w.key;v!==null;){if(v.key===b)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){t(p,v.sibling),v=i(v,w.children||[]),v.return=p,p=v;break e}else{t(p,v);break}else e(p,v);v=v.sibling}v=Zb(w,p.mode,_),v.return=p,p=v}return o(p);case Fc:return b=w._init,g(p,v,b(w._payload),_)}if(pm(w))return d(p,v,w,_);if(vp(w))return m(p,v,w,_);rv(p,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(t(p,v.sibling),v=i(v,w),v.return=p,p=v):(t(p,v),v=$b(w,p.mode,_),v.return=p,p=v),o(p)):t(p,v)}return g}var gd=s5(!0),o5=s5(!1),u_=SA(null),f_=null,Bh=null,FI=null;function PI(){FI=Bh=f_=null}function LI(n){var e=u_.current;In(u_),n._currentValue=e}function lM(n,e,t){for(;n!==null;){var r=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),n===t)break;n=n.return}}function Xh(n,e){f_=n,FI=Bh=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&($i=!0),n.firstContext=null)}function yo(n){var e=n._currentValue;if(FI!==n)if(n={context:n,memoizedValue:e,next:null},Bh===null){if(f_===null)throw Error(De(308));Bh=n,f_.dependencies={lanes:0,firstContext:n}}else Bh=Bh.next=n;return e}var au=null;function DI(n){au===null?au=[n]:au.push(n)}function a5(n,e,t,r){var i=e.interleaved;return i===null?(t.next=t,DI(e)):(t.next=i.next,i.next=t),e.interleaved=t,Yl(n,r)}function Yl(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var Pc=!1;function NI(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function l5(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Ql(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function rA(n,e,t){var r=n.updateQueue;if(r===null)return null;if(r=r.shared,Wt&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,Yl(n,t)}return i=r.interleaved,i===null?(e.next=e,DI(r)):(e.next=i.next,i.next=e),r.interleaved=e,Yl(n,t)}function lw(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,xI(n,t)}}function cP(n,e){var t=n.updateQueue,r=n.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var i=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?i=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?i=s=e:s=s.next=e}else i=s=e;t={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function h_(n,e,t,r){var i=n.updateQueue;Pc=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var A=n.alternate;A!==null&&(A=A.updateQueue,a=A.lastBaseUpdate,a!==o&&(a===null?A.firstBaseUpdate=c:a.next=c,A.lastBaseUpdate=l))}if(s!==null){var u=i.baseState;o=0,A=c=l=null,a=s;do{var f=a.lane,h=a.eventTime;if((r&f)===f){A!==null&&(A=A.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var d=n,m=a;switch(f=e,h=t,m.tag){case 1:if(d=m.payload,typeof d=="function"){u=d.call(h,u,f);break e}u=d;break e;case 3:d.flags=d.flags&-65537|128;case 0:if(d=m.payload,f=typeof d=="function"?d.call(h,u,f):d,f==null)break e;u=Yn({},u,f);break e;case 2:Pc=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else h={eventTime:h,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},A===null?(c=A=h,l=u):A=A.next=h,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(A===null&&(l=u),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=A,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Su|=o,n.lanes=o,n.memoizedState=u}}function AP(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var r=jb.transition;jb.transition={};try{n(!1),e()}finally{dn=t,jb.transition=r}}function B5(){return wo().memoizedState}function z$(n,e,t){var r=sA(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},S5(n))M5(e,t);else if(t=a5(n,e,t,r),t!==null){var i=Ni();ea(t,n,r,i),C5(t,e,r)}}function G$(n,e,t){var r=sA(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(S5(n))M5(e,i);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(i.hasEagerState=!0,i.eagerState=a,ia(a,o)){var l=e.interleaved;l===null?(i.next=i,DI(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=a5(n,e,i,r),t!==null&&(i=Ni(),ea(t,n,r,i),C5(t,e,r))}}function S5(n){var e=n.alternate;return n===Xn||e!==null&&e===Xn}function M5(n,e){Vm=p_=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function C5(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,xI(n,t)}}var m_={readContext:yo,useCallback:ci,useContext:ci,useEffect:ci,useImperativeHandle:ci,useInsertionEffect:ci,useLayoutEffect:ci,useMemo:ci,useReducer:ci,useRef:ci,useState:ci,useDebugValue:ci,useDeferredValue:ci,useTransition:ci,useMutableSource:ci,useSyncExternalStore:ci,useId:ci,unstable_isNewReconciler:!1},V$={readContext:yo,useCallback:function(n,e){return _a().memoizedState=[n,e===void 0?null:e],n},useContext:yo,useEffect:fP,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Aw(4194308,4,w5.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Aw(4194308,4,n,e)},useInsertionEffect:function(n,e){return Aw(4,2,n,e)},useMemo:function(n,e){var t=_a();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=_a();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=z$.bind(null,Xn,n),[r.memoizedState,n]},useRef:function(n){var e=_a();return n={current:n},e.memoizedState=n},useState:uP,useDebugValue:jI,useDeferredValue:function(n){return _a().memoizedState=n},useTransition:function(){var n=uP(!1),e=n[0];return n=Q$.bind(null,n[1]),_a().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Xn,i=_a();if(Nn){if(t===void 0)throw Error(De(407));t=t()}else{if(t=e(),Wr===null)throw Error(De(349));Bu&30||f5(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,fP(d5.bind(null,r,s,n),[n]),r.flags|=2048,Cg(9,h5.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=_a(),e=Wr.identifierPrefix;if(Nn){var t=Nl,r=Dl;t=(r&~(1<<32-Jo(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Sg++,0")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{Rb=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?pm(n):""}function xY(n){switch(n.tag){case 5:return pm(n.type);case 16:return pm("Lazy");case 13:return pm("Suspense");case 19:return pm("SuspenseList");case 0:case 2:case 15:return n=Ub(n.type,!1),n;case 11:return n=Ub(n.type.render,!1),n;case 1:return n=Ub(n.type,!0),n;default:return""}}function HS(n){if(n==null)return null;if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case wh:return"Fragment";case yh:return"Portal";case NS:return"Profiler";case wI:return"StrictMode";case OS:return"Suspense";case kS:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case AQ:return(n.displayName||"Context")+".Consumer";case cQ:return(n._context.displayName||"Context")+".Provider";case _I:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case xI:return e=n.displayName||null,e!==null?e:HS(n.type)||"Memo";case Lc:e=n._payload,n=n._init;try{return HS(n(e))}catch{}}return null}function bY(n){var e=n.type;switch(n.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return n=e.render,n=n.displayName||n.name||"",e.displayName||(n!==""?"ForwardRef("+n+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return HS(e);case 8:return e===wI?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pA(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function fQ(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function EY(n){var e=fQ(n)?"checked":"value",t=Object.getOwnPropertyDescriptor(n.constructor.prototype,e),r=""+n[e];if(!n.hasOwnProperty(e)&&typeof t<"u"&&typeof t.get=="function"&&typeof t.set=="function"){var i=t.get,s=t.set;return Object.defineProperty(n,e,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(n,e,{enumerable:t.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){n._valueTracker=null,delete n[e]}}}}function Y0(n){n._valueTracker||(n._valueTracker=EY(n))}function hQ(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=fQ(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function t_(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}function QS(n,e){var t=e.checked;return Yn({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function FF(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=pA(e.value!=null?e.value:t),n._wrapperState={initialChecked:r,initialValue:t,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function dQ(n,e){e=e.checked,e!=null&&yI(n,"checked",e,!1)}function zS(n,e){dQ(n,e);var t=pA(e.value),r=e.type;if(t!=null)r==="number"?(t===0&&n.value===""||n.value!=t)&&(n.value=""+t):n.value!==""+t&&(n.value=""+t);else if(r==="submit"||r==="reset"){n.removeAttribute("value");return}e.hasOwnProperty("value")?GS(n,e.type,t):e.hasOwnProperty("defaultValue")&&GS(n,e.type,pA(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function PF(n,e,t){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+n._wrapperState.initialValue,t||e===n.value||(n.value=e),n.defaultValue=e}t=n.name,t!==""&&(n.name=""),n.defaultChecked=!!n._wrapperState.initialChecked,t!==""&&(n.name=t)}function GS(n,e,t){(e!=="number"||t_(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var mm=Array.isArray;function Kh(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=$0.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function pg(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Hm={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},BY=["Webkit","ms","Moz","O"];Object.keys(Hm).forEach(function(n){BY.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Hm[e]=Hm[n]})});function vQ(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Hm.hasOwnProperty(n)&&Hm[n]?(""+e).trim():e+"px"}function yQ(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=vQ(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var SY=Yn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function WS(n,e){if(e){if(SY[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(De(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(De(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(De(61))}if(e.style!=null&&typeof e.style!="object")throw Error(De(62))}}function KS(n,e){if(n.indexOf("-")===-1)return typeof e.is=="string";switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var XS=null;function bI(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var YS=null,Xh=null,Yh=null;function NF(n){if(n=h0(n)){if(typeof YS!="function")throw Error(De(280));var e=n.stateNode;e&&(e=Vx(e),YS(n.stateNode,n.type,e))}}function wQ(n){Xh?Yh?Yh.push(n):Yh=[n]:Xh=n}function _Q(){if(Xh){var n=Xh,e=Yh;if(Yh=Xh=null,NF(n),e)for(n=0;n>>=0,n===0?32:31-(NY(n)/OY|0)|0}var Z0=64,q0=4194304;function gm(n){switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return n&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return n&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return n}}function s_(n,e){var t=n.pendingLanes;if(t===0)return 0;var r=0,i=n.suspendedLanes,s=n.pingedLanes,o=t&268435455;if(o!==0){var a=o&~i;a!==0?r=gm(a):(s&=o,s!==0&&(r=gm(s)))}else o=t&~i,o!==0?r=gm(o):s!==0&&(r=gm(s));if(r===0)return 0;if(e!==0&&e!==r&&!(e&i)&&(i=r&-r,s=e&-e,i>=s||i===16&&(s&4194240)!==0))return e;if(r&4&&(r|=t&16),e=n.entangledLanes,e!==0)for(n=n.entanglements,e&=r;0t;t++)e.push(n);return e}function u0(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-ea(e),n[e]=t}function zY(n,e){var t=n.pendingLanes&~e;n.pendingLanes=e,n.suspendedLanes=0,n.pingedLanes=0,n.expiredLanes&=e,n.mutableReadLanes&=e,n.entangledLanes&=e,e=n.entanglements;var r=n.eventTimes;for(n=n.expirationTimes;0=zm),WF=String.fromCharCode(32),KF=!1;function QQ(n,e){switch(n){case"keyup":return m$.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zQ(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var _h=!1;function v$(n,e){switch(n){case"compositionend":return zQ(e);case"keypress":return e.which!==32?null:(KF=!0,WF);case"textInput":return n=e.data,n===WF&&KF?null:n;default:return null}}function y$(n,e){if(_h)return n==="compositionend"||!RI&&QQ(n,e)?(n=kQ(),cw=CI=Vc=null,_h=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:t,offset:e-n};n=r}e:{for(;t;){if(t.nextSibling){t=t.nextSibling;break e}t=t.parentNode}t=void 0}t=ZF(t)}}function WQ(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?WQ(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function KQ(){for(var n=window,e=t_();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=t_(n.document)}return e}function UI(n){var e=n&&n.nodeName&&n.nodeName.toLowerCase();return e&&(e==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||e==="textarea"||n.contentEditable==="true")}function C$(n){var e=KQ(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&WQ(t.ownerDocument.documentElement,t)){if(r!==null&&UI(t)){if(e=r.start,n=r.end,n===void 0&&(n=e),"selectionStart"in t)t.selectionStart=e,t.selectionEnd=Math.min(n,t.value.length);else if(n=(e=t.ownerDocument||document)&&e.defaultView||window,n.getSelection){n=n.getSelection();var i=t.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!n.extend&&s>r&&(i=r,r=s,s=i),i=qF(t,s);var o=qF(t,r);i&&o&&(n.rangeCount!==1||n.anchorNode!==i.node||n.anchorOffset!==i.offset||n.focusNode!==o.node||n.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),n.removeAllRanges(),s>r?(n.addRange(e),n.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),n.addRange(e)))}}for(e=[],n=t;n=n.parentNode;)n.nodeType===1&&e.push({element:n,left:n.scrollLeft,top:n.scrollTop});for(typeof t.focus=="function"&&t.focus(),t=0;t=document.documentMode,xh=null,tM=null,Vm=null,nM=!1;function JF(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;nM||xh==null||xh!==t_(r)||(r=xh,"selectionStart"in r&&UI(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Vm&&_g(Vm,r)||(Vm=r,r=l_(tM,"onSelect"),0Bh||(n.current=lM[Bh],lM[Bh]=null,Bh--)}function En(n,e){Bh++,lM[Bh]=n.current,n.current=e}var mA={},Mi=CA(mA),Ji=CA(!1),Su=mA;function gd(n,e){var t=n.type.contextTypes;if(!t)return mA;var r=n.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in t)i[s]=e[s];return r&&(n=n.stateNode,n.__reactInternalMemoizedUnmaskedChildContext=e,n.__reactInternalMemoizedMaskedChildContext=i),i}function es(n){return n=n.childContextTypes,n!=null}function A_(){In(Ji),In(Mi)}function oP(n,e,t){if(Mi.current!==mA)throw Error(De(168));En(Mi,e),En(Ji,t)}function n5(n,e,t){var r=n.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return t;r=r.getChildContext();for(var i in r)if(!(i in e))throw Error(De(108,bY(n)||"Unknown",i));return Yn({},t,r)}function u_(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||mA,Su=Mi.current,En(Mi,n),En(Ji,Ji.current),!0}function aP(n,e,t){var r=n.stateNode;if(!r)throw Error(De(169));t?(n=n5(n,e,Su),r.__reactInternalMemoizedMergedChildContext=n,In(Ji),In(Mi),En(Mi,n)):In(Ji),En(Ji,t)}var Fl=null,jx=!1,Wb=!1;function r5(n){Fl===null?Fl=[n]:Fl.push(n)}function H$(n){jx=!0,r5(n)}function TA(){if(!Wb&&Fl!==null){Wb=!0;var n=0,e=dn;try{var t=Fl;for(dn=1;n>=o,i-=o,kl=1<<32-ea(e)+i|t<S?(I=B,B=null):I=B.sibling;var M=f(p,B,w[S],_);if(M===null){B===null&&(B=I);break}n&&B&&M.alternate===null&&e(p,B),v=s(M,v,S),b===null?x=M:b.sibling=M,b=M,B=I}if(S===w.length)return t(p,B),Nn&&qA(p,S),x;if(B===null){for(;SS?(I=B,B=null):I=B.sibling;var P=f(p,B,M.value,_);if(P===null){B===null&&(B=I);break}n&&B&&P.alternate===null&&e(p,B),v=s(P,v,S),b===null?x=P:b.sibling=P,b=P,B=I}if(M.done)return t(p,B),Nn&&qA(p,S),x;if(B===null){for(;!M.done;S++,M=w.next())M=u(p,M.value,_),M!==null&&(v=s(M,v,S),b===null?x=M:b.sibling=M,b=M);return Nn&&qA(p,S),x}for(B=r(p,B);!M.done;S++,M=w.next())M=h(B,p,S,M.value,_),M!==null&&(n&&M.alternate!==null&&B.delete(M.key===null?S:M.key),v=s(M,v,S),b===null?x=M:b.sibling=M,b=M);return n&&B.forEach(function(D){return e(p,D)}),Nn&&qA(p,S),x}function g(p,v,w,_){if(typeof w=="object"&&w!==null&&w.type===wh&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case X0:e:{for(var x=w.key,b=v;b!==null;){if(b.key===x){if(x=w.type,x===wh){if(b.tag===7){t(p,b.sibling),v=i(b,w.props.children),v.return=p,p=v;break e}}else if(b.elementType===x||typeof x=="object"&&x!==null&&x.$$typeof===Lc&&AP(x)===b.type){t(p,b.sibling),v=i(b,w.props),v.ref=Ep(p,b,w),v.return=p,p=v;break e}t(p,b);break}else e(p,b);b=b.sibling}w.type===wh?(v=mu(w.props.children,p.mode,_,w.key),v.return=p,p=v):(_=gw(w.type,w.key,w.props,null,p.mode,_),_.ref=Ep(p,v,w),_.return=p,p=_)}return o(p);case yh:e:{for(b=w.key;v!==null;){if(v.key===b)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){t(p,v.sibling),v=i(v,w.children||[]),v.return=p,p=v;break e}else{t(p,v);break}else e(p,v);v=v.sibling}v=eE(w,p.mode,_),v.return=p,p=v}return o(p);case Lc:return b=w._init,g(p,v,b(w._payload),_)}if(mm(w))return d(p,v,w,_);if(yp(w))return m(p,v,w,_);sv(p,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(t(p,v.sibling),v=i(v,w),v.return=p,p=v):(t(p,v),v=Jb(w,p.mode,_),v.return=p,p=v),o(p)):t(p,v)}return g}var yd=a5(!0),l5=a5(!1),d_=CA(null),p_=null,Ch=null,DI=null;function NI(){DI=Ch=p_=null}function OI(n){var e=d_.current;In(d_),n._currentValue=e}function uM(n,e,t){for(;n!==null;){var r=n.alternate;if((n.childLanes&e)!==e?(n.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),n===t)break;n=n.return}}function Zh(n,e){p_=n,DI=Ch=null,n=n.dependencies,n!==null&&n.firstContext!==null&&(n.lanes&e&&(Zi=!0),n.firstContext=null)}function wo(n){var e=n._currentValue;if(DI!==n)if(n={context:n,memoizedValue:e,next:null},Ch===null){if(p_===null)throw Error(De(308));Ch=n,p_.dependencies={lanes:0,firstContext:n}}else Ch=Ch.next=n;return e}var cu=null;function kI(n){cu===null?cu=[n]:cu.push(n)}function c5(n,e,t,r){var i=e.interleaved;return i===null?(t.next=t,kI(e)):(t.next=i.next,i.next=t),e.interleaved=t,ql(n,r)}function ql(n,e){n.lanes|=e;var t=n.alternate;for(t!==null&&(t.lanes|=e),t=n,n=n.return;n!==null;)n.childLanes|=e,t=n.alternate,t!==null&&(t.childLanes|=e),t=n,n=n.return;return t.tag===3?t.stateNode:null}var Dc=!1;function HI(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function A5(n,e){n=n.updateQueue,e.updateQueue===n&&(e.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,effects:n.effects})}function Vl(n,e){return{eventTime:n,lane:e,tag:0,payload:null,callback:null,next:null}}function sA(n,e,t){var r=n.updateQueue;if(r===null)return null;if(r=r.shared,Wt&2){var i=r.pending;return i===null?e.next=e:(e.next=i.next,i.next=e),r.pending=e,ql(n,t)}return i=r.interleaved,i===null?(e.next=e,kI(r)):(e.next=i.next,i.next=e),r.interleaved=e,ql(n,t)}function uw(n,e,t){if(e=e.updateQueue,e!==null&&(e=e.shared,(t&4194240)!==0)){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,BI(n,t)}}function uP(n,e){var t=n.updateQueue,r=n.alternate;if(r!==null&&(r=r.updateQueue,t===r)){var i=null,s=null;if(t=t.firstBaseUpdate,t!==null){do{var o={eventTime:t.eventTime,lane:t.lane,tag:t.tag,payload:t.payload,callback:t.callback,next:null};s===null?i=s=o:s=s.next=o,t=t.next}while(t!==null);s===null?i=s=e:s=s.next=e}else i=s=e;t={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},n.updateQueue=t;return}n=t.lastBaseUpdate,n===null?t.firstBaseUpdate=e:n.next=e,t.lastBaseUpdate=e}function m_(n,e,t,r){var i=n.updateQueue;Dc=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var A=n.alternate;A!==null&&(A=A.updateQueue,a=A.lastBaseUpdate,a!==o&&(a===null?A.firstBaseUpdate=c:a.next=c,A.lastBaseUpdate=l))}if(s!==null){var u=i.baseState;o=0,A=c=l=null,a=s;do{var f=a.lane,h=a.eventTime;if((r&f)===f){A!==null&&(A=A.next={eventTime:h,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var d=n,m=a;switch(f=e,h=t,m.tag){case 1:if(d=m.payload,typeof d=="function"){u=d.call(h,u,f);break e}u=d;break e;case 3:d.flags=d.flags&-65537|128;case 0:if(d=m.payload,f=typeof d=="function"?d.call(h,u,f):d,f==null)break e;u=Yn({},u,f);break e;case 2:Dc=!0}}a.callback!==null&&a.lane!==0&&(n.flags|=64,f=i.effects,f===null?i.effects=[a]:f.push(a))}else h={eventTime:h,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},A===null?(c=A=h,l=u):A=A.next=h,o|=f;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;f=a,a=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(A===null&&(l=u),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=A,e=i.shared.interleaved,e!==null){i=e;do o|=i.lane,i=i.next;while(i!==e)}else s===null&&(i.shared.lanes=0);Tu|=o,n.lanes=o,n.memoizedState=u}}function fP(n,e,t){if(n=e.effects,e.effects=null,n!==null)for(e=0;et?t:4,n(!0);var r=Xb.transition;Xb.transition={};try{n(!1),e()}finally{dn=t,Xb.transition=r}}function M5(){return _o().memoizedState}function V$(n,e,t){var r=aA(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},C5(n))T5(e,t);else if(t=c5(n,e,t,r),t!==null){var i=ki();ta(t,n,r,i),I5(t,e,r)}}function j$(n,e,t){var r=aA(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(C5(n))T5(e,i);else{var s=n.alternate;if(n.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var o=e.lastRenderedState,a=s(o,t);if(i.hasEagerState=!0,i.eagerState=a,sa(a,o)){var l=e.interleaved;l===null?(i.next=i,kI(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=c5(n,e,i,r),t!==null&&(i=ki(),ta(t,n,r,i),I5(t,e,r))}}function C5(n){var e=n.alternate;return n===Xn||e!==null&&e===Xn}function T5(n,e){jm=v_=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function I5(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,BI(n,t)}}var y_={readContext:wo,useCallback:Ai,useContext:Ai,useEffect:Ai,useImperativeHandle:Ai,useInsertionEffect:Ai,useLayoutEffect:Ai,useMemo:Ai,useReducer:Ai,useRef:Ai,useState:Ai,useDebugValue:Ai,useDeferredValue:Ai,useTransition:Ai,useMutableSource:Ai,useSyncExternalStore:Ai,useId:Ai,unstable_isNewReconciler:!1},W$={readContext:wo,useCallback:function(n,e){return xa().memoizedState=[n,e===void 0?null:e],n},useContext:wo,useEffect:dP,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,hw(4194308,4,x5.bind(null,e,n),t)},useLayoutEffect:function(n,e){return hw(4194308,4,n,e)},useInsertionEffect:function(n,e){return hw(4,2,n,e)},useMemo:function(n,e){var t=xa();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=xa();return e=t!==void 0?t(e):e,r.memoizedState=r.baseState=e,n={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:e},r.queue=n,n=n.dispatch=V$.bind(null,Xn,n),[r.memoizedState,n]},useRef:function(n){var e=xa();return n={current:n},e.memoizedState=n},useState:hP,useDebugValue:XI,useDeferredValue:function(n){return xa().memoizedState=n},useTransition:function(){var n=hP(!1),e=n[0];return n=G$.bind(null,n[1]),xa().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Xn,i=xa();if(Nn){if(t===void 0)throw Error(De(407));t=t()}else{if(t=e(),Xr===null)throw Error(De(349));Cu&30||d5(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,dP(m5.bind(null,r,s,n),[n]),r.flags|=2048,Tg(9,p5.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=xa(),e=Xr.identifierPrefix;if(Nn){var t=Hl,r=kl;t=(r&~(1<<32-ea(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Mg++,0<\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=o.createElement(t,{is:r.is}):(n=o.createElement(t),t==="select"&&(o=n,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):n=o.createElementNS(n,t),n[Ca]=e,n[bg]=r,O5(n,e,!1,!1),e.stateNode=n;e:{switch(o=VS(t,r),t){case"dialog":Bn("cancel",n),Bn("close",n),i=r;break;case"iframe":case"object":case"embed":Bn("load",n),i=r;break;case"video":case"audio":for(i=0;iwd&&(e.flags|=128,r=!0,Ep(s,!1),e.lanes=4194304)}else{if(!r)if(n=d_(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Ep(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Nn)return Ai(e),null}else 2*hr()-s.renderingStartTime>wd&&t!==1073741824&&(e.flags|=128,r=!0,Ep(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=hr(),e.sibling=null,t=Vn.current,En(Vn,r?t&1|2:t&1),e):(Ai(e),null);case 22:case 23:return ZI(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?ws&1073741824&&(Ai(e),e.subtreeFlags&6&&(e.flags|=8192)):Ai(e),null;case 24:return null;case 25:return null}throw Error(De(156,e.tag))}function q$(n,e){switch(RI(e),e.tag){case 1:return Ji(e.type)&&a_(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return vd(),In(qi),In(Bi),HI(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return kI(e),null;case 13:if(In(Vn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(De(340));md()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return In(Vn),null;case 4:return vd(),null;case 10:return LI(e.type._context),null;case 22:case 23:return ZI(),null;case 24:return null;default:return null}}var sv=!1,vi=!1,J$=typeof WeakSet=="function"?WeakSet:Set,Ze=null;function Sh(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Jn(n,e,r)}else t.current=null}function gM(n,e,t){try{t()}catch(r){Jn(n,e,r)}}var bP=!1;function eZ(n,e){if(eM=r_,n=jQ(),TI(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,A=0,u=n,f=null;t:for(;;){for(var h;u!==t||i!==0&&u.nodeType!==3||(a=o+i),u!==s||r!==0&&u.nodeType!==3||(l=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(h=u.firstChild)!==null;)f=u,u=h;for(;;){if(u===n)break t;if(f===t&&++c===i&&(a=o),f===s&&++A===r&&(l=o),(h=u.nextSibling)!==null)break;u=f,f=u.parentNode}u=h}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(tM={focusedElem:n,selectionRange:t},r_=!1,Ze=e;Ze!==null;)if(e=Ze,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Ze=n;else for(;Ze!==null;){e=Ze;try{var d=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var m=d.memoizedProps,g=d.memoizedState,p=e.stateNode,v=p.getSnapshotBeforeUpdate(e.elementType===e.type?m:Vo(e.type,m),g);p.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(De(163))}}catch(_){Jn(e,e.return,_)}if(n=e.sibling,n!==null){n.return=e.return,Ze=n;break}Ze=e.return}return d=bP,bP=!1,d}function jm(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var s=i.destroy;i.destroy=void 0,s!==void 0&&gM(e,t,s)}i=i.next}while(i!==r)}}function Wx(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function vM(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function Q5(n){var e=n.alternate;e!==null&&(n.alternate=null,Q5(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Ca],delete e[bg],delete e[iM],delete e[D$],delete e[N$])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function z5(n){return n.tag===5||n.tag===3||n.tag===4}function EP(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||z5(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function yM(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=o_));else if(r!==4&&(n=n.child,n!==null))for(yM(n,e,t),n=n.sibling;n!==null;)yM(n,e,t),n=n.sibling}function wM(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(wM(n,e,t),n=n.sibling;n!==null;)wM(n,e,t),n=n.sibling}var ei=null,Wo=!1;function mc(n,e,t){for(t=t.child;t!==null;)G5(n,e,t),t=t.sibling}function G5(n,e,t){if(Qa&&typeof Qa.onCommitFiberUnmount=="function")try{Qa.onCommitFiberUnmount(Ox,t)}catch{}switch(t.tag){case 5:vi||Sh(t,e);case 6:var r=ei,i=Wo;ei=null,mc(n,e,t),ei=r,Wo=i,ei!==null&&(Wo?(n=ei,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):ei.removeChild(t.stateNode));break;case 18:ei!==null&&(Wo?(n=ei,t=t.stateNode,n.nodeType===8?zb(n.parentNode,t):n.nodeType===1&&zb(n,t),vg(n)):zb(ei,t.stateNode));break;case 4:r=ei,i=Wo,ei=t.stateNode.containerInfo,Wo=!0,mc(n,e,t),ei=r,Wo=i;break;case 0:case 11:case 14:case 15:if(!vi&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&gM(t,e,o),i=i.next}while(i!==r)}mc(n,e,t);break;case 1:if(!vi&&(Sh(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){Jn(t,e,a)}mc(n,e,t);break;case 21:mc(n,e,t);break;case 22:t.mode&1?(vi=(r=vi)||t.memoizedState!==null,mc(n,e,t),vi=r):mc(n,e,t);break;default:mc(n,e,t)}}function BP(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new J$),e.forEach(function(r){var i=cZ.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Uo(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=hr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*nZ(r/1960))-r,10n?16:n,Gc===null)var r=!1;else{if(n=Gc,Gc=null,y_=0,Wt&6)throw Error(De(331));var i=Wt;for(Wt|=4,Ze=n.current;Ze!==null;){var s=Ze,o=s.child;if(Ze.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lhr()-YI?hu(n,0):XI|=t),es(n,e)}function Z5(n,e){e===0&&(n.mode&1?(e=$0,$0<<=1,!($0&130023424)&&($0=4194304)):e=1);var t=Ni();n=Yl(n,e),n!==null&&(c0(n,e,t),es(n,t))}function lZ(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),Z5(n,t)}function cZ(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(De(314))}r!==null&&r.delete(e),Z5(n,t)}var q5;q5=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||qi.current)$i=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return $i=!1,$$(n,e,t);$i=!!(n.flags&131072)}else $i=!1,Nn&&e.flags&1048576&&n5(e,A_,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;uw(n,e),n=e.pendingProps;var i=pd(e,Bi.current);Xh(e,t),i=zI(null,e,r,n,i,t);var s=GI();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ji(r)?(s=!0,l_(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,NI(e),i.updater=jx,e.stateNode=i,i._reactInternals=e,AM(e,r,n,t),e=hM(null,e,r,!0,s,t)):(e.tag=0,Nn&&s&&II(e),Ui(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(uw(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=uZ(r),n=Vo(r,n),i){case 0:e=fM(null,e,r,n,t);break e;case 1:e=wP(null,e,r,n,t);break e;case 11:e=vP(null,e,r,n,t);break e;case 14:e=yP(null,e,r,Vo(r.type,n),t);break e}throw Error(De(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Vo(r,i),fM(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Vo(r,i),wP(n,e,r,i,t);case 3:e:{if(L5(e),n===null)throw Error(De(387));r=e.pendingProps,s=e.memoizedState,i=s.element,l5(n,e),h_(e,r,null,t);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=yd(Error(De(423)),e),e=_P(n,e,r,t,i);break e}else if(r!==i){i=yd(Error(De(424)),e),e=_P(n,e,r,t,i);break e}else for(Ms=nA(e.stateNode.containerInfo.firstChild),Fs=e,Nn=!0,Xo=null,t=o5(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(md(),r===i){e=$l(n,e,t);break e}Ui(n,e,r,t)}e=e.child}return e;case 5:return c5(e),n===null&&aM(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,nM(r,i)?o=null:s!==null&&nM(r,s)&&(e.flags|=32),P5(n,e),Ui(n,e,o,t),e.child;case 6:return n===null&&aM(e),null;case 13:return D5(n,e,t);case 4:return OI(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=gd(e,null,r,t):Ui(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Vo(r,i),vP(n,e,r,i,t);case 7:return Ui(n,e,e.pendingProps,t),e.child;case 8:return Ui(n,e,e.pendingProps.children,t),e.child;case 12:return Ui(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,En(u_,r._currentValue),r._currentValue=o,s!==null)if(ia(s.value,o)){if(s.children===i.children&&!qi.current){e=$l(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Ql(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var A=c.pending;A===null?l.next=l:(l.next=A.next,A.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),lM(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(De(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),lM(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Ui(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Xh(e,t),i=yo(i),r=r(i),e.flags|=1,Ui(n,e,r,t),e.child;case 14:return r=e.type,i=Vo(r,e.pendingProps),i=Vo(r.type,i),yP(n,e,r,i,t);case 15:return U5(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:Vo(r,i),uw(n,e),e.tag=1,Ji(r)?(n=!0,l_(e)):n=!1,Xh(e,t),T5(e,r,i),AM(e,r,i,t),hM(null,e,r,!0,n,t);case 19:return N5(n,e,t);case 22:return F5(n,e,t)}throw Error(De(156,e.tag))};function J5(n,e){return SQ(n,e)}function AZ(n,e,t,r){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ao(n,e,t,r){return new AZ(n,e,t,r)}function JI(n){return n=n.prototype,!(!n||!n.isReactComponent)}function uZ(n){if(typeof n=="function")return JI(n)?1:0;if(n!=null){if(n=n.$$typeof,n===vI)return 11;if(n===yI)return 14}return 2}function oA(n,e){var t=n.alternate;return t===null?(t=ao(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function dw(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")JI(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case gh:return du(t.children,i,s,e);case gI:o=8,i|=8;break;case PS:return n=ao(12,t,e,i|2),n.elementType=PS,n.lanes=s,n;case LS:return n=ao(13,t,e,i),n.elementType=LS,n.lanes=s,n;case DS:return n=ao(19,t,e,i),n.elementType=DS,n.lanes=s,n;case cQ:return Xx(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case aQ:o=10;break e;case lQ:o=9;break e;case vI:o=11;break e;case yI:o=14;break e;case Fc:o=16,r=null;break e}throw Error(De(130,n==null?n:typeof n,""))}return e=ao(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function du(n,e,t,r){return n=ao(7,n,r,e),n.lanes=t,n}function Xx(n,e,t,r){return n=ao(22,n,r,e),n.elementType=cQ,n.lanes=t,n.stateNode={isHidden:!1},n}function $b(n,e,t){return n=ao(6,n,null,e),n.lanes=t,n}function Zb(n,e,t){return e=ao(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function fZ(n,e,t,r,i){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Rb(0),this.expirationTimes=Rb(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rb(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function eR(n,e,t,r,i,s,o,a,l){return n=new fZ(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=ao(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},NI(s),n}function hZ(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r6)}catch(n){console.error(n)}}r6(),rQ.exports=Gs;var vZ=rQ.exports,FP=vZ;US.createRoot=FP.createRoot,US.hydrateRoot=FP.hydrateRoot;const yZ="/assets/cc_bgm_balanced-f542698c.wav",Bo=xe.createContext(),wZ=({children:n})=>{const[e,t]=xe.useState(!1),r=q.useRef(null),i=()=>{t(!1);const o=r.current;o.src=yZ,o.loop=!0,o.volume=0,o.play();let a=0;const l=5,c=setInterval(()=>{a=Math.max(a+1/(10*l*60),1),a>=1&&clearInterval(c),o.volume=a},1e3/60)},s=()=>{t(!0),r.current.pause()};return Q.jsxs(Bo.Provider,{value:{isMute:e,setMute:t,enableAudio:i,disableAudio:s},children:[Q.jsx("audio",{ref:r}),n]})},_Z=xe.createContext(),xZ=n=>{const[e,t]=xe.useState(null),[r,i]=xe.useState(null),[s,o]=xe.useState(!1),[a,l]=xe.useState([]);return Q.jsx(_Z.Provider,{value:{walletAddress:e,setWalletAddress:t,ensName:r,setEnsName:i,connected:s,setConnected:o,OTTokens:a,setOTTokens:l},children:n.children})};function Cl(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function i6(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}/*! +`+s.stack}return{value:n,source:e,stack:i,digest:null}}function Zb(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function dM(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var Y$=typeof WeakMap=="function"?WeakMap:Map;function U5(n,e,t){t=Vl(-1,t),t.tag=3,t.payload={element:null};var r=e.value;return t.callback=function(){__||(__=!0,EM=r),dM(n,e)},t}function F5(n,e,t){t=Vl(-1,t),t.tag=3;var r=n.type.getDerivedStateFromError;if(typeof r=="function"){var i=e.value;t.payload=function(){return r(i)},t.callback=function(){dM(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){dM(n,e),typeof r!="function"&&(oA===null?oA=new Set([this]):oA.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function gP(n,e,t){var r=n.pingCache;if(r===null){r=n.pingCache=new Y$;var i=new Set;r.set(e,i)}else i=r.get(e),i===void 0&&(i=new Set,r.set(e,i));i.has(t)||(i.add(t),n=cZ.bind(null,n,e,t),e.then(n,n))}function vP(n){do{var e;if((e=n.tag===13)&&(e=n.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return n;n=n.return}while(n!==null);return null}function yP(n,e,t,r,i){return n.mode&1?(n.flags|=65536,n.lanes=i,n):(n===e?n.flags|=65536:(n.flags|=128,t.flags|=131072,t.flags&=-52805,t.tag===1&&(t.alternate===null?t.tag=17:(e=Vl(-1,1),e.tag=2,sA(t,e,1))),t.lanes|=1),n)}var $$=lc.ReactCurrentOwner,Zi=!1;function Pi(n,e,t,r){e.child=n===null?l5(e,null,t,r):yd(e,n.child,t,r)}function wP(n,e,t,r,i){t=t.render;var s=e.ref;return Zh(e,i),r=jI(n,e,t,r,s,i),t=WI(),n!==null&&!Zi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,Jl(n,e,i)):(Nn&&t&&FI(e),e.flags|=1,Pi(n,e,r,i),e.child)}function _P(n,e,t,r,i){if(n===null){var s=t.type;return typeof s=="function"&&!nR(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,P5(n,e,s,r,i)):(n=gw(t.type,null,r,e,e.mode,i),n.ref=e.ref,n.return=e,e.child=n)}if(s=n.child,!(n.lanes&i)){var o=s.memoizedProps;if(t=t.compare,t=t!==null?t:_g,t(o,r)&&n.ref===e.ref)return Jl(n,e,i)}return e.flags|=1,n=lA(s,r),n.ref=e.ref,n.return=e,e.child=n}function P5(n,e,t,r,i){if(n!==null){var s=n.memoizedProps;if(_g(s,r)&&n.ref===e.ref)if(Zi=!1,e.pendingProps=r=s,(n.lanes&i)!==0)n.flags&131072&&(Zi=!0);else return e.lanes=n.lanes,Jl(n,e,i)}return pM(n,e,t,r,i)}function L5(n,e,t){var r=e.pendingProps,i=r.children,s=n!==null?n.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},En(Ih,_s),_s|=t;else{if(!(t&1073741824))return n=s!==null?s.baseLanes|t:t,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:n,cachePool:null,transitions:null},e.updateQueue=null,En(Ih,_s),_s|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:t,En(Ih,_s),_s|=r}else s!==null?(r=s.baseLanes|t,e.memoizedState=null):r=t,En(Ih,_s),_s|=r;return Pi(n,e,i,t),e.child}function D5(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function pM(n,e,t,r,i){var s=es(t)?Su:Mi.current;return s=gd(e,s),Zh(e,i),t=jI(n,e,t,r,s,i),r=WI(),n!==null&&!Zi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,Jl(n,e,i)):(Nn&&r&&FI(e),e.flags|=1,Pi(n,e,t,i),e.child)}function xP(n,e,t,r,i){if(es(t)){var s=!0;u_(e)}else s=!1;if(Zh(e,i),e.stateNode===null)dw(n,e),R5(e,t,r),hM(e,t,r,i),r=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,c=t.contextType;typeof c=="object"&&c!==null?c=wo(c):(c=es(t)?Su:Mi.current,c=gd(e,c));var A=t.getDerivedStateFromProps,u=typeof A=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==c)&&mP(e,o,r,c),Dc=!1;var f=e.memoizedState;o.state=f,m_(e,r,o,i),l=e.memoizedState,a!==r||f!==l||Ji.current||Dc?(typeof A=="function"&&(fM(e,t,A,r),l=e.memoizedState),(a=Dc||pP(e,t,a,r,f,l,c))?(u||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),o.props=r,o.state=l,o.context=c,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,A5(n,e),a=e.memoizedProps,c=e.type===e.elementType?a:jo(e.type,a),o.props=c,u=e.pendingProps,f=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=wo(l):(l=es(t)?Su:Mi.current,l=gd(e,l));var h=t.getDerivedStateFromProps;(A=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==u||f!==l)&&mP(e,o,r,l),Dc=!1,f=e.memoizedState,o.state=f,m_(e,r,o,i);var d=e.memoizedState;a!==u||f!==d||Ji.current||Dc?(typeof h=="function"&&(fM(e,t,h,r),d=e.memoizedState),(c=Dc||pP(e,t,c,r,f,d,l)||!1)?(A||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,d,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,d,l)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=d),o.props=r,o.state=d,o.context=l,r=c):(typeof o.componentDidUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===n.memoizedProps&&f===n.memoizedState||(e.flags|=1024),r=!1)}return mM(n,e,t,r,s,i)}function mM(n,e,t,r,i,s){D5(n,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&aP(e,t,!1),Jl(n,e,s);r=e.stateNode,$$.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,n!==null&&o?(e.child=yd(e,n.child,null,s),e.child=yd(e,null,a,s)):Pi(n,e,a,s),e.memoizedState=r.state,i&&aP(e,t,!0),e.child}function N5(n){var e=n.stateNode;e.pendingContext?oP(n,e.pendingContext,e.pendingContext!==e.context):e.context&&oP(n,e.context,!1),QI(n,e.containerInfo)}function bP(n,e,t,r,i){return vd(),LI(i),e.flags|=256,Pi(n,e,t,r),e.child}var gM={dehydrated:null,treeContext:null,retryLane:0};function vM(n){return{baseLanes:n,cachePool:null,transitions:null}}function O5(n,e,t){var r=e.pendingProps,i=Vn.current,s=!1,o=(e.flags&128)!==0,a;if((a=o)||(a=n!==null&&n.memoizedState===null?!1:(i&2)!==0),a?(s=!0,e.flags&=-129):(n===null||n.memoizedState!==null)&&(i|=1),En(Vn,i&1),n===null)return AM(e),n=e.memoizedState,n!==null&&(n=n.dehydrated,n!==null)?(e.mode&1?n.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,n=r.fallback,s?(r=e.mode,s=e.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=$x(o,r,0,null),n=mu(n,r,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=vM(t),e.memoizedState=gM,n):YI(e,o));if(i=n.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return Z$(n,e,o,r,a,i,t);if(s){s=r.fallback,o=e.mode,i=n.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&e.child!==i?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=lA(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=lA(a,s):(s=mu(s,o,t,null),s.flags|=2),s.return=e,r.return=e,r.sibling=s,e.child=r,r=s,s=e.child,o=n.child.memoizedState,o=o===null?vM(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=gM,r}return s=n.child,n=s.sibling,r=lA(s,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=t),r.return=e,r.sibling=null,n!==null&&(t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)),e.child=r,e.memoizedState=null,r}function YI(n,e){return e=$x({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function ov(n,e,t,r){return r!==null&&LI(r),yd(e,n.child,null,t),n=YI(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function Z$(n,e,t,r,i,s,o){if(t)return e.flags&256?(e.flags&=-257,r=Zb(Error(De(422))),ov(n,e,o,r)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=$x({mode:"visible",children:r.children},i,0,null),s=mu(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&yd(e,n.child,null,o),e.child.memoizedState=vM(o),e.memoizedState=gM,s);if(!(e.mode&1))return ov(n,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(De(419)),r=Zb(s,r,void 0),ov(n,e,o,r)}if(a=(o&n.childLanes)!==0,Zi||a){if(r=Xr,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,ql(n,i),ta(r,n,i,-1))}return tR(),r=Zb(Error(De(421))),ov(n,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=n.child,e=AZ.bind(null,n),i._reactRetry=e,null):(n=s.treeContext,Cs=iA(i.nextSibling),Ps=e,Nn=!0,Yo=null,n!==null&&(ro[io++]=kl,ro[io++]=Hl,ro[io++]=Mu,kl=n.id,Hl=n.overflow,Mu=e),e=YI(e,r.children),e.flags|=4096,e)}function EP(n,e,t){n.lanes|=e;var r=n.alternate;r!==null&&(r.lanes|=e),uM(n.return,e,t)}function qb(n,e,t,r,i){var s=n.memoizedState;s===null?n.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:t,tailMode:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=t,s.tailMode=i)}function k5(n,e,t){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(Pi(n,e,r.children,t),r=Vn.current,r&2)r=r&1|2,e.flags|=128;else{if(n!==null&&n.flags&128)e:for(n=e.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&EP(n,t,e);else if(n.tag===19)EP(n,t,e);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break e;for(;n.sibling===null;){if(n.return===null||n.return===e)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}r&=1}if(En(Vn,r),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(t=e.child,i=null;t!==null;)n=t.alternate,n!==null&&g_(n)===null&&(i=t),t=t.sibling;t=i,t===null?(i=e.child,e.child=null):(i=t.sibling,t.sibling=null),qb(e,!1,i,t,s);break;case"backwards":for(t=null,i=e.child,e.child=null;i!==null;){if(n=i.alternate,n!==null&&g_(n)===null){e.child=i;break}n=i.sibling,i.sibling=t,t=i,i=n}qb(e,!0,t,null,s);break;case"together":qb(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function dw(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function Jl(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),Tu|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(De(153));if(e.child!==null){for(n=e.child,t=lA(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=lA(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function q$(n,e,t){switch(e.tag){case 3:N5(e),vd();break;case 5:u5(e);break;case 1:es(e.type)&&u_(e);break;case 4:QI(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;En(d_,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(En(Vn,Vn.current&1),e.flags|=128,null):t&e.child.childLanes?O5(n,e,t):(En(Vn,Vn.current&1),n=Jl(n,e,t),n!==null?n.sibling:null);En(Vn,Vn.current&1);break;case 19:if(r=(t&e.childLanes)!==0,n.flags&128){if(r)return k5(n,e,t);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),En(Vn,Vn.current),r)break;return null;case 22:case 23:return e.lanes=0,L5(n,e,t)}return Jl(n,e,t)}var H5,yM,Q5,z5;H5=function(n,e){for(var t=e.child;t!==null;){if(t.tag===5||t.tag===6)n.appendChild(t.stateNode);else if(t.tag!==4&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return;t=t.return}t.sibling.return=t.return,t=t.sibling}};yM=function(){};Q5=function(n,e,t,r){var i=n.memoizedProps;if(i!==r){n=e.stateNode,Au(Ga.current);var s=null;switch(t){case"input":i=QS(n,i),r=QS(n,r),s=[];break;case"select":i=Yn({},i,{value:void 0}),r=Yn({},r,{value:void 0}),s=[];break;case"textarea":i=VS(n,i),r=VS(n,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(n.onclick=c_)}WS(t,r);var o;t=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(dg.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(t||(t={}),t[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(t||(t={}),t[o]=l[o])}else t||(s||(s=[]),s.push(c,t)),t=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(dg.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Bn("scroll",n),s||a===l||(s=[])):(s=s||[]).push(c,l))}t&&(s=s||[]).push("style",t);var c=s;(e.updateQueue=c)&&(e.flags|=4)}};z5=function(n,e,t,r){t!==r&&(e.flags|=4)};function Bp(n,e){if(!Nn)switch(n.tailMode){case"hidden":e=n.tail;for(var t=null;e!==null;)e.alternate!==null&&(t=e),e=e.sibling;t===null?n.tail=null:t.sibling=null;break;case"collapsed":t=n.tail;for(var r=null;t!==null;)t.alternate!==null&&(r=t),t=t.sibling;r===null?e||n.tail===null?n.tail=null:n.tail.sibling=null:r.sibling=null}}function ui(n){var e=n.alternate!==null&&n.alternate.child===n.child,t=0,r=0;if(e)for(var i=n.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=n,i=i.sibling;else for(i=n.child;i!==null;)t|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=n,i=i.sibling;return n.subtreeFlags|=r,n.childLanes=t,e}function J$(n,e,t){var r=e.pendingProps;switch(PI(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ui(e),null;case 1:return es(e.type)&&A_(),ui(e),null;case 3:return r=e.stateNode,wd(),In(Ji),In(Mi),GI(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(n===null||n.child===null)&&(iv(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Yo!==null&&(MM(Yo),Yo=null))),yM(n,e),ui(e),null;case 5:zI(e);var i=Au(Sg.current);if(t=e.type,n!==null&&e.stateNode!=null)Q5(n,e,t,r,i),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(De(166));return ui(e),null}if(n=Au(Ga.current),iv(e)){r=e.stateNode,t=e.type;var s=e.memoizedProps;switch(r[Ta]=e,r[Eg]=s,n=(e.mode&1)!==0,t){case"dialog":Bn("cancel",r),Bn("close",r);break;case"iframe":case"object":case"embed":Bn("load",r);break;case"video":case"audio":for(i=0;i<\/script>",n=n.removeChild(n.firstChild)):typeof r.is=="string"?n=o.createElement(t,{is:r.is}):(n=o.createElement(t),t==="select"&&(o=n,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):n=o.createElementNS(n,t),n[Ta]=e,n[Eg]=r,H5(n,e,!1,!1),e.stateNode=n;e:{switch(o=KS(t,r),t){case"dialog":Bn("cancel",n),Bn("close",n),i=r;break;case"iframe":case"object":case"embed":Bn("load",n),i=r;break;case"video":case"audio":for(i=0;ixd&&(e.flags|=128,r=!0,Bp(s,!1),e.lanes=4194304)}else{if(!r)if(n=g_(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Bp(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Nn)return ui(e),null}else 2*hr()-s.renderingStartTime>xd&&t!==1073741824&&(e.flags|=128,r=!0,Bp(s,!1),e.lanes=4194304);s.isBackwards?(o.sibling=e.child,e.child=o):(t=s.last,t!==null?t.sibling=o:e.child=o,s.last=o)}return s.tail!==null?(e=s.tail,s.rendering=e,s.tail=e.sibling,s.renderingStartTime=hr(),e.sibling=null,t=Vn.current,En(Vn,r?t&1|2:t&1),e):(ui(e),null);case 22:case 23:return eR(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?_s&1073741824&&(ui(e),e.subtreeFlags&6&&(e.flags|=8192)):ui(e),null;case 24:return null;case 25:return null}throw Error(De(156,e.tag))}function eZ(n,e){switch(PI(e),e.tag){case 1:return es(e.type)&&A_(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return wd(),In(Ji),In(Mi),GI(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return zI(e),null;case 13:if(In(Vn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(De(340));vd()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return In(Vn),null;case 4:return wd(),null;case 10:return OI(e.type._context),null;case 22:case 23:return eR(),null;case 24:return null;default:return null}}var av=!1,yi=!1,tZ=typeof WeakSet=="function"?WeakSet:Set,Ze=null;function Th(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Jn(n,e,r)}else t.current=null}function wM(n,e,t){try{t()}catch(r){Jn(n,e,r)}}var BP=!1;function nZ(n,e){if(rM=o_,n=KQ(),UI(n)){if("selectionStart"in n)var t={start:n.selectionStart,end:n.selectionEnd};else e:{t=(t=n.ownerDocument)&&t.defaultView||window;var r=t.getSelection&&t.getSelection();if(r&&r.rangeCount!==0){t=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{t.nodeType,s.nodeType}catch{t=null;break e}var o=0,a=-1,l=-1,c=0,A=0,u=n,f=null;t:for(;;){for(var h;u!==t||i!==0&&u.nodeType!==3||(a=o+i),u!==s||r!==0&&u.nodeType!==3||(l=o+r),u.nodeType===3&&(o+=u.nodeValue.length),(h=u.firstChild)!==null;)f=u,u=h;for(;;){if(u===n)break t;if(f===t&&++c===i&&(a=o),f===s&&++A===r&&(l=o),(h=u.nextSibling)!==null)break;u=f,f=u.parentNode}u=h}t=a===-1||l===-1?null:{start:a,end:l}}else t=null}t=t||{start:0,end:0}}else t=null;for(iM={focusedElem:n,selectionRange:t},o_=!1,Ze=e;Ze!==null;)if(e=Ze,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Ze=n;else for(;Ze!==null;){e=Ze;try{var d=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(d!==null){var m=d.memoizedProps,g=d.memoizedState,p=e.stateNode,v=p.getSnapshotBeforeUpdate(e.elementType===e.type?m:jo(e.type,m),g);p.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(De(163))}}catch(_){Jn(e,e.return,_)}if(n=e.sibling,n!==null){n.return=e.return,Ze=n;break}Ze=e.return}return d=BP,BP=!1,d}function Wm(n,e,t){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&n)===n){var s=i.destroy;i.destroy=void 0,s!==void 0&&wM(e,t,s)}i=i.next}while(i!==r)}}function Xx(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function _M(n){var e=n.ref;if(e!==null){var t=n.stateNode;switch(n.tag){case 5:n=t;break;default:n=t}typeof e=="function"?e(n):e.current=n}}function G5(n){var e=n.alternate;e!==null&&(n.alternate=null,G5(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Ta],delete e[Eg],delete e[aM],delete e[O$],delete e[k$])),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}function V5(n){return n.tag===5||n.tag===3||n.tag===4}function SP(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||V5(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function xM(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.nodeType===8?t.parentNode.insertBefore(n,e):t.insertBefore(n,e):(t.nodeType===8?(e=t.parentNode,e.insertBefore(n,t)):(e=t,e.appendChild(n)),t=t._reactRootContainer,t!=null||e.onclick!==null||(e.onclick=c_));else if(r!==4&&(n=n.child,n!==null))for(xM(n,e,t),n=n.sibling;n!==null;)xM(n,e,t),n=n.sibling}function bM(n,e,t){var r=n.tag;if(r===5||r===6)n=n.stateNode,e?t.insertBefore(n,e):t.appendChild(n);else if(r!==4&&(n=n.child,n!==null))for(bM(n,e,t),n=n.sibling;n!==null;)bM(n,e,t),n=n.sibling}var ti=null,Ko=!1;function vc(n,e,t){for(t=t.child;t!==null;)j5(n,e,t),t=t.sibling}function j5(n,e,t){if(za&&typeof za.onCommitFiberUnmount=="function")try{za.onCommitFiberUnmount(Hx,t)}catch{}switch(t.tag){case 5:yi||Th(t,e);case 6:var r=ti,i=Ko;ti=null,vc(n,e,t),ti=r,Ko=i,ti!==null&&(Ko?(n=ti,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):ti.removeChild(t.stateNode));break;case 18:ti!==null&&(Ko?(n=ti,t=t.stateNode,n.nodeType===8?jb(n.parentNode,t):n.nodeType===1&&jb(n,t),yg(n)):jb(ti,t.stateNode));break;case 4:r=ti,i=Ko,ti=t.stateNode.containerInfo,Ko=!0,vc(n,e,t),ti=r,Ko=i;break;case 0:case 11:case 14:case 15:if(!yi&&(r=t.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&wM(t,e,o),i=i.next}while(i!==r)}vc(n,e,t);break;case 1:if(!yi&&(Th(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){Jn(t,e,a)}vc(n,e,t);break;case 21:vc(n,e,t);break;case 22:t.mode&1?(yi=(r=yi)||t.memoizedState!==null,vc(n,e,t),yi=r):vc(n,e,t);break;default:vc(n,e,t)}}function MP(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new tZ),e.forEach(function(r){var i=uZ.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function Fo(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=hr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*iZ(r/1960))-r,10n?16:n,jc===null)var r=!1;else{if(n=jc,jc=null,x_=0,Wt&6)throw Error(De(331));var i=Wt;for(Wt|=4,Ze=n.current;Ze!==null;){var s=Ze,o=s.child;if(Ze.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lhr()-qI?pu(n,0):ZI|=t),ts(n,e)}function J5(n,e){e===0&&(n.mode&1?(e=q0,q0<<=1,!(q0&130023424)&&(q0=4194304)):e=1);var t=ki();n=ql(n,e),n!==null&&(u0(n,e,t),ts(n,t))}function AZ(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),J5(n,t)}function uZ(n,e){var t=0;switch(n.tag){case 13:var r=n.stateNode,i=n.memoizedState;i!==null&&(t=i.retryLane);break;case 19:r=n.stateNode;break;default:throw Error(De(314))}r!==null&&r.delete(e),J5(n,t)}var e6;e6=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Ji.current)Zi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Zi=!1,q$(n,e,t);Zi=!!(n.flags&131072)}else Zi=!1,Nn&&e.flags&1048576&&i5(e,h_,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;dw(n,e),n=e.pendingProps;var i=gd(e,Mi.current);Zh(e,t),i=jI(null,e,r,n,i,t);var s=WI();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,es(r)?(s=!0,u_(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,HI(e),i.updater=Kx,e.stateNode=i,i._reactInternals=e,hM(e,r,n,t),e=mM(null,e,r,!0,s,t)):(e.tag=0,Nn&&s&&FI(e),Pi(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(dw(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=hZ(r),n=jo(r,n),i){case 0:e=pM(null,e,r,n,t);break e;case 1:e=xP(null,e,r,n,t);break e;case 11:e=wP(null,e,r,n,t);break e;case 14:e=_P(null,e,r,jo(r.type,n),t);break e}throw Error(De(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:jo(r,i),pM(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:jo(r,i),xP(n,e,r,i,t);case 3:e:{if(N5(e),n===null)throw Error(De(387));r=e.pendingProps,s=e.memoizedState,i=s.element,A5(n,e),m_(e,r,null,t);var o=e.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=s,e.memoizedState=s,e.flags&256){i=_d(Error(De(423)),e),e=bP(n,e,r,t,i);break e}else if(r!==i){i=_d(Error(De(424)),e),e=bP(n,e,r,t,i);break e}else for(Cs=iA(e.stateNode.containerInfo.firstChild),Ps=e,Nn=!0,Yo=null,t=l5(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(vd(),r===i){e=Jl(n,e,t);break e}Pi(n,e,r,t)}e=e.child}return e;case 5:return u5(e),n===null&&AM(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,sM(r,i)?o=null:s!==null&&sM(r,s)&&(e.flags|=32),D5(n,e),Pi(n,e,o,t),e.child;case 6:return n===null&&AM(e),null;case 13:return O5(n,e,t);case 4:return QI(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=yd(e,null,r,t):Pi(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:jo(r,i),wP(n,e,r,i,t);case 7:return Pi(n,e,e.pendingProps,t),e.child;case 8:return Pi(n,e,e.pendingProps.children,t),e.child;case 12:return Pi(n,e,e.pendingProps.children,t),e.child;case 10:e:{if(r=e.type._context,i=e.pendingProps,s=e.memoizedProps,o=i.value,En(d_,r._currentValue),r._currentValue=o,s!==null)if(sa(s.value,o)){if(s.children===i.children&&!Ji.current){e=Jl(n,e,t);break e}}else for(s=e.child,s!==null&&(s.return=e);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=Vl(-1,t&-t),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var A=c.pending;A===null?l.next=l:(l.next=A.next,A.next=l),c.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),uM(s.return,t,e),a.lanes|=t;break}l=l.next}}else if(s.tag===10)o=s.type===e.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(De(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),uM(o,t,e),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===e){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Pi(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,Zh(e,t),i=wo(i),r=r(i),e.flags|=1,Pi(n,e,r,t),e.child;case 14:return r=e.type,i=jo(r,e.pendingProps),i=jo(r.type,i),_P(n,e,r,i,t);case 15:return P5(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:jo(r,i),dw(n,e),e.tag=1,es(r)?(n=!0,u_(e)):n=!1,Zh(e,t),R5(e,r,i),hM(e,r,i,t),mM(null,e,r,!0,n,t);case 19:return k5(n,e,t);case 22:return L5(n,e,t)}throw Error(De(156,e.tag))};function t6(n,e){return CQ(n,e)}function fZ(n,e,t,r){this.tag=n,this.key=t,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function lo(n,e,t,r){return new fZ(n,e,t,r)}function nR(n){return n=n.prototype,!(!n||!n.isReactComponent)}function hZ(n){if(typeof n=="function")return nR(n)?1:0;if(n!=null){if(n=n.$$typeof,n===_I)return 11;if(n===xI)return 14}return 2}function lA(n,e){var t=n.alternate;return t===null?(t=lo(n.tag,e,n.key,n.mode),t.elementType=n.elementType,t.type=n.type,t.stateNode=n.stateNode,t.alternate=n,n.alternate=t):(t.pendingProps=e,t.type=n.type,t.flags=0,t.subtreeFlags=0,t.deletions=null),t.flags=n.flags&14680064,t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},t.sibling=n.sibling,t.index=n.index,t.ref=n.ref,t}function gw(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")nR(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case wh:return mu(t.children,i,s,e);case wI:o=8,i|=8;break;case NS:return n=lo(12,t,e,i|2),n.elementType=NS,n.lanes=s,n;case OS:return n=lo(13,t,e,i),n.elementType=OS,n.lanes=s,n;case kS:return n=lo(19,t,e,i),n.elementType=kS,n.lanes=s,n;case uQ:return $x(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case cQ:o=10;break e;case AQ:o=9;break e;case _I:o=11;break e;case xI:o=14;break e;case Lc:o=16,r=null;break e}throw Error(De(130,n==null?n:typeof n,""))}return e=lo(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function mu(n,e,t,r){return n=lo(7,n,r,e),n.lanes=t,n}function $x(n,e,t,r){return n=lo(22,n,r,e),n.elementType=uQ,n.lanes=t,n.stateNode={isHidden:!1},n}function Jb(n,e,t){return n=lo(6,n,null,e),n.lanes=t,n}function eE(n,e,t){return e=lo(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function dZ(n,e,t,r,i){this.tag=e,this.containerInfo=n,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Pb(0),this.expirationTimes=Pb(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Pb(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function rR(n,e,t,r,i,s,o,a,l){return n=new dZ(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=lo(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},HI(s),n}function pZ(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s6)}catch(n){console.error(n)}}s6(),sQ.exports=Vs;var wZ=sQ.exports,LP=wZ;LS.createRoot=LP.createRoot,LS.hydrateRoot=LP.hydrateRoot;const _Z="/assets/cc_bgm_balanced-f542698c.wav",So=xe.createContext(),xZ=({children:n})=>{const[e,t]=xe.useState(!1),r=q.useRef(null),i=()=>{t(!1);const o=r.current;o.src=_Z,o.loop=!0,o.volume=0,o.play();let a=0;const l=5,c=setInterval(()=>{a=Math.max(a+1/(10*l*60),1),a>=1&&clearInterval(c),o.volume=a},1e3/60)},s=()=>{t(!0),r.current.pause()};return Q.jsxs(So.Provider,{value:{isMute:e,setMute:t,enableAudio:i,disableAudio:s},children:[Q.jsx("audio",{ref:r}),n]})},bZ=xe.createContext(),EZ=n=>{const[e,t]=xe.useState(null),[r,i]=xe.useState(null),[s,o]=xe.useState(!1),[a,l]=xe.useState([]);return Q.jsx(bZ.Provider,{value:{walletAddress:e,setWalletAddress:t,ensName:r,setEnsName:i,connected:s,setConnected:o,OTTokens:a,setOTTokens:l},children:n.children})};function Il(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function o6(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}/*! * GSAP 3.12.5 * https://gsap.com * @@ -52,7 +52,7 @@ Error generating stack: `+s.message+` * Subject to the terms at https://gsap.com/standard-license or for * Club GSAP members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com -*/var Ps={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},_d={duration:.5,overwrite:!1,delay:0},iR,xi,On,lo=1e8,_n=1/lo,BM=Math.PI*2,bZ=BM/4,EZ=0,s6=Math.sqrt,BZ=Math.cos,SZ=Math.sin,Kr=function(e){return typeof e=="string"},nr=function(e){return typeof e=="function"},Zl=function(e){return typeof e=="number"},sR=function(e){return typeof e>"u"},$a=function(e){return typeof e=="object"},ts=function(e){return e!==!1},oR=function(){return typeof window<"u"},lv=function(e){return nr(e)||Kr(e)},o6=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},bi=Array.isArray,SM=/(?:-?\.?\d|\.)+/gi,a6=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Ch=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,qb=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,l6=/[+-]=-?[.\d]+/,c6=/[^,'"\[\]\s]+/gi,MZ=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,jn,Ea,MM,aR,Os={},x_={},A6,u6=function(e){return(x_=Cu(e,Os))&&ls},lR=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Ig=function(e,t){return!t&&console.warn(e)},f6=function(e,t){return e&&(Os[e]=t)&&x_&&(x_[e]=t)||Os},Rg=function(){return 0},CZ={suppressEvents:!0,isStart:!0,kill:!1},pw={suppressEvents:!0,kill:!1},TZ={suppressEvents:!0},cR={},aA=[],CM={},h6,bs={},Jb={},PP=30,mw=[],AR="",uR=function(e){var t=e[0],r,i;if($a(t)||nr(t)||(e=[e]),!(r=(t._gsap||{}).harness)){for(i=mw.length;i--&&!mw[i].targetTest(t););r=mw[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new N6(e[i],r)))||e.splice(i,1);return e},pu=function(e){return e._gsap||uR(co(e))[0]._gsap},d6=function(e,t,r){return(r=e[t])&&nr(r)?e[t]():sR(r)&&e.getAttribute&&e.getAttribute(t)||r},ns=function(e,t){return(e=e.split(",")).forEach(t)||e},fr=function(e){return Math.round(e*1e5)/1e5||0},Gr=function(e){return Math.round(e*1e7)/1e7||0},$h=function(e,t){var r=t.charAt(0),i=parseFloat(t.substr(2));return e=parseFloat(e),r==="+"?e+i:r==="-"?e-i:r==="*"?e*i:e/i},IZ=function(e,t){for(var r=t.length,i=0;e.indexOf(t[i])<0&&++ia;)o=o._prev;return o?(t._next=o._next,o._next=t):(t._next=e[r],e[r]=t),t._next?t._next._prev=t:e[i]=t,t._prev=o,t.parent=t._dp=e,t},Jx=function(e,t,r,i){r===void 0&&(r="_first"),i===void 0&&(i="_last");var s=t._prev,o=t._next;s?s._next=o:e[r]===t&&(e[r]=o),o?o._prev=s:e[i]===t&&(e[i]=s),t._next=t._prev=t.parent=null},pA=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},mu=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},FZ=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},TM=function(e,t,r,i){return e._startAt&&(xi?e._startAt.revert(pw):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},PZ=function n(e){return!e||e._ts&&n(e.parent)},DP=function(e){return e._repeat?xd(e._tTime,e=e.duration()+e._rDelay)*e:0},xd=function(e,t){var r=Math.floor(e/=t);return e&&r===e?r-1:r},B_=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},e1=function(e){return e._end=Gr(e._start+(e._tDur/Math.abs(e._ts||e._rts||_n)||0))},t1=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=Gr(r._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),e1(e),r._dirty||mu(r,e)),e},y6=function(e,t){var r;if((t._time||!t._dur&&t._initted||t._start_n)&&t.render(r,!0)),mu(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&r.totalTime(r._tTime),r=r._dp;e._zTime=-_n}},Ta=function(e,t,r,i){return t.parent&&pA(t),t._start=Gr((Zl(r)?r:r||e!==jn?qs(e,r,t):e._time)+t._delay),t._end=Gr(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),v6(e,t,"_first","_last",e._sort?"_start":0),IM(t)||(e._recent=t),i||y6(e,t),e._ts<0&&t1(e,e._tTime),e},w6=function(e,t){return(Os.ScrollTrigger||lR("scrollTrigger",t))&&Os.ScrollTrigger.create(t,e)},_6=function(e,t,r,i,s){if(hR(e,t,s),!e._initted)return 1;if(!r&&e._pt&&!xi&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&h6!==Es.frame)return aA.push(e),e._lazy=[s,i],1},LZ=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},IM=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},DZ=function(e,t,r,i){var s=e.ratio,o=t<0||!t&&(!e._start&&LZ(e)&&!(!e._initted&&IM(e))||(e._ts<0||e._dp._ts<0)&&!IM(e))?0:1,a=e._rDelay,l=0,c,A,u;if(a&&e._repeat&&(l=h0(0,e._tDur,t),A=xd(l,a),e._yoyo&&A&1&&(o=1-o),A!==xd(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||xi||i||e._zTime===_n||!t&&e._zTime){if(!e._initted&&_6(e,t,i,r,l))return;for(u=e._zTime,e._zTime=t||(r?_n:0),r||(r=t&&!u),e.ratio=o,e._from&&(o=1-o),e._time=0,e._tTime=l,c=e._pt;c;)c.r(o,c.d),c=c._next;t<0&&TM(e,t,r,!0),e._onUpdate&&!r&&Cs(e,"onUpdate"),l&&e._repeat&&!r&&e.parent&&Cs(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&pA(e,1),!r&&!xi&&(Cs(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},NZ=function(e,t,r){var i;if(r>t)for(i=e._first;i&&i._start<=r;){if(i.data==="isPause"&&i._start>t)return i;i=i._next}else for(i=e._last;i&&i._start>=r;){if(i.data==="isPause"&&i._start0&&!i&&t1(e,e._tTime=e._tDur*a),e.parent&&e1(e),r||mu(e.parent,e),e},NP=function(e){return e instanceof Li?mu(e):bd(e,e._dur)},OZ={_start:0,endTime:Rg,totalDuration:Rg},qs=function n(e,t,r){var i=e.labels,s=e._recent||OZ,o=e.duration()>=lo?s.endTime(!1):e._dur,a,l,c;return Kr(t)&&(isNaN(t)||t in i)?(l=t.charAt(0),c=t.substr(-1)==="%",a=t.indexOf("="),l==="<"||l===">"?(a>=0&&(t=t.replace(/=/,"")),(l==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(t.substr(1))||0)*(c?(a<0?s:r).totalDuration()/100:1)):a<0?(t in i||(i[t]=o),i[t]):(l=parseFloat(t.charAt(a-1)+t.substr(a+1)),c&&r&&(l=l/100*(bi(r)?r[0]:r).totalDuration()),a>1?n(e,t.substr(0,a-1),r)+l:o+l)):t==null?o:+t},Ym=function(e,t,r){var i=Zl(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s],a,l;if(i&&(o.duration=t[1]),o.parent=r,e){for(a=o,l=r;l&&!("immediateRender"in a);)a=l.vars.defaults||{},l=ts(l.vars.inherit)&&l.parent;o.immediateRender=ts(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new _r(t[0],o,t[s+1])},CA=function(e,t){return e||e===0?t(e):t},h0=function(e,t,r){return rt?t:r},yi=function(e,t){return!Kr(e)||!(t=MZ.exec(e))?"":t[1]},kZ=function(e,t,r){return CA(r,function(i){return h0(e,t,i)})},RM=[].slice,x6=function(e,t){return e&&$a(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&$a(e[0]))&&!e.nodeType&&e!==Ea},HZ=function(e,t,r){return r===void 0&&(r=[]),e.forEach(function(i){var s;return Kr(i)&&!t||x6(i,1)?(s=r).push.apply(s,co(i)):r.push(i)})||r},co=function(e,t,r){return On&&!t&&On.selector?On.selector(e):Kr(e)&&!r&&(MM||!Ed())?RM.call((t||aR).querySelectorAll(e),0):bi(e)?HZ(e,r):x6(e)?RM.call(e,0):e?[e]:[]},UM=function(e){return e=co(e)[0]||Ig("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return co(t,r.querySelectorAll?r:r===e?Ig("Invalid scope")||aR.createElement("div"):e)}},b6=function(e){return e.sort(function(){return .5-Math.random()})},E6=function(e){if(nr(e))return e;var t=$a(e)?e:{each:e},r=gu(t.ease),i=t.from||0,s=parseFloat(t.base)||0,o={},a=i>0&&i<1,l=isNaN(i)||a,c=t.axis,A=i,u=i;return Kr(i)?A=u={center:.5,edges:.5,end:1}[i]||0:!a&&l&&(A=i[0],u=i[1]),function(f,h,d){var m=(d||t).length,g=o[m],p,v,w,_,x,b,B,M,I;if(!g){if(I=t.grid==="auto"?0:(t.grid||[1,lo])[1],!I){for(B=-lo;B<(B=d[I++].getBoundingClientRect().left)&&IB&&(B=x),xm?m-1:c?c==="y"?m/I:I:Math.max(I,m/I))||0)*(i==="edges"?-1:1),g.b=m<0?s-m:s,g.u=yi(t.amount||t.each)||0,r=r&&m<0?P6(r):r}return m=(g[f]-g.min)/g.max||0,Gr(g.b+(r?r(m):m)*g.v)+g.u}},FM=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var i=Gr(Math.round(parseFloat(r)/e)*e*t);return(i-i%1)/t+(Zl(r)?0:yi(r))}},B6=function(e,t){var r=bi(e),i,s;return!r&&$a(e)&&(i=r=e.radius||lo,e.values?(e=co(e.values),(s=!Zl(e[0]))&&(i*=i)):e=FM(e.increment)),CA(t,r?nr(e)?function(o){return s=e(o),Math.abs(s-o)<=i?s:o}:function(o){for(var a=parseFloat(s?o.x:o),l=parseFloat(s?o.y:0),c=lo,A=0,u=e.length,f,h;u--;)s?(f=e[u].x-a,h=e[u].y-l,f=f*f+h*h):f=Math.abs(e[u]-a),fi?s-o:o)})},Ug=function(e){for(var t=0,r="",i,s,o,a;~(i=e.indexOf("random(",t));)o=e.indexOf(")",i),a=e.charAt(i+7)==="[",s=e.substr(i+7,o-i-7).match(a?c6:SM),r+=e.substr(t,i-t)+S6(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return r+e.substr(t,e.length-t)},C6=function(e,t,r,i,s){var o=t-e,a=i-r;return CA(s,function(l){return r+((l-e)/o*a||0)})},WZ=function n(e,t,r,i){var s=isNaN(e+t)?0:function(h){return(1-h)*e+h*t};if(!s){var o=Kr(e),a={},l,c,A,u,f;if(r===!0&&(i=1)&&(r=null),o)e={p:e},t={p:t};else if(bi(e)&&!bi(t)){for(A=[],u=e.length,f=u-2,c=1;c(a=Math.abs(a))&&(l=o,s=a);return l},Cs=function(e,t,r){var i=e.vars,s=i[t],o=On,a=e._ctx,l,c,A;if(s)return l=i[t+"Params"],c=i.callbackScope||e,r&&aA.length&&b_(),a&&(On=a),A=l?s.apply(c,l):s.call(c),On=o,A},vm=function(e){return pA(e),e.scrollTrigger&&e.scrollTrigger.kill(!!xi),e.progress()<1&&Cs(e,"onInterrupt"),e},Th,T6=[],I6=function(e){if(e)if(e=!e.name&&e.default||e,oR()||e.headless){var t=e.name,r=nr(e),i=t&&!r&&e.init?function(){this._props=[]}:e,s={init:Rg,render:mR,add:fR,kill:lq,modifier:aq,rawVars:0},o={targetTest:0,get:0,getSetter:pR,aliases:{},register:0};if(Ed(),e!==i){if(bs[t])return;_o(i,_o(E_(e,s),o)),Cu(i.prototype,Cu(s,E_(e,o))),bs[i.prop=t]=i,e.targetTest&&(mw.push(i),cR[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}f6(t,i),e.register&&e.register(ls,i,rs)}else T6.push(e)},vn=255,ym={aqua:[0,vn,vn],lime:[0,vn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,vn],navy:[0,0,128],white:[vn,vn,vn],olive:[128,128,0],yellow:[vn,vn,0],orange:[vn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[vn,0,0],pink:[vn,192,203],cyan:[0,vn,vn],transparent:[vn,vn,vn,0]},eE=function(e,t,r){return e+=e<0?1:e>1?-1:0,(e*6<1?t+(r-t)*e*6:e<.5?r:e*3<2?t+(r-t)*(2/3-e)*6:t)*vn+.5|0},R6=function(e,t,r){var i=e?Zl(e)?[e>>16,e>>8&vn,e&vn]:0:ym.black,s,o,a,l,c,A,u,f,h,d;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),ym[e])i=ym[e];else if(e.charAt(0)==="#"){if(e.length<6&&(s=e.charAt(1),o=e.charAt(2),a=e.charAt(3),e="#"+s+s+o+o+a+a+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return i=parseInt(e.substr(1,6),16),[i>>16,i>>8&vn,i&vn,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&vn,e&vn]}else if(e.substr(0,3)==="hsl"){if(i=d=e.match(SM),!t)l=+i[0]%360/360,c=+i[1]/100,A=+i[2]/100,o=A<=.5?A*(c+1):A+c-A*c,s=A*2-o,i.length>3&&(i[3]*=1),i[0]=eE(l+1/3,s,o),i[1]=eE(l,s,o),i[2]=eE(l-1/3,s,o);else if(~e.indexOf("="))return i=e.match(a6),r&&i.length<4&&(i[3]=1),i}else i=e.match(SM)||ym.transparent;i=i.map(Number)}return t&&!d&&(s=i[0]/vn,o=i[1]/vn,a=i[2]/vn,u=Math.max(s,o,a),f=Math.min(s,o,a),A=(u+f)/2,u===f?l=c=0:(h=u-f,c=A>.5?h/(2-u-f):h/(u+f),l=u===s?(o-a)/h+(oe||p<0)&&(r+=p-t),i+=p,x=i-r,w=x-o,(w>0||v)&&(b=++u.frame,f=x-u.time*1e3,u.time=x=x/1e3,o+=w+(w>=s?4:s-w),_=1),v||(l=c(m)),_)for(h=0;h=p&&h--},_listeners:a},u}(),Ed=function(){return!Fg&&Es.wake()},zt={},XZ=/^[\d.\-M][\d.\-,\s]/,YZ=/["']/g,$Z=function(e){for(var t={},r=e.substr(1,e.length-3).split(":"),i=r[0],s=1,o=r.length,a,l,c;s1&&r.config?r.config.apply(null,~e.indexOf("{")?[$Z(t[1])]:ZZ(e).split(",").map(m6)):zt._CE&&XZ.test(e)?zt._CE("",e):r},P6=function(e){return function(t){return 1-e(1-t)}},L6=function n(e,t){for(var r=e._first,i;r;)r instanceof Li?n(r,t):r.vars.yoyoEase&&(!r._yoyo||!r._repeat)&&r._yoyo!==t&&(r.timeline?n(r.timeline,t):(i=r._ease,r._ease=r._yEase,r._yEase=i,r._yoyo=t)),r=r._next},gu=function(e,t){return e&&(nr(e)?e:zt[e]||qZ(e))||t},Gu=function(e,t,r,i){r===void 0&&(r=function(l){return 1-t(1-l)}),i===void 0&&(i=function(l){return l<.5?t(l*2)/2:1-t((1-l)*2)/2});var s={easeIn:t,easeOut:r,easeInOut:i},o;return ns(e,function(a){zt[a]=Os[a]=s,zt[o=a.toLowerCase()]=r;for(var l in s)zt[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=zt[a+"."+l]=s[l]}),s},D6=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},tE=function n(e,t,r){var i=t>=1?t:1,s=(r||(e?.3:.45))/(t<1?t:1),o=s/BM*(Math.asin(1/i)||0),a=function(A){return A===1?1:i*Math.pow(2,-10*A)*SZ((A-o)*s)+1},l=e==="out"?a:e==="in"?function(c){return 1-a(1-c)}:D6(a);return s=BM/s,l.config=function(c,A){return n(e,c,A)},l},nE=function n(e,t){t===void 0&&(t=1.70158);var r=function(o){return o?--o*o*((t+1)*o+t)+1:0},i=e==="out"?r:e==="in"?function(s){return 1-r(1-s)}:D6(r);return i.config=function(s){return n(e,s)},i};ns("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;Gu(n+",Power"+(t-1),e?function(r){return Math.pow(r,t)}:function(r){return r},function(r){return 1-Math.pow(1-r,t)},function(r){return r<.5?Math.pow(r*2,t)/2:1-Math.pow((1-r)*2,t)/2})});zt.Linear.easeNone=zt.none=zt.Linear.easeIn;Gu("Elastic",tE("in"),tE("out"),tE());(function(n,e){var t=1/e,r=2*t,i=2.5*t,s=function(a){return a0?r+(r+this._rDelay)*this._repeat:r):this.totalDuration()&&this._dur},e.totalDuration=function(r){return arguments.length?(this._dirty=0,bd(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(r,i){if(Ed(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(t1(this,r),!s._dp||s.parent||y6(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&r0||!this._tDur&&!r)&&Ta(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===_n||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),p6(this,r,i)),this},e.time=function(r,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+DP(this))%(this._dur+this._rDelay)||(r?this._dur:0),i):this._time},e.totalProgress=function(r,i){return arguments.length?this.totalTime(this.totalDuration()*r,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},e.progress=function(r,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-r:r)+DP(this),i):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(r,i){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(r-1)*s,i):this._repeat?xd(this._tTime,s)+1:1},e.timeScale=function(r,i){if(!arguments.length)return this._rts===-_n?0:this._rts;if(this._rts===r)return this;var s=this.parent&&this._ts?B_(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-_n?0:this._rts,this.totalTime(h0(-Math.abs(this._delay),this._tDur,s),i!==!1),e1(this),FZ(this)},e.paused=function(r){return arguments.length?(this._ps!==r&&(this._ps=r,r?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Ed(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==_n&&(this._tTime-=_n)))),this):this._ps},e.startTime=function(r){if(arguments.length){this._start=r;var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&Ta(i,this,r-this._delay),this}return this._start},e.endTime=function(r){return this._start+(ts(r)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(r){var i=this.parent||this._dp;return i?r&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?B_(i.rawTime(r),this):this._tTime:this._tTime},e.revert=function(r){r===void 0&&(r=TZ);var i=xi;return xi=r,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),xi=i,this},e.globalTime=function(r){for(var i=this,s=arguments.length?r:i.rawTime();i;)s=i._start+s/(Math.abs(i._ts)||1),i=i._dp;return!this.parent&&this._sat?this._sat.globalTime(r):s},e.repeat=function(r){return arguments.length?(this._repeat=r===1/0?-2:r,NP(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(r){if(arguments.length){var i=this._time;return this._rDelay=r,NP(this),i?this.time(i):this}return this._rDelay},e.yoyo=function(r){return arguments.length?(this._yoyo=r,this):this._yoyo},e.seek=function(r,i){return this.totalTime(qs(this,r),ts(i))},e.restart=function(r,i){return this.play().totalTime(r?-this._delay:0,ts(i))},e.play=function(r,i){return r!=null&&this.seek(r,i),this.reversed(!1).paused(!1)},e.reverse=function(r,i){return r!=null&&this.seek(r||this.totalDuration(),i),this.reversed(!0).paused(!1)},e.pause=function(r,i){return r!=null&&this.seek(r,i),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(r){return arguments.length?(!!r!==this.reversed()&&this.timeScale(-this._rts||(r?-_n:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-_n,this},e.isActive=function(){var r=this.parent||this._dp,i=this._start,s;return!!(!r||this._ts&&this._initted&&r.isActive()&&(s=r.rawTime(!0))>=i&&s1?(i?(o[r]=i,s&&(o[r+"Params"]=s),r==="onUpdate"&&(this._onUpdate=i)):delete o[r],this):o[r]},e.then=function(r){var i=this;return new Promise(function(s){var o=nr(r)?r:g6,a=function(){var c=i.then;i.then=null,nr(o)&&(o=o(i))&&(o.then||o===i)&&(i.then=c),s(o),i.then=c};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?a():i._prom=a})},e.kill=function(){vm(this)},n}();_o(Pg.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-_n,_prom:0,_ps:!1,_rts:1});var Li=function(n){i6(e,n);function e(r,i){var s;return r===void 0&&(r={}),s=n.call(this,r)||this,s.labels={},s.smoothChildTiming=!!r.smoothChildTiming,s.autoRemoveChildren=!!r.autoRemoveChildren,s._sort=ts(r.sortChildren),jn&&Ta(r.parent||jn,Cl(s),i),r.reversed&&s.reverse(),r.paused&&s.paused(!0),r.scrollTrigger&&w6(Cl(s),r.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,o){return Ym(0,arguments,this),this},t.from=function(i,s,o){return Ym(1,arguments,this),this},t.fromTo=function(i,s,o,a){return Ym(2,arguments,this),this},t.set=function(i,s,o){return s.duration=0,s.parent=this,Xm(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new _r(i,s,qs(this,o),1),this},t.call=function(i,s,o){return Ta(this,_r.delayedCall(0,i,s),o)},t.staggerTo=function(i,s,o,a,l,c,A){return o.duration=s,o.stagger=o.stagger||a,o.onComplete=c,o.onCompleteParams=A,o.parent=this,new _r(i,o,qs(this,l)),this},t.staggerFrom=function(i,s,o,a,l,c,A){return o.runBackwards=1,Xm(o).immediateRender=ts(o.immediateRender),this.staggerTo(i,s,o,a,l,c,A)},t.staggerFromTo=function(i,s,o,a,l,c,A,u){return a.startAt=o,Xm(a).immediateRender=ts(a.immediateRender),this.staggerTo(i,s,a,l,c,A,u)},t.render=function(i,s,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,c=this._dur,A=i<=0?0:Gr(i),u=this._zTime<0!=i<0&&(this._initted||!c),f,h,d,m,g,p,v,w,_,x,b,B;if(this!==jn&&A>l&&i>=0&&(A=l),A!==this._tTime||o||u){if(a!==this._time&&c&&(A+=this._time-a,i+=this._time-a),f=A,_=this._start,w=this._ts,p=!w,u&&(c||(a=this._zTime),(i||!s)&&(this._zTime=i)),this._repeat){if(b=this._yoyo,g=c+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(g*100+i,s,o);if(f=Gr(A%g),A===l?(m=this._repeat,f=c):(m=~~(A/g),m&&m===A/g&&(f=c,m--),f>c&&(f=c)),x=xd(this._tTime,g),!a&&this._tTime&&x!==m&&this._tTime-x*g-this._dur<=0&&(x=m),b&&m&1&&(f=c-f,B=1),m!==x&&!this._lock){var M=b&&x&1,I=M===(b&&m&1);if(m=a&&i>=0)for(h=this._first;h;){if(d=h._next,(h._act||f>=h._start)&&h._ts&&v!==h){if(h.parent!==this)return this.render(i,s,o);if(h.render(h._ts>0?(f-h._start)*h._ts:(h._dirty?h.totalDuration():h._tDur)+(f-h._start)*h._ts,s,o),f!==this._time||!this._ts&&!p){v=0,d&&(A+=this._zTime=-_n);break}}h=d}else{h=this._last;for(var S=i<0?i:f;h;){if(d=h._prev,(h._act||S<=h._end)&&h._ts&&v!==h){if(h.parent!==this)return this.render(i,s,o);if(h.render(h._ts>0?(S-h._start)*h._ts:(h._dirty?h.totalDuration():h._tDur)+(S-h._start)*h._ts,s,o||xi&&(h._initted||h._startAt)),f!==this._time||!this._ts&&!p){v=0,d&&(A+=this._zTime=S?-_n:_n);break}}h=d}}if(v&&!s&&(this.pause(),v.render(f>=a?0:-_n)._zTime=f>=a?1:-1,this._ts))return this._start=_,e1(this),this.render(i,s,o);this._onUpdate&&!s&&Cs(this,"onUpdate",!0),(A===l&&this._tTime>=this.totalDuration()||!A&&a)&&(_===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((i||!c)&&(A===l&&this._ts>0||!A&&this._ts<0)&&pA(this,1),!s&&!(i<0&&!a)&&(A||a||!l)&&(Cs(this,A===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(A0)&&this._prom())))}return this},t.add=function(i,s){var o=this;if(Zl(s)||(s=qs(this,s,i)),!(i instanceof Pg)){if(bi(i))return i.forEach(function(a){return o.add(a,s)}),this;if(Kr(i))return this.addLabel(i,s);if(nr(i))i=_r.delayedCall(0,i);else return this}return this!==i?Ta(this,i,s):this},t.getChildren=function(i,s,o,a){i===void 0&&(i=!0),s===void 0&&(s=!0),o===void 0&&(o=!0),a===void 0&&(a=-lo);for(var l=[],c=this._first;c;)c._start>=a&&(c instanceof _r?s&&l.push(c):(o&&l.push(c),i&&l.push.apply(l,c.getChildren(!0,s,o)))),c=c._next;return l},t.getById=function(i){for(var s=this.getChildren(1,1,1),o=s.length;o--;)if(s[o].vars.id===i)return s[o]},t.remove=function(i){return Kr(i)?this.removeLabel(i):nr(i)?this.killTweensOf(i):(Jx(this,i),i===this._recent&&(this._recent=this._last),mu(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Gr(Es.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),n.prototype.totalTime.call(this,i,s),this._forcing=0,this):this._tTime},t.addLabel=function(i,s){return this.labels[i]=qs(this,s),this},t.removeLabel=function(i){return delete this.labels[i],this},t.addPause=function(i,s,o){var a=_r.delayedCall(0,s||Rg,o);return a.data="isPause",this._hasPause=1,Ta(this,a,qs(this,i))},t.removePause=function(i){var s=this._first;for(i=qs(this,i);s;)s._start===i&&s.data==="isPause"&&pA(s),s=s._next},t.killTweensOf=function(i,s,o){for(var a=this.getTweensOf(i,o),l=a.length;l--;)Vc!==a[l]&&a[l].kill(i,s);return this},t.getTweensOf=function(i,s){for(var o=[],a=co(i),l=this._first,c=Zl(s),A;l;)l instanceof _r?IZ(l._targets,a)&&(c?(!Vc||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&o.push(l):(A=l.getTweensOf(a,s)).length&&o.push.apply(o,A),l=l._next;return o},t.tweenTo=function(i,s){s=s||{};var o=this,a=qs(o,i),l=s,c=l.startAt,A=l.onStart,u=l.onStartParams,f=l.immediateRender,h,d=_r.to(o,_o({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:s.duration||Math.abs((a-(c&&"time"in c?c.time:o._time))/o.timeScale())||_n,onStart:function(){if(o.pause(),!h){var g=s.duration||Math.abs((a-(c&&"time"in c?c.time:o._time))/o.timeScale());d._dur!==g&&bd(d,g,0,1).render(d._time,!0,!0),h=1}A&&A.apply(d,u||[])}},s));return f?d.render(0):d},t.tweenFromTo=function(i,s,o){return this.tweenTo(s,_o({startAt:{time:qs(this,i)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),OP(this,qs(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),OP(this,qs(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+_n)},t.shiftChildren=function(i,s,o){o===void 0&&(o=0);for(var a=this._first,l=this.labels,c;a;)a._start>=o&&(a._start+=i,a._end+=i),a=a._next;if(s)for(c in l)l[c]>=o&&(l[c]+=i);return mu(this)},t.invalidate=function(i){var s=this._first;for(this._lock=0;s;)s.invalidate(i),s=s._next;return n.prototype.invalidate.call(this,i)},t.clear=function(i){i===void 0&&(i=!0);for(var s=this._first,o;s;)o=s._next,this.remove(s),s=o;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),mu(this)},t.totalDuration=function(i){var s=0,o=this,a=o._last,l=lo,c,A,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-i:i));if(o._dirty){for(u=o.parent;a;)c=a._prev,a._dirty&&a.totalDuration(),A=a._start,A>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,Ta(o,a,A-a._delay,1)._lock=0):l=A,A<0&&a._ts&&(s-=A,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=A/o._ts,o._time-=A,o._tTime-=A),o.shiftChildren(-A,!1,-1/0),l=0),a._end>s&&a._ts&&(s=a._end),a=c;bd(o,o===jn&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(i){if(jn._ts&&(p6(jn,B_(i,jn)),h6=Es.frame),Es.frame>=PP){PP+=Ps.autoSleep||120;var s=jn._first;if((!s||!s._ts)&&Ps.autoSleep&&Es._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Es.sleep()}}},e}(Pg);_o(Li.prototype,{_lock:0,_hasPause:0,_forcing:0});var JZ=function(e,t,r,i,s,o,a){var l=new rs(this._pt,e,t,0,1,G6,null,s),c=0,A=0,u,f,h,d,m,g,p,v;for(l.b=r,l.e=i,r+="",i+="",(p=~i.indexOf("random("))&&(i=Ug(i)),o&&(v=[r,i],o(v,e,t),r=v[0],i=v[1]),f=r.match(qb)||[];u=qb.exec(i);)d=u[0],m=i.substring(c,u.index),h?h=(h+1)%5:m.substr(-5)==="rgba("&&(h=1),d!==f[A++]&&(g=parseFloat(f[A-1])||0,l._pt={_next:l._pt,p:m||A===1?m:",",s:g,c:d.charAt(1)==="="?$h(g,d)-g:parseFloat(d)-g,m:h&&h<4?Math.round:0},c=qb.lastIndex);return l.c=c")}),_.duration();else{b={};for(M in d)M==="ease"||M==="easeEach"||rq(M,d[M],b,d.easeEach);for(M in b)for(T=b[M].sort(function(U,P){return U.t-P.t}),O=0,x=0;xl-_n&&!A?l:i<_n?0:i,f,h,d,m,g,p,v,w,_;if(!c)DZ(this,i,s,o);else if(u!==this._tTime||!i||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==A){if(f=u,w=this.timeline,this._repeat){if(m=c+this._rDelay,this._repeat<-1&&A)return this.totalTime(m*100+i,s,o);if(f=Gr(u%m),u===l?(d=this._repeat,f=c):(d=~~(u/m),d&&d===Gr(u/m)&&(f=c,d--),f>c&&(f=c)),p=this._yoyo&&d&1,p&&(_=this._yEase,f=c-f),g=xd(this._tTime,m),f===a&&!o&&this._initted&&d===g)return this._tTime=u,this;d!==g&&(w&&this._yEase&&L6(w,p),this.vars.repeatRefresh&&!p&&!this._lock&&this._time!==m&&this._initted&&(this._lock=o=1,this.render(Gr(m*d),!0).invalidate()._lock=0))}if(!this._initted){if(_6(this,A?i:f,o,s,u))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&d!==g))return this;if(c!==this._dur)return this.render(i,s,o)}if(this._tTime=u,this._time=f,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=v=(_||this._ease)(f/c),this._from&&(this.ratio=v=1-v),f&&!a&&!s&&!d&&(Cs(this,"onStart"),this._tTime!==u))return this;for(h=this._pt;h;)h.r(v,h.d),h=h._next;w&&w.render(i<0?i:w._dur*w._ease(f/this._dur),s,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(A&&TM(this,i,s,o),Cs(this,"onUpdate")),this._repeat&&d!==g&&this.vars.onRepeat&&!s&&this.parent&&Cs(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(A&&!this._onUpdate&&TM(this,i,!0,!0),(i||!c)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&pA(this,1),!s&&!(A&&!a)&&(u||a||p)&&(Cs(this,u===l?"onComplete":"onReverseComplete",!0),this._prom&&!(u0)&&this._prom()))}return this},t.targets=function(){return this._targets},t.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),n.prototype.invalidate.call(this,i)},t.resetTo=function(i,s,o,a,l){Fg||Es.wake(),this._ts||this.play();var c=Math.min(this._dur,(this._dp._time-this._start)*this._ts),A;return this._initted||hR(this,c),A=this._ease(c/this._dur),tq(this,i,s,o,a,A,c,l)?this.resetTo(i,s,o,a,1):(t1(this,0),this.parent||v6(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},t.kill=function(i,s){if(s===void 0&&(s="all"),!i&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?vm(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,Vc&&Vc.vars.overwrite!==!0)._first||vm(this),this.parent&&o!==this.timeline.totalDuration()&&bd(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=i?co(i):a,c=this._ptLookup,A=this._pt,u,f,h,d,m,g,p;if((!s||s==="all")&&UZ(a,l))return s==="all"&&(this._pt=0),vm(this);for(u=this._op=this._op||[],s!=="all"&&(Kr(s)&&(m={},ns(s,function(v){return m[v]=1}),s=m),s=nq(a,s)),p=a.length;p--;)if(~l.indexOf(a[p])){f=c[p],s==="all"?(u[p]=s,d=f,h={}):(h=u[p]=u[p]||{},d=s);for(m in d)g=f&&f[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&Jx(this,g,"_pt"),delete f[m]),h!=="all"&&(h[m]=1)}return this._initted&&!this._pt&&A&&vm(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return Ym(1,arguments)},e.delayedCall=function(i,s,o,a){return new e(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:s,onReverseComplete:s,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},e.fromTo=function(i,s,o){return Ym(2,arguments)},e.set=function(i,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new e(i,s)},e.killTweensOf=function(i,s,o){return jn.killTweensOf(i,s,o)},e}(Pg);_o(_r.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});ns("staggerTo,staggerFrom,staggerFromTo",function(n){_r[n]=function(){var e=new Li,t=RM.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var dR=function(e,t,r){return e[t]=r},Q6=function(e,t,r){return e[t](r)},iq=function(e,t,r,i){return e[t](i.fp,r)},sq=function(e,t,r){return e.setAttribute(t,r)},pR=function(e,t){return nr(e[t])?Q6:sR(e[t])&&e.setAttribute?sq:dR},z6=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},oq=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},G6=function(e,t){var r=t._pt,i="";if(!e&&t.b)i=t.b;else if(e===1&&t.e)i=t.e;else{for(;r;)i=r.p+(r.m?r.m(r.s+r.c*e):Math.round((r.s+r.c*e)*1e4)/1e4)+i,r=r._next;i+=t.c}t.set(t.t,t.p,i,t)},mR=function(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next},aq=function(e,t,r,i){for(var s=this._pt,o;s;)o=s._next,s.p===i&&s.modifier(e,t,r),s=o},lq=function(e){for(var t=this._pt,r,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?Jx(this,t,"_pt"):t.dep||(r=1),t=i;return!r},cq=function(e,t,r,i){i.mSet(e,t,i.m.call(i.tween,r,i.mt),i)},V6=function(e){for(var t=e._pt,r,i,s,o;t;){for(r=t._next,i=s;i&&i.pr>t.pr;)i=i._next;(t._prev=i?i._prev:o)?t._prev._next=t:s=t,(t._next=i)?i._prev=t:o=t,t=r}e._pt=s},rs=function(){function n(t,r,i,s,o,a,l,c,A){this.t=r,this.s=s,this.c=o,this.p=i,this.r=a||z6,this.d=l||this,this.set=c||dR,this.pr=A||0,this._next=t,t&&(t._prev=this)}var e=n.prototype;return e.modifier=function(r,i,s){this.mSet=this.mSet||this.set,this.set=cq,this.m=r,this.mt=s,this.tween=i},n}();ns(AR+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(n){return cR[n]=1});Os.TweenMax=Os.TweenLite=_r;Os.TimelineLite=Os.TimelineMax=Li;jn=new Li({sortChildren:!1,defaults:_d,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});Ps.stringFilter=F6;var vu=[],gw={},Aq=[],HP=0,uq=0,rE=function(e){return(gw[e]||Aq).map(function(t){return t()})},LM=function(){var e=Date.now(),t=[];e-HP>2&&(rE("matchMediaInit"),vu.forEach(function(r){var i=r.queries,s=r.conditions,o,a,l,c;for(a in i)o=Ea.matchMedia(i[a]).matches,o&&(l=1),o!==s[a]&&(s[a]=o,c=1);c&&(r.revert(),l&&t.push(r))}),rE("matchMediaRevert"),t.forEach(function(r){return r.onMatch(r,function(i){return r.add(null,i)})}),HP=e,rE("matchMedia"))},j6=function(){function n(t,r){this.selector=r&&UM(r),this.data=[],this._r=[],this.isReverted=!1,this.id=uq++,t&&this.add(t)}var e=n.prototype;return e.add=function(r,i,s){nr(r)&&(s=i,i=r,r=nr);var o=this,a=function(){var c=On,A=o.selector,u;return c&&c!==o&&c.data.push(o),s&&(o.selector=UM(s)),On=o,u=i.apply(o,arguments),nr(u)&&o._r.push(u),On=c,o.selector=A,o.isReverted=!1,u};return o.last=a,r===nr?a(o,function(l){return o.add(null,l)}):r?o[r]=a:a},e.ignore=function(r){var i=On;On=null,r(this),On=i},e.getTweens=function(){var r=[];return this.data.forEach(function(i){return i instanceof n?r.push.apply(r,i.getTweens()):i instanceof _r&&!(i.parent&&i.parent.data==="nested")&&r.push(i)}),r},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(r,i){var s=this;if(r?function(){for(var a=s.getTweens(),l=s.data.length,c;l--;)c=s.data[l],c.data==="isFlip"&&(c.revert(),c.getChildren(!0,!0,!1).forEach(function(A){return a.splice(a.indexOf(A),1)}));for(a.map(function(A){return{g:A._dur||A._delay||A._sat&&!A._sat.vars.immediateRender?A.globalTime(0):-1/0,t:A}}).sort(function(A,u){return u.g-A.g||-1/0}).forEach(function(A){return A.t.revert(r)}),l=s.data.length;l--;)c=s.data[l],c instanceof Li?c.data!=="nested"&&(c.scrollTrigger&&c.scrollTrigger.revert(),c.kill()):!(c instanceof _r)&&c.revert&&c.revert(r);s._r.forEach(function(A){return A(r,s)}),s.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),i)for(var o=vu.length;o--;)vu[o].id===this.id&&vu.splice(o,1)},e.revert=function(r){this.kill(r||{})},n}(),fq=function(){function n(t){this.contexts=[],this.scope=t,On&&On.data.push(this)}var e=n.prototype;return e.add=function(r,i,s){$a(r)||(r={matches:r});var o=new j6(0,s||this.scope),a=o.conditions={},l,c,A;On&&!o.selector&&(o.selector=On.selector),this.contexts.push(o),i=o.add("onMatch",i),o.queries=r;for(c in r)c==="all"?A=1:(l=Ea.matchMedia(r[c]),l&&(vu.indexOf(o)<0&&vu.push(o),(a[c]=l.matches)&&(A=1),l.addListener?l.addListener(LM):l.addEventListener("change",LM)));return A&&i(o,function(u){return o.add(null,u)}),this},e.revert=function(r){this.kill(r||{})},e.kill=function(r){this.contexts.forEach(function(i){return i.kill(r,!0)})},n}(),S_={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r1){var i=e.map(function(A){return ls.quickSetter(A,t,r)}),s=i.length;return function(A){for(var u=s;u--;)i[u](A)}}e=e[0]||{};var o=bs[t],a=pu(e),l=a.harness&&(a.harness.aliases||{})[t]||t,c=o?function(A){var u=new o;Th._pt=0,u.init(e,r?A+r:A,Th,0,[e]),u.render(1,u),Th._pt&&mR(1,Th)}:a.set(e,l);return o?c:function(A){return c(e,l,r?A+r:A,a,1)}},quickTo:function(e,t,r){var i,s=ls.to(e,Cu((i={},i[t]="+=0.1",i.paused=!0,i),r||{})),o=function(l,c,A){return s.resetTo(t,l,c,A)};return o.tween=s,o},isTweening:function(e){return jn.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=gu(e.ease,_d.ease)),LP(_d,e||{})},config:function(e){return LP(Ps,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,i=e.plugins,s=e.defaults,o=e.extendTimeline;(i||"").split(",").forEach(function(a){return a&&!bs[a]&&!Os[a]&&Ig(t+" effect requires "+a+" plugin.")}),Jb[t]=function(a,l,c){return r(co(a),_o(l||{},s),c)},o&&(Li.prototype[t]=function(a,l,c){return this.add(Jb[t](a,$a(l)?l:(c=l)&&{},this),c)})},registerEase:function(e,t){zt[e]=gu(t)},parseEase:function(e,t){return arguments.length?gu(e,t):zt},getById:function(e){return jn.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var r=new Li(e),i,s;for(r.smoothChildTiming=ts(e.smoothChildTiming),jn.remove(r),r._dp=0,r._time=r._tTime=jn._time,i=jn._first;i;)s=i._next,(t||!(!i._dur&&i instanceof _r&&i.vars.onComplete===i._targets[0]))&&Ta(r,i,i._start-i._delay),i=s;return Ta(jn,r,0),r},context:function(e,t){return e?new j6(e,t):On},matchMedia:function(e){return new fq(e)},matchMediaRefresh:function(){return vu.forEach(function(e){var t=e.conditions,r,i;for(i in t)t[i]&&(t[i]=!1,r=1);r&&e.revert()})||LM()},addEventListener:function(e,t){var r=gw[e]||(gw[e]=[]);~r.indexOf(t)||r.push(t)},removeEventListener:function(e,t){var r=gw[e],i=r&&r.indexOf(t);i>=0&&r.splice(i,1)},utils:{wrap:VZ,wrapYoyo:jZ,distribute:E6,random:S6,snap:B6,normalize:GZ,getUnit:yi,clamp:kZ,splitColor:R6,toArray:co,selector:UM,mapRange:C6,pipe:QZ,unitize:zZ,interpolate:WZ,shuffle:b6},install:u6,effects:Jb,ticker:Es,updateRoot:Li.updateRoot,plugins:bs,globalTimeline:jn,core:{PropTween:rs,globals:f6,Tween:_r,Timeline:Li,Animation:Pg,getCache:pu,_removeLinkedListItem:Jx,reverting:function(){return xi},context:function(e){return e&&On&&(On.data.push(e),e._ctx=On),On},suppressOverwrites:function(e){return iR=e}}};ns("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return S_[n]=_r[n]});Es.add(Li.updateRoot);Th=S_.to({},{duration:0});var hq=function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r},dq=function(e,t){var r=e._targets,i,s,o;for(i in t)for(s=r.length;s--;)o=e._ptLookup[s][i],o&&(o=o.d)&&(o._pt&&(o=hq(o,i)),o&&o.modifier&&o.modifier(t[i],e,r[s],i))},iE=function(e,t){return{name:e,rawVars:1,init:function(i,s,o){o._onInit=function(a){var l,c;if(Kr(s)&&(l={},ns(s,function(A){return l[A]=1}),s=l),t){l={};for(c in s)l[c]=t(s[c]);s=l}dq(a,s)}}}},ls=S_.registerPlugin({name:"attr",init:function(e,t,r,i,s){var o,a,l;this.tween=r;for(o in t)l=e.getAttribute(o)||"",a=this.add(e,"setAttribute",(l||0)+"",t[o],i,s,0,0,o),a.op=o,a.b=l,this._props.push(o)},render:function(e,t){for(var r=t._pt;r;)xi?r.set(r.t,r.p,r.b,r):r.r(e,r.d),r=r._next}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r],0,0,0,0,0,1)}},iE("roundProps",FM),iE("modifiers"),iE("snap",B6))||S_;_r.version=Li.version=ls.version="3.12.5";A6=1;oR()&&Ed();zt.Power0;zt.Power1;zt.Power2;zt.Power3;zt.Power4;zt.Linear;zt.Quad;zt.Cubic;zt.Quart;zt.Quint;zt.Strong;zt.Elastic;zt.Back;zt.SteppedEase;zt.Bounce;zt.Sine;zt.Expo;zt.Circ;/*! +*/var Ls={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},bd={duration:.5,overwrite:!1,delay:0},aR,Ei,On,co=1e8,_n=1/co,CM=Math.PI*2,BZ=CM/4,SZ=0,a6=Math.sqrt,MZ=Math.cos,CZ=Math.sin,Yr=function(e){return typeof e=="string"},nr=function(e){return typeof e=="function"},ec=function(e){return typeof e=="number"},lR=function(e){return typeof e>"u"},Za=function(e){return typeof e=="object"},ns=function(e){return e!==!1},cR=function(){return typeof window<"u"},Av=function(e){return nr(e)||Yr(e)},l6=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Bi=Array.isArray,TM=/(?:-?\.?\d|\.)+/gi,c6=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Rh=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,tE=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,A6=/[+-]=-?[.\d]+/,u6=/[^,'"\[\]\s]+/gi,TZ=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,jn,Ba,IM,AR,ks={},B_={},f6,h6=function(e){return(B_=Ru(e,ks))&&cs},uR=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},Rg=function(e,t){return!t&&console.warn(e)},d6=function(e,t){return e&&(ks[e]=t)&&B_&&(B_[e]=t)||ks},Ug=function(){return 0},IZ={suppressEvents:!0,isStart:!0,kill:!1},vw={suppressEvents:!0,kill:!1},RZ={suppressEvents:!0},fR={},cA=[],RM={},p6,Es={},nE={},DP=30,yw=[],hR="",dR=function(e){var t=e[0],r,i;if(Za(t)||nr(t)||(e=[e]),!(r=(t._gsap||{}).harness)){for(i=yw.length;i--&&!yw[i].targetTest(t););r=yw[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new k6(e[i],r)))||e.splice(i,1);return e},gu=function(e){return e._gsap||dR(Ao(e))[0]._gsap},m6=function(e,t,r){return(r=e[t])&&nr(r)?e[t]():lR(r)&&e.getAttribute&&e.getAttribute(t)||r},rs=function(e,t){return(e=e.split(",")).forEach(t)||e},fr=function(e){return Math.round(e*1e5)/1e5||0},jr=function(e){return Math.round(e*1e7)/1e7||0},Jh=function(e,t){var r=t.charAt(0),i=parseFloat(t.substr(2));return e=parseFloat(e),r==="+"?e+i:r==="-"?e-i:r==="*"?e*i:e/i},UZ=function(e,t){for(var r=t.length,i=0;e.indexOf(t[i])<0&&++ia;)o=o._prev;return o?(t._next=o._next,o._next=t):(t._next=e[r],e[r]=t),t._next?t._next._prev=t:e[i]=t,t._prev=o,t.parent=t._dp=e,t},t1=function(e,t,r,i){r===void 0&&(r="_first"),i===void 0&&(i="_last");var s=t._prev,o=t._next;s?s._next=o:e[r]===t&&(e[r]=o),o?o._prev=s:e[i]===t&&(e[i]=s),t._next=t._prev=t.parent=null},gA=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove&&e.parent.remove(e),e._act=0},vu=function(e,t){if(e&&(!t||t._end>e._dur||t._start<0))for(var r=e;r;)r._dirty=1,r=r.parent;return e},LZ=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},UM=function(e,t,r,i){return e._startAt&&(Ei?e._startAt.revert(vw):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},DZ=function n(e){return!e||e._ts&&n(e.parent)},OP=function(e){return e._repeat?Ed(e._tTime,e=e.duration()+e._rDelay)*e:0},Ed=function(e,t){var r=Math.floor(e/=t);return e&&r===e?r-1:r},C_=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},n1=function(e){return e._end=jr(e._start+(e._tDur/Math.abs(e._ts||e._rts||_n)||0))},r1=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=jr(r._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),n1(e),r._dirty||vu(r,e)),e},_6=function(e,t){var r;if((t._time||!t._dur&&t._initted||t._start_n)&&t.render(r,!0)),vu(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&r.totalTime(r._tTime),r=r._dp;e._zTime=-_n}},Ia=function(e,t,r,i){return t.parent&&gA(t),t._start=jr((ec(r)?r:r||e!==jn?Js(e,r,t):e._time)+t._delay),t._end=jr(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),w6(e,t,"_first","_last",e._sort?"_start":0),FM(t)||(e._recent=t),i||_6(e,t),e._ts<0&&r1(e,e._tTime),e},x6=function(e,t){return(ks.ScrollTrigger||uR("scrollTrigger",t))&&ks.ScrollTrigger.create(t,e)},b6=function(e,t,r,i,s){if(mR(e,t,s),!e._initted)return 1;if(!r&&e._pt&&!Ei&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&p6!==Bs.frame)return cA.push(e),e._lazy=[s,i],1},NZ=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},FM=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},OZ=function(e,t,r,i){var s=e.ratio,o=t<0||!t&&(!e._start&&NZ(e)&&!(!e._initted&&FM(e))||(e._ts<0||e._dp._ts<0)&&!FM(e))?0:1,a=e._rDelay,l=0,c,A,u;if(a&&e._repeat&&(l=p0(0,e._tDur,t),A=Ed(l,a),e._yoyo&&A&1&&(o=1-o),A!==Ed(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||Ei||i||e._zTime===_n||!t&&e._zTime){if(!e._initted&&b6(e,t,i,r,l))return;for(u=e._zTime,e._zTime=t||(r?_n:0),r||(r=t&&!u),e.ratio=o,e._from&&(o=1-o),e._time=0,e._tTime=l,c=e._pt;c;)c.r(o,c.d),c=c._next;t<0&&UM(e,t,r,!0),e._onUpdate&&!r&&Ts(e,"onUpdate"),l&&e._repeat&&!r&&e.parent&&Ts(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&gA(e,1),!r&&!Ei&&(Ts(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},kZ=function(e,t,r){var i;if(r>t)for(i=e._first;i&&i._start<=r;){if(i.data==="isPause"&&i._start>t)return i;i=i._next}else for(i=e._last;i&&i._start>=r;){if(i.data==="isPause"&&i._start0&&!i&&r1(e,e._tTime=e._tDur*a),e.parent&&n1(e),r||vu(e.parent,e),e},kP=function(e){return e instanceof Ni?vu(e):Bd(e,e._dur)},HZ={_start:0,endTime:Ug,totalDuration:Ug},Js=function n(e,t,r){var i=e.labels,s=e._recent||HZ,o=e.duration()>=co?s.endTime(!1):e._dur,a,l,c;return Yr(t)&&(isNaN(t)||t in i)?(l=t.charAt(0),c=t.substr(-1)==="%",a=t.indexOf("="),l==="<"||l===">"?(a>=0&&(t=t.replace(/=/,"")),(l==="<"?s._start:s.endTime(s._repeat>=0))+(parseFloat(t.substr(1))||0)*(c?(a<0?s:r).totalDuration()/100:1)):a<0?(t in i||(i[t]=o),i[t]):(l=parseFloat(t.charAt(a-1)+t.substr(a+1)),c&&r&&(l=l/100*(Bi(r)?r[0]:r).totalDuration()),a>1?n(e,t.substr(0,a-1),r)+l:o+l)):t==null?o:+t},$m=function(e,t,r){var i=ec(t[1]),s=(i?2:1)+(e<2?0:1),o=t[s],a,l;if(i&&(o.duration=t[1]),o.parent=r,e){for(a=o,l=r;l&&!("immediateRender"in a);)a=l.vars.defaults||{},l=ns(l.vars.inherit)&&l.parent;o.immediateRender=ns(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new xr(t[0],o,t[s+1])},IA=function(e,t){return e||e===0?t(e):t},p0=function(e,t,r){return rt?t:r},wi=function(e,t){return!Yr(e)||!(t=TZ.exec(e))?"":t[1]},QZ=function(e,t,r){return IA(r,function(i){return p0(e,t,i)})},PM=[].slice,E6=function(e,t){return e&&Za(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&Za(e[0]))&&!e.nodeType&&e!==Ba},zZ=function(e,t,r){return r===void 0&&(r=[]),e.forEach(function(i){var s;return Yr(i)&&!t||E6(i,1)?(s=r).push.apply(s,Ao(i)):r.push(i)})||r},Ao=function(e,t,r){return On&&!t&&On.selector?On.selector(e):Yr(e)&&!r&&(IM||!Sd())?PM.call((t||AR).querySelectorAll(e),0):Bi(e)?zZ(e,r):E6(e)?PM.call(e,0):e?[e]:[]},LM=function(e){return e=Ao(e)[0]||Rg("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Ao(t,r.querySelectorAll?r:r===e?Rg("Invalid scope")||AR.createElement("div"):e)}},B6=function(e){return e.sort(function(){return .5-Math.random()})},S6=function(e){if(nr(e))return e;var t=Za(e)?e:{each:e},r=yu(t.ease),i=t.from||0,s=parseFloat(t.base)||0,o={},a=i>0&&i<1,l=isNaN(i)||a,c=t.axis,A=i,u=i;return Yr(i)?A=u={center:.5,edges:.5,end:1}[i]||0:!a&&l&&(A=i[0],u=i[1]),function(f,h,d){var m=(d||t).length,g=o[m],p,v,w,_,x,b,B,S,I;if(!g){if(I=t.grid==="auto"?0:(t.grid||[1,co])[1],!I){for(B=-co;B<(B=d[I++].getBoundingClientRect().left)&&IB&&(B=x),xm?m-1:c?c==="y"?m/I:I:Math.max(I,m/I))||0)*(i==="edges"?-1:1),g.b=m<0?s-m:s,g.u=wi(t.amount||t.each)||0,r=r&&m<0?D6(r):r}return m=(g[f]-g.min)/g.max||0,jr(g.b+(r?r(m):m)*g.v)+g.u}},DM=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var i=jr(Math.round(parseFloat(r)/e)*e*t);return(i-i%1)/t+(ec(r)?0:wi(r))}},M6=function(e,t){var r=Bi(e),i,s;return!r&&Za(e)&&(i=r=e.radius||co,e.values?(e=Ao(e.values),(s=!ec(e[0]))&&(i*=i)):e=DM(e.increment)),IA(t,r?nr(e)?function(o){return s=e(o),Math.abs(s-o)<=i?s:o}:function(o){for(var a=parseFloat(s?o.x:o),l=parseFloat(s?o.y:0),c=co,A=0,u=e.length,f,h;u--;)s?(f=e[u].x-a,h=e[u].y-l,f=f*f+h*h):f=Math.abs(e[u]-a),fi?s-o:o)})},Fg=function(e){for(var t=0,r="",i,s,o,a;~(i=e.indexOf("random(",t));)o=e.indexOf(")",i),a=e.charAt(i+7)==="[",s=e.substr(i+7,o-i-7).match(a?u6:TM),r+=e.substr(t,i-t)+C6(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return r+e.substr(t,e.length-t)},I6=function(e,t,r,i,s){var o=t-e,a=i-r;return IA(s,function(l){return r+((l-e)/o*a||0)})},XZ=function n(e,t,r,i){var s=isNaN(e+t)?0:function(h){return(1-h)*e+h*t};if(!s){var o=Yr(e),a={},l,c,A,u,f;if(r===!0&&(i=1)&&(r=null),o)e={p:e},t={p:t};else if(Bi(e)&&!Bi(t)){for(A=[],u=e.length,f=u-2,c=1;c(a=Math.abs(a))&&(l=o,s=a);return l},Ts=function(e,t,r){var i=e.vars,s=i[t],o=On,a=e._ctx,l,c,A;if(s)return l=i[t+"Params"],c=i.callbackScope||e,r&&cA.length&&S_(),a&&(On=a),A=l?s.apply(c,l):s.call(c),On=o,A},ym=function(e){return gA(e),e.scrollTrigger&&e.scrollTrigger.kill(!!Ei),e.progress()<1&&Ts(e,"onInterrupt"),e},Uh,R6=[],U6=function(e){if(e)if(e=!e.name&&e.default||e,cR()||e.headless){var t=e.name,r=nr(e),i=t&&!r&&e.init?function(){this._props=[]}:e,s={init:Ug,render:yR,add:pR,kill:Aq,modifier:cq,rawVars:0},o={targetTest:0,get:0,getSetter:vR,aliases:{},register:0};if(Sd(),e!==i){if(Es[t])return;xo(i,xo(M_(e,s),o)),Ru(i.prototype,Ru(s,M_(e,o))),Es[i.prop=t]=i,e.targetTest&&(yw.push(i),fR[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}d6(t,i),e.register&&e.register(cs,i,is)}else R6.push(e)},vn=255,wm={aqua:[0,vn,vn],lime:[0,vn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,vn],navy:[0,0,128],white:[vn,vn,vn],olive:[128,128,0],yellow:[vn,vn,0],orange:[vn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[vn,0,0],pink:[vn,192,203],cyan:[0,vn,vn],transparent:[vn,vn,vn,0]},rE=function(e,t,r){return e+=e<0?1:e>1?-1:0,(e*6<1?t+(r-t)*e*6:e<.5?r:e*3<2?t+(r-t)*(2/3-e)*6:t)*vn+.5|0},F6=function(e,t,r){var i=e?ec(e)?[e>>16,e>>8&vn,e&vn]:0:wm.black,s,o,a,l,c,A,u,f,h,d;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),wm[e])i=wm[e];else if(e.charAt(0)==="#"){if(e.length<6&&(s=e.charAt(1),o=e.charAt(2),a=e.charAt(3),e="#"+s+s+o+o+a+a+(e.length===5?e.charAt(4)+e.charAt(4):"")),e.length===9)return i=parseInt(e.substr(1,6),16),[i>>16,i>>8&vn,i&vn,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&vn,e&vn]}else if(e.substr(0,3)==="hsl"){if(i=d=e.match(TM),!t)l=+i[0]%360/360,c=+i[1]/100,A=+i[2]/100,o=A<=.5?A*(c+1):A+c-A*c,s=A*2-o,i.length>3&&(i[3]*=1),i[0]=rE(l+1/3,s,o),i[1]=rE(l,s,o),i[2]=rE(l-1/3,s,o);else if(~e.indexOf("="))return i=e.match(c6),r&&i.length<4&&(i[3]=1),i}else i=e.match(TM)||wm.transparent;i=i.map(Number)}return t&&!d&&(s=i[0]/vn,o=i[1]/vn,a=i[2]/vn,u=Math.max(s,o,a),f=Math.min(s,o,a),A=(u+f)/2,u===f?l=c=0:(h=u-f,c=A>.5?h/(2-u-f):h/(u+f),l=u===s?(o-a)/h+(oe||p<0)&&(r+=p-t),i+=p,x=i-r,w=x-o,(w>0||v)&&(b=++u.frame,f=x-u.time*1e3,u.time=x=x/1e3,o+=w+(w>=s?4:s-w),_=1),v||(l=c(m)),_)for(h=0;h=p&&h--},_listeners:a},u}(),Sd=function(){return!Pg&&Bs.wake()},zt={},$Z=/^[\d.\-M][\d.\-,\s]/,ZZ=/["']/g,qZ=function(e){for(var t={},r=e.substr(1,e.length-3).split(":"),i=r[0],s=1,o=r.length,a,l,c;s1&&r.config?r.config.apply(null,~e.indexOf("{")?[qZ(t[1])]:JZ(e).split(",").map(v6)):zt._CE&&$Z.test(e)?zt._CE("",e):r},D6=function(e){return function(t){return 1-e(1-t)}},N6=function n(e,t){for(var r=e._first,i;r;)r instanceof Ni?n(r,t):r.vars.yoyoEase&&(!r._yoyo||!r._repeat)&&r._yoyo!==t&&(r.timeline?n(r.timeline,t):(i=r._ease,r._ease=r._yEase,r._yEase=i,r._yoyo=t)),r=r._next},yu=function(e,t){return e&&(nr(e)?e:zt[e]||eq(e))||t},Wu=function(e,t,r,i){r===void 0&&(r=function(l){return 1-t(1-l)}),i===void 0&&(i=function(l){return l<.5?t(l*2)/2:1-t((1-l)*2)/2});var s={easeIn:t,easeOut:r,easeInOut:i},o;return rs(e,function(a){zt[a]=ks[a]=s,zt[o=a.toLowerCase()]=r;for(var l in s)zt[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=zt[a+"."+l]=s[l]}),s},O6=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},iE=function n(e,t,r){var i=t>=1?t:1,s=(r||(e?.3:.45))/(t<1?t:1),o=s/CM*(Math.asin(1/i)||0),a=function(A){return A===1?1:i*Math.pow(2,-10*A)*CZ((A-o)*s)+1},l=e==="out"?a:e==="in"?function(c){return 1-a(1-c)}:O6(a);return s=CM/s,l.config=function(c,A){return n(e,c,A)},l},sE=function n(e,t){t===void 0&&(t=1.70158);var r=function(o){return o?--o*o*((t+1)*o+t)+1:0},i=e==="out"?r:e==="in"?function(s){return 1-r(1-s)}:O6(r);return i.config=function(s){return n(e,s)},i};rs("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;Wu(n+",Power"+(t-1),e?function(r){return Math.pow(r,t)}:function(r){return r},function(r){return 1-Math.pow(1-r,t)},function(r){return r<.5?Math.pow(r*2,t)/2:1-Math.pow((1-r)*2,t)/2})});zt.Linear.easeNone=zt.none=zt.Linear.easeIn;Wu("Elastic",iE("in"),iE("out"),iE());(function(n,e){var t=1/e,r=2*t,i=2.5*t,s=function(a){return a0?r+(r+this._rDelay)*this._repeat:r):this.totalDuration()&&this._dur},e.totalDuration=function(r){return arguments.length?(this._dirty=0,Bd(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(r,i){if(Sd(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(r1(this,r),!s._dp||s.parent||_6(s,this);s&&s.parent;)s.parent._time!==s._start+(s._ts>=0?s._tTime/s._ts:(s.totalDuration()-s._tTime)/-s._ts)&&s.totalTime(s._tTime,!0),s=s.parent;!this.parent&&this._dp.autoRemoveChildren&&(this._ts>0&&r0||!this._tDur&&!r)&&Ia(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===_n||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),g6(this,r,i)),this},e.time=function(r,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+OP(this))%(this._dur+this._rDelay)||(r?this._dur:0),i):this._time},e.totalProgress=function(r,i){return arguments.length?this.totalTime(this.totalDuration()*r,i):this.totalDuration()?Math.min(1,this._tTime/this._tDur):this.rawTime()>0?1:0},e.progress=function(r,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-r:r)+OP(this),i):this.duration()?Math.min(1,this._time/this._dur):this.rawTime()>0?1:0},e.iteration=function(r,i){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(r-1)*s,i):this._repeat?Ed(this._tTime,s)+1:1},e.timeScale=function(r,i){if(!arguments.length)return this._rts===-_n?0:this._rts;if(this._rts===r)return this;var s=this.parent&&this._ts?C_(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-_n?0:this._rts,this.totalTime(p0(-Math.abs(this._delay),this._tDur,s),i!==!1),n1(this),LZ(this)},e.paused=function(r){return arguments.length?(this._ps!==r&&(this._ps=r,r?(this._pTime=this._tTime||Math.max(-this._delay,this.rawTime()),this._ts=this._act=0):(Sd(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==_n&&(this._tTime-=_n)))),this):this._ps},e.startTime=function(r){if(arguments.length){this._start=r;var i=this.parent||this._dp;return i&&(i._sort||!this.parent)&&Ia(i,this,r-this._delay),this}return this._start},e.endTime=function(r){return this._start+(ns(r)?this.totalDuration():this.duration())/Math.abs(this._ts||1)},e.rawTime=function(r){var i=this.parent||this._dp;return i?r&&(!this._ts||this._repeat&&this._time&&this.totalProgress()<1)?this._tTime%(this._dur+this._rDelay):this._ts?C_(i.rawTime(r),this):this._tTime:this._tTime},e.revert=function(r){r===void 0&&(r=RZ);var i=Ei;return Ei=r,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),Ei=i,this},e.globalTime=function(r){for(var i=this,s=arguments.length?r:i.rawTime();i;)s=i._start+s/(Math.abs(i._ts)||1),i=i._dp;return!this.parent&&this._sat?this._sat.globalTime(r):s},e.repeat=function(r){return arguments.length?(this._repeat=r===1/0?-2:r,kP(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(r){if(arguments.length){var i=this._time;return this._rDelay=r,kP(this),i?this.time(i):this}return this._rDelay},e.yoyo=function(r){return arguments.length?(this._yoyo=r,this):this._yoyo},e.seek=function(r,i){return this.totalTime(Js(this,r),ns(i))},e.restart=function(r,i){return this.play().totalTime(r?-this._delay:0,ns(i))},e.play=function(r,i){return r!=null&&this.seek(r,i),this.reversed(!1).paused(!1)},e.reverse=function(r,i){return r!=null&&this.seek(r||this.totalDuration(),i),this.reversed(!0).paused(!1)},e.pause=function(r,i){return r!=null&&this.seek(r,i),this.paused(!0)},e.resume=function(){return this.paused(!1)},e.reversed=function(r){return arguments.length?(!!r!==this.reversed()&&this.timeScale(-this._rts||(r?-_n:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-_n,this},e.isActive=function(){var r=this.parent||this._dp,i=this._start,s;return!!(!r||this._ts&&this._initted&&r.isActive()&&(s=r.rawTime(!0))>=i&&s1?(i?(o[r]=i,s&&(o[r+"Params"]=s),r==="onUpdate"&&(this._onUpdate=i)):delete o[r],this):o[r]},e.then=function(r){var i=this;return new Promise(function(s){var o=nr(r)?r:y6,a=function(){var c=i.then;i.then=null,nr(o)&&(o=o(i))&&(o.then||o===i)&&(i.then=c),s(o),i.then=c};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?a():i._prom=a})},e.kill=function(){ym(this)},n}();xo(Lg.prototype,{_time:0,_start:0,_end:0,_tTime:0,_tDur:0,_dirty:0,_repeat:0,_yoyo:!1,parent:null,_initted:!1,_rDelay:0,_ts:1,_dp:0,ratio:0,_zTime:-_n,_prom:0,_ps:!1,_rts:1});var Ni=function(n){o6(e,n);function e(r,i){var s;return r===void 0&&(r={}),s=n.call(this,r)||this,s.labels={},s.smoothChildTiming=!!r.smoothChildTiming,s.autoRemoveChildren=!!r.autoRemoveChildren,s._sort=ns(r.sortChildren),jn&&Ia(r.parent||jn,Il(s),i),r.reversed&&s.reverse(),r.paused&&s.paused(!0),r.scrollTrigger&&x6(Il(s),r.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,o){return $m(0,arguments,this),this},t.from=function(i,s,o){return $m(1,arguments,this),this},t.fromTo=function(i,s,o,a){return $m(2,arguments,this),this},t.set=function(i,s,o){return s.duration=0,s.parent=this,Ym(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new xr(i,s,Js(this,o),1),this},t.call=function(i,s,o){return Ia(this,xr.delayedCall(0,i,s),o)},t.staggerTo=function(i,s,o,a,l,c,A){return o.duration=s,o.stagger=o.stagger||a,o.onComplete=c,o.onCompleteParams=A,o.parent=this,new xr(i,o,Js(this,l)),this},t.staggerFrom=function(i,s,o,a,l,c,A){return o.runBackwards=1,Ym(o).immediateRender=ns(o.immediateRender),this.staggerTo(i,s,o,a,l,c,A)},t.staggerFromTo=function(i,s,o,a,l,c,A,u){return a.startAt=o,Ym(a).immediateRender=ns(a.immediateRender),this.staggerTo(i,s,a,l,c,A,u)},t.render=function(i,s,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,c=this._dur,A=i<=0?0:jr(i),u=this._zTime<0!=i<0&&(this._initted||!c),f,h,d,m,g,p,v,w,_,x,b,B;if(this!==jn&&A>l&&i>=0&&(A=l),A!==this._tTime||o||u){if(a!==this._time&&c&&(A+=this._time-a,i+=this._time-a),f=A,_=this._start,w=this._ts,p=!w,u&&(c||(a=this._zTime),(i||!s)&&(this._zTime=i)),this._repeat){if(b=this._yoyo,g=c+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(g*100+i,s,o);if(f=jr(A%g),A===l?(m=this._repeat,f=c):(m=~~(A/g),m&&m===A/g&&(f=c,m--),f>c&&(f=c)),x=Ed(this._tTime,g),!a&&this._tTime&&x!==m&&this._tTime-x*g-this._dur<=0&&(x=m),b&&m&1&&(f=c-f,B=1),m!==x&&!this._lock){var S=b&&x&1,I=S===(b&&m&1);if(m=a&&i>=0)for(h=this._first;h;){if(d=h._next,(h._act||f>=h._start)&&h._ts&&v!==h){if(h.parent!==this)return this.render(i,s,o);if(h.render(h._ts>0?(f-h._start)*h._ts:(h._dirty?h.totalDuration():h._tDur)+(f-h._start)*h._ts,s,o),f!==this._time||!this._ts&&!p){v=0,d&&(A+=this._zTime=-_n);break}}h=d}else{h=this._last;for(var M=i<0?i:f;h;){if(d=h._prev,(h._act||M<=h._end)&&h._ts&&v!==h){if(h.parent!==this)return this.render(i,s,o);if(h.render(h._ts>0?(M-h._start)*h._ts:(h._dirty?h.totalDuration():h._tDur)+(M-h._start)*h._ts,s,o||Ei&&(h._initted||h._startAt)),f!==this._time||!this._ts&&!p){v=0,d&&(A+=this._zTime=M?-_n:_n);break}}h=d}}if(v&&!s&&(this.pause(),v.render(f>=a?0:-_n)._zTime=f>=a?1:-1,this._ts))return this._start=_,n1(this),this.render(i,s,o);this._onUpdate&&!s&&Ts(this,"onUpdate",!0),(A===l&&this._tTime>=this.totalDuration()||!A&&a)&&(_===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((i||!c)&&(A===l&&this._ts>0||!A&&this._ts<0)&&gA(this,1),!s&&!(i<0&&!a)&&(A||a||!l)&&(Ts(this,A===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(A0)&&this._prom())))}return this},t.add=function(i,s){var o=this;if(ec(s)||(s=Js(this,s,i)),!(i instanceof Lg)){if(Bi(i))return i.forEach(function(a){return o.add(a,s)}),this;if(Yr(i))return this.addLabel(i,s);if(nr(i))i=xr.delayedCall(0,i);else return this}return this!==i?Ia(this,i,s):this},t.getChildren=function(i,s,o,a){i===void 0&&(i=!0),s===void 0&&(s=!0),o===void 0&&(o=!0),a===void 0&&(a=-co);for(var l=[],c=this._first;c;)c._start>=a&&(c instanceof xr?s&&l.push(c):(o&&l.push(c),i&&l.push.apply(l,c.getChildren(!0,s,o)))),c=c._next;return l},t.getById=function(i){for(var s=this.getChildren(1,1,1),o=s.length;o--;)if(s[o].vars.id===i)return s[o]},t.remove=function(i){return Yr(i)?this.removeLabel(i):nr(i)?this.killTweensOf(i):(t1(this,i),i===this._recent&&(this._recent=this._last),vu(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=jr(Bs.time-(this._ts>0?i/this._ts:(this.totalDuration()-i)/-this._ts))),n.prototype.totalTime.call(this,i,s),this._forcing=0,this):this._tTime},t.addLabel=function(i,s){return this.labels[i]=Js(this,s),this},t.removeLabel=function(i){return delete this.labels[i],this},t.addPause=function(i,s,o){var a=xr.delayedCall(0,s||Ug,o);return a.data="isPause",this._hasPause=1,Ia(this,a,Js(this,i))},t.removePause=function(i){var s=this._first;for(i=Js(this,i);s;)s._start===i&&s.data==="isPause"&&gA(s),s=s._next},t.killTweensOf=function(i,s,o){for(var a=this.getTweensOf(i,o),l=a.length;l--;)Wc!==a[l]&&a[l].kill(i,s);return this},t.getTweensOf=function(i,s){for(var o=[],a=Ao(i),l=this._first,c=ec(s),A;l;)l instanceof xr?UZ(l._targets,a)&&(c?(!Wc||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&o.push(l):(A=l.getTweensOf(a,s)).length&&o.push.apply(o,A),l=l._next;return o},t.tweenTo=function(i,s){s=s||{};var o=this,a=Js(o,i),l=s,c=l.startAt,A=l.onStart,u=l.onStartParams,f=l.immediateRender,h,d=xr.to(o,xo({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:s.duration||Math.abs((a-(c&&"time"in c?c.time:o._time))/o.timeScale())||_n,onStart:function(){if(o.pause(),!h){var g=s.duration||Math.abs((a-(c&&"time"in c?c.time:o._time))/o.timeScale());d._dur!==g&&Bd(d,g,0,1).render(d._time,!0,!0),h=1}A&&A.apply(d,u||[])}},s));return f?d.render(0):d},t.tweenFromTo=function(i,s,o){return this.tweenTo(s,xo({startAt:{time:Js(this,i)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),HP(this,Js(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),HP(this,Js(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+_n)},t.shiftChildren=function(i,s,o){o===void 0&&(o=0);for(var a=this._first,l=this.labels,c;a;)a._start>=o&&(a._start+=i,a._end+=i),a=a._next;if(s)for(c in l)l[c]>=o&&(l[c]+=i);return vu(this)},t.invalidate=function(i){var s=this._first;for(this._lock=0;s;)s.invalidate(i),s=s._next;return n.prototype.invalidate.call(this,i)},t.clear=function(i){i===void 0&&(i=!0);for(var s=this._first,o;s;)o=s._next,this.remove(s),s=o;return this._dp&&(this._time=this._tTime=this._pTime=0),i&&(this.labels={}),vu(this)},t.totalDuration=function(i){var s=0,o=this,a=o._last,l=co,c,A,u;if(arguments.length)return o.timeScale((o._repeat<0?o.duration():o.totalDuration())/(o.reversed()?-i:i));if(o._dirty){for(u=o.parent;a;)c=a._prev,a._dirty&&a.totalDuration(),A=a._start,A>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,Ia(o,a,A-a._delay,1)._lock=0):l=A,A<0&&a._ts&&(s-=A,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=A/o._ts,o._time-=A,o._tTime-=A),o.shiftChildren(-A,!1,-1/0),l=0),a._end>s&&a._ts&&(s=a._end),a=c;Bd(o,o===jn&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(i){if(jn._ts&&(g6(jn,C_(i,jn)),p6=Bs.frame),Bs.frame>=DP){DP+=Ls.autoSleep||120;var s=jn._first;if((!s||!s._ts)&&Ls.autoSleep&&Bs._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Bs.sleep()}}},e}(Lg);xo(Ni.prototype,{_lock:0,_hasPause:0,_forcing:0});var tq=function(e,t,r,i,s,o,a){var l=new is(this._pt,e,t,0,1,j6,null,s),c=0,A=0,u,f,h,d,m,g,p,v;for(l.b=r,l.e=i,r+="",i+="",(p=~i.indexOf("random("))&&(i=Fg(i)),o&&(v=[r,i],o(v,e,t),r=v[0],i=v[1]),f=r.match(tE)||[];u=tE.exec(i);)d=u[0],m=i.substring(c,u.index),h?h=(h+1)%5:m.substr(-5)==="rgba("&&(h=1),d!==f[A++]&&(g=parseFloat(f[A-1])||0,l._pt={_next:l._pt,p:m||A===1?m:",",s:g,c:d.charAt(1)==="="?Jh(g,d)-g:parseFloat(d)-g,m:h&&h<4?Math.round:0},c=tE.lastIndex);return l.c=c")}),_.duration();else{b={};for(S in d)S==="ease"||S==="easeEach"||sq(S,d[S],b,d.easeEach);for(S in b)for(T=b[S].sort(function(R,L){return R.t-L.t}),D=0,x=0;xl-_n&&!A?l:i<_n?0:i,f,h,d,m,g,p,v,w,_;if(!c)OZ(this,i,s,o);else if(u!==this._tTime||!i||o||!this._initted&&this._tTime||this._startAt&&this._zTime<0!==A){if(f=u,w=this.timeline,this._repeat){if(m=c+this._rDelay,this._repeat<-1&&A)return this.totalTime(m*100+i,s,o);if(f=jr(u%m),u===l?(d=this._repeat,f=c):(d=~~(u/m),d&&d===jr(u/m)&&(f=c,d--),f>c&&(f=c)),p=this._yoyo&&d&1,p&&(_=this._yEase,f=c-f),g=Ed(this._tTime,m),f===a&&!o&&this._initted&&d===g)return this._tTime=u,this;d!==g&&(w&&this._yEase&&N6(w,p),this.vars.repeatRefresh&&!p&&!this._lock&&this._time!==m&&this._initted&&(this._lock=o=1,this.render(jr(m*d),!0).invalidate()._lock=0))}if(!this._initted){if(b6(this,A?i:f,o,s,u))return this._tTime=0,this;if(a!==this._time&&!(o&&this.vars.repeatRefresh&&d!==g))return this;if(c!==this._dur)return this.render(i,s,o)}if(this._tTime=u,this._time=f,!this._act&&this._ts&&(this._act=1,this._lazy=0),this.ratio=v=(_||this._ease)(f/c),this._from&&(this.ratio=v=1-v),f&&!a&&!s&&!d&&(Ts(this,"onStart"),this._tTime!==u))return this;for(h=this._pt;h;)h.r(v,h.d),h=h._next;w&&w.render(i<0?i:w._dur*w._ease(f/this._dur),s,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(A&&UM(this,i,s,o),Ts(this,"onUpdate")),this._repeat&&d!==g&&this.vars.onRepeat&&!s&&this.parent&&Ts(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(A&&!this._onUpdate&&UM(this,i,!0,!0),(i||!c)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&gA(this,1),!s&&!(A&&!a)&&(u||a||p)&&(Ts(this,u===l?"onComplete":"onReverseComplete",!0),this._prom&&!(u0)&&this._prom()))}return this},t.targets=function(){return this._targets},t.invalidate=function(i){return(!i||!this.vars.runBackwards)&&(this._startAt=0),this._pt=this._op=this._onUpdate=this._lazy=this.ratio=0,this._ptLookup=[],this.timeline&&this.timeline.invalidate(i),n.prototype.invalidate.call(this,i)},t.resetTo=function(i,s,o,a,l){Pg||Bs.wake(),this._ts||this.play();var c=Math.min(this._dur,(this._dp._time-this._start)*this._ts),A;return this._initted||mR(this,c),A=this._ease(c/this._dur),rq(this,i,s,o,a,A,c,l)?this.resetTo(i,s,o,a,1):(r1(this,0),this.parent||w6(this._dp,this,"_first","_last",this._dp._sort?"_start":0),this.render(0))},t.kill=function(i,s){if(s===void 0&&(s="all"),!i&&(!s||s==="all"))return this._lazy=this._pt=0,this.parent?ym(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,Wc&&Wc.vars.overwrite!==!0)._first||ym(this),this.parent&&o!==this.timeline.totalDuration()&&Bd(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=i?Ao(i):a,c=this._ptLookup,A=this._pt,u,f,h,d,m,g,p;if((!s||s==="all")&&PZ(a,l))return s==="all"&&(this._pt=0),ym(this);for(u=this._op=this._op||[],s!=="all"&&(Yr(s)&&(m={},rs(s,function(v){return m[v]=1}),s=m),s=iq(a,s)),p=a.length;p--;)if(~l.indexOf(a[p])){f=c[p],s==="all"?(u[p]=s,d=f,h={}):(h=u[p]=u[p]||{},d=s);for(m in d)g=f&&f[m],g&&((!("kill"in g.d)||g.d.kill(m)===!0)&&t1(this,g,"_pt"),delete f[m]),h!=="all"&&(h[m]=1)}return this._initted&&!this._pt&&A&&ym(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return $m(1,arguments)},e.delayedCall=function(i,s,o,a){return new e(s,0,{immediateRender:!1,lazy:!1,overwrite:!1,delay:i,onComplete:s,onReverseComplete:s,onCompleteParams:o,onReverseCompleteParams:o,callbackScope:a})},e.fromTo=function(i,s,o){return $m(2,arguments)},e.set=function(i,s){return s.duration=0,s.repeatDelay||(s.repeat=0),new e(i,s)},e.killTweensOf=function(i,s,o){return jn.killTweensOf(i,s,o)},e}(Lg);xo(xr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});rs("staggerTo,staggerFrom,staggerFromTo",function(n){xr[n]=function(){var e=new Ni,t=PM.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var gR=function(e,t,r){return e[t]=r},G6=function(e,t,r){return e[t](r)},oq=function(e,t,r,i){return e[t](i.fp,r)},aq=function(e,t,r){return e.setAttribute(t,r)},vR=function(e,t){return nr(e[t])?G6:lR(e[t])&&e.setAttribute?aq:gR},V6=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},lq=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},j6=function(e,t){var r=t._pt,i="";if(!e&&t.b)i=t.b;else if(e===1&&t.e)i=t.e;else{for(;r;)i=r.p+(r.m?r.m(r.s+r.c*e):Math.round((r.s+r.c*e)*1e4)/1e4)+i,r=r._next;i+=t.c}t.set(t.t,t.p,i,t)},yR=function(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next},cq=function(e,t,r,i){for(var s=this._pt,o;s;)o=s._next,s.p===i&&s.modifier(e,t,r),s=o},Aq=function(e){for(var t=this._pt,r,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?t1(this,t,"_pt"):t.dep||(r=1),t=i;return!r},uq=function(e,t,r,i){i.mSet(e,t,i.m.call(i.tween,r,i.mt),i)},W6=function(e){for(var t=e._pt,r,i,s,o;t;){for(r=t._next,i=s;i&&i.pr>t.pr;)i=i._next;(t._prev=i?i._prev:o)?t._prev._next=t:s=t,(t._next=i)?i._prev=t:o=t,t=r}e._pt=s},is=function(){function n(t,r,i,s,o,a,l,c,A){this.t=r,this.s=s,this.c=o,this.p=i,this.r=a||V6,this.d=l||this,this.set=c||gR,this.pr=A||0,this._next=t,t&&(t._prev=this)}var e=n.prototype;return e.modifier=function(r,i,s){this.mSet=this.mSet||this.set,this.set=uq,this.m=r,this.mt=s,this.tween=i},n}();rs(hR+"parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger",function(n){return fR[n]=1});ks.TweenMax=ks.TweenLite=xr;ks.TimelineLite=ks.TimelineMax=Ni;jn=new Ni({sortChildren:!1,defaults:bd,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});Ls.stringFilter=L6;var wu=[],ww={},fq=[],zP=0,hq=0,oE=function(e){return(ww[e]||fq).map(function(t){return t()})},OM=function(){var e=Date.now(),t=[];e-zP>2&&(oE("matchMediaInit"),wu.forEach(function(r){var i=r.queries,s=r.conditions,o,a,l,c;for(a in i)o=Ba.matchMedia(i[a]).matches,o&&(l=1),o!==s[a]&&(s[a]=o,c=1);c&&(r.revert(),l&&t.push(r))}),oE("matchMediaRevert"),t.forEach(function(r){return r.onMatch(r,function(i){return r.add(null,i)})}),zP=e,oE("matchMedia"))},K6=function(){function n(t,r){this.selector=r&&LM(r),this.data=[],this._r=[],this.isReverted=!1,this.id=hq++,t&&this.add(t)}var e=n.prototype;return e.add=function(r,i,s){nr(r)&&(s=i,i=r,r=nr);var o=this,a=function(){var c=On,A=o.selector,u;return c&&c!==o&&c.data.push(o),s&&(o.selector=LM(s)),On=o,u=i.apply(o,arguments),nr(u)&&o._r.push(u),On=c,o.selector=A,o.isReverted=!1,u};return o.last=a,r===nr?a(o,function(l){return o.add(null,l)}):r?o[r]=a:a},e.ignore=function(r){var i=On;On=null,r(this),On=i},e.getTweens=function(){var r=[];return this.data.forEach(function(i){return i instanceof n?r.push.apply(r,i.getTweens()):i instanceof xr&&!(i.parent&&i.parent.data==="nested")&&r.push(i)}),r},e.clear=function(){this._r.length=this.data.length=0},e.kill=function(r,i){var s=this;if(r?function(){for(var a=s.getTweens(),l=s.data.length,c;l--;)c=s.data[l],c.data==="isFlip"&&(c.revert(),c.getChildren(!0,!0,!1).forEach(function(A){return a.splice(a.indexOf(A),1)}));for(a.map(function(A){return{g:A._dur||A._delay||A._sat&&!A._sat.vars.immediateRender?A.globalTime(0):-1/0,t:A}}).sort(function(A,u){return u.g-A.g||-1/0}).forEach(function(A){return A.t.revert(r)}),l=s.data.length;l--;)c=s.data[l],c instanceof Ni?c.data!=="nested"&&(c.scrollTrigger&&c.scrollTrigger.revert(),c.kill()):!(c instanceof xr)&&c.revert&&c.revert(r);s._r.forEach(function(A){return A(r,s)}),s.isReverted=!0}():this.data.forEach(function(a){return a.kill&&a.kill()}),this.clear(),i)for(var o=wu.length;o--;)wu[o].id===this.id&&wu.splice(o,1)},e.revert=function(r){this.kill(r||{})},n}(),dq=function(){function n(t){this.contexts=[],this.scope=t,On&&On.data.push(this)}var e=n.prototype;return e.add=function(r,i,s){Za(r)||(r={matches:r});var o=new K6(0,s||this.scope),a=o.conditions={},l,c,A;On&&!o.selector&&(o.selector=On.selector),this.contexts.push(o),i=o.add("onMatch",i),o.queries=r;for(c in r)c==="all"?A=1:(l=Ba.matchMedia(r[c]),l&&(wu.indexOf(o)<0&&wu.push(o),(a[c]=l.matches)&&(A=1),l.addListener?l.addListener(OM):l.addEventListener("change",OM)));return A&&i(o,function(u){return o.add(null,u)}),this},e.revert=function(r){this.kill(r||{})},e.kill=function(r){this.contexts.forEach(function(i){return i.kill(r,!0)})},n}(),T_={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r1){var i=e.map(function(A){return cs.quickSetter(A,t,r)}),s=i.length;return function(A){for(var u=s;u--;)i[u](A)}}e=e[0]||{};var o=Es[t],a=gu(e),l=a.harness&&(a.harness.aliases||{})[t]||t,c=o?function(A){var u=new o;Uh._pt=0,u.init(e,r?A+r:A,Uh,0,[e]),u.render(1,u),Uh._pt&&yR(1,Uh)}:a.set(e,l);return o?c:function(A){return c(e,l,r?A+r:A,a,1)}},quickTo:function(e,t,r){var i,s=cs.to(e,Ru((i={},i[t]="+=0.1",i.paused=!0,i),r||{})),o=function(l,c,A){return s.resetTo(t,l,c,A)};return o.tween=s,o},isTweening:function(e){return jn.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=yu(e.ease,bd.ease)),NP(bd,e||{})},config:function(e){return NP(Ls,e||{})},registerEffect:function(e){var t=e.name,r=e.effect,i=e.plugins,s=e.defaults,o=e.extendTimeline;(i||"").split(",").forEach(function(a){return a&&!Es[a]&&!ks[a]&&Rg(t+" effect requires "+a+" plugin.")}),nE[t]=function(a,l,c){return r(Ao(a),xo(l||{},s),c)},o&&(Ni.prototype[t]=function(a,l,c){return this.add(nE[t](a,Za(l)?l:(c=l)&&{},this),c)})},registerEase:function(e,t){zt[e]=yu(t)},parseEase:function(e,t){return arguments.length?yu(e,t):zt},getById:function(e){return jn.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var r=new Ni(e),i,s;for(r.smoothChildTiming=ns(e.smoothChildTiming),jn.remove(r),r._dp=0,r._time=r._tTime=jn._time,i=jn._first;i;)s=i._next,(t||!(!i._dur&&i instanceof xr&&i.vars.onComplete===i._targets[0]))&&Ia(r,i,i._start-i._delay),i=s;return Ia(jn,r,0),r},context:function(e,t){return e?new K6(e,t):On},matchMedia:function(e){return new dq(e)},matchMediaRefresh:function(){return wu.forEach(function(e){var t=e.conditions,r,i;for(i in t)t[i]&&(t[i]=!1,r=1);r&&e.revert()})||OM()},addEventListener:function(e,t){var r=ww[e]||(ww[e]=[]);~r.indexOf(t)||r.push(t)},removeEventListener:function(e,t){var r=ww[e],i=r&&r.indexOf(t);i>=0&&r.splice(i,1)},utils:{wrap:WZ,wrapYoyo:KZ,distribute:S6,random:C6,snap:M6,normalize:jZ,getUnit:wi,clamp:QZ,splitColor:F6,toArray:Ao,selector:LM,mapRange:I6,pipe:GZ,unitize:VZ,interpolate:XZ,shuffle:B6},install:h6,effects:nE,ticker:Bs,updateRoot:Ni.updateRoot,plugins:Es,globalTimeline:jn,core:{PropTween:is,globals:d6,Tween:xr,Timeline:Ni,Animation:Lg,getCache:gu,_removeLinkedListItem:t1,reverting:function(){return Ei},context:function(e){return e&&On&&(On.data.push(e),e._ctx=On),On},suppressOverwrites:function(e){return aR=e}}};rs("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return T_[n]=xr[n]});Bs.add(Ni.updateRoot);Uh=T_.to({},{duration:0});var pq=function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r},mq=function(e,t){var r=e._targets,i,s,o;for(i in t)for(s=r.length;s--;)o=e._ptLookup[s][i],o&&(o=o.d)&&(o._pt&&(o=pq(o,i)),o&&o.modifier&&o.modifier(t[i],e,r[s],i))},aE=function(e,t){return{name:e,rawVars:1,init:function(i,s,o){o._onInit=function(a){var l,c;if(Yr(s)&&(l={},rs(s,function(A){return l[A]=1}),s=l),t){l={};for(c in s)l[c]=t(s[c]);s=l}mq(a,s)}}}},cs=T_.registerPlugin({name:"attr",init:function(e,t,r,i,s){var o,a,l;this.tween=r;for(o in t)l=e.getAttribute(o)||"",a=this.add(e,"setAttribute",(l||0)+"",t[o],i,s,0,0,o),a.op=o,a.b=l,this._props.push(o)},render:function(e,t){for(var r=t._pt;r;)Ei?r.set(r.t,r.p,r.b,r):r.r(e,r.d),r=r._next}},{name:"endArray",init:function(e,t){for(var r=t.length;r--;)this.add(e,r,e[r]||0,t[r],0,0,0,0,0,1)}},aE("roundProps",DM),aE("modifiers"),aE("snap",M6))||T_;xr.version=Ni.version=cs.version="3.12.5";f6=1;cR()&&Sd();zt.Power0;zt.Power1;zt.Power2;zt.Power3;zt.Power4;zt.Linear;zt.Quad;zt.Cubic;zt.Quart;zt.Quint;zt.Strong;zt.Elastic;zt.Back;zt.SteppedEase;zt.Bounce;zt.Sine;zt.Expo;zt.Circ;/*! * CSSPlugin 3.12.5 * https://gsap.com * @@ -60,15 +60,15 @@ Error generating stack: `+s.message+` * Subject to the terms at https://gsap.com/standard-license or for * Club GSAP members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com -*/var QP,jc,Zh,gR,cu,zP,vR,pq=function(){return typeof window<"u"},ql={},qA=180/Math.PI,qh=Math.PI/180,nf=Math.atan2,GP=1e8,yR=/([A-Z])/g,mq=/(left|right|width|margin|padding|x)/i,gq=/[\s,\(]\S/,La={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},DM=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},vq=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},yq=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},wq=function(e,t){var r=t.s+t.c*e;t.set(t.t,t.p,~~(r+(r<0?-.5:.5))+t.u,t)},W6=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},K6=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},_q=function(e,t,r){return e.style[t]=r},xq=function(e,t,r){return e.style.setProperty(t,r)},bq=function(e,t,r){return e._gsap[t]=r},Eq=function(e,t,r){return e._gsap.scaleX=e._gsap.scaleY=r},Bq=function(e,t,r,i,s){var o=e._gsap;o.scaleX=o.scaleY=r,o.renderTransform(s,o)},Sq=function(e,t,r,i,s){var o=e._gsap;o[t]=r,o.renderTransform(s,o)},Wn="transform",is=Wn+"Origin",Mq=function n(e,t){var r=this,i=this.target,s=i.style,o=i._gsap;if(e in ql&&s){if(this.tfm=this.tfm||{},e!=="transform")e=La[e]||e,~e.indexOf(",")?e.split(",").forEach(function(a){return r.tfm[a]=Ul(i,a)}):this.tfm[e]=o.x?o[e]:Ul(i,e),e===is&&(this.tfm.zOrigin=o.zOrigin);else return La.transform.split(",").forEach(function(a){return n.call(r,a,t)});if(this.props.indexOf(Wn)>=0)return;o.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(is,t,"")),e=Wn}(s||t)&&this.props.push(e,t,s[e])},X6=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},Cq=function(){var e=this.props,t=this.target,r=t.style,i=t._gsap,s,o;for(s=0;s=0?VP[o]:"")+e},OM=function(){pq()&&window.document&&(QP=window,jc=QP.document,Zh=jc.documentElement,cu=NM("div")||{style:{}},NM("div"),Wn=Bd(Wn),is=Wn+"Origin",cu.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",$6=!!Bd("perspective"),vR=ls.core.reverting,gR=1)},sE=function n(e){var t=NM("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=this.parentNode,i=this.nextSibling,s=this.style.cssText,o;if(Zh.appendChild(t),t.appendChild(this),this.style.display="block",e)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=n}catch{}else this._gsapBBox&&(o=this._gsapBBox());return r&&(i?r.insertBefore(this,i):r.appendChild(this)),Zh.removeChild(t),this.style.cssText=s,o},jP=function(e,t){for(var r=t.length;r--;)if(e.hasAttribute(t[r]))return e.getAttribute(t[r])},Z6=function(e){var t;try{t=e.getBBox()}catch{t=sE.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===sE||(t=sE.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+jP(e,["x","cx","x1"])||0,y:+jP(e,["y","cy","y1"])||0,width:0,height:0}:t},q6=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&Z6(e))},Tu=function(e,t){if(t){var r=e.style,i;t in ql&&t!==is&&(t=Wn),r.removeProperty?(i=t.substr(0,2),(i==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),r.removeProperty(i==="--"?t:t.replace(yR,"-$1").toLowerCase())):r.removeAttribute(t)}},Wc=function(e,t,r,i,s,o){var a=new rs(e._pt,t,r,0,1,o?K6:W6);return e._pt=a,a.b=i,a.e=s,e._props.push(r),a},WP={deg:1,rad:1,turn:1},Tq={grid:1,flex:1},mA=function n(e,t,r,i){var s=parseFloat(r)||0,o=(r+"").trim().substr((s+"").length)||"px",a=cu.style,l=mq.test(t),c=e.tagName.toLowerCase()==="svg",A=(c?"client":"offset")+(l?"Width":"Height"),u=100,f=i==="px",h=i==="%",d,m,g,p;if(i===o||!s||WP[i]||WP[o])return s;if(o!=="px"&&!f&&(s=n(e,t,r,"px")),p=e.getCTM&&q6(e),(h||o==="%")&&(ql[t]||~t.indexOf("adius")))return d=p?e.getBBox()[l?"width":"height"]:e[A],fr(h?s/d*u:s/100*d);if(a[l?"width":"height"]=u+(f?o:i),m=~t.indexOf("adius")||i==="em"&&e.appendChild&&!c?e:e.parentNode,p&&(m=(e.ownerSVGElement||{}).parentNode),(!m||m===jc||!m.appendChild)&&(m=jc.body),g=m._gsap,g&&h&&g.width&&l&&g.time===Es.time&&!g.uncache)return fr(s/g.width*u);if(h&&(t==="height"||t==="width")){var v=e.style[t];e.style[t]=u+i,d=e[A],v?e.style[t]=v:Tu(e,t)}else(h||o==="%")&&!Tq[Ga(m,"display")]&&(a.position=Ga(e,"position")),m===e&&(a.position="static"),m.appendChild(cu),d=cu[A],m.removeChild(cu),a.position="absolute";return l&&h&&(g=pu(m),g.time=Es.time,g.width=m[A]),fr(f?d*s/u:d&&s?u/d*s:0)},Ul=function(e,t,r,i){var s;return gR||OM(),t in La&&t!=="transform"&&(t=La[t],~t.indexOf(",")&&(t=t.split(",")[0])),ql[t]&&t!=="transform"?(s=Dg(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:C_(Ga(e,is))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=M_[t]&&M_[t](e,t,r)||Ga(e,t)||d6(e,t)||(t==="opacity"?1:0))),r&&!~(s+"").trim().indexOf(" ")?mA(e,t,s,r)+r:s},Iq=function(e,t,r,i){if(!r||r==="none"){var s=Bd(t,e,1),o=s&&Ga(e,s,1);o&&o!==r?(t=s,r=o):t==="borderColor"&&(r=Ga(e,"borderTopColor"))}var a=new rs(this._pt,e.style,t,0,1,G6),l=0,c=0,A,u,f,h,d,m,g,p,v,w,_,x;if(a.b=r,a.e=i,r+="",i+="",i==="auto"&&(m=e.style[t],e.style[t]=i,i=Ga(e,t)||i,m?e.style[t]=m:Tu(e,t)),A=[r,i],F6(A),r=A[0],i=A[1],f=r.match(Ch)||[],x=i.match(Ch)||[],x.length){for(;u=Ch.exec(i);)g=u[0],v=i.substring(l,u.index),d?d=(d+1)%5:(v.substr(-5)==="rgba("||v.substr(-5)==="hsla(")&&(d=1),g!==(m=f[c++]||"")&&(h=parseFloat(m)||0,_=m.substr((h+"").length),g.charAt(1)==="="&&(g=$h(h,g)+_),p=parseFloat(g),w=g.substr((p+"").length),l=Ch.lastIndex-w.length,w||(w=w||Ps.units[t]||_,l===i.length&&(i+=w,a.e+=w)),_!==w&&(h=mA(e,t,m,w)||0),a._pt={_next:a._pt,p:v||c===1?v:",",s:h,c:p-h,m:d&&d<4||t==="zIndex"?Math.round:0});a.c=l-1;)a=s[c],ql[a]&&(l=1,a=a==="transformOrigin"?is:Wn),Tu(r,a);l&&(Tu(r,Wn),o&&(o.svg&&r.removeAttribute("transform"),Dg(r,1),o.uncache=1,X6(i)))}},M_={clearProps:function(e,t,r,i,s){if(s.data!=="isFromStart"){var o=e._pt=new rs(e._pt,t,r,0,0,Uq);return o.u=i,o.pr=-10,o.tween=s,e._props.push(r),1}}},Lg=[1,0,0,1,0,0],J6={},ez=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},XP=function(e){var t=Ga(e,Wn);return ez(t)?Lg:t.substr(7).match(a6).map(fr)},wR=function(e,t){var r=e._gsap||pu(e),i=e.style,s=XP(e),o,a,l,c;return r.svg&&e.getAttribute("transform")?(l=e.transform.baseVal.consolidate().matrix,s=[l.a,l.b,l.c,l.d,l.e,l.f],s.join(",")==="1,0,0,1,0,0"?Lg:s):(s===Lg&&!e.offsetParent&&e!==Zh&&!r.svg&&(l=i.display,i.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(c=1,a=e.nextElementSibling,Zh.appendChild(e)),s=XP(e),l?i.display=l:Tu(e,"display"),c&&(a?o.insertBefore(e,a):o?o.appendChild(e):Zh.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},kM=function(e,t,r,i,s,o){var a=e._gsap,l=s||wR(e,!0),c=a.xOrigin||0,A=a.yOrigin||0,u=a.xOffset||0,f=a.yOffset||0,h=l[0],d=l[1],m=l[2],g=l[3],p=l[4],v=l[5],w=t.split(" "),_=parseFloat(w[0])||0,x=parseFloat(w[1])||0,b,B,M,I;r?l!==Lg&&(B=h*g-d*m)&&(M=_*(g/B)+x*(-m/B)+(m*v-g*p)/B,I=_*(-d/B)+x*(h/B)-(h*v-d*p)/B,_=M,x=I):(b=Z6(e),_=b.x+(~w[0].indexOf("%")?_/100*b.width:_),x=b.y+(~(w[1]||w[0]).indexOf("%")?x/100*b.height:x)),i||i!==!1&&a.smooth?(p=_-c,v=x-A,a.xOffset=u+(p*h+v*m)-p,a.yOffset=f+(p*d+v*g)-v):a.xOffset=a.yOffset=0,a.xOrigin=_,a.yOrigin=x,a.smooth=!!i,a.origin=t,a.originIsAbsolute=!!r,e.style[is]="0px 0px",o&&(Wc(o,a,"xOrigin",c,_),Wc(o,a,"yOrigin",A,x),Wc(o,a,"xOffset",u,a.xOffset),Wc(o,a,"yOffset",f,a.yOffset)),e.setAttribute("data-svg-origin",_+" "+x)},Dg=function(e,t){var r=e._gsap||new N6(e);if("x"in r&&!t&&!r.uncache)return r;var i=e.style,s=r.scaleX<0,o="px",a="deg",l=getComputedStyle(e),c=Ga(e,is)||"0",A,u,f,h,d,m,g,p,v,w,_,x,b,B,M,I,S,L,O,T,y,E,U,P,N,z,W,H,C,K,te,F;return A=u=f=m=g=p=v=w=_=0,h=d=1,r.svg=!!(e.getCTM&&q6(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Wn]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Wn]!=="none"?l[Wn]:"")),i.scale=i.rotate=i.translate="none"),B=wR(e,r.svg),r.svg&&(r.uncache?(N=e.getBBox(),c=r.xOrigin-N.x+"px "+(r.yOrigin-N.y)+"px",P=""):P=!t&&e.getAttribute("data-svg-origin"),kM(e,P||c,!!P||r.originIsAbsolute,r.smooth!==!1,B)),x=r.xOrigin||0,b=r.yOrigin||0,B!==Lg&&(L=B[0],O=B[1],T=B[2],y=B[3],A=E=B[4],u=U=B[5],B.length===6?(h=Math.sqrt(L*L+O*O),d=Math.sqrt(y*y+T*T),m=L||O?nf(O,L)*qA:0,v=T||y?nf(T,y)*qA+m:0,v&&(d*=Math.abs(Math.cos(v*qh))),r.svg&&(A-=x-(x*L+b*T),u-=b-(x*O+b*y))):(F=B[6],K=B[7],W=B[8],H=B[9],C=B[10],te=B[11],A=B[12],u=B[13],f=B[14],M=nf(F,C),g=M*qA,M&&(I=Math.cos(-M),S=Math.sin(-M),P=E*I+W*S,N=U*I+H*S,z=F*I+C*S,W=E*-S+W*I,H=U*-S+H*I,C=F*-S+C*I,te=K*-S+te*I,E=P,U=N,F=z),M=nf(-T,C),p=M*qA,M&&(I=Math.cos(-M),S=Math.sin(-M),P=L*I-W*S,N=O*I-H*S,z=T*I-C*S,te=y*S+te*I,L=P,O=N,T=z),M=nf(O,L),m=M*qA,M&&(I=Math.cos(M),S=Math.sin(M),P=L*I+O*S,N=E*I+U*S,O=O*I-L*S,U=U*I-E*S,L=P,E=N),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,p=180-p),h=fr(Math.sqrt(L*L+O*O+T*T)),d=fr(Math.sqrt(U*U+F*F)),M=nf(E,U),v=Math.abs(M)>2e-4?M*qA:0,_=te?1/(te<0?-te:te):0),r.svg&&(P=e.getAttribute("transform"),r.forceCSS=e.setAttribute("transform","")||!ez(Ga(e,Wn)),P&&e.setAttribute("transform",P))),Math.abs(v)>90&&Math.abs(v)<270&&(s?(h*=-1,v+=m<=0?180:-180,m+=m<=0?180:-180):(d*=-1,v+=v<=0?180:-180)),t=t||r.uncache,r.x=A-((r.xPercent=A&&(!t&&r.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-A)?-50:0)))?e.offsetWidth*r.xPercent/100:0)+o,r.y=u-((r.yPercent=u&&(!t&&r.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-u)?-50:0)))?e.offsetHeight*r.yPercent/100:0)+o,r.z=f+o,r.scaleX=fr(h),r.scaleY=fr(d),r.rotation=fr(m)+a,r.rotationX=fr(g)+a,r.rotationY=fr(p)+a,r.skewX=v+a,r.skewY=w+a,r.transformPerspective=_+o,(r.zOrigin=parseFloat(c.split(" ")[2])||!t&&r.zOrigin||0)&&(i[is]=C_(c)),r.xOffset=r.yOffset=0,r.force3D=Ps.force3D,r.renderTransform=r.svg?Pq:$6?tz:Fq,r.uncache=0,r},C_=function(e){return(e=e.split(" "))[0]+" "+e[1]},oE=function(e,t,r){var i=yi(t);return fr(parseFloat(t)+parseFloat(mA(e,"x",r+"px",i)))+i},Fq=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,tz(e,t)},UA="0deg",Sp="0px",FA=") ",tz=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.z,c=r.rotation,A=r.rotationY,u=r.rotationX,f=r.skewX,h=r.skewY,d=r.scaleX,m=r.scaleY,g=r.transformPerspective,p=r.force3D,v=r.target,w=r.zOrigin,_="",x=p==="auto"&&e&&e!==1||p===!0;if(w&&(u!==UA||A!==UA)){var b=parseFloat(A)*qh,B=Math.sin(b),M=Math.cos(b),I;b=parseFloat(u)*qh,I=Math.cos(b),o=oE(v,o,B*I*-w),a=oE(v,a,-Math.sin(b)*-w),l=oE(v,l,M*I*-w+w)}g!==Sp&&(_+="perspective("+g+FA),(i||s)&&(_+="translate("+i+"%, "+s+"%) "),(x||o!==Sp||a!==Sp||l!==Sp)&&(_+=l!==Sp||x?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+FA),c!==UA&&(_+="rotate("+c+FA),A!==UA&&(_+="rotateY("+A+FA),u!==UA&&(_+="rotateX("+u+FA),(f!==UA||h!==UA)&&(_+="skew("+f+", "+h+FA),(d!==1||m!==1)&&(_+="scale("+d+", "+m+FA),v.style[Wn]=_||"translate(0, 0)"},Pq=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.rotation,c=r.skewX,A=r.skewY,u=r.scaleX,f=r.scaleY,h=r.target,d=r.xOrigin,m=r.yOrigin,g=r.xOffset,p=r.yOffset,v=r.forceCSS,w=parseFloat(o),_=parseFloat(a),x,b,B,M,I;l=parseFloat(l),c=parseFloat(c),A=parseFloat(A),A&&(A=parseFloat(A),c+=A,l+=A),l||c?(l*=qh,c*=qh,x=Math.cos(l)*u,b=Math.sin(l)*u,B=Math.sin(l-c)*-f,M=Math.cos(l-c)*f,c&&(A*=qh,I=Math.tan(c-A),I=Math.sqrt(1+I*I),B*=I,M*=I,A&&(I=Math.tan(A),I=Math.sqrt(1+I*I),x*=I,b*=I)),x=fr(x),b=fr(b),B=fr(B),M=fr(M)):(x=u,M=f,b=B=0),(w&&!~(o+"").indexOf("px")||_&&!~(a+"").indexOf("px"))&&(w=mA(h,"x",o,"px"),_=mA(h,"y",a,"px")),(d||m||g||p)&&(w=fr(w+d-(d*x+m*B)+g),_=fr(_+m-(d*b+m*M)+p)),(i||s)&&(I=h.getBBox(),w=fr(w+i/100*I.width),_=fr(_+s/100*I.height)),I="matrix("+x+","+b+","+B+","+M+","+w+","+_+")",h.setAttribute("transform",I),v&&(h.style[Wn]=I)},Lq=function(e,t,r,i,s){var o=360,a=Kr(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?qA:1),c=l-i,A=i+c+"deg",u,f;return a&&(u=s.split("_")[1],u==="short"&&(c%=o,c!==c%(o/2)&&(c+=c<0?o:-o)),u==="cw"&&c<0?c=(c+o*GP)%o-~~(c/o)*o:u==="ccw"&&c>0&&(c=(c-o*GP)%o-~~(c/o)*o)),e._pt=f=new rs(e._pt,t,r,i,c,vq),f.e=A,f.u="deg",e._props.push(r),f},YP=function(e,t){for(var r in t)e[r]=t[r];return e},Dq=function(e,t,r){var i=YP({},r._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=r.style,a,l,c,A,u,f,h,d;i.svg?(c=r.getAttribute("transform"),r.setAttribute("transform",""),o[Wn]=t,a=Dg(r,1),Tu(r,Wn),r.setAttribute("transform",c)):(c=getComputedStyle(r)[Wn],o[Wn]=t,a=Dg(r,1),o[Wn]=c);for(l in ql)c=i[l],A=a[l],c!==A&&s.indexOf(l)<0&&(h=yi(c),d=yi(A),u=h!==d?mA(r,l,c,d):parseFloat(c),f=parseFloat(A),e._pt=new rs(e._pt,a,l,u,f-u,DM),e._pt.u=d||0,e._props.push(l));YP(a,i)};ns("padding,margin,Width,Radius",function(n,e){var t="Top",r="Right",i="Bottom",s="Left",o=(e<3?[t,r,i,s]:[t+s,t+r,i+r,i+s]).map(function(a){return e<2?n+a:"border"+a+n});M_[e>1?"border"+n:n]=function(a,l,c,A,u){var f,h;if(arguments.length<4)return f=o.map(function(d){return Ul(a,d,c)}),h=f.join(" "),h.split(f[0]).length===5?f[0]:h;f=(A+"").split(" "),h={},o.forEach(function(d,m){return h[d]=f[m]=f[m]||f[(m-1)/2|0]}),a.init(l,h,u)}});var nz={name:"css",register:OM,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,r,i,s){var o=this._props,a=e.style,l=r.vars.startAt,c,A,u,f,h,d,m,g,p,v,w,_,x,b,B,M;gR||OM(),this.styles=this.styles||Y6(e),M=this.styles.props,this.tween=r;for(m in t)if(m!=="autoRound"&&(A=t[m],!(bs[m]&&O6(m,t,r,i,e,s)))){if(h=typeof A,d=M_[m],h==="function"&&(A=A.call(r,i,e,s),h=typeof A),h==="string"&&~A.indexOf("random(")&&(A=Ug(A)),d)d(this,e,m,A,r)&&(B=1);else if(m.substr(0,2)==="--")c=(getComputedStyle(e).getPropertyValue(m)+"").trim(),A+="",lA.lastIndex=0,lA.test(c)||(g=yi(c),p=yi(A)),p?g!==p&&(c=mA(e,m,c,p)+p):g&&(A+=g),this.add(a,"setProperty",c,A,i,s,0,0,m),o.push(m),M.push(m,0,a[m]);else if(h!=="undefined"){if(l&&m in l?(c=typeof l[m]=="function"?l[m].call(r,i,e,s):l[m],Kr(c)&&~c.indexOf("random(")&&(c=Ug(c)),yi(c+"")||c==="auto"||(c+=Ps.units[m]||yi(Ul(e,m))||""),(c+"").charAt(1)==="="&&(c=Ul(e,m))):c=Ul(e,m),f=parseFloat(c),v=h==="string"&&A.charAt(1)==="="&&A.substr(0,2),v&&(A=A.substr(2)),u=parseFloat(A),m in La&&(m==="autoAlpha"&&(f===1&&Ul(e,"visibility")==="hidden"&&u&&(f=0),M.push("visibility",0,a.visibility),Wc(this,a,"visibility",f?"inherit":"hidden",u?"inherit":"hidden",!u)),m!=="scale"&&m!=="transform"&&(m=La[m],~m.indexOf(",")&&(m=m.split(",")[0]))),w=m in ql,w){if(this.styles.save(m),_||(x=e._gsap,x.renderTransform&&!t.parseTransform||Dg(e,t.parseTransform),b=t.smoothOrigin!==!1&&x.smooth,_=this._pt=new rs(this._pt,a,Wn,0,1,x.renderTransform,x,0,-1),_.dep=1),m==="scale")this._pt=new rs(this._pt,x,"scaleY",x.scaleY,(v?$h(x.scaleY,v+u):u)-x.scaleY||0,DM),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){M.push(is,0,a[is]),A=Rq(A),x.svg?kM(e,A,0,b,0,this):(p=parseFloat(A.split(" ")[2])||0,p!==x.zOrigin&&Wc(this,x,"zOrigin",x.zOrigin,p),Wc(this,a,m,C_(c),C_(A)));continue}else if(m==="svgOrigin"){kM(e,A,1,b,0,this);continue}else if(m in J6){Lq(this,x,m,f,v?$h(f,v+A):A);continue}else if(m==="smoothOrigin"){Wc(this,x,"smooth",x.smooth,A);continue}else if(m==="force3D"){x[m]=A;continue}else if(m==="transform"){Dq(this,A,e);continue}}else m in a||(m=Bd(m)||m);if(w||(u||u===0)&&(f||f===0)&&!gq.test(A)&&m in a)g=(c+"").substr((f+"").length),u||(u=0),p=yi(A)||(m in Ps.units?Ps.units[m]:g),g!==p&&(f=mA(e,m,c,p)),this._pt=new rs(this._pt,w?x:a,m,f,(v?$h(f,v+u):u)-f,!w&&(p==="px"||m==="zIndex")&&t.autoRound!==!1?wq:DM),this._pt.u=p||0,g!==p&&p!=="%"&&(this._pt.b=c,this._pt.r=yq);else if(m in a)Iq.call(this,e,m,c,v?v+A:A);else if(m in e)this.add(e,m,c||e[m],v?v+A:A,i,s);else if(m!=="parseTransform"){lR(m,A);continue}w||(m in a?M.push(m,0,a[m]):M.push(m,1,c||e[m])),o.push(m)}}B&&V6(this)},render:function(e,t){if(t.tween._time||!vR())for(var r=t._pt;r;)r.r(e,r.d),r=r._next;else t.styles.revert()},get:Ul,aliases:La,getSetter:function(e,t,r){var i=La[t];return i&&i.indexOf(",")<0&&(t=i),t in ql&&t!==is&&(e._gsap.x||Ul(e,"x"))?r&&zP===r?t==="scale"?Eq:bq:(zP=r||{})&&(t==="scale"?Bq:Sq):e.style&&!sR(e.style[t])?_q:~t.indexOf("-")?xq:pR(e,t)},core:{_removeProperty:Tu,_getMatrix:wR}};ls.utils.checkPrefix=Bd;ls.core.getStyleSaver=Y6;(function(n,e,t,r){var i=ns(n+","+e+","+t,function(s){ql[s]=1});ns(e,function(s){Ps.units[s]="deg",J6[s]=1}),La[i[13]]=n+","+e,ns(r,function(s){var o=s.split(":");La[o[1]]=i[o[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");ns("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){Ps.units[n]="px"});ls.registerPlugin(nz);var HM=ls.registerPlugin(nz)||ls;HM.core.Tween;function Vd(){localStorage&&Object.keys(localStorage).map(n=>{this.setItem(n,localStorage[n],!1)}),Object.defineProperty(this,"length",{get:function(){return Object.keys(this).length},enumerable:!1})}Vd.prototype.key=function(n){return Object.keys(this)[n]};Vd.prototype.getItem=function(n){try{return JSON.parse(this[n])}catch{}return this[n]};Vd.prototype.setItem=function(n,e,t=!0){const r=typeof e=="string"?e:JSON.stringify(e);return t&&localStorage.setItem(n,r),this[n]=r};Vd.prototype.removeItem=function(n){delete this[n]};Vd.prototype.clear=function(){Object.keys(this).forEach(n=>delete this[n])};let Nq=new Vd;const Oq=n=>({get(e,t){return n.getItem(String(t))},set(e,t,r){return n.setItem(String(t),r),!0}}),kq=(n=Nq)=>new Proxy({},Oq(n)),Qe=kq();/** +*/var GP,Kc,ed,wR,uu,VP,_R,gq=function(){return typeof window<"u"},tc={},eu=180/Math.PI,td=Math.PI/180,of=Math.atan2,jP=1e8,xR=/([A-Z])/g,vq=/(left|right|width|margin|padding|x)/i,yq=/[\s,\(]\S/,Da={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},kM=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},wq=function(e,t){return t.set(t.t,t.p,e===1?t.e:Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},_q=function(e,t){return t.set(t.t,t.p,e?Math.round((t.s+t.c*e)*1e4)/1e4+t.u:t.b,t)},xq=function(e,t){var r=t.s+t.c*e;t.set(t.t,t.p,~~(r+(r<0?-.5:.5))+t.u,t)},X6=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},Y6=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},bq=function(e,t,r){return e.style[t]=r},Eq=function(e,t,r){return e.style.setProperty(t,r)},Bq=function(e,t,r){return e._gsap[t]=r},Sq=function(e,t,r){return e._gsap.scaleX=e._gsap.scaleY=r},Mq=function(e,t,r,i,s){var o=e._gsap;o.scaleX=o.scaleY=r,o.renderTransform(s,o)},Cq=function(e,t,r,i,s){var o=e._gsap;o[t]=r,o.renderTransform(s,o)},Wn="transform",ss=Wn+"Origin",Tq=function n(e,t){var r=this,i=this.target,s=i.style,o=i._gsap;if(e in tc&&s){if(this.tfm=this.tfm||{},e!=="transform")e=Da[e]||e,~e.indexOf(",")?e.split(",").forEach(function(a){return r.tfm[a]=Pl(i,a)}):this.tfm[e]=o.x?o[e]:Pl(i,e),e===ss&&(this.tfm.zOrigin=o.zOrigin);else return Da.transform.split(",").forEach(function(a){return n.call(r,a,t)});if(this.props.indexOf(Wn)>=0)return;o.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(ss,t,"")),e=Wn}(s||t)&&this.props.push(e,t,s[e])},$6=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},Iq=function(){var e=this.props,t=this.target,r=t.style,i=t._gsap,s,o;for(s=0;s=0?WP[o]:"")+e},QM=function(){gq()&&window.document&&(GP=window,Kc=GP.document,ed=Kc.documentElement,uu=HM("div")||{style:{}},HM("div"),Wn=Md(Wn),ss=Wn+"Origin",uu.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",q6=!!Md("perspective"),_R=cs.core.reverting,wR=1)},lE=function n(e){var t=HM("svg",this.ownerSVGElement&&this.ownerSVGElement.getAttribute("xmlns")||"http://www.w3.org/2000/svg"),r=this.parentNode,i=this.nextSibling,s=this.style.cssText,o;if(ed.appendChild(t),t.appendChild(this),this.style.display="block",e)try{o=this.getBBox(),this._gsapBBox=this.getBBox,this.getBBox=n}catch{}else this._gsapBBox&&(o=this._gsapBBox());return r&&(i?r.insertBefore(this,i):r.appendChild(this)),ed.removeChild(t),this.style.cssText=s,o},KP=function(e,t){for(var r=t.length;r--;)if(e.hasAttribute(t[r]))return e.getAttribute(t[r])},J6=function(e){var t;try{t=e.getBBox()}catch{t=lE.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===lE||(t=lE.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+KP(e,["x","cx","x1"])||0,y:+KP(e,["y","cy","y1"])||0,width:0,height:0}:t},ez=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&J6(e))},Uu=function(e,t){if(t){var r=e.style,i;t in tc&&t!==ss&&(t=Wn),r.removeProperty?(i=t.substr(0,2),(i==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),r.removeProperty(i==="--"?t:t.replace(xR,"-$1").toLowerCase())):r.removeAttribute(t)}},Xc=function(e,t,r,i,s,o){var a=new is(e._pt,t,r,0,1,o?Y6:X6);return e._pt=a,a.b=i,a.e=s,e._props.push(r),a},XP={deg:1,rad:1,turn:1},Rq={grid:1,flex:1},vA=function n(e,t,r,i){var s=parseFloat(r)||0,o=(r+"").trim().substr((s+"").length)||"px",a=uu.style,l=vq.test(t),c=e.tagName.toLowerCase()==="svg",A=(c?"client":"offset")+(l?"Width":"Height"),u=100,f=i==="px",h=i==="%",d,m,g,p;if(i===o||!s||XP[i]||XP[o])return s;if(o!=="px"&&!f&&(s=n(e,t,r,"px")),p=e.getCTM&&ez(e),(h||o==="%")&&(tc[t]||~t.indexOf("adius")))return d=p?e.getBBox()[l?"width":"height"]:e[A],fr(h?s/d*u:s/100*d);if(a[l?"width":"height"]=u+(f?o:i),m=~t.indexOf("adius")||i==="em"&&e.appendChild&&!c?e:e.parentNode,p&&(m=(e.ownerSVGElement||{}).parentNode),(!m||m===Kc||!m.appendChild)&&(m=Kc.body),g=m._gsap,g&&h&&g.width&&l&&g.time===Bs.time&&!g.uncache)return fr(s/g.width*u);if(h&&(t==="height"||t==="width")){var v=e.style[t];e.style[t]=u+i,d=e[A],v?e.style[t]=v:Uu(e,t)}else(h||o==="%")&&!Rq[Va(m,"display")]&&(a.position=Va(e,"position")),m===e&&(a.position="static"),m.appendChild(uu),d=uu[A],m.removeChild(uu),a.position="absolute";return l&&h&&(g=gu(m),g.time=Bs.time,g.width=m[A]),fr(f?d*s/u:d&&s?u/d*s:0)},Pl=function(e,t,r,i){var s;return wR||QM(),t in Da&&t!=="transform"&&(t=Da[t],~t.indexOf(",")&&(t=t.split(",")[0])),tc[t]&&t!=="transform"?(s=Ng(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:R_(Va(e,ss))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=I_[t]&&I_[t](e,t,r)||Va(e,t)||m6(e,t)||(t==="opacity"?1:0))),r&&!~(s+"").trim().indexOf(" ")?vA(e,t,s,r)+r:s},Uq=function(e,t,r,i){if(!r||r==="none"){var s=Md(t,e,1),o=s&&Va(e,s,1);o&&o!==r?(t=s,r=o):t==="borderColor"&&(r=Va(e,"borderTopColor"))}var a=new is(this._pt,e.style,t,0,1,j6),l=0,c=0,A,u,f,h,d,m,g,p,v,w,_,x;if(a.b=r,a.e=i,r+="",i+="",i==="auto"&&(m=e.style[t],e.style[t]=i,i=Va(e,t)||i,m?e.style[t]=m:Uu(e,t)),A=[r,i],L6(A),r=A[0],i=A[1],f=r.match(Rh)||[],x=i.match(Rh)||[],x.length){for(;u=Rh.exec(i);)g=u[0],v=i.substring(l,u.index),d?d=(d+1)%5:(v.substr(-5)==="rgba("||v.substr(-5)==="hsla(")&&(d=1),g!==(m=f[c++]||"")&&(h=parseFloat(m)||0,_=m.substr((h+"").length),g.charAt(1)==="="&&(g=Jh(h,g)+_),p=parseFloat(g),w=g.substr((p+"").length),l=Rh.lastIndex-w.length,w||(w=w||Ls.units[t]||_,l===i.length&&(i+=w,a.e+=w)),_!==w&&(h=vA(e,t,m,w)||0),a._pt={_next:a._pt,p:v||c===1?v:",",s:h,c:p-h,m:d&&d<4||t==="zIndex"?Math.round:0});a.c=l-1;)a=s[c],tc[a]&&(l=1,a=a==="transformOrigin"?ss:Wn),Uu(r,a);l&&(Uu(r,Wn),o&&(o.svg&&r.removeAttribute("transform"),Ng(r,1),o.uncache=1,$6(i)))}},I_={clearProps:function(e,t,r,i,s){if(s.data!=="isFromStart"){var o=e._pt=new is(e._pt,t,r,0,0,Pq);return o.u=i,o.pr=-10,o.tween=s,e._props.push(r),1}}},Dg=[1,0,0,1,0,0],tz={},nz=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},$P=function(e){var t=Va(e,Wn);return nz(t)?Dg:t.substr(7).match(c6).map(fr)},bR=function(e,t){var r=e._gsap||gu(e),i=e.style,s=$P(e),o,a,l,c;return r.svg&&e.getAttribute("transform")?(l=e.transform.baseVal.consolidate().matrix,s=[l.a,l.b,l.c,l.d,l.e,l.f],s.join(",")==="1,0,0,1,0,0"?Dg:s):(s===Dg&&!e.offsetParent&&e!==ed&&!r.svg&&(l=i.display,i.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(c=1,a=e.nextElementSibling,ed.appendChild(e)),s=$P(e),l?i.display=l:Uu(e,"display"),c&&(a?o.insertBefore(e,a):o?o.appendChild(e):ed.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},zM=function(e,t,r,i,s,o){var a=e._gsap,l=s||bR(e,!0),c=a.xOrigin||0,A=a.yOrigin||0,u=a.xOffset||0,f=a.yOffset||0,h=l[0],d=l[1],m=l[2],g=l[3],p=l[4],v=l[5],w=t.split(" "),_=parseFloat(w[0])||0,x=parseFloat(w[1])||0,b,B,S,I;r?l!==Dg&&(B=h*g-d*m)&&(S=_*(g/B)+x*(-m/B)+(m*v-g*p)/B,I=_*(-d/B)+x*(h/B)-(h*v-d*p)/B,_=S,x=I):(b=J6(e),_=b.x+(~w[0].indexOf("%")?_/100*b.width:_),x=b.y+(~(w[1]||w[0]).indexOf("%")?x/100*b.height:x)),i||i!==!1&&a.smooth?(p=_-c,v=x-A,a.xOffset=u+(p*h+v*m)-p,a.yOffset=f+(p*d+v*g)-v):a.xOffset=a.yOffset=0,a.xOrigin=_,a.yOrigin=x,a.smooth=!!i,a.origin=t,a.originIsAbsolute=!!r,e.style[ss]="0px 0px",o&&(Xc(o,a,"xOrigin",c,_),Xc(o,a,"yOrigin",A,x),Xc(o,a,"xOffset",u,a.xOffset),Xc(o,a,"yOffset",f,a.yOffset)),e.setAttribute("data-svg-origin",_+" "+x)},Ng=function(e,t){var r=e._gsap||new k6(e);if("x"in r&&!t&&!r.uncache)return r;var i=e.style,s=r.scaleX<0,o="px",a="deg",l=getComputedStyle(e),c=Va(e,ss)||"0",A,u,f,h,d,m,g,p,v,w,_,x,b,B,S,I,M,P,D,T,y,E,R,L,N,z,W,H,C,K,ee,F;return A=u=f=m=g=p=v=w=_=0,h=d=1,r.svg=!!(e.getCTM&&ez(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Wn]=(l.translate!=="none"?"translate3d("+(l.translate+" 0 0").split(" ").slice(0,3).join(", ")+") ":"")+(l.rotate!=="none"?"rotate("+l.rotate+") ":"")+(l.scale!=="none"?"scale("+l.scale.split(" ").join(",")+") ":"")+(l[Wn]!=="none"?l[Wn]:"")),i.scale=i.rotate=i.translate="none"),B=bR(e,r.svg),r.svg&&(r.uncache?(N=e.getBBox(),c=r.xOrigin-N.x+"px "+(r.yOrigin-N.y)+"px",L=""):L=!t&&e.getAttribute("data-svg-origin"),zM(e,L||c,!!L||r.originIsAbsolute,r.smooth!==!1,B)),x=r.xOrigin||0,b=r.yOrigin||0,B!==Dg&&(P=B[0],D=B[1],T=B[2],y=B[3],A=E=B[4],u=R=B[5],B.length===6?(h=Math.sqrt(P*P+D*D),d=Math.sqrt(y*y+T*T),m=P||D?of(D,P)*eu:0,v=T||y?of(T,y)*eu+m:0,v&&(d*=Math.abs(Math.cos(v*td))),r.svg&&(A-=x-(x*P+b*T),u-=b-(x*D+b*y))):(F=B[6],K=B[7],W=B[8],H=B[9],C=B[10],ee=B[11],A=B[12],u=B[13],f=B[14],S=of(F,C),g=S*eu,S&&(I=Math.cos(-S),M=Math.sin(-S),L=E*I+W*M,N=R*I+H*M,z=F*I+C*M,W=E*-M+W*I,H=R*-M+H*I,C=F*-M+C*I,ee=K*-M+ee*I,E=L,R=N,F=z),S=of(-T,C),p=S*eu,S&&(I=Math.cos(-S),M=Math.sin(-S),L=P*I-W*M,N=D*I-H*M,z=T*I-C*M,ee=y*M+ee*I,P=L,D=N,T=z),S=of(D,P),m=S*eu,S&&(I=Math.cos(S),M=Math.sin(S),L=P*I+D*M,N=E*I+R*M,D=D*I-P*M,R=R*I-E*M,P=L,E=N),g&&Math.abs(g)+Math.abs(m)>359.9&&(g=m=0,p=180-p),h=fr(Math.sqrt(P*P+D*D+T*T)),d=fr(Math.sqrt(R*R+F*F)),S=of(E,R),v=Math.abs(S)>2e-4?S*eu:0,_=ee?1/(ee<0?-ee:ee):0),r.svg&&(L=e.getAttribute("transform"),r.forceCSS=e.setAttribute("transform","")||!nz(Va(e,Wn)),L&&e.setAttribute("transform",L))),Math.abs(v)>90&&Math.abs(v)<270&&(s?(h*=-1,v+=m<=0?180:-180,m+=m<=0?180:-180):(d*=-1,v+=v<=0?180:-180)),t=t||r.uncache,r.x=A-((r.xPercent=A&&(!t&&r.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-A)?-50:0)))?e.offsetWidth*r.xPercent/100:0)+o,r.y=u-((r.yPercent=u&&(!t&&r.yPercent||(Math.round(e.offsetHeight/2)===Math.round(-u)?-50:0)))?e.offsetHeight*r.yPercent/100:0)+o,r.z=f+o,r.scaleX=fr(h),r.scaleY=fr(d),r.rotation=fr(m)+a,r.rotationX=fr(g)+a,r.rotationY=fr(p)+a,r.skewX=v+a,r.skewY=w+a,r.transformPerspective=_+o,(r.zOrigin=parseFloat(c.split(" ")[2])||!t&&r.zOrigin||0)&&(i[ss]=R_(c)),r.xOffset=r.yOffset=0,r.force3D=Ls.force3D,r.renderTransform=r.svg?Dq:q6?rz:Lq,r.uncache=0,r},R_=function(e){return(e=e.split(" "))[0]+" "+e[1]},cE=function(e,t,r){var i=wi(t);return fr(parseFloat(t)+parseFloat(vA(e,"x",r+"px",i)))+i},Lq=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,rz(e,t)},PA="0deg",Mp="0px",LA=") ",rz=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.z,c=r.rotation,A=r.rotationY,u=r.rotationX,f=r.skewX,h=r.skewY,d=r.scaleX,m=r.scaleY,g=r.transformPerspective,p=r.force3D,v=r.target,w=r.zOrigin,_="",x=p==="auto"&&e&&e!==1||p===!0;if(w&&(u!==PA||A!==PA)){var b=parseFloat(A)*td,B=Math.sin(b),S=Math.cos(b),I;b=parseFloat(u)*td,I=Math.cos(b),o=cE(v,o,B*I*-w),a=cE(v,a,-Math.sin(b)*-w),l=cE(v,l,S*I*-w+w)}g!==Mp&&(_+="perspective("+g+LA),(i||s)&&(_+="translate("+i+"%, "+s+"%) "),(x||o!==Mp||a!==Mp||l!==Mp)&&(_+=l!==Mp||x?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+LA),c!==PA&&(_+="rotate("+c+LA),A!==PA&&(_+="rotateY("+A+LA),u!==PA&&(_+="rotateX("+u+LA),(f!==PA||h!==PA)&&(_+="skew("+f+", "+h+LA),(d!==1||m!==1)&&(_+="scale("+d+", "+m+LA),v.style[Wn]=_||"translate(0, 0)"},Dq=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.rotation,c=r.skewX,A=r.skewY,u=r.scaleX,f=r.scaleY,h=r.target,d=r.xOrigin,m=r.yOrigin,g=r.xOffset,p=r.yOffset,v=r.forceCSS,w=parseFloat(o),_=parseFloat(a),x,b,B,S,I;l=parseFloat(l),c=parseFloat(c),A=parseFloat(A),A&&(A=parseFloat(A),c+=A,l+=A),l||c?(l*=td,c*=td,x=Math.cos(l)*u,b=Math.sin(l)*u,B=Math.sin(l-c)*-f,S=Math.cos(l-c)*f,c&&(A*=td,I=Math.tan(c-A),I=Math.sqrt(1+I*I),B*=I,S*=I,A&&(I=Math.tan(A),I=Math.sqrt(1+I*I),x*=I,b*=I)),x=fr(x),b=fr(b),B=fr(B),S=fr(S)):(x=u,S=f,b=B=0),(w&&!~(o+"").indexOf("px")||_&&!~(a+"").indexOf("px"))&&(w=vA(h,"x",o,"px"),_=vA(h,"y",a,"px")),(d||m||g||p)&&(w=fr(w+d-(d*x+m*B)+g),_=fr(_+m-(d*b+m*S)+p)),(i||s)&&(I=h.getBBox(),w=fr(w+i/100*I.width),_=fr(_+s/100*I.height)),I="matrix("+x+","+b+","+B+","+S+","+w+","+_+")",h.setAttribute("transform",I),v&&(h.style[Wn]=I)},Nq=function(e,t,r,i,s){var o=360,a=Yr(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?eu:1),c=l-i,A=i+c+"deg",u,f;return a&&(u=s.split("_")[1],u==="short"&&(c%=o,c!==c%(o/2)&&(c+=c<0?o:-o)),u==="cw"&&c<0?c=(c+o*jP)%o-~~(c/o)*o:u==="ccw"&&c>0&&(c=(c-o*jP)%o-~~(c/o)*o)),e._pt=f=new is(e._pt,t,r,i,c,wq),f.e=A,f.u="deg",e._props.push(r),f},ZP=function(e,t){for(var r in t)e[r]=t[r];return e},Oq=function(e,t,r){var i=ZP({},r._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=r.style,a,l,c,A,u,f,h,d;i.svg?(c=r.getAttribute("transform"),r.setAttribute("transform",""),o[Wn]=t,a=Ng(r,1),Uu(r,Wn),r.setAttribute("transform",c)):(c=getComputedStyle(r)[Wn],o[Wn]=t,a=Ng(r,1),o[Wn]=c);for(l in tc)c=i[l],A=a[l],c!==A&&s.indexOf(l)<0&&(h=wi(c),d=wi(A),u=h!==d?vA(r,l,c,d):parseFloat(c),f=parseFloat(A),e._pt=new is(e._pt,a,l,u,f-u,kM),e._pt.u=d||0,e._props.push(l));ZP(a,i)};rs("padding,margin,Width,Radius",function(n,e){var t="Top",r="Right",i="Bottom",s="Left",o=(e<3?[t,r,i,s]:[t+s,t+r,i+r,i+s]).map(function(a){return e<2?n+a:"border"+a+n});I_[e>1?"border"+n:n]=function(a,l,c,A,u){var f,h;if(arguments.length<4)return f=o.map(function(d){return Pl(a,d,c)}),h=f.join(" "),h.split(f[0]).length===5?f[0]:h;f=(A+"").split(" "),h={},o.forEach(function(d,m){return h[d]=f[m]=f[m]||f[(m-1)/2|0]}),a.init(l,h,u)}});var iz={name:"css",register:QM,targetTest:function(e){return e.style&&e.nodeType},init:function(e,t,r,i,s){var o=this._props,a=e.style,l=r.vars.startAt,c,A,u,f,h,d,m,g,p,v,w,_,x,b,B,S;wR||QM(),this.styles=this.styles||Z6(e),S=this.styles.props,this.tween=r;for(m in t)if(m!=="autoRound"&&(A=t[m],!(Es[m]&&H6(m,t,r,i,e,s)))){if(h=typeof A,d=I_[m],h==="function"&&(A=A.call(r,i,e,s),h=typeof A),h==="string"&&~A.indexOf("random(")&&(A=Fg(A)),d)d(this,e,m,A,r)&&(B=1);else if(m.substr(0,2)==="--")c=(getComputedStyle(e).getPropertyValue(m)+"").trim(),A+="",AA.lastIndex=0,AA.test(c)||(g=wi(c),p=wi(A)),p?g!==p&&(c=vA(e,m,c,p)+p):g&&(A+=g),this.add(a,"setProperty",c,A,i,s,0,0,m),o.push(m),S.push(m,0,a[m]);else if(h!=="undefined"){if(l&&m in l?(c=typeof l[m]=="function"?l[m].call(r,i,e,s):l[m],Yr(c)&&~c.indexOf("random(")&&(c=Fg(c)),wi(c+"")||c==="auto"||(c+=Ls.units[m]||wi(Pl(e,m))||""),(c+"").charAt(1)==="="&&(c=Pl(e,m))):c=Pl(e,m),f=parseFloat(c),v=h==="string"&&A.charAt(1)==="="&&A.substr(0,2),v&&(A=A.substr(2)),u=parseFloat(A),m in Da&&(m==="autoAlpha"&&(f===1&&Pl(e,"visibility")==="hidden"&&u&&(f=0),S.push("visibility",0,a.visibility),Xc(this,a,"visibility",f?"inherit":"hidden",u?"inherit":"hidden",!u)),m!=="scale"&&m!=="transform"&&(m=Da[m],~m.indexOf(",")&&(m=m.split(",")[0]))),w=m in tc,w){if(this.styles.save(m),_||(x=e._gsap,x.renderTransform&&!t.parseTransform||Ng(e,t.parseTransform),b=t.smoothOrigin!==!1&&x.smooth,_=this._pt=new is(this._pt,a,Wn,0,1,x.renderTransform,x,0,-1),_.dep=1),m==="scale")this._pt=new is(this._pt,x,"scaleY",x.scaleY,(v?Jh(x.scaleY,v+u):u)-x.scaleY||0,kM),this._pt.u=0,o.push("scaleY",m),m+="X";else if(m==="transformOrigin"){S.push(ss,0,a[ss]),A=Fq(A),x.svg?zM(e,A,0,b,0,this):(p=parseFloat(A.split(" ")[2])||0,p!==x.zOrigin&&Xc(this,x,"zOrigin",x.zOrigin,p),Xc(this,a,m,R_(c),R_(A)));continue}else if(m==="svgOrigin"){zM(e,A,1,b,0,this);continue}else if(m in tz){Nq(this,x,m,f,v?Jh(f,v+A):A);continue}else if(m==="smoothOrigin"){Xc(this,x,"smooth",x.smooth,A);continue}else if(m==="force3D"){x[m]=A;continue}else if(m==="transform"){Oq(this,A,e);continue}}else m in a||(m=Md(m)||m);if(w||(u||u===0)&&(f||f===0)&&!yq.test(A)&&m in a)g=(c+"").substr((f+"").length),u||(u=0),p=wi(A)||(m in Ls.units?Ls.units[m]:g),g!==p&&(f=vA(e,m,c,p)),this._pt=new is(this._pt,w?x:a,m,f,(v?Jh(f,v+u):u)-f,!w&&(p==="px"||m==="zIndex")&&t.autoRound!==!1?xq:kM),this._pt.u=p||0,g!==p&&p!=="%"&&(this._pt.b=c,this._pt.r=_q);else if(m in a)Uq.call(this,e,m,c,v?v+A:A);else if(m in e)this.add(e,m,c||e[m],v?v+A:A,i,s);else if(m!=="parseTransform"){uR(m,A);continue}w||(m in a?S.push(m,0,a[m]):S.push(m,1,c||e[m])),o.push(m)}}B&&W6(this)},render:function(e,t){if(t.tween._time||!_R())for(var r=t._pt;r;)r.r(e,r.d),r=r._next;else t.styles.revert()},get:Pl,aliases:Da,getSetter:function(e,t,r){var i=Da[t];return i&&i.indexOf(",")<0&&(t=i),t in tc&&t!==ss&&(e._gsap.x||Pl(e,"x"))?r&&VP===r?t==="scale"?Sq:Bq:(VP=r||{})&&(t==="scale"?Mq:Cq):e.style&&!lR(e.style[t])?bq:~t.indexOf("-")?Eq:vR(e,t)},core:{_removeProperty:Uu,_getMatrix:bR}};cs.utils.checkPrefix=Md;cs.core.getStyleSaver=Z6;(function(n,e,t,r){var i=rs(n+","+e+","+t,function(s){tc[s]=1});rs(e,function(s){Ls.units[s]="deg",tz[s]=1}),Da[i[13]]=n+","+e,rs(r,function(s){var o=s.split(":");Da[o[1]]=i[o[0]]})})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent","rotation,rotationX,rotationY,skewX,skewY","transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective","0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY");rs("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){Ls.units[n]="px"});cs.registerPlugin(iz);var GM=cs.registerPlugin(iz)||cs;GM.core.Tween;function Wd(){localStorage&&Object.keys(localStorage).map(n=>{this.setItem(n,localStorage[n],!1)}),Object.defineProperty(this,"length",{get:function(){return Object.keys(this).length},enumerable:!1})}Wd.prototype.key=function(n){return Object.keys(this)[n]};Wd.prototype.getItem=function(n){try{return JSON.parse(this[n])}catch{}return this[n]};Wd.prototype.setItem=function(n,e,t=!0){const r=typeof e=="string"?e:JSON.stringify(e);return t&&localStorage.setItem(n,r),this[n]=r};Wd.prototype.removeItem=function(n){delete this[n]};Wd.prototype.clear=function(){Object.keys(this).forEach(n=>delete this[n])};let kq=new Wd;const Hq=n=>({get(e,t){return n.getItem(String(t))},set(e,t,r){return n.setItem(String(t),r),!0}}),Qq=(n=kq)=>new Proxy({},Hq(n)),Qe=Qq();/** * @license * Copyright 2010-2024 Three.js Authors * SPDX-License-Identifier: MIT - */const Jl="169",Jh={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Ih={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Hq=0,$P=1,Qq=2,rz=1,zq=2,xl=3,ks=0,si=1,wi=2,zl=0,ed=1,Iu=2,ZP=3,qP=4,Gq=5,ru=100,Vq=101,jq=102,Wq=103,Kq=104,Xq=200,Yq=201,$q=202,Zq=203,QM=204,zM=205,qq=206,Jq=207,eJ=208,tJ=209,nJ=210,rJ=211,iJ=212,sJ=213,oJ=214,GM=0,VM=1,jM=2,Sd=3,WM=4,KM=5,XM=6,YM=7,n1=0,aJ=1,lJ=2,cA=0,cJ=1,AJ=2,uJ=3,fJ=4,hJ=5,dJ=6,pJ=7,JP="attached",mJ="detached",iz=300,Md=301,Cd=302,T_=303,$M=304,r1=306,Hs=1e3,Zo=1001,Ng=1002,jr=1003,_R=1004,Rh=1005,Xi=1006,Zm=1007,Da=1008,ec=1009,sz=1010,oz=1011,Og=1012,xR=1013,gA=1014,Ts=1015,jd=1016,bR=1017,ER=1018,Td=1020,az=35902,lz=1021,cz=1022,Lr=1023,Az=1024,uz=1025,td=1026,Id=1027,BR=1028,i1=1029,fz=1030,SR=1031,MR=1033,vw=33776,yw=33777,ww=33778,_w=33779,ZM=35840,qM=35841,JM=35842,eC=35843,tC=36196,nC=37492,rC=37496,iC=37808,sC=37809,oC=37810,aC=37811,lC=37812,cC=37813,AC=37814,uC=37815,fC=37816,hC=37817,dC=37818,pC=37819,mC=37820,gC=37821,xw=36492,vC=36494,yC=36495,hz=36283,wC=36284,_C=36285,xC=36286,gJ=2200,vJ=2201,yJ=2202,Rd=2300,Ud=2301,aE=2302,Uh=2400,Fh=2401,I_=2402,CR=2500,wJ=2501,_J=0,dz=1,bC=2,xJ=3200,bJ=3201,Wd=0,EJ=1,Ia="",kt="srgb",Xr="srgb-linear",TR="display-p3",s1="display-p3-linear",R_="linear",Sn="srgb",U_="rec709",F_="p3",rf=7680,eL=519,BJ=512,SJ=513,MJ=514,pz=515,CJ=516,TJ=517,IJ=518,RJ=519,EC=35044,UJ=35048,tL="300 es",Ol=2e3,P_=2001;class TA{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});const r=this._listeners;r[e]===void 0&&(r[e]=[]),r[e].indexOf(t)===-1&&r[e].push(t)}hasEventListener(e,t){if(this._listeners===void 0)return!1;const r=this._listeners;return r[e]!==void 0&&r[e].indexOf(t)!==-1}removeEventListener(e,t){if(this._listeners===void 0)return;const i=this._listeners[e];if(i!==void 0){const s=i.indexOf(t);s!==-1&&i.splice(s,1)}}dispatchEvent(e){if(this._listeners===void 0)return;const r=this._listeners[e.type];if(r!==void 0){e.target=this;const i=r.slice(0);for(let s=0,o=i.length;s>8&255]+ui[n>>16&255]+ui[n>>24&255]+"-"+ui[e&255]+ui[e>>8&255]+"-"+ui[e>>16&15|64]+ui[e>>24&255]+"-"+ui[t&63|128]+ui[t>>8&255]+"-"+ui[t>>16&255]+ui[t>>24&255]+ui[r&255]+ui[r>>8&255]+ui[r>>16&255]+ui[r>>24&255]).toLowerCase()}function xr(n,e,t){return Math.max(e,Math.min(t,n))}function IR(n,e){return(n%e+e)%e}function FJ(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function PJ(n,e,t){return n!==e?(t-n)/(e-n):0}function Jm(n,e,t){return(1-t)*n+t*e}function LJ(n,e,t,r){return Jm(n,e,1-Math.exp(-t*r))}function DJ(n,e=1){return e-Math.abs(IR(n,e*2)-e)}function NJ(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function OJ(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function kJ(n,e){return n+Math.floor(Math.random()*(e-n+1))}function HJ(n,e){return n+Math.random()*(e-n)}function QJ(n){return n*(.5-Math.random())}function zJ(n){n!==void 0&&(nL=n);let e=nL+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function GJ(n){return n*qm}function VJ(n){return n*Fd}function jJ(n){return(n&n-1)===0&&n!==0}function WJ(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function KJ(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function XJ(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+r)/2),A=o((e+r)/2),u=s((e-r)/2),f=o((e-r)/2),h=s((r-e)/2),d=o((r-e)/2);switch(i){case"XYX":n.set(a*A,l*u,l*f,a*c);break;case"YZY":n.set(l*f,a*A,l*u,a*c);break;case"ZXZ":n.set(l*u,l*f,a*A,a*c);break;case"XZX":n.set(a*A,l*d,l*h,a*c);break;case"YXY":n.set(l*h,a*A,l*d,a*c);break;case"ZYZ":n.set(l*d,l*h,a*A,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function Yo(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function fn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Et={DEG2RAD:qm,RAD2DEG:Fd,generateUUID:ta,clamp:xr,euclideanModulo:IR,mapLinear:FJ,inverseLerp:PJ,lerp:Jm,damp:LJ,pingpong:DJ,smoothstep:NJ,smootherstep:OJ,randInt:kJ,randFloat:HJ,randFloatSpread:QJ,seededRandom:zJ,degToRad:GJ,radToDeg:VJ,isPowerOfTwo:jJ,ceilPowerOfTwo:WJ,floorPowerOfTwo:KJ,setQuaternionFromProperEuler:XJ,normalize:fn,denormalize:Yo};class je{constructor(e=0,t=0){je.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(xr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ut{constructor(e,t,r,i,s,o,a,l,c){ut.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c)}set(e,t,r,i,s,o,a,l,c){const A=this.elements;return A[0]=e,A[1]=i,A[2]=a,A[3]=t,A[4]=s,A[5]=l,A[6]=r,A[7]=o,A[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],A=r[4],u=r[7],f=r[2],h=r[5],d=r[8],m=i[0],g=i[3],p=i[6],v=i[1],w=i[4],_=i[7],x=i[2],b=i[5],B=i[8];return s[0]=o*m+a*v+l*x,s[3]=o*g+a*w+l*b,s[6]=o*p+a*_+l*B,s[1]=c*m+A*v+u*x,s[4]=c*g+A*w+u*b,s[7]=c*p+A*_+u*B,s[2]=f*m+h*v+d*x,s[5]=f*g+h*w+d*b,s[8]=f*p+h*_+d*B,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8];return t*o*A-t*a*c-r*s*A+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8],u=A*o-a*c,f=a*l-A*s,h=c*s-o*l,d=t*u+r*f+i*h;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return e[0]=u*m,e[1]=(i*c-A*r)*m,e[2]=(a*r-i*o)*m,e[3]=f*m,e[4]=(A*t-i*l)*m,e[5]=(i*s-a*t)*m,e[6]=h*m,e[7]=(r*l-c*t)*m,e[8]=(o*t-r*s)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(lE.makeScale(e,t)),this}rotate(e){return this.premultiply(lE.makeRotation(-e)),this}translate(e,t){return this.premultiply(lE.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const lE=new ut;function mz(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function kg(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function YJ(){const n=kg("canvas");return n.style.display="block",n}const rL={};function bw(n){n in rL||(rL[n]=!0,console.warn(n))}function $J(n,e,t){return new Promise(function(r,i){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:i();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:r()}}setTimeout(s,t)})}function ZJ(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function qJ(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const iL=new ut().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),sL=new ut().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Mp={[Xr]:{transfer:R_,primaries:U_,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n,fromReference:n=>n},[kt]:{transfer:Sn,primaries:U_,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[s1]:{transfer:R_,primaries:F_,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.applyMatrix3(sL),fromReference:n=>n.applyMatrix3(iL)},[TR]:{transfer:Sn,primaries:F_,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.convertSRGBToLinear().applyMatrix3(sL),fromReference:n=>n.applyMatrix3(iL).convertLinearToSRGB()}},JJ=new Set([Xr,s1]),bt={enabled:!0,_workingColorSpace:Xr,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!JJ.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const r=Mp[e].toReference,i=Mp[t].fromReference;return i(r(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Mp[n].primaries},getTransfer:function(n){return n===Ia?R_:Mp[n].transfer},getLuminanceCoefficients:function(n,e=this._workingColorSpace){return n.fromArray(Mp[e].luminanceCoefficients)}};function nd(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function cE(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let sf;class eee{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{sf===void 0&&(sf=kg("canvas")),sf.width=e.width,sf.height=e.height;const r=sf.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=sf}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=kg("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==iz)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Hs:e.x=e.x-Math.floor(e.x);break;case Zo:e.x=e.x<0?0:1;break;case Ng:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Hs:e.y=e.y-Math.floor(e.y);break;case Zo:e.y=e.y<0?0:1;break;case Ng:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Hn.DEFAULT_IMAGE=null;Hn.DEFAULT_MAPPING=iz;Hn.DEFAULT_ANISOTROPY=1;class Ut{constructor(e=0,t=0,r=0,i=1){Ut.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,i,s;const l=e.elements,c=l[0],A=l[4],u=l[8],f=l[1],h=l[5],d=l[9],m=l[2],g=l[6],p=l[10];if(Math.abs(A-f)<.01&&Math.abs(u-m)<.01&&Math.abs(d-g)<.01){if(Math.abs(A+f)<.1&&Math.abs(u+m)<.1&&Math.abs(d+g)<.1&&Math.abs(c+h+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,_=(h+1)/2,x=(p+1)/2,b=(A+f)/4,B=(u+m)/4,M=(d+g)/4;return w>_&&w>x?w<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(w),i=b/r,s=B/r):_>x?_<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(_),r=b/i,s=M/i):x<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(x),r=B/s,i=M/s),this.set(r,i,s,t),this}let v=Math.sqrt((g-d)*(g-d)+(u-m)*(u-m)+(f-A)*(f-A));return Math.abs(v)<.001&&(v=1),this.x=(g-d)/v,this.y=(u-m)/v,this.z=(f-A)/v,this.w=Math.acos((c+h+p-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class ree extends TA{constructor(e=1,t=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ut(0,0,e,t),this.scissorTest=!1,this.viewport=new Ut(0,0,e,t);const i={width:e,height:t,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Xi,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new Hn(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a=0?1:-1,w=1-p*p;if(w>Number.EPSILON){const x=Math.sqrt(w),b=Math.atan2(x,p*v);g=Math.sin(g*b)/x,a=Math.sin(a*b)/x}const _=a*v;if(l=l*g+f*_,c=c*g+h*_,A=A*g+d*_,u=u*g+m*_,g===1-a){const x=1/Math.sqrt(l*l+c*c+A*A+u*u);l*=x,c*=x,A*=x,u*=x}}e[t]=l,e[t+1]=c,e[t+2]=A,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],A=r[i+3],u=s[o],f=s[o+1],h=s[o+2],d=s[o+3];return e[t]=a*d+A*u+l*h-c*f,e[t+1]=l*d+A*f+c*u-a*h,e[t+2]=c*d+A*h+a*f-l*u,e[t+3]=A*d-a*u-l*f-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),A=a(i/2),u=a(s/2),f=l(r/2),h=l(i/2),d=l(s/2);switch(o){case"XYZ":this._x=f*A*u+c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u-f*h*d;break;case"YXZ":this._x=f*A*u+c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u+f*h*d;break;case"ZXY":this._x=f*A*u-c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u-f*h*d;break;case"ZYX":this._x=f*A*u-c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u+f*h*d;break;case"YZX":this._x=f*A*u+c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u-f*h*d;break;case"XZY":this._x=f*A*u-c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u+f*h*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],A=t[6],u=t[10],f=r+a+u;if(f>0){const h=.5/Math.sqrt(f+1);this._w=.25/h,this._x=(A-l)*h,this._y=(s-c)*h,this._z=(o-i)*h}else if(r>a&&r>u){const h=2*Math.sqrt(1+r-a-u);this._w=(A-l)/h,this._x=.25*h,this._y=(i+o)/h,this._z=(s+c)/h}else if(a>u){const h=2*Math.sqrt(1+a-r-u);this._w=(s-c)/h,this._x=(i+o)/h,this._y=.25*h,this._z=(l+A)/h}else{const h=2*Math.sqrt(1+u-r-a);this._w=(o-i)/h,this._x=(s+c)/h,this._y=(l+A)/h,this._z=.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(xr(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,A=t._w;return this._x=r*A+o*a+i*c-s*l,this._y=i*A+o*l+s*a-r*c,this._z=s*A+o*c+r*l-i*a,this._w=o*A-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const h=1-t;return this._w=h*o+t*this._w,this._x=h*r+t*this._x,this._y=h*i+t*this._y,this._z=h*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),A=Math.atan2(c,a),u=Math.sin((1-t)*A)/c,f=Math.sin(t*A)/c;return this._w=o*u+this._w*f,this._x=r*u+this._x*f,this._y=i*u+this._y*f,this._z=s*u+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ${constructor(e=0,t=0,r=0){$.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(oL.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(oL.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),A=2*(a*t-s*i),u=2*(s*r-o*t);return this.x=t+l*c+o*u-a*A,this.y=r+l*A+a*c-s*u,this.z=i+l*u+s*A-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return uE.copy(this).projectOnVector(e),this.sub(uE)}reflect(e){return this.sub(uE.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(xr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const uE=new $,oL=new tt;class Qn{constructor(e=new $(1/0,1/0,1/0),t=new $(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Fo),Fo.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Cp),Av.subVectors(this.max,Cp),of.subVectors(e.a,Cp),af.subVectors(e.b,Cp),lf.subVectors(e.c,Cp),gc.subVectors(af,of),vc.subVectors(lf,af),PA.subVectors(of,lf);let t=[0,-gc.z,gc.y,0,-vc.z,vc.y,0,-PA.z,PA.y,gc.z,0,-gc.x,vc.z,0,-vc.x,PA.z,0,-PA.x,-gc.y,gc.x,0,-vc.y,vc.x,0,-PA.y,PA.x,0];return!fE(t,of,af,lf,Av)||(t=[1,0,0,0,1,0,0,0,1],!fE(t,of,af,lf,Av))?!1:(uv.crossVectors(gc,vc),t=[uv.x,uv.y,uv.z],fE(t,of,af,lf,Av))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Fo).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Fo).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(ll[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),ll[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),ll[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),ll[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),ll[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),ll[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),ll[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),ll[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(ll),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const ll=[new $,new $,new $,new $,new $,new $,new $,new $],Fo=new $,cv=new Qn,of=new $,af=new $,lf=new $,gc=new $,vc=new $,PA=new $,Cp=new $,Av=new $,uv=new $,LA=new $;function fE(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){LA.fromArray(n,s);const a=i.x*Math.abs(LA.x)+i.y*Math.abs(LA.y)+i.z*Math.abs(LA.z),l=e.dot(LA),c=t.dot(LA),A=r.dot(LA);if(Math.max(-Math.max(l,c,A),Math.min(l,c,A))>a)return!1}return!0}const see=new Qn,Tp=new $,hE=new $;class Ei{constructor(e=new $,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):see.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Tp.subVectors(e,this.center);const t=Tp.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Tp,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(hE.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Tp.copy(e.center).add(hE)),this.expandByPoint(Tp.copy(e.center).sub(hE))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const cl=new $,dE=new $,fv=new $,yc=new $,pE=new $,hv=new $,mE=new $;class Vu{constructor(e=new $,t=new $(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,cl)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=cl.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(cl.copy(this.origin).addScaledVector(this.direction,t),cl.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){dE.copy(e).add(t).multiplyScalar(.5),fv.copy(t).sub(e).normalize(),yc.copy(this.origin).sub(dE);const s=e.distanceTo(t)*.5,o=-this.direction.dot(fv),a=yc.dot(this.direction),l=-yc.dot(fv),c=yc.lengthSq(),A=Math.abs(1-o*o);let u,f,h,d;if(A>0)if(u=o*l-a,f=o*a-l,d=s*A,u>=0)if(f>=-d)if(f<=d){const m=1/A;u*=m,f*=m,h=u*(u+o*f+2*a)+f*(o*u+f+2*l)+c}else f=s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;else f=-s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;else f<=-d?(u=Math.max(0,-(-o*s+a)),f=u>0?-s:Math.min(Math.max(-s,-l),s),h=-u*u+f*(f+2*l)+c):f<=d?(u=0,f=Math.min(Math.max(-s,-l),s),h=f*(f+2*l)+c):(u=Math.max(0,-(o*s+a)),f=u>0?s:Math.min(Math.max(-s,-l),s),h=-u*u+f*(f+2*l)+c);else f=o>0?-s:s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(dE).addScaledVector(fv,f),h}intersectSphere(e,t){cl.subVectors(e.center,this.origin);const r=cl.dot(this.direction),i=cl.dot(cl)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,s,o,a,l;const c=1/this.direction.x,A=1/this.direction.y,u=1/this.direction.z,f=this.origin;return c>=0?(r=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(r=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),A>=0?(s=(e.min.y-f.y)*A,o=(e.max.y-f.y)*A):(s=(e.max.y-f.y)*A,o=(e.min.y-f.y)*A),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(a=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,cl)!==null}intersectTriangle(e,t,r,i,s){pE.subVectors(t,e),hv.subVectors(r,e),mE.crossVectors(pE,hv);let o=this.direction.dot(mE),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;yc.subVectors(this.origin,e);const l=a*this.direction.dot(hv.crossVectors(yc,hv));if(l<0)return null;const c=a*this.direction.dot(pE.cross(yc));if(c<0||l+c>o)return null;const A=-a*yc.dot(mE);return A<0?null:this.at(A/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ke{constructor(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g){ke.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g)}set(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g){const p=this.elements;return p[0]=e,p[4]=t,p[8]=r,p[12]=i,p[1]=s,p[5]=o,p[9]=a,p[13]=l,p[2]=c,p[6]=A,p[10]=u,p[14]=f,p[3]=h,p[7]=d,p[11]=m,p[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ke().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/cf.setFromMatrixColumn(e,0).length(),s=1/cf.setFromMatrixColumn(e,1).length(),o=1/cf.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),A=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const f=o*A,h=o*u,d=a*A,m=a*u;t[0]=l*A,t[4]=-l*u,t[8]=c,t[1]=h+d*c,t[5]=f-m*c,t[9]=-a*l,t[2]=m-f*c,t[6]=d+h*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*A,h=l*u,d=c*A,m=c*u;t[0]=f+m*a,t[4]=d*a-h,t[8]=o*c,t[1]=o*u,t[5]=o*A,t[9]=-a,t[2]=h*a-d,t[6]=m+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*A,h=l*u,d=c*A,m=c*u;t[0]=f-m*a,t[4]=-o*u,t[8]=d+h*a,t[1]=h+d*a,t[5]=o*A,t[9]=m-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*A,h=o*u,d=a*A,m=a*u;t[0]=l*A,t[4]=d*c-h,t[8]=f*c+m,t[1]=l*u,t[5]=m*c+f,t[9]=h*c-d,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,h=o*c,d=a*l,m=a*c;t[0]=l*A,t[4]=m-f*u,t[8]=d*u+h,t[1]=u,t[5]=o*A,t[9]=-a*A,t[2]=-c*A,t[6]=h*u+d,t[10]=f-m*u}else if(e.order==="XZY"){const f=o*l,h=o*c,d=a*l,m=a*c;t[0]=l*A,t[4]=-u,t[8]=c*A,t[1]=f*u+m,t[5]=o*A,t[9]=h*u-d,t[2]=d*u-h,t[6]=a*A,t[10]=m*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(oee,e,aee)}lookAt(e,t,r){const i=this.elements;return hs.subVectors(e,t),hs.lengthSq()===0&&(hs.z=1),hs.normalize(),wc.crossVectors(r,hs),wc.lengthSq()===0&&(Math.abs(r.z)===1?hs.x+=1e-4:hs.z+=1e-4,hs.normalize(),wc.crossVectors(r,hs)),wc.normalize(),dv.crossVectors(hs,wc),i[0]=wc.x,i[4]=dv.x,i[8]=hs.x,i[1]=wc.y,i[5]=dv.y,i[9]=hs.y,i[2]=wc.z,i[6]=dv.z,i[10]=hs.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],A=r[1],u=r[5],f=r[9],h=r[13],d=r[2],m=r[6],g=r[10],p=r[14],v=r[3],w=r[7],_=r[11],x=r[15],b=i[0],B=i[4],M=i[8],I=i[12],S=i[1],L=i[5],O=i[9],T=i[13],y=i[2],E=i[6],U=i[10],P=i[14],N=i[3],z=i[7],W=i[11],H=i[15];return s[0]=o*b+a*S+l*y+c*N,s[4]=o*B+a*L+l*E+c*z,s[8]=o*M+a*O+l*U+c*W,s[12]=o*I+a*T+l*P+c*H,s[1]=A*b+u*S+f*y+h*N,s[5]=A*B+u*L+f*E+h*z,s[9]=A*M+u*O+f*U+h*W,s[13]=A*I+u*T+f*P+h*H,s[2]=d*b+m*S+g*y+p*N,s[6]=d*B+m*L+g*E+p*z,s[10]=d*M+m*O+g*U+p*W,s[14]=d*I+m*T+g*P+p*H,s[3]=v*b+w*S+_*y+x*N,s[7]=v*B+w*L+_*E+x*z,s[11]=v*M+w*O+_*U+x*W,s[15]=v*I+w*T+_*P+x*H,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],A=e[2],u=e[6],f=e[10],h=e[14],d=e[3],m=e[7],g=e[11],p=e[15];return d*(+s*l*u-i*c*u-s*a*f+r*c*f+i*a*h-r*l*h)+m*(+t*l*h-t*c*f+s*o*f-i*o*h+i*c*A-s*l*A)+g*(+t*c*u-t*a*h-s*o*u+r*o*h+s*a*A-r*c*A)+p*(-i*a*A-t*l*u+t*a*f+i*o*u-r*o*f+r*l*A)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8],u=e[9],f=e[10],h=e[11],d=e[12],m=e[13],g=e[14],p=e[15],v=u*g*c-m*f*c+m*l*h-a*g*h-u*l*p+a*f*p,w=d*f*c-A*g*c-d*l*h+o*g*h+A*l*p-o*f*p,_=A*m*c-d*u*c+d*a*h-o*m*h-A*a*p+o*u*p,x=d*u*l-A*m*l-d*a*f+o*m*f+A*a*g-o*u*g,b=t*v+r*w+i*_+s*x;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/b;return e[0]=v*B,e[1]=(m*f*s-u*g*s-m*i*h+r*g*h+u*i*p-r*f*p)*B,e[2]=(a*g*s-m*l*s+m*i*c-r*g*c-a*i*p+r*l*p)*B,e[3]=(u*l*s-a*f*s-u*i*c+r*f*c+a*i*h-r*l*h)*B,e[4]=w*B,e[5]=(A*g*s-d*f*s+d*i*h-t*g*h-A*i*p+t*f*p)*B,e[6]=(d*l*s-o*g*s-d*i*c+t*g*c+o*i*p-t*l*p)*B,e[7]=(o*f*s-A*l*s+A*i*c-t*f*c-o*i*h+t*l*h)*B,e[8]=_*B,e[9]=(d*u*s-A*m*s-d*r*h+t*m*h+A*r*p-t*u*p)*B,e[10]=(o*m*s-d*a*s+d*r*c-t*m*c-o*r*p+t*a*p)*B,e[11]=(A*a*s-o*u*s-A*r*c+t*u*c+o*r*h-t*a*h)*B,e[12]=x*B,e[13]=(A*m*i-d*u*i+d*r*f-t*m*f-A*r*g+t*u*g)*B,e[14]=(d*a*i-o*m*i-d*r*l+t*m*l+o*r*g-t*a*g)*B,e[15]=(o*u*i-A*a*i+A*r*l-t*u*l-o*r*f+t*a*f)*B,this}scale(e){const t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,A=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,A*a+r,A*l-i*o,0,c*l-i*a,A*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,A=o+o,u=a+a,f=s*c,h=s*A,d=s*u,m=o*A,g=o*u,p=a*u,v=l*c,w=l*A,_=l*u,x=r.x,b=r.y,B=r.z;return i[0]=(1-(m+p))*x,i[1]=(h+_)*x,i[2]=(d-w)*x,i[3]=0,i[4]=(h-_)*b,i[5]=(1-(f+p))*b,i[6]=(g+v)*b,i[7]=0,i[8]=(d+w)*B,i[9]=(g-v)*B,i[10]=(1-(f+m))*B,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let s=cf.set(i[0],i[1],i[2]).length();const o=cf.set(i[4],i[5],i[6]).length(),a=cf.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Po.copy(this);const c=1/s,A=1/o,u=1/a;return Po.elements[0]*=c,Po.elements[1]*=c,Po.elements[2]*=c,Po.elements[4]*=A,Po.elements[5]*=A,Po.elements[6]*=A,Po.elements[8]*=u,Po.elements[9]*=u,Po.elements[10]*=u,t.setFromRotationMatrix(Po),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=Ol){const l=this.elements,c=2*s/(t-e),A=2*s/(r-i),u=(t+e)/(t-e),f=(r+i)/(r-i);let h,d;if(a===Ol)h=-(o+s)/(o-s),d=-2*o*s/(o-s);else if(a===P_)h=-o/(o-s),d=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=A,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=h,l[14]=d,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,r,i,s,o,a=Ol){const l=this.elements,c=1/(t-e),A=1/(r-i),u=1/(o-s),f=(t+e)*c,h=(r+i)*A;let d,m;if(a===Ol)d=(o+s)*u,m=-2*u;else if(a===P_)d=s*u,m=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*A,l[9]=0,l[13]=-h,l[2]=0,l[6]=0,l[10]=m,l[14]=-d,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const cf=new $,Po=new ke,oee=new $(0,0,0),aee=new $(1,1,1),wc=new $,dv=new $,hs=new $,aL=new ke,lL=new tt;class tr{constructor(e=0,t=0,r=0,i=tr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],A=i[9],u=i[2],f=i[6],h=i[10];switch(t){case"XYZ":this._y=Math.asin(xr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-A,h),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-xr(A,-1,1)),Math.abs(A)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(xr(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-xr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,h),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(xr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-A,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-xr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-A,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return aL.makeRotationFromQuaternion(e),this.setFromRotationMatrix(aL,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return lL.setFromEuler(this),this.setFromQuaternion(lL,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}tr.DEFAULT_ORDER="XYZ";class UR{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let r=0;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,A=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),A.length>0&&(r.images=A),u.length>0&&(r.shapes=u),f.length>0&&(r.skeletons=f),h.length>0&&(r.animations=h),d.length>0&&(r.nodes=d)}return r.object=i,r;function o(a){const l=[];for(const c in a){const A=a[c];delete A.metadata,l.push(A)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){Lo.subVectors(i,t),ul.subVectors(r,t),vE.subVectors(e,t);const o=Lo.dot(Lo),a=Lo.dot(ul),l=Lo.dot(vE),c=ul.dot(ul),A=ul.dot(vE),u=o*c-a*a;if(u===0)return s.set(0,0,0),null;const f=1/u,h=(c*l-a*A)*f,d=(o*A-a*l)*f;return s.set(1-h-d,d,h)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,fl)===null?!1:fl.x>=0&&fl.y>=0&&fl.x+fl.y<=1}static getInterpolation(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,fl)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,fl.x),l.addScaledVector(o,fl.y),l.addScaledVector(a,fl.z),l)}static getInterpolatedAttribute(e,t,r,i,s,o){return xE.setScalar(0),bE.setScalar(0),EE.setScalar(0),xE.fromBufferAttribute(e,t),bE.fromBufferAttribute(e,r),EE.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(xE,s.x),o.addScaledVector(bE,s.y),o.addScaledVector(EE,s.z),o}static isFrontFacing(e,t,r,i){return Lo.subVectors(r,t),ul.subVectors(e,t),Lo.cross(ul).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Lo.subVectors(this.c,this.b),ul.subVectors(this.a,this.b),Lo.cross(ul).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Vr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Vr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,i,s){return Vr.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Vr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Vr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,s=this.c;let o,a;ff.subVectors(i,r),hf.subVectors(s,r),yE.subVectors(e,r);const l=ff.dot(yE),c=hf.dot(yE);if(l<=0&&c<=0)return t.copy(r);wE.subVectors(e,i);const A=ff.dot(wE),u=hf.dot(wE);if(A>=0&&u<=A)return t.copy(i);const f=l*u-A*c;if(f<=0&&l>=0&&A<=0)return o=l/(l-A),t.copy(r).addScaledVector(ff,o);_E.subVectors(e,s);const h=ff.dot(_E),d=hf.dot(_E);if(d>=0&&h<=d)return t.copy(s);const m=h*c-l*d;if(m<=0&&c>=0&&d<=0)return a=c/(c-d),t.copy(r).addScaledVector(hf,a);const g=A*d-h*u;if(g<=0&&u-A>=0&&h-d>=0)return dL.subVectors(s,i),a=(u-A)/(u-A+(h-d)),t.copy(i).addScaledVector(dL,a);const p=1/(g+m+f);return o=m*p,a=f*p,t.copy(r).addScaledVector(ff,o).addScaledVector(hf,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const vz={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},_c={h:0,s:0,l:0},mv={h:0,s:0,l:0};function BE(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class He{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=kt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,bt.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=bt.workingColorSpace){return this.r=e,this.g=t,this.b=r,bt.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=bt.workingColorSpace){if(e=IR(e,1),t=xr(t,0,1),r=xr(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=BE(o,s,e+1/3),this.g=BE(o,s,e),this.b=BE(o,s,e-1/3)}return bt.toWorkingColorSpace(this,i),this}setStyle(e,t=kt){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=kt){const r=vz[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=nd(e.r),this.g=nd(e.g),this.b=nd(e.b),this}copyLinearToSRGB(e){return this.r=cE(e.r),this.g=cE(e.g),this.b=cE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=kt){return bt.fromWorkingColorSpace(fi.copy(this),e),Math.round(xr(fi.r*255,0,255))*65536+Math.round(xr(fi.g*255,0,255))*256+Math.round(xr(fi.b*255,0,255))}getHexString(e=kt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=bt.workingColorSpace){bt.fromWorkingColorSpace(fi.copy(this),t);const r=fi.r,i=fi.g,s=fi.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const A=(a+o)/2;if(a===o)l=0,c=0;else{const u=o-a;switch(c=A<=.5?u/(o+a):u/(2-o-a),o){case r:l=(i-s)/u+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==ed&&(r.blending=this.blending),this.side!==ks&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==QM&&(r.blendSrc=this.blendSrc),this.blendDst!==zM&&(r.blendDst=this.blendDst),this.blendEquation!==ru&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Sd&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==eL&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==rf&&(r.stencilFail=this.stencilFail),this.stencilZFail!==rf&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==rf&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}};class Zi extends ss{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new He(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tr,this.combine=n1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const mr=new $,gv=new je;class lt{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=EC,this.updateRanges=[],this.gpuType=Ts,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],A=[];for(let u=0,f=c.length;u0&&(i[l]=A,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(t));const i=e.attributes;for(const c in i){const A=i[c];this.setAttribute(c,A.clone(t))}const s=e.morphAttributes;for(const c in s){const A=[],u=s[c];for(let f=0,h=u.length;f0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(pL.copy(s).invert(),DA.copy(e.ray).applyMatrix4(pL),!(r.boundingBox!==null&&DA.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,DA)))}_computeIntersections(e,t,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,A=s.attributes.uv1,u=s.attributes.normal,f=s.groups,h=s.drawRange;if(a!==null)if(Array.isArray(o))for(let d=0,m=f.length;dt.far?null:{distance:c,point:bv.clone(),object:n}}function Ev(n,e,t,r,i,s,o,a,l,c){n.getVertexPosition(a,yv),n.getVertexPosition(l,wv),n.getVertexPosition(c,_v);const A=dee(n,e,t,r,yv,wv,_v,gL);if(A){const u=new $;Vr.getBarycoord(gL,yv,wv,_v,u),i&&(A.uv=Vr.getInterpolatedAttribute(i,a,l,c,u,new je)),s&&(A.uv1=Vr.getInterpolatedAttribute(s,a,l,c,u,new je)),o&&(A.normal=Vr.getInterpolatedAttribute(o,a,l,c,u,new $),A.normal.dot(r.direction)>0&&A.normal.multiplyScalar(-1));const f={a,b:l,c,normal:new $,materialIndex:0};Vr.getNormal(yv,wv,_v,f.normal),A.face=f,A.barycoord=u}return A}class d0 extends Zt{constructor(e=1,t=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],A=[],u=[];let f=0,h=0;d("z","y","x",-1,-1,r,t,e,o,s,0),d("z","y","x",1,-1,r,t,-e,o,s,1),d("x","z","y",1,1,e,r,t,i,o,2),d("x","z","y",1,-1,e,r,-t,i,o,3),d("x","y","z",1,-1,e,t,r,i,s,4),d("x","y","z",-1,-1,e,t,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new xn(c,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(u,2));function d(m,g,p,v,w,_,x,b,B,M,I){const S=_/B,L=x/M,O=_/2,T=x/2,y=b/2,E=B+1,U=M+1;let P=0,N=0;const z=new $;for(let W=0;W0?1:-1,A.push(z.x,z.y,z.z),u.push(C/B),u.push(1-W/M),P+=1}}for(let W=0;W>8&255]+fi[n>>16&255]+fi[n>>24&255]+"-"+fi[e&255]+fi[e>>8&255]+"-"+fi[e>>16&15|64]+fi[e>>24&255]+"-"+fi[t&63|128]+fi[t>>8&255]+"-"+fi[t>>16&255]+fi[t>>24&255]+fi[r&255]+fi[r>>8&255]+fi[r>>16&255]+fi[r>>24&255]).toLowerCase()}function dr(n,e,t){return Math.max(e,Math.min(t,n))}function FR(n,e){return(n%e+e)%e}function LJ(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function DJ(n,e,t){return n!==e?(t-n)/(e-n):0}function eg(n,e,t){return(1-t)*n+t*e}function NJ(n,e,t,r){return eg(n,e,1-Math.exp(-t*r))}function OJ(n,e=1){return e-Math.abs(FR(n,e*2)-e)}function kJ(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function HJ(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function QJ(n,e){return n+Math.floor(Math.random()*(e-n+1))}function zJ(n,e){return n+Math.random()*(e-n)}function GJ(n){return n*(.5-Math.random())}function VJ(n){n!==void 0&&(iL=n);let e=iL+=1831565813;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function jJ(n){return n*Jm}function WJ(n){return n*Ld}function KJ(n){return(n&n-1)===0&&n!==0}function XJ(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function YJ(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function $J(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),c=s((e+r)/2),A=o((e+r)/2),u=s((e-r)/2),f=o((e-r)/2),h=s((r-e)/2),d=o((r-e)/2);switch(i){case"XYX":n.set(a*A,l*u,l*f,a*c);break;case"YZY":n.set(l*f,a*A,l*u,a*c);break;case"ZXZ":n.set(l*u,l*f,a*A,a*c);break;case"XZX":n.set(a*A,l*d,l*h,a*c);break;case"YXY":n.set(l*h,a*A,l*d,a*c);break;case"ZYZ":n.set(l*d,l*h,a*A,a*c);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function $o(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return n/4294967295;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int32Array:return Math.max(n/2147483647,-1);case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function fn(n,e){switch(e.constructor){case Float32Array:return n;case Uint32Array:return Math.round(n*4294967295);case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int32Array:return Math.round(n*2147483647);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}const Et={DEG2RAD:Jm,RAD2DEG:Ld,generateUUID:na,clamp:dr,euclideanModulo:FR,mapLinear:LJ,inverseLerp:DJ,lerp:eg,damp:NJ,pingpong:OJ,smoothstep:kJ,smootherstep:HJ,randInt:QJ,randFloat:zJ,randFloatSpread:GJ,seededRandom:VJ,degToRad:jJ,radToDeg:WJ,isPowerOfTwo:KJ,ceilPowerOfTwo:XJ,floorPowerOfTwo:YJ,setQuaternionFromProperEuler:$J,normalize:fn,denormalize:$o};class je{constructor(e=0,t=0){je.prototype.isVector2=!0,this.x=e,this.y=t}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){const t=this.x,r=this.y,i=e.elements;return this.x=i[0]*t+i[3]*r+i[6],this.y=i[1]*t+i[4]*r+i[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(dr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y;return t*t+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){const r=Math.cos(t),i=Math.sin(t),s=this.x-e.x,o=this.y-e.y;return this.x=s*r-o*i+e.x,this.y=s*i+o*r+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class ut{constructor(e,t,r,i,s,o,a,l,c){ut.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c)}set(e,t,r,i,s,o,a,l,c){const A=this.elements;return A[0]=e,A[1]=i,A[2]=a,A[3]=t,A[4]=s,A[5]=l,A[6]=r,A[7]=o,A[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],this}extractBasis(e,t,r){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),r.setFromMatrix3Column(this,2),this}setFromMatrix4(e){const t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[3],l=r[6],c=r[1],A=r[4],u=r[7],f=r[2],h=r[5],d=r[8],m=i[0],g=i[3],p=i[6],v=i[1],w=i[4],_=i[7],x=i[2],b=i[5],B=i[8];return s[0]=o*m+a*v+l*x,s[3]=o*g+a*w+l*b,s[6]=o*p+a*_+l*B,s[1]=c*m+A*v+u*x,s[4]=c*g+A*w+u*b,s[7]=c*p+A*_+u*B,s[2]=f*m+h*v+d*x,s[5]=f*g+h*w+d*b,s[8]=f*p+h*_+d*B,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8];return t*o*A-t*a*c-r*s*A+r*a*l+i*s*c-i*o*l}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8],u=A*o-a*c,f=a*l-A*s,h=c*s-o*l,d=t*u+r*f+i*h;if(d===0)return this.set(0,0,0,0,0,0,0,0,0);const m=1/d;return e[0]=u*m,e[1]=(i*c-A*r)*m,e[2]=(a*r-i*o)*m,e[3]=f*m,e[4]=(A*t-i*l)*m,e[5]=(i*s-a*t)*m,e[6]=h*m,e[7]=(r*l-c*t)*m,e[8]=(o*t-r*s)*m,this}transpose(){let e;const t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){const t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,r,i,s,o,a){const l=Math.cos(s),c=Math.sin(s);return this.set(r*l,r*c,-r*(l*o+c*a)+o+e,-i*c,i*l,-i*(-c*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(uE.makeScale(e,t)),this}rotate(e){return this.premultiply(uE.makeRotation(-e)),this}translate(e,t){return this.premultiply(uE.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,r,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<9;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<9;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e}clone(){return new this.constructor().fromArray(this.elements)}}const uE=new ut;function vz(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Qg(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function ZJ(){const n=Qg("canvas");return n.style.display="block",n}const sL={};function Sw(n){n in sL||(sL[n]=!0,console.warn(n))}function qJ(n,e,t){return new Promise(function(r,i){function s(){switch(n.clientWaitSync(e,n.SYNC_FLUSH_COMMANDS_BIT,0)){case n.WAIT_FAILED:i();break;case n.TIMEOUT_EXPIRED:setTimeout(s,t);break;default:r()}}setTimeout(s,t)})}function JJ(n){const e=n.elements;e[2]=.5*e[2]+.5*e[3],e[6]=.5*e[6]+.5*e[7],e[10]=.5*e[10]+.5*e[11],e[14]=.5*e[14]+.5*e[15]}function eee(n){const e=n.elements;e[11]===-1?(e[10]=-e[10]-1,e[14]=-e[14]):(e[10]=-e[10],e[14]=-e[14]+1)}const oL=new ut().set(.8224621,.177538,0,.0331941,.9668058,0,.0170827,.0723974,.9105199),aL=new ut().set(1.2249401,-.2249404,0,-.0420569,1.0420571,0,-.0196376,-.0786361,1.0982735),Cp={[Mr]:{transfer:F_,primaries:P_,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n,fromReference:n=>n},[kt]:{transfer:Sn,primaries:P_,luminanceCoefficients:[.2126,.7152,.0722],toReference:n=>n.convertSRGBToLinear(),fromReference:n=>n.convertLinearToSRGB()},[a1]:{transfer:F_,primaries:L_,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.applyMatrix3(aL),fromReference:n=>n.applyMatrix3(oL)},[UR]:{transfer:Sn,primaries:L_,luminanceCoefficients:[.2289,.6917,.0793],toReference:n=>n.convertSRGBToLinear().applyMatrix3(aL),fromReference:n=>n.applyMatrix3(oL).convertLinearToSRGB()}},tee=new Set([Mr,a1]),bt={enabled:!0,_workingColorSpace:Mr,get workingColorSpace(){return this._workingColorSpace},set workingColorSpace(n){if(!tee.has(n))throw new Error(`Unsupported working color space, "${n}".`);this._workingColorSpace=n},convert:function(n,e,t){if(this.enabled===!1||e===t||!e||!t)return n;const r=Cp[e].toReference,i=Cp[t].fromReference;return i(r(n))},fromWorkingColorSpace:function(n,e){return this.convert(n,this._workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this._workingColorSpace)},getPrimaries:function(n){return Cp[n].primaries},getTransfer:function(n){return n===Ra?F_:Cp[n].transfer},getLuminanceCoefficients:function(n,e=this._workingColorSpace){return n.fromArray(Cp[e].luminanceCoefficients)}};function sd(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function fE(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}let lf;class nee{static getDataURL(e){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{lf===void 0&&(lf=Qg("canvas")),lf.width=e.width,lf.height=e.height;const r=lf.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=lf}return t.width>2048||t.height>2048?(console.warn("THREE.ImageUtils.getDataURL: Image converted to jpg for performance reasons",e),t.toDataURL("image/jpeg",.6)):t.toDataURL("image/png")}static sRGBToLinear(e){if(typeof HTMLImageElement<"u"&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&e instanceof ImageBitmap){const t=Qg("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0,e.width,e.height);const i=r.getImageData(0,0,e.width,e.height),s=i.data;for(let o=0;o0&&(r.userData=this.userData),t||(e.textures[this.uuid]=r),r}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(e){if(this.mapping!==oz)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case Qs:e.x=e.x-Math.floor(e.x);break;case Is:e.x=e.x<0?0:1;break;case kg:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x=e.x-Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case Qs:e.y=e.y-Math.floor(e.y);break;case Is:e.y=e.y<0?0:1;break;case kg:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y=e.y-Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}}Hn.DEFAULT_IMAGE=null;Hn.DEFAULT_MAPPING=oz;Hn.DEFAULT_ANISOTROPY=1;class Ut{constructor(e=0,t=0,r=0,i=1){Ut.prototype.isVector4=!0,this.x=e,this.y=t,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,r,i){return this.x=e,this.y=t,this.z=r,this.w=i,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w!==void 0?e.w:1,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=this.w,o=e.elements;return this.x=o[0]*t+o[4]*r+o[8]*i+o[12]*s,this.y=o[1]*t+o[5]*r+o[9]*i+o[13]*s,this.z=o[2]*t+o[6]*r+o[10]*i+o[14]*s,this.w=o[3]*t+o[7]*r+o[11]*i+o[15]*s,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);const t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,r,i,s;const l=e.elements,c=l[0],A=l[4],u=l[8],f=l[1],h=l[5],d=l[9],m=l[2],g=l[6],p=l[10];if(Math.abs(A-f)<.01&&Math.abs(u-m)<.01&&Math.abs(d-g)<.01){if(Math.abs(A+f)<.1&&Math.abs(u+m)<.1&&Math.abs(d+g)<.1&&Math.abs(c+h+p-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(c+1)/2,_=(h+1)/2,x=(p+1)/2,b=(A+f)/4,B=(u+m)/4,S=(d+g)/4;return w>_&&w>x?w<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(w),i=b/r,s=B/r):_>x?_<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(_),r=b/i,s=S/i):x<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(x),r=B/s,i=S/s),this.set(r,i,s,t),this}let v=Math.sqrt((g-d)*(g-d)+(u-m)*(u-m)+(f-A)*(f-A));return Math.abs(v)<.001&&(v=1),this.x=(g-d)/v,this.y=(u-m)/v,this.z=(f-A)/v,this.w=Math.acos((c+h+p-1)/2),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this.w=t[15],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this.w=Math.min(this.w,e.w),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this.w=Math.max(this.w,e.w),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this.w=Math.max(e.w,Math.min(t.w,this.w)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this.w=Math.max(e,Math.min(t,this.w)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z+this.w*e.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this.w+=(e.w-this.w)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this.w=e.w+(t.w-e.w)*r,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z&&e.w===this.w}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this.w=e[t+3],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this.w=e.getW(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class see extends RA{constructor(e=1,t=1,r={}){super(),this.isRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ut(0,0,e,t),this.scissorTest=!1,this.viewport=new Ut(0,0,e,t);const i={width:e,height:t,depth:1};r=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:Lr,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1},r);const s=new Hn(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.colorSpace);s.flipY=!1,s.generateMipmaps=r.generateMipmaps,s.internalFormat=r.internalFormat,this.textures=[];const o=r.count;for(let a=0;a=0?1:-1,w=1-p*p;if(w>Number.EPSILON){const x=Math.sqrt(w),b=Math.atan2(x,p*v);g=Math.sin(g*b)/x,a=Math.sin(a*b)/x}const _=a*v;if(l=l*g+f*_,c=c*g+h*_,A=A*g+d*_,u=u*g+m*_,g===1-a){const x=1/Math.sqrt(l*l+c*c+A*A+u*u);l*=x,c*=x,A*=x,u*=x}}e[t]=l,e[t+1]=c,e[t+2]=A,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],c=r[i+2],A=r[i+3],u=s[o],f=s[o+1],h=s[o+2],d=s[o+3];return e[t]=a*d+A*u+l*h-c*f,e[t+1]=l*d+A*f+c*u-a*h,e[t+2]=c*d+A*h+a*f-l*u,e[t+3]=A*d-a*u-l*f-c*h,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,r,i){return this._x=e,this._y=t,this._z=r,this._w=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,c=a(r/2),A=a(i/2),u=a(s/2),f=l(r/2),h=l(i/2),d=l(s/2);switch(o){case"XYZ":this._x=f*A*u+c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u-f*h*d;break;case"YXZ":this._x=f*A*u+c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u+f*h*d;break;case"ZXY":this._x=f*A*u-c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u-f*h*d;break;case"ZYX":this._x=f*A*u-c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u+f*h*d;break;case"YZX":this._x=f*A*u+c*h*d,this._y=c*h*u+f*A*d,this._z=c*A*d-f*h*u,this._w=c*A*u-f*h*d;break;case"XZY":this._x=f*A*u-c*h*d,this._y=c*h*u-f*A*d,this._z=c*A*d+f*h*u,this._w=c*A*u+f*h*d;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){const r=t/2,i=Math.sin(r);return this._x=e.x*i,this._y=e.y*i,this._z=e.z*i,this._w=Math.cos(r),this._onChangeCallback(),this}setFromRotationMatrix(e){const t=e.elements,r=t[0],i=t[4],s=t[8],o=t[1],a=t[5],l=t[9],c=t[2],A=t[6],u=t[10],f=r+a+u;if(f>0){const h=.5/Math.sqrt(f+1);this._w=.25/h,this._x=(A-l)*h,this._y=(s-c)*h,this._z=(o-i)*h}else if(r>a&&r>u){const h=2*Math.sqrt(1+r-a-u);this._w=(A-l)/h,this._x=.25*h,this._y=(i+o)/h,this._z=(s+c)/h}else if(a>u){const h=2*Math.sqrt(1+a-r-u);this._w=(s-c)/h,this._x=(i+o)/h,this._y=.25*h,this._z=(l+A)/h}else{const h=2*Math.sqrt(1+u-r-a);this._w=(o-i)/h,this._x=(s+c)/h,this._y=(l+A)/h,this._z=.25*h}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let r=e.dot(t)+1;return rMath.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=r):(this._x=0,this._y=-e.z,this._z=e.y,this._w=r)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=r),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(dr(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,c=t._z,A=t._w;return this._x=r*A+o*a+i*c-s*l,this._y=i*A+o*l+s*a-r*c,this._z=s*A+o*c+r*l-i*a,this._w=o*A-r*a-i*l-s*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);const r=this._x,i=this._y,s=this._z,o=this._w;let a=o*e._w+r*e._x+i*e._y+s*e._z;if(a<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,a=-a):this.copy(e),a>=1)return this._w=o,this._x=r,this._y=i,this._z=s,this;const l=1-a*a;if(l<=Number.EPSILON){const h=1-t;return this._w=h*o+t*this._w,this._x=h*r+t*this._x,this._y=h*i+t*this._y,this._z=h*s+t*this._z,this.normalize(),this}const c=Math.sqrt(l),A=Math.atan2(c,a),u=Math.sin((1-t)*A)/c,f=Math.sin(t*A)/c;return this._w=o*u+this._w*f,this._x=r*u+this._x*f,this._y=i*u+this._y*f,this._z=s*u+this._z*f,this._onChangeCallback(),this}slerpQuaternions(e,t,r){return this.copy(e).slerp(t,r)}random(){const e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),r=Math.random(),i=Math.sqrt(1-r),s=Math.sqrt(r);return this.set(i*Math.sin(e),i*Math.cos(e),s*Math.sin(t),s*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class ${constructor(e=0,t=0,r=0){$.prototype.isVector3=!0,this.x=e,this.y=t,this.z=r}set(e,t,r){return r===void 0&&(r=this.z),this.x=e,this.y=t,this.z=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw new Error("index is out of range: "+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(lL.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(lL.setFromAxisAngle(e,t))}applyMatrix3(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[3]*r+s[6]*i,this.y=s[1]*t+s[4]*r+s[7]*i,this.z=s[2]*t+s[5]*r+s[8]*i,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){const t=this.x,r=this.y,i=this.z,s=e.elements,o=1/(s[3]*t+s[7]*r+s[11]*i+s[15]);return this.x=(s[0]*t+s[4]*r+s[8]*i+s[12])*o,this.y=(s[1]*t+s[5]*r+s[9]*i+s[13])*o,this.z=(s[2]*t+s[6]*r+s[10]*i+s[14])*o,this}applyQuaternion(e){const t=this.x,r=this.y,i=this.z,s=e.x,o=e.y,a=e.z,l=e.w,c=2*(o*i-a*r),A=2*(a*t-s*i),u=2*(s*r-o*t);return this.x=t+l*c+o*u-a*A,this.y=r+l*A+a*c-s*u,this.z=i+l*u+s*A-o*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){const t=this.x,r=this.y,i=this.z,s=e.elements;return this.x=s[0]*t+s[4]*r+s[8]*i,this.y=s[1]*t+s[5]*r+s[9]*i,this.z=s[2]*t+s[6]*r+s[10]*i,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Math.max(e.x,Math.min(t.x,this.x)),this.y=Math.max(e.y,Math.min(t.y,this.y)),this.z=Math.max(e.z,Math.min(t.z,this.z)),this}clampScalar(e,t){return this.x=Math.max(e,Math.min(t,this.x)),this.y=Math.max(e,Math.min(t,this.y)),this.z=Math.max(e,Math.min(t,this.z)),this}clampLength(e,t){const r=this.length();return this.divideScalar(r||1).multiplyScalar(Math.max(e,Math.min(t,r)))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,r){return this.x=e.x+(t.x-e.x)*r,this.y=e.y+(t.y-e.y)*r,this.z=e.z+(t.z-e.z)*r,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){const r=e.x,i=e.y,s=e.z,o=t.x,a=t.y,l=t.z;return this.x=i*l-s*a,this.y=s*o-r*l,this.z=r*a-i*o,this}projectOnVector(e){const t=e.lengthSq();if(t===0)return this.set(0,0,0);const r=e.dot(this)/t;return this.copy(e).multiplyScalar(r)}projectOnPlane(e){return dE.copy(this).projectOnVector(e),this.sub(dE)}reflect(e){return this.sub(dE.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(dr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const e=Math.random()*Math.PI*2,t=Math.random()*2-1,r=Math.sqrt(1-t*t);return this.x=r*Math.cos(e),this.y=t,this.z=r*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const dE=new $,lL=new tt;class Qn{constructor(e=new $(1/0,1/0,1/0),t=new $(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=e,this.max=t}set(e,t){return this.min.copy(e),this.max.copy(t),this}setFromArray(e){this.makeEmpty();for(let t=0,r=e.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Po),Po.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,r;return e.normal.x>0?(t=e.normal.x*this.min.x,r=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,r=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,r+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,r+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,r+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,r+=e.normal.z*this.min.z),t<=-e.constant&&r>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Tp),fv.subVectors(this.max,Tp),cf.subVectors(e.a,Tp),Af.subVectors(e.b,Tp),uf.subVectors(e.c,Tp),yc.subVectors(Af,cf),wc.subVectors(uf,Af),DA.subVectors(cf,uf);let t=[0,-yc.z,yc.y,0,-wc.z,wc.y,0,-DA.z,DA.y,yc.z,0,-yc.x,wc.z,0,-wc.x,DA.z,0,-DA.x,-yc.y,yc.x,0,-wc.y,wc.x,0,-DA.y,DA.x,0];return!pE(t,cf,Af,uf,fv)||(t=[1,0,0,0,1,0,0,0,1],!pE(t,cf,Af,uf,fv))?!1:(hv.crossVectors(yc,wc),t=[hv.x,hv.y,hv.z],pE(t,cf,Af,uf,fv))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Po).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Po).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Al[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Al[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Al[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Al[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Al[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Al[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Al[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Al[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Al),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}}const Al=[new $,new $,new $,new $,new $,new $,new $,new $],Po=new $,uv=new Qn,cf=new $,Af=new $,uf=new $,yc=new $,wc=new $,DA=new $,Tp=new $,fv=new $,hv=new $,NA=new $;function pE(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){NA.fromArray(n,s);const a=i.x*Math.abs(NA.x)+i.y*Math.abs(NA.y)+i.z*Math.abs(NA.z),l=e.dot(NA),c=t.dot(NA),A=r.dot(NA);if(Math.max(-Math.max(l,c,A),Math.min(l,c,A))>a)return!1}return!0}const aee=new Qn,Ip=new $,mE=new $;class Si{constructor(e=new $,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){const r=this.center;t!==void 0?r.copy(t):aee.setFromPoints(e).getCenter(r);let i=0;for(let s=0,o=e.length;sthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius=this.radius*e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Ip.subVectors(e,this.center);const t=Ip.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Ip,i/r),this.radius+=i}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(mE.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ip.copy(e.center).add(mE)),this.expandByPoint(Ip.copy(e.center).sub(mE))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const ul=new $,gE=new $,dv=new $,_c=new $,vE=new $,pv=new $,yE=new $;class Ku{constructor(e=new $,t=new $(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,ul)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);const r=t.dot(this.direction);return r<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,r)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=ul.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(ul.copy(this.origin).addScaledVector(this.direction,t),ul.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){gE.copy(e).add(t).multiplyScalar(.5),dv.copy(t).sub(e).normalize(),_c.copy(this.origin).sub(gE);const s=e.distanceTo(t)*.5,o=-this.direction.dot(dv),a=_c.dot(this.direction),l=-_c.dot(dv),c=_c.lengthSq(),A=Math.abs(1-o*o);let u,f,h,d;if(A>0)if(u=o*l-a,f=o*a-l,d=s*A,u>=0)if(f>=-d)if(f<=d){const m=1/A;u*=m,f*=m,h=u*(u+o*f+2*a)+f*(o*u+f+2*l)+c}else f=s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;else f=-s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;else f<=-d?(u=Math.max(0,-(-o*s+a)),f=u>0?-s:Math.min(Math.max(-s,-l),s),h=-u*u+f*(f+2*l)+c):f<=d?(u=0,f=Math.min(Math.max(-s,-l),s),h=f*(f+2*l)+c):(u=Math.max(0,-(o*s+a)),f=u>0?s:Math.min(Math.max(-s,-l),s),h=-u*u+f*(f+2*l)+c);else f=o>0?-s:s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+c;return r&&r.copy(this.origin).addScaledVector(this.direction,u),i&&i.copy(gE).addScaledVector(dv,f),h}intersectSphere(e,t){ul.subVectors(e.center,this.origin);const r=ul.dot(this.direction),i=ul.dot(ul)-r*r,s=e.radius*e.radius;if(i>s)return null;const o=Math.sqrt(s-i),a=r-o,l=r+o;return l<0?null:a<0?this.at(l,t):this.at(a,t)}intersectsSphere(e){return this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){const t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;const r=-(this.origin.dot(e.normal)+e.constant)/t;return r>=0?r:null}intersectPlane(e,t){const r=this.distanceToPlane(e);return r===null?null:this.at(r,t)}intersectsPlane(e){const t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let r,i,s,o,a,l;const c=1/this.direction.x,A=1/this.direction.y,u=1/this.direction.z,f=this.origin;return c>=0?(r=(e.min.x-f.x)*c,i=(e.max.x-f.x)*c):(r=(e.max.x-f.x)*c,i=(e.min.x-f.x)*c),A>=0?(s=(e.min.y-f.y)*A,o=(e.max.y-f.y)*A):(s=(e.max.y-f.y)*A,o=(e.min.y-f.y)*A),r>o||s>i||((s>r||isNaN(r))&&(r=s),(o=0?(a=(e.min.z-f.z)*u,l=(e.max.z-f.z)*u):(a=(e.max.z-f.z)*u,l=(e.min.z-f.z)*u),r>l||a>i)||((a>r||r!==r)&&(r=a),(l=0?r:i,t)}intersectsBox(e){return this.intersectBox(e,ul)!==null}intersectTriangle(e,t,r,i,s){vE.subVectors(t,e),pv.subVectors(r,e),yE.crossVectors(vE,pv);let o=this.direction.dot(yE),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;_c.subVectors(this.origin,e);const l=a*this.direction.dot(pv.crossVectors(_c,pv));if(l<0)return null;const c=a*this.direction.dot(vE.cross(_c));if(c<0||l+c>o)return null;const A=-a*_c.dot(yE);return A<0?null:this.at(A/o,s)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class ke{constructor(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g){ke.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],e!==void 0&&this.set(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g)}set(e,t,r,i,s,o,a,l,c,A,u,f,h,d,m,g){const p=this.elements;return p[0]=e,p[4]=t,p[8]=r,p[12]=i,p[1]=s,p[5]=o,p[9]=a,p[13]=l,p[2]=c,p[6]=A,p[10]=u,p[14]=f,p[3]=h,p[7]=d,p[11]=m,p[15]=g,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new ke().fromArray(this.elements)}copy(e){const t=this.elements,r=e.elements;return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],this}copyPosition(e){const t=this.elements,r=e.elements;return t[12]=r[12],t[13]=r[13],t[14]=r[14],this}setFromMatrix3(e){const t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,r){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),r.setFromMatrixColumn(this,2),this}makeBasis(e,t,r){return this.set(e.x,t.x,r.x,0,e.y,t.y,r.y,0,e.z,t.z,r.z,0,0,0,0,1),this}extractRotation(e){const t=this.elements,r=e.elements,i=1/ff.setFromMatrixColumn(e,0).length(),s=1/ff.setFromMatrixColumn(e,1).length(),o=1/ff.setFromMatrixColumn(e,2).length();return t[0]=r[0]*i,t[1]=r[1]*i,t[2]=r[2]*i,t[3]=0,t[4]=r[4]*s,t[5]=r[5]*s,t[6]=r[6]*s,t[7]=0,t[8]=r[8]*o,t[9]=r[9]*o,t[10]=r[10]*o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){const t=this.elements,r=e.x,i=e.y,s=e.z,o=Math.cos(r),a=Math.sin(r),l=Math.cos(i),c=Math.sin(i),A=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const f=o*A,h=o*u,d=a*A,m=a*u;t[0]=l*A,t[4]=-l*u,t[8]=c,t[1]=h+d*c,t[5]=f-m*c,t[9]=-a*l,t[2]=m-f*c,t[6]=d+h*c,t[10]=o*l}else if(e.order==="YXZ"){const f=l*A,h=l*u,d=c*A,m=c*u;t[0]=f+m*a,t[4]=d*a-h,t[8]=o*c,t[1]=o*u,t[5]=o*A,t[9]=-a,t[2]=h*a-d,t[6]=m+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*A,h=l*u,d=c*A,m=c*u;t[0]=f-m*a,t[4]=-o*u,t[8]=d+h*a,t[1]=h+d*a,t[5]=o*A,t[9]=m-f*a,t[2]=-o*c,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*A,h=o*u,d=a*A,m=a*u;t[0]=l*A,t[4]=d*c-h,t[8]=f*c+m,t[1]=l*u,t[5]=m*c+f,t[9]=h*c-d,t[2]=-c,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,h=o*c,d=a*l,m=a*c;t[0]=l*A,t[4]=m-f*u,t[8]=d*u+h,t[1]=u,t[5]=o*A,t[9]=-a*A,t[2]=-c*A,t[6]=h*u+d,t[10]=f-m*u}else if(e.order==="XZY"){const f=o*l,h=o*c,d=a*l,m=a*c;t[0]=l*A,t[4]=-u,t[8]=c*A,t[1]=f*u+m,t[5]=o*A,t[9]=h*u-d,t[2]=d*u-h,t[6]=a*A,t[10]=m*u+f}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(lee,e,cee)}lookAt(e,t,r){const i=this.elements;return ds.subVectors(e,t),ds.lengthSq()===0&&(ds.z=1),ds.normalize(),xc.crossVectors(r,ds),xc.lengthSq()===0&&(Math.abs(r.z)===1?ds.x+=1e-4:ds.z+=1e-4,ds.normalize(),xc.crossVectors(r,ds)),xc.normalize(),mv.crossVectors(ds,xc),i[0]=xc.x,i[4]=mv.x,i[8]=ds.x,i[1]=xc.y,i[5]=mv.y,i[9]=ds.y,i[2]=xc.z,i[6]=mv.z,i[10]=ds.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){const r=e.elements,i=t.elements,s=this.elements,o=r[0],a=r[4],l=r[8],c=r[12],A=r[1],u=r[5],f=r[9],h=r[13],d=r[2],m=r[6],g=r[10],p=r[14],v=r[3],w=r[7],_=r[11],x=r[15],b=i[0],B=i[4],S=i[8],I=i[12],M=i[1],P=i[5],D=i[9],T=i[13],y=i[2],E=i[6],R=i[10],L=i[14],N=i[3],z=i[7],W=i[11],H=i[15];return s[0]=o*b+a*M+l*y+c*N,s[4]=o*B+a*P+l*E+c*z,s[8]=o*S+a*D+l*R+c*W,s[12]=o*I+a*T+l*L+c*H,s[1]=A*b+u*M+f*y+h*N,s[5]=A*B+u*P+f*E+h*z,s[9]=A*S+u*D+f*R+h*W,s[13]=A*I+u*T+f*L+h*H,s[2]=d*b+m*M+g*y+p*N,s[6]=d*B+m*P+g*E+p*z,s[10]=d*S+m*D+g*R+p*W,s[14]=d*I+m*T+g*L+p*H,s[3]=v*b+w*M+_*y+x*N,s[7]=v*B+w*P+_*E+x*z,s[11]=v*S+w*D+_*R+x*W,s[15]=v*I+w*T+_*L+x*H,this}multiplyScalar(e){const t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){const e=this.elements,t=e[0],r=e[4],i=e[8],s=e[12],o=e[1],a=e[5],l=e[9],c=e[13],A=e[2],u=e[6],f=e[10],h=e[14],d=e[3],m=e[7],g=e[11],p=e[15];return d*(+s*l*u-i*c*u-s*a*f+r*c*f+i*a*h-r*l*h)+m*(+t*l*h-t*c*f+s*o*f-i*o*h+i*c*A-s*l*A)+g*(+t*c*u-t*a*h-s*o*u+r*o*h+s*a*A-r*c*A)+p*(-i*a*A-t*l*u+t*a*f+i*o*u-r*o*f+r*l*A)}transpose(){const e=this.elements;let t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,r){const i=this.elements;return e.isVector3?(i[12]=e.x,i[13]=e.y,i[14]=e.z):(i[12]=e,i[13]=t,i[14]=r),this}invert(){const e=this.elements,t=e[0],r=e[1],i=e[2],s=e[3],o=e[4],a=e[5],l=e[6],c=e[7],A=e[8],u=e[9],f=e[10],h=e[11],d=e[12],m=e[13],g=e[14],p=e[15],v=u*g*c-m*f*c+m*l*h-a*g*h-u*l*p+a*f*p,w=d*f*c-A*g*c-d*l*h+o*g*h+A*l*p-o*f*p,_=A*m*c-d*u*c+d*a*h-o*m*h-A*a*p+o*u*p,x=d*u*l-A*m*l-d*a*f+o*m*f+A*a*g-o*u*g,b=t*v+r*w+i*_+s*x;if(b===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const B=1/b;return e[0]=v*B,e[1]=(m*f*s-u*g*s-m*i*h+r*g*h+u*i*p-r*f*p)*B,e[2]=(a*g*s-m*l*s+m*i*c-r*g*c-a*i*p+r*l*p)*B,e[3]=(u*l*s-a*f*s-u*i*c+r*f*c+a*i*h-r*l*h)*B,e[4]=w*B,e[5]=(A*g*s-d*f*s+d*i*h-t*g*h-A*i*p+t*f*p)*B,e[6]=(d*l*s-o*g*s-d*i*c+t*g*c+o*i*p-t*l*p)*B,e[7]=(o*f*s-A*l*s+A*i*c-t*f*c-o*i*h+t*l*h)*B,e[8]=_*B,e[9]=(d*u*s-A*m*s-d*r*h+t*m*h+A*r*p-t*u*p)*B,e[10]=(o*m*s-d*a*s+d*r*c-t*m*c-o*r*p+t*a*p)*B,e[11]=(A*a*s-o*u*s-A*r*c+t*u*c+o*r*h-t*a*h)*B,e[12]=x*B,e[13]=(A*m*i-d*u*i+d*r*f-t*m*f-A*r*g+t*u*g)*B,e[14]=(d*a*i-o*m*i-d*r*l+t*m*l+o*r*g-t*a*g)*B,e[15]=(o*u*i-A*a*i+A*r*l-t*u*l-o*r*f+t*a*f)*B,this}scale(e){const t=this.elements,r=e.x,i=e.y,s=e.z;return t[0]*=r,t[4]*=i,t[8]*=s,t[1]*=r,t[5]*=i,t[9]*=s,t[2]*=r,t[6]*=i,t[10]*=s,t[3]*=r,t[7]*=i,t[11]*=s,this}getMaxScaleOnAxis(){const e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],r=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],i=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,r,i))}makeTranslation(e,t,r){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,r,0,0,0,1),this}makeRotationX(e){const t=Math.cos(e),r=Math.sin(e);return this.set(1,0,0,0,0,t,-r,0,0,r,t,0,0,0,0,1),this}makeRotationY(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,0,r,0,0,1,0,0,-r,0,t,0,0,0,0,1),this}makeRotationZ(e){const t=Math.cos(e),r=Math.sin(e);return this.set(t,-r,0,0,r,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){const r=Math.cos(t),i=Math.sin(t),s=1-r,o=e.x,a=e.y,l=e.z,c=s*o,A=s*a;return this.set(c*o+r,c*a-i*l,c*l+i*a,0,c*a+i*l,A*a+r,A*l-i*o,0,c*l-i*a,A*l+i*o,s*l*l+r,0,0,0,0,1),this}makeScale(e,t,r){return this.set(e,0,0,0,0,t,0,0,0,0,r,0,0,0,0,1),this}makeShear(e,t,r,i,s,o){return this.set(1,r,s,0,e,1,o,0,t,i,1,0,0,0,0,1),this}compose(e,t,r){const i=this.elements,s=t._x,o=t._y,a=t._z,l=t._w,c=s+s,A=o+o,u=a+a,f=s*c,h=s*A,d=s*u,m=o*A,g=o*u,p=a*u,v=l*c,w=l*A,_=l*u,x=r.x,b=r.y,B=r.z;return i[0]=(1-(m+p))*x,i[1]=(h+_)*x,i[2]=(d-w)*x,i[3]=0,i[4]=(h-_)*b,i[5]=(1-(f+p))*b,i[6]=(g+v)*b,i[7]=0,i[8]=(d+w)*B,i[9]=(g-v)*B,i[10]=(1-(f+m))*B,i[11]=0,i[12]=e.x,i[13]=e.y,i[14]=e.z,i[15]=1,this}decompose(e,t,r){const i=this.elements;let s=ff.set(i[0],i[1],i[2]).length();const o=ff.set(i[4],i[5],i[6]).length(),a=ff.set(i[8],i[9],i[10]).length();this.determinant()<0&&(s=-s),e.x=i[12],e.y=i[13],e.z=i[14],Lo.copy(this);const c=1/s,A=1/o,u=1/a;return Lo.elements[0]*=c,Lo.elements[1]*=c,Lo.elements[2]*=c,Lo.elements[4]*=A,Lo.elements[5]*=A,Lo.elements[6]*=A,Lo.elements[8]*=u,Lo.elements[9]*=u,Lo.elements[10]*=u,t.setFromRotationMatrix(Lo),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o,a=Ql){const l=this.elements,c=2*s/(t-e),A=2*s/(r-i),u=(t+e)/(t-e),f=(r+i)/(r-i);let h,d;if(a===Ql)h=-(o+s)/(o-s),d=-2*o*s/(o-s);else if(a===D_)h=-o/(o-s),d=-o*s/(o-s);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+a);return l[0]=c,l[4]=0,l[8]=u,l[12]=0,l[1]=0,l[5]=A,l[9]=f,l[13]=0,l[2]=0,l[6]=0,l[10]=h,l[14]=d,l[3]=0,l[7]=0,l[11]=-1,l[15]=0,this}makeOrthographic(e,t,r,i,s,o,a=Ql){const l=this.elements,c=1/(t-e),A=1/(r-i),u=1/(o-s),f=(t+e)*c,h=(r+i)*A;let d,m;if(a===Ql)d=(o+s)*u,m=-2*u;else if(a===D_)d=s*u,m=-1*u;else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+a);return l[0]=2*c,l[4]=0,l[8]=0,l[12]=-f,l[1]=0,l[5]=2*A,l[9]=0,l[13]=-h,l[2]=0,l[6]=0,l[10]=m,l[14]=-d,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this}equals(e){const t=this.elements,r=e.elements;for(let i=0;i<16;i++)if(t[i]!==r[i])return!1;return!0}fromArray(e,t=0){for(let r=0;r<16;r++)this.elements[r]=e[r+t];return this}toArray(e=[],t=0){const r=this.elements;return e[t]=r[0],e[t+1]=r[1],e[t+2]=r[2],e[t+3]=r[3],e[t+4]=r[4],e[t+5]=r[5],e[t+6]=r[6],e[t+7]=r[7],e[t+8]=r[8],e[t+9]=r[9],e[t+10]=r[10],e[t+11]=r[11],e[t+12]=r[12],e[t+13]=r[13],e[t+14]=r[14],e[t+15]=r[15],e}}const ff=new $,Lo=new ke,lee=new $(0,0,0),cee=new $(1,1,1),xc=new $,mv=new $,ds=new $,cL=new ke,AL=new tt;class tr{constructor(e=0,t=0,r=0,i=tr.DEFAULT_ORDER){this.isEuler=!0,this._x=e,this._y=t,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,r,i=this._order){return this._x=e,this._y=t,this._z=r,this._order=i,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,r=!0){const i=e.elements,s=i[0],o=i[4],a=i[8],l=i[1],c=i[5],A=i[9],u=i[2],f=i[6],h=i[10];switch(t){case"XYZ":this._y=Math.asin(dr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-A,h),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,c),this._z=0);break;case"YXZ":this._x=Math.asin(-dr(A,-1,1)),Math.abs(A)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,c)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(dr(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-o,c)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-dr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,h),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,c));break;case"YZX":this._z=Math.asin(dr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-A,c),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-dr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,c),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-A,h),this._y=0);break;default:console.warn("THREE.Euler: .setFromRotationMatrix() encountered an unknown order: "+t)}return this._order=t,r===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,r){return cL.makeRotationFromQuaternion(e),this.setFromRotationMatrix(cL,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return AL.setFromEuler(this),this.setFromQuaternion(AL,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}tr.DEFAULT_ORDER="XYZ";class LR{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let t=0;t1){for(let r=0;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.toArray(),i.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(i.matrixAutoUpdate=!1),this.isInstancedMesh&&(i.type="InstancedMesh",i.count=this.count,i.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(i.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(i.type="BatchedMesh",i.perObjectFrustumCulled=this.perObjectFrustumCulled,i.sortObjects=this.sortObjects,i.drawRanges=this._drawRanges,i.reservedRanges=this._reservedRanges,i.visibility=this._visibility,i.active=this._active,i.bounds=this._bounds.map(a=>({boxInitialized:a.boxInitialized,boxMin:a.box.min.toArray(),boxMax:a.box.max.toArray(),sphereInitialized:a.sphereInitialized,sphereRadius:a.sphere.radius,sphereCenter:a.sphere.center.toArray()})),i.maxInstanceCount=this._maxInstanceCount,i.maxVertexCount=this._maxVertexCount,i.maxIndexCount=this._maxIndexCount,i.geometryInitialized=this._geometryInitialized,i.geometryCount=this._geometryCount,i.matricesTexture=this._matricesTexture.toJSON(e),this._colorsTexture!==null&&(i.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(i.boundingSphere={center:i.boundingSphere.center.toArray(),radius:i.boundingSphere.radius}),this.boundingBox!==null&&(i.boundingBox={min:i.boundingBox.min.toArray(),max:i.boundingBox.max.toArray()}));function s(a,l){return a[l.uuid]===void 0&&(a[l.uuid]=l.toJSON(e)),l.uuid}if(this.isScene)this.background&&(this.background.isColor?i.background=this.background.toJSON():this.background.isTexture&&(i.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(i.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){i.geometry=s(e.geometries,this.geometry);const a=this.geometry.parameters;if(a!==void 0&&a.shapes!==void 0){const l=a.shapes;if(Array.isArray(l))for(let c=0,A=l.length;c0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),c.length>0&&(r.textures=c),A.length>0&&(r.images=A),u.length>0&&(r.shapes=u),f.length>0&&(r.skeletons=f),h.length>0&&(r.animations=h),d.length>0&&(r.nodes=d)}return r.object=i,r;function o(a){const l=[];for(const c in a){const A=a[c];delete A.metadata,l.push(A)}return l}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let r=0;r0?i.multiplyScalar(1/Math.sqrt(s)):i.set(0,0,0)}static getBarycoord(e,t,r,i,s){Do.subVectors(i,t),hl.subVectors(r,t),_E.subVectors(e,t);const o=Do.dot(Do),a=Do.dot(hl),l=Do.dot(_E),c=hl.dot(hl),A=hl.dot(_E),u=o*c-a*a;if(u===0)return s.set(0,0,0),null;const f=1/u,h=(c*l-a*A)*f,d=(o*A-a*l)*f;return s.set(1-h-d,d,h)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,dl)===null?!1:dl.x>=0&&dl.y>=0&&dl.x+dl.y<=1}static getInterpolation(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,dl)===null?(l.x=0,l.y=0,"z"in l&&(l.z=0),"w"in l&&(l.w=0),null):(l.setScalar(0),l.addScaledVector(s,dl.x),l.addScaledVector(o,dl.y),l.addScaledVector(a,dl.z),l)}static getInterpolatedAttribute(e,t,r,i,s,o){return BE.setScalar(0),SE.setScalar(0),ME.setScalar(0),BE.fromBufferAttribute(e,t),SE.fromBufferAttribute(e,r),ME.fromBufferAttribute(e,i),o.setScalar(0),o.addScaledVector(BE,s.x),o.addScaledVector(SE,s.y),o.addScaledVector(ME,s.z),o}static isFrontFacing(e,t,r,i){return Do.subVectors(r,t),hl.subVectors(e,t),Do.cross(hl).dot(i)<0}set(e,t,r){return this.a.copy(e),this.b.copy(t),this.c.copy(r),this}setFromPointsAndIndices(e,t,r,i){return this.a.copy(e[t]),this.b.copy(e[r]),this.c.copy(e[i]),this}setFromAttributeAndIndices(e,t,r,i){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,r),this.c.fromBufferAttribute(e,i),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return Do.subVectors(this.c,this.b),hl.subVectors(this.a,this.b),Do.cross(hl).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Wr.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Wr.getBarycoord(e,this.a,this.b,this.c,t)}getInterpolation(e,t,r,i,s){return Wr.getInterpolation(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Wr.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Wr.isFrontFacing(this.a,this.b,this.c,e)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){const r=this.a,i=this.b,s=this.c;let o,a;pf.subVectors(i,r),mf.subVectors(s,r),xE.subVectors(e,r);const l=pf.dot(xE),c=mf.dot(xE);if(l<=0&&c<=0)return t.copy(r);bE.subVectors(e,i);const A=pf.dot(bE),u=mf.dot(bE);if(A>=0&&u<=A)return t.copy(i);const f=l*u-A*c;if(f<=0&&l>=0&&A<=0)return o=l/(l-A),t.copy(r).addScaledVector(pf,o);EE.subVectors(e,s);const h=pf.dot(EE),d=mf.dot(EE);if(d>=0&&h<=d)return t.copy(s);const m=h*c-l*d;if(m<=0&&c>=0&&d<=0)return a=c/(c-d),t.copy(r).addScaledVector(mf,a);const g=A*d-h*u;if(g<=0&&u-A>=0&&h-d>=0)return mL.subVectors(s,i),a=(u-A)/(u-A+(h-d)),t.copy(i).addScaledVector(mL,a);const p=1/(g+m+f);return o=m*p,a=f*p,t.copy(r).addScaledVector(pf,o).addScaledVector(mf,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}const wz={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},bc={h:0,s:0,l:0},vv={h:0,s:0,l:0};function CE(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*6*(2/3-t):n}class He{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,r)}set(e,t,r){if(t===void 0&&r===void 0){const i=e;i&&i.isColor?this.copy(i):typeof i=="number"?this.setHex(i):typeof i=="string"&&this.setStyle(i)}else this.setRGB(e,t,r);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=kt){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,bt.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=bt.workingColorSpace){return this.r=e,this.g=t,this.b=r,bt.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=bt.workingColorSpace){if(e=FR(e,1),t=dr(t,0,1),r=dr(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=CE(o,s,e+1/3),this.g=CE(o,s,e),this.b=CE(o,s,e-1/3)}return bt.toWorkingColorSpace(this,i),this}setStyle(e,t=kt){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^(\w+)\(([^\)]*)\)/.exec(e)){let s;const o=i[1],a=i[2];switch(o){case"rgb":case"rgba":if(s=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(255,parseInt(s[1],10))/255,Math.min(255,parseInt(s[2],10))/255,Math.min(255,parseInt(s[3],10))/255,t);if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setRGB(Math.min(100,parseInt(s[1],10))/100,Math.min(100,parseInt(s[2],10))/100,Math.min(100,parseInt(s[3],10))/100,t);break;case"hsl":case"hsla":if(s=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return r(s[4]),this.setHSL(parseFloat(s[1])/360,parseFloat(s[2])/100,parseFloat(s[3])/100,t);break;default:console.warn("THREE.Color: Unknown color model "+e)}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.setRGB(parseInt(s.charAt(0),16)/15,parseInt(s.charAt(1),16)/15,parseInt(s.charAt(2),16)/15,t);if(o===6)return this.setHex(parseInt(s,16),t);console.warn("THREE.Color: Invalid hex color "+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=kt){const r=wz[e.toLowerCase()];return r!==void 0?this.setHex(r,t):console.warn("THREE.Color: Unknown color "+e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=sd(e.r),this.g=sd(e.g),this.b=sd(e.b),this}copyLinearToSRGB(e){return this.r=fE(e.r),this.g=fE(e.g),this.b=fE(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=kt){return bt.fromWorkingColorSpace(hi.copy(this),e),Math.round(dr(hi.r*255,0,255))*65536+Math.round(dr(hi.g*255,0,255))*256+Math.round(dr(hi.b*255,0,255))}getHexString(e=kt){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=bt.workingColorSpace){bt.fromWorkingColorSpace(hi.copy(this),t);const r=hi.r,i=hi.g,s=hi.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,c;const A=(a+o)/2;if(a===o)l=0,c=0;else{const u=o-a;switch(c=A<=.5?u/(o+a):u/(2-o-a),o){case r:l=(i-s)/u+(i0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(const t in e){const r=e[t];if(r===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}const i=this[t];if(i===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}i&&i.isColor?i.set(r):i&&i.isVector3&&r&&r.isVector3?i.copy(r):this[t]=r}}toJSON(e){const t=e===void 0||typeof e=="string";t&&(e={textures:{},images:{}});const r={metadata:{version:4.6,type:"Material",generator:"Material.toJSON"}};r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),this.color&&this.color.isColor&&(r.color=this.color.getHex()),this.roughness!==void 0&&(r.roughness=this.roughness),this.metalness!==void 0&&(r.metalness=this.metalness),this.sheen!==void 0&&(r.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(r.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(r.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(r.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(r.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(r.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(r.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(r.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(r.shininess=this.shininess),this.clearcoat!==void 0&&(r.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(r.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(r.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(r.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(r.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,r.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(r.dispersion=this.dispersion),this.iridescence!==void 0&&(r.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(r.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(r.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(r.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(r.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(r.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(r.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(r.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(r.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(r.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(r.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(r.lightMap=this.lightMap.toJSON(e).uuid,r.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(r.aoMap=this.aoMap.toJSON(e).uuid,r.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(r.bumpMap=this.bumpMap.toJSON(e).uuid,r.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(r.normalMap=this.normalMap.toJSON(e).uuid,r.normalMapType=this.normalMapType,r.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(r.displacementMap=this.displacementMap.toJSON(e).uuid,r.displacementScale=this.displacementScale,r.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(r.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(r.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(r.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(r.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(r.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(r.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(r.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(r.combine=this.combine)),this.envMapRotation!==void 0&&(r.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(r.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(r.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(r.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(r.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(r.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(r.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(r.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(r.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(r.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(r.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(r.size=this.size),this.shadowSide!==null&&(r.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(r.sizeAttenuation=this.sizeAttenuation),this.blending!==rd&&(r.blending=this.blending),this.side!==Hs&&(r.side=this.side),this.vertexColors===!0&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=!0),this.blendSrc!==VM&&(r.blendSrc=this.blendSrc),this.blendDst!==jM&&(r.blendDst=this.blendDst),this.blendEquation!==su&&(r.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(r.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(r.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(r.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(r.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(r.blendAlpha=this.blendAlpha),this.depthFunc!==Cd&&(r.depthFunc=this.depthFunc),this.depthTest===!1&&(r.depthTest=this.depthTest),this.depthWrite===!1&&(r.depthWrite=this.depthWrite),this.colorWrite===!1&&(r.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(r.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==nL&&(r.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(r.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(r.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==af&&(r.stencilFail=this.stencilFail),this.stencilZFail!==af&&(r.stencilZFail=this.stencilZFail),this.stencilZPass!==af&&(r.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(r.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(r.rotation=this.rotation),this.polygonOffset===!0&&(r.polygonOffset=!0),this.polygonOffsetFactor!==0&&(r.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(r.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(r.linewidth=this.linewidth),this.dashSize!==void 0&&(r.dashSize=this.dashSize),this.gapSize!==void 0&&(r.gapSize=this.gapSize),this.scale!==void 0&&(r.scale=this.scale),this.dithering===!0&&(r.dithering=!0),this.alphaTest>0&&(r.alphaTest=this.alphaTest),this.alphaHash===!0&&(r.alphaHash=!0),this.alphaToCoverage===!0&&(r.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=!0),this.forceSinglePass===!0&&(r.forceSinglePass=!0),this.wireframe===!0&&(r.wireframe=!0),this.wireframeLinewidth>1&&(r.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(r.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(r.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(r.flatShading=!0),this.visible===!1&&(r.visible=!1),this.toneMapped===!1&&(r.toneMapped=!1),this.fog===!1&&(r.fog=!1),Object.keys(this.userData).length>0&&(r.userData=this.userData);function i(s){const o=[];for(const a in s){const l=s[a];delete l.metadata,o.push(l)}return o}if(t){const s=i(e.textures),o=i(e.images);s.length>0&&(r.textures=s),o.length>0&&(r.images=o)}return r}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;const t=e.clippingPlanes;let r=null;if(t!==null){const i=t.length;r=new Array(i);for(let s=0;s!==i;++s)r[s]=t[s].clone()}return this.clippingPlanes=r,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(e){e===!0&&this.version++}onBuild(){console.warn("Material: onBuild() has been removed.")}};class qi extends os{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new He(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tr,this.combine=i1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}}const Ll=pee();function pee(){const n=new ArrayBuffer(4),e=new Float32Array(n),t=new Uint32Array(n),r=new Uint32Array(512),i=new Uint32Array(512);for(let l=0;l<256;++l){const c=l-127;c<-27?(r[l]=0,r[l|256]=32768,i[l]=24,i[l|256]=24):c<-14?(r[l]=1024>>-c-14,r[l|256]=1024>>-c-14|32768,i[l]=-c-1,i[l|256]=-c-1):c<=15?(r[l]=c+15<<10,r[l|256]=c+15<<10|32768,i[l]=13,i[l|256]=13):c<128?(r[l]=31744,r[l|256]=64512,i[l]=24,i[l|256]=24):(r[l]=31744,r[l|256]=64512,i[l]=13,i[l|256]=13)}const s=new Uint32Array(2048),o=new Uint32Array(64),a=new Uint32Array(64);for(let l=1;l<1024;++l){let c=l<<13,A=0;for(;!(c&8388608);)c<<=1,A-=8388608;c&=-8388609,A+=947912704,s[l]=c|A}for(let l=1024;l<2048;++l)s[l]=939524096+(l-1024<<13);for(let l=1;l<31;++l)o[l]=l<<23;o[31]=1199570944,o[32]=2147483648;for(let l=33;l<63;++l)o[l]=2147483648+(l-32<<23);o[63]=3347054592;for(let l=1;l<64;++l)l!==32&&(a[l]=1024);return{floatView:e,uint32View:t,baseTable:r,shiftTable:i,mantissaTable:s,exponentTable:o,offsetTable:a}}function mee(n){Math.abs(n)>65504&&console.warn("THREE.DataUtils.toHalfFloat(): Value out of range."),n=dr(n,-65504,65504),Ll.floatView[0]=n;const e=Ll.uint32View[0],t=e>>23&511;return Ll.baseTable[t]+((e&8388607)>>Ll.shiftTable[t])}function gee(n){const e=n>>10;return Ll.uint32View[0]=Ll.mantissaTable[Ll.offsetTable[e]+(n&1023)]+Ll.exponentTable[e],Ll.floatView[0]}const yv={toHalfFloat:mee,fromHalfFloat:gee},gr=new $,wv=new je;class lt{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=MC,this.updateRanges=[],this.gpuType=xi,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,r){e*=this.itemSize,r*=t.itemSize;for(let i=0,s=this.itemSize;i0&&(e.userData=this.userData),this.parameters!==void 0){const l=this.parameters;for(const c in l)l[c]!==void 0&&(e[c]=l[c]);return e}e.data={attributes:{}};const t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});const r=this.attributes;for(const l in r){const c=r[l];e.data.attributes[l]=c.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const c=this.morphAttributes[l],A=[];for(let u=0,f=c.length;u0&&(i[l]=A,s=!0)}s&&(e.data.morphAttributes=i,e.data.morphTargetsRelative=this.morphTargetsRelative);const o=this.groups;o.length>0&&(e.data.groups=JSON.parse(JSON.stringify(o)));const a=this.boundingSphere;return a!==null&&(e.data.boundingSphere={center:a.center.toArray(),radius:a.radius}),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const t={};this.name=e.name;const r=e.index;r!==null&&this.setIndex(r.clone(t));const i=e.attributes;for(const c in i){const A=i[c];this.setAttribute(c,A.clone(t))}const s=e.morphAttributes;for(const c in s){const A=[],u=s[c];for(let f=0,h=u.length;f0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s(e.far-e.near)**2))&&(gL.copy(s).invert(),OA.copy(e.ray).applyMatrix4(gL),!(r.boundingBox!==null&&OA.intersectsBox(r.boundingBox)===!1)&&this._computeIntersections(e,t,OA)))}_computeIntersections(e,t,r){let i;const s=this.geometry,o=this.material,a=s.index,l=s.attributes.position,c=s.attributes.uv,A=s.attributes.uv1,u=s.attributes.normal,f=s.groups,h=s.drawRange;if(a!==null)if(Array.isArray(o))for(let d=0,m=f.length;dt.far?null:{distance:c,point:Sv.clone(),object:n}}function Mv(n,e,t,r,i,s,o,a,l,c){n.getVertexPosition(a,xv),n.getVertexPosition(l,bv),n.getVertexPosition(c,Ev);const A=yee(n,e,t,r,xv,bv,Ev,yL);if(A){const u=new $;Wr.getBarycoord(yL,xv,bv,Ev,u),i&&(A.uv=Wr.getInterpolatedAttribute(i,a,l,c,u,new je)),s&&(A.uv1=Wr.getInterpolatedAttribute(s,a,l,c,u,new je)),o&&(A.normal=Wr.getInterpolatedAttribute(o,a,l,c,u,new $),A.normal.dot(r.direction)>0&&A.normal.multiplyScalar(-1));const f={a,b:l,c,normal:new $,materialIndex:0};Wr.getNormal(xv,bv,Ev,f.normal),A.face=f,A.barycoord=u}return A}class m0 extends Zt{constructor(e=1,t=1,r=1,i=1,s=1,o=1){super(),this.type="BoxGeometry",this.parameters={width:e,height:t,depth:r,widthSegments:i,heightSegments:s,depthSegments:o};const a=this;i=Math.floor(i),s=Math.floor(s),o=Math.floor(o);const l=[],c=[],A=[],u=[];let f=0,h=0;d("z","y","x",-1,-1,r,t,e,o,s,0),d("z","y","x",1,-1,r,t,-e,o,s,1),d("x","z","y",1,1,e,r,t,i,o,2),d("x","z","y",1,-1,e,r,-t,i,o,3),d("x","y","z",1,-1,e,t,r,i,s,4),d("x","y","z",-1,-1,e,t,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new xn(c,3)),this.setAttribute("normal",new xn(A,3)),this.setAttribute("uv",new xn(u,2));function d(m,g,p,v,w,_,x,b,B,S,I){const M=_/B,P=x/S,D=_/2,T=x/2,y=b/2,E=B+1,R=S+1;let L=0,N=0;const z=new $;for(let W=0;W0?1:-1,A.push(z.x,z.y,z.z),u.push(C/B),u.push(1-W/S),L+=1}}for(let W=0;W0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class _z extends Ft{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ke,this.projectionMatrix=new ke,this.projectionMatrixInverse=new ke,this.coordinateSystem=Ol}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const xc=new $,vL=new je,yL=new je;class Ur extends _z{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Fd*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(qm*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Fd*2*Math.atan(Math.tan(qm*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,r){xc.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(xc.x,xc.y).multiplyScalar(-e/xc.z),xc.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(xc.x,xc.y).multiplyScalar(-e/xc.z)}getViewSize(e,t){return this.getViewBounds(e,vL,yL),t.subVectors(yL,vL)}setViewOffset(e,t,r,i,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(qm*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const pf=-90,mf=1;class vee extends Ft{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Ur(pf,mf,e,t);i.layers=this.layers,this.add(i);const s=new Ur(pf,mf,e,t);s.layers=this.layers,this.add(s);const o=new Ur(pf,mf,e,t);o.layers=this.layers,this.add(o);const a=new Ur(pf,mf,e,t);a.layers=this.layers,this.add(a);const l=new Ur(pf,mf,e,t);l.layers=this.layers,this.add(l);const c=new Ur(pf,mf,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[r,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Ol)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===P_)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,A]=this.children,u=e.getRenderTarget(),f=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;const m=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(t,s),e.setRenderTarget(r,1,i),e.render(t,o),e.setRenderTarget(r,2,i),e.render(t,a),e.setRenderTarget(r,3,i),e.render(t,l),e.setRenderTarget(r,4,i),e.render(t,c),r.texture.generateMipmaps=m,e.setRenderTarget(r,5,i),e.render(t,A),e.setRenderTarget(u,f,h),e.xr.enabled=d,r.texture.needsPMREMUpdate=!0}}class xz extends Hn{constructor(e,t,r,i,s,o,a,l,c,A){e=e!==void 0?e:[],t=t!==void 0?t:Md,super(e,t,r,i,s,o,a,l,c,A),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class yee extends Za{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new xz(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Xi}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class pr extends os{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=_ee,this.fragmentShader=xee,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,e!==void 0&&this.setValues(e)}copy(e){return super.copy(e),this.fragmentShader=e.fragmentShader,this.vertexShader=e.vertexShader,this.uniforms=Dd(e.uniforms),this.uniformsGroups=wee(e.uniformsGroups),this.defines=Object.assign({},e.defines),this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.fog=e.fog,this.lights=e.lights,this.clipping=e.clipping,this.extensions=Object.assign({},e.extensions),this.glslVersion=e.glslVersion,this}toJSON(e){const t=super.toJSON(e);t.glslVersion=this.glslVersion,t.uniforms={};for(const i in this.uniforms){const o=this.uniforms[i].value;o&&o.isTexture?t.uniforms[i]={type:"t",value:o.toJSON(e).uuid}:o&&o.isColor?t.uniforms[i]={type:"c",value:o.getHex()}:o&&o.isVector2?t.uniforms[i]={type:"v2",value:o.toArray()}:o&&o.isVector3?t.uniforms[i]={type:"v3",value:o.toArray()}:o&&o.isVector4?t.uniforms[i]={type:"v4",value:o.toArray()}:o&&o.isMatrix3?t.uniforms[i]={type:"m3",value:o.toArray()}:o&&o.isMatrix4?t.uniforms[i]={type:"m4",value:o.toArray()}:t.uniforms[i]={value:o}}Object.keys(this.defines).length>0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;const r={};for(const i in this.extensions)this.extensions[i]===!0&&(r[i]=!0);return Object.keys(r).length>0&&(t.extensions=r),t}}class bz extends Ft{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new ke,this.projectionMatrix=new ke,this.projectionMatrixInverse=new ke,this.coordinateSystem=Ql}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const Ec=new $,wL=new je,_L=new je;class Fr extends bz{constructor(e=50,t=1,r=.1,i=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=e,this.zoom=1,this.near=r,this.far=i,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){const t=.5*this.getFilmHeight()/e;this.fov=Ld*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(Jm*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Ld*2*Math.atan(Math.tan(Jm*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,r){Ec.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(Ec.x,Ec.y).multiplyScalar(-e/Ec.z),Ec.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),r.set(Ec.x,Ec.y).multiplyScalar(-e/Ec.z)}getViewSize(e,t){return this.getViewBounds(e,wL,_L),t.subVectors(_L,wL)}setViewOffset(e,t,r,i,s,o){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=this.near;let t=e*Math.tan(Jm*.5*this.fov)/this.zoom,r=2*t,i=this.aspect*r,s=-.5*i;const o=this.view;if(this.view!==null&&this.view.enabled){const l=o.fullWidth,c=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/c,i*=o.width/l,r*=o.height/c}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}}const vf=-90,yf=1;class bee extends Ft{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r,this.coordinateSystem=null,this.activeMipmapLevel=0;const i=new Fr(vf,yf,e,t);i.layers=this.layers,this.add(i);const s=new Fr(vf,yf,e,t);s.layers=this.layers,this.add(s);const o=new Fr(vf,yf,e,t);o.layers=this.layers,this.add(o);const a=new Fr(vf,yf,e,t);a.layers=this.layers,this.add(a);const l=new Fr(vf,yf,e,t);l.layers=this.layers,this.add(l);const c=new Fr(vf,yf,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){const e=this.coordinateSystem,t=this.children.concat(),[r,i,s,o,a,l]=t;for(const c of t)this.remove(c);if(e===Ql)r.up.set(0,1,0),r.lookAt(1,0,0),i.up.set(0,1,0),i.lookAt(-1,0,0),s.up.set(0,0,-1),s.lookAt(0,1,0),o.up.set(0,0,1),o.lookAt(0,-1,0),a.up.set(0,1,0),a.lookAt(0,0,1),l.up.set(0,1,0),l.lookAt(0,0,-1);else if(e===D_)r.up.set(0,-1,0),r.lookAt(-1,0,0),i.up.set(0,-1,0),i.lookAt(1,0,0),s.up.set(0,0,1),s.lookAt(0,1,0),o.up.set(0,0,-1),o.lookAt(0,-1,0),a.up.set(0,-1,0),a.lookAt(0,0,1),l.up.set(0,-1,0),l.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+e);for(const c of t)this.add(c),c.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();const{renderTarget:r,activeMipmapLevel:i}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());const[s,o,a,l,c,A]=this.children,u=e.getRenderTarget(),f=e.getActiveCubeFace(),h=e.getActiveMipmapLevel(),d=e.xr.enabled;e.xr.enabled=!1;const m=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0,i),e.render(t,s),e.setRenderTarget(r,1,i),e.render(t,o),e.setRenderTarget(r,2,i),e.render(t,a),e.setRenderTarget(r,3,i),e.render(t,l),e.setRenderTarget(r,4,i),e.render(t,c),r.texture.generateMipmaps=m,e.setRenderTarget(r,5,i),e.render(t,A),e.setRenderTarget(u,f,h),e.xr.enabled=d,r.texture.needsPMREMUpdate=!0}}class Ez extends Hn{constructor(e,t,r,i,s,o,a,l,c,A){e=e!==void 0?e:[],t=t!==void 0?t:Td,super(e,t,r,i,s,o,a,l,c,A),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class Eee extends qa{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;const r={width:e,height:e,depth:1},i=[r,r,r,r,r,r];this.texture=new Ez(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.colorSpace),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:Lr}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:` varying vec3 vWorldDirection; @@ -103,9 +103,9 @@ Error generating stack: `+s.message+` gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},i=new d0(5,5,5),s=new dr({name:"CubemapFromEquirect",uniforms:Pd(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:si,blending:zl});s.uniforms.tEquirect.value=t;const o=new hn(i,s),a=t.minFilter;return t.minFilter===Da&&(t.minFilter=Xi),new vee(1,10,this).update(e,o),t.minFilter=a,o.geometry.dispose(),o.material.dispose(),this}clear(e,t,r,i){const s=e.getRenderTarget();for(let o=0;o<6;o++)e.setRenderTarget(this,o),e.clear(t,r,i);e.setRenderTarget(s)}}const CE=new $,wee=new $,_ee=new ut;class Sa{constructor(e=new $(1,0,0),t=0){this.isPlane=!0,this.normal=e,this.constant=t}set(e,t){return this.normal.copy(e),this.constant=t,this}setComponents(e,t,r,i){return this.normal.set(e,t,r),this.constant=i,this}setFromNormalAndCoplanarPoint(e,t){return this.normal.copy(e),this.constant=-t.dot(this.normal),this}setFromCoplanarPoints(e,t,r){const i=CE.subVectors(r,t).cross(wee.subVectors(e,t)).normalize();return this.setFromNormalAndCoplanarPoint(i,e),this}copy(e){return this.normal.copy(e.normal),this.constant=e.constant,this}normalize(){const e=1/this.normal.length();return this.normal.multiplyScalar(e),this.constant*=e,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(e){return this.normal.dot(e)+this.constant}distanceToSphere(e){return this.distanceToPoint(e.center)-e.radius}projectPoint(e,t){return t.copy(e).addScaledVector(this.normal,-this.distanceToPoint(e))}intersectLine(e,t){const r=e.delta(CE),i=this.normal.dot(r);if(i===0)return this.distanceToPoint(e.start)===0?t.copy(e.start):null;const s=-(e.start.dot(this.normal)+this.constant)/i;return s<0||s>1?null:t.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const r=t||_ee.getNormalMatrix(e),i=this.coplanarPoint(CE).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const NA=new Ei,Bv=new $;class a1{constructor(e=new Sa,t=new Sa,r=new Sa,i=new Sa,s=new Sa,o=new Sa){this.planes=[e,t,r,i,s,o]}set(e,t,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=Ol){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],A=i[5],u=i[6],f=i[7],h=i[8],d=i[9],m=i[10],g=i[11],p=i[12],v=i[13],w=i[14],_=i[15];if(r[0].setComponents(l-s,f-c,g-h,_-p).normalize(),r[1].setComponents(l+s,f+c,g+h,_+p).normalize(),r[2].setComponents(l+o,f+A,g+d,_+v).normalize(),r[3].setComponents(l-o,f-A,g-d,_-v).normalize(),r[4].setComponents(l-a,f-u,g-m,_-w).normalize(),t===Ol)r[5].setComponents(l+a,f+u,g+m,_+w).normalize();else if(t===P_)r[5].setComponents(a,u,m,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),NA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),NA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(NA)}intersectsSprite(e){return NA.center.set(0,0,0),NA.radius=.7071067811865476,NA.applyMatrix4(e.matrixWorld),this.intersectsSphere(NA)}intersectsSphere(e){const t=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(r)0?e.max.x:e.min.x,Bv.y=i.normal.y>0?e.max.y:e.min.y,Bv.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Bv)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function bz(){let n=null,e=!1,t=null,r=null;function i(s,o){t(s,o),r=n.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(r=n.requestAnimationFrame(i),e=!0)},stop:function(){n.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function xee(n){const e=new WeakMap;function t(a,l){const c=a.array,A=a.usage,u=c.byteLength,f=n.createBuffer();n.bindBuffer(l,f),n.bufferData(l,c,A),a.onUploadCallback();let h;if(c instanceof Float32Array)h=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?h=n.HALF_FLOAT:h=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)h=n.SHORT;else if(c instanceof Uint32Array)h=n.UNSIGNED_INT;else if(c instanceof Int32Array)h=n.INT;else if(c instanceof Int8Array)h=n.BYTE;else if(c instanceof Uint8Array)h=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)h=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:h,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:u}}function r(a,l,c){const A=l.array,u=l.updateRanges;if(n.bindBuffer(c,a),u.length===0)n.bufferSubData(c,0,A);else{u.sort((h,d)=>h.start-d.start);let f=0;for(let h=1;h1?null:t.copy(e.start).addScaledVector(r,s)}intersectsLine(e){const t=this.distanceToPoint(e.start),r=this.distanceToPoint(e.end);return t<0&&r>0||r<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){const r=t||See.getNormalMatrix(e),i=this.coplanarPoint(RE).applyMatrix4(e),s=this.normal.applyMatrix3(r).normalize();return this.constant=-i.dot(s),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}}const kA=new Si,Cv=new $;class c1{constructor(e=new Ma,t=new Ma,r=new Ma,i=new Ma,s=new Ma,o=new Ma){this.planes=[e,t,r,i,s,o]}set(e,t,r,i,s,o){const a=this.planes;return a[0].copy(e),a[1].copy(t),a[2].copy(r),a[3].copy(i),a[4].copy(s),a[5].copy(o),this}copy(e){const t=this.planes;for(let r=0;r<6;r++)t[r].copy(e.planes[r]);return this}setFromProjectionMatrix(e,t=Ql){const r=this.planes,i=e.elements,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],A=i[5],u=i[6],f=i[7],h=i[8],d=i[9],m=i[10],g=i[11],p=i[12],v=i[13],w=i[14],_=i[15];if(r[0].setComponents(l-s,f-c,g-h,_-p).normalize(),r[1].setComponents(l+s,f+c,g+h,_+p).normalize(),r[2].setComponents(l+o,f+A,g+d,_+v).normalize(),r[3].setComponents(l-o,f-A,g-d,_-v).normalize(),r[4].setComponents(l-a,f-u,g-m,_-w).normalize(),t===Ql)r[5].setComponents(l+a,f+u,g+m,_+w).normalize();else if(t===D_)r[5].setComponents(a,u,m,w).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),kA.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{const t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),kA.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(kA)}intersectsSprite(e){return kA.center.set(0,0,0),kA.radius=.7071067811865476,kA.applyMatrix4(e.matrixWorld),this.intersectsSphere(kA)}intersectsSphere(e){const t=this.planes,r=e.center,i=-e.radius;for(let s=0;s<6;s++)if(t[s].distanceToPoint(r)0?e.max.x:e.min.x,Cv.y=i.normal.y>0?e.max.y:e.min.y,Cv.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(Cv)<0)return!1}return!0}containsPoint(e){const t=this.planes;for(let r=0;r<6;r++)if(t[r].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}function Bz(){let n=null,e=!1,t=null,r=null;function i(s,o){t(s,o),r=n.requestAnimationFrame(i)}return{start:function(){e!==!0&&t!==null&&(r=n.requestAnimationFrame(i),e=!0)},stop:function(){n.cancelAnimationFrame(r),e=!1},setAnimationLoop:function(s){t=s},setContext:function(s){n=s}}}function Mee(n){const e=new WeakMap;function t(a,l){const c=a.array,A=a.usage,u=c.byteLength,f=n.createBuffer();n.bindBuffer(l,f),n.bufferData(l,c,A),a.onUploadCallback();let h;if(c instanceof Float32Array)h=n.FLOAT;else if(c instanceof Uint16Array)a.isFloat16BufferAttribute?h=n.HALF_FLOAT:h=n.UNSIGNED_SHORT;else if(c instanceof Int16Array)h=n.SHORT;else if(c instanceof Uint32Array)h=n.UNSIGNED_INT;else if(c instanceof Int32Array)h=n.INT;else if(c instanceof Int8Array)h=n.BYTE;else if(c instanceof Uint8Array)h=n.UNSIGNED_BYTE;else if(c instanceof Uint8ClampedArray)h=n.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+c);return{buffer:f,type:h,bytesPerElement:c.BYTES_PER_ELEMENT,version:a.version,size:u}}function r(a,l,c){const A=l.array,u=l.updateRanges;if(n.bindBuffer(c,a),u.length===0)n.bufferSubData(c,0,A);else{u.sort((h,d)=>h.start-d.start);let f=0;for(let h=1;h 0 +#endif`,Gee=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #ifdef ALPHA_TO_COVERAGE float distanceToPlane, distanceGradient; @@ -355,26 +355,26 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve if ( clipped ) discard; #endif #endif -#endif`,kee=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Vee=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,Hee=`#if NUM_CLIPPING_PLANES > 0 +#endif`,jee=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; -#endif`,Qee=`#if NUM_CLIPPING_PLANES > 0 +#endif`,Wee=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,zee=`#if defined( USE_COLOR_ALPHA ) +#endif`,Kee=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,Gee=`#if defined( USE_COLOR_ALPHA ) +#endif`,Xee=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,Vee=`#if defined( USE_COLOR_ALPHA ) +#endif`,Yee=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) varying vec3 vColor; -#endif`,jee=`#if defined( USE_COLOR_ALPHA ) +#endif`,$ee=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) vColor = vec3( 1.0 ); @@ -388,7 +388,7 @@ vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in ve #ifdef USE_BATCHING_COLOR vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); vColor.xyz *= batchingColor.xyz; -#endif`,Wee=`#define PI 3.141592653589793 +#endif`,Zee=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -462,7 +462,7 @@ vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,Kee=`#ifdef ENVMAP_TYPE_CUBE_UV +} // validated`,qee=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -555,7 +555,7 @@ float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,Xee=`vec3 transformedNormal = objectNormal; +#endif`,Jee=`vec3 transformedNormal = objectNormal; #ifdef USE_TANGENT vec3 transformedTangent = objectTangent; #endif @@ -584,18 +584,18 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,Yee=`#ifdef USE_DISPLACEMENTMAP +#endif`,ete=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,$ee=`#ifdef USE_DISPLACEMENTMAP +#endif`,tte=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,Zee=`#ifdef USE_EMISSIVEMAP +#endif`,nte=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,qee=`#ifdef USE_EMISSIVEMAP +#endif`,rte=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,Jee="gl_FragColor = linearToOutputTexel( gl_FragColor );",ete=` +#endif`,ite="gl_FragColor = linearToOutputTexel( gl_FragColor );",ste=` const mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3( vec3( 0.8224621, 0.177538, 0.0 ), vec3( 0.0331941, 0.9668058, 0.0 ), @@ -617,7 +617,7 @@ vec4 LinearTransferOETF( in vec4 value ) { } vec4 sRGBTransferOETF( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`,tte=`#ifdef USE_ENVMAP +}`,ote=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -646,7 +646,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,nte=`#ifdef USE_ENVMAP +#endif`,ate=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; uniform mat3 envMapRotation; @@ -656,7 +656,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,rte=`#ifdef USE_ENVMAP +#endif`,lte=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -667,7 +667,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,ite=`#ifdef USE_ENVMAP +#endif`,cte=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -678,7 +678,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,ste=`#ifdef USE_ENVMAP +#endif`,Ate=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -695,18 +695,18 @@ vec4 sRGBTransferOETF( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,ote=`#ifdef USE_FOG +#endif`,ute=`#ifdef USE_FOG vFogDepth = - mvPosition.z; -#endif`,ate=`#ifdef USE_FOG +#endif`,fte=`#ifdef USE_FOG varying float vFogDepth; -#endif`,lte=`#ifdef USE_FOG +#endif`,hte=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,cte=`#ifdef USE_FOG +#endif`,dte=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -715,7 +715,7 @@ vec4 sRGBTransferOETF( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,Ate=`#ifdef USE_GRADIENTMAP +#endif`,pte=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -727,12 +727,12 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,ute=`#ifdef USE_LIGHTMAP +}`,mte=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,fte=`LambertMaterial material; +#endif`,gte=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,hte=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,vte=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -746,7 +746,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometr reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,dte=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,yte=`uniform bool receiveShadow; uniform vec3 ambientLightColor; #if defined( USE_LIGHT_PROBES ) uniform vec3 lightProbe[ 9 ]; @@ -862,7 +862,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,pte=`#ifdef USE_ENVMAP +#endif`,wte=`#ifdef USE_ENVMAP vec3 getIBLIrradiance( const in vec3 normal ) { #ifdef ENVMAP_TYPE_CUBE_UV vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -895,8 +895,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi #endif } #endif -#endif`,mte=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,gte=`varying vec3 vViewPosition; +#endif`,_te=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,xte=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -908,11 +908,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPo reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,vte=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,bte=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,yte=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,Ete=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -929,7 +929,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geom reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,wte=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,Bte=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -1015,7 +1015,7 @@ material.roughness = min( material.roughness, 1.0 ); material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,_te=`struct PhysicalMaterial { +#endif`,Ste=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1316,7 +1316,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,xte=` +}`,Mte=` vec3 geometryPosition = - vViewPosition; vec3 geometryNormal = normal; vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); @@ -1431,7 +1431,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,bte=`#if defined( RE_IndirectDiffuse ) +#endif`,Cte=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1450,33 +1450,33 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,Ete=`#if defined( RE_IndirectDiffuse ) +#endif`,Tte=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,Bte=`#if defined( USE_LOGDEPTHBUF ) +#endif`,Ite=`#if defined( USE_LOGDEPTHBUF ) gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,Ste=`#if defined( USE_LOGDEPTHBUF ) +#endif`,Rte=`#if defined( USE_LOGDEPTHBUF ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,Mte=`#ifdef USE_LOGDEPTHBUF +#endif`,Ute=`#ifdef USE_LOGDEPTHBUF varying float vFragDepth; varying float vIsPerspective; -#endif`,Cte=`#ifdef USE_LOGDEPTHBUF +#endif`,Fte=`#ifdef USE_LOGDEPTHBUF vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,Tte=`#ifdef USE_MAP +#endif`,Pte=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vMapUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,Ite=`#ifdef USE_MAP +#endif`,Lte=`#ifdef USE_MAP uniform sampler2D map; -#endif`,Rte=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,Dte=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) #if defined( USE_POINTS_UV ) vec2 uv = vUv; #else @@ -1488,7 +1488,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,Ute=`#if defined( USE_POINTS_UV ) +#endif`,Nte=`#if defined( USE_POINTS_UV ) varying vec2 vUv; #else #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) @@ -1500,19 +1500,19 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,Fte=`float metalnessFactor = metalness; +#endif`,Ote=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); metalnessFactor *= texelMetalness.b; -#endif`,Pte=`#ifdef USE_METALNESSMAP +#endif`,kte=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,Lte=`#ifdef USE_INSTANCING_MORPH +#endif`,Hte=`#ifdef USE_INSTANCING_MORPH float morphTargetInfluences[ MORPHTARGETS_COUNT ]; float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; } -#endif`,Dte=`#if defined( USE_MORPHCOLORS ) +#endif`,Qte=`#if defined( USE_MORPHCOLORS ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1521,12 +1521,12 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,Nte=`#ifdef USE_MORPHNORMALS +#endif`,zte=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; } -#endif`,Ote=`#ifdef USE_MORPHTARGETS +#endif`,Gte=`#ifdef USE_MORPHTARGETS #ifndef USE_INSTANCING_MORPH uniform float morphTargetBaseInfluence; uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1540,12 +1540,12 @@ IncidentLight directLight; ivec3 morphUV = ivec3( x, y, morphTargetIndex ); return texelFetch( morphTargetsTexture, morphUV, 0 ); } -#endif`,kte=`#ifdef USE_MORPHTARGETS +#endif`,Vte=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; } -#endif`,Hte=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,jte=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1586,7 +1586,7 @@ IncidentLight directLight; tbn2[1] *= faceDirection; #endif #endif -vec3 nonPerturbedNormal = normal;`,Qte=`#ifdef USE_NORMALMAP_OBJECTSPACE +vec3 nonPerturbedNormal = normal;`,Wte=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1601,25 +1601,25 @@ vec3 nonPerturbedNormal = normal;`,Qte=`#ifdef USE_NORMALMAP_OBJECTSPACE normal = normalize( tbn * mapN ); #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,zte=`#ifndef FLAT_SHADED +#endif`,Kte=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,Gte=`#ifndef FLAT_SHADED +#endif`,Xte=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,Vte=`#ifndef FLAT_SHADED +#endif`,Yte=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,jte=`#ifdef USE_NORMALMAP +#endif`,$te=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1641,13 +1641,13 @@ vec3 nonPerturbedNormal = normal;`,Qte=`#ifdef USE_NORMALMAP_OBJECTSPACE float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); return mat3( T * scale, B * scale, N ); } -#endif`,Wte=`#ifdef USE_CLEARCOAT +#endif`,Zte=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,Kte=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,qte=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,Xte=`#ifdef USE_CLEARCOATMAP +#endif`,Jte=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_NORMALMAP @@ -1656,18 +1656,18 @@ vec3 nonPerturbedNormal = normal;`,Qte=`#ifdef USE_NORMALMAP_OBJECTSPACE #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP uniform sampler2D clearcoatRoughnessMap; -#endif`,Yte=`#ifdef USE_IRIDESCENCEMAP +#endif`,ene=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,$te=`#ifdef OPAQUE +#endif`,tne=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,Zte=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,nne=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1736,9 +1736,9 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * depth - far ); -}`,qte=`#ifdef PREMULTIPLIED_ALPHA +}`,rne=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,Jte=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,ine=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING mvPosition = batchingMatrix * mvPosition; #endif @@ -1746,22 +1746,22 @@ float perspectiveDepthToViewZ( const in float depth, const in float near, const mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,ene=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,sne=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,tne=`#ifdef DITHERING +#endif`,one=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,nne=`float roughnessFactor = roughness; +#endif`,ane=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); roughnessFactor *= texelRoughness.g; -#endif`,rne=`#ifdef USE_ROUGHNESSMAP +#endif`,lne=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,ine=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,cne=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -1947,7 +1947,7 @@ gl_Position = projectionMatrix * mvPosition;`,ene=`#ifdef DITHERING } return mix( 1.0, shadow, shadowIntensity ); } -#endif`,sne=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Ane=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -1988,7 +1988,7 @@ gl_Position = projectionMatrix * mvPosition;`,ene=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,one=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,une=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -2020,7 +2020,7 @@ gl_Position = projectionMatrix * mvPosition;`,ene=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,ane=`float getShadowMask() { +#endif`,fne=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -2052,12 +2052,12 @@ gl_Position = projectionMatrix * mvPosition;`,ene=`#ifdef DITHERING #endif #endif return shadow; -}`,lne=`#ifdef USE_SKINNING +}`,hne=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,cne=`#ifdef USE_SKINNING +#endif`,dne=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -2072,7 +2072,7 @@ gl_Position = projectionMatrix * mvPosition;`,ene=`#ifdef DITHERING vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); return mat4( v1, v2, v3, v4 ); } -#endif`,Ane=`#ifdef USE_SKINNING +#endif`,pne=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -2080,7 +2080,7 @@ gl_Position = projectionMatrix * mvPosition;`,ene=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,une=`#ifdef USE_SKINNING +#endif`,mne=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -2091,17 +2091,17 @@ gl_Position = projectionMatrix * mvPosition;`,ene=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,fne=`float specularStrength; +#endif`,gne=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,hne=`#ifdef USE_SPECULARMAP +#endif`,vne=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,dne=`#if defined( TONE_MAPPING ) +#endif`,yne=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,pne=`#ifndef saturate +#endif`,wne=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -2198,7 +2198,7 @@ vec3 NeutralToneMapping( vec3 color ) { float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); return mix( color, vec3( newPeak ), g ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,mne=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,_ne=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -2219,7 +2219,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,mne=`#ifdef USE_TRANSMIS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,gne=`#ifdef USE_TRANSMISSION +#endif`,xne=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -2350,7 +2350,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,mne=`#ifdef USE_TRANSMIS float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); } -#endif`,vne=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,bne=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2420,7 +2420,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,mne=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,yne=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,Ene=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) varying vec2 vUv; #endif #ifdef USE_MAP @@ -2514,7 +2514,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,mne=`#ifdef USE_TRANSMIS #ifdef USE_THICKNESSMAP uniform mat3 thicknessMapTransform; varying vec2 vThicknessMapUv; -#endif`,wne=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) +#endif`,Bne=`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) vUv = vec3( uv, 1 ).xy; #endif #ifdef USE_MAP @@ -2585,7 +2585,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,mne=`#ifdef USE_TRANSMIS #endif #ifdef USE_THICKNESSMAP vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,_ne=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,Sne=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_BATCHING worldPosition = batchingMatrix * worldPosition; @@ -2594,12 +2594,12 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,mne=`#ifdef USE_TRANSMIS worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const xne=`varying vec2 vUv; +#endif`;const Mne=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,bne=`uniform sampler2D t2D; +}`,Cne=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2611,14 +2611,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,Ene=`varying vec3 vWorldDirection; +}`,Tne=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Bne=`#ifdef ENVMAP_TYPE_CUBE +}`,Ine=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2641,14 +2641,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,Sne=`varying vec3 vWorldDirection; +}`,Rne=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Mne=`uniform samplerCube tCube; +}`,Une=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2658,7 +2658,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,Cne=`#include +}`,Fne=`#include #include #include #include @@ -2685,7 +2685,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,Tne=`#if DEPTH_PACKING == 3200 +}`,Pne=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2719,7 +2719,7 @@ void main() { #elif DEPTH_PACKING == 3203 gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); #endif -}`,Ine=`#define DISTANCE +}`,Lne=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2746,7 +2746,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,Rne=`#define DISTANCE +}`,Dne=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2770,13 +2770,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,Une=`varying vec3 vWorldDirection; +}`,Nne=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,Fne=`uniform sampler2D tEquirect; +}`,One=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2785,7 +2785,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,Pne=`uniform float scale; +}`,kne=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2807,7 +2807,7 @@ void main() { #include #include #include -}`,Lne=`uniform vec3 diffuse; +}`,Hne=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2835,7 +2835,7 @@ void main() { #include #include #include -}`,Dne=`#include +}`,Qne=`#include #include #include #include @@ -2867,7 +2867,7 @@ void main() { #include #include #include -}`,Nne=`uniform vec3 diffuse; +}`,zne=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2915,7 +2915,7 @@ void main() { #include #include #include -}`,One=`#define LAMBERT +}`,Gne=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -2954,7 +2954,7 @@ void main() { #include #include #include -}`,kne=`#define LAMBERT +}`,Vne=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3011,7 +3011,7 @@ void main() { #include #include #include -}`,Hne=`#define MATCAP +}`,jne=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -3045,7 +3045,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,Qne=`#define MATCAP +}`,Wne=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -3091,7 +3091,7 @@ void main() { #include #include #include -}`,zne=`#define NORMAL +}`,Kne=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; #endif @@ -3124,7 +3124,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) vViewPosition = - mvPosition.xyz; #endif -}`,Gne=`#define NORMAL +}`,Xne=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) varying vec3 vViewPosition; @@ -3146,7 +3146,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,Vne=`#define PHONG +}`,Yne=`#define PHONG varying vec3 vViewPosition; #include #include @@ -3185,7 +3185,7 @@ void main() { #include #include #include -}`,jne=`#define PHONG +}`,$ne=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -3244,7 +3244,7 @@ void main() { #include #include #include -}`,Wne=`#define STANDARD +}`,Zne=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -3287,7 +3287,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,Kne=`#define STANDARD +}`,qne=`#define STANDARD #ifdef PHYSICAL #define IOR #define USE_SPECULAR @@ -3412,7 +3412,7 @@ void main() { #include #include #include -}`,Xne=`#define TOON +}`,Jne=`#define TOON varying vec3 vViewPosition; #include #include @@ -3449,7 +3449,7 @@ void main() { #include #include #include -}`,Yne=`#define TOON +}`,ere=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -3502,7 +3502,7 @@ void main() { #include #include #include -}`,$ne=`uniform float size; +}`,tre=`uniform float size; uniform float scale; #include #include @@ -3533,7 +3533,7 @@ void main() { #include #include #include -}`,Zne=`uniform vec3 diffuse; +}`,nre=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3558,7 +3558,7 @@ void main() { #include #include #include -}`,qne=`#include +}`,rre=`#include #include #include #include @@ -3581,7 +3581,7 @@ void main() { #include #include #include -}`,Jne=`uniform vec3 color; +}`,ire=`uniform vec3 color; uniform float opacity; #include #include @@ -3597,7 +3597,7 @@ void main() { #include #include #include -}`,ere=`uniform float rotation; +}`,sre=`uniform float rotation; uniform vec2 center; #include #include @@ -3621,7 +3621,7 @@ void main() { #include #include #include -}`,tre=`uniform vec3 diffuse; +}`,ore=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -3646,7 +3646,7 @@ void main() { #include #include #include -}`,Bt={alphahash_fragment:bee,alphahash_pars_fragment:Eee,alphamap_fragment:Bee,alphamap_pars_fragment:See,alphatest_fragment:Mee,alphatest_pars_fragment:Cee,aomap_fragment:Tee,aomap_pars_fragment:Iee,batching_pars_vertex:Ree,batching_vertex:Uee,begin_vertex:Fee,beginnormal_vertex:Pee,bsdfs:Lee,iridescence_fragment:Dee,bumpmap_pars_fragment:Nee,clipping_planes_fragment:Oee,clipping_planes_pars_fragment:kee,clipping_planes_pars_vertex:Hee,clipping_planes_vertex:Qee,color_fragment:zee,color_pars_fragment:Gee,color_pars_vertex:Vee,color_vertex:jee,common:Wee,cube_uv_reflection_fragment:Kee,defaultnormal_vertex:Xee,displacementmap_pars_vertex:Yee,displacementmap_vertex:$ee,emissivemap_fragment:Zee,emissivemap_pars_fragment:qee,colorspace_fragment:Jee,colorspace_pars_fragment:ete,envmap_fragment:tte,envmap_common_pars_fragment:nte,envmap_pars_fragment:rte,envmap_pars_vertex:ite,envmap_physical_pars_fragment:pte,envmap_vertex:ste,fog_vertex:ote,fog_pars_vertex:ate,fog_fragment:lte,fog_pars_fragment:cte,gradientmap_pars_fragment:Ate,lightmap_pars_fragment:ute,lights_lambert_fragment:fte,lights_lambert_pars_fragment:hte,lights_pars_begin:dte,lights_toon_fragment:mte,lights_toon_pars_fragment:gte,lights_phong_fragment:vte,lights_phong_pars_fragment:yte,lights_physical_fragment:wte,lights_physical_pars_fragment:_te,lights_fragment_begin:xte,lights_fragment_maps:bte,lights_fragment_end:Ete,logdepthbuf_fragment:Bte,logdepthbuf_pars_fragment:Ste,logdepthbuf_pars_vertex:Mte,logdepthbuf_vertex:Cte,map_fragment:Tte,map_pars_fragment:Ite,map_particle_fragment:Rte,map_particle_pars_fragment:Ute,metalnessmap_fragment:Fte,metalnessmap_pars_fragment:Pte,morphinstance_vertex:Lte,morphcolor_vertex:Dte,morphnormal_vertex:Nte,morphtarget_pars_vertex:Ote,morphtarget_vertex:kte,normal_fragment_begin:Hte,normal_fragment_maps:Qte,normal_pars_fragment:zte,normal_pars_vertex:Gte,normal_vertex:Vte,normalmap_pars_fragment:jte,clearcoat_normal_fragment_begin:Wte,clearcoat_normal_fragment_maps:Kte,clearcoat_pars_fragment:Xte,iridescence_pars_fragment:Yte,opaque_fragment:$te,packing:Zte,premultiplied_alpha_fragment:qte,project_vertex:Jte,dithering_fragment:ene,dithering_pars_fragment:tne,roughnessmap_fragment:nne,roughnessmap_pars_fragment:rne,shadowmap_pars_fragment:ine,shadowmap_pars_vertex:sne,shadowmap_vertex:one,shadowmask_pars_fragment:ane,skinbase_vertex:lne,skinning_pars_vertex:cne,skinning_vertex:Ane,skinnormal_vertex:une,specularmap_fragment:fne,specularmap_pars_fragment:hne,tonemapping_fragment:dne,tonemapping_pars_fragment:pne,transmission_fragment:mne,transmission_pars_fragment:gne,uv_pars_fragment:vne,uv_pars_vertex:yne,uv_vertex:wne,worldpos_vertex:_ne,background_vert:xne,background_frag:bne,backgroundCube_vert:Ene,backgroundCube_frag:Bne,cube_vert:Sne,cube_frag:Mne,depth_vert:Cne,depth_frag:Tne,distanceRGBA_vert:Ine,distanceRGBA_frag:Rne,equirect_vert:Une,equirect_frag:Fne,linedashed_vert:Pne,linedashed_frag:Lne,meshbasic_vert:Dne,meshbasic_frag:Nne,meshlambert_vert:One,meshlambert_frag:kne,meshmatcap_vert:Hne,meshmatcap_frag:Qne,meshnormal_vert:zne,meshnormal_frag:Gne,meshphong_vert:Vne,meshphong_frag:jne,meshphysical_vert:Wne,meshphysical_frag:Kne,meshtoon_vert:Xne,meshtoon_frag:Yne,points_vert:$ne,points_frag:Zne,shadow_vert:qne,shadow_frag:Jne,sprite_vert:ere,sprite_frag:tre},ze={common:{diffuse:{value:new He(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ut},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ut}},envmap:{envMap:{value:null},envMapRotation:{value:new ut},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ut}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ut}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ut},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ut},normalScale:{value:new je(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ut},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ut}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ut}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ut}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new He(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new He(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0},uvTransform:{value:new ut}},sprite:{diffuse:{value:new He(16777215)},opacity:{value:1},center:{value:new je(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ut},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0}}},Ma={basic:{uniforms:Ii([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.fog]),vertexShader:Bt.meshbasic_vert,fragmentShader:Bt.meshbasic_frag},lambert:{uniforms:Ii([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new He(0)}}]),vertexShader:Bt.meshlambert_vert,fragmentShader:Bt.meshlambert_frag},phong:{uniforms:Ii([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new He(0)},specular:{value:new He(1118481)},shininess:{value:30}}]),vertexShader:Bt.meshphong_vert,fragmentShader:Bt.meshphong_frag},standard:{uniforms:Ii([ze.common,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.roughnessmap,ze.metalnessmap,ze.fog,ze.lights,{emissive:{value:new He(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Bt.meshphysical_vert,fragmentShader:Bt.meshphysical_frag},toon:{uniforms:Ii([ze.common,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.gradientmap,ze.fog,ze.lights,{emissive:{value:new He(0)}}]),vertexShader:Bt.meshtoon_vert,fragmentShader:Bt.meshtoon_frag},matcap:{uniforms:Ii([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,{matcap:{value:null}}]),vertexShader:Bt.meshmatcap_vert,fragmentShader:Bt.meshmatcap_frag},points:{uniforms:Ii([ze.points,ze.fog]),vertexShader:Bt.points_vert,fragmentShader:Bt.points_frag},dashed:{uniforms:Ii([ze.common,ze.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Bt.linedashed_vert,fragmentShader:Bt.linedashed_frag},depth:{uniforms:Ii([ze.common,ze.displacementmap]),vertexShader:Bt.depth_vert,fragmentShader:Bt.depth_frag},normal:{uniforms:Ii([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,{opacity:{value:1}}]),vertexShader:Bt.meshnormal_vert,fragmentShader:Bt.meshnormal_frag},sprite:{uniforms:Ii([ze.sprite,ze.fog]),vertexShader:Bt.sprite_vert,fragmentShader:Bt.sprite_frag},background:{uniforms:{uvTransform:{value:new ut},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Bt.background_vert,fragmentShader:Bt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ut}},vertexShader:Bt.backgroundCube_vert,fragmentShader:Bt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Bt.cube_vert,fragmentShader:Bt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Bt.equirect_vert,fragmentShader:Bt.equirect_frag},distanceRGBA:{uniforms:Ii([ze.common,ze.displacementmap,{referencePosition:{value:new $},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Bt.distanceRGBA_vert,fragmentShader:Bt.distanceRGBA_frag},shadow:{uniforms:Ii([ze.lights,ze.fog,{color:{value:new He(0)},opacity:{value:1}}]),vertexShader:Bt.shadow_vert,fragmentShader:Bt.shadow_frag}};Ma.physical={uniforms:Ii([Ma.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ut},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ut},clearcoatNormalScale:{value:new je(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ut},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ut},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ut},sheen:{value:0},sheenColor:{value:new He(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ut},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ut},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ut},transmissionSamplerSize:{value:new je},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ut},attenuationDistance:{value:0},attenuationColor:{value:new He(0)},specularColor:{value:new He(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ut},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ut},anisotropyVector:{value:new je},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ut}}]),vertexShader:Bt.meshphysical_vert,fragmentShader:Bt.meshphysical_frag};const Sv={r:0,b:0,g:0},OA=new tr,nre=new ke;function rre(n,e,t,r,i,s,o){const a=new He(0);let l=s===!0?0:1,c,A,u=null,f=0,h=null;function d(v){let w=v.isScene===!0?v.background:null;return w&&w.isTexture&&(w=(v.backgroundBlurriness>0?t:e).get(w)),w}function m(v){let w=!1;const _=d(v);_===null?p(a,l):_&&_.isColor&&(p(_,1),w=!0);const x=n.xr.getEnvironmentBlendMode();x==="additive"?r.buffers.color.setClear(0,0,0,1,o):x==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(n.autoClear||w)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function g(v,w){const _=d(w);_&&(_.isCubeTexture||_.mapping===r1)?(A===void 0&&(A=new hn(new d0(1,1,1),new dr({name:"BackgroundCubeMaterial",uniforms:Pd(Ma.backgroundCube.uniforms),vertexShader:Ma.backgroundCube.vertexShader,fragmentShader:Ma.backgroundCube.fragmentShader,side:si,depthTest:!1,depthWrite:!1,fog:!1})),A.geometry.deleteAttribute("normal"),A.geometry.deleteAttribute("uv"),A.onBeforeRender=function(x,b,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(A.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(A)),OA.copy(w.backgroundRotation),OA.x*=-1,OA.y*=-1,OA.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(OA.y*=-1,OA.z*=-1),A.material.uniforms.envMap.value=_,A.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,A.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,A.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,A.material.uniforms.backgroundRotation.value.setFromMatrix4(nre.makeRotationFromEuler(OA)),A.material.toneMapped=bt.getTransfer(_.colorSpace)!==Sn,(u!==_||f!==_.version||h!==n.toneMapping)&&(A.material.needsUpdate=!0,u=_,f=_.version,h=n.toneMapping),A.layers.enableAll(),v.unshift(A,A.geometry,A.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new hn(new ac(2,2),new dr({name:"BackgroundMaterial",uniforms:Pd(Ma.background.uniforms),vertexShader:Ma.background.vertexShader,fragmentShader:Ma.background.fragmentShader,side:ks,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=_,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.toneMapped=bt.getTransfer(_.colorSpace)!==Sn,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(u!==_||f!==_.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,u=_,f=_.version,h=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function p(v,w){v.getRGB(Sv,wz(n)),r.buffers.color.setClear(Sv.r,Sv.g,Sv.b,w,o)}return{getClearColor:function(){return a},setClearColor:function(v,w=1){a.set(v),l=w,p(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,p(a,l)},render:m,addToRenderList:g}}function ire(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),r={},i=f(null);let s=i,o=!1;function a(S,L,O,T,y){let E=!1;const U=u(T,O,L);s!==U&&(s=U,c(s.object)),E=h(S,T,O,y),E&&d(S,T,O,y),y!==null&&e.update(y,n.ELEMENT_ARRAY_BUFFER),(E||o)&&(o=!1,_(S,L,O,T),y!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(y).buffer))}function l(){return n.createVertexArray()}function c(S){return n.bindVertexArray(S)}function A(S){return n.deleteVertexArray(S)}function u(S,L,O){const T=O.wireframe===!0;let y=r[S.id];y===void 0&&(y={},r[S.id]=y);let E=y[L.id];E===void 0&&(E={},y[L.id]=E);let U=E[T];return U===void 0&&(U=f(l()),E[T]=U),U}function f(S){const L=[],O=[],T=[];for(let y=0;y=0){const W=y[N];let H=E[N];if(H===void 0&&(N==="instanceMatrix"&&S.instanceMatrix&&(H=S.instanceMatrix),N==="instanceColor"&&S.instanceColor&&(H=S.instanceColor)),W===void 0||W.attribute!==H||H&&W.data!==H.data)return!0;U++}return s.attributesNum!==U||s.index!==T}function d(S,L,O,T){const y={},E=L.attributes;let U=0;const P=O.getAttributes();for(const N in P)if(P[N].location>=0){let W=E[N];W===void 0&&(N==="instanceMatrix"&&S.instanceMatrix&&(W=S.instanceMatrix),N==="instanceColor"&&S.instanceColor&&(W=S.instanceColor));const H={};H.attribute=W,W&&W.data&&(H.data=W.data),y[N]=H,U++}s.attributes=y,s.attributesNum=U,s.index=T}function m(){const S=s.newAttributes;for(let L=0,O=S.length;L=0){let z=y[P];if(z===void 0&&(P==="instanceMatrix"&&S.instanceMatrix&&(z=S.instanceMatrix),P==="instanceColor"&&S.instanceColor&&(z=S.instanceColor)),z!==void 0){const W=z.normalized,H=z.itemSize,C=e.get(z);if(C===void 0)continue;const K=C.buffer,te=C.type,F=C.bytesPerElement,re=te===n.INT||te===n.UNSIGNED_INT||z.gpuType===xR;if(z.isInterleavedBufferAttribute){const ce=z.data,oe=ce.stride,ge=z.offset;if(ce.isInstancedInterleavedBuffer){for(let me=0;me0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";B="mediump"}return B==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const A=l(c);A!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",A,"instead."),c=A);const u=t.logarithmicDepthBuffer===!0,f=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(f===!0){const B=e.get("EXT_clip_control");B.clipControlEXT(B.LOWER_LEFT_EXT,B.ZERO_TO_ONE_EXT)}const h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),d=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),p=n.getParameter(n.MAX_VERTEX_ATTRIBS),v=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),w=n.getParameter(n.MAX_VARYING_VECTORS),_=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),x=d>0,b=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:u,reverseDepthBuffer:f,maxTextures:h,maxVertexTextures:d,maxTextureSize:m,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:v,maxVaryings:w,maxFragmentUniforms:_,vertexTextures:x,maxSamples:b}}function are(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new Sa,a=new ut,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const h=u.length!==0||f||r!==0||i;return i=f,r=u.length,h},this.beginShadows=function(){s=!0,A(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,f){t=A(u,f,0)},this.setState=function(u,f,h){const d=u.clippingPlanes,m=u.clipIntersection,g=u.clipShadows,p=n.get(u);if(!i||d===null||d.length===0||s&&!g)s?A(null):c();else{const v=s?0:r,w=v*4;let _=p.clippingState||null;l.value=_,_=A(d,f,w,h);for(let x=0;x!==w;++x)_[x]=t[x];p.clippingState=_,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function A(u,f,h,d){const m=u!==null?u.length:0;let g=null;if(m!==0){if(g=l.value,d!==!0||g===null){const p=h+m*4,v=f.matrixWorldInverse;a.getNormalMatrix(v),(g===null||g.length0){const c=new yee(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class p0 extends _z{constructor(e=-1,t=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,A=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=A*this.view.offsetY,l=a-A*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Ph=4,wL=[.125,.215,.35,.446,.526,.582],iu=20,TE=new p0,_L=new He;let IE=null,RE=0,UE=0,FE=!1;const JA=(1+Math.sqrt(5))/2,gf=1/JA,xL=[new $(-JA,gf,0),new $(JA,gf,0),new $(-gf,0,JA),new $(gf,0,JA),new $(0,JA,-gf),new $(0,JA,gf),new $(-1,1,-1),new $(1,1,-1),new $(-1,1,1),new $(1,1,1)];class bL{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,i=100){IE=this._renderer.getRenderTarget(),RE=this._renderer.getActiveCubeFace(),UE=this._renderer.getActiveMipmapLevel(),FE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=SL(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=BL(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?w:0,w,w),A.setRenderTarget(i),m&&A.render(d,a),A.render(e,a)}d.geometry.dispose(),d.material.dispose(),A.toneMapping=f,A.autoClear=u,e.background=g}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===Md||e.mapping===Cd;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=SL()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=BL());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new hn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Mv(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,TE)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;siu&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${iu}`);const p=[];let v=0;for(let B=0;Bw-Ph?i-w+Ph:0),b=4*(this._cubeSize-_);Mv(t,x,b,3*_,2*_),l.setRenderTarget(t),l.render(u,TE)}}function cre(n){const e=[],t=[],r=[];let i=n;const s=n-Ph+1+wL.length;for(let o=0;on-Ph?l=wL[o-n+Ph-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),A=-c,u=1+c,f=[A,A,u,A,u,u,A,A,u,u,A,u],h=6,d=6,m=3,g=2,p=1,v=new Float32Array(m*d*h),w=new Float32Array(g*d*h),_=new Float32Array(p*d*h);for(let b=0;b2?0:-1,I=[B,M,0,B+2/3,M,0,B+2/3,M+1,0,B,M,0,B+2/3,M+1,0,B,M+1,0];v.set(I,m*d*b),w.set(f,g*d*b);const S=[b,b,b,b,b,b];_.set(S,p*d*b)}const x=new Zt;x.setAttribute("position",new lt(v,m)),x.setAttribute("uv",new lt(w,g)),x.setAttribute("faceIndex",new lt(_,p)),e.push(x),i>Ph&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function EL(n,e,t){const r=new Za(n,e,t);return r.texture.mapping=r1,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Mv(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function Are(n,e,t){const r=new Float32Array(iu),i=new $(0,1,0);return new dr({name:"SphericalGaussianBlur",defines:{n:iu,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:PR(),fragmentShader:` +}`,Bt={alphahash_fragment:Cee,alphahash_pars_fragment:Tee,alphamap_fragment:Iee,alphamap_pars_fragment:Ree,alphatest_fragment:Uee,alphatest_pars_fragment:Fee,aomap_fragment:Pee,aomap_pars_fragment:Lee,batching_pars_vertex:Dee,batching_vertex:Nee,begin_vertex:Oee,beginnormal_vertex:kee,bsdfs:Hee,iridescence_fragment:Qee,bumpmap_pars_fragment:zee,clipping_planes_fragment:Gee,clipping_planes_pars_fragment:Vee,clipping_planes_pars_vertex:jee,clipping_planes_vertex:Wee,color_fragment:Kee,color_pars_fragment:Xee,color_pars_vertex:Yee,color_vertex:$ee,common:Zee,cube_uv_reflection_fragment:qee,defaultnormal_vertex:Jee,displacementmap_pars_vertex:ete,displacementmap_vertex:tte,emissivemap_fragment:nte,emissivemap_pars_fragment:rte,colorspace_fragment:ite,colorspace_pars_fragment:ste,envmap_fragment:ote,envmap_common_pars_fragment:ate,envmap_pars_fragment:lte,envmap_pars_vertex:cte,envmap_physical_pars_fragment:wte,envmap_vertex:Ate,fog_vertex:ute,fog_pars_vertex:fte,fog_fragment:hte,fog_pars_fragment:dte,gradientmap_pars_fragment:pte,lightmap_pars_fragment:mte,lights_lambert_fragment:gte,lights_lambert_pars_fragment:vte,lights_pars_begin:yte,lights_toon_fragment:_te,lights_toon_pars_fragment:xte,lights_phong_fragment:bte,lights_phong_pars_fragment:Ete,lights_physical_fragment:Bte,lights_physical_pars_fragment:Ste,lights_fragment_begin:Mte,lights_fragment_maps:Cte,lights_fragment_end:Tte,logdepthbuf_fragment:Ite,logdepthbuf_pars_fragment:Rte,logdepthbuf_pars_vertex:Ute,logdepthbuf_vertex:Fte,map_fragment:Pte,map_pars_fragment:Lte,map_particle_fragment:Dte,map_particle_pars_fragment:Nte,metalnessmap_fragment:Ote,metalnessmap_pars_fragment:kte,morphinstance_vertex:Hte,morphcolor_vertex:Qte,morphnormal_vertex:zte,morphtarget_pars_vertex:Gte,morphtarget_vertex:Vte,normal_fragment_begin:jte,normal_fragment_maps:Wte,normal_pars_fragment:Kte,normal_pars_vertex:Xte,normal_vertex:Yte,normalmap_pars_fragment:$te,clearcoat_normal_fragment_begin:Zte,clearcoat_normal_fragment_maps:qte,clearcoat_pars_fragment:Jte,iridescence_pars_fragment:ene,opaque_fragment:tne,packing:nne,premultiplied_alpha_fragment:rne,project_vertex:ine,dithering_fragment:sne,dithering_pars_fragment:one,roughnessmap_fragment:ane,roughnessmap_pars_fragment:lne,shadowmap_pars_fragment:cne,shadowmap_pars_vertex:Ane,shadowmap_vertex:une,shadowmask_pars_fragment:fne,skinbase_vertex:hne,skinning_pars_vertex:dne,skinning_vertex:pne,skinnormal_vertex:mne,specularmap_fragment:gne,specularmap_pars_fragment:vne,tonemapping_fragment:yne,tonemapping_pars_fragment:wne,transmission_fragment:_ne,transmission_pars_fragment:xne,uv_pars_fragment:bne,uv_pars_vertex:Ene,uv_vertex:Bne,worldpos_vertex:Sne,background_vert:Mne,background_frag:Cne,backgroundCube_vert:Tne,backgroundCube_frag:Ine,cube_vert:Rne,cube_frag:Une,depth_vert:Fne,depth_frag:Pne,distanceRGBA_vert:Lne,distanceRGBA_frag:Dne,equirect_vert:Nne,equirect_frag:One,linedashed_vert:kne,linedashed_frag:Hne,meshbasic_vert:Qne,meshbasic_frag:zne,meshlambert_vert:Gne,meshlambert_frag:Vne,meshmatcap_vert:jne,meshmatcap_frag:Wne,meshnormal_vert:Kne,meshnormal_frag:Xne,meshphong_vert:Yne,meshphong_frag:$ne,meshphysical_vert:Zne,meshphysical_frag:qne,meshtoon_vert:Jne,meshtoon_frag:ere,points_vert:tre,points_frag:nre,shadow_vert:rre,shadow_frag:ire,sprite_vert:sre,sprite_frag:ore},ze={common:{diffuse:{value:new He(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new ut},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new ut}},envmap:{envMap:{value:null},envMapRotation:{value:new ut},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new ut}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new ut}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new ut},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new ut},normalScale:{value:new je(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new ut},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new ut}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new ut}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new ut}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new He(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new He(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0},uvTransform:{value:new ut}},sprite:{diffuse:{value:new He(16777215)},opacity:{value:1},center:{value:new je(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new ut},alphaMap:{value:null},alphaMapTransform:{value:new ut},alphaTest:{value:0}}},Ca={basic:{uniforms:Ui([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.fog]),vertexShader:Bt.meshbasic_vert,fragmentShader:Bt.meshbasic_frag},lambert:{uniforms:Ui([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new He(0)}}]),vertexShader:Bt.meshlambert_vert,fragmentShader:Bt.meshlambert_frag},phong:{uniforms:Ui([ze.common,ze.specularmap,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,ze.lights,{emissive:{value:new He(0)},specular:{value:new He(1118481)},shininess:{value:30}}]),vertexShader:Bt.meshphong_vert,fragmentShader:Bt.meshphong_frag},standard:{uniforms:Ui([ze.common,ze.envmap,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.roughnessmap,ze.metalnessmap,ze.fog,ze.lights,{emissive:{value:new He(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:Bt.meshphysical_vert,fragmentShader:Bt.meshphysical_frag},toon:{uniforms:Ui([ze.common,ze.aomap,ze.lightmap,ze.emissivemap,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.gradientmap,ze.fog,ze.lights,{emissive:{value:new He(0)}}]),vertexShader:Bt.meshtoon_vert,fragmentShader:Bt.meshtoon_frag},matcap:{uniforms:Ui([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,ze.fog,{matcap:{value:null}}]),vertexShader:Bt.meshmatcap_vert,fragmentShader:Bt.meshmatcap_frag},points:{uniforms:Ui([ze.points,ze.fog]),vertexShader:Bt.points_vert,fragmentShader:Bt.points_frag},dashed:{uniforms:Ui([ze.common,ze.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:Bt.linedashed_vert,fragmentShader:Bt.linedashed_frag},depth:{uniforms:Ui([ze.common,ze.displacementmap]),vertexShader:Bt.depth_vert,fragmentShader:Bt.depth_frag},normal:{uniforms:Ui([ze.common,ze.bumpmap,ze.normalmap,ze.displacementmap,{opacity:{value:1}}]),vertexShader:Bt.meshnormal_vert,fragmentShader:Bt.meshnormal_frag},sprite:{uniforms:Ui([ze.sprite,ze.fog]),vertexShader:Bt.sprite_vert,fragmentShader:Bt.sprite_frag},background:{uniforms:{uvTransform:{value:new ut},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:Bt.background_vert,fragmentShader:Bt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new ut}},vertexShader:Bt.backgroundCube_vert,fragmentShader:Bt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:Bt.cube_vert,fragmentShader:Bt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:Bt.equirect_vert,fragmentShader:Bt.equirect_frag},distanceRGBA:{uniforms:Ui([ze.common,ze.displacementmap,{referencePosition:{value:new $},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:Bt.distanceRGBA_vert,fragmentShader:Bt.distanceRGBA_frag},shadow:{uniforms:Ui([ze.lights,ze.fog,{color:{value:new He(0)},opacity:{value:1}}]),vertexShader:Bt.shadow_vert,fragmentShader:Bt.shadow_frag}};Ca.physical={uniforms:Ui([Ca.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new ut},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new ut},clearcoatNormalScale:{value:new je(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new ut},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new ut},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new ut},sheen:{value:0},sheenColor:{value:new He(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new ut},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new ut},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new ut},transmissionSamplerSize:{value:new je},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new ut},attenuationDistance:{value:0},attenuationColor:{value:new He(0)},specularColor:{value:new He(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new ut},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new ut},anisotropyVector:{value:new je},anisotropyMap:{value:null},anisotropyMapTransform:{value:new ut}}]),vertexShader:Bt.meshphysical_vert,fragmentShader:Bt.meshphysical_frag};const Tv={r:0,b:0,g:0},HA=new tr,are=new ke;function lre(n,e,t,r,i,s,o){const a=new He(0);let l=s===!0?0:1,c,A,u=null,f=0,h=null;function d(v){let w=v.isScene===!0?v.background:null;return w&&w.isTexture&&(w=(v.backgroundBlurriness>0?t:e).get(w)),w}function m(v){let w=!1;const _=d(v);_===null?p(a,l):_&&_.isColor&&(p(_,1),w=!0);const x=n.xr.getEnvironmentBlendMode();x==="additive"?r.buffers.color.setClear(0,0,0,1,o):x==="alpha-blend"&&r.buffers.color.setClear(0,0,0,0,o),(n.autoClear||w)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil))}function g(v,w){const _=d(w);_&&(_.isCubeTexture||_.mapping===s1)?(A===void 0&&(A=new hn(new m0(1,1,1),new pr({name:"BackgroundCubeMaterial",uniforms:Dd(Ca.backgroundCube.uniforms),vertexShader:Ca.backgroundCube.vertexShader,fragmentShader:Ca.backgroundCube.fragmentShader,side:oi,depthTest:!1,depthWrite:!1,fog:!1})),A.geometry.deleteAttribute("normal"),A.geometry.deleteAttribute("uv"),A.onBeforeRender=function(x,b,B){this.matrixWorld.copyPosition(B.matrixWorld)},Object.defineProperty(A.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(A)),HA.copy(w.backgroundRotation),HA.x*=-1,HA.y*=-1,HA.z*=-1,_.isCubeTexture&&_.isRenderTargetTexture===!1&&(HA.y*=-1,HA.z*=-1),A.material.uniforms.envMap.value=_,A.material.uniforms.flipEnvMap.value=_.isCubeTexture&&_.isRenderTargetTexture===!1?-1:1,A.material.uniforms.backgroundBlurriness.value=w.backgroundBlurriness,A.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,A.material.uniforms.backgroundRotation.value.setFromMatrix4(are.makeRotationFromEuler(HA)),A.material.toneMapped=bt.getTransfer(_.colorSpace)!==Sn,(u!==_||f!==_.version||h!==n.toneMapping)&&(A.material.needsUpdate=!0,u=_,f=_.version,h=n.toneMapping),A.layers.enableAll(),v.unshift(A,A.geometry,A.material,0,0,null)):_&&_.isTexture&&(c===void 0&&(c=new hn(new cc(2,2),new pr({name:"BackgroundMaterial",uniforms:Dd(Ca.background.uniforms),vertexShader:Ca.background.vertexShader,fragmentShader:Ca.background.fragmentShader,side:Hs,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),Object.defineProperty(c.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(c)),c.material.uniforms.t2D.value=_,c.material.uniforms.backgroundIntensity.value=w.backgroundIntensity,c.material.toneMapped=bt.getTransfer(_.colorSpace)!==Sn,_.matrixAutoUpdate===!0&&_.updateMatrix(),c.material.uniforms.uvTransform.value.copy(_.matrix),(u!==_||f!==_.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,u=_,f=_.version,h=n.toneMapping),c.layers.enableAll(),v.unshift(c,c.geometry,c.material,0,0,null))}function p(v,w){v.getRGB(Tv,xz(n)),r.buffers.color.setClear(Tv.r,Tv.g,Tv.b,w,o)}return{getClearColor:function(){return a},setClearColor:function(v,w=1){a.set(v),l=w,p(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(v){l=v,p(a,l)},render:m,addToRenderList:g}}function cre(n,e){const t=n.getParameter(n.MAX_VERTEX_ATTRIBS),r={},i=f(null);let s=i,o=!1;function a(M,P,D,T,y){let E=!1;const R=u(T,D,P);s!==R&&(s=R,c(s.object)),E=h(M,T,D,y),E&&d(M,T,D,y),y!==null&&e.update(y,n.ELEMENT_ARRAY_BUFFER),(E||o)&&(o=!1,_(M,P,D,T),y!==null&&n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,e.get(y).buffer))}function l(){return n.createVertexArray()}function c(M){return n.bindVertexArray(M)}function A(M){return n.deleteVertexArray(M)}function u(M,P,D){const T=D.wireframe===!0;let y=r[M.id];y===void 0&&(y={},r[M.id]=y);let E=y[P.id];E===void 0&&(E={},y[P.id]=E);let R=E[T];return R===void 0&&(R=f(l()),E[T]=R),R}function f(M){const P=[],D=[],T=[];for(let y=0;y=0){const W=y[N];let H=E[N];if(H===void 0&&(N==="instanceMatrix"&&M.instanceMatrix&&(H=M.instanceMatrix),N==="instanceColor"&&M.instanceColor&&(H=M.instanceColor)),W===void 0||W.attribute!==H||H&&W.data!==H.data)return!0;R++}return s.attributesNum!==R||s.index!==T}function d(M,P,D,T){const y={},E=P.attributes;let R=0;const L=D.getAttributes();for(const N in L)if(L[N].location>=0){let W=E[N];W===void 0&&(N==="instanceMatrix"&&M.instanceMatrix&&(W=M.instanceMatrix),N==="instanceColor"&&M.instanceColor&&(W=M.instanceColor));const H={};H.attribute=W,W&&W.data&&(H.data=W.data),y[N]=H,R++}s.attributes=y,s.attributesNum=R,s.index=T}function m(){const M=s.newAttributes;for(let P=0,D=M.length;P=0){let z=y[L];if(z===void 0&&(L==="instanceMatrix"&&M.instanceMatrix&&(z=M.instanceMatrix),L==="instanceColor"&&M.instanceColor&&(z=M.instanceColor)),z!==void 0){const W=z.normalized,H=z.itemSize,C=e.get(z);if(C===void 0)continue;const K=C.buffer,ee=C.type,F=C.bytesPerElement,re=ee===n.INT||ee===n.UNSIGNED_INT||z.gpuType===BR;if(z.isInterleavedBufferAttribute){const ce=z.data,oe=ce.stride,ge=z.offset;if(ce.isInstancedInterleavedBuffer){for(let me=0;me0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.HIGH_FLOAT).precision>0)return"highp";B="mediump"}return B==="mediump"&&n.getShaderPrecisionFormat(n.VERTEX_SHADER,n.MEDIUM_FLOAT).precision>0&&n.getShaderPrecisionFormat(n.FRAGMENT_SHADER,n.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let c=t.precision!==void 0?t.precision:"highp";const A=l(c);A!==c&&(console.warn("THREE.WebGLRenderer:",c,"not supported, using",A,"instead."),c=A);const u=t.logarithmicDepthBuffer===!0,f=t.reverseDepthBuffer===!0&&e.has("EXT_clip_control");if(f===!0){const B=e.get("EXT_clip_control");B.clipControlEXT(B.LOWER_LEFT_EXT,B.ZERO_TO_ONE_EXT)}const h=n.getParameter(n.MAX_TEXTURE_IMAGE_UNITS),d=n.getParameter(n.MAX_VERTEX_TEXTURE_IMAGE_UNITS),m=n.getParameter(n.MAX_TEXTURE_SIZE),g=n.getParameter(n.MAX_CUBE_MAP_TEXTURE_SIZE),p=n.getParameter(n.MAX_VERTEX_ATTRIBS),v=n.getParameter(n.MAX_VERTEX_UNIFORM_VECTORS),w=n.getParameter(n.MAX_VARYING_VECTORS),_=n.getParameter(n.MAX_FRAGMENT_UNIFORM_VECTORS),x=d>0,b=n.getParameter(n.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:s,getMaxPrecision:l,textureFormatReadable:o,textureTypeReadable:a,precision:c,logarithmicDepthBuffer:u,reverseDepthBuffer:f,maxTextures:h,maxVertexTextures:d,maxTextureSize:m,maxCubemapSize:g,maxAttributes:p,maxVertexUniforms:v,maxVaryings:w,maxFragmentUniforms:_,vertexTextures:x,maxSamples:b}}function fre(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new Ma,a=new ut,l={value:null,needsUpdate:!1};this.uniform=l,this.numPlanes=0,this.numIntersection=0,this.init=function(u,f){const h=u.length!==0||f||r!==0||i;return i=f,r=u.length,h},this.beginShadows=function(){s=!0,A(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,f){t=A(u,f,0)},this.setState=function(u,f,h){const d=u.clippingPlanes,m=u.clipIntersection,g=u.clipShadows,p=n.get(u);if(!i||d===null||d.length===0||s&&!g)s?A(null):c();else{const v=s?0:r,w=v*4;let _=p.clippingState||null;l.value=_,_=A(d,f,w,h);for(let x=0;x!==w;++x)_[x]=t[x];p.clippingState=_,this.numIntersection=m?this.numPlanes:0,this.numPlanes+=v}};function c(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function A(u,f,h,d){const m=u!==null?u.length:0;let g=null;if(m!==0){if(g=l.value,d!==!0||g===null){const p=h+m*4,v=f.matrixWorldInverse;a.getNormalMatrix(v),(g===null||g.length0){const c=new Eee(l.height);return c.fromEquirectangularTexture(n,o),e.set(o,c),o.addEventListener("dispose",i),t(c.texture,o.mapping)}else return null}}return o}function i(o){const a=o.target;a.removeEventListener("dispose",i);const l=e.get(a);l!==void 0&&(e.delete(a),l.dispose())}function s(){e=new WeakMap}return{get:r,dispose:s}}class g0 extends bz{constructor(e=-1,t=1,r=1,i=-1,s=.1,o=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=r,this.bottom=i,this.near=s,this.far=o,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,r,i,s,o){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=r,this.view.offsetY=i,this.view.width=s,this.view.height=o,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),r=(this.right+this.left)/2,i=(this.top+this.bottom)/2;let s=r-e,o=r+e,a=i+t,l=i-t;if(this.view!==null&&this.view.enabled){const c=(this.right-this.left)/this.view.fullWidth/this.zoom,A=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=c*this.view.offsetX,o=s+c*this.view.width,a-=A*this.view.offsetY,l=a-A*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){const t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}}const Nh=4,xL=[.125,.215,.35,.446,.526,.582],ou=20,UE=new g0,bL=new He;let FE=null,PE=0,LE=0,DE=!1;const tu=(1+Math.sqrt(5))/2,wf=1/tu,EL=[new $(-tu,wf,0),new $(tu,wf,0),new $(-wf,0,tu),new $(wf,0,tu),new $(0,tu,-wf),new $(0,tu,wf),new $(-1,1,-1),new $(1,1,-1),new $(-1,1,1),new $(1,1,1)];class BL{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,r=.1,i=100){FE=this._renderer.getRenderTarget(),PE=this._renderer.getActiveCubeFace(),LE=this._renderer.getActiveMipmapLevel(),DE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(256);const s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,r,i,s),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=CL(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ML(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?w:0,w,w),A.setRenderTarget(i),m&&A.render(d,a),A.render(e,a)}d.geometry.dispose(),d.material.dispose(),A.toneMapping=f,A.autoClear=u,e.background=g}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===Td||e.mapping===Id;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=CL()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ML());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new hn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;Iv(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,UE)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;const i=this._lodPlanes.length;for(let s=1;sou&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${ou}`);const p=[];let v=0;for(let B=0;Bw-Nh?i-w+Nh:0),b=4*(this._cubeSize-_);Iv(t,x,b,3*_,2*_),l.setRenderTarget(t),l.render(u,UE)}}function dre(n){const e=[],t=[],r=[];let i=n;const s=n-Nh+1+xL.length;for(let o=0;on-Nh?l=xL[o-n+Nh-1]:o===0&&(l=0),r.push(l);const c=1/(a-2),A=-c,u=1+c,f=[A,A,u,A,u,u,A,A,u,u,A,u],h=6,d=6,m=3,g=2,p=1,v=new Float32Array(m*d*h),w=new Float32Array(g*d*h),_=new Float32Array(p*d*h);for(let b=0;b2?0:-1,I=[B,S,0,B+2/3,S,0,B+2/3,S+1,0,B,S,0,B+2/3,S+1,0,B,S+1,0];v.set(I,m*d*b),w.set(f,g*d*b);const M=[b,b,b,b,b,b];_.set(M,p*d*b)}const x=new Zt;x.setAttribute("position",new lt(v,m)),x.setAttribute("uv",new lt(w,g)),x.setAttribute("faceIndex",new lt(_,p)),e.push(x),i>Nh&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function SL(n,e,t){const r=new qa(n,e,t);return r.texture.mapping=s1,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function Iv(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function pre(n,e,t){const r=new Float32Array(ou),i=new $(0,1,0);return new pr({name:"SphericalGaussianBlur",defines:{n:ou,CUBEUV_TEXEL_WIDTH:1/e,CUBEUV_TEXEL_HEIGHT:1/t,CUBEUV_MAX_MIP:`${n}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:NR(),fragmentShader:` precision mediump float; precision mediump int; @@ -3706,7 +3706,7 @@ void main() { } } - `,blending:zl,depthTest:!1,depthWrite:!1})}function BL(){return new dr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:PR(),fragmentShader:` + `,blending:jl,depthTest:!1,depthWrite:!1})}function ML(){return new pr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:NR(),fragmentShader:` precision mediump float; precision mediump int; @@ -3725,7 +3725,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:zl,depthTest:!1,depthWrite:!1})}function SL(){return new dr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:PR(),fragmentShader:` + `,blending:jl,depthTest:!1,depthWrite:!1})}function CL(){return new pr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:NR(),fragmentShader:` precision mediump float; precision mediump int; @@ -3741,7 +3741,7 @@ void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } - `,blending:zl,depthTest:!1,depthWrite:!1})}function PR(){return` + `,blending:jl,depthTest:!1,depthWrite:!1})}function NR(){return` precision mediump float; precision mediump int; @@ -3796,16 +3796,16 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function ure(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,c=l===T_||l===$M,A=l===Md||l===Cd;if(c||A){let u=e.get(a);const f=u!==void 0?u.texture.pmremVersion:0;if(a.isRenderTargetTexture&&a.pmremVersion!==f)return t===null&&(t=new bL(n)),u=c?t.fromEquirectangular(a,u):t.fromCubemap(a,u),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),u.texture;if(u!==void 0)return u.texture;{const h=a.image;return c&&h&&h.height>0||A&&h&&i(h)?(t===null&&(t=new bL(n)),u=c?t.fromEquirectangular(a):t.fromCubemap(a),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),a.addEventListener("dispose",s),u.texture):null}}}return a}function i(a){let l=0;const c=6;for(let A=0;Ae.maxTextureSize&&(x=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);const b=new Float32Array(_*x*4*u),B=new gz(b,_,x,u);B.type=Ts,B.needsUpdate=!0;const M=w*4;for(let S=0;S0)return n;const i=e*t;let s=CL[i];if(s===void 0&&(s=new Float32Array(i),CL[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Dr(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t0||A&&h&&i(h)?(t===null&&(t=new BL(n)),u=c?t.fromEquirectangular(a):t.fromCubemap(a),u.texture.pmremVersion=a.pmremVersion,e.set(a,u),a.addEventListener("dispose",s),u.texture):null}}}return a}function i(a){let l=0;const c=6;for(let A=0;Ae.maxTextureSize&&(x=Math.ceil(_/e.maxTextureSize),_=e.maxTextureSize);const b=new Float32Array(_*x*4*u),B=new yz(b,_,x,u);B.type=xi,B.needsUpdate=!0;const S=w*4;for(let M=0;M0)return n;const i=e*t;let s=IL[i];if(s===void 0&&(s=new Float32Array(i),IL[i]=s),e!==0){r.toArray(s,0);for(let o=1,a=0;o!==e;++o)a+=t,n[o].toArray(s,a)}return s}function Or(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t":" "} ${a}: ${t[o]}`)}return r.join(` -`)}function uie(n){const e=bt.getPrimaries(bt.workingColorSpace),t=bt.getPrimaries(n);let r;switch(e===t?r="":e===F_&&t===U_?r="LinearDisplayP3ToLinearSRGB":e===U_&&t===F_&&(r="LinearSRGBToLinearDisplayP3"),n){case Xr:case s1:return[r,"LinearTransferOETF"];case kt:case TR:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[r,"LinearTransferOETF"]}}function LL(n,e,t){const r=n.getShaderParameter(e,n.COMPILE_STATUS),i=n.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` +`)}function mie(n){const e=bt.getPrimaries(bt.workingColorSpace),t=bt.getPrimaries(n);let r;switch(e===t?r="":e===L_&&t===P_?r="LinearDisplayP3ToLinearSRGB":e===P_&&t===L_&&(r="LinearSRGBToLinearDisplayP3"),n){case Mr:case a1:return[r,"LinearTransferOETF"];case kt:case UR:return[r,"sRGBTransferOETF"];default:return console.warn("THREE.WebGLProgram: Unsupported color space:",n),[r,"LinearTransferOETF"]}}function NL(n,e,t){const r=n.getShaderParameter(e,n.COMPILE_STATUS),i=n.getShaderInfoLog(e).trim();if(r&&i==="")return"";const s=/ERROR: 0:(\d+)/.exec(i);if(s){const o=parseInt(s[1]);return t.toUpperCase()+` `+i+` -`+Aie(n.getShaderSource(e),o)}else return i}function fie(n,e){const t=uie(e);return`vec4 ${n}( vec4 value ) { return ${t[0]}( ${t[1]}( value ) ); }`}function hie(n,e){let t;switch(e){case cJ:t="Linear";break;case AJ:t="Reinhard";break;case uJ:t="Cineon";break;case fJ:t="ACESFilmic";break;case dJ:t="AgX";break;case pJ:t="Neutral";break;case hJ:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}const Cv=new $;function die(){bt.getLuminanceCoefficients(Cv);const n=Cv.x.toFixed(4),e=Cv.y.toFixed(4),t=Cv.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",` const vec3 weights = vec3( ${n}, ${e}, ${t} );`," return dot( weights, rgb );","}"].join(` -`)}function pie(n){return[n.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",n.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(wm).join(` -`)}function mie(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(` -`)}function gie(n,e){const t={},r=n.getProgramParameter(e,n.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function BC(n){return n.replace(vie,wie)}const yie=new Map;function wie(n,e){let t=Bt[e];if(t===void 0){const r=yie.get(e);if(r!==void 0)t=Bt[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return BC(t)}const _ie=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function OL(n){return n.replace(_ie,xie)}function xie(n,e,t,r){let i="";for(let s=parseInt(e);s/gm;function CC(n){return n.replace(bie,Bie)}const Eie=new Map;function Bie(n,e){let t=Bt[e];if(t===void 0){const r=Eie.get(e);if(r!==void 0)t=Bt[r],console.warn('THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.',e,r);else throw new Error("Can not resolve #include <"+e+">")}return CC(t)}const Sie=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function HL(n){return n.replace(Sie,Mie)}function Mie(n,e,t,r){let i="";for(let s=parseInt(e);s0&&(g+=` -`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d].filter(wm).join(` +`),p=["#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d].filter(_m).join(` `),p.length>0&&(p+=` -`)):(g=[kL(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+A:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(wm).join(` -`),p=[kL(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+A:"",t.envMap?"#define "+u:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==cA?"#define TONE_MAPPING":"",t.toneMapping!==cA?Bt.tonemapping_pars_fragment:"",t.toneMapping!==cA?hie("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Bt.colorspace_pars_fragment,fie("linearToOutputTexel",t.outputColorSpace),die(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(wm).join(` -`)),o=BC(o),o=DL(o,t),o=NL(o,t),a=BC(a),a=DL(a,t),a=NL(a,t),o=OL(o),a=OL(a),t.isRawShaderMaterial!==!0&&(v=`#version 300 es +`)):(g=[QL(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",t.batching?"#define USE_BATCHING":"",t.batchingColor?"#define USE_BATCHING_COLOR":"",t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.instancingMorph?"#define USE_INSTANCING_MORPH":"",t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+A:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.displacementMap?"#define USE_DISPLACEMENTMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.mapUv?"#define MAP_UV "+t.mapUv:"",t.alphaMapUv?"#define ALPHAMAP_UV "+t.alphaMapUv:"",t.lightMapUv?"#define LIGHTMAP_UV "+t.lightMapUv:"",t.aoMapUv?"#define AOMAP_UV "+t.aoMapUv:"",t.emissiveMapUv?"#define EMISSIVEMAP_UV "+t.emissiveMapUv:"",t.bumpMapUv?"#define BUMPMAP_UV "+t.bumpMapUv:"",t.normalMapUv?"#define NORMALMAP_UV "+t.normalMapUv:"",t.displacementMapUv?"#define DISPLACEMENTMAP_UV "+t.displacementMapUv:"",t.metalnessMapUv?"#define METALNESSMAP_UV "+t.metalnessMapUv:"",t.roughnessMapUv?"#define ROUGHNESSMAP_UV "+t.roughnessMapUv:"",t.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+t.anisotropyMapUv:"",t.clearcoatMapUv?"#define CLEARCOATMAP_UV "+t.clearcoatMapUv:"",t.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+t.clearcoatNormalMapUv:"",t.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+t.clearcoatRoughnessMapUv:"",t.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+t.iridescenceMapUv:"",t.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+t.iridescenceThicknessMapUv:"",t.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+t.sheenColorMapUv:"",t.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+t.sheenRoughnessMapUv:"",t.specularMapUv?"#define SPECULARMAP_UV "+t.specularMapUv:"",t.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+t.specularColorMapUv:"",t.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+t.specularIntensityMapUv:"",t.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+t.transmissionMapUv:"",t.thicknessMapUv?"#define THICKNESSMAP_UV "+t.thicknessMapUv:"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.flatShading?"#define FLAT_SHADED":"",t.skinning?"#define USE_SKINNING":"",t.morphTargets?"#define USE_MORPHTARGETS":"",t.morphNormals&&t.flatShading===!1?"#define USE_MORPHNORMALS":"",t.morphColors?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+t.morphTargetsCount:"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.sizeAttenuation?"#define USE_SIZEATTENUATION":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING"," attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR"," attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH"," uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1"," attribute vec2 uv1;","#endif","#ifdef USE_UV2"," attribute vec2 uv2;","#endif","#ifdef USE_UV3"," attribute vec2 uv3;","#endif","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` +`].filter(_m).join(` +`),p=[QL(t),"#define SHADER_TYPE "+t.shaderType,"#define SHADER_NAME "+t.shaderName,d,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+c:"",t.envMap?"#define "+A:"",t.envMap?"#define "+u:"",f?"#define CUBEUV_TEXEL_WIDTH "+f.texelWidth:"",f?"#define CUBEUV_TEXEL_HEIGHT "+f.texelHeight:"",f?"#define CUBEUV_MAX_MIP "+f.maxMip+".0":"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",t.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.anisotropy?"#define USE_ANISOTROPY":"",t.anisotropyMap?"#define USE_ANISOTROPYMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.dispersion?"#define USE_DISPERSION":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",t.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.alphaHash?"#define USE_ALPHAHASH":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.vertexTangents&&t.flatShading===!1?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor||t.batchingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUv1s?"#define USE_UV1":"",t.vertexUv2s?"#define USE_UV2":"",t.vertexUv3s?"#define USE_UV3":"",t.pointsUvs?"#define USE_POINTS_UV":"",t.gradientMap?"#define USE_GRADIENTMAP":"",t.flatShading?"#define FLAT_SHADED":"",t.doubleSided?"#define DOUBLE_SIDED":"",t.flipSided?"#define FLIP_SIDED":"",t.shadowMapEnabled?"#define USE_SHADOWMAP":"",t.shadowMapEnabled?"#define "+l:"",t.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",t.numLightProbes>0?"#define USE_LIGHT_PROBES":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.reverseDepthBuffer?"#define USE_REVERSEDEPTHBUF":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==uA?"#define TONE_MAPPING":"",t.toneMapping!==uA?Bt.tonemapping_pars_fragment:"",t.toneMapping!==uA?vie("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",Bt.colorspace_pars_fragment,gie("linearToOutputTexel",t.outputColorSpace),yie(),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(_m).join(` +`)),o=CC(o),o=OL(o,t),o=kL(o,t),a=CC(a),a=OL(a,t),a=kL(a,t),o=HL(o),a=HL(a),t.isRawShaderMaterial!==!0&&(v=`#version 300 es `,g=[h,"#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+g,p=["#define varying in",t.glslVersion===tL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===tL?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`+g,p=["#define varying in",t.glslVersion===rL?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===rL?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` -`+p);const w=v+g+o,_=v+p+a,x=PL(i,i.VERTEX_SHADER,w),b=PL(i,i.FRAGMENT_SHADER,_);i.attachShader(m,x),i.attachShader(m,b),t.index0AttributeName!==void 0?i.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m);function B(L){if(n.debug.checkShaderErrors){const O=i.getProgramInfoLog(m).trim(),T=i.getShaderInfoLog(x).trim(),y=i.getShaderInfoLog(b).trim();let E=!0,U=!0;if(i.getProgramParameter(m,i.LINK_STATUS)===!1)if(E=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,m,x,b);else{const P=LL(i,x,"vertex"),N=LL(i,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,i.VALIDATE_STATUS)+` +`+p);const w=v+g+o,_=v+p+a,x=DL(i,i.VERTEX_SHADER,w),b=DL(i,i.FRAGMENT_SHADER,_);i.attachShader(m,x),i.attachShader(m,b),t.index0AttributeName!==void 0?i.bindAttribLocation(m,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(m,0,"position"),i.linkProgram(m);function B(P){if(n.debug.checkShaderErrors){const D=i.getProgramInfoLog(m).trim(),T=i.getShaderInfoLog(x).trim(),y=i.getShaderInfoLog(b).trim();let E=!0,R=!0;if(i.getProgramParameter(m,i.LINK_STATUS)===!1)if(E=!1,typeof n.debug.onShaderError=="function")n.debug.onShaderError(i,m,x,b);else{const L=NL(i,x,"vertex"),N=NL(i,b,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(m,i.VALIDATE_STATUS)+` -Material Name: `+L.name+` -Material Type: `+L.type+` +Material Name: `+P.name+` +Material Type: `+P.type+` -Program Info Log: `+O+` -`+P+` -`+N)}else O!==""?console.warn("THREE.WebGLProgram: Program Info Log:",O):(T===""||y==="")&&(U=!1);U&&(L.diagnostics={runnable:E,programLog:O,vertexShader:{log:T,prefix:g},fragmentShader:{log:y,prefix:p}})}i.deleteShader(x),i.deleteShader(b),M=new Ew(i,m),I=gie(i,m)}let M;this.getUniforms=function(){return M===void 0&&B(this),M};let I;this.getAttributes=function(){return I===void 0&&B(this),I};let S=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return S===!1&&(S=i.getProgramParameter(m,lie)),S},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=cie++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=b,this}let Tie=0;class Iie{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new Rie(e),t.set(e,r)),r}}class Rie{constructor(e){this.id=Tie++,this.code=e,this.usedTimes=0}}function Uie(n,e,t,r,i,s,o){const a=new UR,l=new Iie,c=new Set,A=[],u=i.logarithmicDepthBuffer,f=i.reverseDepthBuffer,h=i.vertexTextures;let d=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(S){return c.add(S),S===0?"uv":`uv${S}`}function p(S,L,O,T,y){const E=T.fog,U=y.geometry,P=S.isMeshStandardMaterial?T.environment:null,N=(S.isMeshStandardMaterial?t:e).get(S.envMap||P),z=N&&N.mapping===r1?N.image.height:null,W=m[S.type];S.precision!==null&&(d=i.getMaxPrecision(S.precision),d!==S.precision&&console.warn("THREE.WebGLProgram.getParameters:",S.precision,"not supported, using",d,"instead."));const H=U.morphAttributes.position||U.morphAttributes.normal||U.morphAttributes.color,C=H!==void 0?H.length:0;let K=0;U.morphAttributes.position!==void 0&&(K=1),U.morphAttributes.normal!==void 0&&(K=2),U.morphAttributes.color!==void 0&&(K=3);let te,F,re,ce;if(W){const _t=Ma[W];te=_t.vertexShader,F=_t.fragmentShader}else te=S.vertexShader,F=S.fragmentShader,l.update(S),re=l.getVertexShaderID(S),ce=l.getFragmentShaderID(S);const oe=n.getRenderTarget(),ge=y.isInstancedMesh===!0,me=y.isBatchedMesh===!0,ve=!!S.map,be=!!S.matcap,ne=!!N,k=!!S.aoMap,ae=!!S.lightMap,le=!!S.bumpMap,Z=!!S.normalMap,J=!!S.displacementMap,ue=!!S.emissiveMap,Y=!!S.metalnessMap,G=!!S.roughnessMap,j=S.anisotropy>0,se=S.clearcoat>0,fe=S.dispersion>0,he=S.iridescence>0,Be=S.sheen>0,V=S.transmission>0,R=j&&!!S.anisotropyMap,D=se&&!!S.clearcoatMap,X=se&&!!S.clearcoatNormalMap,ie=se&&!!S.clearcoatRoughnessMap,pe=he&&!!S.iridescenceMap,de=he&&!!S.iridescenceThicknessMap,Ie=Be&&!!S.sheenColorMap,Le=Be&&!!S.sheenRoughnessMap,Ue=!!S.specularMap,Ye=!!S.specularColorMap,Ae=!!S.specularIntensityMap,Fe=V&&!!S.transmissionMap,Me=V&&!!S.thicknessMap,Ce=!!S.gradientMap,Re=!!S.alphaMap,Oe=S.alphaTest>0,$e=!!S.alphaHash,dt=!!S.extensions;let Fn=cA;S.toneMapped&&(oe===null||oe.isXRRenderTarget===!0)&&(Fn=n.toneMapping);const nt={shaderID:W,shaderType:S.type,shaderName:S.name,vertexShader:te,fragmentShader:F,defines:S.defines,customVertexShaderID:re,customFragmentShaderID:ce,isRawShaderMaterial:S.isRawShaderMaterial===!0,glslVersion:S.glslVersion,precision:d,batching:me,batchingColor:me&&y._colorsTexture!==null,instancing:ge,instancingColor:ge&&y.instanceColor!==null,instancingMorph:ge&&y.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:oe===null?n.outputColorSpace:oe.isXRRenderTarget===!0?oe.texture.colorSpace:Xr,alphaToCoverage:!!S.alphaToCoverage,map:ve,matcap:be,envMap:ne,envMapMode:ne&&N.mapping,envMapCubeUVHeight:z,aoMap:k,lightMap:ae,bumpMap:le,normalMap:Z,displacementMap:h&&J,emissiveMap:ue,normalMapObjectSpace:Z&&S.normalMapType===EJ,normalMapTangentSpace:Z&&S.normalMapType===Wd,metalnessMap:Y,roughnessMap:G,anisotropy:j,anisotropyMap:R,clearcoat:se,clearcoatMap:D,clearcoatNormalMap:X,clearcoatRoughnessMap:ie,dispersion:fe,iridescence:he,iridescenceMap:pe,iridescenceThicknessMap:de,sheen:Be,sheenColorMap:Ie,sheenRoughnessMap:Le,specularMap:Ue,specularColorMap:Ye,specularIntensityMap:Ae,transmission:V,transmissionMap:Fe,thicknessMap:Me,gradientMap:Ce,opaque:S.transparent===!1&&S.blending===ed&&S.alphaToCoverage===!1,alphaMap:Re,alphaTest:Oe,alphaHash:$e,combine:S.combine,mapUv:ve&&g(S.map.channel),aoMapUv:k&&g(S.aoMap.channel),lightMapUv:ae&&g(S.lightMap.channel),bumpMapUv:le&&g(S.bumpMap.channel),normalMapUv:Z&&g(S.normalMap.channel),displacementMapUv:J&&g(S.displacementMap.channel),emissiveMapUv:ue&&g(S.emissiveMap.channel),metalnessMapUv:Y&&g(S.metalnessMap.channel),roughnessMapUv:G&&g(S.roughnessMap.channel),anisotropyMapUv:R&&g(S.anisotropyMap.channel),clearcoatMapUv:D&&g(S.clearcoatMap.channel),clearcoatNormalMapUv:X&&g(S.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ie&&g(S.clearcoatRoughnessMap.channel),iridescenceMapUv:pe&&g(S.iridescenceMap.channel),iridescenceThicknessMapUv:de&&g(S.iridescenceThicknessMap.channel),sheenColorMapUv:Ie&&g(S.sheenColorMap.channel),sheenRoughnessMapUv:Le&&g(S.sheenRoughnessMap.channel),specularMapUv:Ue&&g(S.specularMap.channel),specularColorMapUv:Ye&&g(S.specularColorMap.channel),specularIntensityMapUv:Ae&&g(S.specularIntensityMap.channel),transmissionMapUv:Fe&&g(S.transmissionMap.channel),thicknessMapUv:Me&&g(S.thicknessMap.channel),alphaMapUv:Re&&g(S.alphaMap.channel),vertexTangents:!!U.attributes.tangent&&(Z||j),vertexColors:S.vertexColors,vertexAlphas:S.vertexColors===!0&&!!U.attributes.color&&U.attributes.color.itemSize===4,pointsUvs:y.isPoints===!0&&!!U.attributes.uv&&(ve||Re),fog:!!E,useFog:S.fog===!0,fogExp2:!!E&&E.isFogExp2,flatShading:S.flatShading===!0,sizeAttenuation:S.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:f,skinning:y.isSkinnedMesh===!0,morphTargets:U.morphAttributes.position!==void 0,morphNormals:U.morphAttributes.normal!==void 0,morphColors:U.morphAttributes.color!==void 0,morphTargetsCount:C,morphTextureStride:K,numDirLights:L.directional.length,numPointLights:L.point.length,numSpotLights:L.spot.length,numSpotLightMaps:L.spotLightMap.length,numRectAreaLights:L.rectArea.length,numHemiLights:L.hemi.length,numDirLightShadows:L.directionalShadowMap.length,numPointLightShadows:L.pointShadowMap.length,numSpotLightShadows:L.spotShadowMap.length,numSpotLightShadowsWithMaps:L.numSpotLightShadowsWithMaps,numLightProbes:L.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:S.dithering,shadowMapEnabled:n.shadowMap.enabled&&O.length>0,shadowMapType:n.shadowMap.type,toneMapping:Fn,decodeVideoTexture:ve&&S.map.isVideoTexture===!0&&bt.getTransfer(S.map.colorSpace)===Sn,premultipliedAlpha:S.premultipliedAlpha,doubleSided:S.side===wi,flipSided:S.side===si,useDepthPacking:S.depthPacking>=0,depthPacking:S.depthPacking||0,index0AttributeName:S.index0AttributeName,extensionClipCullDistance:dt&&S.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(dt&&S.extensions.multiDraw===!0||me)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:S.customProgramCacheKey()};return nt.vertexUv1s=c.has(1),nt.vertexUv2s=c.has(2),nt.vertexUv3s=c.has(3),c.clear(),nt}function v(S){const L=[];if(S.shaderID?L.push(S.shaderID):(L.push(S.customVertexShaderID),L.push(S.customFragmentShaderID)),S.defines!==void 0)for(const O in S.defines)L.push(O),L.push(S.defines[O]);return S.isRawShaderMaterial===!1&&(w(L,S),_(L,S),L.push(n.outputColorSpace)),L.push(S.customProgramCacheKey),L.join()}function w(S,L){S.push(L.precision),S.push(L.outputColorSpace),S.push(L.envMapMode),S.push(L.envMapCubeUVHeight),S.push(L.mapUv),S.push(L.alphaMapUv),S.push(L.lightMapUv),S.push(L.aoMapUv),S.push(L.bumpMapUv),S.push(L.normalMapUv),S.push(L.displacementMapUv),S.push(L.emissiveMapUv),S.push(L.metalnessMapUv),S.push(L.roughnessMapUv),S.push(L.anisotropyMapUv),S.push(L.clearcoatMapUv),S.push(L.clearcoatNormalMapUv),S.push(L.clearcoatRoughnessMapUv),S.push(L.iridescenceMapUv),S.push(L.iridescenceThicknessMapUv),S.push(L.sheenColorMapUv),S.push(L.sheenRoughnessMapUv),S.push(L.specularMapUv),S.push(L.specularColorMapUv),S.push(L.specularIntensityMapUv),S.push(L.transmissionMapUv),S.push(L.thicknessMapUv),S.push(L.combine),S.push(L.fogExp2),S.push(L.sizeAttenuation),S.push(L.morphTargetsCount),S.push(L.morphAttributeCount),S.push(L.numDirLights),S.push(L.numPointLights),S.push(L.numSpotLights),S.push(L.numSpotLightMaps),S.push(L.numHemiLights),S.push(L.numRectAreaLights),S.push(L.numDirLightShadows),S.push(L.numPointLightShadows),S.push(L.numSpotLightShadows),S.push(L.numSpotLightShadowsWithMaps),S.push(L.numLightProbes),S.push(L.shadowMapType),S.push(L.toneMapping),S.push(L.numClippingPlanes),S.push(L.numClipIntersection),S.push(L.depthPacking)}function _(S,L){a.disableAll(),L.supportsVertexTextures&&a.enable(0),L.instancing&&a.enable(1),L.instancingColor&&a.enable(2),L.instancingMorph&&a.enable(3),L.matcap&&a.enable(4),L.envMap&&a.enable(5),L.normalMapObjectSpace&&a.enable(6),L.normalMapTangentSpace&&a.enable(7),L.clearcoat&&a.enable(8),L.iridescence&&a.enable(9),L.alphaTest&&a.enable(10),L.vertexColors&&a.enable(11),L.vertexAlphas&&a.enable(12),L.vertexUv1s&&a.enable(13),L.vertexUv2s&&a.enable(14),L.vertexUv3s&&a.enable(15),L.vertexTangents&&a.enable(16),L.anisotropy&&a.enable(17),L.alphaHash&&a.enable(18),L.batching&&a.enable(19),L.dispersion&&a.enable(20),L.batchingColor&&a.enable(21),S.push(a.mask),a.disableAll(),L.fog&&a.enable(0),L.useFog&&a.enable(1),L.flatShading&&a.enable(2),L.logarithmicDepthBuffer&&a.enable(3),L.reverseDepthBuffer&&a.enable(4),L.skinning&&a.enable(5),L.morphTargets&&a.enable(6),L.morphNormals&&a.enable(7),L.morphColors&&a.enable(8),L.premultipliedAlpha&&a.enable(9),L.shadowMapEnabled&&a.enable(10),L.doubleSided&&a.enable(11),L.flipSided&&a.enable(12),L.useDepthPacking&&a.enable(13),L.dithering&&a.enable(14),L.transmission&&a.enable(15),L.sheen&&a.enable(16),L.opaque&&a.enable(17),L.pointsUvs&&a.enable(18),L.decodeVideoTexture&&a.enable(19),L.alphaToCoverage&&a.enable(20),S.push(a.mask)}function x(S){const L=m[S.type];let O;if(L){const T=Ma[L];O=FR.clone(T.uniforms)}else O=S.uniforms;return O}function b(S,L){let O;for(let T=0,y=A.length;T0?r.push(p):h.transparent===!0?i.push(p):t.push(p)}function l(u,f,h,d,m,g){const p=o(u,f,h,d,m,g);h.transmission>0?r.unshift(p):h.transparent===!0?i.unshift(p):t.unshift(p)}function c(u,f){t.length>1&&t.sort(u||Pie),r.length>1&&r.sort(f||HL),i.length>1&&i.sort(f||HL)}function A(){for(let u=e,f=n.length;u=s.length?(o=new QL,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function Die(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new $,color:new He};break;case"SpotLight":t={position:new $,direction:new $,color:new He,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new $,color:new He,distance:0,decay:0};break;case"HemisphereLight":t={direction:new $,skyColor:new He,groundColor:new He};break;case"RectAreaLight":t={color:new He,position:new $,halfWidth:new $,halfHeight:new $};break}return n[e.id]=t,t}}}function Nie(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Oie=0;function kie(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Hie(n){const e=new Die,t=Nie(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new $);const i=new $,s=new ke,o=new ke;function a(c){let A=0,u=0,f=0;for(let I=0;I<9;I++)r.probe[I].set(0,0,0);let h=0,d=0,m=0,g=0,p=0,v=0,w=0,_=0,x=0,b=0,B=0;c.sort(kie);for(let I=0,S=c.length;I0&&(n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ze.LTC_FLOAT_1,r.rectAreaLTC2=ze.LTC_FLOAT_2):(r.rectAreaLTC1=ze.LTC_HALF_1,r.rectAreaLTC2=ze.LTC_HALF_2)),r.ambient[0]=A,r.ambient[1]=u,r.ambient[2]=f;const M=r.hash;(M.directionalLength!==h||M.pointLength!==d||M.spotLength!==m||M.rectAreaLength!==g||M.hemiLength!==p||M.numDirectionalShadows!==v||M.numPointShadows!==w||M.numSpotShadows!==_||M.numSpotMaps!==x||M.numLightProbes!==B)&&(r.directional.length=h,r.spot.length=m,r.rectArea.length=g,r.point.length=d,r.hemi.length=p,r.directionalShadow.length=v,r.directionalShadowMap.length=v,r.pointShadow.length=w,r.pointShadowMap.length=w,r.spotShadow.length=_,r.spotShadowMap.length=_,r.directionalShadowMatrix.length=v,r.pointShadowMatrix.length=w,r.spotLightMatrix.length=_+x-b,r.spotLightMap.length=x,r.numSpotLightShadowsWithMaps=b,r.numLightProbes=B,M.directionalLength=h,M.pointLength=d,M.spotLength=m,M.rectAreaLength=g,M.hemiLength=p,M.numDirectionalShadows=v,M.numPointShadows=w,M.numSpotShadows=_,M.numSpotMaps=x,M.numLightProbes=B,r.version=Oie++)}function l(c,A){let u=0,f=0,h=0,d=0,m=0;const g=A.matrixWorldInverse;for(let p=0,v=c.length;p=o.length?(a=new zL(n),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:t,dispose:r}}class zie extends ss{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=xJ,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Gie extends ss{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Vie=`void main() { +Program Info Log: `+D+` +`+L+` +`+N)}else D!==""?console.warn("THREE.WebGLProgram: Program Info Log:",D):(T===""||y==="")&&(R=!1);R&&(P.diagnostics={runnable:E,programLog:D,vertexShader:{log:T,prefix:g},fragmentShader:{log:y,prefix:p}})}i.deleteShader(x),i.deleteShader(b),S=new Mw(i,m),I=xie(i,m)}let S;this.getUniforms=function(){return S===void 0&&B(this),S};let I;this.getAttributes=function(){return I===void 0&&B(this),I};let M=t.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return M===!1&&(M=i.getProgramParameter(m,hie)),M},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(m),this.program=void 0},this.type=t.shaderType,this.name=t.shaderName,this.id=die++,this.cacheKey=e,this.usedTimes=1,this.program=m,this.vertexShader=x,this.fragmentShader=b,this}let Pie=0;class Lie{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){const t=e.vertexShader,r=e.fragmentShader,i=this._getShaderStage(t),s=this._getShaderStage(r),o=this._getShaderCacheForMaterial(e);return o.has(i)===!1&&(o.add(i),i.usedTimes++),o.has(s)===!1&&(o.add(s),s.usedTimes++),this}remove(e){const t=this.materialCache.get(e);for(const r of t)r.usedTimes--,r.usedTimes===0&&this.shaderCache.delete(r.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){const t=this.materialCache;let r=t.get(e);return r===void 0&&(r=new Set,t.set(e,r)),r}_getShaderStage(e){const t=this.shaderCache;let r=t.get(e);return r===void 0&&(r=new Die(e),t.set(e,r)),r}}class Die{constructor(e){this.id=Pie++,this.code=e,this.usedTimes=0}}function Nie(n,e,t,r,i,s,o){const a=new LR,l=new Lie,c=new Set,A=[],u=i.logarithmicDepthBuffer,f=i.reverseDepthBuffer,h=i.vertexTextures;let d=i.precision;const m={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function g(M){return c.add(M),M===0?"uv":`uv${M}`}function p(M,P,D,T,y){const E=T.fog,R=y.geometry,L=M.isMeshStandardMaterial?T.environment:null,N=(M.isMeshStandardMaterial?t:e).get(M.envMap||L),z=N&&N.mapping===s1?N.image.height:null,W=m[M.type];M.precision!==null&&(d=i.getMaxPrecision(M.precision),d!==M.precision&&console.warn("THREE.WebGLProgram.getParameters:",M.precision,"not supported, using",d,"instead."));const H=R.morphAttributes.position||R.morphAttributes.normal||R.morphAttributes.color,C=H!==void 0?H.length:0;let K=0;R.morphAttributes.position!==void 0&&(K=1),R.morphAttributes.normal!==void 0&&(K=2),R.morphAttributes.color!==void 0&&(K=3);let ee,F,re,ce;if(W){const _t=Ca[W];ee=_t.vertexShader,F=_t.fragmentShader}else ee=M.vertexShader,F=M.fragmentShader,l.update(M),re=l.getVertexShaderID(M),ce=l.getFragmentShaderID(M);const oe=n.getRenderTarget(),ge=y.isInstancedMesh===!0,me=y.isBatchedMesh===!0,ve=!!M.map,be=!!M.matcap,ne=!!N,k=!!M.aoMap,ae=!!M.lightMap,le=!!M.bumpMap,Z=!!M.normalMap,J=!!M.displacementMap,ue=!!M.emissiveMap,Y=!!M.metalnessMap,G=!!M.roughnessMap,j=M.anisotropy>0,se=M.clearcoat>0,fe=M.dispersion>0,he=M.iridescence>0,Be=M.sheen>0,V=M.transmission>0,U=j&&!!M.anisotropyMap,O=se&&!!M.clearcoatMap,X=se&&!!M.clearcoatNormalMap,ie=se&&!!M.clearcoatRoughnessMap,pe=he&&!!M.iridescenceMap,de=he&&!!M.iridescenceThicknessMap,Ie=Be&&!!M.sheenColorMap,Le=Be&&!!M.sheenRoughnessMap,Ue=!!M.specularMap,Ye=!!M.specularColorMap,Ae=!!M.specularIntensityMap,Fe=V&&!!M.transmissionMap,Me=V&&!!M.thicknessMap,Ce=!!M.gradientMap,Re=!!M.alphaMap,Oe=M.alphaTest>0,$e=!!M.alphaHash,dt=!!M.extensions;let Fn=uA;M.toneMapped&&(oe===null||oe.isXRRenderTarget===!0)&&(Fn=n.toneMapping);const nt={shaderID:W,shaderType:M.type,shaderName:M.name,vertexShader:ee,fragmentShader:F,defines:M.defines,customVertexShaderID:re,customFragmentShaderID:ce,isRawShaderMaterial:M.isRawShaderMaterial===!0,glslVersion:M.glslVersion,precision:d,batching:me,batchingColor:me&&y._colorsTexture!==null,instancing:ge,instancingColor:ge&&y.instanceColor!==null,instancingMorph:ge&&y.morphTexture!==null,supportsVertexTextures:h,outputColorSpace:oe===null?n.outputColorSpace:oe.isXRRenderTarget===!0?oe.texture.colorSpace:Mr,alphaToCoverage:!!M.alphaToCoverage,map:ve,matcap:be,envMap:ne,envMapMode:ne&&N.mapping,envMapCubeUVHeight:z,aoMap:k,lightMap:ae,bumpMap:le,normalMap:Z,displacementMap:h&&J,emissiveMap:ue,normalMapObjectSpace:Z&&M.normalMapType===SJ,normalMapTangentSpace:Z&&M.normalMapType===Kd,metalnessMap:Y,roughnessMap:G,anisotropy:j,anisotropyMap:U,clearcoat:se,clearcoatMap:O,clearcoatNormalMap:X,clearcoatRoughnessMap:ie,dispersion:fe,iridescence:he,iridescenceMap:pe,iridescenceThicknessMap:de,sheen:Be,sheenColorMap:Ie,sheenRoughnessMap:Le,specularMap:Ue,specularColorMap:Ye,specularIntensityMap:Ae,transmission:V,transmissionMap:Fe,thicknessMap:Me,gradientMap:Ce,opaque:M.transparent===!1&&M.blending===rd&&M.alphaToCoverage===!1,alphaMap:Re,alphaTest:Oe,alphaHash:$e,combine:M.combine,mapUv:ve&&g(M.map.channel),aoMapUv:k&&g(M.aoMap.channel),lightMapUv:ae&&g(M.lightMap.channel),bumpMapUv:le&&g(M.bumpMap.channel),normalMapUv:Z&&g(M.normalMap.channel),displacementMapUv:J&&g(M.displacementMap.channel),emissiveMapUv:ue&&g(M.emissiveMap.channel),metalnessMapUv:Y&&g(M.metalnessMap.channel),roughnessMapUv:G&&g(M.roughnessMap.channel),anisotropyMapUv:U&&g(M.anisotropyMap.channel),clearcoatMapUv:O&&g(M.clearcoatMap.channel),clearcoatNormalMapUv:X&&g(M.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:ie&&g(M.clearcoatRoughnessMap.channel),iridescenceMapUv:pe&&g(M.iridescenceMap.channel),iridescenceThicknessMapUv:de&&g(M.iridescenceThicknessMap.channel),sheenColorMapUv:Ie&&g(M.sheenColorMap.channel),sheenRoughnessMapUv:Le&&g(M.sheenRoughnessMap.channel),specularMapUv:Ue&&g(M.specularMap.channel),specularColorMapUv:Ye&&g(M.specularColorMap.channel),specularIntensityMapUv:Ae&&g(M.specularIntensityMap.channel),transmissionMapUv:Fe&&g(M.transmissionMap.channel),thicknessMapUv:Me&&g(M.thicknessMap.channel),alphaMapUv:Re&&g(M.alphaMap.channel),vertexTangents:!!R.attributes.tangent&&(Z||j),vertexColors:M.vertexColors,vertexAlphas:M.vertexColors===!0&&!!R.attributes.color&&R.attributes.color.itemSize===4,pointsUvs:y.isPoints===!0&&!!R.attributes.uv&&(ve||Re),fog:!!E,useFog:M.fog===!0,fogExp2:!!E&&E.isFogExp2,flatShading:M.flatShading===!0,sizeAttenuation:M.sizeAttenuation===!0,logarithmicDepthBuffer:u,reverseDepthBuffer:f,skinning:y.isSkinnedMesh===!0,morphTargets:R.morphAttributes.position!==void 0,morphNormals:R.morphAttributes.normal!==void 0,morphColors:R.morphAttributes.color!==void 0,morphTargetsCount:C,morphTextureStride:K,numDirLights:P.directional.length,numPointLights:P.point.length,numSpotLights:P.spot.length,numSpotLightMaps:P.spotLightMap.length,numRectAreaLights:P.rectArea.length,numHemiLights:P.hemi.length,numDirLightShadows:P.directionalShadowMap.length,numPointLightShadows:P.pointShadowMap.length,numSpotLightShadows:P.spotShadowMap.length,numSpotLightShadowsWithMaps:P.numSpotLightShadowsWithMaps,numLightProbes:P.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:M.dithering,shadowMapEnabled:n.shadowMap.enabled&&D.length>0,shadowMapType:n.shadowMap.type,toneMapping:Fn,decodeVideoTexture:ve&&M.map.isVideoTexture===!0&&bt.getTransfer(M.map.colorSpace)===Sn,premultipliedAlpha:M.premultipliedAlpha,doubleSided:M.side===_i,flipSided:M.side===oi,useDepthPacking:M.depthPacking>=0,depthPacking:M.depthPacking||0,index0AttributeName:M.index0AttributeName,extensionClipCullDistance:dt&&M.extensions.clipCullDistance===!0&&r.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(dt&&M.extensions.multiDraw===!0||me)&&r.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:r.has("KHR_parallel_shader_compile"),customProgramCacheKey:M.customProgramCacheKey()};return nt.vertexUv1s=c.has(1),nt.vertexUv2s=c.has(2),nt.vertexUv3s=c.has(3),c.clear(),nt}function v(M){const P=[];if(M.shaderID?P.push(M.shaderID):(P.push(M.customVertexShaderID),P.push(M.customFragmentShaderID)),M.defines!==void 0)for(const D in M.defines)P.push(D),P.push(M.defines[D]);return M.isRawShaderMaterial===!1&&(w(P,M),_(P,M),P.push(n.outputColorSpace)),P.push(M.customProgramCacheKey),P.join()}function w(M,P){M.push(P.precision),M.push(P.outputColorSpace),M.push(P.envMapMode),M.push(P.envMapCubeUVHeight),M.push(P.mapUv),M.push(P.alphaMapUv),M.push(P.lightMapUv),M.push(P.aoMapUv),M.push(P.bumpMapUv),M.push(P.normalMapUv),M.push(P.displacementMapUv),M.push(P.emissiveMapUv),M.push(P.metalnessMapUv),M.push(P.roughnessMapUv),M.push(P.anisotropyMapUv),M.push(P.clearcoatMapUv),M.push(P.clearcoatNormalMapUv),M.push(P.clearcoatRoughnessMapUv),M.push(P.iridescenceMapUv),M.push(P.iridescenceThicknessMapUv),M.push(P.sheenColorMapUv),M.push(P.sheenRoughnessMapUv),M.push(P.specularMapUv),M.push(P.specularColorMapUv),M.push(P.specularIntensityMapUv),M.push(P.transmissionMapUv),M.push(P.thicknessMapUv),M.push(P.combine),M.push(P.fogExp2),M.push(P.sizeAttenuation),M.push(P.morphTargetsCount),M.push(P.morphAttributeCount),M.push(P.numDirLights),M.push(P.numPointLights),M.push(P.numSpotLights),M.push(P.numSpotLightMaps),M.push(P.numHemiLights),M.push(P.numRectAreaLights),M.push(P.numDirLightShadows),M.push(P.numPointLightShadows),M.push(P.numSpotLightShadows),M.push(P.numSpotLightShadowsWithMaps),M.push(P.numLightProbes),M.push(P.shadowMapType),M.push(P.toneMapping),M.push(P.numClippingPlanes),M.push(P.numClipIntersection),M.push(P.depthPacking)}function _(M,P){a.disableAll(),P.supportsVertexTextures&&a.enable(0),P.instancing&&a.enable(1),P.instancingColor&&a.enable(2),P.instancingMorph&&a.enable(3),P.matcap&&a.enable(4),P.envMap&&a.enable(5),P.normalMapObjectSpace&&a.enable(6),P.normalMapTangentSpace&&a.enable(7),P.clearcoat&&a.enable(8),P.iridescence&&a.enable(9),P.alphaTest&&a.enable(10),P.vertexColors&&a.enable(11),P.vertexAlphas&&a.enable(12),P.vertexUv1s&&a.enable(13),P.vertexUv2s&&a.enable(14),P.vertexUv3s&&a.enable(15),P.vertexTangents&&a.enable(16),P.anisotropy&&a.enable(17),P.alphaHash&&a.enable(18),P.batching&&a.enable(19),P.dispersion&&a.enable(20),P.batchingColor&&a.enable(21),M.push(a.mask),a.disableAll(),P.fog&&a.enable(0),P.useFog&&a.enable(1),P.flatShading&&a.enable(2),P.logarithmicDepthBuffer&&a.enable(3),P.reverseDepthBuffer&&a.enable(4),P.skinning&&a.enable(5),P.morphTargets&&a.enable(6),P.morphNormals&&a.enable(7),P.morphColors&&a.enable(8),P.premultipliedAlpha&&a.enable(9),P.shadowMapEnabled&&a.enable(10),P.doubleSided&&a.enable(11),P.flipSided&&a.enable(12),P.useDepthPacking&&a.enable(13),P.dithering&&a.enable(14),P.transmission&&a.enable(15),P.sheen&&a.enable(16),P.opaque&&a.enable(17),P.pointsUvs&&a.enable(18),P.decodeVideoTexture&&a.enable(19),P.alphaToCoverage&&a.enable(20),M.push(a.mask)}function x(M){const P=m[M.type];let D;if(P){const T=Ca[P];D=DR.clone(T.uniforms)}else D=M.uniforms;return D}function b(M,P){let D;for(let T=0,y=A.length;T0?r.push(p):h.transparent===!0?i.push(p):t.push(p)}function l(u,f,h,d,m,g){const p=o(u,f,h,d,m,g);h.transmission>0?r.unshift(p):h.transparent===!0?i.unshift(p):t.unshift(p)}function c(u,f){t.length>1&&t.sort(u||kie),r.length>1&&r.sort(f||zL),i.length>1&&i.sort(f||zL)}function A(){for(let u=e,f=n.length;u=s.length?(o=new GL,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function Qie(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={direction:new $,color:new He};break;case"SpotLight":t={position:new $,direction:new $,color:new He,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new $,color:new He,distance:0,decay:0};break;case"HemisphereLight":t={direction:new $,skyColor:new He,groundColor:new He};break;case"RectAreaLight":t={color:new He,position:new $,halfWidth:new $,halfHeight:new $};break}return n[e.id]=t,t}}}function zie(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je};break;case"SpotLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je};break;case"PointLight":t={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new je,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Gie=0;function Vie(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function jie(n){const e=new Qie,t=zie(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let c=0;c<9;c++)r.probe.push(new $);const i=new $,s=new ke,o=new ke;function a(c){let A=0,u=0,f=0;for(let I=0;I<9;I++)r.probe[I].set(0,0,0);let h=0,d=0,m=0,g=0,p=0,v=0,w=0,_=0,x=0,b=0,B=0;c.sort(Vie);for(let I=0,M=c.length;I0&&(n.has("OES_texture_float_linear")===!0?(r.rectAreaLTC1=ze.LTC_FLOAT_1,r.rectAreaLTC2=ze.LTC_FLOAT_2):(r.rectAreaLTC1=ze.LTC_HALF_1,r.rectAreaLTC2=ze.LTC_HALF_2)),r.ambient[0]=A,r.ambient[1]=u,r.ambient[2]=f;const S=r.hash;(S.directionalLength!==h||S.pointLength!==d||S.spotLength!==m||S.rectAreaLength!==g||S.hemiLength!==p||S.numDirectionalShadows!==v||S.numPointShadows!==w||S.numSpotShadows!==_||S.numSpotMaps!==x||S.numLightProbes!==B)&&(r.directional.length=h,r.spot.length=m,r.rectArea.length=g,r.point.length=d,r.hemi.length=p,r.directionalShadow.length=v,r.directionalShadowMap.length=v,r.pointShadow.length=w,r.pointShadowMap.length=w,r.spotShadow.length=_,r.spotShadowMap.length=_,r.directionalShadowMatrix.length=v,r.pointShadowMatrix.length=w,r.spotLightMatrix.length=_+x-b,r.spotLightMap.length=x,r.numSpotLightShadowsWithMaps=b,r.numLightProbes=B,S.directionalLength=h,S.pointLength=d,S.spotLength=m,S.rectAreaLength=g,S.hemiLength=p,S.numDirectionalShadows=v,S.numPointShadows=w,S.numSpotShadows=_,S.numSpotMaps=x,S.numLightProbes=B,r.version=Gie++)}function l(c,A){let u=0,f=0,h=0,d=0,m=0;const g=A.matrixWorldInverse;for(let p=0,v=c.length;p=o.length?(a=new VL(n),o.push(a)):a=o[s],a}function r(){e=new WeakMap}return{get:t,dispose:r}}class Kie extends os{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=EJ,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}}class Xie extends os{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const Yie=`void main() { gl_Position = vec4( position, 1.0 ); -}`,jie=`uniform sampler2D shadow_pass; +}`,$ie=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -3874,12 +3874,12 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function Wie(n,e,t){let r=new a1;const i=new je,s=new je,o=new Ut,a=new zie({depthPacking:bJ}),l=new Gie,c={},A=t.maxTextureSize,u={[ks]:si,[si]:ks,[wi]:wi},f=new dr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new je},radius:{value:4}},vertexShader:Vie,fragmentShader:jie}),h=f.clone();h.defines.HORIZONTAL_PASS=1;const d=new Zt;d.setAttribute("position",new lt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new hn(d,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=rz;let p=this.type;this.render=function(b,B,M){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;const I=n.getRenderTarget(),S=n.getActiveCubeFace(),L=n.getActiveMipmapLevel(),O=n.state;O.setBlending(zl),O.buffers.color.setClear(1,1,1,1),O.buffers.depth.setTest(!0),O.setScissorTest(!1);const T=p!==xl&&this.type===xl,y=p===xl&&this.type!==xl;for(let E=0,U=b.length;EA||i.y>A)&&(i.x>A&&(s.x=Math.floor(A/z.x),i.x=s.x*z.x,N.mapSize.x=s.x),i.y>A&&(s.y=Math.floor(A/z.y),i.y=s.y*z.y,N.mapSize.y=s.y)),N.map===null||T===!0||y===!0){const H=this.type!==xl?{minFilter:jr,magFilter:jr}:{};N.map!==null&&N.map.dispose(),N.map=new Za(i.x,i.y,H),N.map.texture.name=P.name+".shadowMap",N.camera.updateProjectionMatrix()}n.setRenderTarget(N.map),n.clear();const W=N.getViewportCount();for(let H=0;H0||B.map&&B.alphaTest>0){const O=S.uuid,T=B.uuid;let y=c[O];y===void 0&&(y={},c[O]=y);let E=y[T];E===void 0&&(E=S.clone(),y[T]=E,B.addEventListener("dispose",x)),S=E}if(S.visible=B.visible,S.wireframe=B.wireframe,I===xl?S.side=B.shadowSide!==null?B.shadowSide:B.side:S.side=B.shadowSide!==null?B.shadowSide:u[B.side],S.alphaMap=B.alphaMap,S.alphaTest=B.alphaTest,S.map=B.map,S.clipShadows=B.clipShadows,S.clippingPlanes=B.clippingPlanes,S.clipIntersection=B.clipIntersection,S.displacementMap=B.displacementMap,S.displacementScale=B.displacementScale,S.displacementBias=B.displacementBias,S.wireframeLinewidth=B.wireframeLinewidth,S.linewidth=B.linewidth,M.isPointLight===!0&&S.isMeshDistanceMaterial===!0){const O=n.properties.get(S);O.light=M}return S}function _(b,B,M,I,S){if(b.visible===!1)return;if(b.layers.test(B.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&S===xl)&&(!b.frustumCulled||r.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(M.matrixWorldInverse,b.matrixWorld);const T=e.update(b),y=b.material;if(Array.isArray(y)){const E=T.groups;for(let U=0,P=E.length;U=1):P.indexOf("OpenGL ES")!==-1&&(U=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),E=U>=2);let N=null,z={};const W=n.getParameter(n.SCISSOR_BOX),H=n.getParameter(n.VIEWPORT),C=new Ut().fromArray(W),K=new Ut().fromArray(H);function te(Ae,Fe,Me,Ce){const Re=new Uint8Array(4),Oe=n.createTexture();n.bindTexture(Ae,Oe),n.texParameteri(Ae,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(Ae,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let $e=0;$e"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new je,A=new WeakMap;let u;const f=new WeakMap;let h=!1;try{h=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function d(Y,G){return h?new OffscreenCanvas(Y,G):kg("canvas")}function m(Y,G,j){let se=1;const fe=ue(Y);if((fe.width>j||fe.height>j)&&(se=j/Math.max(fe.width,fe.height)),se<1)if(typeof HTMLImageElement<"u"&&Y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Y instanceof ImageBitmap||typeof VideoFrame<"u"&&Y instanceof VideoFrame){const he=Math.floor(se*fe.width),Be=Math.floor(se*fe.height);u===void 0&&(u=d(he,Be));const V=G?d(he,Be):u;return V.width=he,V.height=Be,V.getContext("2d").drawImage(Y,0,0,he,Be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+fe.width+"x"+fe.height+") to ("+he+"x"+Be+")."),V}else return"data"in Y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+fe.width+"x"+fe.height+")."),Y;return Y}function g(Y){return Y.generateMipmaps&&Y.minFilter!==jr&&Y.minFilter!==Xi}function p(Y){n.generateMipmap(Y)}function v(Y,G,j,se,fe=!1){if(Y!==null){if(n[Y]!==void 0)return n[Y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Y+"'")}let he=G;if(G===n.RED&&(j===n.FLOAT&&(he=n.R32F),j===n.HALF_FLOAT&&(he=n.R16F),j===n.UNSIGNED_BYTE&&(he=n.R8)),G===n.RED_INTEGER&&(j===n.UNSIGNED_BYTE&&(he=n.R8UI),j===n.UNSIGNED_SHORT&&(he=n.R16UI),j===n.UNSIGNED_INT&&(he=n.R32UI),j===n.BYTE&&(he=n.R8I),j===n.SHORT&&(he=n.R16I),j===n.INT&&(he=n.R32I)),G===n.RG&&(j===n.FLOAT&&(he=n.RG32F),j===n.HALF_FLOAT&&(he=n.RG16F),j===n.UNSIGNED_BYTE&&(he=n.RG8)),G===n.RG_INTEGER&&(j===n.UNSIGNED_BYTE&&(he=n.RG8UI),j===n.UNSIGNED_SHORT&&(he=n.RG16UI),j===n.UNSIGNED_INT&&(he=n.RG32UI),j===n.BYTE&&(he=n.RG8I),j===n.SHORT&&(he=n.RG16I),j===n.INT&&(he=n.RG32I)),G===n.RGB_INTEGER&&(j===n.UNSIGNED_BYTE&&(he=n.RGB8UI),j===n.UNSIGNED_SHORT&&(he=n.RGB16UI),j===n.UNSIGNED_INT&&(he=n.RGB32UI),j===n.BYTE&&(he=n.RGB8I),j===n.SHORT&&(he=n.RGB16I),j===n.INT&&(he=n.RGB32I)),G===n.RGBA_INTEGER&&(j===n.UNSIGNED_BYTE&&(he=n.RGBA8UI),j===n.UNSIGNED_SHORT&&(he=n.RGBA16UI),j===n.UNSIGNED_INT&&(he=n.RGBA32UI),j===n.BYTE&&(he=n.RGBA8I),j===n.SHORT&&(he=n.RGBA16I),j===n.INT&&(he=n.RGBA32I)),G===n.RGB&&j===n.UNSIGNED_INT_5_9_9_9_REV&&(he=n.RGB9_E5),G===n.RGBA){const Be=fe?R_:bt.getTransfer(se);j===n.FLOAT&&(he=n.RGBA32F),j===n.HALF_FLOAT&&(he=n.RGBA16F),j===n.UNSIGNED_BYTE&&(he=Be===Sn?n.SRGB8_ALPHA8:n.RGBA8),j===n.UNSIGNED_SHORT_4_4_4_4&&(he=n.RGBA4),j===n.UNSIGNED_SHORT_5_5_5_1&&(he=n.RGB5_A1)}return(he===n.R16F||he===n.R32F||he===n.RG16F||he===n.RG32F||he===n.RGBA16F||he===n.RGBA32F)&&e.get("EXT_color_buffer_float"),he}function w(Y,G){let j;return Y?G===null||G===gA||G===Td?j=n.DEPTH24_STENCIL8:G===Ts?j=n.DEPTH32F_STENCIL8:G===Og&&(j=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):G===null||G===gA||G===Td?j=n.DEPTH_COMPONENT24:G===Ts?j=n.DEPTH_COMPONENT32F:G===Og&&(j=n.DEPTH_COMPONENT16),j}function _(Y,G){return g(Y)===!0||Y.isFramebufferTexture&&Y.minFilter!==jr&&Y.minFilter!==Xi?Math.log2(Math.max(G.width,G.height))+1:Y.mipmaps!==void 0&&Y.mipmaps.length>0?Y.mipmaps.length:Y.isCompressedTexture&&Array.isArray(Y.image)?G.mipmaps.length:1}function x(Y){const G=Y.target;G.removeEventListener("dispose",x),B(G),G.isVideoTexture&&A.delete(G)}function b(Y){const G=Y.target;G.removeEventListener("dispose",b),I(G)}function B(Y){const G=r.get(Y);if(G.__webglInit===void 0)return;const j=Y.source,se=f.get(j);if(se){const fe=se[G.__cacheKey];fe.usedTimes--,fe.usedTimes===0&&M(Y),Object.keys(se).length===0&&f.delete(j)}r.remove(Y)}function M(Y){const G=r.get(Y);n.deleteTexture(G.__webglTexture);const j=Y.source,se=f.get(j);delete se[G.__cacheKey],o.memory.textures--}function I(Y){const G=r.get(Y);if(Y.depthTexture&&Y.depthTexture.dispose(),Y.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(G.__webglFramebuffer[se]))for(let fe=0;fe=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Y+" texture units while this GPU supports only "+i.maxTextures),S+=1,Y}function T(Y){const G=[];return G.push(Y.wrapS),G.push(Y.wrapT),G.push(Y.wrapR||0),G.push(Y.magFilter),G.push(Y.minFilter),G.push(Y.anisotropy),G.push(Y.internalFormat),G.push(Y.format),G.push(Y.type),G.push(Y.generateMipmaps),G.push(Y.premultiplyAlpha),G.push(Y.flipY),G.push(Y.unpackAlignment),G.push(Y.colorSpace),G.join()}function y(Y,G){const j=r.get(Y);if(Y.isVideoTexture&&Z(Y),Y.isRenderTargetTexture===!1&&Y.version>0&&j.__version!==Y.version){const se=Y.image;if(se===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{K(j,Y,G);return}}t.bindTexture(n.TEXTURE_2D,j.__webglTexture,n.TEXTURE0+G)}function E(Y,G){const j=r.get(Y);if(Y.version>0&&j.__version!==Y.version){K(j,Y,G);return}t.bindTexture(n.TEXTURE_2D_ARRAY,j.__webglTexture,n.TEXTURE0+G)}function U(Y,G){const j=r.get(Y);if(Y.version>0&&j.__version!==Y.version){K(j,Y,G);return}t.bindTexture(n.TEXTURE_3D,j.__webglTexture,n.TEXTURE0+G)}function P(Y,G){const j=r.get(Y);if(Y.version>0&&j.__version!==Y.version){te(j,Y,G);return}t.bindTexture(n.TEXTURE_CUBE_MAP,j.__webglTexture,n.TEXTURE0+G)}const N={[Hs]:n.REPEAT,[Zo]:n.CLAMP_TO_EDGE,[Ng]:n.MIRRORED_REPEAT},z={[jr]:n.NEAREST,[_R]:n.NEAREST_MIPMAP_NEAREST,[Rh]:n.NEAREST_MIPMAP_LINEAR,[Xi]:n.LINEAR,[Zm]:n.LINEAR_MIPMAP_NEAREST,[Da]:n.LINEAR_MIPMAP_LINEAR},W={[BJ]:n.NEVER,[RJ]:n.ALWAYS,[SJ]:n.LESS,[pz]:n.LEQUAL,[MJ]:n.EQUAL,[IJ]:n.GEQUAL,[CJ]:n.GREATER,[TJ]:n.NOTEQUAL};function H(Y,G){if(G.type===Ts&&e.has("OES_texture_float_linear")===!1&&(G.magFilter===Xi||G.magFilter===Zm||G.magFilter===Rh||G.magFilter===Da||G.minFilter===Xi||G.minFilter===Zm||G.minFilter===Rh||G.minFilter===Da)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(Y,n.TEXTURE_WRAP_S,N[G.wrapS]),n.texParameteri(Y,n.TEXTURE_WRAP_T,N[G.wrapT]),(Y===n.TEXTURE_3D||Y===n.TEXTURE_2D_ARRAY)&&n.texParameteri(Y,n.TEXTURE_WRAP_R,N[G.wrapR]),n.texParameteri(Y,n.TEXTURE_MAG_FILTER,z[G.magFilter]),n.texParameteri(Y,n.TEXTURE_MIN_FILTER,z[G.minFilter]),G.compareFunction&&(n.texParameteri(Y,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(Y,n.TEXTURE_COMPARE_FUNC,W[G.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(G.magFilter===jr||G.minFilter!==Rh&&G.minFilter!==Da||G.type===Ts&&e.has("OES_texture_float_linear")===!1)return;if(G.anisotropy>1||r.get(G).__currentAnisotropy){const j=e.get("EXT_texture_filter_anisotropic");n.texParameterf(Y,j.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(G.anisotropy,i.getMaxAnisotropy())),r.get(G).__currentAnisotropy=G.anisotropy}}}function C(Y,G){let j=!1;Y.__webglInit===void 0&&(Y.__webglInit=!0,G.addEventListener("dispose",x));const se=G.source;let fe=f.get(se);fe===void 0&&(fe={},f.set(se,fe));const he=T(G);if(he!==Y.__cacheKey){fe[he]===void 0&&(fe[he]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,j=!0),fe[he].usedTimes++;const Be=fe[Y.__cacheKey];Be!==void 0&&(fe[Y.__cacheKey].usedTimes--,Be.usedTimes===0&&M(G)),Y.__cacheKey=he,Y.__webglTexture=fe[he].texture}return j}function K(Y,G,j){let se=n.TEXTURE_2D;(G.isDataArrayTexture||G.isCompressedArrayTexture)&&(se=n.TEXTURE_2D_ARRAY),G.isData3DTexture&&(se=n.TEXTURE_3D);const fe=C(Y,G),he=G.source;t.bindTexture(se,Y.__webglTexture,n.TEXTURE0+j);const Be=r.get(he);if(he.version!==Be.__version||fe===!0){t.activeTexture(n.TEXTURE0+j);const V=bt.getPrimaries(bt.workingColorSpace),R=G.colorSpace===Ia?null:bt.getPrimaries(G.colorSpace),D=G.colorSpace===Ia||V===R?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,G.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,G.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,D);let X=m(G.image,!1,i.maxTextureSize);X=J(G,X);const ie=s.convert(G.format,G.colorSpace),pe=s.convert(G.type);let de=v(G.internalFormat,ie,pe,G.colorSpace,G.isVideoTexture);H(se,G);let Ie;const Le=G.mipmaps,Ue=G.isVideoTexture!==!0,Ye=Be.__version===void 0||fe===!0,Ae=he.dataReady,Fe=_(G,X);if(G.isDepthTexture)de=w(G.format===Id,G.type),Ye&&(Ue?t.texStorage2D(n.TEXTURE_2D,1,de,X.width,X.height):t.texImage2D(n.TEXTURE_2D,0,de,X.width,X.height,0,ie,pe,null));else if(G.isDataTexture)if(Le.length>0){Ue&&Ye&&t.texStorage2D(n.TEXTURE_2D,Fe,de,Le[0].width,Le[0].height);for(let Me=0,Ce=Le.length;Me0){const Re=GL(Ie.width,Ie.height,G.format,G.type);for(const Oe of G.layerUpdates){const $e=Ie.data.subarray(Oe*Re/Ie.data.BYTES_PER_ELEMENT,(Oe+1)*Re/Ie.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Me,0,0,Oe,Ie.width,Ie.height,1,ie,$e,0,0)}G.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Me,0,0,0,Ie.width,Ie.height,X.depth,ie,Ie.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Me,de,Ie.width,Ie.height,X.depth,0,Ie.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ue?Ae&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Me,0,0,0,Ie.width,Ie.height,X.depth,ie,pe,Ie.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Me,de,Ie.width,Ie.height,X.depth,0,ie,pe,Ie.data)}else{Ue&&Ye&&t.texStorage2D(n.TEXTURE_2D,Fe,de,Le[0].width,Le[0].height);for(let Me=0,Ce=Le.length;Me0){const Me=GL(X.width,X.height,G.format,G.type);for(const Ce of G.layerUpdates){const Re=X.data.subarray(Ce*Me/X.data.BYTES_PER_ELEMENT,(Ce+1)*Me/X.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Ce,X.width,X.height,1,ie,pe,Re)}G.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,X.width,X.height,X.depth,ie,pe,X.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,de,X.width,X.height,X.depth,0,ie,pe,X.data);else if(G.isData3DTexture)Ue?(Ye&&t.texStorage3D(n.TEXTURE_3D,Fe,de,X.width,X.height,X.depth),Ae&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,X.width,X.height,X.depth,ie,pe,X.data)):t.texImage3D(n.TEXTURE_3D,0,de,X.width,X.height,X.depth,0,ie,pe,X.data);else if(G.isFramebufferTexture){if(Ye)if(Ue)t.texStorage2D(n.TEXTURE_2D,Fe,de,X.width,X.height);else{let Me=X.width,Ce=X.height;for(let Re=0;Re>=1,Ce>>=1}}else if(Le.length>0){if(Ue&&Ye){const Me=ue(Le[0]);t.texStorage2D(n.TEXTURE_2D,Fe,de,Me.width,Me.height)}for(let Me=0,Ce=Le.length;Me0&&Fe++;const Ce=ue(ie[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Fe,Le,Ce.width,Ce.height)}for(let Ce=0;Ce<6;Ce++)if(X){Ue?Ae&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,0,0,ie[Ce].width,ie[Ce].height,de,Ie,ie[Ce].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,Le,ie[Ce].width,ie[Ce].height,0,de,Ie,ie[Ce].data);for(let Re=0;Re>he),ie=Math.max(1,G.height>>he);fe===n.TEXTURE_3D||fe===n.TEXTURE_2D_ARRAY?t.texImage3D(fe,he,R,X,ie,G.depth,0,Be,V,null):t.texImage2D(fe,he,R,X,ie,0,Be,V,null)}t.bindFramebuffer(n.FRAMEBUFFER,Y),le(G)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,se,fe,r.get(j).__webglTexture,0,ae(G)):(fe===n.TEXTURE_2D||fe>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&fe<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,se,fe,r.get(j).__webglTexture,he),t.bindFramebuffer(n.FRAMEBUFFER,null)}function re(Y,G,j){if(n.bindRenderbuffer(n.RENDERBUFFER,Y),G.depthBuffer){const se=G.depthTexture,fe=se&&se.isDepthTexture?se.type:null,he=w(G.stencilBuffer,fe),Be=G.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,V=ae(G);le(G)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,V,he,G.width,G.height):j?n.renderbufferStorageMultisample(n.RENDERBUFFER,V,he,G.width,G.height):n.renderbufferStorage(n.RENDERBUFFER,he,G.width,G.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Be,n.RENDERBUFFER,Y)}else{const se=G.textures;for(let fe=0;fe{delete G.__boundDepthTexture,delete G.__depthDisposeCallback,se.removeEventListener("dispose",fe)};se.addEventListener("dispose",fe),G.__depthDisposeCallback=fe}G.__boundDepthTexture=se}if(Y.depthTexture&&!G.__autoAllocateDepthBuffer){if(j)throw new Error("target.depthTexture not supported in Cube render targets");ce(G.__webglFramebuffer,Y)}else if(j){G.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(n.FRAMEBUFFER,G.__webglFramebuffer[se]),G.__webglDepthbuffer[se]===void 0)G.__webglDepthbuffer[se]=n.createRenderbuffer(),re(G.__webglDepthbuffer[se],Y,!1);else{const fe=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,he=G.__webglDepthbuffer[se];n.bindRenderbuffer(n.RENDERBUFFER,he),n.framebufferRenderbuffer(n.FRAMEBUFFER,fe,n.RENDERBUFFER,he)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,G.__webglFramebuffer),G.__webglDepthbuffer===void 0)G.__webglDepthbuffer=n.createRenderbuffer(),re(G.__webglDepthbuffer,Y,!1);else{const se=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,fe=G.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,fe),n.framebufferRenderbuffer(n.FRAMEBUFFER,se,n.RENDERBUFFER,fe)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ge(Y,G,j){const se=r.get(Y);G!==void 0&&F(se.__webglFramebuffer,Y,Y.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),j!==void 0&&oe(Y)}function me(Y){const G=Y.texture,j=r.get(Y),se=r.get(G);Y.addEventListener("dispose",b);const fe=Y.textures,he=Y.isWebGLCubeRenderTarget===!0,Be=fe.length>1;if(Be||(se.__webglTexture===void 0&&(se.__webglTexture=n.createTexture()),se.__version=G.version,o.memory.textures++),he){j.__webglFramebuffer=[];for(let V=0;V<6;V++)if(G.mipmaps&&G.mipmaps.length>0){j.__webglFramebuffer[V]=[];for(let R=0;R0){j.__webglFramebuffer=[];for(let V=0;V0&&le(Y)===!1){j.__webglMultisampledFramebuffer=n.createFramebuffer(),j.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,j.__webglMultisampledFramebuffer);for(let V=0;V0)for(let R=0;R0)for(let R=0;R0){if(le(Y)===!1){const G=Y.textures,j=Y.width,se=Y.height;let fe=n.COLOR_BUFFER_BIT;const he=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Be=r.get(Y),V=G.length>1;if(V)for(let R=0;R0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&G.__useRenderToTexture!==!1}function Z(Y){const G=o.render.frame;A.get(Y)!==G&&(A.set(Y,G),Y.update())}function J(Y,G){const j=Y.colorSpace,se=Y.format,fe=Y.type;return Y.isCompressedTexture===!0||Y.isVideoTexture===!0||j!==Xr&&j!==Ia&&(bt.getTransfer(j)===Sn?(se!==Lr||fe!==ec)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",j)),G}function ue(Y){return typeof HTMLImageElement<"u"&&Y instanceof HTMLImageElement?(c.width=Y.naturalWidth||Y.width,c.height=Y.naturalHeight||Y.height):typeof VideoFrame<"u"&&Y instanceof VideoFrame?(c.width=Y.displayWidth,c.height=Y.displayHeight):(c.width=Y.width,c.height=Y.height),c}this.allocateTextureUnit=O,this.resetTextureUnits=L,this.setTexture2D=y,this.setTexture2DArray=E,this.setTexture3D=U,this.setTextureCube=P,this.rebindTextures=ge,this.setupRenderTarget=me,this.updateRenderTargetMipmap=ve,this.updateMultisampleRenderTarget=k,this.setupDepthRenderbuffer=oe,this.setupFrameBufferTexture=F,this.useMultisampledRTT=le}function Zie(n,e){function t(r,i=Ia){let s;const o=bt.getTransfer(i);if(r===ec)return n.UNSIGNED_BYTE;if(r===bR)return n.UNSIGNED_SHORT_4_4_4_4;if(r===ER)return n.UNSIGNED_SHORT_5_5_5_1;if(r===az)return n.UNSIGNED_INT_5_9_9_9_REV;if(r===sz)return n.BYTE;if(r===oz)return n.SHORT;if(r===Og)return n.UNSIGNED_SHORT;if(r===xR)return n.INT;if(r===gA)return n.UNSIGNED_INT;if(r===Ts)return n.FLOAT;if(r===jd)return n.HALF_FLOAT;if(r===lz)return n.ALPHA;if(r===cz)return n.RGB;if(r===Lr)return n.RGBA;if(r===Az)return n.LUMINANCE;if(r===uz)return n.LUMINANCE_ALPHA;if(r===td)return n.DEPTH_COMPONENT;if(r===Id)return n.DEPTH_STENCIL;if(r===BR)return n.RED;if(r===i1)return n.RED_INTEGER;if(r===fz)return n.RG;if(r===SR)return n.RG_INTEGER;if(r===MR)return n.RGBA_INTEGER;if(r===vw||r===yw||r===ww||r===_w)if(o===Sn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===vw)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===yw)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===ww)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===_w)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===vw)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===yw)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===ww)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===_w)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===ZM||r===qM||r===JM||r===eC)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===ZM)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===qM)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===JM)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===eC)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===tC||r===nC||r===rC)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===tC||r===nC)return o===Sn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===rC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===iC||r===sC||r===oC||r===aC||r===lC||r===cC||r===AC||r===uC||r===fC||r===hC||r===dC||r===pC||r===mC||r===gC)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===iC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===sC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===oC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===aC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===lC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===cC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===AC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===uC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===fC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===hC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===dC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===pC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===mC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===gC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===xw||r===vC||r===yC)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===xw)return o===Sn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===vC)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===yC)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===hz||r===wC||r===_C||r===xC)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===xw)return s.COMPRESSED_RED_RGTC1_EXT;if(r===wC)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===_C)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===xC)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Td?n.UNSIGNED_INT_24_8:n[r]!==void 0?n[r]:null}return{convert:t}}class qie extends Ur{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class ni extends Ft{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Jie={type:"move"};class LE{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ni,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ni,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new $,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new $),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ni,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new $,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new $),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const m of e.hand.values()){const g=t.getJointPose(m,r),p=this._getHandJoint(c,m);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const A=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=A.position.distanceTo(u.position),h=.02,d=.005;c.inputState.pinching&&f>h+d?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=h-d&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(Jie)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new ni;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}const ese=` +}`;function Zie(n,e,t){let r=new c1;const i=new je,s=new je,o=new Ut,a=new Kie({depthPacking:BJ}),l=new Xie,c={},A=t.maxTextureSize,u={[Hs]:oi,[oi]:Hs,[_i]:_i},f=new pr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new je},radius:{value:4}},vertexShader:Yie,fragmentShader:$ie}),h=f.clone();h.defines.HORIZONTAL_PASS=1;const d=new Zt;d.setAttribute("position",new lt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const m=new hn(d,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=sz;let p=this.type;this.render=function(b,B,S){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||b.length===0)return;const I=n.getRenderTarget(),M=n.getActiveCubeFace(),P=n.getActiveMipmapLevel(),D=n.state;D.setBlending(jl),D.buffers.color.setClear(1,1,1,1),D.buffers.depth.setTest(!0),D.setScissorTest(!1);const T=p!==El&&this.type===El,y=p===El&&this.type!==El;for(let E=0,R=b.length;EA||i.y>A)&&(i.x>A&&(s.x=Math.floor(A/z.x),i.x=s.x*z.x,N.mapSize.x=s.x),i.y>A&&(s.y=Math.floor(A/z.y),i.y=s.y*z.y,N.mapSize.y=s.y)),N.map===null||T===!0||y===!0){const H=this.type!==El?{minFilter:Kr,magFilter:Kr}:{};N.map!==null&&N.map.dispose(),N.map=new qa(i.x,i.y,H),N.map.texture.name=L.name+".shadowMap",N.camera.updateProjectionMatrix()}n.setRenderTarget(N.map),n.clear();const W=N.getViewportCount();for(let H=0;H0||B.map&&B.alphaTest>0){const D=M.uuid,T=B.uuid;let y=c[D];y===void 0&&(y={},c[D]=y);let E=y[T];E===void 0&&(E=M.clone(),y[T]=E,B.addEventListener("dispose",x)),M=E}if(M.visible=B.visible,M.wireframe=B.wireframe,I===El?M.side=B.shadowSide!==null?B.shadowSide:B.side:M.side=B.shadowSide!==null?B.shadowSide:u[B.side],M.alphaMap=B.alphaMap,M.alphaTest=B.alphaTest,M.map=B.map,M.clipShadows=B.clipShadows,M.clippingPlanes=B.clippingPlanes,M.clipIntersection=B.clipIntersection,M.displacementMap=B.displacementMap,M.displacementScale=B.displacementScale,M.displacementBias=B.displacementBias,M.wireframeLinewidth=B.wireframeLinewidth,M.linewidth=B.linewidth,S.isPointLight===!0&&M.isMeshDistanceMaterial===!0){const D=n.properties.get(M);D.light=S}return M}function _(b,B,S,I,M){if(b.visible===!1)return;if(b.layers.test(B.layers)&&(b.isMesh||b.isLine||b.isPoints)&&(b.castShadow||b.receiveShadow&&M===El)&&(!b.frustumCulled||r.intersectsObject(b))){b.modelViewMatrix.multiplyMatrices(S.matrixWorldInverse,b.matrixWorld);const T=e.update(b),y=b.material;if(Array.isArray(y)){const E=T.groups;for(let R=0,L=E.length;R=1):L.indexOf("OpenGL ES")!==-1&&(R=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),E=R>=2);let N=null,z={};const W=n.getParameter(n.SCISSOR_BOX),H=n.getParameter(n.VIEWPORT),C=new Ut().fromArray(W),K=new Ut().fromArray(H);function ee(Ae,Fe,Me,Ce){const Re=new Uint8Array(4),Oe=n.createTexture();n.bindTexture(Ae,Oe),n.texParameteri(Ae,n.TEXTURE_MIN_FILTER,n.NEAREST),n.texParameteri(Ae,n.TEXTURE_MAG_FILTER,n.NEAREST);for(let $e=0;$e"u"?!1:/OculusBrowser/g.test(navigator.userAgent),c=new je,A=new WeakMap;let u;const f=new WeakMap;let h=!1;try{h=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function d(Y,G){return h?new OffscreenCanvas(Y,G):Qg("canvas")}function m(Y,G,j){let se=1;const fe=ue(Y);if((fe.width>j||fe.height>j)&&(se=j/Math.max(fe.width,fe.height)),se<1)if(typeof HTMLImageElement<"u"&&Y instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Y instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Y instanceof ImageBitmap||typeof VideoFrame<"u"&&Y instanceof VideoFrame){const he=Math.floor(se*fe.width),Be=Math.floor(se*fe.height);u===void 0&&(u=d(he,Be));const V=G?d(he,Be):u;return V.width=he,V.height=Be,V.getContext("2d").drawImage(Y,0,0,he,Be),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+fe.width+"x"+fe.height+") to ("+he+"x"+Be+")."),V}else return"data"in Y&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+fe.width+"x"+fe.height+")."),Y;return Y}function g(Y){return Y.generateMipmaps&&Y.minFilter!==Kr&&Y.minFilter!==Lr}function p(Y){n.generateMipmap(Y)}function v(Y,G,j,se,fe=!1){if(Y!==null){if(n[Y]!==void 0)return n[Y];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Y+"'")}let he=G;if(G===n.RED&&(j===n.FLOAT&&(he=n.R32F),j===n.HALF_FLOAT&&(he=n.R16F),j===n.UNSIGNED_BYTE&&(he=n.R8)),G===n.RED_INTEGER&&(j===n.UNSIGNED_BYTE&&(he=n.R8UI),j===n.UNSIGNED_SHORT&&(he=n.R16UI),j===n.UNSIGNED_INT&&(he=n.R32UI),j===n.BYTE&&(he=n.R8I),j===n.SHORT&&(he=n.R16I),j===n.INT&&(he=n.R32I)),G===n.RG&&(j===n.FLOAT&&(he=n.RG32F),j===n.HALF_FLOAT&&(he=n.RG16F),j===n.UNSIGNED_BYTE&&(he=n.RG8)),G===n.RG_INTEGER&&(j===n.UNSIGNED_BYTE&&(he=n.RG8UI),j===n.UNSIGNED_SHORT&&(he=n.RG16UI),j===n.UNSIGNED_INT&&(he=n.RG32UI),j===n.BYTE&&(he=n.RG8I),j===n.SHORT&&(he=n.RG16I),j===n.INT&&(he=n.RG32I)),G===n.RGB_INTEGER&&(j===n.UNSIGNED_BYTE&&(he=n.RGB8UI),j===n.UNSIGNED_SHORT&&(he=n.RGB16UI),j===n.UNSIGNED_INT&&(he=n.RGB32UI),j===n.BYTE&&(he=n.RGB8I),j===n.SHORT&&(he=n.RGB16I),j===n.INT&&(he=n.RGB32I)),G===n.RGBA_INTEGER&&(j===n.UNSIGNED_BYTE&&(he=n.RGBA8UI),j===n.UNSIGNED_SHORT&&(he=n.RGBA16UI),j===n.UNSIGNED_INT&&(he=n.RGBA32UI),j===n.BYTE&&(he=n.RGBA8I),j===n.SHORT&&(he=n.RGBA16I),j===n.INT&&(he=n.RGBA32I)),G===n.RGB&&j===n.UNSIGNED_INT_5_9_9_9_REV&&(he=n.RGB9_E5),G===n.RGBA){const Be=fe?F_:bt.getTransfer(se);j===n.FLOAT&&(he=n.RGBA32F),j===n.HALF_FLOAT&&(he=n.RGBA16F),j===n.UNSIGNED_BYTE&&(he=Be===Sn?n.SRGB8_ALPHA8:n.RGBA8),j===n.UNSIGNED_SHORT_4_4_4_4&&(he=n.RGBA4),j===n.UNSIGNED_SHORT_5_5_5_1&&(he=n.RGB5_A1)}return(he===n.R16F||he===n.R32F||he===n.RG16F||he===n.RG32F||he===n.RGBA16F||he===n.RGBA32F)&&e.get("EXT_color_buffer_float"),he}function w(Y,G){let j;return Y?G===null||G===yA||G===Rd?j=n.DEPTH24_STENCIL8:G===xi?j=n.DEPTH32F_STENCIL8:G===Hg&&(j=n.DEPTH24_STENCIL8,console.warn("DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.")):G===null||G===yA||G===Rd?j=n.DEPTH_COMPONENT24:G===xi?j=n.DEPTH_COMPONENT32F:G===Hg&&(j=n.DEPTH_COMPONENT16),j}function _(Y,G){return g(Y)===!0||Y.isFramebufferTexture&&Y.minFilter!==Kr&&Y.minFilter!==Lr?Math.log2(Math.max(G.width,G.height))+1:Y.mipmaps!==void 0&&Y.mipmaps.length>0?Y.mipmaps.length:Y.isCompressedTexture&&Array.isArray(Y.image)?G.mipmaps.length:1}function x(Y){const G=Y.target;G.removeEventListener("dispose",x),B(G),G.isVideoTexture&&A.delete(G)}function b(Y){const G=Y.target;G.removeEventListener("dispose",b),I(G)}function B(Y){const G=r.get(Y);if(G.__webglInit===void 0)return;const j=Y.source,se=f.get(j);if(se){const fe=se[G.__cacheKey];fe.usedTimes--,fe.usedTimes===0&&S(Y),Object.keys(se).length===0&&f.delete(j)}r.remove(Y)}function S(Y){const G=r.get(Y);n.deleteTexture(G.__webglTexture);const j=Y.source,se=f.get(j);delete se[G.__cacheKey],o.memory.textures--}function I(Y){const G=r.get(Y);if(Y.depthTexture&&Y.depthTexture.dispose(),Y.isWebGLCubeRenderTarget)for(let se=0;se<6;se++){if(Array.isArray(G.__webglFramebuffer[se]))for(let fe=0;fe=i.maxTextures&&console.warn("THREE.WebGLTextures: Trying to use "+Y+" texture units while this GPU supports only "+i.maxTextures),M+=1,Y}function T(Y){const G=[];return G.push(Y.wrapS),G.push(Y.wrapT),G.push(Y.wrapR||0),G.push(Y.magFilter),G.push(Y.minFilter),G.push(Y.anisotropy),G.push(Y.internalFormat),G.push(Y.format),G.push(Y.type),G.push(Y.generateMipmaps),G.push(Y.premultiplyAlpha),G.push(Y.flipY),G.push(Y.unpackAlignment),G.push(Y.colorSpace),G.join()}function y(Y,G){const j=r.get(Y);if(Y.isVideoTexture&&Z(Y),Y.isRenderTargetTexture===!1&&Y.version>0&&j.__version!==Y.version){const se=Y.image;if(se===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(se.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{K(j,Y,G);return}}t.bindTexture(n.TEXTURE_2D,j.__webglTexture,n.TEXTURE0+G)}function E(Y,G){const j=r.get(Y);if(Y.version>0&&j.__version!==Y.version){K(j,Y,G);return}t.bindTexture(n.TEXTURE_2D_ARRAY,j.__webglTexture,n.TEXTURE0+G)}function R(Y,G){const j=r.get(Y);if(Y.version>0&&j.__version!==Y.version){K(j,Y,G);return}t.bindTexture(n.TEXTURE_3D,j.__webglTexture,n.TEXTURE0+G)}function L(Y,G){const j=r.get(Y);if(Y.version>0&&j.__version!==Y.version){ee(j,Y,G);return}t.bindTexture(n.TEXTURE_CUBE_MAP,j.__webglTexture,n.TEXTURE0+G)}const N={[Qs]:n.REPEAT,[Is]:n.CLAMP_TO_EDGE,[kg]:n.MIRRORED_REPEAT},z={[Kr]:n.NEAREST,[ER]:n.NEAREST_MIPMAP_NEAREST,[Ph]:n.NEAREST_MIPMAP_LINEAR,[Lr]:n.LINEAR,[qm]:n.LINEAR_MIPMAP_NEAREST,[qo]:n.LINEAR_MIPMAP_LINEAR},W={[MJ]:n.NEVER,[FJ]:n.ALWAYS,[CJ]:n.LESS,[gz]:n.LEQUAL,[TJ]:n.EQUAL,[UJ]:n.GEQUAL,[IJ]:n.GREATER,[RJ]:n.NOTEQUAL};function H(Y,G){if(G.type===xi&&e.has("OES_texture_float_linear")===!1&&(G.magFilter===Lr||G.magFilter===qm||G.magFilter===Ph||G.magFilter===qo||G.minFilter===Lr||G.minFilter===qm||G.minFilter===Ph||G.minFilter===qo)&&console.warn("THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device."),n.texParameteri(Y,n.TEXTURE_WRAP_S,N[G.wrapS]),n.texParameteri(Y,n.TEXTURE_WRAP_T,N[G.wrapT]),(Y===n.TEXTURE_3D||Y===n.TEXTURE_2D_ARRAY)&&n.texParameteri(Y,n.TEXTURE_WRAP_R,N[G.wrapR]),n.texParameteri(Y,n.TEXTURE_MAG_FILTER,z[G.magFilter]),n.texParameteri(Y,n.TEXTURE_MIN_FILTER,z[G.minFilter]),G.compareFunction&&(n.texParameteri(Y,n.TEXTURE_COMPARE_MODE,n.COMPARE_REF_TO_TEXTURE),n.texParameteri(Y,n.TEXTURE_COMPARE_FUNC,W[G.compareFunction])),e.has("EXT_texture_filter_anisotropic")===!0){if(G.magFilter===Kr||G.minFilter!==Ph&&G.minFilter!==qo||G.type===xi&&e.has("OES_texture_float_linear")===!1)return;if(G.anisotropy>1||r.get(G).__currentAnisotropy){const j=e.get("EXT_texture_filter_anisotropic");n.texParameterf(Y,j.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(G.anisotropy,i.getMaxAnisotropy())),r.get(G).__currentAnisotropy=G.anisotropy}}}function C(Y,G){let j=!1;Y.__webglInit===void 0&&(Y.__webglInit=!0,G.addEventListener("dispose",x));const se=G.source;let fe=f.get(se);fe===void 0&&(fe={},f.set(se,fe));const he=T(G);if(he!==Y.__cacheKey){fe[he]===void 0&&(fe[he]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,j=!0),fe[he].usedTimes++;const Be=fe[Y.__cacheKey];Be!==void 0&&(fe[Y.__cacheKey].usedTimes--,Be.usedTimes===0&&S(G)),Y.__cacheKey=he,Y.__webglTexture=fe[he].texture}return j}function K(Y,G,j){let se=n.TEXTURE_2D;(G.isDataArrayTexture||G.isCompressedArrayTexture)&&(se=n.TEXTURE_2D_ARRAY),G.isData3DTexture&&(se=n.TEXTURE_3D);const fe=C(Y,G),he=G.source;t.bindTexture(se,Y.__webglTexture,n.TEXTURE0+j);const Be=r.get(he);if(he.version!==Be.__version||fe===!0){t.activeTexture(n.TEXTURE0+j);const V=bt.getPrimaries(bt.workingColorSpace),U=G.colorSpace===Ra?null:bt.getPrimaries(G.colorSpace),O=G.colorSpace===Ra||V===U?n.NONE:n.BROWSER_DEFAULT_WEBGL;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,G.flipY),n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,G.premultiplyAlpha),n.pixelStorei(n.UNPACK_ALIGNMENT,G.unpackAlignment),n.pixelStorei(n.UNPACK_COLORSPACE_CONVERSION_WEBGL,O);let X=m(G.image,!1,i.maxTextureSize);X=J(G,X);const ie=s.convert(G.format,G.colorSpace),pe=s.convert(G.type);let de=v(G.internalFormat,ie,pe,G.colorSpace,G.isVideoTexture);H(se,G);let Ie;const Le=G.mipmaps,Ue=G.isVideoTexture!==!0,Ye=Be.__version===void 0||fe===!0,Ae=he.dataReady,Fe=_(G,X);if(G.isDepthTexture)de=w(G.format===Ud,G.type),Ye&&(Ue?t.texStorage2D(n.TEXTURE_2D,1,de,X.width,X.height):t.texImage2D(n.TEXTURE_2D,0,de,X.width,X.height,0,ie,pe,null));else if(G.isDataTexture)if(Le.length>0){Ue&&Ye&&t.texStorage2D(n.TEXTURE_2D,Fe,de,Le[0].width,Le[0].height);for(let Me=0,Ce=Le.length;Me0){const Re=jL(Ie.width,Ie.height,G.format,G.type);for(const Oe of G.layerUpdates){const $e=Ie.data.subarray(Oe*Re/Ie.data.BYTES_PER_ELEMENT,(Oe+1)*Re/Ie.data.BYTES_PER_ELEMENT);t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Me,0,0,Oe,Ie.width,Ie.height,1,ie,$e,0,0)}G.clearLayerUpdates()}else t.compressedTexSubImage3D(n.TEXTURE_2D_ARRAY,Me,0,0,0,Ie.width,Ie.height,X.depth,ie,Ie.data,0,0)}else t.compressedTexImage3D(n.TEXTURE_2D_ARRAY,Me,de,Ie.width,Ie.height,X.depth,0,Ie.data,0,0);else console.warn("THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()");else Ue?Ae&&t.texSubImage3D(n.TEXTURE_2D_ARRAY,Me,0,0,0,Ie.width,Ie.height,X.depth,ie,pe,Ie.data):t.texImage3D(n.TEXTURE_2D_ARRAY,Me,de,Ie.width,Ie.height,X.depth,0,ie,pe,Ie.data)}else{Ue&&Ye&&t.texStorage2D(n.TEXTURE_2D,Fe,de,Le[0].width,Le[0].height);for(let Me=0,Ce=Le.length;Me0){const Me=jL(X.width,X.height,G.format,G.type);for(const Ce of G.layerUpdates){const Re=X.data.subarray(Ce*Me/X.data.BYTES_PER_ELEMENT,(Ce+1)*Me/X.data.BYTES_PER_ELEMENT);t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,Ce,X.width,X.height,1,ie,pe,Re)}G.clearLayerUpdates()}else t.texSubImage3D(n.TEXTURE_2D_ARRAY,0,0,0,0,X.width,X.height,X.depth,ie,pe,X.data)}else t.texImage3D(n.TEXTURE_2D_ARRAY,0,de,X.width,X.height,X.depth,0,ie,pe,X.data);else if(G.isData3DTexture)Ue?(Ye&&t.texStorage3D(n.TEXTURE_3D,Fe,de,X.width,X.height,X.depth),Ae&&t.texSubImage3D(n.TEXTURE_3D,0,0,0,0,X.width,X.height,X.depth,ie,pe,X.data)):t.texImage3D(n.TEXTURE_3D,0,de,X.width,X.height,X.depth,0,ie,pe,X.data);else if(G.isFramebufferTexture){if(Ye)if(Ue)t.texStorage2D(n.TEXTURE_2D,Fe,de,X.width,X.height);else{let Me=X.width,Ce=X.height;for(let Re=0;Re>=1,Ce>>=1}}else if(Le.length>0){if(Ue&&Ye){const Me=ue(Le[0]);t.texStorage2D(n.TEXTURE_2D,Fe,de,Me.width,Me.height)}for(let Me=0,Ce=Le.length;Me0&&Fe++;const Ce=ue(ie[0]);t.texStorage2D(n.TEXTURE_CUBE_MAP,Fe,Le,Ce.width,Ce.height)}for(let Ce=0;Ce<6;Ce++)if(X){Ue?Ae&&t.texSubImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,0,0,ie[Ce].width,ie[Ce].height,de,Ie,ie[Ce].data):t.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+Ce,0,Le,ie[Ce].width,ie[Ce].height,0,de,Ie,ie[Ce].data);for(let Re=0;Re>he),ie=Math.max(1,G.height>>he);fe===n.TEXTURE_3D||fe===n.TEXTURE_2D_ARRAY?t.texImage3D(fe,he,U,X,ie,G.depth,0,Be,V,null):t.texImage2D(fe,he,U,X,ie,0,Be,V,null)}t.bindFramebuffer(n.FRAMEBUFFER,Y),le(G)?a.framebufferTexture2DMultisampleEXT(n.FRAMEBUFFER,se,fe,r.get(j).__webglTexture,0,ae(G)):(fe===n.TEXTURE_2D||fe>=n.TEXTURE_CUBE_MAP_POSITIVE_X&&fe<=n.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&n.framebufferTexture2D(n.FRAMEBUFFER,se,fe,r.get(j).__webglTexture,he),t.bindFramebuffer(n.FRAMEBUFFER,null)}function re(Y,G,j){if(n.bindRenderbuffer(n.RENDERBUFFER,Y),G.depthBuffer){const se=G.depthTexture,fe=se&&se.isDepthTexture?se.type:null,he=w(G.stencilBuffer,fe),Be=G.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,V=ae(G);le(G)?a.renderbufferStorageMultisampleEXT(n.RENDERBUFFER,V,he,G.width,G.height):j?n.renderbufferStorageMultisample(n.RENDERBUFFER,V,he,G.width,G.height):n.renderbufferStorage(n.RENDERBUFFER,he,G.width,G.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,Be,n.RENDERBUFFER,Y)}else{const se=G.textures;for(let fe=0;fe{delete G.__boundDepthTexture,delete G.__depthDisposeCallback,se.removeEventListener("dispose",fe)};se.addEventListener("dispose",fe),G.__depthDisposeCallback=fe}G.__boundDepthTexture=se}if(Y.depthTexture&&!G.__autoAllocateDepthBuffer){if(j)throw new Error("target.depthTexture not supported in Cube render targets");ce(G.__webglFramebuffer,Y)}else if(j){G.__webglDepthbuffer=[];for(let se=0;se<6;se++)if(t.bindFramebuffer(n.FRAMEBUFFER,G.__webglFramebuffer[se]),G.__webglDepthbuffer[se]===void 0)G.__webglDepthbuffer[se]=n.createRenderbuffer(),re(G.__webglDepthbuffer[se],Y,!1);else{const fe=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,he=G.__webglDepthbuffer[se];n.bindRenderbuffer(n.RENDERBUFFER,he),n.framebufferRenderbuffer(n.FRAMEBUFFER,fe,n.RENDERBUFFER,he)}}else if(t.bindFramebuffer(n.FRAMEBUFFER,G.__webglFramebuffer),G.__webglDepthbuffer===void 0)G.__webglDepthbuffer=n.createRenderbuffer(),re(G.__webglDepthbuffer,Y,!1);else{const se=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,fe=G.__webglDepthbuffer;n.bindRenderbuffer(n.RENDERBUFFER,fe),n.framebufferRenderbuffer(n.FRAMEBUFFER,se,n.RENDERBUFFER,fe)}t.bindFramebuffer(n.FRAMEBUFFER,null)}function ge(Y,G,j){const se=r.get(Y);G!==void 0&&F(se.__webglFramebuffer,Y,Y.texture,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,0),j!==void 0&&oe(Y)}function me(Y){const G=Y.texture,j=r.get(Y),se=r.get(G);Y.addEventListener("dispose",b);const fe=Y.textures,he=Y.isWebGLCubeRenderTarget===!0,Be=fe.length>1;if(Be||(se.__webglTexture===void 0&&(se.__webglTexture=n.createTexture()),se.__version=G.version,o.memory.textures++),he){j.__webglFramebuffer=[];for(let V=0;V<6;V++)if(G.mipmaps&&G.mipmaps.length>0){j.__webglFramebuffer[V]=[];for(let U=0;U0){j.__webglFramebuffer=[];for(let V=0;V0&&le(Y)===!1){j.__webglMultisampledFramebuffer=n.createFramebuffer(),j.__webglColorRenderbuffer=[],t.bindFramebuffer(n.FRAMEBUFFER,j.__webglMultisampledFramebuffer);for(let V=0;V0)for(let U=0;U0)for(let U=0;U0){if(le(Y)===!1){const G=Y.textures,j=Y.width,se=Y.height;let fe=n.COLOR_BUFFER_BIT;const he=Y.stencilBuffer?n.DEPTH_STENCIL_ATTACHMENT:n.DEPTH_ATTACHMENT,Be=r.get(Y),V=G.length>1;if(V)for(let U=0;U0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&G.__useRenderToTexture!==!1}function Z(Y){const G=o.render.frame;A.get(Y)!==G&&(A.set(Y,G),Y.update())}function J(Y,G){const j=Y.colorSpace,se=Y.format,fe=Y.type;return Y.isCompressedTexture===!0||Y.isVideoTexture===!0||j!==Mr&&j!==Ra&&(bt.getTransfer(j)===Sn?(se!==Nr||fe!==rc)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture color space:",j)),G}function ue(Y){return typeof HTMLImageElement<"u"&&Y instanceof HTMLImageElement?(c.width=Y.naturalWidth||Y.width,c.height=Y.naturalHeight||Y.height):typeof VideoFrame<"u"&&Y instanceof VideoFrame?(c.width=Y.displayWidth,c.height=Y.displayHeight):(c.width=Y.width,c.height=Y.height),c}this.allocateTextureUnit=D,this.resetTextureUnits=P,this.setTexture2D=y,this.setTexture2DArray=E,this.setTexture3D=R,this.setTextureCube=L,this.rebindTextures=ge,this.setupRenderTarget=me,this.updateRenderTargetMipmap=ve,this.updateMultisampleRenderTarget=k,this.setupDepthRenderbuffer=oe,this.setupFrameBufferTexture=F,this.useMultisampledRTT=le}function nse(n,e){function t(r,i=Ra){let s;const o=bt.getTransfer(i);if(r===rc)return n.UNSIGNED_BYTE;if(r===SR)return n.UNSIGNED_SHORT_4_4_4_4;if(r===MR)return n.UNSIGNED_SHORT_5_5_5_1;if(r===cz)return n.UNSIGNED_INT_5_9_9_9_REV;if(r===az)return n.BYTE;if(r===lz)return n.SHORT;if(r===Hg)return n.UNSIGNED_SHORT;if(r===BR)return n.INT;if(r===yA)return n.UNSIGNED_INT;if(r===xi)return n.FLOAT;if(r===Na)return n.HALF_FLOAT;if(r===Az)return n.ALPHA;if(r===uz)return n.RGB;if(r===Nr)return n.RGBA;if(r===fz)return n.LUMINANCE;if(r===hz)return n.LUMINANCE_ALPHA;if(r===id)return n.DEPTH_COMPONENT;if(r===Ud)return n.DEPTH_STENCIL;if(r===CR)return n.RED;if(r===o1)return n.RED_INTEGER;if(r===dz)return n.RG;if(r===TR)return n.RG_INTEGER;if(r===IR)return n.RGBA_INTEGER;if(r===_w||r===xw||r===bw||r===Ew)if(o===Sn)if(s=e.get("WEBGL_compressed_texture_s3tc_srgb"),s!==null){if(r===_w)return s.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(r===xw)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(r===bw)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(r===Ew)return s.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(s=e.get("WEBGL_compressed_texture_s3tc"),s!==null){if(r===_w)return s.COMPRESSED_RGB_S3TC_DXT1_EXT;if(r===xw)return s.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(r===bw)return s.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(r===Ew)return s.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(r===eC||r===tC||r===nC||r===rC)if(s=e.get("WEBGL_compressed_texture_pvrtc"),s!==null){if(r===eC)return s.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(r===tC)return s.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(r===nC)return s.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(r===rC)return s.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(r===iC||r===sC||r===oC)if(s=e.get("WEBGL_compressed_texture_etc"),s!==null){if(r===iC||r===sC)return o===Sn?s.COMPRESSED_SRGB8_ETC2:s.COMPRESSED_RGB8_ETC2;if(r===oC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:s.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(r===aC||r===lC||r===cC||r===AC||r===uC||r===fC||r===hC||r===dC||r===pC||r===mC||r===gC||r===vC||r===yC||r===wC)if(s=e.get("WEBGL_compressed_texture_astc"),s!==null){if(r===aC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:s.COMPRESSED_RGBA_ASTC_4x4_KHR;if(r===lC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:s.COMPRESSED_RGBA_ASTC_5x4_KHR;if(r===cC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:s.COMPRESSED_RGBA_ASTC_5x5_KHR;if(r===AC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:s.COMPRESSED_RGBA_ASTC_6x5_KHR;if(r===uC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:s.COMPRESSED_RGBA_ASTC_6x6_KHR;if(r===fC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:s.COMPRESSED_RGBA_ASTC_8x5_KHR;if(r===hC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:s.COMPRESSED_RGBA_ASTC_8x6_KHR;if(r===dC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:s.COMPRESSED_RGBA_ASTC_8x8_KHR;if(r===pC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:s.COMPRESSED_RGBA_ASTC_10x5_KHR;if(r===mC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:s.COMPRESSED_RGBA_ASTC_10x6_KHR;if(r===gC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:s.COMPRESSED_RGBA_ASTC_10x8_KHR;if(r===vC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:s.COMPRESSED_RGBA_ASTC_10x10_KHR;if(r===yC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:s.COMPRESSED_RGBA_ASTC_12x10_KHR;if(r===wC)return o===Sn?s.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:s.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(r===Bw||r===_C||r===xC)if(s=e.get("EXT_texture_compression_bptc"),s!==null){if(r===Bw)return o===Sn?s.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:s.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(r===_C)return s.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(r===xC)return s.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(r===pz||r===bC||r===EC||r===BC)if(s=e.get("EXT_texture_compression_rgtc"),s!==null){if(r===Bw)return s.COMPRESSED_RED_RGTC1_EXT;if(r===bC)return s.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(r===EC)return s.COMPRESSED_RED_GREEN_RGTC2_EXT;if(r===BC)return s.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return r===Rd?n.UNSIGNED_INT_24_8:n[r]!==void 0?n[r]:null}return{convert:t}}class rse extends Fr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class ri extends Ft{constructor(){super(),this.isGroup=!0,this.type="Group"}}const ise={type:"move"};class OE{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new ri,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new ri,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new $,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new $),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new ri,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new $,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new $),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){const t=this._hand;if(t)for(const r of e.hand.values())this._getHandJoint(t,r)}return this.dispatchEvent({type:"connected",data:e}),this}disconnect(e){return this.dispatchEvent({type:"disconnected",data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,r){let i=null,s=null,o=null;const a=this._targetRay,l=this._grip,c=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(c&&e.hand){o=!0;for(const m of e.hand.values()){const g=t.getJointPose(m,r),p=this._getHandJoint(c,m);g!==null&&(p.matrix.fromArray(g.transform.matrix),p.matrix.decompose(p.position,p.rotation,p.scale),p.matrixWorldNeedsUpdate=!0,p.jointRadius=g.radius),p.visible=g!==null}const A=c.joints["index-finger-tip"],u=c.joints["thumb-tip"],f=A.position.distanceTo(u.position),h=.02,d=.005;c.inputState.pinching&&f>h+d?(c.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!c.inputState.pinching&&f<=h-d&&(c.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:e.handedness,target:this}))}else l!==null&&e.gripSpace&&(s=t.getPose(e.gripSpace,r),s!==null&&(l.matrix.fromArray(s.transform.matrix),l.matrix.decompose(l.position,l.rotation,l.scale),l.matrixWorldNeedsUpdate=!0,s.linearVelocity?(l.hasLinearVelocity=!0,l.linearVelocity.copy(s.linearVelocity)):l.hasLinearVelocity=!1,s.angularVelocity?(l.hasAngularVelocity=!0,l.angularVelocity.copy(s.angularVelocity)):l.hasAngularVelocity=!1));a!==null&&(i=t.getPose(e.targetRaySpace,r),i===null&&s!==null&&(i=s),i!==null&&(a.matrix.fromArray(i.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,i.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(i.linearVelocity)):a.hasLinearVelocity=!1,i.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(i.angularVelocity)):a.hasAngularVelocity=!1,this.dispatchEvent(ise)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),c!==null&&(c.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new ri;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}const sse=` void main() { gl_Position = vec4( position, 1.0 ); -}`,tse=` +}`,ose=` uniform sampler2DArray depthColor; uniform float depthWidth; uniform float depthHeight; @@ -3898,12 +3898,12 @@ void main() { } -}`;class nse{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,r){if(this.texture===null){const i=new Hn,s=e.properties.get(i);s.__webglTexture=t.texture,(t.depthNear!=r.depthNear||t.depthFar!=r.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=i}}getMesh(e){if(this.texture!==null&&this.mesh===null){const t=e.cameras[0].viewport,r=new dr({vertexShader:ese,fragmentShader:tse,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new hn(new ac(20,20),r)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class rse extends TA{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,c=null,A=null,u=null,f=null,h=null,d=null;const m=new nse,g=t.getContextAttributes();let p=null,v=null;const w=[],_=[],x=new je;let b=null;const B=new Ur;B.layers.enable(1),B.viewport=new Ut;const M=new Ur;M.layers.enable(2),M.viewport=new Ut;const I=[B,M],S=new qie;S.layers.enable(1),S.layers.enable(2);let L=null,O=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(te){let F=w[te];return F===void 0&&(F=new LE,w[te]=F),F.getTargetRaySpace()},this.getControllerGrip=function(te){let F=w[te];return F===void 0&&(F=new LE,w[te]=F),F.getGripSpace()},this.getHand=function(te){let F=w[te];return F===void 0&&(F=new LE,w[te]=F),F.getHandSpace()};function T(te){const F=_.indexOf(te.inputSource);if(F===-1)return;const re=w[F];re!==void 0&&(re.update(te.inputSource,te.frame,c||o),re.dispatchEvent({type:te.type,data:te.inputSource}))}function y(){i.removeEventListener("select",T),i.removeEventListener("selectstart",T),i.removeEventListener("selectend",T),i.removeEventListener("squeeze",T),i.removeEventListener("squeezestart",T),i.removeEventListener("squeezeend",T),i.removeEventListener("end",y),i.removeEventListener("inputsourceschange",E);for(let te=0;te=0&&(_[ce]=null,w[ce].disconnect(re))}for(let F=0;F=_.length){_.push(re),ce=ge;break}else if(_[ge]===null){_[ge]=re,ce=ge;break}if(ce===-1)break}const oe=w[ce];oe&&oe.connect(re)}}const U=new $,P=new $;function N(te,F,re){U.setFromMatrixPosition(F.matrixWorld),P.setFromMatrixPosition(re.matrixWorld);const ce=U.distanceTo(P),oe=F.projectionMatrix.elements,ge=re.projectionMatrix.elements,me=oe[14]/(oe[10]-1),ve=oe[14]/(oe[10]+1),be=(oe[9]+1)/oe[5],ne=(oe[9]-1)/oe[5],k=(oe[8]-1)/oe[0],ae=(ge[8]+1)/ge[0],le=me*k,Z=me*ae,J=ce/(-k+ae),ue=J*-k;if(F.matrixWorld.decompose(te.position,te.quaternion,te.scale),te.translateX(ue),te.translateZ(J),te.matrixWorld.compose(te.position,te.quaternion,te.scale),te.matrixWorldInverse.copy(te.matrixWorld).invert(),oe[10]===-1)te.projectionMatrix.copy(F.projectionMatrix),te.projectionMatrixInverse.copy(F.projectionMatrixInverse);else{const Y=me+J,G=ve+J,j=le-ue,se=Z+(ce-ue),fe=be*ve/G*Y,he=ne*ve/G*Y;te.projectionMatrix.makePerspective(j,se,fe,he,Y,G),te.projectionMatrixInverse.copy(te.projectionMatrix).invert()}}function z(te,F){F===null?te.matrixWorld.copy(te.matrix):te.matrixWorld.multiplyMatrices(F.matrixWorld,te.matrix),te.matrixWorldInverse.copy(te.matrixWorld).invert()}this.updateCamera=function(te){if(i===null)return;let F=te.near,re=te.far;m.texture!==null&&(m.depthNear>0&&(F=m.depthNear),m.depthFar>0&&(re=m.depthFar)),S.near=M.near=B.near=F,S.far=M.far=B.far=re,(L!==S.near||O!==S.far)&&(i.updateRenderState({depthNear:S.near,depthFar:S.far}),L=S.near,O=S.far);const ce=te.parent,oe=S.cameras;z(S,ce);for(let ge=0;ge0&&(g.alphaTest.value=p.alphaTest);const v=e.get(p),w=v.envMap,_=v.envMapRotation;w&&(g.envMap.value=w,kA.copy(_),kA.x*=-1,kA.y*=-1,kA.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(kA.y*=-1,kA.z*=-1),g.envMapRotation.value.setFromMatrix4(ise.makeRotationFromEuler(kA)),g.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function o(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function a(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,v,w){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*v,g.scale.value=w*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function A(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function f(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function h(g,p,v){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===si&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function d(g,p){p.matcap&&(g.matcap.value=p.matcap)}function m(g,p){const v=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function ose(n,e,t,r){let i={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,w){const _=w.program;r.uniformBlockBinding(v,_)}function c(v,w){let _=i[v.id];_===void 0&&(d(v),_=A(v),i[v.id]=_,v.addEventListener("dispose",g));const x=w.program;r.updateUBOMapping(v,x);const b=e.render.frame;s[v.id]!==b&&(f(v),s[v.id]=b)}function A(v){const w=u();v.__bindingPointIndex=w;const _=n.createBuffer(),x=v.__size,b=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,_),n.bufferData(n.UNIFORM_BUFFER,x,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,w,_),_}function u(){for(let v=0;v0&&(_+=x-b),v.__size=_,v.__cache={},this}function m(v){const w={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(w.boundary=4,w.storage=4):v.isVector2?(w.boundary=8,w.storage=8):v.isVector3||v.isColor?(w.boundary=16,w.storage=12):v.isVector4?(w.boundary=16,w.storage=16):v.isMatrix3?(w.boundary=48,w.storage=48):v.isMatrix4?(w.boundary=64,w.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),w}function g(v){const w=v.target;w.removeEventListener("dispose",g);const _=o.indexOf(w.__bindingPointIndex);o.splice(_,1),n.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function p(){for(const v in i)n.deleteBuffer(i[v]);o=[],i={},s={}}return{bind:l,update:c,dispose:p}}class m0{constructor(e={}){const{canvas:t=YJ(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:A="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let f;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=r.getContextAttributes().alpha}else f=o;const h=new Uint32Array(4),d=new Int32Array(4);let m=null,g=null;const p=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=kt,this.toneMapping=cA,this.toneMappingExposure=1;const w=this;let _=!1,x=0,b=0,B=null,M=-1,I=null;const S=new Ut,L=new Ut;let O=null;const T=new He(0);let y=0,E=t.width,U=t.height,P=1,N=null,z=null;const W=new Ut(0,0,E,U),H=new Ut(0,0,E,U);let C=!1;const K=new a1;let te=!1,F=!1;const re=new ke,ce=new ke,oe=new $,ge=new Ut,me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ve=!1;function be(){return B===null?P:1}let ne=r;function k(ee,ye){return t.getContext(ee,ye)}try{const ee={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:A,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${Jl}`),t.addEventListener("webglcontextlost",Ce,!1),t.addEventListener("webglcontextrestored",Re,!1),t.addEventListener("webglcontextcreationerror",Oe,!1),ne===null){const ye="webgl2";if(ne=k(ye,ee),ne===null)throw k(ye)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(ee){throw console.error("THREE.WebGLRenderer: "+ee.message),ee}let ae,le,Z,J,ue,Y,G,j,se,fe,he,Be,V,R,D,X,ie,pe,de,Ie,Le,Ue,Ye,Ae;function Fe(){ae=new fre(ne),ae.init(),Ue=new Zie(ne,ae),le=new ore(ne,ae,e,Ue),Z=new Xie(ne),le.reverseDepthBuffer&&Z.buffers.depth.setReversed(!0),J=new pre(ne),ue=new Fie,Y=new $ie(ne,ae,Z,ue,le,Ue,J),G=new lre(w),j=new ure(w),se=new xee(ne),Ye=new ire(ne,se),fe=new hre(ne,se,J,Ye),he=new gre(ne,fe,se,J),de=new mre(ne,le,Y),X=new are(ue),Be=new Uie(w,G,j,ae,le,Ye,X),V=new sse(w,ue),R=new Lie,D=new Qie(ae),pe=new rre(w,G,j,Z,he,f,l),ie=new Wie(w,he,le),Ae=new ose(ne,J,le,Z),Ie=new sre(ne,ae,J),Le=new dre(ne,ae,J),J.programs=Be.programs,w.capabilities=le,w.extensions=ae,w.properties=ue,w.renderLists=R,w.shadowMap=ie,w.state=Z,w.info=J}Fe();const Me=new rse(w,ne);this.xr=Me,this.getContext=function(){return ne},this.getContextAttributes=function(){return ne.getContextAttributes()},this.forceContextLoss=function(){const ee=ae.get("WEBGL_lose_context");ee&&ee.loseContext()},this.forceContextRestore=function(){const ee=ae.get("WEBGL_lose_context");ee&&ee.restoreContext()},this.getPixelRatio=function(){return P},this.setPixelRatio=function(ee){ee!==void 0&&(P=ee,this.setSize(E,U,!1))},this.getSize=function(ee){return ee.set(E,U)},this.setSize=function(ee,ye,Ee=!0){if(Me.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}E=ee,U=ye,t.width=Math.floor(ee*P),t.height=Math.floor(ye*P),Ee===!0&&(t.style.width=ee+"px",t.style.height=ye+"px"),this.setViewport(0,0,ee,ye)},this.getDrawingBufferSize=function(ee){return ee.set(E*P,U*P).floor()},this.setDrawingBufferSize=function(ee,ye,Ee){E=ee,U=ye,P=Ee,t.width=Math.floor(ee*Ee),t.height=Math.floor(ye*Ee),this.setViewport(0,0,ee,ye)},this.getCurrentViewport=function(ee){return ee.copy(S)},this.getViewport=function(ee){return ee.copy(W)},this.setViewport=function(ee,ye,Ee,Se){ee.isVector4?W.set(ee.x,ee.y,ee.z,ee.w):W.set(ee,ye,Ee,Se),Z.viewport(S.copy(W).multiplyScalar(P).round())},this.getScissor=function(ee){return ee.copy(H)},this.setScissor=function(ee,ye,Ee,Se){ee.isVector4?H.set(ee.x,ee.y,ee.z,ee.w):H.set(ee,ye,Ee,Se),Z.scissor(L.copy(H).multiplyScalar(P).round())},this.getScissorTest=function(){return C},this.setScissorTest=function(ee){Z.setScissorTest(C=ee)},this.setOpaqueSort=function(ee){N=ee},this.setTransparentSort=function(ee){z=ee},this.getClearColor=function(ee){return ee.copy(pe.getClearColor())},this.setClearColor=function(){pe.setClearColor.apply(pe,arguments)},this.getClearAlpha=function(){return pe.getClearAlpha()},this.setClearAlpha=function(){pe.setClearAlpha.apply(pe,arguments)},this.clear=function(ee=!0,ye=!0,Ee=!0){let Se=0;if(ee){let we=!1;if(B!==null){const Ne=B.texture.format;we=Ne===MR||Ne===SR||Ne===i1}if(we){const Ne=B.texture.type,Ke=Ne===ec||Ne===gA||Ne===Og||Ne===Td||Ne===bR||Ne===ER,qe=pe.getClearColor(),et=pe.getClearAlpha(),ct=qe.r,ht=qe.g,it=qe.b;Ke?(h[0]=ct,h[1]=ht,h[2]=it,h[3]=et,ne.clearBufferuiv(ne.COLOR,0,h)):(d[0]=ct,d[1]=ht,d[2]=it,d[3]=et,ne.clearBufferiv(ne.COLOR,0,d))}else Se|=ne.COLOR_BUFFER_BIT}ye&&(Se|=ne.DEPTH_BUFFER_BIT,ne.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Ee&&(Se|=ne.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ne.clear(Se)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ce,!1),t.removeEventListener("webglcontextrestored",Re,!1),t.removeEventListener("webglcontextcreationerror",Oe,!1),R.dispose(),D.dispose(),ue.dispose(),G.dispose(),j.dispose(),he.dispose(),Ye.dispose(),Ae.dispose(),Be.dispose(),Me.dispose(),Me.removeEventListener("sessionstart",en),Me.removeEventListener("sessionend",qt),$r.stop()};function Ce(ee){ee.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function Re(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const ee=J.autoReset,ye=ie.enabled,Ee=ie.autoUpdate,Se=ie.needsUpdate,we=ie.type;Fe(),J.autoReset=ee,ie.enabled=ye,ie.autoUpdate=Ee,ie.needsUpdate=Se,ie.type=we}function Oe(ee){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",ee.statusMessage)}function $e(ee){const ye=ee.target;ye.removeEventListener("dispose",$e),dt(ye)}function dt(ee){Fn(ee),ue.remove(ee)}function Fn(ee){const ye=ue.get(ee).programs;ye!==void 0&&(ye.forEach(function(Ee){Be.releaseProgram(Ee)}),ee.isShaderMaterial&&Be.releaseShaderCache(ee))}this.renderBufferDirect=function(ee,ye,Ee,Se,we,Ne){ye===null&&(ye=me);const Ke=we.isMesh&&we.matrixWorld.determinant()<0,qe=ua(ee,ye,Ee,Se,we);Z.setMaterial(Se,Ke);let et=Ee.index,ct=1;if(Se.wireframe===!0){if(et=fe.getWireframeAttribute(Ee),et===void 0)return;ct=2}const ht=Ee.drawRange,it=Ee.attributes.position;let Vt=ht.start*ct,un=(ht.start+ht.count)*ct;Ne!==null&&(Vt=Math.max(Vt,Ne.start*ct),un=Math.min(un,(Ne.start+Ne.count)*ct)),et!==null?(Vt=Math.max(Vt,0),un=Math.min(un,et.count)):it!=null&&(Vt=Math.max(Vt,0),un=Math.min(un,it.count));const yn=un-Vt;if(yn<0||yn===1/0)return;Ye.setup(we,Se,qe,Ee,et);let Zr,Gt=Ie;if(et!==null&&(Zr=se.get(et),Gt=Le,Gt.setIndex(Zr)),we.isMesh)Se.wireframe===!0?(Z.setLineWidth(Se.wireframeLinewidth*be()),Gt.setMode(ne.LINES)):Gt.setMode(ne.TRIANGLES);else if(we.isLine){let ot=Se.linewidth;ot===void 0&&(ot=1),Z.setLineWidth(ot*be()),we.isLineSegments?Gt.setMode(ne.LINES):we.isLineLoop?Gt.setMode(ne.LINE_LOOP):Gt.setMode(ne.LINE_STRIP)}else we.isPoints?Gt.setMode(ne.POINTS):we.isSprite&&Gt.setMode(ne.TRIANGLES);if(we.isBatchedMesh)if(we._multiDrawInstances!==null)Gt.renderMultiDrawInstances(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount,we._multiDrawInstances);else if(ae.get("WEBGL_multi_draw"))Gt.renderMultiDraw(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount);else{const ot=we._multiDrawStarts,sr=we._multiDrawCounts,on=we._multiDrawCount,To=et?se.get(et).bytesPerElement:1,Ju=ue.get(Se).currentProgram.getUniforms();for(let fs=0;fs{function Ne(){if(Se.forEach(function(Ke){ue.get(Ke).currentProgram.isReady()&&Se.delete(Ke)}),Se.size===0){we(ee);return}setTimeout(Ne,10)}ae.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let _t=null;function Cr(ee){_t&&_t(ee)}function en(){$r.stop()}function qt(){$r.start()}const $r=new bz;$r.setAnimationLoop(Cr),typeof self<"u"&&$r.setContext(self),this.setAnimationLoop=function(ee){_t=ee,Me.setAnimationLoop(ee),ee===null?$r.stop():$r.start()},Me.addEventListener("sessionstart",en),Me.addEventListener("sessionend",qt),this.render=function(ee,ye){if(ye!==void 0&&ye.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(_===!0)return;if(ee.matrixWorldAutoUpdate===!0&&ee.updateMatrixWorld(),ye.parent===null&&ye.matrixWorldAutoUpdate===!0&&ye.updateMatrixWorld(),Me.enabled===!0&&Me.isPresenting===!0&&(Me.cameraAutoUpdate===!0&&Me.updateCamera(ye),ye=Me.getCamera()),ee.isScene===!0&&ee.onBeforeRender(w,ee,ye,B),g=D.get(ee,v.length),g.init(ye),v.push(g),ce.multiplyMatrices(ye.projectionMatrix,ye.matrixWorldInverse),K.setFromProjectionMatrix(ce),F=this.localClippingEnabled,te=X.init(this.clippingPlanes,F),m=R.get(ee,p.length),m.init(),p.push(m),Me.enabled===!0&&Me.isPresenting===!0){const Ne=w.xr.getDepthSensingMesh();Ne!==null&&Jt(Ne,ye,-1/0,w.sortObjects)}Jt(ee,ye,0,w.sortObjects),m.finish(),w.sortObjects===!0&&m.sort(N,z),ve=Me.enabled===!1||Me.isPresenting===!1||Me.hasDepthSensing()===!1,ve&&pe.addToRenderList(m,ee),this.info.render.frame++,te===!0&&X.beginShadows();const Ee=g.state.shadowsArray;ie.render(Ee,ee,ye),te===!0&&X.endShadows(),this.info.autoReset===!0&&this.info.reset();const Se=m.opaque,we=m.transmissive;if(g.setupLights(),ye.isArrayCamera){const Ne=ye.cameras;if(we.length>0)for(let Ke=0,qe=Ne.length;Ke0&&js(Se,we,ee,ye),ve&&pe.render(ee),tn(m,ee,ye);B!==null&&(Y.updateMultisampleRenderTarget(B),Y.updateRenderTargetMipmap(B)),ee.isScene===!0&&ee.onAfterRender(w,ee,ye),Ye.resetDefaultState(),M=-1,I=null,v.pop(),v.length>0?(g=v[v.length-1],te===!0&&X.setGlobalState(w.clippingPlanes,g.state.camera)):g=null,p.pop(),p.length>0?m=p[p.length-1]:m=null};function Jt(ee,ye,Ee,Se){if(ee.visible===!1)return;if(ee.layers.test(ye.layers)){if(ee.isGroup)Ee=ee.renderOrder;else if(ee.isLOD)ee.autoUpdate===!0&&ee.update(ye);else if(ee.isLight)g.pushLight(ee),ee.castShadow&&g.pushShadow(ee);else if(ee.isSprite){if(!ee.frustumCulled||K.intersectsSprite(ee)){Se&&ge.setFromMatrixPosition(ee.matrixWorld).applyMatrix4(ce);const Ke=he.update(ee),qe=ee.material;qe.visible&&m.push(ee,Ke,qe,Ee,ge.z,null)}}else if((ee.isMesh||ee.isLine||ee.isPoints)&&(!ee.frustumCulled||K.intersectsObject(ee))){const Ke=he.update(ee),qe=ee.material;if(Se&&(ee.boundingSphere!==void 0?(ee.boundingSphere===null&&ee.computeBoundingSphere(),ge.copy(ee.boundingSphere.center)):(Ke.boundingSphere===null&&Ke.computeBoundingSphere(),ge.copy(Ke.boundingSphere.center)),ge.applyMatrix4(ee.matrixWorld).applyMatrix4(ce)),Array.isArray(qe)){const et=Ke.groups;for(let ct=0,ht=et.length;ct0&&Kt(we,ye,Ee),Ne.length>0&&Kt(Ne,ye,Ee),Ke.length>0&&Kt(Ke,ye,Ee),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function js(ee,ye,Ee,Se){if((Ee.isScene===!0?Ee.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[Se.id]===void 0&&(g.state.transmissionRenderTarget[Se.id]=new Za(1,1,{generateMipmaps:!0,type:ae.has("EXT_color_buffer_half_float")||ae.has("EXT_color_buffer_float")?jd:ec,minFilter:Da,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:bt.workingColorSpace}));const Ne=g.state.transmissionRenderTarget[Se.id],Ke=Se.viewport||S;Ne.setSize(Ke.z,Ke.w);const qe=w.getRenderTarget();w.setRenderTarget(Ne),w.getClearColor(T),y=w.getClearAlpha(),y<1&&w.setClearColor(16777215,.5),w.clear(),ve&&pe.render(Ee);const et=w.toneMapping;w.toneMapping=cA;const ct=Se.viewport;if(Se.viewport!==void 0&&(Se.viewport=void 0),g.setupLightsView(Se),te===!0&&X.setGlobalState(w.clippingPlanes,Se),Kt(ee,Ee,Se),Y.updateMultisampleRenderTarget(Ne),Y.updateRenderTargetMipmap(Ne),ae.has("WEBGL_multisampled_render_to_texture")===!1){let ht=!1;for(let it=0,Vt=ye.length;it0),it=!!Ee.morphAttributes.position,Vt=!!Ee.morphAttributes.normal,un=!!Ee.morphAttributes.color;let yn=cA;Se.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(yn=w.toneMapping);const Zr=Ee.morphAttributes.position||Ee.morphAttributes.normal||Ee.morphAttributes.color,Gt=Zr!==void 0?Zr.length:0,ot=ue.get(Se),sr=g.state.lights;if(te===!0&&(F===!0||ee!==I)){const Ws=ee===I&&Se.id===M;X.setState(Se,ee,Ws)}let on=!1;Se.version===ot.__version?(ot.needsLights&&ot.lightsStateVersion!==sr.state.version||ot.outputColorSpace!==qe||we.isBatchedMesh&&ot.batching===!1||!we.isBatchedMesh&&ot.batching===!0||we.isBatchedMesh&&ot.batchingColor===!0&&we.colorTexture===null||we.isBatchedMesh&&ot.batchingColor===!1&&we.colorTexture!==null||we.isInstancedMesh&&ot.instancing===!1||!we.isInstancedMesh&&ot.instancing===!0||we.isSkinnedMesh&&ot.skinning===!1||!we.isSkinnedMesh&&ot.skinning===!0||we.isInstancedMesh&&ot.instancingColor===!0&&we.instanceColor===null||we.isInstancedMesh&&ot.instancingColor===!1&&we.instanceColor!==null||we.isInstancedMesh&&ot.instancingMorph===!0&&we.morphTexture===null||we.isInstancedMesh&&ot.instancingMorph===!1&&we.morphTexture!==null||ot.envMap!==et||Se.fog===!0&&ot.fog!==Ne||ot.numClippingPlanes!==void 0&&(ot.numClippingPlanes!==X.numPlanes||ot.numIntersection!==X.numIntersection)||ot.vertexAlphas!==ct||ot.vertexTangents!==ht||ot.morphTargets!==it||ot.morphNormals!==Vt||ot.morphColors!==un||ot.toneMapping!==yn||ot.morphTargetsCount!==Gt)&&(on=!0):(on=!0,ot.__version=Se.version);let To=ot.currentProgram;on===!0&&(To=Ci(Se,ye,we));let Ju=!1,fs=!1,rb=!1;const or=To.getUniforms(),hc=ot.uniforms;if(Z.useProgram(To.program)&&(Ju=!0,fs=!0,rb=!0),Se.id!==M&&(M=Se.id,fs=!0),Ju||I!==ee){le.reverseDepthBuffer?(re.copy(ee.projectionMatrix),ZJ(re),qJ(re),or.setValue(ne,"projectionMatrix",re)):or.setValue(ne,"projectionMatrix",ee.projectionMatrix),or.setValue(ne,"viewMatrix",ee.matrixWorldInverse);const Ws=or.map.cameraPosition;Ws!==void 0&&Ws.setValue(ne,oe.setFromMatrixPosition(ee.matrixWorld)),le.logarithmicDepthBuffer&&or.setValue(ne,"logDepthBufFC",2/(Math.log(ee.far+1)/Math.LN2)),(Se.isMeshPhongMaterial||Se.isMeshToonMaterial||Se.isMeshLambertMaterial||Se.isMeshBasicMaterial||Se.isMeshStandardMaterial||Se.isShaderMaterial)&&or.setValue(ne,"isOrthographic",ee.isOrthographicCamera===!0),I!==ee&&(I=ee,fs=!0,rb=!0)}if(we.isSkinnedMesh){or.setOptional(ne,we,"bindMatrix"),or.setOptional(ne,we,"bindMatrixInverse");const Ws=we.skeleton;Ws&&(Ws.boneTexture===null&&Ws.computeBoneTexture(),or.setValue(ne,"boneTexture",Ws.boneTexture,Y))}we.isBatchedMesh&&(or.setOptional(ne,we,"batchingTexture"),or.setValue(ne,"batchingTexture",we._matricesTexture,Y),or.setOptional(ne,we,"batchingIdTexture"),or.setValue(ne,"batchingIdTexture",we._indirectTexture,Y),or.setOptional(ne,we,"batchingColorTexture"),we._colorsTexture!==null&&or.setValue(ne,"batchingColorTexture",we._colorsTexture,Y));const ib=Ee.morphAttributes;if((ib.position!==void 0||ib.normal!==void 0||ib.color!==void 0)&&de.update(we,Ee,To),(fs||ot.receiveShadow!==we.receiveShadow)&&(ot.receiveShadow=we.receiveShadow,or.setValue(ne,"receiveShadow",we.receiveShadow)),Se.isMeshGouraudMaterial&&Se.envMap!==null&&(hc.envMap.value=et,hc.flipEnvMap.value=et.isCubeTexture&&et.isRenderTargetTexture===!1?-1:1),Se.isMeshStandardMaterial&&Se.envMap===null&&ye.environment!==null&&(hc.envMapIntensity.value=ye.environmentIntensity),fs&&(or.setValue(ne,"toneMappingExposure",w.toneMappingExposure),ot.needsLights&&An(hc,rb),Ne&&Se.fog===!0&&V.refreshFogUniforms(hc,Ne),V.refreshMaterialUniforms(hc,Se,P,U,g.state.transmissionRenderTarget[ee.id]),Ew.upload(ne,nn(ot),hc,Y)),Se.isShaderMaterial&&Se.uniformsNeedUpdate===!0&&(Ew.upload(ne,nn(ot),hc,Y),Se.uniformsNeedUpdate=!1),Se.isSpriteMaterial&&or.setValue(ne,"center",we.center),or.setValue(ne,"modelViewMatrix",we.modelViewMatrix),or.setValue(ne,"normalMatrix",we.normalMatrix),or.setValue(ne,"modelMatrix",we.matrixWorld),Se.isShaderMaterial||Se.isRawShaderMaterial){const Ws=Se.uniformsGroups;for(let sb=0,xW=Ws.length;sb0&&Y.useMultisampledRTT(ee)===!1?we=ue.get(ee).__webglMultisampledFramebuffer:Array.isArray(ht)?we=ht[Ee]:we=ht,S.copy(ee.viewport),L.copy(ee.scissor),O=ee.scissorTest}else S.copy(W).multiplyScalar(P).floor(),L.copy(H).multiplyScalar(P).floor(),O=C;if(Z.bindFramebuffer(ne.FRAMEBUFFER,we)&&Se&&Z.drawBuffers(ee,we),Z.viewport(S),Z.scissor(L),Z.setScissorTest(O),Ne){const et=ue.get(ee.texture);ne.framebufferTexture2D(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ne.TEXTURE_CUBE_MAP_POSITIVE_X+ye,et.__webglTexture,Ee)}else if(Ke){const et=ue.get(ee.texture),ct=ye||0;ne.framebufferTextureLayer(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0,et.__webglTexture,Ee||0,ct)}M=-1},this.readRenderTargetPixels=function(ee,ye,Ee,Se,we,Ne,Ke){if(!(ee&&ee.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let qe=ue.get(ee).__webglFramebuffer;if(ee.isWebGLCubeRenderTarget&&Ke!==void 0&&(qe=qe[Ke]),qe){Z.bindFramebuffer(ne.FRAMEBUFFER,qe);try{const et=ee.texture,ct=et.format,ht=et.type;if(!le.textureFormatReadable(ct)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(ht)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ye>=0&&ye<=ee.width-Se&&Ee>=0&&Ee<=ee.height-we&&ne.readPixels(ye,Ee,Se,we,Ue.convert(ct),Ue.convert(ht),Ne)}finally{const et=B!==null?ue.get(B).__webglFramebuffer:null;Z.bindFramebuffer(ne.FRAMEBUFFER,et)}}},this.readRenderTargetPixelsAsync=async function(ee,ye,Ee,Se,we,Ne,Ke){if(!(ee&&ee.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let qe=ue.get(ee).__webglFramebuffer;if(ee.isWebGLCubeRenderTarget&&Ke!==void 0&&(qe=qe[Ke]),qe){const et=ee.texture,ct=et.format,ht=et.type;if(!le.textureFormatReadable(ct))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(ht))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(ye>=0&&ye<=ee.width-Se&&Ee>=0&&Ee<=ee.height-we){Z.bindFramebuffer(ne.FRAMEBUFFER,qe);const it=ne.createBuffer();ne.bindBuffer(ne.PIXEL_PACK_BUFFER,it),ne.bufferData(ne.PIXEL_PACK_BUFFER,Ne.byteLength,ne.STREAM_READ),ne.readPixels(ye,Ee,Se,we,Ue.convert(ct),Ue.convert(ht),0);const Vt=B!==null?ue.get(B).__webglFramebuffer:null;Z.bindFramebuffer(ne.FRAMEBUFFER,Vt);const un=ne.fenceSync(ne.SYNC_GPU_COMMANDS_COMPLETE,0);return ne.flush(),await $J(ne,un,4),ne.bindBuffer(ne.PIXEL_PACK_BUFFER,it),ne.getBufferSubData(ne.PIXEL_PACK_BUFFER,0,Ne),ne.deleteBuffer(it),ne.deleteSync(un),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(ee,ye=null,Ee=0){ee.isTexture!==!0&&(bw("WebGLRenderer: copyFramebufferToTexture function signature has changed."),ye=arguments[0]||null,ee=arguments[1]);const Se=Math.pow(2,-Ee),we=Math.floor(ee.image.width*Se),Ne=Math.floor(ee.image.height*Se),Ke=ye!==null?ye.x:0,qe=ye!==null?ye.y:0;Y.setTexture2D(ee,0),ne.copyTexSubImage2D(ne.TEXTURE_2D,Ee,0,0,Ke,qe,we,Ne),Z.unbindTexture()},this.copyTextureToTexture=function(ee,ye,Ee=null,Se=null,we=0){ee.isTexture!==!0&&(bw("WebGLRenderer: copyTextureToTexture function signature has changed."),Se=arguments[0]||null,ee=arguments[1],ye=arguments[2],we=arguments[3]||0,Ee=null);let Ne,Ke,qe,et,ct,ht;Ee!==null?(Ne=Ee.max.x-Ee.min.x,Ke=Ee.max.y-Ee.min.y,qe=Ee.min.x,et=Ee.min.y):(Ne=ee.image.width,Ke=ee.image.height,qe=0,et=0),Se!==null?(ct=Se.x,ht=Se.y):(ct=0,ht=0);const it=Ue.convert(ye.format),Vt=Ue.convert(ye.type);Y.setTexture2D(ye,0),ne.pixelStorei(ne.UNPACK_FLIP_Y_WEBGL,ye.flipY),ne.pixelStorei(ne.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ye.premultiplyAlpha),ne.pixelStorei(ne.UNPACK_ALIGNMENT,ye.unpackAlignment);const un=ne.getParameter(ne.UNPACK_ROW_LENGTH),yn=ne.getParameter(ne.UNPACK_IMAGE_HEIGHT),Zr=ne.getParameter(ne.UNPACK_SKIP_PIXELS),Gt=ne.getParameter(ne.UNPACK_SKIP_ROWS),ot=ne.getParameter(ne.UNPACK_SKIP_IMAGES),sr=ee.isCompressedTexture?ee.mipmaps[we]:ee.image;ne.pixelStorei(ne.UNPACK_ROW_LENGTH,sr.width),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,sr.height),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,qe),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,et),ee.isDataTexture?ne.texSubImage2D(ne.TEXTURE_2D,we,ct,ht,Ne,Ke,it,Vt,sr.data):ee.isCompressedTexture?ne.compressedTexSubImage2D(ne.TEXTURE_2D,we,ct,ht,sr.width,sr.height,it,sr.data):ne.texSubImage2D(ne.TEXTURE_2D,we,ct,ht,Ne,Ke,it,Vt,sr),ne.pixelStorei(ne.UNPACK_ROW_LENGTH,un),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,yn),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,Zr),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,Gt),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,ot),we===0&&ye.generateMipmaps&&ne.generateMipmap(ne.TEXTURE_2D),Z.unbindTexture()},this.copyTextureToTexture3D=function(ee,ye,Ee=null,Se=null,we=0){ee.isTexture!==!0&&(bw("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Ee=arguments[0]||null,Se=arguments[1]||null,ee=arguments[2],ye=arguments[3],we=arguments[4]||0);let Ne,Ke,qe,et,ct,ht,it,Vt,un;const yn=ee.isCompressedTexture?ee.mipmaps[we]:ee.image;Ee!==null?(Ne=Ee.max.x-Ee.min.x,Ke=Ee.max.y-Ee.min.y,qe=Ee.max.z-Ee.min.z,et=Ee.min.x,ct=Ee.min.y,ht=Ee.min.z):(Ne=yn.width,Ke=yn.height,qe=yn.depth,et=0,ct=0,ht=0),Se!==null?(it=Se.x,Vt=Se.y,un=Se.z):(it=0,Vt=0,un=0);const Zr=Ue.convert(ye.format),Gt=Ue.convert(ye.type);let ot;if(ye.isData3DTexture)Y.setTexture3D(ye,0),ot=ne.TEXTURE_3D;else if(ye.isDataArrayTexture||ye.isCompressedArrayTexture)Y.setTexture2DArray(ye,0),ot=ne.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ne.pixelStorei(ne.UNPACK_FLIP_Y_WEBGL,ye.flipY),ne.pixelStorei(ne.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ye.premultiplyAlpha),ne.pixelStorei(ne.UNPACK_ALIGNMENT,ye.unpackAlignment);const sr=ne.getParameter(ne.UNPACK_ROW_LENGTH),on=ne.getParameter(ne.UNPACK_IMAGE_HEIGHT),To=ne.getParameter(ne.UNPACK_SKIP_PIXELS),Ju=ne.getParameter(ne.UNPACK_SKIP_ROWS),fs=ne.getParameter(ne.UNPACK_SKIP_IMAGES);ne.pixelStorei(ne.UNPACK_ROW_LENGTH,yn.width),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,yn.height),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,et),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,ct),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,ht),ee.isDataTexture||ee.isData3DTexture?ne.texSubImage3D(ot,we,it,Vt,un,Ne,Ke,qe,Zr,Gt,yn.data):ye.isCompressedArrayTexture?ne.compressedTexSubImage3D(ot,we,it,Vt,un,Ne,Ke,qe,Zr,yn.data):ne.texSubImage3D(ot,we,it,Vt,un,Ne,Ke,qe,Zr,Gt,yn),ne.pixelStorei(ne.UNPACK_ROW_LENGTH,sr),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,on),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,To),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,Ju),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,fs),we===0&&ye.generateMipmaps&&ne.generateMipmap(ot),Z.unbindTexture()},this.initRenderTarget=function(ee){ue.get(ee).__webglFramebuffer===void 0&&Y.setupRenderTarget(ee)},this.initTexture=function(ee){ee.isCubeTexture?Y.setTextureCube(ee,0):ee.isData3DTexture?Y.setTexture3D(ee,0):ee.isDataArrayTexture||ee.isCompressedArrayTexture?Y.setTexture2DArray(ee,0):Y.setTexture2D(ee,0),Z.unbindTexture()},this.resetState=function(){x=0,b=0,B=null,Z.reset(),Ye.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ol}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===TR?"display-p3":"srgb",t.unpackColorSpace=bt.workingColorSpace===s1?"display-p3":"srgb"}}class Hg extends Ft{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new tr,this.environmentIntensity=1,this.environmentRotation=new tr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class ase{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=EC,this.updateRanges=[],this.version=0,this.uuid=ta()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let i=0,s=this.stride;i=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=r}reset(){this.list.length=0,this.index=0}}const bc=new ke,OE=new ke,dse=new ke,pse=new He(1,1,1),qL=new ke,kE=new a1,Rv=new Qn,HA=new Ei,Pp=new $,JL=new $,mse=new $,HE=new hse,hi=new hn,Uv=[];function gse(n,e,t=0){const r=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const i=n.count;for(let s=0;s65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new lt(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const r in t.attributes){if(!e.hasAttribute(r))throw new Error(`BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=t.getAttribute(r);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let r=0,i=t.length;r=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=r):(i=this._drawInfo.length,this._drawInfo.push(r));const s=this._matricesTexture,o=s.image.data;dse.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(pse.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,t=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),A=c!==null;if(A&&(r===-1?i.indexCount=c.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const u=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:A?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new Qn,sphereInitialized:!1,sphere:new Ei}),this.setGeometryAt(u,e),u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const h in r.attributes){const d=t.getAttribute(h),m=r.getAttribute(h);gse(d,m,l);const g=d.itemSize;for(let p=d.count,v=c;p=t.length||t[e].active===!1?this:(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.box,s=this.geometry;if(r.boxInitialized===!1){i.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,A=l.start+l.count;c=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,Rv),Rv.getCenter(i.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let A=l.start,u=l.start+l.count;A=r.length||r[e].active===!1?this:(t.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const r=this._drawInfo,i=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?null:t.fromArray(i,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const r=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(i,e*4),r.needsUpdate=!0,this)}getColorAt(e,t){const r=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:t.fromArray(r,e*4)}setVisibleAt(e,t){const r=this._drawInfo;return e>=r.length||r[e].active===!1||r[e].visible===t?this:(r[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}setGeometryIdAt(e,t){const r=this._drawInfo;return e>=r.length||r[e].active===!1||t<0||t>=this._geometryCount?null:(r[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const r=this._drawRanges[e];return t.start=r.start,t.count=r.count,t}raycast(e,t){const r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,o=this.geometry;hi.material=this.material,hi.geometry.index=o.index,hi.geometry.attributes=o.attributes,hi.geometry.boundingBox===null&&(hi.geometry.boundingBox=new Qn),hi.geometry.boundingSphere===null&&(hi.geometry.boundingSphere=new Ei);for(let a=0,l=r.length;a({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,A=this._multiDrawCounts,u=this._drawRanges,f=this.perObjectFrustumCulled,h=this._indirectTexture,d=h.image.data;f&&(qL.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),kE.setFromProjectionMatrix(qL,e.coordinateSystem));let m=0;if(this.sortObjects){OE.copy(this.matrixWorld).invert(),Pp.setFromMatrixPosition(r.matrixWorld).applyMatrix4(OE),JL.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(OE);for(let v=0,w=l.length;v0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;sr)return;QE.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(QE);if(!(le.far))return{distance:l,point:tD.clone().applyMatrix4(n.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:n}}const nD=new $,rD=new $;class g0 extends Xd{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[];for(let i=0,s=t.count;i0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class zE extends Hn{constructor(e,t,r,i,s,o,a,l,c,A,u,f){super(null,o,a,l,c,A,i,s,u,f),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class _se extends Hn{constructor(e,t,r,i,s,o,a,l,c){super(e,t,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class xse{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let i=0;const s=r.length;let o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const A=r[i],f=r[i+1]-A,h=(o-A)/f;return(i+h)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new je:new $);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new $,i=[],s=[],o=[],a=new $,l=new ke;for(let h=0;h<=e;h++){const d=h/e;i[h]=this.getTangentAt(d,new $)}s[0]=new $,o[0]=new $;let c=Number.MAX_VALUE;const A=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);A<=c&&(c=A,r.set(1,0,0)),u<=c&&(c=u,r.set(0,1,0)),f<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let h=1;h<=e;h++){if(s[h]=s[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(i[h-1],i[h]),a.length()>Number.EPSILON){a.normalize();const d=Math.acos(xr(i[h-1].dot(i[h]),-1,1));s[h].applyMatrix4(l.makeRotationAxis(a,d))}o[h].crossVectors(i[h],s[h])}if(t===!0){let h=Math.acos(xr(s[0].dot(s[e]),-1,1));h/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(h=-h);for(let d=1;d<=e;d++)s[d].applyMatrix4(l.makeRotationAxis(i[d],h*d)),o[d].crossVectors(i[d],s[d])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class A1 extends Zt{constructor(e=1,t=1,r=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const A=[],u=[],f=[],h=[];let d=0;const m=[],g=r/2;let p=0;v(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(A),this.setAttribute("position",new xn(u,3)),this.setAttribute("normal",new xn(f,3)),this.setAttribute("uv",new xn(h,2));function v(){const _=new $,x=new $;let b=0;const B=(t-e)/r;for(let M=0;M<=s;M++){const I=[],S=M/s,L=S*(t-e)+e;for(let O=0;O<=i;O++){const T=O/i,y=T*l+a,E=Math.sin(y),U=Math.cos(y);x.x=L*E,x.y=-S*r+g,x.z=L*U,u.push(x.x,x.y,x.z),_.set(E,B,U).normalize(),f.push(_.x,_.y,_.z),h.push(T,1-S),I.push(d++)}m.push(I)}for(let M=0;M0&&(A.push(S,L,T),b+=3),t>0&&(A.push(L,O,T),b+=3)}c.addGroup(p,b,0),p+=b}function w(_){const x=d,b=new je,B=new $;let M=0;const I=_===!0?e:t,S=_===!0?1:-1;for(let O=1;O<=i;O++)u.push(0,g*S,0),f.push(0,S,0),h.push(.5,.5),d++;const L=d;for(let O=0;O<=i;O++){const y=O/i*l+a,E=Math.cos(y),U=Math.sin(y);B.x=I*U,B.y=g*S,B.z=I*E,u.push(B.x,B.y,B.z),f.push(0,S,0),b.x=E*.5+.5,b.y=U*.5*S+.5,h.push(b.x,b.y),d++}for(let O=0;O80*t){a=c=n[0],l=A=n[1];for(let d=t;dc&&(c=u),f>A&&(A=f);h=Math.max(c-a,A-l),h=h!==0?32767/h:0}return zg(s,o,t,a,l,h,0),o}};function Tz(n,e,t,r,i){let s,o;if(i===kse(n,e,t,r)>0)for(s=e;s=e;s-=r)o=oD(s,n[s],n[s+1],o);return o&&u1(o,o.next)&&(Vg(o),o=o.next),o}function Ru(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(u1(t,t.next)||Kn(t.prev,t,t.next)===0)){if(Vg(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function zg(n,e,t,r,i,s,o){if(!n)return;!o&&s&&Fse(n,r,i,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?Bse(n,r,i,s):Ese(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Vg(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=Sse(Ru(n),e,t),zg(n,e,t,r,i,s,2)):o===2&&Mse(n,e,t,r,i,s):zg(Ru(n),e,t,r,i,s,1);break}}}function Ese(n){const e=n.prev,t=n,r=n.next;if(Kn(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,c=r.y,A=is?i>o?i:o:s>o?s:o,h=a>l?a>c?a:c:l>c?l:c;let d=r.next;for(;d!==e;){if(d.x>=A&&d.x<=f&&d.y>=u&&d.y<=h&&Lh(i,a,s,l,o,c,d.x,d.y)&&Kn(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Bse(n,e,t,r){const i=n.prev,s=n,o=n.next;if(Kn(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,A=i.y,u=s.y,f=o.y,h=al?a>c?a:c:l>c?l:c,g=A>u?A>f?A:f:u>f?u:f,p=MC(h,d,e,t,r),v=MC(m,g,e,t,r);let w=n.prevZ,_=n.nextZ;for(;w&&w.z>=p&&_&&_.z<=v;){if(w.x>=h&&w.x<=m&&w.y>=d&&w.y<=g&&w!==i&&w!==o&&Lh(a,A,l,u,c,f,w.x,w.y)&&Kn(w.prev,w,w.next)>=0||(w=w.prevZ,_.x>=h&&_.x<=m&&_.y>=d&&_.y<=g&&_!==i&&_!==o&&Lh(a,A,l,u,c,f,_.x,_.y)&&Kn(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;w&&w.z>=p;){if(w.x>=h&&w.x<=m&&w.y>=d&&w.y<=g&&w!==i&&w!==o&&Lh(a,A,l,u,c,f,w.x,w.y)&&Kn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;_&&_.z<=v;){if(_.x>=h&&_.x<=m&&_.y>=d&&_.y<=g&&_!==i&&_!==o&&Lh(a,A,l,u,c,f,_.x,_.y)&&Kn(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Sse(n,e,t){let r=n;do{const i=r.prev,s=r.next.next;!u1(i,s)&&Iz(i,r,r.next,s)&&Gg(i,s)&&Gg(s,i)&&(e.push(i.i/t|0),e.push(r.i/t|0),e.push(s.i/t|0),Vg(r),Vg(r.next),r=n=s),r=r.next}while(r!==n);return Ru(r)}function Mse(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Dse(o,a)){let l=Rz(o,a);o=Ru(o,o.next),l=Ru(l,l.next),zg(o,e,t,r,i,s,0),zg(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function Cse(n,e,t,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){const f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>r&&(r=f,i=t.x=t.x&&t.x>=l&&s!==t.x&&Lh(oi.x||t.x===i.x&&Use(i,t)))&&(i=t,A=u)),t=t.next;while(t!==a);return i}function Use(n,e){return Kn(n.prev,n,e.prev)<0&&Kn(e.next,n,n.next)<0}function Fse(n,e,t,r){let i=n;do i.z===0&&(i.z=MC(i.x,i.y,e,t,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,Pse(i)}function Pse(n){let e,t,r,i,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(i=t,t=t.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;t=r}s.nextZ=null,c*=2}while(o>1);return n}function MC(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function Lse(n){let e=n,t=n;do(e.x=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function Dse(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!Nse(n,e)&&(Gg(n,e)&&Gg(e,n)&&Ose(n,e)&&(Kn(n.prev,n,e.prev)||Kn(n,e.prev,e))||u1(n,e)&&Kn(n.prev,n,n.next)>0&&Kn(e.prev,e,e.next)>0)}function Kn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function u1(n,e){return n.x===e.x&&n.y===e.y}function Iz(n,e,t,r){const i=Ov(Kn(n,e,t)),s=Ov(Kn(n,e,r)),o=Ov(Kn(t,r,n)),a=Ov(Kn(t,r,e));return!!(i!==s&&o!==a||i===0&&Nv(n,t,e)||s===0&&Nv(n,r,e)||o===0&&Nv(t,n,r)||a===0&&Nv(t,e,r))}function Nv(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Ov(n){return n>0?1:n<0?-1:0}function Nse(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&Iz(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function Gg(n,e){return Kn(n.prev,n,n.next)<0?Kn(n,e,n.next)>=0&&Kn(n,n.prev,e)>=0:Kn(n,e,n.prev)<0||Kn(n,n.next,e)<0}function Ose(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function Rz(n,e){const t=new CC(n.i,n.x,n.y),r=new CC(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function oD(n,e,t,r){const i=new CC(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Vg(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function CC(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function kse(n,e,t,r){let i=0;for(let s=e,o=t-r;s2&&n[e-1].equals(n[0])&&n.pop()}function lD(n,e){for(let t=0;t0)&&h.push(w,_,b),(p!==r-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class GE extends ss{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new He(16777215),this.specular=new He(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wd,this.normalScale=new je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tr,this.combine=n1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class Hse extends ss{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wd,this.normalScale=new je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Qse extends ss{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new He(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Wd,this.normalScale=new je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tr,this.combine=n1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function kv(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function zse(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Gse(n){function e(i,s){return n[i]-n[s]}const t=n.length,r=new Array(t);for(let i=0;i!==t;++i)r[i]=i;return r.sort(e),r}function cD(n,e,t){const r=n.length,i=new n.constructor(r);for(let s=0,o=0;o!==r;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=n[a+l]}return i}function Uz(n,e,t,r){let i=1,s=n[0];for(;s!==void 0&&s[r]===void 0;)s=n[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=n[i++];while(s!==void 0)}class v0{constructor(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let r=this._cachedIndex,i=t[r],s=t[r-1];e:{t:{let o;n:{r:if(!(e=s)){const a=t[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&zse(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===aE,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*r)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}rl.prototype.TimeBufferType=Float32Array;rl.prototype.ValueBufferType=Float32Array;rl.prototype.DefaultInterpolation=Ud;class Yd extends rl{constructor(e,t,r){super(e,t,r)}}Yd.prototype.ValueTypeName="bool";Yd.prototype.ValueBufferType=Array;Yd.prototype.DefaultInterpolation=Rd;Yd.prototype.InterpolantFactoryMethodLinear=void 0;Yd.prototype.InterpolantFactoryMethodSmooth=void 0;class Pz extends rl{}Pz.prototype.ValueTypeName="color";class Uu extends rl{}Uu.prototype.ValueTypeName="number";class Wse extends v0{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(i-t);let c=e*a;for(let A=c+a;c!==A;c+=4)tt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class qa extends rl{InterpolantFactoryMethodLinear(e){return new Wse(this.times,this.values,this.getValueSize(),e)}}qa.prototype.ValueTypeName="quaternion";qa.prototype.InterpolantFactoryMethodSmooth=void 0;class $d extends rl{constructor(e,t,r){super(e,t,r)}}$d.prototype.ValueTypeName="string";$d.prototype.ValueBufferType=Array;$d.prototype.DefaultInterpolation=Rd;$d.prototype.InterpolantFactoryMethodLinear=void 0;$d.prototype.InterpolantFactoryMethodSmooth=void 0;class tc extends rl{}tc.prototype.ValueTypeName="vector";class Fu{constructor(e="",t=-1,r=[],i=CR){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=ta(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(Xse(r[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(rl.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const u=A[1];let f=i[u];f||(i[u]=f=[]),f.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(u,f,h,d,m){if(h.length!==0){const g=[],p=[];Uz(h,g,p,d),g.length!==0&&m.push(new u(f,g,p))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if(hl[e]!==void 0){hl[e].push({onLoad:t,onProgress:r,onError:i});return}hl[e]=[],hl[e].push({onLoad:t,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const A=hl[e],u=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),h=f?parseInt(f):0,d=h!==0;let m=0;const g=new ReadableStream({start(p){v();function v(){u.read().then(({done:w,value:_})=>{if(w)p.close();else{m+=_.byteLength;const x=new ProgressEvent("progress",{lengthComputable:d,loaded:m,total:h});for(let b=0,B=A.length;b{p.error(w)})}}});return new Response(g)}else throw new $se(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(A=>new DOMParser().parseFromString(A,a));case"json":return c.json();default:if(a===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,h=new TextDecoder(f);return c.arrayBuffer().then(d=>h.decode(d))}}}).then(c=>{Kc.add(e,c);const A=hl[e];delete hl[e];for(let u=0,f=A.length;u{const A=hl[e];if(A===void 0)throw this.manager.itemError(e),c;delete hl[e];for(let u=0,f=A.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Dz extends nc{constructor(e){super(e)}load(e,t,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Kc.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=kg("img");function l(){A(),Kc.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){A(),i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}function A(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class ju extends nc{constructor(e){super(e)}load(e,t,r,i){const s=new Hn,o=new Dz(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,i),s}}class f1 extends Ft{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new He(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const VE=new ke,AD=new $,uD=new $;class HR{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new je(512,512),this.map=null,this.mapPass=null,this.matrix=new ke,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new a1,this._frameExtents=new je(1,1),this._viewportCount=1,this._viewports=[new Ut(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;AD.setFromMatrixPosition(e.matrixWorld),t.position.copy(AD),uD.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(uD),t.updateMatrixWorld(),VE.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(VE),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(VE)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class Zse extends HR{constructor(){super(new Ur(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=Fd*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class Nz extends f1{constructor(e,t,r=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ft.DEFAULT_UP),this.updateMatrix(),this.target=new Ft,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new Zse}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const fD=new ke,Dp=new $,jE=new $;class qse extends HR{constructor(){super(new Ur(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new je(4,2),this._viewportCount=6,this._viewports=[new Ut(2,1,1,1),new Ut(0,1,1,1),new Ut(3,1,1,1),new Ut(1,1,1,1),new Ut(3,0,1,1),new Ut(1,0,1,1)],this._cubeDirections=[new $(1,0,0),new $(-1,0,0),new $(0,0,1),new $(0,0,-1),new $(0,1,0),new $(0,-1,0)],this._cubeUps=[new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,0,1),new $(0,0,-1)]}updateMatrices(e,t=0){const r=this.camera,i=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Dp.setFromMatrixPosition(e.matrixWorld),r.position.copy(Dp),jE.copy(r.position),jE.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(jE),r.updateMatrixWorld(),i.makeTranslation(-Dp.x,-Dp.y,-Dp.z),fD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(fD)}}class TC extends f1{constructor(e,t,r=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new qse}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class Jse extends HR{constructor(){super(new p0(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class QR extends f1{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ft.DEFAULT_UP),this.updateMatrix(),this.target=new Ft,this.shadow=new Jse}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Oz extends f1{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class id{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Kc.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Kc.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Kc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Kc.add(e,l),s.manager.itemStart(e)}}class kz{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=hD(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=hD();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function hD(){return performance.now()}class toe{constructor(e,t,r){this.binding=e,this.valueSize=r;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const r=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)r[s+a]=r[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(r,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,r=this.valueSize,i=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,r=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(r,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(let s=r,o=i;s!==o;++s)t[s]=t[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,i){tt.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;tt.multiplyQuaternionsFlat(e,o,e,t,e,r),tt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,t,r,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[r+o]*i}}}const zR="\\[\\]\\.:\\/",noe=new RegExp("["+zR+"]","g"),GR="[^"+zR+"]",roe="[^"+zR.replace("\\.","")+"]",ioe=/((?:WC+[\/:])*)/.source.replace("WC",GR),soe=/(WCOD+)?/.source.replace("WCOD",roe),ooe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",GR),aoe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",GR),loe=new RegExp("^"+ioe+soe+ooe+aoe+"$"),coe=["material","materials","bones","map"];class Aoe{constructor(e,t,r){const i=r||Mt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class Mt{constructor(e,t,r){this.path=t,this.parsedPath=r||Mt.parseTrackName(t),this.node=Mt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new Mt.Composite(e,t,r):new Mt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(noe,"")}static parseTrackName(e){const t=loe.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);coe.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case wJ:for(let A=0,u=l.length;A!==u;++A)l[A].evaluate(o),c[A].accumulateAdditive(a);break;case CR:default:for(let A=0,u=l.length;A!==u;++A)l[A].evaluate(o),c[A].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===yJ;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===gJ){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,r){const i=this._interpolantSettings;r?(i.endingStart=Fh,i.endingEnd=Fh):(e?i.endingStart=this.zeroSlopeAtStart?Fh:Uh:i.endingStart=I_,t?i.endingEnd=this.zeroSlopeAtEnd?Fh:Uh:i.endingEnd=I_)}_scheduleFading(e,t,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}}const foe=new Float32Array(1);class hoe extends TA{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let A=c[l];A===void 0&&(A={},c[l]=A);for(let u=0;u!==s;++u){const f=i[u],h=f.name;let d=A[h];if(d!==void 0)++d.referenceCount,o[u]=d;else{if(d=o[u],d!==void 0){d._cacheIndex===null&&(++d.referenceCount,this._addInactiveBinding(d,l,h));continue}const m=t&&t._propertyBindings[u].binding.parsedPath;d=new toe(Mt.create(r,h,m),f.ValueTypeName,f.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,l,h),o[u]=d}a[u].resultBuffer=d.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;tMath.PI&&(r-=zi),i<-Math.PI?i+=zi:i>Math.PI&&(i-=zi),r<=i?this._spherical.theta=Math.max(r,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(r+i)/2?Math.max(r,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(Tr.setFromSpherical(this._spherical),Tr.applyQuaternion(this._quatInverse),t.copy(this.target).add(Tr),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=Tr.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new $(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new $(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=Tr.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(Qv.origin.copy(this.object.position),Qv.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Qv.direction))WE||8*(1-this._lastQuaternion.dot(this.object.quaternion))>WE||this._lastTargetPosition.distanceToSquared(this.target)>WE?(this.dispatchEvent(yD),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?zi/60*this.autoRotateSpeed*e:zi/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Tr.setFromMatrixColumn(t,0),Tr.multiplyScalar(-e),this._panOffset.add(Tr)}_panUp(e,t){this.screenSpacePanning===!0?Tr.setFromMatrixColumn(t,1):(Tr.setFromMatrixColumn(t,0),Tr.crossVectors(this.object.up,Tr)),Tr.multiplyScalar(e),this._panOffset.add(Tr)}_pan(e,t){const r=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;Tr.copy(i).sub(this.target);let s=Tr.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/r.clientHeight,this.object.matrix),this._panUp(2*t*s/r.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const r=this.domElement.getBoundingClientRect(),i=e-r.left,s=t-r.top,o=r.width,a=r.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(zi*this._rotateDelta.x/t.clientHeight),this._rotateUp(zi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(zi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(-zi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(zi*this.rotateSpeed/this.domElement.clientHeight):this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(-zi*this.rotateSpeed/this.domElement.clientHeight):this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(r,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(r,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),i=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(zi*this._rotateDelta.x/t.clientHeight),this._rotateUp(zi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(r,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t=2.0 are supported."));return}const c=new lae(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let A=0;A=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function Ioe(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Rt={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 Roe{constructor(e){this.parser=e,this.name=Rt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class joe{constructor(e){this.parser=e,this.name=Rt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.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 Woe{constructor(e){this.parser=e,this.name=Rt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.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 Koe{constructor(e){this.name=Rt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.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 s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,A=i.count,u=i.byteStride,f=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(A,u,f,i.mode,i.filter).then(function(h){return h.buffer}):o.ready.then(function(){const h=new ArrayBuffer(A*u);return o.decodeGltfBuffer(new Uint8Array(h),A,u,f,i.mode,i.filter),h})})}else return null}}let Xoe=class{constructor(e){this.name=Rt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=t.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==Js.TRIANGLES&&c.mode!==Js.TRIANGLE_STRIP&&c.mode!==Js.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(A=>(l[c]=A,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const A=c.pop(),u=A.isGroup?A.children:[A],f=c[0].count,h=[];for(const d of u){const m=new ke,g=new $,p=new tt,v=new $(1,1,1),w=new c1(d.geometry,d.material,f);for(let _=0;_0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const aae=new ke;class lae{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Ioe,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 r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new ju(this.options.manager):this.textureLoader=new eoe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new kR(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 r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return QA(s,a,i),Tl(a,i),Promise.all(r._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||[],r=this.json.meshes||[];for(let i=0,s=t.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,A]of o.children.entries())s(A,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&g.setY(I,b[B*l+1]),l>=3&&g.setZ(I,b[B*l+2]),l>=4&&g.setW(I,b[B*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=d}return g})}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,r){const i=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,r).then(function(A){A.flipY=!1,A.name=o.name||a.name||"",A.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(A.name=a.uri);const f=(s.samplers||{})[o.sampler]||{};return A.magFilter=bD[f.magFilter]||Xi,A.minFilter=bD[f.minFilter]||Da,A.wrapS=ED[f.wrapS]||Hs,A.wrapT=ED[f.wrapT]||Hs,i.associations.set(A,{textures:e}),A}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(u){c=!0;const f=new Blob([u],{type:o.mimeType});return l=a.createObjectURL(f),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const A=Promise.resolve(l).then(function(u){return new Promise(function(f,h){let d=f;t.isImageBitmapLoader===!0&&(d=function(m){const g=new Hn(m);g.needsUpdate=!0,f(g)}),t.load(id.resolveURL(u,s.path),d,void 0,h)})}).then(function(u){return c===!0&&a.revokeObjectURL(l),Tl(u,o),u.userData.mimeType=o.mimeType||oae(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=A,A}assignTexture(e,t,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[Rt.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[Rt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Rt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Cz,ss.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new lc,ss.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(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(r))),r=l}e.material=r}getMaterialType(){return Ld}loadMaterial(e){const t=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[Rt.KHR_MATERIALS_UNLIT]){const u=i[Rt.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),c.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new He(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Xr),a.opacity=f[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",u.baseColorTexture,kt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=wi);const A=s.alphaMode||XE.OPAQUE;if(A===XE.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,A===XE.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Zi&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new je(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&o!==Zi&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Zi){const u=s.emissiveFactor;a.emissive=new He().setRGB(u[0],u[1],u[2],Xr)}return s.emissiveTexture!==void 0&&o!==Zi&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,kt)),Promise.all(c).then(function(){const u=new o(a);return s.name&&(u.name=s.name),Tl(u,s),t.associations.set(u,{materials:e}),s.extensions&&QA(i,u,s),u})}createUniqueName(e){const t=Mt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[Rt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return BD(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&iae(p,s),p.name=t.createUniqueName(s.name||"mesh_"+e),Tl(p,s),g.extensions&&QA(i,p,g),t.assignFinalMaterial(p),u.push(p)}for(let h=0,d=u.length;h1?A=new ni:c.length===1?A=c[0]:A=new Ft,A!==c[0])for(let u=0,f=c.length;u{const u=new Map;for(const[f,h]of i.associations)(f instanceof ss||f instanceof Hn)&&u.set(f,h);return A.traverse(f=>{const h=i.associations.get(f);h!=null&&u.set(f,h)}),u};return i.associations=c(s),s})}_createAnimationTracks(e,t,r,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];Ec[s.path]===Ec.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(a);let c;switch(Ec[s.path]){case Ec.weights:c=Uu;break;case Ec.rotation:c=qa;break;case Ec.position:case Ec.scale:c=tc;break;default:switch(r.itemSize){case 1:c=Uu;break;case 2:case 3:default:c=tc;break}break}const A=i.interpolation!==void 0?tae[i.interpolation]:Ud,u=this._getArrayFromAccessor(r);for(let f=0,h=l.length;f=0&&(_[ce]=null,w[ce].disconnect(re))}for(let F=0;F=_.length){_.push(re),ce=ge;break}else if(_[ge]===null){_[ge]=re,ce=ge;break}if(ce===-1)break}const oe=w[ce];oe&&oe.connect(re)}}const R=new $,L=new $;function N(ee,F,re){R.setFromMatrixPosition(F.matrixWorld),L.setFromMatrixPosition(re.matrixWorld);const ce=R.distanceTo(L),oe=F.projectionMatrix.elements,ge=re.projectionMatrix.elements,me=oe[14]/(oe[10]-1),ve=oe[14]/(oe[10]+1),be=(oe[9]+1)/oe[5],ne=(oe[9]-1)/oe[5],k=(oe[8]-1)/oe[0],ae=(ge[8]+1)/ge[0],le=me*k,Z=me*ae,J=ce/(-k+ae),ue=J*-k;if(F.matrixWorld.decompose(ee.position,ee.quaternion,ee.scale),ee.translateX(ue),ee.translateZ(J),ee.matrixWorld.compose(ee.position,ee.quaternion,ee.scale),ee.matrixWorldInverse.copy(ee.matrixWorld).invert(),oe[10]===-1)ee.projectionMatrix.copy(F.projectionMatrix),ee.projectionMatrixInverse.copy(F.projectionMatrixInverse);else{const Y=me+J,G=ve+J,j=le-ue,se=Z+(ce-ue),fe=be*ve/G*Y,he=ne*ve/G*Y;ee.projectionMatrix.makePerspective(j,se,fe,he,Y,G),ee.projectionMatrixInverse.copy(ee.projectionMatrix).invert()}}function z(ee,F){F===null?ee.matrixWorld.copy(ee.matrix):ee.matrixWorld.multiplyMatrices(F.matrixWorld,ee.matrix),ee.matrixWorldInverse.copy(ee.matrixWorld).invert()}this.updateCamera=function(ee){if(i===null)return;let F=ee.near,re=ee.far;m.texture!==null&&(m.depthNear>0&&(F=m.depthNear),m.depthFar>0&&(re=m.depthFar)),M.near=S.near=B.near=F,M.far=S.far=B.far=re,(P!==M.near||D!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),P=M.near,D=M.far);const ce=ee.parent,oe=M.cameras;z(M,ce);for(let ge=0;ge0&&(g.alphaTest.value=p.alphaTest);const v=e.get(p),w=v.envMap,_=v.envMapRotation;w&&(g.envMap.value=w,QA.copy(_),QA.x*=-1,QA.y*=-1,QA.z*=-1,w.isCubeTexture&&w.isRenderTargetTexture===!1&&(QA.y*=-1,QA.z*=-1),g.envMapRotation.value.setFromMatrix4(cse.makeRotationFromEuler(QA)),g.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,g.reflectivity.value=p.reflectivity,g.ior.value=p.ior,g.refractionRatio.value=p.refractionRatio),p.lightMap&&(g.lightMap.value=p.lightMap,g.lightMapIntensity.value=p.lightMapIntensity,t(p.lightMap,g.lightMapTransform)),p.aoMap&&(g.aoMap.value=p.aoMap,g.aoMapIntensity.value=p.aoMapIntensity,t(p.aoMap,g.aoMapTransform))}function o(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform))}function a(g,p){g.dashSize.value=p.dashSize,g.totalSize.value=p.dashSize+p.gapSize,g.scale.value=p.scale}function l(g,p,v,w){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.size.value=p.size*v,g.scale.value=w*.5,p.map&&(g.map.value=p.map,t(p.map,g.uvTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function c(g,p){g.diffuse.value.copy(p.color),g.opacity.value=p.opacity,g.rotation.value=p.rotation,p.map&&(g.map.value=p.map,t(p.map,g.mapTransform)),p.alphaMap&&(g.alphaMap.value=p.alphaMap,t(p.alphaMap,g.alphaMapTransform)),p.alphaTest>0&&(g.alphaTest.value=p.alphaTest)}function A(g,p){g.specular.value.copy(p.specular),g.shininess.value=Math.max(p.shininess,1e-4)}function u(g,p){p.gradientMap&&(g.gradientMap.value=p.gradientMap)}function f(g,p){g.metalness.value=p.metalness,p.metalnessMap&&(g.metalnessMap.value=p.metalnessMap,t(p.metalnessMap,g.metalnessMapTransform)),g.roughness.value=p.roughness,p.roughnessMap&&(g.roughnessMap.value=p.roughnessMap,t(p.roughnessMap,g.roughnessMapTransform)),p.envMap&&(g.envMapIntensity.value=p.envMapIntensity)}function h(g,p,v){g.ior.value=p.ior,p.sheen>0&&(g.sheenColor.value.copy(p.sheenColor).multiplyScalar(p.sheen),g.sheenRoughness.value=p.sheenRoughness,p.sheenColorMap&&(g.sheenColorMap.value=p.sheenColorMap,t(p.sheenColorMap,g.sheenColorMapTransform)),p.sheenRoughnessMap&&(g.sheenRoughnessMap.value=p.sheenRoughnessMap,t(p.sheenRoughnessMap,g.sheenRoughnessMapTransform))),p.clearcoat>0&&(g.clearcoat.value=p.clearcoat,g.clearcoatRoughness.value=p.clearcoatRoughness,p.clearcoatMap&&(g.clearcoatMap.value=p.clearcoatMap,t(p.clearcoatMap,g.clearcoatMapTransform)),p.clearcoatRoughnessMap&&(g.clearcoatRoughnessMap.value=p.clearcoatRoughnessMap,t(p.clearcoatRoughnessMap,g.clearcoatRoughnessMapTransform)),p.clearcoatNormalMap&&(g.clearcoatNormalMap.value=p.clearcoatNormalMap,t(p.clearcoatNormalMap,g.clearcoatNormalMapTransform),g.clearcoatNormalScale.value.copy(p.clearcoatNormalScale),p.side===oi&&g.clearcoatNormalScale.value.negate())),p.dispersion>0&&(g.dispersion.value=p.dispersion),p.iridescence>0&&(g.iridescence.value=p.iridescence,g.iridescenceIOR.value=p.iridescenceIOR,g.iridescenceThicknessMinimum.value=p.iridescenceThicknessRange[0],g.iridescenceThicknessMaximum.value=p.iridescenceThicknessRange[1],p.iridescenceMap&&(g.iridescenceMap.value=p.iridescenceMap,t(p.iridescenceMap,g.iridescenceMapTransform)),p.iridescenceThicknessMap&&(g.iridescenceThicknessMap.value=p.iridescenceThicknessMap,t(p.iridescenceThicknessMap,g.iridescenceThicknessMapTransform))),p.transmission>0&&(g.transmission.value=p.transmission,g.transmissionSamplerMap.value=v.texture,g.transmissionSamplerSize.value.set(v.width,v.height),p.transmissionMap&&(g.transmissionMap.value=p.transmissionMap,t(p.transmissionMap,g.transmissionMapTransform)),g.thickness.value=p.thickness,p.thicknessMap&&(g.thicknessMap.value=p.thicknessMap,t(p.thicknessMap,g.thicknessMapTransform)),g.attenuationDistance.value=p.attenuationDistance,g.attenuationColor.value.copy(p.attenuationColor)),p.anisotropy>0&&(g.anisotropyVector.value.set(p.anisotropy*Math.cos(p.anisotropyRotation),p.anisotropy*Math.sin(p.anisotropyRotation)),p.anisotropyMap&&(g.anisotropyMap.value=p.anisotropyMap,t(p.anisotropyMap,g.anisotropyMapTransform))),g.specularIntensity.value=p.specularIntensity,g.specularColor.value.copy(p.specularColor),p.specularColorMap&&(g.specularColorMap.value=p.specularColorMap,t(p.specularColorMap,g.specularColorMapTransform)),p.specularIntensityMap&&(g.specularIntensityMap.value=p.specularIntensityMap,t(p.specularIntensityMap,g.specularIntensityMapTransform))}function d(g,p){p.matcap&&(g.matcap.value=p.matcap)}function m(g,p){const v=e.get(p).light;g.referencePosition.value.setFromMatrixPosition(v.matrixWorld),g.nearDistance.value=v.shadow.camera.near,g.farDistance.value=v.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function use(n,e,t,r){let i={},s={},o=[];const a=n.getParameter(n.MAX_UNIFORM_BUFFER_BINDINGS);function l(v,w){const _=w.program;r.uniformBlockBinding(v,_)}function c(v,w){let _=i[v.id];_===void 0&&(d(v),_=A(v),i[v.id]=_,v.addEventListener("dispose",g));const x=w.program;r.updateUBOMapping(v,x);const b=e.render.frame;s[v.id]!==b&&(f(v),s[v.id]=b)}function A(v){const w=u();v.__bindingPointIndex=w;const _=n.createBuffer(),x=v.__size,b=v.usage;return n.bindBuffer(n.UNIFORM_BUFFER,_),n.bufferData(n.UNIFORM_BUFFER,x,b),n.bindBuffer(n.UNIFORM_BUFFER,null),n.bindBufferBase(n.UNIFORM_BUFFER,w,_),_}function u(){for(let v=0;v0&&(_+=x-b),v.__size=_,v.__cache={},this}function m(v){const w={boundary:0,storage:0};return typeof v=="number"||typeof v=="boolean"?(w.boundary=4,w.storage=4):v.isVector2?(w.boundary=8,w.storage=8):v.isVector3||v.isColor?(w.boundary=16,w.storage=12):v.isVector4?(w.boundary=16,w.storage=16):v.isMatrix3?(w.boundary=48,w.storage=48):v.isMatrix4?(w.boundary=64,w.storage=64):v.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",v),w}function g(v){const w=v.target;w.removeEventListener("dispose",g);const _=o.indexOf(w.__bindingPointIndex);o.splice(_,1),n.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function p(){for(const v in i)n.deleteBuffer(i[v]);o=[],i={},s={}}return{bind:l,update:c,dispose:p}}class v0{constructor(e={}){const{canvas:t=ZJ(),context:r=null,depth:i=!0,stencil:s=!1,alpha:o=!1,antialias:a=!1,premultipliedAlpha:l=!0,preserveDrawingBuffer:c=!1,powerPreference:A="default",failIfMajorPerformanceCaveat:u=!1}=e;this.isWebGLRenderer=!0;let f;if(r!==null){if(typeof WebGLRenderingContext<"u"&&r instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");f=r.getContextAttributes().alpha}else f=o;const h=new Uint32Array(4),d=new Int32Array(4);let m=null,g=null;const p=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this._outputColorSpace=kt,this.toneMapping=uA,this.toneMappingExposure=1;const w=this;let _=!1,x=0,b=0,B=null,S=-1,I=null;const M=new Ut,P=new Ut;let D=null;const T=new He(0);let y=0,E=t.width,R=t.height,L=1,N=null,z=null;const W=new Ut(0,0,E,R),H=new Ut(0,0,E,R);let C=!1;const K=new c1;let ee=!1,F=!1;const re=new ke,ce=new ke,oe=new $,ge=new Ut,me={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let ve=!1;function be(){return B===null?L:1}let ne=r;function k(te,ye){return t.getContext(te,ye)}try{const te={alpha:!0,depth:i,stencil:s,antialias:a,premultipliedAlpha:l,preserveDrawingBuffer:c,powerPreference:A,failIfMajorPerformanceCaveat:u};if("setAttribute"in t&&t.setAttribute("data-engine",`three.js r${nc}`),t.addEventListener("webglcontextlost",Ce,!1),t.addEventListener("webglcontextrestored",Re,!1),t.addEventListener("webglcontextcreationerror",Oe,!1),ne===null){const ye="webgl2";if(ne=k(ye,te),ne===null)throw k(ye)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(te){throw console.error("THREE.WebGLRenderer: "+te.message),te}let ae,le,Z,J,ue,Y,G,j,se,fe,he,Be,V,U,O,X,ie,pe,de,Ie,Le,Ue,Ye,Ae;function Fe(){ae=new gre(ne),ae.init(),Ue=new nse(ne,ae),le=new ure(ne,ae,e,Ue),Z=new Jie(ne),le.reverseDepthBuffer&&Z.buffers.depth.setReversed(!0),J=new wre(ne),ue=new Oie,Y=new tse(ne,ae,Z,ue,le,Ue,J),G=new hre(w),j=new mre(w),se=new Mee(ne),Ye=new cre(ne,se),fe=new vre(ne,se,J,Ye),he=new xre(ne,fe,se,J),de=new _re(ne,le,Y),X=new fre(ue),Be=new Nie(w,G,j,ae,le,Ye,X),V=new Ase(w,ue),U=new Hie,O=new Wie(ae),pe=new lre(w,G,j,Z,he,f,l),ie=new Zie(w,he,le),Ae=new use(ne,J,le,Z),Ie=new Are(ne,ae,J),Le=new yre(ne,ae,J),J.programs=Be.programs,w.capabilities=le,w.extensions=ae,w.properties=ue,w.renderLists=U,w.shadowMap=ie,w.state=Z,w.info=J}Fe();const Me=new lse(w,ne);this.xr=Me,this.getContext=function(){return ne},this.getContextAttributes=function(){return ne.getContextAttributes()},this.forceContextLoss=function(){const te=ae.get("WEBGL_lose_context");te&&te.loseContext()},this.forceContextRestore=function(){const te=ae.get("WEBGL_lose_context");te&&te.restoreContext()},this.getPixelRatio=function(){return L},this.setPixelRatio=function(te){te!==void 0&&(L=te,this.setSize(E,R,!1))},this.getSize=function(te){return te.set(E,R)},this.setSize=function(te,ye,Ee=!0){if(Me.isPresenting){console.warn("THREE.WebGLRenderer: Can't change size while VR device is presenting.");return}E=te,R=ye,t.width=Math.floor(te*L),t.height=Math.floor(ye*L),Ee===!0&&(t.style.width=te+"px",t.style.height=ye+"px"),this.setViewport(0,0,te,ye)},this.getDrawingBufferSize=function(te){return te.set(E*L,R*L).floor()},this.setDrawingBufferSize=function(te,ye,Ee){E=te,R=ye,L=Ee,t.width=Math.floor(te*Ee),t.height=Math.floor(ye*Ee),this.setViewport(0,0,te,ye)},this.getCurrentViewport=function(te){return te.copy(M)},this.getViewport=function(te){return te.copy(W)},this.setViewport=function(te,ye,Ee,Se){te.isVector4?W.set(te.x,te.y,te.z,te.w):W.set(te,ye,Ee,Se),Z.viewport(M.copy(W).multiplyScalar(L).round())},this.getScissor=function(te){return te.copy(H)},this.setScissor=function(te,ye,Ee,Se){te.isVector4?H.set(te.x,te.y,te.z,te.w):H.set(te,ye,Ee,Se),Z.scissor(P.copy(H).multiplyScalar(L).round())},this.getScissorTest=function(){return C},this.setScissorTest=function(te){Z.setScissorTest(C=te)},this.setOpaqueSort=function(te){N=te},this.setTransparentSort=function(te){z=te},this.getClearColor=function(te){return te.copy(pe.getClearColor())},this.setClearColor=function(){pe.setClearColor.apply(pe,arguments)},this.getClearAlpha=function(){return pe.getClearAlpha()},this.setClearAlpha=function(){pe.setClearAlpha.apply(pe,arguments)},this.clear=function(te=!0,ye=!0,Ee=!0){let Se=0;if(te){let we=!1;if(B!==null){const Ne=B.texture.format;we=Ne===IR||Ne===TR||Ne===o1}if(we){const Ne=B.texture.type,Ke=Ne===rc||Ne===yA||Ne===Hg||Ne===Rd||Ne===SR||Ne===MR,qe=pe.getClearColor(),et=pe.getClearAlpha(),ct=qe.r,ht=qe.g,it=qe.b;Ke?(h[0]=ct,h[1]=ht,h[2]=it,h[3]=et,ne.clearBufferuiv(ne.COLOR,0,h)):(d[0]=ct,d[1]=ht,d[2]=it,d[3]=et,ne.clearBufferiv(ne.COLOR,0,d))}else Se|=ne.COLOR_BUFFER_BIT}ye&&(Se|=ne.DEPTH_BUFFER_BIT,ne.clearDepth(this.capabilities.reverseDepthBuffer?0:1)),Ee&&(Se|=ne.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),ne.clear(Se)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener("webglcontextlost",Ce,!1),t.removeEventListener("webglcontextrestored",Re,!1),t.removeEventListener("webglcontextcreationerror",Oe,!1),U.dispose(),O.dispose(),ue.dispose(),G.dispose(),j.dispose(),he.dispose(),Ye.dispose(),Ae.dispose(),Be.dispose(),Me.dispose(),Me.removeEventListener("sessionstart",en),Me.removeEventListener("sessionend",qt),Zr.stop()};function Ce(te){te.preventDefault(),console.log("THREE.WebGLRenderer: Context Lost."),_=!0}function Re(){console.log("THREE.WebGLRenderer: Context Restored."),_=!1;const te=J.autoReset,ye=ie.enabled,Ee=ie.autoUpdate,Se=ie.needsUpdate,we=ie.type;Fe(),J.autoReset=te,ie.enabled=ye,ie.autoUpdate=Ee,ie.needsUpdate=Se,ie.type=we}function Oe(te){console.error("THREE.WebGLRenderer: A WebGL context could not be created. Reason: ",te.statusMessage)}function $e(te){const ye=te.target;ye.removeEventListener("dispose",$e),dt(ye)}function dt(te){Fn(te),ue.remove(te)}function Fn(te){const ye=ue.get(te).programs;ye!==void 0&&(ye.forEach(function(Ee){Be.releaseProgram(Ee)}),te.isShaderMaterial&&Be.releaseShaderCache(te))}this.renderBufferDirect=function(te,ye,Ee,Se,we,Ne){ye===null&&(ye=me);const Ke=we.isMesh&&we.matrixWorld.determinant()<0,qe=fa(te,ye,Ee,Se,we);Z.setMaterial(Se,Ke);let et=Ee.index,ct=1;if(Se.wireframe===!0){if(et=fe.getWireframeAttribute(Ee),et===void 0)return;ct=2}const ht=Ee.drawRange,it=Ee.attributes.position;let Vt=ht.start*ct,un=(ht.start+ht.count)*ct;Ne!==null&&(Vt=Math.max(Vt,Ne.start*ct),un=Math.min(un,(Ne.start+Ne.count)*ct)),et!==null?(Vt=Math.max(Vt,0),un=Math.min(un,et.count)):it!=null&&(Vt=Math.max(Vt,0),un=Math.min(un,it.count));const yn=un-Vt;if(yn<0||yn===1/0)return;Ye.setup(we,Se,qe,Ee,et);let qr,Gt=Ie;if(et!==null&&(qr=se.get(et),Gt=Le,Gt.setIndex(qr)),we.isMesh)Se.wireframe===!0?(Z.setLineWidth(Se.wireframeLinewidth*be()),Gt.setMode(ne.LINES)):Gt.setMode(ne.TRIANGLES);else if(we.isLine){let ot=Se.linewidth;ot===void 0&&(ot=1),Z.setLineWidth(ot*be()),we.isLineSegments?Gt.setMode(ne.LINES):we.isLineLoop?Gt.setMode(ne.LINE_LOOP):Gt.setMode(ne.LINE_STRIP)}else we.isPoints?Gt.setMode(ne.POINTS):we.isSprite&&Gt.setMode(ne.TRIANGLES);if(we.isBatchedMesh)if(we._multiDrawInstances!==null)Gt.renderMultiDrawInstances(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount,we._multiDrawInstances);else if(ae.get("WEBGL_multi_draw"))Gt.renderMultiDraw(we._multiDrawStarts,we._multiDrawCounts,we._multiDrawCount);else{const ot=we._multiDrawStarts,sr=we._multiDrawCounts,on=we._multiDrawCount,Io=et?se.get(et).bytesPerElement:1,nf=ue.get(Se).currentProgram.getUniforms();for(let hs=0;hs{function Ne(){if(Se.forEach(function(Ke){ue.get(Ke).currentProgram.isReady()&&Se.delete(Ke)}),Se.size===0){we(te);return}setTimeout(Ne,10)}ae.get("KHR_parallel_shader_compile")!==null?Ne():setTimeout(Ne,10)})};let _t=null;function Tr(te){_t&&_t(te)}function en(){Zr.stop()}function qt(){Zr.start()}const Zr=new Bz;Zr.setAnimationLoop(Tr),typeof self<"u"&&Zr.setContext(self),this.setAnimationLoop=function(te){_t=te,Me.setAnimationLoop(te),te===null?Zr.stop():Zr.start()},Me.addEventListener("sessionstart",en),Me.addEventListener("sessionend",qt),this.render=function(te,ye){if(ye!==void 0&&ye.isCamera!==!0){console.error("THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.");return}if(_===!0)return;if(te.matrixWorldAutoUpdate===!0&&te.updateMatrixWorld(),ye.parent===null&&ye.matrixWorldAutoUpdate===!0&&ye.updateMatrixWorld(),Me.enabled===!0&&Me.isPresenting===!0&&(Me.cameraAutoUpdate===!0&&Me.updateCamera(ye),ye=Me.getCamera()),te.isScene===!0&&te.onBeforeRender(w,te,ye,B),g=O.get(te,v.length),g.init(ye),v.push(g),ce.multiplyMatrices(ye.projectionMatrix,ye.matrixWorldInverse),K.setFromProjectionMatrix(ce),F=this.localClippingEnabled,ee=X.init(this.clippingPlanes,F),m=U.get(te,p.length),m.init(),p.push(m),Me.enabled===!0&&Me.isPresenting===!0){const Ne=w.xr.getDepthSensingMesh();Ne!==null&&Jt(Ne,ye,-1/0,w.sortObjects)}Jt(te,ye,0,w.sortObjects),m.finish(),w.sortObjects===!0&&m.sort(N,z),ve=Me.enabled===!1||Me.isPresenting===!1||Me.hasDepthSensing()===!1,ve&&pe.addToRenderList(m,te),this.info.render.frame++,ee===!0&&X.beginShadows();const Ee=g.state.shadowsArray;ie.render(Ee,te,ye),ee===!0&&X.endShadows(),this.info.autoReset===!0&&this.info.reset();const Se=m.opaque,we=m.transmissive;if(g.setupLights(),ye.isArrayCamera){const Ne=ye.cameras;if(we.length>0)for(let Ke=0,qe=Ne.length;Ke0&&Ws(Se,we,te,ye),ve&&pe.render(te),tn(m,te,ye);B!==null&&(Y.updateMultisampleRenderTarget(B),Y.updateRenderTargetMipmap(B)),te.isScene===!0&&te.onAfterRender(w,te,ye),Ye.resetDefaultState(),S=-1,I=null,v.pop(),v.length>0?(g=v[v.length-1],ee===!0&&X.setGlobalState(w.clippingPlanes,g.state.camera)):g=null,p.pop(),p.length>0?m=p[p.length-1]:m=null};function Jt(te,ye,Ee,Se){if(te.visible===!1)return;if(te.layers.test(ye.layers)){if(te.isGroup)Ee=te.renderOrder;else if(te.isLOD)te.autoUpdate===!0&&te.update(ye);else if(te.isLight)g.pushLight(te),te.castShadow&&g.pushShadow(te);else if(te.isSprite){if(!te.frustumCulled||K.intersectsSprite(te)){Se&&ge.setFromMatrixPosition(te.matrixWorld).applyMatrix4(ce);const Ke=he.update(te),qe=te.material;qe.visible&&m.push(te,Ke,qe,Ee,ge.z,null)}}else if((te.isMesh||te.isLine||te.isPoints)&&(!te.frustumCulled||K.intersectsObject(te))){const Ke=he.update(te),qe=te.material;if(Se&&(te.boundingSphere!==void 0?(te.boundingSphere===null&&te.computeBoundingSphere(),ge.copy(te.boundingSphere.center)):(Ke.boundingSphere===null&&Ke.computeBoundingSphere(),ge.copy(Ke.boundingSphere.center)),ge.applyMatrix4(te.matrixWorld).applyMatrix4(ce)),Array.isArray(qe)){const et=Ke.groups;for(let ct=0,ht=et.length;ct0&&Kt(we,ye,Ee),Ne.length>0&&Kt(Ne,ye,Ee),Ke.length>0&&Kt(Ke,ye,Ee),Z.buffers.depth.setTest(!0),Z.buffers.depth.setMask(!0),Z.buffers.color.setMask(!0),Z.setPolygonOffset(!1)}function Ws(te,ye,Ee,Se){if((Ee.isScene===!0?Ee.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[Se.id]===void 0&&(g.state.transmissionRenderTarget[Se.id]=new qa(1,1,{generateMipmaps:!0,type:ae.has("EXT_color_buffer_half_float")||ae.has("EXT_color_buffer_float")?Na:rc,minFilter:qo,samples:4,stencilBuffer:s,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:bt.workingColorSpace}));const Ne=g.state.transmissionRenderTarget[Se.id],Ke=Se.viewport||M;Ne.setSize(Ke.z,Ke.w);const qe=w.getRenderTarget();w.setRenderTarget(Ne),w.getClearColor(T),y=w.getClearAlpha(),y<1&&w.setClearColor(16777215,.5),w.clear(),ve&&pe.render(Ee);const et=w.toneMapping;w.toneMapping=uA;const ct=Se.viewport;if(Se.viewport!==void 0&&(Se.viewport=void 0),g.setupLightsView(Se),ee===!0&&X.setGlobalState(w.clippingPlanes,Se),Kt(te,Ee,Se),Y.updateMultisampleRenderTarget(Ne),Y.updateRenderTargetMipmap(Ne),ae.has("WEBGL_multisampled_render_to_texture")===!1){let ht=!1;for(let it=0,Vt=ye.length;it0),it=!!Ee.morphAttributes.position,Vt=!!Ee.morphAttributes.normal,un=!!Ee.morphAttributes.color;let yn=uA;Se.toneMapped&&(B===null||B.isXRRenderTarget===!0)&&(yn=w.toneMapping);const qr=Ee.morphAttributes.position||Ee.morphAttributes.normal||Ee.morphAttributes.color,Gt=qr!==void 0?qr.length:0,ot=ue.get(Se),sr=g.state.lights;if(ee===!0&&(F===!0||te!==I)){const Ks=te===I&&Se.id===S;X.setState(Se,te,Ks)}let on=!1;Se.version===ot.__version?(ot.needsLights&&ot.lightsStateVersion!==sr.state.version||ot.outputColorSpace!==qe||we.isBatchedMesh&&ot.batching===!1||!we.isBatchedMesh&&ot.batching===!0||we.isBatchedMesh&&ot.batchingColor===!0&&we.colorTexture===null||we.isBatchedMesh&&ot.batchingColor===!1&&we.colorTexture!==null||we.isInstancedMesh&&ot.instancing===!1||!we.isInstancedMesh&&ot.instancing===!0||we.isSkinnedMesh&&ot.skinning===!1||!we.isSkinnedMesh&&ot.skinning===!0||we.isInstancedMesh&&ot.instancingColor===!0&&we.instanceColor===null||we.isInstancedMesh&&ot.instancingColor===!1&&we.instanceColor!==null||we.isInstancedMesh&&ot.instancingMorph===!0&&we.morphTexture===null||we.isInstancedMesh&&ot.instancingMorph===!1&&we.morphTexture!==null||ot.envMap!==et||Se.fog===!0&&ot.fog!==Ne||ot.numClippingPlanes!==void 0&&(ot.numClippingPlanes!==X.numPlanes||ot.numIntersection!==X.numIntersection)||ot.vertexAlphas!==ct||ot.vertexTangents!==ht||ot.morphTargets!==it||ot.morphNormals!==Vt||ot.morphColors!==un||ot.toneMapping!==yn||ot.morphTargetsCount!==Gt)&&(on=!0):(on=!0,ot.__version=Se.version);let Io=ot.currentProgram;on===!0&&(Io=Ii(Se,ye,we));let nf=!1,hs=!1,ob=!1;const or=Io.getUniforms(),pc=ot.uniforms;if(Z.useProgram(Io.program)&&(nf=!0,hs=!0,ob=!0),Se.id!==S&&(S=Se.id,hs=!0),nf||I!==te){le.reverseDepthBuffer?(re.copy(te.projectionMatrix),JJ(re),eee(re),or.setValue(ne,"projectionMatrix",re)):or.setValue(ne,"projectionMatrix",te.projectionMatrix),or.setValue(ne,"viewMatrix",te.matrixWorldInverse);const Ks=or.map.cameraPosition;Ks!==void 0&&Ks.setValue(ne,oe.setFromMatrixPosition(te.matrixWorld)),le.logarithmicDepthBuffer&&or.setValue(ne,"logDepthBufFC",2/(Math.log(te.far+1)/Math.LN2)),(Se.isMeshPhongMaterial||Se.isMeshToonMaterial||Se.isMeshLambertMaterial||Se.isMeshBasicMaterial||Se.isMeshStandardMaterial||Se.isShaderMaterial)&&or.setValue(ne,"isOrthographic",te.isOrthographicCamera===!0),I!==te&&(I=te,hs=!0,ob=!0)}if(we.isSkinnedMesh){or.setOptional(ne,we,"bindMatrix"),or.setOptional(ne,we,"bindMatrixInverse");const Ks=we.skeleton;Ks&&(Ks.boneTexture===null&&Ks.computeBoneTexture(),or.setValue(ne,"boneTexture",Ks.boneTexture,Y))}we.isBatchedMesh&&(or.setOptional(ne,we,"batchingTexture"),or.setValue(ne,"batchingTexture",we._matricesTexture,Y),or.setOptional(ne,we,"batchingIdTexture"),or.setValue(ne,"batchingIdTexture",we._indirectTexture,Y),or.setOptional(ne,we,"batchingColorTexture"),we._colorsTexture!==null&&or.setValue(ne,"batchingColorTexture",we._colorsTexture,Y));const ab=Ee.morphAttributes;if((ab.position!==void 0||ab.normal!==void 0||ab.color!==void 0)&&de.update(we,Ee,Io),(hs||ot.receiveShadow!==we.receiveShadow)&&(ot.receiveShadow=we.receiveShadow,or.setValue(ne,"receiveShadow",we.receiveShadow)),Se.isMeshGouraudMaterial&&Se.envMap!==null&&(pc.envMap.value=et,pc.flipEnvMap.value=et.isCubeTexture&&et.isRenderTargetTexture===!1?-1:1),Se.isMeshStandardMaterial&&Se.envMap===null&&ye.environment!==null&&(pc.envMapIntensity.value=ye.environmentIntensity),hs&&(or.setValue(ne,"toneMappingExposure",w.toneMappingExposure),ot.needsLights&&An(pc,ob),Ne&&Se.fog===!0&&V.refreshFogUniforms(pc,Ne),V.refreshMaterialUniforms(pc,Se,L,R,g.state.transmissionRenderTarget[te.id]),Mw.upload(ne,nn(ot),pc,Y)),Se.isShaderMaterial&&Se.uniformsNeedUpdate===!0&&(Mw.upload(ne,nn(ot),pc,Y),Se.uniformsNeedUpdate=!1),Se.isSpriteMaterial&&or.setValue(ne,"center",we.center),or.setValue(ne,"modelViewMatrix",we.modelViewMatrix),or.setValue(ne,"normalMatrix",we.normalMatrix),or.setValue(ne,"modelMatrix",we.matrixWorld),Se.isShaderMaterial||Se.isRawShaderMaterial){const Ks=Se.uniformsGroups;for(let lb=0,EW=Ks.length;lb0&&Y.useMultisampledRTT(te)===!1?we=ue.get(te).__webglMultisampledFramebuffer:Array.isArray(ht)?we=ht[Ee]:we=ht,M.copy(te.viewport),P.copy(te.scissor),D=te.scissorTest}else M.copy(W).multiplyScalar(L).floor(),P.copy(H).multiplyScalar(L).floor(),D=C;if(Z.bindFramebuffer(ne.FRAMEBUFFER,we)&&Se&&Z.drawBuffers(te,we),Z.viewport(M),Z.scissor(P),Z.setScissorTest(D),Ne){const et=ue.get(te.texture);ne.framebufferTexture2D(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0,ne.TEXTURE_CUBE_MAP_POSITIVE_X+ye,et.__webglTexture,Ee)}else if(Ke){const et=ue.get(te.texture),ct=ye||0;ne.framebufferTextureLayer(ne.FRAMEBUFFER,ne.COLOR_ATTACHMENT0,et.__webglTexture,Ee||0,ct)}S=-1},this.readRenderTargetPixels=function(te,ye,Ee,Se,we,Ne,Ke){if(!(te&&te.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let qe=ue.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Ke!==void 0&&(qe=qe[Ke]),qe){Z.bindFramebuffer(ne.FRAMEBUFFER,qe);try{const et=te.texture,ct=et.format,ht=et.type;if(!le.textureFormatReadable(ct)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}if(!le.textureTypeReadable(ht)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ye>=0&&ye<=te.width-Se&&Ee>=0&&Ee<=te.height-we&&ne.readPixels(ye,Ee,Se,we,Ue.convert(ct),Ue.convert(ht),Ne)}finally{const et=B!==null?ue.get(B).__webglFramebuffer:null;Z.bindFramebuffer(ne.FRAMEBUFFER,et)}}},this.readRenderTargetPixelsAsync=async function(te,ye,Ee,Se,we,Ne,Ke){if(!(te&&te.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let qe=ue.get(te).__webglFramebuffer;if(te.isWebGLCubeRenderTarget&&Ke!==void 0&&(qe=qe[Ke]),qe){const et=te.texture,ct=et.format,ht=et.type;if(!le.textureFormatReadable(ct))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!le.textureTypeReadable(ht))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");if(ye>=0&&ye<=te.width-Se&&Ee>=0&&Ee<=te.height-we){Z.bindFramebuffer(ne.FRAMEBUFFER,qe);const it=ne.createBuffer();ne.bindBuffer(ne.PIXEL_PACK_BUFFER,it),ne.bufferData(ne.PIXEL_PACK_BUFFER,Ne.byteLength,ne.STREAM_READ),ne.readPixels(ye,Ee,Se,we,Ue.convert(ct),Ue.convert(ht),0);const Vt=B!==null?ue.get(B).__webglFramebuffer:null;Z.bindFramebuffer(ne.FRAMEBUFFER,Vt);const un=ne.fenceSync(ne.SYNC_GPU_COMMANDS_COMPLETE,0);return ne.flush(),await qJ(ne,un,4),ne.bindBuffer(ne.PIXEL_PACK_BUFFER,it),ne.getBufferSubData(ne.PIXEL_PACK_BUFFER,0,Ne),ne.deleteBuffer(it),ne.deleteSync(un),Ne}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")}},this.copyFramebufferToTexture=function(te,ye=null,Ee=0){te.isTexture!==!0&&(Sw("WebGLRenderer: copyFramebufferToTexture function signature has changed."),ye=arguments[0]||null,te=arguments[1]);const Se=Math.pow(2,-Ee),we=Math.floor(te.image.width*Se),Ne=Math.floor(te.image.height*Se),Ke=ye!==null?ye.x:0,qe=ye!==null?ye.y:0;Y.setTexture2D(te,0),ne.copyTexSubImage2D(ne.TEXTURE_2D,Ee,0,0,Ke,qe,we,Ne),Z.unbindTexture()},this.copyTextureToTexture=function(te,ye,Ee=null,Se=null,we=0){te.isTexture!==!0&&(Sw("WebGLRenderer: copyTextureToTexture function signature has changed."),Se=arguments[0]||null,te=arguments[1],ye=arguments[2],we=arguments[3]||0,Ee=null);let Ne,Ke,qe,et,ct,ht;Ee!==null?(Ne=Ee.max.x-Ee.min.x,Ke=Ee.max.y-Ee.min.y,qe=Ee.min.x,et=Ee.min.y):(Ne=te.image.width,Ke=te.image.height,qe=0,et=0),Se!==null?(ct=Se.x,ht=Se.y):(ct=0,ht=0);const it=Ue.convert(ye.format),Vt=Ue.convert(ye.type);Y.setTexture2D(ye,0),ne.pixelStorei(ne.UNPACK_FLIP_Y_WEBGL,ye.flipY),ne.pixelStorei(ne.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ye.premultiplyAlpha),ne.pixelStorei(ne.UNPACK_ALIGNMENT,ye.unpackAlignment);const un=ne.getParameter(ne.UNPACK_ROW_LENGTH),yn=ne.getParameter(ne.UNPACK_IMAGE_HEIGHT),qr=ne.getParameter(ne.UNPACK_SKIP_PIXELS),Gt=ne.getParameter(ne.UNPACK_SKIP_ROWS),ot=ne.getParameter(ne.UNPACK_SKIP_IMAGES),sr=te.isCompressedTexture?te.mipmaps[we]:te.image;ne.pixelStorei(ne.UNPACK_ROW_LENGTH,sr.width),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,sr.height),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,qe),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,et),te.isDataTexture?ne.texSubImage2D(ne.TEXTURE_2D,we,ct,ht,Ne,Ke,it,Vt,sr.data):te.isCompressedTexture?ne.compressedTexSubImage2D(ne.TEXTURE_2D,we,ct,ht,sr.width,sr.height,it,sr.data):ne.texSubImage2D(ne.TEXTURE_2D,we,ct,ht,Ne,Ke,it,Vt,sr),ne.pixelStorei(ne.UNPACK_ROW_LENGTH,un),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,yn),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,qr),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,Gt),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,ot),we===0&&ye.generateMipmaps&&ne.generateMipmap(ne.TEXTURE_2D),Z.unbindTexture()},this.copyTextureToTexture3D=function(te,ye,Ee=null,Se=null,we=0){te.isTexture!==!0&&(Sw("WebGLRenderer: copyTextureToTexture3D function signature has changed."),Ee=arguments[0]||null,Se=arguments[1]||null,te=arguments[2],ye=arguments[3],we=arguments[4]||0);let Ne,Ke,qe,et,ct,ht,it,Vt,un;const yn=te.isCompressedTexture?te.mipmaps[we]:te.image;Ee!==null?(Ne=Ee.max.x-Ee.min.x,Ke=Ee.max.y-Ee.min.y,qe=Ee.max.z-Ee.min.z,et=Ee.min.x,ct=Ee.min.y,ht=Ee.min.z):(Ne=yn.width,Ke=yn.height,qe=yn.depth,et=0,ct=0,ht=0),Se!==null?(it=Se.x,Vt=Se.y,un=Se.z):(it=0,Vt=0,un=0);const qr=Ue.convert(ye.format),Gt=Ue.convert(ye.type);let ot;if(ye.isData3DTexture)Y.setTexture3D(ye,0),ot=ne.TEXTURE_3D;else if(ye.isDataArrayTexture||ye.isCompressedArrayTexture)Y.setTexture2DArray(ye,0),ot=ne.TEXTURE_2D_ARRAY;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}ne.pixelStorei(ne.UNPACK_FLIP_Y_WEBGL,ye.flipY),ne.pixelStorei(ne.UNPACK_PREMULTIPLY_ALPHA_WEBGL,ye.premultiplyAlpha),ne.pixelStorei(ne.UNPACK_ALIGNMENT,ye.unpackAlignment);const sr=ne.getParameter(ne.UNPACK_ROW_LENGTH),on=ne.getParameter(ne.UNPACK_IMAGE_HEIGHT),Io=ne.getParameter(ne.UNPACK_SKIP_PIXELS),nf=ne.getParameter(ne.UNPACK_SKIP_ROWS),hs=ne.getParameter(ne.UNPACK_SKIP_IMAGES);ne.pixelStorei(ne.UNPACK_ROW_LENGTH,yn.width),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,yn.height),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,et),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,ct),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,ht),te.isDataTexture||te.isData3DTexture?ne.texSubImage3D(ot,we,it,Vt,un,Ne,Ke,qe,qr,Gt,yn.data):ye.isCompressedArrayTexture?ne.compressedTexSubImage3D(ot,we,it,Vt,un,Ne,Ke,qe,qr,yn.data):ne.texSubImage3D(ot,we,it,Vt,un,Ne,Ke,qe,qr,Gt,yn),ne.pixelStorei(ne.UNPACK_ROW_LENGTH,sr),ne.pixelStorei(ne.UNPACK_IMAGE_HEIGHT,on),ne.pixelStorei(ne.UNPACK_SKIP_PIXELS,Io),ne.pixelStorei(ne.UNPACK_SKIP_ROWS,nf),ne.pixelStorei(ne.UNPACK_SKIP_IMAGES,hs),we===0&&ye.generateMipmaps&&ne.generateMipmap(ot),Z.unbindTexture()},this.initRenderTarget=function(te){ue.get(te).__webglFramebuffer===void 0&&Y.setupRenderTarget(te)},this.initTexture=function(te){te.isCubeTexture?Y.setTextureCube(te,0):te.isData3DTexture?Y.setTexture3D(te,0):te.isDataArrayTexture||te.isCompressedArrayTexture?Y.setTexture2DArray(te,0):Y.setTexture2D(te,0),Z.unbindTexture()},this.resetState=function(){x=0,b=0,B=null,Z.reset(),Ye.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return Ql}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(e){this._outputColorSpace=e;const t=this.getContext();t.drawingBufferColorSpace=e===UR?"display-p3":"srgb",t.unpackColorSpace=bt.workingColorSpace===a1?"display-p3":"srgb"}}class zg extends Ft{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new tr,this.environmentIntensity=1,this.environmentRotation=new tr,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){const t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}}class fse{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=MC,this.updateRanges=[],this.version=0,this.uuid=na()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,r){e*=this.stride,r*=t.stride;for(let i=0,s=this.stride;i=i.length&&i.push({start:-1,count:-1,z:-1,index:-1});const o=i[this.index];s.push(o),this.index++,o.start=e.start,o.count=e.count,o.z=t,o.index=r}reset(){this.list.length=0,this.index=0}}const Bc=new ke,QE=new ke,yse=new ke,wse=new He(1,1,1),eD=new ke,zE=new c1,Pv=new Qn,zA=new Si,Lp=new $,tD=new $,_se=new $,GE=new vse,di=new hn,Lv=[];function xse(n,e,t=0){const r=e.itemSize;if(n.isInterleavedBufferAttribute||n.array.constructor!==e.array.constructor){const i=n.count;for(let s=0;s65535?new Uint32Array(i):new Uint16Array(i);t.setIndex(new lt(s,1))}this._geometryInitialized=!0}}_validateGeometry(e){const t=this.geometry;if(!!e.getIndex()!=!!t.getIndex())throw new Error('BatchedMesh: All geometries must consistently have "index".');for(const r in t.attributes){if(!e.hasAttribute(r))throw new Error(`BatchedMesh: Added geometry missing "${r}". All geometries must have consistent attributes.`);const i=e.getAttribute(r),s=t.getAttribute(r);if(i.itemSize!==s.itemSize||i.normalized!==s.normalized)throw new Error("BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}setCustomSort(e){return this.customSort=e,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Qn);const e=this.boundingBox,t=this._drawInfo;e.makeEmpty();for(let r=0,i=t.length;r=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("BatchedMesh: Maximum item count reached.");const r={visible:!0,active:!0,geometryIndex:e};let i=null;this._availableInstanceIds.length>0?(i=this._availableInstanceIds.pop(),this._drawInfo[i]=r):(i=this._drawInfo.length,this._drawInfo.push(r));const s=this._matricesTexture,o=s.image.data;yse.toArray(o,i*16),s.needsUpdate=!0;const a=this._colorsTexture;return a&&(wse.toArray(a.image.data,i*4),a.needsUpdate=!0),i}addGeometry(e,t=-1,r=-1){if(this._initializeGeometry(e),this._validateGeometry(e),this._drawInfo.length>=this._maxInstanceCount)throw new Error("BatchedMesh: Maximum item count reached.");const i={vertexStart:-1,vertexCount:-1,indexStart:-1,indexCount:-1};let s=null;const o=this._reservedRanges,a=this._drawRanges,l=this._bounds;this._geometryCount!==0&&(s=o[o.length-1]),t===-1?i.vertexCount=e.getAttribute("position").count:i.vertexCount=t,s===null?i.vertexStart=0:i.vertexStart=s.vertexStart+s.vertexCount;const c=e.getIndex(),A=c!==null;if(A&&(r===-1?i.indexCount=c.count:i.indexCount=r,s===null?i.indexStart=0:i.indexStart=s.indexStart+s.indexCount),i.indexStart!==-1&&i.indexStart+i.indexCount>this._maxIndexCount||i.vertexStart+i.vertexCount>this._maxVertexCount)throw new Error("BatchedMesh: Reserved space request exceeds the maximum buffer size.");const u=this._geometryCount;return this._geometryCount++,o.push(i),a.push({start:A?i.indexStart:i.vertexStart,count:-1}),l.push({boxInitialized:!1,box:new Qn,sphereInitialized:!1,sphere:new Si}),this.setGeometryAt(u,e),u}setGeometryAt(e,t){if(e>=this._geometryCount)throw new Error("BatchedMesh: Maximum geometry count reached.");this._validateGeometry(t);const r=this.geometry,i=r.getIndex()!==null,s=r.getIndex(),o=t.getIndex(),a=this._reservedRanges[e];if(i&&o.count>a.indexCount||t.attributes.position.count>a.vertexCount)throw new Error("BatchedMesh: Reserved space not large enough for provided geometry.");const l=a.vertexStart,c=a.vertexCount;for(const h in r.attributes){const d=t.getAttribute(h),m=r.getAttribute(h);xse(d,m,l);const g=d.itemSize;for(let p=d.count,v=c;p=t.length||t[e].active===!1?this:(t[e].active=!1,this._availableInstanceIds.push(e),this._visibilityChanged=!0,this)}getBoundingBoxAt(e,t){if(e>=this._geometryCount)return null;const r=this._bounds[e],i=r.box,s=this.geometry;if(r.boxInitialized===!1){i.makeEmpty();const o=s.index,a=s.attributes.position,l=this._drawRanges[e];for(let c=l.start,A=l.start+l.count;c=this._geometryCount)return null;const r=this._bounds[e],i=r.sphere,s=this.geometry;if(r.sphereInitialized===!1){i.makeEmpty(),this.getBoundingBoxAt(e,Pv),Pv.getCenter(i.center);const o=s.index,a=s.attributes.position,l=this._drawRanges[e];let c=0;for(let A=l.start,u=l.start+l.count;A=r.length||r[e].active===!1?this:(t.toArray(s,e*16),i.needsUpdate=!0,this)}getMatrixAt(e,t){const r=this._drawInfo,i=this._matricesTexture.image.data;return e>=r.length||r[e].active===!1?null:t.fromArray(i,e*16)}setColorAt(e,t){this._colorsTexture===null&&this._initColorsTexture();const r=this._colorsTexture,i=this._colorsTexture.image.data,s=this._drawInfo;return e>=s.length||s[e].active===!1?this:(t.toArray(i,e*4),r.needsUpdate=!0,this)}getColorAt(e,t){const r=this._colorsTexture.image.data,i=this._drawInfo;return e>=i.length||i[e].active===!1?null:t.fromArray(r,e*4)}setVisibleAt(e,t){const r=this._drawInfo;return e>=r.length||r[e].active===!1||r[e].visible===t?this:(r[e].visible=t,this._visibilityChanged=!0,this)}getVisibleAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?!1:t[e].visible}setGeometryIdAt(e,t){const r=this._drawInfo;return e>=r.length||r[e].active===!1||t<0||t>=this._geometryCount?null:(r[e].geometryIndex=t,this)}getGeometryIdAt(e){const t=this._drawInfo;return e>=t.length||t[e].active===!1?-1:t[e].geometryIndex}getGeometryRangeAt(e,t={}){if(e<0||e>=this._geometryCount)return null;const r=this._drawRanges[e];return t.start=r.start,t.count=r.count,t}raycast(e,t){const r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld,o=this.geometry;di.material=this.material,di.geometry.index=o.index,di.geometry.attributes=o.attributes,di.geometry.boundingBox===null&&(di.geometry.boundingBox=new Qn),di.geometry.boundingSphere===null&&(di.geometry.boundingSphere=new Si);for(let a=0,l=r.length;a({...t})),this._reservedRanges=e._reservedRanges.map(t=>({...t})),this._drawInfo=e._drawInfo.map(t=>({...t})),this._bounds=e._bounds.map(t=>({boxInitialized:t.boxInitialized,box:t.box.clone(),sphereInitialized:t.sphereInitialized,sphere:t.sphere.clone()})),this._maxInstanceCount=e._maxInstanceCount,this._maxVertexCount=e._maxVertexCount,this._maxIndexCount=e._maxIndexCount,this._geometryInitialized=e._geometryInitialized,this._geometryCount=e._geometryCount,this._multiDrawCounts=e._multiDrawCounts.slice(),this._multiDrawStarts=e._multiDrawStarts.slice(),this._matricesTexture=e._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=e._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){return this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null),this}onBeforeRender(e,t,r,i,s){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const o=i.getIndex(),a=o===null?1:o.array.BYTES_PER_ELEMENT,l=this._drawInfo,c=this._multiDrawStarts,A=this._multiDrawCounts,u=this._drawRanges,f=this.perObjectFrustumCulled,h=this._indirectTexture,d=h.image.data;f&&(eD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse).multiply(this.matrixWorld),zE.setFromProjectionMatrix(eD,e.coordinateSystem));let m=0;if(this.sortObjects){QE.copy(this.matrixWorld).invert(),Lp.setFromMatrixPosition(r.matrixWorld).applyMatrix4(QE),tD.set(0,0,-1).transformDirection(r.matrixWorld).transformDirection(QE);for(let v=0,w=l.length;v0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;sr)return;VE.applyMatrix4(n.matrixWorld);const l=e.ray.origin.distanceTo(VE);if(!(le.far))return{distance:l,point:rD.clone().applyMatrix4(n.matrixWorld),index:i,face:null,faceIndex:null,barycoord:null,object:n}}const iD=new $,sD=new $;class y0 extends Yd{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const e=this.geometry;if(e.index===null){const t=e.attributes.position,r=[];for(let i=0,s=t.count;i0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;si.far)return;s.push({distance:c,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,faceIndex:null,barycoord:null,object:o})}}class jE extends Hn{constructor(e,t,r,i,s,o,a,l,c,A,u,f){super(null,o,a,l,c,A,i,s,u,f),this.isCompressedTexture=!0,this.image={width:t,height:r},this.mipmaps=e,this.flipY=!1,this.generateMipmaps=!1}}class Sse extends Hn{constructor(e,t,r,i,s,o,a,l,c){super(e,t,r,i,s,o,a,l,c),this.isCanvasTexture=!0,this.needsUpdate=!0}}class Mse{constructor(){this.type="Curve",this.arcLengthDivisions=200}getPoint(){return console.warn("THREE.Curve: .getPoint() not implemented."),null}getPointAt(e,t){const r=this.getUtoTmapping(e);return this.getPoint(r,t)}getPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPoint(r/e));return t}getSpacedPoints(e=5){const t=[];for(let r=0;r<=e;r++)t.push(this.getPointAt(r/e));return t}getLength(){const e=this.getLengths();return e[e.length-1]}getLengths(e=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===e+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const t=[];let r,i=this.getPoint(0),s=0;t.push(0);for(let o=1;o<=e;o++)r=this.getPoint(o/e),s+=r.distanceTo(i),t.push(s),i=r;return this.cacheArcLengths=t,t}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(e,t){const r=this.getLengths();let i=0;const s=r.length;let o;t?o=t:o=e*r[s-1];let a=0,l=s-1,c;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),c=r[i]-o,c<0)a=i+1;else if(c>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const A=r[i],f=r[i+1]-A,h=(o-A)/f;return(i+h)/(s-1)}getTangent(e,t){let i=e-1e-4,s=e+1e-4;i<0&&(i=0),s>1&&(s=1);const o=this.getPoint(i),a=this.getPoint(s),l=t||(o.isVector2?new je:new $);return l.copy(a).sub(o).normalize(),l}getTangentAt(e,t){const r=this.getUtoTmapping(e);return this.getTangent(r,t)}computeFrenetFrames(e,t){const r=new $,i=[],s=[],o=[],a=new $,l=new ke;for(let h=0;h<=e;h++){const d=h/e;i[h]=this.getTangentAt(d,new $)}s[0]=new $,o[0]=new $;let c=Number.MAX_VALUE;const A=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);A<=c&&(c=A,r.set(1,0,0)),u<=c&&(c=u,r.set(0,1,0)),f<=c&&r.set(0,0,1),a.crossVectors(i[0],r).normalize(),s[0].crossVectors(i[0],a),o[0].crossVectors(i[0],s[0]);for(let h=1;h<=e;h++){if(s[h]=s[h-1].clone(),o[h]=o[h-1].clone(),a.crossVectors(i[h-1],i[h]),a.length()>Number.EPSILON){a.normalize();const d=Math.acos(dr(i[h-1].dot(i[h]),-1,1));s[h].applyMatrix4(l.makeRotationAxis(a,d))}o[h].crossVectors(i[h],s[h])}if(t===!0){let h=Math.acos(dr(s[0].dot(s[e]),-1,1));h/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(h=-h);for(let d=1;d<=e;d++)s[d].applyMatrix4(l.makeRotationAxis(i[d],h*d)),o[d].crossVectors(i[d],s[d])}return{tangents:i,normals:s,binormals:o}}clone(){return new this.constructor().copy(this)}copy(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}toJSON(){const e={metadata:{version:4.6,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class f1 extends Zt{constructor(e=1,t=1,r=1,i=32,s=1,o=!1,a=0,l=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:e,radiusBottom:t,height:r,radialSegments:i,heightSegments:s,openEnded:o,thetaStart:a,thetaLength:l};const c=this;i=Math.floor(i),s=Math.floor(s);const A=[],u=[],f=[],h=[];let d=0;const m=[],g=r/2;let p=0;v(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(A),this.setAttribute("position",new xn(u,3)),this.setAttribute("normal",new xn(f,3)),this.setAttribute("uv",new xn(h,2));function v(){const _=new $,x=new $;let b=0;const B=(t-e)/r;for(let S=0;S<=s;S++){const I=[],M=S/s,P=M*(t-e)+e;for(let D=0;D<=i;D++){const T=D/i,y=T*l+a,E=Math.sin(y),R=Math.cos(y);x.x=P*E,x.y=-M*r+g,x.z=P*R,u.push(x.x,x.y,x.z),_.set(E,B,R).normalize(),f.push(_.x,_.y,_.z),h.push(T,1-M),I.push(d++)}m.push(I)}for(let S=0;S0&&(A.push(M,P,T),b+=3),t>0&&(A.push(P,D,T),b+=3)}c.addGroup(p,b,0),p+=b}function w(_){const x=d,b=new je,B=new $;let S=0;const I=_===!0?e:t,M=_===!0?1:-1;for(let D=1;D<=i;D++)u.push(0,g*M,0),f.push(0,M,0),h.push(.5,.5),d++;const P=d;for(let D=0;D<=i;D++){const y=D/i*l+a,E=Math.cos(y),R=Math.sin(y);B.x=I*R,B.y=g*M,B.z=I*E,u.push(B.x,B.y,B.z),f.push(0,M,0),b.x=E*.5+.5,b.y=R*.5*M+.5,h.push(b.x,b.y),d++}for(let D=0;D80*t){a=c=n[0],l=A=n[1];for(let d=t;dc&&(c=u),f>A&&(A=f);h=Math.max(c-a,A-l),h=h!==0?32767/h:0}return Vg(s,o,t,a,l,h,0),o}};function Rz(n,e,t,r,i){let s,o;if(i===Vse(n,e,t,r)>0)for(s=e;s=e;s-=r)o=lD(s,n[s],n[s+1],o);return o&&h1(o,o.next)&&(Wg(o),o=o.next),o}function Pu(n,e){if(!n)return n;e||(e=n);let t=n,r;do if(r=!1,!t.steiner&&(h1(t,t.next)||Kn(t.prev,t,t.next)===0)){if(Wg(t),t=e=t.prev,t===t.next)break;r=!0}else t=t.next;while(r||t!==e);return e}function Vg(n,e,t,r,i,s,o){if(!n)return;!o&&s&&Ose(n,r,i,s);let a=n,l,c;for(;n.prev!==n.next;){if(l=n.prev,c=n.next,s?Ise(n,r,i,s):Tse(n)){e.push(l.i/t|0),e.push(n.i/t|0),e.push(c.i/t|0),Wg(n),n=c.next,a=c.next;continue}if(n=c,n===a){o?o===1?(n=Rse(Pu(n),e,t),Vg(n,e,t,r,i,s,2)):o===2&&Use(n,e,t,r,i,s):Vg(Pu(n),e,t,r,i,s,1);break}}}function Tse(n){const e=n.prev,t=n,r=n.next;if(Kn(e,t,r)>=0)return!1;const i=e.x,s=t.x,o=r.x,a=e.y,l=t.y,c=r.y,A=is?i>o?i:o:s>o?s:o,h=a>l?a>c?a:c:l>c?l:c;let d=r.next;for(;d!==e;){if(d.x>=A&&d.x<=f&&d.y>=u&&d.y<=h&&Oh(i,a,s,l,o,c,d.x,d.y)&&Kn(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Ise(n,e,t,r){const i=n.prev,s=n,o=n.next;if(Kn(i,s,o)>=0)return!1;const a=i.x,l=s.x,c=o.x,A=i.y,u=s.y,f=o.y,h=al?a>c?a:c:l>c?l:c,g=A>u?A>f?A:f:u>f?u:f,p=IC(h,d,e,t,r),v=IC(m,g,e,t,r);let w=n.prevZ,_=n.nextZ;for(;w&&w.z>=p&&_&&_.z<=v;){if(w.x>=h&&w.x<=m&&w.y>=d&&w.y<=g&&w!==i&&w!==o&&Oh(a,A,l,u,c,f,w.x,w.y)&&Kn(w.prev,w,w.next)>=0||(w=w.prevZ,_.x>=h&&_.x<=m&&_.y>=d&&_.y<=g&&_!==i&&_!==o&&Oh(a,A,l,u,c,f,_.x,_.y)&&Kn(_.prev,_,_.next)>=0))return!1;_=_.nextZ}for(;w&&w.z>=p;){if(w.x>=h&&w.x<=m&&w.y>=d&&w.y<=g&&w!==i&&w!==o&&Oh(a,A,l,u,c,f,w.x,w.y)&&Kn(w.prev,w,w.next)>=0)return!1;w=w.prevZ}for(;_&&_.z<=v;){if(_.x>=h&&_.x<=m&&_.y>=d&&_.y<=g&&_!==i&&_!==o&&Oh(a,A,l,u,c,f,_.x,_.y)&&Kn(_.prev,_,_.next)>=0)return!1;_=_.nextZ}return!0}function Rse(n,e,t){let r=n;do{const i=r.prev,s=r.next.next;!h1(i,s)&&Uz(i,r,r.next,s)&&jg(i,s)&&jg(s,i)&&(e.push(i.i/t|0),e.push(r.i/t|0),e.push(s.i/t|0),Wg(r),Wg(r.next),r=n=s),r=r.next}while(r!==n);return Pu(r)}function Use(n,e,t,r,i,s){let o=n;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Qse(o,a)){let l=Fz(o,a);o=Pu(o,o.next),l=Pu(l,l.next),Vg(o,e,t,r,i,s,0),Vg(l,e,t,r,i,s,0);return}a=a.next}o=o.next}while(o!==n)}function Fse(n,e,t,r){const i=[];let s,o,a,l,c;for(s=0,o=e.length;s=t.next.y&&t.next.y!==t.y){const f=t.x+(o-t.y)*(t.next.x-t.x)/(t.next.y-t.y);if(f<=s&&f>r&&(r=f,i=t.x=t.x&&t.x>=l&&s!==t.x&&Oh(oi.x||t.x===i.x&&Nse(i,t)))&&(i=t,A=u)),t=t.next;while(t!==a);return i}function Nse(n,e){return Kn(n.prev,n,e.prev)<0&&Kn(e.next,n,n.next)<0}function Ose(n,e,t,r){let i=n;do i.z===0&&(i.z=IC(i.x,i.y,e,t,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==n);i.prevZ.nextZ=null,i.prevZ=null,kse(i)}function kse(n){let e,t,r,i,s,o,a,l,c=1;do{for(t=n,n=null,s=null,o=0;t;){for(o++,r=t,a=0,e=0;e0||l>0&&r;)a!==0&&(l===0||!r||t.z<=r.z)?(i=t,t=t.nextZ,a--):(i=r,r=r.nextZ,l--),s?s.nextZ=i:n=i,i.prevZ=s,s=i;t=r}s.nextZ=null,c*=2}while(o>1);return n}function IC(n,e,t,r,i){return n=(n-t)*i|0,e=(e-r)*i|0,n=(n|n<<8)&16711935,n=(n|n<<4)&252645135,n=(n|n<<2)&858993459,n=(n|n<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,n|e<<1}function Hse(n){let e=n,t=n;do(e.x=(n-o)*(s-a)&&(n-o)*(r-a)>=(t-o)*(e-a)&&(t-o)*(s-a)>=(i-o)*(r-a)}function Qse(n,e){return n.next.i!==e.i&&n.prev.i!==e.i&&!zse(n,e)&&(jg(n,e)&&jg(e,n)&&Gse(n,e)&&(Kn(n.prev,n,e.prev)||Kn(n,e.prev,e))||h1(n,e)&&Kn(n.prev,n,n.next)>0&&Kn(e.prev,e,e.next)>0)}function Kn(n,e,t){return(e.y-n.y)*(t.x-e.x)-(e.x-n.x)*(t.y-e.y)}function h1(n,e){return n.x===e.x&&n.y===e.y}function Uz(n,e,t,r){const i=Qv(Kn(n,e,t)),s=Qv(Kn(n,e,r)),o=Qv(Kn(t,r,n)),a=Qv(Kn(t,r,e));return!!(i!==s&&o!==a||i===0&&Hv(n,t,e)||s===0&&Hv(n,r,e)||o===0&&Hv(t,n,r)||a===0&&Hv(t,e,r))}function Hv(n,e,t){return e.x<=Math.max(n.x,t.x)&&e.x>=Math.min(n.x,t.x)&&e.y<=Math.max(n.y,t.y)&&e.y>=Math.min(n.y,t.y)}function Qv(n){return n>0?1:n<0?-1:0}function zse(n,e){let t=n;do{if(t.i!==n.i&&t.next.i!==n.i&&t.i!==e.i&&t.next.i!==e.i&&Uz(t,t.next,n,e))return!0;t=t.next}while(t!==n);return!1}function jg(n,e){return Kn(n.prev,n,n.next)<0?Kn(n,e,n.next)>=0&&Kn(n,n.prev,e)>=0:Kn(n,e,n.prev)<0||Kn(n,n.next,e)<0}function Gse(n,e){let t=n,r=!1;const i=(n.x+e.x)/2,s=(n.y+e.y)/2;do t.y>s!=t.next.y>s&&t.next.y!==t.y&&i<(t.next.x-t.x)*(s-t.y)/(t.next.y-t.y)+t.x&&(r=!r),t=t.next;while(t!==n);return r}function Fz(n,e){const t=new RC(n.i,n.x,n.y),r=new RC(e.i,e.x,e.y),i=n.next,s=e.prev;return n.next=e,e.prev=n,t.next=i,i.prev=t,r.next=t,t.prev=r,s.next=r,r.prev=s,r}function lD(n,e,t,r){const i=new RC(n,e,t);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Wg(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function RC(n,e,t){this.i=n,this.x=e,this.y=t,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Vse(n,e,t,r){let i=0;for(let s=e,o=t-r;s2&&n[e-1].equals(n[0])&&n.pop()}function AD(n,e){for(let t=0;t0)&&h.push(w,_,b),(p!==r-1||l0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}}class WE extends os{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new He(16777215),this.specular=new He(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tr,this.combine=i1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}class jse extends os{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(e)}copy(e){return super.copy(e),this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.flatShading=e.flatShading,this}}class Wse extends os{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new He(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new He(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Kd,this.normalScale=new je(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new tr,this.combine=i1,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}}function zv(n,e,t){return!n||!t&&n.constructor===e?n:typeof e.BYTES_PER_ELEMENT=="number"?new e(n):Array.prototype.slice.call(n)}function Kse(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Xse(n){function e(i,s){return n[i]-n[s]}const t=n.length,r=new Array(t);for(let i=0;i!==t;++i)r[i]=i;return r.sort(e),r}function uD(n,e,t){const r=n.length,i=new n.constructor(r);for(let s=0,o=0;o!==r;++s){const a=t[s]*e;for(let l=0;l!==e;++l)i[o++]=n[a+l]}return i}function Pz(n,e,t,r){let i=1,s=n[0];for(;s!==void 0&&s[r]===void 0;)s=n[i++];if(s===void 0)return;let o=s[r];if(o!==void 0)if(Array.isArray(o))do o=s[r],o!==void 0&&(e.push(s.time),t.push.apply(t,o)),s=n[i++];while(s!==void 0);else if(o.toArray!==void 0)do o=s[r],o!==void 0&&(e.push(s.time),o.toArray(t,t.length)),s=n[i++];while(s!==void 0);else do o=s[r],o!==void 0&&(e.push(s.time),t.push(o)),s=n[i++];while(s!==void 0)}class w0{constructor(e,t,r,i){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=i!==void 0?i:new t.constructor(r),this.sampleValues=t,this.valueSize=r,this.settings=null,this.DefaultSettings_={}}evaluate(e){const t=this.parameterPositions;let r=this._cachedIndex,i=t[r],s=t[r-1];e:{t:{let o;n:{r:if(!(e=s)){const a=t[1];e=s)break t}o=r,r=0;break n}break e}for(;r>>1;et;)--o;if(++o,s!==0||o!==i){s>=o&&(o=Math.max(o,1),s=o-1);const a=this.getValueSize();this.times=r.slice(s,o),this.values=this.values.slice(s*a,o*a)}return this}validate(){let e=!0;const t=this.getValueSize();t-Math.floor(t)!==0&&(console.error("THREE.KeyframeTrack: Invalid value size in track.",this),e=!1);const r=this.times,i=this.values,s=r.length;s===0&&(console.error("THREE.KeyframeTrack: Track is empty.",this),e=!1);let o=null;for(let a=0;a!==s;a++){const l=r[a];if(typeof l=="number"&&isNaN(l)){console.error("THREE.KeyframeTrack: Time is not a valid number.",this,a,l),e=!1;break}if(o!==null&&o>l){console.error("THREE.KeyframeTrack: Out of order keys.",this,a,l,o),e=!1;break}o=l}if(i!==void 0&&Kse(i))for(let a=0,l=i.length;a!==l;++a){const c=i[a];if(isNaN(c)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,c),e=!1;break}}return e}optimize(){const e=this.times.slice(),t=this.values.slice(),r=this.getValueSize(),i=this.getInterpolation()===AE,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,c=0;c!==r;++c)t[l+c]=t[a+c];++o}return o!==e.length?(this.times=e.slice(0,o),this.values=t.slice(0,o*r)):(this.times=e,this.values=t),this}clone(){const e=this.times.slice(),t=this.values.slice(),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}sl.prototype.TimeBufferType=Float32Array;sl.prototype.ValueBufferType=Float32Array;sl.prototype.DefaultInterpolation=Pd;class $d extends sl{constructor(e,t,r){super(e,t,r)}}$d.prototype.ValueTypeName="bool";$d.prototype.ValueBufferType=Array;$d.prototype.DefaultInterpolation=Fd;$d.prototype.InterpolantFactoryMethodLinear=void 0;$d.prototype.InterpolantFactoryMethodSmooth=void 0;class Dz extends sl{}Dz.prototype.ValueTypeName="color";class Lu extends sl{}Lu.prototype.ValueTypeName="number";class Zse extends w0{constructor(e,t,r,i){super(e,t,r,i)}interpolate_(e,t,r,i){const s=this.resultBuffer,o=this.sampleValues,a=this.valueSize,l=(r-t)/(i-t);let c=e*a;for(let A=c+a;c!==A;c+=4)tt.slerpFlat(s,0,o,c-a,o,c,l);return s}}class Ja extends sl{InterpolantFactoryMethodLinear(e){return new Zse(this.times,this.values,this.getValueSize(),e)}}Ja.prototype.ValueTypeName="quaternion";Ja.prototype.InterpolantFactoryMethodSmooth=void 0;class Zd extends sl{constructor(e,t,r){super(e,t,r)}}Zd.prototype.ValueTypeName="string";Zd.prototype.ValueBufferType=Array;Zd.prototype.DefaultInterpolation=Fd;Zd.prototype.InterpolantFactoryMethodLinear=void 0;Zd.prototype.InterpolantFactoryMethodSmooth=void 0;class ic extends sl{}ic.prototype.ValueTypeName="vector";class Du{constructor(e="",t=-1,r=[],i=RR){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=na(),this.duration<0&&this.resetDuration()}static parse(e){const t=[],r=e.tracks,i=1/(e.fps||1);for(let o=0,a=r.length;o!==a;++o)t.push(Jse(r[o]).scale(i));const s=new this(e.name,e.duration,t,e.blendMode);return s.uuid=e.uuid,s}static toJSON(e){const t=[],r=e.tracks,i={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let s=0,o=r.length;s!==o;++s)t.push(sl.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const u=A[1];let f=i[u];f||(i[u]=f=[]),f.push(c)}}const o=[];for(const a in i)o.push(this.CreateFromMorphTargetSequence(a,i[a],t,r));return o}static parseAnimation(e,t){if(!e)return console.error("THREE.AnimationClip: No animation in JSONLoader data."),null;const r=function(u,f,h,d,m){if(h.length!==0){const g=[],p=[];Pz(h,g,p,d),g.length!==0&&m.push(new u(f,g,p))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const c=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if(pl[e]!==void 0){pl[e].push({onLoad:t,onProgress:r,onError:i});return}pl[e]=[],pl[e].push({onLoad:t,onProgress:r,onError:i});const o=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin"}),a=this.mimeType,l=this.responseType;fetch(o).then(c=>{if(c.status===200||c.status===0){if(c.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||c.body===void 0||c.body.getReader===void 0)return c;const A=pl[e],u=c.body.getReader(),f=c.headers.get("X-File-Size")||c.headers.get("Content-Length"),h=f?parseInt(f):0,d=h!==0;let m=0;const g=new ReadableStream({start(p){v();function v(){u.read().then(({done:w,value:_})=>{if(w)p.close();else{m+=_.byteLength;const x=new ProgressEvent("progress",{lengthComputable:d,loaded:m,total:h});for(let b=0,B=A.length;b{p.error(w)})}}});return new Response(g)}else throw new toe(`fetch for "${c.url}" responded with ${c.status}: ${c.statusText}`,c)}).then(c=>{switch(l){case"arraybuffer":return c.arrayBuffer();case"blob":return c.blob();case"document":return c.text().then(A=>new DOMParser().parseFromString(A,a));case"json":return c.json();default:if(a===void 0)return c.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,h=new TextDecoder(f);return c.arrayBuffer().then(d=>h.decode(d))}}}).then(c=>{Yc.add(e,c);const A=pl[e];delete pl[e];for(let u=0,f=A.length;u{const A=pl[e];if(A===void 0)throw this.manager.itemError(e),c;delete pl[e];for(let u=0,f=A.length;u{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}}class Oz extends el{constructor(e){super(e)}load(e,t,r,i){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Yc.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Qg("img");function l(){A(),Yc.add(e,this),t&&t(this),s.manager.itemEnd(e)}function c(u){A(),i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}function A(){a.removeEventListener("load",l,!1),a.removeEventListener("error",c,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",c,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class noe extends el{constructor(e){super(e)}load(e,t,r,i){const s=this,o=new _u,a=new d1(this.manager);return a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setPath(this.path),a.setWithCredentials(s.withCredentials),a.load(e,function(l){let c;try{c=s.parse(l)}catch(A){if(i!==void 0)i(A);else{console.error(A);return}}c.image!==void 0?o.image=c.image:c.data!==void 0&&(o.image.width=c.width,o.image.height=c.height,o.image.data=c.data),o.wrapS=c.wrapS!==void 0?c.wrapS:Is,o.wrapT=c.wrapT!==void 0?c.wrapT:Is,o.magFilter=c.magFilter!==void 0?c.magFilter:Lr,o.minFilter=c.minFilter!==void 0?c.minFilter:Lr,o.anisotropy=c.anisotropy!==void 0?c.anisotropy:1,c.colorSpace!==void 0&&(o.colorSpace=c.colorSpace),c.flipY!==void 0&&(o.flipY=c.flipY),c.format!==void 0&&(o.format=c.format),c.type!==void 0&&(o.type=c.type),c.mipmaps!==void 0&&(o.mipmaps=c.mipmaps,o.minFilter=qo),c.mipmapCount===1&&(o.minFilter=Lr),c.generateMipmaps!==void 0&&(o.generateMipmaps=c.generateMipmaps),o.needsUpdate=!0,t&&t(o,c)},r,i),o}}class Xu extends el{constructor(e){super(e)}load(e,t,r,i){const s=new Hn,o=new Oz(this.manager);return o.setCrossOrigin(this.crossOrigin),o.setPath(this.path),o.load(e,function(a){s.image=a,s.needsUpdate=!0,t!==void 0&&t(s)},r,i),s}}class p1 extends Ft{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new He(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){const t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}}const KE=new ke,fD=new $,hD=new $;class zR{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new je(512,512),this.map=null,this.mapPass=null,this.matrix=new ke,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new c1,this._frameExtents=new je(1,1),this._viewportCount=1,this._viewports=[new Ut(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;fD.setFromMatrixPosition(e.matrixWorld),t.position.copy(fD),hD.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(hD),t.updateMatrixWorld(),KE.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(KE),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(KE)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}}class roe extends zR{constructor(){super(new Fr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=Ld*2*e.angle*this.focus,i=this.mapSize.width/this.mapSize.height,s=e.distance||t.far;(r!==t.fov||i!==t.aspect||s!==t.far)&&(t.fov=r,t.aspect=i,t.far=s,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}}class kz extends p1{constructor(e,t,r=0,i=Math.PI/3,s=0,o=2){super(e,t),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(Ft.DEFAULT_UP),this.updateMatrix(),this.target=new Ft,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new roe}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}const dD=new ke,Np=new $,XE=new $;class ioe extends zR{constructor(){super(new Fr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new je(4,2),this._viewportCount=6,this._viewports=[new Ut(2,1,1,1),new Ut(0,1,1,1),new Ut(3,1,1,1),new Ut(1,1,1,1),new Ut(3,0,1,1),new Ut(1,0,1,1)],this._cubeDirections=[new $(1,0,0),new $(-1,0,0),new $(0,0,1),new $(0,0,-1),new $(0,1,0),new $(0,-1,0)],this._cubeUps=[new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,1,0),new $(0,0,1),new $(0,0,-1)]}updateMatrices(e,t=0){const r=this.camera,i=this.matrix,s=e.distance||r.far;s!==r.far&&(r.far=s,r.updateProjectionMatrix()),Np.setFromMatrixPosition(e.matrixWorld),r.position.copy(Np),XE.copy(r.position),XE.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(XE),r.updateMatrixWorld(),i.makeTranslation(-Np.x,-Np.y,-Np.z),dD.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(dD)}}class UC extends p1{constructor(e,t,r=0,i=2){super(e,t),this.isPointLight=!0,this.type="PointLight",this.distance=r,this.decay=i,this.shadow=new ioe}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}}class soe extends zR{constructor(){super(new g0(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class GR extends p1{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(Ft.DEFAULT_UP),this.updateMatrix(),this.target=new Ft,this.shadow=new soe}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class Hz extends p1{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class od{static decodeText(e){if(console.warn("THREE.LoaderUtils: decodeText() has been deprecated with r165 and will be removed with r175. Use TextDecoder instead."),typeof TextDecoder<"u")return new TextDecoder().decode(e);let t="";for(let r=0,i=e.length;r"u"&&console.warn("THREE.ImageBitmapLoader: createImageBitmap() not supported."),typeof fetch>"u"&&console.warn("THREE.ImageBitmapLoader: fetch() not supported."),this.options={premultiplyAlpha:"none"}}setOptions(e){return this.options=e,this}load(e,t,r,i){e===void 0&&(e=""),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);const s=this,o=Yc.get(e);if(o!==void 0){if(s.manager.itemStart(e),o.then){o.then(c=>{t&&t(c),s.manager.itemEnd(e)}).catch(c=>{i&&i(c)});return}return setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o}const a={};a.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",a.headers=this.requestHeader;const l=fetch(e,a).then(function(c){return c.blob()}).then(function(c){return createImageBitmap(c,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(c){return Yc.add(e,c),t&&t(c),s.manager.itemEnd(e),c}).catch(function(c){i&&i(c),Yc.remove(e),s.manager.itemError(e),s.manager.itemEnd(e)});Yc.add(e,l),s.manager.itemStart(e)}}class Qz{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=pD(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let e=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const t=pD();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function pD(){return performance.now()}class aoe{constructor(e,t,r){this.binding=e,this.valueSize=r;let i,s,o;switch(t){case"quaternion":i=this._slerp,s=this._slerpAdditive,o=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(r*6),this._workIndex=5;break;case"string":case"bool":i=this._select,s=this._select,o=this._setAdditiveIdentityOther,this.buffer=new Array(r*5);break;default:i=this._lerp,s=this._lerpAdditive,o=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(r*5)}this._mixBufferRegion=i,this._mixBufferRegionAdditive=s,this._setIdentity=o,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(e,t){const r=this.buffer,i=this.valueSize,s=e*i+i;let o=this.cumulativeWeight;if(o===0){for(let a=0;a!==i;++a)r[s+a]=r[a];o=t}else{o+=t;const a=t/o;this._mixBufferRegion(r,s,0,a,i)}this.cumulativeWeight=o}accumulateAdditive(e){const t=this.buffer,r=this.valueSize,i=r*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(t,i,0,e,r),this.cumulativeWeightAdditive+=e}apply(e){const t=this.valueSize,r=this.buffer,i=e*t+t,s=this.cumulativeWeight,o=this.cumulativeWeightAdditive,a=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,s<1){const l=t*this._origIndex;this._mixBufferRegion(r,i,l,1-s,t)}o>0&&this._mixBufferRegionAdditive(r,i,this._addIndex*t,1,t);for(let l=t,c=t+t;l!==c;++l)if(r[l]!==r[l+t]){a.setValue(r,i);break}}saveOriginalState(){const e=this.binding,t=this.buffer,r=this.valueSize,i=r*this._origIndex;e.getValue(t,i);for(let s=r,o=i;s!==o;++s)t[s]=t[i+s%r];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const e=this.valueSize*3;this.binding.setValue(this.buffer,e)}_setAdditiveIdentityNumeric(){const e=this._addIndex*this.valueSize,t=e+this.valueSize;for(let r=e;r=.5)for(let o=0;o!==s;++o)e[t+o]=e[r+o]}_slerp(e,t,r,i){tt.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;tt.multiplyQuaternionsFlat(e,o,e,t,e,r),tt.slerpFlat(e,t,e,t,e,o,i)}_lerp(e,t,r,i,s){const o=1-i;for(let a=0;a!==s;++a){const l=t+a;e[l]=e[l]*o+e[r+a]*i}}_lerpAdditive(e,t,r,i,s){for(let o=0;o!==s;++o){const a=t+o;e[a]=e[a]+e[r+o]*i}}}const VR="\\[\\]\\.:\\/",loe=new RegExp("["+VR+"]","g"),jR="[^"+VR+"]",coe="[^"+VR.replace("\\.","")+"]",Aoe=/((?:WC+[\/:])*)/.source.replace("WC",jR),uoe=/(WCOD+)?/.source.replace("WCOD",coe),foe=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",jR),hoe=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",jR),doe=new RegExp("^"+Aoe+uoe+foe+hoe+"$"),poe=["material","materials","bones","map"];class moe{constructor(e,t,r){const i=r||Mt.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,i)}getValue(e,t){this.bind();const r=this._targetGroup.nCachedObjects_,i=this._bindings[r];i!==void 0&&i.getValue(e,t)}setValue(e,t){const r=this._bindings;for(let i=this._targetGroup.nCachedObjects_,s=r.length;i!==s;++i)r[i].setValue(e,t)}bind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].bind()}unbind(){const e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,r=e.length;t!==r;++t)e[t].unbind()}}class Mt{constructor(e,t,r){this.path=t,this.parsedPath=r||Mt.parseTrackName(t),this.node=Mt.findNode(e,this.parsedPath.nodeName),this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new Mt.Composite(e,t,r):new Mt(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(loe,"")}static parseTrackName(e){const t=doe.exec(e);if(t===null)throw new Error("PropertyBinding: Cannot parse trackName: "+e);const r={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},i=r.nodeName&&r.nodeName.lastIndexOf(".");if(i!==void 0&&i!==-1){const s=r.nodeName.substring(i+1);poe.indexOf(s)!==-1&&(r.nodeName=r.nodeName.substring(0,i),r.objectName=s)}if(r.propertyName===null||r.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+e);return r}static findNode(e,t){if(t===void 0||t===""||t==="."||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){const r=e.skeleton.getBoneByName(t);if(r!==void 0)return r}if(e.children){const r=function(s){for(let o=0;o0){const l=this._interpolants,c=this._propertyBindings;switch(this.blendMode){case xJ:for(let A=0,u=l.length;A!==u;++A)l[A].evaluate(o),c[A].accumulateAdditive(a);break;case RR:default:for(let A=0,u=l.length;A!==u;++A)l[A].evaluate(o),c[A].accumulate(i,a)}}}_updateWeight(e){let t=0;if(this.enabled){t=this.weight;const r=this._weightInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopFading(),i===0&&(this.enabled=!1))}}return this._effectiveWeight=t,t}_updateTimeScale(e){let t=0;if(!this.paused){t=this.timeScale;const r=this._timeScaleInterpolant;if(r!==null){const i=r.evaluate(e)[0];t*=i,e>r.parameterPositions[1]&&(this.stopWarping(),t===0?this.paused=!0:this.timeScale=t)}}return this._effectiveTimeScale=t,t}_updateTime(e){const t=this._clip.duration,r=this.loop;let i=this.time+e,s=this._loopCount;const o=r===_J;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===yJ){s===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));e:{if(i>=t)i=t;else if(i<0)i=0;else{this.time=i;break e}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e<0?-1:1})}}else{if(s===-1&&(e>=0?(s=0,this._setEndings(!0,this.repetitions===0,o)):this._setEndings(this.repetitions===0,!0,o)),i>=t||i<0){const a=Math.floor(i/t);i-=t*a,s+=Math.abs(a);const l=this.repetitions-s;if(l<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,i=e>0?t:0,this.time=i,this._mixer.dispatchEvent({type:"finished",action:this,direction:e>0?1:-1});else{if(l===1){const c=e<0;this._setEndings(c,!c,o)}else this._setEndings(!1,!1,o);this._loopCount=s,this.time=i,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:a})}}else this.time=i;if(o&&(s&1)===1)return t-i}return i}_setEndings(e,t,r){const i=this._interpolantSettings;r?(i.endingStart=Dh,i.endingEnd=Dh):(e?i.endingStart=this.zeroSlopeAtStart?Dh:Lh:i.endingStart=U_,t?i.endingEnd=this.zeroSlopeAtEnd?Dh:Lh:i.endingEnd=U_)}_scheduleFading(e,t,r){const i=this._mixer,s=i.time;let o=this._weightInterpolant;o===null&&(o=i._lendControlInterpolant(),this._weightInterpolant=o);const a=o.parameterPositions,l=o.sampleValues;return a[0]=s,l[0]=t,a[1]=s+e,l[1]=r,this}}const voe=new Float32Array(1);class yoe extends RA{constructor(e){super(),this._root=e,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(e,t){const r=e._localRoot||this._root,i=e._clip.tracks,s=i.length,o=e._propertyBindings,a=e._interpolants,l=r.uuid,c=this._bindingsByRootAndName;let A=c[l];A===void 0&&(A={},c[l]=A);for(let u=0;u!==s;++u){const f=i[u],h=f.name;let d=A[h];if(d!==void 0)++d.referenceCount,o[u]=d;else{if(d=o[u],d!==void 0){d._cacheIndex===null&&(++d.referenceCount,this._addInactiveBinding(d,l,h));continue}const m=t&&t._propertyBindings[u].binding.parsedPath;d=new aoe(Mt.create(r,h,m),f.ValueTypeName,f.getValueSize()),++d.referenceCount,this._addInactiveBinding(d,l,h),o[u]=d}a[u].resultBuffer=d.buffer}}_activateAction(e){if(!this._isActiveAction(e)){if(e._cacheIndex===null){const r=(e._localRoot||this._root).uuid,i=e._clip.uuid,s=this._actionsByClip[i];this._bindAction(e,s&&s.knownActions[0]),this._addInactiveAction(e,i,r)}const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];s.useCount++===0&&(this._lendBinding(s),s.saveOriginalState())}this._lendAction(e)}}_deactivateAction(e){if(this._isActiveAction(e)){const t=e._propertyBindings;for(let r=0,i=t.length;r!==i;++r){const s=t[r];--s.useCount===0&&(s.restoreOriginalState(),this._takeBackBinding(s))}this._takeBackAction(e)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const e=this;this.stats={actions:{get total(){return e._actions.length},get inUse(){return e._nActiveActions}},bindings:{get total(){return e._bindings.length},get inUse(){return e._nActiveBindings}},controlInterpolants:{get total(){return e._controlInterpolants.length},get inUse(){return e._nActiveControlInterpolants}}}}_isActiveAction(e){const t=e._cacheIndex;return t!==null&&t=0;--r)e[r].stop();return this}update(e){e*=this.timeScale;const t=this._actions,r=this._nActiveActions,i=this.time+=e,s=Math.sign(e),o=this._accuIndex^=1;for(let c=0;c!==r;++c)t[c]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let c=0;c!==l;++c)a[c].apply(o);return this}setTime(e){this.time=0;for(let t=0;tMath.PI&&(r-=Vi),i<-Math.PI?i+=Vi:i>Math.PI&&(i-=Vi),r<=i?this._spherical.theta=Math.max(r,Math.min(i,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(r+i)/2?Math.max(r,this._spherical.theta):Math.min(i,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let s=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{const o=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),s=o!=this._spherical.radius}if(Ir.setFromSpherical(this._spherical),Ir.applyQuaternion(this._quatInverse),t.copy(this.target).add(Ir),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let o=null;if(this.object.isPerspectiveCamera){const a=Ir.length();o=this._clampDistance(a*this._scale);const l=a-o;this.object.position.addScaledVector(this._dollyDirection,l),this.object.updateMatrixWorld(),s=!!l}else if(this.object.isOrthographicCamera){const a=new $(this._mouse.x,this._mouse.y,0);a.unproject(this.object);const l=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),s=l!==this.object.zoom;const c=new $(this._mouse.x,this._mouse.y,0);c.unproject(this.object),this.object.position.sub(c).add(a),this.object.updateMatrixWorld(),o=Ir.length()}else console.warn("WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled."),this.zoomToCursor=!1;o!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(o).add(this.object.position):(Vv.origin.copy(this.object.position),Vv.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(Vv.direction))YE||8*(1-this._lastQuaternion.dot(this.object.quaternion))>YE||this._lastTargetPosition.distanceToSquared(this.target)>YE?(this.dispatchEvent(_D),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e!==null?Vi/60*this.autoRotateSpeed*e:Vi/60/60*this.autoRotateSpeed}_getZoomScale(e){const t=Math.abs(e*.01);return Math.pow(.95,this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){Ir.setFromMatrixColumn(t,0),Ir.multiplyScalar(-e),this._panOffset.add(Ir)}_panUp(e,t){this.screenSpacePanning===!0?Ir.setFromMatrixColumn(t,1):(Ir.setFromMatrixColumn(t,0),Ir.crossVectors(this.object.up,Ir)),Ir.multiplyScalar(e),this._panOffset.add(Ir)}_pan(e,t){const r=this.domElement;if(this.object.isPerspectiveCamera){const i=this.object.position;Ir.copy(i).sub(this.target);let s=Ir.length();s*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*s/r.clientHeight,this.object.matrix),this._panUp(2*t*s/r.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/r.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/r.clientHeight,this.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;const r=this.domElement.getBoundingClientRect(),i=e-r.left,s=t-r.top,o=r.width,a=r.height;this._mouse.x=i/o*2-1,this._mouse.y=-(s/a)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Vi*this._rotateDelta.x/t.clientHeight),this._rotateUp(Vi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateUp(-Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this._rotateLeft(-Vi*this.rotateSpeed/this.domElement.clientHeight):this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._rotateStart.set(r,i)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panStart.set(r,i)}}_handleTouchStartDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyStart.set(0,s)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{const r=this._getSecondPointerPosition(e),i=.5*(e.pageX+r.x),s=.5*(e.pageY+r.y);this._rotateEnd.set(i,s)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);const t=this.domElement;this._rotateLeft(Vi*this._rotateDelta.x/t.clientHeight),this._rotateUp(Vi*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{const t=this._getSecondPointerPosition(e),r=.5*(e.pageX+t.x),i=.5*(e.pageY+t.y);this._panEnd.set(r,i)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){const t=this._getSecondPointerPosition(e),r=e.pageX-t.x,i=e.pageY-t.y,s=Math.sqrt(r*r+i*i);this._dollyEnd.set(0,s),this._dollyDelta.set(0,Math.pow(this._dollyEnd.y/this._dollyStart.y,this.zoomSpeed)),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);const o=(e.pageX+t.x)*.5,a=(e.pageY+t.y)*.5;this._updateZoomParameters(o,a)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t=2.0 are supported."));return}const c=new dae(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let A=0;A=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}c.setExtensions(o),c.setPlugins(a),c.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function Doe(){let n={};return{get:function(e){return n[e]},add:function(e,t){n[e]=t},remove:function(e){delete n[e]},removeAll:function(){n={}}}}const Rt={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 Noe{constructor(e){this.parser=e,this.name=Rt.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const e=this.parser,t=this.parser.json.nodes||[];for(let r=0,i=t.length;r=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return t.loadTextureImage(e,s.source,o)}}class Zoe{constructor(e){this.parser=e,this.name=Rt.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return r.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 qoe{constructor(e){this.parser=e,this.name=Rt.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(e){const t=this.name,r=this.parser,i=r.json,s=i.textures[e];if(!s.extensions||!s.extensions[t])return null;const o=s.extensions[t],a=i.images[o.source];let l=r.textureLoader;if(a.uri){const c=r.options.manager.getHandler(a.uri);c!==null&&(l=c)}return this.detectSupport().then(function(c){if(c)return r.loadTextureImage(e,o.source,l);if(i.extensionsRequired&&i.extensionsRequired.indexOf(t)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return r.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 Joe{constructor(e){this.name=Rt.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){const t=this.parser.json,r=t.bufferViews[e];if(r.extensions&&r.extensions[this.name]){const i=r.extensions[this.name],s=this.parser.getDependency("buffer",i.buffer),o=this.parser.options.meshoptDecoder;if(!o||!o.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 s.then(function(a){const l=i.byteOffset||0,c=i.byteLength||0,A=i.count,u=i.byteStride,f=new Uint8Array(a,l,c);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(A,u,f,i.mode,i.filter).then(function(h){return h.buffer}):o.ready.then(function(){const h=new ArrayBuffer(A*u);return o.decodeGltfBuffer(new Uint8Array(h),A,u,f,i.mode,i.filter),h})})}else return null}}let eae=class{constructor(e){this.name=Rt.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){const t=this.parser.json,r=t.nodes[e];if(!r.extensions||!r.extensions[this.name]||r.mesh===void 0)return null;const i=t.meshes[r.mesh];for(const c of i.primitives)if(c.mode!==eo.TRIANGLES&&c.mode!==eo.TRIANGLE_STRIP&&c.mode!==eo.TRIANGLE_FAN&&c.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const c in o)a.push(this.parser.getDependency("accessor",o[c]).then(A=>(l[c]=A,l[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(c=>{const A=c.pop(),u=A.isGroup?A.children:[A],f=c[0].count,h=[];for(const d of u){const m=new ke,g=new $,p=new tt,v=new $(1,1,1),w=new u1(d.geometry,d.material,f);for(let _=0;_0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const hae=new ke;class dae{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Doe,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 r=!1,i=-1,s=!1,o=-1;if(typeof navigator<"u"){const a=navigator.userAgent;r=/^((?!chrome|android).)*safari/i.test(a)===!0;const l=a.match(/Version\/(\d+)/);i=r&&l?parseInt(l[1],10):-1,s=a.indexOf("Firefox")>-1,o=s?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||r&&i<17||s&&o<98?this.textureLoader=new Xu(this.options.manager):this.textureLoader=new ooe(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new d1(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 r=this,i=this.json,s=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(o){return o._markDefs&&o._markDefs()}),Promise.all(this._invokeAll(function(o){return o.beforeRoot&&o.beforeRoot()})).then(function(){return Promise.all([r.getDependencies("scene"),r.getDependencies("animation"),r.getDependencies("camera")])}).then(function(o){const a={scene:o[0][i.scene||0],scenes:o[0],animations:o[1],cameras:o[2],asset:i.asset,parser:r,userData:{}};return GA(s,a,i),Rl(a,i),Promise.all(r._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||[],r=this.json.meshes||[];for(let i=0,s=t.length;i{const l=this.associations.get(o);l!=null&&this.associations.set(a,l);for(const[c,A]of o.children.entries())s(A,a.children[c])};return s(r,i),i.name+="_instance_"+e.uses[t]++,i}_invokeOne(e){const t=Object.values(this.plugins);t.push(this);for(let r=0;r=2&&g.setY(I,b[B*l+1]),l>=3&&g.setZ(I,b[B*l+2]),l>=4&&g.setW(I,b[B*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}g.normalized=d}return g})}loadTexture(e){const t=this.json,r=this.options,s=t.textures[e].source,o=t.images[s];let a=this.textureLoader;if(o.uri){const l=r.manager.getHandler(o.uri);l!==null&&(a=l)}return this.loadTextureImage(e,s,a)}loadTextureImage(e,t,r){const i=this,s=this.json,o=s.textures[e],a=s.images[t],l=(a.uri||a.bufferView)+":"+o.sampler;if(this.textureCache[l])return this.textureCache[l];const c=this.loadImageSource(t,r).then(function(A){A.flipY=!1,A.name=o.name||a.name||"",A.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(A.name=a.uri);const f=(s.samplers||{})[o.sampler]||{};return A.magFilter=BD[f.magFilter]||Lr,A.minFilter=BD[f.minFilter]||qo,A.wrapS=SD[f.wrapS]||Qs,A.wrapT=SD[f.wrapT]||Qs,i.associations.set(A,{textures:e}),A}).catch(function(){return null});return this.textureCache[l]=c,c}loadImageSource(e,t){const r=this,i=this.json,s=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(u=>u.clone());const o=i.images[e],a=self.URL||self.webkitURL;let l=o.uri||"",c=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(u){c=!0;const f=new Blob([u],{type:o.mimeType});return l=a.createObjectURL(f),l});else if(o.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+e+" is missing URI and bufferView");const A=Promise.resolve(l).then(function(u){return new Promise(function(f,h){let d=f;t.isImageBitmapLoader===!0&&(d=function(m){const g=new Hn(m);g.needsUpdate=!0,f(g)}),t.load(od.resolveURL(u,s.path),d,void 0,h)})}).then(function(u){return c===!0&&a.revokeObjectURL(l),Rl(u,o),u.userData.mimeType=o.mimeType||fae(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=A,A}assignTexture(e,t,r,i){const s=this;return this.getDependency("texture",r.index).then(function(o){if(!o)return null;if(r.texCoord!==void 0&&r.texCoord>0&&(o=o.clone(),o.channel=r.texCoord),s.extensions[Rt.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[Rt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Rt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.colorSpace=i),e[t]=o,o})}assignFinalMaterial(e){const t=e.geometry;let r=e.material;const i=t.attributes.tangent===void 0,s=t.attributes.color!==void 0,o=t.attributes.normal===void 0;if(e.isPoints){const a="PointsMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Iz,os.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,l.sizeAttenuation=!1,this.cache.add(a,l)),r=l}else if(e.isLine){const a="LineBasicMaterial:"+r.uuid;let l=this.cache.get(a);l||(l=new Ac,os.prototype.copy.call(l,r),l.color.copy(r.color),l.map=r.map,this.cache.add(a,l)),r=l}if(i||s||o){let a="ClonedMaterial:"+r.uuid+":";i&&(a+="derivative-tangents:"),s&&(a+="vertex-colors:"),o&&(a+="flat-shading:");let l=this.cache.get(a);l||(l=r.clone(),s&&(l.vertexColors=!0),o&&(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(r))),r=l}e.material=r}getMaterialType(){return Nd}loadMaterial(e){const t=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},c=[];if(l[Rt.KHR_MATERIALS_UNLIT]){const u=i[Rt.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),c.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new He(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.setRGB(f[0],f[1],f[2],Mr),a.opacity=f[3]}u.baseColorTexture!==void 0&&c.push(t.assignTexture(a,"map",u.baseColorTexture,kt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),c.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=_i);const A=s.alphaMode||ZE.OPAQUE;if(A===ZE.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,A===ZE.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==qi&&(c.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new je(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}if(s.occlusionTexture!==void 0&&o!==qi&&(c.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==qi){const u=s.emissiveFactor;a.emissive=new He().setRGB(u[0],u[1],u[2],Mr)}return s.emissiveTexture!==void 0&&o!==qi&&c.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,kt)),Promise.all(c).then(function(){const u=new o(a);return s.name&&(u.name=s.name),Rl(u,s),t.associations.set(u,{materials:e}),s.extensions&&GA(i,u,s),u})}createUniqueName(e){const t=Mt.sanitizeNodeName(e||"");return t in this.nodeNamesUsed?t+"_"+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[Rt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return MD(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&Aae(p,s),p.name=t.createUniqueName(s.name||"mesh_"+e),Rl(p,s),g.extensions&&GA(i,p,g),t.assignFinalMaterial(p),u.push(p)}for(let h=0,d=u.length;h1?A=new ri:c.length===1?A=c[0]:A=new Ft,A!==c[0])for(let u=0,f=c.length;u{const u=new Map;for(const[f,h]of i.associations)(f instanceof os||f instanceof Hn)&&u.set(f,h);return A.traverse(f=>{const h=i.associations.get(f);h!=null&&u.set(f,h)}),u};return i.associations=c(s),s})}_createAnimationTracks(e,t,r,i,s){const o=[],a=e.name?e.name:e.uuid,l=[];Sc[s.path]===Sc.weights?e.traverse(function(f){f.morphTargetInfluences&&l.push(f.name?f.name:f.uuid)}):l.push(a);let c;switch(Sc[s.path]){case Sc.weights:c=Lu;break;case Sc.rotation:c=Ja;break;case Sc.position:case Sc.scale:c=ic;break;default:switch(r.itemSize){case 1:c=Lu;break;case 2:case 3:default:c=ic;break}break}const A=i.interpolation!==void 0?aae[i.interpolation]:Pd,u=this._getArrayFromAccessor(r);for(let f=0,h=l.length;f Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE version 0.8.2 -*/var so=Uint8Array,Dh=Uint16Array,Aae=Int32Array,Wz=new so([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]),Kz=new so([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]),uae=new so([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Xz=function(n,e){for(var t=new Dh(31),r=0;r<31;++r)t[r]=e+=1<>1|(Tn&21845)<<1;Bc=(Bc&52428)>>2|(Bc&13107)<<2,Bc=(Bc&61680)>>4|(Bc&3855)<<4,FC[Tn]=((Bc&65280)>>8|(Bc&255)<<8)>>1}var eg=function(n,e,t){for(var r=n.length,i=0,s=new Dh(e);i>l]=c}else for(a=new Dh(r),i=0;i>15-n[i]);return a},y0=new so(288);for(var Tn=0;Tn<144;++Tn)y0[Tn]=8;for(var Tn=144;Tn<256;++Tn)y0[Tn]=9;for(var Tn=256;Tn<280;++Tn)y0[Tn]=7;for(var Tn=280;Tn<288;++Tn)y0[Tn]=8;var Zz=new so(32);for(var Tn=0;Tn<32;++Tn)Zz[Tn]=5;var pae=eg(y0,9,1),mae=eg(Zz,5,1),$E=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},Do=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},ZE=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},gae=function(n){return(n+7)/8|0},vae=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new so(n.subarray(e,t))},yae=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],jo=function(n,e,t){var r=new Error(e||yae[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,jo),!t)throw r;return r},wae=function(n,e,t,r){var i=n.length,s=r?r.length:0;if(!i||e.f&&!e.l)return t||new so(0);var o=!t,a=o||e.i!=2,l=e.i;o&&(t=new so(i*3));var c=function(ve){var be=t.length;if(ve>be){var ne=new so(Math.max(be*2,ve));ne.set(t),t=ne}},A=e.f||0,u=e.p||0,f=e.b||0,h=e.l,d=e.d,m=e.m,g=e.n,p=i*8;do{if(!h){A=Do(n,u,1);var v=Do(n,u+1,3);if(u+=3,v)if(v==1)h=pae,d=mae,m=9,g=5;else if(v==2){var b=Do(n,u,31)+257,B=Do(n,u+10,15)+4,M=b+Do(n,u+5,31)+1;u+=14;for(var I=new so(M),S=new so(19),L=0;L>4;if(w<16)I[L++]=w;else{var U=0,P=0;for(w==16?(P=3+Do(n,u,3),u+=2,U=I[L-1]):w==17?(P=3+Do(n,u,7),u+=3):w==18&&(P=11+Do(n,u,127),u+=7);P--;)I[L++]=U}}var N=I.subarray(0,b),z=I.subarray(b);m=$E(N),g=$E(z),h=eg(N,m,1),d=eg(z,g,1)}else jo(1);else{var w=gae(u)+4,_=n[w-4]|n[w-3]<<8,x=w+_;if(x>i){l&&jo(0);break}a&&c(f+_),t.set(n.subarray(w,x),f),e.b=f+=_,e.p=u=x*8,e.f=A;continue}if(u>p){l&&jo(0);break}}a&&c(f+131072);for(var W=(1<>4;if(u+=U&15,u>p){l&&jo(0);break}if(U||jo(2),K<256)t[f++]=K;else if(K==256){C=u,h=null;break}else{var te=K-254;if(K>264){var L=K-257,F=Wz[L];te=Do(n,u,(1<>4;re||jo(3),u+=re&15;var z=dae[ce];if(ce>3){var F=Kz[ce];z+=ZE(n,u)&(1<p){l&&jo(0);break}a&&c(f+131072);var oe=f+te;if(f>4>7||(n[0]<<8|n[1])%31)&&jo(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&jo(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function bae(n,e){return wae(n.subarray(xae(n,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}var Eae=typeof TextDecoder<"u"&&new TextDecoder,Bae=0;try{Eae.decode(_ae,{stream:!0}),Bae=1}catch{}function qz(n,e,t){const r=t.length-n-1;if(e>=t[r])return r-1;if(e<=t[n])return n;let i=n,s=r,o=Math.floor((i+s)/2);for(;e=t[o+1];)e=m&&(d[h][0]=d[f][0]/a[v+1][p],g=d[h][0]*a[p][v]);const w=p>=-1?1:-p,_=u-1<=v?m-1:t-u;for(let b=w;b<=_;++b)d[h][b]=(d[f][b]-d[f][b-1])/a[v+1][p+b],g+=d[h][b]*a[p+b][v];u<=v&&(d[h][m]=-d[f][m-1]/a[v+1][u],g+=d[h][m]*a[u][v]),o[m][u]=g;const x=f;f=h,h=x}}let A=t;for(let u=1;u<=r;++u){for(let f=0;f<=t;++f)o[u][f]*=A;A*=t-u}return o}function Tae(n,e,t,r,i){const s=i0,l=typeof s.Content=="string"&&s.Content!=="";if(a||l){const c=this.parseImage(r[i]);t[s.RelativeFilename||s.Filename]=c}}}}for(const r in e){const i=e[r];t[i]!==void 0?e[r]=t[i]:e[r]=e[r].split("\\").pop()}return e}parseImage(e){const t=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();let s;switch(i){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",r),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in St.Objects){const r=St.Objects.Texture;for(const i in r){const s=this.parseTexture(r[i],e);t.set(parseInt(i),s)}}return t}parseTexture(e,t){const r=this.loadTexture(e,t);r.ID=e.id,r.name=e.attrName;const i=e.WrapModeU,s=e.WrapModeV,o=i!==void 0?i.value:0,a=s!==void 0?s.value:0;if(r.wrapS=o===0?Hs:Zo,r.wrapT=a===0?Hs:Zo,"Scaling"in e){const l=e.Scaling.value;r.repeat.x=l[0],r.repeat.y=l[1]}if("Translation"in e){const l=e.Translation.value;r.offset.x=l[0],r.offset.y=l[1]}return r}loadTexture(e,t){const r=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),i=e.FileName.split(".").pop().toLowerCase(),s=r.has(i)?this.manager.getHandler(`.${i}`):this.textureLoader;if(!s)return console.warn(`FBXLoader: ${i.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new Hn;const o=s.path;o||s.setPath(this.textureLoader.path);const a=Ar.get(e.id).children;let l;a!==void 0&&a.length>0&&t[a[0].ID]!==void 0&&(l=t[a[0].ID],(l.indexOf("blob:")===0||l.indexOf("data:")===0)&&s.setPath(void 0));const c=s.load(l);return s.setPath(o),c}parseMaterials(e){const t=new Map;if("Material"in St.Objects){const r=St.Objects.Material;for(const i in r){const s=this.parseMaterial(r[i],e);s!==null&&t.set(parseInt(i),s)}}return t}parseMaterial(e,t){const r=e.id,i=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!Ar.has(r))return null;const o=this.parseParameters(e,t,r);let a;switch(s.toLowerCase()){case"phong":a=new GE;break;case"lambert":a=new Qse;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new GE;break}return a.setValues(o),a.name=i,a}parseParameters(e,t,r){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=bt.toWorkingColorSpace(new He().fromArray(e.Diffuse.value),kt):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=bt.toWorkingColorSpace(new He().fromArray(e.DiffuseColor.value),kt)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=bt.toWorkingColorSpace(new He().fromArray(e.Emissive.value),kt):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=bt.toWorkingColorSpace(new He().fromArray(e.EmissiveColor.value),kt)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=bt.toWorkingColorSpace(new He().fromArray(e.Specular.value),kt):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=bt.toWorkingColorSpace(new He().fromArray(e.SpecularColor.value),kt));const s=this;return Ar.get(r).children.forEach(function(o){const a=o.relationship;switch(a){case"Bump":i.bumpMap=s.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":i.aoMap=s.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=s.getTexture(t,o.ID),i.map!==void 0&&(i.map.colorSpace=kt);break;case"DisplacementColor":i.displacementMap=s.getTexture(t,o.ID);break;case"EmissiveColor":i.emissiveMap=s.getTexture(t,o.ID),i.emissiveMap!==void 0&&(i.emissiveMap.colorSpace=kt);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=s.getTexture(t,o.ID);break;case"ReflectionColor":i.envMap=s.getTexture(t,o.ID),i.envMap!==void 0&&(i.envMap.mapping=T_,i.envMap.colorSpace=kt);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&(i.specularMap.colorSpace=kt);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=s.getTexture(t,o.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),i}getTexture(e,t){return"LayeredTexture"in St.Objects&&t in St.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ar.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in St.Objects){const r=St.Objects.Deformer;for(const i in r){const s=r[i],o=Ar.get(parseInt(i));if(s.attrType==="Skin"){const a=this.parseSkeleton(o,r);a.ID=i,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[i]=a}else if(s.attrType==="BlendShape"){const a={id:i};a.rawTargets=this.parseMorphTargets(o,r),a.id=i,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const r=[];return e.children.forEach(function(i){const s=t[i.ID];if(s.attrType!=="Cluster")return;const o={ID:i.ID,indices:[],weights:[],transformLink:new ke().fromArray(s.TransformLink.a)};"Indexes"in s&&(o.indices=s.Indexes.a,o.weights=s.Weights.a),r.push(o)}),{rawBones:r,bones:[]}}parseMorphTargets(e,t){const r=[];for(let i=0;i1?o=a:a.length>0?o=a[0]:(o=new GE({name:nc.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new Va(s,o),i.normalizeSkinWeights()):i=new hn(s,o),i}createCurve(e,t){const r=e.children.reduce(function(s,o){return t.has(o.ID)&&(s=t.get(o.ID)),s},null),i=new lc({name:nc.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Xd(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=jg(t.RotationOrder.value):r.eulerOrder=jg(0),"Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}setLookAtProperties(e,t){"LookAtProperty"in t&&Ar.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=St.Objects.Model[i.ID];if("Lcl_Translation"in s){const o=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),Ri.add(e.target)):e.lookAt(new $().fromArray(o))}}})}bindSkeleton(e,t,r){const i=this.parsePoseNodes();for(const s in e){const o=e[s];Ar.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const c=l.ID;Ar.get(c).parents.forEach(function(u){r.has(u.ID)&&r.get(u.ID).bind(new IA(o.bones),i[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in St.Objects){const t=St.Objects.Pose;for(const r in t)if(t[r].attrType==="BindPose"&&t[r].NbPoseNodes>0){const i=t[r].PoseNode;Array.isArray(i)?i.forEach(function(s){e[s.Node]=new ke().fromArray(s.Matrix.a)}):e[i.Node]=new ke().fromArray(i.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in St){if("AmbientColor"in St.GlobalSettings){const e=St.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(t!==0||r!==0||i!==0){const s=new He().setRGB(t,r,i,kt);Ri.add(new Oz(s,1))}}"UnitScaleFactor"in St.GlobalSettings&&(Ri.userData.unitScaleFactor=St.GlobalSettings.UnitScaleFactor.value)}}}class Dae{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in St.Objects){const r=St.Objects.Geometry;for(const i in r){const s=Ar.get(parseInt(i)),o=this.parseGeometry(s,r[i],e);t.set(parseInt(i),o)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,r){const i=r.skeletons,s=[],o=e.parents.map(function(u){return St.Objects.Model[u.ID]});if(o.length===0)return;const a=e.children.reduce(function(u,f){return i[f.ID]!==void 0&&(u=i[f.ID]),u},null);e.children.forEach(function(u){r.morphTargets[u.ID]!==void 0&&s.push(r.morphTargets[u.ID])});const l=o[0],c={};"RotationOrder"in l&&(c.eulerOrder=jg(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);const A=e8(c);return this.genGeometry(t,a,s,A)}genGeometry(e,t,r,i){const s=new Zt;e.attrName&&(s.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),l=new xn(a.vertex,3);if(l.applyMatrix4(i),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new xn(a.colors,3)),t&&(s.setAttribute("skinIndex",new o1(a.weightsIndices,4)),s.setAttribute("skinWeight",new xn(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const c=new ut().getNormalMatrix(i),A=new xn(a.normal,3);A.applyNormalMatrix(c),s.setAttribute("normal",A)}if(a.uvs.forEach(function(c,A){const u=A===0?"uv":`uv${A}`;s.setAttribute(u,new xn(a.uvs[A],2))}),o.material&&o.material.mappingType!=="AllSame"){let c=a.materialIndex[0],A=0;if(a.materialIndex.forEach(function(u,f){u!==c&&(s.addGroup(A,f-A,c),c=u,A=f)}),s.groups.length>0){const u=s.groups[s.groups.length-1],f=u.start+u.count;f!==a.materialIndex.length&&s.addGroup(f,a.materialIndex.length-f,c)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,r,i),s}parseGeoNode(e,t){const r={};if(r.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],r.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return r.weightTable={},t!==null&&(r.skeleton=t,t.rawBones.forEach(function(i,s){i.indices.forEach(function(o,a){r.weightTable[o]===void 0&&(r.weightTable[o]=[]),r.weightTable[o].push({id:s,weight:i.weights[a]})})})),r}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let r=0,i=0,s=!1,o=[],a=[],l=[],c=[],A=[],u=[];const f=this;return e.vertexIndices.forEach(function(h,d){let m,g=!1;h<0&&(h=h^-1,g=!0);let p=[],v=[];if(o.push(h*3,h*3+1,h*3+2),e.color){const w=zv(d,r,h,e.color);l.push(w[0],w[1],w[2])}if(e.skeleton){if(e.weightTable[h]!==void 0&&e.weightTable[h].forEach(function(w){v.push(w.weight),p.push(w.id)}),v.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const w=[0,0,0,0],_=[0,0,0,0];v.forEach(function(x,b){let B=x,M=p[b];_.forEach(function(I,S,L){if(B>I){L[S]=B,B=I;const O=w[S];w[S]=M,M=O}})}),p=w,v=_}for(;v.length<4;)v.push(0),p.push(0);for(let w=0;w<4;++w)A.push(v[w]),u.push(p[w])}if(e.normal){const w=zv(d,r,h,e.normal);a.push(w[0],w[1],w[2])}e.material&&e.material.mappingType!=="AllSame"&&(m=zv(d,r,h,e.material)[0],m<0&&(f.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(w,_){const x=zv(d,r,h,w);c[_]===void 0&&(c[_]=[]),c[_].push(x[0]),c[_].push(x[1])}),i++,g&&(f.genFace(t,e,o,m,a,l,c,A,u,i),r++,i=0,o=[],a=[],l=[],c=[],A=[],u=[])}),t}getNormalNewell(e){const t=new $(0,0,0);for(let r=0;r.5?new $(0,1,0):new $(0,0,1)).cross(t).normalize(),s=t.clone().cross(i).normalize();return{normal:t,tangent:i,bitangent:s}}flattenVertex(e,t,r){return new je(e.dot(t),e.dot(r))}genFace(e,t,r,i,s,o,a,l,c,A){let u;if(A>3){const f=[],h=t.baseVertexPositions||t.vertexPositions;for(let p=0;p1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=e.get(s[0].ID);r[i]={name:t[i].attrName,layer:o}}return r}addClip(e){let t=[];const r=this;return e.layer.forEach(function(i){t=t.concat(r.generateTracks(i))}),new Fu(e.name,-1,t)}generateTracks(e){const t=[];let r=new $,i=new $;if(e.transform&&e.transform.decompose(r,new tt,i),r=r.toArray(),i=i.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,r,i){const s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,r);return new tc(e+"."+i,s,o)}generateRotationTrack(e,t,r,i,s){let o,a;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const f=this.interpolateRotations(t.x,t.y,t.z,s);o=f[0],a=f[1]}const l=jg(0);r!==void 0&&(r=r.map(Et.degToRad),r.push(l),r=new tr().fromArray(r),r=new tt().setFromEuler(r)),i!==void 0&&(i=i.map(Et.degToRad),i.push(l),i=new tr().fromArray(i),i=new tt().setFromEuler(i).invert());const c=new tt,A=new tr,u=[];if(!a||!o)return new qa(e+".quaternion",[0],[0]);for(let f=0;f2&&new tt().fromArray(u,(f-3)/3*4).dot(c)<0&&c.set(-c.x,-c.y,-c.z,-c.w),c.toArray(u,f/3*4);return new qa(e+".quaternion",o,u)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,r=t.values.map(function(s){return s/100}),i=Ri.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Uu(e.modelName+".morphTargetInfluences["+i+"]",t.times,r)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(r,i){return r-i}),t.length>1){let r=1,i=t[0];for(let s=1;s=180||h[1]>=180||h[2]>=180){const m=Math.max(...h)/180,g=new tr(...c,i),p=new tr(...u,i),v=new tt().setFromEuler(g),w=new tt().setFromEuler(p);v.dot(w)&&w.set(-w.x,-w.y,-w.z,-w.w);const _=e.times[a-1],x=e.times[a]-_,b=new tt,B=new tr;for(let M=0;M<1;M+=1/m)b.copy(v.clone().slerp(w.clone(),M)),s.push(_+M*x),B.setFromQuaternion(b,i),o.push(B.x),o.push(B.y),o.push(B.z)}else s.push(e.times[a]),o.push(Et.degToRad(e.values[a])),o.push(Et.degToRad(t.values[a])),o.push(Et.degToRad(r.values[a]))}return[s,o]}}class Oae{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new Jz,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,r=e.split(/[\r\n]+/);return r.forEach(function(i,s){const o=i.match(/^[\s\t]*;/),a=i.match(/^[\s\t]*$/);if(o||a)return;const l=i.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),c=i.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),A=i.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(i,l):c?t.parseNodeProperty(i,c,r[++s]):A?t.popStack():i.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(i)}),this.allNodes}parseNodeBegin(e,t){const r=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:r},o=this.parseNodeAttr(i),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(r,s):r in a?(r==="PoseNode"?a.PoseNode.push(s):a[r].id!==void 0&&(a[r]={},a[r][a[r].id]=a[r]),o.id!==""&&(a[r][o.id]=s)):typeof o.id=="number"?(a[r]={},a[r][o.id]=s):r!=="Properties70"&&(r==="PoseNode"?a[r]=[s]:a[r]=s),typeof o.id=="number"&&(s.id=o.id),o.name!==""&&(s.attrName=o.name),o.type!==""&&(s.attrType=o.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let r="",i="";return e.length>1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:r,type:i}}parseNodeProperty(e,t,r){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,i,s);return}if(i==="C"){const l=s.split(",").slice(1),c=parseInt(l[0]),A=parseInt(l[1]);let u=s.split(",").slice(3);u=u.map(function(f){return f.trim().replace(/^"/,"")}),i="connections",s=[c,A],Vae(s,u),o[i]===void 0&&(o[i]=[])}i==="Node"&&(o.id=s),i in o&&Array.isArray(o[i])?o[i].push(s):i!=="a"?o[i]=s:o.a=s,this.setCurrentProp(o,i),i==="a"&&s.slice(-1)!==","&&(o.a=JE(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=JE(t.a))}parseNodeSpecialProperty(e,t,r){const i=r.split('",').map(function(A){return A.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],o=i[1],a=i[2],l=i[3];let c=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=JE(c);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:c},this.setCurrentProp(this.getPrevNode(),s)}}class kae{parse(e){const t=new SD(e);t.skip(23);const r=t.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);const i=new Jz;for(;!this.endOfContent(t);){const s=this.parseNode(t,r);s!==null&&i.add(s.name,s)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const r={},i=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const o=e.getUint8(),a=e.getString(o);if(i===0)return null;const l=[];for(let f=0;f0?l[0]:"",A=l.length>1?l[1]:"",u=l.length>2?l[2]:"";for(r.singleProperty=s===1&&e.getOffset()===i;i>e.getOffset();){const f=this.parseNode(e,t);f!==null&&this.parseSubNode(a,r,f)}return r.propertyList=l,typeof c=="number"&&(r.id=c),A!==""&&(r.attrName=A),u!==""&&(r.attrType=u),a!==""&&(r.name=a),r}parseSubNode(e,t,r){if(r.singleProperty===!0){const i=r.propertyList[0];Array.isArray(i)?(t[r.name]=r,r.a=i):t[r.name]=i}else if(e==="Connections"&&r.name==="C"){const i=[];r.propertyList.forEach(function(s,o){o!==0&&i.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(r.name==="Properties70")Object.keys(r).forEach(function(s){t[s]=r[s]});else if(e==="Properties70"&&r.name==="P"){let i=r.propertyList[0],s=r.propertyList[1];const o=r.propertyList[2],a=r.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:l=r.propertyList[4],t[i]={type:s,type2:o,flag:a,value:l}}else t[r.name]===void 0?typeof r.id=="number"?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:r.name==="PoseNode"?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):t[r.name][r.id]===void 0&&(t[r.name][r.id]=r)}parseProperty(e){const t=e.getString(1);let r;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return r=e.getUint32(),e.getArrayBuffer(r);case"S":return r=e.getUint32(),e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),s=e.getUint32(),o=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const a=bae(new Uint8Array(e.getArrayBuffer(o))),l=new SD(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class SD{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let r=0;r=0&&(r=new Uint8Array(this.dv.buffer,t,i)),this._textDecoder.decode(r)}}class Jz{add(e,t){this[e]=t}}function Hae(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===t8(n,0,e.length)}function Qae(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function r(i){const s=n[i-1];return n=n.slice(t+i),t++,s}for(let i=0;i>1|(Tn&21845)<<1;Mc=(Mc&52428)>>2|(Mc&13107)<<2,Mc=(Mc&61680)>>4|(Mc&3855)<<4,DC[Tn]=((Mc&65280)>>8|(Mc&255)<<8)>>1}var tg=function(n,e,t){for(var r=n.length,i=0,s=new kh(e);i>l]=c}else for(a=new kh(r),i=0;i>15-n[i]);return a},_0=new oo(288);for(var Tn=0;Tn<144;++Tn)_0[Tn]=8;for(var Tn=144;Tn<256;++Tn)_0[Tn]=9;for(var Tn=256;Tn<280;++Tn)_0[Tn]=7;for(var Tn=280;Tn<288;++Tn)_0[Tn]=8;var Jz=new oo(32);for(var Tn=0;Tn<32;++Tn)Jz[Tn]=5;var _ae=tg(_0,9,1),xae=tg(Jz,5,1),JE=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},No=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},eB=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},bae=function(n){return(n+7)/8|0},Eae=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new oo(n.subarray(e,t))},Bae=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Wo=function(n,e,t){var r=new Error(e||Bae[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Wo),!t)throw r;return r},Sae=function(n,e,t,r){var i=n.length,s=r?r.length:0;if(!i||e.f&&!e.l)return t||new oo(0);var o=!t,a=o||e.i!=2,l=e.i;o&&(t=new oo(i*3));var c=function(ve){var be=t.length;if(ve>be){var ne=new oo(Math.max(be*2,ve));ne.set(t),t=ne}},A=e.f||0,u=e.p||0,f=e.b||0,h=e.l,d=e.d,m=e.m,g=e.n,p=i*8;do{if(!h){A=No(n,u,1);var v=No(n,u+1,3);if(u+=3,v)if(v==1)h=_ae,d=xae,m=9,g=5;else if(v==2){var b=No(n,u,31)+257,B=No(n,u+10,15)+4,S=b+No(n,u+5,31)+1;u+=14;for(var I=new oo(S),M=new oo(19),P=0;P>4;if(w<16)I[P++]=w;else{var R=0,L=0;for(w==16?(L=3+No(n,u,3),u+=2,R=I[P-1]):w==17?(L=3+No(n,u,7),u+=3):w==18&&(L=11+No(n,u,127),u+=7);L--;)I[P++]=R}}var N=I.subarray(0,b),z=I.subarray(b);m=JE(N),g=JE(z),h=tg(N,m,1),d=tg(z,g,1)}else Wo(1);else{var w=bae(u)+4,_=n[w-4]|n[w-3]<<8,x=w+_;if(x>i){l&&Wo(0);break}a&&c(f+_),t.set(n.subarray(w,x),f),e.b=f+=_,e.p=u=x*8,e.f=A;continue}if(u>p){l&&Wo(0);break}}a&&c(f+131072);for(var W=(1<>4;if(u+=R&15,u>p){l&&Wo(0);break}if(R||Wo(2),K<256)t[f++]=K;else if(K==256){C=u,h=null;break}else{var ee=K-254;if(K>264){var P=K-257,F=Xz[P];ee=No(n,u,(1<>4;re||Wo(3),u+=re&15;var z=wae[ce];if(ce>3){var F=Yz[ce];z+=eB(n,u)&(1<p){l&&Wo(0);break}a&&c(f+131072);var oe=f+ee;if(f>4>7||(n[0]<<8|n[1])%31)&&Wo(6,"invalid zlib data"),(n[1]>>5&1)==+!e&&Wo(6,"invalid zlib data: "+(n[1]&32?"need":"unexpected")+" dictionary"),(n[1]>>3&4)+2};function Tae(n,e){return Sae(n.subarray(Cae(n,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}var Iae=typeof TextDecoder<"u"&&new TextDecoder,Rae=0;try{Iae.decode(Mae,{stream:!0}),Rae=1}catch{}function e8(n,e,t){const r=t.length-n-1;if(e>=t[r])return r-1;if(e<=t[n])return n;let i=n,s=r,o=Math.floor((i+s)/2);for(;e=t[o+1];)e=m&&(d[h][0]=d[f][0]/a[v+1][p],g=d[h][0]*a[p][v]);const w=p>=-1?1:-p,_=u-1<=v?m-1:t-u;for(let b=w;b<=_;++b)d[h][b]=(d[f][b]-d[f][b-1])/a[v+1][p+b],g+=d[h][b]*a[p+b][v];u<=v&&(d[h][m]=-d[f][m-1]/a[v+1][u],g+=d[h][m]*a[u][v]),o[m][u]=g;const x=f;f=h,h=x}}let A=t;for(let u=1;u<=r;++u){for(let f=0;f<=t;++f)o[u][f]*=A;A*=t-u}return o}function Lae(n,e,t,r,i){const s=i0,l=typeof s.Content=="string"&&s.Content!=="";if(a||l){const c=this.parseImage(r[i]);t[s.RelativeFilename||s.Filename]=c}}}}for(const r in e){const i=e[r];t[i]!==void 0?e[r]=t[i]:e[r]=e[r].split("\\").pop()}return e}parseImage(e){const t=e.Content,r=e.RelativeFilename||e.Filename,i=r.slice(r.lastIndexOf(".")+1).toLowerCase();let s;switch(i){case"bmp":s="image/bmp";break;case"jpg":case"jpeg":s="image/jpeg";break;case"png":s="image/png";break;case"tif":s="image/tiff";break;case"tga":this.manager.getHandler(".tga")===null&&console.warn("FBXLoader: TGA loader not found, skipping ",r),s="image/tga";break;default:console.warn('FBXLoader: Image type "'+i+'" is not supported.');return}if(typeof t=="string")return"data:"+s+";base64,"+t;{const o=new Uint8Array(t);return window.URL.createObjectURL(new Blob([o],{type:s}))}}parseTextures(e){const t=new Map;if("Texture"in St.Objects){const r=St.Objects.Texture;for(const i in r){const s=this.parseTexture(r[i],e);t.set(parseInt(i),s)}}return t}parseTexture(e,t){const r=this.loadTexture(e,t);r.ID=e.id,r.name=e.attrName;const i=e.WrapModeU,s=e.WrapModeV,o=i!==void 0?i.value:0,a=s!==void 0?s.value:0;if(r.wrapS=o===0?Qs:Is,r.wrapT=a===0?Qs:Is,"Scaling"in e){const l=e.Scaling.value;r.repeat.x=l[0],r.repeat.y=l[1]}if("Translation"in e){const l=e.Translation.value;r.offset.x=l[0],r.offset.y=l[1]}return r}loadTexture(e,t){const r=new Set(["tga","tif","tiff","exr","dds","hdr","ktx2"]),i=e.FileName.split(".").pop().toLowerCase(),s=r.has(i)?this.manager.getHandler(`.${i}`):this.textureLoader;if(!s)return console.warn(`FBXLoader: ${i.toUpperCase()} loader not found, creating placeholder texture for`,e.RelativeFilename),new Hn;const o=s.path;o||s.setPath(this.textureLoader.path);const a=Ar.get(e.id).children;let l;a!==void 0&&a.length>0&&t[a[0].ID]!==void 0&&(l=t[a[0].ID],(l.indexOf("blob:")===0||l.indexOf("data:")===0)&&s.setPath(void 0));const c=s.load(l);return s.setPath(o),c}parseMaterials(e){const t=new Map;if("Material"in St.Objects){const r=St.Objects.Material;for(const i in r){const s=this.parseMaterial(r[i],e);s!==null&&t.set(parseInt(i),s)}}return t}parseMaterial(e,t){const r=e.id,i=e.attrName;let s=e.ShadingModel;if(typeof s=="object"&&(s=s.value),!Ar.has(r))return null;const o=this.parseParameters(e,t,r);let a;switch(s.toLowerCase()){case"phong":a=new WE;break;case"lambert":a=new Wse;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new WE;break}return a.setValues(o),a.name=i,a}parseParameters(e,t,r){const i={};e.BumpFactor&&(i.bumpScale=e.BumpFactor.value),e.Diffuse?i.color=bt.toWorkingColorSpace(new He().fromArray(e.Diffuse.value),kt):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=bt.toWorkingColorSpace(new He().fromArray(e.DiffuseColor.value),kt)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=bt.toWorkingColorSpace(new He().fromArray(e.Emissive.value),kt):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=bt.toWorkingColorSpace(new He().fromArray(e.EmissiveColor.value),kt)),e.EmissiveFactor&&(i.emissiveIntensity=parseFloat(e.EmissiveFactor.value)),e.Opacity&&(i.opacity=parseFloat(e.Opacity.value)),i.opacity<1&&(i.transparent=!0),e.ReflectionFactor&&(i.reflectivity=e.ReflectionFactor.value),e.Shininess&&(i.shininess=e.Shininess.value),e.Specular?i.specular=bt.toWorkingColorSpace(new He().fromArray(e.Specular.value),kt):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=bt.toWorkingColorSpace(new He().fromArray(e.SpecularColor.value),kt));const s=this;return Ar.get(r).children.forEach(function(o){const a=o.relationship;switch(a){case"Bump":i.bumpMap=s.getTexture(t,o.ID);break;case"Maya|TEX_ao_map":i.aoMap=s.getTexture(t,o.ID);break;case"DiffuseColor":case"Maya|TEX_color_map":i.map=s.getTexture(t,o.ID),i.map!==void 0&&(i.map.colorSpace=kt);break;case"DisplacementColor":i.displacementMap=s.getTexture(t,o.ID);break;case"EmissiveColor":i.emissiveMap=s.getTexture(t,o.ID),i.emissiveMap!==void 0&&(i.emissiveMap.colorSpace=kt);break;case"NormalMap":case"Maya|TEX_normal_map":i.normalMap=s.getTexture(t,o.ID);break;case"ReflectionColor":i.envMap=s.getTexture(t,o.ID),i.envMap!==void 0&&(i.envMap.mapping=Og,i.envMap.colorSpace=kt);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&(i.specularMap.colorSpace=kt);break;case"TransparentColor":case"TransparencyFactor":i.alphaMap=s.getTexture(t,o.ID),i.transparent=!0;break;case"AmbientColor":case"ShininessExponent":case"SpecularFactor":case"VectorDisplacementColor":default:console.warn("THREE.FBXLoader: %s map is not supported in three.js, skipping texture.",a);break}}),i}getTexture(e,t){return"LayeredTexture"in St.Objects&&t in St.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Ar.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in St.Objects){const r=St.Objects.Deformer;for(const i in r){const s=r[i],o=Ar.get(parseInt(i));if(s.attrType==="Skin"){const a=this.parseSkeleton(o,r);a.ID=i,o.parents.length>1&&console.warn("THREE.FBXLoader: skeleton attached to more than one geometry is not supported."),a.geometryID=o.parents[0].ID,e[i]=a}else if(s.attrType==="BlendShape"){const a={id:i};a.rawTargets=this.parseMorphTargets(o,r),a.id=i,o.parents.length>1&&console.warn("THREE.FBXLoader: morph target attached to more than one geometry is not supported."),t[i]=a}}}return{skeletons:e,morphTargets:t}}parseSkeleton(e,t){const r=[];return e.children.forEach(function(i){const s=t[i.ID];if(s.attrType!=="Cluster")return;const o={ID:i.ID,indices:[],weights:[],transformLink:new ke().fromArray(s.TransformLink.a)};"Indexes"in s&&(o.indices=s.Indexes.a,o.weights=s.Weights.a),r.push(o)}),{rawBones:r,bones:[]}}parseMorphTargets(e,t){const r=[];for(let i=0;i1?o=a:a.length>0?o=a[0]:(o=new WE({name:el.DEFAULT_MATERIAL_NAME,color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new ja(s,o),i.normalizeSkinWeights()):i=new hn(s,o),i}createCurve(e,t){const r=e.children.reduce(function(s,o){return t.has(o.ID)&&(s=t.get(o.ID)),s},null),i=new Ac({name:el.DEFAULT_MATERIAL_NAME,color:3342591,linewidth:1});return new Yd(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=Kg(t.RotationOrder.value):r.eulerOrder=Kg(0),"Lcl_Translation"in t&&(r.translation=t.Lcl_Translation.value),"PreRotation"in t&&(r.preRotation=t.PreRotation.value),"Lcl_Rotation"in t&&(r.rotation=t.Lcl_Rotation.value),"PostRotation"in t&&(r.postRotation=t.PostRotation.value),"Lcl_Scaling"in t&&(r.scale=t.Lcl_Scaling.value),"ScalingOffset"in t&&(r.scalingOffset=t.ScalingOffset.value),"ScalingPivot"in t&&(r.scalingPivot=t.ScalingPivot.value),"RotationOffset"in t&&(r.rotationOffset=t.RotationOffset.value),"RotationPivot"in t&&(r.rotationPivot=t.RotationPivot.value),e.userData.transformData=r}setLookAtProperties(e,t){"LookAtProperty"in t&&Ar.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=St.Objects.Model[i.ID];if("Lcl_Translation"in s){const o=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),Fi.add(e.target)):e.lookAt(new $().fromArray(o))}}})}bindSkeleton(e,t,r){const i=this.parsePoseNodes();for(const s in e){const o=e[s];Ar.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const c=l.ID;Ar.get(c).parents.forEach(function(u){r.has(u.ID)&&r.get(u.ID).bind(new UA(o.bones),i[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in St.Objects){const t=St.Objects.Pose;for(const r in t)if(t[r].attrType==="BindPose"&&t[r].NbPoseNodes>0){const i=t[r].PoseNode;Array.isArray(i)?i.forEach(function(s){e[s.Node]=new ke().fromArray(s.Matrix.a)}):e[i.Node]=new ke().fromArray(i.Matrix.a)}}return e}addGlobalSceneSettings(){if("GlobalSettings"in St){if("AmbientColor"in St.GlobalSettings){const e=St.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(t!==0||r!==0||i!==0){const s=new He().setRGB(t,r,i,kt);Fi.add(new Hz(s,1))}}"UnitScaleFactor"in St.GlobalSettings&&(Fi.userData.unitScaleFactor=St.GlobalSettings.UnitScaleFactor.value)}}}class zae{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in St.Objects){const r=St.Objects.Geometry;for(const i in r){const s=Ar.get(parseInt(i)),o=this.parseGeometry(s,r[i],e);t.set(parseInt(i),o)}}return this.negativeMaterialIndices===!0&&console.warn("THREE.FBXLoader: The FBX file contains invalid (negative) material indices. The asset might not render as expected."),t}parseGeometry(e,t,r){switch(t.attrType){case"Mesh":return this.parseMeshGeometry(e,t,r);case"NurbsCurve":return this.parseNurbsGeometry(t)}}parseMeshGeometry(e,t,r){const i=r.skeletons,s=[],o=e.parents.map(function(u){return St.Objects.Model[u.ID]});if(o.length===0)return;const a=e.children.reduce(function(u,f){return i[f.ID]!==void 0&&(u=i[f.ID]),u},null);e.children.forEach(function(u){r.morphTargets[u.ID]!==void 0&&s.push(r.morphTargets[u.ID])});const l=o[0],c={};"RotationOrder"in l&&(c.eulerOrder=Kg(l.RotationOrder.value)),"InheritType"in l&&(c.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(c.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(c.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(c.scale=l.GeometricScaling.value);const A=n8(c);return this.genGeometry(t,a,s,A)}genGeometry(e,t,r,i){const s=new Zt;e.attrName&&(s.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),l=new xn(a.vertex,3);if(l.applyMatrix4(i),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new xn(a.colors,3)),t&&(s.setAttribute("skinIndex",new l1(a.weightsIndices,4)),s.setAttribute("skinWeight",new xn(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const c=new ut().getNormalMatrix(i),A=new xn(a.normal,3);A.applyNormalMatrix(c),s.setAttribute("normal",A)}if(a.uvs.forEach(function(c,A){const u=A===0?"uv":`uv${A}`;s.setAttribute(u,new xn(a.uvs[A],2))}),o.material&&o.material.mappingType!=="AllSame"){let c=a.materialIndex[0],A=0;if(a.materialIndex.forEach(function(u,f){u!==c&&(s.addGroup(A,f-A,c),c=u,A=f)}),s.groups.length>0){const u=s.groups[s.groups.length-1],f=u.start+u.count;f!==a.materialIndex.length&&s.addGroup(f,a.materialIndex.length-f,c)}s.groups.length===0&&s.addGroup(0,a.materialIndex.length,a.materialIndex[0])}return this.addMorphTargets(s,e,r,i),s}parseGeoNode(e,t){const r={};if(r.vertexPositions=e.Vertices!==void 0?e.Vertices.a:[],r.vertexIndices=e.PolygonVertexIndex!==void 0?e.PolygonVertexIndex.a:[],e.LayerElementColor&&(r.color=this.parseVertexColors(e.LayerElementColor[0])),e.LayerElementMaterial&&(r.material=this.parseMaterialIndices(e.LayerElementMaterial[0])),e.LayerElementNormal&&(r.normal=this.parseNormals(e.LayerElementNormal[0])),e.LayerElementUV){r.uv=[];let i=0;for(;e.LayerElementUV[i];)e.LayerElementUV[i].UV&&r.uv.push(this.parseUVs(e.LayerElementUV[i])),i++}return r.weightTable={},t!==null&&(r.skeleton=t,t.rawBones.forEach(function(i,s){i.indices.forEach(function(o,a){r.weightTable[o]===void 0&&(r.weightTable[o]=[]),r.weightTable[o].push({id:s,weight:i.weights[a]})})})),r}genBuffers(e){const t={vertex:[],normal:[],colors:[],uvs:[],materialIndex:[],vertexWeights:[],weightsIndices:[]};let r=0,i=0,s=!1,o=[],a=[],l=[],c=[],A=[],u=[];const f=this;return e.vertexIndices.forEach(function(h,d){let m,g=!1;h<0&&(h=h^-1,g=!0);let p=[],v=[];if(o.push(h*3,h*3+1,h*3+2),e.color){const w=jv(d,r,h,e.color);l.push(w[0],w[1],w[2])}if(e.skeleton){if(e.weightTable[h]!==void 0&&e.weightTable[h].forEach(function(w){v.push(w.weight),p.push(w.id)}),v.length>4){s||(console.warn("THREE.FBXLoader: Vertex has more than 4 skinning weights assigned to vertex. Deleting additional weights."),s=!0);const w=[0,0,0,0],_=[0,0,0,0];v.forEach(function(x,b){let B=x,S=p[b];_.forEach(function(I,M,P){if(B>I){P[M]=B,B=I;const D=w[M];w[M]=S,S=D}})}),p=w,v=_}for(;v.length<4;)v.push(0),p.push(0);for(let w=0;w<4;++w)A.push(v[w]),u.push(p[w])}if(e.normal){const w=jv(d,r,h,e.normal);a.push(w[0],w[1],w[2])}e.material&&e.material.mappingType!=="AllSame"&&(m=jv(d,r,h,e.material)[0],m<0&&(f.negativeMaterialIndices=!0,m=0)),e.uv&&e.uv.forEach(function(w,_){const x=jv(d,r,h,w);c[_]===void 0&&(c[_]=[]),c[_].push(x[0]),c[_].push(x[1])}),i++,g&&(f.genFace(t,e,o,m,a,l,c,A,u,i),r++,i=0,o=[],a=[],l=[],c=[],A=[],u=[])}),t}getNormalNewell(e){const t=new $(0,0,0);for(let r=0;r.5?new $(0,1,0):new $(0,0,1)).cross(t).normalize(),s=t.clone().cross(i).normalize();return{normal:t,tangent:i,bitangent:s}}flattenVertex(e,t,r){return new je(e.dot(t),e.dot(r))}genFace(e,t,r,i,s,o,a,l,c,A){let u;if(A>3){const f=[],h=t.baseVertexPositions||t.vertexPositions;for(let p=0;p1&&console.warn("THREE.FBXLoader: Encountered an animation stack with multiple layers, this is currently not supported. Ignoring subsequent layers.");const o=e.get(s[0].ID);r[i]={name:t[i].attrName,layer:o}}return r}addClip(e){let t=[];const r=this;return e.layer.forEach(function(i){t=t.concat(r.generateTracks(i))}),new Du(e.name,-1,t)}generateTracks(e){const t=[];let r=new $,i=new $;if(e.transform&&e.transform.decompose(r,new tt,i),r=r.toArray(),i=i.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");s!==void 0&&t.push(s)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const s=this.generateRotationTrack(e.modelName,e.R.curves,e.preRotation,e.postRotation,e.eulerOrder);s!==void 0&&t.push(s)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const s=this.generateVectorTrack(e.modelName,e.S.curves,i,"scale");s!==void 0&&t.push(s)}if(e.DeformPercent!==void 0){const s=this.generateMorphTrack(e);s!==void 0&&t.push(s)}return t}generateVectorTrack(e,t,r,i){const s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,r);return new ic(e+"."+i,s,o)}generateRotationTrack(e,t,r,i,s){let o,a;if(t.x!==void 0&&t.y!==void 0&&t.z!==void 0){const f=this.interpolateRotations(t.x,t.y,t.z,s);o=f[0],a=f[1]}const l=Kg(0);r!==void 0&&(r=r.map(Et.degToRad),r.push(l),r=new tr().fromArray(r),r=new tt().setFromEuler(r)),i!==void 0&&(i=i.map(Et.degToRad),i.push(l),i=new tr().fromArray(i),i=new tt().setFromEuler(i).invert());const c=new tt,A=new tr,u=[];if(!a||!o)return new Ja(e+".quaternion",[0],[0]);for(let f=0;f2&&new tt().fromArray(u,(f-3)/3*4).dot(c)<0&&c.set(-c.x,-c.y,-c.z,-c.w),c.toArray(u,f/3*4);return new Ja(e+".quaternion",o,u)}generateMorphTrack(e){const t=e.DeformPercent.curves.morph,r=t.values.map(function(s){return s/100}),i=Fi.getObjectByName(e.modelName).morphTargetDictionary[e.morphName];return new Lu(e.modelName+".morphTargetInfluences["+i+"]",t.times,r)}getTimesForAllAxes(e){let t=[];if(e.x!==void 0&&(t=t.concat(e.x.times)),e.y!==void 0&&(t=t.concat(e.y.times)),e.z!==void 0&&(t=t.concat(e.z.times)),t=t.sort(function(r,i){return r-i}),t.length>1){let r=1,i=t[0];for(let s=1;s=180||h[1]>=180||h[2]>=180){const m=Math.max(...h)/180,g=new tr(...c,i),p=new tr(...u,i),v=new tt().setFromEuler(g),w=new tt().setFromEuler(p);v.dot(w)&&w.set(-w.x,-w.y,-w.z,-w.w);const _=e.times[a-1],x=e.times[a]-_,b=new tt,B=new tr;for(let S=0;S<1;S+=1/m)b.copy(v.clone().slerp(w.clone(),S)),s.push(_+S*x),B.setFromQuaternion(b,i),o.push(B.x),o.push(B.y),o.push(B.z)}else s.push(e.times[a]),o.push(Et.degToRad(e.values[a])),o.push(Et.degToRad(t.values[a])),o.push(Et.degToRad(r.values[a]))}return[s,o]}}class Vae{getPrevNode(){return this.nodeStack[this.currentIndent-2]}getCurrentNode(){return this.nodeStack[this.currentIndent-1]}getCurrentProp(){return this.currentProp}pushStack(e){this.nodeStack.push(e),this.currentIndent+=1}popStack(){this.nodeStack.pop(),this.currentIndent-=1}setCurrentProp(e,t){this.currentProp=e,this.currentPropName=t}parse(e){this.currentIndent=0,this.allNodes=new t8,this.nodeStack=[],this.currentProp=[],this.currentPropName="";const t=this,r=e.split(/[\r\n]+/);return r.forEach(function(i,s){const o=i.match(/^[\s\t]*;/),a=i.match(/^[\s\t]*$/);if(o||a)return;const l=i.match("^\\t{"+t.currentIndent+"}(\\w+):(.*){",""),c=i.match("^\\t{"+t.currentIndent+"}(\\w+):[\\s\\t\\r\\n](.*)"),A=i.match("^\\t{"+(t.currentIndent-1)+"}}");l?t.parseNodeBegin(i,l):c?t.parseNodeProperty(i,c,r[++s]):A?t.popStack():i.match(/^[^\s\t}]/)&&t.parseNodePropertyContinued(i)}),this.allNodes}parseNodeBegin(e,t){const r=t[1].trim().replace(/^"/,"").replace(/"$/,""),i=t[2].split(",").map(function(l){return l.trim().replace(/^"/,"").replace(/"$/,"")}),s={name:r},o=this.parseNodeAttr(i),a=this.getCurrentNode();this.currentIndent===0?this.allNodes.add(r,s):r in a?(r==="PoseNode"?a.PoseNode.push(s):a[r].id!==void 0&&(a[r]={},a[r][a[r].id]=a[r]),o.id!==""&&(a[r][o.id]=s)):typeof o.id=="number"?(a[r]={},a[r][o.id]=s):r!=="Properties70"&&(r==="PoseNode"?a[r]=[s]:a[r]=s),typeof o.id=="number"&&(s.id=o.id),o.name!==""&&(s.attrName=o.name),o.type!==""&&(s.attrType=o.type),this.pushStack(s)}parseNodeAttr(e){let t=e[0];e[0]!==""&&(t=parseInt(e[0]),isNaN(t)&&(t=e[0]));let r="",i="";return e.length>1&&(r=e[1].replace(/^(\w+)::/,""),i=e[2]),{id:t,name:r,type:i}}parseNodeProperty(e,t,r){let i=t[1].replace(/^"/,"").replace(/"$/,"").trim(),s=t[2].replace(/^"/,"").replace(/"$/,"").trim();i==="Content"&&s===","&&(s=r.replace(/"/g,"").replace(/,$/,"").trim());const o=this.getCurrentNode();if(o.name==="Properties70"){this.parseNodeSpecialProperty(e,i,s);return}if(i==="C"){const l=s.split(",").slice(1),c=parseInt(l[0]),A=parseInt(l[1]);let u=s.split(",").slice(3);u=u.map(function(f){return f.trim().replace(/^"/,"")}),i="connections",s=[c,A],$ae(s,u),o[i]===void 0&&(o[i]=[])}i==="Node"&&(o.id=s),i in o&&Array.isArray(o[i])?o[i].push(s):i!=="a"?o[i]=s:o.a=s,this.setCurrentProp(o,i),i==="a"&&s.slice(-1)!==","&&(o.a=nB(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=nB(t.a))}parseNodeSpecialProperty(e,t,r){const i=r.split('",').map(function(A){return A.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],o=i[1],a=i[2],l=i[3];let c=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":c=parseFloat(c);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":c=nB(c);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:c},this.setCurrentProp(this.getPrevNode(),s)}}class jae{parse(e){const t=new CD(e);t.skip(23);const r=t.getUint32();if(r<6400)throw new Error("THREE.FBXLoader: FBX version not supported, FileVersion: "+r);const i=new t8;for(;!this.endOfContent(t);){const s=this.parseNode(t,r);s!==null&&i.add(s.name,s)}return i}endOfContent(e){return e.size()%16===0?(e.getOffset()+160+16&-16)>=e.size():e.getOffset()+160+16>=e.size()}parseNode(e,t){const r={},i=t>=7500?e.getUint64():e.getUint32(),s=t>=7500?e.getUint64():e.getUint32();t>=7500?e.getUint64():e.getUint32();const o=e.getUint8(),a=e.getString(o);if(i===0)return null;const l=[];for(let f=0;f0?l[0]:"",A=l.length>1?l[1]:"",u=l.length>2?l[2]:"";for(r.singleProperty=s===1&&e.getOffset()===i;i>e.getOffset();){const f=this.parseNode(e,t);f!==null&&this.parseSubNode(a,r,f)}return r.propertyList=l,typeof c=="number"&&(r.id=c),A!==""&&(r.attrName=A),u!==""&&(r.attrType=u),a!==""&&(r.name=a),r}parseSubNode(e,t,r){if(r.singleProperty===!0){const i=r.propertyList[0];Array.isArray(i)?(t[r.name]=r,r.a=i):t[r.name]=i}else if(e==="Connections"&&r.name==="C"){const i=[];r.propertyList.forEach(function(s,o){o!==0&&i.push(s)}),t.connections===void 0&&(t.connections=[]),t.connections.push(i)}else if(r.name==="Properties70")Object.keys(r).forEach(function(s){t[s]=r[s]});else if(e==="Properties70"&&r.name==="P"){let i=r.propertyList[0],s=r.propertyList[1];const o=r.propertyList[2],a=r.propertyList[3];let l;i.indexOf("Lcl ")===0&&(i=i.replace("Lcl ","Lcl_")),s.indexOf("Lcl ")===0&&(s=s.replace("Lcl ","Lcl_")),s==="Color"||s==="ColorRGB"||s==="Vector"||s==="Vector3D"||s.indexOf("Lcl_")===0?l=[r.propertyList[4],r.propertyList[5],r.propertyList[6]]:l=r.propertyList[4],t[i]={type:s,type2:o,flag:a,value:l}}else t[r.name]===void 0?typeof r.id=="number"?(t[r.name]={},t[r.name][r.id]=r):t[r.name]=r:r.name==="PoseNode"?(Array.isArray(t[r.name])||(t[r.name]=[t[r.name]]),t[r.name].push(r)):t[r.name][r.id]===void 0&&(t[r.name][r.id]=r)}parseProperty(e){const t=e.getString(1);let r;switch(t){case"C":return e.getBoolean();case"D":return e.getFloat64();case"F":return e.getFloat32();case"I":return e.getInt32();case"L":return e.getInt64();case"R":return r=e.getUint32(),e.getArrayBuffer(r);case"S":return r=e.getUint32(),e.getString(r);case"Y":return e.getInt16();case"b":case"c":case"d":case"f":case"i":case"l":const i=e.getUint32(),s=e.getUint32(),o=e.getUint32();if(s===0)switch(t){case"b":case"c":return e.getBooleanArray(i);case"d":return e.getFloat64Array(i);case"f":return e.getFloat32Array(i);case"i":return e.getInt32Array(i);case"l":return e.getInt64Array(i)}const a=Tae(new Uint8Array(e.getArrayBuffer(o))),l=new CD(a.buffer);switch(t){case"b":case"c":return l.getBooleanArray(i);case"d":return l.getFloat64Array(i);case"f":return l.getFloat32Array(i);case"i":return l.getInt32Array(i);case"l":return l.getInt64Array(i)}break;default:throw new Error("THREE.FBXLoader: Unknown property type "+t)}}}class CD{constructor(e,t){this.dv=new DataView(e),this.offset=0,this.littleEndian=t!==void 0?t:!0,this._textDecoder=new TextDecoder}getOffset(){return this.offset}size(){return this.dv.buffer.byteLength}skip(e){this.offset+=e}getBoolean(){return(this.getUint8()&1)===1}getBooleanArray(e){const t=[];for(let r=0;r=0&&(r=new Uint8Array(this.dv.buffer,t,i)),this._textDecoder.decode(r)}}class t8{add(e,t){this[e]=t}}function Wae(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===r8(n,0,e.length)}function Kae(n){const e=["K","a","y","d","a","r","a","\\","F","B","X","\\","B","i","n","a","r","y","\\","\\"];let t=0;function r(i){const s=n[i-1];return n=n.slice(t+i),t++,s}for(let i=0;i4?o=n.array[i*n.itemSize+s]:(s===0?o=n.getX(i):s===1?o=n.getY(i):s===2?o=n.getZ(i):s===3&&(o=n.getW(i)),n.normalized===!0&&(o=Et.normalize(o,n.array))),r.min[s]=Math.min(r.min[s],o),r.max[s]=Math.max(r.max[s],o)}return r}function n8(n){return Math.ceil(n/4)*4}function rB(n,e=0){const t=n8(n.byteLength);if(t!==n.byteLength){const r=new Uint8Array(t);if(r.set(new Uint8Array(n)),e!==0)for(let i=n.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function FD(n,e){if(n.toBlob!==void 0)return new Promise(r=>n.toBlob(r,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),n.convertToBlob({type:e,quality:t})}class ele{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 r"+Jl}},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,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,s=i.buffers,o=i.json;r=i.options;const a=i.extensionsUsed,l=i.extensionsRequired,c=new Blob(s,{type:"application/octet-stream"}),A=Object.keys(a),u=Object.keys(l);if(A.length>0&&(o.extensionsUsed=A),u.length>0&&(o.extensionsRequired=u),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=c.size),r.binary===!0){const f=new FileReader;f.readAsArrayBuffer(c),f.onloadend=function(){const h=rB(f.result),d=new DataView(new ArrayBuffer(RD));d.setUint32(0,h.byteLength,!0),d.setUint32(4,$ae,!0);const m=rB(Zae(JSON.stringify(o)),32),g=new DataView(new ArrayBuffer(RD));g.setUint32(0,m.byteLength,!0),g.setUint32(4,Yae,!0);const p=new ArrayBuffer(ID),v=new DataView(p);v.setUint32(0,Kae,!0),v.setUint32(4,Xae,!0);const w=ID+g.byteLength+m.byteLength+d.byteLength+h.byteLength;v.setUint32(8,w,!0);const _=new Blob([p,g,m,d,h],{type:"application/octet-stream"}),x=new FileReader;x.readAsArrayBuffer(_),x.onloadend=function(){t(x.result)}}}else if(o.buffers&&o.buffers.length>0){const f=new FileReader;f.readAsDataURL(c),f.onloadend=function(){const h=f.result;o.buffers[0].uri=h,t(o)}}else t(o)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const r=this.options,i=this.extensionsUsed;try{const s=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],i[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const i=new Map;i.set(!0,this.uid++),i.set(!1,this.uid++),this.uids.set(e,i)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const r=new $;for(let i=0,s=e.count;i5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),i=new $;for(let s=0,o=r.count;s4?g=e.array[d*e.itemSize+m]:(m===0?g=e.getX(d):m===1?g=e.getY(d):m===2?g=e.getZ(d):m===3&&(g=e.getW(d)),e.normalized===!0&&(g=Et.normalize(g,e.array))),t===It.FLOAT?A.setFloat32(u,g,!0):t===It.INT?A.setInt32(u,g,!0):t===It.UNSIGNED_INT?A.setUint32(u,g,!0):t===It.SHORT?A.setInt16(u,g,!0):t===It.UNSIGNED_SHORT?A.setUint16(u,g,!0):t===It.BYTE?A.setInt8(u,g):t===It.UNSIGNED_BYTE&&A.setUint8(u,g),u+=a}u%l!==0&&(u+=l-u%l)}const f={buffer:this.processBuffer(A.buffer),byteOffset:this.byteOffset,byteLength:c};return s!==void 0&&(f.target=s),s===It.ARRAY_BUFFER&&(f.byteStride=l),this.byteOffset+=c,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise(function(i){const s=new FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){const o=rB(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,i(r.bufferViews.push(a)-1)}})}processAccessor(e,t,r,i){const s=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=It.FLOAT;else if(e.array.constructor===Int32Array)a=It.INT;else if(e.array.constructor===Uint32Array)a=It.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=It.SHORT;else if(e.array.constructor===Uint16Array)a=It.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=It.BYTE;else if(e.array.constructor===Uint8Array)a=It.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(r===void 0&&(r=0),(i===void 0||i===1/0)&&(i=e.count),i===0)return null;const l=Jae(e,r,i);let c;t!==void 0&&(c=e===t.index?It.ELEMENT_ARRAY_BUFFER:It.ARRAY_BUFFER);const A=this.processBufferView(e,a,r,i,c),u={bufferView:A.id,byteOffset:A.byteOffset,componentType:a,count:i,max:l.max,min:l.min,type:o[e.itemSize]};return e.normalized===!0&&(u.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(u)-1}processImage(e,t,r,i="image/png"){if(e!==null){const s=this,o=s.cache,a=s.json,l=s.options,c=s.pending;o.images.has(e)||o.images.set(e,{});const A=o.images.get(e),u=i+":flipY/"+r.toString();if(A[u]!==void 0)return A[u];a.images||(a.images=[]);const f={mimeType:i},h=UD();h.width=Math.min(e.width,l.maxTextureSize),h.height=Math.min(e.height,l.maxTextureSize);const d=h.getContext("2d",{willReadFrequently:!0});if(r===!0&&(d.translate(0,h.height),d.scale(1,-1)),e.data!==void 0){t!==Lr&&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 g=new Uint8ClampedArray(e.height*e.width*4);for(let p=0;ps.processBufferViewImage(g)).then(g=>{f.bufferView=g})):h.toDataURL!==void 0?f.uri=h.toDataURL(i):c.push(FD(h,i).then(g=>new FileReader().readAsDataURL(g)).then(g=>{f.uri=g}));const m=a.images.push(f)-1;return A[u]=m,m}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 r={magFilter:Is[e.magFilter],minFilter:Is[e.minFilter],wrapS:Is[e.wrapS],wrapT:Is[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const r=this.options,i=this.cache,s=this.json;if(i.textures.has(e))return i.textures.get(e);s.textures||(s.textures=[]),e instanceof zE&&(e=tB(e,r.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(a.name=e.name),this._invokeAll(function(c){c.writeTexture&&c.writeTexture(e,a)});const l=s.textures.push(a)-1;return i.textures.set(e,l),l}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const s=e.color.toArray().concat([e.opacity]);if(_m(s,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=s),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 c={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(c,e.emissiveMap),i.emissiveTexture=c}}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===wi&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});const o=r.materials.push(i)-1;return t.materials.set(e,o),o}processMesh(e){const t=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let _=0,x=e.material.length;_0){const _=[],x=[],b={};if(e.morphTargetDictionary!==void 0)for(const B in e.morphTargetDictionary)b[e.morphTargetDictionary[B]]=B;for(let B=0;B0&&(l.extras={},l.extras.targetNames=x)}const m=Array.isArray(e.material);if(m&&o.groups.length===0)return null;let g=!1;if(m&&o.index===null){const _=[];for(let x=0,b=o.attributes.position.count;x0&&(b.targets=u),o.index!==null){let M=this.getUID(o.index);(v[_].start!==void 0||v[_].count!==void 0)&&(M+=":"+v[_].start+":"+v[_].count),t.attributes.has(M)?b.indices=t.attributes.get(M):(b.indices=this.processAccessor(o.index,o,v[_].start,v[_].count),t.attributes.set(M,b.indices)),b.indices===null&&delete b.indices}const B=this.processMaterial(p[v[_].materialIndex]);B!==null&&(b.material=B),A.push(b)}g===!0&&o.setIndex(null),l.primitives=A,r.meshes||(r.meshes=[]),this._invokeAll(function(_){_.writeMesh&&_.writeMesh(e,l)});const w=r.meshes.push(l)-1;return t.meshes.set(s,w),w}detectMeshQuantization(e,t){if(this.extensionsUsed[nB])return;let r;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized");const i=e.split("_",1)[0];CD[i]&&CD[i].includes(r)&&(this.extensionsUsed[nB]=!0,this.extensionsRequired[nB]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,i={type:r?"orthographic":"perspective"};return r?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:Et.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 r=this.json,i=this.nodeMap;r.animations||(r.animations=[]),e=WR.Utils.mergeMorphTargetTracks(e.clone(),t);const s=e.tracks,o=[],a=[];for(let l=0;l0){const a=[];for(let l=0,c=e.children.length;l0&&(s.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,s)});const o=t.nodes.push(s)-1;return i.set(e,o),o}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const s=[];for(let o=0,a=e.children.length;o0&&(i.nodes=s),this.serializeUserData(e,i)}processObjects(e){const t=new Hg;t.name="AuxScene";for(let r=0;r0&&this.processObjects(r);for(let i=0;i0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(1-e.penumbra)*e.angle,o.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."),s[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},s[this.name]=!0);const a=i.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}class nle{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class rle{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.clearcoatFactor=e.clearcoat,e.clearcoatMap){const o={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(o,e.clearcoatMap),s.clearcoatTexture=o}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const o={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(o,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){const o={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(o.scale=e.clearcoatNormalScale.x),r.applyTextureTransform(o,e.clearcoatNormalMap),s.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ile{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;const i=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class sle{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.iridescenceFactor=e.iridescence,e.iridescenceMap){const o={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(o,e.iridescenceMap),s.iridescenceTexture=o}if(s.iridescenceIor=e.iridescenceIOR,s.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],s.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const o={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(o,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ole{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){const o={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ale{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){const o={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}e.attenuationDistance!==1/0&&(s.attenuationDistance=e.attenuationDistance),s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class lle{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const i=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class cle{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(Wae)&&!e.specularIntensityMap&&!e.specularColorMap)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.specularIntensityMap){const o={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(o,e.specularIntensityMap),s.specularTexture=o}if(e.specularColorMap){const o={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(o,e.specularColorMap),s.specularColorTexture=o}s.specularFactor=e.specularIntensity,s.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Ale{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.sheenRoughnessMap){const o={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(o,e.sheenRoughnessMap),s.sheenRoughnessTexture=o}if(e.sheenColorMap){const o={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(o,e.sheenColorMap),s.sheenColorTexture=o}s.sheenRoughnessFactor=e.sheenRoughness,s.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ule{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.anisotropyMap){const o={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(o,e.anisotropyMap),s.anisotropyTexture=o}s.anisotropyStrength=e.anisotropy,s.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class fle{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const i=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class hle{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.bumpMap){const o={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(o,e.bumpMap),s.bumpTexture=o}s.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class dle{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const r=this.writer,i=e,s=new Float32Array(i.count*3),o=new Float32Array(i.count*4),a=new Float32Array(i.count*3),l=new ke,c=new $,A=new tt,u=new $;for(let h=0;hn.times[n.times.length-1]){if(Math.abs(n.times[n.times.length-1]-e)<.001)return n.times.length-1;i[i.length-1]=e,i.set(n.times,0),s.set(n.values,0),s.set(o.evaluate(e),n.values.length),a=i.length-1}else for(let l=0;le){i.set(n.times.slice(0,l+1),0),i[l+1]=e,i.set(n.times.slice(l+1),l+2),s.set(n.values.slice(0,(l+1)*r),0),s.set(o.evaluate(e),(l+1)*r),s.set(n.values.slice((l+1)*r),(l+2)*r),a=l+1;break}}return n.times=i,n.values=s,a},mergeMorphTargetTracks:function(n,e){const t=[],r={},i=n.tracks;for(let s=0;s0)throw new Error("Invalid string. Length must be a multiple of 4");var t=n.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function gle(n){var e=i8(n),t=e[0],r=e[1];return(t+r)*3/4-r}function vle(n,e,t){return(e+t)*3/4-t}function yle(n){var e,t=i8(n),r=t[0],i=t[1],s=new ple(vle(n,r,i)),o=0,a=i>0?r-4:r,l;for(l=0;l>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=eo[n.charCodeAt(l)]<<2|eo[n.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=eo[n.charCodeAt(l)]<<10|eo[n.charCodeAt(l+1)]<<4|eo[n.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function wle(n){return Ra[n>>18&63]+Ra[n>>12&63]+Ra[n>>6&63]+Ra[n&63]}function _le(n,e,t){for(var r,i=[],s=e;sa?a:o+s));return r===1?(e=n[t-1],i.push(Ra[e>>2]+Ra[e<<4&63]+"==")):r===2&&(e=(n[t-2]<<8)+n[t-1],i.push(Ra[e>>10]+Ra[e>>4&63]+Ra[e<<2&63]+"=")),i.join("")}var KR={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */KR.read=function(n,e,t,r,i){var s,o,a=i*8-r-1,l=(1<>1,A=-7,u=t?i-1:0,f=t?-1:1,h=n[e+u];for(u+=f,s=h&(1<<-A)-1,h>>=-A,A+=a;A>0;s=s*256+n[e+u],u+=f,A-=8);for(o=s&(1<<-A)-1,s>>=-A,A+=r;A>0;o=o*256+n[e+u],u+=f,A-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-c}return(h?-1:1)*o*Math.pow(2,s-r)};KR.write=function(n,e,t,r,i,s){var o,a,l,c=s*8-i-1,A=(1<>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,d=r?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=A):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+u>=1?e+=f/l:e+=f*Math.pow(2,1-u),e*l>=2&&(o++,l/=2),o+u>=A?(a=0,o=A):o+u>=1?(a=(e*l-1)*Math.pow(2,i),o=o+u):(a=e*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;n[t+h]=a&255,h+=d,a/=256,i-=8);for(o=o<0;n[t+h]=o&255,h+=d,o/=256,c-=8);n[t+h-d]|=m*128};/*! + }`})),bf.uniforms.blitTexture.value=n,bf.defines.IS_SRGB=n.colorSpace==kt,bf.needsUpdate=!0,Wv||(Wv=new hn(rB,bf),Wv.frustumCulled=!1);const r=new Fr,i=new zg;i.add(Wv),t===null&&(t=kp=new v0({antialias:!1}));const s=Math.min(n.image.width,e),o=Math.min(n.image.height,e);t.setSize(s,o),t.clear(),t.render(i,r);const a=document.createElement("canvas"),l=a.getContext("2d");a.width=s,a.height=o,l.drawImage(t.domElement,0,0,s,o);const c=new Sse(a);return c.minFilter=n.minFilter,c.magFilter=n.magFilter,c.wrapS=n.wrapS,c.wrapT=n.wrapT,c.colorSpace=n.colorSpace,c.name=n.name,kp&&(kp.forceContextLoss(),kp.dispose(),kp=null),c}const ID={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 XR{constructor(){this.pluginCallbacks=[],this.register(function(e){return new ale(e)}),this.register(function(e){return new lle(e)}),this.register(function(e){return new fle(e)}),this.register(function(e){return new hle(e)}),this.register(function(e){return new dle(e)}),this.register(function(e){return new ple(e)}),this.register(function(e){return new cle(e)}),this.register(function(e){return new Ale(e)}),this.register(function(e){return new ule(e)}),this.register(function(e){return new mle(e)}),this.register(function(e){return new gle(e)}),this.register(function(e){return new vle(e)}),this.register(function(e){return new yle(e)}),this.register(function(e){return new wle(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,r,i){const s=new ole,o=[];for(let a=0,l=this.pluginCallbacks.length;a4?o=n.array[i*n.itemSize+s]:(s===0?o=n.getX(i):s===1?o=n.getY(i):s===2?o=n.getZ(i):s===3&&(o=n.getW(i)),n.normalized===!0&&(o=Et.normalize(o,n.array))),r.min[s]=Math.min(r.min[s],o),r.max[s]=Math.max(r.max[s],o)}return r}function i8(n){return Math.ceil(n/4)*4}function oB(n,e=0){const t=i8(n.byteLength);if(t!==n.byteLength){const r=new Uint8Array(t);if(r.set(new Uint8Array(n)),e!==0)for(let i=n.byteLength;i"u"&&typeof OffscreenCanvas<"u"?new OffscreenCanvas(1,1):document.createElement("canvas")}function LD(n,e){if(n.toBlob!==void 0)return new Promise(r=>n.toBlob(r,e));let t;return e==="image/jpeg"?t=.92:e==="image/webp"&&(t=.8),n.convertToBlob({type:e,quality:t})}class ole{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 r"+nc}},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,r={}){this.options=Object.assign({binary:!1,trs:!1,onlyVisible:!0,maxTextureSize:1/0,animations:[],includeCustomExtensions:!1},r),this.options.animations.length>0&&(this.options.trs=!0),this.processInput(e),await Promise.all(this.pending);const i=this,s=i.buffers,o=i.json;r=i.options;const a=i.extensionsUsed,l=i.extensionsRequired,c=new Blob(s,{type:"application/octet-stream"}),A=Object.keys(a),u=Object.keys(l);if(A.length>0&&(o.extensionsUsed=A),u.length>0&&(o.extensionsRequired=u),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=c.size),r.binary===!0){const f=new FileReader;f.readAsArrayBuffer(c),f.onloadend=function(){const h=oB(f.result),d=new DataView(new ArrayBuffer(FD));d.setUint32(0,h.byteLength,!0),d.setUint32(4,nle,!0);const m=oB(rle(JSON.stringify(o)),32),g=new DataView(new ArrayBuffer(FD));g.setUint32(0,m.byteLength,!0),g.setUint32(4,tle,!0);const p=new ArrayBuffer(UD),v=new DataView(p);v.setUint32(0,Jae,!0),v.setUint32(4,ele,!0);const w=UD+g.byteLength+m.byteLength+d.byteLength+h.byteLength;v.setUint32(8,w,!0);const _=new Blob([p,g,m,d,h],{type:"application/octet-stream"}),x=new FileReader;x.readAsArrayBuffer(_),x.onloadend=function(){t(x.result)}}}else if(o.buffers&&o.buffers.length>0){const f=new FileReader;f.readAsDataURL(c),f.onloadend=function(){const h=f.result;o.buffers[0].uri=h,t(o)}}else t(o)}serializeUserData(e,t){if(Object.keys(e.userData).length===0)return;const r=this.options,i=this.extensionsUsed;try{const s=JSON.parse(JSON.stringify(e.userData));if(r.includeCustomExtensions&&s.gltfExtensions){t.extensions===void 0&&(t.extensions={});for(const o in s.gltfExtensions)t.extensions[o]=s.gltfExtensions[o],i[o]=!0;delete s.gltfExtensions}Object.keys(s).length>0&&(t.extras=s)}catch(s){console.warn("THREE.GLTFExporter: userData of '"+e.name+"' won't be serialized because of JSON.stringify error - "+s.message)}}getUID(e,t=!1){if(this.uids.has(e)===!1){const i=new Map;i.set(!0,this.uid++),i.set(!1,this.uid++),this.uids.set(e,i)}return this.uids.get(e).get(t)}isNormalizedNormalAttribute(e){if(this.cache.attributesNormalized.has(e))return!1;const r=new $;for(let i=0,s=e.count;i5e-4)return!1;return!0}createNormalizedNormalAttribute(e){const t=this.cache;if(t.attributesNormalized.has(e))return t.attributesNormalized.get(e);const r=e.clone(),i=new $;for(let s=0,o=r.count;s4?g=e.array[d*e.itemSize+m]:(m===0?g=e.getX(d):m===1?g=e.getY(d):m===2?g=e.getZ(d):m===3&&(g=e.getW(d)),e.normalized===!0&&(g=Et.normalize(g,e.array))),t===It.FLOAT?A.setFloat32(u,g,!0):t===It.INT?A.setInt32(u,g,!0):t===It.UNSIGNED_INT?A.setUint32(u,g,!0):t===It.SHORT?A.setInt16(u,g,!0):t===It.UNSIGNED_SHORT?A.setUint16(u,g,!0):t===It.BYTE?A.setInt8(u,g):t===It.UNSIGNED_BYTE&&A.setUint8(u,g),u+=a}u%l!==0&&(u+=l-u%l)}const f={buffer:this.processBuffer(A.buffer),byteOffset:this.byteOffset,byteLength:c};return s!==void 0&&(f.target=s),s===It.ARRAY_BUFFER&&(f.byteStride=l),this.byteOffset+=c,o.bufferViews.push(f),{id:o.bufferViews.length-1,byteLength:0}}processBufferViewImage(e){const t=this,r=t.json;return r.bufferViews||(r.bufferViews=[]),new Promise(function(i){const s=new FileReader;s.readAsArrayBuffer(e),s.onloadend=function(){const o=oB(s.result),a={buffer:t.processBuffer(o),byteOffset:t.byteOffset,byteLength:o.byteLength};t.byteOffset+=o.byteLength,i(r.bufferViews.push(a)-1)}})}processAccessor(e,t,r,i){const s=this.json,o={1:"SCALAR",2:"VEC2",3:"VEC3",4:"VEC4",9:"MAT3",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=It.FLOAT;else if(e.array.constructor===Int32Array)a=It.INT;else if(e.array.constructor===Uint32Array)a=It.UNSIGNED_INT;else if(e.array.constructor===Int16Array)a=It.SHORT;else if(e.array.constructor===Uint16Array)a=It.UNSIGNED_SHORT;else if(e.array.constructor===Int8Array)a=It.BYTE;else if(e.array.constructor===Uint8Array)a=It.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type: "+e.array.constructor.name);if(r===void 0&&(r=0),(i===void 0||i===1/0)&&(i=e.count),i===0)return null;const l=sle(e,r,i);let c;t!==void 0&&(c=e===t.index?It.ELEMENT_ARRAY_BUFFER:It.ARRAY_BUFFER);const A=this.processBufferView(e,a,r,i,c),u={bufferView:A.id,byteOffset:A.byteOffset,componentType:a,count:i,max:l.max,min:l.min,type:o[e.itemSize]};return e.normalized===!0&&(u.normalized=!0),s.accessors||(s.accessors=[]),s.accessors.push(u)-1}processImage(e,t,r,i="image/png"){if(e!==null){const s=this,o=s.cache,a=s.json,l=s.options,c=s.pending;o.images.has(e)||o.images.set(e,{});const A=o.images.get(e),u=i+":flipY/"+r.toString();if(A[u]!==void 0)return A[u];a.images||(a.images=[]);const f={mimeType:i},h=PD();h.width=Math.min(e.width,l.maxTextureSize),h.height=Math.min(e.height,l.maxTextureSize);const d=h.getContext("2d",{willReadFrequently:!0});if(r===!0&&(d.translate(0,h.height),d.scale(1,-1)),e.data!==void 0){t!==Nr&&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 g=new Uint8ClampedArray(e.height*e.width*4);for(let p=0;ps.processBufferViewImage(g)).then(g=>{f.bufferView=g})):h.toDataURL!==void 0?f.uri=h.toDataURL(i):c.push(LD(h,i).then(g=>new FileReader().readAsDataURL(g)).then(g=>{f.uri=g}));const m=a.images.push(f)-1;return A[u]=m,m}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 r={magFilter:Rs[e.magFilter],minFilter:Rs[e.minFilter],wrapS:Rs[e.wrapS],wrapT:Rs[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const r=this.options,i=this.cache,s=this.json;if(i.textures.has(e))return i.textures.get(e);s.textures||(s.textures=[]),e instanceof jE&&(e=iB(e,r.maxTextureSize));let o=e.userData.mimeType;o==="image/webp"&&(o="image/png");const a={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,o)};e.name&&(a.name=e.name),this._invokeAll(function(c){c.writeTexture&&c.writeTexture(e,a)});const l=s.textures.push(a)-1;return i.textures.set(e,l),l}processMaterial(e){const t=this.cache,r=this.json;if(t.materials.has(e))return t.materials.get(e);if(e.isShaderMaterial)return console.warn("GLTFExporter: THREE.ShaderMaterial not supported."),null;r.materials||(r.materials=[]);const i={pbrMetallicRoughness:{}};e.isMeshStandardMaterial!==!0&&e.isMeshBasicMaterial!==!0&&console.warn("GLTFExporter: Use MeshStandardMaterial or MeshBasicMaterial for best results.");const s=e.color.toArray().concat([e.opacity]);if(xm(s,[1,1,1,1])||(i.pbrMetallicRoughness.baseColorFactor=s),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 c={index:this.processTexture(e.emissiveMap),texCoord:e.emissiveMap.channel};this.applyTextureTransform(c,e.emissiveMap),i.emissiveTexture=c}}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===_i&&(i.doubleSided=!0),e.name!==""&&(i.name=e.name),this.serializeUserData(e,i),this._invokeAll(function(a){a.writeMaterial&&a.writeMaterial(e,i)});const o=r.materials.push(i)-1;return t.materials.set(e,o),o}processMesh(e){const t=this.cache,r=this.json,i=[e.geometry.uuid];if(Array.isArray(e.material))for(let _=0,x=e.material.length;_0){const _=[],x=[],b={};if(e.morphTargetDictionary!==void 0)for(const B in e.morphTargetDictionary)b[e.morphTargetDictionary[B]]=B;for(let B=0;B0&&(l.extras={},l.extras.targetNames=x)}const m=Array.isArray(e.material);if(m&&o.groups.length===0)return null;let g=!1;if(m&&o.index===null){const _=[];for(let x=0,b=o.attributes.position.count;x0&&(b.targets=u),o.index!==null){let S=this.getUID(o.index);(v[_].start!==void 0||v[_].count!==void 0)&&(S+=":"+v[_].start+":"+v[_].count),t.attributes.has(S)?b.indices=t.attributes.get(S):(b.indices=this.processAccessor(o.index,o,v[_].start,v[_].count),t.attributes.set(S,b.indices)),b.indices===null&&delete b.indices}const B=this.processMaterial(p[v[_].materialIndex]);B!==null&&(b.material=B),A.push(b)}g===!0&&o.setIndex(null),l.primitives=A,r.meshes||(r.meshes=[]),this._invokeAll(function(_){_.writeMesh&&_.writeMesh(e,l)});const w=r.meshes.push(l)-1;return t.meshes.set(s,w),w}detectMeshQuantization(e,t){if(this.extensionsUsed[sB])return;let r;switch(t.array.constructor){case Int8Array:r="byte";break;case Uint8Array:r="unsigned byte";break;case Int16Array:r="short";break;case Uint16Array:r="unsigned short";break;default:return}t.normalized&&(r+=" normalized");const i=e.split("_",1)[0];ID[i]&&ID[i].includes(r)&&(this.extensionsUsed[sB]=!0,this.extensionsRequired[sB]=!0)}processCamera(e){const t=this.json;t.cameras||(t.cameras=[]);const r=e.isOrthographicCamera,i={type:r?"orthographic":"perspective"};return r?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:Et.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 r=this.json,i=this.nodeMap;r.animations||(r.animations=[]),e=XR.Utils.mergeMorphTargetTracks(e.clone(),t);const s=e.tracks,o=[],a=[];for(let l=0;l0){const a=[];for(let l=0,c=e.children.length;l0&&(s.children=a)}this._invokeAll(function(a){a.writeNode&&a.writeNode(e,s)});const o=t.nodes.push(s)-1;return i.set(e,o),o}processScene(e){const t=this.json,r=this.options;t.scenes||(t.scenes=[],t.scene=0);const i={};e.name!==""&&(i.name=e.name),t.scenes.push(i);const s=[];for(let o=0,a=e.children.length;o0&&(i.nodes=s),this.serializeUserData(e,i)}processObjects(e){const t=new zg;t.name="AuxScene";for(let r=0;r0&&this.processObjects(r);for(let i=0;i0&&(o.range=e.distance)):e.isSpotLight&&(o.type="spot",e.distance>0&&(o.range=e.distance),o.spot={},o.spot.innerConeAngle=(1-e.penumbra)*e.angle,o.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."),s[this.name]||(i.extensions=i.extensions||{},i.extensions[this.name]={lights:[]},s[this.name]=!0);const a=i.extensions[this.name].lights;a.push(o),t.extensions=t.extensions||{},t.extensions[this.name]={light:a.length-1}}}class lle{constructor(e){this.writer=e,this.name="KHR_materials_unlit"}writeMaterial(e,t){if(!e.isMeshBasicMaterial)return;const i=this.writer.extensionsUsed;t.extensions=t.extensions||{},t.extensions[this.name]={},i[this.name]=!0,t.pbrMetallicRoughness.metallicFactor=0,t.pbrMetallicRoughness.roughnessFactor=.9}}class cle{constructor(e){this.writer=e,this.name="KHR_materials_clearcoat"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.clearcoat===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.clearcoatFactor=e.clearcoat,e.clearcoatMap){const o={index:r.processTexture(e.clearcoatMap),texCoord:e.clearcoatMap.channel};r.applyTextureTransform(o,e.clearcoatMap),s.clearcoatTexture=o}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const o={index:r.processTexture(e.clearcoatRoughnessMap),texCoord:e.clearcoatRoughnessMap.channel};r.applyTextureTransform(o,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){const o={index:r.processTexture(e.clearcoatNormalMap),texCoord:e.clearcoatNormalMap.channel};e.clearcoatNormalScale.x!==1&&(o.scale=e.clearcoatNormalScale.x),r.applyTextureTransform(o,e.clearcoatNormalMap),s.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Ale{constructor(e){this.writer=e,this.name="KHR_materials_dispersion"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.dispersion===0)return;const i=this.writer.extensionsUsed,s={};s.dispersion=e.dispersion,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ule{constructor(e){this.writer=e,this.name="KHR_materials_iridescence"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.iridescence===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.iridescenceFactor=e.iridescence,e.iridescenceMap){const o={index:r.processTexture(e.iridescenceMap),texCoord:e.iridescenceMap.channel};r.applyTextureTransform(o,e.iridescenceMap),s.iridescenceTexture=o}if(s.iridescenceIor=e.iridescenceIOR,s.iridescenceThicknessMinimum=e.iridescenceThicknessRange[0],s.iridescenceThicknessMaximum=e.iridescenceThicknessRange[1],e.iridescenceThicknessMap){const o={index:r.processTexture(e.iridescenceThicknessMap),texCoord:e.iridescenceThicknessMap.channel};r.applyTextureTransform(o,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class fle{constructor(e){this.writer=e,this.name="KHR_materials_transmission"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.transmissionFactor=e.transmission,e.transmissionMap){const o={index:r.processTexture(e.transmissionMap),texCoord:e.transmissionMap.channel};r.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class hle{constructor(e){this.writer=e,this.name="KHR_materials_volume"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.transmission===0)return;const r=this.writer,i=r.extensionsUsed,s={};if(s.thicknessFactor=e.thickness,e.thicknessMap){const o={index:r.processTexture(e.thicknessMap),texCoord:e.thicknessMap.channel};r.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}e.attenuationDistance!==1/0&&(s.attenuationDistance=e.attenuationDistance),s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class dle{constructor(e){this.writer=e,this.name="KHR_materials_ior"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.ior===1.5)return;const i=this.writer.extensionsUsed,s={};s.ior=e.ior,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class ple{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(qae)&&!e.specularIntensityMap&&!e.specularColorMap)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.specularIntensityMap){const o={index:r.processTexture(e.specularIntensityMap),texCoord:e.specularIntensityMap.channel};r.applyTextureTransform(o,e.specularIntensityMap),s.specularTexture=o}if(e.specularColorMap){const o={index:r.processTexture(e.specularColorMap),texCoord:e.specularColorMap.channel};r.applyTextureTransform(o,e.specularColorMap),s.specularColorTexture=o}s.specularFactor=e.specularIntensity,s.specularColorFactor=e.specularColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class mle{constructor(e){this.writer=e,this.name="KHR_materials_sheen"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.sheen==0)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.sheenRoughnessMap){const o={index:r.processTexture(e.sheenRoughnessMap),texCoord:e.sheenRoughnessMap.channel};r.applyTextureTransform(o,e.sheenRoughnessMap),s.sheenRoughnessTexture=o}if(e.sheenColorMap){const o={index:r.processTexture(e.sheenColorMap),texCoord:e.sheenColorMap.channel};r.applyTextureTransform(o,e.sheenColorMap),s.sheenColorTexture=o}s.sheenRoughnessFactor=e.sheenRoughness,s.sheenColorFactor=e.sheenColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class gle{constructor(e){this.writer=e,this.name="KHR_materials_anisotropy"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.anisotropy==0)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.anisotropyMap){const o={index:r.processTexture(e.anisotropyMap)};r.applyTextureTransform(o,e.anisotropyMap),s.anisotropyTexture=o}s.anisotropyStrength=e.anisotropy,s.anisotropyRotation=e.anisotropyRotation,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class vle{constructor(e){this.writer=e,this.name="KHR_materials_emissive_strength"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.emissiveIntensity===1)return;const i=this.writer.extensionsUsed,s={};s.emissiveStrength=e.emissiveIntensity,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class yle{constructor(e){this.writer=e,this.name="EXT_materials_bump"}writeMaterial(e,t){if(!e.isMeshStandardMaterial||e.bumpScale===1&&!e.bumpMap)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.bumpMap){const o={index:r.processTexture(e.bumpMap),texCoord:e.bumpMap.channel};r.applyTextureTransform(o,e.bumpMap),s.bumpTexture=o}s.bumpFactor=e.bumpScale,t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class wle{constructor(e){this.writer=e,this.name="EXT_mesh_gpu_instancing"}writeNode(e,t){if(!e.isInstancedMesh)return;const r=this.writer,i=e,s=new Float32Array(i.count*3),o=new Float32Array(i.count*4),a=new Float32Array(i.count*3),l=new ke,c=new $,A=new tt,u=new $;for(let h=0;hn.times[n.times.length-1]){if(Math.abs(n.times[n.times.length-1]-e)<.001)return n.times.length-1;i[i.length-1]=e,i.set(n.times,0),s.set(n.values,0),s.set(o.evaluate(e),n.values.length),a=i.length-1}else for(let l=0;le){i.set(n.times.slice(0,l+1),0),i[l+1]=e,i.set(n.times.slice(l+1),l+2),s.set(n.values.slice(0,(l+1)*r),0),s.set(o.evaluate(e),(l+1)*r),s.set(n.values.slice((l+1)*r),(l+2)*r),a=l+1;break}}return n.times=i,n.values=s,a},mergeMorphTargetTracks:function(n,e){const t=[],r={},i=n.tracks;for(let s=0;s0)throw new Error("Invalid string. Length must be a multiple of 4");var t=n.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function ble(n){var e=o8(n),t=e[0],r=e[1];return(t+r)*3/4-r}function Ele(n,e,t){return(e+t)*3/4-t}function Ble(n){var e,t=o8(n),r=t[0],i=t[1],s=new _le(Ele(n,r,i)),o=0,a=i>0?r-4:r,l;for(l=0;l>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=to[n.charCodeAt(l)]<<2|to[n.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=to[n.charCodeAt(l)]<<10|to[n.charCodeAt(l+1)]<<4|to[n.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function Sle(n){return Ua[n>>18&63]+Ua[n>>12&63]+Ua[n>>6&63]+Ua[n&63]}function Mle(n,e,t){for(var r,i=[],s=e;sa?a:o+s));return r===1?(e=n[t-1],i.push(Ua[e>>2]+Ua[e<<4&63]+"==")):r===2&&(e=(n[t-2]<<8)+n[t-1],i.push(Ua[e>>10]+Ua[e>>4&63]+Ua[e<<2&63]+"=")),i.join("")}var YR={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */YR.read=function(n,e,t,r,i){var s,o,a=i*8-r-1,l=(1<>1,A=-7,u=t?i-1:0,f=t?-1:1,h=n[e+u];for(u+=f,s=h&(1<<-A)-1,h>>=-A,A+=a;A>0;s=s*256+n[e+u],u+=f,A-=8);for(o=s&(1<<-A)-1,s>>=-A,A+=r;A>0;o=o*256+n[e+u],u+=f,A-=8);if(s===0)s=1-c;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-c}return(h?-1:1)*o*Math.pow(2,s-r)};YR.write=function(n,e,t,r,i,s){var o,a,l,c=s*8-i-1,A=(1<>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,d=r?1:-1,m=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=A):(o=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+u>=1?e+=f/l:e+=f*Math.pow(2,1-u),e*l>=2&&(o++,l/=2),o+u>=A?(a=0,o=A):o+u>=1?(a=(e*l-1)*Math.pow(2,i),o=o+u):(a=e*Math.pow(2,u-1)*Math.pow(2,i),o=0));i>=8;n[t+h]=a&255,h+=d,a/=256,i-=8);for(o=o<0;n[t+h]=o&255,h+=d,o/=256,c-=8);n[t+h-d]|=m*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */(function(n){const e=h1,t=KR,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=a,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50;const i=2147483647;n.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{const V=new Uint8Array(1),R={foo:function(){return 42}};return Object.setPrototypeOf(R,Uint8Array.prototype),Object.setPrototypeOf(V,R),V.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(V){if(V>i)throw new RangeError('The value "'+V+'" is invalid for option "size"');const R=new Uint8Array(V);return Object.setPrototypeOf(R,a.prototype),R}function a(V,R,D){if(typeof V=="number"){if(typeof R=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(V)}return l(V,R,D)}a.poolSize=8192;function l(V,R,D){if(typeof V=="string")return f(V,R);if(ArrayBuffer.isView(V))return d(V);if(V==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V);if(j(V,ArrayBuffer)||V&&j(V.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(j(V,SharedArrayBuffer)||V&&j(V.buffer,SharedArrayBuffer)))return m(V,R,D);if(typeof V=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const X=V.valueOf&&V.valueOf();if(X!=null&&X!==V)return a.from(X,R,D);const ie=g(V);if(ie)return ie;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof V[Symbol.toPrimitive]=="function")return a.from(V[Symbol.toPrimitive]("string"),R,D);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V)}a.from=function(V,R,D){return l(V,R,D)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(V){if(typeof V!="number")throw new TypeError('"size" argument must be of type number');if(V<0)throw new RangeError('The value "'+V+'" is invalid for option "size"')}function A(V,R,D){return c(V),V<=0?o(V):R!==void 0?typeof D=="string"?o(V).fill(R,D):o(V).fill(R):o(V)}a.alloc=function(V,R,D){return A(V,R,D)};function u(V){return c(V),o(V<0?0:p(V)|0)}a.allocUnsafe=function(V){return u(V)},a.allocUnsafeSlow=function(V){return u(V)};function f(V,R){if((typeof R!="string"||R==="")&&(R="utf8"),!a.isEncoding(R))throw new TypeError("Unknown encoding: "+R);const D=w(V,R)|0;let X=o(D);const ie=X.write(V,R);return ie!==D&&(X=X.slice(0,ie)),X}function h(V){const R=V.length<0?0:p(V.length)|0,D=o(R);for(let X=0;X=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return V|0}function v(V){return+V!=V&&(V=0),a.alloc(+V)}a.isBuffer=function(R){return R!=null&&R._isBuffer===!0&&R!==a.prototype},a.compare=function(R,D){if(j(R,Uint8Array)&&(R=a.from(R,R.offset,R.byteLength)),j(D,Uint8Array)&&(D=a.from(D,D.offset,D.byteLength)),!a.isBuffer(R)||!a.isBuffer(D))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(R===D)return 0;let X=R.length,ie=D.length;for(let pe=0,de=Math.min(X,ie);peie.length?(a.isBuffer(de)||(de=a.from(de)),de.copy(ie,pe)):Uint8Array.prototype.set.call(ie,de,pe);else if(a.isBuffer(de))de.copy(ie,pe);else throw new TypeError('"list" argument must be an Array of Buffers');pe+=de.length}return ie};function w(V,R){if(a.isBuffer(V))return V.length;if(ArrayBuffer.isView(V)||j(V,ArrayBuffer))return V.byteLength;if(typeof V!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof V);const D=V.length,X=arguments.length>2&&arguments[2]===!0;if(!X&&D===0)return 0;let ie=!1;for(;;)switch(R){case"ascii":case"latin1":case"binary":return D;case"utf8":case"utf-8":return Z(V).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D*2;case"hex":return D>>>1;case"base64":return Y(V).length;default:if(ie)return X?-1:Z(V).length;R=(""+R).toLowerCase(),ie=!0}}a.byteLength=w;function _(V,R,D){let X=!1;if((R===void 0||R<0)&&(R=0),R>this.length||((D===void 0||D>this.length)&&(D=this.length),D<=0)||(D>>>=0,R>>>=0,D<=R))return"";for(V||(V="utf8");;)switch(V){case"hex":return z(this,R,D);case"utf8":case"utf-8":return y(this,R,D);case"ascii":return P(this,R,D);case"latin1":case"binary":return N(this,R,D);case"base64":return T(this,R,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,R,D);default:if(X)throw new TypeError("Unknown encoding: "+V);V=(V+"").toLowerCase(),X=!0}}a.prototype._isBuffer=!0;function x(V,R,D){const X=V[R];V[R]=V[D],V[D]=X}a.prototype.swap16=function(){const R=this.length;if(R%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let D=0;DD&&(R+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(R,D,X,ie,pe){if(j(R,Uint8Array)&&(R=a.from(R,R.offset,R.byteLength)),!a.isBuffer(R))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof R);if(D===void 0&&(D=0),X===void 0&&(X=R?R.length:0),ie===void 0&&(ie=0),pe===void 0&&(pe=this.length),D<0||X>R.length||ie<0||pe>this.length)throw new RangeError("out of range index");if(ie>=pe&&D>=X)return 0;if(ie>=pe)return-1;if(D>=X)return 1;if(D>>>=0,X>>>=0,ie>>>=0,pe>>>=0,this===R)return 0;let de=pe-ie,Ie=X-D;const Le=Math.min(de,Ie),Ue=this.slice(ie,pe),Ye=R.slice(D,X);for(let Ae=0;Ae2147483647?D=2147483647:D<-2147483648&&(D=-2147483648),D=+D,se(D)&&(D=ie?0:V.length-1),D<0&&(D=V.length+D),D>=V.length){if(ie)return-1;D=V.length-1}else if(D<0)if(ie)D=0;else return-1;if(typeof R=="string"&&(R=a.from(R,X)),a.isBuffer(R))return R.length===0?-1:B(V,R,D,X,ie);if(typeof R=="number")return R=R&255,typeof Uint8Array.prototype.indexOf=="function"?ie?Uint8Array.prototype.indexOf.call(V,R,D):Uint8Array.prototype.lastIndexOf.call(V,R,D):B(V,[R],D,X,ie);throw new TypeError("val must be string, number or Buffer")}function B(V,R,D,X,ie){let pe=1,de=V.length,Ie=R.length;if(X!==void 0&&(X=String(X).toLowerCase(),X==="ucs2"||X==="ucs-2"||X==="utf16le"||X==="utf-16le")){if(V.length<2||R.length<2)return-1;pe=2,de/=2,Ie/=2,D/=2}function Le(Ye,Ae){return pe===1?Ye[Ae]:Ye.readUInt16BE(Ae*pe)}let Ue;if(ie){let Ye=-1;for(Ue=D;Uede&&(D=de-Ie),Ue=D;Ue>=0;Ue--){let Ye=!0;for(let Ae=0;Aeie&&(X=ie)):X=ie;const pe=R.length;X>pe/2&&(X=pe/2);let de;for(de=0;de>>0,isFinite(X)?(X=X>>>0,ie===void 0&&(ie="utf8")):(ie=X,X=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const pe=this.length-D;if((X===void 0||X>pe)&&(X=pe),R.length>0&&(X<0||D<0)||D>this.length)throw new RangeError("Attempt to write outside buffer bounds");ie||(ie="utf8");let de=!1;for(;;)switch(ie){case"hex":return M(this,R,D,X);case"utf8":case"utf-8":return I(this,R,D,X);case"ascii":case"latin1":case"binary":return S(this,R,D,X);case"base64":return L(this,R,D,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,R,D,X);default:if(de)throw new TypeError("Unknown encoding: "+ie);ie=(""+ie).toLowerCase(),de=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(V,R,D){return R===0&&D===V.length?e.fromByteArray(V):e.fromByteArray(V.slice(R,D))}function y(V,R,D){D=Math.min(V.length,D);const X=[];let ie=R;for(;ie239?4:pe>223?3:pe>191?2:1;if(ie+Ie<=D){let Le,Ue,Ye,Ae;switch(Ie){case 1:pe<128&&(de=pe);break;case 2:Le=V[ie+1],(Le&192)===128&&(Ae=(pe&31)<<6|Le&63,Ae>127&&(de=Ae));break;case 3:Le=V[ie+1],Ue=V[ie+2],(Le&192)===128&&(Ue&192)===128&&(Ae=(pe&15)<<12|(Le&63)<<6|Ue&63,Ae>2047&&(Ae<55296||Ae>57343)&&(de=Ae));break;case 4:Le=V[ie+1],Ue=V[ie+2],Ye=V[ie+3],(Le&192)===128&&(Ue&192)===128&&(Ye&192)===128&&(Ae=(pe&15)<<18|(Le&63)<<12|(Ue&63)<<6|Ye&63,Ae>65535&&Ae<1114112&&(de=Ae))}}de===null?(de=65533,Ie=1):de>65535&&(de-=65536,X.push(de>>>10&1023|55296),de=56320|de&1023),X.push(de),ie+=Ie}return U(X)}const E=4096;function U(V){const R=V.length;if(R<=E)return String.fromCharCode.apply(String,V);let D="",X=0;for(;XX)&&(D=X);let ie="";for(let pe=R;peX&&(R=X),D<0?(D+=X,D<0&&(D=0)):D>X&&(D=X),DD)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(R,D,X){R=R>>>0,D=D>>>0,X||H(R,D,this.length);let ie=this[R],pe=1,de=0;for(;++de>>0,D=D>>>0,X||H(R,D,this.length);let ie=this[R+--D],pe=1;for(;D>0&&(pe*=256);)ie+=this[R+--D]*pe;return ie},a.prototype.readUint8=a.prototype.readUInt8=function(R,D){return R=R>>>0,D||H(R,1,this.length),this[R]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(R,D){return R=R>>>0,D||H(R,2,this.length),this[R]|this[R+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(R,D){return R=R>>>0,D||H(R,2,this.length),this[R]<<8|this[R+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(R,D){return R=R>>>0,D||H(R,4,this.length),(this[R]|this[R+1]<<8|this[R+2]<<16)+this[R+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(R,D){return R=R>>>0,D||H(R,4,this.length),this[R]*16777216+(this[R+1]<<16|this[R+2]<<8|this[R+3])},a.prototype.readBigUInt64LE=he(function(R){R=R>>>0,ne(R,"offset");const D=this[R],X=this[R+7];(D===void 0||X===void 0)&&k(R,this.length-8);const ie=D+this[++R]*2**8+this[++R]*2**16+this[++R]*2**24,pe=this[++R]+this[++R]*2**8+this[++R]*2**16+X*2**24;return BigInt(ie)+(BigInt(pe)<>>0,ne(R,"offset");const D=this[R],X=this[R+7];(D===void 0||X===void 0)&&k(R,this.length-8);const ie=D*2**24+this[++R]*2**16+this[++R]*2**8+this[++R],pe=this[++R]*2**24+this[++R]*2**16+this[++R]*2**8+X;return(BigInt(ie)<>>0,D=D>>>0,X||H(R,D,this.length);let ie=this[R],pe=1,de=0;for(;++de=pe&&(ie-=Math.pow(2,8*D)),ie},a.prototype.readIntBE=function(R,D,X){R=R>>>0,D=D>>>0,X||H(R,D,this.length);let ie=D,pe=1,de=this[R+--ie];for(;ie>0&&(pe*=256);)de+=this[R+--ie]*pe;return pe*=128,de>=pe&&(de-=Math.pow(2,8*D)),de},a.prototype.readInt8=function(R,D){return R=R>>>0,D||H(R,1,this.length),this[R]&128?(255-this[R]+1)*-1:this[R]},a.prototype.readInt16LE=function(R,D){R=R>>>0,D||H(R,2,this.length);const X=this[R]|this[R+1]<<8;return X&32768?X|4294901760:X},a.prototype.readInt16BE=function(R,D){R=R>>>0,D||H(R,2,this.length);const X=this[R+1]|this[R]<<8;return X&32768?X|4294901760:X},a.prototype.readInt32LE=function(R,D){return R=R>>>0,D||H(R,4,this.length),this[R]|this[R+1]<<8|this[R+2]<<16|this[R+3]<<24},a.prototype.readInt32BE=function(R,D){return R=R>>>0,D||H(R,4,this.length),this[R]<<24|this[R+1]<<16|this[R+2]<<8|this[R+3]},a.prototype.readBigInt64LE=he(function(R){R=R>>>0,ne(R,"offset");const D=this[R],X=this[R+7];(D===void 0||X===void 0)&&k(R,this.length-8);const ie=this[R+4]+this[R+5]*2**8+this[R+6]*2**16+(X<<24);return(BigInt(ie)<>>0,ne(R,"offset");const D=this[R],X=this[R+7];(D===void 0||X===void 0)&&k(R,this.length-8);const ie=(D<<24)+this[++R]*2**16+this[++R]*2**8+this[++R];return(BigInt(ie)<>>0,D||H(R,4,this.length),t.read(this,R,!0,23,4)},a.prototype.readFloatBE=function(R,D){return R=R>>>0,D||H(R,4,this.length),t.read(this,R,!1,23,4)},a.prototype.readDoubleLE=function(R,D){return R=R>>>0,D||H(R,8,this.length),t.read(this,R,!0,52,8)},a.prototype.readDoubleBE=function(R,D){return R=R>>>0,D||H(R,8,this.length),t.read(this,R,!1,52,8)};function C(V,R,D,X,ie,pe){if(!a.isBuffer(V))throw new TypeError('"buffer" argument must be a Buffer instance');if(R>ie||RV.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(R,D,X,ie){if(R=+R,D=D>>>0,X=X>>>0,!ie){const Ie=Math.pow(2,8*X)-1;C(this,R,D,X,Ie,0)}let pe=1,de=0;for(this[D]=R&255;++de>>0,X=X>>>0,!ie){const Ie=Math.pow(2,8*X)-1;C(this,R,D,X,Ie,0)}let pe=X-1,de=1;for(this[D+pe]=R&255;--pe>=0&&(de*=256);)this[D+pe]=R/de&255;return D+X},a.prototype.writeUint8=a.prototype.writeUInt8=function(R,D,X){return R=+R,D=D>>>0,X||C(this,R,D,1,255,0),this[D]=R&255,D+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(R,D,X){return R=+R,D=D>>>0,X||C(this,R,D,2,65535,0),this[D]=R&255,this[D+1]=R>>>8,D+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(R,D,X){return R=+R,D=D>>>0,X||C(this,R,D,2,65535,0),this[D]=R>>>8,this[D+1]=R&255,D+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(R,D,X){return R=+R,D=D>>>0,X||C(this,R,D,4,4294967295,0),this[D+3]=R>>>24,this[D+2]=R>>>16,this[D+1]=R>>>8,this[D]=R&255,D+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(R,D,X){return R=+R,D=D>>>0,X||C(this,R,D,4,4294967295,0),this[D]=R>>>24,this[D+1]=R>>>16,this[D+2]=R>>>8,this[D+3]=R&255,D+4};function K(V,R,D,X,ie){be(R,X,ie,V,D,7);let pe=Number(R&BigInt(4294967295));V[D++]=pe,pe=pe>>8,V[D++]=pe,pe=pe>>8,V[D++]=pe,pe=pe>>8,V[D++]=pe;let de=Number(R>>BigInt(32)&BigInt(4294967295));return V[D++]=de,de=de>>8,V[D++]=de,de=de>>8,V[D++]=de,de=de>>8,V[D++]=de,D}function te(V,R,D,X,ie){be(R,X,ie,V,D,7);let pe=Number(R&BigInt(4294967295));V[D+7]=pe,pe=pe>>8,V[D+6]=pe,pe=pe>>8,V[D+5]=pe,pe=pe>>8,V[D+4]=pe;let de=Number(R>>BigInt(32)&BigInt(4294967295));return V[D+3]=de,de=de>>8,V[D+2]=de,de=de>>8,V[D+1]=de,de=de>>8,V[D]=de,D+8}a.prototype.writeBigUInt64LE=he(function(R,D=0){return K(this,R,D,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=he(function(R,D=0){return te(this,R,D,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(R,D,X,ie){if(R=+R,D=D>>>0,!ie){const Le=Math.pow(2,8*X-1);C(this,R,D,X,Le-1,-Le)}let pe=0,de=1,Ie=0;for(this[D]=R&255;++pe>0)-Ie&255;return D+X},a.prototype.writeIntBE=function(R,D,X,ie){if(R=+R,D=D>>>0,!ie){const Le=Math.pow(2,8*X-1);C(this,R,D,X,Le-1,-Le)}let pe=X-1,de=1,Ie=0;for(this[D+pe]=R&255;--pe>=0&&(de*=256);)R<0&&Ie===0&&this[D+pe+1]!==0&&(Ie=1),this[D+pe]=(R/de>>0)-Ie&255;return D+X},a.prototype.writeInt8=function(R,D,X){return R=+R,D=D>>>0,X||C(this,R,D,1,127,-128),R<0&&(R=255+R+1),this[D]=R&255,D+1},a.prototype.writeInt16LE=function(R,D,X){return R=+R,D=D>>>0,X||C(this,R,D,2,32767,-32768),this[D]=R&255,this[D+1]=R>>>8,D+2},a.prototype.writeInt16BE=function(R,D,X){return R=+R,D=D>>>0,X||C(this,R,D,2,32767,-32768),this[D]=R>>>8,this[D+1]=R&255,D+2},a.prototype.writeInt32LE=function(R,D,X){return R=+R,D=D>>>0,X||C(this,R,D,4,2147483647,-2147483648),this[D]=R&255,this[D+1]=R>>>8,this[D+2]=R>>>16,this[D+3]=R>>>24,D+4},a.prototype.writeInt32BE=function(R,D,X){return R=+R,D=D>>>0,X||C(this,R,D,4,2147483647,-2147483648),R<0&&(R=4294967295+R+1),this[D]=R>>>24,this[D+1]=R>>>16,this[D+2]=R>>>8,this[D+3]=R&255,D+4},a.prototype.writeBigInt64LE=he(function(R,D=0){return K(this,R,D,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=he(function(R,D=0){return te(this,R,D,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(V,R,D,X,ie,pe){if(D+X>V.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("Index out of range")}function re(V,R,D,X,ie){return R=+R,D=D>>>0,ie||F(V,R,D,4),t.write(V,R,D,X,23,4),D+4}a.prototype.writeFloatLE=function(R,D,X){return re(this,R,D,!0,X)},a.prototype.writeFloatBE=function(R,D,X){return re(this,R,D,!1,X)};function ce(V,R,D,X,ie){return R=+R,D=D>>>0,ie||F(V,R,D,8),t.write(V,R,D,X,52,8),D+8}a.prototype.writeDoubleLE=function(R,D,X){return ce(this,R,D,!0,X)},a.prototype.writeDoubleBE=function(R,D,X){return ce(this,R,D,!1,X)},a.prototype.copy=function(R,D,X,ie){if(!a.isBuffer(R))throw new TypeError("argument should be a Buffer");if(X||(X=0),!ie&&ie!==0&&(ie=this.length),D>=R.length&&(D=R.length),D||(D=0),ie>0&&ie=this.length)throw new RangeError("Index out of range");if(ie<0)throw new RangeError("sourceEnd out of bounds");ie>this.length&&(ie=this.length),R.length-D>>0,X=X===void 0?this.length:X>>>0,R||(R=0);let pe;if(typeof R=="number")for(pe=D;pe2**32?ie=me(String(D)):typeof D=="bigint"&&(ie=String(D),(D>BigInt(2)**BigInt(32)||D<-(BigInt(2)**BigInt(32)))&&(ie=me(ie)),ie+="n"),X+=` It must be ${R}. Received ${ie}`,X},RangeError);function me(V){let R="",D=V.length;const X=V[0]==="-"?1:0;for(;D>=X+4;D-=3)R=`_${V.slice(D-3,D)}${R}`;return`${V.slice(0,D)}${R}`}function ve(V,R,D){ne(R,"offset"),(V[R]===void 0||V[R+D]===void 0)&&k(R,V.length-(D+1))}function be(V,R,D,X,ie,pe){if(V>D||V3?R===0||R===BigInt(0)?Ie=`>= 0${de} and < 2${de} ** ${(pe+1)*8}${de}`:Ie=`>= -(2${de} ** ${(pe+1)*8-1}${de}) and < 2 ** ${(pe+1)*8-1}${de}`:Ie=`>= ${R}${de} and <= ${D}${de}`,new oe.ERR_OUT_OF_RANGE("value",Ie,V)}ve(X,ie,pe)}function ne(V,R){if(typeof V!="number")throw new oe.ERR_INVALID_ARG_TYPE(R,"number",V)}function k(V,R,D){throw Math.floor(V)!==V?(ne(V,D),new oe.ERR_OUT_OF_RANGE(D||"offset","an integer",V)):R<0?new oe.ERR_BUFFER_OUT_OF_BOUNDS:new oe.ERR_OUT_OF_RANGE(D||"offset",`>= ${D?1:0} and <= ${R}`,V)}const ae=/[^+/0-9A-Za-z-_]/g;function le(V){if(V=V.split("=")[0],V=V.trim().replace(ae,""),V.length<2)return"";for(;V.length%4!==0;)V=V+"=";return V}function Z(V,R){R=R||1/0;let D;const X=V.length;let ie=null;const pe=[];for(let de=0;de55295&&D<57344){if(!ie){if(D>56319){(R-=3)>-1&&pe.push(239,191,189);continue}else if(de+1===X){(R-=3)>-1&&pe.push(239,191,189);continue}ie=D;continue}if(D<56320){(R-=3)>-1&&pe.push(239,191,189),ie=D;continue}D=(ie-55296<<10|D-56320)+65536}else ie&&(R-=3)>-1&&pe.push(239,191,189);if(ie=null,D<128){if((R-=1)<0)break;pe.push(D)}else if(D<2048){if((R-=2)<0)break;pe.push(D>>6|192,D&63|128)}else if(D<65536){if((R-=3)<0)break;pe.push(D>>12|224,D>>6&63|128,D&63|128)}else if(D<1114112){if((R-=4)<0)break;pe.push(D>>18|240,D>>12&63|128,D>>6&63|128,D&63|128)}else throw new Error("Invalid code point")}return pe}function J(V){const R=[];for(let D=0;D>8,ie=D%256,pe.push(ie),pe.push(X);return pe}function Y(V){return e.toByteArray(le(V))}function G(V,R,D,X){let ie;for(ie=0;ie=R.length||ie>=V.length);++ie)R[ie+D]=V[ie];return ie}function j(V,R){return V instanceof R||V!=null&&V.constructor!=null&&V.constructor.name!=null&&V.constructor.name===R.name}function se(V){return V!==V}const fe=function(){const V="0123456789abcdef",R=new Array(256);for(let D=0;D<16;++D){const X=D*16;for(let ie=0;ie<16;++ie)R[X+ie]=V[D]+V[ie]}return R}();function he(V){return typeof BigInt>"u"?Be:V}function Be(){throw new Error("BigInt not supported")}})(r8);/*! + */(function(n){const e=m1,t=YR,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=a,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50;const i=2147483647;n.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{const V=new Uint8Array(1),U={foo:function(){return 42}};return Object.setPrototypeOf(U,Uint8Array.prototype),Object.setPrototypeOf(V,U),V.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(V){if(V>i)throw new RangeError('The value "'+V+'" is invalid for option "size"');const U=new Uint8Array(V);return Object.setPrototypeOf(U,a.prototype),U}function a(V,U,O){if(typeof V=="number"){if(typeof U=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(V)}return l(V,U,O)}a.poolSize=8192;function l(V,U,O){if(typeof V=="string")return f(V,U);if(ArrayBuffer.isView(V))return d(V);if(V==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V);if(j(V,ArrayBuffer)||V&&j(V.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(j(V,SharedArrayBuffer)||V&&j(V.buffer,SharedArrayBuffer)))return m(V,U,O);if(typeof V=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const X=V.valueOf&&V.valueOf();if(X!=null&&X!==V)return a.from(X,U,O);const ie=g(V);if(ie)return ie;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof V[Symbol.toPrimitive]=="function")return a.from(V[Symbol.toPrimitive]("string"),U,O);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V)}a.from=function(V,U,O){return l(V,U,O)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function c(V){if(typeof V!="number")throw new TypeError('"size" argument must be of type number');if(V<0)throw new RangeError('The value "'+V+'" is invalid for option "size"')}function A(V,U,O){return c(V),V<=0?o(V):U!==void 0?typeof O=="string"?o(V).fill(U,O):o(V).fill(U):o(V)}a.alloc=function(V,U,O){return A(V,U,O)};function u(V){return c(V),o(V<0?0:p(V)|0)}a.allocUnsafe=function(V){return u(V)},a.allocUnsafeSlow=function(V){return u(V)};function f(V,U){if((typeof U!="string"||U==="")&&(U="utf8"),!a.isEncoding(U))throw new TypeError("Unknown encoding: "+U);const O=w(V,U)|0;let X=o(O);const ie=X.write(V,U);return ie!==O&&(X=X.slice(0,ie)),X}function h(V){const U=V.length<0?0:p(V.length)|0,O=o(U);for(let X=0;X=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return V|0}function v(V){return+V!=V&&(V=0),a.alloc(+V)}a.isBuffer=function(U){return U!=null&&U._isBuffer===!0&&U!==a.prototype},a.compare=function(U,O){if(j(U,Uint8Array)&&(U=a.from(U,U.offset,U.byteLength)),j(O,Uint8Array)&&(O=a.from(O,O.offset,O.byteLength)),!a.isBuffer(U)||!a.isBuffer(O))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(U===O)return 0;let X=U.length,ie=O.length;for(let pe=0,de=Math.min(X,ie);peie.length?(a.isBuffer(de)||(de=a.from(de)),de.copy(ie,pe)):Uint8Array.prototype.set.call(ie,de,pe);else if(a.isBuffer(de))de.copy(ie,pe);else throw new TypeError('"list" argument must be an Array of Buffers');pe+=de.length}return ie};function w(V,U){if(a.isBuffer(V))return V.length;if(ArrayBuffer.isView(V)||j(V,ArrayBuffer))return V.byteLength;if(typeof V!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof V);const O=V.length,X=arguments.length>2&&arguments[2]===!0;if(!X&&O===0)return 0;let ie=!1;for(;;)switch(U){case"ascii":case"latin1":case"binary":return O;case"utf8":case"utf-8":return Z(V).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O*2;case"hex":return O>>>1;case"base64":return Y(V).length;default:if(ie)return X?-1:Z(V).length;U=(""+U).toLowerCase(),ie=!0}}a.byteLength=w;function _(V,U,O){let X=!1;if((U===void 0||U<0)&&(U=0),U>this.length||((O===void 0||O>this.length)&&(O=this.length),O<=0)||(O>>>=0,U>>>=0,O<=U))return"";for(V||(V="utf8");;)switch(V){case"hex":return z(this,U,O);case"utf8":case"utf-8":return y(this,U,O);case"ascii":return L(this,U,O);case"latin1":case"binary":return N(this,U,O);case"base64":return T(this,U,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,U,O);default:if(X)throw new TypeError("Unknown encoding: "+V);V=(V+"").toLowerCase(),X=!0}}a.prototype._isBuffer=!0;function x(V,U,O){const X=V[U];V[U]=V[O],V[O]=X}a.prototype.swap16=function(){const U=this.length;if(U%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let O=0;OO&&(U+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(U,O,X,ie,pe){if(j(U,Uint8Array)&&(U=a.from(U,U.offset,U.byteLength)),!a.isBuffer(U))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof U);if(O===void 0&&(O=0),X===void 0&&(X=U?U.length:0),ie===void 0&&(ie=0),pe===void 0&&(pe=this.length),O<0||X>U.length||ie<0||pe>this.length)throw new RangeError("out of range index");if(ie>=pe&&O>=X)return 0;if(ie>=pe)return-1;if(O>=X)return 1;if(O>>>=0,X>>>=0,ie>>>=0,pe>>>=0,this===U)return 0;let de=pe-ie,Ie=X-O;const Le=Math.min(de,Ie),Ue=this.slice(ie,pe),Ye=U.slice(O,X);for(let Ae=0;Ae2147483647?O=2147483647:O<-2147483648&&(O=-2147483648),O=+O,se(O)&&(O=ie?0:V.length-1),O<0&&(O=V.length+O),O>=V.length){if(ie)return-1;O=V.length-1}else if(O<0)if(ie)O=0;else return-1;if(typeof U=="string"&&(U=a.from(U,X)),a.isBuffer(U))return U.length===0?-1:B(V,U,O,X,ie);if(typeof U=="number")return U=U&255,typeof Uint8Array.prototype.indexOf=="function"?ie?Uint8Array.prototype.indexOf.call(V,U,O):Uint8Array.prototype.lastIndexOf.call(V,U,O):B(V,[U],O,X,ie);throw new TypeError("val must be string, number or Buffer")}function B(V,U,O,X,ie){let pe=1,de=V.length,Ie=U.length;if(X!==void 0&&(X=String(X).toLowerCase(),X==="ucs2"||X==="ucs-2"||X==="utf16le"||X==="utf-16le")){if(V.length<2||U.length<2)return-1;pe=2,de/=2,Ie/=2,O/=2}function Le(Ye,Ae){return pe===1?Ye[Ae]:Ye.readUInt16BE(Ae*pe)}let Ue;if(ie){let Ye=-1;for(Ue=O;Uede&&(O=de-Ie),Ue=O;Ue>=0;Ue--){let Ye=!0;for(let Ae=0;Aeie&&(X=ie)):X=ie;const pe=U.length;X>pe/2&&(X=pe/2);let de;for(de=0;de>>0,isFinite(X)?(X=X>>>0,ie===void 0&&(ie="utf8")):(ie=X,X=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const pe=this.length-O;if((X===void 0||X>pe)&&(X=pe),U.length>0&&(X<0||O<0)||O>this.length)throw new RangeError("Attempt to write outside buffer bounds");ie||(ie="utf8");let de=!1;for(;;)switch(ie){case"hex":return S(this,U,O,X);case"utf8":case"utf-8":return I(this,U,O,X);case"ascii":case"latin1":case"binary":return M(this,U,O,X);case"base64":return P(this,U,O,X);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,U,O,X);default:if(de)throw new TypeError("Unknown encoding: "+ie);ie=(""+ie).toLowerCase(),de=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(V,U,O){return U===0&&O===V.length?e.fromByteArray(V):e.fromByteArray(V.slice(U,O))}function y(V,U,O){O=Math.min(V.length,O);const X=[];let ie=U;for(;ie239?4:pe>223?3:pe>191?2:1;if(ie+Ie<=O){let Le,Ue,Ye,Ae;switch(Ie){case 1:pe<128&&(de=pe);break;case 2:Le=V[ie+1],(Le&192)===128&&(Ae=(pe&31)<<6|Le&63,Ae>127&&(de=Ae));break;case 3:Le=V[ie+1],Ue=V[ie+2],(Le&192)===128&&(Ue&192)===128&&(Ae=(pe&15)<<12|(Le&63)<<6|Ue&63,Ae>2047&&(Ae<55296||Ae>57343)&&(de=Ae));break;case 4:Le=V[ie+1],Ue=V[ie+2],Ye=V[ie+3],(Le&192)===128&&(Ue&192)===128&&(Ye&192)===128&&(Ae=(pe&15)<<18|(Le&63)<<12|(Ue&63)<<6|Ye&63,Ae>65535&&Ae<1114112&&(de=Ae))}}de===null?(de=65533,Ie=1):de>65535&&(de-=65536,X.push(de>>>10&1023|55296),de=56320|de&1023),X.push(de),ie+=Ie}return R(X)}const E=4096;function R(V){const U=V.length;if(U<=E)return String.fromCharCode.apply(String,V);let O="",X=0;for(;XX)&&(O=X);let ie="";for(let pe=U;peX&&(U=X),O<0?(O+=X,O<0&&(O=0)):O>X&&(O=X),OO)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(U,O,X){U=U>>>0,O=O>>>0,X||H(U,O,this.length);let ie=this[U],pe=1,de=0;for(;++de>>0,O=O>>>0,X||H(U,O,this.length);let ie=this[U+--O],pe=1;for(;O>0&&(pe*=256);)ie+=this[U+--O]*pe;return ie},a.prototype.readUint8=a.prototype.readUInt8=function(U,O){return U=U>>>0,O||H(U,1,this.length),this[U]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(U,O){return U=U>>>0,O||H(U,2,this.length),this[U]|this[U+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(U,O){return U=U>>>0,O||H(U,2,this.length),this[U]<<8|this[U+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(U,O){return U=U>>>0,O||H(U,4,this.length),(this[U]|this[U+1]<<8|this[U+2]<<16)+this[U+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(U,O){return U=U>>>0,O||H(U,4,this.length),this[U]*16777216+(this[U+1]<<16|this[U+2]<<8|this[U+3])},a.prototype.readBigUInt64LE=he(function(U){U=U>>>0,ne(U,"offset");const O=this[U],X=this[U+7];(O===void 0||X===void 0)&&k(U,this.length-8);const ie=O+this[++U]*2**8+this[++U]*2**16+this[++U]*2**24,pe=this[++U]+this[++U]*2**8+this[++U]*2**16+X*2**24;return BigInt(ie)+(BigInt(pe)<>>0,ne(U,"offset");const O=this[U],X=this[U+7];(O===void 0||X===void 0)&&k(U,this.length-8);const ie=O*2**24+this[++U]*2**16+this[++U]*2**8+this[++U],pe=this[++U]*2**24+this[++U]*2**16+this[++U]*2**8+X;return(BigInt(ie)<>>0,O=O>>>0,X||H(U,O,this.length);let ie=this[U],pe=1,de=0;for(;++de=pe&&(ie-=Math.pow(2,8*O)),ie},a.prototype.readIntBE=function(U,O,X){U=U>>>0,O=O>>>0,X||H(U,O,this.length);let ie=O,pe=1,de=this[U+--ie];for(;ie>0&&(pe*=256);)de+=this[U+--ie]*pe;return pe*=128,de>=pe&&(de-=Math.pow(2,8*O)),de},a.prototype.readInt8=function(U,O){return U=U>>>0,O||H(U,1,this.length),this[U]&128?(255-this[U]+1)*-1:this[U]},a.prototype.readInt16LE=function(U,O){U=U>>>0,O||H(U,2,this.length);const X=this[U]|this[U+1]<<8;return X&32768?X|4294901760:X},a.prototype.readInt16BE=function(U,O){U=U>>>0,O||H(U,2,this.length);const X=this[U+1]|this[U]<<8;return X&32768?X|4294901760:X},a.prototype.readInt32LE=function(U,O){return U=U>>>0,O||H(U,4,this.length),this[U]|this[U+1]<<8|this[U+2]<<16|this[U+3]<<24},a.prototype.readInt32BE=function(U,O){return U=U>>>0,O||H(U,4,this.length),this[U]<<24|this[U+1]<<16|this[U+2]<<8|this[U+3]},a.prototype.readBigInt64LE=he(function(U){U=U>>>0,ne(U,"offset");const O=this[U],X=this[U+7];(O===void 0||X===void 0)&&k(U,this.length-8);const ie=this[U+4]+this[U+5]*2**8+this[U+6]*2**16+(X<<24);return(BigInt(ie)<>>0,ne(U,"offset");const O=this[U],X=this[U+7];(O===void 0||X===void 0)&&k(U,this.length-8);const ie=(O<<24)+this[++U]*2**16+this[++U]*2**8+this[++U];return(BigInt(ie)<>>0,O||H(U,4,this.length),t.read(this,U,!0,23,4)},a.prototype.readFloatBE=function(U,O){return U=U>>>0,O||H(U,4,this.length),t.read(this,U,!1,23,4)},a.prototype.readDoubleLE=function(U,O){return U=U>>>0,O||H(U,8,this.length),t.read(this,U,!0,52,8)},a.prototype.readDoubleBE=function(U,O){return U=U>>>0,O||H(U,8,this.length),t.read(this,U,!1,52,8)};function C(V,U,O,X,ie,pe){if(!a.isBuffer(V))throw new TypeError('"buffer" argument must be a Buffer instance');if(U>ie||UV.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(U,O,X,ie){if(U=+U,O=O>>>0,X=X>>>0,!ie){const Ie=Math.pow(2,8*X)-1;C(this,U,O,X,Ie,0)}let pe=1,de=0;for(this[O]=U&255;++de>>0,X=X>>>0,!ie){const Ie=Math.pow(2,8*X)-1;C(this,U,O,X,Ie,0)}let pe=X-1,de=1;for(this[O+pe]=U&255;--pe>=0&&(de*=256);)this[O+pe]=U/de&255;return O+X},a.prototype.writeUint8=a.prototype.writeUInt8=function(U,O,X){return U=+U,O=O>>>0,X||C(this,U,O,1,255,0),this[O]=U&255,O+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(U,O,X){return U=+U,O=O>>>0,X||C(this,U,O,2,65535,0),this[O]=U&255,this[O+1]=U>>>8,O+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(U,O,X){return U=+U,O=O>>>0,X||C(this,U,O,2,65535,0),this[O]=U>>>8,this[O+1]=U&255,O+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(U,O,X){return U=+U,O=O>>>0,X||C(this,U,O,4,4294967295,0),this[O+3]=U>>>24,this[O+2]=U>>>16,this[O+1]=U>>>8,this[O]=U&255,O+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(U,O,X){return U=+U,O=O>>>0,X||C(this,U,O,4,4294967295,0),this[O]=U>>>24,this[O+1]=U>>>16,this[O+2]=U>>>8,this[O+3]=U&255,O+4};function K(V,U,O,X,ie){be(U,X,ie,V,O,7);let pe=Number(U&BigInt(4294967295));V[O++]=pe,pe=pe>>8,V[O++]=pe,pe=pe>>8,V[O++]=pe,pe=pe>>8,V[O++]=pe;let de=Number(U>>BigInt(32)&BigInt(4294967295));return V[O++]=de,de=de>>8,V[O++]=de,de=de>>8,V[O++]=de,de=de>>8,V[O++]=de,O}function ee(V,U,O,X,ie){be(U,X,ie,V,O,7);let pe=Number(U&BigInt(4294967295));V[O+7]=pe,pe=pe>>8,V[O+6]=pe,pe=pe>>8,V[O+5]=pe,pe=pe>>8,V[O+4]=pe;let de=Number(U>>BigInt(32)&BigInt(4294967295));return V[O+3]=de,de=de>>8,V[O+2]=de,de=de>>8,V[O+1]=de,de=de>>8,V[O]=de,O+8}a.prototype.writeBigUInt64LE=he(function(U,O=0){return K(this,U,O,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=he(function(U,O=0){return ee(this,U,O,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(U,O,X,ie){if(U=+U,O=O>>>0,!ie){const Le=Math.pow(2,8*X-1);C(this,U,O,X,Le-1,-Le)}let pe=0,de=1,Ie=0;for(this[O]=U&255;++pe>0)-Ie&255;return O+X},a.prototype.writeIntBE=function(U,O,X,ie){if(U=+U,O=O>>>0,!ie){const Le=Math.pow(2,8*X-1);C(this,U,O,X,Le-1,-Le)}let pe=X-1,de=1,Ie=0;for(this[O+pe]=U&255;--pe>=0&&(de*=256);)U<0&&Ie===0&&this[O+pe+1]!==0&&(Ie=1),this[O+pe]=(U/de>>0)-Ie&255;return O+X},a.prototype.writeInt8=function(U,O,X){return U=+U,O=O>>>0,X||C(this,U,O,1,127,-128),U<0&&(U=255+U+1),this[O]=U&255,O+1},a.prototype.writeInt16LE=function(U,O,X){return U=+U,O=O>>>0,X||C(this,U,O,2,32767,-32768),this[O]=U&255,this[O+1]=U>>>8,O+2},a.prototype.writeInt16BE=function(U,O,X){return U=+U,O=O>>>0,X||C(this,U,O,2,32767,-32768),this[O]=U>>>8,this[O+1]=U&255,O+2},a.prototype.writeInt32LE=function(U,O,X){return U=+U,O=O>>>0,X||C(this,U,O,4,2147483647,-2147483648),this[O]=U&255,this[O+1]=U>>>8,this[O+2]=U>>>16,this[O+3]=U>>>24,O+4},a.prototype.writeInt32BE=function(U,O,X){return U=+U,O=O>>>0,X||C(this,U,O,4,2147483647,-2147483648),U<0&&(U=4294967295+U+1),this[O]=U>>>24,this[O+1]=U>>>16,this[O+2]=U>>>8,this[O+3]=U&255,O+4},a.prototype.writeBigInt64LE=he(function(U,O=0){return K(this,U,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=he(function(U,O=0){return ee(this,U,O,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(V,U,O,X,ie,pe){if(O+X>V.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("Index out of range")}function re(V,U,O,X,ie){return U=+U,O=O>>>0,ie||F(V,U,O,4),t.write(V,U,O,X,23,4),O+4}a.prototype.writeFloatLE=function(U,O,X){return re(this,U,O,!0,X)},a.prototype.writeFloatBE=function(U,O,X){return re(this,U,O,!1,X)};function ce(V,U,O,X,ie){return U=+U,O=O>>>0,ie||F(V,U,O,8),t.write(V,U,O,X,52,8),O+8}a.prototype.writeDoubleLE=function(U,O,X){return ce(this,U,O,!0,X)},a.prototype.writeDoubleBE=function(U,O,X){return ce(this,U,O,!1,X)},a.prototype.copy=function(U,O,X,ie){if(!a.isBuffer(U))throw new TypeError("argument should be a Buffer");if(X||(X=0),!ie&&ie!==0&&(ie=this.length),O>=U.length&&(O=U.length),O||(O=0),ie>0&&ie=this.length)throw new RangeError("Index out of range");if(ie<0)throw new RangeError("sourceEnd out of bounds");ie>this.length&&(ie=this.length),U.length-O>>0,X=X===void 0?this.length:X>>>0,U||(U=0);let pe;if(typeof U=="number")for(pe=O;pe2**32?ie=me(String(O)):typeof O=="bigint"&&(ie=String(O),(O>BigInt(2)**BigInt(32)||O<-(BigInt(2)**BigInt(32)))&&(ie=me(ie)),ie+="n"),X+=` It must be ${U}. Received ${ie}`,X},RangeError);function me(V){let U="",O=V.length;const X=V[0]==="-"?1:0;for(;O>=X+4;O-=3)U=`_${V.slice(O-3,O)}${U}`;return`${V.slice(0,O)}${U}`}function ve(V,U,O){ne(U,"offset"),(V[U]===void 0||V[U+O]===void 0)&&k(U,V.length-(O+1))}function be(V,U,O,X,ie,pe){if(V>O||V3?U===0||U===BigInt(0)?Ie=`>= 0${de} and < 2${de} ** ${(pe+1)*8}${de}`:Ie=`>= -(2${de} ** ${(pe+1)*8-1}${de}) and < 2 ** ${(pe+1)*8-1}${de}`:Ie=`>= ${U}${de} and <= ${O}${de}`,new oe.ERR_OUT_OF_RANGE("value",Ie,V)}ve(X,ie,pe)}function ne(V,U){if(typeof V!="number")throw new oe.ERR_INVALID_ARG_TYPE(U,"number",V)}function k(V,U,O){throw Math.floor(V)!==V?(ne(V,O),new oe.ERR_OUT_OF_RANGE(O||"offset","an integer",V)):U<0?new oe.ERR_BUFFER_OUT_OF_BOUNDS:new oe.ERR_OUT_OF_RANGE(O||"offset",`>= ${O?1:0} and <= ${U}`,V)}const ae=/[^+/0-9A-Za-z-_]/g;function le(V){if(V=V.split("=")[0],V=V.trim().replace(ae,""),V.length<2)return"";for(;V.length%4!==0;)V=V+"=";return V}function Z(V,U){U=U||1/0;let O;const X=V.length;let ie=null;const pe=[];for(let de=0;de55295&&O<57344){if(!ie){if(O>56319){(U-=3)>-1&&pe.push(239,191,189);continue}else if(de+1===X){(U-=3)>-1&&pe.push(239,191,189);continue}ie=O;continue}if(O<56320){(U-=3)>-1&&pe.push(239,191,189),ie=O;continue}O=(ie-55296<<10|O-56320)+65536}else ie&&(U-=3)>-1&&pe.push(239,191,189);if(ie=null,O<128){if((U-=1)<0)break;pe.push(O)}else if(O<2048){if((U-=2)<0)break;pe.push(O>>6|192,O&63|128)}else if(O<65536){if((U-=3)<0)break;pe.push(O>>12|224,O>>6&63|128,O&63|128)}else if(O<1114112){if((U-=4)<0)break;pe.push(O>>18|240,O>>12&63|128,O>>6&63|128,O&63|128)}else throw new Error("Invalid code point")}return pe}function J(V){const U=[];for(let O=0;O>8,ie=O%256,pe.push(ie),pe.push(X);return pe}function Y(V){return e.toByteArray(le(V))}function G(V,U,O,X){let ie;for(ie=0;ie=U.length||ie>=V.length);++ie)U[ie+O]=V[ie];return ie}function j(V,U){return V instanceof U||V!=null&&V.constructor!=null&&V.constructor.name!=null&&V.constructor.name===U.name}function se(V){return V!==V}const fe=function(){const V="0123456789abcdef",U=new Array(256);for(let O=0;O<16;++O){const X=O*16;for(let ie=0;ie<16;++ie)U[X+ie]=V[O]+V[ie]}return U}();function he(V){return typeof BigInt>"u"?Be:V}function Be(){throw new Error("BigInt not supported")}})(s8);/*! * html2canvas 1.4.1 * Copyright (c) 2022 Niklas von Hertzen * Released under MIT License @@ -3942,14 +3942,14 @@ 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 PC=function(n,e){return PC=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(t[i]=r[i])},PC(n,e)};function oa(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");PC(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function Zs(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})}function ps(n,e){var t={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},r,i,s,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(c){return function(A){return l([c,A])}}function l(c){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(s=c[0]&2?i.return:c[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,c[1])).done)return s;switch(i=0,s&&(c=[c[0]&2,s.value]),c[0]){case 0:case 1:s=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,i=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},PD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ble=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Vv=0;Vv"u"?[]:new Uint8Array(256);for(var jv=0;jv>4,A[i++]=(o&15)<<4|a>>2,A[i++]=(a&3)<<6|l&63;return c},Ble=function(n){for(var e=n.length,t=[],r=0;r>yu,Cle=1<>yu,Ile=s8+Tle,Rle=Ile,Ule=32,Fle=Rle+Ule,Ple=65536>>YR,Lle=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>yu],t=(t<>yu)],t=(t<>YR),t=this.index[t],t+=e>>yu&Dle,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var Wv=0;WvOD?(i.push(!0),a-=OD):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(o),t.push(NC);if(a===Gle||a===LC){if(o===0)return r.push(o),t.push(su);var l=t[o-1];return Zle.indexOf(l)===-1?(r.push(r[o-1]),t.push(l)):(r.push(o),t.push(su))}if(r.push(o),a===Xle)return t.push(e==="strict"?OC:Wg);if(a===c8||a===Kle)return t.push(su);if(a===Yle)return s>=131072&&s<=196605||s>=196608&&s<=262141?t.push(Wg):t.push(su);t.push(a)}),[r,t,i]},cB=function(n,e,t,r){var i=r[t];if(Array.isArray(n)?n.indexOf(i)!==-1:n===i)for(var s=t;s<=r.length;){s++;var o=r[s];if(o===e)return!0;if(o!==Xc)break}if(i===Xc)for(var s=t;s>0;){s--;var a=r[s];if(Array.isArray(n)?n.indexOf(a)!==-1:n===a)for(var l=t;l<=r.length;){l++;var o=r[l];if(o===e)return!0;if(o!==Xc)break}if(a!==Xc)break}return!1},jD=function(n,e){for(var t=n;t>=0;){var r=e[t];if(r===Xc)t--;else return r}return 0},ece=function(n,e,t,r,i){if(t[r]===0)return Dt;var s=r-1;if(Array.isArray(i)&&i[s]===!0)return Dt;var o=s-1,a=s+1,l=e[s],c=o>=0?e[o]:0,A=e[a];if(l===o8&&A===a8)return Dt;if(VC.indexOf(l)!==-1)return A8;if(VC.indexOf(A)!==-1||u8.indexOf(A)!==-1)return Dt;if(jD(s,e)===l8)return $v;if(GC.get(n[s])===LC||(l===Xv||l===Yv)&&GC.get(n[a])===LC||l===kD||A===kD||l===HD||[Xc,DC,bm].indexOf(l)===-1&&A===HD||[Kv,kp,Wle,xf,bf].indexOf(A)!==-1||jD(s,e)===Hp||cB(aB,Hp,s,e)||cB([Kv,kp],OC,s,e)||cB(QD,QD,s,e))return Dt;if(l===Xc)return $v;if(l===aB||A===aB)return Dt;if(A===NC||l===NC)return $v;if([DC,bm,OC].indexOf(A)!==-1||l===jle||c===QC&&qle.indexOf(l)!==-1||l===bf&&A===QC||A===zD||dl.indexOf(A)!==-1&&l===ms||dl.indexOf(l)!==-1&&A===ms||l===Bm&&[Wg,Xv,Yv].indexOf(A)!==-1||[Wg,Xv,Yv].indexOf(l)!==-1&&A===Em||dl.indexOf(l)!==-1&&GD.indexOf(A)!==-1||GD.indexOf(l)!==-1&&dl.indexOf(A)!==-1||[Bm,Em].indexOf(l)!==-1&&(A===ms||[Hp,bm].indexOf(A)!==-1&&e[a+1]===ms)||[Hp,bm].indexOf(l)!==-1&&A===ms||l===ms&&[ms,bf,xf].indexOf(A)!==-1)return Dt;if([ms,bf,xf,Kv,kp].indexOf(A)!==-1)for(var u=s;u>=0;){var f=e[u];if(f===ms)return Dt;if([bf,xf].indexOf(f)!==-1)u--;else break}if([Bm,Em].indexOf(A)!==-1)for(var u=[Kv,kp].indexOf(l)!==-1?o:s;u>=0;){var f=e[u];if(f===ms)return Dt;if([bf,xf].indexOf(f)!==-1)u--;else break}if(zC===l&&[zC,Bw,kC,HC].indexOf(A)!==-1||[Bw,kC].indexOf(l)!==-1&&[Bw,Sw].indexOf(A)!==-1||[Sw,HC].indexOf(l)!==-1&&A===Sw||VD.indexOf(l)!==-1&&[zD,Em].indexOf(A)!==-1||VD.indexOf(A)!==-1&&l===Bm||dl.indexOf(l)!==-1&&dl.indexOf(A)!==-1||l===xf&&dl.indexOf(A)!==-1||dl.concat(ms).indexOf(l)!==-1&&A===Hp&&$le.indexOf(n[a])===-1||dl.concat(ms).indexOf(A)!==-1&&l===kp)return Dt;if(l===lB&&A===lB){for(var h=t[s],d=1;h>0&&(h--,e[h]===lB);)d++;if(d%2!==0)return Dt}return l===Xv&&A===Yv?Dt:$v},tce=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=Jle(n,e.lineBreak),r=t[0],i=t[1],s=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(a){return[ms,su,c8].indexOf(a)!==-1?Wg:a}));var o=e.wordBreak==="keep-all"?s.map(function(a,l){return a&&n[l]>=19968&&n[l]<=40959}):void 0;return[r,i,o]},nce=function(){function n(e,t,r,i){this.codePoints=e,this.required=t===A8,this.start=r,this.end=i}return n.prototype.slice=function(){return cr.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),rce=function(n,e){var t=d1(n),r=tce(t,e),i=r[0],s=r[1],o=r[2],a=t.length,l=0,c=0;return{next:function(){if(c>=a)return{done:!0,value:null};for(var A=Dt;c=f8&&n<=57},Nce=function(n){return n>=55296&&n<=57343},Ef=function(n){return mi(n)||n>=p8&&n<=g8||n>=h8&&n<=Uce},Oce=function(n){return n>=h8&&n<=Pce},kce=function(n){return n>=p8&&n<=Dce},Hce=function(n){return Oce(n)||kce(n)},Qce=function(n){return n>=xce},ty=function(n){return n===O_||n===oce||n===ace},k_=function(n){return Hce(n)||Qce(n)||n===uce},$D=function(n){return k_(n)||mi(n)||n===ji},zce=function(n){return n>=Sce&&n<=Mce||n===Cce||n>=Tce&&n<=Ice||n===Rce},Lc=function(n,e){return n!==tg?!1:e!==O_},ny=function(n,e,t){return n===ji?k_(e)||Lc(e,t):k_(n)?!0:!!(n===tg&&Lc(n,e))},uB=function(n,e,t){return n===Au||n===ji?mi(e)?!0:e===Kg&&mi(t):mi(n===Kg?e:n)},Gce=function(n){var e=0,t=1;(n[e]===Au||n[e]===ji)&&(n[e]===ji&&(t=-1),e++);for(var r=[];mi(n[e]);)r.push(n[e++]);var i=r.length?parseInt(cr.apply(void 0,r),10):0;n[e]===Kg&&e++;for(var s=[];mi(n[e]);)s.push(n[e++]);var o=s.length,a=o?parseInt(cr.apply(void 0,s),10):0;(n[e]===m8||n[e]===d8)&&e++;var l=1;(n[e]===Au||n[e]===ji)&&(n[e]===ji&&(l=-1),e++);for(var c=[];mi(n[e]);)c.push(n[e++]);var A=c.length?parseInt(cr.apply(void 0,c),10):0;return t*(i+a*Math.pow(10,-o))*Math.pow(10,l*A)},Vce={type:2},jce={type:3},Wce={type:4},Kce={type:13},Xce={type:8},Yce={type:21},$ce={type:9},Zce={type:10},qce={type:11},Jce={type:12},eAe={type:14},ry={type:23},tAe={type:1},nAe={type:25},rAe={type:24},iAe={type:26},sAe={type:27},oAe={type:28},aAe={type:29},lAe={type:31},jC={type:32},v8=function(){function n(){this._value=[]}return n.prototype.write=function(e){this._value=this._value.concat(d1(e))},n.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==jC;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Zv:return this.consumeStringToken(Zv);case lce:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),i=this.peekCodePoint(2);if($D(t)||Lc(r,i)){var s=ny(t,r,i)?sce:ice,o=this.consumeName();return{type:5,value:o,flags:s}}break;case cce:if(this.peekCodePoint(0)===Qp)return this.consumeCodePoint(),Kce;break;case qv:return this.consumeStringToken(qv);case Jv:return Vce;case zp:return jce;case AB:if(this.peekCodePoint(0)===Qp)return this.consumeCodePoint(),eAe;break;case Au:if(uB(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case bce:return Wce;case ji:var a=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(uB(a,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(ny(a,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===ji&&c===dce)return this.consumeCodePoint(),this.consumeCodePoint(),rAe;break;case Kg:if(uB(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case KD:if(this.peekCodePoint(0)===AB)for(this.consumeCodePoint();;){var A=this.consumeCodePoint();if(A===AB&&(A=this.consumeCodePoint(),A===KD))return this.consumeToken();if(A===ha)return this.consumeToken()}break;case Ece:return iAe;case Bce:return sAe;case hce:if(this.peekCodePoint(0)===fce&&this.peekCodePoint(1)===ji&&this.peekCodePoint(2)===ji)return this.consumeCodePoint(),this.consumeCodePoint(),nAe;break;case pce:var u=this.peekCodePoint(0),f=this.peekCodePoint(1),h=this.peekCodePoint(2);if(ny(u,f,h)){var o=this.consumeName();return{type:7,value:o}}break;case mce:return oAe;case tg:if(Lc(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case gce:return aAe;case vce:if(this.peekCodePoint(0)===Qp)return this.consumeCodePoint(),Xce;break;case yce:return qce;case wce:return Jce;case Fce:case Lce:var d=this.peekCodePoint(0),m=this.peekCodePoint(1);return d===Au&&(Ef(m)||m===ey)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case XD:if(this.peekCodePoint(0)===Qp)return this.consumeCodePoint(),$ce;if(this.peekCodePoint(0)===XD)return this.consumeCodePoint(),Yce;break;case _ce:if(this.peekCodePoint(0)===Qp)return this.consumeCodePoint(),Zce;break;case ha:return jC}return ty(e)?(this.consumeWhiteSpace(),lAe):mi(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):k_(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:cr(e)}},n.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},n.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},n.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},n.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Ef(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===ey&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var i=parseInt(cr.apply(void 0,e.map(function(l){return l===ey?f8:l})),16),s=parseInt(cr.apply(void 0,e.map(function(l){return l===ey?g8:l})),16);return{type:30,start:i,end:s}}var o=parseInt(cr.apply(void 0,e),16);if(this.peekCodePoint(0)===ji&&Ef(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];Ef(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var s=parseInt(cr.apply(void 0,a),16);return{type:30,start:o,end:s}}else return{type:30,start:o,end:o}},n.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===Jv?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===Jv?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===ha)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===qv||t===Zv){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===ha||this.peekCodePoint(0)===zp)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),ry)}for(;;){var i=this.consumeCodePoint();if(i===ha||i===zp)return{type:22,value:cr.apply(void 0,e)};if(ty(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===ha||this.peekCodePoint(0)===zp?(this.consumeCodePoint(),{type:22,value:cr.apply(void 0,e)}):(this.consumeBadUrlRemnants(),ry);if(i===Zv||i===qv||i===Jv||zce(i))return this.consumeBadUrlRemnants(),ry;if(i===tg)if(Lc(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),ry;else e.push(i)}},n.prototype.consumeWhiteSpace=function(){for(;ty(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===zp||e===ha)return;Lc(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},n.prototype.consumeStringSlice=function(e){for(var t=5e4,r="";e>0;){var i=Math.min(t,e);r+=cr.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),r},n.prototype.consumeStringToken=function(e){var t="",r=0;do{var i=this._value[r];if(i===ha||i===void 0||i===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(i===O_)return this._value.splice(0,r),tAe;if(i===tg){var s=this._value[r+1];s!==ha&&s!==void 0&&(s===O_?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):Lc(i,s)&&(t+=this.consumeStringSlice(r),t+=cr(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=w0,r=this.peekCodePoint(0);for((r===Au||r===ji)&&e.push(this.consumeCodePoint());mi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(r===Kg&&mi(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=WD;mi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),i=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===m8||r===d8)&&((i===Au||i===ji)&&mi(s)||mi(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=WD;mi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Gce(e),t]},n.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],r=e[1],i=this.peekCodePoint(0),s=this.peekCodePoint(1),o=this.peekCodePoint(2);if(ny(i,s,o)){var a=this.consumeName();return{type:15,number:t,flags:r,unit:a}}return i===Ace?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Ef(e)){for(var t=cr(e);Ef(this.peekCodePoint(0))&&t.length<6;)t+=cr(this.consumeCodePoint());ty(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||Nce(r)||r>1114111?YD:r}return e===ha?YD:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if($D(t))e+=cr(t);else if(Lc(t,this.peekCodePoint(0)))e+=cr(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),y8=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new v8;return t.write(e),new n(t.read())},n.parseValue=function(e){return n.create(e).parseComponentValue()},n.parseValues=function(e){return n.create(e).parseComponentValues()},n.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},n.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},n.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},n.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},r=this.consumeToken();;){if(r.type===32||cAe(r,e))return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue()),r=this.consumeToken()}},n.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var r=this.consumeToken();if(r.type===32||r.type===3)return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue())}},n.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?jC:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),_0=function(n){return n.type===15},p1=function(n){return n.type===17},ir=function(n){return n.type===20},WC=function(n,e){return ir(n)&&n.value===e},m1=function(n){return n.type!==31&&n.type!==4},il=function(n){var e=[],t=[];return n.forEach(function(r){if(r.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}r.type!==31&&t.push(r)}),t.length&&e.push(t),e},cAe=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},vA=function(n){return n.type===17||n.type===15},br=function(n){return n.type===16||vA(n)},w8=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},ri={type:17,number:0,flags:w0},$R={type:16,number:50,flags:w0},Yc={type:16,number:100,flags:w0},Sm=function(n,e,t){var r=n[0],i=n[1];return[bn(r,e),bn(typeof i<"u"?i:r,t)]},bn=function(n,e){if(n.type===16)return n.number/100*e;if(_0(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},_8="deg",x8="grad",b8="rad",E8="turn",g1={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case _8:return Math.PI*e.number/180;case x8:return Math.PI/200*e.number;case b8:return e.number;case E8:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},B8=function(n){return n.type===15&&(n.unit===_8||n.unit===x8||n.unit===b8||n.unit===E8)},S8=function(n){var e=n.filter(ir).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ri,ri];case"to top":case"bottom":return Ao(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ri,Yc];case"to right":case"left":return Ao(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Yc,Yc];case"to bottom":case"top":return Ao(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Yc,ri];case"to left":case"right":return Ao(270)}return 0},Ao=function(n){return Math.PI*n/180},AA={name:"color",parse:function(n,e){if(e.type===18){var t=AAe[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(n,e.values)}if(e.type===5){if(e.value.length===3){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3);return $c(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),1)}if(e.value.length===4){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3),o=e.value.substring(3,4);return $c(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),parseInt(o+o,16)/255)}if(e.value.length===6){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6);return $c(parseInt(r,16),parseInt(i,16),parseInt(s,16),1)}if(e.value.length===8){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6),o=e.value.substring(6,8);return $c(parseInt(r,16),parseInt(i,16),parseInt(s,16),parseInt(o,16)/255)}}if(e.type===20){var a=Xg[e.value.toUpperCase()];if(typeof a<"u")return a}return Xg.TRANSPARENT}},od=function(n){return(255&n)===0},kr=function(n){var e=255&n,t=255&n>>8,r=255&n>>16,i=255&n>>24;return e<255?"rgba("+i+","+r+","+t+","+e/255+")":"rgb("+i+","+r+","+t+")"},$c=function(n,e,t,r){return(n<<24|e<<16|t<<8|Math.round(r*255)<<0)>>>0},ZD=function(n,e){if(n.type===17)return n.number;if(n.type===16){var t=e===3?1:255;return e===3?n.number/100*t:Math.round(n.number/100*t)}return 0},qD=function(n,e){var t=e.filter(m1);if(t.length===3){var r=t.map(ZD),i=r[0],s=r[1],o=r[2];return $c(i,s,o,1)}if(t.length===4){var a=t.map(ZD),i=a[0],s=a[1],o=a[2],l=a[3];return $c(i,s,o,l)}return 0};function fB(n,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-n)*t*6+n:t<1/2?e:t<2/3?(e-n)*6*(2/3-t)+n:n}var JD=function(n,e){var t=e.filter(m1),r=t[0],i=t[1],s=t[2],o=t[3],a=(r.type===17?Ao(r.number):g1.parse(n,r))/(Math.PI*2),l=br(i)?i.number/100:0,c=br(s)?s.number/100:0,A=typeof o<"u"&&br(o)?bn(o,1):1;if(l===0)return $c(c*255,c*255,c*255,1);var u=c<=.5?c*(l+1):c+l-c*l,f=c*2-u,h=fB(f,u,a+1/3),d=fB(f,u,a),m=fB(f,u,a-1/3);return $c(h*255,d*255,m*255,A)},AAe={hsl:JD,hsla:JD,rgb:qD,rgba:qD},eN=function(n,e){return AA.parse(n,y8.create(e).parseComponentValue())},Xg={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},uAe={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(ir(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},fAe={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},v1=function(n,e){var t=AA.parse(n,e[0]),r=e[1];return r&&br(r)?{color:t,stop:r}:{color:t,stop:null}},tN=function(n,e){var t=n[0],r=n[n.length-1];t.stop===null&&(t.stop=ri),r.stop===null&&(r.stop=Yc);for(var i=[],s=0,o=0;os?i.push(l):i.push(s),s=l}else i.push(null)}for(var c=null,o=0;oo.optimumDistance)?{optimumCorner:a,optimumDistance:A}:o},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},pAe=function(n,e,t,r,i){var s=0,o=0;switch(n.size){case 0:n.shape===0?s=o=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.min(Math.abs(e),Math.abs(e-r)),o=Math.min(Math.abs(t),Math.abs(t-i)));break;case 2:if(n.shape===0)s=o=Math.min(ko(e,t),ko(e,t-i),ko(e-r,t),ko(e-r,t-i));else if(n.shape===1){var a=Math.min(Math.abs(t),Math.abs(t-i))/Math.min(Math.abs(e),Math.abs(e-r)),l=nN(r,i,e,t,!0),c=l[0],A=l[1];s=ko(c-e,(A-t)/a),o=a*s}break;case 1:n.shape===0?s=o=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.max(Math.abs(e),Math.abs(e-r)),o=Math.max(Math.abs(t),Math.abs(t-i)));break;case 3:if(n.shape===0)s=o=Math.max(ko(e,t),ko(e,t-i),ko(e-r,t),ko(e-r,t-i));else if(n.shape===1){var a=Math.max(Math.abs(t),Math.abs(t-i))/Math.max(Math.abs(e),Math.abs(e-r)),u=nN(r,i,e,t,!1),c=u[0],A=u[1];s=ko(c-e,(A-t)/a),o=a*s}break}return Array.isArray(n.size)&&(s=bn(n.size[0],r),o=n.size.length===2?bn(n.size[1],i):s),[s,o]},mAe=function(n,e){var t=Ao(180),r=[];return il(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&o.value==="to"){t=S8(i);return}else if(B8(o)){t=g1.parse(n,o);return}}var a=v1(n,i);r.push(a)}),{angle:t,stops:r,type:1}},iy=function(n,e){var t=Ao(180),r=[];return il(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&["top","left","right","bottom"].indexOf(o.value)!==-1){t=S8(i);return}else if(B8(o)){t=(g1.parse(n,o)+Ao(270))%Ao(360);return}}var a=v1(n,i);r.push(a)}),{angle:t,stops:r,type:1}},gAe=function(n,e){var t=Ao(180),r=[],i=1,s=0,o=3,a=[];return il(e).forEach(function(l,c){var A=l[0];if(c===0){if(ir(A)&&A.value==="linear"){i=1;return}else if(ir(A)&&A.value==="radial"){i=2;return}}if(A.type===18){if(A.name==="from"){var u=AA.parse(n,A.values[0]);r.push({stop:ri,color:u})}else if(A.name==="to"){var u=AA.parse(n,A.values[0]);r.push({stop:Yc,color:u})}else if(A.name==="color-stop"){var f=A.values.filter(m1);if(f.length===2){var u=AA.parse(n,f[1]),h=f[0];p1(h)&&r.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(t+Ao(180))%Ao(360),stops:r,type:i}:{size:o,shape:s,stops:r,position:a,type:i}},M8="closest-side",C8="farthest-side",T8="closest-corner",I8="farthest-corner",R8="circle",U8="ellipse",F8="cover",P8="contain",vAe=function(n,e){var t=0,r=3,i=[],s=[];return il(e).forEach(function(o,a){var l=!0;if(a===0){var c=!1;l=o.reduce(function(u,f){if(c)if(ir(f))switch(f.value){case"center":return s.push($R),u;case"top":case"left":return s.push(ri),u;case"right":case"bottom":return s.push(Yc),u}else(br(f)||vA(f))&&s.push(f);else if(ir(f))switch(f.value){case R8:return t=0,!1;case U8:return t=1,!1;case"at":return c=!0,!1;case M8:return r=0,!1;case F8:case C8:return r=1,!1;case P8:case T8:return r=2,!1;case I8:return r=3,!1}else if(vA(f)||br(f))return Array.isArray(r)||(r=[]),r.push(f),!1;return u},l)}if(l){var A=v1(n,o);i.push(A)}}),{size:r,shape:t,stops:i,position:s,type:2}},sy=function(n,e){var t=0,r=3,i=[],s=[];return il(e).forEach(function(o,a){var l=!0;if(a===0?l=o.reduce(function(A,u){if(ir(u))switch(u.value){case"center":return s.push($R),!1;case"top":case"left":return s.push(ri),!1;case"right":case"bottom":return s.push(Yc),!1}else if(br(u)||vA(u))return s.push(u),!1;return A},l):a===1&&(l=o.reduce(function(A,u){if(ir(u))switch(u.value){case R8:return t=0,!1;case U8:return t=1,!1;case P8:case M8:return r=0,!1;case C8:return r=1,!1;case T8:return r=2,!1;case F8:case I8:return r=3,!1}else if(vA(u)||br(u))return Array.isArray(r)||(r=[]),r.push(u),!1;return A},l)),l){var c=v1(n,o);i.push(c)}}),{size:r,shape:t,stops:i,position:s,type:2}},yAe=function(n){return n.type===1},wAe=function(n){return n.type===2},ZR={name:"image",parse:function(n,e){if(e.type===22){var t={url:e.value,type:0};return n.cache.addImage(e.value),t}if(e.type===18){var r=L8[e.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return r(n,e.values)}throw new Error("Unsupported image type "+e.type)}};function _Ae(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!L8[n.name])}var L8={"linear-gradient":mAe,"-moz-linear-gradient":iy,"-ms-linear-gradient":iy,"-o-linear-gradient":iy,"-webkit-linear-gradient":iy,"radial-gradient":vAe,"-moz-radial-gradient":sy,"-ms-radial-gradient":sy,"-o-radial-gradient":sy,"-webkit-radial-gradient":sy,"-webkit-gradient":gAe},xAe={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(n,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(r){return m1(r)&&_Ae(r)}).map(function(r){return ZR.parse(n,r)})}},bAe={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(ir(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},EAe={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return il(e).map(function(t){return t.filter(br)}).map(w8)}},BAe={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return il(e).map(function(t){return t.filter(ir).map(function(r){return r.value}).join(" ")}).map(SAe)}},SAe=function(n){switch(n){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},ad;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(ad||(ad={}));var MAe={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return il(e).map(function(t){return t.filter(CAe)})}},CAe=function(n){return ir(n)||br(n)},y1=function(n){return{name:"border-"+n+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},TAe=y1("top"),IAe=y1("right"),RAe=y1("bottom"),UAe=y1("left"),w1=function(n){return{name:"border-radius-"+n,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return w8(t.filter(br))}}},FAe=w1("top-left"),PAe=w1("top-right"),LAe=w1("bottom-right"),DAe=w1("bottom-left"),_1=function(n){return{name:"border-"+n+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},NAe=_1("top"),OAe=_1("right"),kAe=_1("bottom"),HAe=_1("left"),x1=function(n){return{name:"border-"+n+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return _0(t)?t.number:0}}},QAe=x1("top"),zAe=x1("right"),GAe=x1("bottom"),VAe=x1("left"),jAe={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},WAe={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},KAe={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(ir).reduce(function(t,r){return t|XAe(r.value)},0)}},XAe=function(n){switch(n){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},YAe={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},$Ae={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(n,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},H_;(function(n){n.NORMAL="normal",n.STRICT="strict"})(H_||(H_={}));var ZAe={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return H_.STRICT;case"normal":default:return H_.NORMAL}}},qAe={name:"line-height",initialValue:"normal",prefix:!1,type:4},rN=function(n,e){return ir(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:br(n)?bn(n,e):e},JAe={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:ZR.parse(n,e)}},eue={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(n,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},tue={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},b1=function(n){return{name:"margin-"+n,initialValue:"0",prefix:!1,type:4}},nue=b1("top"),rue=b1("right"),iue=b1("bottom"),sue=b1("left"),oue={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(ir).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},aue={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},E1=function(n){return{name:"padding-"+n,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},lue=E1("top"),cue=E1("right"),Aue=E1("bottom"),uue=E1("left"),fue={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(n,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},hue={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(n,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},due={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&WC(e[0],"none")?[]:il(e).map(function(t){for(var r={color:Xg.TRANSPARENT,offsetX:ri,offsetY:ri,blur:ri},i=0,s=0;s"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},gue=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},vue=function(n){var e=n.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],r=e[1];e[2],e[3];var i=e[4],s=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var o=e[12],a=e[13];return e[14],e[15],e.length===16?[t,r,i,s,o,a]:null},yue={matrix:gue,matrix3d:vue},iN={type:16,number:50,flags:w0},wue=[iN,iN],_ue={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(br);return t.length!==2?wue:[t[0],t[1]]}},xue={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},ng;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(ng||(ng={}));var bue={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return ng.BREAK_ALL;case"keep-all":return ng.KEEP_ALL;case"normal":default:return ng.NORMAL}}},Eue={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if(p1(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},D8={name:"time",parse:function(n,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},Bue={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return p1(e)?e.number:1}},Sue={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Mue={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(ir).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},Cue={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(n,e){var t=[],r=[];return e.forEach(function(i){switch(i.type){case 20:case 0:t.push(i.value);break;case 17:t.push(i.number.toString());break;case 4:r.push(t.join(" ")),t.length=0;break}}),t.length&&r.push(t.join(" ")),r.map(function(i){return i.indexOf(" ")===-1?i:"'"+i+"'"})}},Tue={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Iue={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if(p1(e))return e.number;if(ir(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},Rue={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(ir).map(function(t){return t.value})}},Uue={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Fr=function(n,e){return(n&e)!==0},Fue={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(_0).map(function(t){return D8.parse(n,t)})}},Pue={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&WC(e[0],"none")?[]:il(e).map(function(t){for(var r={color:255,offsetX:ri,offsetY:ri,blur:ri,spread:ri,inset:!1},i=0,s=0;s1?1:0],this.overflowWrap=Je(e,aue,t.overflowWrap),this.paddingTop=Je(e,lue,t.paddingTop),this.paddingRight=Je(e,cue,t.paddingRight),this.paddingBottom=Je(e,Aue,t.paddingBottom),this.paddingLeft=Je(e,uue,t.paddingLeft),this.paintOrder=Je(e,Lue,t.paintOrder),this.position=Je(e,hue,t.position),this.textAlign=Je(e,fue,t.textAlign),this.textDecorationColor=Je(e,Sue,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=Je(e,Mue,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=Je(e,due,t.textShadow),this.textTransform=Je(e,pue,t.textTransform),this.transform=Je(e,mue,t.transform),this.transformOrigin=Je(e,_ue,t.transformOrigin),this.visibility=Je(e,xue,t.visibility),this.webkitTextStrokeColor=Je(e,Due,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Je(e,Nue,t.webkitTextStrokeWidth),this.wordBreak=Je(e,bue,t.wordBreak),this.zIndex=Je(e,Eue,t.zIndex)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return od(this.backgroundColor)},n.prototype.isTransformed=function(){return this.transform!==null},n.prototype.isPositioned=function(){return this.position!==0},n.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},n.prototype.isFloating=function(){return this.float!==0},n.prototype.isInlineLevel=function(){return Fr(this.display,4)||Fr(this.display,33554432)||Fr(this.display,268435456)||Fr(this.display,536870912)||Fr(this.display,67108864)||Fr(this.display,134217728)},n}(),Je=function(n,e,t){var r=new v8,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(i);var s=new y8(r.read());switch(e.type){case 2:var o=s.parseComponentValue();return e.parse(n,ir(o)?o.value:e.initialValue);case 0:return e.parse(n,s.parseComponentValue());case 1:return e.parse(n,s.parseComponentValues());case 4:return s.parseComponentValue();case 3:switch(e.format){case"angle":return g1.parse(n,s.parseComponentValue());case"color":return AA.parse(n,s.parseComponentValue());case"image":return ZR.parse(n,s.parseComponentValue());case"length":var a=s.parseComponentValue();return vA(a)?a:ri;case"length-percentage":var l=s.parseComponentValue();return br(l)?l:ri;case"time":return D8.parse(n,s.parseComponentValue())}break}},kue="data-html2canvas-debug",Hue=function(n){var e=n.getAttribute(kue);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},sN=function(n,e){var t=Hue(n);return t===1||e===t},sl=function(){function n(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,sN(t,3))debugger;this.styles=new Oue(e,window.getComputedStyle(t,null)),Hfe(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=XR(this.context,t),sN(t,4)&&(this.flags|=16)}return n}(),Que="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",oN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Mm=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var oy=0;oy>4,A[i++]=(o&15)<<4|a>>2,A[i++]=(a&3)<<6|l&63;return c},Gue=function(n){for(var e=n.length,t=[],r=0;r>wu,Wue=1<>wu,Xue=N8+Kue,Yue=Xue,$ue=32,Zue=Yue+$ue,que=65536>>qR,Jue=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>wu],t=(t<>wu)],t=(t<>qR),t=this.index[t],t+=e>>wu&efe,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var ay=0;ay=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},cfe=nfe(Que),to="×",wB="÷",Afe=function(n){return cfe.get(n)},ufe=function(n,e,t){var r=t-2,i=e[r],s=e[t-1],o=e[t];if(s===pB&&o===mB)return to;if(s===pB||s===mB||s===cN||o===pB||o===mB||o===cN)return wB;if(s===uN&&[uN,gB,fN,hN].indexOf(o)!==-1||(s===fN||s===gB)&&(o===gB||o===vB)||(s===hN||s===vB)&&o===vB||o===dN||o===AN||o===ofe||s===sfe)return to;if(s===dN&&o===pN){for(;i===AN;)i=e[--r];if(i===pN)return to}if(s===yB&&o===yB){for(var a=0;i===yB;)a++,i=e[--r];if(a%2===0)return to}return wB},ffe=function(n){var e=afe(n),t=e.length,r=0,i=0,s=e.map(Afe);return{next:function(){if(r>=t)return{done:!0,value:null};for(var o=to;ro.x||A.y>o.y;return o=A,c===0?!0:u});return n.body.removeChild(e),a},mfe=function(){return typeof new Image().crossOrigin<"u"},gfe=function(){return typeof new XMLHttpRequest().responseType=="string"},vfe=function(n){var e=new Image,t=n.createElement("canvas"),r=t.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,";try{r.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},mN=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},yfe=function(n){var e=n.createElement("canvas"),t=100;e.width=t,e.height=t;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,t,t);var i=new Image,s=e.toDataURL();i.src=s;var o=KC(t,t,0,0,i);return r.fillStyle="red",r.fillRect(0,0,t,t),gN(o).then(function(a){r.drawImage(a,0,0);var l=r.getImageData(0,0,t,t).data;r.fillStyle="red",r.fillRect(0,0,t,t);var c=n.createElement("div");return c.style.backgroundImage="url("+s+")",c.style.height=t+"px",mN(l)?gN(KC(t,t,0,0,c)):Promise.reject(!1)}).then(function(a){return r.drawImage(a,0,0),mN(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},KC=function(n,e,t,r,i){var s="http://www.w3.org/2000/svg",o=document.createElementNS(s,"svg"),a=document.createElementNS(s,"foreignObject");return o.setAttributeNS(null,"width",n.toString()),o.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",t.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),o.appendChild(a),a.appendChild(i),o},gN=function(n){return new Promise(function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(n))})},ys={get SUPPORT_RANGE_BOUNDS(){var n=dfe(document);return Object.defineProperty(ys,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=ys.SUPPORT_RANGE_BOUNDS&&pfe(document);return Object.defineProperty(ys,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=vfe(document);return Object.defineProperty(ys,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?yfe(document):Promise.resolve(!1);return Object.defineProperty(ys,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=mfe();return Object.defineProperty(ys,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=gfe();return Object.defineProperty(ys,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(ys,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(ys,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},rg=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),wfe=function(n,e,t,r){var i=bfe(e,t),s=[],o=0;return i.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(ys.SUPPORT_RANGE_BOUNDS){var l=vN(r,o,a.length).getClientRects();if(l.length>1){var c=JR(a),A=0;c.forEach(function(f){s.push(new rg(f,Pu.fromDOMRectList(n,vN(r,A+o,f.length).getClientRects()))),A+=f.length})}else s.push(new rg(a,Pu.fromDOMRectList(n,l)))}else{var u=r.splitText(a.length);s.push(new rg(a,_fe(n,r))),r=u}else ys.SUPPORT_RANGE_BOUNDS||(r=r.splitText(a.length));o+=a.length}),s},_fe=function(n,e){var t=e.ownerDocument;if(t){var r=t.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(r,e);var s=XR(n,r);return r.firstChild&&i.replaceChild(r.firstChild,r),s}}return Pu.EMPTY},vN=function(n,e,t){var r=n.ownerDocument;if(!r)throw new Error("Node has no owner document");var i=r.createRange();return i.setStart(n,e),i.setEnd(n,e+t),i},JR=function(n){if(ys.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(n)).map(function(t){return t.segment})}return hfe(n)},xfe=function(n,e){if(ys.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(n)).map(function(r){return r.segment})}return Bfe(n,e)},bfe=function(n,e){return e.letterSpacing!==0?JR(n):xfe(n,e)},Efe=[32,160,4961,65792,65793,4153,4241],Bfe=function(n,e){for(var t=rce(n,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),r=[],i,s=function(){if(i.value){var o=i.value.slice(),a=d1(o),l="";a.forEach(function(c){Efe.indexOf(c)===-1?l+=cr(c):(l.length&&r.push(l),r.push(cr(c)),l="")}),l.length&&r.push(l)}};!(i=t.next()).done;)s();return r},Sfe=function(){function n(e,t,r){this.text=Mfe(t.data,r.textTransform),this.textBounds=wfe(e,this.text,r,t)}return n}(),Mfe=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(Cfe,Tfe);case 2:return n.toUpperCase();default:return n}},Cfe=/(^|\s|:|-|\(|\))([a-z])/g,Tfe=function(n,e,t){return n.length>0?e+t.toUpperCase():n},O8=function(n){oa(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.src=r.currentSrc||r.src,i.intrinsicWidth=r.naturalWidth,i.intrinsicHeight=r.naturalHeight,i.context.cache.addImage(i.src),i}return e}(sl),k8=function(n){oa(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.canvas=r,i.intrinsicWidth=r.width,i.intrinsicHeight=r.height,i}return e}(sl),H8=function(n){oa(e,n);function e(t,r){var i=n.call(this,t,r)||this,s=new XMLSerializer,o=XR(t,r);return r.setAttribute("width",o.width+"px"),r.setAttribute("height",o.height+"px"),i.svg="data:image/svg+xml,"+encodeURIComponent(s.serializeToString(r)),i.intrinsicWidth=r.width.baseVal.value,i.intrinsicHeight=r.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e}(sl),Q8=function(n){oa(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.value=r.value,i}return e}(sl),XC=function(n){oa(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.start=r.start,i.reversed=typeof r.reversed=="boolean"&&r.reversed===!0,i}return e}(sl),Ife=[{type:15,flags:0,unit:"px",number:3}],Rfe=[{type:16,flags:0,number:50}],Ufe=function(n){return n.width>n.height?new Pu(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width0)t.textNodes.push(new Sfe(n,i,t.styles));else if(W8(i))if(Yfe(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return Mw(n,a,t,r)});else{var o=j8(n,i);o.styles.isVisible()&&(Nfe(i,o,r)?o.flags|=4:Ofe(o.styles)&&(o.flags|=2),Lfe.indexOf(i.tagName)!==-1&&(o.flags|=8),t.elements.push(o),i.slot,i.shadowRoot?Mw(n,i.shadowRoot,o,r):!X8(i)&&!K8(i)&&!Y8(i)&&Mw(n,i,o,r))}},j8=function(n,e){return Kfe(e)?new O8(n,e):Wfe(e)?new k8(n,e):K8(e)?new H8(n,e):zfe(e)?new Q8(n,e):Gfe(e)?new XC(n,e):Vfe(e)?new e2(n,e):Y8(e)?new z8(n,e):X8(e)?new G8(n,e):Xfe(e)?new V8(n,e):new sl(n,e)},Dfe=function(n,e){var t=j8(n,e);return t.flags|=4,Mw(n,e,t,t),t},Nfe=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||jfe(n)&&t.styles.isTransparent()},Ofe=function(n){return n.isPositioned()||n.isFloating()},kfe=function(n){return n.nodeType===Node.TEXT_NODE},W8=function(n){return n.nodeType===Node.ELEMENT_NODE},Hfe=function(n){return W8(n)&&typeof n.style<"u"&&!Qfe(n)},Qfe=function(n){return typeof n.className=="object"},zfe=function(n){return n.tagName==="LI"},Gfe=function(n){return n.tagName==="OL"},Vfe=function(n){return n.tagName==="INPUT"},K8=function(n){return n.tagName==="svg"},jfe=function(n){return n.tagName==="BODY"},Wfe=function(n){return n.tagName==="CANVAS"},Kfe=function(n){return n.tagName==="IMG"},Xfe=function(n){return n.tagName==="IFRAME"},X8=function(n){return n.tagName==="TEXTAREA"},Y8=function(n){return n.tagName==="SELECT"},Yfe=function(n){return n.tagName==="SLOT"},wN={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},_N={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},$fe={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Zfe={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Bf=function(n,e,t,r,i,s){return nt?t2(n,i,s.length>0):r.integers.reduce(function(o,a,l){for(;n>=a;)n-=a,o+=r.values[l];return o},"")+s},$8=function(n,e,t,r){var i="";do t||n--,i=r(n)+i,n/=e;while(n*e>=e);return i},ar=function(n,e,t,r,i){var s=t-e+1;return(n<0?"-":"")+($8(Math.abs(n),s,r,function(o){return cr(Math.floor(o%s)+e)})+i)},zA=function(n,e,t){t===void 0&&(t=". ");var r=e.length;return $8(Math.abs(n),r,!1,function(i){return e[Math.floor(i%r)]})+t},Gf=1,Rc=2,Uc=4,Cm=8,pl=function(n,e,t,r,i,s){if(n<-9999||n>9999)return t2(n,4,i.length>0);var o=Math.abs(n),a=i;if(o===0)return e[0]+a;for(var l=0;o>0&&l<=4;l++){var c=o%10;c===0&&Fr(s,Gf)&&a!==""?a=e[c]+a:c>1||c===1&&l===0||c===1&&l===1&&Fr(s,Rc)||c===1&&l===1&&Fr(s,Uc)&&n>100||c===1&&l>1&&Fr(s,Cm)?a=e[c]+(l>0?t[l-1]:"")+a:c===1&&l>0&&(a=t[l-1]+a),o=Math.floor(o/10)}return(n<0?r:"")+a},xN="十百千萬",bN="拾佰仟萬",EN="マイナス",_B="마이너스",t2=function(n,e,t){var r=t?". ":"",i=t?"、":"",s=t?", ":"",o=t?" ":"";switch(e){case 0:return"•"+o;case 1:return"◦"+o;case 2:return"◾"+o;case 5:var a=ar(n,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return zA(n,"〇一二三四五六七八九",i);case 6:return Bf(n,1,3999,wN,3,r).toLowerCase();case 7:return Bf(n,1,3999,wN,3,r);case 8:return ar(n,945,969,!1,r);case 9:return ar(n,97,122,!1,r);case 10:return ar(n,65,90,!1,r);case 11:return ar(n,1632,1641,!0,r);case 12:case 49:return Bf(n,1,9999,_N,3,r);case 35:return Bf(n,1,9999,_N,3,r).toLowerCase();case 13:return ar(n,2534,2543,!0,r);case 14:case 30:return ar(n,6112,6121,!0,r);case 15:return zA(n,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return zA(n,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return pl(n,"零一二三四五六七八九",xN,"負",i,Rc|Uc|Cm);case 47:return pl(n,"零壹貳參肆伍陸柒捌玖",bN,"負",i,Gf|Rc|Uc|Cm);case 42:return pl(n,"零一二三四五六七八九",xN,"负",i,Rc|Uc|Cm);case 41:return pl(n,"零壹贰叁肆伍陆柒捌玖",bN,"负",i,Gf|Rc|Uc|Cm);case 26:return pl(n,"〇一二三四五六七八九","十百千万",EN,i,0);case 25:return pl(n,"零壱弐参四伍六七八九","拾百千万",EN,i,Gf|Rc|Uc);case 31:return pl(n,"영일이삼사오육칠팔구","십백천만",_B,s,Gf|Rc|Uc);case 33:return pl(n,"零一二三四五六七八九","十百千萬",_B,s,0);case 32:return pl(n,"零壹貳參四五六七八九","拾百千",_B,s,Gf|Rc|Uc);case 18:return ar(n,2406,2415,!0,r);case 20:return Bf(n,1,19999,Zfe,3,r);case 21:return ar(n,2790,2799,!0,r);case 22:return ar(n,2662,2671,!0,r);case 22:return Bf(n,1,10999,$fe,3,r);case 23:return zA(n,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return zA(n,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return ar(n,3302,3311,!0,r);case 28:return zA(n,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return zA(n,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return ar(n,3792,3801,!0,r);case 37:return ar(n,6160,6169,!0,r);case 38:return ar(n,4160,4169,!0,r);case 39:return ar(n,2918,2927,!0,r);case 40:return ar(n,1776,1785,!0,r);case 43:return ar(n,3046,3055,!0,r);case 44:return ar(n,3174,3183,!0,r);case 45:return ar(n,3664,3673,!0,r);case 46:return ar(n,3872,3881,!0,r);case 3:default:return ar(n,48,57,!0,r)}},BN;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(BN||(BN={}));var qfe=function(){function n(){}return n.getOrigin=function(e){var t=n._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},n.isSameOrigin=function(e){return n.getOrigin(e)===n._origin},n.setContext=function(e){n._link=e.document.createElement("a"),n._origin=n.getOrigin(e.location.href)},n._origin="about:blank",n}(),Xe=function(){function n(e,t){this.type=0,this.x=e,this.y=t}return n.prototype.add=function(e,t){return new n(this.x+e,this.y+t)},n}(),Sf=function(n,e,t){return new Xe(n.x+(e.x-n.x)*t,n.y+(e.y-n.y)*t)},ly=function(){function n(e,t,r,i){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=i}return n.prototype.subdivide=function(e,t){var r=Sf(this.start,this.startControl,e),i=Sf(this.startControl,this.endControl,e),s=Sf(this.endControl,this.end,e),o=Sf(r,i,e),a=Sf(i,s,e),l=Sf(o,a,e);return t?new n(this.start,r,o,l):new n(l,a,s,this.end)},n.prototype.add=function(e,t){return new n(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},n.prototype.reverse=function(){return new n(this.end,this.endControl,this.startControl,this.start)},n}(),io=function(n){return n.type===1},Jfe=function(){function n(e){var t=e.styles,r=e.bounds,i=Sm(t.borderTopLeftRadius,r.width,r.height),s=i[0],o=i[1],a=Sm(t.borderTopRightRadius,r.width,r.height),l=a[0],c=a[1],A=Sm(t.borderBottomRightRadius,r.width,r.height),u=A[0],f=A[1],h=Sm(t.borderBottomLeftRadius,r.width,r.height),d=h[0],m=h[1],g=[];g.push((s+l)/r.width),g.push((d+u)/r.width),g.push((o+m)/r.height),g.push((c+f)/r.height);var p=Math.max.apply(Math,g);p>1&&(s/=p,o/=p,l/=p,c/=p,u/=p,f/=p,d/=p,m/=p);var v=r.width-l,w=r.height-f,_=r.width-u,x=r.height-m,b=t.borderTopWidth,B=t.borderRightWidth,M=t.borderBottomWidth,I=t.borderLeftWidth,S=bn(t.paddingTop,e.bounds.width),L=bn(t.paddingRight,e.bounds.width),O=bn(t.paddingBottom,e.bounds.width),T=bn(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?Pn(r.left+I/3,r.top+b/3,s-I/3,o-b/3,an.TOP_LEFT):new Xe(r.left+I/3,r.top+b/3),this.topRightBorderDoubleOuterBox=s>0||o>0?Pn(r.left+v,r.top+b/3,l-B/3,c-b/3,an.TOP_RIGHT):new Xe(r.left+r.width-B/3,r.top+b/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?Pn(r.left+_,r.top+w,u-B/3,f-M/3,an.BOTTOM_RIGHT):new Xe(r.left+r.width-B/3,r.top+r.height-M/3),this.bottomLeftBorderDoubleOuterBox=d>0||m>0?Pn(r.left+I/3,r.top+x,d-I/3,m-M/3,an.BOTTOM_LEFT):new Xe(r.left+I/3,r.top+r.height-M/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?Pn(r.left+I*2/3,r.top+b*2/3,s-I*2/3,o-b*2/3,an.TOP_LEFT):new Xe(r.left+I*2/3,r.top+b*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?Pn(r.left+v,r.top+b*2/3,l-B*2/3,c-b*2/3,an.TOP_RIGHT):new Xe(r.left+r.width-B*2/3,r.top+b*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?Pn(r.left+_,r.top+w,u-B*2/3,f-M*2/3,an.BOTTOM_RIGHT):new Xe(r.left+r.width-B*2/3,r.top+r.height-M*2/3),this.bottomLeftBorderDoubleInnerBox=d>0||m>0?Pn(r.left+I*2/3,r.top+x,d-I*2/3,m-M*2/3,an.BOTTOM_LEFT):new Xe(r.left+I*2/3,r.top+r.height-M*2/3),this.topLeftBorderStroke=s>0||o>0?Pn(r.left+I/2,r.top+b/2,s-I/2,o-b/2,an.TOP_LEFT):new Xe(r.left+I/2,r.top+b/2),this.topRightBorderStroke=s>0||o>0?Pn(r.left+v,r.top+b/2,l-B/2,c-b/2,an.TOP_RIGHT):new Xe(r.left+r.width-B/2,r.top+b/2),this.bottomRightBorderStroke=u>0||f>0?Pn(r.left+_,r.top+w,u-B/2,f-M/2,an.BOTTOM_RIGHT):new Xe(r.left+r.width-B/2,r.top+r.height-M/2),this.bottomLeftBorderStroke=d>0||m>0?Pn(r.left+I/2,r.top+x,d-I/2,m-M/2,an.BOTTOM_LEFT):new Xe(r.left+I/2,r.top+r.height-M/2),this.topLeftBorderBox=s>0||o>0?Pn(r.left,r.top,s,o,an.TOP_LEFT):new Xe(r.left,r.top),this.topRightBorderBox=l>0||c>0?Pn(r.left+v,r.top,l,c,an.TOP_RIGHT):new Xe(r.left+r.width,r.top),this.bottomRightBorderBox=u>0||f>0?Pn(r.left+_,r.top+w,u,f,an.BOTTOM_RIGHT):new Xe(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=d>0||m>0?Pn(r.left,r.top+x,d,m,an.BOTTOM_LEFT):new Xe(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||o>0?Pn(r.left+I,r.top+b,Math.max(0,s-I),Math.max(0,o-b),an.TOP_LEFT):new Xe(r.left+I,r.top+b),this.topRightPaddingBox=l>0||c>0?Pn(r.left+Math.min(v,r.width-B),r.top+b,v>r.width+B?0:Math.max(0,l-B),Math.max(0,c-b),an.TOP_RIGHT):new Xe(r.left+r.width-B,r.top+b),this.bottomRightPaddingBox=u>0||f>0?Pn(r.left+Math.min(_,r.width-I),r.top+Math.min(w,r.height-M),Math.max(0,u-B),Math.max(0,f-M),an.BOTTOM_RIGHT):new Xe(r.left+r.width-B,r.top+r.height-M),this.bottomLeftPaddingBox=d>0||m>0?Pn(r.left+I,r.top+Math.min(x,r.height-M),Math.max(0,d-I),Math.max(0,m-M),an.BOTTOM_LEFT):new Xe(r.left+I,r.top+r.height-M),this.topLeftContentBox=s>0||o>0?Pn(r.left+I+T,r.top+b+S,Math.max(0,s-(I+T)),Math.max(0,o-(b+S)),an.TOP_LEFT):new Xe(r.left+I+T,r.top+b+S),this.topRightContentBox=l>0||c>0?Pn(r.left+Math.min(v,r.width+I+T),r.top+b+S,v>r.width+I+T?0:l-I+T,c-(b+S),an.TOP_RIGHT):new Xe(r.left+r.width-(B+L),r.top+b+S),this.bottomRightContentBox=u>0||f>0?Pn(r.left+Math.min(_,r.width-(I+T)),r.top+Math.min(w,r.height+b+S),Math.max(0,u-(B+L)),f-(M+O),an.BOTTOM_RIGHT):new Xe(r.left+r.width-(B+L),r.top+r.height-(M+O)),this.bottomLeftContentBox=d>0||m>0?Pn(r.left+I+T,r.top+x,Math.max(0,d-(I+T)),m-(M+O),an.BOTTOM_LEFT):new Xe(r.left+I+T,r.top+r.height-(M+O))}return n}(),an;(function(n){n[n.TOP_LEFT=0]="TOP_LEFT",n[n.TOP_RIGHT=1]="TOP_RIGHT",n[n.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",n[n.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(an||(an={}));var Pn=function(n,e,t,r,i){var s=4*((Math.sqrt(2)-1)/3),o=t*s,a=r*s,l=n+t,c=e+r;switch(i){case an.TOP_LEFT:return new ly(new Xe(n,c),new Xe(n,c-a),new Xe(l-o,e),new Xe(l,e));case an.TOP_RIGHT:return new ly(new Xe(n,e),new Xe(n+o,e),new Xe(l,c-a),new Xe(l,c));case an.BOTTOM_RIGHT:return new ly(new Xe(l,e),new Xe(l,e+a),new Xe(n+o,c),new Xe(n,c));case an.BOTTOM_LEFT:default:return new ly(new Xe(l,c),new Xe(l-o,c),new Xe(n,e+a),new Xe(n,e))}},G_=function(n){return[n.topLeftBorderBox,n.topRightBorderBox,n.bottomRightBorderBox,n.bottomLeftBorderBox]},ehe=function(n){return[n.topLeftContentBox,n.topRightContentBox,n.bottomRightContentBox,n.bottomLeftContentBox]},V_=function(n){return[n.topLeftPaddingBox,n.topRightPaddingBox,n.bottomRightPaddingBox,n.bottomLeftPaddingBox]},the=function(){function n(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return n}(),cy=function(){function n(e,t){this.path=e,this.target=t,this.type=1}return n}(),nhe=function(){function n(e){this.opacity=e,this.type=2,this.target=6}return n}(),rhe=function(n){return n.type===0},Z8=function(n){return n.type===1},ihe=function(n){return n.type===2},SN=function(n,e){return n.length===e.length?n.some(function(t,r){return t===e[r]}):!1},she=function(n,e,t,r,i){return n.map(function(s,o){switch(o){case 0:return s.add(e,t);case 1:return s.add(e+r,t);case 2:return s.add(e+r,t+i);case 3:return s.add(e,t+i)}return s})},q8=function(){function n(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return n}(),J8=function(){function n(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Jfe(this.container),this.container.styles.opacity<1&&this.effects.push(new nhe(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new the(r,i,s))}if(this.container.styles.overflowX!==0){var o=G_(this.curves),a=V_(this.curves);SN(o,a)?this.effects.push(new cy(o,6)):(this.effects.push(new cy(o,2)),this.effects.push(new cy(a,4)))}}return n.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,i=this.effects.slice(0);r;){var s=r.effects.filter(function(l){return!Z8(l)});if(t||r.container.styles.position!==0||!r.parent){if(i.unshift.apply(i,s),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var o=G_(r.curves),a=V_(r.curves);SN(o,a)||i.unshift(new cy(a,6))}}else i.unshift.apply(i,s);r=r.parent}return i.filter(function(l){return Fr(l.target,e)})},n}(),YC=function(n,e,t,r){n.container.elements.forEach(function(i){var s=Fr(i.flags,4),o=Fr(i.flags,2),a=new J8(i,n);Fr(i.styles.display,2048)&&r.push(a);var l=Fr(i.flags,8)?[]:r;if(s||o){var c=s||i.styles.isPositioned()?t:e,A=new q8(a);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var f=0;c.negativeZIndex.some(function(d,m){return u>d.element.container.styles.zIndex.order?(f=m,!1):f>0}),c.negativeZIndex.splice(f,0,A)}else if(u>0){var h=0;c.positiveZIndex.some(function(d,m){return u>=d.element.container.styles.zIndex.order?(h=m+1,!1):h>0}),c.positiveZIndex.splice(h,0,A)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(A)}else i.styles.isFloating()?c.nonPositionedFloats.push(A):c.nonPositionedInlineLevel.push(A);YC(a,A,s?A:t,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),YC(a,e,t,l);Fr(i.flags,8)&&eG(i,l)})},eG=function(n,e){for(var t=n instanceof XC?n.start:1,r=n instanceof XC?n.reversed:!1,i=0;i"u"?n[0]:t},hhe=function(n,e,t,r,i){var s=e[0],o=e[1],a=t[0],l=t[1];switch(n){case 2:return[new Xe(Math.round(r.left),Math.round(r.top+o)),new Xe(Math.round(r.left+r.width),Math.round(r.top+o)),new Xe(Math.round(r.left+r.width),Math.round(l+r.top+o)),new Xe(Math.round(r.left),Math.round(l+r.top+o))];case 3:return[new Xe(Math.round(r.left+s),Math.round(r.top)),new Xe(Math.round(r.left+s+a),Math.round(r.top)),new Xe(Math.round(r.left+s+a),Math.round(r.height+r.top)),new Xe(Math.round(r.left+s),Math.round(r.height+r.top))];case 1:return[new Xe(Math.round(r.left+s),Math.round(r.top+o)),new Xe(Math.round(r.left+s+a),Math.round(r.top+o)),new Xe(Math.round(r.left+s+a),Math.round(r.top+o+l)),new Xe(Math.round(r.left+s),Math.round(r.top+o+l))];default:return[new Xe(Math.round(i.left),Math.round(i.top)),new Xe(Math.round(i.left+i.width),Math.round(i.top)),new Xe(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Xe(Math.round(i.left),Math.round(i.height+i.top))]}},dhe="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",CN="Hidden Text",phe=function(){function n(e){this._data={},this._document=e}return n.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),i=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",o.appendChild(r),i.src=dhe,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=t,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(CN)),r.appendChild(s),r.appendChild(i);var a=i.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(CN)),r.style.lineHeight="normal",i.style.verticalAlign="super";var l=i.offsetTop-r.offsetTop+2;return o.removeChild(r),{baseline:a,middle:l}},n.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},n}(),nG=function(){function n(e,t){this.context=e,this.options=t}return n}(),mhe=1e4;(function(n){oa(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i._activeEffects=[],i.canvas=r.canvas?r.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),r.canvas||(i.canvas.width=Math.floor(r.width*r.scale),i.canvas.height=Math.floor(r.height*r.scale),i.canvas.style.width=r.width+"px",i.canvas.style.height=r.height+"px"),i.fontMetrics=new phe(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-r.x,-r.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),i}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(i){return r.applyEffect(i)})},e.prototype.applyEffect=function(t){this.ctx.save(),ihe(t)&&(this.ctx.globalAlpha=t.opacity),rhe(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),Z8(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return Zs(this,void 0,void 0,function(){var r;return ps(this,function(i){switch(i.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return Zs(this,void 0,void 0,function(){return ps(this,function(r){switch(r.label){case 0:if(Fr(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,i){var s=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var o=JR(t.text);o.reduce(function(a,l){return s.ctx.fillText(l,a,t.bounds.top+i),a+s.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),i=_he(t.fontFamily).join(", "),s=_0(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,s,i].join(" "),i,s]},e.prototype.renderTextNode=function(t,r){return Zs(this,void 0,void 0,function(){var i,s,o,a,l,c,A,u,f=this;return ps(this,function(h){return i=this.createFontStyle(r),s=i[0],o=i[1],a=i[2],this.ctx.font=s,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(o,a),c=l.baseline,A=l.middle,u=r.paintOrder,t.textBounds.forEach(function(d){u.forEach(function(m){switch(m){case 0:f.ctx.fillStyle=kr(r.color),f.renderTextWithLetterSpacing(d,r.letterSpacing,c);var g=r.textShadow;g.length&&d.text.trim().length&&(g.slice(0).reverse().forEach(function(p){f.ctx.shadowColor=kr(p.color),f.ctx.shadowOffsetX=p.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=p.offsetY.number*f.options.scale,f.ctx.shadowBlur=p.blur.number,f.renderTextWithLetterSpacing(d,r.letterSpacing,c)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),r.textDecorationLine.length&&(f.ctx.fillStyle=kr(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(p){switch(p){case 1:f.ctx.fillRect(d.bounds.left,Math.round(d.bounds.top+c),d.bounds.width,1);break;case 2:f.ctx.fillRect(d.bounds.left,Math.round(d.bounds.top),d.bounds.width,1);break;case 3:f.ctx.fillRect(d.bounds.left,Math.ceil(d.bounds.top+A),d.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&d.text.trim().length&&(f.ctx.strokeStyle=kr(r.webkitTextStrokeColor),f.ctx.lineWidth=r.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(d.text,d.bounds.left,d.bounds.top+c)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,i){if(i&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var s=j_(t),o=V_(r);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,t.intrinsicWidth,t.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return Zs(this,void 0,void 0,function(){var r,i,s,o,a,l,v,v,c,A,u,f,_,h,d,x,m,g,p,v,w,_,x;return ps(this,function(b){switch(b.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,i=t.curves,s=r.styles,o=0,a=r.textNodes,b.label=1;case 1:return o0&&y>0&&(M=s.ctx.createPattern(x,"repeat"),s.renderRepeat(S,M,U,P))):wAe(A)&&(I=xB(t,r,[null,null,null]),S=I[0],L=I[1],O=I[2],T=I[3],y=I[4],E=A.position.length===0?[$R]:A.position,U=bn(E[0],T),P=bn(E[E.length-1],y),N=pAe(A,U,P,T,y),z=N[0],W=N[1],z>0&&W>0&&(H=s.ctx.createRadialGradient(L+U,O+P,0,L+U,O+P,z),tN(A.stops,z*2).forEach(function(ce){return H.addColorStop(ce.stop,kr(ce.color))}),s.path(S),s.ctx.fillStyle=H,z!==W?(C=t.bounds.left+.5*t.bounds.width,K=t.bounds.top+.5*t.bounds.height,te=W/z,F=1/te,s.ctx.save(),s.ctx.translate(C,K),s.ctx.transform(1,0,0,te,0,0),s.ctx.translate(-C,-K),s.ctx.fillRect(L,F*(O-K)+K,T,y*F),s.ctx.restore()):s.ctx.fill())),re.label=6;case 6:return r--,[2]}})},s=this,o=0,a=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return o0?A.style!==2?[3,5]:[4,this.renderDashedDottedBorder(A.color,A.width,a,t.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return A.style!==3?[3,7]:[4,this.renderDashedDottedBorder(A.color,A.width,a,t.curves,3)];case 6:return f.sent(),[3,11];case 7:return A.style!==4?[3,9]:[4,this.renderDoubleBorder(A.color,A.width,a,t.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(A.color,a,t.curves)];case 10:f.sent(),f.label=11;case 11:a++,f.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,i,s,o){return Zs(this,void 0,void 0,function(){var a,l,c,A,u,f,h,d,m,g,p,v,w,_,x,b,x,b;return ps(this,function(B){return this.ctx.save(),a=che(s,i),l=MN(s,i),o===2&&(this.path(l),this.ctx.clip()),io(l[0])?(c=l[0].start.x,A=l[0].start.y):(c=l[0].x,A=l[0].y),io(l[1])?(u=l[1].end.x,f=l[1].end.y):(u=l[1].x,f=l[1].y),i===0||i===2?h=Math.abs(c-u):h=Math.abs(A-f),this.ctx.beginPath(),o===3?this.formatPath(a):this.formatPath(l.slice(0,2)),d=r<3?r*3:r*2,m=r<3?r*2:r,o===3&&(d=r,m=r),g=!0,h<=d*2?g=!1:h<=d*2+m?(p=h/(2*d+m),d*=p,m*=p):(v=Math.floor((h+m)/(d+m)),w=(h-v*d)/(v-1),_=(h-(v+1)*d)/v,m=_<=0||Math.abs(m-w)0&&s[s.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!s||c[1]>s[0]&&c[1]=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},DD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Tle=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Kv=0;Kv"u"?[]:new Uint8Array(256);for(var Xv=0;Xv>4,A[i++]=(o&15)<<4|a>>2,A[i++]=(a&3)<<6|l&63;return c},Rle=function(n){for(var e=n.length,t=[],r=0;r>xu,Ple=1<>xu,Dle=a8+Lle,Nle=Dle,Ole=32,kle=Nle+Ole,Hle=65536>>ZR,Qle=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>xu],t=(t<>xu)],t=(t<>ZR),t=this.index[t],t+=e>>xu&zle,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var Yv=0;YvHD?(i.push(!0),a-=HD):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(o),t.push(HC);if(a===Yle||a===OC){if(o===0)return r.push(o),t.push(au);var l=t[o-1];return rce.indexOf(l)===-1?(r.push(r[o-1]),t.push(l)):(r.push(o),t.push(au))}if(r.push(o),a===ece)return t.push(e==="strict"?QC:Xg);if(a===u8||a===Jle)return t.push(au);if(a===tce)return s>=131072&&s<=196605||s>=196608&&s<=262141?t.push(Xg):t.push(au);t.push(a)}),[r,t,i]},fB=function(n,e,t,r){var i=r[t];if(Array.isArray(n)?n.indexOf(i)!==-1:n===i)for(var s=t;s<=r.length;){s++;var o=r[s];if(o===e)return!0;if(o!==$c)break}if(i===$c)for(var s=t;s>0;){s--;var a=r[s];if(Array.isArray(n)?n.indexOf(a)!==-1:n===a)for(var l=t;l<=r.length;){l++;var o=r[l];if(o===e)return!0;if(o!==$c)break}if(a!==$c)break}return!1},KD=function(n,e){for(var t=n;t>=0;){var r=e[t];if(r===$c)t--;else return r}return 0},oce=function(n,e,t,r,i){if(t[r]===0)return Dt;var s=r-1;if(Array.isArray(i)&&i[s]===!0)return Dt;var o=s-1,a=s+1,l=e[s],c=o>=0?e[o]:0,A=e[a];if(l===l8&&A===c8)return Dt;if(KC.indexOf(l)!==-1)return f8;if(KC.indexOf(A)!==-1||h8.indexOf(A)!==-1)return Dt;if(KD(s,e)===A8)return Jv;if(WC.get(n[s])===OC||(l===Zv||l===qv)&&WC.get(n[a])===OC||l===QD||A===QD||l===zD||[$c,kC,Em].indexOf(l)===-1&&A===zD||[$v,Hp,qle,Bf,Sf].indexOf(A)!==-1||KD(s,e)===Qp||fB(AB,Qp,s,e)||fB([$v,Hp],QC,s,e)||fB(GD,GD,s,e))return Dt;if(l===$c)return Jv;if(l===AB||A===AB)return Dt;if(A===HC||l===HC)return Jv;if([kC,Em,QC].indexOf(A)!==-1||l===Zle||c===VC&&ice.indexOf(l)!==-1||l===Sf&&A===VC||A===VD||ml.indexOf(A)!==-1&&l===gs||ml.indexOf(l)!==-1&&A===gs||l===Sm&&[Xg,Zv,qv].indexOf(A)!==-1||[Xg,Zv,qv].indexOf(l)!==-1&&A===Bm||ml.indexOf(l)!==-1&&jD.indexOf(A)!==-1||jD.indexOf(l)!==-1&&ml.indexOf(A)!==-1||[Sm,Bm].indexOf(l)!==-1&&(A===gs||[Qp,Em].indexOf(A)!==-1&&e[a+1]===gs)||[Qp,Em].indexOf(l)!==-1&&A===gs||l===gs&&[gs,Sf,Bf].indexOf(A)!==-1)return Dt;if([gs,Sf,Bf,$v,Hp].indexOf(A)!==-1)for(var u=s;u>=0;){var f=e[u];if(f===gs)return Dt;if([Sf,Bf].indexOf(f)!==-1)u--;else break}if([Sm,Bm].indexOf(A)!==-1)for(var u=[$v,Hp].indexOf(l)!==-1?o:s;u>=0;){var f=e[u];if(f===gs)return Dt;if([Sf,Bf].indexOf(f)!==-1)u--;else break}if(jC===l&&[jC,Cw,zC,GC].indexOf(A)!==-1||[Cw,zC].indexOf(l)!==-1&&[Cw,Tw].indexOf(A)!==-1||[Tw,GC].indexOf(l)!==-1&&A===Tw||WD.indexOf(l)!==-1&&[VD,Bm].indexOf(A)!==-1||WD.indexOf(A)!==-1&&l===Sm||ml.indexOf(l)!==-1&&ml.indexOf(A)!==-1||l===Bf&&ml.indexOf(A)!==-1||ml.concat(gs).indexOf(l)!==-1&&A===Qp&&nce.indexOf(n[a])===-1||ml.concat(gs).indexOf(A)!==-1&&l===Hp)return Dt;if(l===uB&&A===uB){for(var h=t[s],d=1;h>0&&(h--,e[h]===uB);)d++;if(d%2!==0)return Dt}return l===Zv&&A===qv?Dt:Jv},ace=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=sce(n,e.lineBreak),r=t[0],i=t[1],s=t[2];(e.wordBreak==="break-all"||e.wordBreak==="break-word")&&(i=i.map(function(a){return[gs,au,u8].indexOf(a)!==-1?Xg:a}));var o=e.wordBreak==="keep-all"?s.map(function(a,l){return a&&n[l]>=19968&&n[l]<=40959}):void 0;return[r,i,o]},lce=function(){function n(e,t,r,i){this.codePoints=e,this.required=t===f8,this.start=r,this.end=i}return n.prototype.slice=function(){return cr.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),cce=function(n,e){var t=g1(n),r=ace(t,e),i=r[0],s=r[1],o=r[2],a=t.length,l=0,c=0;return{next:function(){if(c>=a)return{done:!0,value:null};for(var A=Dt;c=d8&&n<=57},Gce=function(n){return n>=55296&&n<=57343},Mf=function(n){return gi(n)||n>=g8&&n<=y8||n>=p8&&n<=Oce},Vce=function(n){return n>=p8&&n<=Hce},jce=function(n){return n>=g8&&n<=zce},Wce=function(n){return Vce(n)||jce(n)},Kce=function(n){return n>=Cce},iy=function(n){return n===H_||n===fce||n===hce},Q_=function(n){return Wce(n)||Kce(n)||n===gce},qD=function(n){return Q_(n)||gi(n)||n===Ki},Xce=function(n){return n>=Uce&&n<=Fce||n===Pce||n>=Lce&&n<=Dce||n===Nce},Nc=function(n,e){return n!==ng?!1:e!==H_},sy=function(n,e,t){return n===Ki?Q_(e)||Nc(e,t):Q_(n)?!0:!!(n===ng&&Nc(n,e))},dB=function(n,e,t){return n===fu||n===Ki?gi(e)?!0:e===Yg&&gi(t):gi(n===Yg?e:n)},Yce=function(n){var e=0,t=1;(n[e]===fu||n[e]===Ki)&&(n[e]===Ki&&(t=-1),e++);for(var r=[];gi(n[e]);)r.push(n[e++]);var i=r.length?parseInt(cr.apply(void 0,r),10):0;n[e]===Yg&&e++;for(var s=[];gi(n[e]);)s.push(n[e++]);var o=s.length,a=o?parseInt(cr.apply(void 0,s),10):0;(n[e]===v8||n[e]===m8)&&e++;var l=1;(n[e]===fu||n[e]===Ki)&&(n[e]===Ki&&(l=-1),e++);for(var c=[];gi(n[e]);)c.push(n[e++]);var A=c.length?parseInt(cr.apply(void 0,c),10):0;return t*(i+a*Math.pow(10,-o))*Math.pow(10,l*A)},$ce={type:2},Zce={type:3},qce={type:4},Jce={type:13},eAe={type:8},tAe={type:21},nAe={type:9},rAe={type:10},iAe={type:11},sAe={type:12},oAe={type:14},oy={type:23},aAe={type:1},lAe={type:25},cAe={type:24},AAe={type:26},uAe={type:27},fAe={type:28},hAe={type:29},dAe={type:31},XC={type:32},w8=function(){function n(){this._value=[]}return n.prototype.write=function(e){this._value=this._value.concat(g1(e))},n.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==XC;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case ey:return this.consumeStringToken(ey);case dce:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),i=this.peekCodePoint(2);if(qD(t)||Nc(r,i)){var s=sy(t,r,i)?uce:Ace,o=this.consumeName();return{type:5,value:o,flags:s}}break;case pce:if(this.peekCodePoint(0)===zp)return this.consumeCodePoint(),Jce;break;case ty:return this.consumeStringToken(ty);case ny:return $ce;case Gp:return Zce;case hB:if(this.peekCodePoint(0)===zp)return this.consumeCodePoint(),oAe;break;case fu:if(dB(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case Tce:return qce;case Ki:var a=e,l=this.peekCodePoint(0),c=this.peekCodePoint(1);if(dB(a,l,c))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(sy(a,l,c))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===Ki&&c===wce)return this.consumeCodePoint(),this.consumeCodePoint(),cAe;break;case Yg:if(dB(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case YD:if(this.peekCodePoint(0)===hB)for(this.consumeCodePoint();;){var A=this.consumeCodePoint();if(A===hB&&(A=this.consumeCodePoint(),A===YD))return this.consumeToken();if(A===da)return this.consumeToken()}break;case Ice:return AAe;case Rce:return uAe;case yce:if(this.peekCodePoint(0)===vce&&this.peekCodePoint(1)===Ki&&this.peekCodePoint(2)===Ki)return this.consumeCodePoint(),this.consumeCodePoint(),lAe;break;case _ce:var u=this.peekCodePoint(0),f=this.peekCodePoint(1),h=this.peekCodePoint(2);if(sy(u,f,h)){var o=this.consumeName();return{type:7,value:o}}break;case xce:return fAe;case ng:if(Nc(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case bce:return hAe;case Ece:if(this.peekCodePoint(0)===zp)return this.consumeCodePoint(),eAe;break;case Bce:return iAe;case Sce:return sAe;case kce:case Qce:var d=this.peekCodePoint(0),m=this.peekCodePoint(1);return d===fu&&(Mf(m)||m===ry)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case $D:if(this.peekCodePoint(0)===zp)return this.consumeCodePoint(),nAe;if(this.peekCodePoint(0)===$D)return this.consumeCodePoint(),tAe;break;case Mce:if(this.peekCodePoint(0)===zp)return this.consumeCodePoint(),rAe;break;case da:return XC}return iy(e)?(this.consumeWhiteSpace(),dAe):gi(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Q_(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:cr(e)}},n.prototype.consumeCodePoint=function(){var e=this._value.shift();return typeof e>"u"?-1:e},n.prototype.reconsumeCodePoint=function(e){this._value.unshift(e)},n.prototype.peekCodePoint=function(e){return e>=this._value.length?-1:this._value[e]},n.prototype.consumeUnicodeRangeToken=function(){for(var e=[],t=this.consumeCodePoint();Mf(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===ry&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var i=parseInt(cr.apply(void 0,e.map(function(l){return l===ry?d8:l})),16),s=parseInt(cr.apply(void 0,e.map(function(l){return l===ry?y8:l})),16);return{type:30,start:i,end:s}}var o=parseInt(cr.apply(void 0,e),16);if(this.peekCodePoint(0)===Ki&&Mf(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];Mf(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var s=parseInt(cr.apply(void 0,a),16);return{type:30,start:o,end:s}}else return{type:30,start:o,end:o}},n.prototype.consumeIdentLikeToken=function(){var e=this.consumeName();return e.toLowerCase()==="url"&&this.peekCodePoint(0)===ny?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===ny?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===da)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===ty||t===ey){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===da||this.peekCodePoint(0)===Gp)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),oy)}for(;;){var i=this.consumeCodePoint();if(i===da||i===Gp)return{type:22,value:cr.apply(void 0,e)};if(iy(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===da||this.peekCodePoint(0)===Gp?(this.consumeCodePoint(),{type:22,value:cr.apply(void 0,e)}):(this.consumeBadUrlRemnants(),oy);if(i===ey||i===ty||i===ny||Xce(i))return this.consumeBadUrlRemnants(),oy;if(i===ng)if(Nc(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),oy;else e.push(i)}},n.prototype.consumeWhiteSpace=function(){for(;iy(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Gp||e===da)return;Nc(e,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},n.prototype.consumeStringSlice=function(e){for(var t=5e4,r="";e>0;){var i=Math.min(t,e);r+=cr.apply(void 0,this._value.splice(0,i)),e-=i}return this._value.shift(),r},n.prototype.consumeStringToken=function(e){var t="",r=0;do{var i=this._value[r];if(i===da||i===void 0||i===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(i===H_)return this._value.splice(0,r),aAe;if(i===ng){var s=this._value[r+1];s!==da&&s!==void 0&&(s===H_?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):Nc(i,s)&&(t+=this.consumeStringSlice(r),t+=cr(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=x0,r=this.peekCodePoint(0);for((r===fu||r===Ki)&&e.push(this.consumeCodePoint());gi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(r===Yg&&gi(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=XD;gi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),i=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===v8||r===m8)&&((i===fu||i===Ki)&&gi(s)||gi(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=XD;gi(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Yce(e),t]},n.prototype.consumeNumericToken=function(){var e=this.consumeNumber(),t=e[0],r=e[1],i=this.peekCodePoint(0),s=this.peekCodePoint(1),o=this.peekCodePoint(2);if(sy(i,s,o)){var a=this.consumeName();return{type:15,number:t,flags:r,unit:a}}return i===mce?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Mf(e)){for(var t=cr(e);Mf(this.peekCodePoint(0))&&t.length<6;)t+=cr(this.consumeCodePoint());iy(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||Gce(r)||r>1114111?ZD:r}return e===da?ZD:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(qD(t))e+=cr(t);else if(Nc(t,this.peekCodePoint(0)))e+=cr(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),_8=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new w8;return t.write(e),new n(t.read())},n.parseValue=function(e){return n.create(e).parseComponentValue()},n.parseValues=function(e){return n.create(e).parseComponentValues()},n.prototype.parseComponentValue=function(){for(var e=this.consumeToken();e.type===31;)e=this.consumeToken();if(e.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(e);var t=this.consumeComponentValue();do e=this.consumeToken();while(e.type===31);if(e.type===32)return t;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},n.prototype.parseComponentValues=function(){for(var e=[];;){var t=this.consumeComponentValue();if(t.type===32)return e;e.push(t),e.push()}},n.prototype.consumeComponentValue=function(){var e=this.consumeToken();switch(e.type){case 11:case 28:case 2:return this.consumeSimpleBlock(e.type);case 19:return this.consumeFunction(e)}return e},n.prototype.consumeSimpleBlock=function(e){for(var t={type:e,values:[]},r=this.consumeToken();;){if(r.type===32||pAe(r,e))return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue()),r=this.consumeToken()}},n.prototype.consumeFunction=function(e){for(var t={name:e.value,values:[],type:18};;){var r=this.consumeToken();if(r.type===32||r.type===3)return t;this.reconsumeToken(r),t.values.push(this.consumeComponentValue())}},n.prototype.consumeToken=function(){var e=this._tokens.shift();return typeof e>"u"?XC:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),b0=function(n){return n.type===15},v1=function(n){return n.type===17},ir=function(n){return n.type===20},YC=function(n,e){return ir(n)&&n.value===e},y1=function(n){return n.type!==31&&n.type!==4},ol=function(n){var e=[],t=[];return n.forEach(function(r){if(r.type===4){if(t.length===0)throw new Error("Error parsing function args, zero tokens for arg");e.push(t),t=[];return}r.type!==31&&t.push(r)}),t.length&&e.push(t),e},pAe=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},wA=function(n){return n.type===17||n.type===15},br=function(n){return n.type===16||wA(n)},x8=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},ii={type:17,number:0,flags:x0},qR={type:16,number:50,flags:x0},Zc={type:16,number:100,flags:x0},Mm=function(n,e,t){var r=n[0],i=n[1];return[bn(r,e),bn(typeof i<"u"?i:r,t)]},bn=function(n,e){if(n.type===16)return n.number/100*e;if(b0(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},b8="deg",E8="grad",B8="rad",S8="turn",w1={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case b8:return Math.PI*e.number/180;case E8:return Math.PI/200*e.number;case B8:return e.number;case S8:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},M8=function(n){return n.type===15&&(n.unit===b8||n.unit===E8||n.unit===B8||n.unit===S8)},C8=function(n){var e=n.filter(ir).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[ii,ii];case"to top":case"bottom":return uo(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[ii,Zc];case"to right":case"left":return uo(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[Zc,Zc];case"to bottom":case"top":return uo(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[Zc,ii];case"to left":case"right":return uo(270)}return 0},uo=function(n){return Math.PI*n/180},fA={name:"color",parse:function(n,e){if(e.type===18){var t=mAe[e.name];if(typeof t>"u")throw new Error('Attempting to parse an unsupported color function "'+e.name+'"');return t(n,e.values)}if(e.type===5){if(e.value.length===3){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3);return qc(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),1)}if(e.value.length===4){var r=e.value.substring(0,1),i=e.value.substring(1,2),s=e.value.substring(2,3),o=e.value.substring(3,4);return qc(parseInt(r+r,16),parseInt(i+i,16),parseInt(s+s,16),parseInt(o+o,16)/255)}if(e.value.length===6){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6);return qc(parseInt(r,16),parseInt(i,16),parseInt(s,16),1)}if(e.value.length===8){var r=e.value.substring(0,2),i=e.value.substring(2,4),s=e.value.substring(4,6),o=e.value.substring(6,8);return qc(parseInt(r,16),parseInt(i,16),parseInt(s,16),parseInt(o,16)/255)}}if(e.type===20){var a=$g[e.value.toUpperCase()];if(typeof a<"u")return a}return $g.TRANSPARENT}},ld=function(n){return(255&n)===0},Qr=function(n){var e=255&n,t=255&n>>8,r=255&n>>16,i=255&n>>24;return e<255?"rgba("+i+","+r+","+t+","+e/255+")":"rgb("+i+","+r+","+t+")"},qc=function(n,e,t,r){return(n<<24|e<<16|t<<8|Math.round(r*255)<<0)>>>0},JD=function(n,e){if(n.type===17)return n.number;if(n.type===16){var t=e===3?1:255;return e===3?n.number/100*t:Math.round(n.number/100*t)}return 0},eN=function(n,e){var t=e.filter(y1);if(t.length===3){var r=t.map(JD),i=r[0],s=r[1],o=r[2];return qc(i,s,o,1)}if(t.length===4){var a=t.map(JD),i=a[0],s=a[1],o=a[2],l=a[3];return qc(i,s,o,l)}return 0};function pB(n,e,t){return t<0&&(t+=1),t>=1&&(t-=1),t<1/6?(e-n)*t*6+n:t<1/2?e:t<2/3?(e-n)*6*(2/3-t)+n:n}var tN=function(n,e){var t=e.filter(y1),r=t[0],i=t[1],s=t[2],o=t[3],a=(r.type===17?uo(r.number):w1.parse(n,r))/(Math.PI*2),l=br(i)?i.number/100:0,c=br(s)?s.number/100:0,A=typeof o<"u"&&br(o)?bn(o,1):1;if(l===0)return qc(c*255,c*255,c*255,1);var u=c<=.5?c*(l+1):c+l-c*l,f=c*2-u,h=pB(f,u,a+1/3),d=pB(f,u,a),m=pB(f,u,a-1/3);return qc(h*255,d*255,m*255,A)},mAe={hsl:tN,hsla:tN,rgb:eN,rgba:eN},nN=function(n,e){return fA.parse(n,_8.create(e).parseComponentValue())},$g={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},gAe={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(ir(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},vAe={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},_1=function(n,e){var t=fA.parse(n,e[0]),r=e[1];return r&&br(r)?{color:t,stop:r}:{color:t,stop:null}},rN=function(n,e){var t=n[0],r=n[n.length-1];t.stop===null&&(t.stop=ii),r.stop===null&&(r.stop=Zc);for(var i=[],s=0,o=0;os?i.push(l):i.push(s),s=l}else i.push(null)}for(var c=null,o=0;oo.optimumDistance)?{optimumCorner:a,optimumDistance:A}:o},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},_Ae=function(n,e,t,r,i){var s=0,o=0;switch(n.size){case 0:n.shape===0?s=o=Math.min(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.min(Math.abs(e),Math.abs(e-r)),o=Math.min(Math.abs(t),Math.abs(t-i)));break;case 2:if(n.shape===0)s=o=Math.min(Ho(e,t),Ho(e,t-i),Ho(e-r,t),Ho(e-r,t-i));else if(n.shape===1){var a=Math.min(Math.abs(t),Math.abs(t-i))/Math.min(Math.abs(e),Math.abs(e-r)),l=iN(r,i,e,t,!0),c=l[0],A=l[1];s=Ho(c-e,(A-t)/a),o=a*s}break;case 1:n.shape===0?s=o=Math.max(Math.abs(e),Math.abs(e-r),Math.abs(t),Math.abs(t-i)):n.shape===1&&(s=Math.max(Math.abs(e),Math.abs(e-r)),o=Math.max(Math.abs(t),Math.abs(t-i)));break;case 3:if(n.shape===0)s=o=Math.max(Ho(e,t),Ho(e,t-i),Ho(e-r,t),Ho(e-r,t-i));else if(n.shape===1){var a=Math.max(Math.abs(t),Math.abs(t-i))/Math.max(Math.abs(e),Math.abs(e-r)),u=iN(r,i,e,t,!1),c=u[0],A=u[1];s=Ho(c-e,(A-t)/a),o=a*s}break}return Array.isArray(n.size)&&(s=bn(n.size[0],r),o=n.size.length===2?bn(n.size[1],i):s),[s,o]},xAe=function(n,e){var t=uo(180),r=[];return ol(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&o.value==="to"){t=C8(i);return}else if(M8(o)){t=w1.parse(n,o);return}}var a=_1(n,i);r.push(a)}),{angle:t,stops:r,type:1}},ay=function(n,e){var t=uo(180),r=[];return ol(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&["top","left","right","bottom"].indexOf(o.value)!==-1){t=C8(i);return}else if(M8(o)){t=(w1.parse(n,o)+uo(270))%uo(360);return}}var a=_1(n,i);r.push(a)}),{angle:t,stops:r,type:1}},bAe=function(n,e){var t=uo(180),r=[],i=1,s=0,o=3,a=[];return ol(e).forEach(function(l,c){var A=l[0];if(c===0){if(ir(A)&&A.value==="linear"){i=1;return}else if(ir(A)&&A.value==="radial"){i=2;return}}if(A.type===18){if(A.name==="from"){var u=fA.parse(n,A.values[0]);r.push({stop:ii,color:u})}else if(A.name==="to"){var u=fA.parse(n,A.values[0]);r.push({stop:Zc,color:u})}else if(A.name==="color-stop"){var f=A.values.filter(y1);if(f.length===2){var u=fA.parse(n,f[1]),h=f[0];v1(h)&&r.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(t+uo(180))%uo(360),stops:r,type:i}:{size:o,shape:s,stops:r,position:a,type:i}},T8="closest-side",I8="farthest-side",R8="closest-corner",U8="farthest-corner",F8="circle",P8="ellipse",L8="cover",D8="contain",EAe=function(n,e){var t=0,r=3,i=[],s=[];return ol(e).forEach(function(o,a){var l=!0;if(a===0){var c=!1;l=o.reduce(function(u,f){if(c)if(ir(f))switch(f.value){case"center":return s.push(qR),u;case"top":case"left":return s.push(ii),u;case"right":case"bottom":return s.push(Zc),u}else(br(f)||wA(f))&&s.push(f);else if(ir(f))switch(f.value){case F8:return t=0,!1;case P8:return t=1,!1;case"at":return c=!0,!1;case T8:return r=0,!1;case L8:case I8:return r=1,!1;case D8:case R8:return r=2,!1;case U8:return r=3,!1}else if(wA(f)||br(f))return Array.isArray(r)||(r=[]),r.push(f),!1;return u},l)}if(l){var A=_1(n,o);i.push(A)}}),{size:r,shape:t,stops:i,position:s,type:2}},ly=function(n,e){var t=0,r=3,i=[],s=[];return ol(e).forEach(function(o,a){var l=!0;if(a===0?l=o.reduce(function(A,u){if(ir(u))switch(u.value){case"center":return s.push(qR),!1;case"top":case"left":return s.push(ii),!1;case"right":case"bottom":return s.push(Zc),!1}else if(br(u)||wA(u))return s.push(u),!1;return A},l):a===1&&(l=o.reduce(function(A,u){if(ir(u))switch(u.value){case F8:return t=0,!1;case P8:return t=1,!1;case D8:case T8:return r=0,!1;case I8:return r=1,!1;case R8:return r=2,!1;case L8:case U8:return r=3,!1}else if(wA(u)||br(u))return Array.isArray(r)||(r=[]),r.push(u),!1;return A},l)),l){var c=_1(n,o);i.push(c)}}),{size:r,shape:t,stops:i,position:s,type:2}},BAe=function(n){return n.type===1},SAe=function(n){return n.type===2},JR={name:"image",parse:function(n,e){if(e.type===22){var t={url:e.value,type:0};return n.cache.addImage(e.value),t}if(e.type===18){var r=N8[e.name];if(typeof r>"u")throw new Error('Attempting to parse an unsupported image function "'+e.name+'"');return r(n,e.values)}throw new Error("Unsupported image type "+e.type)}};function MAe(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!N8[n.name])}var N8={"linear-gradient":xAe,"-moz-linear-gradient":ay,"-ms-linear-gradient":ay,"-o-linear-gradient":ay,"-webkit-linear-gradient":ay,"radial-gradient":EAe,"-moz-radial-gradient":ly,"-ms-radial-gradient":ly,"-o-radial-gradient":ly,"-webkit-radial-gradient":ly,"-webkit-gradient":bAe},CAe={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(n,e){if(e.length===0)return[];var t=e[0];return t.type===20&&t.value==="none"?[]:e.filter(function(r){return y1(r)&&MAe(r)}).map(function(r){return JR.parse(n,r)})}},TAe={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(ir(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},IAe={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return ol(e).map(function(t){return t.filter(br)}).map(x8)}},RAe={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return ol(e).map(function(t){return t.filter(ir).map(function(r){return r.value}).join(" ")}).map(UAe)}},UAe=function(n){switch(n){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},cd;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(cd||(cd={}));var FAe={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return ol(e).map(function(t){return t.filter(PAe)})}},PAe=function(n){return ir(n)||br(n)},x1=function(n){return{name:"border-"+n+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},LAe=x1("top"),DAe=x1("right"),NAe=x1("bottom"),OAe=x1("left"),b1=function(n){return{name:"border-radius-"+n,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return x8(t.filter(br))}}},kAe=b1("top-left"),HAe=b1("top-right"),QAe=b1("bottom-right"),zAe=b1("bottom-left"),E1=function(n){return{name:"border-"+n+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(e,t){switch(t){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},GAe=E1("top"),VAe=E1("right"),jAe=E1("bottom"),WAe=E1("left"),B1=function(n){return{name:"border-"+n+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return b0(t)?t.number:0}}},KAe=B1("top"),XAe=B1("right"),YAe=B1("bottom"),$Ae=B1("left"),ZAe={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},qAe={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},JAe={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(ir).reduce(function(t,r){return t|eue(r.value)},0)}},eue=function(n){switch(n){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},tue={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},nue={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(n,e){return e.type===20&&e.value==="normal"?0:e.type===17||e.type===15?e.number:0}},z_;(function(n){n.NORMAL="normal",n.STRICT="strict"})(z_||(z_={}));var rue={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return z_.STRICT;case"normal":default:return z_.NORMAL}}},iue={name:"line-height",initialValue:"normal",prefix:!1,type:4},sN=function(n,e){return ir(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:br(n)?bn(n,e):e},sue={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:JR.parse(n,e)}},oue={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(n,e){switch(e){case"inside":return 0;case"outside":default:return 1}}},aue={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},S1=function(n){return{name:"margin-"+n,initialValue:"0",prefix:!1,type:4}},lue=S1("top"),cue=S1("right"),Aue=S1("bottom"),uue=S1("left"),fue={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(ir).map(function(t){switch(t.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},hue={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-word":return"break-word";case"normal":default:return"normal"}}},M1=function(n){return{name:"padding-"+n,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},due=M1("top"),pue=M1("right"),mue=M1("bottom"),gue=M1("left"),vue={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(n,e){switch(e){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},yue={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(n,e){switch(e){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},wue={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&YC(e[0],"none")?[]:ol(e).map(function(t){for(var r={color:$g.TRANSPARENT,offsetX:ii,offsetY:ii,blur:ii},i=0,s=0;s"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},bue=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},Eue=function(n){var e=n.filter(function(l){return l.type===17}).map(function(l){return l.number}),t=e[0],r=e[1];e[2],e[3];var i=e[4],s=e[5];e[6],e[7],e[8],e[9],e[10],e[11];var o=e[12],a=e[13];return e[14],e[15],e.length===16?[t,r,i,s,o,a]:null},Bue={matrix:bue,matrix3d:Eue},oN={type:16,number:50,flags:x0},Sue=[oN,oN],Mue={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(br);return t.length!==2?Sue:[t[0],t[1]]}},Cue={name:"visible",initialValue:"none",prefix:!1,type:2,parse:function(n,e){switch(e){case"hidden":return 1;case"collapse":return 2;case"visible":default:return 0}}},rg;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(rg||(rg={}));var Tue={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return rg.BREAK_ALL;case"keep-all":return rg.KEEP_ALL;case"normal":default:return rg.NORMAL}}},Iue={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if(v1(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},O8={name:"time",parse:function(n,e){if(e.type===15)switch(e.unit.toLowerCase()){case"s":return 1e3*e.number;case"ms":return e.number}throw new Error("Unsupported time type")}},Rue={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return v1(e)?e.number:1}},Uue={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Fue={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(ir).map(function(t){switch(t.value){case"underline":return 1;case"overline":return 2;case"line-through":return 3;case"none":return 4}return 0}).filter(function(t){return t!==0})}},Pue={name:"font-family",initialValue:"",prefix:!1,type:1,parse:function(n,e){var t=[],r=[];return e.forEach(function(i){switch(i.type){case 20:case 0:t.push(i.value);break;case 17:t.push(i.number.toString());break;case 4:r.push(t.join(" ")),t.length=0;break}}),t.length&&r.push(t.join(" ")),r.map(function(i){return i.indexOf(" ")===-1?i:"'"+i+"'"})}},Lue={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Due={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if(v1(e))return e.number;if(ir(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},Nue={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(ir).map(function(t){return t.value})}},Oue={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},Pr=function(n,e){return(n&e)!==0},kue={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(b0).map(function(t){return O8.parse(n,t)})}},Hue={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&YC(e[0],"none")?[]:ol(e).map(function(t){for(var r={color:255,offsetX:ii,offsetY:ii,blur:ii,spread:ii,inset:!1},i=0,s=0;s1?1:0],this.overflowWrap=Je(e,hue,t.overflowWrap),this.paddingTop=Je(e,due,t.paddingTop),this.paddingRight=Je(e,pue,t.paddingRight),this.paddingBottom=Je(e,mue,t.paddingBottom),this.paddingLeft=Je(e,gue,t.paddingLeft),this.paintOrder=Je(e,Que,t.paintOrder),this.position=Je(e,yue,t.position),this.textAlign=Je(e,vue,t.textAlign),this.textDecorationColor=Je(e,Uue,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=Je(e,Fue,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=Je(e,wue,t.textShadow),this.textTransform=Je(e,_ue,t.textTransform),this.transform=Je(e,xue,t.transform),this.transformOrigin=Je(e,Mue,t.transformOrigin),this.visibility=Je(e,Cue,t.visibility),this.webkitTextStrokeColor=Je(e,zue,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Je(e,Gue,t.webkitTextStrokeWidth),this.wordBreak=Je(e,Tue,t.wordBreak),this.zIndex=Je(e,Iue,t.zIndex)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return ld(this.backgroundColor)},n.prototype.isTransformed=function(){return this.transform!==null},n.prototype.isPositioned=function(){return this.position!==0},n.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},n.prototype.isFloating=function(){return this.float!==0},n.prototype.isInlineLevel=function(){return Pr(this.display,4)||Pr(this.display,33554432)||Pr(this.display,268435456)||Pr(this.display,536870912)||Pr(this.display,67108864)||Pr(this.display,134217728)},n}(),Je=function(n,e,t){var r=new w8,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(i);var s=new _8(r.read());switch(e.type){case 2:var o=s.parseComponentValue();return e.parse(n,ir(o)?o.value:e.initialValue);case 0:return e.parse(n,s.parseComponentValue());case 1:return e.parse(n,s.parseComponentValues());case 4:return s.parseComponentValue();case 3:switch(e.format){case"angle":return w1.parse(n,s.parseComponentValue());case"color":return fA.parse(n,s.parseComponentValue());case"image":return JR.parse(n,s.parseComponentValue());case"length":var a=s.parseComponentValue();return wA(a)?a:ii;case"length-percentage":var l=s.parseComponentValue();return br(l)?l:ii;case"time":return O8.parse(n,s.parseComponentValue())}break}},jue="data-html2canvas-debug",Wue=function(n){var e=n.getAttribute(jue);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},aN=function(n,e){var t=Wue(n);return t===1||e===t},al=function(){function n(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,aN(t,3))debugger;this.styles=new Vue(e,window.getComputedStyle(t,null)),Wfe(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=$R(this.context,t),aN(t,4)&&(this.flags|=16)}return n}(),Kue="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",lN="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Cm=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var cy=0;cy>4,A[i++]=(o&15)<<4|a>>2,A[i++]=(a&3)<<6|l&63;return c},Yue=function(n){for(var e=n.length,t=[],r=0;r>bu,que=1<>bu,efe=k8+Jue,tfe=efe,nfe=32,rfe=tfe+nfe,ife=65536>>e2,sfe=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>bu],t=(t<>bu)],t=(t<>e2),t=this.index[t],t+=e>>bu&ofe,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var Ay=0;Ay=55296&&i<=56319&&t>10)+55296,o%1024+56320)),(i+1===t||r.length>16384)&&(s+=String.fromCharCode.apply(String,r),r.length=0)}return s},pfe=lfe(Kue),no="×",bB="÷",mfe=function(n){return pfe.get(n)},gfe=function(n,e,t){var r=t-2,i=e[r],s=e[t-1],o=e[t];if(s===vB&&o===yB)return no;if(s===vB||s===yB||s===uN||o===vB||o===yB||o===uN)return bB;if(s===hN&&[hN,wB,dN,pN].indexOf(o)!==-1||(s===dN||s===wB)&&(o===wB||o===_B)||(s===pN||s===_B)&&o===_B||o===mN||o===fN||o===ffe||s===ufe)return no;if(s===mN&&o===gN){for(;i===fN;)i=e[--r];if(i===gN)return no}if(s===xB&&o===xB){for(var a=0;i===xB;)a++,i=e[--r];if(a%2===0)return no}return bB},vfe=function(n){var e=hfe(n),t=e.length,r=0,i=0,s=e.map(mfe);return{next:function(){if(r>=t)return{done:!0,value:null};for(var o=no;ro.x||A.y>o.y;return o=A,c===0?!0:u});return n.body.removeChild(e),a},xfe=function(){return typeof new Image().crossOrigin<"u"},bfe=function(){return typeof new XMLHttpRequest().responseType=="string"},Efe=function(n){var e=new Image,t=n.createElement("canvas"),r=t.getContext("2d");if(!r)return!1;e.src="data:image/svg+xml,";try{r.drawImage(e,0,0),t.toDataURL()}catch{return!1}return!0},vN=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},Bfe=function(n){var e=n.createElement("canvas"),t=100;e.width=t,e.height=t;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,t,t);var i=new Image,s=e.toDataURL();i.src=s;var o=$C(t,t,0,0,i);return r.fillStyle="red",r.fillRect(0,0,t,t),yN(o).then(function(a){r.drawImage(a,0,0);var l=r.getImageData(0,0,t,t).data;r.fillStyle="red",r.fillRect(0,0,t,t);var c=n.createElement("div");return c.style.backgroundImage="url("+s+")",c.style.height=t+"px",vN(l)?yN($C(t,t,0,0,c)):Promise.reject(!1)}).then(function(a){return r.drawImage(a,0,0),vN(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},$C=function(n,e,t,r,i){var s="http://www.w3.org/2000/svg",o=document.createElementNS(s,"svg"),a=document.createElementNS(s,"foreignObject");return o.setAttributeNS(null,"width",n.toString()),o.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",t.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),o.appendChild(a),a.appendChild(i),o},yN=function(n){return new Promise(function(e,t){var r=new Image;r.onload=function(){return e(r)},r.onerror=t,r.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(n))})},ws={get SUPPORT_RANGE_BOUNDS(){var n=wfe(document);return Object.defineProperty(ws,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=ws.SUPPORT_RANGE_BOUNDS&&_fe(document);return Object.defineProperty(ws,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=Efe(document);return Object.defineProperty(ws,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?Bfe(document):Promise.resolve(!1);return Object.defineProperty(ws,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=xfe();return Object.defineProperty(ws,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=bfe();return Object.defineProperty(ws,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(ws,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(ws,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},ig=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),Sfe=function(n,e,t,r){var i=Tfe(e,t),s=[],o=0;return i.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(ws.SUPPORT_RANGE_BOUNDS){var l=wN(r,o,a.length).getClientRects();if(l.length>1){var c=t2(a),A=0;c.forEach(function(f){s.push(new ig(f,Nu.fromDOMRectList(n,wN(r,A+o,f.length).getClientRects()))),A+=f.length})}else s.push(new ig(a,Nu.fromDOMRectList(n,l)))}else{var u=r.splitText(a.length);s.push(new ig(a,Mfe(n,r))),r=u}else ws.SUPPORT_RANGE_BOUNDS||(r=r.splitText(a.length));o+=a.length}),s},Mfe=function(n,e){var t=e.ownerDocument;if(t){var r=t.createElement("html2canvaswrapper");r.appendChild(e.cloneNode(!0));var i=e.parentNode;if(i){i.replaceChild(r,e);var s=$R(n,r);return r.firstChild&&i.replaceChild(r.firstChild,r),s}}return Nu.EMPTY},wN=function(n,e,t){var r=n.ownerDocument;if(!r)throw new Error("Node has no owner document");var i=r.createRange();return i.setStart(n,e),i.setEnd(n,e+t),i},t2=function(n){if(ws.SUPPORT_NATIVE_TEXT_SEGMENTATION){var e=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(e.segment(n)).map(function(t){return t.segment})}return yfe(n)},Cfe=function(n,e){if(ws.SUPPORT_NATIVE_TEXT_SEGMENTATION){var t=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(t.segment(n)).map(function(r){return r.segment})}return Rfe(n,e)},Tfe=function(n,e){return e.letterSpacing!==0?t2(n):Cfe(n,e)},Ife=[32,160,4961,65792,65793,4153,4241],Rfe=function(n,e){for(var t=cce(n,{lineBreak:e.lineBreak,wordBreak:e.overflowWrap==="break-word"?"break-word":e.wordBreak}),r=[],i,s=function(){if(i.value){var o=i.value.slice(),a=g1(o),l="";a.forEach(function(c){Ife.indexOf(c)===-1?l+=cr(c):(l.length&&r.push(l),r.push(cr(c)),l="")}),l.length&&r.push(l)}};!(i=t.next()).done;)s();return r},Ufe=function(){function n(e,t,r){this.text=Ffe(t.data,r.textTransform),this.textBounds=Sfe(e,this.text,r,t)}return n}(),Ffe=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(Pfe,Lfe);case 2:return n.toUpperCase();default:return n}},Pfe=/(^|\s|:|-|\(|\))([a-z])/g,Lfe=function(n,e,t){return n.length>0?e+t.toUpperCase():n},H8=function(n){aa(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.src=r.currentSrc||r.src,i.intrinsicWidth=r.naturalWidth,i.intrinsicHeight=r.naturalHeight,i.context.cache.addImage(i.src),i}return e}(al),Q8=function(n){aa(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.canvas=r,i.intrinsicWidth=r.width,i.intrinsicHeight=r.height,i}return e}(al),z8=function(n){aa(e,n);function e(t,r){var i=n.call(this,t,r)||this,s=new XMLSerializer,o=$R(t,r);return r.setAttribute("width",o.width+"px"),r.setAttribute("height",o.height+"px"),i.svg="data:image/svg+xml,"+encodeURIComponent(s.serializeToString(r)),i.intrinsicWidth=r.width.baseVal.value,i.intrinsicHeight=r.height.baseVal.value,i.context.cache.addImage(i.svg),i}return e}(al),G8=function(n){aa(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.value=r.value,i}return e}(al),ZC=function(n){aa(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.start=r.start,i.reversed=typeof r.reversed=="boolean"&&r.reversed===!0,i}return e}(al),Dfe=[{type:15,flags:0,unit:"px",number:3}],Nfe=[{type:16,flags:0,number:50}],Ofe=function(n){return n.width>n.height?new Nu(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width0)t.textNodes.push(new Ufe(n,i,t.styles));else if(X8(i))if(the(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return Iw(n,a,t,r)});else{var o=K8(n,i);o.styles.isVisible()&&(Gfe(i,o,r)?o.flags|=4:Vfe(o.styles)&&(o.flags|=2),Qfe.indexOf(i.tagName)!==-1&&(o.flags|=8),t.elements.push(o),i.slot,i.shadowRoot?Iw(n,i.shadowRoot,o,r):!$8(i)&&!Y8(i)&&!Z8(i)&&Iw(n,i,o,r))}},K8=function(n,e){return Jfe(e)?new H8(n,e):qfe(e)?new Q8(n,e):Y8(e)?new z8(n,e):Xfe(e)?new G8(n,e):Yfe(e)?new ZC(n,e):$fe(e)?new n2(n,e):Z8(e)?new V8(n,e):$8(e)?new j8(n,e):ehe(e)?new W8(n,e):new al(n,e)},zfe=function(n,e){var t=K8(n,e);return t.flags|=4,Iw(n,e,t,t),t},Gfe=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Zfe(n)&&t.styles.isTransparent()},Vfe=function(n){return n.isPositioned()||n.isFloating()},jfe=function(n){return n.nodeType===Node.TEXT_NODE},X8=function(n){return n.nodeType===Node.ELEMENT_NODE},Wfe=function(n){return X8(n)&&typeof n.style<"u"&&!Kfe(n)},Kfe=function(n){return typeof n.className=="object"},Xfe=function(n){return n.tagName==="LI"},Yfe=function(n){return n.tagName==="OL"},$fe=function(n){return n.tagName==="INPUT"},Y8=function(n){return n.tagName==="svg"},Zfe=function(n){return n.tagName==="BODY"},qfe=function(n){return n.tagName==="CANVAS"},Jfe=function(n){return n.tagName==="IMG"},ehe=function(n){return n.tagName==="IFRAME"},$8=function(n){return n.tagName==="TEXTAREA"},Z8=function(n){return n.tagName==="SELECT"},the=function(n){return n.tagName==="SLOT"},xN={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},bN={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},nhe={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},rhe={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Cf=function(n,e,t,r,i,s){return nt?r2(n,i,s.length>0):r.integers.reduce(function(o,a,l){for(;n>=a;)n-=a,o+=r.values[l];return o},"")+s},q8=function(n,e,t,r){var i="";do t||n--,i=r(n)+i,n/=e;while(n*e>=e);return i},ar=function(n,e,t,r,i){var s=t-e+1;return(n<0?"-":"")+(q8(Math.abs(n),s,r,function(o){return cr(Math.floor(o%s)+e)})+i)},VA=function(n,e,t){t===void 0&&(t=". ");var r=e.length;return q8(Math.abs(n),r,!1,function(i){return e[Math.floor(i%r)]})+t},Wf=1,Fc=2,Pc=4,Tm=8,gl=function(n,e,t,r,i,s){if(n<-9999||n>9999)return r2(n,4,i.length>0);var o=Math.abs(n),a=i;if(o===0)return e[0]+a;for(var l=0;o>0&&l<=4;l++){var c=o%10;c===0&&Pr(s,Wf)&&a!==""?a=e[c]+a:c>1||c===1&&l===0||c===1&&l===1&&Pr(s,Fc)||c===1&&l===1&&Pr(s,Pc)&&n>100||c===1&&l>1&&Pr(s,Tm)?a=e[c]+(l>0?t[l-1]:"")+a:c===1&&l>0&&(a=t[l-1]+a),o=Math.floor(o/10)}return(n<0?r:"")+a},EN="十百千萬",BN="拾佰仟萬",SN="マイナス",EB="마이너스",r2=function(n,e,t){var r=t?". ":"",i=t?"、":"",s=t?", ":"",o=t?" ":"";switch(e){case 0:return"•"+o;case 1:return"◦"+o;case 2:return"◾"+o;case 5:var a=ar(n,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return VA(n,"〇一二三四五六七八九",i);case 6:return Cf(n,1,3999,xN,3,r).toLowerCase();case 7:return Cf(n,1,3999,xN,3,r);case 8:return ar(n,945,969,!1,r);case 9:return ar(n,97,122,!1,r);case 10:return ar(n,65,90,!1,r);case 11:return ar(n,1632,1641,!0,r);case 12:case 49:return Cf(n,1,9999,bN,3,r);case 35:return Cf(n,1,9999,bN,3,r).toLowerCase();case 13:return ar(n,2534,2543,!0,r);case 14:case 30:return ar(n,6112,6121,!0,r);case 15:return VA(n,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return VA(n,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return gl(n,"零一二三四五六七八九",EN,"負",i,Fc|Pc|Tm);case 47:return gl(n,"零壹貳參肆伍陸柒捌玖",BN,"負",i,Wf|Fc|Pc|Tm);case 42:return gl(n,"零一二三四五六七八九",EN,"负",i,Fc|Pc|Tm);case 41:return gl(n,"零壹贰叁肆伍陆柒捌玖",BN,"负",i,Wf|Fc|Pc|Tm);case 26:return gl(n,"〇一二三四五六七八九","十百千万",SN,i,0);case 25:return gl(n,"零壱弐参四伍六七八九","拾百千万",SN,i,Wf|Fc|Pc);case 31:return gl(n,"영일이삼사오육칠팔구","십백천만",EB,s,Wf|Fc|Pc);case 33:return gl(n,"零一二三四五六七八九","十百千萬",EB,s,0);case 32:return gl(n,"零壹貳參四五六七八九","拾百千",EB,s,Wf|Fc|Pc);case 18:return ar(n,2406,2415,!0,r);case 20:return Cf(n,1,19999,rhe,3,r);case 21:return ar(n,2790,2799,!0,r);case 22:return ar(n,2662,2671,!0,r);case 22:return Cf(n,1,10999,nhe,3,r);case 23:return VA(n,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return VA(n,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return ar(n,3302,3311,!0,r);case 28:return VA(n,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return VA(n,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return ar(n,3792,3801,!0,r);case 37:return ar(n,6160,6169,!0,r);case 38:return ar(n,4160,4169,!0,r);case 39:return ar(n,2918,2927,!0,r);case 40:return ar(n,1776,1785,!0,r);case 43:return ar(n,3046,3055,!0,r);case 44:return ar(n,3174,3183,!0,r);case 45:return ar(n,3664,3673,!0,r);case 46:return ar(n,3872,3881,!0,r);case 3:default:return ar(n,48,57,!0,r)}},MN;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(MN||(MN={}));var ihe=function(){function n(){}return n.getOrigin=function(e){var t=n._link;return t?(t.href=e,t.href=t.href,t.protocol+t.hostname+t.port):"about:blank"},n.isSameOrigin=function(e){return n.getOrigin(e)===n._origin},n.setContext=function(e){n._link=e.document.createElement("a"),n._origin=n.getOrigin(e.location.href)},n._origin="about:blank",n}(),Xe=function(){function n(e,t){this.type=0,this.x=e,this.y=t}return n.prototype.add=function(e,t){return new n(this.x+e,this.y+t)},n}(),Tf=function(n,e,t){return new Xe(n.x+(e.x-n.x)*t,n.y+(e.y-n.y)*t)},uy=function(){function n(e,t,r,i){this.type=1,this.start=e,this.startControl=t,this.endControl=r,this.end=i}return n.prototype.subdivide=function(e,t){var r=Tf(this.start,this.startControl,e),i=Tf(this.startControl,this.endControl,e),s=Tf(this.endControl,this.end,e),o=Tf(r,i,e),a=Tf(i,s,e),l=Tf(o,a,e);return t?new n(this.start,r,o,l):new n(l,a,s,this.end)},n.prototype.add=function(e,t){return new n(this.start.add(e,t),this.startControl.add(e,t),this.endControl.add(e,t),this.end.add(e,t))},n.prototype.reverse=function(){return new n(this.end,this.endControl,this.startControl,this.start)},n}(),so=function(n){return n.type===1},she=function(){function n(e){var t=e.styles,r=e.bounds,i=Mm(t.borderTopLeftRadius,r.width,r.height),s=i[0],o=i[1],a=Mm(t.borderTopRightRadius,r.width,r.height),l=a[0],c=a[1],A=Mm(t.borderBottomRightRadius,r.width,r.height),u=A[0],f=A[1],h=Mm(t.borderBottomLeftRadius,r.width,r.height),d=h[0],m=h[1],g=[];g.push((s+l)/r.width),g.push((d+u)/r.width),g.push((o+m)/r.height),g.push((c+f)/r.height);var p=Math.max.apply(Math,g);p>1&&(s/=p,o/=p,l/=p,c/=p,u/=p,f/=p,d/=p,m/=p);var v=r.width-l,w=r.height-f,_=r.width-u,x=r.height-m,b=t.borderTopWidth,B=t.borderRightWidth,S=t.borderBottomWidth,I=t.borderLeftWidth,M=bn(t.paddingTop,e.bounds.width),P=bn(t.paddingRight,e.bounds.width),D=bn(t.paddingBottom,e.bounds.width),T=bn(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?Pn(r.left+I/3,r.top+b/3,s-I/3,o-b/3,an.TOP_LEFT):new Xe(r.left+I/3,r.top+b/3),this.topRightBorderDoubleOuterBox=s>0||o>0?Pn(r.left+v,r.top+b/3,l-B/3,c-b/3,an.TOP_RIGHT):new Xe(r.left+r.width-B/3,r.top+b/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?Pn(r.left+_,r.top+w,u-B/3,f-S/3,an.BOTTOM_RIGHT):new Xe(r.left+r.width-B/3,r.top+r.height-S/3),this.bottomLeftBorderDoubleOuterBox=d>0||m>0?Pn(r.left+I/3,r.top+x,d-I/3,m-S/3,an.BOTTOM_LEFT):new Xe(r.left+I/3,r.top+r.height-S/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?Pn(r.left+I*2/3,r.top+b*2/3,s-I*2/3,o-b*2/3,an.TOP_LEFT):new Xe(r.left+I*2/3,r.top+b*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?Pn(r.left+v,r.top+b*2/3,l-B*2/3,c-b*2/3,an.TOP_RIGHT):new Xe(r.left+r.width-B*2/3,r.top+b*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?Pn(r.left+_,r.top+w,u-B*2/3,f-S*2/3,an.BOTTOM_RIGHT):new Xe(r.left+r.width-B*2/3,r.top+r.height-S*2/3),this.bottomLeftBorderDoubleInnerBox=d>0||m>0?Pn(r.left+I*2/3,r.top+x,d-I*2/3,m-S*2/3,an.BOTTOM_LEFT):new Xe(r.left+I*2/3,r.top+r.height-S*2/3),this.topLeftBorderStroke=s>0||o>0?Pn(r.left+I/2,r.top+b/2,s-I/2,o-b/2,an.TOP_LEFT):new Xe(r.left+I/2,r.top+b/2),this.topRightBorderStroke=s>0||o>0?Pn(r.left+v,r.top+b/2,l-B/2,c-b/2,an.TOP_RIGHT):new Xe(r.left+r.width-B/2,r.top+b/2),this.bottomRightBorderStroke=u>0||f>0?Pn(r.left+_,r.top+w,u-B/2,f-S/2,an.BOTTOM_RIGHT):new Xe(r.left+r.width-B/2,r.top+r.height-S/2),this.bottomLeftBorderStroke=d>0||m>0?Pn(r.left+I/2,r.top+x,d-I/2,m-S/2,an.BOTTOM_LEFT):new Xe(r.left+I/2,r.top+r.height-S/2),this.topLeftBorderBox=s>0||o>0?Pn(r.left,r.top,s,o,an.TOP_LEFT):new Xe(r.left,r.top),this.topRightBorderBox=l>0||c>0?Pn(r.left+v,r.top,l,c,an.TOP_RIGHT):new Xe(r.left+r.width,r.top),this.bottomRightBorderBox=u>0||f>0?Pn(r.left+_,r.top+w,u,f,an.BOTTOM_RIGHT):new Xe(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=d>0||m>0?Pn(r.left,r.top+x,d,m,an.BOTTOM_LEFT):new Xe(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||o>0?Pn(r.left+I,r.top+b,Math.max(0,s-I),Math.max(0,o-b),an.TOP_LEFT):new Xe(r.left+I,r.top+b),this.topRightPaddingBox=l>0||c>0?Pn(r.left+Math.min(v,r.width-B),r.top+b,v>r.width+B?0:Math.max(0,l-B),Math.max(0,c-b),an.TOP_RIGHT):new Xe(r.left+r.width-B,r.top+b),this.bottomRightPaddingBox=u>0||f>0?Pn(r.left+Math.min(_,r.width-I),r.top+Math.min(w,r.height-S),Math.max(0,u-B),Math.max(0,f-S),an.BOTTOM_RIGHT):new Xe(r.left+r.width-B,r.top+r.height-S),this.bottomLeftPaddingBox=d>0||m>0?Pn(r.left+I,r.top+Math.min(x,r.height-S),Math.max(0,d-I),Math.max(0,m-S),an.BOTTOM_LEFT):new Xe(r.left+I,r.top+r.height-S),this.topLeftContentBox=s>0||o>0?Pn(r.left+I+T,r.top+b+M,Math.max(0,s-(I+T)),Math.max(0,o-(b+M)),an.TOP_LEFT):new Xe(r.left+I+T,r.top+b+M),this.topRightContentBox=l>0||c>0?Pn(r.left+Math.min(v,r.width+I+T),r.top+b+M,v>r.width+I+T?0:l-I+T,c-(b+M),an.TOP_RIGHT):new Xe(r.left+r.width-(B+P),r.top+b+M),this.bottomRightContentBox=u>0||f>0?Pn(r.left+Math.min(_,r.width-(I+T)),r.top+Math.min(w,r.height+b+M),Math.max(0,u-(B+P)),f-(S+D),an.BOTTOM_RIGHT):new Xe(r.left+r.width-(B+P),r.top+r.height-(S+D)),this.bottomLeftContentBox=d>0||m>0?Pn(r.left+I+T,r.top+x,Math.max(0,d-(I+T)),m-(S+D),an.BOTTOM_LEFT):new Xe(r.left+I+T,r.top+r.height-(S+D))}return n}(),an;(function(n){n[n.TOP_LEFT=0]="TOP_LEFT",n[n.TOP_RIGHT=1]="TOP_RIGHT",n[n.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",n[n.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(an||(an={}));var Pn=function(n,e,t,r,i){var s=4*((Math.sqrt(2)-1)/3),o=t*s,a=r*s,l=n+t,c=e+r;switch(i){case an.TOP_LEFT:return new uy(new Xe(n,c),new Xe(n,c-a),new Xe(l-o,e),new Xe(l,e));case an.TOP_RIGHT:return new uy(new Xe(n,e),new Xe(n+o,e),new Xe(l,c-a),new Xe(l,c));case an.BOTTOM_RIGHT:return new uy(new Xe(l,e),new Xe(l,e+a),new Xe(n+o,c),new Xe(n,c));case an.BOTTOM_LEFT:default:return new uy(new Xe(l,c),new Xe(l-o,c),new Xe(n,e+a),new Xe(n,e))}},j_=function(n){return[n.topLeftBorderBox,n.topRightBorderBox,n.bottomRightBorderBox,n.bottomLeftBorderBox]},ohe=function(n){return[n.topLeftContentBox,n.topRightContentBox,n.bottomRightContentBox,n.bottomLeftContentBox]},W_=function(n){return[n.topLeftPaddingBox,n.topRightPaddingBox,n.bottomRightPaddingBox,n.bottomLeftPaddingBox]},ahe=function(){function n(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return n}(),fy=function(){function n(e,t){this.path=e,this.target=t,this.type=1}return n}(),lhe=function(){function n(e){this.opacity=e,this.type=2,this.target=6}return n}(),che=function(n){return n.type===0},J8=function(n){return n.type===1},Ahe=function(n){return n.type===2},CN=function(n,e){return n.length===e.length?n.some(function(t,r){return t===e[r]}):!1},uhe=function(n,e,t,r,i){return n.map(function(s,o){switch(o){case 0:return s.add(e,t);case 1:return s.add(e+r,t);case 2:return s.add(e+r,t+i);case 3:return s.add(e,t+i)}return s})},eG=function(){function n(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return n}(),tG=function(){function n(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new she(this.container),this.container.styles.opacity<1&&this.effects.push(new lhe(this.container.styles.opacity)),this.container.styles.transform!==null){var r=this.container.bounds.left+this.container.styles.transformOrigin[0].number,i=this.container.bounds.top+this.container.styles.transformOrigin[1].number,s=this.container.styles.transform;this.effects.push(new ahe(r,i,s))}if(this.container.styles.overflowX!==0){var o=j_(this.curves),a=W_(this.curves);CN(o,a)?this.effects.push(new fy(o,6)):(this.effects.push(new fy(o,2)),this.effects.push(new fy(a,4)))}}return n.prototype.getEffects=function(e){for(var t=[2,3].indexOf(this.container.styles.position)===-1,r=this.parent,i=this.effects.slice(0);r;){var s=r.effects.filter(function(l){return!J8(l)});if(t||r.container.styles.position!==0||!r.parent){if(i.unshift.apply(i,s),t=[2,3].indexOf(r.container.styles.position)===-1,r.container.styles.overflowX!==0){var o=j_(r.curves),a=W_(r.curves);CN(o,a)||i.unshift(new fy(a,6))}}else i.unshift.apply(i,s);r=r.parent}return i.filter(function(l){return Pr(l.target,e)})},n}(),qC=function(n,e,t,r){n.container.elements.forEach(function(i){var s=Pr(i.flags,4),o=Pr(i.flags,2),a=new tG(i,n);Pr(i.styles.display,2048)&&r.push(a);var l=Pr(i.flags,8)?[]:r;if(s||o){var c=s||i.styles.isPositioned()?t:e,A=new eG(a);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var f=0;c.negativeZIndex.some(function(d,m){return u>d.element.container.styles.zIndex.order?(f=m,!1):f>0}),c.negativeZIndex.splice(f,0,A)}else if(u>0){var h=0;c.positiveZIndex.some(function(d,m){return u>=d.element.container.styles.zIndex.order?(h=m+1,!1):h>0}),c.positiveZIndex.splice(h,0,A)}else c.zeroOrAutoZIndexOrTransformedOrOpacity.push(A)}else i.styles.isFloating()?c.nonPositionedFloats.push(A):c.nonPositionedInlineLevel.push(A);qC(a,A,s?A:t,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),qC(a,e,t,l);Pr(i.flags,8)&&nG(i,l)})},nG=function(n,e){for(var t=n instanceof ZC?n.start:1,r=n instanceof ZC?n.reversed:!1,i=0;i"u"?n[0]:t},yhe=function(n,e,t,r,i){var s=e[0],o=e[1],a=t[0],l=t[1];switch(n){case 2:return[new Xe(Math.round(r.left),Math.round(r.top+o)),new Xe(Math.round(r.left+r.width),Math.round(r.top+o)),new Xe(Math.round(r.left+r.width),Math.round(l+r.top+o)),new Xe(Math.round(r.left),Math.round(l+r.top+o))];case 3:return[new Xe(Math.round(r.left+s),Math.round(r.top)),new Xe(Math.round(r.left+s+a),Math.round(r.top)),new Xe(Math.round(r.left+s+a),Math.round(r.height+r.top)),new Xe(Math.round(r.left+s),Math.round(r.height+r.top))];case 1:return[new Xe(Math.round(r.left+s),Math.round(r.top+o)),new Xe(Math.round(r.left+s+a),Math.round(r.top+o)),new Xe(Math.round(r.left+s+a),Math.round(r.top+o+l)),new Xe(Math.round(r.left+s),Math.round(r.top+o+l))];default:return[new Xe(Math.round(i.left),Math.round(i.top)),new Xe(Math.round(i.left+i.width),Math.round(i.top)),new Xe(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Xe(Math.round(i.left),Math.round(i.height+i.top))]}},whe="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",IN="Hidden Text",_he=function(){function n(e){this._data={},this._document=e}return n.prototype.parseMetrics=function(e,t){var r=this._document.createElement("div"),i=this._document.createElement("img"),s=this._document.createElement("span"),o=this._document.body;r.style.visibility="hidden",r.style.fontFamily=e,r.style.fontSize=t,r.style.margin="0",r.style.padding="0",r.style.whiteSpace="nowrap",o.appendChild(r),i.src=whe,i.width=1,i.height=1,i.style.margin="0",i.style.padding="0",i.style.verticalAlign="baseline",s.style.fontFamily=e,s.style.fontSize=t,s.style.margin="0",s.style.padding="0",s.appendChild(this._document.createTextNode(IN)),r.appendChild(s),r.appendChild(i);var a=i.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(IN)),r.style.lineHeight="normal",i.style.verticalAlign="super";var l=i.offsetTop-r.offsetTop+2;return o.removeChild(r),{baseline:a,middle:l}},n.prototype.getMetrics=function(e,t){var r=e+" "+t;return typeof this._data[r]>"u"&&(this._data[r]=this.parseMetrics(e,t)),this._data[r]},n}(),iG=function(){function n(e,t){this.context=e,this.options=t}return n}(),xhe=1e4;(function(n){aa(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i._activeEffects=[],i.canvas=r.canvas?r.canvas:document.createElement("canvas"),i.ctx=i.canvas.getContext("2d"),r.canvas||(i.canvas.width=Math.floor(r.width*r.scale),i.canvas.height=Math.floor(r.height*r.scale),i.canvas.style.width=r.width+"px",i.canvas.style.height=r.height+"px"),i.fontMetrics=new _he(document),i.ctx.scale(i.options.scale,i.options.scale),i.ctx.translate(-r.x,-r.y),i.ctx.textBaseline="bottom",i._activeEffects=[],i.context.logger.debug("Canvas renderer initialized ("+r.width+"x"+r.height+") with scale "+r.scale),i}return e.prototype.applyEffects=function(t){for(var r=this;this._activeEffects.length;)this.popEffect();t.forEach(function(i){return r.applyEffect(i)})},e.prototype.applyEffect=function(t){this.ctx.save(),Ahe(t)&&(this.ctx.globalAlpha=t.opacity),che(t)&&(this.ctx.translate(t.offsetX,t.offsetY),this.ctx.transform(t.matrix[0],t.matrix[1],t.matrix[2],t.matrix[3],t.matrix[4],t.matrix[5]),this.ctx.translate(-t.offsetX,-t.offsetY)),J8(t)&&(this.path(t.path),this.ctx.clip()),this._activeEffects.push(t)},e.prototype.popEffect=function(){this._activeEffects.pop(),this.ctx.restore()},e.prototype.renderStack=function(t){return qs(this,void 0,void 0,function(){var r;return ms(this,function(i){switch(i.label){case 0:return r=t.element.container.styles,r.isVisible()?[4,this.renderStackContent(t)]:[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},e.prototype.renderNode=function(t){return qs(this,void 0,void 0,function(){return ms(this,function(r){switch(r.label){case 0:if(Pr(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,i){var s=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var o=t2(t.text);o.reduce(function(a,l){return s.ctx.fillText(l,a,t.bounds.top+i),a+s.ctx.measureText(l).width},t.bounds.left)}},e.prototype.createFontStyle=function(t){var r=t.fontVariant.filter(function(o){return o==="normal"||o==="small-caps"}).join(""),i=Mhe(t.fontFamily).join(", "),s=b0(t.fontSize)?""+t.fontSize.number+t.fontSize.unit:t.fontSize.number+"px";return[[t.fontStyle,r,t.fontWeight,s,i].join(" "),i,s]},e.prototype.renderTextNode=function(t,r){return qs(this,void 0,void 0,function(){var i,s,o,a,l,c,A,u,f=this;return ms(this,function(h){return i=this.createFontStyle(r),s=i[0],o=i[1],a=i[2],this.ctx.font=s,this.ctx.direction=r.direction===1?"rtl":"ltr",this.ctx.textAlign="left",this.ctx.textBaseline="alphabetic",l=this.fontMetrics.getMetrics(o,a),c=l.baseline,A=l.middle,u=r.paintOrder,t.textBounds.forEach(function(d){u.forEach(function(m){switch(m){case 0:f.ctx.fillStyle=Qr(r.color),f.renderTextWithLetterSpacing(d,r.letterSpacing,c);var g=r.textShadow;g.length&&d.text.trim().length&&(g.slice(0).reverse().forEach(function(p){f.ctx.shadowColor=Qr(p.color),f.ctx.shadowOffsetX=p.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=p.offsetY.number*f.options.scale,f.ctx.shadowBlur=p.blur.number,f.renderTextWithLetterSpacing(d,r.letterSpacing,c)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),r.textDecorationLine.length&&(f.ctx.fillStyle=Qr(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(p){switch(p){case 1:f.ctx.fillRect(d.bounds.left,Math.round(d.bounds.top+c),d.bounds.width,1);break;case 2:f.ctx.fillRect(d.bounds.left,Math.round(d.bounds.top),d.bounds.width,1);break;case 3:f.ctx.fillRect(d.bounds.left,Math.ceil(d.bounds.top+A),d.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&d.text.trim().length&&(f.ctx.strokeStyle=Qr(r.webkitTextStrokeColor),f.ctx.lineWidth=r.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(d.text,d.bounds.left,d.bounds.top+c)),f.ctx.strokeStyle="",f.ctx.lineWidth=0,f.ctx.lineJoin="miter";break}})}),[2]})})},e.prototype.renderReplacedElement=function(t,r,i){if(i&&t.intrinsicWidth>0&&t.intrinsicHeight>0){var s=K_(t),o=W_(r);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,t.intrinsicWidth,t.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return qs(this,void 0,void 0,function(){var r,i,s,o,a,l,v,v,c,A,u,f,_,h,d,x,m,g,p,v,w,_,x;return ms(this,function(b){switch(b.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,i=t.curves,s=r.styles,o=0,a=r.textNodes,b.label=1;case 1:return o0&&y>0&&(S=s.ctx.createPattern(x,"repeat"),s.renderRepeat(M,S,R,L))):SAe(A)&&(I=BB(t,r,[null,null,null]),M=I[0],P=I[1],D=I[2],T=I[3],y=I[4],E=A.position.length===0?[qR]:A.position,R=bn(E[0],T),L=bn(E[E.length-1],y),N=_Ae(A,R,L,T,y),z=N[0],W=N[1],z>0&&W>0&&(H=s.ctx.createRadialGradient(P+R,D+L,0,P+R,D+L,z),rN(A.stops,z*2).forEach(function(ce){return H.addColorStop(ce.stop,Qr(ce.color))}),s.path(M),s.ctx.fillStyle=H,z!==W?(C=t.bounds.left+.5*t.bounds.width,K=t.bounds.top+.5*t.bounds.height,ee=W/z,F=1/ee,s.ctx.save(),s.ctx.translate(C,K),s.ctx.transform(1,0,0,ee,0,0),s.ctx.translate(-C,-K),s.ctx.fillRect(P,F*(D-K)+K,T,y*F),s.ctx.restore()):s.ctx.fill())),re.label=6;case 6:return r--,[2]}})},s=this,o=0,a=t.styles.backgroundImage.slice(0).reverse(),c.label=1;case 1:return o0?A.style!==2?[3,5]:[4,this.renderDashedDottedBorder(A.color,A.width,a,t.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return A.style!==3?[3,7]:[4,this.renderDashedDottedBorder(A.color,A.width,a,t.curves,3)];case 6:return f.sent(),[3,11];case 7:return A.style!==4?[3,9]:[4,this.renderDoubleBorder(A.color,A.width,a,t.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(A.color,a,t.curves)];case 10:f.sent(),f.label=11;case 11:a++,f.label=12;case 12:return l++,[3,3];case 13:return[2]}})})},e.prototype.renderDashedDottedBorder=function(t,r,i,s,o){return qs(this,void 0,void 0,function(){var a,l,c,A,u,f,h,d,m,g,p,v,w,_,x,b,x,b;return ms(this,function(B){return this.ctx.save(),a=phe(s,i),l=TN(s,i),o===2&&(this.path(l),this.ctx.clip()),so(l[0])?(c=l[0].start.x,A=l[0].start.y):(c=l[0].x,A=l[0].y),so(l[1])?(u=l[1].end.x,f=l[1].end.y):(u=l[1].x,f=l[1].y),i===0||i===2?h=Math.abs(c-u):h=Math.abs(A-f),this.ctx.beginPath(),o===3?this.formatPath(a):this.formatPath(l.slice(0,2)),d=r<3?r*3:r*2,m=r<3?r*2:r,o===3&&(d=r,m=r),g=!0,h<=d*2?g=!1:h<=d*2+m?(p=h/(2*d+m),d*=p,m*=p):(v=Math.floor((h+m)/(d+m)),w=(h-v*d)/(v-1),_=(h-(v+1)*d)/v,m=_<=0||Math.abs(m-w)new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Yt=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),W_=class extends Ft{constructor(n){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${n}`,this.expressionName=n,this.type="VRMExpression",this.visible=!1}get overrideBlinkAmount(){return this.overrideBlink==="block"?0.5?1:0:this.weight}addBind(n){this._binds.push(n)}applyWeight(n){var e;let t=this.outputWeight;t*=(e=n==null?void 0:n.multiplier)!=null?e:1,this.isBinary&&t<1&&(t=0),this._binds.forEach(r=>r.applyWeight(t))}clearAppliedWeight(){this._binds.forEach(n=>n.clearAppliedWeight())}};function rG(n,e,t){var r,i;const s=n.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,A=[];return t.traverse(u=>{A.length{const s=rG(n,i,r);s!=null&&t.set(i,s)}),t})}var ti={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function iG(n){return Math.max(Math.min(n,1),0)}var K_=class sG{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},t=new Set(Object.values(ti));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},t=new Set(Object.values(ti));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)||(e[r]=i)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new sG().copy(this)}getExpression(e){var t;return(t=this._expressionMap[e])!=null?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const t=this._expressions.indexOf(e);t===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var t;const r=this.getExpression(e);return(t=r==null?void 0:r.weight)!=null?t:null}setValue(e,t){const r=this.getExpression(e);r&&(r.weight=iG(t))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const t=this.getExpression(e);return t?`${t.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(t=>{t.clearAppliedWeight()}),this._expressions.forEach(t=>{let r=1;const i=t.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),t.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,t=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,t-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),t=Math.max(0,t),r=Math.max(0,r),{blink:e,lookAt:t,mouth:r}}},Gp={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},bhe={_Color:Gp.Color,_EmissionColor:Gp.EmissionColor,_ShadeColor:Gp.ShadeColor,_RimColor:Gp.RimColor,_OutlineColor:Gp.OutlineColor},Ehe=new He,oG=class aG{constructor({material:e,type:t,targetValue:r,targetAlpha:i}){this.material=e,this.type=t,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:t,alpha:r}=this._state;if(t!=null){const{propertyName:i,deltaValue:s}=t,o=this.material[i];o!=null&&o.add(Ehe.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:t}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(t!=null){const{propertyName:r,initialValue:i}=t;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,t,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?t:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const A=i[l].clone(),u=new He(o.r-A.r,o.g-A.g,o.b-A.b);return{propertyName:l,initialValue:A,deltaValue:u}}_initAlphaBindState(){var e,t,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?t:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],A=o-c;return{propertyName:l,initialValue:c,deltaValue:A}}_getPropertyNameMap(){var e,t;return(t=(e=Object.entries(aG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?t:null}};oG._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var RN=oG,$C=class{constructor({primitives:n,index:e,weight:t}){this.primitives=n,this.index=e,this.weight=t}applyWeight(n){this.primitives.forEach(e=>{var t;((t=e.morphTargetInfluences)==null?void 0:t[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*n)})}clearAppliedWeight(){this.primitives.forEach(n=>{var e;((e=n.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(n.morphTargetInfluences[this.index]=0)})}},UN=new je,lG=class cG{constructor({material:e,scale:t,offset:r}){var i,s;this.material=e,this.scale=t,this.offset=r;const o=(i=Object.entries(cG._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const c=(l=e[a])==null?void 0:l.clone();if(!c)return null;e[a]=c;const A=c.offset.clone(),u=c.repeat.clone(),f=r.clone().sub(A),h=t.clone().sub(u);this._properties.push({name:a,initialOffset:A,deltaOffset:f,initialScale:u,deltaScale:h})}))}applyWeight(e){this._properties.forEach(t=>{const r=this.material[t.name];r!==void 0&&(r.offset.add(UN.copy(t.deltaOffset).multiplyScalar(e)),r.repeat.add(UN.copy(t.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const t=this.material[e.name];t!==void 0&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale))})}};lG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var FN=lG,Bhe=new Set(["1.0","1.0-beta"]),AG=class uG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return Yt(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return Yt(this,null,function*(){const t=yield this._v1Import(e);if(t)return t;const r=yield this._v0Import(e);return r||null})}_v1Import(e){return Yt(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Bhe.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const c=new Set(Object.values(ti)),A=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([f,h])=>{if(h!=null){if(!c.has(f)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${f}" detected. Ignoring the expression`);return}A.set(f,h)}}),l.custom!=null&&Object.entries(l.custom).forEach(([f,h])=>{if(c.has(f)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${f}". Ignoring the expression`);return}A.set(f,h)});const u=new K_;return yield Promise.all(Array.from(A.entries()).map(f=>Yt(this,[f],function*([h,d]){var m,g,p,v,w,_,x;const b=new W_(h);if(e.scene.add(b),b.isBinary=(m=d.isBinary)!=null?m:!1,b.overrideBlink=(g=d.overrideBlink)!=null?g:"none",b.overrideLookAt=(p=d.overrideLookAt)!=null?p:"none",b.overrideMouth=(v=d.overrideMouth)!=null?v:"none",(w=d.morphTargetBinds)==null||w.forEach(B=>Yt(this,null,function*(){var M;if(B.node===void 0||B.index===void 0)return;const I=yield TN(e,B.node),S=B.index;if(!I.every(L=>Array.isArray(L.morphTargetInfluences)&&S{const I=M.material;I&&B.push(I)}),(_=d.materialColorBinds)==null||_.forEach(M=>Yt(this,null,function*(){B.filter(S=>{var L;const O=(L=this.parser.associations.get(S))==null?void 0:L.materials;return M.material===O}).forEach(S=>{b.addBind(new RN({material:S,type:M.type,targetValue:new He().fromArray(M.targetValue),targetAlpha:M.targetValue[3]}))})})),(x=d.textureTransformBinds)==null||x.forEach(M=>Yt(this,null,function*(){B.filter(S=>{var L;const O=(L=this.parser.associations.get(S))==null?void 0:L.materials;return M.material===O}).forEach(S=>{var L,O;b.addBind(new FN({material:S,offset:new je().fromArray((L=M.offset)!=null?L:[0,0]),scale:new je().fromArray((O=M.scale)!=null?O:[1,1])}))})}))}u.registerExpression(b)}))),u})}_v0Import(e){return Yt(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new K_,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>Yt(this,null,function*(){var A;const u=c.presetName,f=u!=null&&uG.v0v1PresetNameMap[u]||null,h=f??c.name;if(h==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(h)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${u} has duplicated entries. Ignoring the expression`);return}l.add(h);const d=new W_(h);e.scene.add(d),d.isBinary=(A=c.isBinary)!=null?A:!1,c.binds&&c.binds.forEach(g=>Yt(this,null,function*(){var p;if(g.mesh===void 0||g.index===void 0)return;const v=[];(p=r.nodes)==null||p.forEach((_,x)=>{_.mesh===g.mesh&&v.push(x)});const w=g.index;yield Promise.all(v.map(_=>Yt(this,null,function*(){var x;const b=yield TN(e,_);if(!b.every(B=>Array.isArray(B.morphTargetInfluences)&&w{if(g.materialName===void 0||g.propertyName===void 0||g.targetValue===void 0)return;const p=[];e.scene.traverse(w=>{if(w.material){const _=w.material;Array.isArray(_)?p.push(..._.filter(x=>(x.name===g.materialName||x.name===g.materialName+" (Outline)")&&p.indexOf(x)===-1)):_.name===g.materialName&&p.indexOf(_)===-1&&p.push(_)}});const v=g.propertyName;p.forEach(w=>{if(v==="_MainTex_ST"){const x=new je(g.targetValue[0],g.targetValue[1]),b=new je(g.targetValue[2],g.targetValue[3]);b.y=1-b.y-x.y,d.addBind(new FN({material:w,scale:x,offset:b}));return}const _=bhe[v];if(_){d.addBind(new RN({material:w,type:_,targetValue:new He().fromArray(g.targetValue),targetAlpha:g.targetValue[3]}));return}console.warn(v+" is not supported")})}),o.registerExpression(d)}))),o})}};AG.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var She=AG,n2=class jf{constructor(e,t){this._firstPersonOnlyLayer=jf.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=jf.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=t}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map(t=>({meshes:t.meshes.concat(),type:t.type})),this}clone(){return new jf(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=jf.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=jf.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=t,this.meshAnnotations.forEach(r=>{r.meshes.forEach(i=>{r.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):r.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):r.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(e,t,r,i){let s=0;if(t!=null&&t.length>0)for(let o=0;o0&&i.includes(u[0])||A[1]>0&&i.includes(u[1])||A[2]>0&&i.includes(u[2])||A[3]>0&&i.includes(u[3]))continue;const f=t[l],h=r[l];if(f[0]>0&&i.includes(h[0])||f[1]>0&&i.includes(h[1])||f[2]>0&&i.includes(h[2])||f[3]>0&&i.includes(h[3]))continue;const d=t[c],m=r[c];d[0]>0&&i.includes(m[0])||d[1]>0&&i.includes(m[1])||d[2]>0&&i.includes(m[2])||d[3]>0&&i.includes(m[3])||(e[s++]=a,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,t){const r=new Va(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const i=r.geometry,s=i.getAttribute("skinIndex"),o=s instanceof dD?[]:s.array,a=[];for(let m=0;m{this._isEraseTarget(s)&&r.push(o)}),!r.length){t.layers.enable(this._thirdPersonOnlyLayer),t.layers.enable(this._firstPersonOnlyLayer);return}t.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(t,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer));else{const t=new ni;t.name=`_headless_${e.name}`,t.layers.set(this._firstPersonOnlyLayer),e.parent.add(t),e.children.filter(r=>r.type==="SkinnedMesh").forEach(r=>{const i=r;this._createHeadlessModelForSkinnedMesh(t,i)})}else if(e.type==="SkinnedMesh"){const t=e;this._createHeadlessModelForSkinnedMesh(e.parent,t)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")?!0:e.parent?this._isEraseTarget(e.parent):!1}};n2.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;n2.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var PN=n2,Mhe=new Set(["1.0","1.0-beta"]),Che=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(n){this.parser=n}afterRoot(n){return Yt(this,null,function*(){const e=n.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");n.userData.vrmFirstPerson=yield this._import(n,e)}})}_import(n,e){return Yt(this,null,function*(){if(e==null)return null;const t=yield this._v1Import(n,e);if(t)return t;const r=yield this._v0Import(n,e);return r||null})}_v1Import(n,e){return Yt(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Mhe.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson;if(!l)return null;const c=[],A=yield IN(n);return Array.from(A.entries()).forEach(([u,f])=>{var h;const d=l.meshAnnotations?l.meshAnnotations.find(m=>m.node===u):void 0;c.push({meshes:f,type:(h=d==null?void 0:d.type)!=null?h:"both"})}),new PN(e,c)})}_v0Import(n,e){return Yt(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield IN(n);return Array.from(a.entries()).forEach(([l,c])=>{const A=r.nodes[l],u=s.meshAnnotations?s.meshAnnotations.find(f=>f.mesh===A.mesh):void 0;o.push({meshes:c,type:this._convertV0FlagToV1Type(u==null?void 0:u.firstPersonFlag)})}),new PN(e,o)})}_convertV0FlagToV1Type(n){return n==="FirstPersonOnly"?"firstPersonOnly":n==="ThirdPersonOnly"?"thirdPersonOnly":n==="Auto"?"auto":"both"}},LN=new $,DN=new $,The=new tt,NN=class extends ni{constructor(n){super(),this.vrmHumanoid=n,this._boneAxesMap=new Map,Object.values(n.humanBones).forEach(e=>{const t=new doe(1);t.matrixAutoUpdate=!1,t.material.depthTest=!1,t.material.depthWrite=!1,this.add(t),this._boneAxesMap.set(e,t)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(n=>{n.geometry.dispose(),n.material.dispose()})}updateMatrixWorld(n){Array.from(this._boneAxesMap.entries()).forEach(([e,t])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(LN,The,DN);const r=LN.set(.1,.1,.1).divide(DN);t.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(n)}},bB=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],Yg={Hips:"hips",Spine:"spine",Chest:"chest",UpperChest:"upperChest",Neck:"neck",Head:"head",LeftEye:"leftEye",RightEye:"rightEye",Jaw:"jaw",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",LeftToes:"leftToes",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",RightToes:"rightToes",LeftShoulder:"leftShoulder",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightShoulder:"rightShoulder",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand",LeftThumbMetacarpal:"leftThumbMetacarpal",LeftThumbProximal:"leftThumbProximal",LeftThumbDistal:"leftThumbDistal",LeftIndexProximal:"leftIndexProximal",LeftIndexIntermediate:"leftIndexIntermediate",LeftIndexDistal:"leftIndexDistal",LeftMiddleProximal:"leftMiddleProximal",LeftMiddleIntermediate:"leftMiddleIntermediate",LeftMiddleDistal:"leftMiddleDistal",LeftRingProximal:"leftRingProximal",LeftRingIntermediate:"leftRingIntermediate",LeftRingDistal:"leftRingDistal",LeftLittleProximal:"leftLittleProximal",LeftLittleIntermediate:"leftLittleIntermediate",LeftLittleDistal:"leftLittleDistal",RightThumbMetacarpal:"rightThumbMetacarpal",RightThumbProximal:"rightThumbProximal",RightThumbDistal:"rightThumbDistal",RightIndexProximal:"rightIndexProximal",RightIndexIntermediate:"rightIndexIntermediate",RightIndexDistal:"rightIndexDistal",RightMiddleProximal:"rightMiddleProximal",RightMiddleIntermediate:"rightMiddleIntermediate",RightMiddleDistal:"rightMiddleDistal",RightRingProximal:"rightRingProximal",RightRingIntermediate:"rightRingIntermediate",RightRingDistal:"rightRingDistal",RightLittleProximal:"rightLittleProximal",RightLittleIntermediate:"rightLittleIntermediate",RightLittleDistal:"rightLittleDistal"},Ihe={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function fG(n){return n.invert?n.invert():n.inverse(),n}var GA=new $,VA=new tt,ZC=class{constructor(n){this.humanBones=n,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);r&&(GA.copy(r.position),VA.copy(r.quaternion),n[t]={position:GA.toArray(),rotation:VA.toArray()})}),n}getPose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);if(!r)return;GA.set(0,0,0),VA.identity();const i=this.restPose[t];i!=null&&i.position&&GA.fromArray(i.position).negate(),i!=null&&i.rotation&&fG(VA.fromArray(i.rotation)),GA.add(r.position),VA.premultiply(r.quaternion),n[t]={position:GA.toArray(),rotation:VA.toArray()}}),n}setPose(n){Object.entries(n).forEach(([e,t])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(t!=null&&t.position&&(i.position.fromArray(t.position),s.position&&i.position.add(GA.fromArray(s.position))),t!=null&&t.rotation&&(i.quaternion.fromArray(t.rotation),s.rotation&&i.quaternion.multiply(VA.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([n,e])=>{const t=this.getBoneNode(n);t&&(e!=null&&e.position&&t.position.fromArray(e.position),e!=null&&e.rotation&&t.quaternion.fromArray(e.rotation))})}getBone(n){var e;return(e=this.humanBones[n])!=null?e:void 0}getBoneNode(n){var e,t;return(t=(e=this.humanBones[n])==null?void 0:e.node)!=null?t:null}},EB=new $,Rhe=new tt,Uhe=new $,ON=class hG extends ZC{static _setupTransforms(e){const t=new Ft;t.name="VRMHumanoidRig";const r={},i={},s={};bB.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const A=new $,u=new tt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(A,u,EB),r[a]=A,i[a]=c.quaternion.clone();const f=new tt;(l=c.parent)==null||l.matrixWorld.decompose(EB,f,EB),s[a]=f}});const o={};return bB.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const A=r[a];let u=a,f;for(;f==null&&(u=Ihe[u],u!=null);)f=r[u];const h=new Ft;h.name="Normalized_"+c.name,(u?(l=o[u])==null?void 0:l.node:t).add(h),h.position.copy(A),f&&h.position.sub(f),o[a]={node:h}}}),{rigBones:o,root:t,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:t,root:r,parentWorldRotations:i,boneRotations:s}=hG._setupTransforms(e);super(t),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){bB.forEach(e=>{const t=this.original.getBoneNode(e);if(t!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=Rhe.copy(i).invert(),o=this._boneRotations[e];if(t.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(o),e==="hips"){const a=r.getWorldPosition(Uhe);t.parent.updateWorldMatrix(!0,!1);const l=t.parent.matrixWorld,c=a.applyMatrix4(l.invert());t.position.copy(c)}}})}},kN=class dG{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,t){var r;this.autoUpdateHumanBones=(r=t==null?void 0:t.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new ZC(e),this._normalizedHumanBones=new ON(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new ZC(e.humanBones),this._normalizedHumanBones=new ON(this._rawHumanBones),this}clone(){return new dG(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},Fhe={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},Phe=new Set(["1.0","1.0-beta"]),HN={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},Lhe=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(n){return Yt(this,null,function*(){n.userData.vrmHumanoid=yield this._import(n)})}_import(n){return Yt(this,null,function*(){const e=yield this._v1Import(n);if(e)return e;const t=yield this._v0Import(n);return t||null})}_v1Import(n){return Yt(this,null,function*(){var e,t;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(t=r.extensions)==null?void 0:t.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!Phe.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,c={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(u=>Yt(this,[u],function*([f,h]){let d=f;const m=h.node;if(l){const p=HN[d];p!=null&&(d=p)}const g=yield this.parser.getDependency("node",m);if(g==null){console.warn(`A glTF node bound to the humanoid bone ${d} (index = ${m}) does not exist`);return}c[d]={node:g}}))));const A=new kN(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(A.normalizedHumanBonesRoot),this.helperRoot){const u=new NN(A);this.helperRoot.add(u),u.renderOrder=this.helperRoot.renderOrder}return A})}_v0Import(n){return Yt(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>Yt(this,null,function*(){const l=a.bone,c=a.node;if(l==null||c==null)return;const A=yield this.parser.getDependency("node",c);if(A==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const u=HN[l],f=u??l;if(s[f]!=null){console.warn(`Multiple bone entries for ${f} detected (index = ${c}), ignoring duplicated entries.`);return}s[f]={node:A}}))));const o=new kN(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new NN(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(n){const e=Object.values(Fhe).filter(t=>n[t]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return n}},QN=class extends Zt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new lt(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(3*63),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,n=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let n=0;n<64;n++){const e=n/63*this._currentTheta;this._attrPos.setXYZ(n+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<63;n++)this._attrIndex.setXYZ(n*3,0,n+1,n+2);this._attrIndex.needsUpdate=!0}},Dhe=class extends Zt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new $,this._currentTail=new $,this._attrPos=new lt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},hy=new tt,zN=new tt,Vp=new $,GN=new $,VN=Math.sqrt(2)/2,Nhe=new tt(0,0,-VN,VN),Ohe=new $(0,1,0),khe=class extends ni{constructor(n){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=n;{const e=new QN;e.radius=.5;const t=new Zi({color:65280,transparent:!0,opacity:.5,side:wi,depthTest:!1,depthWrite:!1});this._meshPitch=new hn(e,t),this.add(this._meshPitch)}{const e=new QN;e.radius=.5;const t=new Zi({color:16711680,transparent:!0,opacity:.5,side:wi,depthTest:!1,depthWrite:!1});this._meshYaw=new hn(e,t),this.add(this._meshYaw)}{const e=new Dhe;e.radius=.1;const t=new lc({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new g0(e,t),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(n){const e=Et.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const t=Et.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=t,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(Vp),this.vrmLookAt.getLookAtWorldQuaternion(hy),hy.multiply(this.vrmLookAt.getFaceFrontQuaternion(zN)),this._meshYaw.position.copy(Vp),this._meshYaw.quaternion.copy(hy),this._meshPitch.position.copy(Vp),this._meshPitch.quaternion.copy(hy),this._meshPitch.quaternion.multiply(zN.setFromAxisAngle(Ohe,e)),this._meshPitch.quaternion.multiply(Nhe);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(GN).sub(Vp),this._lineTarget.geometry.tail.copy(GN),this._lineTarget.geometry.update(),this._lineTarget.position.copy(Vp)),super.updateMatrixWorld(n)}},Hhe=new $,Qhe=new $;function qC(n,e){return n.matrixWorld.decompose(Hhe,e,Qhe),e}function Cw(n){return[Math.atan2(-n.z,n.x),Math.atan2(n.y,Math.sqrt(n.x*n.x+n.z*n.z))]}function jN(n){const e=Math.round(n/2/Math.PI);return n-2*Math.PI*e}var WN=new $(0,0,1),zhe=new $,Ghe=new $,Vhe=new $,jhe=new tt,BB=new tt,KN=new tt,Whe=new tt,SB=new tr,pG=class mG{constructor(e,t){this.offsetFromHeadBone=new $,this.autoUpdate=!0,this.faceFront=new $(0,0,1),this.humanoid=e,this.applier=t,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new tt)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new tr)}getEuler(e){return e.set(Et.DEG2RAD*this._pitch,Et.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new mG(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const t=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(t.matrixWorld)}getLookAtWorldQuaternion(e){const t=this.humanoid.getRawBoneNode("head");return qC(t,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(WN)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,r]=Cw(this.faceFront);return SB.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(SB).premultiply(Whe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(BB),this.getFaceFrontQuaternion(KN),e.copy(WN).applyQuaternion(BB).applyQuaternion(KN).applyEuler(this.getEuler(SB))}lookAt(e){const t=jhe.copy(this._restHeadWorldQuaternion).multiply(fG(this.getLookAtWorldQuaternion(BB))),r=this.getLookAtWorldPosition(Ghe),i=Vhe.copy(e).sub(r).applyQuaternion(t).normalize(),[s,o]=Cw(this.faceFront),[a,l]=Cw(i),c=jN(a-s),A=jN(o-l);this._yaw=Et.RAD2DEG*c,this._pitch=Et.RAD2DEG*A,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(zhe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};pG.EULER_ORDER="YXZ";var Khe=pG,Xhe=new $(0,0,1),da=new tt,Cf=new tt,Ys=new tr(0,0,0,"YXZ"),Tw=class{constructor(n,e,t,r,i){this.humanoid=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new $(0,0,1),this._restQuatLeftEye=new tt,this._restQuatRightEye=new tt,this._restLeftEyeParentWorldQuat=new tt,this._restRightEyeParentWorldQuat=new tt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),qC(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),qC(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(n,e){const t=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");t&&(e<0?Ys.x=-Et.DEG2RAD*this.rangeMapVerticalDown.map(-e):Ys.x=Et.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?Ys.y=-Et.DEG2RAD*this.rangeMapHorizontalInner.map(-n):Ys.y=Et.DEG2RAD*this.rangeMapHorizontalOuter.map(n),da.setFromEuler(Ys),this._getWorldFaceFrontQuat(Cf),i.quaternion.copy(Cf).multiply(da).multiply(Cf.invert()),da.copy(this._restLeftEyeParentWorldQuat),t.quaternion.copy(i.quaternion).multiply(da).premultiply(da.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?Ys.x=-Et.DEG2RAD*this.rangeMapVerticalDown.map(-e):Ys.x=Et.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?Ys.y=-Et.DEG2RAD*this.rangeMapHorizontalOuter.map(-n):Ys.y=Et.DEG2RAD*this.rangeMapHorizontalInner.map(n),da.setFromEuler(Ys),this._getWorldFaceFrontQuat(Cf),s.quaternion.copy(Cf).multiply(da).multiply(Cf.invert()),da.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(da).premultiply(da.invert()).multiply(this._restQuatRightEye))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Et.RAD2DEG*n.y,t=Et.RAD2DEG*n.x;this.applyYawPitch(e,t)}_getWorldFaceFrontQuat(n){if(this.faceFront.distanceToSquared(Xhe)<.01)return n.identity();const[e,t]=Cw(this.faceFront);return Ys.set(0,.5*Math.PI+e,t,"YZX"),n.setFromEuler(Ys)}};Tw.type="bone";var JC=class{constructor(n,e,t,r,i){this.expressions=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(n,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),n<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-n))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(n)))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Et.RAD2DEG*n.y,t=Et.RAD2DEG*n.x;this.applyYawPitch(e,t)}};JC.type="expression";var XN=class{constructor(n,e){this.inputMaxValue=n,this.outputScale=e}map(n){return this.outputScale*iG(n/this.inputMaxValue)}},Yhe=new Set(["1.0","1.0-beta"]),dy=.01,$he=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(n){return Yt(this,null,function*(){const e=n.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const t=n.userData.vrmExpressionManager;if(t!==null){if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");n.userData.vrmLookAt=yield this._import(n,e,t)}})}_import(n,e,t){return Yt(this,null,function*(){if(e==null||t==null)return null;const r=yield this._v1Import(n,e,t);if(r)return r;const i=yield this._v0Import(n,e,t);return i||null})}_v1Import(n,e,t){return Yt(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!Yhe.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const A=l.lookAt;if(!A)return null;const u=A.type==="expression"?1:10,f=this._v1ImportRangeMap(A.rangeMapHorizontalInner,u),h=this._v1ImportRangeMap(A.rangeMapHorizontalOuter,u),d=this._v1ImportRangeMap(A.rangeMapVerticalDown,u),m=this._v1ImportRangeMap(A.rangeMapVerticalUp,u);let g;A.type==="expression"?g=new JC(t,f,h,d,m):g=new Tw(e,f,h,d,m);const p=this._importLookAt(e,g);return p.offsetFromHeadBone.fromArray((s=A.offsetFromHeadBone)!=null?s:[0,.06,0]),p})}_v1ImportRangeMap(n,e){var t,r;let i=(t=n==null?void 0:n.inputMaxValue)!=null?t:90;const s=(r=n==null?void 0:n.outputScale)!=null?r:e;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},ede=class{constructor(n){this.scene=n.scene,this.meta=n.meta,this.humanoid=n.humanoid,this.expressionManager=n.expressionManager,this.firstPerson=n.firstPerson,this.lookAt=n.lookAt}update(n){this.humanoid.update(),this.lookAt&&this.lookAt.update(n),this.expressionManager&&this.expressionManager.update()}},tde=class extends ede{constructor(n){super(n),this.materials=n.materials,this.springBoneManager=n.springBoneManager,this.nodeConstraintManager=n.nodeConstraintManager}update(n){super.update(n),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(n),this.materials&&this.materials.forEach(e=>{e.update&&e.update(n)})}},nde=Object.defineProperty,YN=Object.getOwnPropertySymbols,rde=Object.prototype.hasOwnProperty,ide=Object.prototype.propertyIsEnumerable,$N=(n,e,t)=>e in n?nde(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ZN=(n,e)=>{for(var t in e||(e={}))rde.call(e,t)&&$N(n,t,e[t]);if(YN)for(var t of YN(e))ide.call(e,t)&&$N(n,t,e[t]);return n},uu=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),sde={"":3e3,srgb:3001};function ode(n,e){parseInt(Jl,10)>=152?n.colorSpace=e:n.encoding=sde[e]}var ade=class{get pending(){return Promise.all(this._pendings)}constructor(n,e){this._parser=n,this._materialParams=e,this._pendings=[]}assignPrimitive(n,e){e!=null&&(this._materialParams[n]=e)}assignColor(n,e,t){e!=null&&(this._materialParams[n]=new He().fromArray(e),t&&this._materialParams[n].convertSRGBToLinear())}assignTexture(n,e,t){return uu(this,null,function*(){const r=(()=>uu(this,null,function*(){e!=null&&(yield this._parser.assignTexture(this._materialParams,n,e),t&&ode(this._materialParams[n],"srgb"))}))();return this._pendings.push(r),r})}assignTextureByIndex(n,e,t){return uu(this,null,function*(){return this.assignTexture(n,e!=null?{index:e}:void 0,t)})}},lde=`// #define PHONG + */var py=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Yt=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),X_=class extends Ft{constructor(n){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${n}`,this.expressionName=n,this.type="VRMExpression",this.visible=!1}get overrideBlinkAmount(){return this.overrideBlink==="block"?0.5?1:0:this.weight}addBind(n){this._binds.push(n)}applyWeight(n){var e;let t=this.outputWeight;t*=(e=n==null?void 0:n.multiplier)!=null?e:1,this.isBinary&&t<1&&(t=0),this._binds.forEach(r=>r.applyWeight(t))}clearAppliedWeight(){this._binds.forEach(n=>n.clearAppliedWeight())}};function sG(n,e,t){var r,i;const s=n.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const c=l.primitives.length,A=[];return t.traverse(u=>{A.length{const s=sG(n,i,r);s!=null&&t.set(i,s)}),t})}var ni={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function oG(n){return Math.max(Math.min(n,1),0)}var Y_=class aG{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},t=new Set(Object.values(ni));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},t=new Set(Object.values(ni));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)||(e[r]=i)}),e}copy(e){return this._expressions.concat().forEach(r=>{this.unregisterExpression(r)}),e._expressions.forEach(r=>{this.registerExpression(r)}),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return new aG().copy(this)}getExpression(e){var t;return(t=this._expressionMap[e])!=null?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const t=this._expressions.indexOf(e);t===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var t;const r=this.getExpression(e);return(t=r==null?void 0:r.weight)!=null?t:null}setValue(e,t){const r=this.getExpression(e);r&&(r.weight=oG(t))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const t=this.getExpression(e);return t?`${t.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(t=>{t.clearAppliedWeight()}),this._expressions.forEach(t=>{let r=1;const i=t.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),t.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,t=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,t-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),t=Math.max(0,t),r=Math.max(0,r),{blink:e,lookAt:t,mouth:r}}},Vp={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},The={_Color:Vp.Color,_EmissionColor:Vp.EmissionColor,_ShadeColor:Vp.ShadeColor,_RimColor:Vp.RimColor,_OutlineColor:Vp.OutlineColor},Ihe=new He,lG=class cG{constructor({material:e,type:t,targetValue:r,targetAlpha:i}){this.material=e,this.type=t,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:t,alpha:r}=this._state;if(t!=null){const{propertyName:i,deltaValue:s}=t,o=this.material[i];o!=null&&o.add(Ihe.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:t}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(t!=null){const{propertyName:r,initialValue:i}=t;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,t,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?t:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const A=i[l].clone(),u=new He(o.r-A.r,o.g-A.g,o.b-A.b);return{propertyName:l,initialValue:A,deltaValue:u}}_initAlphaBindState(){var e,t,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?t:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const c=i[l],A=o-c;return{propertyName:l,initialValue:c,deltaValue:A}}_getPropertyNameMap(){var e,t;return(t=(e=Object.entries(cG._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?t:null}};lG._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var FN=lG,JC=class{constructor({primitives:n,index:e,weight:t}){this.primitives=n,this.index=e,this.weight=t}applyWeight(n){this.primitives.forEach(e=>{var t;((t=e.morphTargetInfluences)==null?void 0:t[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*n)})}clearAppliedWeight(){this.primitives.forEach(n=>{var e;((e=n.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(n.morphTargetInfluences[this.index]=0)})}},PN=new je,AG=class uG{constructor({material:e,scale:t,offset:r}){var i,s;this.material=e,this.scale=t,this.offset=r;const o=(i=Object.entries(uG._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const c=(l=e[a])==null?void 0:l.clone();if(!c)return null;e[a]=c;const A=c.offset.clone(),u=c.repeat.clone(),f=r.clone().sub(A),h=t.clone().sub(u);this._properties.push({name:a,initialOffset:A,deltaOffset:f,initialScale:u,deltaScale:h})}))}applyWeight(e){this._properties.forEach(t=>{const r=this.material[t.name];r!==void 0&&(r.offset.add(PN.copy(t.deltaOffset).multiplyScalar(e)),r.repeat.add(PN.copy(t.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const t=this.material[e.name];t!==void 0&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale))})}};AG._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var LN=AG,Rhe=new Set(["1.0","1.0-beta"]),fG=class hG{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return Yt(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return Yt(this,null,function*(){const t=yield this._v1Import(e);if(t)return t;const r=yield this._v0Import(e);return r||null})}_v1Import(e){return Yt(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Rhe.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const c=new Set(Object.values(ni)),A=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([f,h])=>{if(h!=null){if(!c.has(f)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${f}" detected. Ignoring the expression`);return}A.set(f,h)}}),l.custom!=null&&Object.entries(l.custom).forEach(([f,h])=>{if(c.has(f)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${f}". Ignoring the expression`);return}A.set(f,h)});const u=new Y_;return yield Promise.all(Array.from(A.entries()).map(f=>Yt(this,[f],function*([h,d]){var m,g,p,v,w,_,x;const b=new X_(h);if(e.scene.add(b),b.isBinary=(m=d.isBinary)!=null?m:!1,b.overrideBlink=(g=d.overrideBlink)!=null?g:"none",b.overrideLookAt=(p=d.overrideLookAt)!=null?p:"none",b.overrideMouth=(v=d.overrideMouth)!=null?v:"none",(w=d.morphTargetBinds)==null||w.forEach(B=>Yt(this,null,function*(){var S;if(B.node===void 0||B.index===void 0)return;const I=yield RN(e,B.node),M=B.index;if(!I.every(P=>Array.isArray(P.morphTargetInfluences)&&M{const I=S.material;I&&B.push(I)}),(_=d.materialColorBinds)==null||_.forEach(S=>Yt(this,null,function*(){B.filter(M=>{var P;const D=(P=this.parser.associations.get(M))==null?void 0:P.materials;return S.material===D}).forEach(M=>{b.addBind(new FN({material:M,type:S.type,targetValue:new He().fromArray(S.targetValue),targetAlpha:S.targetValue[3]}))})})),(x=d.textureTransformBinds)==null||x.forEach(S=>Yt(this,null,function*(){B.filter(M=>{var P;const D=(P=this.parser.associations.get(M))==null?void 0:P.materials;return S.material===D}).forEach(M=>{var P,D;b.addBind(new LN({material:M,offset:new je().fromArray((P=S.offset)!=null?P:[0,0]),scale:new je().fromArray((D=S.scale)!=null?D:[1,1])}))})}))}u.registerExpression(b)}))),u})}_v0Import(e){return Yt(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new Y_,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(c=>Yt(this,null,function*(){var A;const u=c.presetName,f=u!=null&&hG.v0v1PresetNameMap[u]||null,h=f??c.name;if(h==null){console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");return}if(l.has(h)){console.warn(`VRMExpressionLoaderPlugin: An expression preset ${u} has duplicated entries. Ignoring the expression`);return}l.add(h);const d=new X_(h);e.scene.add(d),d.isBinary=(A=c.isBinary)!=null?A:!1,c.binds&&c.binds.forEach(g=>Yt(this,null,function*(){var p;if(g.mesh===void 0||g.index===void 0)return;const v=[];(p=r.nodes)==null||p.forEach((_,x)=>{_.mesh===g.mesh&&v.push(x)});const w=g.index;yield Promise.all(v.map(_=>Yt(this,null,function*(){var x;const b=yield RN(e,_);if(!b.every(B=>Array.isArray(B.morphTargetInfluences)&&w{if(g.materialName===void 0||g.propertyName===void 0||g.targetValue===void 0)return;const p=[];e.scene.traverse(w=>{if(w.material){const _=w.material;Array.isArray(_)?p.push(..._.filter(x=>(x.name===g.materialName||x.name===g.materialName+" (Outline)")&&p.indexOf(x)===-1)):_.name===g.materialName&&p.indexOf(_)===-1&&p.push(_)}});const v=g.propertyName;p.forEach(w=>{if(v==="_MainTex_ST"){const x=new je(g.targetValue[0],g.targetValue[1]),b=new je(g.targetValue[2],g.targetValue[3]);b.y=1-b.y-x.y,d.addBind(new LN({material:w,scale:x,offset:b}));return}const _=The[v];if(_){d.addBind(new FN({material:w,type:_,targetValue:new He().fromArray(g.targetValue),targetAlpha:g.targetValue[3]}));return}console.warn(v+" is not supported")})}),o.registerExpression(d)}))),o})}};fG.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var Uhe=fG,i2=class Xf{constructor(e,t){this._firstPersonOnlyLayer=Xf.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Xf.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=t}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map(t=>({meshes:t.meshes.concat(),type:t.type})),this}clone(){return new Xf(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Xf.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=Xf.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=t,this.meshAnnotations.forEach(r=>{r.meshes.forEach(i=>{r.type==="firstPersonOnly"?(i.layers.set(this._firstPersonOnlyLayer),i.traverse(s=>s.layers.set(this._firstPersonOnlyLayer))):r.type==="thirdPersonOnly"?(i.layers.set(this._thirdPersonOnlyLayer),i.traverse(s=>s.layers.set(this._thirdPersonOnlyLayer))):r.type==="auto"&&this._createHeadlessModel(i)})}),this._initializedLayers=!0)}_excludeTriangles(e,t,r,i){let s=0;if(t!=null&&t.length>0)for(let o=0;o0&&i.includes(u[0])||A[1]>0&&i.includes(u[1])||A[2]>0&&i.includes(u[2])||A[3]>0&&i.includes(u[3]))continue;const f=t[l],h=r[l];if(f[0]>0&&i.includes(h[0])||f[1]>0&&i.includes(h[1])||f[2]>0&&i.includes(h[2])||f[3]>0&&i.includes(h[3]))continue;const d=t[c],m=r[c];d[0]>0&&i.includes(m[0])||d[1]>0&&i.includes(m[1])||d[2]>0&&i.includes(m[2])||d[3]>0&&i.includes(m[3])||(e[s++]=a,e[s++]=l,e[s++]=c)}return s}_createErasedMesh(e,t){const r=new ja(e.geometry.clone(),e.material);r.name=`${e.name}(erase)`,r.frustumCulled=e.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const i=r.geometry,s=i.getAttribute("skinIndex"),o=s instanceof mD?[]:s.array,a=[];for(let m=0;m{this._isEraseTarget(s)&&r.push(o)}),!r.length){t.layers.enable(this._thirdPersonOnlyLayer),t.layers.enable(this._firstPersonOnlyLayer);return}t.layers.set(this._thirdPersonOnlyLayer);const i=this._createErasedMesh(t,r);e.add(i)}_createHeadlessModel(e){if(e.type==="Group")if(e.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(e))e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer));else{const t=new ri;t.name=`_headless_${e.name}`,t.layers.set(this._firstPersonOnlyLayer),e.parent.add(t),e.children.filter(r=>r.type==="SkinnedMesh").forEach(r=>{const i=r;this._createHeadlessModelForSkinnedMesh(t,i)})}else if(e.type==="SkinnedMesh"){const t=e;this._createHeadlessModelForSkinnedMesh(e.parent,t)}else this._isEraseTarget(e)&&(e.layers.set(this._thirdPersonOnlyLayer),e.traverse(t=>t.layers.set(this._thirdPersonOnlyLayer)))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")?!0:e.parent?this._isEraseTarget(e.parent):!1}};i2.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;i2.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var DN=i2,Fhe=new Set(["1.0","1.0-beta"]),Phe=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(n){this.parser=n}afterRoot(n){return Yt(this,null,function*(){const e=n.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");n.userData.vrmFirstPerson=yield this._import(n,e)}})}_import(n,e){return Yt(this,null,function*(){if(e==null)return null;const t=yield this._v1Import(n,e);if(t)return t;const r=yield this._v0Import(n,e);return r||null})}_v1Import(n,e){return Yt(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Fhe.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson;if(!l)return null;const c=[],A=yield UN(n);return Array.from(A.entries()).forEach(([u,f])=>{var h;const d=l.meshAnnotations?l.meshAnnotations.find(m=>m.node===u):void 0;c.push({meshes:f,type:(h=d==null?void 0:d.type)!=null?h:"both"})}),new DN(e,c)})}_v0Import(n,e){return Yt(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield UN(n);return Array.from(a.entries()).forEach(([l,c])=>{const A=r.nodes[l],u=s.meshAnnotations?s.meshAnnotations.find(f=>f.mesh===A.mesh):void 0;o.push({meshes:c,type:this._convertV0FlagToV1Type(u==null?void 0:u.firstPersonFlag)})}),new DN(e,o)})}_convertV0FlagToV1Type(n){return n==="FirstPersonOnly"?"firstPersonOnly":n==="ThirdPersonOnly"?"thirdPersonOnly":n==="Auto"?"auto":"both"}},NN=new $,ON=new $,Lhe=new tt,kN=class extends ri{constructor(n){super(),this.vrmHumanoid=n,this._boneAxesMap=new Map,Object.values(n.humanBones).forEach(e=>{const t=new woe(1);t.matrixAutoUpdate=!1,t.material.depthTest=!1,t.material.depthWrite=!1,this.add(t),this._boneAxesMap.set(e,t)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(n=>{n.geometry.dispose(),n.material.dispose()})}updateMatrixWorld(n){Array.from(this._boneAxesMap.entries()).forEach(([e,t])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(NN,Lhe,ON);const r=NN.set(.1,.1,.1).divide(ON);t.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(n)}},SB=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],Zg={Hips:"hips",Spine:"spine",Chest:"chest",UpperChest:"upperChest",Neck:"neck",Head:"head",LeftEye:"leftEye",RightEye:"rightEye",Jaw:"jaw",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",LeftToes:"leftToes",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",RightToes:"rightToes",LeftShoulder:"leftShoulder",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightShoulder:"rightShoulder",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand",LeftThumbMetacarpal:"leftThumbMetacarpal",LeftThumbProximal:"leftThumbProximal",LeftThumbDistal:"leftThumbDistal",LeftIndexProximal:"leftIndexProximal",LeftIndexIntermediate:"leftIndexIntermediate",LeftIndexDistal:"leftIndexDistal",LeftMiddleProximal:"leftMiddleProximal",LeftMiddleIntermediate:"leftMiddleIntermediate",LeftMiddleDistal:"leftMiddleDistal",LeftRingProximal:"leftRingProximal",LeftRingIntermediate:"leftRingIntermediate",LeftRingDistal:"leftRingDistal",LeftLittleProximal:"leftLittleProximal",LeftLittleIntermediate:"leftLittleIntermediate",LeftLittleDistal:"leftLittleDistal",RightThumbMetacarpal:"rightThumbMetacarpal",RightThumbProximal:"rightThumbProximal",RightThumbDistal:"rightThumbDistal",RightIndexProximal:"rightIndexProximal",RightIndexIntermediate:"rightIndexIntermediate",RightIndexDistal:"rightIndexDistal",RightMiddleProximal:"rightMiddleProximal",RightMiddleIntermediate:"rightMiddleIntermediate",RightMiddleDistal:"rightMiddleDistal",RightRingProximal:"rightRingProximal",RightRingIntermediate:"rightRingIntermediate",RightRingDistal:"rightRingDistal",RightLittleProximal:"rightLittleProximal",RightLittleIntermediate:"rightLittleIntermediate",RightLittleDistal:"rightLittleDistal"},Dhe={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"upperChest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"upperChest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function dG(n){return n.invert?n.invert():n.inverse(),n}var jA=new $,WA=new tt,eT=class{constructor(n){this.humanBones=n,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);r&&(jA.copy(r.position),WA.copy(r.quaternion),n[t]={position:jA.toArray(),rotation:WA.toArray()})}),n}getPose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);if(!r)return;jA.set(0,0,0),WA.identity();const i=this.restPose[t];i!=null&&i.position&&jA.fromArray(i.position).negate(),i!=null&&i.rotation&&dG(WA.fromArray(i.rotation)),jA.add(r.position),WA.premultiply(r.quaternion),n[t]={position:jA.toArray(),rotation:WA.toArray()}}),n}setPose(n){Object.entries(n).forEach(([e,t])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(t!=null&&t.position&&(i.position.fromArray(t.position),s.position&&i.position.add(jA.fromArray(s.position))),t!=null&&t.rotation&&(i.quaternion.fromArray(t.rotation),s.rotation&&i.quaternion.multiply(WA.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([n,e])=>{const t=this.getBoneNode(n);t&&(e!=null&&e.position&&t.position.fromArray(e.position),e!=null&&e.rotation&&t.quaternion.fromArray(e.rotation))})}getBone(n){var e;return(e=this.humanBones[n])!=null?e:void 0}getBoneNode(n){var e,t;return(t=(e=this.humanBones[n])==null?void 0:e.node)!=null?t:null}},MB=new $,Nhe=new tt,Ohe=new $,HN=class pG extends eT{static _setupTransforms(e){const t=new Ft;t.name="VRMHumanoidRig";const r={},i={},s={};SB.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const A=new $,u=new tt;c.updateWorldMatrix(!0,!1),c.matrixWorld.decompose(A,u,MB),r[a]=A,i[a]=c.quaternion.clone();const f=new tt;(l=c.parent)==null||l.matrixWorld.decompose(MB,f,MB),s[a]=f}});const o={};return SB.forEach(a=>{var l;const c=e.getBoneNode(a);if(c){const A=r[a];let u=a,f;for(;f==null&&(u=Dhe[u],u!=null);)f=r[u];const h=new Ft;h.name="Normalized_"+c.name,(u?(l=o[u])==null?void 0:l.node:t).add(h),h.position.copy(A),f&&h.position.sub(f),o[a]={node:h}}}),{rigBones:o,root:t,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:t,root:r,parentWorldRotations:i,boneRotations:s}=pG._setupTransforms(e);super(t),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){SB.forEach(e=>{const t=this.original.getBoneNode(e);if(t!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=Nhe.copy(i).invert(),o=this._boneRotations[e];if(t.quaternion.copy(r.quaternion).multiply(i).premultiply(s).multiply(o),e==="hips"){const a=r.getWorldPosition(Ohe);t.parent.updateWorldMatrix(!0,!1);const l=t.parent.matrixWorld,c=a.applyMatrix4(l.invert());t.position.copy(c)}}})}},QN=class mG{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,t){var r;this.autoUpdateHumanBones=(r=t==null?void 0:t.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new eT(e),this._normalizedHumanBones=new HN(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new eT(e.humanBones),this._normalizedHumanBones=new HN(this._rawHumanBones),this}clone(){return new mG(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._normalizedHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}},khe={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},Hhe=new Set(["1.0","1.0-beta"]),zN={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},Qhe=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(n){return Yt(this,null,function*(){n.userData.vrmHumanoid=yield this._import(n)})}_import(n){return Yt(this,null,function*(){const e=yield this._v1Import(n);if(e)return e;const t=yield this._v0Import(n);return t||null})}_v1Import(n){return Yt(this,null,function*(){var e,t;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(t=r.extensions)==null?void 0:t.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!Hhe.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,c={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(u=>Yt(this,[u],function*([f,h]){let d=f;const m=h.node;if(l){const p=zN[d];p!=null&&(d=p)}const g=yield this.parser.getDependency("node",m);if(g==null){console.warn(`A glTF node bound to the humanoid bone ${d} (index = ${m}) does not exist`);return}c[d]={node:g}}))));const A=new QN(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(A.normalizedHumanBonesRoot),this.helperRoot){const u=new kN(A);this.helperRoot.add(u),u.renderOrder=this.helperRoot.renderOrder}return A})}_v0Import(n){return Yt(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>Yt(this,null,function*(){const l=a.bone,c=a.node;if(l==null||c==null)return;const A=yield this.parser.getDependency("node",c);if(A==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${c}) does not exist`);return}const u=zN[l],f=u??l;if(s[f]!=null){console.warn(`Multiple bone entries for ${f} detected (index = ${c}), ignoring duplicated entries.`);return}s[f]={node:A}}))));const o=new QN(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new kN(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(n){const e=Object.values(khe).filter(t=>n[t]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return n}},GN=class extends Zt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new lt(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(3*63),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,n=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let n=0;n<64;n++){const e=n/63*this._currentTheta;this._attrPos.setXYZ(n+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<63;n++)this._attrIndex.setXYZ(n*3,0,n+1,n+2);this._attrIndex.needsUpdate=!0}},zhe=class extends Zt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new $,this._currentTail=new $,this._attrPos=new lt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},my=new tt,VN=new tt,jp=new $,jN=new $,WN=Math.sqrt(2)/2,Ghe=new tt(0,0,-WN,WN),Vhe=new $(0,1,0),jhe=class extends ri{constructor(n){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=n;{const e=new GN;e.radius=.5;const t=new qi({color:65280,transparent:!0,opacity:.5,side:_i,depthTest:!1,depthWrite:!1});this._meshPitch=new hn(e,t),this.add(this._meshPitch)}{const e=new GN;e.radius=.5;const t=new qi({color:16711680,transparent:!0,opacity:.5,side:_i,depthTest:!1,depthWrite:!1});this._meshYaw=new hn(e,t),this.add(this._meshYaw)}{const e=new zhe;e.radius=.1;const t=new Ac({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new y0(e,t),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(n){const e=Et.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const t=Et.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=t,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(jp),this.vrmLookAt.getLookAtWorldQuaternion(my),my.multiply(this.vrmLookAt.getFaceFrontQuaternion(VN)),this._meshYaw.position.copy(jp),this._meshYaw.quaternion.copy(my),this._meshPitch.position.copy(jp),this._meshPitch.quaternion.copy(my),this._meshPitch.quaternion.multiply(VN.setFromAxisAngle(Vhe,e)),this._meshPitch.quaternion.multiply(Ghe);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(jN).sub(jp),this._lineTarget.geometry.tail.copy(jN),this._lineTarget.geometry.update(),this._lineTarget.position.copy(jp)),super.updateMatrixWorld(n)}},Whe=new $,Khe=new $;function tT(n,e){return n.matrixWorld.decompose(Whe,e,Khe),e}function Rw(n){return[Math.atan2(-n.z,n.x),Math.atan2(n.y,Math.sqrt(n.x*n.x+n.z*n.z))]}function KN(n){const e=Math.round(n/2/Math.PI);return n-2*Math.PI*e}var XN=new $(0,0,1),Xhe=new $,Yhe=new $,$he=new $,Zhe=new tt,CB=new tt,YN=new tt,qhe=new tt,TB=new tr,gG=class vG{constructor(e,t){this.offsetFromHeadBone=new $,this.autoUpdate=!0,this.faceFront=new $(0,0,1),this.humanoid=e,this.applier=t,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new tt)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new tr)}getEuler(e){return e.set(Et.DEG2RAD*this._pitch,Et.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new vG(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const t=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(t.matrixWorld)}getLookAtWorldQuaternion(e){const t=this.humanoid.getRawBoneNode("head");return tT(t,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(XN)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,r]=Rw(this.faceFront);return TB.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(TB).premultiply(qhe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(CB),this.getFaceFrontQuaternion(YN),e.copy(XN).applyQuaternion(CB).applyQuaternion(YN).applyEuler(this.getEuler(TB))}lookAt(e){const t=Zhe.copy(this._restHeadWorldQuaternion).multiply(dG(this.getLookAtWorldQuaternion(CB))),r=this.getLookAtWorldPosition(Yhe),i=$he.copy(e).sub(r).applyQuaternion(t).normalize(),[s,o]=Rw(this.faceFront),[a,l]=Rw(i),c=KN(a-s),A=KN(o-l);this._yaw=Et.RAD2DEG*c,this._pitch=Et.RAD2DEG*A,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(Xhe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};gG.EULER_ORDER="YXZ";var Jhe=gG,ede=new $(0,0,1),pa=new tt,Rf=new tt,$s=new tr(0,0,0,"YXZ"),Uw=class{constructor(n,e,t,r,i){this.humanoid=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new $(0,0,1),this._restQuatLeftEye=new tt,this._restQuatRightEye=new tt,this._restLeftEyeParentWorldQuat=new tt,this._restRightEyeParentWorldQuat=new tt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),tT(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),tT(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(n,e){const t=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");t&&(e<0?$s.x=-Et.DEG2RAD*this.rangeMapVerticalDown.map(-e):$s.x=Et.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?$s.y=-Et.DEG2RAD*this.rangeMapHorizontalInner.map(-n):$s.y=Et.DEG2RAD*this.rangeMapHorizontalOuter.map(n),pa.setFromEuler($s),this._getWorldFaceFrontQuat(Rf),i.quaternion.copy(Rf).multiply(pa).multiply(Rf.invert()),pa.copy(this._restLeftEyeParentWorldQuat),t.quaternion.copy(i.quaternion).multiply(pa).premultiply(pa.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?$s.x=-Et.DEG2RAD*this.rangeMapVerticalDown.map(-e):$s.x=Et.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?$s.y=-Et.DEG2RAD*this.rangeMapHorizontalOuter.map(-n):$s.y=Et.DEG2RAD*this.rangeMapHorizontalInner.map(n),pa.setFromEuler($s),this._getWorldFaceFrontQuat(Rf),s.quaternion.copy(Rf).multiply(pa).multiply(Rf.invert()),pa.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(pa).premultiply(pa.invert()).multiply(this._restQuatRightEye))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Et.RAD2DEG*n.y,t=Et.RAD2DEG*n.x;this.applyYawPitch(e,t)}_getWorldFaceFrontQuat(n){if(this.faceFront.distanceToSquared(ede)<.01)return n.identity();const[e,t]=Rw(this.faceFront);return $s.set(0,.5*Math.PI+e,t,"YZX"),n.setFromEuler($s)}};Uw.type="bone";var nT=class{constructor(n,e,t,r,i){this.expressions=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(n,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),n<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-n))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(n)))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Et.RAD2DEG*n.y,t=Et.RAD2DEG*n.x;this.applyYawPitch(e,t)}};nT.type="expression";var $N=class{constructor(n,e){this.inputMaxValue=n,this.outputScale=e}map(n){return this.outputScale*oG(n/this.inputMaxValue)}},tde=new Set(["1.0","1.0-beta"]),gy=.01,nde=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(n){return Yt(this,null,function*(){const e=n.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const t=n.userData.vrmExpressionManager;if(t!==null){if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");n.userData.vrmLookAt=yield this._import(n,e,t)}})}_import(n,e,t){return Yt(this,null,function*(){if(e==null||t==null)return null;const r=yield this._v1Import(n,e,t);if(r)return r;const i=yield this._v0Import(n,e,t);return i||null})}_v1Import(n,e,t){return Yt(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const c=l.specVersion;if(!tde.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const A=l.lookAt;if(!A)return null;const u=A.type==="expression"?1:10,f=this._v1ImportRangeMap(A.rangeMapHorizontalInner,u),h=this._v1ImportRangeMap(A.rangeMapHorizontalOuter,u),d=this._v1ImportRangeMap(A.rangeMapVerticalDown,u),m=this._v1ImportRangeMap(A.rangeMapVerticalUp,u);let g;A.type==="expression"?g=new nT(t,f,h,d,m):g=new Uw(e,f,h,d,m);const p=this._importLookAt(e,g);return p.offsetFromHeadBone.fromArray((s=A.offsetFromHeadBone)!=null?s:[0,.06,0]),p})}_v1ImportRangeMap(n,e){var t,r;let i=(t=n==null?void 0:n.inputMaxValue)!=null?t:90;const s=(r=n==null?void 0:n.outputScale)!=null?r:e;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},ode=class{constructor(n){this.scene=n.scene,this.meta=n.meta,this.humanoid=n.humanoid,this.expressionManager=n.expressionManager,this.firstPerson=n.firstPerson,this.lookAt=n.lookAt}update(n){this.humanoid.update(),this.lookAt&&this.lookAt.update(n),this.expressionManager&&this.expressionManager.update()}},ade=class extends ode{constructor(n){super(n),this.materials=n.materials,this.springBoneManager=n.springBoneManager,this.nodeConstraintManager=n.nodeConstraintManager}update(n){super.update(n),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(n),this.materials&&this.materials.forEach(e=>{e.update&&e.update(n)})}},lde=Object.defineProperty,ZN=Object.getOwnPropertySymbols,cde=Object.prototype.hasOwnProperty,Ade=Object.prototype.propertyIsEnumerable,qN=(n,e,t)=>e in n?lde(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,JN=(n,e)=>{for(var t in e||(e={}))cde.call(e,t)&&qN(n,t,e[t]);if(ZN)for(var t of ZN(e))Ade.call(e,t)&&qN(n,t,e[t]);return n},hu=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),ude={"":3e3,srgb:3001};function fde(n,e){parseInt(nc,10)>=152?n.colorSpace=e:n.encoding=ude[e]}var hde=class{get pending(){return Promise.all(this._pendings)}constructor(n,e){this._parser=n,this._materialParams=e,this._pendings=[]}assignPrimitive(n,e){e!=null&&(this._materialParams[n]=e)}assignColor(n,e,t){e!=null&&(this._materialParams[n]=new He().fromArray(e),t&&this._materialParams[n].convertSRGBToLinear())}assignTexture(n,e,t){return hu(this,null,function*(){const r=(()=>hu(this,null,function*(){e!=null&&(yield this._parser.assignTexture(this._materialParams,n,e),t&&fde(this._materialParams[n],"srgb"))}))();return this._pendings.push(r),r})}assignTextureByIndex(n,e,t){return hu(this,null,function*(){return this.assignTexture(n,e!=null?{index:e}:void 0,t)})}},dde=`// #define PHONG varying vec3 vViewPosition; @@ -4067,7 +4067,7 @@ void main() { #include #include -}`,cde=`// #define PHONG +}`,pde=`// #define PHONG uniform vec3 litFactor; @@ -4869,9 +4869,9 @@ void main() { gl_FragColor = vec4( col, diffuseColor.a ); postCorrection(); } -`,Ade={None:"none",Normal:"normal",LitShadeRate:"litShadeRate",UV:"uv"},qN={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},ude={3e3:"",3001:"srgb"};function MB(n){return parseInt(Jl,10)>=152?n.colorSpace:ude[n.encoding]}var gG=class extends dr{constructor(n={}){var e;super({vertexShader:lde,fragmentShader:cde}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=Wd,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=Ade.None,this._outlineWidthMode=qN.None,this._isOutline=!1,n.transparentWithZWrite&&(n.depthWrite=!0),delete n.transparentWithZWrite,n.fog=!0,n.lights=!0,n.clipping=!0,this.uniforms=FR.merge([ze.common,ze.normalmap,ze.emissivemap,ze.fog,ze.lights,{litFactor:{value:new He(1,1,1)},mapUvTransform:{value:new ut},colorAlpha:{value:1},normalMapUvTransform:{value:new ut},shadeColorFactor:{value:new He(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new ut},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new ut},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new He(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new ut},parametricRimColorFactor:{value:new He(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new ut},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new He(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new ut},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new ut},outlineWidthFactor:{value:0},outlineColorFactor:{value:new He(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new ut},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=n.uniforms)!=null?e:{}]),this.setValues(n),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([t,r])=>`${t}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${MB(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${MB(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${MB(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=t=>{const r=parseInt(Jl,10),i=Object.entries(ZN(ZN({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` +`,mde={None:"none",Normal:"normal",LitShadeRate:"litShadeRate",UV:"uv"},eO={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},gde={3e3:"",3001:"srgb"};function IB(n){return parseInt(nc,10)>=152?n.colorSpace:gde[n.encoding]}var yG=class extends pr{constructor(n={}){var e;super({vertexShader:dde,fragmentShader:pde}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=Kd,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=mde.None,this._outlineWidthMode=eO.None,this._isOutline=!1,n.transparentWithZWrite&&(n.depthWrite=!0),delete n.transparentWithZWrite,n.fog=!0,n.lights=!0,n.clipping=!0,this.uniforms=DR.merge([ze.common,ze.normalmap,ze.emissivemap,ze.fog,ze.lights,{litFactor:{value:new He(1,1,1)},mapUvTransform:{value:new ut},colorAlpha:{value:1},normalMapUvTransform:{value:new ut},shadeColorFactor:{value:new He(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new ut},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new ut},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new He(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new ut},parametricRimColorFactor:{value:new He(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new ut},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new He(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new ut},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new ut},outlineWidthFactor:{value:0},outlineColorFactor:{value:new He(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new ut},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=n.uniforms)!=null?e:{}]),this.setValues(n),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([t,r])=>`${t}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${IB(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${IB(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${IB(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=t=>{const r=parseInt(nc,10),i=Object.entries(JN(JN({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` `)+` -`;t.vertexShader=i+t.vertexShader,t.fragmentShader=i+t.fragmentShader,r<154&&(t.fragmentShader=t.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(n){this.uniforms.litFactor.value=n}get map(){return this.uniforms.map.value}set map(n){this.uniforms.map.value=n}get normalMap(){return this.uniforms.normalMap.value}set normalMap(n){this.uniforms.normalMap.value=n}get normalScale(){return this.uniforms.normalScale.value}set normalScale(n){this.uniforms.normalScale.value=n}get emissive(){return this.uniforms.emissive.value}set emissive(n){this.uniforms.emissive.value=n}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(n){this.uniforms.emissiveIntensity.value=n}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(n){this.uniforms.emissiveMap.value=n}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(n){this.uniforms.shadeColorFactor.value=n}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(n){this.uniforms.shadeMultiplyTexture.value=n}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(n){this.uniforms.shadingShiftFactor.value=n}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(n){this.uniforms.shadingShiftTexture.value=n}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(n){this.uniforms.shadingShiftTextureScale.value=n}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(n){this.uniforms.shadingToonyFactor.value=n}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(n){this.uniforms.giEqualizationFactor.value=n}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(n){this.uniforms.matcapFactor.value=n}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(n){this.uniforms.matcapTexture.value=n}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(n){this.uniforms.parametricRimColorFactor.value=n}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(n){this.uniforms.rimMultiplyTexture.value=n}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(n){this.uniforms.rimLightingMixFactor.value=n}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(n){this.uniforms.parametricRimFresnelPowerFactor.value=n}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(n){this.uniforms.parametricRimLiftFactor.value=n}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(n){this.uniforms.outlineWidthMultiplyTexture.value=n}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(n){this.uniforms.outlineWidthFactor.value=n}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(n){this.uniforms.outlineColorFactor.value=n}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(n){this.uniforms.outlineLightingMixFactor.value=n}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(n){this.uniforms.uvAnimationMaskTexture.value=n}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(n){this.uniforms.uvAnimationScrollXOffset.value=n}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(n){this.uniforms.uvAnimationScrollYOffset.value=n}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(n){this.uniforms.uvAnimationRotationPhase.value=n}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(n){this._ignoreVertexColor=n,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(n){this._v0CompatShade=n,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(n){this._debugMode=n,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(n){this._outlineWidthMode=n,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(n){this._isOutline=n,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(n){this._uploadUniformsWorkaround(),this._updateUVAnimation(n)}copy(n){return super.copy(n),this.map=n.map,this.normalMap=n.normalMap,this.emissiveMap=n.emissiveMap,this.shadeMultiplyTexture=n.shadeMultiplyTexture,this.shadingShiftTexture=n.shadingShiftTexture,this.matcapTexture=n.matcapTexture,this.rimMultiplyTexture=n.rimMultiplyTexture,this.outlineWidthMultiplyTexture=n.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=n.uvAnimationMaskTexture,this.normalMapType=n.normalMapType,this.uvAnimationScrollXSpeedFactor=n.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=n.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=n.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=n.ignoreVertexColor,this.v0CompatShade=n.v0CompatShade,this.debugMode=n.debugMode,this.outlineWidthMode=n.outlineWidthMode,this.isOutline=n.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(n){this.uniforms.uvAnimationScrollXOffset.value+=n*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=n*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=n*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const n=parseInt(Jl,10),e=this.outlineWidthMultiplyTexture!==null,t=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:n,OUTLINE:this._isOutline,MTOON_USE_UV:e||t,MTOON_UVS_VERTEX_ONLY:e&&!t,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===qN.ScreenCoordinates}}_updateTextureMatrix(n,e){n.value&&(n.value.matrixAutoUpdate&&n.value.updateMatrix(),e.value.copy(n.value.matrix))}},fde=new Set(["1.0","1.0-beta"]),vG=class Iw{get name(){return Iw.EXTENSION_NAME}constructor(e,t={}){var r,i,s,o;this.parser=e,this.materialType=(r=t.materialType)!=null?r:gG,this.renderOrderOffset=(i=t.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=t.v0CompatShade)!=null?s:!1,this.debugMode=(o=t.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return uu(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return uu(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,t){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,t):null}loadMesh(e){return uu(this,null,function*(){var t;const r=this.parser,s=(t=r.json.meshes)==null?void 0:t[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,c=o[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=a;for(let c=0;c{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[Iw.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!fde.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Iw.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,t){return uu(this,null,function*(){var r;delete t.metalness,delete t.roughness;const i=new ade(this.parser,t);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(r=e.shadingShiftTexture)==null?void 0:r.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,t){const r=this._getMToonExtension(t);if(r){const i=this._parseRenderOrder(r);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const t=e.material;if(!(t instanceof ss)||!this._shouldGenerateOutline(t))return;e.material=[t];const r=t.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=si,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const t=e.material,r=new Set;Array.isArray(t)?t.forEach(i=>r.add(i)):r.add(t);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var t;return(e.transparentWithZWrite?0:19)+((t=e.renderQueueOffsetNumber)!=null?t:0)}};vG.EXTENSION_NAME="VRMC_materials_mtoon";var hde=vG,dde=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),yG=class eT{get name(){return eT.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,t){return dde(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;t.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[eT.EXTENSION_NAME];if(a!=null)return a}};yG.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var pde=yG,mde=Object.defineProperty,gde=Object.defineProperties,vde=Object.getOwnPropertyDescriptors,JN=Object.getOwnPropertySymbols,yde=Object.prototype.hasOwnProperty,wde=Object.prototype.propertyIsEnumerable,eO=(n,e,t)=>e in n?mde(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,pa=(n,e)=>{for(var t in e||(e={}))yde.call(e,t)&&eO(n,t,e[t]);if(JN)for(var t of JN(e))wde.call(e,t)&&eO(n,t,e[t]);return n},tO=(n,e)=>gde(n,vde(e)),_de=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())});function Tf(n){return Math.pow(n,2.2)}var xde=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(n){var e;this.parser=n,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const t=this.parser.json;t.extensionsUsed=(e=t.extensionsUsed)!=null?e:[],t.extensionsUsed.indexOf("KHR_texture_transform")===-1&&t.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return _de(this,null,function*(){var n;const e=this.parser.json,t=(n=e.extensions)==null?void 0:n.VRM,r=t==null?void 0:t.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(n,e){var t,r,i,s,o,a,l,c,A,u,f,h,d,m,g,p,v,w,_,x,b,B,M,I,S,L,O,T,y,E,U,P,N,z,W,H,C,K,te,F,re,ce,oe,ge,me,ve,be,ne,k,ae,le,Z,J,ue,Y;const G=(r=(t=n.keywordMap)==null?void 0:t._ALPHABLEND_ON)!=null?r:!1,se=((i=n.floatProperties)==null?void 0:i._ZWrite)===1&&G,fe=this._v0ParseRenderQueue(n),he=(o=(s=n.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,Be=G?"BLEND":he?"MASK":"OPAQUE",V=he?(l=(a=n.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,D=((A=(c=n.floatProperties)==null?void 0:c._CullMode)!=null?A:2)===0,X=this._portTextureTransform(n),ie=((f=(u=n.vectorProperties)==null?void 0:u._Color)!=null?f:[1,1,1,1]).map((Ne,Ke)=>Ke===3?Ne:Tf(Ne)),pe=(h=n.textureProperties)==null?void 0:h._MainTex,de=pe!=null?{index:pe,extensions:pa({},X)}:void 0,Ie=(m=(d=n.floatProperties)==null?void 0:d._BumpScale)!=null?m:1,Le=(g=n.textureProperties)==null?void 0:g._BumpMap,Ue=Le!=null?{index:Le,scale:Ie,extensions:pa({},X)}:void 0,Ye=((v=(p=n.vectorProperties)==null?void 0:p._EmissionColor)!=null?v:[0,0,0,1]).map(Tf),Ae=(w=n.textureProperties)==null?void 0:w._EmissionMap,Fe=Ae!=null?{index:Ae,extensions:pa({},X)}:void 0,Me=((x=(_=n.vectorProperties)==null?void 0:_._ShadeColor)!=null?x:[.97,.81,.86,1]).map(Tf),Ce=(b=n.textureProperties)==null?void 0:b._ShadeTexture,Re=Ce!=null?{index:Ce,extensions:pa({},X)}:void 0;let Oe=(M=(B=n.floatProperties)==null?void 0:B._ShadeShift)!=null?M:0,$e=(S=(I=n.floatProperties)==null?void 0:I._ShadeToony)!=null?S:.9;$e=Et.lerp($e,1,.5+.5*Oe),Oe=-Oe-(1-$e);const dt=(O=(L=n.floatProperties)==null?void 0:L._IndirectLightIntensity)!=null?O:.1,Fn=dt?1-dt:void 0,nt=(T=n.textureProperties)==null?void 0:T._SphereAdd,_t=nt!=null?[1,1,1]:void 0,Cr=nt!=null?{index:nt}:void 0,en=(E=(y=n.floatProperties)==null?void 0:y._RimLightingMix)!=null?E:0,qt=(U=n.textureProperties)==null?void 0:U._RimTexture,$r=qt!=null?{index:qt,extensions:pa({},X)}:void 0,Jt=((N=(P=n.vectorProperties)==null?void 0:P._RimColor)!=null?N:[0,0,0,1]).map(Tf),tn=(W=(z=n.floatProperties)==null?void 0:z._RimFresnelPower)!=null?W:1,js=(C=(H=n.floatProperties)==null?void 0:H._RimLift)!=null?C:0,Kt=["none","worldCoordinates","screenCoordinates"][(te=(K=n.floatProperties)==null?void 0:K._OutlineWidthMode)!=null?te:0];let Xt=(re=(F=n.floatProperties)==null?void 0:F._OutlineWidth)!=null?re:0;Xt=.01*Xt;const Ci=(ce=n.textureProperties)==null?void 0:ce._OutlineWidthTexture,nn=Ci!=null?{index:Ci,extensions:pa({},X)}:void 0,rn=((ge=(oe=n.vectorProperties)==null?void 0:oe._OutlineColor)!=null?ge:[0,0,0]).map(Tf),An=((ve=(me=n.floatProperties)==null?void 0:me._OutlineColorMode)!=null?ve:0)===1?(ne=(be=n.floatProperties)==null?void 0:be._OutlineLightingMix)!=null?ne:1:0,sn=(k=n.textureProperties)==null?void 0:k._UvAnimMaskTexture,ee=sn!=null?{index:sn,extensions:pa({},X)}:void 0,ye=(le=(ae=n.floatProperties)==null?void 0:ae._UvAnimScrollX)!=null?le:0;let Ee=(J=(Z=n.floatProperties)==null?void 0:Z._UvAnimScrollY)!=null?J:0;Ee!=null&&(Ee=-Ee);const Se=(Y=(ue=n.floatProperties)==null?void 0:ue._UvAnimRotation)!=null?Y:0,we={specVersion:"1.0",transparentWithZWrite:se,renderQueueOffsetNumber:fe,shadeColorFactor:Me,shadeMultiplyTexture:Re,shadingShiftFactor:Oe,shadingToonyFactor:$e,giEqualizationFactor:Fn,matcapFactor:_t,matcapTexture:Cr,rimLightingMixFactor:en,rimMultiplyTexture:$r,parametricRimColorFactor:Jt,parametricRimFresnelPowerFactor:tn,parametricRimLiftFactor:js,outlineWidthMode:Kt,outlineWidthFactor:Xt,outlineWidthMultiplyTexture:nn,outlineColorFactor:rn,outlineLightingMixFactor:An,uvAnimationMaskTexture:ee,uvAnimationScrollXSpeedFactor:ye,uvAnimationScrollYSpeedFactor:Ee,uvAnimationRotationSpeedFactor:Se};return tO(pa({},e),{pbrMetallicRoughness:{baseColorFactor:ie,baseColorTexture:de},normalTexture:Ue,emissiveTexture:Fe,emissiveFactor:Ye,alphaMode:Be,alphaCutoff:V,doubleSided:D,extensions:{VRMC_materials_mtoon:we}})}_parseV0UnlitProperties(n,e){var t,r,i,s,o;const a=n.shader==="VRM/UnlitTransparentZWrite",l=n.shader==="VRM/UnlitTransparent"||a,c=this._v0ParseRenderQueue(n),A=n.shader==="VRM/UnlitCutout",u=l?"BLEND":A?"MASK":"OPAQUE",f=A?(r=(t=n.floatProperties)==null?void 0:t._Cutoff)!=null?r:.5:void 0,h=this._portTextureTransform(n),d=((s=(i=n.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Tf),m=(o=n.textureProperties)==null?void 0:o._MainTex,g=m!=null?{index:m,extensions:pa({},h)}:void 0,p={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:d,shadeMultiplyTexture:g};return tO(pa({},e),{pbrMetallicRoughness:{baseColorFactor:d,baseColorTexture:g},alphaMode:u,alphaCutoff:f,extensions:{VRMC_materials_mtoon:p}})}_portTextureTransform(n){var e,t,r,i,s;const o=(e=n.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(t=o==null?void 0:o[0])!=null?t:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(n){var e,t;const r=n.shader==="VRM/UnlitTransparentZWrite",i=((e=n.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||n.shader==="VRM/UnlitTransparent"||r,s=((t=n.floatProperties)==null?void 0:t._ZWrite)===1||r;let o=0;if(i){const a=n.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(n){const e=new Set,t=new Set;n.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const c=r.renderQueue;c!=null&&(l?t.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(t).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},nO=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Sc=new $,CB=class extends ni{constructor(n){super(),this._attrPosition=new lt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(UJ);const e=new Zt;e.setAttribute("position",this._attrPosition);const t=new lc({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Xd(e,t),this.add(this._line),this.constraint=n}updateMatrixWorld(n){Sc.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,Sc.x,Sc.y,Sc.z),this.constraint.source&&Sc.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,Sc.x,Sc.y,Sc.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(n)}};function rO(n,e){return e.set(n.elements[12],n.elements[13],n.elements[14])}var bde=new $,Ede=new $;function Bde(n,e){return n.decompose(bde,e,Ede),e}function X_(n){return n.invert?n.invert():n.inverse(),n}var r2=class{constructor(n,e){this.destination=n,this.source=e,this.weight=1}},Sde=new $,Mde=new $,Cde=new $,Tde=new tt,Ide=new tt,Rde=new tt,Ude=class extends r2{get aimAxis(){return this._aimAxis}set aimAxis(n){this._aimAxis=n,this._v3AimAxis.set(n==="PositiveX"?1:n==="NegativeX"?-1:0,n==="PositiveY"?1:n==="NegativeY"?-1:0,n==="PositiveZ"?1:n==="NegativeZ"?-1:0)}get dependencies(){const n=new Set([this.source]);return this.destination.parent&&n.add(this.destination.parent),n}constructor(n,e){super(n,e),this._aimAxis="PositiveX",this._v3AimAxis=new $(1,0,0),this._dstRestQuat=new tt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const n=Tde.identity(),e=Ide.identity();this.destination.parent&&(Bde(this.destination.parent.matrixWorld,n),X_(e.copy(n)));const t=Sde.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(n),r=rO(this.source.matrixWorld,Mde).sub(rO(this.destination.matrixWorld,Cde)).normalize(),i=Rde.setFromUnitVectors(t,r).premultiply(e).multiply(n).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function Fde(n,e){const t=[n];let r=n.parent;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}var Pde=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(n){this._constraints.add(n);let e=this._objectConstraintsMap.get(n.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(n.destination,e)),e.add(n)}deleteConstraint(n){this._constraints.delete(n),this._objectConstraintsMap.get(n.destination).delete(n)}setInitState(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.setInitState())}update(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.update())}_processConstraint(n,e,t,r){if(t.has(n))return;if(e.has(n))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(n);const i=n.dependencies;for(const s of i)Fde(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,t,r)});r(n),t.add(n)}},Lde=new tt,Dde=new tt,Nde=class extends r2{get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._dstRestQuat=new tt,this._invSrcRestQuat=new tt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),X_(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const n=Lde.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Dde.copy(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Ode=new $,kde=new tt,Hde=new tt,Qde=class extends r2{get rollAxis(){return this._rollAxis}set rollAxis(n){this._rollAxis=n,this._v3RollAxis.set(n==="X"?1:0,n==="Y"?1:0,n==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._rollAxis="X",this._v3RollAxis=new $(1,0,0),this._dstRestQuat=new tt,this._invDstRestQuat=new tt,this._invSrcRestQuatMulDstRestQuat=new tt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),X_(this._invDstRestQuat.copy(this._dstRestQuat)),X_(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const n=kde.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Ode.copy(this._v3RollAxis).applyQuaternion(n),r=Hde.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},zde=new Set(["1.0","1.0-beta"]),wG=class Tm{get name(){return Tm.EXTENSION_NAME}constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}afterRoot(e){return nO(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return nO(this,null,function*(){var t;const r=this.parser.json;if(!(((t=r.extensionsUsed)==null?void 0:t.indexOf(Tm.EXTENSION_NAME))!==-1))return null;const s=new Pde,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var c;const A=r.nodes[l],u=(c=A==null?void 0:A.extensions)==null?void 0:c[Tm.EXTENSION_NAME];if(u==null)return;const f=u.specVersion;if(!zde.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Tm.EXTENSION_NAME} specVersion "${f}"`);return}const h=u.constraint;if(h.roll!=null){const d=this._importRollConstraint(a,o,h.roll);s.addConstraint(d)}else if(h.aim!=null){const d=this._importAimConstraint(a,o,h.aim);s.addConstraint(d)}else if(h.rotation!=null){const d=this._importRotationConstraint(a,o,h.rotation);s.addConstraint(d)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,t,r){const{source:i,rollAxis:s,weight:o}=r,a=t[i],l=new Qde(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new CB(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,t,r){const{source:i,aimAxis:s,weight:o}=r,a=t[i],l=new Ude(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new CB(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,t,r){const{source:i,weight:s}=r,o=t[i],a=new Nde(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new CB(a);this.helperRoot.add(l)}return a}};wG.EXTENSION_NAME="VRMC_node_constraint";var Gde=wG,py=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),i2=class{},TB=new $,jA=new $,_G=class extends i2{get type(){return"capsule"}constructor(n){var e,t,r,i;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.tail=(t=n==null?void 0:n.tail)!=null?t:new $(0,0,0),this.radius=(r=n==null?void 0:n.radius)!=null?r:0,this.inside=(i=n==null?void 0:n.inside)!=null?i:!1}calculateCollision(n,e,t,r){TB.copy(this.offset).applyMatrix4(n),jA.copy(this.tail).applyMatrix4(n),jA.sub(TB);const i=jA.lengthSq();r.copy(e).sub(TB);const s=jA.dot(r);s<=0||(i<=s||jA.multiplyScalar(s/i),r.sub(jA));const o=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),o}},IB=new $,iO=new ut,xG=class extends i2{get type(){return"plane"}constructor(n){var e,t;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.normal=(t=n==null?void 0:n.normal)!=null?t:new $(0,0,1)}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e),iO.getNormalMatrix(n),IB.copy(this.normal).applyNormalMatrix(iO).normalize();const i=r.dot(IB)-t;return r.copy(IB),i}},bG=class extends i2{get type(){return"sphere"}constructor(n){var e,t,r;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.radius=(t=n==null?void 0:n.radius)!=null?t:0,this.inside=(r=n==null?void 0:n.inside)!=null?r:!1}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e);const i=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),i}},ma=new $,Vde=class extends Zt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new $,this._currentTail=new $,this._shape=n,this._attrPos=new lt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0);const t=ma.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(t)>1e-10&&(this._currentTail.copy(t),n=!0),n&&this._buildPosition()}_buildPosition(){ma.copy(this._currentTail).sub(this._currentOffset);const n=ma.length()/this._currentRadius;for(let r=0;r<=16;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+r,n+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+r,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+r,n+Math.sin(i),0,Math.cos(i))}for(let r=0;r<32;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+r,n,Math.sin(i),Math.cos(i))}const e=Math.atan2(ma.y,Math.sqrt(ma.x*ma.x+ma.z*ma.z)),t=-Math.atan2(ma.z,ma.x);this.rotateZ(e),this.rotateY(t),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<34;n++){const e=(n+1)%34;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(68+n*2,34+n,34+e)}for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(136+n*2,68+n,68+e),this._attrIndex.setXY(200+n*2,100+n,100+e)}this._attrIndex.needsUpdate=!0}},jde=class extends Zt{constructor(n){super(),this.worldScale=1,this._currentOffset=new $,this._currentNormal=new $,this._shape=n,this._attrPos=new lt(new Float32Array(6*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},Wde=class extends Zt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new $,this._shape=n,this._attrPos=new lt(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.needsUpdate=!0}},Kde=new $,RB=class extends ni{constructor(n){if(super(),this.matrixAutoUpdate=!1,this.collider=n,this.collider.shape instanceof bG)this._geometry=new Wde(this.collider.shape);else if(this.collider.shape instanceof _G)this._geometry=new Vde(this.collider.shape);else if(this.collider.shape instanceof xG)this._geometry=new jde(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new lc({color:16711935,depthTest:!1,depthWrite:!1});this._line=new g0(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=Kde.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},Xde=class extends Zt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new $,this._springBone=n,this._attrPos=new lt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},Yde=new $,$de=class extends ni{constructor(n){super(),this.matrixAutoUpdate=!1,this.springBone=n,this._geometry=new Xde(this.springBone);const e=new lc({color:16776960,depthTest:!1,depthWrite:!1});this._line=new g0(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=Yde.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},UB=class extends Ft{constructor(n){super(),this.shape=n}},Zde=new ke;function EG(n){return n.invert?n.invert():n.getInverse(Zde.copy(n)),n}var qde=class{constructor(n){this._inverseCache=new ke,this._shouldUpdateInverse=!0,this.matrix=n;const e={set:(t,r,i)=>(this._shouldUpdateInverse=!0,t[r]=i,!0)};this._originalElements=n.elements,n.elements=new Proxy(n.elements,e)}get inverse(){return this._shouldUpdateInverse&&(EG(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},Jde=new ke,ml=new $,jp=new $,epe=new $,If=new $,sO=new $,Wp=new $,oO=new tt,Rf=new ke,tpe=new ke,npe=class{constructor(n,e,t={},r=[]){this._currentTail=new $,this._prevTail=new $,this._boneAxis=new $,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new ke,this._initialLocalRotation=new tt,this._initialLocalChildPosition=new $;var i,s,o,a,l,c;this.bone=n,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=t.hitRadius)!=null?i:0,stiffness:(s=t.stiffness)!=null?s:1,gravityPower:(o=t.gravityPower)!=null?o:0,gravityDir:(l=(a=t.gravityDir)==null?void 0:a.clone())!=null?l:new $(0,-1,0),dragForce:(c=t.dragForce)!=null?c:.4},this.colliderGroups=r}get center(){return this._center}set center(n){var e;(e=this._center)!=null&&e.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=n,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new qde(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:Jde}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const n=this._getMatrixWorldToCenter(Rf);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const n=this._getMatrixWorldToCenter(Rf);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail)}update(n){if(n<=0)return;this._calcWorldSpaceBoneLength(),If.setFromMatrixPosition(this.bone.matrixWorld);let e=this._getMatrixWorldToCenter(Rf);sO.copy(If).applyMatrix4(e);const t=oO.setFromRotationMatrix(e),r=tpe.copy(e).multiply(this._parentMatrixWorld),i=jp.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(r).sub(sO).normalize(),s=epe.copy(this.settings.gravityDir).applyQuaternion(t).normalize(),o=this._getMatrixCenterToWorld(Rf);Wp.copy(this._currentTail).add(ml.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(ml.copy(i).multiplyScalar(this.settings.stiffness*n)).add(ml.copy(s).multiplyScalar(this.settings.gravityPower*n)).applyMatrix4(o),Wp.sub(If).normalize().multiplyScalar(this._worldSpaceBoneLength).add(If),this._collision(Wp),e=this._getMatrixWorldToCenter(Rf),this._prevTail.copy(this._currentTail),this._currentTail.copy(ml.copy(Wp).applyMatrix4(e));const a=EG(Rf.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),l=oO.setFromUnitVectors(this._boneAxis,ml.copy(Wp).applyMatrix4(a).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(l),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(n){this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{const r=t.shape.calculateCollision(t.matrixWorld,n,this.settings.hitRadius,ml);r<0&&(n.add(ml.multiplyScalar(-r)),n.sub(If).normalize().multiplyScalar(this._worldSpaceBoneLength).add(If))})})}_calcWorldSpaceBoneLength(){ml.setFromMatrixPosition(this.bone.matrixWorld),this.child?jp.setFromMatrixPosition(this.child.matrixWorld):(jp.copy(this._initialLocalChildPosition),jp.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=ml.sub(jp).length()}_getMatrixCenterToWorld(n){return this._center?n.copy(this._center.matrixWorld):n.identity(),n}_getMatrixWorldToCenter(n){return this._center?n.copy(this._center.userData.inverseCacheProxy.inverse):n.identity(),n}};function rpe(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function BG(n,e){n.children.forEach(t=>{e(t)||BG(t,e)})}var aO=class{constructor(){this._joints=new Set,this._hasWarnedCircularDependency=!1,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const n=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(t=>{n.add(t)})}),Array.from(n)}get colliders(){const n=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{n.add(t)})}),Array.from(n)}addJoint(n){this._joints.add(n);let e=this._objectSpringBonesMap.get(n.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(n.bone,e)),e.add(n)}addSpringBone(n){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(n)}deleteJoint(n){this._joints.delete(n),this._objectSpringBonesMap.get(n.bone).delete(n)}deleteSpringBone(n){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(n)}setInitState(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.setInitState())}reset(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.reset())}update(n){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.update(n)),BG(i.bone,s=>{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(s.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(n,e,t,r,i){if(t.has(n))return;if(e.has(n)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected while updating springbones"),this._hasWarnedCircularDependency=!0);return}e.add(n);const s=this._getDependencies(n);for(const o of s)rpe(o,a=>{const l=this._objectSpringBonesMap.get(a);if(l)for(const c of l)this._processSpringBone(c,e,t,r,i);else r.has(a)||(a.updateWorldMatrix(!1,!1),r.add(a))});n.bone.updateMatrix(),n.bone.updateWorldMatrix(!1,!1),i(n),r.add(n.bone),t.add(n)}_getDependencies(n){const e=new Set,t=n.bone.parent;return t&&e.add(t),n.colliderGroups.forEach(r=>{r.colliders.forEach(i=>{e.add(i)})}),e}},lO="VRMC_springBone_extended_collider",ipe=new Set(["1.0","1.0-beta"]),spe=new Set(["1.0"]),SG=class Wf{get name(){return Wf.EXTENSION_NAME}constructor(e,t){var r;this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot,this.useExtendedColliders=(r=t==null?void 0:t.useExtendedColliders)!=null?r:!0}afterRoot(e){return py(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return py(this,null,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){return py(this,null,function*(){var t,r,i,s,o;const a=e.parser.json;if(!(((t=a.extensionsUsed)==null?void 0:t.indexOf(Wf.EXTENSION_NAME))!==-1))return null;const c=new aO,A=yield e.parser.getDependencies("node"),u=(r=a.extensions)==null?void 0:r[Wf.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!ipe.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Wf.EXTENSION_NAME} specVersion "${f}"`),null;const h=(i=u.colliders)==null?void 0:i.map((m,g)=>{var p,v,w,_,x,b,B,M,I,S,L,O,T,y,E;const U=A[m.node],P=m.shape,N=(p=m.extensions)==null?void 0:p[lO];if(this.useExtendedColliders&&N!=null){const z=N.specVersion;if(!spe.has(z))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${lO} specVersion "${z}". Fallbacking to the ${Wf.EXTENSION_NAME} definition`);else{const W=N.shape;if(W.sphere)return this._importSphereCollider(U,{offset:new $().fromArray((v=W.sphere.offset)!=null?v:[0,0,0]),radius:(w=W.sphere.radius)!=null?w:0,inside:(_=W.sphere.inside)!=null?_:!1});if(W.capsule)return this._importCapsuleCollider(U,{offset:new $().fromArray((x=W.capsule.offset)!=null?x:[0,0,0]),radius:(b=W.capsule.radius)!=null?b:0,tail:new $().fromArray((B=W.capsule.tail)!=null?B:[0,0,0]),inside:(M=W.capsule.inside)!=null?M:!1});if(W.plane)return this._importPlaneCollider(U,{offset:new $().fromArray((I=W.plane.offset)!=null?I:[0,0,0]),normal:new $().fromArray((S=W.plane.normal)!=null?S:[0,0,1])})}}if(P.sphere)return this._importSphereCollider(U,{offset:new $().fromArray((L=P.sphere.offset)!=null?L:[0,0,0]),radius:(O=P.sphere.radius)!=null?O:0,inside:!1});if(P.capsule)return this._importCapsuleCollider(U,{offset:new $().fromArray((T=P.capsule.offset)!=null?T:[0,0,0]),radius:(y=P.capsule.radius)!=null?y:0,tail:new $().fromArray((E=P.capsule.tail)!=null?E:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),d=(s=u.colliderGroups)==null?void 0:s.map((m,g)=>{var p;return{colliders:((p=m.colliders)!=null?p:[]).map(w=>{const _=h==null?void 0:h[w];if(_==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${g} attempted to use a collider #${w} but not found`);return _}),name:m.name}});return(o=u.springs)==null||o.forEach((m,g)=>{var p;const v=m.joints,w=(p=m.colliderGroups)==null?void 0:p.map(b=>{const B=d==null?void 0:d[b];if(B==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${b} but not found`);return B}),_=m.center!=null?A[m.center]:void 0;let x;v.forEach(b=>{if(x){const B=x.node,M=A[B],I=b.node,S=A[I],L={hitRadius:x.hitRadius,dragForce:x.dragForce,gravityPower:x.gravityPower,stiffness:x.stiffness,gravityDir:x.gravityDir!=null?new $().fromArray(x.gravityDir):void 0},O=this._importJoint(M,S,L,w);_&&(O.center=_),c.addJoint(O)}x=b})}),c.setInitState(),c})}_v0Import(e){return py(this,null,function*(){var t,r,i;const s=e.parser.json;if(!(((t=s.extensionsUsed)==null?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const A=new aO,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)==null?void 0:i.map(h=>{var d;const m=u[h.node];return{colliders:((d=h.colliders)!=null?d:[]).map((p,v)=>{var w,_,x;const b=new $(0,0,0);return p.offset&&b.set((w=p.offset.x)!=null?w:0,(_=p.offset.y)!=null?_:0,p.offset.z?-p.offset.z:0),this._importSphereCollider(m,{offset:b,radius:(x=p.radius)!=null?x:0,inside:!1})})}});return c==null||c.forEach((h,d)=>{const m=h.bones;m&&m.forEach(g=>{var p,v,w,_;const x=u[g],b=new $;h.gravityDir?b.set((p=h.gravityDir.x)!=null?p:0,(v=h.gravityDir.y)!=null?v:0,(w=h.gravityDir.z)!=null?w:0):b.set(0,-1,0);const B=h.center!=null?u[h.center]:void 0,M={hitRadius:h.hitRadius,dragForce:h.dragForce,gravityPower:h.gravityPower,stiffness:h.stiffiness,gravityDir:b},I=(_=h.colliderGroups)==null?void 0:_.map(S=>{const L=f==null?void 0:f[S];if(L==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${d} attempted to use a colliderGroup ${S} but not found`);return L});x.traverse(S=>{var L;const O=(L=S.children[0])!=null?L:null,T=this._importJoint(S,O,M,I);B&&(T.center=B),A.addJoint(T)})})}),e.scene.updateMatrixWorld(),A.setInitState(),A})}_importJoint(e,t,r,i){const s=new npe(e,t,r,i);if(this.jointHelperRoot){const o=new $de(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const r=new bG(t),i=new UB(r);if(e.add(i),this.colliderHelperRoot){const s=new RB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,t){const r=new _G(t),i=new UB(r);if(e.add(i),this.colliderHelperRoot){const s=new RB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,t){const r=new xG(t),i=new UB(r);if(e.add(i),this.colliderHelperRoot){const s=new RB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};SG.EXTENSION_NAME="VRMC_springBone";var ope=SG,ape=class{get name(){return"VRMLoaderPlugin"}constructor(n,e){var t,r,i,s,o,a,l,c,A,u;this.parser=n;const f=e==null?void 0:e.helperRoot,h=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(t=e==null?void 0:e.expressionPlugin)!=null?t:new She(n),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new Che(n),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new Lhe(n,{helperRoot:f,autoUpdateHumanBones:h}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new $he(n,{helperRoot:f}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new Jhe(n),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new hde(n),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new pde(n),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new xde(n),this.springBonePlugin=(A=e==null?void 0:e.springBonePlugin)!=null?A:new ope(n,{colliderHelperRoot:f,jointHelperRoot:f}),this.nodeConstraintPlugin=(u=e==null?void 0:e.nodeConstraintPlugin)!=null?u:new Gde(n,{helperRoot:f})}beforeRoot(){return fy(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(n){return fy(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(n)})}getMaterialType(n){const e=this.mtoonMaterialPlugin.getMaterialType(n);return e??null}extendMaterialParams(n,e){return fy(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(n,e),yield this.mtoonMaterialPlugin.extendMaterialParams(n,e)})}afterRoot(n){return fy(this,null,function*(){yield this.metaPlugin.afterRoot(n),yield this.humanoidPlugin.afterRoot(n),yield this.expressionPlugin.afterRoot(n),yield this.lookAtPlugin.afterRoot(n),yield this.firstPersonPlugin.afterRoot(n),yield this.springBonePlugin.afterRoot(n),yield this.nodeConstraintPlugin.afterRoot(n),yield this.mtoonMaterialPlugin.afterRoot(n);const e=n.userData.vrmMeta,t=n.userData.vrmHumanoid;if(e&&t){const r=new tde({scene:n.scene,expressionManager:n.userData.vrmExpressionManager,firstPerson:n.userData.vrmFirstPerson,humanoid:t,lookAt:n.userData.vrmLookAt,meta:e,materials:n.userData.vrmMToonMaterials,springBoneManager:n.userData.vrmSpringBoneManager,nodeConstraintManager:n.userData.vrmNodeConstraintManager});n.userData.vrm=r}})}};function cO(n){if(Object.values(n).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),n.isShaderMaterial){const e=n.uniforms;e&&Object.values(e).forEach(t=>{const r=t.value;r!=null&&r.isTexture&&r.dispose()})}n.dispose()}function lpe(n){const e=n.geometry;e&&e.dispose();const t=n.skeleton;t&&t.dispose();const r=n.material;r&&(Array.isArray(r)?r.forEach(i=>cO(i)):r&&cO(r))}function cpe(n){n.traverse(lpe)}function Ape(n,e){var t;const r=(t=e==null?void 0:e.experimentalSameBoneCounts)!=null?t:!1,i=[];n.traverse(a=>{a.type==="SkinnedMesh"&&i.push(a)});const s=new Map;let o=0;for(const a of i){const c=a.geometry.getAttribute("skinIndex"),A=[],u=[],f={},h=c.array;for(let d=0;d{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,c=l.index;if(c==null)return;const A=e.get(l);if(A!=null){a.geometry=A;return}const u=new Zt;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(m=>{u.addGroup(m.start,m.count,m.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)==null?void 0:r.clone())!=null?i:null,u.boundingSphere=(o=(s=l.boundingSphere)==null?void 0:s.clone())!=null?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],h=[];{const m=c.array,g=new m.constructor(m.length);let p=0;for(let v=0;v{const g=l.attributes[m];if(g.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const p=g.array,{itemSize:v,normalized:w}=g,_=new p.constructor(h.length*v);h.forEach((x,b)=>{for(let B=0;B{u.morphAttributes[m]=[];const g=l.morphAttributes[m];for(let p=0;p{for(let I=0;I<_;I++)b[M*_+I]=w[B*_+I]}),d=d&&b.every(B=>B===0),u.morphAttributes[m][p]=new lt(b,_,x)}}),d&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function fpe(n){var e;((e=n.meta)==null?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}var x0=class{constructor(){}};x0.deepDispose=cpe;x0.removeUnnecessaryJoints=Ape;x0.removeUnnecessaryVertices=upe;x0.rotateVRM0=fpe;/*! +`;t.vertexShader=i+t.vertexShader,t.fragmentShader=i+t.fragmentShader,r<154&&(t.fragmentShader=t.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(n){this.uniforms.litFactor.value=n}get map(){return this.uniforms.map.value}set map(n){this.uniforms.map.value=n}get normalMap(){return this.uniforms.normalMap.value}set normalMap(n){this.uniforms.normalMap.value=n}get normalScale(){return this.uniforms.normalScale.value}set normalScale(n){this.uniforms.normalScale.value=n}get emissive(){return this.uniforms.emissive.value}set emissive(n){this.uniforms.emissive.value=n}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(n){this.uniforms.emissiveIntensity.value=n}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(n){this.uniforms.emissiveMap.value=n}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(n){this.uniforms.shadeColorFactor.value=n}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(n){this.uniforms.shadeMultiplyTexture.value=n}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(n){this.uniforms.shadingShiftFactor.value=n}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(n){this.uniforms.shadingShiftTexture.value=n}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(n){this.uniforms.shadingShiftTextureScale.value=n}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(n){this.uniforms.shadingToonyFactor.value=n}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(n){this.uniforms.giEqualizationFactor.value=n}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(n){this.uniforms.matcapFactor.value=n}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(n){this.uniforms.matcapTexture.value=n}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(n){this.uniforms.parametricRimColorFactor.value=n}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(n){this.uniforms.rimMultiplyTexture.value=n}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(n){this.uniforms.rimLightingMixFactor.value=n}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(n){this.uniforms.parametricRimFresnelPowerFactor.value=n}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(n){this.uniforms.parametricRimLiftFactor.value=n}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(n){this.uniforms.outlineWidthMultiplyTexture.value=n}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(n){this.uniforms.outlineWidthFactor.value=n}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(n){this.uniforms.outlineColorFactor.value=n}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(n){this.uniforms.outlineLightingMixFactor.value=n}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(n){this.uniforms.uvAnimationMaskTexture.value=n}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(n){this.uniforms.uvAnimationScrollXOffset.value=n}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(n){this.uniforms.uvAnimationScrollYOffset.value=n}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(n){this.uniforms.uvAnimationRotationPhase.value=n}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(n){this._ignoreVertexColor=n,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(n){this._v0CompatShade=n,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(n){this._debugMode=n,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(n){this._outlineWidthMode=n,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(n){this._isOutline=n,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(n){this._uploadUniformsWorkaround(),this._updateUVAnimation(n)}copy(n){return super.copy(n),this.map=n.map,this.normalMap=n.normalMap,this.emissiveMap=n.emissiveMap,this.shadeMultiplyTexture=n.shadeMultiplyTexture,this.shadingShiftTexture=n.shadingShiftTexture,this.matcapTexture=n.matcapTexture,this.rimMultiplyTexture=n.rimMultiplyTexture,this.outlineWidthMultiplyTexture=n.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=n.uvAnimationMaskTexture,this.normalMapType=n.normalMapType,this.uvAnimationScrollXSpeedFactor=n.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=n.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=n.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=n.ignoreVertexColor,this.v0CompatShade=n.v0CompatShade,this.debugMode=n.debugMode,this.outlineWidthMode=n.outlineWidthMode,this.isOutline=n.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(n){this.uniforms.uvAnimationScrollXOffset.value+=n*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=n*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=n*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const n=parseInt(nc,10),e=this.outlineWidthMultiplyTexture!==null,t=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:n,OUTLINE:this._isOutline,MTOON_USE_UV:e||t,MTOON_UVS_VERTEX_ONLY:e&&!t,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===eO.ScreenCoordinates}}_updateTextureMatrix(n,e){n.value&&(n.value.matrixAutoUpdate&&n.value.updateMatrix(),e.value.copy(n.value.matrix))}},vde=new Set(["1.0","1.0-beta"]),wG=class Fw{get name(){return Fw.EXTENSION_NAME}constructor(e,t={}){var r,i,s,o;this.parser=e,this.materialType=(r=t.materialType)!=null?r:yG,this.renderOrderOffset=(i=t.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=t.v0CompatShade)!=null?s:!1,this.debugMode=(o=t.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return hu(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return hu(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,t){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,t):null}loadMesh(e){return hu(this,null,function*(){var t;const r=this.parser,s=(t=r.json.meshes)==null?void 0:t[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,c=o[0].material;c!=null&&this._setupPrimitive(l,c)}else{const l=a;for(let c=0;c{var o;this._getMToonExtension(s)&&((o=i.extensions)!=null&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[Fw.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!vde.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Fw.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,t){return hu(this,null,function*(){var r;delete t.metalness,delete t.roughness;const i=new hde(this.parser,t);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(r=e.shadingShiftTexture)==null?void 0:r.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,t){const r=this._getMToonExtension(t);if(r){const i=this._parseRenderOrder(r);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const t=e.material;if(!(t instanceof os)||!this._shouldGenerateOutline(t))return;e.material=[t];const r=t.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=oi,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const t=e.material,r=new Set;Array.isArray(t)?t.forEach(i=>r.add(i)):r.add(t);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var t;return(e.transparentWithZWrite?0:19)+((t=e.renderQueueOffsetNumber)!=null?t:0)}};wG.EXTENSION_NAME="VRMC_materials_mtoon";var yde=wG,wde=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),_G=class rT{get name(){return rT.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,t){return wde(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;t.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[rT.EXTENSION_NAME];if(a!=null)return a}};_G.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var _de=_G,xde=Object.defineProperty,bde=Object.defineProperties,Ede=Object.getOwnPropertyDescriptors,tO=Object.getOwnPropertySymbols,Bde=Object.prototype.hasOwnProperty,Sde=Object.prototype.propertyIsEnumerable,nO=(n,e,t)=>e in n?xde(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,ma=(n,e)=>{for(var t in e||(e={}))Bde.call(e,t)&&nO(n,t,e[t]);if(tO)for(var t of tO(e))Sde.call(e,t)&&nO(n,t,e[t]);return n},rO=(n,e)=>bde(n,Ede(e)),Mde=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())});function Uf(n){return Math.pow(n,2.2)}var Cde=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(n){var e;this.parser=n,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const t=this.parser.json;t.extensionsUsed=(e=t.extensionsUsed)!=null?e:[],t.extensionsUsed.indexOf("KHR_texture_transform")===-1&&t.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return Mde(this,null,function*(){var n;const e=this.parser.json,t=(n=e.extensions)==null?void 0:n.VRM,r=t==null?void 0:t.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(i,l);e.materials[s]=c}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(i,l);e.materials[s]=c}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(n,e){var t,r,i,s,o,a,l,c,A,u,f,h,d,m,g,p,v,w,_,x,b,B,S,I,M,P,D,T,y,E,R,L,N,z,W,H,C,K,ee,F,re,ce,oe,ge,me,ve,be,ne,k,ae,le,Z,J,ue,Y;const G=(r=(t=n.keywordMap)==null?void 0:t._ALPHABLEND_ON)!=null?r:!1,se=((i=n.floatProperties)==null?void 0:i._ZWrite)===1&&G,fe=this._v0ParseRenderQueue(n),he=(o=(s=n.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,Be=G?"BLEND":he?"MASK":"OPAQUE",V=he?(l=(a=n.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,O=((A=(c=n.floatProperties)==null?void 0:c._CullMode)!=null?A:2)===0,X=this._portTextureTransform(n),ie=((f=(u=n.vectorProperties)==null?void 0:u._Color)!=null?f:[1,1,1,1]).map((Ne,Ke)=>Ke===3?Ne:Uf(Ne)),pe=(h=n.textureProperties)==null?void 0:h._MainTex,de=pe!=null?{index:pe,extensions:ma({},X)}:void 0,Ie=(m=(d=n.floatProperties)==null?void 0:d._BumpScale)!=null?m:1,Le=(g=n.textureProperties)==null?void 0:g._BumpMap,Ue=Le!=null?{index:Le,scale:Ie,extensions:ma({},X)}:void 0,Ye=((v=(p=n.vectorProperties)==null?void 0:p._EmissionColor)!=null?v:[0,0,0,1]).map(Uf),Ae=(w=n.textureProperties)==null?void 0:w._EmissionMap,Fe=Ae!=null?{index:Ae,extensions:ma({},X)}:void 0,Me=((x=(_=n.vectorProperties)==null?void 0:_._ShadeColor)!=null?x:[.97,.81,.86,1]).map(Uf),Ce=(b=n.textureProperties)==null?void 0:b._ShadeTexture,Re=Ce!=null?{index:Ce,extensions:ma({},X)}:void 0;let Oe=(S=(B=n.floatProperties)==null?void 0:B._ShadeShift)!=null?S:0,$e=(M=(I=n.floatProperties)==null?void 0:I._ShadeToony)!=null?M:.9;$e=Et.lerp($e,1,.5+.5*Oe),Oe=-Oe-(1-$e);const dt=(D=(P=n.floatProperties)==null?void 0:P._IndirectLightIntensity)!=null?D:.1,Fn=dt?1-dt:void 0,nt=(T=n.textureProperties)==null?void 0:T._SphereAdd,_t=nt!=null?[1,1,1]:void 0,Tr=nt!=null?{index:nt}:void 0,en=(E=(y=n.floatProperties)==null?void 0:y._RimLightingMix)!=null?E:0,qt=(R=n.textureProperties)==null?void 0:R._RimTexture,Zr=qt!=null?{index:qt,extensions:ma({},X)}:void 0,Jt=((N=(L=n.vectorProperties)==null?void 0:L._RimColor)!=null?N:[0,0,0,1]).map(Uf),tn=(W=(z=n.floatProperties)==null?void 0:z._RimFresnelPower)!=null?W:1,Ws=(C=(H=n.floatProperties)==null?void 0:H._RimLift)!=null?C:0,Kt=["none","worldCoordinates","screenCoordinates"][(ee=(K=n.floatProperties)==null?void 0:K._OutlineWidthMode)!=null?ee:0];let Xt=(re=(F=n.floatProperties)==null?void 0:F._OutlineWidth)!=null?re:0;Xt=.01*Xt;const Ii=(ce=n.textureProperties)==null?void 0:ce._OutlineWidthTexture,nn=Ii!=null?{index:Ii,extensions:ma({},X)}:void 0,rn=((ge=(oe=n.vectorProperties)==null?void 0:oe._OutlineColor)!=null?ge:[0,0,0]).map(Uf),An=((ve=(me=n.floatProperties)==null?void 0:me._OutlineColorMode)!=null?ve:0)===1?(ne=(be=n.floatProperties)==null?void 0:be._OutlineLightingMix)!=null?ne:1:0,sn=(k=n.textureProperties)==null?void 0:k._UvAnimMaskTexture,te=sn!=null?{index:sn,extensions:ma({},X)}:void 0,ye=(le=(ae=n.floatProperties)==null?void 0:ae._UvAnimScrollX)!=null?le:0;let Ee=(J=(Z=n.floatProperties)==null?void 0:Z._UvAnimScrollY)!=null?J:0;Ee!=null&&(Ee=-Ee);const Se=(Y=(ue=n.floatProperties)==null?void 0:ue._UvAnimRotation)!=null?Y:0,we={specVersion:"1.0",transparentWithZWrite:se,renderQueueOffsetNumber:fe,shadeColorFactor:Me,shadeMultiplyTexture:Re,shadingShiftFactor:Oe,shadingToonyFactor:$e,giEqualizationFactor:Fn,matcapFactor:_t,matcapTexture:Tr,rimLightingMixFactor:en,rimMultiplyTexture:Zr,parametricRimColorFactor:Jt,parametricRimFresnelPowerFactor:tn,parametricRimLiftFactor:Ws,outlineWidthMode:Kt,outlineWidthFactor:Xt,outlineWidthMultiplyTexture:nn,outlineColorFactor:rn,outlineLightingMixFactor:An,uvAnimationMaskTexture:te,uvAnimationScrollXSpeedFactor:ye,uvAnimationScrollYSpeedFactor:Ee,uvAnimationRotationSpeedFactor:Se};return rO(ma({},e),{pbrMetallicRoughness:{baseColorFactor:ie,baseColorTexture:de},normalTexture:Ue,emissiveTexture:Fe,emissiveFactor:Ye,alphaMode:Be,alphaCutoff:V,doubleSided:O,extensions:{VRMC_materials_mtoon:we}})}_parseV0UnlitProperties(n,e){var t,r,i,s,o;const a=n.shader==="VRM/UnlitTransparentZWrite",l=n.shader==="VRM/UnlitTransparent"||a,c=this._v0ParseRenderQueue(n),A=n.shader==="VRM/UnlitCutout",u=l?"BLEND":A?"MASK":"OPAQUE",f=A?(r=(t=n.floatProperties)==null?void 0:t._Cutoff)!=null?r:.5:void 0,h=this._portTextureTransform(n),d=((s=(i=n.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Uf),m=(o=n.textureProperties)==null?void 0:o._MainTex,g=m!=null?{index:m,extensions:ma({},h)}:void 0,p={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:c,shadeColorFactor:d,shadeMultiplyTexture:g};return rO(ma({},e),{pbrMetallicRoughness:{baseColorFactor:d,baseColorTexture:g},alphaMode:u,alphaCutoff:f,extensions:{VRMC_materials_mtoon:p}})}_portTextureTransform(n){var e,t,r,i,s;const o=(e=n.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(t=o==null?void 0:o[0])!=null?t:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(n){var e,t;const r=n.shader==="VRM/UnlitTransparentZWrite",i=((e=n.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||n.shader==="VRM/UnlitTransparent"||r,s=((t=n.floatProperties)==null?void 0:t._ZWrite)===1||r;let o=0;if(i){const a=n.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(n){const e=new Set,t=new Set;n.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const c=r.renderQueue;c!=null&&(l?t.add(c):e.add(c))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(t).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},iO=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Cc=new $,RB=class extends ri{constructor(n){super(),this._attrPosition=new lt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(PJ);const e=new Zt;e.setAttribute("position",this._attrPosition);const t=new Ac({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Yd(e,t),this.add(this._line),this.constraint=n}updateMatrixWorld(n){Cc.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,Cc.x,Cc.y,Cc.z),this.constraint.source&&Cc.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,Cc.x,Cc.y,Cc.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(n)}};function sO(n,e){return e.set(n.elements[12],n.elements[13],n.elements[14])}var Tde=new $,Ide=new $;function Rde(n,e){return n.decompose(Tde,e,Ide),e}function $_(n){return n.invert?n.invert():n.inverse(),n}var s2=class{constructor(n,e){this.destination=n,this.source=e,this.weight=1}},Ude=new $,Fde=new $,Pde=new $,Lde=new tt,Dde=new tt,Nde=new tt,Ode=class extends s2{get aimAxis(){return this._aimAxis}set aimAxis(n){this._aimAxis=n,this._v3AimAxis.set(n==="PositiveX"?1:n==="NegativeX"?-1:0,n==="PositiveY"?1:n==="NegativeY"?-1:0,n==="PositiveZ"?1:n==="NegativeZ"?-1:0)}get dependencies(){const n=new Set([this.source]);return this.destination.parent&&n.add(this.destination.parent),n}constructor(n,e){super(n,e),this._aimAxis="PositiveX",this._v3AimAxis=new $(1,0,0),this._dstRestQuat=new tt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const n=Lde.identity(),e=Dde.identity();this.destination.parent&&(Rde(this.destination.parent.matrixWorld,n),$_(e.copy(n)));const t=Ude.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(n),r=sO(this.source.matrixWorld,Fde).sub(sO(this.destination.matrixWorld,Pde)).normalize(),i=Nde.setFromUnitVectors(t,r).premultiply(e).multiply(n).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function kde(n,e){const t=[n];let r=n.parent;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}var Hde=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(n){this._constraints.add(n);let e=this._objectConstraintsMap.get(n.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(n.destination,e)),e.add(n)}deleteConstraint(n){this._constraints.delete(n),this._objectConstraintsMap.get(n.destination).delete(n)}setInitState(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.setInitState())}update(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.update())}_processConstraint(n,e,t,r){if(t.has(n))return;if(e.has(n))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(n);const i=n.dependencies;for(const s of i)kde(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,t,r)});r(n),t.add(n)}},Qde=new tt,zde=new tt,Gde=class extends s2{get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._dstRestQuat=new tt,this._invSrcRestQuat=new tt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),$_(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const n=Qde.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=zde.copy(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Vde=new $,jde=new tt,Wde=new tt,Kde=class extends s2{get rollAxis(){return this._rollAxis}set rollAxis(n){this._rollAxis=n,this._v3RollAxis.set(n==="X"?1:0,n==="Y"?1:0,n==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._rollAxis="X",this._v3RollAxis=new $(1,0,0),this._dstRestQuat=new tt,this._invDstRestQuat=new tt,this._invSrcRestQuatMulDstRestQuat=new tt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),$_(this._invDstRestQuat.copy(this._dstRestQuat)),$_(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const n=jde.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Vde.copy(this._v3RollAxis).applyQuaternion(n),r=Wde.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},Xde=new Set(["1.0","1.0-beta"]),xG=class Im{get name(){return Im.EXTENSION_NAME}constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}afterRoot(e){return iO(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return iO(this,null,function*(){var t;const r=this.parser.json;if(!(((t=r.extensionsUsed)==null?void 0:t.indexOf(Im.EXTENSION_NAME))!==-1))return null;const s=new Hde,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var c;const A=r.nodes[l],u=(c=A==null?void 0:A.extensions)==null?void 0:c[Im.EXTENSION_NAME];if(u==null)return;const f=u.specVersion;if(!Xde.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Im.EXTENSION_NAME} specVersion "${f}"`);return}const h=u.constraint;if(h.roll!=null){const d=this._importRollConstraint(a,o,h.roll);s.addConstraint(d)}else if(h.aim!=null){const d=this._importAimConstraint(a,o,h.aim);s.addConstraint(d)}else if(h.rotation!=null){const d=this._importRotationConstraint(a,o,h.rotation);s.addConstraint(d)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,t,r){const{source:i,rollAxis:s,weight:o}=r,a=t[i],l=new Kde(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new RB(l);this.helperRoot.add(c)}return l}_importAimConstraint(e,t,r){const{source:i,aimAxis:s,weight:o}=r,a=t[i],l=new Ode(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const c=new RB(l);this.helperRoot.add(c)}return l}_importRotationConstraint(e,t,r){const{source:i,weight:s}=r,o=t[i],a=new Gde(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new RB(a);this.helperRoot.add(l)}return a}};xG.EXTENSION_NAME="VRMC_node_constraint";var Yde=xG,vy=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(c){i(c)}},o=l=>{try{a(t.throw(l))}catch(c){i(c)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),o2=class{},UB=new $,KA=new $,bG=class extends o2{get type(){return"capsule"}constructor(n){var e,t,r,i;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.tail=(t=n==null?void 0:n.tail)!=null?t:new $(0,0,0),this.radius=(r=n==null?void 0:n.radius)!=null?r:0,this.inside=(i=n==null?void 0:n.inside)!=null?i:!1}calculateCollision(n,e,t,r){UB.copy(this.offset).applyMatrix4(n),KA.copy(this.tail).applyMatrix4(n),KA.sub(UB);const i=KA.lengthSq();r.copy(e).sub(UB);const s=KA.dot(r);s<=0||(i<=s||KA.multiplyScalar(s/i),r.sub(KA));const o=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),o}},FB=new $,oO=new ut,EG=class extends o2{get type(){return"plane"}constructor(n){var e,t;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.normal=(t=n==null?void 0:n.normal)!=null?t:new $(0,0,1)}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e),oO.getNormalMatrix(n),FB.copy(this.normal).applyNormalMatrix(oO).normalize();const i=r.dot(FB)-t;return r.copy(FB),i}},BG=class extends o2{get type(){return"sphere"}constructor(n){var e,t,r;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new $(0,0,0),this.radius=(t=n==null?void 0:n.radius)!=null?t:0,this.inside=(r=n==null?void 0:n.inside)!=null?r:!1}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e);const i=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),i}},ga=new $,$de=class extends Zt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new $,this._currentTail=new $,this._shape=n,this._attrPos=new lt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0);const t=ga.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(t)>1e-10&&(this._currentTail.copy(t),n=!0),n&&this._buildPosition()}_buildPosition(){ga.copy(this._currentTail).sub(this._currentOffset);const n=ga.length()/this._currentRadius;for(let r=0;r<=16;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+r,n+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+r,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+r,n+Math.sin(i),0,Math.cos(i))}for(let r=0;r<32;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+r,n,Math.sin(i),Math.cos(i))}const e=Math.atan2(ga.y,Math.sqrt(ga.x*ga.x+ga.z*ga.z)),t=-Math.atan2(ga.z,ga.x);this.rotateZ(e),this.rotateY(t),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<34;n++){const e=(n+1)%34;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(68+n*2,34+n,34+e)}for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(136+n*2,68+n,68+e),this._attrIndex.setXY(200+n*2,100+n,100+e)}this._attrIndex.needsUpdate=!0}},Zde=class extends Zt{constructor(n){super(),this.worldScale=1,this._currentOffset=new $,this._currentNormal=new $,this._shape=n,this._attrPos=new lt(new Float32Array(6*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},qde=class extends Zt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new $,this._shape=n,this._attrPos=new lt(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.needsUpdate=!0}},Jde=new $,PB=class extends ri{constructor(n){if(super(),this.matrixAutoUpdate=!1,this.collider=n,this.collider.shape instanceof BG)this._geometry=new qde(this.collider.shape);else if(this.collider.shape instanceof bG)this._geometry=new $de(this.collider.shape);else if(this.collider.shape instanceof EG)this._geometry=new Zde(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new Ac({color:16711935,depthTest:!1,depthWrite:!1});this._line=new y0(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=Jde.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},epe=class extends Zt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new $,this._springBone=n,this._attrPos=new lt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},tpe=new $,npe=class extends ri{constructor(n){super(),this.matrixAutoUpdate=!1,this.springBone=n,this._geometry=new epe(this.springBone);const e=new Ac({color:16776960,depthTest:!1,depthWrite:!1});this._line=new y0(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=tpe.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},LB=class extends Ft{constructor(n){super(),this.shape=n}},rpe=new ke;function SG(n){return n.invert?n.invert():n.getInverse(rpe.copy(n)),n}var ipe=class{constructor(n){this._inverseCache=new ke,this._shouldUpdateInverse=!0,this.matrix=n;const e={set:(t,r,i)=>(this._shouldUpdateInverse=!0,t[r]=i,!0)};this._originalElements=n.elements,n.elements=new Proxy(n.elements,e)}get inverse(){return this._shouldUpdateInverse&&(SG(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},spe=new ke,vl=new $,Wp=new $,ope=new $,Ff=new $,aO=new $,Kp=new $,lO=new tt,Pf=new ke,ape=new ke,lpe=class{constructor(n,e,t={},r=[]){this._currentTail=new $,this._prevTail=new $,this._boneAxis=new $,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new ke,this._initialLocalRotation=new tt,this._initialLocalChildPosition=new $;var i,s,o,a,l,c;this.bone=n,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=t.hitRadius)!=null?i:0,stiffness:(s=t.stiffness)!=null?s:1,gravityPower:(o=t.gravityPower)!=null?o:0,gravityDir:(l=(a=t.gravityDir)==null?void 0:a.clone())!=null?l:new $(0,-1,0),dragForce:(c=t.dragForce)!=null?c:.4},this.colliderGroups=r}get center(){return this._center}set center(n){var e;(e=this._center)!=null&&e.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=n,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new ipe(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:spe}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const n=this._getMatrixWorldToCenter(Pf);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const n=this._getMatrixWorldToCenter(Pf);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail)}update(n){if(n<=0)return;this._calcWorldSpaceBoneLength(),Ff.setFromMatrixPosition(this.bone.matrixWorld);let e=this._getMatrixWorldToCenter(Pf);aO.copy(Ff).applyMatrix4(e);const t=lO.setFromRotationMatrix(e),r=ape.copy(e).multiply(this._parentMatrixWorld),i=Wp.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(r).sub(aO).normalize(),s=ope.copy(this.settings.gravityDir).applyQuaternion(t).normalize(),o=this._getMatrixCenterToWorld(Pf);Kp.copy(this._currentTail).add(vl.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(vl.copy(i).multiplyScalar(this.settings.stiffness*n)).add(vl.copy(s).multiplyScalar(this.settings.gravityPower*n)).applyMatrix4(o),Kp.sub(Ff).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Ff),this._collision(Kp),e=this._getMatrixWorldToCenter(Pf),this._prevTail.copy(this._currentTail),this._currentTail.copy(vl.copy(Kp).applyMatrix4(e));const a=SG(Pf.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),l=lO.setFromUnitVectors(this._boneAxis,vl.copy(Kp).applyMatrix4(a).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(l),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(n){this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{const r=t.shape.calculateCollision(t.matrixWorld,n,this.settings.hitRadius,vl);r<0&&(n.add(vl.multiplyScalar(-r)),n.sub(Ff).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Ff))})})}_calcWorldSpaceBoneLength(){vl.setFromMatrixPosition(this.bone.matrixWorld),this.child?Wp.setFromMatrixPosition(this.child.matrixWorld):(Wp.copy(this._initialLocalChildPosition),Wp.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=vl.sub(Wp).length()}_getMatrixCenterToWorld(n){return this._center?n.copy(this._center.matrixWorld):n.identity(),n}_getMatrixWorldToCenter(n){return this._center?n.copy(this._center.userData.inverseCacheProxy.inverse):n.identity(),n}};function cpe(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function MG(n,e){n.children.forEach(t=>{e(t)||MG(t,e)})}var cO=class{constructor(){this._joints=new Set,this._hasWarnedCircularDependency=!1,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const n=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(t=>{n.add(t)})}),Array.from(n)}get colliders(){const n=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{n.add(t)})}),Array.from(n)}addJoint(n){this._joints.add(n);let e=this._objectSpringBonesMap.get(n.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(n.bone,e)),e.add(n)}addSpringBone(n){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(n)}deleteJoint(n){this._joints.delete(n),this._objectSpringBonesMap.get(n.bone).delete(n)}deleteSpringBone(n){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(n)}setInitState(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.setInitState())}reset(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.reset())}update(n){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.update(n)),MG(i.bone,s=>{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(s.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(n,e,t,r,i){if(t.has(n))return;if(e.has(n)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected while updating springbones"),this._hasWarnedCircularDependency=!0);return}e.add(n);const s=this._getDependencies(n);for(const o of s)cpe(o,a=>{const l=this._objectSpringBonesMap.get(a);if(l)for(const c of l)this._processSpringBone(c,e,t,r,i);else r.has(a)||(a.updateWorldMatrix(!1,!1),r.add(a))});n.bone.updateMatrix(),n.bone.updateWorldMatrix(!1,!1),i(n),r.add(n.bone),t.add(n)}_getDependencies(n){const e=new Set,t=n.bone.parent;return t&&e.add(t),n.colliderGroups.forEach(r=>{r.colliders.forEach(i=>{e.add(i)})}),e}},AO="VRMC_springBone_extended_collider",Ape=new Set(["1.0","1.0-beta"]),upe=new Set(["1.0"]),CG=class Yf{get name(){return Yf.EXTENSION_NAME}constructor(e,t){var r;this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot,this.useExtendedColliders=(r=t==null?void 0:t.useExtendedColliders)!=null?r:!0}afterRoot(e){return vy(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return vy(this,null,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){return vy(this,null,function*(){var t,r,i,s,o;const a=e.parser.json;if(!(((t=a.extensionsUsed)==null?void 0:t.indexOf(Yf.EXTENSION_NAME))!==-1))return null;const c=new cO,A=yield e.parser.getDependencies("node"),u=(r=a.extensions)==null?void 0:r[Yf.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!Ape.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Yf.EXTENSION_NAME} specVersion "${f}"`),null;const h=(i=u.colliders)==null?void 0:i.map((m,g)=>{var p,v,w,_,x,b,B,S,I,M,P,D,T,y,E;const R=A[m.node],L=m.shape,N=(p=m.extensions)==null?void 0:p[AO];if(this.useExtendedColliders&&N!=null){const z=N.specVersion;if(!upe.has(z))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${AO} specVersion "${z}". Fallbacking to the ${Yf.EXTENSION_NAME} definition`);else{const W=N.shape;if(W.sphere)return this._importSphereCollider(R,{offset:new $().fromArray((v=W.sphere.offset)!=null?v:[0,0,0]),radius:(w=W.sphere.radius)!=null?w:0,inside:(_=W.sphere.inside)!=null?_:!1});if(W.capsule)return this._importCapsuleCollider(R,{offset:new $().fromArray((x=W.capsule.offset)!=null?x:[0,0,0]),radius:(b=W.capsule.radius)!=null?b:0,tail:new $().fromArray((B=W.capsule.tail)!=null?B:[0,0,0]),inside:(S=W.capsule.inside)!=null?S:!1});if(W.plane)return this._importPlaneCollider(R,{offset:new $().fromArray((I=W.plane.offset)!=null?I:[0,0,0]),normal:new $().fromArray((M=W.plane.normal)!=null?M:[0,0,1])})}}if(L.sphere)return this._importSphereCollider(R,{offset:new $().fromArray((P=L.sphere.offset)!=null?P:[0,0,0]),radius:(D=L.sphere.radius)!=null?D:0,inside:!1});if(L.capsule)return this._importCapsuleCollider(R,{offset:new $().fromArray((T=L.capsule.offset)!=null?T:[0,0,0]),radius:(y=L.capsule.radius)!=null?y:0,tail:new $().fromArray((E=L.capsule.tail)!=null?E:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),d=(s=u.colliderGroups)==null?void 0:s.map((m,g)=>{var p;return{colliders:((p=m.colliders)!=null?p:[]).map(w=>{const _=h==null?void 0:h[w];if(_==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${g} attempted to use a collider #${w} but not found`);return _}),name:m.name}});return(o=u.springs)==null||o.forEach((m,g)=>{var p;const v=m.joints,w=(p=m.colliderGroups)==null?void 0:p.map(b=>{const B=d==null?void 0:d[b];if(B==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${b} but not found`);return B}),_=m.center!=null?A[m.center]:void 0;let x;v.forEach(b=>{if(x){const B=x.node,S=A[B],I=b.node,M=A[I],P={hitRadius:x.hitRadius,dragForce:x.dragForce,gravityPower:x.gravityPower,stiffness:x.stiffness,gravityDir:x.gravityDir!=null?new $().fromArray(x.gravityDir):void 0},D=this._importJoint(S,M,P,w);_&&(D.center=_),c.addJoint(D)}x=b})}),c.setInitState(),c})}_v0Import(e){return vy(this,null,function*(){var t,r,i;const s=e.parser.json;if(!(((t=s.extensionsUsed)==null?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const c=l==null?void 0:l.boneGroups;if(!c)return null;const A=new cO,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)==null?void 0:i.map(h=>{var d;const m=u[h.node];return{colliders:((d=h.colliders)!=null?d:[]).map((p,v)=>{var w,_,x;const b=new $(0,0,0);return p.offset&&b.set((w=p.offset.x)!=null?w:0,(_=p.offset.y)!=null?_:0,p.offset.z?-p.offset.z:0),this._importSphereCollider(m,{offset:b,radius:(x=p.radius)!=null?x:0,inside:!1})})}});return c==null||c.forEach((h,d)=>{const m=h.bones;m&&m.forEach(g=>{var p,v,w,_;const x=u[g],b=new $;h.gravityDir?b.set((p=h.gravityDir.x)!=null?p:0,(v=h.gravityDir.y)!=null?v:0,(w=h.gravityDir.z)!=null?w:0):b.set(0,-1,0);const B=h.center!=null?u[h.center]:void 0,S={hitRadius:h.hitRadius,dragForce:h.dragForce,gravityPower:h.gravityPower,stiffness:h.stiffiness,gravityDir:b},I=(_=h.colliderGroups)==null?void 0:_.map(M=>{const P=f==null?void 0:f[M];if(P==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${d} attempted to use a colliderGroup ${M} but not found`);return P});x.traverse(M=>{var P;const D=(P=M.children[0])!=null?P:null,T=this._importJoint(M,D,S,I);B&&(T.center=B),A.addJoint(T)})})}),e.scene.updateMatrixWorld(),A.setInitState(),A})}_importJoint(e,t,r,i){const s=new lpe(e,t,r,i);if(this.jointHelperRoot){const o=new npe(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const r=new BG(t),i=new LB(r);if(e.add(i),this.colliderHelperRoot){const s=new PB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,t){const r=new bG(t),i=new LB(r);if(e.add(i),this.colliderHelperRoot){const s=new PB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,t){const r=new EG(t),i=new LB(r);if(e.add(i),this.colliderHelperRoot){const s=new PB(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};CG.EXTENSION_NAME="VRMC_springBone";var fpe=CG,hpe=class{get name(){return"VRMLoaderPlugin"}constructor(n,e){var t,r,i,s,o,a,l,c,A,u;this.parser=n;const f=e==null?void 0:e.helperRoot,h=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(t=e==null?void 0:e.expressionPlugin)!=null?t:new Uhe(n),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new Phe(n),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new Qhe(n,{helperRoot:f,autoUpdateHumanBones:h}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new nde(n,{helperRoot:f}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new sde(n),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new yde(n),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new _de(n),this.materialsV0CompatPlugin=(c=e==null?void 0:e.materialsV0CompatPlugin)!=null?c:new Cde(n),this.springBonePlugin=(A=e==null?void 0:e.springBonePlugin)!=null?A:new fpe(n,{colliderHelperRoot:f,jointHelperRoot:f}),this.nodeConstraintPlugin=(u=e==null?void 0:e.nodeConstraintPlugin)!=null?u:new Yde(n,{helperRoot:f})}beforeRoot(){return py(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(n){return py(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(n)})}getMaterialType(n){const e=this.mtoonMaterialPlugin.getMaterialType(n);return e??null}extendMaterialParams(n,e){return py(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(n,e),yield this.mtoonMaterialPlugin.extendMaterialParams(n,e)})}afterRoot(n){return py(this,null,function*(){yield this.metaPlugin.afterRoot(n),yield this.humanoidPlugin.afterRoot(n),yield this.expressionPlugin.afterRoot(n),yield this.lookAtPlugin.afterRoot(n),yield this.firstPersonPlugin.afterRoot(n),yield this.springBonePlugin.afterRoot(n),yield this.nodeConstraintPlugin.afterRoot(n),yield this.mtoonMaterialPlugin.afterRoot(n);const e=n.userData.vrmMeta,t=n.userData.vrmHumanoid;if(e&&t){const r=new ade({scene:n.scene,expressionManager:n.userData.vrmExpressionManager,firstPerson:n.userData.vrmFirstPerson,humanoid:t,lookAt:n.userData.vrmLookAt,meta:e,materials:n.userData.vrmMToonMaterials,springBoneManager:n.userData.vrmSpringBoneManager,nodeConstraintManager:n.userData.vrmNodeConstraintManager});n.userData.vrm=r}})}};function uO(n){if(Object.values(n).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),n.isShaderMaterial){const e=n.uniforms;e&&Object.values(e).forEach(t=>{const r=t.value;r!=null&&r.isTexture&&r.dispose()})}n.dispose()}function dpe(n){const e=n.geometry;e&&e.dispose();const t=n.skeleton;t&&t.dispose();const r=n.material;r&&(Array.isArray(r)?r.forEach(i=>uO(i)):r&&uO(r))}function ppe(n){n.traverse(dpe)}function mpe(n,e){var t;const r=(t=e==null?void 0:e.experimentalSameBoneCounts)!=null?t:!1,i=[];n.traverse(a=>{a.type==="SkinnedMesh"&&i.push(a)});const s=new Map;let o=0;for(const a of i){const c=a.geometry.getAttribute("skinIndex"),A=[],u=[],f={},h=c.array;for(let d=0;d{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,c=l.index;if(c==null)return;const A=e.get(l);if(A!=null){a.geometry=A;return}const u=new Zt;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(m=>{u.addGroup(m.start,m.count,m.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)==null?void 0:r.clone())!=null?i:null,u.boundingSphere=(o=(s=l.boundingSphere)==null?void 0:s.clone())!=null?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],h=[];{const m=c.array,g=new m.constructor(m.length);let p=0;for(let v=0;v{const g=l.attributes[m];if(g.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const p=g.array,{itemSize:v,normalized:w}=g,_=new p.constructor(h.length*v);h.forEach((x,b)=>{for(let B=0;B{u.morphAttributes[m]=[];const g=l.morphAttributes[m];for(let p=0;p{for(let I=0;I<_;I++)b[S*_+I]=w[B*_+I]}),d=d&&b.every(B=>B===0),u.morphAttributes[m][p]=new lt(b,_,x)}}),d&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function vpe(n){var e;((e=n.meta)==null?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}var E0=class{constructor(){}};E0.deepDispose=ppe;E0.removeUnnecessaryJoints=mpe;E0.removeUnnecessaryVertices=gpe;E0.rotateVRM0=vpe;/*! * @pixiv/three-vrm-core v3.1.4 * The implementation of core features of VRM, for @pixiv/three-vrm * @@ -4913,7 +4913,7 @@ void main() { * Copyright (c) 2019-2024 pixiv Inc. * @pixiv/three-vrm-springbone is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */var vr;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(vr||(vr={}));const Y_="blend_",AO="vrmColliderSphere";class hpe{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},c={},A={},u=e.lookAt,f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(s)if(o)if(a){if(!u)throw new Error("lookAt is undefined or null")}else throw new Error("materials is undefined or null");else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=a.filter((me,ve,be)=>be.findIndex(ne=>ne.name===me.name.replace(" (Outline)",""))===ve).map(me=>me),d=h.map(me=>me.name),m=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(me=>me.map).map(me=>{if(!me.map)throw new Error(me.name+" map is null");return{name:me.name,imageBitmap:me.map.image}}),p=h.filter(me=>me.userData.shadeTexture).map(me=>{if(!me.userData.shadeTexture)throw new Error(me.userData.shadeTexture+" map is null");return{name:me.name+"_shade",imageBitmap:me.userData.shadeTexture.image}}),v=g.concat(p),w=vpe(v,m),_=ype(w),x=wpe(w),b=gpe(h,v),B=t.children.filter(me=>me.children.length>0&&me.children[0].type===Fi.Bone)[0],M=MG(B).filter(me=>me.name!==AO),I=M.map(me=>me.name),S=M.map(me=>({children:me.children.filter(ve=>ve.name!==AO).map(ve=>I.indexOf(ve.name)),name:me.name,rotation:[me.quaternion.x,me.quaternion.y,me.quaternion.z,me.quaternion.w],scale:[me.scale.x,me.scale.y,me.scale.z],translation:[me.position.x,me.position.y,me.position.z]})),L=[],O=t.children.filter(me=>me.type===Fi.Group||me.type===Fi.SkinnedMesh),T=[];O.forEach(me=>{const ve=me.type===Fi.Group?me.children[0]:me,be=ve.geometry.attributes;T.push(new gl(be.position,vr.FLOAT,ln.POSITION,zo.VEC3,ve.name,void 0)),T.push(new gl(be.normal,vr.FLOAT,ln.NORMAL,zo.VEC3,ve.name,void 0)),T.push(new gl(be.uv,vr.FLOAT,ln.UV,zo.VEC2,ve.name,void 0)),T.push(new gl(be.skinWeight,vr.FLOAT,ln.SKIN_WEIGHT,zo.VEC4,ve.name,void 0)),T.push(new gl(be.skinIndex,vr.UNSIGNED_SHORT,ln.SKIN_INDEX,zo.VEC4,ve.name,void 0)),(me.type===Fi.Group?me.children.map(k=>k):[me]).forEach(k=>{if(!k.geometry.index)throw new Error(k.name+" geometry.index is null");T.push(new gl(k.geometry.index,vr.UNSIGNED_INT,ln.INDEX,zo.SCALAR,ve.name,k.name))}),ve.morphTargetDictionary||(ve.morphTargetDictionary={},ve.morphTargetInfluences=[],ve.geometry.morphAttributes={},ve.updateMorphTargets()),ve.geometry.userData.targetNames=[];for(const k in e.expressionManager.expressionMap){const ae=e.expressionManager.expressionMap[k],le=ae._binds.map(J=>({node:M.length,index:J.index,weight:J.weight}));let Z=!1;for(const J in ti)if(k.toLowerCase()===ti[J].toLowerCase()){l[ti[J]]={morphTargetBinds:le,isBinary:ae.isBinary,overrideBlink:ae.overrideBlink,overrideLookAt:ae.overrideLookAt,overrideMouth:ae.overrideMouth},Z=!0;break}!Z&&k.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:le,isBinary:ae.isBinary,overrideBlink:ae.overrideBlink,overrideLookAt:ae.overrideLookAt,overrideMouth:ae.overrideMouth},Z=!0),Z===!1&&(c[k]={morphTargetBinds:le,isBinary:ae.isBinary,overrideBlink:ae.overrideBlink,overrideLookAt:ae.overrideLookAt,overrideMouth:ae.overrideMouth})}for(const k in ve.morphTargetDictionary){ve.geometry.userData.targetNames.push(k);const ae=ve.morphTargetDictionary[k],le=ve.geometry.morphAttributes;T.push(new gl(le.position[ae],vr.FLOAT,ln.BLEND_POSITION,zo.VEC3,ve.name,Y_+k)),T.push(new gl(le.normal[ae],vr.FLOAT,ln.BLEND_NORMAL,zo.VEC3,ve.name,Y_+k))}}),Object.keys(l).length>0&&(A.preset=l),Object.keys(c).length>0&&(A.custom=c),O.forEach(me=>{const ve=me.type===Fi.Group?me.children[0]:me,be=new Float32Array(ve.skeleton.boneInverses.map(ne=>ne.elements).flat());T.push(new gl(new lt(be,16),vr.FLOAT,ln.BIND_MATRIX,zo.MAT4,ve.name,ve.name))}),L.push(...T.map(me=>({bufferView:-1,byteOffset:0,componentType:me.valueType,count:me.attribute.count,max:me.max,min:me.min,normalized:!1,type:me.accessorsType})));const y=ppe(O,T,d);O.forEach((me,ve)=>{S.push({mesh:ve,name:me.name,rotation:[me.quaternion.x,me.quaternion.y,me.quaternion.z,me.quaternion.w],scale:[me.scale.x,me.scale.y,me.scale.z],skin:ve,translation:[me.position.x,me.position.y,me.position.z]})});const E=mpe(O,T,I),U={offsetFromHeadBone:[0,0,0],rangeMapHorizontalInner:{inputMaxValue:u.applier.rangeMapHorizontalInner.inputMaxValue,outputScale:u.applier.rangeMapHorizontalInner.outputScale},rangeMapHorizontalOuter:{inputMaxValue:u.applier.rangeMapHorizontalOuter.inputMaxValue,outputScale:u.applier.rangeMapHorizontalOuter.outputScale},rangeMapVerticalDown:{inputMaxValue:u.applier.rangeMapVerticalDown.inputMaxValue,outputScale:u.applier.rangeMapVerticalDown.outputScale},rangeMapVerticalUp:{inputMaxValue:u.applier.rangeMapVerticalUp.inputMaxValue,outputScale:u.applier.rangeMapVerticalUp.outputScale},type:"bone"},P={humanBones:{}};for(const me in s.humanBones)P.humanBones[me]={node:I.indexOf(s.humanBones[me].node.name)};const N=o,z=[];z.push(...v.map(me=>({buffer:uO(me.imageBitmap),type:ln.IMAGE}))),z.push(...T.map(me=>({buffer:me.buffer,type:me.type}))),m&&z.push({buffer:uO(m.imageBitmap),type:ln.IMAGE});let W=0,H=0,C=0;const K=z.map((me,ve)=>{const be={buffer:0,byteLength:me.buffer.byteLength,byteOffset:W,target:me.type===ln.IMAGE||me.type===ln.BIND_MATRIX?void 0:me.type===ln.INDEX?vr.ELEMENT_ARRAY_BUFFER:vr.ARRAY_BUFFER};return W+=me.buffer.byteLength,me.type===ln.IMAGE?w[H++].bufferView=ve:L[C++].bufferView=ve,be}),te=_pe(t,S),F={accessors:L,asset:f,buffers:[{byteLength:W}],bufferViews:K,extensions:{VRMC_vrm:{expressions:A,humanoid:P,lookAt:U,meta:N,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:w,materials:b,meshes:y,nodes:S,samplers:_,avatar:0,scenes:te,skins:E,textures:x},re=new fO(nT(JSON.stringify(F,void 0,2)),"JSON"),ce=new fO(Im(z.map(me=>me.buffer)),"BIN\0"),oe=Im([re.buffer,ce.buffer]),ge=Im([nT("glTF"),tT(2,4),tT(oe.byteLength+12,4)]);i(Im([ge,oe]))}}function MG(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>MG(e)).flat())}function uO(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=new ArrayBuffer(r.length),s=new DataView(i);for(let o=0;o4?c=r[a*n.itemSize+l]:l===0?c=n.getX(a):l===1?c=n.getY(a):l===2?c=n.getZ(a):c=n.getW(a),e===vr.UNSIGNED_SHORT?o.setUint16(i,c,!0):e===vr.UNSIGNED_INT?o.setUint32(i,c,!0):o.setFloat32(i,c,!0),i+=t}return s}let fO=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=Im([tT(r.byteLength,4),nT(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sl%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0,this.min=r===ln.POSITION||r===ln.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0}};var Nh;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Nh||(Nh={}));var zo;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(zo||(zo={}));var ln;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(ln||(ln={}));var Fi;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(Fi||(Fi={}));const ppe=(n,e,t)=>n.map(r=>{const i=r.type===Fi.Group?r.children[0]:r,s=r.type===Fi.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(c=>c.meshName===i.name?c.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(ln.SKIN_INDEX),NORMAL:a.indexOf(ln.NORMAL),POSITION:a.indexOf(ln.POSITION),TEXCOORD_0:a.indexOf(ln.UV),WEIGHTS_0:a.indexOf(ln.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(c=>c.type===ln.INDEX&&c.meshName===i.name?c.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(c=>({NORMAL:e.map(A=>A.type===ln.BLEND_NORMAL&&A.meshName===i.name?A.name:null).indexOf(Y_+c),POSITION:e.map(A=>A.type===ln.BLEND_POSITION&&A.meshName===i.name?A.name:null).indexOf(Y_+c)})):void 0}})}}),mpe=(n,e,t)=>n.map(r=>{const i=r.type===Fi.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===ln.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),gpe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i=t.userData.gltfExtensions.VRMC_materials_mtoon,i.shadeMultiplyTexture={index:e.map(A=>A.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const c=t;r=c.color?[c.color.r,c.color.g,c.color.b,1]:void 0}let s=-1;t.map?s=e.map(c=>c.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(c=>c.name).indexOf(t.uniforms.map.name));const o=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,a=(()=>{switch(t.type){case Nh.MeshStandardMaterial:return t.metalness;case Nh.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case Nh.MeshStandardMaterial:return t.roughness;case Nh.MeshBasicMaterial:return .9;default:return .9}})();return{alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:{baseColorFactor:r,baseColorTexture:o,metallicFactor:a,roughnessFactor:l}}}),vpe=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),ype=n=>n.map(()=>({magFilter:vr.LINEAR,minFilter:vr.LINEAR,wrapS:vr.REPEAT,wrapT:vr.REPEAT})),wpe=n=>n.map((e,t)=>({sampler:0,source:t})),_pe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===Fi.Object3D||r.type===Fi.SkinnedMesh||r.type===Fi.Group||r.type===Fi.Bone).map(r=>t.indexOf(r.name))}]},CG=0,xpe=1,TG=2,hO=2,FB=1.25,dO=1,ig=6*4+4+4,B1=65535,bpe=Math.pow(2,-24),PB=Symbol("SKIP_GENERATION");function Epe(n){return n.index?n.index.count:n.attributes.position.count}function Zd(n){return Epe(n)/3}function Bpe(n,e=ArrayBuffer){return n>65535?new Uint32Array(new e(4*n)):new Uint16Array(new e(2*n))}function Spe(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Bpe(t,r);n.setIndex(new lt(i,1));for(let s=0;sl-c);for(let l=0;lo.offset-a.offset),i=r[r.length-1];i.count=Math.min(t-i.offset,i.count);let s=0;return r.forEach(({count:o})=>s+=o),t!==s}function LB(n,e,t,r,i){let s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,A=-1/0,u=1/0,f=1/0,h=1/0,d=-1/0,m=-1/0,g=-1/0;for(let p=e*6,v=(e+t)*6;pl&&(l=b),wd&&(d=w);const B=n[p+2],M=n[p+3],I=B-M,S=B+M;Ic&&(c=S),Bm&&(m=B);const L=n[p+4],O=n[p+5],T=L-O,y=L+O;TA&&(A=y),Lg&&(g=L)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=c,r[5]=A,i[0]=u,i[1]=f,i[2]=h,i[3]=d,i[4]=m,i[5]=g}function Cpe(n,e=null,t=null,r=null){const i=n.attributes.position,s=n.index?n.index.array:null,o=Zd(n),a=i.normalized;let l;e===null?(l=new Float32Array(o*6),t=0,r=o):(l=e,t=t||0,r=r||o);const c=i.array,A=i.offset||0;let u=3;i.isInterleavedBufferAttribute&&(u=i.data.stride);const f=["getX","getY","getZ"];for(let h=t;hM&&(M=x),b>M&&(M=b);const I=(M-B)/2,S=w*2;l[m+S+0]=B+I,l[m+S+1]=I+(Math.abs(B)+I)*bpe}}return l}function er(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function pO(n){let e=-1,t=-1/0;for(let r=0;r<3;r++){const i=n[r+3]-n[r];i>t&&(t=i,e=r)}return e}function mO(n,e){e.set(n)}function gO(n,e,t){let r,i;for(let s=0;s<3;s++){const o=s+3;r=n[s],i=e[s],t[s]=ri?r:i}}function my(n,e,t){for(let r=0;r<3;r++){const i=e[n+2*r],s=e[n+2*r+1],o=i-s,a=i+s;ot[r+3]&&(t[r+3]=a)}}function Kp(n){const e=n[3]-n[0],t=n[4]-n[1],r=n[5]-n[2];return 2*(e*t+t*r+r*e)}const bl=32,Tpe=(n,e)=>n.candidate-e.candidate,Mc=new Array(bl).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),gy=new Float32Array(6);function Ipe(n,e,t,r,i,s){let o=-1,a=0;if(s===CG)o=pO(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===xpe)o=pO(n),o!==-1&&(a=Rpe(t,r,i,o));else if(s===TG){const l=Kp(n);let c=FB*i;const A=r*6,u=(r+i)*6;for(let f=0;f<3;f++){const h=e[f],g=(e[f+3]-h)/bl;if(i=B.candidate?my(_,t,B.rightCacheBounds):(my(_,t,B.leftCacheBounds),B.count++)}}for(let _=0;_=bl&&(b=bl-1);const B=Mc[b];B.count++,my(w,t,B.bounds)}const p=Mc[bl-1];mO(p.bounds,p.rightCacheBounds);for(let w=bl-2;w>=0;w--){const _=Mc[w],x=Mc[w+1];gO(_.bounds,x.rightCacheBounds,_.rightCacheBounds)}let v=0;for(let w=0;w=l;)a--;if(o=l;)a--;if(oPpe)throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return Rm[t+6]=c/4,c=iT(c,a),Rm[t+7]=l,c}}function Dpe(n,e){const t=(n.index?n.index.count:n.attributes.position.count)/3,r=t>2**16,i=r?4:2,s=e?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),o=r?new Uint32Array(s):new Uint16Array(s);for(let a=0,l=o.length;a=s&&(p=!0,o&&(console.warn(`MeshBVH: Max depth of ${s} reached when generating BVH. Consider increasing maxDepth.`),console.warn(f))),B<=a||I>=s)return w(b+B),x.offset=b,x.count=B,x;const S=Ipe(x.boundingData,M,e,b,B,l);if(S.axis===-1)return w(b+B),x.offset=b,x.count=B,x;const L=d(u,h,e,b,B,S);if(L===b||L===b+B)w(b+B),x.offset=b,x.count=B;else{x.splitAxis=S.axis;const O=new DB,T=b,y=L-b;x.left=O,LB(e,T,y,O.boundingData,g),_(O,T,y,g,I+1);const E=new DB,U=L,P=B-y;x.right=E,LB(e,U,P,E.boundingData,g),_(E,U,P,g,I+1)}return x}}function Ope(n,e){const t=n.geometry;e.indirect&&(n._indirectBuffer=Dpe(t,e.useSharedArrayBuffer),Mpe(t,e.range)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups or a range that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),n._indirectBuffer||Spe(t,e);const r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Cpe(t),s=e.indirect?IG(t,e.range):RG(t,e.range);n._roots=s.map(o=>{const a=Npe(n,i,o.offset,o.count,e),l=rT(a),c=new r(ig*l);return Lpe(0,a,c),c})}class rc{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}rc.prototype.setFromBox=function(){const n=new $;return function(t,r){const i=r.min,s=r.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let c=0;c<=1;c++)for(let A=0;A<=1;A++){n.x=i.x*l+s.x*(1-l),n.y=i.y*c+s.y*(1-c),n.z=i.z*A+s.z*(1-A);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const kpe=function(){const n=new $,e=new $,t=new $;return function(i,s,o){const a=i.start,l=n,c=s.start,A=e;t.subVectors(a,c),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(A),f=A.dot(l),h=A.dot(A),d=t.dot(l),g=l.dot(l)*h-f*f;let p,v;g!==0?p=(u*f-d*h)/g:p=0,v=(u+p*f)/h,o.x=p,o.y=v}}(),s2=function(){const n=new je,e=new $,t=new $;return function(i,s,o,a){kpe(i,s,n);let l=n.x,c=n.y;if(l>=0&&l<=1&&c>=0&&c<=1){i.at(l,o),s.at(c,a);return}else if(l>=0&&l<=1){c<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(c>=0&&c<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let A;l<0?A=i.start:A=i.end;let u;c<0?u=s.start:u=s.end;const f=e,h=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(A,!0,t),f.distanceToSquared(u)<=h.distanceToSquared(A)){o.copy(f),a.copy(u);return}else{o.copy(A),a.copy(h);return}}}}(),Hpe=function(){const n=new $,e=new $,t=new Sa,r=new Gl;return function(s,o){const{radius:a,center:l}=s,{a:c,b:A,c:u}=o;if(r.start=c,r.end=A,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const m=o.getPlane(t);if(Math.abs(m.distanceToPoint(l))<=a){const p=m.projectPoint(l,e);if(o.containsPoint(p))return!0}return!1}}(),Qpe=1e-15;function NB(n){return Math.abs(n)new $),this.satBounds=new Array(4).fill().map(()=>new rc),this.points=[this.a,this.b,this.c],this.sphere=new Ei,this.plane=new Sa,this.needsUpdate=!0}intersectsSphere(e){return Hpe(e,this)}update(){const e=this.a,t=this.b,r=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const c=s[1],A=o[1];c.subVectors(e,t),A.setFromPoints(c,i);const u=s[2],f=o[2];u.subVectors(t,r),f.setFromPoints(u,i);const h=s[3],d=o[3];h.subVectors(r,e),d.setFromPoints(h,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}sa.prototype.closestPointToSegment=function(){const n=new $,e=new $,t=new Gl;return function(i,s=null,o=null){const{start:a,end:l}=i,c=this.points;let A,u=1/0;for(let f=0;f<3;f++){const h=(f+1)%3;t.start.copy(c[f]),t.end.copy(c[h]),s2(t,i,n,e),A=n.distanceToSquared(e),A=2){(_===1?p.start:p.end).copy(h),w=2;break}if(w++,w===2&&_===-1)break}}return w}return function(g,p=null,v=!1){this.needsUpdate&&this.update(),g.isExtendedTriangle?g.needsUpdate&&g.update():(n.copy(g),n.update(),g=n);const w=this.plane,_=g.plane;if(Math.abs(w.normal.dot(_.normal))>1-1e-10){const x=this.satBounds,b=this.satAxes;t[0]=g.a,t[1]=g.b,t[2]=g.c;for(let I=0;I<4;I++){const S=x[I],L=b[I];if(r.setFromPoints(L,t),S.isSeparated(r))return!1}const B=g.satBounds,M=g.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let I=0;I<4;I++){const S=B[I],L=M[I];if(r.setFromPoints(L,e),S.isSeparated(r))return!1}for(let I=0;I<4;I++){const S=b[I];for(let L=0;L<4;L++){const O=M[L];if(s.crossVectors(S,O),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return p&&(v||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}else{const x=d(this,_,u);if(x===1&&g.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(x!==2)return!1;const b=d(g,w,f);if(b===1&&this.containsPoint(f.end))return p&&(p.start.copy(f.end),p.end.copy(f.end)),!0;if(b!==2)return!1;if(u.delta(a),f.delta(l),a.dot(l)<0){let T=f.start;f.start=f.end,f.end=T}const B=u.start.dot(a),M=u.end.dot(a),I=f.start.dot(a),S=f.end.dot(a),L=M0?p.start.copy(u.start):p.start.copy(f.start),c.subVectors(u.end,f.end),c.dot(a)<0?p.end.copy(u.end):p.end.copy(f.end)),!0)}}}();sa.prototype.distanceToPoint=function(){const n=new $;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();sa.prototype.distanceToTriangle=function(){const n=new $,e=new $,t=["a","b","c"],r=new Gl,i=new Gl;return function(o,a=null,l=null){const c=a||l?r:null;if(this.intersectsTriangle(o,c))return(a||l)&&(a&&c.getCenter(a),l&&c.getCenter(l)),0;let A=1/0;for(let u=0;u<3;u++){let f;const h=t[u],d=o[h];this.closestPointToPoint(d,n),f=d.distanceToSquared(n),fnew $),this.satAxes=new Array(3).fill().map(()=>new $),this.satBounds=new Array(3).fill().map(()=>new rc),this.alignedSatBounds=new Array(3).fill().map(()=>new rc),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}Hi.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let c=0;c<=1;c++)for(let A=0;A<=1;A++)for(let u=0;u<=1;u++){const f=1*c|2*A|4*u,h=i[f];h.x=c?r.x:t.x,h.y=A?r.y:t.y,h.z=u?r.z:t.z,h.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let c=0;c<3;c++){const A=o[c],u=s[c],f=1<new Gl),t=new Array(12).fill().map(()=>new Gl),r=new $,i=new $;return function(o,a=0,l=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||c)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),c&&c.copy(i)),0;const A=a*a,u=o.min,f=o.max,h=this.points;let d=1/0;for(let g=0;g<8;g++){const p=h[g];i.copy(p).clamp(u,f);const v=p.distanceToSquared(i);if(vnew sa)}}const mo=new zpe;class Gpe{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=r=>{t&&e.push(t),t=r,this.float32Array=new Float32Array(r),this.uint16Array=new Uint16Array(r),this.uint32Array=new Uint32Array(r)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const Rn=new Gpe;let Zc,Oh;const Uf=[],vy=new o2(()=>new Qn);function Vpe(n,e,t,r,i,s){Zc=vy.getPrimitive(),Oh=vy.getPrimitive(),Uf.push(Zc,Oh),Rn.setBuffer(n._roots[e]);const o=sT(0,n.geometry,t,r,i,s);Rn.clearBuffer(),vy.releasePrimitive(Zc),vy.releasePrimitive(Oh),Uf.pop(),Uf.pop();const a=Uf.length;return a>0&&(Oh=Uf[a-1],Zc=Uf[a-2]),o}function sT(n,e,t,r,i=null,s=0,o=0){const{float32Array:a,uint16Array:l,uint32Array:c}=Rn;let A=n*2;if(Yi(A,l)){const f=Rs(n,c),h=fo(A,l);return er(n,a,Zc),r(f,h,!1,o,s+n,Zc)}else{let S=function(O){const{uint16Array:T,uint32Array:y}=Rn;let E=O*2;for(;!Yi(E,T);)O=ho(O),E=O*2;return Rs(O,y)},L=function(O){const{uint16Array:T,uint32Array:y}=Rn;let E=O*2;for(;!Yi(E,T);)O=po(O,y),E=O*2;return Rs(O,y)+fo(E,T)};const f=ho(n),h=po(n,c);let d=f,m=h,g,p,v,w;if(i&&(v=Zc,w=Oh,er(d,a,v),er(m,a,w),g=i(v),p=i(w),p(Xp.copy(e).clamp(A.min,A.max),Xp.distanceToSquared(e)),intersectsBounds:(A,u,f)=>f{A.closestPointToPoint(e,Xp);const f=e.distanceToSquared(Xp);return f=169,WA=new $,KA=new $,XA=new $,yy=new je,wy=new je,_y=new je,vO=new $,yO=new $,wO=new $,Yp=new $;function Kpe(n,e,t,r,i,s,o,a){let l;if(s===si?l=n.intersectTriangle(r,t,e,!0,i):l=n.intersectTriangle(e,t,r,s!==wi,i),l===null)return null;const c=n.origin.distanceTo(i);return ca?null:{distance:c,point:i.clone()}}function Xpe(n,e,t,r,i,s,o,a,l,c,A){WA.fromBufferAttribute(e,s),KA.fromBufferAttribute(e,o),XA.fromBufferAttribute(e,a);const u=Kpe(n,WA,KA,XA,Yp,l,c,A);if(u){const f=new $;Vr.getBarycoord(Yp,WA,KA,XA,f),r&&(yy.fromBufferAttribute(r,s),wy.fromBufferAttribute(r,o),_y.fromBufferAttribute(r,a),u.uv=Vr.getInterpolation(Yp,WA,KA,XA,yy,wy,_y,new je)),i&&(yy.fromBufferAttribute(i,s),wy.fromBufferAttribute(i,o),_y.fromBufferAttribute(i,a),u.uv1=Vr.getInterpolation(Yp,WA,KA,XA,yy,wy,_y,new je)),t&&(vO.fromBufferAttribute(t,s),yO.fromBufferAttribute(t,o),wO.fromBufferAttribute(t,a),u.normal=Vr.getInterpolation(Yp,WA,KA,XA,vO,yO,wO,new $),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a:s,b:o,c:a,normal:new $,materialIndex:0};Vr.getNormal(WA,KA,XA,h.normal),u.face=h,u.faceIndex=s,Wpe&&(u.barycoord=f)}return u}function S1(n,e,t,r,i,s,o){const a=r*3;let l=a+0,c=a+1,A=a+2;const u=n.index;n.index&&(l=u.getX(l),c=u.getX(c),A=u.getX(A));const{position:f,normal:h,uv:d,uv1:m}=n.attributes,g=Xpe(t,f,h,d,m,l,c,A,e,s,o);return g?(g.faceIndex=r,i&&i.push(g),g):null}function Sr(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,c=e+2;t&&(a=t.getX(a),l=t.getX(l),c=t.getX(c)),i.x=r.getX(a),i.y=r.getY(a),i.z=r.getZ(a),s.x=r.getX(l),s.y=r.getY(l),s.z=r.getZ(l),o.x=r.getX(c),o.y=r.getY(c),o.z=r.getZ(c)}function Ype(n,e,t,r,i,s,o,a){const{geometry:l,_indirectBuffer:c}=n;for(let A=r,u=r+i;Ab&&(b=O),T<_&&(_=T),T>B&&(B=T),yM&&(M=y)}return l[f+0]!==w||l[f+1]!==_||l[f+2]!==x||l[f+3]!==b||l[f+4]!==B||l[f+5]!==M?(l[f+0]=w,l[f+1]=_,l[f+2]=x,l[f+3]=b,l[f+4]=B,l[f+5]=M,!0):!1}else{const p=f+8,v=o[f+6],w=p+h,_=v+h;let x=d,b=!1,B=!1;e?x||(b=e.has(w),B=e.has(_),x=!b&&!B):(b=!0,B=!0);const M=x||b,I=x||B;let S=!1;M&&(S=u(p,h,x));let L=!1;I&&(L=u(v,h,x));const O=S||L;if(O)for(let T=0;T<3;T++){const y=p+T,E=v+T,U=l[y],P=l[y+3],N=l[E],z=l[E+3];l[f+T]=Uz?P:z}return O}}}function yA(n,e,t,r,i){let s,o,a,l,c,A;const u=1/t.direction.x,f=1/t.direction.y,h=1/t.direction.z,d=t.origin.x,m=t.origin.y,g=t.origin.z;let p=e[n],v=e[n+3],w=e[n+1],_=e[n+3+1],x=e[n+2],b=e[n+3+2];return u>=0?(s=(p-d)*u,o=(v-d)*u):(s=(v-d)*u,o=(p-d)*u),f>=0?(a=(w-m)*f,l=(_-m)*f):(a=(_-m)*f,l=(w-m)*f),s>l||a>o||((a>s||isNaN(s))&&(s=a),(l=0?(c=(x-g)*h,A=(b-g)*h):(c=(b-g)*h,A=(x-g)*h),s>A||c>o)?!1:((c>s||s!==s)&&(s=c),(A=r)}function Jpe(n,e,t,r,i,s,o,a){const{geometry:l,_indirectBuffer:c}=n;for(let A=r,u=r+i;A=0;let m,g;d?(m=ho(n),g=po(n,l)):(m=po(n,l),g=ho(n));const v=yA(m,o,r,i,s)?aT(m,e,t,r,i,s):null;if(v){const x=v.point[f];if(d?x<=o[g+u]:x>=o[g+u+3])return v}const _=yA(g,o,r,i,s)?aT(g,e,t,r,i,s):null;return v&&_?v.distance<=_.distance?v:_:v||_||null}}const xy=new Qn,Ff=new sa,Pf=new sa,$p=new ke,_O=new Hi,by=new Hi;function sme(n,e,t,r){Rn.setBuffer(n._roots[e]);const i=lT(0,n,t,r);return Rn.clearBuffer(),i}function lT(n,e,t,r,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=Rn;let l=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),_O.set(t.boundingBox.min,t.boundingBox.max,r),i=_O),Yi(l,o)){const A=e.geometry,u=A.index,f=A.attributes.position,h=t.index,d=t.attributes.position,m=Rs(n,a),g=fo(l,o);if($p.copy(r).invert(),t.boundsTree)return er(n,s,by),by.matrix.copy($p),by.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>by.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(r),v.b.applyMatrix4(r),v.c.applyMatrix4(r),v.needsUpdate=!0;for(let w=m*3,_=(g+m)*3;w<_;w+=3)if(Sr(Pf,w,u,f),Pf.needsUpdate=!0,v.intersectsTriangle(Pf))return!0;return!1}});for(let p=m*3,v=(g+m)*3;pkB.distanceToBox(x),intersectsBounds:(x,b,B)=>B{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:M=>Zp.distanceToBox(M),intersectsBounds:(M,I,S)=>S{for(let S=M,L=M+I;Sb&&(b=y),E<_&&(_=E),E>B&&(B=E),UM&&(M=U)}}return l[f+0]!==w||l[f+1]!==_||l[f+2]!==x||l[f+3]!==b||l[f+4]!==B||l[f+5]!==M?(l[f+0]=w,l[f+1]=_,l[f+2]=x,l[f+3]=b,l[f+4]=B,l[f+5]=M,!0):!1}else{const p=f+8,v=o[f+6],w=p+h,_=v+h;let x=d,b=!1,B=!1;e?x||(b=e.has(w),B=e.has(_),x=!b&&!B):(b=!0,B=!0);const M=x||b,I=x||B;let S=!1;M&&(S=u(p,h,x));let L=!1;I&&(L=u(v,h,x));const O=S||L;if(O)for(let T=0;T<3;T++){const y=p+T,E=v+T,U=l[y],P=l[y+3],N=l[E],z=l[E+3];l[f+T]=Uz?P:z}return O}}}function fme(n,e,t,r,i,s,o){Rn.setBuffer(n._roots[e]),cT(0,n,t,r,i,s,o),Rn.clearBuffer()}function cT(n,e,t,r,i,s,o){const{float32Array:a,uint16Array:l,uint32Array:c}=Rn,A=n*2;if(Yi(A,l)){const f=Rs(n,c),h=fo(A,l);Jpe(e,t,r,f,h,i,s,o)}else{const f=ho(n);yA(f,a,r,s,o)&&cT(f,e,t,r,i,s,o);const h=po(n,c);yA(h,a,r,s,o)&&cT(h,e,t,r,i,s,o)}}const hme=["x","y","z"];function dme(n,e,t,r,i,s){Rn.setBuffer(n._roots[e]);const o=AT(0,n,t,r,i,s);return Rn.clearBuffer(),o}function AT(n,e,t,r,i,s){const{float32Array:o,uint16Array:a,uint32Array:l}=Rn;let c=n*2;if(Yi(c,a)){const u=Rs(n,l),f=fo(c,a);return eme(e,t,r,u,f,i,s)}else{const u=UG(n,l),f=hme[u],d=r.direction[f]>=0;let m,g;d?(m=ho(n),g=po(n,l)):(m=po(n,l),g=ho(n));const v=yA(m,o,r,i,s)?AT(m,e,t,r,i,s):null;if(v){const x=v.point[f];if(d?x<=o[g+u]:x>=o[g+u+3])return v}const _=yA(g,o,r,i,s)?AT(g,e,t,r,i,s):null;return v&&_?v.distance<=_.distance?v:_:v||_||null}}const By=new Qn,Lf=new sa,Df=new sa,qp=new ke,xO=new Hi,Sy=new Hi;function pme(n,e,t,r){Rn.setBuffer(n._roots[e]);const i=uT(0,n,t,r);return Rn.clearBuffer(),i}function uT(n,e,t,r,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=Rn;let l=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),xO.set(t.boundingBox.min,t.boundingBox.max,r),i=xO),Yi(l,o)){const A=e.geometry,u=A.index,f=A.attributes.position,h=t.index,d=t.attributes.position,m=Rs(n,a),g=fo(l,o);if(qp.copy(r).invert(),t.boundsTree)return er(n,s,Sy),Sy.matrix.copy(qp),Sy.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>Sy.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(r),v.b.applyMatrix4(r),v.c.applyMatrix4(r),v.needsUpdate=!0;for(let w=m,_=g+m;w<_;w++)if(Sr(Df,3*e.resolveTriangleIndex(w),u,f),Df.needsUpdate=!0,v.intersectsTriangle(Df))return!0;return!1}});for(let p=m,v=g+m;pHB.distanceToBox(x),intersectsBounds:(x,b,B)=>B{if(e.boundsTree){const B=e.boundsTree;return B.shapecast({boundsTraverseOrder:M=>Jp.distanceToBox(M),intersectsBounds:(M,I,S)=>S{for(let S=M,L=M+I;Snew Qn),Nf=new Qn,Of=new Qn,QB=new Qn,zB=new Qn;let GB=!1;function xme(n,e,t,r){if(GB)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");GB=!0;const i=n._roots,s=e._roots;let o,a=0,l=0;const c=new ke().copy(t).invert();for(let A=0,u=i.length;Al.slice()),index:o?o.array.slice():null,indirectBuffer:s?s.slice():null}:a={roots:i,index:o?o.array:null,indirectBuffer:s},a}static deserialize(e,t,r={}){r={setIndex:!0,indirect:!!e.indirectBuffer,...r};const{index:i,roots:s,indirectBuffer:o}=e,a=new a2(t,{...r,[PB]:!0});if(a._roots=s,a._indirectBuffer=o||null,r.setIndex){const l=t.getIndex();if(l===null){const c=new lt(e.index,1,!1);t.setIndex(c)}else l.array!==i&&(l.array.set(i),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({...bme,[PB]:!1},t),t.useSharedArrayBuffer&&!_me())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[PB]||(Ope(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Qn))),this.resolveTriangleIndex=t.indirect?r=>this._indirectBuffer[r]:r=>r}refit(e=null){return(this.indirect?ume:qpe)(this,e)}traverse(e,t=0){const r=this._roots[t],i=new Uint32Array(r),s=new Uint16Array(r);o(0);function o(a,l=0){const c=a*2,A=s[c+15]===B1;if(A){const u=i[a+6],f=s[c+14];e(l,A,new Float32Array(r,a*4,6),u,f)}else{const u=a+ig/4,f=i[a+6],h=i[a+7];e(l,A,new Float32Array(r,a*4,6),h)||(o(u,l+1),o(f,l+1))}}}raycast(e,t=ks,r=0,i=1/0){const s=this._roots,o=this.geometry,a=[],l=t.isMaterial,c=Array.isArray(t),A=o.groups,u=l?t.side:t,f=this.indirect?fme:nme;for(let h=0,d=s.length;hu(f,h,d,m,g)?!0:r(f,h,this,a,d,m,t)}else o||(a?o=(u,f,h,d)=>r(u,f,this,a,h,d,t):o=(u,f,h)=>h);let l=!1,c=0;const A=this._roots;for(let u=0,f=A.length;u{const m=this.resolveTriangleIndex(d);Sr(o,m*3,a,l)}:d=>{Sr(o,d*3,a,l)},A=mo.getPrimitive(),u=e.geometry.index,f=e.geometry.attributes.position,h=e.indirect?d=>{const m=e.resolveTriangleIndex(d);Sr(A,m*3,u,f)}:d=>{Sr(A,d*3,u,f)};if(s){const d=(m,g,p,v,w,_,x,b)=>{for(let B=p,M=p+v;BCy.intersectsBox(r),intersectsTriangle:r=>Cy.intersectsTriangle(r)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},i={},s=0,o=1/0){return(this.indirect?wme:Ame)(this,e,t,r,i,s,o)}closestPointToPoint(e,t={},r=0,i=1/0){return jpe(this,e,t,r,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(r=>{er(0,new Float32Array(r),bO),e.union(bO)}),e}}function EO(n,e,t){return n===null?null:(n.point.applyMatrix4(e.matrixWorld),n.distance=n.point.distanceTo(t.ray.origin),n.object=e,n)}const Ty=new Vu,BO=new $,SO=new ke,Eme=hn.prototype.raycast,Bme=vse.prototype.raycast,MO=new $,qr=new hn,Iy=[];function Sme(n,e){this.isBatchedMesh?Mme.call(this,n,e):Cme.call(this,n,e)}function Mme(n,e){if(this.boundsTrees){const t=this.boundsTrees,r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld;qr.material=this.material,qr.geometry=this.geometry;const o=qr.geometry.boundsTree,a=qr.geometry.drawRange;qr.geometry.boundingSphere===null&&(qr.geometry.boundingSphere=new Ei);for(let l=0,c=r.length;l{const e=n.attributes.position,t=n.index,r=new Vr,i=new $,s=new $,o=new $,a=[];for(let l=0;l{const e=n.geometry.clone();let t=[];if(Array.isArray(n.material))for(let i=0;i{n.isMesh&&(n.geometry.userData.faceNormals=null,n.geometry.dispose(),n.geometry.disposeBoundsTree(),n.parent&&n.parent.remove(n),n.userData.cancelMesh&&Uw(n.userData.cancelMesh))},LG=n=>{var e,t;n.userData.cullingClone&&(Uw(n.userData.cullingClone),n.userData.cullingClone=null,Uw(n.userData.cullingCloneP),n.userData.cullingCloneP=null,Uw(n.userData.cullingCloneN),n.userData.cullingCloneN=null,((e=n.userData)==null?void 0:e.clippedIndexGeometry)!=null&&(n.userData.clippedIndexGeometry=null),((t=n.userData)==null?void 0:t.origIndexBuffer)!=null&&(n.userData.origIndexBuffer=null))},Nme=async n=>{if(n==null){console.warn("Null parameter for meshes was provided. Skipping mesh culling.");return}if(!Array.isArray(n)){console.warn("No valid mesh array was provided. Skipping mesh culling.");return}if(n.length==0){console.warn("No mesh array with elements was provided. Skipping mesh culling.");return}const e=[];Um=n[0].parent,Um.lines!=null&&(Um.lines.forEach(i=>{i.visible=!1}),Um.lines.length=0),n.forEach(i=>{if(i.userData.cullLayer!=null){i.userData.origIndexBuffer==null&&(i.userData.origIndexBuffer=i.geometry.index.clone()),e[i.userData.cullLayer]==null&&(e[i.userData.cullLayer]={origMeshes:[],cloneMeshes:[],posMeshes:[],negMeshes:[],scaleMeshes:[],positionMeshes:[]}),i.userData.cullingClone==null&&(i.userData.cullingClone=Dme(i),i.userData.cullingCloneP=i.userData.cullingClone.clone(),i.userData.cullingCloneN=i.userData.cullingClone.clone());const s=i.userData.cullingClone,o=i.userData.cullingCloneP,a=i.userData.cullingCloneN;o.material=Fme,a.userData.cancelMesh=o,a.material=Pme,o.userData.maxCullDistance=a.userData.maxCullDistance=i.userData.maxCullDistance,e[i.userData.cullLayer].origMeshes.push(i),e[i.userData.cullLayer].cloneMeshes.push(s),e[i.userData.cullLayer].posMeshes.push(o),e[i.userData.cullLayer].negMeshes.push(a),i.geometry.setIndex(i.userData.origIndexBuffer)}});for(let i=e.length-1;i>=0;i--)e[i]==null&&e.splice(i,1);let t=[];const r=[];for(let i=e.length-1;i>=0;i--){if(t.length!=0||e.length>=1)for(let s=0;s{i.geom.setIndex(i.index)})},Ome=n=>{let e=Rme,t=Ume;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},kme=(n,e,t,r,i,s,o=!1)=>{const a=[],l=Ome(s);let c=l[0],A=l[1];Ry.far=c+A;for(let f=0;f=0;v--)c-p[v].distance>=p[v].object.userData.maxCullDistance&&p.splice(v,1);if(p.length===0){for(let v=0;v<3;v++)a.push(n[h+v]);break}else{const v=p.map(w=>w.object);for(let w=0;ww).length===0){for(let w=0;w<3;w++)a.push(n[h+w]);break}if(m===0)d=p.map(w=>w.object);else if(d=p.map(w=>{if(d.indexOf(w.object)!==-1)return w.object}),d=d.filter(w=>w),m===2&&d.filter(w=>w).length===0)for(let w=0;w<3;w++)a.push(n[h+w]);o&&Hme(VB,em.clone().multiplyScalar(-1),Ry.far,16711680,Um)}}}const u=new Uint32Array(a);return new lt(u,1,!1)};function Hme(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new $;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new Zt().setFromPoints(o),l=[];l.push(new He(0)),l.push(new He(16777215));let c=new lc({color:r});var A=new Xd(a,c);A.renderOrder=100,i.add(A),i.lines.push(A)}function Qme(n,e=10){if(n<=0)return[];const t=n,r=[{w:e,h:e,x:0,y:0}];function i(o,a,l,c){if(a<=0)return;const A=o.w/2,u=[{w:A,h:A,x:l,y:c},{w:A,h:A,x:l+A,y:c},{w:A,h:A,x:l,y:c+A},{w:A,h:A,x:l+A,y:c+A}];r.push(...u);const f=r.find(p=>p.x===l&&p.y===c&&p.w===o.w&&p.h===o.h);if(r.splice(r.indexOf(f),1),n<=r.length)return;const h=Math.max(...r.map(p=>p.w)),d=r.find(p=>p.w===h),m=d.x,g=d.y;i({w:d.w,h:d.h},a-1,m,g)}if(n==1)return{squares:r,fill:1};for(i({w:e,h:e},t,0,0),r.sort((o,a)=>a.w-o.w);r.length>n;)r.pop();const s=r.reduce((o,a)=>o+a.w*a.h,0)/(e*e);return{squares:r,fill:s}}class l2{constructor(e,t){jt(this,"width");jt(this,"height");jt(this,"cameraRTT",null);jt(this,"sceneRTT",null);jt(this,"material",null);jt(this,"quad",null);jt(this,"renderer",null);jt(this,"rtTexture",null);this.width=e,this.height=t}render(e,t,r,i,s,o,a=!0){var A;if(e||(e=l2.createSolidColorTexture(r,i,s)),this.renderer==null){this.sceneRTT=new Hg,this.cameraRTT=new p0(-i/2,i/2,s/2,-s/2,-1e4,1e4),this.cameraRTT.position.z=100,this.sceneRTT.add(this.cameraRTT),this.material=new Zi({side:wi,transparent:!0,opacity:1,color:new He(1,1,1)});const u=new ac(1,1);this.quad=new hn(u,this.material),this.quad.scale.set(i,s,1),this.sceneRTT.add(this.quad),this.renderer=new m0,this.renderer.setPixelRatio(1),this.renderer.setSize(i,s),this.renderer.autoClear=!1}else this.cameraRTT&&(this.cameraRTT.left=-i/2,this.cameraRTT.right=i/2,this.cameraRTT.top=s/2,this.cameraRTT.bottom=-s/2,this.cameraRTT.updateProjectionMatrix()),(A=this.quad)==null||A.scale.set(i,s,1),this.renderer.setSize(i,s);this.rtTexture=new Za(i,s),this.rtTexture.texture.colorSpace=a?kt:Ia,this.material&&(this.material.map=e,this.material.color=t.clone()),this.renderer.setClearColor(r.clone(),o?0:1),this.renderer.setRenderTarget(this.rtTexture),this.renderer.clear(),this.sceneRTT&&this.cameraRTT&&this.renderer.render(this.sceneRTT,this.cameraRTT);let l=new Uint8ClampedArray(this.rtTexture.width*this.rtTexture.height*4);return this.renderer.readRenderTargetPixels(this.rtTexture,0,0,i,s,l),new ImageData(l,i,s)}destroy(){var e,t;this.cameraRTT=null,(e=this.sceneRTT)==null||e.clear(),this.sceneRTT=null,this.material=null,this.quad=null,(t=this.renderer)==null||t.dispose(),this.renderer=null,this.rtTexture=null}static createSolidColorTexture(e,t,r){const i=t*r,s=new Uint8Array(4*i),o=Math.floor(e.r*255),a=Math.floor(e.g*255),l=Math.floor(e.b*255);for(let A=0;Atypeof window>"u"?await Vme({meshes:e,atlasSize:r,mtoon:i,transparentMaterial:s,transparentTexture:o}):await jme({backColor:n,meshes:e,atlasSize:r,mtoon:i,includeNonTexturedMeshesInAtlas:t,transparentMaterial:s,transparentTexture:o,twoSidedMaterial:a}),Vme=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(b=>{const B=b.material;let M=a.find(I=>I.material===B);if(!M)a.push({material:B,mesh:b});else{const{dest:I}=M1({meshes:[M.mesh,b]});M.mesh.geometry=I}});const l=Object.fromEntries(o.map(b=>[b,DG({width:s,height:s,transparent:i})])),c=Math.floor(Math.sqrt(n.length)+1),A=s/c,u=new Map(a.map((b,B)=>{const M=new je(B%c,Math.floor(B/c)).multiplyScalar(1/c),I=new je(M.x+1/c,M.y+1/c);return[b.mesh,{min:M,max:I}]})),f=[],h=[];a.forEach(b=>{const{min:B,max:M}=u.get(b.mesh);h.push(M),f.push(B)});const d=new je(Math.max(...h.map(b=>b.x)),Math.max(...h.map(b=>b.y))),m=new je(Math.min(...f.map(b=>b.x)),Math.min(...f.map(b=>b.y))),g=1/(d.x-m.x),p=1/(d.y-m.y),v=A*g,w=A*p,_=new Map(a.map(b=>{let{min:B,max:M}=u.get(b.mesh);return B.x=B.x*g,B.y=B.y*p,M.x=M.x*g,M.y=M.y*p,[b.mesh,{min:B,max:M}]}));a.forEach(b=>{const{material:B,mesh:M}=b,{min:I,max:S}=_.get(M);o.forEach(y=>{const E=l[y];E.globalCompositeOperation="source-over";let U=Z_(B,fT[y].find(P=>Z_(B,P)));if(U!==""&&U!==void 0)try{const P=new Uint8ClampedArray(U.data),N=new ImageData(P,v,w),z=document.createElement("canvas");z.width=v,z.height=w;const W=z.getContext("2d");W.putImageData(N,0,0),W.save(),E.drawImage(z,I.x*s,I.y*s,v,w)}catch(P){console.error("error",P)}else E.fillStyle=y==="diffuse"?`#${B.color.clone().getHexString()}`:y==="normal"?"#8080ff":y==="orm"?`#${new He(B.aoMapIntensity,B.roughness,B.metalness).getHexString()}`:"#7F7F7F",E.fillRect(I.x*s,I.y*s,v,w)});const L=M.geometry,O=L.attributes.uv;if(O)for(let y=0;y{const B=new Hn(l[b].canvas);return B.flipY=!1,[b,B]})));return{bakeObjects:a,textures:x,uvs:_}},jme=async({backColor:n,includeNonTexturedMeshesInAtlas:e=!1,meshes:t,atlasSize:r,mtoon:i,transparentMaterial:s,transparentTexture:o,twoSidedMaterial:a})=>{const l=r,c=i?["diffuse"]:["diffuse","orm","normal"],A=[];let u=null;t.forEach(P=>{P=P.clone();const N=P.material.length==null?P.material:P.material[0];i&&u==null&&N.type=="ShaderMaterial"&&(u=N.clone());let z=A.find(W=>{W.material});if(!z)A.push({material:N,mesh:P});else{const{dest:W}=M1({meshes:[z.mesh,P]});z.mesh.geometry=W}});const f=Object.fromEntries(c.map(P=>[P,DG({width:l,height:l,transparent:o&&P=="diffuse"})])),h=new Set,d=new Map,m=A.map(P=>{const N=P.mesh.geometry;if(e==!1){if(!P.mesh.visible)return h.add(P.mesh),[P.mesh,0];let z=!0;for(const W of c)for(const H of fT[W])if(Z_(P.material,H)&&z){z=!1;break}if(z){const W=P.material;if(W instanceof dr)return[P.mesh,2];if(d.size==0)return d.set(W,[P.mesh]),[P.mesh,1];for(let[H,C]of Array.from(d.entries()))if((()=>H.color.r.toFixed(5)==W.color.r.toFixed(5)&&H.color.g.toFixed(5)==W.color.g.toFixed(5)&&H.color.b.toFixed(5)==W.color.b.toFixed(5)&&H.emissive.equals(W.emissive)&&H.aoMapIntensity==W.aoMapIntensity&&H.metalness==W.metalness&&H.normalScale.equals(W.normalScale)&&H.roughness==W.roughness&&H.transparent==W.transparent&&H.vertexColors==W.vertexColors)())return C.push(P.mesh),[P.mesh,0];return d.set(W,[P.mesh]),[P.mesh,1]}}return[P.mesh,N.index?N.index.count/3:N.attributes.position.count/3]}).sort((P,N)=>N[1]-P[1]),g=m.filter(([,P])=>P!=0),{squares:p,fill:v}=Qme(g.length,l);console.log("squaresplit",v);const w=p.map(P=>({x:P.x,y:P.y,width:P.w,height:P.h})),_=new Map(w.map((P,N)=>[m[N][0],P]));d.forEach(P=>{if(P.length>1){const N=_.get(P[0]);P.forEach(z=>{_.set(z,N)})}});const x=new Map(Array.from(_.entries()).map(([P,N])=>{const z=new je(N.x,N.y),W=new je(N.x+N.width,N.y+N.height);return[P,{min:z,max:W}]})),b=[];Array.from(_.keys()).forEach(P=>{if(h.has(P))return;const{min:N,max:z}=x.get(P);b.push(N)});const B=new je(Math.min(...b.map(P=>P.x)),Math.min(...b.map(P=>P.y))),M=1/(l-B.x),I=1/(l-B.y),S=new Map(Array.from(_.keys()).map(P=>{if(h.has(P))return;let{min:N,max:z}=x.get(P);return N.x=N.x*M,N.y=N.y*I,z.x=z.x*M,z.y=z.y*I,[P,{min:N,max:z}]}).filter(P=>P));let L=!1;const O=new l2(l,l);Array.from(_.keys()).forEach(P=>{const N=A.find(re=>re.mesh===P),{material:z}=N;let W,H;const C=S.get(P);if(C?(W=C.min,H=C.max):(W=new je(0,0),H=new je(0,0)),!h.has(N.mesh)){const re=_.get(P).width,ce=_.get(P).height;c.forEach(oe=>{var k;const ge=f[oe];ge.globalCompositeOperation="source-over";let me,ve=new He(1,1,1);switch(oe){case"diffuse":me=z.color||n,(k=z.uniforms)!=null&&k.litFactor?ve=z.uniforms.litFactor.value:ve=z.color;break;case"normal":me=new He(8421631);break;case"orm":me=new He(0,z.roughness,z.metalness);break;default:me=new He(1,1,1);break}let be=zme(z,fT[oe].find(ae=>Z_(z,ae)));L==!1&&oe=="normal"&&be!=null&&(L=!0);const ne=O.render(be,ve,me,l,l,oe=="diffuse"&&o,oe!="normal");createImageBitmap(ne).then(ae=>ge.drawImage(ae,W.x*l,W.y*l,re,ce))})}const K=P.geometry.clone();P.geometry=K;const te=K.attributes.uv.clone();if(K.attributes.uv=te,te)for(let re=0;re{const N=new Hn(f[P].canvas);return N.flipY=!1,[P,N]}))),y=a?wi:ks;let E;const U=s?"transparent":"opaque";return i?(E=new Ld({map:T.diffuse,transparent:s,side:y}),u==null&&(u=new gG),u.side=y,u.uniforms.map=T.diffuse,u.uniforms.shadeMultiplyTexture=T.diffuse,u.transparent=s,o&&!s&&(E.alphaTest=.5,u.alphaTest=.5),E.userData.vrmMaterial=u,E.userData.shadeTexture=T.uniformColor,E.name="mToon_"+U,E.map.name=E.name):(E=new Ld({map:T.diffuse,roughnessMap:T.orm,metalnessMap:T.orm,normalMap:L?T.normal:null,transparent:s,side:y}),o&&!s&&(E.alphaTest=.5),E.name="standard_"+U,E.roughnessMap!=null&&(E.roughnessMap.name=E.name+"_orm"),E.normalMap!=null&&(E.normalMap.name=E.name+"_normal")),{bakeObjects:A,material:E}};function NG(n){const e=new Map;for(const r of n.skeleton.bones){const i=r.clone(!1);e.set(r,i)}n.skeleton.bones[0].traverse(r=>{if(r.type!=="Bone")return;const i=e.get(r);for(const s of r.children){const o=e.get(s);o&&i.add(o)}});const t=new IA(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function OG(n,e){const t=new Map;new $(-1,1,-1),new ke,new $;let r=0;n.forEach(l=>{if(l.skeleton){var c=NG(l);const A=c.bones;c.bones.forEach((u,f)=>{var h;if(A.indexOf(u)!==-1){const d=t.get(u.name);if(d==null){const m={index:r,boneInverses:c.boneInverses[f],bone:u.clone(!1),parentName:((h=u.parent)==null?void 0:h.type)=="Bone"?u.parent.name:null};r++,t.set(u.name,m)}else u.userData.VRMcolliders!=null&&(d.bone.userData.VRMcolliders==null?d.bone.userData.VRMcolliders=u.userData.VRMcolliders:u.userData.VRMcollidersID!=d.bone.userData.VRMcollidersID&&(d.bone.userData.VRMcolliders=[...d.bone.userData.VRMcolliders,...u.userData.VRMcolliders]))}})}});const i=[],s=[];[...t.values()].forEach(l=>{var c;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const A=(c=t.get(l.parentName))==null?void 0:c.bone;A&&A.add(l.bone)}});const a=new IA(i,s);return a.bones.forEach(l=>{var A;const c=(A=l.userData)==null?void 0:A.vrm0RestPosition;c&&l.position.set(-c.x,c.y,-c.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function Wme(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(A=>A.name===o.name),c=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,c)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function Kme(n){const t=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array].filter(r=>n.constructor===r);return t.length&&t[0]||null}function q_(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function $me(n,e,t){const{scale:r,isVrm0:i,mergeAppliedMorphs:s}=t,o=[],a=[],l=Dd(n,"SkinnedMesh"),c=QG(e),A=HG(e).map(h=>h.id);l.forEach(h=>{const d=h.clone();o.push(d),Array.isArray(h.material)?a.push(...h.material):a.push(h.material)});const u=OG(o,r),f=new Ft;return f.name="AvatarRoot",o.forEach(h=>{var L,O;const d=new Zt,m={};for(const T in h.geometry.attributes){const y=h.geometry.attributes[T];m[T]=y.clone()}const g={merge:new Set,keep:new Set(c),remove:new Set};if(s){if(!h.morphTargetDictionary||!h.morphTargetInfluences)return;A.forEach(T=>{const y=h.morphTargetDictionary[T];if(y!==void 0&&h.morphTargetInfluences[y]>0)g.merge.add(T);else return g.remove.add(T),null})}if((L=h.userData)!=null&&L.isVRM0)for(let T=0;T[T,T.morphTargetDictionary||{}])),morphTargetInfluences:new Map(l.map(T=>[T,T.morphTargetInfluences||[]])),index:null,animations:{}},{dest:v,destMorphToMerge:w}=M1({meshes:[h],scale:r,morphTargetsProcess:g},i);if(i)for(let T=0;Th.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new $(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],c=[],A=t.geometry.attributes.position.array,u=new $,f=e.userData.isVRM0?-1:1;for(let h=0;hE.id);for(const E in I){const U=I[E],P=U.meshArray;if(P.length>0){const{bakeObjects:N,material:z}=await Gme({transparentColor:r,atlasSize:U.size,meshes:P,mtoon:U.isMtoon,includeNonTexturedMeshesInAtlas:l,transparentMaterial:U.transparentMaterial,transparentTexture:b,twoSidedMaterial:d}),W=N.map(oe=>oe.mesh),H=[],C={merge:new Set,keep:new Set(Object.keys(S)),remove:new Set};W.forEach(oe=>{if(oe.type=="Mesh"&&(oe=qme(M,oe)),H.push(oe),u){if(!oe.morphTargetDictionary||!oe.morphTargetInfluences)return;L.forEach(ae=>{const le=oe.morphTargetDictionary[ae];if(le!==void 0&&oe.morphTargetInfluences[le]>0)C.merge.add(ae);else return C.remove.add(ae),null})}const ge=oe.geometry,me=ge.index.array,ve=kG(oe.geometry.index.array),be=[];for(let ae=0;ae{const ge=ce.morphTargetDictionary[oe];ge!==void 0&&(ce.userData.bindMorphs.new[oe]={index:ge,primitives:[ce.id]})}),B.userData.atlasMaterial.push(z)}}const O=(y=Object.values(e).find(E=>{var U;return(U=E==null?void 0:E.vrm)==null?void 0:U.expressionManager}))==null?void 0:y.vrm.expressionManager;return B.userData.expressionManagerToClone=O,B.add(M.bones[0]),B}function HG(n){var t;return((t=Object.values(n).filter(r=>r)[0])==null?void 0:t.traitInfo.manifestData.getAllBlendShapeTraits())||[]}function QG(n){const e=Object.values(n).map(i=>i==null?void 0:i.vrm).filter(i=>!!i).map(i=>{var s;return(s=i.expressionManager)==null?void 0:s.expressionMap}),t={};let r=[];for(const i of e)if(i)for(const s of Object.values(i)){if(r.includes(s.expressionName))continue;r.push(s.expressionName);const o=s._binds;!o||o.length==0||o.forEach(a=>{function l(A){const f=a.primitives.map(h=>h.morphTargetDictionary).filter(h=>!!h).find(h=>Object.values(h).includes(A));if(f)return Object.entries(f).find(([,h])=>h==A)}const c=l(a.index);c&&(t[c[0]]={index:c[1],primitives:a.primitives.map(A=>A.id)})})}return t}function TO({meshes:n,sourceMorphTargetDictionaries:e,destMorphTargetDictionary:t}){const r=[];return Object.entries(t).map(([i,s])=>{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function ege({sourceAttributes:n}){const e=new Set,t=Array.from(n.values());t.forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map(i=>{r[i]=zz(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function IO(n){const{sourceMorphTargetDictionaries:e,morphTargetsProcess:t}=n,r=new Set;Array.from(e.values()).forEach(o=>{Object.keys(o).forEach(a=>{if(!t)r.add(a);else{if(t.remove.has(a)||t.merge.has(a))return;t.keep.has(a)&&r.add(a)}})});const s={};return Array.from(r.keys()).map((o,a)=>{s[o]=a}),s}function RO({meshes:n,sourceMorphTargetDictionaries:e,sourceMorphAttributes:t,destMorphTargetDictionary:r,scale:i},s=!1){const o=new Set;Array.from(t.values()).forEach(u=>{Object.keys(u).forEach(f=>o.add(f))});const l=Array.from(o),c={};l.forEach(u=>{c[u]=[],Object.entries(r).forEach(([f,h])=>{c[u][h]=[],n.forEach(d=>{let m;const g=e.get(d);if(g.hasOwnProperty(f)&&d.geometry.morphAttributes[u]){const p=g[f];m=d.geometry.morphAttributes[u][p]}else{const p=d.geometry.attributes[u],v=new p.array.constructor(new Array(p.array.length).fill(0));m=new lt(v,p.itemSize,p.normalized)}c[u][h].push(m)})})});const A={};return l.forEach(u=>{A[u]=[];for(let f=0;f{const i=r.geometry.index;for(var s=0;s{var h;if(i+=f.geometry.attributes.uv.count,(h=f.userData)!=null&&h.isVRM0)for(let d=0;d[f,f.geometry.attributes])),morphAttributes:new Map(n.map(f=>[f,f.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(f=>[f,f.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(f=>[f,f.morphTargetInfluences||[]]))},o={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};o.attributes=ege({sourceAttributes:s.attributes});const a=IO({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:(t==null?void 0:t.remove)||new Set,keep:(t==null?void 0:t.keep)||new Set,merge:(t==null?void 0:t.merge)||new Set}});o.morphTargetDictionary=a,o.morphAttributes=RO({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a,scale:e},r),o.morphTargetInfluences=TO({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a}),o.index=tge({meshes:n});const l={morphAttributes:{},morphTargetDictionaries:{},morphTargetInfluences:null};let c=new Set((t==null?void 0:t.keep)||[]);t==null||t.merge.forEach(f=>{c.add(f)});const A=IO({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:new Set,keep:c,merge:new Set}});l.morphAttributes=RO({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:A,scale:e},r);const u=TO({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:A});return l.morphTargetInfluences=u,l.morphTargetDictionaries=A,o.animations={},{source:s,dest:o,destMorphToMerge:l}}function mt(n){return n==null?[]:Array.isArray(n)?n:[n]}function nge(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function rge(n,e){const r=await new ju().load(e);r.colorSpace=kt,r.flipY=!1,n.traverse(i=>{if(i instanceof hn){const s=Array.isArray(i.material)?i.material:[i.material];for(let o=0;o{const e=[];for(const t in n){const r=n[t].vrm;if(r){const i=r.data.cullingLayer;i>=0&&r.data.cullingMeshes.map(s=>{s.userData.cullLayer=i,s.userData.cullDistance=r.data.cullingDistance,s.userData.maxCullDistance=r.data.maxCullingDistance,e.push(s)})}}Nme(e)};function ige(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var c;const l=mt(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((c=l.uniforms.alphaTest)==null?void 0:c.value)!=0&&(s=!0)):l.transparent==!0?(t.push(o),s=!0):(e.push(o),l.alphaTest!=0&&(s=!0))}),{stdMesh:e,stdTranspMesh:t,mToonMesh:r,mToonTranspMesh:i,requiresTransparency:s}}function sge(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{mt(a.material).forEach(c=>{c.type=="ShaderMaterial"?c.transparent==!0?o.push(c):c.uniforms.alphaTest.value!=0?s.push(c):i.push(c):c.transparent==!0?r.push(c):c.alphaTest!=0?t.push(c):e.push(c)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function UO(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function oge(n,e){if(n.data!=null)return n.data[e]}function age(n){const e=oge(n,"cullingMeshes");e&&(e.forEach(t=>{LG(t)}),n.data.cullingMeshes=null)}function Dn(n){switch(n){case 1:return 128;case 2:return 256;case 3:return 512;case 4:return 1024;case 5:return 2048;case 6:return 4096;case 7:return 8192;case 8:return 16384;default:return 4096}}function lge(n){const e=n.scene;age(n),e.traverse(t=>{t.material&&hT(t.material),t.geometry&&(LG(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),x0.deepDispose(e),n.expressionManager&&n.expressionManager.expressions.forEach(t=>{t._binds&&t._binds.forEach(r=>{r.primitives&&r.primitives.forEach(i=>{i.geometry.dispose(),i.material&&hT(i.material)})})});for(const t in n)n[t]=null}const hT=n=>{var e,t,r,i,s,o;if(n.length)for(let a=0;a{let e,t,r=0;return Array.isArray(n)?(e=n[0]||0,t=n[1]||0,r=n[2]||0):(typeof n=="string"||n instanceof String)&&n.split("-").forEach(s=>{switch(s=s.toLowerCase(),s){case"left":e=-1;break;case"right":e=1;break;case"bottom":case"down":t=-1;break;case"top":case"up":t=1;break;case"back":case"backward":r=-1;break;case"front":case"forward":r=1;break;default:console.warn("unkown cameraPosition name: "+s+" in: "+n+". Please use left, right, bottom, top, back or front");break}}),new $(e,t,r)},zG=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},cge=n=>{var t,r,i,s,o,a,l,c,A,u,f;const e=n.humanoid.humanBones;e.hips.node.parent.name="rootBone",e.upperChest==null&&e.neck.node.parent!=e.chest&&(e.neck.node.parent!=e.chest.node?e.upperChest={node:e.neck.node.parent}:e.upperChest!=null&&(e.upperChest={node:e.neck.node.parent},e.chest={node:e.neck.node.parent.parent})),e.leftShoulder==null&&(e.leftUpperArm.node.parent!=((t=e.chest)==null?void 0:t.node)&&e.leftUpperArm.node.parent!=((r=e.upperChest)==null?void 0:r.node)&&e.leftUpperArm.node.parent!=((i=e.spine)==null?void 0:i.node)&&e.leftUpperArm.node.parent!=((s=e.neck)==null?void 0:s.node)&&e.leftUpperArm.node.parent!=((o=e.head)==null?void 0:o.node),e.leftShoulder={node:e.leftUpperArm.node.parent}),e.rightShoulder==null&&(e.rightUpperArm.node.parent!=((a=e.chest)==null?void 0:a.node)&&e.rightUpperArm.node.parent!=((l=e.upperChest)==null?void 0:l.node)&&e.rightUpperArm.node.parent!=((c=e.spine)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((A=e.neck)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let h in Yg)h=h.charAt(0).toLowerCase()+h.slice(1),(f=e[h])!=null&&f.node&&(e[h].node.name=h)};function GG({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),GG({candidates:n,predicate:e}))}function VG(n,e){return GG({candidates:[n],predicate:t=>t.name===e})}function jG({candidates:n,predicate:e,results:t=[]}){if(!n.length)return t;const r=n.shift();return e(r)&&t.push(r),n=n.concat(r.children),jG({candidates:n,predicate:e,results:t})}function Dd(n,e){return jG({candidates:[n],predicate:t=>mt(e).includes(t.type)})}function Age(n,e){if(!n.morphTargetDictionary)return!1;for(const t of Object.keys(n.morphTargetDictionary))if(e[t])return!0;return!1}const uge={mixamorigHips:"hips",mixamorigSpine:"spine",mixamorigSpine1:"chest",mixamorigSpine2:"upperChest",mixamorigNeck:"neck",mixamorigHead:"head",mixamorigLeftShoulder:"leftShoulder",mixamorigLeftArm:"leftUpperArm",mixamorigLeftForeArm:"leftLowerArm",mixamorigLeftHand:"leftHand",mixamorigLeftHandThumb1:"leftThumbMetacarpal",mixamorigLeftHandThumb2:"leftThumbProximal",mixamorigLeftHandThumb3:"leftThumbDistal",mixamorigLeftHandIndex1:"leftIndexProximal",mixamorigLeftHandIndex2:"leftIndexIntermediate",mixamorigLeftHandIndex3:"leftIndexDistal",mixamorigLeftHandMiddle1:"leftMiddleProximal",mixamorigLeftHandMiddle2:"leftMiddleIntermediate",mixamorigLeftHandMiddle3:"leftMiddleDistal",mixamorigLeftHandRing1:"leftRingProximal",mixamorigLeftHandRing2:"leftRingIntermediate",mixamorigLeftHandRing3:"leftRingDistal",mixamorigLeftHandPinky1:"leftLittleProximal",mixamorigLeftHandPinky2:"leftLittleIntermediate",mixamorigLeftHandPinky3:"leftLittleDistal",mixamorigRightShoulder:"rightShoulder",mixamorigRightArm:"rightUpperArm",mixamorigRightForeArm:"rightLowerArm",mixamorigRightHand:"rightHand",mixamorigRightHandPinky1:"rightLittleProximal",mixamorigRightHandPinky2:"rightLittleIntermediate",mixamorigRightHandPinky3:"rightLittleDistal",mixamorigRightHandRing1:"rightRingProximal",mixamorigRightHandRing2:"rightRingIntermediate",mixamorigRightHandRing3:"rightRingDistal",mixamorigRightHandMiddle1:"rightMiddleProximal",mixamorigRightHandMiddle2:"rightMiddleIntermediate",mixamorigRightHandMiddle3:"rightMiddleDistal",mixamorigRightHandIndex1:"rightIndexProximal",mixamorigRightHandIndex2:"rightIndexIntermediate",mixamorigRightHandIndex3:"rightIndexDistal",mixamorigRightHandThumb1:"rightThumbMetacarpal",mixamorigRightHandThumb2:"rightThumbProximal",mixamorigRightHandThumb3:"rightThumbDistal",mixamorigLeftUpLeg:"leftUpperLeg",mixamorigLeftLeg:"leftLowerLeg",mixamorigLeftFoot:"leftFoot",mixamorigLeftToeBase:"leftToes",mixamorigRightUpLeg:"rightUpperLeg",mixamorigRightLeg:"rightLowerLeg",mixamorigRightFoot:"rightFoot",mixamorigRightToeBase:"rightToes"};function WG(n,e,t){var m;const r=Fu.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new tt,o=new tt,a=new tt,l=new $,c=e.getObjectByName("mixamorigHips").position.y,A=(m=t.humanoid)==null?void 0:m.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,h=Math.abs(A-u)/c;return r.tracks.forEach(g=>{const p=g.clone(),v=p.name.split("."),w=v[0],x=uge[w],b=e.getObjectByName(w);if(x!=null){const B=v[1];if(b.getWorldQuaternion(s).invert(),b.parent.getWorldQuaternion(o),p instanceof qa){for(let M=0;M{p.values[L+M]=S})}i.push(new qa(`${x}.${B}`,p.times,p.values.map((M,I)=>{var S;return((S=t.meta)==null?void 0:S.metaVersion)==="0"&&I%2===0?-M:M})))}else if(p instanceof tc){const M=p.values.map((I,S)=>{var L;return(((L=t.meta)==null?void 0:L.metaVersion)==="0"&&S%3!==1?-I:I)*h});i.push(new tc(`${x}.${B}`,p.times,M))}}}),new Fu("vrmAnimation",r.duration,i)}const fge=new Pae,hge=new Gz,WB=.2,dge=n=>Math.floor(Math.random()*n);class FO{constructor(e,t,r,i,s,o,a){var l,c,A,u;this.mixer=new hoe(t),this.actions=[],this.to=null,this.from=null,this.vrm=r,this.animationManager=e,this.mixamoModel=null,this.fadeOutActions=null,this.newAnimationWeight=1,this.neckBone=(c=(l=r==null?void 0:r.humanoid)==null?void 0:l.humanBones)==null?void 0:c.neck,this.spineBone=(u=(A=r==null?void 0:r.humanoid)==null?void 0:A.humanBones)==null?void 0:u.spine,this.timeScale=1,i&&(this.setAnimations(i,null,null,a),this.to=this.actions[s],o!=-1&&(this.from=this.actions[o],this.from.reset(),this.from.time=e.getFromActionTime(),this.from.play(),this.to.weight=e.getWeightIn(),this.from.weight=e.getWeightOut()),this.actions[s].reset(),this.actions[s].time=e.getToActionTime(),this.actions[s].play())}setTimeScale(e){this.timeScale=e,this.actions.forEach(t=>{t.timeScale=e})}setMouseLookEnabled(e){this.setAnimations(this.animations,this.mixamoModel,e)}setAnimations(e,t=null,r=null,i=!1){if(r=r??this.animationManager.mouseLookEnabled,this.animations=e,t!=null){if(this.vrm!=null){const s=WG(e,t,this.vrm);s&&(e=[s],this.mixamoModel=t)}}else{const s=[];e.forEach(o=>{s.push(o.clone())}),e=s}if(r&&e[0].tracks.map((s,o)=>{(s.name==="neck.quaternion"||s.name==="spine.quaternion")&&e[0].tracks.splice(o,1)}),i){this.actions.forEach(s=>{s.weight=0,s.stop()}),this.actions=[],this.newAnimationWeight=1;for(let s=0;s{r.weight=1-this.newAnimationWeight}),this.newAnimationWeight>=1&&(this.newAnimationWeight=1,this.fadeOutActions.forEach(r=>{r.weight=0,r.stop()}),this.fadeOutActions=null),this.actions.forEach(r=>{r.weight=this.newAnimationWeight})),this.from!=null&&(this.from.weight=t),this.to!=null&&(this.to.weight=e),this.mixer.update(1/30)}reset(){this.mixer.setTime(0),this.to.paused=!0}resume(){this.to.paused=!1}setTime(e){this.mixer.setTime(e)}getTime(){return this.mixer.time}dispose(){this.animationManager.disposeAnimation(this)}}class pge{constructor(){this.animationPaths=[],this.defaultAnimations=[],this.lastAnimID=null,this.mainControl=null,this.animationControl=null,this.animations=null,this.paused=!1,this.scale=1,this.curLoadAnim=0,this.currentAnimationName="",this.weightIn=NaN,this.weightOut=NaN,this.lastAnimID=-1,this.curAnimID=0,this.animationControls=[],this.started=!1,this.mouseLookEnabled=!1,this.mixamoModel=null,this.mixamoAnimations=null,this.currentClip=null,setInterval(()=>{this.update()},1e3/30)}enableMouseLook(e){this.mouseLookEnabled=e,this.animationControls.forEach(t=>{t.setMouseLookEnabled(e)})}setScale(e){this.scale=e}async loadAnimation(e,t,r=0,i=!0,s="",o=""){const a=s+(s!=""?"/":"")+mt(e)[0];o=o==""?Vl(a):o,this.currentAnimationName=o;const c=await(i?fge:hge).loadAsync(a);c.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(c.animations);const A=Fu.findByName(c.animations,"mixamo.com");A!=null?(this.mixamoModel=c.clone(),this.mixamoAnimations=c.animations,this.currentClip=A):(this.mixamoModel=null,this.animations=c.animations,this.currentClip=c.animations[0]),this.mainControl==null&&(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new FO(this,c,null,c.animations,this.curAnimID,this.lastAnimID,t),this.animationControls.push(this.mainControl)),this.animationControls.forEach(u=>{u.setAnimations(c.animations,this.mixamoModel,this.mouseLookEnabled,t)}),this.setTime(r),t?this.pause():this.play()}getCurrentClip(){return this.currentClip}getCurrentClipDuration(){return this.currentClip?this.currentClip.duration:0}getCurrentAnimationName(){return this.currentAnimationName}clearCurrentAnimations(){this.animationPaths=this.defaultAnimations,this.animationControls=[],this.mainControl=null}storeAnimationPaths(e,t,r=!0){const i=mt(e);r?this.animationPaths=[...this.defaultAnimations,...i.map(s=>`${t}/${s}`)]:this.animationPaths=i.map(s=>t!=""?`${t}/${s}`:s)}storeDefaultAnimationPaths(e,t){const r=mt(e);this.defaultAnimations=r.map(i=>t!=""?`${t}/${i}`:i),this.animationPaths=this.defaultAnimations}loadNextAnimation(){this.curLoadAnim==this.animationPaths.length-1?this.curLoadAnim=0:this.curLoadAnim++,this.loadAnimation(this.animationPaths[this.curLoadAnim])}loadPreviousAnimation(){this.curLoadAnim==0?this.curLoadAnim=this.animationPaths.length-1:this.curLoadAnim--,this.loadAnimation(this.animationPaths[this.curLoadAnim])}enableScreenshot(){this.animationControls.forEach(e=>{e.reset()})}disableScreenshot(){this.animationControls.forEach(e=>{e.resume()})}_scaleOffsetHips(e){e.forEach(t=>{for(let r=0;rr.vrm===e);t!==-1&&this.animationControls.splice(t,1)[0].dispose()}getFromActionTime(){return this.mainControl.actions[this.lastAnimID].time}getToActionTime(){return this.mainControl?this.mainControl.actions[this.curAnimID].time:.1}getWeightIn(){return this.weightIn}getWeightOut(){return this.weightOut}disposeAnimation(e){if(e!=null){const t=this.animationControls.indexOf(e);t!=-1&&this.animationControls.splice(t,1)}}dispose(){this.animationControls.forEach(e=>{e.dispose()})}animRandomizer(e){setTimeout(()=>{this.lastAnimID=this.curAnimID,this.curAnimID=dge(this.animations.length),this.curAnimID!=this.lastAnimID&&this.animationControls.forEach(t=>{t.from=t.actions[this.lastAnimID],t.to=t.actions[this.curAnimID],this.weightIn=0,this.weightOut=1,t.to.play(),t.to.reset()}),this.animRandomizer(this.animations[this.curAnimID].duration-WB)},e*1e3)}pause(){this.paused=!0}play(){this.paused=!1}isPaused(){return this.paused}setTime(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTime(e)})}setFrame(e){this.setTime(e*30)}setSpeed(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTimeScale(e)})}update(e=!1){(this.mainControl&&!this.paused||e)&&(this.animationControls.forEach(t=>{t.update(this.weightIn,this.weightOut)}),this.weightIn<1?this.weightIn+=1/(30*WB):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*WB):this.weightOut=0)}}const mge={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` + */var yr;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(yr||(yr={}));const Z_="blend_",fO="vrmColliderSphere";class ype{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},c={},A={},u=e.lookAt,f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(s)if(o)if(a){if(!u)throw new Error("lookAt is undefined or null")}else throw new Error("materials is undefined or null");else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=a.filter((me,ve,be)=>be.findIndex(ne=>ne.name===me.name.replace(" (Outline)",""))===ve).map(me=>me),d=h.map(me=>me.name),m=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(me=>me.map).map(me=>{if(!me.map)throw new Error(me.name+" map is null");return{name:me.name,imageBitmap:me.map.image}}),p=h.filter(me=>me.userData.shadeTexture).map(me=>{if(!me.userData.shadeTexture)throw new Error(me.userData.shadeTexture+" map is null");return{name:me.name+"_shade",imageBitmap:me.userData.shadeTexture.image}}),v=g.concat(p),w=Epe(v,m),_=Bpe(w),x=Spe(w),b=bpe(h,v),B=t.children.filter(me=>me.children.length>0&&me.children[0].type===Li.Bone)[0],S=TG(B).filter(me=>me.name!==fO),I=S.map(me=>me.name),M=S.map(me=>({children:me.children.filter(ve=>ve.name!==fO).map(ve=>I.indexOf(ve.name)),name:me.name,rotation:[me.quaternion.x,me.quaternion.y,me.quaternion.z,me.quaternion.w],scale:[me.scale.x,me.scale.y,me.scale.z],translation:[me.position.x,me.position.y,me.position.z]})),P=[],D=t.children.filter(me=>me.type===Li.Group||me.type===Li.SkinnedMesh),T=[];D.forEach(me=>{const ve=me.type===Li.Group?me.children[0]:me,be=ve.geometry.attributes;T.push(new yl(be.position,yr.FLOAT,ln.POSITION,Go.VEC3,ve.name,void 0)),T.push(new yl(be.normal,yr.FLOAT,ln.NORMAL,Go.VEC3,ve.name,void 0)),T.push(new yl(be.uv,yr.FLOAT,ln.UV,Go.VEC2,ve.name,void 0)),T.push(new yl(be.skinWeight,yr.FLOAT,ln.SKIN_WEIGHT,Go.VEC4,ve.name,void 0)),T.push(new yl(be.skinIndex,yr.UNSIGNED_SHORT,ln.SKIN_INDEX,Go.VEC4,ve.name,void 0)),(me.type===Li.Group?me.children.map(k=>k):[me]).forEach(k=>{if(!k.geometry.index)throw new Error(k.name+" geometry.index is null");T.push(new yl(k.geometry.index,yr.UNSIGNED_INT,ln.INDEX,Go.SCALAR,ve.name,k.name))}),ve.morphTargetDictionary||(ve.morphTargetDictionary={},ve.morphTargetInfluences=[],ve.geometry.morphAttributes={},ve.updateMorphTargets()),ve.geometry.userData.targetNames=[];for(const k in e.expressionManager.expressionMap){const ae=e.expressionManager.expressionMap[k],le=ae._binds.map(J=>({node:S.length,index:J.index,weight:J.weight}));let Z=!1;for(const J in ni)if(k.toLowerCase()===ni[J].toLowerCase()){l[ni[J]]={morphTargetBinds:le,isBinary:ae.isBinary,overrideBlink:ae.overrideBlink,overrideLookAt:ae.overrideLookAt,overrideMouth:ae.overrideMouth},Z=!0;break}!Z&&k.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:le,isBinary:ae.isBinary,overrideBlink:ae.overrideBlink,overrideLookAt:ae.overrideLookAt,overrideMouth:ae.overrideMouth},Z=!0),Z===!1&&(c[k]={morphTargetBinds:le,isBinary:ae.isBinary,overrideBlink:ae.overrideBlink,overrideLookAt:ae.overrideLookAt,overrideMouth:ae.overrideMouth})}for(const k in ve.morphTargetDictionary){ve.geometry.userData.targetNames.push(k);const ae=ve.morphTargetDictionary[k],le=ve.geometry.morphAttributes;T.push(new yl(le.position[ae],yr.FLOAT,ln.BLEND_POSITION,Go.VEC3,ve.name,Z_+k)),T.push(new yl(le.normal[ae],yr.FLOAT,ln.BLEND_NORMAL,Go.VEC3,ve.name,Z_+k))}}),Object.keys(l).length>0&&(A.preset=l),Object.keys(c).length>0&&(A.custom=c),D.forEach(me=>{const ve=me.type===Li.Group?me.children[0]:me,be=new Float32Array(ve.skeleton.boneInverses.map(ne=>ne.elements).flat());T.push(new yl(new lt(be,16),yr.FLOAT,ln.BIND_MATRIX,Go.MAT4,ve.name,ve.name))}),P.push(...T.map(me=>({bufferView:-1,byteOffset:0,componentType:me.valueType,count:me.attribute.count,max:me.max,min:me.min,normalized:!1,type:me.accessorsType})));const y=_pe(D,T,d);D.forEach((me,ve)=>{M.push({mesh:ve,name:me.name,rotation:[me.quaternion.x,me.quaternion.y,me.quaternion.z,me.quaternion.w],scale:[me.scale.x,me.scale.y,me.scale.z],skin:ve,translation:[me.position.x,me.position.y,me.position.z]})});const E=xpe(D,T,I),R={offsetFromHeadBone:[0,0,0],rangeMapHorizontalInner:{inputMaxValue:u.applier.rangeMapHorizontalInner.inputMaxValue,outputScale:u.applier.rangeMapHorizontalInner.outputScale},rangeMapHorizontalOuter:{inputMaxValue:u.applier.rangeMapHorizontalOuter.inputMaxValue,outputScale:u.applier.rangeMapHorizontalOuter.outputScale},rangeMapVerticalDown:{inputMaxValue:u.applier.rangeMapVerticalDown.inputMaxValue,outputScale:u.applier.rangeMapVerticalDown.outputScale},rangeMapVerticalUp:{inputMaxValue:u.applier.rangeMapVerticalUp.inputMaxValue,outputScale:u.applier.rangeMapVerticalUp.outputScale},type:"bone"},L={humanBones:{}};for(const me in s.humanBones)L.humanBones[me]={node:I.indexOf(s.humanBones[me].node.name)};const N=o,z=[];z.push(...v.map(me=>({buffer:hO(me.imageBitmap),type:ln.IMAGE}))),z.push(...T.map(me=>({buffer:me.buffer,type:me.type}))),m&&z.push({buffer:hO(m.imageBitmap),type:ln.IMAGE});let W=0,H=0,C=0;const K=z.map((me,ve)=>{const be={buffer:0,byteLength:me.buffer.byteLength,byteOffset:W,target:me.type===ln.IMAGE||me.type===ln.BIND_MATRIX?void 0:me.type===ln.INDEX?yr.ELEMENT_ARRAY_BUFFER:yr.ARRAY_BUFFER};return W+=me.buffer.byteLength,me.type===ln.IMAGE?w[H++].bufferView=ve:P[C++].bufferView=ve,be}),ee=Mpe(t,M),F={accessors:P,asset:f,buffers:[{byteLength:W}],bufferViews:K,extensions:{VRMC_vrm:{expressions:A,humanoid:L,lookAt:R,meta:N,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:w,materials:b,meshes:y,nodes:M,samplers:_,avatar:0,scenes:ee,skins:E,textures:x},re=new dO(sT(JSON.stringify(F,void 0,2)),"JSON"),ce=new dO(Rm(z.map(me=>me.buffer)),"BIN\0"),oe=Rm([re.buffer,ce.buffer]),ge=Rm([sT("glTF"),iT(2,4),iT(oe.byteLength+12,4)]);i(Rm([ge,oe]))}}function TG(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>TG(e)).flat())}function hO(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=new ArrayBuffer(r.length),s=new DataView(i);for(let o=0;o4?c=r[a*n.itemSize+l]:l===0?c=n.getX(a):l===1?c=n.getY(a):l===2?c=n.getZ(a):c=n.getW(a),e===yr.UNSIGNED_SHORT?o.setUint16(i,c,!0):e===yr.UNSIGNED_INT?o.setUint32(i,c,!0):o.setFloat32(i,c,!0),i+=t}return s}let dO=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=Rm([iT(r.byteLength,4),sT(this.type),r])}paddingBinary(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new Uint8Array(r);i.set(new Uint8Array(e),0);for(let s=e.byteLength;sl%3===0)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.max.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0,this.min=r===ln.POSITION||r===ln.BLEND_POSITION?[Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===0)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===1)),Math.min.apply(null,Array.from(this.attribute.array).filter((a,l)=>l%3===2))]:void 0}};var Hh;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Hh||(Hh={}));var Go;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(Go||(Go={}));var ln;(function(n){n.POSITION="POSITION",n.NORMAL="NORMAL",n.UV="UV",n.INDEX="INDEX",n.SKIN_WEIGHT="SKIN_WEIGHT",n.SKIN_INDEX="SKIN_INDEX",n.BLEND_POSITION="BLEND_POSITION",n.BLEND_NORMAL="BLEND_NORMAL",n.BIND_MATRIX="BIND_MATRIX",n.IMAGE="IMAGE"})(ln||(ln={}));var Li;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(Li||(Li={}));const _pe=(n,e,t)=>n.map(r=>{const i=r.type===Li.Group?r.children[0]:r,s=r.type===Li.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(c=>c.meshName===i.name?c.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(ln.SKIN_INDEX),NORMAL:a.indexOf(ln.NORMAL),POSITION:a.indexOf(ln.POSITION),TEXCOORD_0:a.indexOf(ln.UV),WEIGHTS_0:a.indexOf(ln.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(c=>c.type===ln.INDEX&&c.meshName===i.name?c.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(c=>({NORMAL:e.map(A=>A.type===ln.BLEND_NORMAL&&A.meshName===i.name?A.name:null).indexOf(Z_+c),POSITION:e.map(A=>A.type===ln.BLEND_POSITION&&A.meshName===i.name?A.name:null).indexOf(Z_+c)})):void 0}})}}),xpe=(n,e,t)=>n.map(r=>{const i=r.type===Li.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===ln.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),bpe=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i=t.userData.gltfExtensions.VRMC_materials_mtoon,i.shadeMultiplyTexture={index:e.map(A=>A.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const c=t;r=c.color?[c.color.r,c.color.g,c.color.b,1]:void 0}let s=-1;t.map?s=e.map(c=>c.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(c=>c.name).indexOf(t.uniforms.map.name));const o=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,a=(()=>{switch(t.type){case Hh.MeshStandardMaterial:return t.metalness;case Hh.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case Hh.MeshStandardMaterial:return t.roughness;case Hh.MeshBasicMaterial:return .9;default:return .9}})();return{alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{},VRMC_materials_mtoon:i}:void 0,name:t.name,pbrMetallicRoughness:{baseColorFactor:r,baseColorTexture:o,metallicFactor:a,roughnessFactor:l}}}),Epe=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),Bpe=n=>n.map(()=>({magFilter:yr.LINEAR,minFilter:yr.LINEAR,wrapS:yr.REPEAT,wrapT:yr.REPEAT})),Spe=n=>n.map((e,t)=>({sampler:0,source:t})),Mpe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===Li.Object3D||r.type===Li.SkinnedMesh||r.type===Li.Group||r.type===Li.Bone).map(r=>t.indexOf(r.name))}]},IG=0,Cpe=1,RG=2,pO=2,DB=1.25,mO=1,sg=6*4+4+4,C1=65535,Tpe=Math.pow(2,-24),NB=Symbol("SKIP_GENERATION");function Ipe(n){return n.index?n.index.count:n.attributes.position.count}function qd(n){return Ipe(n)/3}function Rpe(n,e=ArrayBuffer){return n>65535?new Uint32Array(new e(4*n)):new Uint16Array(new e(2*n))}function Upe(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Rpe(t,r);n.setIndex(new lt(i,1));for(let s=0;sl-c);for(let l=0;lo.offset-a.offset),i=r[r.length-1];i.count=Math.min(t-i.offset,i.count);let s=0;return r.forEach(({count:o})=>s+=o),t!==s}function OB(n,e,t,r,i){let s=1/0,o=1/0,a=1/0,l=-1/0,c=-1/0,A=-1/0,u=1/0,f=1/0,h=1/0,d=-1/0,m=-1/0,g=-1/0;for(let p=e*6,v=(e+t)*6;pl&&(l=b),wd&&(d=w);const B=n[p+2],S=n[p+3],I=B-S,M=B+S;Ic&&(c=M),Bm&&(m=B);const P=n[p+4],D=n[p+5],T=P-D,y=P+D;TA&&(A=y),Pg&&(g=P)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=c,r[5]=A,i[0]=u,i[1]=f,i[2]=h,i[3]=d,i[4]=m,i[5]=g}function Ppe(n,e=null,t=null,r=null){const i=n.attributes.position,s=n.index?n.index.array:null,o=qd(n),a=i.normalized;let l;e===null?(l=new Float32Array(o*6),t=0,r=o):(l=e,t=t||0,r=r||o);const c=i.array,A=i.offset||0;let u=3;i.isInterleavedBufferAttribute&&(u=i.data.stride);const f=["getX","getY","getZ"];for(let h=t;hS&&(S=x),b>S&&(S=b);const I=(S-B)/2,M=w*2;l[m+M+0]=B+I,l[m+M+1]=I+(Math.abs(B)+I)*Tpe}}return l}function er(n,e,t){return t.min.x=e[n],t.min.y=e[n+1],t.min.z=e[n+2],t.max.x=e[n+3],t.max.y=e[n+4],t.max.z=e[n+5],t}function gO(n){let e=-1,t=-1/0;for(let r=0;r<3;r++){const i=n[r+3]-n[r];i>t&&(t=i,e=r)}return e}function vO(n,e){e.set(n)}function yO(n,e,t){let r,i;for(let s=0;s<3;s++){const o=s+3;r=n[s],i=e[s],t[s]=ri?r:i}}function yy(n,e,t){for(let r=0;r<3;r++){const i=e[n+2*r],s=e[n+2*r+1],o=i-s,a=i+s;ot[r+3]&&(t[r+3]=a)}}function Xp(n){const e=n[3]-n[0],t=n[4]-n[1],r=n[5]-n[2];return 2*(e*t+t*r+r*e)}const Bl=32,Lpe=(n,e)=>n.candidate-e.candidate,Tc=new Array(Bl).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),wy=new Float32Array(6);function Dpe(n,e,t,r,i,s){let o=-1,a=0;if(s===IG)o=gO(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===Cpe)o=gO(n),o!==-1&&(a=Npe(t,r,i,o));else if(s===RG){const l=Xp(n);let c=DB*i;const A=r*6,u=(r+i)*6;for(let f=0;f<3;f++){const h=e[f],g=(e[f+3]-h)/Bl;if(i=B.candidate?yy(_,t,B.rightCacheBounds):(yy(_,t,B.leftCacheBounds),B.count++)}}for(let _=0;_=Bl&&(b=Bl-1);const B=Tc[b];B.count++,yy(w,t,B.bounds)}const p=Tc[Bl-1];vO(p.bounds,p.rightCacheBounds);for(let w=Bl-2;w>=0;w--){const _=Tc[w],x=Tc[w+1];yO(_.bounds,x.rightCacheBounds,_.rightCacheBounds)}let v=0;for(let w=0;w=l;)a--;if(o=l;)a--;if(oHpe)throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return Um[t+6]=c/4,c=aT(c,a),Um[t+7]=l,c}}function zpe(n,e){const t=(n.index?n.index.count:n.attributes.position.count)/3,r=t>2**16,i=r?4:2,s=e?new SharedArrayBuffer(t*i):new ArrayBuffer(t*i),o=r?new Uint32Array(s):new Uint16Array(s);for(let a=0,l=o.length;a=s&&(p=!0,o&&(console.warn(`MeshBVH: Max depth of ${s} reached when generating BVH. Consider increasing maxDepth.`),console.warn(f))),B<=a||I>=s)return w(b+B),x.offset=b,x.count=B,x;const M=Dpe(x.boundingData,S,e,b,B,l);if(M.axis===-1)return w(b+B),x.offset=b,x.count=B,x;const P=d(u,h,e,b,B,M);if(P===b||P===b+B)w(b+B),x.offset=b,x.count=B;else{x.splitAxis=M.axis;const D=new kB,T=b,y=P-b;x.left=D,OB(e,T,y,D.boundingData,g),_(D,T,y,g,I+1);const E=new kB,R=P,L=B-y;x.right=E,OB(e,R,L,E.boundingData,g),_(E,R,L,g,I+1)}return x}}function Vpe(n,e){const t=n.geometry;e.indirect&&(n._indirectBuffer=zpe(t,e.useSharedArrayBuffer),Fpe(t,e.range)&&!e.verbose&&console.warn('MeshBVH: Provided geometry contains groups or a range that do not fully span the vertex contents while using the "indirect" option. BVH may incorrectly report intersections on unrendered portions of the geometry.')),n._indirectBuffer||Upe(t,e);const r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer,i=Ppe(t),s=e.indirect?UG(t,e.range):FG(t,e.range);n._roots=s.map(o=>{const a=Gpe(n,i,o.offset,o.count,e),l=oT(a),c=new r(sg*l);return Qpe(0,a,c),c})}class sc{constructor(){this.min=1/0,this.max=-1/0}setFromPointsField(e,t){let r=1/0,i=-1/0;for(let s=0,o=e.length;si?l:i}this.min=r,this.max=i}setFromPoints(e,t){let r=1/0,i=-1/0;for(let s=0,o=t.length;si?l:i}this.min=r,this.max=i}isSeparated(e){return this.min>e.max||e.min>this.max}}sc.prototype.setFromBox=function(){const n=new $;return function(t,r){const i=r.min,s=r.max;let o=1/0,a=-1/0;for(let l=0;l<=1;l++)for(let c=0;c<=1;c++)for(let A=0;A<=1;A++){n.x=i.x*l+s.x*(1-l),n.y=i.y*c+s.y*(1-c),n.z=i.z*A+s.z*(1-A);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const jpe=function(){const n=new $,e=new $,t=new $;return function(i,s,o){const a=i.start,l=n,c=s.start,A=e;t.subVectors(a,c),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(A),f=A.dot(l),h=A.dot(A),d=t.dot(l),g=l.dot(l)*h-f*f;let p,v;g!==0?p=(u*f-d*h)/g:p=0,v=(u+p*f)/h,o.x=p,o.y=v}}(),a2=function(){const n=new je,e=new $,t=new $;return function(i,s,o,a){jpe(i,s,n);let l=n.x,c=n.y;if(l>=0&&l<=1&&c>=0&&c<=1){i.at(l,o),s.at(c,a);return}else if(l>=0&&l<=1){c<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(c>=0&&c<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let A;l<0?A=i.start:A=i.end;let u;c<0?u=s.start:u=s.end;const f=e,h=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(A,!0,t),f.distanceToSquared(u)<=h.distanceToSquared(A)){o.copy(f),a.copy(u);return}else{o.copy(A),a.copy(h);return}}}}(),Wpe=function(){const n=new $,e=new $,t=new Ma,r=new Wl;return function(s,o){const{radius:a,center:l}=s,{a:c,b:A,c:u}=o;if(r.start=c,r.end=A,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const m=o.getPlane(t);if(Math.abs(m.distanceToPoint(l))<=a){const p=m.projectPoint(l,e);if(o.containsPoint(p))return!0}return!1}}(),Kpe=1e-15;function HB(n){return Math.abs(n)new $),this.satBounds=new Array(4).fill().map(()=>new sc),this.points=[this.a,this.b,this.c],this.sphere=new Si,this.plane=new Ma,this.needsUpdate=!0}intersectsSphere(e){return Wpe(e,this)}update(){const e=this.a,t=this.b,r=this.c,i=this.points,s=this.satAxes,o=this.satBounds,a=s[0],l=o[0];this.getNormal(a),l.setFromPoints(a,i);const c=s[1],A=o[1];c.subVectors(e,t),A.setFromPoints(c,i);const u=s[2],f=o[2];u.subVectors(t,r),f.setFromPoints(u,i);const h=s[3],d=o[3];h.subVectors(r,e),d.setFromPoints(h,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}oa.prototype.closestPointToSegment=function(){const n=new $,e=new $,t=new Wl;return function(i,s=null,o=null){const{start:a,end:l}=i,c=this.points;let A,u=1/0;for(let f=0;f<3;f++){const h=(f+1)%3;t.start.copy(c[f]),t.end.copy(c[h]),a2(t,i,n,e),A=n.distanceToSquared(e),A=2){(_===1?p.start:p.end).copy(h),w=2;break}if(w++,w===2&&_===-1)break}}return w}return function(g,p=null,v=!1){this.needsUpdate&&this.update(),g.isExtendedTriangle?g.needsUpdate&&g.update():(n.copy(g),n.update(),g=n);const w=this.plane,_=g.plane;if(Math.abs(w.normal.dot(_.normal))>1-1e-10){const x=this.satBounds,b=this.satAxes;t[0]=g.a,t[1]=g.b,t[2]=g.c;for(let I=0;I<4;I++){const M=x[I],P=b[I];if(r.setFromPoints(P,t),M.isSeparated(r))return!1}const B=g.satBounds,S=g.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let I=0;I<4;I++){const M=B[I],P=S[I];if(r.setFromPoints(P,e),M.isSeparated(r))return!1}for(let I=0;I<4;I++){const M=b[I];for(let P=0;P<4;P++){const D=S[P];if(s.crossVectors(M,D),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return p&&(v||console.warn("ExtendedTriangle.intersectsTriangle: Triangles are coplanar which does not support an output edge. Setting edge to 0, 0, 0."),p.start.set(0,0,0),p.end.set(0,0,0)),!0}else{const x=d(this,_,u);if(x===1&&g.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(x!==2)return!1;const b=d(g,w,f);if(b===1&&this.containsPoint(f.end))return p&&(p.start.copy(f.end),p.end.copy(f.end)),!0;if(b!==2)return!1;if(u.delta(a),f.delta(l),a.dot(l)<0){let T=f.start;f.start=f.end,f.end=T}const B=u.start.dot(a),S=u.end.dot(a),I=f.start.dot(a),M=f.end.dot(a),P=S0?p.start.copy(u.start):p.start.copy(f.start),c.subVectors(u.end,f.end),c.dot(a)<0?p.end.copy(u.end):p.end.copy(f.end)),!0)}}}();oa.prototype.distanceToPoint=function(){const n=new $;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();oa.prototype.distanceToTriangle=function(){const n=new $,e=new $,t=["a","b","c"],r=new Wl,i=new Wl;return function(o,a=null,l=null){const c=a||l?r:null;if(this.intersectsTriangle(o,c))return(a||l)&&(a&&c.getCenter(a),l&&c.getCenter(l)),0;let A=1/0;for(let u=0;u<3;u++){let f;const h=t[u],d=o[h];this.closestPointToPoint(d,n),f=d.distanceToSquared(n),fnew $),this.satAxes=new Array(3).fill().map(()=>new $),this.satBounds=new Array(3).fill().map(()=>new sc),this.alignedSatBounds=new Array(3).fill().map(()=>new sc),this.needsUpdate=!1,e&&this.min.copy(e),t&&this.max.copy(t),r&&this.matrix.copy(r)}set(e,t,r){this.min.copy(e),this.max.copy(t),this.matrix.copy(r),this.needsUpdate=!0}copy(e){this.min.copy(e.min),this.max.copy(e.max),this.matrix.copy(e.matrix),this.needsUpdate=!0}}zi.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let c=0;c<=1;c++)for(let A=0;A<=1;A++)for(let u=0;u<=1;u++){const f=1*c|2*A|4*u,h=i[f];h.x=c?r.x:t.x,h.y=A?r.y:t.y,h.z=u?r.z:t.z,h.applyMatrix4(e)}const s=this.satBounds,o=this.satAxes,a=i[0];for(let c=0;c<3;c++){const A=o[c],u=s[c],f=1<new Wl),t=new Array(12).fill().map(()=>new Wl),r=new $,i=new $;return function(o,a=0,l=null,c=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||c)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),c&&c.copy(i)),0;const A=a*a,u=o.min,f=o.max,h=this.points;let d=1/0;for(let g=0;g<8;g++){const p=h[g];i.copy(p).clamp(u,f);const v=p.distanceToSquared(i);if(vnew oa)}}const go=new Xpe;class Ype{constructor(){this.float32Array=null,this.uint16Array=null,this.uint32Array=null;const e=[];let t=null;this.setBuffer=r=>{t&&e.push(t),t=r,this.float32Array=new Float32Array(r),this.uint16Array=new Uint16Array(r),this.uint32Array=new Uint32Array(r)},this.clearBuffer=()=>{t=null,this.float32Array=null,this.uint16Array=null,this.uint32Array=null,e.length!==0&&this.setBuffer(e.pop())}}}const Rn=new Ype;let Jc,Qh;const Lf=[],_y=new l2(()=>new Qn);function $pe(n,e,t,r,i,s){Jc=_y.getPrimitive(),Qh=_y.getPrimitive(),Lf.push(Jc,Qh),Rn.setBuffer(n._roots[e]);const o=lT(0,n.geometry,t,r,i,s);Rn.clearBuffer(),_y.releasePrimitive(Jc),_y.releasePrimitive(Qh),Lf.pop(),Lf.pop();const a=Lf.length;return a>0&&(Qh=Lf[a-1],Jc=Lf[a-2]),o}function lT(n,e,t,r,i=null,s=0,o=0){const{float32Array:a,uint16Array:l,uint32Array:c}=Rn;let A=n*2;if($i(A,l)){const f=Us(n,c),h=ho(A,l);return er(n,a,Jc),r(f,h,!1,o,s+n,Jc)}else{let M=function(D){const{uint16Array:T,uint32Array:y}=Rn;let E=D*2;for(;!$i(E,T);)D=po(D),E=D*2;return Us(D,y)},P=function(D){const{uint16Array:T,uint32Array:y}=Rn;let E=D*2;for(;!$i(E,T);)D=mo(D,y),E=D*2;return Us(D,y)+ho(E,T)};const f=po(n),h=mo(n,c);let d=f,m=h,g,p,v,w;if(i&&(v=Jc,w=Qh,er(d,a,v),er(m,a,w),g=i(v),p=i(w),p(Yp.copy(e).clamp(A.min,A.max),Yp.distanceToSquared(e)),intersectsBounds:(A,u,f)=>f{A.closestPointToPoint(e,Yp);const f=e.distanceToSquared(Yp);return f=169,XA=new $,YA=new $,$A=new $,xy=new je,by=new je,Ey=new je,wO=new $,_O=new $,xO=new $,$p=new $;function Jpe(n,e,t,r,i,s,o,a){let l;if(s===oi?l=n.intersectTriangle(r,t,e,!0,i):l=n.intersectTriangle(e,t,r,s!==_i,i),l===null)return null;const c=n.origin.distanceTo(i);return ca?null:{distance:c,point:i.clone()}}function eme(n,e,t,r,i,s,o,a,l,c,A){XA.fromBufferAttribute(e,s),YA.fromBufferAttribute(e,o),$A.fromBufferAttribute(e,a);const u=Jpe(n,XA,YA,$A,$p,l,c,A);if(u){const f=new $;Wr.getBarycoord($p,XA,YA,$A,f),r&&(xy.fromBufferAttribute(r,s),by.fromBufferAttribute(r,o),Ey.fromBufferAttribute(r,a),u.uv=Wr.getInterpolation($p,XA,YA,$A,xy,by,Ey,new je)),i&&(xy.fromBufferAttribute(i,s),by.fromBufferAttribute(i,o),Ey.fromBufferAttribute(i,a),u.uv1=Wr.getInterpolation($p,XA,YA,$A,xy,by,Ey,new je)),t&&(wO.fromBufferAttribute(t,s),_O.fromBufferAttribute(t,o),xO.fromBufferAttribute(t,a),u.normal=Wr.getInterpolation($p,XA,YA,$A,wO,_O,xO,new $),u.normal.dot(n.direction)>0&&u.normal.multiplyScalar(-1));const h={a:s,b:o,c:a,normal:new $,materialIndex:0};Wr.getNormal(XA,YA,$A,h.normal),u.face=h,u.faceIndex=s,qpe&&(u.barycoord=f)}return u}function T1(n,e,t,r,i,s,o){const a=r*3;let l=a+0,c=a+1,A=a+2;const u=n.index;n.index&&(l=u.getX(l),c=u.getX(c),A=u.getX(A));const{position:f,normal:h,uv:d,uv1:m}=n.attributes,g=eme(t,f,h,d,m,l,c,A,e,s,o);return g?(g.faceIndex=r,i&&i.push(g),g):null}function Sr(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,c=e+2;t&&(a=t.getX(a),l=t.getX(l),c=t.getX(c)),i.x=r.getX(a),i.y=r.getY(a),i.z=r.getZ(a),s.x=r.getX(l),s.y=r.getY(l),s.z=r.getZ(l),o.x=r.getX(c),o.y=r.getY(c),o.z=r.getZ(c)}function tme(n,e,t,r,i,s,o,a){const{geometry:l,_indirectBuffer:c}=n;for(let A=r,u=r+i;Ab&&(b=D),T<_&&(_=T),T>B&&(B=T),yS&&(S=y)}return l[f+0]!==w||l[f+1]!==_||l[f+2]!==x||l[f+3]!==b||l[f+4]!==B||l[f+5]!==S?(l[f+0]=w,l[f+1]=_,l[f+2]=x,l[f+3]=b,l[f+4]=B,l[f+5]=S,!0):!1}else{const p=f+8,v=o[f+6],w=p+h,_=v+h;let x=d,b=!1,B=!1;e?x||(b=e.has(w),B=e.has(_),x=!b&&!B):(b=!0,B=!0);const S=x||b,I=x||B;let M=!1;S&&(M=u(p,h,x));let P=!1;I&&(P=u(v,h,x));const D=M||P;if(D)for(let T=0;T<3;T++){const y=p+T,E=v+T,R=l[y],L=l[y+3],N=l[E],z=l[E+3];l[f+T]=Rz?L:z}return D}}}function _A(n,e,t,r,i){let s,o,a,l,c,A;const u=1/t.direction.x,f=1/t.direction.y,h=1/t.direction.z,d=t.origin.x,m=t.origin.y,g=t.origin.z;let p=e[n],v=e[n+3],w=e[n+1],_=e[n+3+1],x=e[n+2],b=e[n+3+2];return u>=0?(s=(p-d)*u,o=(v-d)*u):(s=(v-d)*u,o=(p-d)*u),f>=0?(a=(w-m)*f,l=(_-m)*f):(a=(_-m)*f,l=(w-m)*f),s>l||a>o||((a>s||isNaN(s))&&(s=a),(l=0?(c=(x-g)*h,A=(b-g)*h):(c=(b-g)*h,A=(x-g)*h),s>A||c>o)?!1:((c>s||s!==s)&&(s=c),(A=r)}function sme(n,e,t,r,i,s,o,a){const{geometry:l,_indirectBuffer:c}=n;for(let A=r,u=r+i;A=0;let m,g;d?(m=po(n),g=mo(n,l)):(m=mo(n,l),g=po(n));const v=_A(m,o,r,i,s)?AT(m,e,t,r,i,s):null;if(v){const x=v.point[f];if(d?x<=o[g+u]:x>=o[g+u+3])return v}const _=_A(g,o,r,i,s)?AT(g,e,t,r,i,s):null;return v&&_?v.distance<=_.distance?v:_:v||_||null}}const By=new Qn,Df=new oa,Nf=new oa,Zp=new ke,bO=new zi,Sy=new zi;function ume(n,e,t,r){Rn.setBuffer(n._roots[e]);const i=uT(0,n,t,r);return Rn.clearBuffer(),i}function uT(n,e,t,r,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=Rn;let l=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),bO.set(t.boundingBox.min,t.boundingBox.max,r),i=bO),$i(l,o)){const A=e.geometry,u=A.index,f=A.attributes.position,h=t.index,d=t.attributes.position,m=Us(n,a),g=ho(l,o);if(Zp.copy(r).invert(),t.boundsTree)return er(n,s,Sy),Sy.matrix.copy(Zp),Sy.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>Sy.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(r),v.b.applyMatrix4(r),v.c.applyMatrix4(r),v.needsUpdate=!0;for(let w=m*3,_=(g+m)*3;w<_;w+=3)if(Sr(Nf,w,u,f),Nf.needsUpdate=!0,v.intersectsTriangle(Nf))return!0;return!1}});for(let p=m*3,v=(g+m)*3;pzB.distanceToBox(x),intersectsBounds:(x,b,B)=>B{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:S=>qp.distanceToBox(S),intersectsBounds:(S,I,M)=>M{for(let M=S,P=S+I;Mb&&(b=y),E<_&&(_=E),E>B&&(B=E),RS&&(S=R)}}return l[f+0]!==w||l[f+1]!==_||l[f+2]!==x||l[f+3]!==b||l[f+4]!==B||l[f+5]!==S?(l[f+0]=w,l[f+1]=_,l[f+2]=x,l[f+3]=b,l[f+4]=B,l[f+5]=S,!0):!1}else{const p=f+8,v=o[f+6],w=p+h,_=v+h;let x=d,b=!1,B=!1;e?x||(b=e.has(w),B=e.has(_),x=!b&&!B):(b=!0,B=!0);const S=x||b,I=x||B;let M=!1;S&&(M=u(p,h,x));let P=!1;I&&(P=u(v,h,x));const D=M||P;if(D)for(let T=0;T<3;T++){const y=p+T,E=v+T,R=l[y],L=l[y+3],N=l[E],z=l[E+3];l[f+T]=Rz?L:z}return D}}}function vme(n,e,t,r,i,s,o){Rn.setBuffer(n._roots[e]),fT(0,n,t,r,i,s,o),Rn.clearBuffer()}function fT(n,e,t,r,i,s,o){const{float32Array:a,uint16Array:l,uint32Array:c}=Rn,A=n*2;if($i(A,l)){const f=Us(n,c),h=ho(A,l);sme(e,t,r,f,h,i,s,o)}else{const f=po(n);_A(f,a,r,s,o)&&fT(f,e,t,r,i,s,o);const h=mo(n,c);_A(h,a,r,s,o)&&fT(h,e,t,r,i,s,o)}}const yme=["x","y","z"];function wme(n,e,t,r,i,s){Rn.setBuffer(n._roots[e]);const o=hT(0,n,t,r,i,s);return Rn.clearBuffer(),o}function hT(n,e,t,r,i,s){const{float32Array:o,uint16Array:a,uint32Array:l}=Rn;let c=n*2;if($i(c,a)){const u=Us(n,l),f=ho(c,a);return ome(e,t,r,u,f,i,s)}else{const u=PG(n,l),f=yme[u],d=r.direction[f]>=0;let m,g;d?(m=po(n),g=mo(n,l)):(m=mo(n,l),g=po(n));const v=_A(m,o,r,i,s)?hT(m,e,t,r,i,s):null;if(v){const x=v.point[f];if(d?x<=o[g+u]:x>=o[g+u+3])return v}const _=_A(g,o,r,i,s)?hT(g,e,t,r,i,s):null;return v&&_?v.distance<=_.distance?v:_:v||_||null}}const Cy=new Qn,Of=new oa,kf=new oa,Jp=new ke,EO=new zi,Ty=new zi;function _me(n,e,t,r){Rn.setBuffer(n._roots[e]);const i=dT(0,n,t,r);return Rn.clearBuffer(),i}function dT(n,e,t,r,i=null){const{float32Array:s,uint16Array:o,uint32Array:a}=Rn;let l=n*2;if(i===null&&(t.boundingBox||t.computeBoundingBox(),EO.set(t.boundingBox.min,t.boundingBox.max,r),i=EO),$i(l,o)){const A=e.geometry,u=A.index,f=A.attributes.position,h=t.index,d=t.attributes.position,m=Us(n,a),g=ho(l,o);if(Jp.copy(r).invert(),t.boundsTree)return er(n,s,Ty),Ty.matrix.copy(Jp),Ty.needsUpdate=!0,t.boundsTree.shapecast({intersectsBounds:v=>Ty.intersectsBox(v),intersectsTriangle:v=>{v.a.applyMatrix4(r),v.b.applyMatrix4(r),v.c.applyMatrix4(r),v.needsUpdate=!0;for(let w=m,_=g+m;w<_;w++)if(Sr(kf,3*e.resolveTriangleIndex(w),u,f),kf.needsUpdate=!0,v.intersectsTriangle(kf))return!0;return!1}});for(let p=m,v=g+m;pGB.distanceToBox(x),intersectsBounds:(x,b,B)=>B{if(e.boundsTree){const B=e.boundsTree;return B.shapecast({boundsTraverseOrder:S=>em.distanceToBox(S),intersectsBounds:(S,I,M)=>M{for(let M=S,P=S+I;Mnew Qn),Hf=new Qn,Qf=new Qn,VB=new Qn,jB=new Qn;let WB=!1;function Cme(n,e,t,r){if(WB)throw new Error("MeshBVH: Recursive calls to bvhcast not supported.");WB=!0;const i=n._roots,s=e._roots;let o,a=0,l=0;const c=new ke().copy(t).invert();for(let A=0,u=i.length;Al.slice()),index:o?o.array.slice():null,indirectBuffer:s?s.slice():null}:a={roots:i,index:o?o.array:null,indirectBuffer:s},a}static deserialize(e,t,r={}){r={setIndex:!0,indirect:!!e.indirectBuffer,...r};const{index:i,roots:s,indirectBuffer:o}=e,a=new c2(t,{...r,[NB]:!0});if(a._roots=s,a._indirectBuffer=o||null,r.setIndex){const l=t.getIndex();if(l===null){const c=new lt(e.index,1,!1);t.setIndex(c)}else l.array!==i&&(l.array.set(i),l.needsUpdate=!0)}return a}get indirect(){return!!this._indirectBuffer}constructor(e,t={}){if(e.isBufferGeometry){if(e.index&&e.index.isInterleavedBufferAttribute)throw new Error("MeshBVH: InterleavedBufferAttribute is not supported for the index attribute.")}else throw new Error("MeshBVH: Only BufferGeometries are supported.");if(t=Object.assign({...Tme,[NB]:!1},t),t.useSharedArrayBuffer&&!Mme())throw new Error("MeshBVH: SharedArrayBuffer is not available.");this.geometry=e,this._roots=null,this._indirectBuffer=null,t[NB]||(Vpe(this,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new Qn))),this.resolveTriangleIndex=t.indirect?r=>this._indirectBuffer[r]:r=>r}refit(e=null){return(this.indirect?gme:ime)(this,e)}traverse(e,t=0){const r=this._roots[t],i=new Uint32Array(r),s=new Uint16Array(r);o(0);function o(a,l=0){const c=a*2,A=s[c+15]===C1;if(A){const u=i[a+6],f=s[c+14];e(l,A,new Float32Array(r,a*4,6),u,f)}else{const u=a+sg/4,f=i[a+6],h=i[a+7];e(l,A,new Float32Array(r,a*4,6),h)||(o(u,l+1),o(f,l+1))}}}raycast(e,t=Hs,r=0,i=1/0){const s=this._roots,o=this.geometry,a=[],l=t.isMaterial,c=Array.isArray(t),A=o.groups,u=l?t.side:t,f=this.indirect?vme:lme;for(let h=0,d=s.length;hu(f,h,d,m,g)?!0:r(f,h,this,a,d,m,t)}else o||(a?o=(u,f,h,d)=>r(u,f,this,a,h,d,t):o=(u,f,h)=>h);let l=!1,c=0;const A=this._roots;for(let u=0,f=A.length;u{const m=this.resolveTriangleIndex(d);Sr(o,m*3,a,l)}:d=>{Sr(o,d*3,a,l)},A=go.getPrimitive(),u=e.geometry.index,f=e.geometry.attributes.position,h=e.indirect?d=>{const m=e.resolveTriangleIndex(d);Sr(A,m*3,u,f)}:d=>{Sr(A,d*3,u,f)};if(s){const d=(m,g,p,v,w,_,x,b)=>{for(let B=p,S=p+v;BRy.intersectsBox(r),intersectsTriangle:r=>Ry.intersectsTriangle(r)})}intersectsSphere(e){return this.shapecast({intersectsBounds:t=>e.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(e)})}closestPointToGeometry(e,t,r={},i={},s=0,o=1/0){return(this.indirect?Sme:mme)(this,e,t,r,i,s,o)}closestPointToPoint(e,t={},r=0,i=1/0){return Zpe(this,e,t,r,i)}getBoundingBox(e){return e.makeEmpty(),this._roots.forEach(r=>{er(0,new Float32Array(r),BO),e.union(BO)}),e}}function SO(n,e,t){return n===null?null:(n.point.applyMatrix4(e.matrixWorld),n.distance=n.point.distanceTo(t.ray.origin),n.object=e,n)}const Uy=new Ku,MO=new $,CO=new ke,Ime=hn.prototype.raycast,Rme=bse.prototype.raycast,TO=new $,Jr=new hn,Fy=[];function Ume(n,e){this.isBatchedMesh?Fme.call(this,n,e):Pme.call(this,n,e)}function Fme(n,e){if(this.boundsTrees){const t=this.boundsTrees,r=this._drawInfo,i=this._drawRanges,s=this.matrixWorld;Jr.material=this.material,Jr.geometry=this.geometry;const o=Jr.geometry.boundsTree,a=Jr.geometry.drawRange;Jr.geometry.boundingSphere===null&&(Jr.geometry.boundingSphere=new Si);for(let l=0,c=r.length;l{const e=n.attributes.position,t=n.index,r=new Wr,i=new $,s=new $,o=new $,a=[];for(let l=0;l{const e=n.geometry.clone();let t=[];if(Array.isArray(n.material))for(let i=0;i{n.isMesh&&(n.geometry.userData.faceNormals=null,n.geometry.dispose(),n.geometry.disposeBoundsTree(),n.parent&&n.parent.remove(n),n.userData.cancelMesh&&Lw(n.userData.cancelMesh))},NG=n=>{var e,t;n.userData.cullingClone&&(Lw(n.userData.cullingClone),n.userData.cullingClone=null,Lw(n.userData.cullingCloneP),n.userData.cullingCloneP=null,Lw(n.userData.cullingCloneN),n.userData.cullingCloneN=null,((e=n.userData)==null?void 0:e.clippedIndexGeometry)!=null&&(n.userData.clippedIndexGeometry=null),((t=n.userData)==null?void 0:t.origIndexBuffer)!=null&&(n.userData.origIndexBuffer=null))},Gme=async n=>{if(n==null){console.warn("Null parameter for meshes was provided. Skipping mesh culling.");return}if(!Array.isArray(n)){console.warn("No valid mesh array was provided. Skipping mesh culling.");return}if(n.length==0){console.warn("No mesh array with elements was provided. Skipping mesh culling.");return}const e=[];Fm=n[0].parent,Fm.lines!=null&&(Fm.lines.forEach(i=>{i.visible=!1}),Fm.lines.length=0),n.forEach(i=>{if(i.userData.cullLayer!=null){i.userData.origIndexBuffer==null&&(i.userData.origIndexBuffer=i.geometry.index.clone()),e[i.userData.cullLayer]==null&&(e[i.userData.cullLayer]={origMeshes:[],cloneMeshes:[],posMeshes:[],negMeshes:[],scaleMeshes:[],positionMeshes:[]}),i.userData.cullingClone==null&&(i.userData.cullingClone=zme(i),i.userData.cullingCloneP=i.userData.cullingClone.clone(),i.userData.cullingCloneN=i.userData.cullingClone.clone());const s=i.userData.cullingClone,o=i.userData.cullingCloneP,a=i.userData.cullingCloneN;o.material=kme,a.userData.cancelMesh=o,a.material=Hme,o.userData.maxCullDistance=a.userData.maxCullDistance=i.userData.maxCullDistance,e[i.userData.cullLayer].origMeshes.push(i),e[i.userData.cullLayer].cloneMeshes.push(s),e[i.userData.cullLayer].posMeshes.push(o),e[i.userData.cullLayer].negMeshes.push(a),i.geometry.setIndex(i.userData.origIndexBuffer)}});for(let i=e.length-1;i>=0;i--)e[i]==null&&e.splice(i,1);let t=[];const r=[];for(let i=e.length-1;i>=0;i--){if(t.length!=0||e.length>=1)for(let s=0;s{i.geom.setIndex(i.index)})},Vme=n=>{let e=Nme,t=Ome;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},jme=(n,e,t,r,i,s,o=!1)=>{const a=[],l=Vme(s);let c=l[0],A=l[1];Py.far=c+A;for(let f=0;f=0;v--)c-p[v].distance>=p[v].object.userData.maxCullDistance&&p.splice(v,1);if(p.length===0){for(let v=0;v<3;v++)a.push(n[h+v]);break}else{const v=p.map(w=>w.object);for(let w=0;ww).length===0){for(let w=0;w<3;w++)a.push(n[h+w]);break}if(m===0)d=p.map(w=>w.object);else if(d=p.map(w=>{if(d.indexOf(w.object)!==-1)return w.object}),d=d.filter(w=>w),m===2&&d.filter(w=>w).length===0)for(let w=0;w<3;w++)a.push(n[h+w]);o&&Wme(KB,tm.clone().multiplyScalar(-1),Py.far,16711680,Fm)}}}const u=new Uint32Array(a);return new lt(u,1,!1)};function Wme(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new $;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new Zt().setFromPoints(o),l=[];l.push(new He(0)),l.push(new He(16777215));let c=new Ac({color:r});var A=new Yd(a,c);A.renderOrder=100,i.add(A),i.lines.push(A)}function Kme(n,e=10){if(n<=0)return[];const t=n,r=[{w:e,h:e,x:0,y:0}];function i(o,a,l,c){if(a<=0)return;const A=o.w/2,u=[{w:A,h:A,x:l,y:c},{w:A,h:A,x:l+A,y:c},{w:A,h:A,x:l,y:c+A},{w:A,h:A,x:l+A,y:c+A}];r.push(...u);const f=r.find(p=>p.x===l&&p.y===c&&p.w===o.w&&p.h===o.h);if(r.splice(r.indexOf(f),1),n<=r.length)return;const h=Math.max(...r.map(p=>p.w)),d=r.find(p=>p.w===h),m=d.x,g=d.y;i({w:d.w,h:d.h},a-1,m,g)}if(n==1)return{squares:r,fill:1};for(i({w:e,h:e},t,0,0),r.sort((o,a)=>a.w-o.w);r.length>n;)r.pop();const s=r.reduce((o,a)=>o+a.w*a.h,0)/(e*e);return{squares:r,fill:s}}class A2{constructor(e,t){jt(this,"width");jt(this,"height");jt(this,"cameraRTT",null);jt(this,"sceneRTT",null);jt(this,"material",null);jt(this,"quad",null);jt(this,"renderer",null);jt(this,"rtTexture",null);this.width=e,this.height=t}render(e,t,r,i,s,o,a=!0){var A;if(e||(e=A2.createSolidColorTexture(r,i,s)),this.renderer==null){this.sceneRTT=new zg,this.cameraRTT=new g0(-i/2,i/2,s/2,-s/2,-1e4,1e4),this.cameraRTT.position.z=100,this.sceneRTT.add(this.cameraRTT),this.material=new qi({side:_i,transparent:!0,opacity:1,color:new He(1,1,1)});const u=new cc(1,1);this.quad=new hn(u,this.material),this.quad.scale.set(i,s,1),this.sceneRTT.add(this.quad),this.renderer=new v0,this.renderer.setPixelRatio(1),this.renderer.setSize(i,s),this.renderer.autoClear=!1}else this.cameraRTT&&(this.cameraRTT.left=-i/2,this.cameraRTT.right=i/2,this.cameraRTT.top=s/2,this.cameraRTT.bottom=-s/2,this.cameraRTT.updateProjectionMatrix()),(A=this.quad)==null||A.scale.set(i,s,1),this.renderer.setSize(i,s);this.rtTexture=new qa(i,s),this.rtTexture.texture.colorSpace=a?kt:Ra,this.material&&(this.material.map=e,this.material.color=t.clone()),this.renderer.setClearColor(r.clone(),o?0:1),this.renderer.setRenderTarget(this.rtTexture),this.renderer.clear(),this.sceneRTT&&this.cameraRTT&&this.renderer.render(this.sceneRTT,this.cameraRTT);let l=new Uint8ClampedArray(this.rtTexture.width*this.rtTexture.height*4);return this.renderer.readRenderTargetPixels(this.rtTexture,0,0,i,s,l),new ImageData(l,i,s)}destroy(){var e,t;this.cameraRTT=null,(e=this.sceneRTT)==null||e.clear(),this.sceneRTT=null,this.material=null,this.quad=null,(t=this.renderer)==null||t.dispose(),this.renderer=null,this.rtTexture=null}static createSolidColorTexture(e,t,r){const i=t*r,s=new Uint8Array(4*i),o=Math.floor(e.r*255),a=Math.floor(e.g*255),l=Math.floor(e.b*255);for(let A=0;Atypeof window>"u"?await $me({meshes:e,atlasSize:r,mtoon:i,transparentMaterial:s,transparentTexture:o}):await Zme({backColor:n,meshes:e,atlasSize:r,mtoon:i,includeNonTexturedMeshesInAtlas:t,transparentMaterial:s,transparentTexture:o,twoSidedMaterial:a}),$me=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(b=>{const B=b.material;let S=a.find(I=>I.material===B);if(!S)a.push({material:B,mesh:b});else{const{dest:I}=I1({meshes:[S.mesh,b]});S.mesh.geometry=I}});const l=Object.fromEntries(o.map(b=>[b,OG({width:s,height:s,transparent:i})])),c=Math.floor(Math.sqrt(n.length)+1),A=s/c,u=new Map(a.map((b,B)=>{const S=new je(B%c,Math.floor(B/c)).multiplyScalar(1/c),I=new je(S.x+1/c,S.y+1/c);return[b.mesh,{min:S,max:I}]})),f=[],h=[];a.forEach(b=>{const{min:B,max:S}=u.get(b.mesh);h.push(S),f.push(B)});const d=new je(Math.max(...h.map(b=>b.x)),Math.max(...h.map(b=>b.y))),m=new je(Math.min(...f.map(b=>b.x)),Math.min(...f.map(b=>b.y))),g=1/(d.x-m.x),p=1/(d.y-m.y),v=A*g,w=A*p,_=new Map(a.map(b=>{let{min:B,max:S}=u.get(b.mesh);return B.x=B.x*g,B.y=B.y*p,S.x=S.x*g,S.y=S.y*p,[b.mesh,{min:B,max:S}]}));a.forEach(b=>{const{material:B,mesh:S}=b,{min:I,max:M}=_.get(S);o.forEach(y=>{const E=l[y];E.globalCompositeOperation="source-over";let R=J_(B,pT[y].find(L=>J_(B,L)));if(R!==""&&R!==void 0)try{const L=new Uint8ClampedArray(R.data),N=new ImageData(L,v,w),z=document.createElement("canvas");z.width=v,z.height=w;const W=z.getContext("2d");W.putImageData(N,0,0),W.save(),E.drawImage(z,I.x*s,I.y*s,v,w)}catch(L){console.error("error",L)}else E.fillStyle=y==="diffuse"?`#${B.color.clone().getHexString()}`:y==="normal"?"#8080ff":y==="orm"?`#${new He(B.aoMapIntensity,B.roughness,B.metalness).getHexString()}`:"#7F7F7F",E.fillRect(I.x*s,I.y*s,v,w)});const P=S.geometry,D=P.attributes.uv;if(D)for(let y=0;y{const B=new Hn(l[b].canvas);return B.flipY=!1,[b,B]})));return{bakeObjects:a,textures:x,uvs:_}},Zme=async({backColor:n,includeNonTexturedMeshesInAtlas:e=!1,meshes:t,atlasSize:r,mtoon:i,transparentMaterial:s,transparentTexture:o,twoSidedMaterial:a})=>{const l=r,c=i?["diffuse"]:["diffuse","orm","normal"],A=[];let u=null;t.forEach(L=>{L=L.clone();const N=L.material.length==null?L.material:L.material[0];i&&u==null&&N.type=="ShaderMaterial"&&(u=N.clone());let z=A.find(W=>{W.material});if(!z)A.push({material:N,mesh:L});else{const{dest:W}=I1({meshes:[z.mesh,L]});z.mesh.geometry=W}});const f=Object.fromEntries(c.map(L=>[L,OG({width:l,height:l,transparent:o&&L=="diffuse"})])),h=new Set,d=new Map,m=A.map(L=>{const N=L.mesh.geometry;if(e==!1){if(!L.mesh.visible)return h.add(L.mesh),[L.mesh,0];let z=!0;for(const W of c)for(const H of pT[W])if(J_(L.material,H)&&z){z=!1;break}if(z){const W=L.material;if(W instanceof pr)return[L.mesh,2];if(d.size==0)return d.set(W,[L.mesh]),[L.mesh,1];for(let[H,C]of Array.from(d.entries()))if((()=>H.color.r.toFixed(5)==W.color.r.toFixed(5)&&H.color.g.toFixed(5)==W.color.g.toFixed(5)&&H.color.b.toFixed(5)==W.color.b.toFixed(5)&&H.emissive.equals(W.emissive)&&H.aoMapIntensity==W.aoMapIntensity&&H.metalness==W.metalness&&H.normalScale.equals(W.normalScale)&&H.roughness==W.roughness&&H.transparent==W.transparent&&H.vertexColors==W.vertexColors)())return C.push(L.mesh),[L.mesh,0];return d.set(W,[L.mesh]),[L.mesh,1]}}return[L.mesh,N.index?N.index.count/3:N.attributes.position.count/3]}).sort((L,N)=>N[1]-L[1]),g=m.filter(([,L])=>L!=0),{squares:p,fill:v}=Kme(g.length,l);console.log("squaresplit",v);const w=p.map(L=>({x:L.x,y:L.y,width:L.w,height:L.h})),_=new Map(w.map((L,N)=>[m[N][0],L]));d.forEach(L=>{if(L.length>1){const N=_.get(L[0]);L.forEach(z=>{_.set(z,N)})}});const x=new Map(Array.from(_.entries()).map(([L,N])=>{const z=new je(N.x,N.y),W=new je(N.x+N.width,N.y+N.height);return[L,{min:z,max:W}]})),b=[];Array.from(_.keys()).forEach(L=>{if(h.has(L))return;const{min:N,max:z}=x.get(L);b.push(N)});const B=new je(Math.min(...b.map(L=>L.x)),Math.min(...b.map(L=>L.y))),S=1/(l-B.x),I=1/(l-B.y),M=new Map(Array.from(_.keys()).map(L=>{if(h.has(L))return;let{min:N,max:z}=x.get(L);return N.x=N.x*S,N.y=N.y*I,z.x=z.x*S,z.y=z.y*I,[L,{min:N,max:z}]}).filter(L=>L));let P=!1;const D=new A2(l,l);Array.from(_.keys()).forEach(L=>{const N=A.find(re=>re.mesh===L),{material:z}=N;let W,H;const C=M.get(L);if(C?(W=C.min,H=C.max):(W=new je(0,0),H=new je(0,0)),!h.has(N.mesh)){const re=_.get(L).width,ce=_.get(L).height;c.forEach(oe=>{var k;const ge=f[oe];ge.globalCompositeOperation="source-over";let me,ve=new He(1,1,1);switch(oe){case"diffuse":me=z.color||n,(k=z.uniforms)!=null&&k.litFactor?ve=z.uniforms.litFactor.value:ve=z.color;break;case"normal":me=new He(8421631);break;case"orm":me=new He(0,z.roughness,z.metalness);break;default:me=new He(1,1,1);break}let be=Xme(z,pT[oe].find(ae=>J_(z,ae)));P==!1&&oe=="normal"&&be!=null&&(P=!0);const ne=D.render(be,ve,me,l,l,oe=="diffuse"&&o,oe!="normal");createImageBitmap(ne).then(ae=>ge.drawImage(ae,W.x*l,W.y*l,re,ce))})}const K=L.geometry.clone();L.geometry=K;const ee=K.attributes.uv.clone();if(K.attributes.uv=ee,ee)for(let re=0;re{const N=new Hn(f[L].canvas);return N.flipY=!1,[L,N]}))),y=a?_i:Hs;let E;const R=s?"transparent":"opaque";return i?(E=new Nd({map:T.diffuse,transparent:s,side:y}),u==null&&(u=new yG),u.side=y,u.uniforms.map=T.diffuse,u.uniforms.shadeMultiplyTexture=T.diffuse,u.transparent=s,o&&!s&&(E.alphaTest=.5,u.alphaTest=.5),E.userData.vrmMaterial=u,E.userData.shadeTexture=T.uniformColor,E.name="mToon_"+R,E.map.name=E.name):(E=new Nd({map:T.diffuse,roughnessMap:T.orm,metalnessMap:T.orm,normalMap:P?T.normal:null,transparent:s,side:y}),o&&!s&&(E.alphaTest=.5),E.name="standard_"+R,E.roughnessMap!=null&&(E.roughnessMap.name=E.name+"_orm"),E.normalMap!=null&&(E.normalMap.name=E.name+"_normal")),{bakeObjects:A,material:E}};function kG(n){const e=new Map;for(const r of n.skeleton.bones){const i=r.clone(!1);e.set(r,i)}n.skeleton.bones[0].traverse(r=>{if(r.type!=="Bone")return;const i=e.get(r);for(const s of r.children){const o=e.get(s);o&&i.add(o)}});const t=new UA(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function HG(n,e){const t=new Map;new $(-1,1,-1),new ke,new $;let r=0;n.forEach(l=>{if(l.skeleton){var c=kG(l);const A=c.bones;c.bones.forEach((u,f)=>{var h;if(A.indexOf(u)!==-1){const d=t.get(u.name);if(d==null){const m={index:r,boneInverses:c.boneInverses[f],bone:u.clone(!1),parentName:((h=u.parent)==null?void 0:h.type)=="Bone"?u.parent.name:null};r++,t.set(u.name,m)}else u.userData.VRMcolliders!=null&&(d.bone.userData.VRMcolliders==null?d.bone.userData.VRMcolliders=u.userData.VRMcolliders:u.userData.VRMcollidersID!=d.bone.userData.VRMcollidersID&&(d.bone.userData.VRMcolliders=[...d.bone.userData.VRMcolliders,...u.userData.VRMcolliders]))}})}});const i=[],s=[];[...t.values()].forEach(l=>{var c;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const A=(c=t.get(l.parentName))==null?void 0:c.bone;A&&A.add(l.bone)}});const a=new UA(i,s);return a.bones.forEach(l=>{var A;const c=(A=l.userData)==null?void 0:A.vrm0RestPosition;c&&l.position.set(-c.x,c.y,-c.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function qme(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(A=>A.name===o.name),c=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,c)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function Jme(n){const t=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array].filter(r=>n.constructor===r);return t.length&&t[0]||null}function ex(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function nge(n,e,t){const{scale:r,isVrm0:i,mergeAppliedMorphs:s}=t,o=[],a=[],l=Od(n,"SkinnedMesh"),c=GG(e),A=zG(e).map(h=>h.id);l.forEach(h=>{const d=h.clone();o.push(d),Array.isArray(h.material)?a.push(...h.material):a.push(h.material)});const u=HG(o,r),f=new Ft;return f.name="AvatarRoot",o.forEach(h=>{var P,D;const d=new Zt,m={};for(const T in h.geometry.attributes){const y=h.geometry.attributes[T];m[T]=y.clone()}const g={merge:new Set,keep:new Set(c),remove:new Set};if(s){if(!h.morphTargetDictionary||!h.morphTargetInfluences)return;A.forEach(T=>{const y=h.morphTargetDictionary[T];if(y!==void 0&&h.morphTargetInfluences[y]>0)g.merge.add(T);else return g.remove.add(T),null})}if((P=h.userData)!=null&&P.isVRM0)for(let T=0;T[T,T.morphTargetDictionary||{}])),morphTargetInfluences:new Map(l.map(T=>[T,T.morphTargetInfluences||[]])),index:null,animations:{}},{dest:v,destMorphToMerge:w}=I1({meshes:[h],scale:r,morphTargetsProcess:g},i);if(i)for(let T=0;Th.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new $(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],c=[],A=t.geometry.attributes.position.array,u=new $,f=e.userData.isVRM0?-1:1;for(let h=0;hE.id);for(const E in I){const R=I[E],L=R.meshArray;if(L.length>0){const{bakeObjects:N,material:z}=await Yme({transparentColor:r,atlasSize:R.size,meshes:L,mtoon:R.isMtoon,includeNonTexturedMeshesInAtlas:l,transparentMaterial:R.transparentMaterial,transparentTexture:b,twoSidedMaterial:d}),W=N.map(oe=>oe.mesh),H=[],C={merge:new Set,keep:new Set(Object.keys(M)),remove:new Set};W.forEach(oe=>{if(oe.type=="Mesh"&&(oe=ige(S,oe)),H.push(oe),u){if(!oe.morphTargetDictionary||!oe.morphTargetInfluences)return;P.forEach(ae=>{const le=oe.morphTargetDictionary[ae];if(le!==void 0&&oe.morphTargetInfluences[le]>0)C.merge.add(ae);else return C.remove.add(ae),null})}const ge=oe.geometry,me=ge.index.array,ve=QG(oe.geometry.index.array),be=[];for(let ae=0;ae{const ge=ce.morphTargetDictionary[oe];ge!==void 0&&(ce.userData.bindMorphs.new[oe]={index:ge,primitives:[ce.id]})}),B.userData.atlasMaterial.push(z)}}const D=(y=Object.values(e).find(E=>{var R;return(R=E==null?void 0:E.vrm)==null?void 0:R.expressionManager}))==null?void 0:y.vrm.expressionManager;return B.userData.expressionManagerToClone=D,B.add(S.bones[0]),B}function zG(n){var t;return((t=Object.values(n).filter(r=>r)[0])==null?void 0:t.traitInfo.manifestData.getAllBlendShapeTraits())||[]}function GG(n){const e=Object.values(n).map(i=>i==null?void 0:i.vrm).filter(i=>!!i).map(i=>{var s;return(s=i.expressionManager)==null?void 0:s.expressionMap}),t={};let r=[];for(const i of e)if(i)for(const s of Object.values(i)){if(r.includes(s.expressionName))continue;r.push(s.expressionName);const o=s._binds;!o||o.length==0||o.forEach(a=>{function l(A){const f=a.primitives.map(h=>h.morphTargetDictionary).filter(h=>!!h).find(h=>Object.values(h).includes(A));if(f)return Object.entries(f).find(([,h])=>h==A)}const c=l(a.index);c&&(t[c[0]]={index:c[1],primitives:a.primitives.map(A=>A.id)})})}return t}function RO({meshes:n,sourceMorphTargetDictionaries:e,destMorphTargetDictionary:t}){const r=[];return Object.entries(t).map(([i,s])=>{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function oge({sourceAttributes:n}){const e=new Set,t=Array.from(n.values());t.forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map(i=>{r[i]=Vz(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function UO(n){const{sourceMorphTargetDictionaries:e,morphTargetsProcess:t}=n,r=new Set;Array.from(e.values()).forEach(o=>{Object.keys(o).forEach(a=>{if(!t)r.add(a);else{if(t.remove.has(a)||t.merge.has(a))return;t.keep.has(a)&&r.add(a)}})});const s={};return Array.from(r.keys()).map((o,a)=>{s[o]=a}),s}function FO({meshes:n,sourceMorphTargetDictionaries:e,sourceMorphAttributes:t,destMorphTargetDictionary:r,scale:i},s=!1){const o=new Set;Array.from(t.values()).forEach(u=>{Object.keys(u).forEach(f=>o.add(f))});const l=Array.from(o),c={};l.forEach(u=>{c[u]=[],Object.entries(r).forEach(([f,h])=>{c[u][h]=[],n.forEach(d=>{let m;const g=e.get(d);if(g.hasOwnProperty(f)&&d.geometry.morphAttributes[u]){const p=g[f];m=d.geometry.morphAttributes[u][p]}else{const p=d.geometry.attributes[u],v=new p.array.constructor(new Array(p.array.length).fill(0));m=new lt(v,p.itemSize,p.normalized)}c[u][h].push(m)})})});const A={};return l.forEach(u=>{A[u]=[];for(let f=0;f{const i=r.geometry.index;for(var s=0;s{var h;if(i+=f.geometry.attributes.uv.count,(h=f.userData)!=null&&h.isVRM0)for(let d=0;d[f,f.geometry.attributes])),morphAttributes:new Map(n.map(f=>[f,f.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(f=>[f,f.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(f=>[f,f.morphTargetInfluences||[]]))},o={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};o.attributes=oge({sourceAttributes:s.attributes});const a=UO({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:(t==null?void 0:t.remove)||new Set,keep:(t==null?void 0:t.keep)||new Set,merge:(t==null?void 0:t.merge)||new Set}});o.morphTargetDictionary=a,o.morphAttributes=FO({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a,scale:e},r),o.morphTargetInfluences=RO({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a}),o.index=age({meshes:n});const l={morphAttributes:{},morphTargetDictionaries:{},morphTargetInfluences:null};let c=new Set((t==null?void 0:t.keep)||[]);t==null||t.merge.forEach(f=>{c.add(f)});const A=UO({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:new Set,keep:c,merge:new Set}});l.morphAttributes=FO({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:A,scale:e},r);const u=RO({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:A});return l.morphTargetInfluences=u,l.morphTargetDictionaries=A,o.animations={},{source:s,dest:o,destMorphToMerge:l}}function mt(n){return n==null?[]:Array.isArray(n)?n:[n]}function lge(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function cge(n,e){const r=await new Xu().load(e);r.colorSpace=kt,r.flipY=!1,n.traverse(i=>{if(i instanceof hn){const s=Array.isArray(i.material)?i.material:[i.material];for(let o=0;o{const e=[];for(const t in n){const r=n[t].vrm;if(r){const i=r.data.cullingLayer;i>=0&&r.data.cullingMeshes.map(s=>{s.userData.cullLayer=i,s.userData.cullDistance=r.data.cullingDistance,s.userData.maxCullDistance=r.data.maxCullingDistance,e.push(s)})}}Gme(e)};function Age(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var c;const l=mt(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((c=l.uniforms.alphaTest)==null?void 0:c.value)!=0&&(s=!0)):l.transparent==!0?(t.push(o),s=!0):(e.push(o),l.alphaTest!=0&&(s=!0))}),{stdMesh:e,stdTranspMesh:t,mToonMesh:r,mToonTranspMesh:i,requiresTransparency:s}}function uge(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{mt(a.material).forEach(c=>{c.type=="ShaderMaterial"?c.transparent==!0?o.push(c):c.uniforms.alphaTest.value!=0?s.push(c):i.push(c):c.transparent==!0?r.push(c):c.alphaTest!=0?t.push(c):e.push(c)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function PO(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function fge(n,e){if(n.data!=null)return n.data[e]}function hge(n){const e=fge(n,"cullingMeshes");e&&(e.forEach(t=>{NG(t)}),n.data.cullingMeshes=null)}function Dn(n){switch(n){case 1:return 128;case 2:return 256;case 3:return 512;case 4:return 1024;case 5:return 2048;case 6:return 4096;case 7:return 8192;case 8:return 16384;default:return 4096}}function dge(n){const e=n.scene;hge(n),e.traverse(t=>{t.material&&mT(t.material),t.geometry&&(NG(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),E0.deepDispose(e),n.expressionManager&&n.expressionManager.expressions.forEach(t=>{t._binds&&t._binds.forEach(r=>{r.primitives&&r.primitives.forEach(i=>{i.geometry.dispose(),i.material&&mT(i.material)})})});for(const t in n)n[t]=null}const mT=n=>{var e,t,r,i,s,o;if(n.length)for(let a=0;a{let e,t,r=0;return Array.isArray(n)?(e=n[0]||0,t=n[1]||0,r=n[2]||0):(typeof n=="string"||n instanceof String)&&n.split("-").forEach(s=>{switch(s=s.toLowerCase(),s){case"left":e=-1;break;case"right":e=1;break;case"bottom":case"down":t=-1;break;case"top":case"up":t=1;break;case"back":case"backward":r=-1;break;case"front":case"forward":r=1;break;default:console.warn("unkown cameraPosition name: "+s+" in: "+n+". Please use left, right, bottom, top, back or front");break}}),new $(e,t,r)},VG=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},pge=n=>{var t,r,i,s,o,a,l,c,A,u,f;const e=n.humanoid.humanBones;e.hips.node.parent.name="rootBone",e.upperChest==null&&e.neck.node.parent!=e.chest&&(e.neck.node.parent!=e.chest.node?e.upperChest={node:e.neck.node.parent}:e.upperChest!=null&&(e.upperChest={node:e.neck.node.parent},e.chest={node:e.neck.node.parent.parent})),e.leftShoulder==null&&(e.leftUpperArm.node.parent!=((t=e.chest)==null?void 0:t.node)&&e.leftUpperArm.node.parent!=((r=e.upperChest)==null?void 0:r.node)&&e.leftUpperArm.node.parent!=((i=e.spine)==null?void 0:i.node)&&e.leftUpperArm.node.parent!=((s=e.neck)==null?void 0:s.node)&&e.leftUpperArm.node.parent!=((o=e.head)==null?void 0:o.node),e.leftShoulder={node:e.leftUpperArm.node.parent}),e.rightShoulder==null&&(e.rightUpperArm.node.parent!=((a=e.chest)==null?void 0:a.node)&&e.rightUpperArm.node.parent!=((l=e.upperChest)==null?void 0:l.node)&&e.rightUpperArm.node.parent!=((c=e.spine)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((A=e.neck)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let h in Zg)h=h.charAt(0).toLowerCase()+h.slice(1),(f=e[h])!=null&&f.node&&(e[h].node.name=h)};function jG({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),jG({candidates:n,predicate:e}))}function WG(n,e){return jG({candidates:[n],predicate:t=>t.name===e})}function KG({candidates:n,predicate:e,results:t=[]}){if(!n.length)return t;const r=n.shift();return e(r)&&t.push(r),n=n.concat(r.children),KG({candidates:n,predicate:e,results:t})}function Od(n,e){return KG({candidates:[n],predicate:t=>mt(e).includes(t.type)})}function mge(n,e){if(!n.morphTargetDictionary)return!1;for(const t of Object.keys(n.morphTargetDictionary))if(e[t])return!0;return!1}const gge={mixamorigHips:"hips",mixamorigSpine:"spine",mixamorigSpine1:"chest",mixamorigSpine2:"upperChest",mixamorigNeck:"neck",mixamorigHead:"head",mixamorigLeftShoulder:"leftShoulder",mixamorigLeftArm:"leftUpperArm",mixamorigLeftForeArm:"leftLowerArm",mixamorigLeftHand:"leftHand",mixamorigLeftHandThumb1:"leftThumbMetacarpal",mixamorigLeftHandThumb2:"leftThumbProximal",mixamorigLeftHandThumb3:"leftThumbDistal",mixamorigLeftHandIndex1:"leftIndexProximal",mixamorigLeftHandIndex2:"leftIndexIntermediate",mixamorigLeftHandIndex3:"leftIndexDistal",mixamorigLeftHandMiddle1:"leftMiddleProximal",mixamorigLeftHandMiddle2:"leftMiddleIntermediate",mixamorigLeftHandMiddle3:"leftMiddleDistal",mixamorigLeftHandRing1:"leftRingProximal",mixamorigLeftHandRing2:"leftRingIntermediate",mixamorigLeftHandRing3:"leftRingDistal",mixamorigLeftHandPinky1:"leftLittleProximal",mixamorigLeftHandPinky2:"leftLittleIntermediate",mixamorigLeftHandPinky3:"leftLittleDistal",mixamorigRightShoulder:"rightShoulder",mixamorigRightArm:"rightUpperArm",mixamorigRightForeArm:"rightLowerArm",mixamorigRightHand:"rightHand",mixamorigRightHandPinky1:"rightLittleProximal",mixamorigRightHandPinky2:"rightLittleIntermediate",mixamorigRightHandPinky3:"rightLittleDistal",mixamorigRightHandRing1:"rightRingProximal",mixamorigRightHandRing2:"rightRingIntermediate",mixamorigRightHandRing3:"rightRingDistal",mixamorigRightHandMiddle1:"rightMiddleProximal",mixamorigRightHandMiddle2:"rightMiddleIntermediate",mixamorigRightHandMiddle3:"rightMiddleDistal",mixamorigRightHandIndex1:"rightIndexProximal",mixamorigRightHandIndex2:"rightIndexIntermediate",mixamorigRightHandIndex3:"rightIndexDistal",mixamorigRightHandThumb1:"rightThumbMetacarpal",mixamorigRightHandThumb2:"rightThumbProximal",mixamorigRightHandThumb3:"rightThumbDistal",mixamorigLeftUpLeg:"leftUpperLeg",mixamorigLeftLeg:"leftLowerLeg",mixamorigLeftFoot:"leftFoot",mixamorigLeftToeBase:"leftToes",mixamorigRightUpLeg:"rightUpperLeg",mixamorigRightLeg:"rightLowerLeg",mixamorigRightFoot:"rightFoot",mixamorigRightToeBase:"rightToes"};function XG(n,e,t){var m;const r=Du.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new tt,o=new tt,a=new tt,l=new $,c=e.getObjectByName("mixamorigHips").position.y,A=(m=t.humanoid)==null?void 0:m.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,h=Math.abs(A-u)/c;return r.tracks.forEach(g=>{const p=g.clone(),v=p.name.split("."),w=v[0],x=gge[w],b=e.getObjectByName(w);if(x!=null){const B=v[1];if(b.getWorldQuaternion(s).invert(),b.parent.getWorldQuaternion(o),p instanceof Ja){for(let S=0;S{p.values[P+S]=M})}i.push(new Ja(`${x}.${B}`,p.times,p.values.map((S,I)=>{var M;return((M=t.meta)==null?void 0:M.metaVersion)==="0"&&I%2===0?-S:S})))}else if(p instanceof ic){const S=p.values.map((I,M)=>{var P;return(((P=t.meta)==null?void 0:P.metaVersion)==="0"&&M%3!==1?-I:I)*h});i.push(new ic(`${x}.${B}`,p.times,S))}}}),new Du("vrmAnimation",r.duration,i)}const vge=new Hae,yge=new jz,YB=.2,wge=n=>Math.floor(Math.random()*n);class LO{constructor(e,t,r,i,s,o,a){var l,c,A,u;this.mixer=new yoe(t),this.actions=[],this.to=null,this.from=null,this.vrm=r,this.animationManager=e,this.mixamoModel=null,this.fadeOutActions=null,this.newAnimationWeight=1,this.neckBone=(c=(l=r==null?void 0:r.humanoid)==null?void 0:l.humanBones)==null?void 0:c.neck,this.spineBone=(u=(A=r==null?void 0:r.humanoid)==null?void 0:A.humanBones)==null?void 0:u.spine,this.timeScale=1,i&&(this.setAnimations(i,null,null,a),this.to=this.actions[s],o!=-1&&(this.from=this.actions[o],this.from.reset(),this.from.time=e.getFromActionTime(),this.from.play(),this.to.weight=e.getWeightIn(),this.from.weight=e.getWeightOut()),this.actions[s].reset(),this.actions[s].time=e.getToActionTime(),this.actions[s].play())}setTimeScale(e){this.timeScale=e,this.actions.forEach(t=>{t.timeScale=e})}setMouseLookEnabled(e){this.setAnimations(this.animations,this.mixamoModel,e)}setAnimations(e,t=null,r=null,i=!1){if(r=r??this.animationManager.mouseLookEnabled,this.animations=e,t!=null){if(this.vrm!=null){const s=XG(e,t,this.vrm);s&&(e=[s],this.mixamoModel=t)}}else{const s=[];e.forEach(o=>{s.push(o.clone())}),e=s}if(r&&e[0].tracks.map((s,o)=>{(s.name==="neck.quaternion"||s.name==="spine.quaternion")&&e[0].tracks.splice(o,1)}),i){this.actions.forEach(s=>{s.weight=0,s.stop()}),this.actions=[],this.newAnimationWeight=1;for(let s=0;s{r.weight=1-this.newAnimationWeight}),this.newAnimationWeight>=1&&(this.newAnimationWeight=1,this.fadeOutActions.forEach(r=>{r.weight=0,r.stop()}),this.fadeOutActions=null),this.actions.forEach(r=>{r.weight=this.newAnimationWeight})),this.from!=null&&(this.from.weight=t),this.to!=null&&(this.to.weight=e),this.mixer.update(1/30)}reset(){this.mixer.setTime(0),this.to.paused=!0}resume(){this.to.paused=!1}setTime(e){this.mixer.setTime(e)}getTime(){return this.mixer.time}dispose(){this.animationManager.disposeAnimation(this)}}class _ge{constructor(){this.animationPaths=[],this.defaultAnimations=[],this.lastAnimID=null,this.mainControl=null,this.animationControl=null,this.animations=null,this.paused=!1,this.scale=1,this.curLoadAnim=0,this.currentAnimationName="",this.weightIn=NaN,this.weightOut=NaN,this.lastAnimID=-1,this.curAnimID=0,this.animationControls=[],this.started=!1,this.mouseLookEnabled=!1,this.mixamoModel=null,this.mixamoAnimations=null,this.currentClip=null,setInterval(()=>{this.update()},1e3/30)}enableMouseLook(e){this.mouseLookEnabled=e,this.animationControls.forEach(t=>{t.setMouseLookEnabled(e)})}setScale(e){this.scale=e}async loadAnimation(e,t,r=0,i=!0,s="",o=""){const a=s+(s!=""?"/":"")+mt(e)[0];o=o==""?Kl(a):o,this.currentAnimationName=o;const c=await(i?vge:yge).loadAsync(a);c.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(c.animations);const A=Du.findByName(c.animations,"mixamo.com");A!=null?(this.mixamoModel=c.clone(),this.mixamoAnimations=c.animations,this.currentClip=A):(this.mixamoModel=null,this.animations=c.animations,this.currentClip=c.animations[0]),this.mainControl==null&&(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new LO(this,c,null,c.animations,this.curAnimID,this.lastAnimID,t),this.animationControls.push(this.mainControl)),this.animationControls.forEach(u=>{u.setAnimations(c.animations,this.mixamoModel,this.mouseLookEnabled,t)}),this.setTime(r),t?this.pause():this.play()}getCurrentClip(){return this.currentClip}getCurrentClipDuration(){return this.currentClip?this.currentClip.duration:0}getCurrentAnimationName(){return this.currentAnimationName}clearCurrentAnimations(){this.animationPaths=this.defaultAnimations,this.animationControls=[],this.mainControl=null}storeAnimationPaths(e,t,r=!0){const i=mt(e);r?this.animationPaths=[...this.defaultAnimations,...i.map(s=>`${t}/${s}`)]:this.animationPaths=i.map(s=>t!=""?`${t}/${s}`:s)}storeDefaultAnimationPaths(e,t){const r=mt(e);this.defaultAnimations=r.map(i=>t!=""?`${t}/${i}`:i),this.animationPaths=this.defaultAnimations}loadNextAnimation(){this.curLoadAnim==this.animationPaths.length-1?this.curLoadAnim=0:this.curLoadAnim++,this.loadAnimation(this.animationPaths[this.curLoadAnim])}loadPreviousAnimation(){this.curLoadAnim==0?this.curLoadAnim=this.animationPaths.length-1:this.curLoadAnim--,this.loadAnimation(this.animationPaths[this.curLoadAnim])}enableScreenshot(){this.animationControls.forEach(e=>{e.reset()})}disableScreenshot(){this.animationControls.forEach(e=>{e.resume()})}_scaleOffsetHips(e){e.forEach(t=>{for(let r=0;rr.vrm===e);t!==-1&&this.animationControls.splice(t,1)[0].dispose()}getFromActionTime(){return this.mainControl.actions[this.lastAnimID].time}getToActionTime(){return this.mainControl?this.mainControl.actions[this.curAnimID].time:.1}getWeightIn(){return this.weightIn}getWeightOut(){return this.weightOut}disposeAnimation(e){if(e!=null){const t=this.animationControls.indexOf(e);t!=-1&&this.animationControls.splice(t,1)}}dispose(){this.animationControls.forEach(e=>{e.dispose()})}animRandomizer(e){setTimeout(()=>{this.lastAnimID=this.curAnimID,this.curAnimID=wge(this.animations.length),this.curAnimID!=this.lastAnimID&&this.animationControls.forEach(t=>{t.from=t.actions[this.lastAnimID],t.to=t.actions[this.curAnimID],this.weightIn=0,this.weightOut=1,t.to.play(),t.to.reset()}),this.animRandomizer(this.animations[this.curAnimID].duration-YB)},e*1e3)}pause(){this.paused=!0}play(){this.paused=!1}isPaused(){return this.paused}setTime(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTime(e)})}setFrame(e){this.setTime(e*30)}setSpeed(e){this.mainControl&&this.animationControls.forEach(t=>{t.setTimeScale(e)})}update(e=!1){(this.mainControl&&!this.paused||e)&&(this.animationControls.forEach(t=>{t.update(this.weightIn,this.weightOut)}),this.weightIn<1?this.weightIn+=1/(30*YB):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*YB):this.weightOut=0)}}const xge={name:"CopyShader",uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; @@ -4936,7 +4936,7 @@ void main() { gl_FragColor = opacity * texel; - }`};class qd{constructor(){this.isPass=!0,this.enabled=!0,this.needsSwap=!0,this.clear=!1,this.renderToScreen=!1}setSize(){}render(){console.error("THREE.Pass: .render() must be implemented in derived pass.")}dispose(){}}const gge=new p0(-1,1,1,-1,0,1);class vge extends Zt{constructor(){super(),this.setAttribute("position",new xn([-1,3,0,-1,-1,0,3,-1,0],3)),this.setAttribute("uv",new xn([0,2,0,0,2,0],2))}}const yge=new vge;class A2{constructor(e){this._mesh=new hn(yge,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,gge)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class wge extends qd{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof dr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=FR.clone(e.uniforms),this.material=new dr({name:e.name!==void 0?e.name:"unspecified",defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new A2(this.material)}render(e,t,r){this.uniforms[this.textureID]&&(this.uniforms[this.textureID].value=r.texture),this.fsQuad.material=this.material,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil),this.fsQuad.render(e))}dispose(){this.material.dispose(),this.fsQuad.dispose()}}class PO extends qd{constructor(e,t){super(),this.scene=e,this.camera=t,this.clear=!0,this.needsSwap=!1,this.inverse=!1}render(e,t,r){const i=e.getContext(),s=e.state;s.buffers.color.setMask(!1),s.buffers.depth.setMask(!1),s.buffers.color.setLocked(!0),s.buffers.depth.setLocked(!0);let o,a;this.inverse?(o=0,a=1):(o=1,a=0),s.buffers.stencil.setTest(!0),s.buffers.stencil.setOp(i.REPLACE,i.REPLACE,i.REPLACE),s.buffers.stencil.setFunc(i.ALWAYS,o,4294967295),s.buffers.stencil.setClear(a),s.buffers.stencil.setLocked(!0),e.setRenderTarget(r),this.clear&&e.clear(),e.render(this.scene,this.camera),e.setRenderTarget(t),this.clear&&e.clear(),e.render(this.scene,this.camera),s.buffers.color.setLocked(!1),s.buffers.depth.setLocked(!1),s.buffers.color.setMask(!0),s.buffers.depth.setMask(!0),s.buffers.stencil.setLocked(!1),s.buffers.stencil.setFunc(i.EQUAL,1,4294967295),s.buffers.stencil.setOp(i.KEEP,i.KEEP,i.KEEP),s.buffers.stencil.setLocked(!0)}}class _ge extends qd{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class xge{constructor(e,t){if(this.renderer=e,this._pixelRatio=e.getPixelRatio(),t===void 0){const r=e.getSize(new je);this._width=r.width,this._height=r.height,t=new Za(this._width*this._pixelRatio,this._height*this._pixelRatio,{type:jd}),t.texture.name="EffectComposer.rt1"}else this._width=t.width,this._height=t.height;this.renderTarget1=t,this.renderTarget2=t.clone(),this.renderTarget2.texture.name="EffectComposer.rt2",this.writeBuffer=this.renderTarget1,this.readBuffer=this.renderTarget2,this.renderToScreen=!0,this.passes=[],this.copyPass=new wge(mge),this.copyPass.material.blending=zl,this.clock=new kz}swapBuffers(){const e=this.readBuffer;this.readBuffer=this.writeBuffer,this.writeBuffer=e}addPass(e){this.passes.push(e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}insertPass(e,t){this.passes.splice(t,0,e),e.setSize(this._width*this._pixelRatio,this._height*this._pixelRatio)}removePass(e){const t=this.passes.indexOf(e);t!==-1&&this.passes.splice(t,1)}isLastEnabledPass(e){for(let t=e+1;t 0.0 ? (1.0 - depthEdgeCoefficient * dei) : (1.0 + normalEdgeCoefficient * nei); gl_FragColor = texel * coefficient; } - `})}}function Uy(n,e,t){const r=new Za(n.x,n.y,t?{depthTexture:new LR(n.x,n.y),depthBuffer:!0}:void 0);return r.texture.format=e,r.texture.minFilter=jr,r.texture.magFilter=jr,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,r}class Bge extends qd{constructor(e){super(),this.resolution=e,this.fsQuad=new A2(this.material())}setResolution(e){this.resolution=e}render(e,t,r){const i=this.fsQuad.material.uniforms;i.tDiffuse.value=r.texture,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.fsQuad.render(e)}material(){return new dr({uniforms:{tDiffuse:{value:null},resolution:{value:new Ut(this.resolution.x,this.resolution.y,1/this.resolution.x,1/this.resolution.y)}},vertexShader:` + `})}}function Ly(n,e,t){const r=new qa(n.x,n.y,t?{depthTexture:new OR(n.x,n.y),depthBuffer:!0}:void 0);return r.texture.format=e,r.texture.minFilter=Kr,r.texture.magFilter=Kr,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,r}class Rge extends Jd{constructor(e){super(),this.resolution=e,this.fsQuad=new f2(this.material())}setResolution(e){this.resolution=e}render(e,t,r){const i=this.fsQuad.material.uniforms;i.tDiffuse.value=r.texture,this.renderToScreen?e.setRenderTarget(null):(e.setRenderTarget(t),this.clear&&e.clear()),this.fsQuad.render(e)}material(){return new pr({uniforms:{tDiffuse:{value:null},resolution:{value:new Ut(this.resolution.x,this.resolution.y,1/this.resolution.x,1/this.resolution.y)}},vertexShader:` varying vec2 vUv; void main() { vUv = uv; @@ -5023,7 +5023,11 @@ void main() { texel.rgb = pow(texel.rgb, vec3(1.0 / 2.2)); gl_FragColor = texel; } - `})}}const tm=new $;class Sge{constructor(e){jt(this,"camera",null);jt(this,"frameOffset",{min:.2,max:.2});jt(this,"boneOffsets");jt(this,"cameraDir",new $);jt(this,"frameTarget",null);this.camera=e||new Ur,this.boneOffsets={head:null,neck:null,chest:null,hips:null,spine:null,leftUpperLeg:null,leftLowerLeg:null,leftFoot:null,rightUpperLeg:null,rightLowerLeg:null,rightFoot:null}}setupCamera(e,t,r=30){this.camera.position.copy(e),this.camera.lookAt(t),this.camera.fov=r}async calculateBoneOffsets(e,t){for(const r in this.boneOffsets){const i=await this._getMinMaxOffsetByBone(e,r,t);console.log("result",i),this.boneOffsets[r]=i}}setFrameTarget(e){this.frameTarget=e}frameCloseupShot(){this.frameShot("head","head")}frameMediumShot(){this.frameShot("chest","head")}frameCowboyShot(){this.frameShot("hips","head")}frameFullShot(){this.frameShot("leftFoot","head")}frameShot(e,t,r=null,i=!1,s=!0){if(!this.frameTarget){console.error("No target object provided, Call setFrameTarget() first;");return}const o=this._getBoneWorldPositionWithOffset(this.frameTarget,e,i),a=this._getBoneWorldPositionWithOffset(this.frameTarget,t,s);o.y-=this.frameOffset.max,a.y+=this.frameOffset.min,r=r||new $(0,0,0),this.positionCameraBetweenPoints(o,a,r)}setBottomFrameOffset(e){this.frameOffset.min=e}setTopFrameOffset(e){this.frameOffset.max=e}_getBoneWorldPositionWithOffset(e,t,r){const i=this._getFirstBoneWithName(t,e);if(!i||!this.boneOffsets[t])return console.error(`Bone with name '${t}' not found in the model.`),new $;const s=new $;i.getWorldPosition(s);const o=r?this.boneOffsets[t].max:this.boneOffsets[t].min;return s.y+=o.y,s}_getFirstBoneWithName(e,t=void 0){let r=null;const i=t||this.frameTarget;if(!i){console.error("_getFirstBoneWithName: No target object provided, Call setFrameTarget() first or provide a targetObject parameter;");return}return i.traverse(s=>{if(s instanceof Va){if(!s.geometry){console.error("Invalid skinned mesh found in children.");return}const o=s.skeleton.bones.findIndex(a=>a.name===e);if(o!==-1){r=s.skeleton.bones[o];return}}}),r}async _getMinMaxOffsetByBone(e,t,r){return new Promise(async(i,s)=>{(!e||!e.traverse)&&(console.error("Invalid parent object provided."),s(null));const o=new $(1/0,1/0,1/0),a=new $(-1/0,-1/0,-1/0),l=[];e.traverse(async u=>{u instanceof Va&&(l.push(this._saveBonesPos(u.skeleton)),u.skeleton.pose())});let c=0;await(u=>new Promise(f=>setTimeout(f,u)))(10),e.traverse(u=>{if(u instanceof Va){if(!u.geometry){console.error("Invalid skinned mesh found in children.");return}const f=u.skeleton.bones.findIndex(g=>g.name===t);if(f===-1){console.error(`Bone with name '${t}' not found in one of the skinned meshes.`);return}const h=u.geometry.getAttribute("position"),d=u.geometry.getAttribute("skinWeight"),m=u.geometry.getAttribute("skinIndex");for(let g=0;g=r){const _=u.skeleton.bones[f],x=new $().setFromMatrixPosition(_.matrixWorld),b=p.clone().sub(x);o.min(b),a.max(b)}}this._restoreSavedPose(l[c],u.skeleton),c++}}),i({min:o,max:a})})}_saveBonesPos(e){let t=[];return e.bones.forEach(r=>{t.push({position:r.position.clone(),rotation:r.rotation.clone(),scale:r.scale.clone()})}),t}_restoreSavedPose(e,t){e&&t.bones.forEach((r,i)=>{r.position.copy(e[i].position),r.rotation.copy(e[i].rotation),r.scale.copy(e[i].scale)})}positionCameraBetweenPoints(e,t,r,i=30){const s=new Qn;s.expandByPoint(e),s.expandByPoint(t),this.camera.fov=i;const o=this.camera.fov*(Math.PI/180),l=s.getSize(new $).length()/(2*Math.tan(o/2));s.getCenter(tm),this.camera.position.copy(tm),r.y*=.5,this.camera.lookAt(tm.clone().sub(r));const c=new $;this.camera.getWorldDirection(c),this.camera.position.addScaledVector(c,-l),this.camera.updateProjectionMatrix()}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,tm.set(0,0,-1),this.cameraDir=tm.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),this.camera.position.x-=this.cameraDir.x*t,this.camera.position.z-=this.cameraDir.z*t}setCameraFrameWithName(e,t){switch(e.toLowerCase()){case"fullshot":this.frameShot("leftFoot","head",t);break;case"cowboyshot":this.frameShot("hips","head",t);break;case"mediumshot":this.frameShot("chest","head",t);break;case"mediumcloseup":case"mediumcloseupshot":this.frameShot("chest","head",t,!0);break;case"closeup":case"closeupshot":this.frameShot("head","head",t);break;default:console.warn("unkown cameraFrame: "+e+". Please use fullShot, cowboyShot, mediumShot, mediumCloseup or closeup"),this.frameShot("leftFoot","head",t);break}}copyCamera(e){this.camera.position.copy(e.position),this.camera.quaternion.copy(e.quaternion),"fov"in e&&(this.camera.fov=e.fov)}}const J_=4096;class Mge{constructor(e,t,r){const i=new m0({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new je(J_,J_);i.setClearColor(0,0),i.outputColorSpace=Xr,i.setSize(s.x,s.y),i.setPixelRatio(window.devicePixelRatio);let o=s.clone().divideScalar(r);o.x|=0,o.y|=0;const a=new xge(i);a.addPass(new bge(e,t)),this._renderPixelPass=new Ege(o,e,t),this._pixelPass=new Bge(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new je(e,t).clone().divideScalar(this.pixelSize);i.x|=0,i.y|=0,this.renderer.setSize(e,t),this._renderPixelPass.setResolution(i),this._pixelPass.setResolution(i)}setPixelSize(e){this.pixelSize=e}render(){this.composer.render()}}class Cge{constructor(e,t){jt(this,"cameraFrameManager");this.renderer=new m0({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputColorSpace=kt,this.renderer.setSize(J_,J_);const r=new Ur(30,1,.1,1e3);this.textureLoader=new ju,this.sceneBackground=new He(.1,.1,.1),this.sceneBackgroundAlpha=1,this.usesBackgroundImage=!1,this.backgroundMaterial=new Zi({color:16777215,transparent:!0,opacity:.5});const i=new ac(1e3,1e3),s=new hn(i,this.backgroundMaterial);s.renderOrder=-1,this.backgroundPlane=s,this.pixelRenderer=new Mge(t,r,20),this.cameraFrameManager=new Sge(r),this.cameraFrameManager.setFrameTarget(this.characterManager.characterModel)}setScene(e){this.scene=e}get camera(){return this.cameraFrameManager.camera}setupCamera(e,t,r=30){this.cameraFrameManager.setupCamera(e,t,r)}_getCharacterMinMax(){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY;return this.characterManager.characterModel.traverse(r=>{r.geometry&&(r.geometry.computeBoundingBox(),r.geometry.boundingBox&&(r.geometry.boundingBox.applyMatrix4(r.matrixWorld),r.geometry.boundingBox.min.yt&&(t=r.geometry.boundingBox.max.y)))}),{minY:e,maxY:t}}_getBoneWorldPosition(e,t=void 0){const r=this.cameraFrameManager._getFirstBoneWithName(e,t);return r!=null?new $().setFromMatrixPosition(r.matrixWorld):(console.warn(`Bone with name '${e}' not found in one of the skinned meshes.`),new $(0,0,0))}setBackground(e){if(Array.isArray(e)){const t=e[3]==null?1:e[3];this.setBackgroundColor(e[0],e[1],e[2],t)}else this.setBackgroundImage(e)}setBackgroundColor(e,t,r,i){const s=new He(e,t,r,i);this.sceneBackground=s,i==null&&(i=1),i>1&&(i=1),i<0&&(i=0),this.sceneBackgroundAlpha=i,this.backgroundMaterial.color=s,this.usesBackgroundImage=!1}setBackgroundImage(e){return new Promise(async(t,r)=>{try{const i=await this.texureLoader.load(e);i&&(i.wrapS=i.wrapT=Hs,this.sceneBackground=i,this.usesBackgroundImage=!0,this.sceneBackgroundAlpha=1,t())}catch(i){console.error("Error loading background image: ",i),r(i)}})}_setBackground(){if(this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1)if(this.sceneBackgroundAlpha==0)this.scene.background=null;else{this.scene.background=null,this.scene.add(this.backgroundPlane),this.backgroundPlane.position.copy(this.camera.position);var e=new $(0,0,-1);e.applyQuaternion(this.camera.quaternion);var t=100;this.backgroundPlane.position.addScaledVector(e,t),this.backgroundPlane.lookAt(this.camera.position)}else this.scene.background=this.sceneBackground}_restoreBackground(){this.scene.background=null,this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1&&this.scene.remove(this.backgroundPlane)}getImageData(e,t,r=null){return this._createImage(e,t,r).split("base64,")[1]}_createImage(e,t,r=null){const i=e/t;typeof r=="number"&&this.pixelRenderer.setPixelSize(r),this.renderer.setSize(e,t),this.pixelRenderer.setSize(e,t);const s="image/png";this.camera.aspect=i,this.camera.updateProjectionMatrix();const o=typeof r=="number"?this.pixelRenderer:this.renderer;try{this._setBackground(),o.render(this.scene,this.camera);let a=o.domElement.toDataURL(s);return this._restoreBackground(),a}catch(a){return console.error(a),null}}savePixelScreenshot(e,t,r,i){this.pixelRenderer.setPixelSize(i),this.pixelRenderer.setSize(t,r);const s=this._createImage(t,r,!0),o="image/octet-stream",a="image/png";this.saveFile(s.replace(a,o),e+".png")}saveScreenshot(e,t,r){const i=this._createImage(t,r),s="image/octet-stream",o="image/png";this.saveFile(i.replace(o,s),e+".png")}getScreenshotImage(e,t){const r=this._createImage(e,t),i=new Image;return i.src=r,i}getScreenshotTexture(e,t){const r=this.getScreenshotImage(e,t),i=new Hn(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=r8.Buffer.from(r.replace(/^data:image\/\w+;base64,/,""),"base64");return new Blob([i],{type:"image/jpeg"})}saveFile(e,t){const r=document.createElement("a");typeof r.download=="string"?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):window.open(e,"_blank").document.write(""+t+"")}}const Tge=2;class Ige{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new kz,this.closeTime=e,this.openTime=t,this.continuity=r,this.randomness=i,this._eyeOpen=1,this._blinkCounter=0,this.isTakingScreenShot=!1,this.update()}addVRM(e){this.vrmBlinkers.push(e)}removeVRM(e){const t=this.vrmBlinkers.indexOf(e);t!==-1&&this.vrmBlinkers.splice(t,1)}enableScreenshot(){this.isTakingScreenShot=!0,this._eyeOpen=Tge,this._updateBlinkers()}disableScreenshot(){this.isTakingScreenShot=!1}update(){setInterval(()=>{if(this.isTakingScreenShot)return;const e=this.clock.getDelta();switch(this.mode){case"closing":this._eyeOpen>0?this._eyeOpen-=e/this.closeTime:(this._eyeOpen=0,this.mode="open"),this._updateBlinkers();break;case"open":this._eyeOpen<1?this._eyeOpen+=e/this.openTime:(this._eyeOpen=1,this.mode="ready"),this._updateBlinkers();break;case"ready":this._blinkCounter+=e,this._blinkCounter>=this.continuity&&(Math.floor(Math.random()*this.randomness)===0&&(this.mode="closing"),this._blinkCounter=0);break}},1e3/30)}_updateBlinkers(){this.vrmBlinkers.forEach(e=>{e.expressionManager.setValue(ti.Blink,1-this._eyeOpen),e.expressionManager.update()})}}function KG(){return(KG=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;f%8&&(f+=8-f%8);let h=[],d=new DataView(new ArrayBuffer(24*n.levels.length)),m=(f||u+s.byteLength)+t.byteLength;for(let v=0;v0?f:0),!0),p.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(rm([new Uint8Array(Jr).buffer,g,d.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...h]))}var pT,mT,Nge={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},gT=new OffscreenCanvas(128,128),OO=gT.getContext("2d",{willReadFrequently:!0}),XG=typeof document>"u";function Oge(n){return createImageBitmap(n).then(function(e){return gT.width=e.width,gT.height=e.height,OO.drawImage(e,0,0),OO.getImageData(0,0,e.width,e.height)})}function kge(n,e){return e===void 0&&(e={}),Qge().then(function(t){var r=new t.BasisEncoder;return Hge(e,r),r.setTexType(pT.cBASISTexType2D),Uge(n,ArrayBuffer)&&(n=new Blob([n])),Oge(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,mT.RAW);var s=new Uint8Array(10485760),o=r.encode(s);if(o===0)throw"encode failed";var a=new Uint8Array(s.buffer,0,o),l=Pge(s);if(e.kvData){for(var c in e.kvData)l.keyValue[c]=e.kvData[c];a=Dge(l,{keepWriter:!0})}return a})})}function Hge(n,e){n===void 0&&(n={}),(n=Rge({},Nge,n)).enableDebug!==void 0&&e.setDebug(n.enableDebug),n.isUASTC!==void 0&&e.setUASTC(n.isUASTC),n.isKTX2File!==void 0&&e.setCreateKTX2File(n.isKTX2File),n.isSetKTX2SRGBTransferFunc!==void 0&&e.setKTX2SRGBTransferFunc(n.isSetKTX2SRGBTransferFunc),n.generateMipmap!==void 0&&e.setMipGen(n.generateMipmap),n.isYFlip!==void 0&&e.setYFlip(n.isYFlip),n.qualityLevel!==void 0&&e.setQualityLevel(n.qualityLevel),n.compressionLevel!==void 0&&e.setCompressionLevel(n.compressionLevel),n.needSupercompression!==void 0&&e.setKTX2UASTCSupercompression(n.needSupercompression),n.isNormalMap!==void 0&&e.setNormalMap(n.isNormalMap)}var KB=null;function Qge(){return KB||(KB=new Promise(function(n,e){XG?(importScripts("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js"),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()}).then(function(t){BASIS({wasmBinary:t}).then(function(r){r.initializeBasis(),n(r)}).catch(e)}).catch(e)):Promise.all([fetch("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js").then(function(t){return t.text()}),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()})]).then(function(t){var r=t[0],i=t[1],s=document.createElement("script");s.onload=function(){BASIS({wasmBinary:i}).then(function(o){o.initializeBasis(),n(o)}).catch(e)},s.src=URL.createObjectURL(new Blob([r])),s.onerror=e,document.body.appendChild(s)}).catch(e)})),KB}XG&&self.addEventListener("message",function(n){kge(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class zge{constructor(e,t){if(this.gl=e,this.libktx=null,e!==void 0)if(t===void 0&&LIBKTX!==void 0&&(t=LIBKTX),t!==void 0)this.initializied=this.init(e,t);else{console.error("Failed to initalize KTXDecoder: ktx library undefined");return}else{console.error("Failed to initalize KTXDecoder: WebGL context undefined");return}}async init(e,t){this.libktx=await t({preinitializedWebGLContext:e}),this.libktx.GL.makeContextCurrent(this.libktx.GL.createContext(e.canvas,{majorVersion:2}))}stringToUastcFlags(e){return e==="FASTER"?this.libktx.UastcFlags.LEVEL_FASTER.value:e==="FASTEST"?this.libktx.UastcFlags.LEVEL_FASTEST.value:e==="SLOWER"?this.libktx.UastcFlags.LEVEL_SLOWER.value:e==="SLOWEST"?this.libktx.UastcFlags.LEVEL_VERYSLOW.value:this.libktx.UastcFlags.LEVEL_DEFAULT.value}stringToSupercmpScheme(e){return e==="Zstd"?this.libktx.SupercmpScheme.ZSTD:e==="Zlib"?this.libktx.SupercmpScheme.ZLIB:e==="BasisLZ"?this.libktx.SupercmpScheme.BASIS_LZ:this.libktx.SupercmpScheme.NONE}transcodeRGBA(e){if(!e.needsTranscoding)return;const t=this.libktx.TranscodeTarget.RGBA8888;e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}transcode(e){if(e.gpuFormat="RGBA8888",e.needsTranscoding){let t,r=!1,i=!1,s=!1,o=!1,a=!1;r=!!this.gl.getExtension("WEBGL_compressed_texture_astc"),i=!!this.gl.getExtension("WEBGL_compressed_texture_etc1"),s=!!this.gl.getExtension("WEBGL_compressed_texture_s3tc"),o=!!this.gl.getExtension("EXT_texture_compression_bptc"),a=!!this.gl.getExtension("WEBGL_compressed_texture_pvrtc")||!!this.gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),r?(t=this.libktx.TranscodeTarget.ASTC_4x4_RGBA,e.gpuFormat="ASTC_4x4_RGBA"):o?(t=this.libktx.TranscodeTarget.BC7_RGBA,e.gpuFormat="BC7_RGBA"):s?(t=this.libktx.TranscodeTarget.BC1_OR_3,e.gpuFormat="BC1_OR_3"):a?(t=this.libktx.TranscodeTarget.PVRTC1_4_RGBA,e.gpuFormat="PVRTC1_4_RGBA"):i?(t=this.libktx.TranscodeTarget.ETC,e.gpuFormat="ETC"):(t=this.libktx.TranscodeTarget.RGBA8888,e.gpuFormat="RGBA8888"),e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}}async loadKtxFromUri(e){await this.initializied;const t=await fetch(e),r=new Uint8Array(await t.arrayBuffer()),i=new this.libktx.ktxTexture(r);this.transcode(i);let s=i.glUpload();if(s.texture==null){console.error("Could not load KTX data");return}return s.texture.levels=Math.log2(i.baseWidth),s.texture.width=i.baseWidth,s.texture.height=i.baseHeight,s.texture.gpuSize=i.dataSize,s.texture.gpuFormat=i.gpuFormat,s.texture.isSRGB=i.isSRGB,s.texture}async loadKtxFromBuffer(e){await this.initializied;const t=new this.libktx.ktxTexture(e);this.transcode(t);const r=t.glUpload();if(r.texture==null){console.error("Could not load KTX data");return}return r.texture.levels=Math.log2(t.baseWidth),r.texture.width=t.baseWidth,r.texture.height=t.baseHeight,r.texture.gpuSize=t.dataSize,r.texture.gpuFormat=t.gpuFormat,r.texture.isSRGB=t.isSRGB,r.texture}async compress(e,t,r,i,s={}){const o=new this.libktx.ktxTexture(e,t,r,i,s.srgb);if(!s.hasOwnProperty("basisu_options")){const c=new this.libktx.ktxBasisParams;c.uastc=!1,c.noSSE=!0,c.verbose=!1,c.qualityLevel=100,c.compressionLevel=2,s.basisu_options=c}s.hasOwnProperty("compression_level")||(s.compression_level=18),s.hasOwnProperty("supercmp_scheme")||(s.supercmp_scheme=this.libktx.SupercmpScheme.NONE),console.log(s);const a=o.compressBasisU(s.basisu_options,s.supercmp_scheme,s.compression_level);return Uint8ClampedArray.from(a)}}class Gge{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new zge(t,window.LIBKTX);await r.init(t,window.LIBKTX),this.ktxEncoder=r,this.libktx=r.libktx}async compress(e,t,r,i,s={}){const o=await new this.libktx.ktxBasisParams,a=s;return o.uastc=a.uastc!==void 0?a.uastc:!1,o.noSSE=a.noSSE!==void 0?a.noSSE:!1,o.verbose=a.verbose!==void 0?a.verbose:!1,o.normalMap=a.normalMap!==void 0?a.normalMap:!1,o.compressionLevel=a.compressionLevel!==void 0?a.compressionLevel:1,o.qualityLevel=a.qualityLevel!==void 0?a.qualityLevel:60,o.maxEndpoints=a.ETC1SmaxEndpoints!==void 0?a.ETC1SmaxEndpoints:0,o.endpointRDOThreshold=a.ETC1SEndpointRdoThreshold!==void 0?a.ETC1SEndpointRdoThreshold:1.25,o.maxSelectors=a.ETC1SMaxSelectors!==void 0?a.ETC1SMaxSelectors:0,o.selectorRDOThreshold=a.ETC1SSelectorRdoThreshold!==void 0?a.ETC1SSelectorRdoThreshold:1.25,o.noEndpointRDO=a.ETC1SNoEndpointRdo!==void 0?a.ETC1SNoEndpointRdo:!1,o.noSelectorRDO=a.ETC1SNoSelectorRdo!==void 0?a.ETC1SNoSelectorRdo:!1,o.uastcFlags=this.ktxEncoder.stringToUastcFlags(a.uastcFlags),o.uastcRDO=o.uastcRDO!==void 0?o.uastcRDO:!1,o.uastcRDOQualityScalar=a.uastcRDOQualityScalar!==void 0?a.uastcRDOQualityScalar:1,o.uastcRDODictSize=a.uastcRDODictSize!==void 0?a.uastcRDOQualityScalar:4096,o.uastcRDOMaxSmoothBlockErrorScale=a.uastcRDOMaxSmoothBlockErrorScale!==void 0?a.uastcRDOMaxSmoothBlockErrorScale:10,o.uastcRDOMaxSmoothBlockStdDev=a.uastcRDOMaxSmoothBlockStdDev!==void 0?a.uastcRDOMaxSmoothBlockStdDev:18,o.uastcRDODontFavorSimplerModes=a.uastcRDODontFavorSimplerModes!==void 0?a.uastcRDODontFavorSimplerModes:!1,s.basisu_options=o,s.hasOwnProperty("supercmp_scheme")?s.supercmp_scheme=this.ktxEncoder.stringToSupercmpScheme(s.supercmp_scheme):s.supercmp_scheme=this.libktx.SupercmpScheme.NONE,await this.ktxEncoder.compress(e,t,r,i,s)}}var qn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(qn||(qn={}));const vT="blend_",kO="vrmColliderSphere";function Vge(n){var e;return{title:n.name,version:"v0",author:((e=n.authors)==null?void 0:e.length)>0?n.authors.join(", "):"",reference:n.references!=null?n.references.join(", "):"",contactInformation:n.contactInformation!=null?n.contactInformation:"",otherPermissionUrl:n.otherPermissionUrl,allowedUserName:n.avatarPermission!=null?n.avatarPermission:"",violentUssageName:n.allowExcessivelyViolentUsage?"Allow":"Disallow",sexualUssageName:n.allowExcessivelySexualUsage?"Allow":"Disallow",commercialUssageName:n.commercialUsage=="personalProfit"||n.commercialUsage=="corporation"?"Allow":"Disallow",licenseName:n.copyrightInformation,otherLicenseUrl:n.otherLicenseUrl,metaVersion:"0"}}function jge(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function Wge(n){switch(n){case"happy":return"joy";case"sad":return"sorrow";case"relaxed":return"fun";case"aa":return"a";case"ih":return"i";case"ou":return"u";case"ee":return"e";case"oh":return"o";default:return n}}function Kge(n){if(n.includes("Thumb")){if(n.includes("Metacarpal"))return n.replace("Metacarpal","Proximal");if(n.includes("Proximal"))return n.replace("Proximal","Intermediate")}return n}class Xge{async parse(e,t,r,i,s,o,a){var G;const l=Vge(e.meta),c=jge(e.humanoid),A=e.materials,u=[],f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(c)if(l){if(!A)throw new Error("materials is undefined or null")}else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=A.filter((j,se,fe)=>fe.findIndex(he=>he.name===j.name.replace(" (Outline)",""))===se).map(j=>j),d=h.map(j=>j.name),m=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(j=>j.map).map(j=>{if(!j.map)throw new Error(j.name+" map is null");return{name:j.name,imageBitmap:j.map.image}}),p=h.filter(j=>j.userData.shadeTexture).map(j=>{if(!j.userData.shadeTexture)throw new Error(j.userData.shadeTexture+" map is null");return{name:j.name+"_shade",imageBitmap:j.userData.shadeTexture.image}}),v=h.filter(j=>j.roughnessMap).map(j=>j.roughnessMap?{name:j.name+"_orm",imageBitmap:j.roughnessMap.image}:null),w=h.filter(j=>j.roughnessMap).map(j=>j.normalMap?{name:j.name+"_normal",imageBitmap:j.normalMap.image}:null),_=[...g,...p,...v,...w].filter(j=>j!==null),x=e0e(_,m,s?"image/ktx2":"image/png"),b=t0e(x),B=n0e(x,s),M=Jge(h,_),I=t.children.filter(j=>j.children.length>0&&j.children[0].type===Pi.Bone)[0],S=YG(I).filter(j=>j.name!==kO),L=S.map(j=>j.name),O=S.map(j=>{const se=j.children.filter(fe=>fe.name!==kO).map(fe=>L.indexOf(fe.name));return{name:j.name,rotation:[j.quaternion.x,j.quaternion.y,j.quaternion.z,j.quaternion.w],scale:[j.scale.x,j.scale.y,j.scale.z],translation:[j.position.x,j.position.y,j.position.z],children:se.length>0?se:void 0}}),T=[],y=t.children.filter(j=>j.type===Pi.Group||j.type===Pi.SkinnedMesh),E=[];y.forEach((j,se)=>{const fe=j.type===Pi.Group?j.children[0]:j,he=fe.geometry.attributes,Be=new Cc(he.position,qn.FLOAT,cn.POSITION,xa.VEC3,fe.name,void 0);E.push(Be);const V=E.length-1,R=he.normal.array,D=new Float32Array(R.length);for(let de=0;dede):[j]).forEach(de=>{if(!de.geometry.index)throw new Error(de.name+" geometry.index is null");E.push(new Cc(de.geometry.index,qn.UNSIGNED_INT,cn.INDEX,xa.SCALAR,fe.name,de.name))}),fe.morphTargetDictionary||(fe.morphTargetDictionary={},fe.morphTargetInfluences=[],fe.geometry.morphAttributes={},fe.updateMorphTargets()),fe.geometry.userData.targetNames=[];const pe=(de,Ie,Le,Ue)=>{const Ye=[],Ae=[];for(let Fe=0;Fe0){const Fe=[...Ye].sort((Re,Oe)=>Re-Oe),Me=[];for(let Re=0;Re({mesh:0,index:he.index,weight:he.weight*100}));if(fe.length>0){let he=!1;for(const Be in ti)if(j===ti[Be]&&j!=="surprised"){u.push({name:j,presetName:Wge(j),binds:fe,isBinary:se.isBinary}),he=!0;break}he===!1&&u.push({name:j,presetName:"unknown",binds:fe,isBinary:se.isBinary})}}y.forEach(j=>{const se=j.type===Pi.Group?j.children[0]:j,fe=new Float32Array(se.skeleton.boneInverses.map(he=>he.elements).flat());E.push(new Cc(new lt(fe,16),qn.FLOAT,cn.BIND_MATRIX,xa.MAT4,se.name,se.name))}),T.push(...E.map(j=>({componentType:j.valueType,count:j.attribute.count,max:j.max,min:j.min,normalized:!1,type:j.accessorsType})));const U=Zge(y,E,d);y.forEach((j,se)=>{O.push({mesh:se,name:j.name,rotation:[j.quaternion.x,j.quaternion.y,j.quaternion.z,j.quaternion.w],scale:[j.scale.x,j.scale.y,j.scale.z],skin:se,translation:[j.position.x,j.position.y,j.position.z]})});const P=qge(y,E,L),N={humanBones:[]};c.humanBones.forEach(j=>{L.indexOf(j.node.name)!=-1&&N.humanBones.push({bone:Kge(j.bone),node:L.indexOf(j.node.name),useDefaultValues:!0})});const z={floatProperties:{_DstBlend:.5,_ShadeShift:.5,_ShadeToony:.5,_ShadingGradeRate:.5},keywordMap:{_NORMALMAP:!1,MTOON_OUTLINE_COLOR_FIXED:!0,MTOON_OUTLINE_WIDTH_WORLD:!0},name:"VRMCombinedMat",renderQueue:2e3,shader:"VRM/MToon",tagMap:{RenderType:"Opaque"},textureProperties:{_MainTex:0,_ShadeTexture:0},vectorProperties:{_Color:[1,1,1,1],_EmissionColor:[0,0,0,1],_EmissionMap:[0,0,1,1],_MainTex:[0,0,1,1],_OutlineColor:[0,0,0,1],_OutlineWidthTexture:[0,0,1,1],_ReceiveShadowTexture:[0,0,1,1],_RimColor:[0,0,0,1],_RimTexture:[0,0,1,1],_ShadeColor:[.9,.9,.9,1]}},W={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},H=[];h.forEach(j=>{j.type=="ShaderMaterial"?H.push(Object.assign({},z)):H.push(Object.assign({},W))});const C=l;i.forEach(j=>{for(let se=0;sej.isSkinnedMesh))==null?void 0:G.skeleton)||null;for(let j=0;j{const Be=he.sphere;fe.colliders.push({radius:Be.radius*o,offset:{x:Be.offset[0]*o,y:Be.offset[1]*o,z:Be.offset[2]*o}})}),K.push(fe)}}console.log("COLLIDER GROUPS",K);const F=j=>{for(let se=0;se{var V;const se=F(j.name);if(se===-1){console.warn("Spring bone "+j.name+" was removed during cleanup process. Skipping.");return}const fe=[];j.colliderGroups.forEach(R=>{const D=R.colliders[0];if(D!=null){const X=D.parent,ie=K.findIndex(pe=>pe.name===X.name);ie!=-1&&(fe.includes(ie)||fe.push(ie))}});let he=F((V=j.center)==null?void 0:V.name);he==-1&&console.warn("no center bone for spring bone "+j.name);const Be=j.settings;re.push({bones:[se],center:he,colliderGroups:fe,dragForce:Be.dragForce,gravityDir:{x:Be.gravityDir.x,y:Be.gravityDir.y,z:Be.gravityDir.z},gravityPower:Be.gravityPower,hitRadius:Be.hitRadius,stiffiness:Be.stiffness})});const ce={boneGroups:re,colliderGroups:K};console.log(ce),C.texture=m?x.length-1:void 0;const oe=await Promise.all(_.map(async j=>({buffer:s?await HO(j.imageBitmap):QO(j.imageBitmap),type:cn.IMAGE})));E.forEach((j,se)=>{j.buffer?oe.push({buffer:j.buffer,typeString:"",type:j.type}):j.sparse&&(oe.push({buffer:j.sparse.indices,typeString:"indices",type:j.type,count:j.sparse.count}),oe.push({buffer:j.sparse.values,typeString:"values",type:j.type})),oe.length-1}),m&&oe.push({buffer:s?await HO(m.imageBitmap):QO(m.imageBitmap),type:cn.IMAGE});let ge=0,me=0,ve=0,be=0;const ne=oe.map(j=>{const se={buffer:0,byteLength:j.buffer.byteLength,byteOffset:ge,target:j.type===cn.IMAGE||j.type===cn.BIND_MATRIX||j.typeString==="indices"||j.typeString==="values"?void 0:j.type===cn.INDEX?qn.ELEMENT_ARRAY_BUFFER:qn.ARRAY_BUFFER};return ge+=j.buffer.byteLength,j.type===cn.IMAGE?(x[me++].bufferView=be,be++):E[ve].sparse?(T[ve].sparse==null&&(T[ve].sparse={}),j.typeString==="indices"&&(T[ve].sparse.count=j.count,T[ve].sparse[j.typeString]={bufferView:be,byteOffset:0,componentType:qn.UNSIGNED_INT}),j.typeString==="values"&&(T[ve].sparse[j.typeString]={bufferView:be,byteOffset:0}),j.typeString==="values"&&ve++,be++):(E[ve].bufferIndex=be,T[ve].bufferView=be,ve++,be++),se}),k=r0e(t,O);Yge(C);const ae=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&ae.push("KHR_texture_basisu");for(const j of P){const se=T.filter(fe=>fe.type=="MAT4");for(let fe of se)if(j.joints.length!=fe.count)throw new Error(`The number of joints in the skin is not equal to the number of Accessors of type MAT4. Got ${j.joints.length} when accessors show ${fe.count} This is usually because of a bone count mismatch in your VRMs!`)}const le={accessors:T,asset:f,buffers:[{byteLength:ge}],bufferViews:ne,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new $,lookAtHorizontalInner:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtHorizontalOuter:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtTypeName:"Bone",lookAtVerticalDown:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtVerticalUp:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10}},materialProperties:H,humanoid:N,meta:C,secondaryAnimation:ce,specVersion:"0.0"}},extensionsUsed:ae,images:x,materials:M,meshes:U,nodes:O,samplers:b,scenes:k,skins:P,textures:B};console.log("output",le);const Z=new zO(wT(JSON.stringify(le,void 0,2)),"JSON"),J=new zO(Fm(oe.map(j=>j.buffer)),"BIN\0"),ue=Fm([Z.buffer,J.buffer]),Y=Fm([wT("glTF"),yT(2,4),yT(ue.byteLength+12,4)]);a(Fm([Y,ue]))}}function Yge(n){n.title=n.title||"Character",n.version=n.version||"1",n.author=n.author||"Anon",n.contactInformation=n.contactInformation||"",n.reference=n.reference||"",n.allowedUserName=n.allowedUserName||"Everyone",n.violentUssageName=n.violentUssageName||"Disallow",n.sexualUssageName=n.sexualUssageName||"Disallow",n.commercialUssageName=n.commercialUssageName||"Disallow",n.otherPermissionUrl=n.otherPermissionUrl||"",n.licenseName=n.licenseName||"Redistribution_Prohibited",n.otherLicenseUrl=n.otherLicenseUrl||""}function YG(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>YG(e)).flat())}const $ge=new Gge;async function HO(n){const e=await createImageBitmap(n),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0);const i=r.getImageData(0,0,t.width,t.height),s=new Uint8Array(i.data.buffer);return await $ge.compress(s,t.width,t.height,4,{normalMap:!1,uastc:!1,qualityLevel:50,compressionLevel:2,uastcFlags:"DEFAULT",compressionUASTC_Rdo_Level:18,uastcRDO:!1,uastcRDOQualityScalar:1,uastcRDODictSize:4096,uastcRDOMaxSmoothBlockErrorScale:10,uastcRDOMaxSmoothBlockStdDev:18,uastcRDODontFavorSimplerModes:!1,ETC1SQualityLevel:128,ETC1SmaxEndpoints:0,ETC1SEndpointRdoThreshold:1.25,ETC1SMaxSelectors:0,ETC1SSelectorRdoThreshold:1.25,ETC1SNoEndpointRdo:!1,ETC1SNoSelectorRdo:!1,supercmp_scheme:"Zstd"})}function QO(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=(4-r.length%4)%4,s=new ArrayBuffer(r.length+i),o=new DataView(s);for(let a=0;a4?c=r[a*n.itemSize+l]:l===0?c=n.getX(a):l===1?c=n.getY(a):l===2?c=n.getZ(a):c=n.getW(a),e===qn.UNSIGNED_SHORT?o.setUint16(i,c,!0):e===qn.UNSIGNED_INT?o.setUint32(i,c,!0):o.setFloat32(i,c,!0),i+=t}return s}class zO{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Fm([yT(r.byteLength,4),wT(this.type),r])}padBuffer(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new ArrayBuffer(r);return new Uint8Array(i).set(new Uint8Array(e)),new Uint8Array(i).fill(t,e.byteLength),i}}const GO=n=>{const e=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],t=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY];for(let r=0;rn.map(r=>{const i=r.type===Pi.Group?r.children[0]:r,s=r.type===Pi.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(c=>c.meshName===i.name?c.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(cn.SKIN_INDEX),NORMAL:a.indexOf(cn.NORMAL),POSITION:a.indexOf(cn.POSITION),TEXCOORD_0:a.indexOf(cn.UV),WEIGHTS_0:a.indexOf(cn.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(c=>c.type===cn.INDEX&&c.meshName===i.name?c.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(c=>{const A=e.map(h=>h.type===cn.BLEND_NORMAL&&h.meshName===i.name?h.name:null).indexOf(vT+c),u=e.map(h=>h.type===cn.BLEND_POSITION&&h.meshName===i.name?h.name:null).indexOf(vT+c),f={};return u!==-1&&(f.POSITION=u),A!==-1&&(f.NORMAL=A),f}):void 0}})}}),qge=(n,e,t)=>n.map(r=>{const i=r.type===Pi.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===cn.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)).filter(s=>s!==-1),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),Jge=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i={},i.shadeMultiplyTexture={index:e.map(d=>d.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const h=t;r=h.color?[h.color.r,h.color.g,h.color.b,1]:void 0}let s=-1;t.map?s=e.map(h=>h.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(h=>h.name).indexOf(t.uniforms.map.name));let o=-1;t.roughnessMap&&(o=e.map(h=>h.name).indexOf(t.name+"_orm"));let a=-1;t.normalMap&&(a=e.map(h=>h.name).indexOf(t.name+"_normal"));const l=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,c={baseColorFactor:r,baseColorTexture:l},A=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(A)c.metallicRoughnessTexture=A;else{const h=(()=>{switch(t.type){case kh.MeshStandardMaterial:return t.metalness;case kh.MeshBasicMaterial:return 0;default:return 0}})(),d=(()=>{switch(t.type){case kh.MeshStandardMaterial:return t.roughness;case kh.MeshBasicMaterial:return .9;default:return .9}})();c.metallicFactor=h,c.roughnessFactor=d}const f={alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{}}:void 0,name:t.name,pbrMetallicRoughness:c};return u&&(f.normalTexture=u),f}),e0e=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),t0e=n=>n.map(()=>({magFilter:qn.LINEAR,minFilter:qn.LINEAR,wrapS:qn.REPEAT,wrapT:qn.REPEAT})),n0e=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),r0e=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===Pi.Object3D||r.type===Pi.SkinnedMesh||r.type===Pi.Group||r.type===Pi.Bone).map(r=>t.indexOf(r.name))}]};function i0e(n,e,t){var a,l;const r=[],i=[];for(const c in n)((l=(a=n[c])==null?void 0:a.vrm)==null?void 0:l.meta)!=null&&(n[c].vrm.meta.authors!=null?i.push(n[c].vrm.meta):r.push(n[c].vrm.meta));r.length+i.length==1&&(r.length==1?r[0].title!=null&&(t=r[0].title):i[0].name!=null&&(t=i[0].name)),e!=null&&(e.authors!=null?i.push(e):r.push(e));const s=o0e(r),o=s0e(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function s0e(n,e){let{authors:t=[],otherLicenseUrl:r=[],contactInformation:i=[],references:s=[],allowExcessivelyViolentUsage:o=void 0,allowExcessivelySexualUsage:a=void 0,commercialUsage:l=void 0,copyrightInformation:c="",avatarPermission:A=void 0,otherPermissionUrl:u=[]}=n,f,h,d,m="unnecessary",g,p=[];e.forEach(M=>{t=t.concat(mt(M.authors)),r=r.concat(mt(M.otherLicenseUrl)),i=i.concat(mt(M.contactInformation)),s=s.concat(mt(M.references)),u=u.concat(mt(M.otherPermissionUrl)),M.allowExcessivelyViolentUsage===!1&&(o=!1),M.allowExcessivelySexualUsage===!1&&(a=!1),l=Fl(c0e,l,M.commercialUsage),c=Fl($G,c,M.copyrightInformation),A=Fl(A0e,A,M.avatarPermission),M.allowAntisocialOrHateUsage===!1&&(f=f=!1),M.allowPoliticalOrReligiousUsage===!1&&(h=h=!1),M.allowRedistribution===!1&&(d=d=!1),M.creditNotation==="required"&&(m="required"),p=p.concat(mt(M.thirdPartyLicenses)),g=Fl(l0e,g,M.modification)});const v=[...new Set(t)].filter(M=>M!=""&&M!=null&&M!="undefined"),w=[...new Set(r)].filter(M=>M!=""&&M!=null&&M!="undefined"),_=[...new Set(i)].filter(M=>M!=""&&M!=null&&M!="undefined"),x=[...new Set(s)].filter(M=>M!=""&&M!=null&&M!="undefined"),b=[...new Set(u)].filter(M=>M!=""&&M!=null&&M!="undefined"),B=[...new Set(p)].filter(M=>M!=""&&M!=null&&M!="undefined");return{authors:v,otherLicenseUrl:w.length==0?"":w.join(", "),contactInformation:_.length==0?"":_.join(", "),references:x,otherPermissionUrl:b.length==0?"":b.join(", "),thirdPartyLicenses:B.length==0?"":B.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:c,avatarPermission:A,allowAntisocialOrHateUsage:f,allowPoliticalOrReligiousUsage:h,allowRedistribution:d,creditNotation:m,modification:g}}function o0e(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,c,A;n.forEach(g=>{e=e.concat(mt(g.author)),t=t.concat(mt(g.contactInformation)),r=r.concat(mt(g.reference)),i=i.concat(mt(g.otherPermissionUrl)),s=s.concat(mt(g.otherLicenseUrl)),o=Fl(u0e,o,g.allowedUsername),a=Fl(YB,a,g.violentUssageName),l=Fl(YB,l,g.sexualUssageName),c=Fl(YB,c,g.commercialUssageName),A=Fl($G,A,g.licenseName)});const u=[...new Set(e)].filter(g=>g!=""&&g!=null&&g!="undefined"),f=[...new Set(t)].filter(g=>g!=""&&g!=null&&g!="undefined"),h=[...new Set(r)].filter(g=>g!=""&&g!=null&&g!="undefined"),d=[...new Set(i)].filter(g=>g!=""&&g!=null&&g!="undefined"),m=[...new Set(s)].filter(g=>g!=""&&g!=null&&g!="undefined");return{authors:u,otherLicenseUrl:m,contactInformation:f,references:h,allowExcessivelyViolentUsage:a==="Allow",allowExcessivelySexualUsage:l==="Allow",commercialUsage:c==="Allow"?"personalProfit":"personalNonProfit",copyrightInformation:A,avatarPermission:a0e(o),otherPermissionUrl:d}}function a0e(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const l0e={prohibited:0,allowModification:1,allowModificationRedistribution:2},c0e={personalNonProfit:0,personalProfit:1,corporation:2},A0e={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},u0e={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},YB={Disallow:0,Allow:1},$G={Redistribution_Prohibited:0,Other:1,CC_BY_NC_ND:2,CC_BY_ND:3,CC_BY_NC_SA:4,CC_BY_SA:5,CC_BY_NC:6,CC_BY:7,CC0:8};function Fl(n,e,t){return e===void 0?t:t==null||!(t in n)||n[e]{r.userData.origIndexBuffer&&t.push(r.userData.origIndexBuffer)}),e.traverse(r=>{r.userData.origIndexBuffer&&(r.userData.origIndexBuffer=t.shift())}),e}function f0e(n){const e=ZG(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=NG(s)),s.isSkinnedMesh){if(s.geometry=s.geometry.clone(),s.skeleton=t,r.push(s),Array.isArray(s.material)){const o=s.material;s.material=new Ld,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new ni;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function h0e(n,e,t){const r=await u2(n,t),i=await qG(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function d0e(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;p0e(n,e,r).then(a=>{eV(a,`${o}.vrm`),i()})})}async function p0e(n,e,t){const r=await u2(n,e,t);return qG(r,e,t)}function u2(n,e,t){const r=ZG(n);t.mergeAppliedMorphs=!0;const{createTextureAtlas:i=!0}=t;return i?Jme(r,e,t):(console.log("no atlas"),$me(r,e,t))}async function m0e(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await u2(n,t):f0e(n);g0e(s).then(o=>{if(o instanceof ArrayBuffer)eV(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);x0e(a,`${r}.gltf`)}})}function g0e(n){return new Promise(e=>new WR().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function v0e(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(c=>c.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{for(const o in Yg)if(s.bone.parent.name==Yg[o]){t.push(s);break}}),t}function y0e(n){const e={};return n.skeleton.bones.map(t=>{for(const r in Yg)if(Yg[r]===t.name){e[t.name]={node:t};break}}),e}function w0e(n,e,t){const r=Dd(n,"SkinnedMesh");return{humanBones:y0e(r[0]),materials:n.userData.atlasMaterial,meta:_0e(e),...t.mergeAppliedMorphs?{expressionManager:B0e(n)}:{}}}function _0e(n){return n=n||{},{...{authors:["CharacterStudio"],metaVersion:"1",version:"v1",name:"CharacterCreator",licenseUrl:"https://vrm.dev/licenses/1.0/",commercialUssageName:"personalNonProfit",contactInformation:"https://m3org.com/",allowExcessivelyViolentUsage:!1,allowExcessivelySexualUsage:!1,allowPoliticalOrReligiousUsage:!1,allowAntisocialOrHateUsage:!1,creditNotation:"required",allowRedistribution:!1,modification:"prohibited"},...n}}function qG(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=i0e(e,s,a);return new Promise(async c=>{const A=i?new Xge:new hpe,u={...E0e(e),...w0e(n,l,t)};let f;n.traverse(m=>{m.isSkinnedMesh&&(f=m)}),(()=>{for(let m=0;m{m.updateMatrix(),m.updateMatrixWorld()}),f.skeleton.calculateInverses(),f.skeleton.computeBoneTexture(),f.skeleton.update()})(),f.skeleton.bones.filter(m=>m.name==="head")[0];const d=v0e(e);A.parse(u,n,r,d,t.ktxCompression,o,m=>{c(m)})})}function JG(n,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(n),t.download=e,t.click()}function x0e(n,e){JG(new Blob([n],{type:"text/plain"}),e)}function eV(n,e){JG(b0e(n),e)}function b0e(n){return new Blob([n],{type:"application/octet-stream"})}function E0e(n){for(const e in n)if(n[e].vrm)return n[e].vrm}function B0e(n){const e=new K_;let t=n.userData.expressionManagerToClone;if(!t){t=new K_;for(const r of Object.values(ti)){const i=new W_(r);t.registerExpression(i)}}e.copy(t),n.userData.expressionManagerToClone=null;for(const r of n.children){if(!r.isMesh&&!r.isSkinnedMesh||!r.morphTargetDictionary)continue;const i=r.userData.bindMorphs;if(!i||!Age(r,i.old))continue;const o=(c,A)=>{var u;return((u=c.find(f=>f.index==A))==null?void 0:u.weight)||0},a=Object.entries(ti).flat(),l=Object.keys(i.old).filter(c=>a.includes(c));for(const c of Object.keys(t.expressionMap)){const A=t.expressionMap[c];if(!A)continue;const u=A._binds;if(!u||u.length==0){e.unregisterExpression(A);continue}for(const f of l){const h=i.new[f]||i.new[f.toLowerCase()],d=i.old[f]||i.old[f.toLowerCase()];if(h){const m=[];n.traverse(v=>{!v.isMesh&&!v.isSkinnedMesh||h.primitives.includes(v.id)&&m.push(v)}),e.unregisterExpression(A),A._binds=[];const g=o(u,d.index),p=new W_(A.expressionName);p.copy(A),console.log("adding bind",A.expressionName),p.addBind(new $C({index:h.index,weight:g,primitives:m})),e.registerExpression(p)}else e.unregisterExpression(A)}}}return e}const S0e=n=>{const t=n.parser.json.meshes,r=n.parser.associations;n.scene.traverse(i=>{var s;if(i instanceof Va&&i.morphTargetDictionary){let o=!1;const a=r.get(i);if(typeof a>"u")return;const l=a.meshes||0,c=a.primitives||0,A=t[l],u=A==null?void 0:A.primitives[c];if((s=u==null?void 0:u.extras)!=null&&s.targetNames){const f=u.extras.targetNames;for(let h=0;h{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?C0e(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?T0e(n):console.warn("No valid vrm file was provided")},C0e=n=>{var a,l,c;const e=n.parser.json,t=n.scene,r=e.nodes,i=(c=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:c.colliderGroups,s=[],o=r.map(A=>tV(A.name,s));i!=null&&i.forEach(A=>{const u=o[A.node],f=VG(t,u);if(f!=null){const h=A.colliders;f.userData.VRMcolliders=h.map(d=>({sphere:{radius:d.radius,offset:[d.offset.x,d.offset.y,d.offset.z]}}))}f.userData.VRMcollidersID=zG()})},T0e=n=>{var l,c,A,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(c=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:c.colliderGroups,s=(u=(A=e.extensions)==null?void 0:A.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(f=>tV(f.name,o));i!=null&&i.forEach(f=>{const h=mt(f.colliders);let d=-1,m=null;h.forEach(g=>{if(d!=s[g].node){d=s[g].node;const p=a[d];m=VG(t,p),m.userData.VRMcolliders=[]}if(m!=null){const p=s[g].shape;for(const v in p){const w=p[v];w!=null&&w.offset&&(w.offset[0]=-w.offset[0])}m.userData.VRMcollidersID=zG(),m.userData.VRMcolliders.push(p)}else console.error("no node with name "+a[d]+" was found")})})},tV=(n,e)=>{const t=Mt.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},ex=[0,400,560,2400,4800],tx=[0,500,700,3e3,6e3],_T=[],El=[],f2=1024,nV=44100;for(let n=0;n{requestAnimationFrame(t),this.update(r,i)};t()}start(e){this.audioContext=new AudioContext,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.meter=nx.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter)}startFromAudioFile(e){this.audioContext||(this.audioContext=new AudioContext),this.userSpeechAnalyzer||(this.userSpeechAnalyzer=this.audioContext.createAnalyser()),this.userSpeechAnalyzer.smoothingTimeConstant=.5,this.userSpeechAnalyzer.fftSize=f2,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=nx.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter),this.mediaStreamSource.connect(this.audioContext.destination),this.mediaStreamSource.start(),this.mediaStreamSource.connect(this.userSpeechAnalyzer)})}destroy(){var e,t,r;return(e=this.meter)==null||e.shutdown(),this.meter=null,(t=this.mediaStreamSource)==null||t.disconnect(),((r=this.audioContext)==null?void 0:r.close().catch(()=>{}))||Promise.resolve()}update(e){if(this.meter){const{volume:t}=this.meter;if(t<.01)this.vrm.expressionManager.setValue(ti.Oh,0),this.vrm.expressionManager.setValue(ti.Ah,0),this.vrm.expressionManager.setValue(ti.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(ti.Oh,i),this.vrm.expressionManager.setValue(ti.Ah,r),this.vrm.expressionManager.setValue(ti.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(c){const u=new Float32Array(c.length);for(let f=0;f0&&(i[c]+=r[A]);i[c]/=El[c+1]-El[c]}for(let c=0;c0&&(s[c]+=r[A]);i[c]/=El[c+1]-El[c],s[c]=s[c]/(_T[c+1]-_T[c])}const o=Math.max(s[1],i[1])>.2?1-2*Math.max(i[2],s[2]):(1-2*Math.max(i[2],s[2]))*5*Math.max(i[1],s[1]),a=3*Math.max(i[3],s[3]),l=.8*(Math.max(i[1],s[1])-Math.max(i[3],s[3]));return{oh:o,ee:l,ah:a}}static createAudioMeter(e){const t=e.createScriptProcessor(512);return t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0),s=i.length;let o=0,a;for(let c=0;c=t.clipLevel&&(t.clipping=!0,t.lastClip=window.performance.now()),o+=a*a;const l=Math.sqrt(o/s);t.volume=Math.max(l,t.volume*t.averaging)},t.clipping=!1,t.lastClip=0,t.volume=0,t.clipLevel=.98,t.averaging=.95,t.clipLag=750,t.connect(e.destination),t.checkClipping=()=>t.clipping?(t.lastClip+t.clipLag{t.disconnect(),t.onaudioprocess=null},t}}const $B=new $;class I0e{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new je,this.hotzoneSection=s(),this.enabled=!1,this.userActivated=!1,this.lookInterest=1,this.hasInterest=!0,this.interestSpeed=.3,this.onCanvas=!0,this.camera=r,this.maxLookPercent={neck:{maxy:15,miny:10,maxx:30,minx:10},spine:{maxy:0,miny:0,maxx:30,minx:10},left:{maxy:15,miny:20,maxx:35,minx:35},right:{maxy:15,miny:20,maxx:35,minx:35}},window.addEventListener("mousemove",o=>{this.curMousePos={x:o.clientX,y:o.clientY}});const i=document.getElementById(t);i&&(i.addEventListener("mouseleave",()=>{this.onCanvas=!1}),i.addEventListener("mouseenter",()=>{this.onCanvas=!0})),window.addEventListener("resize",()=>{this.hotzoneSection=s()});function s(){const o=window.innerWidth*e/100,a=(window.innerWidth-o)/2;return{xStart:a,xEnd:window.innerWidth-a,yStart:50,yEnd:window.innerHeight-80}}}setActive(e){console.log("is activating"),this.userActivated=e}setCamera(e){this.camera=e}addVRM(e){const t=e.data.isVRM0||!1,r=e.humanoid.humanBones;t||(r.neck.node.userData.inverseLookAt=!0,r.spine.node.userData.inverseLookAt=!0,r.leftEye&&(r.leftEye.node.userData.inverseLookAt=!0),r.rightEye&&(r.rightEye.node.userData.inverseLookAt=!0));const i={vrm:e,neckBone:r.neck.node,spineBone:r.spine.node,leftEyeBone:r.leftEye?r.leftEye.node:null,rightEyeBone:r.rightEye?r.rightEye.node:null};this.bonesInfo.push(i)}removeVRM(e){const t=this.bonesInfo.find(r=>r.vrm===e);if(t){const r=this.bonesInfo.indexOf(t);this.bonesInfo.splice(r,1)}}_getMouseDegrees(e,t,r){let i=0,s=0,o,a,l,c,A={x:window.innerWidth,y:window.innerHeight};return e<=A.x/2&&(o=A.x/2-e,a=o/(A.x/2)*100,i=r.maxx*a/100*-1),e>=A.x/2&&(o=e-A.x/2,a=o/(A.x/2)*100,i=r.minx*a/100),t<=A.y/2&&(l=A.y/2-t,c=l/(A.y/2)*100,s=r.maxy*.5*c/100*-1),t>=A.y/2&&(l=t-A.y/2,c=l/(A.y/2)*100,s=r.miny*c/100),{x:i,y:s}}lerp(e,t,r){return(1-r)*e+r*t}_moveJoint(e,t){const r=e.userData.inverseLookAt===!0?1:-1;if(Object.keys(e).length!==0){const i=(this.camera.position.y-1.8)*window.innerHeight/2;let s=this._getMouseDegrees(this.curMousePos.x,this.curMousePos.y-i,t);const o=.8;e.rotation.y=this.lerp(Et.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Et.degToRad(s.y*r),e.rotation.x,o)}}update(){$B.set(0,0,1),$B.applyQuaternion(this.camera.quaternion);const e=$B.z>0;this.curMousePos.x>this.hotzoneSection.xStart&&this.curMousePos.xthis.hotzoneSection.yStart&&this.curMousePos.y{this._moveJoint(t.neckBone,this.maxLookPercent.neck),this._moveJoint(t.spineBone,this.maxLookPercent.spine),this._moveJoint(t.leftEyeBone,this.maxLookPercent.left),this._moveJoint(t.rightEyeBone,this.maxLookPercent.right)})}}class ZB{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:c,requiredTraits:A,randomTraits:u,colliderTraits:f,lipSyncTraits:h,blinkerTraits:d,typeRestrictions:m,defaultCullingLayer:g,defaultCullingDistance:p,offset:v,vrmMeta:w,traits:_,textureCollections:x,colorCollections:b,canDownload:B=!0,downloadOptions:M={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=mt(o),this.requiredTraits=mt(A),this.randomTraits=mt(u),this.initialTraits=c||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=mt(f),this.lipSyncTraits=mt(h),this.blinkerTraits=mt(d),this.typeRestrictions=m,this.defaultCullingLayer=g,this.defaultCullingDistance=p,this.offset=v,this.canDownload=B,this.downloadOptions=M;const I=()=>{const O=[];for(const T in _)O.push(_[T].trait);return O};this.allTraits=I(),I(),(()=>{if(this.typeRestrictions)for(const O in this.typeRestrictions)mt(this.typeRestrictions[O]).forEach(y=>{this.typeRestrictions[y]==null&&(this.typeRestrictions[y]=[]),this.typeRestrictions[y].indexOf(O)==-1&&this.typeRestrictions[y].push(O)})})(),(()=>{M.vrmMeta=M.vrmMeta||w,M.scale=M.scale||a||1,M.mToonAtlasSize=M.mToonAtlasSize||2048,M.mToonAtlasSizeTransp=M.mToonAtlasSizeTransp||1024,M.stdAtlasSize=M.stdAtlasSize||2048,M.stdAtlasSizeTransp=M.stdAtlasSizeTransp||1024,M.exportStdAtlas=M.exportStdAtlas||!1,M.exportMtoonAtlas=M.exportMtoonAtlas||!0,M.screenshotFaceDistance=M.screenshotFaceDistance||1,M.screenshotFaceOffset=M.screenshotFaceOffset||[0,0,0],M.screenshotResolution=M.screenshotResolution||[512,512],M.screenshotBackground=M.screenshotBackground||[.1,.1,.1],M.screenshotFOV=M.screenshotFOV||75,!M.exportStdAtlas&&!M.exportMtoonAtlas&&(M.exportMtoonAtlas=!0)})(),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(x),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(b),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(_)}appendManifestData(e,t){e.textureTraits.forEach(r=>{const i=this.getTextureGroup(r.trait);i!=null?i.appendCollection(r,t):(this.textureTraits.push(r),this.textureTraitsMap.set(r.trait,r))}),e.colorTraits.forEach(r=>{const i=this.getColorGroup(r.trait);i!=null?i.appendCollection(r,t):(this.colorTraits.push(r),this.colorTraitsMap.set(r.trait,r))}),e.modelTraits.forEach(r=>{const i=this.getModelGroup(r.trait);i!=null?i.appendCollection(r,t):(this.modelTraits.push(r),this.modelTraitsMap.set(r.trait,r))}),console.log(e)}getExportOptions(){return this.downloadOptions}getGroupModelTraits(){return this.modelTraits}getInitialTraits(){return this.getRandomTraits(this.initialTraits)}getAllTraits(){return this.getRandomTraits(this.allTraits)}getAllBlendShapeTraits(){return this.modelTraits.map(e=>e.getCollection()).flat().map(e=>e.blendshapeTraits).flat().map(e=>e==null?void 0:e.collection).flat().filter(e=>!!e)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=mt(t);const i=[];return r.forEach(s=>{if(t.indexOf(s.trait_type)==-1){const o=this.getTraitOption(s.trait_type,s.value);o&&i.push(o)}}),i}else return console.warn("No attiributes parameter was found in ",e),null}getRandomTraits(e){const t=[];return(e||this.randomTraits).forEach(i=>{const s=this.getRandomTrait(i);s&&t.push(s)}),this._filterTraitOptions(t)}getRandomTrait(e){var r,i;const t=this.getModelGroup(e);if(t){const s=t.getRandomTrait();if(s){const o=(r=s.targetTextureCollection)==null?void 0:r.getRandomTrait(),a=(i=s.targetColorCollection)==null?void 0:i.getRandomTrait();return new qB(s,o,a)}else return null}else return console.warn("No trait group with name "+e+" was found."),null}async _fetchJson(e){return await(await fetch(e)).json()}getTraitOption(e,t){var i,s;const r=this.getModelTrait(e,t);if(r){const o=(i=r.targetTextureCollection)==null?void 0:i.getRandomTrait(),a=(s=r.targetColorCollection)==null?void 0:s.getRandomTrait();return new qB(r,o,a)}return null}_filterTraitOptions(e){const t=[],r=[];for(let i=0;i0&&console.log("options were filtered to fullfill restrictions: ",r),t}getCustomTraitOption(e,t){const r=this.getCustomModelTrait(e,t);return r?new qB(r,null,null):null}getCustomModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getCustomTrait(t)}getModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getTrait(t)}getModelTraits(e){const t=this.getModelGroup(e);return t?t.getCollection():(console.warn("No model group with name "+e),null)}getModelGroup(e){return this.modelTraitsMap.get(e)}getTextureTrait(e,t){var r;return(r=this.getTextureGroup(e))==null?void 0:r.getTrait(t)}getTextureGroup(e){return this.textureTraitsMap.get(e)}getColorTrait(e,t){var r;return(r=this.getColorGroup(e))==null?void 0:r.getTrait(t)}getColorGroup(e){return this.colorTraitsMap.get(e)}getTraitsDirectory(){let e=(this.assetsLocation||"")+(this.traitsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getThumbnailsDirectory(){let e=(this.assetsLocation||"")+(this.thumbnailsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getTraitIconsDirectorySvg(){let e=(this.assetsLocation||"")+(this.traitIconsDirectorySvg||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getAssetsDirectory(){let e=this.assetsLocation||"";return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}createModelTraits(e,t=!1){t&&(this.modelTraits=[]),mt(e).forEach(r=>{this.modelTraits.push(new R0e(this,r))}),this.modelTraitsMap=new Map(this.modelTraits.map(r=>[r.trait,r])),this.modelTraits.forEach(r=>{r.restrictedTraits.forEach(i=>{const s=this.getModelGroup(i);console.log(s),s&&s.addTraitRestriction(r.trait)})})}createTextureTraits(e,t=!1){t&&(this.textureTraits=[]),mt(e).forEach(r=>{this.textureTraits.push(new U0e(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),mt(e).forEach(r=>{this.colorTraits.push(new F0e(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class R0e{constructor(e,t){const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:c,restrictedTraits:A=[],restrictedTypes:u=[]}=t;this.manifestData=e,this.isRequired=e.requiredTraits.indexOf(r)!==-1,this.trait=r,this.name=i,this.iconSvg=s,this.fullIconSvg=e.getTraitIconsDirectorySvg()+s,this.restrictedTraits=A,this.restrictedTypes=u,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(c)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Model with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Model with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}addTraitRestriction(e){this.restrictedTraits.indexOf(e)==-1&&this.restrictedTraits.push(e)}createCollection(e,t=!1){t&&(this.collection=[]),mt(e).forEach(r=>{this.collection.push(new VO(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new VO(this,{directory:e,fullDirectory:e,id:"_custom",name:"Custom"})}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}getCollection(){return this.collection}}class U0e{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),mt(e).forEach(r=>{this.collection.push(new D0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class F0e{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Color with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Color with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),mt(e).forEach(r=>{this.collection.push(new N0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class VO{constructor(e,t){jt(this,"blendshapeTraits",[]);jt(this,"blendshapeTraitsMap",new Map);const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:c=[],textureCollection:A,blendshapeTraits:u,colorCollection:f,fullDirectory:h,fullThumbnail:d}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,h)this.fullDirectory=h;else if(Array.isArray(i)){this.fullDirectory=[];for(let m=0;mnew P0e(this,m)),this.blendshapeTraitsMap=new Map(this.blendshapeTraits.map(m=>[m.trait,m])))}isRestricted(e){if(e==null)return!1;const t=e.traitGroup.trait;if(this.traitGroup.restrictedTraits.indexOf(t)!=-1)return!0;if(this.type.length>0&&this.manifestData.restrictedTypes>0){const r=(o,a)=>{if(o==null||a==null)return!1;for(let l=0;lr(i[o],s))}return!1}getGroupBlendShapeTraits(){return this.blendshapeTraits}getBlendShapes(e){var t,r;return(r=(t=this.blendshapeTraitsMap)==null?void 0:t.get(e))==null?void 0:r.collection}getBlendShape(e,t){var r,i;return(i=(r=this.blendshapeTraitsMap)==null?void 0:r.get(e))==null?void 0:i.getTrait(t)}}class P0e{constructor(e,t){jt(this,"trait");jt(this,"name");jt(this,"isBlendShapeGroup",!0);jt(this,"collection",[]);jt(this,"cameraTarget",null);jt(this,"collectionMap",null);const{trait:r,name:i,collection:s,cameraTarget:o=e.traitGroup.cameraTarget||{distance:3,height:1}}=t;this.modelTrait=e,this.trait=r,this.name=i,this.cameraTarget=o,this.createCollection(s)}createCollection(e,t=!1){t&&(this.collection=[]),mt(e).forEach(r=>{this.collection.push(new L0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class L0e{constructor(e,t){jt(this,"id");jt(this,"name");jt(this,"fullThumbnail");jt(this,"isBlendShape",!0);const{id:r,name:i,fullThumbnail:s}=t;r||console.warn("BlendShapeTrait is missing id, parent trait: "+e.trait),i||console.warn("BlendShapeTrait is missing name, parent trait: "+e.trait),this.parentGroup=e,this.id=r,this.fullThumbnail=s,this.name=i}getGroupId(){return this.parentGroup.trait}}class D0e{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{e.traverse(i=>{if(i.isMesh||i.isSkinnedMesh){const s=i;if(!s.morphTargetDictionary||!s.morphTargetInfluences)return;const o=s.morphTargetDictionary[t.id];o!=null&&(s.morphTargetInfluences[o]=r?1:0)}})});this._start(e)}async _start(e){const{parentModel:t=null,renderCamera:r=null,manifestURL:i=null}=e;this.rootModel=new Ft,this.characterModel=new Ft,this.parentModel=t,t&&t.add(this.rootModel),this.lipSync=null,this.lookAtManager=null,this.animationManager=new pge,this.screenshotManager=new Cge(this,t||this.rootModel),this.blinkManager=new Ige(.1,.1,.5,5),this.rootModel.add(this.characterModel),this.renderCamera=r,this.manifestData=null,this.manifest=null,i&&(this.loadManifest(i),this.animationManager.setScale(this.manifestData.displayScale)),this.avatar={},this.storedAvatar={},this.traitLoadManager=new k0e;const s=new ni;s.renderOrder=1e4,this.rootModel.add(s),this.vrmHelperRoot=s}update(){this.lookAtManager!=null&&this.lookAtManager.update()}addLookAtMouse(e,t,r,i=!0){var s;this.lookAtManager=new I0e(e,t,r),this.lookAtManager.enabled=!0;for(const o in this.avatar)((s=this.avatar[o])==null?void 0:s.vrm)!=null&&this.lookAtManager.addVRM(this.avatar[o].vrm)}toggleCharacterLookAtMouse(e){this.lookAtManager!=null?(this.lookAtManager.setActive(e),this.animationManager&&this.animationManager.enableMouseLook(e)):console.warn("toggleCharacterLookAtMouse() was called, but no lookAtManager exist. Make sure to set it up first with addLookArMous()")}savePortraitScreenshot(e,t,r,i=1,s=0){this.blinkManager.enableScreenshot(),this.characterModel.traverse(o=>{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(vl)}),vl.z+=.3,vl.y+=s,this.screenshotManager.cameraFrameManager.setCamera(vl,i),this.screenshotManager.saveScreenshot(e,t,r),this.blinkManager.disableScreenshot()}cameraRaycastCulling(e,t,r=!0){if(this.renderCamera==null){console.warn("No camera was set in character manager. Please call setRenderCamera(camera) before calling this function");return}const i=()=>{this.characterModel.traverse(c=>{c.isMesh&&c.userData.origIndexBuffer&&(c.userData.clippedIndexGeometry=c.geometry.index.clone(),c.geometry.setIndex(c.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(c=>{c.isMesh&&c.userData.origIndexBuffer&&c.geometry.setIndex(c.userData.clippedIndexGeometry)})},o=(c,A)=>{for(let u=0;u{var m,g;const u=c.object,f=c.face,h=[f.a,f.b,f.c],d=(g=(m=u.userData)==null?void 0:m.clippedIndexGeometry)==null?void 0:g.array;if(d!=null){const p=o(d,h),v=Array.from(d);if(p==-1&&!A){const w=[...v,...h];u.userData.clippedIndexGeometry=new lt(new Uint32Array(w),1,!1)}p!=1&&A&&(v.splice(p,3),u.userData.clippedIndexGeometry=new lt(new Uint32Array(v),1,!1))}};JB.x=e,JB.y=t,i(),jO.setFromCamera(JB,this.renderCamera);const l=jO.intersectObjects(this.characterModel.children);if(l.length>0){const c=l[0];a(c,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new Fw({traitGroupID:t,traitModel:null}));e.forEach(t=>{this._addLoadedData(t)}),this.avatar={}}removeCurrentManifest(){this.removeCurrentCharacter(),this.manifest=null,this.manifestData=null,this.animationManager&&this.animationManager.clearCurrentAnimations()}canDownload(){var e;return((e=this.manifestData)==null?void 0:e.canDownload)||!0}downloadVRM(e,t=null){return new Promise(async(r,i)=>{if(this.canDownload())try{t=t||{};const o={...this.manifestData.getExportOptions(),...t};o.isVrm0=!0,o.screenshot=this._getPortaitScreenshotTexture(!1,o),console.log(o),await d0e(this.characterModel,this.avatar,e,o),r()}catch(s){console.error("Error downloading VRM:",s.message),i(new Error("Failed to download VRM."))}else{const s="Download not supported.";console.error(s),i(new Error(s))}})}downloadGLB(e,t=null){if(console.log("XXX fix glb downloader"),this.canDownload()){t=t||{};const r={...this.manifestData.getExportOptions(),...t};m0e(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getBoneTriangleCount(){let e=0,t=new Set;for(const r in this.avatar)this.avatar[r].model.traverse(i=>{i.isMesh&&(e+=i.geometry.index.array.length),i.isSkinnedMesh&&i.skeleton.bones.forEach(s=>{t.add(s.name)})});return{triangles:e/3,bones:t.size}}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getBlendShapeGroupTraits(e,t){var r;return this.manifestData?(r=this.manifestData.getModelTrait(e,t))==null?void 0:r.getGroupBlendShapeTraits():[]}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentBlendShapeTraitData(e){var t;return((t=this.avatar[e])==null?void 0:t.blendShapeTraitsInfo)||{}}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&this.screenshotManager.setScene(this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(mt(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadBlendShapeTrait(e,t,r){if(!this.avatar[e]){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(!this.manifestData){console.warn("No manifest data was found.");return}try{this._loadBlendShapeTrait(e,t,r)}catch{console.error("Error loading blendshape trait "+e,t,r)}}removeBlendShapeTrait(e,t){this.avatar[e]?this._loadBlendShapeTrait(e,t,null):console.warn(`No trait with name: ${e} was found.`)}loadTrait(e,t,r=!1){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getTraitOption(e,t);o&&(await this._loadTraits(mt(o),r),i())}catch(o){console.error("Error loading specific trait:",o.message),s(new Error("Failed to load specific trait."))}else{const o="No manifest was loaded, specific trait cannot be loaded.";console.error(o),s(new Error(o))}})}loadCustomTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getCustomTraitOption(e,t);s&&(await this._loadTraits(mt(s)),r())}catch(s){console.error("Error loading custom trait:",s.message),i(new Error("Failed to load custom trait."))}else{const s="No manifest was loaded, custom trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTexture(e,t){return new Promise(async(r,i)=>{var o;const s=(o=this.avatar[e])==null?void 0:o.model;if(s)await rge(s,t),r();else{const a="No Group Trait with name "+e+" was found.";console.warn(a),i(new Error(a))}})}setTraitColor(e,t){var i;const r=(i=this.avatar[e])==null?void 0:i.model;if(r)try{const s=new He(t);r.traverse(o=>{o.isMesh&&(o.material.type==="MeshStandardMaterial"?Array.isArray(o.material)?o.material.forEach(a=>{a.color=s}):o.material.color=s:(o.material[0].uniforms.litFactor.value=s,o.material[0].uniforms.shadeColorFactor.value=new He(s.r*.8,s.g*.8,s.b*.8)))})}catch(s){throw console.error("Error setting trait color:",s.message),new Error("Failed to set trait color.")}else{const s="No Group Trait with name "+e+" was found.";throw console.warn(s),new Error(s)}}removeTrait(e,t=!1){if(this.isTraitGroupRequired(e)&&!t){console.warn(`No trait with name: ${e} is not removable.`);return}if(this.manifestData.getModelGroup(e)){const i=new Fw({traitGroupID:e,traitModel:null});this._addLoadedData(i),jB(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){jB(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new ZB(this.manifest)}getCurrentOptimizerCharacterModel(){var e;return(e=this.avatar.CUSTOM)==null?void 0:e.vrm}loadOptimizerCharacter(e){return this.loadCustomTrait("CUSTOM",e)}setManifest(e){return this.removeCurrentCharacter(),new Promise(async(t,r)=>{try{if(this.manifest=e,this.manifest){if(this.manifestData=new ZB(this.manifest),this.animationManager)try{await this._animationManagerSetup(this.manifest.animationPath,this.manifest.assetsLocation,this.manifestData.displayScale)}catch(i){console.error("Error loading animations: "+i)}t()}else{const i="Failed to fetch or parse the manifest.";console.error(i),r(new Error(i))}}catch(i){console.error("Error setting manifest:",i.message),r(new Error("Failed to set the manifest."))}})}appendManifest(e,t){return new Promise(async(r,i)=>{try{t?this.manifest={...this.manifest||{},manifest:e}:this.manifest={manifest:e,...this.manifest||{}};const s=new ZB(e);this.manifestData.appendManifestData(s),r()}catch(s){console.error("Error setting manifest:",s.message),i(new Error("Failed to set the manifest."))}})}loadManifest(e){return new Promise(async(t,r)=>{try{const i=await this._fetchManifest(e);this.setManifest(i).then(()=>{t()})}catch(i){console.error("Error loading manifest:",i.message),r(new Error("Failed to load the manifest."))}})}loadAppendManifest(e,t){return new Promise(async(r,i)=>{try{const s=await this._fetchManifest(e);this.appendManifest(s,t).then(()=>{r()})}catch(s){console.error("Error loading manifest:",s.message),i(new Error("Failed to load the manifest."))}})}async soloTargetGroupTrait(e){const t=mt(e),r=[];for(const i in this.avatar)t.includes(i)&&r.push(this.manifestData.getTraitOption(i,this.avatar[i].traitInfo.id));await this._loadTraits(r,!0)}storeCurrentAvatar(){this.storedAvatar={...this.avatar}}async loadStoredAvatar(){const e=[];for(const t in this.storedAvatar)e.push(this.manifestData.getTraitOption(t,this.storedAvatar[t].traitInfo.id));console.log(e),this._loadTraits(e,!0)}async _loadTraits(e,t=!1){console.log("laoded traits:",e),await this.traitLoadManager.loadTraitOptions(mt(e)).then(r=>{t&&this.getGroupTraits().forEach(s=>{r.some(a=>{var l;return((l=a.traitModel)==null?void 0:l.traitGroup.trait)===s.trait})||this.avatar[s.trait]!=null&&r.push(new Fw({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),jB(this.avatar)})}async _loadBlendShapeTrait(e,t,r){const i=this.avatar[e];if(!i){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(i.blendShapeTraitsInfo||(i.blendShapeTraitsInfo={}),i.blendShapeTraitsInfo[t]&&this.toggleBinaryBlendShape(i.model,i.blendShapeTraitsInfo[t],!1),r==null){delete this.avatar[e].blendShapeTraitsInfo[t];return}const s=i.traitInfo.getBlendShape(t,r);if(!s){console.warn(`Blendshape with name: ${r} was not found.`);return}this.toggleBinaryBlendShape(i.model,s,!0),this.avatar[e].blendShapeTraitsInfo[s.getGroupId()]=s}async _animationManagerSetup(e,t,r){const i=mt(e);this.animationManager&&(this.animationManager.setScale(r),e.length>0&&(this.animationManager.storeAnimationPaths(i,t||""),await this.animationManager.loadAnimation(i,!1,0,i[0].endsWith(".fbx"),t||"")))}async _fetchManifest(e){return await(await fetch(e)).json()}_getPortaitScreenshotTexture(e,t){this.blinkManager.enableScreenshot(),this.characterModel.traverse(u=>{u.isSkinnedMesh&&u.skeleton.bones.filter(h=>h.name==="head")[0].getWorldPosition(vl)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],c=r[1];vl.x+=s[0],vl.y+=s[1],vl.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.cameraFrameManager.setCamera(vl,i,a);const A=e?this.screenshotManager.getScreenshotBlob(l,c):this.screenshotManager.getScreenshotTexture(l,c);return this.blinkManager.disableScreenshot(),A}_setupWireframeMaterial(e){e.origMat=e.material;const t=()=>{const o=.1+Math.random()*.9,a=.1+Math.random()*(1-.1),l=.1+Math.random()*(1-.1);return new He(o,a,l)},r=new Zi({color:t(),wireframe:!0,wireframeLinewidth:.2}),i=e.material;e.setDebugMode=s=>{s?e.material.length?(e.material[0]=r,e.material[1]=r):e.material=r:e.material=i}}_VRMBaseSetup(e,t,r,i,s){var a,l;let o=e.userData.vrm;if(e.userData.vrm==null)return console.error("No valid VRM was provided for "+r+" trait, skipping file."),null;if(UO(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&M0e(e),cge(o),S0e(e),this._unregisterMorphTargetsFromManifest(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new nx(o)),this._modelBaseSetup(o,t,r,i,s),((l=o.meta)==null?void 0:l.metaVersion)==="0"){if(o.humanoid.humanBones.hips.node.parent==o.scene){const c=new Ft;c.name="newRootNode",nge(o.scene,c),c.add(o.humanoid.humanBones.hips.node)}o.humanoid.humanBones.hips.node.parent.rotateY(3.14159),o.scene.traverse(c=>{if(c.isSkinnedMesh){for(let A=0;Aa.id).includes(o.expressionName)&&i.push(o);for(const o of i)e.expressionManager.unregisterExpression(o)}_modelBaseSetup(e,t,r,i,s){const o=[],a=mt(t.cullingIgnore),l=[];t.meshTargets&&mt(t.meshTargets).map(u=>{const f=e.scene.getObjectByName(u);f!=null&&f.isMesh&&o.push(f)}),e.scene.traverse(u=>{!t.meshTargets&&u.isMesh&&o.push(u),u.frustumCulled=!1,u.isMesh&&(this._setupWireframeMaterial(u),a.indexOf(u.name)===-1&&l.push(u))});const c=this.manifest,A=this.manifestData.getModelGroup(r);UO(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:A.cullingLayer!=null?A.cullingLayer:c.defaultCullingLayer!=null?c.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:A.cullingDistance!=null?A.cullingDistance:c.defaultCullingDistance!=null?c.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,f)=>{if(i){const h=i[f]||i[0];h!=null&&mt(u.material).map(d=>{H0e(d,h)})}if(s){const h=s[f]||s[0];h!=null&&(u.material[0].uniforms.litFactor.value=h,u.material[0].uniforms.shadeColorFactor.value=new He(h.r*.8,h.g*.8,h.b*.8))}})}_applyManagers(e){this.blinkManager.addVRM(e),this.lookAtManager&&this.lookAtManager.addVRM(e),this.animationManager&&this.animationManager.addVRM(e)}_displayModel(e){if(e){const t=e.scene;this.characterModel.attach(t)}}_positionModel(e){const t=this.manifestData.displayScale;e.scene.scale.set(t,t,t)}_disposeTrait(e){this.blinkManager.removeVRM(e),this.lookAtManager&&this.lookAtManager.removeVRM(e),this.animationManager&&this.animationManager.removeVRM(e),lge(e)}_addLoadedData(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;if(r==null){this.avatar[t]&&this.avatar[t].vrm&&(this._disposeTrait(this.avatar[t].vrm),this.avatar[t]={});return}let c=null;o.map(A=>{A!=null&&(c=this._VRMBaseSetup(A,r,t,a,l))}),c!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(c),this._displayModel(c),this._applyManagers(c),console.log(this.characterModel),this.avatar[t]={traitInfo:r,blendShapeTraitsInfo:{},textureInfo:i,colorInfo:s,name:r.name,model:c&&c.scene,vrm:c})}}class k0e{constructor(){const e=new Lz;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new Gz(e);t.crossOrigin="anonymous",t.register(i=>new ape(i,{autoUpdateHumanBones:!0}));const r=new ju(e);this.loadPercentager=0,this.loadingManager=e,this.gltfLoader=t,this.textureLoader=r,this.isLoading=!1}setLoadPercentage(e){this.loadPercentager=e}loadTraitOptions(e){return new Promise(t=>{this.isLoading=!0;const r=[],i=e.map(async(s,o)=>{var A,u,f;if(s==null){r[o]=null;return}const a=await Promise.all(mt((A=s==null?void 0:s.traitModel)==null?void 0:A.fullDirectory).map(async h=>{try{return await this.gltfLoader.loadAsync(h)}catch(d){return console.error(`Error loading modelsss ${h}:`,d),null}})),l=await Promise.all(mt((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(h=>new Promise(d=>{this.textureLoader.load(h,m=>{m.flipY=!1,m.colorSpace=kt,d(m)},null,m=>{console.error("error loading texture: ",m),d(null)})}))),c=mt((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(h=>new He(h));r[o]=new Fw({traitGroupID:s==null?void 0:s.traitModel.traitGroup.trait,traitModel:s==null?void 0:s.traitModel,textureTrait:s==null?void 0:s.traitTexture,colorTrait:s==null?void 0:s.traitColor,models:a,textures:l,colors:c})});Promise.allSettled(i).then(()=>{this.setLoadPercentage(100),t(r),this.isLoading=!1}).catch(s=>{this.setLoadPercentage(100),console.error("An error occurred:",s),t(r),this.isLoading=!1})})}}class Fw{constructor(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;this.traitGroupID=t,this.traitModel=r,this.textureTrait=i,this.colorTrait=s,this.models=o,this.textures=a,this.colors=l}}function H0e(n,e){if(n.type==="Shadermaterial"&&!n.isMToonMaterial){console.warn("XXX set material texture to shader material",n);return}n.map=e,n.needsUpdate=!0}function Q0e(n){const e=new Hg,t=new Oz(16777215,2);e.add(t);const r=new QR(16777215,2);r.position.set(0,1,1),e.add(r);const i=new Ft;e.add(i);const s=new Ur(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new O0e({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new m0({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),c=new goe(s,l.domElement);c.minDistance=1,c.maxDistance=4,c.maxPolarAngle=Math.PI/2,c.enablePan=!0,c.target=new $(0,1,0),c.enableDamping=!0,c.dampingFactor=.1;const A=new $(-.5,0,-.5),u=new $(.5,1.7,.5),f=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",f),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputColorSpace=kt;const h=()=>{requestAnimationFrame(h),c.target.clamp(A,u),c==null||c.update(),o.update(),l.render(e,s)};h();const d=g=>{const p=g.ctrlKey,v=a.getBoundingClientRect(),w=(g.clientX-v.left)/v.width*2-1,_=-((g.clientY-v.top)/v.height)*2+1;o.cameraRaycastCulling(w,_,p)};async function m(){}return m(),a.addEventListener("click",d),{scene:e,camera:s,controls:c,characterManager:o,sceneElements:i}}function Fy(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var rV={exports:{}};/*! + `})}}const nm=new $;class Uge{constructor(e){jt(this,"camera",null);jt(this,"frameOffset",{min:.2,max:.2});jt(this,"boneOffsets");jt(this,"cameraDir",new $);jt(this,"frameTarget",null);this.camera=e||new Fr,this.boneOffsets={head:null,neck:null,chest:null,hips:null,spine:null,leftUpperLeg:null,leftLowerLeg:null,leftFoot:null,rightUpperLeg:null,rightLowerLeg:null,rightFoot:null}}setupCamera(e,t,r=30){this.camera.position.copy(e),this.camera.lookAt(t),this.camera.fov=r}async calculateBoneOffsets(e,t){for(const r in this.boneOffsets){const i=await this._getMinMaxOffsetByBone(e,r,t);console.log("result",i),this.boneOffsets[r]=i}}setFrameTarget(e){this.frameTarget=e}frameCloseupShot(){this.frameShot("head","head")}frameMediumShot(){this.frameShot("chest","head")}frameCowboyShot(){this.frameShot("hips","head")}frameFullShot(){this.frameShot("leftFoot","head")}frameShot(e,t,r=null,i=!1,s=!0){if(!this.frameTarget){console.error("No target object provided, Call setFrameTarget() first;");return}const o=this._getBoneWorldPositionWithOffset(this.frameTarget,e,i),a=this._getBoneWorldPositionWithOffset(this.frameTarget,t,s);o.y-=this.frameOffset.max,a.y+=this.frameOffset.min,r=r||new $(0,0,0),this.positionCameraBetweenPoints(o,a,r)}setBottomFrameOffset(e){this.frameOffset.min=e}setTopFrameOffset(e){this.frameOffset.max=e}_getBoneWorldPositionWithOffset(e,t,r){const i=this._getFirstBoneWithName(t,e);if(!i||!this.boneOffsets[t])return console.error(`Bone with name '${t}' not found in the model.`),new $;const s=new $;i.getWorldPosition(s);const o=r?this.boneOffsets[t].max:this.boneOffsets[t].min;return s.y+=o.y,s}_getFirstBoneWithName(e,t=void 0){let r=null;const i=t||this.frameTarget;if(!i){console.error("_getFirstBoneWithName: No target object provided, Call setFrameTarget() first or provide a targetObject parameter;");return}return i.traverse(s=>{if(s instanceof ja){if(!s.geometry){console.error("Invalid skinned mesh found in children.");return}const o=s.skeleton.bones.findIndex(a=>a.name===e);if(o!==-1){r=s.skeleton.bones[o];return}}}),r}async _getMinMaxOffsetByBone(e,t,r){return new Promise(async(i,s)=>{(!e||!e.traverse)&&(console.error("Invalid parent object provided."),s(null));const o=new $(1/0,1/0,1/0),a=new $(-1/0,-1/0,-1/0),l=[];e.traverse(async u=>{u instanceof ja&&(l.push(this._saveBonesPos(u.skeleton)),u.skeleton.pose())});let c=0;await(u=>new Promise(f=>setTimeout(f,u)))(10),e.traverse(u=>{if(u instanceof ja){if(!u.geometry){console.error("Invalid skinned mesh found in children.");return}const f=u.skeleton.bones.findIndex(g=>g.name===t);if(f===-1){console.error(`Bone with name '${t}' not found in one of the skinned meshes.`);return}const h=u.geometry.getAttribute("position"),d=u.geometry.getAttribute("skinWeight"),m=u.geometry.getAttribute("skinIndex");for(let g=0;g=r){const _=u.skeleton.bones[f],x=new $().setFromMatrixPosition(_.matrixWorld),b=p.clone().sub(x);o.min(b),a.max(b)}}this._restoreSavedPose(l[c],u.skeleton),c++}}),i({min:o,max:a})})}_saveBonesPos(e){let t=[];return e.bones.forEach(r=>{t.push({position:r.position.clone(),rotation:r.rotation.clone(),scale:r.scale.clone()})}),t}_restoreSavedPose(e,t){e&&t.bones.forEach((r,i)=>{r.position.copy(e[i].position),r.rotation.copy(e[i].rotation),r.scale.copy(e[i].scale)})}positionCameraBetweenPoints(e,t,r,i=30){const s=new Qn;s.expandByPoint(e),s.expandByPoint(t),this.camera.fov=i;const o=this.camera.fov*(Math.PI/180),l=s.getSize(new $).length()/(2*Math.tan(o/2));s.getCenter(nm),this.camera.position.copy(nm),r.y*=.5,this.camera.lookAt(nm.clone().sub(r));const c=new $;this.camera.getWorldDirection(c),this.camera.position.addScaledVector(c,-l),this.camera.updateProjectionMatrix()}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,nm.set(0,0,-1),this.cameraDir=nm.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),this.camera.position.x-=this.cameraDir.x*t,this.camera.position.z-=this.cameraDir.z*t}setCameraFrameWithName(e,t){switch(e.toLowerCase()){case"fullshot":this.frameShot("leftFoot","head",t);break;case"cowboyshot":this.frameShot("hips","head",t);break;case"mediumshot":this.frameShot("chest","head",t);break;case"mediumcloseup":case"mediumcloseupshot":this.frameShot("chest","head",t,!0);break;case"closeup":case"closeupshot":this.frameShot("head","head",t);break;default:console.warn("unkown cameraFrame: "+e+". Please use fullShot, cowboyShot, mediumShot, mediumCloseup or closeup"),this.frameShot("leftFoot","head",t);break}}copyCamera(e){this.camera.position.copy(e.position),this.camera.quaternion.copy(e.quaternion),"fov"in e&&(this.camera.fov=e.fov)}}const tx=4096;class Fge{constructor(e,t,r){const i=new v0({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new je(tx,tx);i.setClearColor(0,0),i.outputColorSpace=Mr,i.setSize(s.x,s.y),i.setPixelRatio(window.devicePixelRatio);let o=s.clone().divideScalar(r);o.x|=0,o.y|=0;const a=new Cge(i);a.addPass(new Tge(e,t)),this._renderPixelPass=new Ige(o,e,t),this._pixelPass=new Rge(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new je(e,t).clone().divideScalar(this.pixelSize);i.x|=0,i.y|=0,this.renderer.setSize(e,t),this._renderPixelPass.setResolution(i),this._pixelPass.setResolution(i)}setPixelSize(e){this.pixelSize=e}render(){this.composer.render()}}class Pge{constructor(e,t){jt(this,"cameraFrameManager");this.renderer=new v0({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputColorSpace=kt,this.renderer.setSize(tx,tx);const r=new Fr(30,1,.1,1e3);this.textureLoader=new Xu,this.sceneBackground=new He(.1,.1,.1),this.sceneBackgroundAlpha=1,this.usesBackgroundImage=!1,this.backgroundMaterial=new qi({color:16777215,transparent:!0,opacity:.5});const i=new cc(1e3,1e3),s=new hn(i,this.backgroundMaterial);s.renderOrder=-1,this.backgroundPlane=s,this.pixelRenderer=new Fge(t,r,20),this.cameraFrameManager=new Uge(r),this.cameraFrameManager.setFrameTarget(this.characterManager.characterModel)}setScene(e){this.scene=e}get camera(){return this.cameraFrameManager.camera}setupCamera(e,t,r=30){this.cameraFrameManager.setupCamera(e,t,r)}_getCharacterMinMax(){let e=Number.POSITIVE_INFINITY,t=Number.NEGATIVE_INFINITY;return this.characterManager.characterModel.traverse(r=>{r.geometry&&(r.geometry.computeBoundingBox(),r.geometry.boundingBox&&(r.geometry.boundingBox.applyMatrix4(r.matrixWorld),r.geometry.boundingBox.min.yt&&(t=r.geometry.boundingBox.max.y)))}),{minY:e,maxY:t}}_getBoneWorldPosition(e,t=void 0){const r=this.cameraFrameManager._getFirstBoneWithName(e,t);return r!=null?new $().setFromMatrixPosition(r.matrixWorld):(console.warn(`Bone with name '${e}' not found in one of the skinned meshes.`),new $(0,0,0))}setBackground(e){if(Array.isArray(e)){const t=e[3]==null?1:e[3];this.setBackgroundColor(e[0],e[1],e[2],t)}else this.setBackgroundImage(e)}setBackgroundColor(e,t,r,i){const s=new He(e,t,r,i);this.sceneBackground=s,i==null&&(i=1),i>1&&(i=1),i<0&&(i=0),this.sceneBackgroundAlpha=i,this.backgroundMaterial.color=s,this.usesBackgroundImage=!1}setBackgroundImage(e){return new Promise(async(t,r)=>{try{const i=await this.texureLoader.load(e);i&&(i.wrapS=i.wrapT=Qs,this.sceneBackground=i,this.usesBackgroundImage=!0,this.sceneBackgroundAlpha=1,t())}catch(i){console.error("Error loading background image: ",i),r(i)}})}_setBackground(){if(this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1)if(this.sceneBackgroundAlpha==0)this.scene.background=null;else{this.scene.background=null,this.scene.add(this.backgroundPlane),this.backgroundPlane.position.copy(this.camera.position);var e=new $(0,0,-1);e.applyQuaternion(this.camera.quaternion);var t=100;this.backgroundPlane.position.addScaledVector(e,t),this.backgroundPlane.lookAt(this.camera.position)}else this.scene.background=this.sceneBackground}_restoreBackground(){this.scene.background=null,this.usesBackgroundImage==!1&&this.sceneBackgroundAlpha!=1&&this.scene.remove(this.backgroundPlane)}getImageData(e,t,r=null){return this._createImage(e,t,r).split("base64,")[1]}_createImage(e,t,r=null){const i=e/t;typeof r=="number"&&this.pixelRenderer.setPixelSize(r),this.renderer.setSize(e,t),this.pixelRenderer.setSize(e,t);const s="image/png";this.camera.aspect=i,this.camera.updateProjectionMatrix();const o=typeof r=="number"?this.pixelRenderer:this.renderer;try{this._setBackground(),o.render(this.scene,this.camera);let a=o.domElement.toDataURL(s);return this._restoreBackground(),a}catch(a){return console.error(a),null}}savePixelScreenshot(e,t,r,i){this.pixelRenderer.setPixelSize(i),this.pixelRenderer.setSize(t,r);const s=this._createImage(t,r,!0),o="image/octet-stream",a="image/png";this.saveFile(s.replace(a,o),e+".png")}saveScreenshot(e,t,r){const i=this._createImage(t,r),s="image/octet-stream",o="image/png";this.saveFile(i.replace(o,s),e+".png")}getScreenshotImage(e,t){const r=this._createImage(e,t),i=new Image;return i.src=r,i}getScreenshotTexture(e,t){const r=this.getScreenshotImage(e,t),i=new Hn(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=s8.Buffer.from(r.replace(/^data:image\/\w+;base64,/,""),"base64");return new Blob([i],{type:"image/jpeg"})}saveFile(e,t){const r=document.createElement("a");typeof r.download=="string"?(document.body.appendChild(r),r.download=t,r.href=e,r.click(),document.body.removeChild(r)):window.open(e,"_blank").document.write(""+t+"")}}const Lge=2;class Dge{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new Qz,this.closeTime=e,this.openTime=t,this.continuity=r,this.randomness=i,this._eyeOpen=1,this._blinkCounter=0,this.isTakingScreenShot=!1,this.update()}addVRM(e){this.vrmBlinkers.push(e)}removeVRM(e){const t=this.vrmBlinkers.indexOf(e);t!==-1&&this.vrmBlinkers.splice(t,1)}enableScreenshot(){this.isTakingScreenShot=!0,this._eyeOpen=Lge,this._updateBlinkers()}disableScreenshot(){this.isTakingScreenShot=!1}update(){setInterval(()=>{if(this.isTakingScreenShot)return;const e=this.clock.getDelta();switch(this.mode){case"closing":this._eyeOpen>0?this._eyeOpen-=e/this.closeTime:(this._eyeOpen=0,this.mode="open"),this._updateBlinkers();break;case"open":this._eyeOpen<1?this._eyeOpen+=e/this.openTime:(this._eyeOpen=1,this.mode="ready"),this._updateBlinkers();break;case"ready":this._blinkCounter+=e,this._blinkCounter>=this.continuity&&(Math.floor(Math.random()*this.randomness)===0&&(this.mode="closing"),this._blinkCounter=0);break}},1e3/30)}_updateBlinkers(){this.vrmBlinkers.forEach(e=>{e.expressionManager.setValue(ni.Blink,1-this._eyeOpen),e.expressionManager.update()})}}function YG(){return(YG=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;f%8&&(f+=8-f%8);let h=[],d=new DataView(new ArrayBuffer(24*n.levels.length)),m=(f||u+s.byteLength)+t.byteLength;for(let v=0;v0?f:0),!0),p.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(im([new Uint8Array(ei).buffer,g,d.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...h]))}var vT,yT,Gge={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},wT=new OffscreenCanvas(128,128),HO=wT.getContext("2d",{willReadFrequently:!0}),$G=typeof document>"u";function Vge(n){return createImageBitmap(n).then(function(e){return wT.width=e.width,wT.height=e.height,HO.drawImage(e,0,0),HO.getImageData(0,0,e.width,e.height)})}function jge(n,e){return e===void 0&&(e={}),Kge().then(function(t){var r=new t.BasisEncoder;return Wge(e,r),r.setTexType(vT.cBASISTexType2D),Oge(n,ArrayBuffer)&&(n=new Blob([n])),Vge(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,yT.RAW);var s=new Uint8Array(10485760),o=r.encode(s);if(o===0)throw"encode failed";var a=new Uint8Array(s.buffer,0,o),l=Hge(s);if(e.kvData){for(var c in e.kvData)l.keyValue[c]=e.kvData[c];a=zge(l,{keepWriter:!0})}return a})})}function Wge(n,e){n===void 0&&(n={}),(n=Nge({},Gge,n)).enableDebug!==void 0&&e.setDebug(n.enableDebug),n.isUASTC!==void 0&&e.setUASTC(n.isUASTC),n.isKTX2File!==void 0&&e.setCreateKTX2File(n.isKTX2File),n.isSetKTX2SRGBTransferFunc!==void 0&&e.setKTX2SRGBTransferFunc(n.isSetKTX2SRGBTransferFunc),n.generateMipmap!==void 0&&e.setMipGen(n.generateMipmap),n.isYFlip!==void 0&&e.setYFlip(n.isYFlip),n.qualityLevel!==void 0&&e.setQualityLevel(n.qualityLevel),n.compressionLevel!==void 0&&e.setCompressionLevel(n.compressionLevel),n.needSupercompression!==void 0&&e.setKTX2UASTCSupercompression(n.needSupercompression),n.isNormalMap!==void 0&&e.setNormalMap(n.isNormalMap)}var $B=null;function Kge(){return $B||($B=new Promise(function(n,e){$G?(importScripts("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js"),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()}).then(function(t){BASIS({wasmBinary:t}).then(function(r){r.initializeBasis(),n(r)}).catch(e)}).catch(e)):Promise.all([fetch("https://mdn.alipayobjects.com/rms/afts/file/A*SrRkQarYYl4AAAAAAAAAAAAAARQnAQ/basis_encoder.js").then(function(t){return t.text()}),fetch("https://mdn.alipayobjects.com/rms/afts/file/A*qFWbTrA0hZYAAAAAAAAAAAAAARQnAQ/basis_encoder.wasm").then(function(t){return t.arrayBuffer()})]).then(function(t){var r=t[0],i=t[1],s=document.createElement("script");s.onload=function(){BASIS({wasmBinary:i}).then(function(o){o.initializeBasis(),n(o)}).catch(e)},s.src=URL.createObjectURL(new Blob([r])),s.onerror=e,document.body.appendChild(s)}).catch(e)})),$B}$G&&self.addEventListener("message",function(n){jge(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class Xge{constructor(e,t){if(this.gl=e,this.libktx=null,e!==void 0)if(t===void 0&&LIBKTX!==void 0&&(t=LIBKTX),t!==void 0)this.initializied=this.init(e,t);else{console.error("Failed to initalize KTXDecoder: ktx library undefined");return}else{console.error("Failed to initalize KTXDecoder: WebGL context undefined");return}}async init(e,t){this.libktx=await t({preinitializedWebGLContext:e}),this.libktx.GL.makeContextCurrent(this.libktx.GL.createContext(e.canvas,{majorVersion:2}))}stringToUastcFlags(e){return e==="FASTER"?this.libktx.UastcFlags.LEVEL_FASTER.value:e==="FASTEST"?this.libktx.UastcFlags.LEVEL_FASTEST.value:e==="SLOWER"?this.libktx.UastcFlags.LEVEL_SLOWER.value:e==="SLOWEST"?this.libktx.UastcFlags.LEVEL_VERYSLOW.value:this.libktx.UastcFlags.LEVEL_DEFAULT.value}stringToSupercmpScheme(e){return e==="Zstd"?this.libktx.SupercmpScheme.ZSTD:e==="Zlib"?this.libktx.SupercmpScheme.ZLIB:e==="BasisLZ"?this.libktx.SupercmpScheme.BASIS_LZ:this.libktx.SupercmpScheme.NONE}transcodeRGBA(e){if(!e.needsTranscoding)return;const t=this.libktx.TranscodeTarget.RGBA8888;e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}transcode(e){if(e.gpuFormat="RGBA8888",e.needsTranscoding){let t,r=!1,i=!1,s=!1,o=!1,a=!1;r=!!this.gl.getExtension("WEBGL_compressed_texture_astc"),i=!!this.gl.getExtension("WEBGL_compressed_texture_etc1"),s=!!this.gl.getExtension("WEBGL_compressed_texture_s3tc"),o=!!this.gl.getExtension("EXT_texture_compression_bptc"),a=!!this.gl.getExtension("WEBGL_compressed_texture_pvrtc")||!!this.gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),r?(t=this.libktx.TranscodeTarget.ASTC_4x4_RGBA,e.gpuFormat="ASTC_4x4_RGBA"):o?(t=this.libktx.TranscodeTarget.BC7_RGBA,e.gpuFormat="BC7_RGBA"):s?(t=this.libktx.TranscodeTarget.BC1_OR_3,e.gpuFormat="BC1_OR_3"):a?(t=this.libktx.TranscodeTarget.PVRTC1_4_RGBA,e.gpuFormat="PVRTC1_4_RGBA"):i?(t=this.libktx.TranscodeTarget.ETC,e.gpuFormat="ETC"):(t=this.libktx.TranscodeTarget.RGBA8888,e.gpuFormat="RGBA8888"),e.transcodeBasis(t,0)!=this.libktx.ErrorCode.SUCCESS&&console.warn("Texture transcode failed. See console for details.")}}async loadKtxFromUri(e){await this.initializied;const t=await fetch(e),r=new Uint8Array(await t.arrayBuffer()),i=new this.libktx.ktxTexture(r);this.transcode(i);let s=i.glUpload();if(s.texture==null){console.error("Could not load KTX data");return}return s.texture.levels=Math.log2(i.baseWidth),s.texture.width=i.baseWidth,s.texture.height=i.baseHeight,s.texture.gpuSize=i.dataSize,s.texture.gpuFormat=i.gpuFormat,s.texture.isSRGB=i.isSRGB,s.texture}async loadKtxFromBuffer(e){await this.initializied;const t=new this.libktx.ktxTexture(e);this.transcode(t);const r=t.glUpload();if(r.texture==null){console.error("Could not load KTX data");return}return r.texture.levels=Math.log2(t.baseWidth),r.texture.width=t.baseWidth,r.texture.height=t.baseHeight,r.texture.gpuSize=t.dataSize,r.texture.gpuFormat=t.gpuFormat,r.texture.isSRGB=t.isSRGB,r.texture}async compress(e,t,r,i,s={}){const o=new this.libktx.ktxTexture(e,t,r,i,s.srgb);if(!s.hasOwnProperty("basisu_options")){const c=new this.libktx.ktxBasisParams;c.uastc=!1,c.noSSE=!0,c.verbose=!1,c.qualityLevel=100,c.compressionLevel=2,s.basisu_options=c}s.hasOwnProperty("compression_level")||(s.compression_level=18),s.hasOwnProperty("supercmp_scheme")||(s.supercmp_scheme=this.libktx.SupercmpScheme.NONE),console.log(s);const a=o.compressBasisU(s.basisu_options,s.supercmp_scheme,s.compression_level);return Uint8ClampedArray.from(a)}}class Yge{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new Xge(t,window.LIBKTX);await r.init(t,window.LIBKTX),this.ktxEncoder=r,this.libktx=r.libktx}async compress(e,t,r,i,s={}){const o=await new this.libktx.ktxBasisParams,a=s;return o.uastc=a.uastc!==void 0?a.uastc:!1,o.noSSE=a.noSSE!==void 0?a.noSSE:!1,o.verbose=a.verbose!==void 0?a.verbose:!1,o.normalMap=a.normalMap!==void 0?a.normalMap:!1,o.compressionLevel=a.compressionLevel!==void 0?a.compressionLevel:1,o.qualityLevel=a.qualityLevel!==void 0?a.qualityLevel:60,o.maxEndpoints=a.ETC1SmaxEndpoints!==void 0?a.ETC1SmaxEndpoints:0,o.endpointRDOThreshold=a.ETC1SEndpointRdoThreshold!==void 0?a.ETC1SEndpointRdoThreshold:1.25,o.maxSelectors=a.ETC1SMaxSelectors!==void 0?a.ETC1SMaxSelectors:0,o.selectorRDOThreshold=a.ETC1SSelectorRdoThreshold!==void 0?a.ETC1SSelectorRdoThreshold:1.25,o.noEndpointRDO=a.ETC1SNoEndpointRdo!==void 0?a.ETC1SNoEndpointRdo:!1,o.noSelectorRDO=a.ETC1SNoSelectorRdo!==void 0?a.ETC1SNoSelectorRdo:!1,o.uastcFlags=this.ktxEncoder.stringToUastcFlags(a.uastcFlags),o.uastcRDO=o.uastcRDO!==void 0?o.uastcRDO:!1,o.uastcRDOQualityScalar=a.uastcRDOQualityScalar!==void 0?a.uastcRDOQualityScalar:1,o.uastcRDODictSize=a.uastcRDODictSize!==void 0?a.uastcRDOQualityScalar:4096,o.uastcRDOMaxSmoothBlockErrorScale=a.uastcRDOMaxSmoothBlockErrorScale!==void 0?a.uastcRDOMaxSmoothBlockErrorScale:10,o.uastcRDOMaxSmoothBlockStdDev=a.uastcRDOMaxSmoothBlockStdDev!==void 0?a.uastcRDOMaxSmoothBlockStdDev:18,o.uastcRDODontFavorSimplerModes=a.uastcRDODontFavorSimplerModes!==void 0?a.uastcRDODontFavorSimplerModes:!1,s.basisu_options=o,s.hasOwnProperty("supercmp_scheme")?s.supercmp_scheme=this.ktxEncoder.stringToSupercmpScheme(s.supercmp_scheme):s.supercmp_scheme=this.libktx.SupercmpScheme.NONE,await this.ktxEncoder.compress(e,t,r,i,s)}}var qn;(function(n){n[n.ARRAY_BUFFER=34962]="ARRAY_BUFFER",n[n.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",n[n.BYTE=5120]="BYTE",n[n.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",n[n.SHORT=5122]="SHORT",n[n.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",n[n.UNSIGNED_INT=5125]="UNSIGNED_INT",n[n.FLOAT=5126]="FLOAT",n[n.LINEAR=9729]="LINEAR",n[n.REPEAT=10497]="REPEAT"})(qn||(qn={}));const _T="blend_",QO="vrmColliderSphere";function $ge(n){var e;return{title:n.name,version:"v0",author:((e=n.authors)==null?void 0:e.length)>0?n.authors.join(", "):"",reference:n.references!=null?n.references.join(", "):"",contactInformation:n.contactInformation!=null?n.contactInformation:"",otherPermissionUrl:n.otherPermissionUrl,allowedUserName:n.avatarPermission!=null?n.avatarPermission:"",violentUssageName:n.allowExcessivelyViolentUsage?"Allow":"Disallow",sexualUssageName:n.allowExcessivelySexualUsage?"Allow":"Disallow",commercialUssageName:n.commercialUsage=="personalProfit"||n.commercialUsage=="corporation"?"Allow":"Disallow",licenseName:n.copyrightInformation,otherLicenseUrl:n.otherLicenseUrl,metaVersion:"0"}}function Zge(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function qge(n){switch(n){case"happy":return"joy";case"sad":return"sorrow";case"relaxed":return"fun";case"aa":return"a";case"ih":return"i";case"ou":return"u";case"ee":return"e";case"oh":return"o";default:return n}}function Jge(n){if(n.includes("Thumb")){if(n.includes("Metacarpal"))return n.replace("Metacarpal","Proximal");if(n.includes("Proximal"))return n.replace("Proximal","Intermediate")}return n}class e0e{async parse(e,t,r,i,s,o,a){var G;const l=$ge(e.meta),c=Zge(e.humanoid),A=e.materials,u=[],f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(c)if(l){if(!A)throw new Error("materials is undefined or null")}else throw new Error("meta is undefined or null");else throw new Error("humanoid is undefined or null");else throw new Error("avatar is undefined or null");const h=A.filter((j,se,fe)=>fe.findIndex(he=>he.name===j.name.replace(" (Outline)",""))===se).map(j=>j),d=h.map(j=>j.name),m=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(j=>j.map).map(j=>{if(!j.map)throw new Error(j.name+" map is null");return{name:j.name,imageBitmap:j.map.image}}),p=h.filter(j=>j.userData.shadeTexture).map(j=>{if(!j.userData.shadeTexture)throw new Error(j.userData.shadeTexture+" map is null");return{name:j.name+"_shade",imageBitmap:j.userData.shadeTexture.image}}),v=h.filter(j=>j.roughnessMap).map(j=>j.roughnessMap?{name:j.name+"_orm",imageBitmap:j.roughnessMap.image}:null),w=h.filter(j=>j.roughnessMap).map(j=>j.normalMap?{name:j.name+"_normal",imageBitmap:j.normalMap.image}:null),_=[...g,...p,...v,...w].filter(j=>j!==null),x=o0e(_,m,s?"image/ktx2":"image/png"),b=a0e(x),B=l0e(x,s),S=s0e(h,_),I=t.children.filter(j=>j.children.length>0&&j.children[0].type===Di.Bone)[0],M=ZG(I).filter(j=>j.name!==QO),P=M.map(j=>j.name),D=M.map(j=>{const se=j.children.filter(fe=>fe.name!==QO).map(fe=>P.indexOf(fe.name));return{name:j.name,rotation:[j.quaternion.x,j.quaternion.y,j.quaternion.z,j.quaternion.w],scale:[j.scale.x,j.scale.y,j.scale.z],translation:[j.position.x,j.position.y,j.position.z],children:se.length>0?se:void 0}}),T=[],y=t.children.filter(j=>j.type===Di.Group||j.type===Di.SkinnedMesh),E=[];y.forEach((j,se)=>{const fe=j.type===Di.Group?j.children[0]:j,he=fe.geometry.attributes,Be=new Ic(he.position,qn.FLOAT,cn.POSITION,ba.VEC3,fe.name,void 0);E.push(Be);const V=E.length-1,U=he.normal.array,O=new Float32Array(U.length);for(let de=0;dede):[j]).forEach(de=>{if(!de.geometry.index)throw new Error(de.name+" geometry.index is null");E.push(new Ic(de.geometry.index,qn.UNSIGNED_INT,cn.INDEX,ba.SCALAR,fe.name,de.name))}),fe.morphTargetDictionary||(fe.morphTargetDictionary={},fe.morphTargetInfluences=[],fe.geometry.morphAttributes={},fe.updateMorphTargets()),fe.geometry.userData.targetNames=[];const pe=(de,Ie,Le,Ue)=>{const Ye=[],Ae=[];for(let Fe=0;Fe0){const Fe=[...Ye].sort((Re,Oe)=>Re-Oe),Me=[];for(let Re=0;Re({mesh:0,index:he.index,weight:he.weight*100}));if(fe.length>0){let he=!1;for(const Be in ni)if(j===ni[Be]&&j!=="surprised"){u.push({name:j,presetName:qge(j),binds:fe,isBinary:se.isBinary}),he=!0;break}he===!1&&u.push({name:j,presetName:"unknown",binds:fe,isBinary:se.isBinary})}}y.forEach(j=>{const se=j.type===Di.Group?j.children[0]:j,fe=new Float32Array(se.skeleton.boneInverses.map(he=>he.elements).flat());E.push(new Ic(new lt(fe,16),qn.FLOAT,cn.BIND_MATRIX,ba.MAT4,se.name,se.name))}),T.push(...E.map(j=>({componentType:j.valueType,count:j.attribute.count,max:j.max,min:j.min,normalized:!1,type:j.accessorsType})));const R=r0e(y,E,d);y.forEach((j,se)=>{D.push({mesh:se,name:j.name,rotation:[j.quaternion.x,j.quaternion.y,j.quaternion.z,j.quaternion.w],scale:[j.scale.x,j.scale.y,j.scale.z],skin:se,translation:[j.position.x,j.position.y,j.position.z]})});const L=i0e(y,E,P),N={humanBones:[]};c.humanBones.forEach(j=>{P.indexOf(j.node.name)!=-1&&N.humanBones.push({bone:Jge(j.bone),node:P.indexOf(j.node.name),useDefaultValues:!0})});const z={floatProperties:{_DstBlend:.5,_ShadeShift:.5,_ShadeToony:.5,_ShadingGradeRate:.5},keywordMap:{_NORMALMAP:!1,MTOON_OUTLINE_COLOR_FIXED:!0,MTOON_OUTLINE_WIDTH_WORLD:!0},name:"VRMCombinedMat",renderQueue:2e3,shader:"VRM/MToon",tagMap:{RenderType:"Opaque"},textureProperties:{_MainTex:0,_ShadeTexture:0},vectorProperties:{_Color:[1,1,1,1],_EmissionColor:[0,0,0,1],_EmissionMap:[0,0,1,1],_MainTex:[0,0,1,1],_OutlineColor:[0,0,0,1],_OutlineWidthTexture:[0,0,1,1],_ReceiveShadowTexture:[0,0,1,1],_RimColor:[0,0,0,1],_RimTexture:[0,0,1,1],_ShadeColor:[.9,.9,.9,1]}},W={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},H=[];h.forEach(j=>{j.type=="ShaderMaterial"?H.push(Object.assign({},z)):H.push(Object.assign({},W))});const C=l;i.forEach(j=>{for(let se=0;sej.isSkinnedMesh))==null?void 0:G.skeleton)||null;for(let j=0;j{const Be=he.sphere;fe.colliders.push({radius:Be.radius*o,offset:{x:Be.offset[0]*o,y:Be.offset[1]*o,z:Be.offset[2]*o}})}),K.push(fe)}}console.log("COLLIDER GROUPS",K);const F=j=>{for(let se=0;se{var V;const se=F(j.name);if(se===-1){console.warn("Spring bone "+j.name+" was removed during cleanup process. Skipping.");return}const fe=[];j.colliderGroups.forEach(U=>{const O=U.colliders[0];if(O!=null){const X=O.parent,ie=K.findIndex(pe=>pe.name===X.name);ie!=-1&&(fe.includes(ie)||fe.push(ie))}});let he=F((V=j.center)==null?void 0:V.name);he==-1&&console.warn("no center bone for spring bone "+j.name);const Be=j.settings;re.push({bones:[se],center:he,colliderGroups:fe,dragForce:Be.dragForce,gravityDir:{x:Be.gravityDir.x,y:Be.gravityDir.y,z:Be.gravityDir.z},gravityPower:Be.gravityPower,hitRadius:Be.hitRadius,stiffiness:Be.stiffness})});const ce={boneGroups:re,colliderGroups:K};console.log(ce),C.texture=m?x.length-1:void 0;const oe=await Promise.all(_.map(async j=>({buffer:s?await zO(j.imageBitmap):GO(j.imageBitmap),type:cn.IMAGE})));E.forEach((j,se)=>{j.buffer?oe.push({buffer:j.buffer,typeString:"",type:j.type}):j.sparse&&(oe.push({buffer:j.sparse.indices,typeString:"indices",type:j.type,count:j.sparse.count}),oe.push({buffer:j.sparse.values,typeString:"values",type:j.type})),oe.length-1}),m&&oe.push({buffer:s?await zO(m.imageBitmap):GO(m.imageBitmap),type:cn.IMAGE});let ge=0,me=0,ve=0,be=0;const ne=oe.map(j=>{const se={buffer:0,byteLength:j.buffer.byteLength,byteOffset:ge,target:j.type===cn.IMAGE||j.type===cn.BIND_MATRIX||j.typeString==="indices"||j.typeString==="values"?void 0:j.type===cn.INDEX?qn.ELEMENT_ARRAY_BUFFER:qn.ARRAY_BUFFER};return ge+=j.buffer.byteLength,j.type===cn.IMAGE?(x[me++].bufferView=be,be++):E[ve].sparse?(T[ve].sparse==null&&(T[ve].sparse={}),j.typeString==="indices"&&(T[ve].sparse.count=j.count,T[ve].sparse[j.typeString]={bufferView:be,byteOffset:0,componentType:qn.UNSIGNED_INT}),j.typeString==="values"&&(T[ve].sparse[j.typeString]={bufferView:be,byteOffset:0}),j.typeString==="values"&&ve++,be++):(E[ve].bufferIndex=be,T[ve].bufferView=be,ve++,be++),se}),k=c0e(t,D);t0e(C);const ae=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&ae.push("KHR_texture_basisu");for(const j of L){const se=T.filter(fe=>fe.type=="MAT4");for(let fe of se)if(j.joints.length!=fe.count)throw new Error(`The number of joints in the skin is not equal to the number of Accessors of type MAT4. Got ${j.joints.length} when accessors show ${fe.count} This is usually because of a bone count mismatch in your VRMs!`)}const le={accessors:T,asset:f,buffers:[{byteLength:ge}],bufferViews:ne,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new $,lookAtHorizontalInner:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtHorizontalOuter:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtTypeName:"Bone",lookAtVerticalDown:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10},lookAtVerticalUp:{curve:[0,0,0,1,1,1,1,0],xRange:90,yRange:10}},materialProperties:H,humanoid:N,meta:C,secondaryAnimation:ce,specVersion:"0.0"}},extensionsUsed:ae,images:x,materials:S,meshes:R,nodes:D,samplers:b,scenes:k,skins:L,textures:B};console.log("output",le);const Z=new VO(bT(JSON.stringify(le,void 0,2)),"JSON"),J=new VO(Pm(oe.map(j=>j.buffer)),"BIN\0"),ue=Pm([Z.buffer,J.buffer]),Y=Pm([bT("glTF"),xT(2,4),xT(ue.byteLength+12,4)]);a(Pm([Y,ue]))}}function t0e(n){n.title=n.title||"Character",n.version=n.version||"1",n.author=n.author||"Anon",n.contactInformation=n.contactInformation||"",n.reference=n.reference||"",n.allowedUserName=n.allowedUserName||"Everyone",n.violentUssageName=n.violentUssageName||"Disallow",n.sexualUssageName=n.sexualUssageName||"Disallow",n.commercialUssageName=n.commercialUssageName||"Disallow",n.otherPermissionUrl=n.otherPermissionUrl||"",n.licenseName=n.licenseName||"Redistribution_Prohibited",n.otherLicenseUrl=n.otherLicenseUrl||""}function ZG(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>ZG(e)).flat())}const n0e=new Yge;async function zO(n){const e=await createImageBitmap(n),t=document.createElement("canvas");t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.drawImage(e,0,0);const i=r.getImageData(0,0,t.width,t.height),s=new Uint8Array(i.data.buffer);return await n0e.compress(s,t.width,t.height,4,{normalMap:!1,uastc:!1,qualityLevel:50,compressionLevel:2,uastcFlags:"DEFAULT",compressionUASTC_Rdo_Level:18,uastcRDO:!1,uastcRDOQualityScalar:1,uastcRDODictSize:4096,uastcRDOMaxSmoothBlockErrorScale:10,uastcRDOMaxSmoothBlockStdDev:18,uastcRDODontFavorSimplerModes:!1,ETC1SQualityLevel:128,ETC1SmaxEndpoints:0,ETC1SEndpointRdoThreshold:1.25,ETC1SMaxSelectors:0,ETC1SSelectorRdoThreshold:1.25,ETC1SNoEndpointRdo:!1,ETC1SNoSelectorRdo:!1,supercmp_scheme:"Zstd"})}function GO(n){const e=document.createElement("canvas");e.width=n.width,e.height=n.height,e.getContext("2d").drawImage(n,0,0);const t=e.toDataURL("image/png"),r=atob(t.split(",")[1]),i=(4-r.length%4)%4,s=new ArrayBuffer(r.length+i),o=new DataView(s);for(let a=0;a4?c=r[a*n.itemSize+l]:l===0?c=n.getX(a):l===1?c=n.getY(a):l===2?c=n.getZ(a):c=n.getW(a),e===qn.UNSIGNED_SHORT?o.setUint16(i,c,!0):e===qn.UNSIGNED_INT?o.setUint32(i,c,!0):o.setFloat32(i,c,!0),i+=t}return s}class VO{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Pm([xT(r.byteLength,4),bT(this.type),r])}padBuffer(e,t){const r=Math.ceil(e.byteLength/4)*4;if(e.byteLength===r)return e;const i=new ArrayBuffer(r);return new Uint8Array(i).set(new Uint8Array(e)),new Uint8Array(i).fill(t,e.byteLength),i}}const jO=n=>{const e=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],t=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY];for(let r=0;rn.map(r=>{const i=r.type===Di.Group?r.children[0]:r,s=r.type===Di.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(c=>c.meshName===i.name?c.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(cn.SKIN_INDEX),NORMAL:a.indexOf(cn.NORMAL),POSITION:a.indexOf(cn.POSITION),TEXCOORD_0:a.indexOf(cn.UV),WEIGHTS_0:a.indexOf(cn.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(c=>c.type===cn.INDEX&&c.meshName===i.name?c.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(c=>{const A=e.map(h=>h.type===cn.BLEND_NORMAL&&h.meshName===i.name?h.name:null).indexOf(_T+c),u=e.map(h=>h.type===cn.BLEND_POSITION&&h.meshName===i.name?h.name:null).indexOf(_T+c),f={};return u!==-1&&(f.POSITION=u),A!==-1&&(f.NORMAL=A),f}):void 0}})}}),i0e=(n,e,t)=>n.map(r=>{const i=r.type===Di.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===cn.BIND_MATRIX?s.meshName:null).indexOf(i.name),joints:i.skeleton.bones.map(s=>t.indexOf(s.name)).filter(s=>s!==-1),skeleton:t.indexOf(i.skeleton.bones[0].name)}}),s0e=(n,e)=>n.map(t=>{let r,i=null;if(t=t.userData.vrmMaterial?t.userData.vrmMaterial:t,t.type==="ShaderMaterial")i={},i.shadeMultiplyTexture={index:e.map(d=>d.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const h=t;r=h.color?[h.color.r,h.color.g,h.color.b,1]:void 0}let s=-1;t.map?s=e.map(h=>h.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(h=>h.name).indexOf(t.uniforms.map.name));let o=-1;t.roughnessMap&&(o=e.map(h=>h.name).indexOf(t.name+"_orm"));let a=-1;t.normalMap&&(a=e.map(h=>h.name).indexOf(t.name+"_normal"));const l=s>=0?{extensions:{KHR_texture_transform:{offset:[0,0],scale:[1,1]}},index:s,texCoord:0}:void 0,c={baseColorFactor:r,baseColorTexture:l},A=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(A)c.metallicRoughnessTexture=A;else{const h=(()=>{switch(t.type){case zh.MeshStandardMaterial:return t.metalness;case zh.MeshBasicMaterial:return 0;default:return 0}})(),d=(()=>{switch(t.type){case zh.MeshStandardMaterial:return t.roughness;case zh.MeshBasicMaterial:return .9;default:return .9}})();c.metallicFactor=h,c.roughnessFactor=d}const f={alphaCutoff:t.alphaTest>0?t.alphaTest:void 0,alphaMode:t.transparent?"BLEND":t.alphaTest>0?"MASK":"OPAQUE",doubleSided:t.side===2,extensions:t.type==="ShaderMaterial"?{KHR_materials_unlit:{}}:void 0,name:t.name,pbrMetallicRoughness:c};return u&&(f.normalTexture=u),f}),o0e=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),a0e=n=>n.map(()=>({magFilter:qn.LINEAR,minFilter:qn.LINEAR,wrapS:qn.REPEAT,wrapT:qn.REPEAT})),l0e=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),c0e=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===Di.Object3D||r.type===Di.SkinnedMesh||r.type===Di.Group||r.type===Di.Bone).map(r=>t.indexOf(r.name))}]};function A0e(n,e,t){var a,l;const r=[],i=[];for(const c in n)((l=(a=n[c])==null?void 0:a.vrm)==null?void 0:l.meta)!=null&&(n[c].vrm.meta.authors!=null?i.push(n[c].vrm.meta):r.push(n[c].vrm.meta));r.length+i.length==1&&(r.length==1?r[0].title!=null&&(t=r[0].title):i[0].name!=null&&(t=i[0].name)),e!=null&&(e.authors!=null?i.push(e):r.push(e));const s=f0e(r),o=u0e(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function u0e(n,e){let{authors:t=[],otherLicenseUrl:r=[],contactInformation:i=[],references:s=[],allowExcessivelyViolentUsage:o=void 0,allowExcessivelySexualUsage:a=void 0,commercialUsage:l=void 0,copyrightInformation:c="",avatarPermission:A=void 0,otherPermissionUrl:u=[]}=n,f,h,d,m="unnecessary",g,p=[];e.forEach(S=>{t=t.concat(mt(S.authors)),r=r.concat(mt(S.otherLicenseUrl)),i=i.concat(mt(S.contactInformation)),s=s.concat(mt(S.references)),u=u.concat(mt(S.otherPermissionUrl)),S.allowExcessivelyViolentUsage===!1&&(o=!1),S.allowExcessivelySexualUsage===!1&&(a=!1),l=Dl(p0e,l,S.commercialUsage),c=Dl(qG,c,S.copyrightInformation),A=Dl(m0e,A,S.avatarPermission),S.allowAntisocialOrHateUsage===!1&&(f=f=!1),S.allowPoliticalOrReligiousUsage===!1&&(h=h=!1),S.allowRedistribution===!1&&(d=d=!1),S.creditNotation==="required"&&(m="required"),p=p.concat(mt(S.thirdPartyLicenses)),g=Dl(d0e,g,S.modification)});const v=[...new Set(t)].filter(S=>S!=""&&S!=null&&S!="undefined"),w=[...new Set(r)].filter(S=>S!=""&&S!=null&&S!="undefined"),_=[...new Set(i)].filter(S=>S!=""&&S!=null&&S!="undefined"),x=[...new Set(s)].filter(S=>S!=""&&S!=null&&S!="undefined"),b=[...new Set(u)].filter(S=>S!=""&&S!=null&&S!="undefined"),B=[...new Set(p)].filter(S=>S!=""&&S!=null&&S!="undefined");return{authors:v,otherLicenseUrl:w.length==0?"":w.join(", "),contactInformation:_.length==0?"":_.join(", "),references:x,otherPermissionUrl:b.length==0?"":b.join(", "),thirdPartyLicenses:B.length==0?"":B.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:c,avatarPermission:A,allowAntisocialOrHateUsage:f,allowPoliticalOrReligiousUsage:h,allowRedistribution:d,creditNotation:m,modification:g}}function f0e(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,c,A;n.forEach(g=>{e=e.concat(mt(g.author)),t=t.concat(mt(g.contactInformation)),r=r.concat(mt(g.reference)),i=i.concat(mt(g.otherPermissionUrl)),s=s.concat(mt(g.otherLicenseUrl)),o=Dl(g0e,o,g.allowedUsername),a=Dl(qB,a,g.violentUssageName),l=Dl(qB,l,g.sexualUssageName),c=Dl(qB,c,g.commercialUssageName),A=Dl(qG,A,g.licenseName)});const u=[...new Set(e)].filter(g=>g!=""&&g!=null&&g!="undefined"),f=[...new Set(t)].filter(g=>g!=""&&g!=null&&g!="undefined"),h=[...new Set(r)].filter(g=>g!=""&&g!=null&&g!="undefined"),d=[...new Set(i)].filter(g=>g!=""&&g!=null&&g!="undefined"),m=[...new Set(s)].filter(g=>g!=""&&g!=null&&g!="undefined");return{authors:u,otherLicenseUrl:m,contactInformation:f,references:h,allowExcessivelyViolentUsage:a==="Allow",allowExcessivelySexualUsage:l==="Allow",commercialUsage:c==="Allow"?"personalProfit":"personalNonProfit",copyrightInformation:A,avatarPermission:h0e(o),otherPermissionUrl:d}}function h0e(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const d0e={prohibited:0,allowModification:1,allowModificationRedistribution:2},p0e={personalNonProfit:0,personalProfit:1,corporation:2},m0e={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},g0e={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},qB={Disallow:0,Allow:1},qG={Redistribution_Prohibited:0,Other:1,CC_BY_NC_ND:2,CC_BY_ND:3,CC_BY_NC_SA:4,CC_BY_SA:5,CC_BY_NC:6,CC_BY:7,CC0:8};function Dl(n,e,t){return e===void 0?t:t==null||!(t in n)||n[e]{r.userData.origIndexBuffer&&t.push(r.userData.origIndexBuffer)}),e.traverse(r=>{r.userData.origIndexBuffer&&(r.userData.origIndexBuffer=t.shift())}),e}function v0e(n){const e=JG(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=kG(s)),s.isSkinnedMesh){if(s.geometry=s.geometry.clone(),s.skeleton=t,r.push(s),Array.isArray(s.material)){const o=s.material;s.material=new Nd,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new ri;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function y0e(n,e,t){const r=await h2(n,t),i=await eV(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function w0e(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;_0e(n,e,r).then(a=>{nV(a,`${o}.vrm`),i()})})}async function _0e(n,e,t){const r=await h2(n,e,t);return eV(r,e,t)}function h2(n,e,t){const r=JG(n);t.mergeAppliedMorphs=!0;const{createTextureAtlas:i=!0}=t;return i?sge(r,e,t):(console.log("no atlas"),nge(r,e,t))}async function x0e(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await h2(n,t):v0e(n);b0e(s).then(o=>{if(o instanceof ArrayBuffer)nV(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);C0e(a,`${r}.gltf`)}})}function b0e(n){return new Promise(e=>new XR().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function E0e(n){var r,i;const e=[];for(const s in n)if(((i=(r=n[s])==null?void 0:r.vrm)==null?void 0:i.springBoneManager)!=null){const o=n[s].vrm.springBoneManager.joints;for(const a of o)e.some(c=>c.name===a.bone.name)||e.push({name:a.bone.name,settings:a.settings,bone:a.bone,colliderGroups:a.colliderGroups,center:a.center})}const t=[];return e.forEach(s=>{for(const o in Zg)if(s.bone.parent.name==Zg[o]){t.push(s);break}}),t}function B0e(n){const e={};return n.skeleton.bones.map(t=>{for(const r in Zg)if(Zg[r]===t.name){e[t.name]={node:t};break}}),e}function S0e(n,e,t){const r=Od(n,"SkinnedMesh");return{humanBones:B0e(r[0]),materials:n.userData.atlasMaterial,meta:M0e(e),...t.mergeAppliedMorphs?{expressionManager:R0e(n)}:{}}}function M0e(n){return n=n||{},{...{authors:["CharacterStudio"],metaVersion:"1",version:"v1",name:"CharacterCreator",licenseUrl:"https://vrm.dev/licenses/1.0/",commercialUssageName:"personalNonProfit",contactInformation:"https://m3org.com/",allowExcessivelyViolentUsage:!1,allowExcessivelySexualUsage:!1,allowPoliticalOrReligiousUsage:!1,allowAntisocialOrHateUsage:!1,creditNotation:"required",allowRedistribution:!1,modification:"prohibited"},...n}}function eV(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=A0e(e,s,a);return new Promise(async c=>{const A=i?new e0e:new ype,u={...I0e(e),...S0e(n,l,t)};let f;n.traverse(m=>{m.isSkinnedMesh&&(f=m)}),(()=>{for(let m=0;m{m.updateMatrix(),m.updateMatrixWorld()}),f.skeleton.calculateInverses(),f.skeleton.computeBoneTexture(),f.skeleton.update()})(),f.skeleton.bones.filter(m=>m.name==="head")[0];const d=E0e(e);A.parse(u,n,r,d,t.ktxCompression,o,m=>{c(m)})})}function tV(n,e){const t=document.createElement("a");t.style.display="none",document.body.appendChild(t),t.href=URL.createObjectURL(n),t.download=e,t.click()}function C0e(n,e){tV(new Blob([n],{type:"text/plain"}),e)}function nV(n,e){tV(T0e(n),e)}function T0e(n){return new Blob([n],{type:"application/octet-stream"})}function I0e(n){for(const e in n)if(n[e].vrm)return n[e].vrm}function R0e(n){const e=new Y_;let t=n.userData.expressionManagerToClone;if(!t){t=new Y_;for(const r of Object.values(ni)){const i=new X_(r);t.registerExpression(i)}}e.copy(t),n.userData.expressionManagerToClone=null;for(const r of n.children){if(!r.isMesh&&!r.isSkinnedMesh||!r.morphTargetDictionary)continue;const i=r.userData.bindMorphs;if(!i||!mge(r,i.old))continue;const o=(c,A)=>{var u;return((u=c.find(f=>f.index==A))==null?void 0:u.weight)||0},a=Object.entries(ni).flat(),l=Object.keys(i.old).filter(c=>a.includes(c));for(const c of Object.keys(t.expressionMap)){const A=t.expressionMap[c];if(!A)continue;const u=A._binds;if(!u||u.length==0){e.unregisterExpression(A);continue}for(const f of l){const h=i.new[f]||i.new[f.toLowerCase()],d=i.old[f]||i.old[f.toLowerCase()];if(h){const m=[];n.traverse(v=>{!v.isMesh&&!v.isSkinnedMesh||h.primitives.includes(v.id)&&m.push(v)}),e.unregisterExpression(A),A._binds=[];const g=o(u,d.index),p=new X_(A.expressionName);p.copy(A),console.log("adding bind",A.expressionName),p.addBind(new JC({index:h.index,weight:g,primitives:m})),e.registerExpression(p)}else e.unregisterExpression(A)}}}return e}const U0e=n=>{const t=n.parser.json.meshes,r=n.parser.associations;n.scene.traverse(i=>{var s;if(i instanceof ja&&i.morphTargetDictionary){let o=!1;const a=r.get(i);if(typeof a>"u")return;const l=a.meshes||0,c=a.primitives||0,A=t[l],u=A==null?void 0:A.primitives[c];if((s=u==null?void 0:u.extras)!=null&&s.targetNames){const f=u.extras.targetNames;for(let h=0;h{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?P0e(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?L0e(n):console.warn("No valid vrm file was provided")},P0e=n=>{var a,l,c;const e=n.parser.json,t=n.scene,r=e.nodes,i=(c=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:c.colliderGroups,s=[],o=r.map(A=>rV(A.name,s));i!=null&&i.forEach(A=>{const u=o[A.node],f=WG(t,u);if(f!=null){const h=A.colliders;f.userData.VRMcolliders=h.map(d=>({sphere:{radius:d.radius,offset:[d.offset.x,d.offset.y,d.offset.z]}}))}f.userData.VRMcollidersID=VG()})},L0e=n=>{var l,c,A,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(c=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:c.colliderGroups,s=(u=(A=e.extensions)==null?void 0:A.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(f=>rV(f.name,o));i!=null&&i.forEach(f=>{const h=mt(f.colliders);let d=-1,m=null;h.forEach(g=>{if(d!=s[g].node){d=s[g].node;const p=a[d];m=WG(t,p),m.userData.VRMcolliders=[]}if(m!=null){const p=s[g].shape;for(const v in p){const w=p[v];w!=null&&w.offset&&(w.offset[0]=-w.offset[0])}m.userData.VRMcollidersID=VG(),m.userData.VRMcolliders.push(p)}else console.error("no node with name "+a[d]+" was found")})})},rV=(n,e)=>{const t=Mt.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},nx=[0,400,560,2400,4800],rx=[0,500,700,3e3,6e3],ET=[],Sl=[],d2=1024,iV=44100;for(let n=0;n{requestAnimationFrame(t),this.update(r,i)};t()}start(e){this.audioContext=new AudioContext,this.mediaStreamSource=this.audioContext.createMediaStreamSource(e),this.meter=ix.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter)}startFromAudioFile(e){this.audioContext||(this.audioContext=new AudioContext),this.userSpeechAnalyzer||(this.userSpeechAnalyzer=this.audioContext.createAnalyser()),this.userSpeechAnalyzer.smoothingTimeConstant=.5,this.userSpeechAnalyzer.fftSize=d2,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=ix.createAudioMeter(this.audioContext),this.mediaStreamSource.connect(this.meter),this.mediaStreamSource.connect(this.audioContext.destination),this.mediaStreamSource.start(),this.mediaStreamSource.connect(this.userSpeechAnalyzer)})}destroy(){var e,t,r;return(e=this.meter)==null||e.shutdown(),this.meter=null,(t=this.mediaStreamSource)==null||t.disconnect(),((r=this.audioContext)==null?void 0:r.close().catch(()=>{}))||Promise.resolve()}update(e){if(this.meter){const{volume:t}=this.meter;if(t<.01)this.vrm.expressionManager.setValue(ni.Oh,0),this.vrm.expressionManager.setValue(ni.Ah,0),this.vrm.expressionManager.setValue(ni.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(ni.Oh,i),this.vrm.expressionManager.setValue(ni.Ah,r),this.vrm.expressionManager.setValue(ni.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(c){const u=new Float32Array(c.length);for(let f=0;f0&&(i[c]+=r[A]);i[c]/=Sl[c+1]-Sl[c]}for(let c=0;c0&&(s[c]+=r[A]);i[c]/=Sl[c+1]-Sl[c],s[c]=s[c]/(ET[c+1]-ET[c])}const o=Math.max(s[1],i[1])>.2?1-2*Math.max(i[2],s[2]):(1-2*Math.max(i[2],s[2]))*5*Math.max(i[1],s[1]),a=3*Math.max(i[3],s[3]),l=.8*(Math.max(i[1],s[1])-Math.max(i[3],s[3]));return{oh:o,ee:l,ah:a}}static createAudioMeter(e){const t=e.createScriptProcessor(512);return t.onaudioprocess=r=>{const i=r.inputBuffer.getChannelData(0),s=i.length;let o=0,a;for(let c=0;c=t.clipLevel&&(t.clipping=!0,t.lastClip=window.performance.now()),o+=a*a;const l=Math.sqrt(o/s);t.volume=Math.max(l,t.volume*t.averaging)},t.clipping=!1,t.lastClip=0,t.volume=0,t.clipLevel=.98,t.averaging=.95,t.clipLag=750,t.connect(e.destination),t.checkClipping=()=>t.clipping?(t.lastClip+t.clipLag{t.disconnect(),t.onaudioprocess=null},t}}const JB=new $;class D0e{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new je,this.hotzoneSection=s(),this.enabled=!1,this.userActivated=!1,this.lookInterest=1,this.hasInterest=!0,this.interestSpeed=.3,this.onCanvas=!0,this.camera=r,this.maxLookPercent={neck:{maxy:15,miny:10,maxx:30,minx:10},spine:{maxy:0,miny:0,maxx:30,minx:10},left:{maxy:15,miny:20,maxx:35,minx:35},right:{maxy:15,miny:20,maxx:35,minx:35}},window.addEventListener("mousemove",o=>{this.curMousePos={x:o.clientX,y:o.clientY}});const i=document.getElementById(t);i&&(i.addEventListener("mouseleave",()=>{this.onCanvas=!1}),i.addEventListener("mouseenter",()=>{this.onCanvas=!0})),window.addEventListener("resize",()=>{this.hotzoneSection=s()});function s(){const o=window.innerWidth*e/100,a=(window.innerWidth-o)/2;return{xStart:a,xEnd:window.innerWidth-a,yStart:50,yEnd:window.innerHeight-80}}}setActive(e){console.log("is activating"),this.userActivated=e}setCamera(e){this.camera=e}addVRM(e){const t=e.data.isVRM0||!1,r=e.humanoid.humanBones;t||(r.neck.node.userData.inverseLookAt=!0,r.spine.node.userData.inverseLookAt=!0,r.leftEye&&(r.leftEye.node.userData.inverseLookAt=!0),r.rightEye&&(r.rightEye.node.userData.inverseLookAt=!0));const i={vrm:e,neckBone:r.neck.node,spineBone:r.spine.node,leftEyeBone:r.leftEye?r.leftEye.node:null,rightEyeBone:r.rightEye?r.rightEye.node:null};this.bonesInfo.push(i)}removeVRM(e){const t=this.bonesInfo.find(r=>r.vrm===e);if(t){const r=this.bonesInfo.indexOf(t);this.bonesInfo.splice(r,1)}}_getMouseDegrees(e,t,r){let i=0,s=0,o,a,l,c,A={x:window.innerWidth,y:window.innerHeight};return e<=A.x/2&&(o=A.x/2-e,a=o/(A.x/2)*100,i=r.maxx*a/100*-1),e>=A.x/2&&(o=e-A.x/2,a=o/(A.x/2)*100,i=r.minx*a/100),t<=A.y/2&&(l=A.y/2-t,c=l/(A.y/2)*100,s=r.maxy*.5*c/100*-1),t>=A.y/2&&(l=t-A.y/2,c=l/(A.y/2)*100,s=r.miny*c/100),{x:i,y:s}}lerp(e,t,r){return(1-r)*e+r*t}_moveJoint(e,t){const r=e.userData.inverseLookAt===!0?1:-1;if(Object.keys(e).length!==0){const i=(this.camera.position.y-1.8)*window.innerHeight/2;let s=this._getMouseDegrees(this.curMousePos.x,this.curMousePos.y-i,t);const o=.8;e.rotation.y=this.lerp(Et.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Et.degToRad(s.y*r),e.rotation.x,o)}}update(){JB.set(0,0,1),JB.applyQuaternion(this.camera.quaternion);const e=JB.z>0;this.curMousePos.x>this.hotzoneSection.xStart&&this.curMousePos.xthis.hotzoneSection.yStart&&this.curMousePos.y{this._moveJoint(t.neckBone,this.maxLookPercent.neck),this._moveJoint(t.spineBone,this.maxLookPercent.spine),this._moveJoint(t.leftEyeBone,this.maxLookPercent.left),this._moveJoint(t.rightEyeBone,this.maxLookPercent.right)})}}class eS{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:c,requiredTraits:A,randomTraits:u,colliderTraits:f,lipSyncTraits:h,blinkerTraits:d,typeRestrictions:m,defaultCullingLayer:g,defaultCullingDistance:p,offset:v,vrmMeta:w,traits:_,textureCollections:x,colorCollections:b,canDownload:B=!0,downloadOptions:S={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=mt(o),this.requiredTraits=mt(A),this.randomTraits=mt(u),this.initialTraits=c||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=mt(f),this.lipSyncTraits=mt(h),this.blinkerTraits=mt(d),this.typeRestrictions=m,this.defaultCullingLayer=g,this.defaultCullingDistance=p,this.offset=v,this.canDownload=B,this.downloadOptions=S;const I=()=>{const D=[];for(const T in _)D.push(_[T].trait);return D};this.allTraits=I(),I(),(()=>{if(this.typeRestrictions)for(const D in this.typeRestrictions)mt(this.typeRestrictions[D]).forEach(y=>{this.typeRestrictions[y]==null&&(this.typeRestrictions[y]=[]),this.typeRestrictions[y].indexOf(D)==-1&&this.typeRestrictions[y].push(D)})})(),(()=>{S.vrmMeta=S.vrmMeta||w,S.scale=S.scale||a||1,S.mToonAtlasSize=S.mToonAtlasSize||2048,S.mToonAtlasSizeTransp=S.mToonAtlasSizeTransp||1024,S.stdAtlasSize=S.stdAtlasSize||2048,S.stdAtlasSizeTransp=S.stdAtlasSizeTransp||1024,S.exportStdAtlas=S.exportStdAtlas||!1,S.exportMtoonAtlas=S.exportMtoonAtlas||!0,S.screenshotFaceDistance=S.screenshotFaceDistance||1,S.screenshotFaceOffset=S.screenshotFaceOffset||[0,0,0],S.screenshotResolution=S.screenshotResolution||[512,512],S.screenshotBackground=S.screenshotBackground||[.1,.1,.1],S.screenshotFOV=S.screenshotFOV||75,!S.exportStdAtlas&&!S.exportMtoonAtlas&&(S.exportMtoonAtlas=!0)})(),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(x),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(b),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(_)}appendManifestData(e,t){e.textureTraits.forEach(r=>{const i=this.getTextureGroup(r.trait);i!=null?i.appendCollection(r,t):(this.textureTraits.push(r),this.textureTraitsMap.set(r.trait,r))}),e.colorTraits.forEach(r=>{const i=this.getColorGroup(r.trait);i!=null?i.appendCollection(r,t):(this.colorTraits.push(r),this.colorTraitsMap.set(r.trait,r))}),e.modelTraits.forEach(r=>{const i=this.getModelGroup(r.trait);i!=null?i.appendCollection(r,t):(this.modelTraits.push(r),this.modelTraitsMap.set(r.trait,r))}),console.log(e)}getExportOptions(){return this.downloadOptions}getGroupModelTraits(){return this.modelTraits}getInitialTraits(){return this.getRandomTraits(this.initialTraits)}getAllTraits(){return this.getRandomTraits(this.allTraits)}getAllBlendShapeTraits(){return this.modelTraits.map(e=>e.getCollection()).flat().map(e=>e.blendshapeTraits).flat().map(e=>e==null?void 0:e.collection).flat().filter(e=>!!e)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=mt(t);const i=[];return r.forEach(s=>{if(t.indexOf(s.trait_type)==-1){const o=this.getTraitOption(s.trait_type,s.value);o&&i.push(o)}}),i}else return console.warn("No attiributes parameter was found in ",e),null}getRandomTraits(e){const t=[];return(e||this.randomTraits).forEach(i=>{const s=this.getRandomTrait(i);s&&t.push(s)}),this._filterTraitOptions(t)}getRandomTrait(e){var r,i;const t=this.getModelGroup(e);if(t){const s=t.getRandomTrait();if(s){const o=(r=s.targetTextureCollection)==null?void 0:r.getRandomTrait(),a=(i=s.targetColorCollection)==null?void 0:i.getRandomTrait();return new tS(s,o,a)}else return null}else return console.warn("No trait group with name "+e+" was found."),null}async _fetchJson(e){return await(await fetch(e)).json()}getTraitOption(e,t){var i,s;const r=this.getModelTrait(e,t);if(r){const o=(i=r.targetTextureCollection)==null?void 0:i.getRandomTrait(),a=(s=r.targetColorCollection)==null?void 0:s.getRandomTrait();return new tS(r,o,a)}return null}_filterTraitOptions(e){const t=[],r=[];for(let i=0;i0&&console.log("options were filtered to fullfill restrictions: ",r),t}getCustomTraitOption(e,t){const r=this.getCustomModelTrait(e,t);return r?new tS(r,null,null):null}getCustomModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getCustomTrait(t)}getModelTrait(e,t){var r;return(r=this.getModelGroup(e))==null?void 0:r.getTrait(t)}getModelTraits(e){const t=this.getModelGroup(e);return t?t.getCollection():(console.warn("No model group with name "+e),null)}getModelGroup(e){return this.modelTraitsMap.get(e)}getTextureTrait(e,t){var r;return(r=this.getTextureGroup(e))==null?void 0:r.getTrait(t)}getTextureGroup(e){return this.textureTraitsMap.get(e)}getColorTrait(e,t){var r;return(r=this.getColorGroup(e))==null?void 0:r.getTrait(t)}getColorGroup(e){return this.colorTraitsMap.get(e)}getTraitsDirectory(){let e=(this.assetsLocation||"")+(this.traitsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getThumbnailsDirectory(){let e=(this.assetsLocation||"")+(this.thumbnailsDirectory||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getTraitIconsDirectorySvg(){let e=(this.assetsLocation||"")+(this.traitIconsDirectorySvg||"");return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}getAssetsDirectory(){let e=this.assetsLocation||"";return!e.endsWith("/")&&!e.endsWith("\\")&&(e+="/"),e}createModelTraits(e,t=!1){t&&(this.modelTraits=[]),mt(e).forEach(r=>{this.modelTraits.push(new N0e(this,r))}),this.modelTraitsMap=new Map(this.modelTraits.map(r=>[r.trait,r])),this.modelTraits.forEach(r=>{r.restrictedTraits.forEach(i=>{const s=this.getModelGroup(i);console.log(s),s&&s.addTraitRestriction(r.trait)})})}createTextureTraits(e,t=!1){t&&(this.textureTraits=[]),mt(e).forEach(r=>{this.textureTraits.push(new O0e(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),mt(e).forEach(r=>{this.colorTraits.push(new k0e(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class N0e{constructor(e,t){const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:c,restrictedTraits:A=[],restrictedTypes:u=[]}=t;this.manifestData=e,this.isRequired=e.requiredTraits.indexOf(r)!==-1,this.trait=r,this.name=i,this.iconSvg=s,this.fullIconSvg=e.getTraitIconsDirectorySvg()+s,this.restrictedTraits=A,this.restrictedTypes=u,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(c)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Model with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Model with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}addTraitRestriction(e){this.restrictedTraits.indexOf(e)==-1&&this.restrictedTraits.push(e)}createCollection(e,t=!1){t&&(this.collection=[]),mt(e).forEach(r=>{this.collection.push(new WO(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new WO(this,{directory:e,fullDirectory:e,id:"_custom",name:"Custom"})}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}getCollection(){return this.collection}}class O0e{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Texture with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Texture with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),mt(e).forEach(r=>{this.collection.push(new z0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class k0e{constructor(e,t){const{trait:r,collection:i}=t;this.manifestData=e,this.trait=r,this.collection=[],this.collectionMap=null,this.createCollection(i)}appendCollection(e,t){e.collection.forEach(r=>{const i=this.getTrait(r.id);if(i!=null)if(t){console.log(`Color with id ${r.id} exists and will be replaced with new one`),this.collectionMap.set(r.id,r);const s=this.collection.indexOf(i);this.collection[s]=r}else console.log(`Color with id ${r.id} exists, skipping`);else this.collection.push(r),this.collectionMap.set(r.id,r)})}createCollection(e,t=!1){t&&(this.collection=[]),mt(e).forEach(r=>{this.collection.push(new G0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class WO{constructor(e,t){jt(this,"blendshapeTraits",[]);jt(this,"blendshapeTraitsMap",new Map);const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:c=[],textureCollection:A,blendshapeTraits:u,colorCollection:f,fullDirectory:h,fullThumbnail:d}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,h)this.fullDirectory=h;else if(Array.isArray(i)){this.fullDirectory=[];for(let m=0;mnew H0e(this,m)),this.blendshapeTraitsMap=new Map(this.blendshapeTraits.map(m=>[m.trait,m])))}isRestricted(e){if(e==null)return!1;const t=e.traitGroup.trait;if(this.traitGroup.restrictedTraits.indexOf(t)!=-1)return!0;if(this.type.length>0&&this.manifestData.restrictedTypes>0){const r=(o,a)=>{if(o==null||a==null)return!1;for(let l=0;lr(i[o],s))}return!1}getGroupBlendShapeTraits(){return this.blendshapeTraits}getBlendShapes(e){var t,r;return(r=(t=this.blendshapeTraitsMap)==null?void 0:t.get(e))==null?void 0:r.collection}getBlendShape(e,t){var r,i;return(i=(r=this.blendshapeTraitsMap)==null?void 0:r.get(e))==null?void 0:i.getTrait(t)}}class H0e{constructor(e,t){jt(this,"trait");jt(this,"name");jt(this,"isBlendShapeGroup",!0);jt(this,"collection",[]);jt(this,"cameraTarget",null);jt(this,"collectionMap",null);const{trait:r,name:i,collection:s,cameraTarget:o=e.traitGroup.cameraTarget||{distance:3,height:1}}=t;this.modelTrait=e,this.trait=r,this.name=i,this.cameraTarget=o,this.createCollection(s)}createCollection(e,t=!1){t&&(this.collection=[]),mt(e).forEach(r=>{this.collection.push(new Q0e(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getTrait(e){return this.collectionMap.get(e)}getTraitByIndex(e){return this.collection[e]}getRandomTrait(){return this.collection.length>0?this.collection[Math.floor(Math.random()*this.collection.length)]:null}}class Q0e{constructor(e,t){jt(this,"id");jt(this,"name");jt(this,"fullThumbnail");jt(this,"isBlendShape",!0);const{id:r,name:i,fullThumbnail:s}=t;r||console.warn("BlendShapeTrait is missing id, parent trait: "+e.trait),i||console.warn("BlendShapeTrait is missing name, parent trait: "+e.trait),this.parentGroup=e,this.id=r,this.fullThumbnail=s,this.name=i}getGroupId(){return this.parentGroup.trait}}class z0e{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{e.traverse(i=>{if(i.isMesh||i.isSkinnedMesh){const s=i;if(!s.morphTargetDictionary||!s.morphTargetInfluences)return;const o=s.morphTargetDictionary[t.id];o!=null&&(s.morphTargetInfluences[o]=r?1:0)}})});this._start(e)}async _start(e){const{parentModel:t=null,renderCamera:r=null,manifestURL:i=null}=e;this.rootModel=new Ft,this.characterModel=new Ft,this.parentModel=t,t&&t.add(this.rootModel),this.lipSync=null,this.lookAtManager=null,this.animationManager=new _ge,this.screenshotManager=new Pge(this,t||this.rootModel),this.blinkManager=new Dge(.1,.1,.5,5),this.rootModel.add(this.characterModel),this.renderCamera=r,this.manifestData=null,this.manifest=null,i&&(this.loadManifest(i),this.animationManager.setScale(this.manifestData.displayScale)),this.avatar={},this.storedAvatar={},this.traitLoadManager=new j0e;const s=new ri;s.renderOrder=1e4,this.rootModel.add(s),this.vrmHelperRoot=s}update(){this.lookAtManager!=null&&this.lookAtManager.update()}addLookAtMouse(e,t,r,i=!0){var s;this.lookAtManager=new D0e(e,t,r),this.lookAtManager.enabled=!0;for(const o in this.avatar)((s=this.avatar[o])==null?void 0:s.vrm)!=null&&this.lookAtManager.addVRM(this.avatar[o].vrm)}toggleCharacterLookAtMouse(e){this.lookAtManager!=null?(this.lookAtManager.setActive(e),this.animationManager&&this.animationManager.enableMouseLook(e)):console.warn("toggleCharacterLookAtMouse() was called, but no lookAtManager exist. Make sure to set it up first with addLookArMous()")}savePortraitScreenshot(e,t,r,i=1,s=0){this.blinkManager.enableScreenshot(),this.characterModel.traverse(o=>{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(wl)}),wl.z+=.3,wl.y+=s,this.screenshotManager.cameraFrameManager.setCamera(wl,i),this.screenshotManager.saveScreenshot(e,t,r),this.blinkManager.disableScreenshot()}cameraRaycastCulling(e,t,r=!0){if(this.renderCamera==null){console.warn("No camera was set in character manager. Please call setRenderCamera(camera) before calling this function");return}const i=()=>{this.characterModel.traverse(c=>{c.isMesh&&c.userData.origIndexBuffer&&(c.userData.clippedIndexGeometry=c.geometry.index.clone(),c.geometry.setIndex(c.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(c=>{c.isMesh&&c.userData.origIndexBuffer&&c.geometry.setIndex(c.userData.clippedIndexGeometry)})},o=(c,A)=>{for(let u=0;u{var m,g;const u=c.object,f=c.face,h=[f.a,f.b,f.c],d=(g=(m=u.userData)==null?void 0:m.clippedIndexGeometry)==null?void 0:g.array;if(d!=null){const p=o(d,h),v=Array.from(d);if(p==-1&&!A){const w=[...v,...h];u.userData.clippedIndexGeometry=new lt(new Uint32Array(w),1,!1)}p!=1&&A&&(v.splice(p,3),u.userData.clippedIndexGeometry=new lt(new Uint32Array(v),1,!1))}};nS.x=e,nS.y=t,i(),KO.setFromCamera(nS,this.renderCamera);const l=KO.intersectObjects(this.characterModel.children);if(l.length>0){const c=l[0];a(c,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new Dw({traitGroupID:t,traitModel:null}));e.forEach(t=>{this._addLoadedData(t)}),this.avatar={}}removeCurrentManifest(){this.removeCurrentCharacter(),this.manifest=null,this.manifestData=null,this.animationManager&&this.animationManager.clearCurrentAnimations()}canDownload(){var e;return((e=this.manifestData)==null?void 0:e.canDownload)||!0}downloadVRM(e,t=null){return new Promise(async(r,i)=>{if(this.canDownload())try{t=t||{};const o={...this.manifestData.getExportOptions(),...t};o.isVrm0=!0,o.screenshot=this._getPortaitScreenshotTexture(!1,o),console.log(o),await w0e(this.characterModel,this.avatar,e,o),r()}catch(s){console.error("Error downloading VRM:",s.message),i(new Error("Failed to download VRM."))}else{const s="Download not supported.";console.error(s),i(new Error(s))}})}downloadGLB(e,t=null){if(console.log("XXX fix glb downloader"),this.canDownload()){t=t||{};const r={...this.manifestData.getExportOptions(),...t};x0e(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getBoneTriangleCount(){let e=0,t=new Set;for(const r in this.avatar)this.avatar[r].model.traverse(i=>{i.isMesh&&(e+=i.geometry.index.array.length),i.isSkinnedMesh&&i.skeleton.bones.forEach(s=>{t.add(s.name)})});return{triangles:e/3,bones:t.size}}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getBlendShapeGroupTraits(e,t){var r;return this.manifestData?(r=this.manifestData.getModelTrait(e,t))==null?void 0:r.getGroupBlendShapeTraits():[]}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentBlendShapeTraitData(e){var t;return((t=this.avatar[e])==null?void 0:t.blendShapeTraitsInfo)||{}}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&this.screenshotManager.setScene(this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(mt(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadBlendShapeTrait(e,t,r){if(!this.avatar[e]){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(!this.manifestData){console.warn("No manifest data was found.");return}try{this._loadBlendShapeTrait(e,t,r)}catch{console.error("Error loading blendshape trait "+e,t,r)}}removeBlendShapeTrait(e,t){this.avatar[e]?this._loadBlendShapeTrait(e,t,null):console.warn(`No trait with name: ${e} was found.`)}loadTrait(e,t,r=!1){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getTraitOption(e,t);o&&(await this._loadTraits(mt(o),r),i())}catch(o){console.error("Error loading specific trait:",o.message),s(new Error("Failed to load specific trait."))}else{const o="No manifest was loaded, specific trait cannot be loaded.";console.error(o),s(new Error(o))}})}loadCustomTrait(e,t){return new Promise(async(r,i)=>{if(this.manifestData)try{const s=this.manifestData.getCustomTraitOption(e,t);s&&(await this._loadTraits(mt(s)),r())}catch(s){console.error("Error loading custom trait:",s.message),i(new Error("Failed to load custom trait."))}else{const s="No manifest was loaded, custom trait cannot be loaded.";console.error(s),i(new Error(s))}})}loadCustomTexture(e,t){return new Promise(async(r,i)=>{var o;const s=(o=this.avatar[e])==null?void 0:o.model;if(s)await cge(s,t),r();else{const a="No Group Trait with name "+e+" was found.";console.warn(a),i(new Error(a))}})}setTraitColor(e,t){var i;const r=(i=this.avatar[e])==null?void 0:i.model;if(r)try{const s=new He(t);r.traverse(o=>{o.isMesh&&(o.material.type==="MeshStandardMaterial"?Array.isArray(o.material)?o.material.forEach(a=>{a.color=s}):o.material.color=s:(o.material[0].uniforms.litFactor.value=s,o.material[0].uniforms.shadeColorFactor.value=new He(s.r*.8,s.g*.8,s.b*.8)))})}catch(s){throw console.error("Error setting trait color:",s.message),new Error("Failed to set trait color.")}else{const s="No Group Trait with name "+e+" was found.";throw console.warn(s),new Error(s)}}removeTrait(e,t=!1){if(this.isTraitGroupRequired(e)&&!t){console.warn(`No trait with name: ${e} is not removable.`);return}if(this.manifestData.getModelGroup(e)){const i=new Dw({traitGroupID:e,traitModel:null});this._addLoadedData(i),XB(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){XB(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new eS(this.manifest)}getCurrentOptimizerCharacterModel(){var e;return(e=this.avatar.CUSTOM)==null?void 0:e.vrm}loadOptimizerCharacter(e){return this.loadCustomTrait("CUSTOM",e)}setManifest(e){return this.removeCurrentCharacter(),new Promise(async(t,r)=>{try{if(this.manifest=e,this.manifest){if(this.manifestData=new eS(this.manifest),this.animationManager)try{await this._animationManagerSetup(this.manifest.animationPath,this.manifest.assetsLocation,this.manifestData.displayScale)}catch(i){console.error("Error loading animations: "+i)}t()}else{const i="Failed to fetch or parse the manifest.";console.error(i),r(new Error(i))}}catch(i){console.error("Error setting manifest:",i.message),r(new Error("Failed to set the manifest."))}})}appendManifest(e,t){return new Promise(async(r,i)=>{try{t?this.manifest={...this.manifest||{},manifest:e}:this.manifest={manifest:e,...this.manifest||{}};const s=new eS(e);this.manifestData.appendManifestData(s),r()}catch(s){console.error("Error setting manifest:",s.message),i(new Error("Failed to set the manifest."))}})}loadManifest(e){return new Promise(async(t,r)=>{try{const i=await this._fetchManifest(e);this.setManifest(i).then(()=>{t()})}catch(i){console.error("Error loading manifest:",i.message),r(new Error("Failed to load the manifest."))}})}loadAppendManifest(e,t){return new Promise(async(r,i)=>{try{const s=await this._fetchManifest(e);this.appendManifest(s,t).then(()=>{r()})}catch(s){console.error("Error loading manifest:",s.message),i(new Error("Failed to load the manifest."))}})}async soloTargetGroupTrait(e){const t=mt(e),r=[];for(const i in this.avatar)t.includes(i)&&r.push(this.manifestData.getTraitOption(i,this.avatar[i].traitInfo.id));await this._loadTraits(r,!0)}storeCurrentAvatar(){this.storedAvatar={...this.avatar}}async loadStoredAvatar(){const e=[];for(const t in this.storedAvatar)e.push(this.manifestData.getTraitOption(t,this.storedAvatar[t].traitInfo.id));console.log(e),this._loadTraits(e,!0)}async _loadTraits(e,t=!1){console.log("laoded traits:",e),await this.traitLoadManager.loadTraitOptions(mt(e)).then(r=>{t&&this.getGroupTraits().forEach(s=>{r.some(a=>{var l;return((l=a.traitModel)==null?void 0:l.traitGroup.trait)===s.trait})||this.avatar[s.trait]!=null&&r.push(new Dw({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),XB(this.avatar)})}async _loadBlendShapeTrait(e,t,r){const i=this.avatar[e];if(!i){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(i.blendShapeTraitsInfo||(i.blendShapeTraitsInfo={}),i.blendShapeTraitsInfo[t]&&this.toggleBinaryBlendShape(i.model,i.blendShapeTraitsInfo[t],!1),r==null){delete this.avatar[e].blendShapeTraitsInfo[t];return}const s=i.traitInfo.getBlendShape(t,r);if(!s){console.warn(`Blendshape with name: ${r} was not found.`);return}this.toggleBinaryBlendShape(i.model,s,!0),this.avatar[e].blendShapeTraitsInfo[s.getGroupId()]=s}async _animationManagerSetup(e,t,r){const i=mt(e);this.animationManager&&(this.animationManager.setScale(r),e.length>0&&(this.animationManager.storeAnimationPaths(i,t||""),await this.animationManager.loadAnimation(i,!1,0,i[0].endsWith(".fbx"),t||"")))}async _fetchManifest(e){return await(await fetch(e)).json()}_getPortaitScreenshotTexture(e,t){this.blinkManager.enableScreenshot(),this.characterModel.traverse(u=>{u.isSkinnedMesh&&u.skeleton.bones.filter(h=>h.name==="head")[0].getWorldPosition(wl)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],c=r[1];wl.x+=s[0],wl.y+=s[1],wl.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.cameraFrameManager.setCamera(wl,i,a);const A=e?this.screenshotManager.getScreenshotBlob(l,c):this.screenshotManager.getScreenshotTexture(l,c);return this.blinkManager.disableScreenshot(),A}_setupWireframeMaterial(e){e.origMat=e.material;const t=()=>{const o=.1+Math.random()*.9,a=.1+Math.random()*(1-.1),l=.1+Math.random()*(1-.1);return new He(o,a,l)},r=new qi({color:t(),wireframe:!0,wireframeLinewidth:.2}),i=e.material;e.setDebugMode=s=>{s?e.material.length?(e.material[0]=r,e.material[1]=r):e.material=r:e.material=i}}_VRMBaseSetup(e,t,r,i,s){var a,l;let o=e.userData.vrm;if(e.userData.vrm==null)return console.error("No valid VRM was provided for "+r+" trait, skipping file."),null;if(PO(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&F0e(e),pge(o),U0e(e),this._unregisterMorphTargetsFromManifest(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new ix(o)),this._modelBaseSetup(o,t,r,i,s),((l=o.meta)==null?void 0:l.metaVersion)==="0"){if(o.humanoid.humanBones.hips.node.parent==o.scene){const c=new Ft;c.name="newRootNode",lge(o.scene,c),c.add(o.humanoid.humanBones.hips.node)}o.humanoid.humanBones.hips.node.parent.rotateY(3.14159),o.scene.traverse(c=>{if(c.isSkinnedMesh){for(let A=0;Aa.id).includes(o.expressionName)&&i.push(o);for(const o of i)e.expressionManager.unregisterExpression(o)}_modelBaseSetup(e,t,r,i,s){const o=[],a=mt(t.cullingIgnore),l=[];t.meshTargets&&mt(t.meshTargets).map(u=>{const f=e.scene.getObjectByName(u);f!=null&&f.isMesh&&o.push(f)}),e.scene.traverse(u=>{!t.meshTargets&&u.isMesh&&o.push(u),u.frustumCulled=!1,u.isMesh&&(this._setupWireframeMaterial(u),a.indexOf(u.name)===-1&&l.push(u))});const c=this.manifest,A=this.manifestData.getModelGroup(r);PO(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:A.cullingLayer!=null?A.cullingLayer:c.defaultCullingLayer!=null?c.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:A.cullingDistance!=null?A.cullingDistance:c.defaultCullingDistance!=null?c.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,f)=>{if(i){const h=i[f]||i[0];h!=null&&mt(u.material).map(d=>{W0e(d,h)})}if(s){const h=s[f]||s[0];h!=null&&(u.material[0].uniforms.litFactor.value=h,u.material[0].uniforms.shadeColorFactor.value=new He(h.r*.8,h.g*.8,h.b*.8))}})}_applyManagers(e){this.blinkManager.addVRM(e),this.lookAtManager&&this.lookAtManager.addVRM(e),this.animationManager&&this.animationManager.addVRM(e)}_displayModel(e){if(e){const t=e.scene;this.characterModel.attach(t)}}_positionModel(e){const t=this.manifestData.displayScale;e.scene.scale.set(t,t,t)}_disposeTrait(e){this.blinkManager.removeVRM(e),this.lookAtManager&&this.lookAtManager.removeVRM(e),this.animationManager&&this.animationManager.removeVRM(e),dge(e)}_addLoadedData(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;if(r==null){this.avatar[t]&&this.avatar[t].vrm&&(this._disposeTrait(this.avatar[t].vrm),this.avatar[t]={});return}let c=null;o.map(A=>{A!=null&&(c=this._VRMBaseSetup(A,r,t,a,l))}),c!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(c),this._displayModel(c),this._applyManagers(c),console.log(this.characterModel),this.avatar[t]={traitInfo:r,blendShapeTraitsInfo:{},textureInfo:i,colorInfo:s,name:r.name,model:c&&c.scene,vrm:c})}}class j0e{constructor(){const e=new Nz;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new jz(e);t.crossOrigin="anonymous",t.register(i=>new hpe(i,{autoUpdateHumanBones:!0}));const r=new Xu(e);this.loadPercentager=0,this.loadingManager=e,this.gltfLoader=t,this.textureLoader=r,this.isLoading=!1}setLoadPercentage(e){this.loadPercentager=e}loadTraitOptions(e){return new Promise(t=>{this.isLoading=!0;const r=[],i=e.map(async(s,o)=>{var A,u,f;if(s==null){r[o]=null;return}const a=await Promise.all(mt((A=s==null?void 0:s.traitModel)==null?void 0:A.fullDirectory).map(async h=>{try{return await this.gltfLoader.loadAsync(h)}catch(d){return console.error(`Error loading modelsss ${h}:`,d),null}})),l=await Promise.all(mt((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(h=>new Promise(d=>{this.textureLoader.load(h,m=>{m.flipY=!1,m.colorSpace=kt,d(m)},null,m=>{console.error("error loading texture: ",m),d(null)})}))),c=mt((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(h=>new He(h));r[o]=new Dw({traitGroupID:s==null?void 0:s.traitModel.traitGroup.trait,traitModel:s==null?void 0:s.traitModel,textureTrait:s==null?void 0:s.traitTexture,colorTrait:s==null?void 0:s.traitColor,models:a,textures:l,colors:c})});Promise.allSettled(i).then(()=>{this.setLoadPercentage(100),t(r),this.isLoading=!1}).catch(s=>{this.setLoadPercentage(100),console.error("An error occurred:",s),t(r),this.isLoading=!1})})}}class Dw{constructor(e){const{traitGroupID:t,traitModel:r,textureTrait:i,colorTrait:s,models:o,textures:a,colors:l}=e;this.traitGroupID=t,this.traitModel=r,this.textureTrait=i,this.colorTrait=s,this.models=o,this.textures=a,this.colors=l}}function W0e(n,e){if(n.type==="Shadermaterial"&&!n.isMToonMaterial){console.warn("XXX set material texture to shader material",n);return}n.map=e,n.needsUpdate=!0}class K0e extends noe{constructor(e){super(e),this.type=Na}parse(e){const o=function(S,I){switch(S){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(I||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(I||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(I||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(I||""))}},A=` +`,u=function(S,I,M){I=I||1024;let D=S.pos,T=-1,y=0,E="",R=String.fromCharCode.apply(null,new Uint16Array(S.subarray(D,D+128)));for(;0>(T=R.indexOf(A))&&y=S.byteLength||!(E=u(S)))&&o(1,"no header found"),(R=E.match(I))||o(3,"bad initial token"),y.valid|=1,y.programtype=R[1],y.string+=E+` +`;E=u(S),E!==!1;){if(y.string+=E+` +`,E.charAt(0)==="#"){y.comments+=E+` +`;continue}if((R=E.match(M))&&(y.gamma=parseFloat(R[1])),(R=E.match(P))&&(y.exposure=parseFloat(R[1])),(R=E.match(D))&&(y.valid|=2,y.format=R[1]),(R=E.match(T))&&(y.valid|=4,y.height=parseInt(R[1],10),y.width=parseInt(R[2],10)),y.valid&2&&y.valid&4)break}return y.valid&2||o(3,"missing format specifier"),y.valid&4||o(3,"missing image size specifier"),y},h=function(S,I,M){const P=I;if(P<8||P>32767||S[0]!==2||S[1]!==2||S[2]&128)return new Uint8Array(S);P!==(S[2]<<8|S[3])&&o(3,"wrong scanline width");const D=new Uint8Array(4*I*M);D.length||o(4,"unable to allocate buffer space");let T=0,y=0;const E=4*P,R=new Uint8Array(4),L=new Uint8Array(E);let N=M;for(;N>0&&yS.byteLength&&o(1),R[0]=S[y++],R[1]=S[y++],R[2]=S[y++],R[3]=S[y++],(R[0]!=2||R[1]!=2||(R[2]<<8|R[3])!=P)&&o(3,"bad rgbe scanline format");let z=0,W;for(;z128;if(C&&(W-=128),(W===0||z+W>E)&&o(3,"bad scanline data"),C){const K=S[y++];for(let ee=0;ee{g.mapping=Og,g.colorSpace=Mr,e.environment=g}),e.environmentIntensity=.5;const t=new Hz(16777215,.8);e.add(t);const r=new GR(16777215,.8);r.position.set(0,1,1),e.add(r);const i=new Ft;e.add(i);const s=new Fr(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new V0e({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new v0({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),c=new boe(s,l.domElement);c.minDistance=1,c.maxDistance=4,c.maxPolarAngle=Math.PI/2,c.enablePan=!0,c.target=new $(0,1,0),c.enableDamping=!0,c.dampingFactor=.1;const A=new $(-.5,0,-.5),u=new $(.5,1.7,.5),f=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",f),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputColorSpace=kt;const h=()=>{requestAnimationFrame(h),c.target.clamp(A,u),c==null||c.update(),o.update(),l.render(e,s)};h();const d=g=>{const p=g.ctrlKey,v=a.getBoundingClientRect(),w=(g.clientX-v.left)/v.width*2-1,_=-((g.clientY-v.top)/v.height)*2+1;o.cameraRaycastCulling(w,_,p)};async function m(){}return m(),a.addEventListener("click",d),{scene:e,camera:s,controls:c,characterManager:o,sceneElements:i}}function Dy(n){throw new Error('Could not dynamically require "'+n+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var sV={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -5033,9 +5037,9 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(r,i,s){function o(c,A){if(!i[c]){if(!r[c]){var u=typeof Fy=="function"&&Fy;if(!A&&u)return u(c,!0);if(a)return a(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var h=i[c]={exports:{}};r[c][0].call(h.exports,function(d){var m=r[c][1][d];return o(m||d)},h,h.exports,t,r,i,s)}return i[c].exports}for(var a=typeof Fy=="function"&&Fy,l=0;l>2,h=(3&c)<<4|A>>4,d=1>6:64,m=2>4,A=(15&f)<<4|(h=a.indexOf(l.charAt(m++)))>>2,u=(3&h)<<6|(d=a.indexOf(l.charAt(m++))),v[g++]=c,h!==64&&(v[g++]=A),d!==64&&(v[g++]=u);return v}},{"./support":30,"./utils":32}],2:[function(t,r,i){var s=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(A,u,f,h,d){this.compressedSize=A,this.uncompressedSize=u,this.crc32=f,this.compression=h,this.compressedContent=d}c.prototype={getContentWorker:function(){var A=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return A.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),A},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(A,u,f){return A.pipe(new a).pipe(new l("uncompressedSize")).pipe(u.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",u)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,i){var s=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,i){var s=t("./utils"),o=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var A=0;A<8;A++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(c,A,u,f){var h=o,d=f+u;c^=-1;for(var m=f;m>>8^h[255&(c^A[m])];return-1^c}(0|l,a,a.length,0):function(c,A,u,f){var h=o,d=f+u;c^=-1;for(var m=f;m>>8^h[255&(c^A.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(t,r,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,r,i){var s=null;s=typeof Promise<"u"?Promise:t("lie"),r.exports={Promise:s}},{lie:37}],7:[function(t,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),l=t("./stream/GenericWorker"),c=s?"uint8array":"array";function A(u,f){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(A,l),A.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,u.data),!1)},A.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},A.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},A.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(f){u.push({data:f,meta:u.meta})}},i.compressWorker=function(u){return new A("Deflate",u)},i.uncompressWorker=function(){return new A("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,i){function s(h,d){var m,g="";for(m=0;m>>=8;return g}function o(h,d,m,g,p,v){var w,_,x=h.file,b=h.compression,B=v!==c.utf8encode,M=a.transformTo("string",v(x.name)),I=a.transformTo("string",c.utf8encode(x.name)),S=x.comment,L=a.transformTo("string",v(S)),O=a.transformTo("string",c.utf8encode(S)),T=I.length!==x.name.length,y=O.length!==S.length,E="",U="",P="",N=x.dir,z=x.date,W={crc32:0,compressedSize:0,uncompressedSize:0};d&&!m||(W.crc32=h.crc32,W.compressedSize=h.compressedSize,W.uncompressedSize=h.uncompressedSize);var H=0;d&&(H|=8),B||!T&&!y||(H|=2048);var C=0,K=0;N&&(C|=16),p==="UNIX"?(K=798,C|=function(F,re){var ce=F;return F||(ce=re?16893:33204),(65535&ce)<<16}(x.unixPermissions,N)):(K=20,C|=function(F){return 63&(F||0)}(x.dosPermissions)),w=z.getUTCHours(),w<<=6,w|=z.getUTCMinutes(),w<<=5,w|=z.getUTCSeconds()/2,_=z.getUTCFullYear()-1980,_<<=4,_|=z.getUTCMonth()+1,_<<=5,_|=z.getUTCDate(),T&&(U=s(1,1)+s(A(M),4)+I,E+="up"+s(U.length,2)+U),y&&(P=s(1,1)+s(A(L),4)+O,E+="uc"+s(P.length,2)+P);var te="";return te+=` -\0`,te+=s(H,2),te+=b.magic,te+=s(w,2),te+=s(_,2),te+=s(W.crc32,4),te+=s(W.compressedSize,4),te+=s(W.uncompressedSize,4),te+=s(M.length,2),te+=s(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+te+M+E,dirRecord:u.CENTRAL_FILE_HEADER+s(K,2)+te+s(L.length,2)+"\0\0\0\0"+s(C,4)+s(g,4)+M+E+L}}var a=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),A=t("../crc32"),u=t("../signature");function f(h,d,m,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=m,this.encodeFileName=g,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(h){var d=h.meta.percent||0,m=this.entriesCount,g=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:m?(d+100*(m-g-1))/m:100}}))},f.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var d=this.streamFiles&&!h.file.dir;if(d){var m=o(h,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(h){this.accumulate=!1;var d=this.streamFiles&&!h.file.dir,m=o(h,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),d)this.push({data:function(g){return u.DATA_DESCRIPTOR+s(g.crc32,4)+s(g.compressedSize,4)+s(g.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var h=this.bytesWritten,d=0;d=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},readString:function(a){return s.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))}},r.exports=o},{"../utils":32}],19:[function(t,r,i){var s=t("./Uint8ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.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},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,i){var s=t("./DataReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.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},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,r,i){var s=t("./ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.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},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,i){var s=t("../utils"),o=t("../support"),a=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),A=t("./Uint8ArrayReader");r.exports=function(u){var f=s.getTypeOf(u);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new c(u):o.uint8array?new A(s.transformTo("uint8array",u)):new a(s.transformTo("array",u)):new l(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,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,r,i){var s=t("./GenericWorker"),o=t("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,i){var s=t("./GenericWorker"),o=t("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}o.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(A){c.dataIsReady=!0,c.data=A,c.max=A&&A.length||0,c.type=s.getTypeOf(A),c.isPaused||c._tickAndRepeat()},function(A){c.error(A)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=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,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,i){function s(o){this.name=o||"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}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l "+o:o}},r.exports=s},{}],29:[function(t,r,i){var s=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),l=t("../base64"),c=t("../support"),A=t("../external"),u=null;if(c.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(d,m){return new A.Promise(function(g,p){var v=[],w=d._internalType,_=d._outputType,x=d._mimeType;d.on("data",function(b,B){v.push(b),m&&m(B)}).on("error",function(b){v=[],p(b)}).on("end",function(){try{var b=function(B,M,I){switch(B){case"blob":return s.newBlob(s.transformTo("arraybuffer",M),I);case"base64":return l.encode(M);default:return s.transformTo(B,M)}}(_,function(B,M){var I,S=0,L=null,O=0;for(I=0;I"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.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,r,i){for(var s=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),A=0;A<256;A++)c[A]=252<=A?6:248<=A?5:240<=A?4:224<=A?3:192<=A?2:1;c[254]=c[254]=1;function u(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}i.utf8encode=function(h){return o.nodebuffer?a.newBufferFrom(h,"utf-8"):function(d){var m,g,p,v,w,_=d.length,x=0;for(v=0;v<_;v++)(64512&(g=d.charCodeAt(v)))==55296&&v+1<_&&(64512&(p=d.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(p-56320),v++),x+=g<128?1:g<2048?2:g<65536?3:4;for(m=o.uint8array?new Uint8Array(x):new Array(x),v=w=0;w>>6:(g<65536?m[w++]=224|g>>>12:(m[w++]=240|g>>>18,m[w++]=128|g>>>12&63),m[w++]=128|g>>>6&63),m[w++]=128|63&g);return m}(h)},i.utf8decode=function(h){return o.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(d){var m,g,p,v,w=d.length,_=new Array(2*w);for(m=g=0;m>10&1023,_[g++]=56320|1023&p)}return _.length!==g&&(_.subarray?_=_.subarray(0,g):_.length=g),s.applyFromCharCode(_)}(h=s.transformTo(o.uint8array?"uint8array":"array",h))},s.inherits(u,l),u.prototype.processChunk=function(h){var d=s.transformTo(o.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=d;(d=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),d.set(m,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var g=function(v,w){var _;for((w=w||v.length)>v.length&&(w=v.length),_=w-1;0<=_&&(192&v[_])==128;)_--;return _<0||_===0?w:_+c[v[_]]>w?_:w}(d),p=d;g!==d.length&&(o.uint8array?(p=d.subarray(0,g),this.leftOver=d.subarray(g,d.length)):(p=d.slice(0,g),this.leftOver=d.slice(g,d.length))),this.push({data:i.utf8decode(p),meta:h.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,s.inherits(f,l),f.prototype.processChunk=function(h){this.push({data:i.utf8encode(h.data),meta:h.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,r,i){var s=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),l=t("./external");function c(m){return m}function A(m,g){for(var p=0;p>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=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var d,m,g,p=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?f[g++]=224|h>>>12:(f[g++]=240|h>>>18,f[g++]=128|h>>>12&63),f[g++]=128|h>>>6&63),f[g++]=128|63&h);return f},i.buf2binstring=function(u){return A(u,u.length)},i.binstring2buf=function(u){for(var f=new s.Buf8(u.length),h=0,d=f.length;h>10&1023,v[d++]=56320|1023&m)}return A(v,d)},i.utf8border=function(u,f){var h;for((f=f||u.length)>u.length&&(f=u.length),h=f-1;0<=h&&(192&u[h])==128;)h--;return h<0||h===0?f:h+l[u[h]]>f?h:f}},{"./common":41}],43:[function(t,r,i){r.exports=function(s,o,a,l){for(var c=65535&s|0,A=s>>>16&65535|0,u=0;a!==0;){for(a-=u=2e3>>1:o>>>1;a[l]=o}return a}();r.exports=function(o,a,l,c){var A=s,u=c+l;o^=-1;for(var f=c;f>>8^A[255&(o^a[f])];return-1^o}},{}],46:[function(t,r,i){var s,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),c=t("./crc32"),A=t("./messages"),u=0,f=4,h=0,d=-2,m=-1,g=4,p=2,v=8,w=9,_=286,x=30,b=19,B=2*_+1,M=15,I=3,S=258,L=S+I+1,O=42,T=113,y=1,E=2,U=3,P=4;function N(k,ae){return k.msg=A[ae],ae}function z(k){return(k<<1)-(4k.avail_out&&(le=k.avail_out),le!==0&&(o.arraySet(k.output,ae.pending_buf,ae.pending_out,le,k.next_out),k.next_out+=le,ae.pending_out+=le,k.total_out+=le,k.avail_out-=le,ae.pending-=le,ae.pending===0&&(ae.pending_out=0))}function C(k,ae){a._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,ae),k.block_start=k.strstart,H(k.strm)}function K(k,ae){k.pending_buf[k.pending++]=ae}function te(k,ae){k.pending_buf[k.pending++]=ae>>>8&255,k.pending_buf[k.pending++]=255&ae}function F(k,ae){var le,Z,J=k.max_chain_length,ue=k.strstart,Y=k.prev_length,G=k.nice_match,j=k.strstart>k.w_size-L?k.strstart-(k.w_size-L):0,se=k.window,fe=k.w_mask,he=k.prev,Be=k.strstart+S,V=se[ue+Y-1],R=se[ue+Y];k.prev_length>=k.good_match&&(J>>=2),G>k.lookahead&&(G=k.lookahead);do if(se[(le=ae)+Y]===R&&se[le+Y-1]===V&&se[le]===se[ue]&&se[++le]===se[ue+1]){ue+=2,le++;do;while(se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&uej&&--J!=0);return Y<=k.lookahead?Y:k.lookahead}function re(k){var ae,le,Z,J,ue,Y,G,j,se,fe,he=k.w_size;do{if(J=k.window_size-k.lookahead-k.strstart,k.strstart>=he+(he-L)){for(o.arraySet(k.window,k.window,he,he,0),k.match_start-=he,k.strstart-=he,k.block_start-=he,ae=le=k.hash_size;Z=k.head[--ae],k.head[ae]=he<=Z?Z-he:0,--le;);for(ae=le=he;Z=k.prev[--ae],k.prev[ae]=he<=Z?Z-he:0,--le;);J+=he}if(k.strm.avail_in===0)break;if(Y=k.strm,G=k.window,j=k.strstart+k.lookahead,se=J,fe=void 0,fe=Y.avail_in,se=I)for(ue=k.strstart-k.insert,k.ins_h=k.window[ue],k.ins_h=(k.ins_h<=I&&(k.ins_h=(k.ins_h<=I)if(Z=a._tr_tally(k,k.strstart-k.match_start,k.match_length-I),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=I){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<=I&&(k.ins_h=(k.ins_h<=I&&k.match_length<=k.prev_length){for(J=k.strstart+k.lookahead-I,Z=a._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-I),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=J&&(k.ins_h=(k.ins_h<k.pending_buf_size-5&&(le=k.pending_buf_size-5);;){if(k.lookahead<=1){if(re(k),k.lookahead===0&&ae===u)return y;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var Z=k.block_start+le;if((k.strstart===0||k.strstart>=Z)&&(k.lookahead=k.strstart-Z,k.strstart=Z,C(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-L&&(C(k,!1),k.strm.avail_out===0))return y}return k.insert=0,ae===f?(C(k,!0),k.strm.avail_out===0?U:P):(k.strstart>k.block_start&&(C(k,!1),k.strm.avail_out),y)}),new ge(4,4,8,4,ce),new ge(4,5,16,8,ce),new ge(4,6,32,32,ce),new ge(4,4,16,16,oe),new ge(8,16,32,32,oe),new ge(8,16,128,128,oe),new ge(8,32,128,256,oe),new ge(32,128,258,1024,oe),new ge(32,258,258,4096,oe)],i.deflateInit=function(k,ae){return ne(k,ae,v,15,8,0)},i.deflateInit2=ne,i.deflateReset=be,i.deflateResetKeep=ve,i.deflateSetHeader=function(k,ae){return k&&k.state?k.state.wrap!==2?d:(k.state.gzhead=ae,h):d},i.deflate=function(k,ae){var le,Z,J,ue;if(!k||!k.state||5>8&255),K(Z,Z.gzhead.time>>16&255),K(Z,Z.gzhead.time>>24&255),K(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),K(Z,255&Z.gzhead.os),Z.gzhead.extra&&Z.gzhead.extra.length&&(K(Z,255&Z.gzhead.extra.length),K(Z,Z.gzhead.extra.length>>8&255)),Z.gzhead.hcrc&&(k.adler=c(k.adler,Z.pending_buf,Z.pending,0)),Z.gzindex=0,Z.status=69):(K(Z,0),K(Z,0),K(Z,0),K(Z,0),K(Z,0),K(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),K(Z,3),Z.status=T);else{var Y=v+(Z.w_bits-8<<4)<<8;Y|=(2<=Z.strategy||Z.level<2?0:Z.level<6?1:Z.level===6?2:3)<<6,Z.strstart!==0&&(Y|=32),Y+=31-Y%31,Z.status=T,te(Z,Y),Z.strstart!==0&&(te(Z,k.adler>>>16),te(Z,65535&k.adler)),k.adler=1}if(Z.status===69)if(Z.gzhead.extra){for(J=Z.pending;Z.gzindex<(65535&Z.gzhead.extra.length)&&(Z.pending!==Z.pending_buf_size||(Z.gzhead.hcrc&&Z.pending>J&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),H(k),J=Z.pending,Z.pending!==Z.pending_buf_size));)K(Z,255&Z.gzhead.extra[Z.gzindex]),Z.gzindex++;Z.gzhead.hcrc&&Z.pending>J&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),Z.gzindex===Z.gzhead.extra.length&&(Z.gzindex=0,Z.status=73)}else Z.status=73;if(Z.status===73)if(Z.gzhead.name){J=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>J&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),H(k),J=Z.pending,Z.pending===Z.pending_buf_size)){ue=1;break}ue=Z.gzindexJ&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),ue===0&&(Z.gzindex=0,Z.status=91)}else Z.status=91;if(Z.status===91)if(Z.gzhead.comment){J=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>J&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),H(k),J=Z.pending,Z.pending===Z.pending_buf_size)){ue=1;break}ue=Z.gzindexJ&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),ue===0&&(Z.status=103)}else Z.status=103;if(Z.status===103&&(Z.gzhead.hcrc?(Z.pending+2>Z.pending_buf_size&&H(k),Z.pending+2<=Z.pending_buf_size&&(K(Z,255&k.adler),K(Z,k.adler>>8&255),k.adler=0,Z.status=T)):Z.status=T),Z.pending!==0){if(H(k),k.avail_out===0)return Z.last_flush=-1,h}else if(k.avail_in===0&&z(ae)<=z(le)&&ae!==f)return N(k,-5);if(Z.status===666&&k.avail_in!==0)return N(k,-5);if(k.avail_in!==0||Z.lookahead!==0||ae!==u&&Z.status!==666){var G=Z.strategy===2?function(j,se){for(var fe;;){if(j.lookahead===0&&(re(j),j.lookahead===0)){if(se===u)return y;break}if(j.match_length=0,fe=a._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++,fe&&(C(j,!1),j.strm.avail_out===0))return y}return j.insert=0,se===f?(C(j,!0),j.strm.avail_out===0?U:P):j.last_lit&&(C(j,!1),j.strm.avail_out===0)?y:E}(Z,ae):Z.strategy===3?function(j,se){for(var fe,he,Be,V,R=j.window;;){if(j.lookahead<=S){if(re(j),j.lookahead<=S&&se===u)return y;if(j.lookahead===0)break}if(j.match_length=0,j.lookahead>=I&&0j.lookahead&&(j.match_length=j.lookahead)}if(j.match_length>=I?(fe=a._tr_tally(j,1,j.match_length-I),j.lookahead-=j.match_length,j.strstart+=j.match_length,j.match_length=0):(fe=a._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++),fe&&(C(j,!1),j.strm.avail_out===0))return y}return j.insert=0,se===f?(C(j,!0),j.strm.avail_out===0?U:P):j.last_lit&&(C(j,!1),j.strm.avail_out===0)?y:E}(Z,ae):s[Z.level].func(Z,ae);if(G!==U&&G!==P||(Z.status=666),G===y||G===U)return k.avail_out===0&&(Z.last_flush=-1),h;if(G===E&&(ae===1?a._tr_align(Z):ae!==5&&(a._tr_stored_block(Z,0,0,!1),ae===3&&(W(Z.head),Z.lookahead===0&&(Z.strstart=0,Z.block_start=0,Z.insert=0))),H(k),k.avail_out===0))return Z.last_flush=-1,h}return ae!==f?h:Z.wrap<=0?1:(Z.wrap===2?(K(Z,255&k.adler),K(Z,k.adler>>8&255),K(Z,k.adler>>16&255),K(Z,k.adler>>24&255),K(Z,255&k.total_in),K(Z,k.total_in>>8&255),K(Z,k.total_in>>16&255),K(Z,k.total_in>>24&255)):(te(Z,k.adler>>>16),te(Z,65535&k.adler)),H(k),0=le.w_size&&(ue===0&&(W(le.head),le.strstart=0,le.block_start=0,le.insert=0),se=new o.Buf8(le.w_size),o.arraySet(se,ae,fe-le.w_size,le.w_size,0),ae=se,fe=le.w_size),Y=k.avail_in,G=k.next_in,j=k.input,k.avail_in=fe,k.next_in=0,k.input=ae,re(le);le.lookahead>=I;){for(Z=le.strstart,J=le.lookahead-(I-1);le.ins_h=(le.ins_h<>>=I=M>>>24,w-=I,(I=M>>>16&255)===0)E[A++]=65535&M;else{if(!(16&I)){if(!(64&I)){M=_[(65535&M)+(v&(1<>>=I,w-=I),w<15&&(v+=y[l++]<>>=I=M>>>24,w-=I,!(16&(I=M>>>16&255))){if(!(64&I)){M=x[(65535&M)+(v&(1<>>=I,w-=I,(I=A-u)>3,v&=(1<<(w-=S<<3))-1,s.next_in=l,s.next_out=A,s.avail_in=l>>24&255)+(O>>>8&65280)+((65280&O)<<8)+((255&O)<<24)}function v(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(O){var T;return O&&O.state?(T=O.state,O.total_in=O.total_out=T.total=0,O.msg="",T.wrap&&(O.adler=1&T.wrap),T.mode=d,T.last=0,T.havedict=0,T.dmax=32768,T.head=null,T.hold=0,T.bits=0,T.lencode=T.lendyn=new s.Buf32(m),T.distcode=T.distdyn=new s.Buf32(g),T.sane=1,T.back=-1,f):h}function _(O){var T;return O&&O.state?((T=O.state).wsize=0,T.whave=0,T.wnext=0,w(O)):h}function x(O,T){var y,E;return O&&O.state?(E=O.state,T<0?(y=0,T=-T):(y=1+(T>>4),T<48&&(T&=15)),T&&(T<8||15=P.wsize?(s.arraySet(P.window,T,y-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(E<(U=P.wsize-P.wnext)&&(U=E),s.arraySet(P.window,T,y-E,U,P.wnext),(E-=U)?(s.arraySet(P.window,T,y-E,E,0),P.wnext=E,P.whave=P.wsize):(P.wnext+=U,P.wnext===P.wsize&&(P.wnext=0),P.whave>>8&255,y.check=a(y.check,ue,2,0),C=H=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&H)<<8)+(H>>8))%31){O.msg="incorrect header check",y.mode=30;break}if((15&H)!=8){O.msg="unknown compression method",y.mode=30;break}if(C-=4,k=8+(15&(H>>>=4)),y.wbits===0)y.wbits=k;else if(k>y.wbits){O.msg="invalid window size",y.mode=30;break}y.dmax=1<>8&1),512&y.flags&&(ue[0]=255&H,ue[1]=H>>>8&255,y.check=a(y.check,ue,2,0)),C=H=0,y.mode=3;case 3:for(;C<32;){if(z===0)break e;z--,H+=E[P++]<>>8&255,ue[2]=H>>>16&255,ue[3]=H>>>24&255,y.check=a(y.check,ue,4,0)),C=H=0,y.mode=4;case 4:for(;C<16;){if(z===0)break e;z--,H+=E[P++]<>8),512&y.flags&&(ue[0]=255&H,ue[1]=H>>>8&255,y.check=a(y.check,ue,2,0)),C=H=0,y.mode=5;case 5:if(1024&y.flags){for(;C<16;){if(z===0)break e;z--,H+=E[P++]<>>8&255,y.check=a(y.check,ue,2,0)),C=H=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&(z<(F=y.length)&&(F=z),F&&(y.head&&(k=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),s.arraySet(y.head.extra,E,P,F,k)),512&y.flags&&(y.check=a(y.check,E,F,P)),z-=F,P+=F,y.length-=F),y.length))break e;y.length=0,y.mode=7;case 7:if(2048&y.flags){if(z===0)break e;for(F=0;k=E[P+F++],y.head&&k&&y.length<65536&&(y.head.name+=String.fromCharCode(k)),k&&F>9&1,y.head.done=!0),O.adler=y.check=0,y.mode=12;break;case 10:for(;C<32;){if(z===0)break e;z--,H+=E[P++]<>>=7&C,C-=7&C,y.mode=27;break}for(;C<3;){if(z===0)break e;z--,H+=E[P++]<>>=1)){case 0:y.mode=14;break;case 1:if(S(y),y.mode=20,T!==6)break;H>>>=2,C-=2;break e;case 2:y.mode=17;break;case 3:O.msg="invalid block type",y.mode=30}H>>>=2,C-=2;break;case 14:for(H>>>=7&C,C-=7&C;C<32;){if(z===0)break e;z--,H+=E[P++]<>>16^65535)){O.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&H,C=H=0,y.mode=15,T===6)break e;case 15:y.mode=16;case 16:if(F=y.length){if(z>>=5,C-=5,y.ndist=1+(31&H),H>>>=5,C-=5,y.ncode=4+(15&H),H>>>=4,C-=4,286>>=3,C-=3}for(;y.have<19;)y.lens[Y[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,le={bits:y.lenbits},ae=c(0,y.lens,0,19,y.lencode,0,y.work,le),y.lenbits=le.bits,ae){O.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have>>16&255,me=65535&J,!((oe=J>>>24)<=C);){if(z===0)break e;z--,H+=E[P++]<>>=oe,C-=oe,y.lens[y.have++]=me;else{if(me===16){for(Z=oe+2;C>>=oe,C-=oe,y.have===0){O.msg="invalid bit length repeat",y.mode=30;break}k=y.lens[y.have-1],F=3+(3&H),H>>>=2,C-=2}else if(me===17){for(Z=oe+3;C>>=oe)),H>>>=3,C-=3}else{for(Z=oe+7;C>>=oe)),H>>>=7,C-=7}if(y.have+F>y.nlen+y.ndist){O.msg="invalid bit length repeat",y.mode=30;break}for(;F--;)y.lens[y.have++]=k}}if(y.mode===30)break;if(y.lens[256]===0){O.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,le={bits:y.lenbits},ae=c(A,y.lens,0,y.nlen,y.lencode,0,y.work,le),y.lenbits=le.bits,ae){O.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,le={bits:y.distbits},ae=c(u,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,le),y.distbits=le.bits,ae){O.msg="invalid distances set",y.mode=30;break}if(y.mode=20,T===6)break e;case 20:y.mode=21;case 21:if(6<=z&&258<=W){O.next_out=N,O.avail_out=W,O.next_in=P,O.avail_in=z,y.hold=H,y.bits=C,l(O,te),N=O.next_out,U=O.output,W=O.avail_out,P=O.next_in,E=O.input,z=O.avail_in,H=y.hold,C=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;ge=(J=y.lencode[H&(1<>>16&255,me=65535&J,!((oe=J>>>24)<=C);){if(z===0)break e;z--,H+=E[P++]<>ve)])>>>16&255,me=65535&J,!(ve+(oe=J>>>24)<=C);){if(z===0)break e;z--,H+=E[P++]<>>=ve,C-=ve,y.back+=ve}if(H>>>=oe,C-=oe,y.back+=oe,y.length=me,ge===0){y.mode=26;break}if(32&ge){y.back=-1,y.mode=12;break}if(64&ge){O.msg="invalid literal/length code",y.mode=30;break}y.extra=15&ge,y.mode=22;case 22:if(y.extra){for(Z=y.extra;C>>=y.extra,C-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;ge=(J=y.distcode[H&(1<>>16&255,me=65535&J,!((oe=J>>>24)<=C);){if(z===0)break e;z--,H+=E[P++]<>ve)])>>>16&255,me=65535&J,!(ve+(oe=J>>>24)<=C);){if(z===0)break e;z--,H+=E[P++]<>>=ve,C-=ve,y.back+=ve}if(H>>>=oe,C-=oe,y.back+=oe,64&ge){O.msg="invalid distance code",y.mode=30;break}y.offset=me,y.extra=15&ge,y.mode=24;case 24:if(y.extra){for(Z=y.extra;C>>=y.extra,C-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){O.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(W===0)break e;if(F=te-W,y.offset>F){if((F=y.offset-F)>y.whave&&y.sane){O.msg="invalid distance too far back",y.mode=30;break}re=F>y.wnext?(F-=y.wnext,y.wsize-F):y.wnext-F,F>y.length&&(F=y.length),ce=y.window}else ce=U,re=N-y.offset,F=y.length;for(WB?(I=re[ce+g[T]],C[K+g[T]]):(I=96,0),v=1<>N)+(w-=v)]=M<<24|I<<16|S|0,w!==0;);for(v=1<>=1;if(v!==0?(H&=v-1,H+=v):H=0,T++,--te[O]==0){if(O===E)break;O=u[f+g[T]]}if(U>>7)]}function K(J,ue){J.pending_buf[J.pending++]=255&ue,J.pending_buf[J.pending++]=ue>>>8&255}function te(J,ue,Y){J.bi_valid>p-Y?(J.bi_buf|=ue<>p-J.bi_valid,J.bi_valid+=Y-p):(J.bi_buf|=ue<>>=1,Y<<=1,0<--ue;);return Y>>>1}function ce(J,ue,Y){var G,j,se=new Array(g+1),fe=0;for(G=1;G<=g;G++)se[G]=fe=fe+Y[G-1]<<1;for(j=0;j<=ue;j++){var he=J[2*j+1];he!==0&&(J[2*j]=re(se[he]++,he))}}function oe(J){var ue;for(ue=0;ue>1;1<=Y;Y--)ve(J,se,Y);for(j=Be;Y=J.heap[1],J.heap[1]=J.heap[J.heap_len--],ve(J,se,1),G=J.heap[1],J.heap[--J.heap_max]=Y,J.heap[--J.heap_max]=G,se[2*j]=se[2*Y]+se[2*G],J.depth[j]=(J.depth[Y]>=J.depth[G]?J.depth[Y]:J.depth[G])+1,se[2*Y+1]=se[2*G+1]=j,J.heap[1]=j++,ve(J,se,1),2<=J.heap_len;);J.heap[--J.heap_max]=J.heap[1],function(R,D){var X,ie,pe,de,Ie,Le,Ue=D.dyn_tree,Ye=D.max_code,Ae=D.stat_desc.static_tree,Fe=D.stat_desc.has_stree,Me=D.stat_desc.extra_bits,Ce=D.stat_desc.extra_base,Re=D.stat_desc.max_length,Oe=0;for(de=0;de<=g;de++)R.bl_count[de]=0;for(Ue[2*R.heap[R.heap_max]+1]=0,X=R.heap_max+1;X>=7;j>>=1)if(1&V&&he.dyn_ltree[2*Be]!==0)return o;if(he.dyn_ltree[18]!==0||he.dyn_ltree[20]!==0||he.dyn_ltree[26]!==0)return a;for(Be=32;Be>>3,(se=J.static_len+3+7>>>3)<=j&&(j=se)):j=se=Y+5,Y+4<=j&&ue!==-1?Z(J,ue,Y,G):J.strategy===4||se===j?(te(J,2+(G?1:0),3),be(J,L,O)):(te(J,4+(G?1:0),3),function(he,Be,V,R){var D;for(te(he,Be-257,5),te(he,V-1,5),te(he,R-4,4),D=0;D>>8&255,J.pending_buf[J.d_buf+2*J.last_lit+1]=255&ue,J.pending_buf[J.l_buf+J.last_lit]=255&Y,J.last_lit++,ue===0?J.dyn_ltree[2*Y]++:(J.matches++,ue--,J.dyn_ltree[2*(y[Y]+u+1)]++,J.dyn_dtree[2*C(ue)]++),J.last_lit===J.lit_bufsize-1},i._tr_align=function(J){te(J,2,3),F(J,w,L),function(ue){ue.bi_valid===16?(K(ue,ue.bi_buf),ue.bi_buf=0,ue.bi_valid=0):8<=ue.bi_valid&&(ue.pending_buf[ue.pending++]=255&ue.bi_buf,ue.bi_buf>>=8,ue.bi_valid-=8)}(J)}},{"../utils/common":41}],53:[function(t,r,i){r.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,r,i){(function(s){(function(o,a){if(!o.setImmediate){var l,c,A,u,f=1,h={},d=!1,m=o.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(o);g=g&&g.setTimeout?g:o,l={}.toString.call(o.process)==="[object process]"?function(_){process.nextTick(function(){v(_)})}:function(){if(o.postMessage&&!o.importScripts){var _=!0,x=o.onmessage;return o.onmessage=function(){_=!1},o.postMessage("","*"),o.onmessage=x,_}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(_){o.postMessage(u+_,"*")}):o.MessageChannel?((A=new MessageChannel).port1.onmessage=function(_){v(_.data)},function(_){A.port2.postMessage(_)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(_){var x=m.createElement("script");x.onreadystatechange=function(){v(_),x.onreadystatechange=null,c.removeChild(x),x=null},c.appendChild(x)}):function(_){setTimeout(v,0,_)},g.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var x=new Array(arguments.length-1),b=0;b"u"?s===void 0?this:s:self)}).call(this,typeof Pa<"u"?Pa:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(rV);var z0e=rV.exports;const G0e=ic(z0e);class Jd{constructor(){this.zipContainer={}}addData(e,t,r,i=""){i==""&&(i="_"),this.zipContainer[i]==null&&(this.zipContainer[i]=[]),this.zipContainer[i].push({data:e,name:t,extension:r})}saveZip(e,t=!0){const r=this.zipContainer,i=new G0e;for(const s in r)if(s=="_")r[s].forEach((o,a)=>{i.file(o.name+"."+o.extension,o.data,{base64:!0})});else{const o=i.folder(s);r[s].forEach((a,l)=>{const c=a.extension!="txt";o.file(a.name+"."+a.extension,a.data,{base64:c})})}i.generateAsync({type:"blob"}).then(s=>{this._saveZipFile(s,e+".zip")}),t&&(this.zipContainer={})}_saveZipFile(e,t){const r=new Blob([e],{type:"application/zip"});if(typeof window.navigator.msSaveBlob<"u")window.navigator.msSaveBlob(r,t);else{const i=document.createElement("a");typeof i.download=="string"?(document.body.appendChild(i),i.download=t,i.href=URL.createObjectURL(r),i.click(),document.body.removeChild(i)):window.open(e,"_blank").document.write(""+t+"")}}}class V0e{constructor(e){jt(this,"screenshotManager");this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager,this.temptime=0}get vrms(){return Object.values(this.characterManager.avatar).map(e=>e.vrm)}async createLoraData(e,t=null,r=""){const i=e.manifest,s=e.name?"loraData/"+e.name:"loraData",o=await this._fetchManifest(i),{assetsLocation:a="",animationsDirectory:l="",backgroundGrayscale:c=1,backgroundDescription:A="",width:u=512,height:f=512,dataCollection:h}=o,d=a+l+"/";this.screenshotManager.setBackground([c,c,c]),this.blinkManager.enableScreenshot(),await this.screenshotManager.cameraFrameManager.calculateBoneOffsets(this.characterManager.characterModel,.2);let m=0;const g=this;if(Array.isArray(h)){const p=t??new Jd;await(async()=>{if(Array.isArray(h))for(let w=0;w{var E;(E=y.springBoneManager)==null||E.reset()});const O=c2(B);g.screenshotManager.cameraFrameManager.setCameraFrameWithName(M,O);const T=g.screenshotManager.getImageData(u,f,!1);p.addData(T,S,"png",s),p.addData("anata "+I+" "+A,S,"txt",s)}})(),t==null&&(r==""&&(r="lora_zip"),p.saveZip(r))}this.blinkManager.disableScreenshot()}async _fetchManifest(e){return await(await fetch(e)).json()}}class j0e{constructor(e){jt(this,"screenshotManager");this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager}async createSpriteAtlas(e,t=null,r=""){const i=e.manifest,s=e.name?"spriteData/"+e.name:"spriteData",o=await this._fetchManifest(i),{assetsLocation:a="",animationsDirectory:l="",backgroundColor:c=[1,1,1,1],screenshotOffset:A,topFrameOffset:u=.1,bottomFrameOffset:f=.1,pixelStyleSize:h,atlasWidth:d=512,atlasHeight:m=512,spritesCollection:g}=o,p=a+l+"/";this.screenshotManager.cameraFrameManager.setBottomFrameOffset(f),this.screenshotManager.cameraFrameManager.setTopFrameOffset(u),this.screenshotManager.setBackground(c),this.blinkManager.enableScreenshot(),await this.screenshotManager.cameraFrameManager.calculateBoneOffsets(this.characterManager.characterModel,.2);let v=0;const w=this;if(Array.isArray(g)){const _=t??new Jd;await(async()=>{if(Array.isArray(g))for(const b of g){const{animationName:B,animationPath:M,framesNumber:I,lookAtCamera:S,expression:L,cameraPosition:O,cameraFrame:T}=b;v++;const y=s+"/"+(B||v.toString().padStart(2,"0"));await w.animationManager.loadAnimation(p+M,!0,0);const E=c2(O);w.screenshotManager.cameraFrameManager.setCameraFrameWithName(T,E);const P=w.animationManager.getCurrentClipDuration()/I;for(let N=0;N{for(const b of m){const{traitGroup:B,cameraPosition:M="front",bottomBoneName:I,bottomBoneMaxVertex:S=!1,topBoneName:L,topBoneMaxVertex:O=!0,groupTopOffset:T,groupBotomOffset:y,cameraFrame:E,saveOnlyIDs:U}=b;if((!I||!L)&&(E||console.warn("missing bonename info or camera frame. Skipping")),!B){console.warn("missing trait group for thumbnail info. Skipping");continue}const P=()=>{const W=[];return mt(U).forEach(C=>{W.push({id:C})}),W},N=U==null?v.characterManager.getTraits(B):P();if(N==null){console.log("SKipping Thumbnail Generation for trait group "+B+", its not present in the character manifest.");continue}const z=c2(M);E?v.screenshotManager.cameraFrameManager.setCameraFrameWithName(E,z):v.screenshotManager.cameraFrameManager.frameShot(I,L,z,S,O);for(let W=0;W{const[e,t]=xe.useState(null),[r,i]=xe.useState(null),[s,o]=xe.useState(null),[a,l]=xe.useState(null),[c,A]=xe.useState(null),[u,f]=xe.useState(null),[h,d]=xe.useState(null),[m,g]=xe.useState(null),[p,v]=xe.useState(null),[w,_]=xe.useState(null),[x,b]=xe.useState(null),[B,M]=xe.useState(!1);let I=!1,[S,L]=xe.useState(!1);xe.useEffect(()=>{if(I||S)return;L(!0),I=!0;const{scene:E,camera:U,controls:P,characterManager:N,sceneElements:z}=Q0e("editor-scene");v(U),g(E),t(N),A(z),f(N.animationManager),d(N.lookAtManager),_(P),i(new V0e(N)),o(new j0e(N)),l(new W0e(N))},[]);const O=E=>{E==null&&(E=!B),M(E),m.traverse(U=>{U.isMesh&&U.setDebugMode&&U.setDebugMode(E)})};xe.useEffect(()=>{if(x!=null&&x.defaultAnimations){const E=x.defaultAnimations.map(U=>U.location);u.storeDefaultAnimationPaths(E,"")}},[x]);const T=E=>{E?m.add(c):m.remove(c)},y=E=>{w&&(HM.to(w.target,{x:E.targetX??0,y:E.targetY??0,z:E.targetZ??0,duration:1}),HM.fromTo(w,{maxDistance:w.getDistance(),minDistance:w.getDistance(),minPolarAngle:w.getPolarAngle(),maxPolarAngle:w.getPolarAngle(),minAzimuthAngle:w.getAzimuthalAngle(),maxAzimuthAngle:w.getAzimuthalAngle()},{maxDistance:E.distance,minDistance:E.distance,minPolarAngle:Math.PI/2-.11,maxPolarAngle:Math.PI/2-.11,minAzimuthAngle:-.78,maxAzimuthAngle:-.78,duration:1}).then(()=>{w.minPolarAngle=0,w.maxPolarAngle=3.1415,w.minDistance=.5,w.maxDistance=10,w.minAzimuthAngle=1/0,w.maxAzimuthAngle=1/0}))};return Q.jsx(pr.Provider,{value:{manifest:x,setManifest:b,scene:m,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:a,showEnvironmentModels:T,debugMode:B,toggleDebugMode:O,animationManager:u,lookAtManager:h,camera:p,moveCamera:y,controls:w,sceneElements:c},children:n.children})},X0e={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},yt={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",SAVE:"SAVE",MINT:"MINT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},cs=q.createContext(),Y0e=n=>{const[e,t]=q.useState(X0e.NORMAL),[r,i]=q.useState(yt.LANDING),[s,o]=q.useState(!1),[a,l]=q.useState(!1);return Q.jsx(cs.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},$0e="modulepreload",Z0e=function(n){return"/"+n},WO={},q0e=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=Z0e(s),s in WO)return;WO[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!r)for(let A=i.length-1;A>=0;A--){const u=i[A];if(u.href===s&&(!o||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const c=document.createElement("link");if(c.rel=o?"stylesheet":$0e,o||(c.as="script",c.crossOrigin=""),c.href=s,document.head.appendChild(c),o)return new Promise((A,u)=>{c.addEventListener("load",A),c.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function rx(){return rx=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0)continue;t[r]=n[r]}return t}function eve(n){xe.useEffect(n,[])}var tve=["id","volume","playbackRate","soundEnabled","interrupt","onload"];function nve(n,e){var t=e===void 0?{}:e,r=t.volume,i=r===void 0?1:r,s=t.playbackRate,o=s===void 0?1:s,a=t.soundEnabled,l=a===void 0?!0:a,c=t.interrupt,A=c===void 0?!1:c,u=t.onload,f=J0e(t,tve),h=q.useRef(null),d=q.useRef(!1),m=q.useState(null),g=m[0],p=m[1],v=q.useState(null),w=v[0],_=v[1],x=function(){typeof u=="function"&&u.call(this),d.current&&p(this.duration()*1e3),_(this)};eve(function(){return q0e(()=>import("./howler-cc775aca.js").then(S=>S.h),[]).then(function(S){if(!d.current){var L;h.current=(L=S.Howl)!==null&&L!==void 0?L:S.default.Howl,d.current=!0,new h.current(rx({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:x},f))}}),function(){d.current=!1}}),q.useEffect(function(){h.current&&w&&_(new h.current(rx({src:Array.isArray(n)?n:[n],volume:i,onload:x},f)))},[JSON.stringify(n)]),q.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var b=q.useCallback(function(S){typeof S>"u"&&(S={}),!(!w||!l&&!S.forceSoundEnabled)&&(A&&w.stop(),S.playbackRate&&w.rate(S.playbackRate),w.play(S.id))},[w,l,A]),B=q.useCallback(function(S){w&&w.stop(S)},[w]),M=q.useCallback(function(S){w&&w.pause(S)},[w]),I=[b,{sound:w,stop:B,pause:M,duration:g}];return I}const rve=[{name:"background/cc_bgm.wav",offset:0,duration:123458.58333333334},{name:"background/cc_bgm_balanced.wav",offset:123458.58333333334,duration:123458.60416666666},{name:"effect/character-load.wav",offset:246917.1875,duration:3030},{name:"effect/class-select.wav",offset:249947.1875,duration:2780},{name:"effect/switchingItem.wav",offset:252727.1875,duration:623.75},{name:"ui/back-next-button.wav",offset:253350.9375,duration:155.02083333333334},{name:"ui/class-mouse-over.wav",offset:253505.95833333334,duration:217.52083333333334},{name:"ui/class_click.wav",offset:253723.4791666667,duration:3123.75},{name:"ui/class_pass.wav",offset:256847.2291666667,duration:155},{name:"ui/option_click.wav",offset:257002.2291666667,duration:155.02083333333334},{name:"ui/randomize-button.wav",offset:257157.25000000003,duration:342.5208333333333},{name:"ui/section_click.wav",offset:257499.77083333337,duration:155}],ive="/assets/sounds-3322d50e.mp3",So=xe.createContext(),sve=n=>{const e=i=>rve.find(s=>i.test(s.name)),[t]=nve(ive,{sprite:{switchItem:[e(/switchingItem/).offset,e(/switchingItem/).duration],classSelect:[e(/class-select/).offset,e(/class-select/).duration],characterLoad:[e(/character-load/).offset,e(/character-load/).duration],randomizeButton:[e(/randomize-button/).offset,e(/randomize-button/).duration],classMouseOver:[e(/class-mouse-over/).offset,e(/class-mouse-over/).duration],backNextButton:[e(/back-next-button/).offset,e(/back-next-button/).duration]}}),r=(i,s=0)=>{s===0?t({id:i}):setTimeout(()=>{t({id:i})},s)};return Q.jsx(So.Provider,{value:{playSound:r},children:n.children})};function Ls(n){"@babel/helpers - typeof";return Ls=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ls(n)}function Mo(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function ove(n,e){if(Ls(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(Ls(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function iV(n){var e=ove(n,"string");return Ls(e)=="symbol"?e:e+""}function KO(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,r=Array(e);t1&&arguments[1]!==void 0?arguments[1]:{};Mo(this,n),this.init(e,t)}return Co(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=t||cve,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,r=new Array(t),i=0;i1?r-1:0),s=1;s-1?a.replace(/###/g,"."):a}function i(){return!n||typeof n=="string"}for(var s=typeof e!="string"?[].concat(e):e.split(".");s.length>1;){if(i())return{};var o=r(s.shift());!n[o]&&t&&(n[o]=new t),Object.prototype.hasOwnProperty.call(n,o)?n=n[o]:n={}}return i()?{}:{obj:n,k:r(s.shift())}}function qO(n,e,t){var r=h2(n,e,Object),i=r.obj,s=r.k;i[s]=t}function fve(n,e,t,r){var i=h2(n,e,Object),s=i.obj,o=i.k;s[o]=s[o]||[],r&&(s[o]=s[o].concat(t)),r||s[o].push(t)}function ix(n,e){var t=h2(n,e),r=t.obj,i=t.k;if(r)return r[i]}function hve(n,e,t){var r=ix(n,t);return r!==void 0?r:ix(e,t)}function lV(n,e,t){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in n?typeof n[r]=="string"||n[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?t&&(n[r]=e[r]):lV(n[r],e[r],t):n[r]=e[r]);return n}function kf(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var dve={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function pve(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return dve[e]}):n}var T1=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,mve=[" ",",","?","!",";"];function gve(n,e,t){e=e||"",t=t||"";var r=mve.filter(function(a){return e.indexOf(a)<0&&t.indexOf(a)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(a){return a==="?"?"\\?":a}).join("|"),")")),s=!i.test(n);if(!s){var o=n.indexOf(t);o>0&&!i.test(n.substring(0,o))&&(s=!0)}return s}function sx(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(n){if(n[e])return n[e];for(var r=e.split(t),i=n,s=0;ss+o;)o++,a=r.slice(s,s+o).join(t),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}var c=r.slice(s+o).join(t);return c?sx(l,c,t):void 0}i=i[r[s]]}return i}}function JO(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Py(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var wve=function(n){C1(t,n);var e=vve(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Mo(this,t),i=e.call(this),T1&&wA.call(uA(i)),i.data=r||{},i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return Co(t,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var s=this.options.ns.indexOf(i);s>-1&&this.options.ns.splice(s,1)}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,A=[i,s];o&&typeof o!="string"&&(A=A.concat(o)),o&&typeof o=="string"&&(A=A.concat(l?o.split(l):o)),i.indexOf(".")>-1&&(A=i.split("."));var u=ix(this.data,A);return u||!c||typeof o!="string"?u:sx(this.data&&this.data[i]&&this.data[i][s],o,l)}},{key:"addResource",value:function(i,s,o,a){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},c=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator,A=[i,s];o&&(A=A.concat(c?o.split(c):o)),i.indexOf(".")>-1&&(A=i.split("."),a=s,s=A[1]),this.addNamespaces(s),qO(this.data,A,a),l.silent||this.emit("added",i,s,o,a)}},{key:"addResources",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var l in o)(typeof o[l]=="string"||Object.prototype.toString.apply(o[l])==="[object Array]")&&this.addResource(i,s,l,o[l],{silent:!0});a.silent||this.emit("added",i,s,o)}},{key:"addResourceBundle",value:function(i,s,o,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},A=[i,s];i.indexOf(".")>-1&&(A=i.split("."),a=o,o=s,s=A[1]),this.addNamespaces(s);var u=ix(this.data,A)||{};a?lV(u,o,l):u=Py(Py({},u),o),qO(this.data,A,u),c.silent||this.emit("added",i,s,o)}},{key:"removeResourceBundle",value:function(i,s){this.hasResourceBundle(i,s)&&delete this.data[i][s],this.removeNamespaces(s),this.emit("removed",i,s)}},{key:"hasResourceBundle",value:function(i,s){return this.getResource(i,s)!==void 0}},{key:"getResourceBundle",value:function(i,s){return s||(s=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Py(Py({},{}),this.getResource(i,s)):this.getResource(i,s)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var s=this.getDataByLanguage(i),o=s&&Object.keys(s)||[];return!!o.find(function(a){return s[a]&&Object.keys(s[a]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),t}(wA),cV={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,i,s){var o=this;return e.forEach(function(a){o.processors[a]&&(t=o.processors[a].process(t,r,i,s))}),t}};function e3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function di(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var t3={},n3=function(n){C1(t,n);var e=_ve(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Mo(this,t),i=e.call(this),T1&&wA.call(uA(i)),uve(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,uA(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=Na.create("translator"),i}return Co(t,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var o=this.resolve(i,s);return o&&o.res!==void 0}},{key:"extractFromKey",value:function(i,s){var o=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");var a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,l=s.ns||this.options.defaultNS||[],c=o&&i.indexOf(o)>-1,A=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!gve(i,o,a);if(c&&!A){var u=i.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:i,namespaces:l};var f=i.split(o);(o!==a||o===a&&this.options.ns.indexOf(f[0])>-1)&&(l=f.shift()),i=f.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,s,o){var a=this;if(Ls(s)!=="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),Ls(s)==="object"&&(s=di({},s)),s||(s={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,c=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,A=this.extractFromKey(i[i.length-1],s),u=A.key,f=A.namespaces,h=f[f.length-1],d=s.lng||this.language,m=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(m){var g=s.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(h).concat(g).concat(u),usedKey:u,exactUsedKey:u,usedLng:d,usedNS:h}:"".concat(h).concat(g).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:d,usedNS:h}:u}var p=this.resolve(i,s),v=p&&p.res,w=p&&p.usedKey||u,_=p&&p.exactUsedKey||u,x=Object.prototype.toString.apply(v),b=["[object Number]","[object Function]","[object RegExp]"],B=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,M=!this.i18nFormat||this.i18nFormat.handleAsObject,I=typeof v!="string"&&typeof v!="boolean"&&typeof v!="number";if(M&&v&&I&&b.indexOf(x)<0&&!(typeof B=="string"&&x==="[object Array]")){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,v,di(di({},s),{},{ns:f})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(p.res=S,p):S}if(c){var L=x==="[object Array]",O=L?[]:{},T=L?_:w;for(var y in v)if(Object.prototype.hasOwnProperty.call(v,y)){var E="".concat(T).concat(c).concat(y);O[y]=this.translate(E,di(di({},s),{joinArrays:!1,ns:f})),O[y]===E&&(O[y]=v[y])}v=O}}else if(M&&typeof B=="string"&&x==="[object Array]")v=v.join(B),v&&(v=this.extendTranslation(v,i,s,o));else{var U=!1,P=!1,N=s.count!==void 0&&typeof s.count!="string",z=t.hasDefaultValue(s),W=N?this.pluralResolver.getSuffix(d,s.count,s):"",H=s["defaultValue".concat(W)]||s.defaultValue;!this.isValidLookup(v)&&z&&(U=!0,v=H),this.isValidLookup(v)||(P=!0,v=u);var C=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,K=C&&P?void 0:v,te=z&&H!==v&&this.options.updateMissing;if(P||U||te){if(this.logger.log(te?"updateKey":"missingKey",d,h,u,te?H:v),c){var F=this.resolve(u,di(di({},s),{},{keySeparator:!1}));F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var re=[],ce=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ce&&ce[0])for(var oe=0;oe1&&arguments[1]!==void 0?arguments[1]:{},a,l,c,A,u;return typeof i=="string"&&(i=[i]),i.forEach(function(f){if(!s.isValidLookup(a)){var h=s.extractFromKey(f,o),d=h.key;l=d;var m=h.namespaces;s.options.fallbackNS&&(m=m.concat(s.options.fallbackNS));var g=o.count!==void 0&&typeof o.count!="string",p=g&&!o.ordinal&&o.count===0&&s.pluralResolver.shouldUseIntlApi(),v=o.context!==void 0&&(typeof o.context=="string"||typeof o.context=="number")&&o.context!=="",w=o.lngs?o.lngs:s.languageUtils.toResolveHierarchy(o.lng||s.language,o.fallbackLng);m.forEach(function(_){s.isValidLookup(a)||(u=_,!t3["".concat(w[0],"-").concat(_)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(t3["".concat(w[0],"-").concat(_)]=!0,s.logger.warn('key "'.concat(l,'" for languages "').concat(w.join(", "),`" won't get resolved as namespace "`).concat(u,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),w.forEach(function(x){if(!s.isValidLookup(a)){A=x;var b=[d];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(b,d,x,_,o);else{var B;g&&(B=s.pluralResolver.getSuffix(x,o.count,o));var M="".concat(s.options.pluralSeparator,"zero");if(g&&(b.push(d+B),p&&b.push(d+M)),v){var I="".concat(d).concat(s.options.contextSeparator).concat(o.context);b.push(I),g&&(b.push(I+B),p&&b.push(I+M))}}for(var S;S=b.pop();)s.isValidLookup(a)||(c=S,a=s.getResource(x,_,S,o))}}))})}}),{res:a,usedKey:l,exactUsedKey:c,usedLng:A,usedNS:u}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,s,o,a):this.resourceStore.getResource(i,s,o,a)}}],[{key:"hasDefaultValue",value:function(i){var s="defaultValue";for(var o in i)if(Object.prototype.hasOwnProperty.call(i,o)&&s===o.substring(0,s.length)&&i[o]!==void 0)return!0;return!1}}]),t}(wA);function eS(n){return n.charAt(0).toUpperCase()+n.slice(1)}var r3=function(){function n(e){Mo(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Na.create("languageUtils")}return Co(n,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var r=t.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(t){if(typeof t=="string"&&t.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=t.split("-");return this.options.lowerCaseLng?i=i.map(function(s){return s.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=eS(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=eS(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=eS(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isSupportedCode",value:function(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var r=this;if(!t)return null;var i;return t.forEach(function(s){if(!i){var o=r.formatLanguageCode(s);(!r.options.supportedLngs||r.isSupportedCode(o))&&(i=o)}}),!i&&this.options.supportedLngs&&t.forEach(function(s){if(!i){var o=r.getLanguagePartFromCode(s);if(r.isSupportedCode(o))return i=o;i=r.options.supportedLngs.find(function(a){if(a===o)return a;if(!(a.indexOf("-")<0&&o.indexOf("-")<0)&&a.indexOf(o)===0)return a})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!r)return t.default||[];var i=t[r];return i||(i=t[this.getScriptPartFromCode(r)]),i||(i=t[this.formatLanguageCode(r)]),i||(i=t[this.getLanguagePartFromCode(r)]),i||(i=t.default),i||[]}},{key:"toResolveHierarchy",value:function(t,r){var i=this,s=this.getFallbackCodes(r||this.options.fallbackLng||[],t),o=[],a=function(c){c&&(i.isSupportedCode(c)?o.push(c):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(c)))};return typeof t=="string"&&t.indexOf("-")>-1?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):typeof t=="string"&&a(this.formatLanguageCode(t)),s.forEach(function(l){o.indexOf(l)<0&&a(i.formatLanguageCode(l))}),o}}]),n}(),bve=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Eve={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}},Bve=["v1","v2","v3"],i3={zero:0,one:1,two:2,few:3,many:4,other:5};function Sve(){var n={};return bve.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:Eve[e.fc]}})}),n}var Mve=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Mo(this,n),this.languageUtils=e,this.options=t,this.logger=Na.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Sve()}return Co(n,[{key:"addRule",value:function(t,r){this.rules[t]=r}},{key:"getRule",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(t,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(t,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,i).map(function(s){return"".concat(r).concat(s)})}},{key:"getSuffixes",value:function(t){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort(function(o,a){return i3[o]-i3[a]}).map(function(o){return"".concat(r.options.prepend).concat(o)}):s.numbers.map(function(o){return r.getSuffix(t,o,i)}):[]}},{key:"getSuffix",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(s.select(r)):this.getSuffixRetroCompatible(s,r):(this.logger.warn("no plural rule found for: ".concat(t)),"")}},{key:"getSuffixRetroCompatible",value:function(t,r){var i=this,s=t.noAbs?t.plurals(r):t.plurals(Math.abs(r)),o=t.numbers[s];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));var a=function(){return i.options.prepend&&o.toString()?i.options.prepend+o.toString():o.toString()};return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?"_plural_".concat(o.toString()):a():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?a():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}},{key:"shouldUseIntlApi",value:function(){return!Bve.includes(this.options.compatibilityJSON)}}]),n}();function s3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function No(n){for(var e=1;e3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=hve(n,e,t);return!s&&i&&typeof t=="string"&&(s=sx(n,t,r),s===void 0&&(s=sx(e,t,r))),s}var Cve=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Mo(this,n),this.logger=Na.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return Co(n,[{key:"init",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var r=t.interpolation;this.escape=r.escape!==void 0?r.escape:pve,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?kf(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?kf(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?kf(r.nestingPrefix):r.nestingPrefixEscaped||kf("$t("),this.nestingSuffix=r.nestingSuffix?kf(r.nestingSuffix):r.nestingSuffixEscaped||kf(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(t,r,i,s){var o=this,a,l,c,A=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(g){return g.replace(/\$/g,"$$$$")}var f=function(p){if(p.indexOf(o.formatSeparator)<0){var v=o3(r,A,p,o.options.keySeparator,o.options.ignoreJSONStructure);return o.alwaysFormat?o.format(v,void 0,i,No(No(No({},s),r),{},{interpolationkey:p})):v}var w=p.split(o.formatSeparator),_=w.shift().trim(),x=w.join(o.formatSeparator).trim();return o.format(o3(r,A,_,o.options.keySeparator,o.options.ignoreJSONStructure),x,i,No(No(No({},s),r),{},{interpolationkey:_}))};this.resetRegExp();var h=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,d=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,m=[{regex:this.regexpUnescape,safeValue:function(p){return u(p)}},{regex:this.regexp,safeValue:function(p){return o.escapeValue?u(o.escape(p)):u(p)}}];return m.forEach(function(g){for(c=0;a=g.regex.exec(t);){var p=a[1].trim();if(l=f(p),l===void 0)if(typeof h=="function"){var v=h(t,a,s);l=typeof v=="string"?v:""}else if(s&&Object.prototype.hasOwnProperty.call(s,p))l="";else if(d){l=a[0];continue}else o.logger.warn("missed to pass in variable ".concat(p," for interpolating ").concat(t)),l="";else typeof l!="string"&&!o.useRawValueToEscape&&(l=ZO(l));var w=g.safeValue(l);if(t=t.replace(a[0],w),d?(g.regex.lastIndex+=l.length,g.regex.lastIndex-=a[0].length):g.regex.lastIndex=0,c++,c>=o.maxReplaces)break}}),t}},{key:"nest",value:function(t,r){var i=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,a,l;function c(h,d){var m=this.nestingOptionsSeparator;if(h.indexOf(m)<0)return h;var g=h.split(new RegExp("".concat(m,"[ ]*{"))),p="{".concat(g[1]);h=g[0],p=this.interpolate(p,l);var v=p.match(/'/g),w=p.match(/"/g);(v&&v.length%2===0&&!w||w.length%2!==0)&&(p=p.replace(/'/g,'"'));try{l=JSON.parse(p),d&&(l=No(No({},d),l))}catch(_){return this.logger.warn("failed parsing options string in nesting for key ".concat(h),_),"".concat(h).concat(m).concat(p)}return delete l.defaultValue,h}for(;o=this.nestingRegexp.exec(t);){var A=[];l=No({},s),l=l.replace&&typeof l.replace!="string"?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;var u=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){var f=o[1].split(this.formatSeparator).map(function(h){return h.trim()});o[1]=f.shift(),A=f,u=!0}if(a=r(c.call(this,o[1].trim(),l),l),a&&o[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=ZO(a)),a||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),a=""),u&&(a=A.reduce(function(h,d){return i.format(h,d,s.lng,No(No({},s),{},{interpolationkey:o[1].trim()}))},a.trim())),t=t.replace(o[0],a),this.regexp.lastIndex=0}return t}}]),n}();function a3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function yl(n){for(var e=1;e-1){var r=n.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)t.currency||(t.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)t.range||(t.range=i.trim());else{var s=i.split(";");s.forEach(function(o){if(o){var a=o.split(":"),l=lve(a),c=l[0],A=l.slice(1),u=A.join(":").trim().replace(/^'+|'+$/g,"");t[c.trim()]||(t[c.trim()]=u),u==="false"&&(t[c.trim()]=!1),u==="true"&&(t[c.trim()]=!0),isNaN(u)||(t[c.trim()]=parseInt(u,10))}})}}return{formatName:e,formatOptions:t}}function Hf(n){var e={};return function(r,i,s){var o=i+JSON.stringify(s),a=e[o];return a||(a=n(i,s),e[o]=a),a(r)}}var Ive=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Mo(this,n),this.logger=Na.create("formatter"),this.options=e,this.formats={number:Hf(function(t,r){var i=new Intl.NumberFormat(t,yl({},r));return function(s){return i.format(s)}}),currency:Hf(function(t,r){var i=new Intl.NumberFormat(t,yl(yl({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:Hf(function(t,r){var i=new Intl.DateTimeFormat(t,yl({},r));return function(s){return i.format(s)}}),relativetime:Hf(function(t,r){var i=new Intl.RelativeTimeFormat(t,yl({},r));return function(s){return i.format(s,r.range||"day")}}),list:Hf(function(t,r){var i=new Intl.ListFormat(t,yl({},r));return function(s){return i.format(s)}})},this.init(e)}return Co(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(t,r){this.formats[t.toLowerCase().trim()]=r}},{key:"addCached",value:function(t,r){this.formats[t.toLowerCase().trim()]=Hf(r)}},{key:"format",value:function(t,r,i){var s=this,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=r.split(this.formatSeparator),l=a.reduce(function(c,A){var u=Tve(A),f=u.formatName,h=u.formatOptions;if(s.formats[f]){var d=c;try{var m=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},g=m.locale||m.lng||o.locale||o.lng||i;d=s.formats[f](c,g,yl(yl(yl({},h),o),m))}catch(p){s.logger.warn(p)}return d}else s.logger.warn("there was no format function for ".concat(f));return c},t);return l}}]),n}();function l3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function c3(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Fve(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var Pve=function(n){C1(t,n);var e=Rve(t);function t(r,i,s){var o,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Mo(this,t),o=e.call(this),T1&&wA.call(uA(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=Na.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(s,a.backend,a),o}return Co(t,[{key:"queueLoad",value:function(i,s,o,a){var l=this,c={},A={},u={},f={};return i.forEach(function(h){var d=!0;s.forEach(function(m){var g="".concat(h,"|").concat(m);!o.reload&&l.store.hasResourceBundle(h,m)?l.state[g]=2:l.state[g]<0||(l.state[g]===1?A[g]===void 0&&(A[g]=!0):(l.state[g]=1,d=!1,A[g]===void 0&&(A[g]=!0),c[g]===void 0&&(c[g]=!0),f[m]===void 0&&(f[m]=!0)))}),d||(u[h]=!0)}),(Object.keys(c).length||Object.keys(A).length)&&this.queue.push({pending:A,pendingCount:Object.keys(A).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(c),pending:Object.keys(A),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(f)}}},{key:"loaded",value:function(i,s,o){var a=i.split("|"),l=a[0],c=a[1];s&&this.emit("failedLoading",l,c,s),o&&this.store.addResourceBundle(l,c,o),this.state[i]=s?-1:2;var A={};this.queue.forEach(function(u){fve(u.loaded,[l],c),Fve(u,i),s&&u.errors.push(s),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(f){A[f]||(A[f]={});var h=u.loaded[f];h.length&&h.forEach(function(d){A[f][d]===void 0&&(A[f][d]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",A),this.queue=this.queue.filter(function(u){return!u.done})}},{key:"read",value:function(i,s,o){var a=this,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,A=arguments.length>5?arguments[5]:void 0;if(!i.length)return A(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:s,fcName:o,tried:l,wait:c,callback:A});return}this.readingCalls++;var u=function(m,g){if(a.readingCalls--,a.waitingReads.length>0){var p=a.waitingReads.shift();a.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(m&&g&&l2&&arguments[2]!==void 0?arguments[2]:{},l=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof s=="string"&&(s=[s]);var c=this.queueLoad(i,s,a,l);if(!c.toLoad.length)return c.pending.length||l(),null;c.toLoad.forEach(function(A){o.loadOne(A)})}},{key:"load",value:function(i,s,o){this.prepareLoading(i,s,{},o)}},{key:"reload",value:function(i,s,o){this.prepareLoading(i,s,{reload:!0},o)}},{key:"loadOne",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",a=i.split("|"),l=a[0],c=a[1];this.read(l,c,"read",void 0,void 0,function(A,u){A&&s.logger.warn("".concat(o,"loading namespace ").concat(c," for language ").concat(l," failed"),A),!A&&u&&s.logger.log("".concat(o,"loaded namespace ").concat(c," for language ").concat(l),u),s.loaded(i,A,u)})}},{key:"saveMissing",value:function(i,s,o,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},A=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(s)){this.logger.warn('did not save key "'.concat(o,'" as the namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend&&this.backend.create){var u=c3(c3({},c),{},{isUpdate:l}),f=this.backend.create.bind(this.backend);if(f.length<6)try{var h;f.length===5?h=f(i,s,o,a,u):h=f(i,s,o,a),h&&typeof h.then=="function"?h.then(function(d){return A(null,d)}).catch(A):A(null,h)}catch(d){A(d)}else f(i,s,o,a,A,u)}!i||!i[0]||this.store.addResource(i[0],s,o,a)}}}]),t}(wA);function A3(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if(Ls(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),Ls(e[2])==="object"||Ls(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){t[i]=r[i]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function u3(n){return typeof n.ns=="string"&&(n.ns=[n.ns]),typeof n.fallbackLng=="string"&&(n.fallbackLng=[n.fallbackLng]),typeof n.fallbackNS=="string"&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&n.supportedLngs.indexOf("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n}function f3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function ga(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Ly(){}function Nve(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var ox=function(n){C1(t,n);var e=Lve(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(Mo(this,t),r=e.call(this),T1&&wA.call(uA(r)),r.options=u3(i),r.services={},r.logger=Na,r.modules={external:[]},Nve(uA(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),b0(r,uA(r));setTimeout(function(){r.init(i,s)},0)}return r}return Co(t,[{key:"init",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;typeof s=="function"&&(o=s,s={}),!s.defaultNS&&s.defaultNS!==!1&&s.ns&&(typeof s.ns=="string"?s.defaultNS=s.ns:s.ns.indexOf("translation")<0&&(s.defaultNS=s.ns[0]));var a=A3();this.options=ga(ga(ga({},a),this.options),u3(s)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=ga(ga({},a.interpolation),this.options.interpolation)),s.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=s.keySeparator),s.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=s.nsSeparator);function l(p){return p?typeof p=="function"?new p:p:null}if(!this.options.isClone){this.modules.logger?Na.init(l(this.modules.logger),this.options):Na.init(null,this.options);var c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Ive);var A=new r3(this.options);this.store=new wve(this.options.resources,this.options);var u=this.services;u.logger=Na,u.resourceStore=this.store,u.languageUtils=A,u.pluralResolver=new Mve(A,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(u.formatter=l(c),u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new Cve(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new Pve(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(p){for(var v=arguments.length,w=new Array(v>1?v-1:0),_=1;_1?v-1:0),_=1;_0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var h=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];h.forEach(function(p){i[p]=function(){var v;return(v=i.store)[p].apply(v,arguments)}});var d=["addResource","addResources","addResourceBundle","removeResourceBundle"];d.forEach(function(p){i[p]=function(){var v;return(v=i.store)[p].apply(v,arguments),i}});var m=im(),g=function(){var v=function(_,x){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),m.resolve(x),o(_,x)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return v(null,i.t.bind(i));i.changeLanguage(i.options.lng,v)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),m}},{key:"loadResources",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ly,a=o,l=typeof i=="string"?i:this.language;if(typeof i=="function"&&(a=i),!this.options.resources||this.options.partialBundledLanguages){if(l&&l.toLowerCase()==="cimode")return a();var c=[],A=function(h){if(h){var d=s.services.languageUtils.toResolveHierarchy(h);d.forEach(function(m){c.indexOf(m)<0&&c.push(m)})}};if(l)A(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(f){return A(f)})}this.options.preload&&this.options.preload.forEach(function(f){return A(f)}),this.services.backendConnector.load(c,this.options.ns,function(f){!f&&!s.resolvedLanguage&&s.language&&s.setResolvedLanguage(s.language),a(f)})}else a(null)}},{key:"reloadResources",value:function(i,s,o){var a=im();return i||(i=this.languages),s||(s=this.options.ns),o||(o=Ly),this.services.backendConnector.reload(i,s,function(l){a.resolve(),o(l)}),a}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&cV.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var s=0;s-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}}},{key:"changeLanguage",value:function(i,s){var o=this;this.isLanguageChangingTo=i;var a=im();this.emit("languageChanging",i);var l=function(f){o.language=f,o.languages=o.services.languageUtils.toResolveHierarchy(f),o.resolvedLanguage=void 0,o.setResolvedLanguage(f)},c=function(f,h){h?(l(h),o.translator.changeLanguage(h),o.isLanguageChangingTo=void 0,o.emit("languageChanged",h),o.logger.log("languageChanged",h)):o.isLanguageChangingTo=void 0,a.resolve(function(){return o.t.apply(o,arguments)}),s&&s(f,function(){return o.t.apply(o,arguments)})},A=function(f){!i&&!f&&o.services.languageDetector&&(f=[]);var h=typeof f=="string"?f:o.services.languageUtils.getBestMatchFromCodes(f);h&&(o.language||l(h),o.translator.language||o.translator.changeLanguage(h),o.services.languageDetector&&o.services.languageDetector.cacheUserLanguage&&o.services.languageDetector.cacheUserLanguage(h)),o.loadResources(h,function(d){c(d,h)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?A(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(A):this.services.languageDetector.detect(A):A(i),a}},{key:"getFixedT",value:function(i,s,o){var a=this,l=function c(A,u){var f;if(Ls(u)!=="object"){for(var h=arguments.length,d=new Array(h>2?h-2:0),m=2;m1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var a=o.lng||this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var A=function(h,d){var m=s.services.backendConnector.state["".concat(h,"|").concat(d)];return m===-1||m===2};if(o.precheck){var u=o.precheck(this,A);if(u!==void 0)return u}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||A(a,i)&&(!l||A(c,i)))}},{key:"loadNamespaces",value:function(i,s){var o=this,a=im();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(l){o.options.ns.indexOf(l)<0&&o.options.ns.push(l)}),this.loadResources(function(l){a.resolve(),s&&s(l)}),a):(s&&s(),Promise.resolve())}},{key:"loadLanguages",value:function(i,s){var o=im();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(c){return a.indexOf(c)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(c){o.resolve(),s&&s(c)}),o):(s&&s(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var s=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services&&this.services.languageUtils||new r3(A3());return s.indexOf(o.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ly,a=ga(ga(ga({},this.options),s),{isClone:!0}),l=new t(a);(s.debug!==void 0||s.prefix!==void 0)&&(l.logger=l.logger.clone(s));var c=["store","services","language"];return c.forEach(function(A){l[A]=i[A]}),l.services=ga({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new n3(l.services,l.options),l.translator.on("*",function(A){for(var u=arguments.length,f=new Array(u>1?u-1:0),h=1;h0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new ox(n,e)});var Mi=ox.createInstance();Mi.createInstance=ox.createInstance;Mi.createInstance;Mi.dir;Mi.init;Mi.loadResources;Mi.reloadResources;Mi.use;Mi.changeLanguage;Mi.getFixedT;Mi.t;Mi.exists;Mi.setDefaultNamespace;Mi.hasLoadedNamespace;Mi.loadNamespaces;Mi.loadLanguages;function Ove(){if(console&&console.warn){for(var n,e=arguments.length,t=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var o=function(l,c){var A=e.services.backendConnector.state["".concat(l,"|").concat(c)];return A===-1||A===2};return t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!o(e.isLanguageChangingTo,n)?!1:!!(e.hasResourceBundle(r,n)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||o(r,n)&&(!i||o(s,n)))}function Hve(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return bT("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(n,{lng:t.lng,precheck:function(s,o){if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!o(s.isLanguageChangingTo,n))return!1}}):kve(n,e,t)}var Qve=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,zve={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Gve=function(e){return zve[e]},Vve=function(e){return e.replace(Qve,Gve)};function m3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function g3(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};ET=g3(g3({},ET),n)}function Wve(){return ET}var uV;function Kve(n){uV=n}function Xve(){return uV}var Yve={type:"3rdParty",init:function(e){jve(e.options.react),Kve(e)}},$ve=xe.createContext(),Zve=function(){function n(){Mo(this,n),this.usedNamespaces={}}return Co(n,[{key:"addUsedNamespaces",value:function(t){var r=this;t.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),n}();function qve(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=s.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(A){c=!0,i=A}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function Jve(n,e){return sV(n)||qve(n,e)||oV(n,e)||aV()}function v3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function tS(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=xe.useContext($ve)||{},i=r.i18n,s=r.defaultNS,o=t||i||Xve();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new Zve),!o){bT("You will need to pass in an i18next instance by using initReactI18next");var a=function(I,S){return typeof S=="string"?S:S&&Ls(S)==="object"&&typeof S.defaultValue=="string"?S.defaultValue:Array.isArray(I)?I[I.length-1]:I},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}o.options.react&&o.options.react.wait!==void 0&&bT("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var c=tS(tS(tS({},Wve()),o.options.react),e),A=c.useSuspense,u=c.keyPrefix,f=n||s||o.options&&o.options.defaultNS;f=typeof f=="string"?[f]:f||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(f);var h=(o.isInitialized||o.initializedStoreOnce)&&f.every(function(M){return Hve(M,o,c)});function d(){return o.getFixedT(e.lng||null,c.nsMode==="fallback"?f:f[0],u)}var m=xe.useState(d),g=Jve(m,2),p=g[0],v=g[1],w=f.join();e.lng&&(w="".concat(e.lng).concat(w));var _=eye(w),x=xe.useRef(!0);xe.useEffect(function(){var M=c.bindI18n,I=c.bindI18nStore;x.current=!0,!h&&!A&&(e.lng?p3(o,e.lng,f,function(){x.current&&v(d)}):d3(o,f,function(){x.current&&v(d)})),h&&_&&_!==w&&x.current&&v(d);function S(){x.current&&v(d)}return M&&o&&o.on(M,S),I&&o&&o.store.on(I,S),function(){x.current=!1,M&&o&&M.split(" ").forEach(function(L){return o.off(L,S)}),I&&o&&I.split(" ").forEach(function(L){return o.store.off(L,S)})}},[o,w]);var b=xe.useRef(!0);xe.useEffect(function(){x.current&&!b.current&&v(d),b.current=!1},[o,u]);var B=[p,o,h];if(B.t=p,B.i18n=o,B.ready=h,h||!h&&!A)return B;throw new Promise(function(M){e.lng?p3(o,e.lng,f,function(){return M()}):d3(o,f,function(){return M()})})}var fV=[],nye=fV.forEach,rye=fV.slice;function iye(n){return nye.call(rye.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var y3=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,sye=function(e,t,r){var i=r||{};i.path=i.path||"/";var s=encodeURIComponent(t),o="".concat(e,"=").concat(s);if(i.maxAge>0){var a=i.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(a))}if(i.domain){if(!y3.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!y3.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},w3={create:function(e,t,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+r*60*1e3)),i&&(s.domain=i),document.cookie=sye(e,encodeURIComponent(t),s)},read:function(e){for(var t="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),s=i.split("&"),o=0;o0){var l=s[o].substring(0,a);l===e.lookupQuerystring&&(t=s[o].substring(a+1))}}}return t}},sm=null,_3=function(){if(sm!==null)return sm;try{sm=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{sm=!1}return sm},lye={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&_3()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&_3()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},om=null,x3=function(){if(om!==null)return om;try{om=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{om=!1}return om},cye={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&x3()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&x3()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Aye={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},uye={name:"htmlTag",lookup:function(e){var t,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(t=r.getAttribute("lang")),t}},fye={name:"path",lookup:function(e){var t;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;t=r[e.lookupFromPathIndex].replace("/","")}else t=r[0].replace("/","")}return t}},hye={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[t]}};function dye(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}}var hV=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Mo(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return Co(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=iye(r,this.options||{},dye()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(s){return s.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(oye),this.addDetector(aye),this.addDetector(lye),this.addDetector(cye),this.addDetector(Aye),this.addDetector(uye),this.addDetector(fye),this.addDetector(hye)}},{key:"addDetector",value:function(t){return this.detectors[t.name]=t,this}},{key:"detect",value:function(t){var r=this;t||(t=this.options.order);var i=[];return t.forEach(function(s){if(r.detectors[s]){var o=r.detectors[s].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(i=i.concat(o))}}),i=i.map(function(s){return r.options.convertDetectedLanguage(s)}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(t,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(function(s){i.detectors[s]&&i.detectors[s].cacheUserLanguage(t,i.options)}))}}]),n}();hV.type="languageDetector";const pye={translation:{pageTitles:{chooseClass:"Choose Character Class",chooseAppearance:"Choose Appearance",saveCharacter:"Save Your Character"},callToAction:{next:"Next",back:"Back",randomize:"Randomize",send:"Send"},editor:{title:"Appearance",head:"Head",body:"Body",eyes:"Eyes",outer:"Outer",chest:"Chest",legs:"Legs",feet:"Feet",accessories:"Accessories"},labels:{name:"Name",voice:"Voice",favoriteColor:"Favorite Color",preferredGreeting:"Preferred Greeting",question:"Question",yourName:"Your Name",conversation:"Conversation"},text:{unoptimized:"Unoptimized",apiUnderMaintnance:"Voice generation API is temporarily disabled for maintenance!"}}},mye={translation:{pageTitles:{chooseClass:"Выбрать Класс Персонажа",chooseAppearance:"Выбрать Внешность",saveCharacter:"Сохранить Персонажа"},callToAction:{next:"Далее",back:"Назад",randomize:"Рандомизировать",send:"Отправить"},editor:{title:"Внешность",head:"Голова",body:"Тело",eyes:"Глаза",outer:"Внешний",chest:"Грудь",legs:"Ноги",feet:"Стопы",accessories:"Аксессуары"},labels:{name:"Имя",voice:"Голос",favoriteColor:"Любимый Цвет",preferredGreeting:"Предпочитаемое Приветствие",question:"Вопрос",yourName:"Ваше Имя",conversation:"Разговор"},text:{unoptimized:"Неоптимизи­рованный",apiUnderMaintnance:"API генерации голоса временно отключен на техническое обслуживание."}}},gye={translation:{pageTitles:{chooseClass:"选择角色类型",chooseAppearance:"选择外观",saveCharacter:"保存角色"},callToAction:{next:"下一步",back:"返回",randomize:"随机",send:"发送"},editor:{title:"外观",head:"头部",body:"身体",eyes:"眼睛",outer:"外套",chest:"上身",legs:"腿部",feet:"脚部",accessories:"配件"},labels:{name:"名字",voice:"语音",favoriteColor:"颜色偏好",preferredGreeting:"首选问候语",question:"问题",yourName:"你的名字",conversation:"对话"},text:{unoptimized:"未优化",apiUnderMaintnance:"语音生成API暂时关闭进行维护!"}}},vye={en:pye,ru:mye,zh:gye};Mi.use(hV).use(Yve).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:vye});const aa=xe.createContext(),yye=n=>{const{t:e}=tye();return Q.jsx(aa.Provider,{value:{t:e},children:n.children})},wye=` +*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(r,i,s){function o(c,A){if(!i[c]){if(!r[c]){var u=typeof Dy=="function"&&Dy;if(!A&&u)return u(c,!0);if(a)return a(c,!0);var f=new Error("Cannot find module '"+c+"'");throw f.code="MODULE_NOT_FOUND",f}var h=i[c]={exports:{}};r[c][0].call(h.exports,function(d){var m=r[c][1][d];return o(m||d)},h,h.exports,t,r,i,s)}return i[c].exports}for(var a=typeof Dy=="function"&&Dy,l=0;l>2,h=(3&c)<<4|A>>4,d=1>6:64,m=2>4,A=(15&f)<<4|(h=a.indexOf(l.charAt(m++)))>>2,u=(3&h)<<6|(d=a.indexOf(l.charAt(m++))),v[g++]=c,h!==64&&(v[g++]=A),d!==64&&(v[g++]=u);return v}},{"./support":30,"./utils":32}],2:[function(t,r,i){var s=t("./external"),o=t("./stream/DataWorker"),a=t("./stream/Crc32Probe"),l=t("./stream/DataLengthProbe");function c(A,u,f,h,d){this.compressedSize=A,this.uncompressedSize=u,this.crc32=f,this.compression=h,this.compressedContent=d}c.prototype={getContentWorker:function(){var A=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return A.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),A},getCompressedWorker:function(){return new o(s.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},c.createWorkerFrom=function(A,u,f){return A.pipe(new a).pipe(new l("uncompressedSize")).pipe(u.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",u)},r.exports=c},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(t,r,i){var s=t("./stream/GenericWorker");i.STORE={magic:"\0\0",compressWorker:function(){return new s("STORE compression")},uncompressWorker:function(){return new s("STORE decompression")}},i.DEFLATE=t("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(t,r,i){var s=t("./utils"),o=function(){for(var a,l=[],c=0;c<256;c++){a=c;for(var A=0;A<8;A++)a=1&a?3988292384^a>>>1:a>>>1;l[c]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(c,A,u,f){var h=o,d=f+u;c^=-1;for(var m=f;m>>8^h[255&(c^A[m])];return-1^c}(0|l,a,a.length,0):function(c,A,u,f){var h=o,d=f+u;c^=-1;for(var m=f;m>>8^h[255&(c^A.charCodeAt(m))];return-1^c}(0|l,a,a.length,0):0}},{"./utils":32}],5:[function(t,r,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,r,i){var s=null;s=typeof Promise<"u"?Promise:t("lie"),r.exports={Promise:s}},{lie:37}],7:[function(t,r,i){var s=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",o=t("pako"),a=t("./utils"),l=t("./stream/GenericWorker"),c=s?"uint8array":"array";function A(u,f){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(A,l),A.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(c,u.data),!1)},A.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},A.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},A.prototype._createPako=function(){this._pako=new o[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var u=this;this._pako.onData=function(f){u.push({data:f,meta:u.meta})}},i.compressWorker=function(u){return new A("Deflate",u)},i.uncompressWorker=function(){return new A("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,i){function s(h,d){var m,g="";for(m=0;m>>=8;return g}function o(h,d,m,g,p,v){var w,_,x=h.file,b=h.compression,B=v!==c.utf8encode,S=a.transformTo("string",v(x.name)),I=a.transformTo("string",c.utf8encode(x.name)),M=x.comment,P=a.transformTo("string",v(M)),D=a.transformTo("string",c.utf8encode(M)),T=I.length!==x.name.length,y=D.length!==M.length,E="",R="",L="",N=x.dir,z=x.date,W={crc32:0,compressedSize:0,uncompressedSize:0};d&&!m||(W.crc32=h.crc32,W.compressedSize=h.compressedSize,W.uncompressedSize=h.uncompressedSize);var H=0;d&&(H|=8),B||!T&&!y||(H|=2048);var C=0,K=0;N&&(C|=16),p==="UNIX"?(K=798,C|=function(F,re){var ce=F;return F||(ce=re?16893:33204),(65535&ce)<<16}(x.unixPermissions,N)):(K=20,C|=function(F){return 63&(F||0)}(x.dosPermissions)),w=z.getUTCHours(),w<<=6,w|=z.getUTCMinutes(),w<<=5,w|=z.getUTCSeconds()/2,_=z.getUTCFullYear()-1980,_<<=4,_|=z.getUTCMonth()+1,_<<=5,_|=z.getUTCDate(),T&&(R=s(1,1)+s(A(S),4)+I,E+="up"+s(R.length,2)+R),y&&(L=s(1,1)+s(A(P),4)+D,E+="uc"+s(L.length,2)+L);var ee="";return ee+=` +\0`,ee+=s(H,2),ee+=b.magic,ee+=s(w,2),ee+=s(_,2),ee+=s(W.crc32,4),ee+=s(W.compressedSize,4),ee+=s(W.uncompressedSize,4),ee+=s(S.length,2),ee+=s(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+ee+S+E,dirRecord:u.CENTRAL_FILE_HEADER+s(K,2)+ee+s(P.length,2)+"\0\0\0\0"+s(C,4)+s(g,4)+S+E+P}}var a=t("../utils"),l=t("../stream/GenericWorker"),c=t("../utf8"),A=t("../crc32"),u=t("../signature");function f(h,d,m,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=d,this.zipPlatform=m,this.encodeFileName=g,this.streamFiles=h,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(f,l),f.prototype.push=function(h){var d=h.meta.percent||0,m=this.entriesCount,g=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:m?(d+100*(m-g-1))/m:100}}))},f.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var d=this.streamFiles&&!h.file.dir;if(d){var m=o(h,d,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:m.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(h){this.accumulate=!1;var d=this.streamFiles&&!h.file.dir,m=o(h,d,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(m.dirRecord),d)this.push({data:function(g){return u.DATA_DESCRIPTOR+s(g.crc32,4)+s(g.compressedSize,4)+s(g.uncompressedSize,4)}(h),meta:{percent:100}});else for(this.push({data:m.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var h=this.bytesWritten,d=0;d=this.index;l--)c=(c<<8)+this.byteAt(l);return this.index+=a,c},readString:function(a){return s.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))}},r.exports=o},{"../utils":32}],19:[function(t,r,i){var s=t("./Uint8ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.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},r.exports=o},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(t,r,i){var s=t("./DataReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.prototype.byteAt=function(a){return this.data.charCodeAt(this.zero+a)},o.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)-this.zero},o.prototype.readAndCheckSignature=function(a){return a===this.readData(4)},o.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},r.exports=o},{"../utils":32,"./DataReader":18}],21:[function(t,r,i){var s=t("./ArrayReader");function o(a){s.call(this,a)}t("../utils").inherits(o,s),o.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},r.exports=o},{"../utils":32,"./ArrayReader":17}],22:[function(t,r,i){var s=t("../utils"),o=t("../support"),a=t("./ArrayReader"),l=t("./StringReader"),c=t("./NodeBufferReader"),A=t("./Uint8ArrayReader");r.exports=function(u){var f=s.getTypeOf(u);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new c(u):o.uint8array?new A(s.transformTo("uint8array",u)):new a(s.transformTo("array",u)):new l(u)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(t,r,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,r,i){var s=t("./GenericWorker"),o=t("../utils");function a(l){s.call(this,"ConvertWorker to "+l),this.destType=l}o.inherits(a,s),a.prototype.processChunk=function(l){this.push({data:o.transformTo(this.destType,l.data),meta:l.meta})},r.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(t,r,i){var s=t("./GenericWorker"),o=t("../crc32");function a(){s.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}t("../utils").inherits(a,s),a.prototype.processChunk=function(l){this.streamInfo.crc32=o(l.data,this.streamInfo.crc32||0),this.push(l)},r.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataLengthProbe for "+l),this.propName=l,this.withStreamInfo(l,0)}s.inherits(a,o),a.prototype.processChunk=function(l){if(l){var c=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=c+l.data.length}o.prototype.processChunk.call(this,l)},r.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(t,r,i){var s=t("../utils"),o=t("./GenericWorker");function a(l){o.call(this,"DataWorker");var c=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(A){c.dataIsReady=!0,c.data=A,c.max=A&&A.length||0,c.type=s.getTypeOf(A),c.isPaused||c._tickAndRepeat()},function(A){c.error(A)})}s.inherits(a,o),a.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,s.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(s.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var l=null,c=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,c);break;case"uint8array":l=this.data.subarray(this.index,c);break;case"array":case"nodebuffer":l=this.data.slice(this.index,c)}return this.index=c,this.push({data:l,meta:{percent:this.max?this.index/this.max*100:0}})},r.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(t,r,i){function s(o){this.name=o||"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}s.prototype={push:function(o){this.emit("data",o)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(o){this.emit("error",o)}return!0},error:function(o){return!this.isFinished&&(this.isPaused?this.generatedError=o:(this.isFinished=!0,this.emit("error",o),this.previous&&this.previous.error(o),this.cleanUp()),!0)},on:function(o,a){return this._listeners[o].push(a),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(o,a){if(this._listeners[o])for(var l=0;l "+o:o}},r.exports=s},{}],29:[function(t,r,i){var s=t("../utils"),o=t("./ConvertWorker"),a=t("./GenericWorker"),l=t("../base64"),c=t("../support"),A=t("../external"),u=null;if(c.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(d,m){return new A.Promise(function(g,p){var v=[],w=d._internalType,_=d._outputType,x=d._mimeType;d.on("data",function(b,B){v.push(b),m&&m(B)}).on("error",function(b){v=[],p(b)}).on("end",function(){try{var b=function(B,S,I){switch(B){case"blob":return s.newBlob(s.transformTo("arraybuffer",S),I);case"base64":return l.encode(S);default:return s.transformTo(B,S)}}(_,function(B,S){var I,M=0,P=null,D=0;for(I=0;I"u")i.blob=!1;else{var s=new ArrayBuffer(0);try{i.blob=new Blob([s],{type:"application/zip"}).size===0}catch{try{var o=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);o.append(s),i.blob=o.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,r,i){for(var s=t("./utils"),o=t("./support"),a=t("./nodejsUtils"),l=t("./stream/GenericWorker"),c=new Array(256),A=0;A<256;A++)c[A]=252<=A?6:248<=A?5:240<=A?4:224<=A?3:192<=A?2:1;c[254]=c[254]=1;function u(){l.call(this,"utf-8 decode"),this.leftOver=null}function f(){l.call(this,"utf-8 encode")}i.utf8encode=function(h){return o.nodebuffer?a.newBufferFrom(h,"utf-8"):function(d){var m,g,p,v,w,_=d.length,x=0;for(v=0;v<_;v++)(64512&(g=d.charCodeAt(v)))==55296&&v+1<_&&(64512&(p=d.charCodeAt(v+1)))==56320&&(g=65536+(g-55296<<10)+(p-56320),v++),x+=g<128?1:g<2048?2:g<65536?3:4;for(m=o.uint8array?new Uint8Array(x):new Array(x),v=w=0;w>>6:(g<65536?m[w++]=224|g>>>12:(m[w++]=240|g>>>18,m[w++]=128|g>>>12&63),m[w++]=128|g>>>6&63),m[w++]=128|63&g);return m}(h)},i.utf8decode=function(h){return o.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(d){var m,g,p,v,w=d.length,_=new Array(2*w);for(m=g=0;m>10&1023,_[g++]=56320|1023&p)}return _.length!==g&&(_.subarray?_=_.subarray(0,g):_.length=g),s.applyFromCharCode(_)}(h=s.transformTo(o.uint8array?"uint8array":"array",h))},s.inherits(u,l),u.prototype.processChunk=function(h){var d=s.transformTo(o.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var m=d;(d=new Uint8Array(m.length+this.leftOver.length)).set(this.leftOver,0),d.set(m,this.leftOver.length)}else d=this.leftOver.concat(d);this.leftOver=null}var g=function(v,w){var _;for((w=w||v.length)>v.length&&(w=v.length),_=w-1;0<=_&&(192&v[_])==128;)_--;return _<0||_===0?w:_+c[v[_]]>w?_:w}(d),p=d;g!==d.length&&(o.uint8array?(p=d.subarray(0,g),this.leftOver=d.subarray(g,d.length)):(p=d.slice(0,g),this.leftOver=d.slice(g,d.length))),this.push({data:i.utf8decode(p),meta:h.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:i.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},i.Utf8DecodeWorker=u,s.inherits(f,l),f.prototype.processChunk=function(h){this.push({data:i.utf8encode(h.data),meta:h.meta})},i.Utf8EncodeWorker=f},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(t,r,i){var s=t("./support"),o=t("./base64"),a=t("./nodejsUtils"),l=t("./external");function c(m){return m}function A(m,g){for(var p=0;p>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=s(this.extraFields[1].value);this.uncompressedSize===o.MAX_VALUE_32BITS&&(this.uncompressedSize=h.readInt(8)),this.compressedSize===o.MAX_VALUE_32BITS&&(this.compressedSize=h.readInt(8)),this.localHeaderOffset===o.MAX_VALUE_32BITS&&(this.localHeaderOffset=h.readInt(8)),this.diskNumberStart===o.MAX_VALUE_32BITS&&(this.diskNumberStart=h.readInt(4))}},readExtraFields:function(h){var d,m,g,p=h.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});h.index+4>>6:(h<65536?f[g++]=224|h>>>12:(f[g++]=240|h>>>18,f[g++]=128|h>>>12&63),f[g++]=128|h>>>6&63),f[g++]=128|63&h);return f},i.buf2binstring=function(u){return A(u,u.length)},i.binstring2buf=function(u){for(var f=new s.Buf8(u.length),h=0,d=f.length;h>10&1023,v[d++]=56320|1023&m)}return A(v,d)},i.utf8border=function(u,f){var h;for((f=f||u.length)>u.length&&(f=u.length),h=f-1;0<=h&&(192&u[h])==128;)h--;return h<0||h===0?f:h+l[u[h]]>f?h:f}},{"./common":41}],43:[function(t,r,i){r.exports=function(s,o,a,l){for(var c=65535&s|0,A=s>>>16&65535|0,u=0;a!==0;){for(a-=u=2e3>>1:o>>>1;a[l]=o}return a}();r.exports=function(o,a,l,c){var A=s,u=c+l;o^=-1;for(var f=c;f>>8^A[255&(o^a[f])];return-1^o}},{}],46:[function(t,r,i){var s,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),c=t("./crc32"),A=t("./messages"),u=0,f=4,h=0,d=-2,m=-1,g=4,p=2,v=8,w=9,_=286,x=30,b=19,B=2*_+1,S=15,I=3,M=258,P=M+I+1,D=42,T=113,y=1,E=2,R=3,L=4;function N(k,ae){return k.msg=A[ae],ae}function z(k){return(k<<1)-(4k.avail_out&&(le=k.avail_out),le!==0&&(o.arraySet(k.output,ae.pending_buf,ae.pending_out,le,k.next_out),k.next_out+=le,ae.pending_out+=le,k.total_out+=le,k.avail_out-=le,ae.pending-=le,ae.pending===0&&(ae.pending_out=0))}function C(k,ae){a._tr_flush_block(k,0<=k.block_start?k.block_start:-1,k.strstart-k.block_start,ae),k.block_start=k.strstart,H(k.strm)}function K(k,ae){k.pending_buf[k.pending++]=ae}function ee(k,ae){k.pending_buf[k.pending++]=ae>>>8&255,k.pending_buf[k.pending++]=255&ae}function F(k,ae){var le,Z,J=k.max_chain_length,ue=k.strstart,Y=k.prev_length,G=k.nice_match,j=k.strstart>k.w_size-P?k.strstart-(k.w_size-P):0,se=k.window,fe=k.w_mask,he=k.prev,Be=k.strstart+M,V=se[ue+Y-1],U=se[ue+Y];k.prev_length>=k.good_match&&(J>>=2),G>k.lookahead&&(G=k.lookahead);do if(se[(le=ae)+Y]===U&&se[le+Y-1]===V&&se[le]===se[ue]&&se[++le]===se[ue+1]){ue+=2,le++;do;while(se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&se[++ue]===se[++le]&&uej&&--J!=0);return Y<=k.lookahead?Y:k.lookahead}function re(k){var ae,le,Z,J,ue,Y,G,j,se,fe,he=k.w_size;do{if(J=k.window_size-k.lookahead-k.strstart,k.strstart>=he+(he-P)){for(o.arraySet(k.window,k.window,he,he,0),k.match_start-=he,k.strstart-=he,k.block_start-=he,ae=le=k.hash_size;Z=k.head[--ae],k.head[ae]=he<=Z?Z-he:0,--le;);for(ae=le=he;Z=k.prev[--ae],k.prev[ae]=he<=Z?Z-he:0,--le;);J+=he}if(k.strm.avail_in===0)break;if(Y=k.strm,G=k.window,j=k.strstart+k.lookahead,se=J,fe=void 0,fe=Y.avail_in,se=I)for(ue=k.strstart-k.insert,k.ins_h=k.window[ue],k.ins_h=(k.ins_h<=I&&(k.ins_h=(k.ins_h<=I)if(Z=a._tr_tally(k,k.strstart-k.match_start,k.match_length-I),k.lookahead-=k.match_length,k.match_length<=k.max_lazy_match&&k.lookahead>=I){for(k.match_length--;k.strstart++,k.ins_h=(k.ins_h<=I&&(k.ins_h=(k.ins_h<=I&&k.match_length<=k.prev_length){for(J=k.strstart+k.lookahead-I,Z=a._tr_tally(k,k.strstart-1-k.prev_match,k.prev_length-I),k.lookahead-=k.prev_length-1,k.prev_length-=2;++k.strstart<=J&&(k.ins_h=(k.ins_h<k.pending_buf_size-5&&(le=k.pending_buf_size-5);;){if(k.lookahead<=1){if(re(k),k.lookahead===0&&ae===u)return y;if(k.lookahead===0)break}k.strstart+=k.lookahead,k.lookahead=0;var Z=k.block_start+le;if((k.strstart===0||k.strstart>=Z)&&(k.lookahead=k.strstart-Z,k.strstart=Z,C(k,!1),k.strm.avail_out===0)||k.strstart-k.block_start>=k.w_size-P&&(C(k,!1),k.strm.avail_out===0))return y}return k.insert=0,ae===f?(C(k,!0),k.strm.avail_out===0?R:L):(k.strstart>k.block_start&&(C(k,!1),k.strm.avail_out),y)}),new ge(4,4,8,4,ce),new ge(4,5,16,8,ce),new ge(4,6,32,32,ce),new ge(4,4,16,16,oe),new ge(8,16,32,32,oe),new ge(8,16,128,128,oe),new ge(8,32,128,256,oe),new ge(32,128,258,1024,oe),new ge(32,258,258,4096,oe)],i.deflateInit=function(k,ae){return ne(k,ae,v,15,8,0)},i.deflateInit2=ne,i.deflateReset=be,i.deflateResetKeep=ve,i.deflateSetHeader=function(k,ae){return k&&k.state?k.state.wrap!==2?d:(k.state.gzhead=ae,h):d},i.deflate=function(k,ae){var le,Z,J,ue;if(!k||!k.state||5>8&255),K(Z,Z.gzhead.time>>16&255),K(Z,Z.gzhead.time>>24&255),K(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),K(Z,255&Z.gzhead.os),Z.gzhead.extra&&Z.gzhead.extra.length&&(K(Z,255&Z.gzhead.extra.length),K(Z,Z.gzhead.extra.length>>8&255)),Z.gzhead.hcrc&&(k.adler=c(k.adler,Z.pending_buf,Z.pending,0)),Z.gzindex=0,Z.status=69):(K(Z,0),K(Z,0),K(Z,0),K(Z,0),K(Z,0),K(Z,Z.level===9?2:2<=Z.strategy||Z.level<2?4:0),K(Z,3),Z.status=T);else{var Y=v+(Z.w_bits-8<<4)<<8;Y|=(2<=Z.strategy||Z.level<2?0:Z.level<6?1:Z.level===6?2:3)<<6,Z.strstart!==0&&(Y|=32),Y+=31-Y%31,Z.status=T,ee(Z,Y),Z.strstart!==0&&(ee(Z,k.adler>>>16),ee(Z,65535&k.adler)),k.adler=1}if(Z.status===69)if(Z.gzhead.extra){for(J=Z.pending;Z.gzindex<(65535&Z.gzhead.extra.length)&&(Z.pending!==Z.pending_buf_size||(Z.gzhead.hcrc&&Z.pending>J&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),H(k),J=Z.pending,Z.pending!==Z.pending_buf_size));)K(Z,255&Z.gzhead.extra[Z.gzindex]),Z.gzindex++;Z.gzhead.hcrc&&Z.pending>J&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),Z.gzindex===Z.gzhead.extra.length&&(Z.gzindex=0,Z.status=73)}else Z.status=73;if(Z.status===73)if(Z.gzhead.name){J=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>J&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),H(k),J=Z.pending,Z.pending===Z.pending_buf_size)){ue=1;break}ue=Z.gzindexJ&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),ue===0&&(Z.gzindex=0,Z.status=91)}else Z.status=91;if(Z.status===91)if(Z.gzhead.comment){J=Z.pending;do{if(Z.pending===Z.pending_buf_size&&(Z.gzhead.hcrc&&Z.pending>J&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),H(k),J=Z.pending,Z.pending===Z.pending_buf_size)){ue=1;break}ue=Z.gzindexJ&&(k.adler=c(k.adler,Z.pending_buf,Z.pending-J,J)),ue===0&&(Z.status=103)}else Z.status=103;if(Z.status===103&&(Z.gzhead.hcrc?(Z.pending+2>Z.pending_buf_size&&H(k),Z.pending+2<=Z.pending_buf_size&&(K(Z,255&k.adler),K(Z,k.adler>>8&255),k.adler=0,Z.status=T)):Z.status=T),Z.pending!==0){if(H(k),k.avail_out===0)return Z.last_flush=-1,h}else if(k.avail_in===0&&z(ae)<=z(le)&&ae!==f)return N(k,-5);if(Z.status===666&&k.avail_in!==0)return N(k,-5);if(k.avail_in!==0||Z.lookahead!==0||ae!==u&&Z.status!==666){var G=Z.strategy===2?function(j,se){for(var fe;;){if(j.lookahead===0&&(re(j),j.lookahead===0)){if(se===u)return y;break}if(j.match_length=0,fe=a._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++,fe&&(C(j,!1),j.strm.avail_out===0))return y}return j.insert=0,se===f?(C(j,!0),j.strm.avail_out===0?R:L):j.last_lit&&(C(j,!1),j.strm.avail_out===0)?y:E}(Z,ae):Z.strategy===3?function(j,se){for(var fe,he,Be,V,U=j.window;;){if(j.lookahead<=M){if(re(j),j.lookahead<=M&&se===u)return y;if(j.lookahead===0)break}if(j.match_length=0,j.lookahead>=I&&0j.lookahead&&(j.match_length=j.lookahead)}if(j.match_length>=I?(fe=a._tr_tally(j,1,j.match_length-I),j.lookahead-=j.match_length,j.strstart+=j.match_length,j.match_length=0):(fe=a._tr_tally(j,0,j.window[j.strstart]),j.lookahead--,j.strstart++),fe&&(C(j,!1),j.strm.avail_out===0))return y}return j.insert=0,se===f?(C(j,!0),j.strm.avail_out===0?R:L):j.last_lit&&(C(j,!1),j.strm.avail_out===0)?y:E}(Z,ae):s[Z.level].func(Z,ae);if(G!==R&&G!==L||(Z.status=666),G===y||G===R)return k.avail_out===0&&(Z.last_flush=-1),h;if(G===E&&(ae===1?a._tr_align(Z):ae!==5&&(a._tr_stored_block(Z,0,0,!1),ae===3&&(W(Z.head),Z.lookahead===0&&(Z.strstart=0,Z.block_start=0,Z.insert=0))),H(k),k.avail_out===0))return Z.last_flush=-1,h}return ae!==f?h:Z.wrap<=0?1:(Z.wrap===2?(K(Z,255&k.adler),K(Z,k.adler>>8&255),K(Z,k.adler>>16&255),K(Z,k.adler>>24&255),K(Z,255&k.total_in),K(Z,k.total_in>>8&255),K(Z,k.total_in>>16&255),K(Z,k.total_in>>24&255)):(ee(Z,k.adler>>>16),ee(Z,65535&k.adler)),H(k),0=le.w_size&&(ue===0&&(W(le.head),le.strstart=0,le.block_start=0,le.insert=0),se=new o.Buf8(le.w_size),o.arraySet(se,ae,fe-le.w_size,le.w_size,0),ae=se,fe=le.w_size),Y=k.avail_in,G=k.next_in,j=k.input,k.avail_in=fe,k.next_in=0,k.input=ae,re(le);le.lookahead>=I;){for(Z=le.strstart,J=le.lookahead-(I-1);le.ins_h=(le.ins_h<>>=I=S>>>24,w-=I,(I=S>>>16&255)===0)E[A++]=65535&S;else{if(!(16&I)){if(!(64&I)){S=_[(65535&S)+(v&(1<>>=I,w-=I),w<15&&(v+=y[l++]<>>=I=S>>>24,w-=I,!(16&(I=S>>>16&255))){if(!(64&I)){S=x[(65535&S)+(v&(1<>>=I,w-=I,(I=A-u)>3,v&=(1<<(w-=M<<3))-1,s.next_in=l,s.next_out=A,s.avail_in=l>>24&255)+(D>>>8&65280)+((65280&D)<<8)+((255&D)<<24)}function v(){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 s.Buf16(320),this.work=new s.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function w(D){var T;return D&&D.state?(T=D.state,D.total_in=D.total_out=T.total=0,D.msg="",T.wrap&&(D.adler=1&T.wrap),T.mode=d,T.last=0,T.havedict=0,T.dmax=32768,T.head=null,T.hold=0,T.bits=0,T.lencode=T.lendyn=new s.Buf32(m),T.distcode=T.distdyn=new s.Buf32(g),T.sane=1,T.back=-1,f):h}function _(D){var T;return D&&D.state?((T=D.state).wsize=0,T.whave=0,T.wnext=0,w(D)):h}function x(D,T){var y,E;return D&&D.state?(E=D.state,T<0?(y=0,T=-T):(y=1+(T>>4),T<48&&(T&=15)),T&&(T<8||15=L.wsize?(s.arraySet(L.window,T,y-L.wsize,L.wsize,0),L.wnext=0,L.whave=L.wsize):(E<(R=L.wsize-L.wnext)&&(R=E),s.arraySet(L.window,T,y-E,R,L.wnext),(E-=R)?(s.arraySet(L.window,T,y-E,E,0),L.wnext=E,L.whave=L.wsize):(L.wnext+=R,L.wnext===L.wsize&&(L.wnext=0),L.whave>>8&255,y.check=a(y.check,ue,2,0),C=H=0,y.mode=2;break}if(y.flags=0,y.head&&(y.head.done=!1),!(1&y.wrap)||(((255&H)<<8)+(H>>8))%31){D.msg="incorrect header check",y.mode=30;break}if((15&H)!=8){D.msg="unknown compression method",y.mode=30;break}if(C-=4,k=8+(15&(H>>>=4)),y.wbits===0)y.wbits=k;else if(k>y.wbits){D.msg="invalid window size",y.mode=30;break}y.dmax=1<>8&1),512&y.flags&&(ue[0]=255&H,ue[1]=H>>>8&255,y.check=a(y.check,ue,2,0)),C=H=0,y.mode=3;case 3:for(;C<32;){if(z===0)break e;z--,H+=E[L++]<>>8&255,ue[2]=H>>>16&255,ue[3]=H>>>24&255,y.check=a(y.check,ue,4,0)),C=H=0,y.mode=4;case 4:for(;C<16;){if(z===0)break e;z--,H+=E[L++]<>8),512&y.flags&&(ue[0]=255&H,ue[1]=H>>>8&255,y.check=a(y.check,ue,2,0)),C=H=0,y.mode=5;case 5:if(1024&y.flags){for(;C<16;){if(z===0)break e;z--,H+=E[L++]<>>8&255,y.check=a(y.check,ue,2,0)),C=H=0}else y.head&&(y.head.extra=null);y.mode=6;case 6:if(1024&y.flags&&(z<(F=y.length)&&(F=z),F&&(y.head&&(k=y.head.extra_len-y.length,y.head.extra||(y.head.extra=new Array(y.head.extra_len)),s.arraySet(y.head.extra,E,L,F,k)),512&y.flags&&(y.check=a(y.check,E,F,L)),z-=F,L+=F,y.length-=F),y.length))break e;y.length=0,y.mode=7;case 7:if(2048&y.flags){if(z===0)break e;for(F=0;k=E[L+F++],y.head&&k&&y.length<65536&&(y.head.name+=String.fromCharCode(k)),k&&F>9&1,y.head.done=!0),D.adler=y.check=0,y.mode=12;break;case 10:for(;C<32;){if(z===0)break e;z--,H+=E[L++]<>>=7&C,C-=7&C,y.mode=27;break}for(;C<3;){if(z===0)break e;z--,H+=E[L++]<>>=1)){case 0:y.mode=14;break;case 1:if(M(y),y.mode=20,T!==6)break;H>>>=2,C-=2;break e;case 2:y.mode=17;break;case 3:D.msg="invalid block type",y.mode=30}H>>>=2,C-=2;break;case 14:for(H>>>=7&C,C-=7&C;C<32;){if(z===0)break e;z--,H+=E[L++]<>>16^65535)){D.msg="invalid stored block lengths",y.mode=30;break}if(y.length=65535&H,C=H=0,y.mode=15,T===6)break e;case 15:y.mode=16;case 16:if(F=y.length){if(z>>=5,C-=5,y.ndist=1+(31&H),H>>>=5,C-=5,y.ncode=4+(15&H),H>>>=4,C-=4,286>>=3,C-=3}for(;y.have<19;)y.lens[Y[y.have++]]=0;if(y.lencode=y.lendyn,y.lenbits=7,le={bits:y.lenbits},ae=c(0,y.lens,0,19,y.lencode,0,y.work,le),y.lenbits=le.bits,ae){D.msg="invalid code lengths set",y.mode=30;break}y.have=0,y.mode=19;case 19:for(;y.have>>16&255,me=65535&J,!((oe=J>>>24)<=C);){if(z===0)break e;z--,H+=E[L++]<>>=oe,C-=oe,y.lens[y.have++]=me;else{if(me===16){for(Z=oe+2;C>>=oe,C-=oe,y.have===0){D.msg="invalid bit length repeat",y.mode=30;break}k=y.lens[y.have-1],F=3+(3&H),H>>>=2,C-=2}else if(me===17){for(Z=oe+3;C>>=oe)),H>>>=3,C-=3}else{for(Z=oe+7;C>>=oe)),H>>>=7,C-=7}if(y.have+F>y.nlen+y.ndist){D.msg="invalid bit length repeat",y.mode=30;break}for(;F--;)y.lens[y.have++]=k}}if(y.mode===30)break;if(y.lens[256]===0){D.msg="invalid code -- missing end-of-block",y.mode=30;break}if(y.lenbits=9,le={bits:y.lenbits},ae=c(A,y.lens,0,y.nlen,y.lencode,0,y.work,le),y.lenbits=le.bits,ae){D.msg="invalid literal/lengths set",y.mode=30;break}if(y.distbits=6,y.distcode=y.distdyn,le={bits:y.distbits},ae=c(u,y.lens,y.nlen,y.ndist,y.distcode,0,y.work,le),y.distbits=le.bits,ae){D.msg="invalid distances set",y.mode=30;break}if(y.mode=20,T===6)break e;case 20:y.mode=21;case 21:if(6<=z&&258<=W){D.next_out=N,D.avail_out=W,D.next_in=L,D.avail_in=z,y.hold=H,y.bits=C,l(D,ee),N=D.next_out,R=D.output,W=D.avail_out,L=D.next_in,E=D.input,z=D.avail_in,H=y.hold,C=y.bits,y.mode===12&&(y.back=-1);break}for(y.back=0;ge=(J=y.lencode[H&(1<>>16&255,me=65535&J,!((oe=J>>>24)<=C);){if(z===0)break e;z--,H+=E[L++]<>ve)])>>>16&255,me=65535&J,!(ve+(oe=J>>>24)<=C);){if(z===0)break e;z--,H+=E[L++]<>>=ve,C-=ve,y.back+=ve}if(H>>>=oe,C-=oe,y.back+=oe,y.length=me,ge===0){y.mode=26;break}if(32&ge){y.back=-1,y.mode=12;break}if(64&ge){D.msg="invalid literal/length code",y.mode=30;break}y.extra=15&ge,y.mode=22;case 22:if(y.extra){for(Z=y.extra;C>>=y.extra,C-=y.extra,y.back+=y.extra}y.was=y.length,y.mode=23;case 23:for(;ge=(J=y.distcode[H&(1<>>16&255,me=65535&J,!((oe=J>>>24)<=C);){if(z===0)break e;z--,H+=E[L++]<>ve)])>>>16&255,me=65535&J,!(ve+(oe=J>>>24)<=C);){if(z===0)break e;z--,H+=E[L++]<>>=ve,C-=ve,y.back+=ve}if(H>>>=oe,C-=oe,y.back+=oe,64&ge){D.msg="invalid distance code",y.mode=30;break}y.offset=me,y.extra=15&ge,y.mode=24;case 24:if(y.extra){for(Z=y.extra;C>>=y.extra,C-=y.extra,y.back+=y.extra}if(y.offset>y.dmax){D.msg="invalid distance too far back",y.mode=30;break}y.mode=25;case 25:if(W===0)break e;if(F=ee-W,y.offset>F){if((F=y.offset-F)>y.whave&&y.sane){D.msg="invalid distance too far back",y.mode=30;break}re=F>y.wnext?(F-=y.wnext,y.wsize-F):y.wnext-F,F>y.length&&(F=y.length),ce=y.window}else ce=R,re=N-y.offset,F=y.length;for(WB?(I=re[ce+g[T]],C[K+g[T]]):(I=96,0),v=1<>N)+(w-=v)]=S<<24|I<<16|M|0,w!==0;);for(v=1<>=1;if(v!==0?(H&=v-1,H+=v):H=0,T++,--ee[D]==0){if(D===E)break;D=u[f+g[T]]}if(R>>7)]}function K(J,ue){J.pending_buf[J.pending++]=255&ue,J.pending_buf[J.pending++]=ue>>>8&255}function ee(J,ue,Y){J.bi_valid>p-Y?(J.bi_buf|=ue<>p-J.bi_valid,J.bi_valid+=Y-p):(J.bi_buf|=ue<>>=1,Y<<=1,0<--ue;);return Y>>>1}function ce(J,ue,Y){var G,j,se=new Array(g+1),fe=0;for(G=1;G<=g;G++)se[G]=fe=fe+Y[G-1]<<1;for(j=0;j<=ue;j++){var he=J[2*j+1];he!==0&&(J[2*j]=re(se[he]++,he))}}function oe(J){var ue;for(ue=0;ue>1;1<=Y;Y--)ve(J,se,Y);for(j=Be;Y=J.heap[1],J.heap[1]=J.heap[J.heap_len--],ve(J,se,1),G=J.heap[1],J.heap[--J.heap_max]=Y,J.heap[--J.heap_max]=G,se[2*j]=se[2*Y]+se[2*G],J.depth[j]=(J.depth[Y]>=J.depth[G]?J.depth[Y]:J.depth[G])+1,se[2*Y+1]=se[2*G+1]=j,J.heap[1]=j++,ve(J,se,1),2<=J.heap_len;);J.heap[--J.heap_max]=J.heap[1],function(U,O){var X,ie,pe,de,Ie,Le,Ue=O.dyn_tree,Ye=O.max_code,Ae=O.stat_desc.static_tree,Fe=O.stat_desc.has_stree,Me=O.stat_desc.extra_bits,Ce=O.stat_desc.extra_base,Re=O.stat_desc.max_length,Oe=0;for(de=0;de<=g;de++)U.bl_count[de]=0;for(Ue[2*U.heap[U.heap_max]+1]=0,X=U.heap_max+1;X>=7;j>>=1)if(1&V&&he.dyn_ltree[2*Be]!==0)return o;if(he.dyn_ltree[18]!==0||he.dyn_ltree[20]!==0||he.dyn_ltree[26]!==0)return a;for(Be=32;Be>>3,(se=J.static_len+3+7>>>3)<=j&&(j=se)):j=se=Y+5,Y+4<=j&&ue!==-1?Z(J,ue,Y,G):J.strategy===4||se===j?(ee(J,2+(G?1:0),3),be(J,P,D)):(ee(J,4+(G?1:0),3),function(he,Be,V,U){var O;for(ee(he,Be-257,5),ee(he,V-1,5),ee(he,U-4,4),O=0;O>>8&255,J.pending_buf[J.d_buf+2*J.last_lit+1]=255&ue,J.pending_buf[J.l_buf+J.last_lit]=255&Y,J.last_lit++,ue===0?J.dyn_ltree[2*Y]++:(J.matches++,ue--,J.dyn_ltree[2*(y[Y]+u+1)]++,J.dyn_dtree[2*C(ue)]++),J.last_lit===J.lit_bufsize-1},i._tr_align=function(J){ee(J,2,3),F(J,w,P),function(ue){ue.bi_valid===16?(K(ue,ue.bi_buf),ue.bi_buf=0,ue.bi_valid=0):8<=ue.bi_valid&&(ue.pending_buf[ue.pending++]=255&ue.bi_buf,ue.bi_buf>>=8,ue.bi_valid-=8)}(J)}},{"../utils/common":41}],53:[function(t,r,i){r.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,r,i){(function(s){(function(o,a){if(!o.setImmediate){var l,c,A,u,f=1,h={},d=!1,m=o.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(o);g=g&&g.setTimeout?g:o,l={}.toString.call(o.process)==="[object process]"?function(_){process.nextTick(function(){v(_)})}:function(){if(o.postMessage&&!o.importScripts){var _=!0,x=o.onmessage;return o.onmessage=function(){_=!1},o.postMessage("","*"),o.onmessage=x,_}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(_){o.postMessage(u+_,"*")}):o.MessageChannel?((A=new MessageChannel).port1.onmessage=function(_){v(_.data)},function(_){A.port2.postMessage(_)}):m&&"onreadystatechange"in m.createElement("script")?(c=m.documentElement,function(_){var x=m.createElement("script");x.onreadystatechange=function(){v(_),x.onreadystatechange=null,c.removeChild(x),x=null},c.appendChild(x)}):function(_){setTimeout(v,0,_)},g.setImmediate=function(_){typeof _!="function"&&(_=new Function(""+_));for(var x=new Array(arguments.length-1),b=0;b"u"?s===void 0?this:s:self)}).call(this,typeof La<"u"?La:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(sV);var Y0e=sV.exports;const $0e=oc(Y0e);class ep{constructor(){this.zipContainer={}}addData(e,t,r,i=""){i==""&&(i="_"),this.zipContainer[i]==null&&(this.zipContainer[i]=[]),this.zipContainer[i].push({data:e,name:t,extension:r})}saveZip(e,t=!0){const r=this.zipContainer,i=new $0e;for(const s in r)if(s=="_")r[s].forEach((o,a)=>{i.file(o.name+"."+o.extension,o.data,{base64:!0})});else{const o=i.folder(s);r[s].forEach((a,l)=>{const c=a.extension!="txt";o.file(a.name+"."+a.extension,a.data,{base64:c})})}i.generateAsync({type:"blob"}).then(s=>{this._saveZipFile(s,e+".zip")}),t&&(this.zipContainer={})}_saveZipFile(e,t){const r=new Blob([e],{type:"application/zip"});if(typeof window.navigator.msSaveBlob<"u")window.navigator.msSaveBlob(r,t);else{const i=document.createElement("a");typeof i.download=="string"?(document.body.appendChild(i),i.download=t,i.href=URL.createObjectURL(r),i.click(),document.body.removeChild(i)):window.open(e,"_blank").document.write(""+t+"")}}}class Z0e{constructor(e){jt(this,"screenshotManager");this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager,this.temptime=0}get vrms(){return Object.values(this.characterManager.avatar).map(e=>e.vrm)}async createLoraData(e,t=null,r=""){const i=e.manifest,s=e.name?"loraData/"+e.name:"loraData",o=await this._fetchManifest(i),{assetsLocation:a="",animationsDirectory:l="",backgroundGrayscale:c=1,backgroundDescription:A="",width:u=512,height:f=512,dataCollection:h}=o,d=a+l+"/";this.screenshotManager.setBackground([c,c,c]),this.blinkManager.enableScreenshot(),await this.screenshotManager.cameraFrameManager.calculateBoneOffsets(this.characterManager.characterModel,.2);let m=0;const g=this;if(Array.isArray(h)){const p=t??new ep;await(async()=>{if(Array.isArray(h))for(let w=0;w{var E;(E=y.springBoneManager)==null||E.reset()});const D=u2(B);g.screenshotManager.cameraFrameManager.setCameraFrameWithName(S,D);const T=g.screenshotManager.getImageData(u,f,!1);p.addData(T,M,"png",s),p.addData("anata "+I+" "+A,M,"txt",s)}})(),t==null&&(r==""&&(r="lora_zip"),p.saveZip(r))}this.blinkManager.disableScreenshot()}async _fetchManifest(e){return await(await fetch(e)).json()}}class q0e{constructor(e){jt(this,"screenshotManager");this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager}async createSpriteAtlas(e,t=null,r=""){const i=e.manifest,s=e.name?"spriteData/"+e.name:"spriteData",o=await this._fetchManifest(i),{assetsLocation:a="",animationsDirectory:l="",backgroundColor:c=[1,1,1,1],screenshotOffset:A,topFrameOffset:u=.1,bottomFrameOffset:f=.1,pixelStyleSize:h,atlasWidth:d=512,atlasHeight:m=512,spritesCollection:g}=o,p=a+l+"/";this.screenshotManager.cameraFrameManager.setBottomFrameOffset(f),this.screenshotManager.cameraFrameManager.setTopFrameOffset(u),this.screenshotManager.setBackground(c),this.blinkManager.enableScreenshot(),await this.screenshotManager.cameraFrameManager.calculateBoneOffsets(this.characterManager.characterModel,.2);let v=0;const w=this;if(Array.isArray(g)){const _=t??new ep;await(async()=>{if(Array.isArray(g))for(const b of g){const{animationName:B,animationPath:S,framesNumber:I,lookAtCamera:M,expression:P,cameraPosition:D,cameraFrame:T}=b;v++;const y=s+"/"+(B||v.toString().padStart(2,"0"));await w.animationManager.loadAnimation(p+S,!0,0);const E=u2(D);w.screenshotManager.cameraFrameManager.setCameraFrameWithName(T,E);const L=w.animationManager.getCurrentClipDuration()/I;for(let N=0;N{for(const b of m){const{traitGroup:B,cameraPosition:S="front",bottomBoneName:I,bottomBoneMaxVertex:M=!1,topBoneName:P,topBoneMaxVertex:D=!0,groupTopOffset:T,groupBotomOffset:y,cameraFrame:E,saveOnlyIDs:R}=b;if((!I||!P)&&(E||console.warn("missing bonename info or camera frame. Skipping")),!B){console.warn("missing trait group for thumbnail info. Skipping");continue}const L=()=>{const W=[];return mt(R).forEach(C=>{W.push({id:C})}),W},N=R==null?v.characterManager.getTraits(B):L();if(N==null){console.log("SKipping Thumbnail Generation for trait group "+B+", its not present in the character manifest.");continue}const z=u2(S);E?v.screenshotManager.cameraFrameManager.setCameraFrameWithName(E,z):v.screenshotManager.cameraFrameManager.frameShot(I,P,z,M,D);for(let W=0;W{const[e,t]=xe.useState(null),[r,i]=xe.useState(null),[s,o]=xe.useState(null),[a,l]=xe.useState(null),[c,A]=xe.useState(null),[u,f]=xe.useState(null),[h,d]=xe.useState(null),[m,g]=xe.useState(null),[p,v]=xe.useState(null),[w,_]=xe.useState(null),[x,b]=xe.useState(null),[B,S]=xe.useState(!1);let I=!1,[M,P]=xe.useState(!1);xe.useEffect(()=>{if(I||M)return;P(!0),I=!0;const{scene:E,camera:R,controls:L,characterManager:N,sceneElements:z}=X0e("editor-scene");v(R),g(E),t(N),A(z),f(N.animationManager),d(N.lookAtManager),_(L),i(new Z0e(N)),o(new q0e(N)),l(new J0e(N))},[]);const D=E=>{E==null&&(E=!B),S(E),m.traverse(R=>{R.isMesh&&R.setDebugMode&&R.setDebugMode(E)})};xe.useEffect(()=>{if(x!=null&&x.defaultAnimations){const E=x.defaultAnimations.map(R=>R.location);u.storeDefaultAnimationPaths(E,"")}},[x]);const T=E=>{E?m.add(c):m.remove(c)},y=E=>{w&&(GM.to(w.target,{x:E.targetX??0,y:E.targetY??0,z:E.targetZ??0,duration:1}),GM.fromTo(w,{maxDistance:w.getDistance(),minDistance:w.getDistance(),minPolarAngle:w.getPolarAngle(),maxPolarAngle:w.getPolarAngle(),minAzimuthAngle:w.getAzimuthalAngle(),maxAzimuthAngle:w.getAzimuthalAngle()},{maxDistance:E.distance,minDistance:E.distance,minPolarAngle:Math.PI/2-.11,maxPolarAngle:Math.PI/2-.11,minAzimuthAngle:-.78,maxAzimuthAngle:-.78,duration:1}).then(()=>{w.minPolarAngle=0,w.maxPolarAngle=3.1415,w.minDistance=.5,w.maxDistance=10,w.minAzimuthAngle=1/0,w.maxAzimuthAngle=1/0}))};return Q.jsx(mr.Provider,{value:{manifest:x,setManifest:b,scene:m,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:a,showEnvironmentModels:T,debugMode:B,toggleDebugMode:D,animationManager:u,lookAtManager:h,camera:p,moveCamera:y,controls:w,sceneElements:c},children:n.children})},tve={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},yt={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",SAVE:"SAVE",MINT:"MINT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},As=q.createContext(),nve=n=>{const[e,t]=q.useState(tve.NORMAL),[r,i]=q.useState(yt.LANDING),[s,o]=q.useState(!1),[a,l]=q.useState(!1);return Q.jsx(As.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},rve="modulepreload",ive=function(n){return"/"+n},XO={},sve=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=ive(s),s in XO)return;XO[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!r)for(let A=i.length-1;A>=0;A--){const u=i[A];if(u.href===s&&(!o||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const c=document.createElement("link");if(c.rel=o?"stylesheet":rve,o||(c.as="script",c.crossOrigin=""),c.href=s,document.head.appendChild(c),o)return new Promise((A,u)=>{c.addEventListener("load",A),c.addEventListener("error",()=>u(new Error(`Unable to preload CSS for ${s}`)))})})).then(()=>e()).catch(s=>{const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=s,window.dispatchEvent(o),!o.defaultPrevented)throw s})};function sx(){return sx=Object.assign?Object.assign.bind():function(n){for(var e=1;e=0)continue;t[r]=n[r]}return t}function ave(n){xe.useEffect(n,[])}var lve=["id","volume","playbackRate","soundEnabled","interrupt","onload"];function cve(n,e){var t=e===void 0?{}:e,r=t.volume,i=r===void 0?1:r,s=t.playbackRate,o=s===void 0?1:s,a=t.soundEnabled,l=a===void 0?!0:a,c=t.interrupt,A=c===void 0?!1:c,u=t.onload,f=ove(t,lve),h=q.useRef(null),d=q.useRef(!1),m=q.useState(null),g=m[0],p=m[1],v=q.useState(null),w=v[0],_=v[1],x=function(){typeof u=="function"&&u.call(this),d.current&&p(this.duration()*1e3),_(this)};ave(function(){return sve(()=>import("./howler-5a5bbb27.js").then(M=>M.h),[]).then(function(M){if(!d.current){var P;h.current=(P=M.Howl)!==null&&P!==void 0?P:M.default.Howl,d.current=!0,new h.current(sx({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:x},f))}}),function(){d.current=!1}}),q.useEffect(function(){h.current&&w&&_(new h.current(sx({src:Array.isArray(n)?n:[n],volume:i,onload:x},f)))},[JSON.stringify(n)]),q.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var b=q.useCallback(function(M){typeof M>"u"&&(M={}),!(!w||!l&&!M.forceSoundEnabled)&&(A&&w.stop(),M.playbackRate&&w.rate(M.playbackRate),w.play(M.id))},[w,l,A]),B=q.useCallback(function(M){w&&w.stop(M)},[w]),S=q.useCallback(function(M){w&&w.pause(M)},[w]),I=[b,{sound:w,stop:B,pause:S,duration:g}];return I}const Ave=[{name:"background/cc_bgm.wav",offset:0,duration:123458.58333333334},{name:"background/cc_bgm_balanced.wav",offset:123458.58333333334,duration:123458.60416666666},{name:"effect/character-load.wav",offset:246917.1875,duration:3030},{name:"effect/class-select.wav",offset:249947.1875,duration:2780},{name:"effect/switchingItem.wav",offset:252727.1875,duration:623.75},{name:"ui/back-next-button.wav",offset:253350.9375,duration:155.02083333333334},{name:"ui/class-mouse-over.wav",offset:253505.95833333334,duration:217.52083333333334},{name:"ui/class_click.wav",offset:253723.4791666667,duration:3123.75},{name:"ui/class_pass.wav",offset:256847.2291666667,duration:155},{name:"ui/option_click.wav",offset:257002.2291666667,duration:155.02083333333334},{name:"ui/randomize-button.wav",offset:257157.25000000003,duration:342.5208333333333},{name:"ui/section_click.wav",offset:257499.77083333337,duration:155}],uve="/assets/sounds-3322d50e.mp3",Mo=xe.createContext(),fve=n=>{const e=i=>Ave.find(s=>i.test(s.name)),[t]=cve(uve,{sprite:{switchItem:[e(/switchingItem/).offset,e(/switchingItem/).duration],classSelect:[e(/class-select/).offset,e(/class-select/).duration],characterLoad:[e(/character-load/).offset,e(/character-load/).duration],randomizeButton:[e(/randomize-button/).offset,e(/randomize-button/).duration],classMouseOver:[e(/class-mouse-over/).offset,e(/class-mouse-over/).duration],backNextButton:[e(/back-next-button/).offset,e(/back-next-button/).duration]}}),r=(i,s=0)=>{s===0?t({id:i}):setTimeout(()=>{t({id:i})},s)};return Q.jsx(Mo.Provider,{value:{playSound:r},children:n.children})};function Ds(n){"@babel/helpers - typeof";return Ds=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ds(n)}function Co(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function hve(n,e){if(Ds(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(Ds(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function oV(n){var e=hve(n,"string");return Ds(e)=="symbol"?e:e+""}function YO(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,r=Array(e);t1&&arguments[1]!==void 0?arguments[1]:{};Co(this,n),this.init(e,t)}return To(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=r.prefix||"i18next:",this.logger=t||mve,this.options=r,this.debug=r.debug}},{key:"setDebug",value:function(t){this.debug=t}},{key:"log",value:function(){for(var t=arguments.length,r=new Array(t),i=0;i1?r-1:0),s=1;s-1?a.replace(/###/g,"."):a}function i(){return!n||typeof n=="string"}for(var s=typeof e!="string"?[].concat(e):e.split(".");s.length>1;){if(i())return{};var o=r(s.shift());!n[o]&&t&&(n[o]=new t),Object.prototype.hasOwnProperty.call(n,o)?n=n[o]:n={}}return i()?{}:{obj:n,k:r(s.shift())}}function e3(n,e,t){var r=p2(n,e,Object),i=r.obj,s=r.k;i[s]=t}function yve(n,e,t,r){var i=p2(n,e,Object),s=i.obj,o=i.k;s[o]=s[o]||[],r&&(s[o]=s[o].concat(t)),r||s[o].push(t)}function ox(n,e){var t=p2(n,e),r=t.obj,i=t.k;if(r)return r[i]}function wve(n,e,t){var r=ox(n,t);return r!==void 0?r:ox(e,t)}function AV(n,e,t){for(var r in e)r!=="__proto__"&&r!=="constructor"&&(r in n?typeof n[r]=="string"||n[r]instanceof String||typeof e[r]=="string"||e[r]instanceof String?t&&(n[r]=e[r]):AV(n[r],e[r],t):n[r]=e[r]);return n}function zf(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var _ve={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function xve(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return _ve[e]}):n}var U1=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,bve=[" ",",","?","!",";"];function Eve(n,e,t){e=e||"",t=t||"";var r=bve.filter(function(a){return e.indexOf(a)<0&&t.indexOf(a)<0});if(r.length===0)return!0;var i=new RegExp("(".concat(r.map(function(a){return a==="?"?"\\?":a}).join("|"),")")),s=!i.test(n);if(!s){var o=n.indexOf(t);o>0&&!i.test(n.substring(0,o))&&(s=!0)}return s}function ax(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(n){if(n[e])return n[e];for(var r=e.split(t),i=n,s=0;ss+o;)o++,a=r.slice(s,s+o).join(t),l=i[a];if(l===void 0)return;if(l===null)return null;if(e.endsWith(a)){if(typeof l=="string")return l;if(a&&typeof l[a]=="string")return l[a]}var c=r.slice(s+o).join(t);return c?ax(l,c,t):void 0}i=i[r[s]]}return i}}function t3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Ny(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var Mve=function(n){R1(t,n);var e=Bve(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Co(this,t),i=e.call(this),U1&&xA.call(hA(i)),i.data=r||{},i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.options.ignoreJSONStructure===void 0&&(i.options.ignoreJSONStructure=!0),i}return To(t,[{key:"addNamespaces",value:function(i){this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}},{key:"removeNamespaces",value:function(i){var s=this.options.ns.indexOf(i);s>-1&&this.options.ns.splice(s,1)}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},l=a.keySeparator!==void 0?a.keySeparator:this.options.keySeparator,c=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,A=[i,s];o&&typeof o!="string"&&(A=A.concat(o)),o&&typeof o=="string"&&(A=A.concat(l?o.split(l):o)),i.indexOf(".")>-1&&(A=i.split("."));var u=ox(this.data,A);return u||!c||typeof o!="string"?u:ax(this.data&&this.data[i]&&this.data[i][s],o,l)}},{key:"addResource",value:function(i,s,o,a){var l=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1},c=l.keySeparator!==void 0?l.keySeparator:this.options.keySeparator,A=[i,s];o&&(A=A.concat(c?o.split(c):o)),i.indexOf(".")>-1&&(A=i.split("."),a=s,s=A[1]),this.addNamespaces(s),e3(this.data,A,a),l.silent||this.emit("added",i,s,o,a)}},{key:"addResources",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(var l in o)(typeof o[l]=="string"||Object.prototype.toString.apply(o[l])==="[object Array]")&&this.addResource(i,s,l,o[l],{silent:!0});a.silent||this.emit("added",i,s,o)}},{key:"addResourceBundle",value:function(i,s,o,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},A=[i,s];i.indexOf(".")>-1&&(A=i.split("."),a=o,o=s,s=A[1]),this.addNamespaces(s);var u=ox(this.data,A)||{};a?AV(u,o,l):u=Ny(Ny({},u),o),e3(this.data,A,u),c.silent||this.emit("added",i,s,o)}},{key:"removeResourceBundle",value:function(i,s){this.hasResourceBundle(i,s)&&delete this.data[i][s],this.removeNamespaces(s),this.emit("removed",i,s)}},{key:"hasResourceBundle",value:function(i,s){return this.getResource(i,s)!==void 0}},{key:"getResourceBundle",value:function(i,s){return s||(s=this.options.defaultNS),this.options.compatibilityAPI==="v1"?Ny(Ny({},{}),this.getResource(i,s)):this.getResource(i,s)}},{key:"getDataByLanguage",value:function(i){return this.data[i]}},{key:"hasLanguageSomeTranslations",value:function(i){var s=this.getDataByLanguage(i),o=s&&Object.keys(s)||[];return!!o.find(function(a){return s[a]&&Object.keys(s[a]).length>0})}},{key:"toJSON",value:function(){return this.data}}]),t}(xA),uV={processors:{},addPostProcessor:function(e){this.processors[e.name]=e},handle:function(e,t,r,i,s){var o=this;return e.forEach(function(a){o.processors[a]&&(t=o.processors[a].process(t,r,i,s))}),t}};function n3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function pi(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}var r3={},i3=function(n){R1(t,n);var e=Cve(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Co(this,t),i=e.call(this),U1&&xA.call(hA(i)),vve(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,hA(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=Oa.create("translator"),i}return To(t,[{key:"changeLanguage",value:function(i){i&&(this.language=i)}},{key:"exists",value:function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(i==null)return!1;var o=this.resolve(i,s);return o&&o.res!==void 0}},{key:"extractFromKey",value:function(i,s){var o=s.nsSeparator!==void 0?s.nsSeparator:this.options.nsSeparator;o===void 0&&(o=":");var a=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,l=s.ns||this.options.defaultNS||[],c=o&&i.indexOf(o)>-1,A=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!Eve(i,o,a);if(c&&!A){var u=i.match(this.interpolator.nestingRegexp);if(u&&u.length>0)return{key:i,namespaces:l};var f=i.split(o);(o!==a||o===a&&this.options.ns.indexOf(f[0])>-1)&&(l=f.shift()),i=f.join(a)}return typeof l=="string"&&(l=[l]),{key:i,namespaces:l}}},{key:"translate",value:function(i,s,o){var a=this;if(Ds(s)!=="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),Ds(s)==="object"&&(s=pi({},s)),s||(s={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,c=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,A=this.extractFromKey(i[i.length-1],s),u=A.key,f=A.namespaces,h=f[f.length-1],d=s.lng||this.language,m=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(m){var g=s.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(h).concat(g).concat(u),usedKey:u,exactUsedKey:u,usedLng:d,usedNS:h}:"".concat(h).concat(g).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:d,usedNS:h}:u}var p=this.resolve(i,s),v=p&&p.res,w=p&&p.usedKey||u,_=p&&p.exactUsedKey||u,x=Object.prototype.toString.apply(v),b=["[object Number]","[object Function]","[object RegExp]"],B=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,S=!this.i18nFormat||this.i18nFormat.handleAsObject,I=typeof v!="string"&&typeof v!="boolean"&&typeof v!="number";if(S&&v&&I&&b.indexOf(x)<0&&!(typeof B=="string"&&x==="[object Array]")){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var M=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,v,pi(pi({},s),{},{ns:f})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(p.res=M,p):M}if(c){var P=x==="[object Array]",D=P?[]:{},T=P?_:w;for(var y in v)if(Object.prototype.hasOwnProperty.call(v,y)){var E="".concat(T).concat(c).concat(y);D[y]=this.translate(E,pi(pi({},s),{joinArrays:!1,ns:f})),D[y]===E&&(D[y]=v[y])}v=D}}else if(S&&typeof B=="string"&&x==="[object Array]")v=v.join(B),v&&(v=this.extendTranslation(v,i,s,o));else{var R=!1,L=!1,N=s.count!==void 0&&typeof s.count!="string",z=t.hasDefaultValue(s),W=N?this.pluralResolver.getSuffix(d,s.count,s):"",H=s["defaultValue".concat(W)]||s.defaultValue;!this.isValidLookup(v)&&z&&(R=!0,v=H),this.isValidLookup(v)||(L=!0,v=u);var C=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,K=C&&L?void 0:v,ee=z&&H!==v&&this.options.updateMissing;if(L||R||ee){if(this.logger.log(ee?"updateKey":"missingKey",d,h,u,ee?H:v),c){var F=this.resolve(u,pi(pi({},s),{},{keySeparator:!1}));F&&F.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}var re=[],ce=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ce&&ce[0])for(var oe=0;oe1&&arguments[1]!==void 0?arguments[1]:{},a,l,c,A,u;return typeof i=="string"&&(i=[i]),i.forEach(function(f){if(!s.isValidLookup(a)){var h=s.extractFromKey(f,o),d=h.key;l=d;var m=h.namespaces;s.options.fallbackNS&&(m=m.concat(s.options.fallbackNS));var g=o.count!==void 0&&typeof o.count!="string",p=g&&!o.ordinal&&o.count===0&&s.pluralResolver.shouldUseIntlApi(),v=o.context!==void 0&&(typeof o.context=="string"||typeof o.context=="number")&&o.context!=="",w=o.lngs?o.lngs:s.languageUtils.toResolveHierarchy(o.lng||s.language,o.fallbackLng);m.forEach(function(_){s.isValidLookup(a)||(u=_,!r3["".concat(w[0],"-").concat(_)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(r3["".concat(w[0],"-").concat(_)]=!0,s.logger.warn('key "'.concat(l,'" for languages "').concat(w.join(", "),`" won't get resolved as namespace "`).concat(u,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),w.forEach(function(x){if(!s.isValidLookup(a)){A=x;var b=[d];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(b,d,x,_,o);else{var B;g&&(B=s.pluralResolver.getSuffix(x,o.count,o));var S="".concat(s.options.pluralSeparator,"zero");if(g&&(b.push(d+B),p&&b.push(d+S)),v){var I="".concat(d).concat(s.options.contextSeparator).concat(o.context);b.push(I),g&&(b.push(I+B),p&&b.push(I+S))}}for(var M;M=b.pop();)s.isValidLookup(a)||(c=M,a=s.getResource(x,_,M,o))}}))})}}),{res:a,usedKey:l,exactUsedKey:c,usedLng:A,usedNS:u}}},{key:"isValidLookup",value:function(i){return i!==void 0&&!(!this.options.returnNull&&i===null)&&!(!this.options.returnEmptyString&&i==="")}},{key:"getResource",value:function(i,s,o){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(i,s,o,a):this.resourceStore.getResource(i,s,o,a)}}],[{key:"hasDefaultValue",value:function(i){var s="defaultValue";for(var o in i)if(Object.prototype.hasOwnProperty.call(i,o)&&s===o.substring(0,s.length)&&i[o]!==void 0)return!0;return!1}}]),t}(xA);function rS(n){return n.charAt(0).toUpperCase()+n.slice(1)}var s3=function(){function n(e){Co(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=Oa.create("languageUtils")}return To(n,[{key:"getScriptPartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return null;var r=t.split("-");return r.length===2||(r.pop(),r[r.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(r.join("-"))}},{key:"getLanguagePartFromCode",value:function(t){if(!t||t.indexOf("-")<0)return t;var r=t.split("-");return this.formatLanguageCode(r[0])}},{key:"formatLanguageCode",value:function(t){if(typeof t=="string"&&t.indexOf("-")>-1){var r=["hans","hant","latn","cyrl","cans","mong","arab"],i=t.split("-");return this.options.lowerCaseLng?i=i.map(function(s){return s.toLowerCase()}):i.length===2?(i[0]=i[0].toLowerCase(),i[1]=i[1].toUpperCase(),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=rS(i[1].toLowerCase()))):i.length===3&&(i[0]=i[0].toLowerCase(),i[1].length===2&&(i[1]=i[1].toUpperCase()),i[0]!=="sgn"&&i[2].length===2&&(i[2]=i[2].toUpperCase()),r.indexOf(i[1].toLowerCase())>-1&&(i[1]=rS(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=rS(i[2].toLowerCase()))),i.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}},{key:"isSupportedCode",value:function(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}},{key:"getBestMatchFromCodes",value:function(t){var r=this;if(!t)return null;var i;return t.forEach(function(s){if(!i){var o=r.formatLanguageCode(s);(!r.options.supportedLngs||r.isSupportedCode(o))&&(i=o)}}),!i&&this.options.supportedLngs&&t.forEach(function(s){if(!i){var o=r.getLanguagePartFromCode(s);if(r.isSupportedCode(o))return i=o;i=r.options.supportedLngs.find(function(a){if(a===o)return a;if(!(a.indexOf("-")<0&&o.indexOf("-")<0)&&a.indexOf(o)===0)return a})}}),i||(i=this.getFallbackCodes(this.options.fallbackLng)[0]),i}},{key:"getFallbackCodes",value:function(t,r){if(!t)return[];if(typeof t=="function"&&(t=t(r)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!r)return t.default||[];var i=t[r];return i||(i=t[this.getScriptPartFromCode(r)]),i||(i=t[this.formatLanguageCode(r)]),i||(i=t[this.getLanguagePartFromCode(r)]),i||(i=t.default),i||[]}},{key:"toResolveHierarchy",value:function(t,r){var i=this,s=this.getFallbackCodes(r||this.options.fallbackLng||[],t),o=[],a=function(c){c&&(i.isSupportedCode(c)?o.push(c):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(c)))};return typeof t=="string"&&t.indexOf("-")>-1?(this.options.load!=="languageOnly"&&a(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&a(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&a(this.getLanguagePartFromCode(t))):typeof t=="string"&&a(this.formatLanguageCode(t)),s.forEach(function(l){o.indexOf(l)<0&&a(i.formatLanguageCode(l))}),o}}]),n}(),Ive=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Rve={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}},Uve=["v1","v2","v3"],o3={zero:0,one:1,two:2,few:3,many:4,other:5};function Fve(){var n={};return Ive.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:Rve[e.fc]}})}),n}var Pve=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Co(this,n),this.languageUtils=e,this.options=t,this.logger=Oa.create("pluralResolver"),(!this.options.compatibilityJSON||this.options.compatibilityJSON==="v4")&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Fve()}return To(n,[{key:"addRule",value:function(t,r){this.rules[t]=r}},{key:"getRule",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(t,{type:r.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}},{key:"needsPlural",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=this.getRule(t,r);return this.shouldUseIntlApi()?i&&i.resolvedOptions().pluralCategories.length>1:i&&i.numbers.length>1}},{key:"getPluralFormsOfKey",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,i).map(function(s){return"".concat(r).concat(s)})}},{key:"getSuffixes",value:function(t){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?s.resolvedOptions().pluralCategories.sort(function(o,a){return o3[o]-o3[a]}).map(function(o){return"".concat(r.options.prepend).concat(o)}):s.numbers.map(function(o){return r.getSuffix(t,o,i)}):[]}},{key:"getSuffix",value:function(t,r){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.getRule(t,i);return s?this.shouldUseIntlApi()?"".concat(this.options.prepend).concat(s.select(r)):this.getSuffixRetroCompatible(s,r):(this.logger.warn("no plural rule found for: ".concat(t)),"")}},{key:"getSuffixRetroCompatible",value:function(t,r){var i=this,s=t.noAbs?t.plurals(r):t.plurals(Math.abs(r)),o=t.numbers[s];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(o===2?o="plural":o===1&&(o=""));var a=function(){return i.options.prepend&&o.toString()?i.options.prepend+o.toString():o.toString()};return this.options.compatibilityJSON==="v1"?o===1?"":typeof o=="number"?"_plural_".concat(o.toString()):a():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?a():this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString()}},{key:"shouldUseIntlApi",value:function(){return!Uve.includes(this.options.compatibilityJSON)}}]),n}();function a3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Oo(n){for(var e=1;e3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=wve(n,e,t);return!s&&i&&typeof t=="string"&&(s=ax(n,t,r),s===void 0&&(s=ax(e,t,r))),s}var Lve=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Co(this,n),this.logger=Oa.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return To(n,[{key:"init",value:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});var r=t.interpolation;this.escape=r.escape!==void 0?r.escape:xve,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?zf(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?zf(r.suffix):r.suffixEscaped||"}}",this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||",",this.unescapePrefix=r.unescapeSuffix?"":r.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":r.unescapeSuffix||"",this.nestingPrefix=r.nestingPrefix?zf(r.nestingPrefix):r.nestingPrefixEscaped||zf("$t("),this.nestingSuffix=r.nestingSuffix?zf(r.nestingSuffix):r.nestingSuffixEscaped||zf(")"),this.nestingOptionsSeparator=r.nestingOptionsSeparator?r.nestingOptionsSeparator:r.nestingOptionsSeparator||",",this.maxReplaces=r.maxReplaces?r.maxReplaces:1e3,this.alwaysFormat=r.alwaysFormat!==void 0?r.alwaysFormat:!1,this.resetRegExp()}},{key:"reset",value:function(){this.options&&this.init(this.options)}},{key:"resetRegExp",value:function(){var t="".concat(this.prefix,"(.+?)").concat(this.suffix);this.regexp=new RegExp(t,"g");var r="".concat(this.prefix).concat(this.unescapePrefix,"(.+?)").concat(this.unescapeSuffix).concat(this.suffix);this.regexpUnescape=new RegExp(r,"g");var i="".concat(this.nestingPrefix,"(.+?)").concat(this.nestingSuffix);this.nestingRegexp=new RegExp(i,"g")}},{key:"interpolate",value:function(t,r,i,s){var o=this,a,l,c,A=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(g){return g.replace(/\$/g,"$$$$")}var f=function(p){if(p.indexOf(o.formatSeparator)<0){var v=l3(r,A,p,o.options.keySeparator,o.options.ignoreJSONStructure);return o.alwaysFormat?o.format(v,void 0,i,Oo(Oo(Oo({},s),r),{},{interpolationkey:p})):v}var w=p.split(o.formatSeparator),_=w.shift().trim(),x=w.join(o.formatSeparator).trim();return o.format(l3(r,A,_,o.options.keySeparator,o.options.ignoreJSONStructure),x,i,Oo(Oo(Oo({},s),r),{},{interpolationkey:_}))};this.resetRegExp();var h=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,d=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,m=[{regex:this.regexpUnescape,safeValue:function(p){return u(p)}},{regex:this.regexp,safeValue:function(p){return o.escapeValue?u(o.escape(p)):u(p)}}];return m.forEach(function(g){for(c=0;a=g.regex.exec(t);){var p=a[1].trim();if(l=f(p),l===void 0)if(typeof h=="function"){var v=h(t,a,s);l=typeof v=="string"?v:""}else if(s&&Object.prototype.hasOwnProperty.call(s,p))l="";else if(d){l=a[0];continue}else o.logger.warn("missed to pass in variable ".concat(p," for interpolating ").concat(t)),l="";else typeof l!="string"&&!o.useRawValueToEscape&&(l=JO(l));var w=g.safeValue(l);if(t=t.replace(a[0],w),d?(g.regex.lastIndex+=l.length,g.regex.lastIndex-=a[0].length):g.regex.lastIndex=0,c++,c>=o.maxReplaces)break}}),t}},{key:"nest",value:function(t,r){var i=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o,a,l;function c(h,d){var m=this.nestingOptionsSeparator;if(h.indexOf(m)<0)return h;var g=h.split(new RegExp("".concat(m,"[ ]*{"))),p="{".concat(g[1]);h=g[0],p=this.interpolate(p,l);var v=p.match(/'/g),w=p.match(/"/g);(v&&v.length%2===0&&!w||w.length%2!==0)&&(p=p.replace(/'/g,'"'));try{l=JSON.parse(p),d&&(l=Oo(Oo({},d),l))}catch(_){return this.logger.warn("failed parsing options string in nesting for key ".concat(h),_),"".concat(h).concat(m).concat(p)}return delete l.defaultValue,h}for(;o=this.nestingRegexp.exec(t);){var A=[];l=Oo({},s),l=l.replace&&typeof l.replace!="string"?l.replace:l,l.applyPostProcessor=!1,delete l.defaultValue;var u=!1;if(o[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(o[1])){var f=o[1].split(this.formatSeparator).map(function(h){return h.trim()});o[1]=f.shift(),A=f,u=!0}if(a=r(c.call(this,o[1].trim(),l),l),a&&o[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=JO(a)),a||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),a=""),u&&(a=A.reduce(function(h,d){return i.format(h,d,s.lng,Oo(Oo({},s),{},{interpolationkey:o[1].trim()}))},a.trim())),t=t.replace(o[0],a),this.regexp.lastIndex=0}return t}}]),n}();function c3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function _l(n){for(var e=1;e-1){var r=n.split("(");e=r[0].toLowerCase().trim();var i=r[1].substring(0,r[1].length-1);if(e==="currency"&&i.indexOf(":")<0)t.currency||(t.currency=i.trim());else if(e==="relativetime"&&i.indexOf(":")<0)t.range||(t.range=i.trim());else{var s=i.split(";");s.forEach(function(o){if(o){var a=o.split(":"),l=pve(a),c=l[0],A=l.slice(1),u=A.join(":").trim().replace(/^'+|'+$/g,"");t[c.trim()]||(t[c.trim()]=u),u==="false"&&(t[c.trim()]=!1),u==="true"&&(t[c.trim()]=!0),isNaN(u)||(t[c.trim()]=parseInt(u,10))}})}}return{formatName:e,formatOptions:t}}function Gf(n){var e={};return function(r,i,s){var o=i+JSON.stringify(s),a=e[o];return a||(a=n(i,s),e[o]=a),a(r)}}var Nve=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Co(this,n),this.logger=Oa.create("formatter"),this.options=e,this.formats={number:Gf(function(t,r){var i=new Intl.NumberFormat(t,_l({},r));return function(s){return i.format(s)}}),currency:Gf(function(t,r){var i=new Intl.NumberFormat(t,_l(_l({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:Gf(function(t,r){var i=new Intl.DateTimeFormat(t,_l({},r));return function(s){return i.format(s)}}),relativetime:Gf(function(t,r){var i=new Intl.RelativeTimeFormat(t,_l({},r));return function(s){return i.format(s,r.range||"day")}}),list:Gf(function(t,r){var i=new Intl.ListFormat(t,_l({},r));return function(s){return i.format(s)}})},this.init(e)}return To(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}},i=r.interpolation;this.formatSeparator=i.formatSeparator?i.formatSeparator:i.formatSeparator||","}},{key:"add",value:function(t,r){this.formats[t.toLowerCase().trim()]=r}},{key:"addCached",value:function(t,r){this.formats[t.toLowerCase().trim()]=Gf(r)}},{key:"format",value:function(t,r,i){var s=this,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},a=r.split(this.formatSeparator),l=a.reduce(function(c,A){var u=Dve(A),f=u.formatName,h=u.formatOptions;if(s.formats[f]){var d=c;try{var m=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},g=m.locale||m.lng||o.locale||o.lng||i;d=s.formats[f](c,g,_l(_l(_l({},h),o),m))}catch(p){s.logger.warn(p)}return d}else s.logger.warn("there was no format function for ".concat(f));return c},t);return l}}]),n}();function A3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function u3(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Hve(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var Qve=function(n){R1(t,n);var e=Ove(t);function t(r,i,s){var o,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Co(this,t),o=e.call(this),U1&&xA.call(hA(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=Oa.create("backendConnector"),o.waitingReads=[],o.maxParallelReads=a.maxParallelReads||10,o.readingCalls=0,o.maxRetries=a.maxRetries>=0?a.maxRetries:5,o.retryTimeout=a.retryTimeout>=1?a.retryTimeout:350,o.state={},o.queue=[],o.backend&&o.backend.init&&o.backend.init(s,a.backend,a),o}return To(t,[{key:"queueLoad",value:function(i,s,o,a){var l=this,c={},A={},u={},f={};return i.forEach(function(h){var d=!0;s.forEach(function(m){var g="".concat(h,"|").concat(m);!o.reload&&l.store.hasResourceBundle(h,m)?l.state[g]=2:l.state[g]<0||(l.state[g]===1?A[g]===void 0&&(A[g]=!0):(l.state[g]=1,d=!1,A[g]===void 0&&(A[g]=!0),c[g]===void 0&&(c[g]=!0),f[m]===void 0&&(f[m]=!0)))}),d||(u[h]=!0)}),(Object.keys(c).length||Object.keys(A).length)&&this.queue.push({pending:A,pendingCount:Object.keys(A).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(c),pending:Object.keys(A),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(f)}}},{key:"loaded",value:function(i,s,o){var a=i.split("|"),l=a[0],c=a[1];s&&this.emit("failedLoading",l,c,s),o&&this.store.addResourceBundle(l,c,o),this.state[i]=s?-1:2;var A={};this.queue.forEach(function(u){yve(u.loaded,[l],c),Hve(u,i),s&&u.errors.push(s),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(f){A[f]||(A[f]={});var h=u.loaded[f];h.length&&h.forEach(function(d){A[f][d]===void 0&&(A[f][d]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",A),this.queue=this.queue.filter(function(u){return!u.done})}},{key:"read",value:function(i,s,o){var a=this,l=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,c=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,A=arguments.length>5?arguments[5]:void 0;if(!i.length)return A(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:s,fcName:o,tried:l,wait:c,callback:A});return}this.readingCalls++;var u=function(m,g){if(a.readingCalls--,a.waitingReads.length>0){var p=a.waitingReads.shift();a.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(m&&g&&l2&&arguments[2]!==void 0?arguments[2]:{},l=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),l&&l();typeof i=="string"&&(i=this.languageUtils.toResolveHierarchy(i)),typeof s=="string"&&(s=[s]);var c=this.queueLoad(i,s,a,l);if(!c.toLoad.length)return c.pending.length||l(),null;c.toLoad.forEach(function(A){o.loadOne(A)})}},{key:"load",value:function(i,s,o){this.prepareLoading(i,s,{},o)}},{key:"reload",value:function(i,s,o){this.prepareLoading(i,s,{reload:!0},o)}},{key:"loadOne",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",a=i.split("|"),l=a[0],c=a[1];this.read(l,c,"read",void 0,void 0,function(A,u){A&&s.logger.warn("".concat(o,"loading namespace ").concat(c," for language ").concat(l," failed"),A),!A&&u&&s.logger.log("".concat(o,"loaded namespace ").concat(c," for language ").concat(l),u),s.loaded(i,A,u)})}},{key:"saveMissing",value:function(i,s,o,a,l){var c=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},A=arguments.length>6&&arguments[6]!==void 0?arguments[6]:function(){};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(s)){this.logger.warn('did not save key "'.concat(o,'" as the namespace "').concat(s,'" was not yet loaded'),"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(o==null||o==="")){if(this.backend&&this.backend.create){var u=u3(u3({},c),{},{isUpdate:l}),f=this.backend.create.bind(this.backend);if(f.length<6)try{var h;f.length===5?h=f(i,s,o,a,u):h=f(i,s,o,a),h&&typeof h.then=="function"?h.then(function(d){return A(null,d)}).catch(A):A(null,h)}catch(d){A(d)}else f(i,s,o,a,A,u)}!i||!i[0]||this.store.addResource(i[0],s,o,a)}}}]),t}(xA);function f3(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(e){var t={};if(Ds(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),Ds(e[2])==="object"||Ds(e[3])==="object"){var r=e[3]||e[2];Object.keys(r).forEach(function(i){t[i]=r[i]})}return t},interpolation:{escapeValue:!0,format:function(e,t,r,i){return e},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function h3(n){return typeof n.ns=="string"&&(n.ns=[n.ns]),typeof n.fallbackLng=="string"&&(n.fallbackLng=[n.fallbackLng]),typeof n.fallbackNS=="string"&&(n.fallbackNS=[n.fallbackNS]),n.supportedLngs&&n.supportedLngs.indexOf("cimode")<0&&(n.supportedLngs=n.supportedLngs.concat(["cimode"])),n}function d3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function va(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Oy(){}function Vve(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var lx=function(n){R1(t,n);var e=zve(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(Co(this,t),r=e.call(this),U1&&xA.call(hA(r)),r.options=h3(i),r.services={},r.logger=Oa,r.modules={external:[]},Vve(hA(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),B0(r,hA(r));setTimeout(function(){r.init(i,s)},0)}return r}return To(t,[{key:"init",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1?arguments[1]:void 0;typeof s=="function"&&(o=s,s={}),!s.defaultNS&&s.defaultNS!==!1&&s.ns&&(typeof s.ns=="string"?s.defaultNS=s.ns:s.ns.indexOf("translation")<0&&(s.defaultNS=s.ns[0]));var a=f3();this.options=va(va(va({},a),this.options),h3(s)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=va(va({},a.interpolation),this.options.interpolation)),s.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=s.keySeparator),s.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=s.nsSeparator);function l(p){return p?typeof p=="function"?new p:p:null}if(!this.options.isClone){this.modules.logger?Oa.init(l(this.modules.logger),this.options):Oa.init(null,this.options);var c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Nve);var A=new s3(this.options);this.store=new Mve(this.options.resources,this.options);var u=this.services;u.logger=Oa,u.resourceStore=this.store,u.languageUtils=A,u.pluralResolver=new Pve(A,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(u.formatter=l(c),u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new Lve(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new Qve(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(p){for(var v=arguments.length,w=new Array(v>1?v-1:0),_=1;_1?v-1:0),_=1;_0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined");var h=["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"];h.forEach(function(p){i[p]=function(){var v;return(v=i.store)[p].apply(v,arguments)}});var d=["addResource","addResources","addResourceBundle","removeResourceBundle"];d.forEach(function(p){i[p]=function(){var v;return(v=i.store)[p].apply(v,arguments),i}});var m=sm(),g=function(){var v=function(_,x){i.isInitialized&&!i.initializedStoreOnce&&i.logger.warn("init: i18next is already initialized. You should call init just once!"),i.isInitialized=!0,i.options.isClone||i.logger.log("initialized",i.options),i.emit("initialized",i.options),m.resolve(x),o(_,x)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return v(null,i.t.bind(i));i.changeLanguage(i.options.lng,v)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),m}},{key:"loadResources",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oy,a=o,l=typeof i=="string"?i:this.language;if(typeof i=="function"&&(a=i),!this.options.resources||this.options.partialBundledLanguages){if(l&&l.toLowerCase()==="cimode")return a();var c=[],A=function(h){if(h){var d=s.services.languageUtils.toResolveHierarchy(h);d.forEach(function(m){c.indexOf(m)<0&&c.push(m)})}};if(l)A(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(f){return A(f)})}this.options.preload&&this.options.preload.forEach(function(f){return A(f)}),this.services.backendConnector.load(c,this.options.ns,function(f){!f&&!s.resolvedLanguage&&s.language&&s.setResolvedLanguage(s.language),a(f)})}else a(null)}},{key:"reloadResources",value:function(i,s,o){var a=sm();return i||(i=this.languages),s||(s=this.options.ns),o||(o=Oy),this.services.backendConnector.reload(i,s,function(l){a.resolve(),o(l)}),a}},{key:"use",value:function(i){if(!i)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!i.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return i.type==="backend"&&(this.modules.backend=i),(i.type==="logger"||i.log&&i.warn&&i.error)&&(this.modules.logger=i),i.type==="languageDetector"&&(this.modules.languageDetector=i),i.type==="i18nFormat"&&(this.modules.i18nFormat=i),i.type==="postProcessor"&&uV.addPostProcessor(i),i.type==="formatter"&&(this.modules.formatter=i),i.type==="3rdParty"&&this.modules.external.push(i),this}},{key:"setResolvedLanguage",value:function(i){if(!(!i||!this.languages)&&!(["cimode","dev"].indexOf(i)>-1))for(var s=0;s-1)&&this.store.hasLanguageSomeTranslations(o)){this.resolvedLanguage=o;break}}}},{key:"changeLanguage",value:function(i,s){var o=this;this.isLanguageChangingTo=i;var a=sm();this.emit("languageChanging",i);var l=function(f){o.language=f,o.languages=o.services.languageUtils.toResolveHierarchy(f),o.resolvedLanguage=void 0,o.setResolvedLanguage(f)},c=function(f,h){h?(l(h),o.translator.changeLanguage(h),o.isLanguageChangingTo=void 0,o.emit("languageChanged",h),o.logger.log("languageChanged",h)):o.isLanguageChangingTo=void 0,a.resolve(function(){return o.t.apply(o,arguments)}),s&&s(f,function(){return o.t.apply(o,arguments)})},A=function(f){!i&&!f&&o.services.languageDetector&&(f=[]);var h=typeof f=="string"?f:o.services.languageUtils.getBestMatchFromCodes(f);h&&(o.language||l(h),o.translator.language||o.translator.changeLanguage(h),o.services.languageDetector&&o.services.languageDetector.cacheUserLanguage&&o.services.languageDetector.cacheUserLanguage(h)),o.loadResources(h,function(d){c(d,h)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?A(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(A):this.services.languageDetector.detect(A):A(i),a}},{key:"getFixedT",value:function(i,s,o){var a=this,l=function c(A,u){var f;if(Ds(u)!=="object"){for(var h=arguments.length,d=new Array(h>2?h-2:0),m=2;m1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;var a=o.lng||this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,c=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var A=function(h,d){var m=s.services.backendConnector.state["".concat(h,"|").concat(d)];return m===-1||m===2};if(o.precheck){var u=o.precheck(this,A);if(u!==void 0)return u}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||A(a,i)&&(!l||A(c,i)))}},{key:"loadNamespaces",value:function(i,s){var o=this,a=sm();return this.options.ns?(typeof i=="string"&&(i=[i]),i.forEach(function(l){o.options.ns.indexOf(l)<0&&o.options.ns.push(l)}),this.loadResources(function(l){a.resolve(),s&&s(l)}),a):(s&&s(),Promise.resolve())}},{key:"loadLanguages",value:function(i,s){var o=sm();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(c){return a.indexOf(c)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(c){o.resolve(),s&&s(c)}),o):(s&&s(),Promise.resolve())}},{key:"dir",value:function(i){if(i||(i=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!i)return"rtl";var s=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],o=this.services&&this.services.languageUtils||new s3(f3());return s.indexOf(o.getLanguagePartFromCode(i))>-1||i.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}},{key:"cloneInstance",value:function(){var i=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Oy,a=va(va(va({},this.options),s),{isClone:!0}),l=new t(a);(s.debug!==void 0||s.prefix!==void 0)&&(l.logger=l.logger.clone(s));var c=["store","services","language"];return c.forEach(function(A){l[A]=i[A]}),l.services=va({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new i3(l.services,l.options),l.translator.on("*",function(A){for(var u=arguments.length,f=new Array(u>1?u-1:0),h=1;h0&&arguments[0]!==void 0?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;return new lx(n,e)});var Ti=lx.createInstance();Ti.createInstance=lx.createInstance;Ti.createInstance;Ti.dir;Ti.init;Ti.loadResources;Ti.reloadResources;Ti.use;Ti.changeLanguage;Ti.getFixedT;Ti.t;Ti.exists;Ti.setDefaultNamespace;Ti.hasLoadedNamespace;Ti.loadNamespaces;Ti.loadLanguages;function jve(){if(console&&console.warn){for(var n,e=arguments.length,t=new Array(e),r=0;r2&&arguments[2]!==void 0?arguments[2]:{},r=e.languages[0],i=e.options?e.options.fallbackLng:!1,s=e.languages[e.languages.length-1];if(r.toLowerCase()==="cimode")return!0;var o=function(l,c){var A=e.services.backendConnector.state["".concat(l,"|").concat(c)];return A===-1||A===2};return t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&e.services.backendConnector.backend&&e.isLanguageChangingTo&&!o(e.isLanguageChangingTo,n)?!1:!!(e.hasResourceBundle(r,n)||!e.services.backendConnector.backend||e.options.resources&&!e.options.partialBundledLanguages||o(r,n)&&(!i||o(s,n)))}function Kve(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return ST("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(n,{lng:t.lng,precheck:function(s,o){if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!o(s.isLanguageChangingTo,n))return!1}}):Wve(n,e,t)}var Xve=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Yve={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},$ve=function(e){return Yve[e]},Zve=function(e){return e.replace(Xve,$ve)};function v3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function y3(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};MT=y3(y3({},MT),n)}function Jve(){return MT}var hV;function eye(n){hV=n}function tye(){return hV}var nye={type:"3rdParty",init:function(e){qve(e.options.react),eye(e)}},rye=xe.createContext(),iye=function(){function n(){Co(this,n),this.usedNamespaces={}}return To(n,[{key:"addUsedNamespaces",value:function(t){var r=this;t.forEach(function(i){r.usedNamespaces[i]||(r.usedNamespaces[i]=!0)})}},{key:"getUsedNamespaces",value:function(){return Object.keys(this.usedNamespaces)}}]),n}();function sye(n,e){var t=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(t!=null){var r,i,s,o,a=[],l=!0,c=!1;try{if(s=(t=t.call(n)).next,e===0){if(Object(t)!==t)return;l=!1}else for(;!(l=(r=s.call(t)).done)&&(a.push(r.value),a.length!==e);l=!0);}catch(A){c=!0,i=A}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}function oye(n,e){return aV(n)||sye(n,e)||lV(n,e)||cV()}function w3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function iS(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=xe.useContext(rye)||{},i=r.i18n,s=r.defaultNS,o=t||i||tye();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new iye),!o){ST("You will need to pass in an i18next instance by using initReactI18next");var a=function(I,M){return typeof M=="string"?M:M&&Ds(M)==="object"&&typeof M.defaultValue=="string"?M.defaultValue:Array.isArray(I)?I[I.length-1]:I},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}o.options.react&&o.options.react.wait!==void 0&&ST("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var c=iS(iS(iS({},Jve()),o.options.react),e),A=c.useSuspense,u=c.keyPrefix,f=n||s||o.options&&o.options.defaultNS;f=typeof f=="string"?[f]:f||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(f);var h=(o.isInitialized||o.initializedStoreOnce)&&f.every(function(S){return Kve(S,o,c)});function d(){return o.getFixedT(e.lng||null,c.nsMode==="fallback"?f:f[0],u)}var m=xe.useState(d),g=oye(m,2),p=g[0],v=g[1],w=f.join();e.lng&&(w="".concat(e.lng).concat(w));var _=aye(w),x=xe.useRef(!0);xe.useEffect(function(){var S=c.bindI18n,I=c.bindI18nStore;x.current=!0,!h&&!A&&(e.lng?g3(o,e.lng,f,function(){x.current&&v(d)}):m3(o,f,function(){x.current&&v(d)})),h&&_&&_!==w&&x.current&&v(d);function M(){x.current&&v(d)}return S&&o&&o.on(S,M),I&&o&&o.store.on(I,M),function(){x.current=!1,S&&o&&S.split(" ").forEach(function(P){return o.off(P,M)}),I&&o&&I.split(" ").forEach(function(P){return o.store.off(P,M)})}},[o,w]);var b=xe.useRef(!0);xe.useEffect(function(){x.current&&!b.current&&v(d),b.current=!1},[o,u]);var B=[p,o,h];if(B.t=p,B.i18n=o,B.ready=h,h||!h&&!A)return B;throw new Promise(function(S){e.lng?g3(o,e.lng,f,function(){return S()}):m3(o,f,function(){return S()})})}var dV=[],cye=dV.forEach,Aye=dV.slice;function uye(n){return cye.call(Aye.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var _3=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,fye=function(e,t,r){var i=r||{};i.path=i.path||"/";var s=encodeURIComponent(t),o="".concat(e,"=").concat(s);if(i.maxAge>0){var a=i.maxAge-0;if(Number.isNaN(a))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(a))}if(i.domain){if(!_3.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!_3.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var l=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(l){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},x3={create:function(e,t,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+r*60*1e3)),i&&(s.domain=i),document.cookie=fye(e,encodeURIComponent(t),s)},read:function(e){for(var t="".concat(e,"="),r=document.cookie.split(";"),i=0;i-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var i=r.substring(1),s=i.split("&"),o=0;o0){var l=s[o].substring(0,a);l===e.lookupQuerystring&&(t=s[o].substring(a+1))}}}return t}},om=null,b3=function(){if(om!==null)return om;try{om=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{om=!1}return om},pye={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&b3()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&b3()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},am=null,E3=function(){if(am!==null)return am;try{am=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{am=!1}return am},mye={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&E3()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&E3()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},gye={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},vye={name:"htmlTag",lookup:function(e){var t,r=e.htmlTag||(typeof document<"u"?document.documentElement:null);return r&&typeof r.getAttribute=="function"&&(t=r.getAttribute("lang")),t}},yye={name:"path",lookup:function(e){var t;if(typeof window<"u"){var r=window.location.pathname.match(/\/([a-zA-Z-]*)/g);if(r instanceof Array)if(typeof e.lookupFromPathIndex=="number"){if(typeof r[e.lookupFromPathIndex]!="string")return;t=r[e.lookupFromPathIndex].replace("/","")}else t=r[0].replace("/","")}return t}},wye={name:"subdomain",lookup:function(e){var t=typeof e.lookupFromSubdomainIndex=="number"?e.lookupFromSubdomainIndex+1:1,r=typeof window<"u"&&window.location&&window.location.hostname&&window.location.hostname.match(/^(\w{2,5})\.(([a-z0-9-]{1,63}\.[a-z]{2,6})|localhost)/i);if(r)return r[t]}};function _ye(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(e){return e}}}var pV=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Co(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return To(n,[{key:"init",value:function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=t||{languageUtils:{}},this.options=uye(r,this.options||{},_ye()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(s){return s.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(hye),this.addDetector(dye),this.addDetector(pye),this.addDetector(mye),this.addDetector(gye),this.addDetector(vye),this.addDetector(yye),this.addDetector(wye)}},{key:"addDetector",value:function(t){return this.detectors[t.name]=t,this}},{key:"detect",value:function(t){var r=this;t||(t=this.options.order);var i=[];return t.forEach(function(s){if(r.detectors[s]){var o=r.detectors[s].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(i=i.concat(o))}}),i=i.map(function(s){return r.options.convertDetectedLanguage(s)}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(t,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(t)>-1||r.forEach(function(s){i.detectors[s]&&i.detectors[s].cacheUserLanguage(t,i.options)}))}}]),n}();pV.type="languageDetector";const xye={translation:{pageTitles:{chooseClass:"Choose Character Class",chooseAppearance:"Choose Appearance",saveCharacter:"Save Your Character"},callToAction:{next:"Next",back:"Back",randomize:"Randomize",send:"Send"},editor:{title:"Appearance",head:"Head",body:"Body",eyes:"Eyes",outer:"Outer",chest:"Chest",legs:"Legs",feet:"Feet",accessories:"Accessories"},labels:{name:"Name",voice:"Voice",favoriteColor:"Favorite Color",preferredGreeting:"Preferred Greeting",question:"Question",yourName:"Your Name",conversation:"Conversation"},text:{unoptimized:"Unoptimized",apiUnderMaintnance:"Voice generation API is temporarily disabled for maintenance!"}}},bye={translation:{pageTitles:{chooseClass:"Выбрать Класс Персонажа",chooseAppearance:"Выбрать Внешность",saveCharacter:"Сохранить Персонажа"},callToAction:{next:"Далее",back:"Назад",randomize:"Рандомизировать",send:"Отправить"},editor:{title:"Внешность",head:"Голова",body:"Тело",eyes:"Глаза",outer:"Внешний",chest:"Грудь",legs:"Ноги",feet:"Стопы",accessories:"Аксессуары"},labels:{name:"Имя",voice:"Голос",favoriteColor:"Любимый Цвет",preferredGreeting:"Предпочитаемое Приветствие",question:"Вопрос",yourName:"Ваше Имя",conversation:"Разговор"},text:{unoptimized:"Неоптимизи­рованный",apiUnderMaintnance:"API генерации голоса временно отключен на техническое обслуживание."}}},Eye={translation:{pageTitles:{chooseClass:"选择角色类型",chooseAppearance:"选择外观",saveCharacter:"保存角色"},callToAction:{next:"下一步",back:"返回",randomize:"随机",send:"发送"},editor:{title:"外观",head:"头部",body:"身体",eyes:"眼睛",outer:"外套",chest:"上身",legs:"腿部",feet:"脚部",accessories:"配件"},labels:{name:"名字",voice:"语音",favoriteColor:"颜色偏好",preferredGreeting:"首选问候语",question:"问题",yourName:"你的名字",conversation:"对话"},text:{unoptimized:"未优化",apiUnderMaintnance:"语音生成API暂时关闭进行维护!"}}},Bye={en:xye,ru:bye,zh:Eye};Ti.use(pV).use(nye).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:Bye});const la=xe.createContext(),Sye=n=>{const{t:e}=lye();return Q.jsx(la.Provider,{value:{t:e},children:n.children})},Mye=` uniform vec3 cameraDir; uniform vec3 eye; @@ -5051,7 +5055,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vWorldPosition = (modelMatrix * vec4( pos, 1.0 )).xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( pos, 1.0 ); } -`,_ye=` +`,Cye=` uniform float switchItemDuration; uniform float switchItemTime; uniform vec3 cameraDir; @@ -5089,7 +5093,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor.a *= (switchItemDuration - switchItemTime); gl_FragColor *= aura; } -`,xye=` +`,Tye=` uniform vec4 cameraBillboardQuaternion; attribute vec2 scales; @@ -5120,7 +5124,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,bye=` +`,Iye=` varying vec2 vUv; varying float vOpacity; varying vec3 vWorldPosition; @@ -5143,7 +5147,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } gl_FragColor.a *= vOpacity; } -`,Eye=` +`,Rye=` attribute vec2 scales; attribute float opacity; attribute vec3 positions; @@ -5169,7 +5173,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,Bye=` +`,Uye=` uniform float radius; varying vec2 vUv; @@ -5192,7 +5196,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor.a = smoothstep(0.3, 0.8, gl_FragColor.a); gl_FragColor.a *= vOpacity; } -`,Sye=` +`,Fye=` uniform vec4 cameraBillboardQuaternion; varying vec2 vUv; @@ -5213,7 +5217,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,Mye=` +`,Pye=` varying vec2 vUv; varying vec3 vWorldPosition; @@ -5223,7 +5227,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor.a = col; gl_FragColor.a *= clamp(vWorldPosition.y * 10., 0.0, 1.0); } -`,Cye=` +`,Lye=` varying vec3 vWorldPosition; varying vec3 vSurfaceNormal; @@ -5236,7 +5240,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vWorldPosition = (modelMatrix * vec4( pos, 1.0 )).xyz; gl_Position = projectionMatrix * modelViewMatrix * vec4( pos, 1.0 ); } -`,Tye=` +`,Dye=` uniform vec3 cameraDir; uniform vec3 eye; @@ -5258,7 +5262,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor *= pow(1. - vUv.y, 3.0); gl_FragColor *= opacity; } -`,d2=(n,e,t)=>{const r=new Zt;["position","normal","uv"].forEach(o=>{r.setAttribute(o,n.attributes[o])}),r.setIndex(n.index);const i=new Float32Array(t*3),s=new Qg(i,3);r.setAttribute("positions",s);for(const o of e){const{name:a,itemSize:l}=o,c=new Float32Array(t*l);r.setAttribute(a,new Qg(c,l))}return r},Iye=n=>{const r=new A1(.45,.45,5,50,50,!0),i=new dr({uniforms:{auraTexture:{value:null}},vertexShader:wye,fragmentShader:_ye,transparent:!0,blending:Iu});i.uniforms.cameraDir=n.cameraDir,i.uniforms.eye=n.eye,i.uniforms.switchItemTime=n.switchItemTime,i.uniforms.switchItemDuration=n.switchItemDuration;const s=new hn(r,i);return s.frustumCulled=!1,s.position.y=5*.46,s},Rye=()=>{const e=[];e.push({name:"opacity",itemSize:1}),e.push({name:"scales",itemSize:2});const t=.3,r=new ac(t,t),i=d2(r,e,20),s=new dr({uniforms:{cameraBillboardQuaternion:{value:new tt}},vertexShader:xye,fragmentShader:bye,depthWrite:!1,blending:Iu}),o=new c1(i,s,20);return o.info={particleCount:20,velocity:[20]},o},Uye=n=>{const t=[];t.push({name:"opacity",itemSize:1}),t.push({name:"scales",itemSize:2});const r=.43,i=new OR(r,32,32),s=d2(i,t,10),o=new dr({uniforms:{radius:{value:r}},vertexShader:Eye,fragmentShader:Bye,depthWrite:!1,blending:Iu});o.uniforms.cameraDir=n.cameraDir,o.uniforms.eye=n.eye,o.uniforms.fadeInAvatarTime=n.fadeInAvatarTime;const a=new c1(s,o,10);return a.info={particleCount:10,velocity:[10],currentIndex:0},a},Fye=n=>{const t=new ac(1,1),r=new dr({uniforms:{cameraBillboardQuaternion:{value:new tt}},vertexShader:Sye,fragmentShader:Mye,depthWrite:!1,blending:Iu});return new hn(t,r)},Pye=n=>{const t=[],s=new A1(.645,.43,2.5,50,50,!0),o=d2(s,t,2),a=new dr({uniforms:{opacity:{value:0}},vertexShader:Cye,fragmentShader:Tye,transparent:!0,blending:Iu});a.uniforms.cameraDir=n.cameraDir,a.uniforms.eye=n.eye;const l=new c1(o,a,2);return l.fadeIn=!1,l.frustumCulled=!1,l.position.y=2.5*.46,l},b3=100,Lye=0,ax=1.5,Dye=.1,Pw=0,E3=1,B3=.05,BT=0,Nye=1,Oye=.015,Vi={normal:0,switchItem:1,fadeOutAvatar:2,loadingAvatar:3,fadeInAvatar:4},kye=new ju,dV=kye.load("./textures/beam2.png");dV.wrapS=Hs;class Hye{constructor(e,t,r){this.scene=e,this.camera=t,this.globalUniforms=r,this.eye=new $,this.cameraDir=new $,this.beamMesh=null,this.initBeam(),this.pixelMesh=null,this.initPixel(),this.ringMesh=null,this.initRing(),this.teleportMesh=null,this.initTeleport(),this.spotLight=null,this.initSpotLight()}emitBeam(){this.beamMesh.visible=!0}emitPixel(){this.stopUpdatePixelMesh=!1;const e=this.pixelMesh.geometry.getAttribute("scales"),t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount,s=.25;for(let o=0;ol+e||i.getX(a)<=0)&&(r.setXYZ(o,0,l,0),t.setXY(o,1,.06),i.setX(o,1),this.ringMesh.info.velocity[o]=.1,this.ringMesh.info.currentIndex++,this.ringMesh.info.currentIndex>=s&&(this.ringMesh.info.currentIndex=0)),t.needsUpdate=!0,r.needsUpdate=!0,i.needsUpdate=!0}emitTeleport(){this.teleportMesh.visible=!0}emitSpotLight(){this.spotLight.visible=!0,this.spotLight.fadeIn=!0}removeSpotLight(){this.spotLight.fadeIn=!1}update(){this.beamMesh.visible&&this.beamMesh.update(),!this.stopUpdatePixelMesh&&this.pixelMesh.update(),this.ringMesh.visible&&this.ringMesh.update(),this.teleportMesh.visible&&this.teleportMesh.update(),this.spotLight.visible&&this.spotLight.update()}initBeam(){this.beamMesh=Iye(this.globalUniforms),this.beamMesh.material.uniforms.auraTexture.value=dV,this.beamMesh.update=()=>this.updateBeam(),this.scene.add(this.beamMesh)}initPixel(){this.pixelMesh=Rye(),this.pixelMesh.update=()=>this.updatePixel(),this.scene.add(this.pixelMesh)}initRing(){this.ringMesh=Uye(this.globalUniforms),this.ringMesh.update=()=>this.updateRing(),this.scene.add(this.ringMesh)}initTeleport(){this.teleportMesh=Fye(this.globalUniforms),this.teleportMesh.update=()=>this.updateTeleport(),this.teleportMesh.visible=!1,this.scene.add(this.teleportMesh)}initSpotLight(){this.spotLight=Pye(this.globalUniforms),this.spotLight.update=()=>this.updateSpotLight(),this.spotLight.visible=!1,this.scene.add(this.spotLight)}updateBeam(){this.beamMesh&&this.globalUniforms.transitionEffectType.value!==Vi.switchItem&&(this.beamMesh.visible=!1)}updatePixel(){if(this.pixelMesh){let e=0;const t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount;for(let s=0;s.01?(t.setY(s,t.getY(s)+this.pixelMesh.info.velocity[s]),r.setX(s,r.getX(s)/1.3)):(r.setX(s,0),e++);e>=i&&(this.stopUpdatePixelMesh=!0),t.needsUpdate=!0,r.needsUpdate=!0,this.pixelMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateRing(){if(this.ringMesh){const e=this.ringMesh.geometry.getAttribute("positions"),t=this.ringMesh.geometry.getAttribute("opacity"),r=this.ringMesh.info.particleCount;for(let i=0;i.01?(e.setY(i,e.getY(i)+this.ringMesh.info.velocity[i]),t.setX(i,t.getX(i)/1.27)):t.setX(i,0);e.needsUpdate=!0,t.needsUpdate=!0,this.globalUniforms.transitionEffectType.value!==Vi.fadeInAvatar&&(this.ringMesh.visible=!1)}}updateTeleport(){if(this.teleportMesh){if(this.globalUniforms.transitionEffectType.value===Vi.fadeOutAvatar){const e=this.globalUniforms.fadeOutAvatarTime.value,t=.2;if(e0?(this.teleportMesh.scale.x=this.teleportMesh.scale.x-.2,this.teleportMesh.scale.z=this.teleportMesh.scale.z-.2):this.teleportMesh.visible=!1}else this.teleportMesh.visible=!1;this.teleportMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateSpotLight(){this.spotLight&&(this.spotLight.fadeIn?this.spotLight.material.uniforms.opacity.value<1&&(this.spotLight.material.uniforms.opacity.value=1):this.spotLight.material.uniforms.opacity.value>0?this.spotLight.material.uniforms.opacity.value-=.025:(this.spotLight.material.uniforms.opacity.value=0,this.spotLight.visible=!1))}}const pV=new ju,ST=pV.load("./textures/pixel9.png");ST.wrapS=ST.wrapT=Hs;const MT=pV.load("./textures/noise3.jpg");MT.wrapS=MT.wrapT=Hs;const Ot={switchItemDuration:{value:ax},switchItemTime:{value:ax},eye:{value:new $},cameraDir:{value:new $},fadeOutAvatarTime:{value:Pw},fadeInAvatarTime:{value:BT},transitionEffectType:{value:Vi.normal}},S3={pixelTexture:{value:ST},noiseTexture:{value:MT}};class Qye extends EventTarget{constructor(){super();jt(this,"setTransitionEffect",t=>{this.transitionEffectType=t});jt(this,"getTransitionEffect",t=>this.transitionEffectType===t);this.cameraDir=new $,this.frameRate=1e3/30,this.initParticle=!1,this.transitionEffectType=null,this.transitionTime=b3,this.update()}setCustomShader(t){t.vertexShader&&(t.vertexShader=t.vertexShader.replace("varying vec3 vViewPosition;",` +`,m2=(n,e,t)=>{const r=new Zt;["position","normal","uv"].forEach(o=>{r.setAttribute(o,n.attributes[o])}),r.setIndex(n.index);const i=new Float32Array(t*3),s=new Gg(i,3);r.setAttribute("positions",s);for(const o of e){const{name:a,itemSize:l}=o,c=new Float32Array(t*l);r.setAttribute(a,new Gg(c,l))}return r},Nye=n=>{const r=new f1(.45,.45,5,50,50,!0),i=new pr({uniforms:{auraTexture:{value:null}},vertexShader:Mye,fragmentShader:Cye,transparent:!0,blending:Fu});i.uniforms.cameraDir=n.cameraDir,i.uniforms.eye=n.eye,i.uniforms.switchItemTime=n.switchItemTime,i.uniforms.switchItemDuration=n.switchItemDuration;const s=new hn(r,i);return s.frustumCulled=!1,s.position.y=5*.46,s},Oye=()=>{const e=[];e.push({name:"opacity",itemSize:1}),e.push({name:"scales",itemSize:2});const t=.3,r=new cc(t,t),i=m2(r,e,20),s=new pr({uniforms:{cameraBillboardQuaternion:{value:new tt}},vertexShader:Tye,fragmentShader:Iye,depthWrite:!1,blending:Fu}),o=new u1(i,s,20);return o.info={particleCount:20,velocity:[20]},o},kye=n=>{const t=[];t.push({name:"opacity",itemSize:1}),t.push({name:"scales",itemSize:2});const r=.43,i=new QR(r,32,32),s=m2(i,t,10),o=new pr({uniforms:{radius:{value:r}},vertexShader:Rye,fragmentShader:Uye,depthWrite:!1,blending:Fu});o.uniforms.cameraDir=n.cameraDir,o.uniforms.eye=n.eye,o.uniforms.fadeInAvatarTime=n.fadeInAvatarTime;const a=new u1(s,o,10);return a.info={particleCount:10,velocity:[10],currentIndex:0},a},Hye=n=>{const t=new cc(1,1),r=new pr({uniforms:{cameraBillboardQuaternion:{value:new tt}},vertexShader:Fye,fragmentShader:Pye,depthWrite:!1,blending:Fu});return new hn(t,r)},Qye=n=>{const t=[],s=new f1(.645,.43,2.5,50,50,!0),o=m2(s,t,2),a=new pr({uniforms:{opacity:{value:0}},vertexShader:Lye,fragmentShader:Dye,transparent:!0,blending:Fu});a.uniforms.cameraDir=n.cameraDir,a.uniforms.eye=n.eye;const l=new u1(o,a,2);return l.fadeIn=!1,l.frustumCulled=!1,l.position.y=2.5*.46,l},B3=100,zye=0,cx=1.5,Gye=.1,Nw=0,S3=1,M3=.05,CT=0,Vye=1,jye=.015,Wi={normal:0,switchItem:1,fadeOutAvatar:2,loadingAvatar:3,fadeInAvatar:4},Wye=new Xu,mV=Wye.load("./textures/beam2.png");mV.wrapS=Qs;class Kye{constructor(e,t,r){this.scene=e,this.camera=t,this.globalUniforms=r,this.eye=new $,this.cameraDir=new $,this.beamMesh=null,this.initBeam(),this.pixelMesh=null,this.initPixel(),this.ringMesh=null,this.initRing(),this.teleportMesh=null,this.initTeleport(),this.spotLight=null,this.initSpotLight()}emitBeam(){this.beamMesh.visible=!0}emitPixel(){this.stopUpdatePixelMesh=!1;const e=this.pixelMesh.geometry.getAttribute("scales"),t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount,s=.25;for(let o=0;ol+e||i.getX(a)<=0)&&(r.setXYZ(o,0,l,0),t.setXY(o,1,.06),i.setX(o,1),this.ringMesh.info.velocity[o]=.1,this.ringMesh.info.currentIndex++,this.ringMesh.info.currentIndex>=s&&(this.ringMesh.info.currentIndex=0)),t.needsUpdate=!0,r.needsUpdate=!0,i.needsUpdate=!0}emitTeleport(){this.teleportMesh.visible=!0}emitSpotLight(){this.spotLight.visible=!0,this.spotLight.fadeIn=!0}removeSpotLight(){this.spotLight.fadeIn=!1}update(){this.beamMesh.visible&&this.beamMesh.update(),!this.stopUpdatePixelMesh&&this.pixelMesh.update(),this.ringMesh.visible&&this.ringMesh.update(),this.teleportMesh.visible&&this.teleportMesh.update(),this.spotLight.visible&&this.spotLight.update()}initBeam(){this.beamMesh=Nye(this.globalUniforms),this.beamMesh.material.uniforms.auraTexture.value=mV,this.beamMesh.update=()=>this.updateBeam(),this.scene.add(this.beamMesh)}initPixel(){this.pixelMesh=Oye(),this.pixelMesh.update=()=>this.updatePixel(),this.scene.add(this.pixelMesh)}initRing(){this.ringMesh=kye(this.globalUniforms),this.ringMesh.update=()=>this.updateRing(),this.scene.add(this.ringMesh)}initTeleport(){this.teleportMesh=Hye(this.globalUniforms),this.teleportMesh.update=()=>this.updateTeleport(),this.teleportMesh.visible=!1,this.scene.add(this.teleportMesh)}initSpotLight(){this.spotLight=Qye(this.globalUniforms),this.spotLight.update=()=>this.updateSpotLight(),this.spotLight.visible=!1,this.scene.add(this.spotLight)}updateBeam(){this.beamMesh&&this.globalUniforms.transitionEffectType.value!==Wi.switchItem&&(this.beamMesh.visible=!1)}updatePixel(){if(this.pixelMesh){let e=0;const t=this.pixelMesh.geometry.getAttribute("positions"),r=this.pixelMesh.geometry.getAttribute("opacity"),i=this.pixelMesh.info.particleCount;for(let s=0;s.01?(t.setY(s,t.getY(s)+this.pixelMesh.info.velocity[s]),r.setX(s,r.getX(s)/1.3)):(r.setX(s,0),e++);e>=i&&(this.stopUpdatePixelMesh=!0),t.needsUpdate=!0,r.needsUpdate=!0,this.pixelMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateRing(){if(this.ringMesh){const e=this.ringMesh.geometry.getAttribute("positions"),t=this.ringMesh.geometry.getAttribute("opacity"),r=this.ringMesh.info.particleCount;for(let i=0;i.01?(e.setY(i,e.getY(i)+this.ringMesh.info.velocity[i]),t.setX(i,t.getX(i)/1.27)):t.setX(i,0);e.needsUpdate=!0,t.needsUpdate=!0,this.globalUniforms.transitionEffectType.value!==Wi.fadeInAvatar&&(this.ringMesh.visible=!1)}}updateTeleport(){if(this.teleportMesh){if(this.globalUniforms.transitionEffectType.value===Wi.fadeOutAvatar){const e=this.globalUniforms.fadeOutAvatarTime.value,t=.2;if(e0?(this.teleportMesh.scale.x=this.teleportMesh.scale.x-.2,this.teleportMesh.scale.z=this.teleportMesh.scale.z-.2):this.teleportMesh.visible=!1}else this.teleportMesh.visible=!1;this.teleportMesh.material.uniforms.cameraBillboardQuaternion.value.copy(this.camera.quaternion)}}updateSpotLight(){this.spotLight&&(this.spotLight.fadeIn?this.spotLight.material.uniforms.opacity.value<1&&(this.spotLight.material.uniforms.opacity.value=1):this.spotLight.material.uniforms.opacity.value>0?this.spotLight.material.uniforms.opacity.value-=.025:(this.spotLight.material.uniforms.opacity.value=0,this.spotLight.visible=!1))}}const gV=new Xu,TT=gV.load("./textures/pixel9.png");TT.wrapS=TT.wrapT=Qs;const IT=gV.load("./textures/noise3.jpg");IT.wrapS=IT.wrapT=Qs;const Ot={switchItemDuration:{value:cx},switchItemTime:{value:cx},eye:{value:new $},cameraDir:{value:new $},fadeOutAvatarTime:{value:Nw},fadeInAvatarTime:{value:CT},transitionEffectType:{value:Wi.normal}},C3={pixelTexture:{value:TT},noiseTexture:{value:IT}};class Xye extends EventTarget{constructor(){super();jt(this,"setTransitionEffect",t=>{this.transitionEffectType=t});jt(this,"getTransitionEffect",t=>this.transitionEffectType===t);this.cameraDir=new $,this.frameRate=1e3/30,this.initParticle=!1,this.transitionEffectType=null,this.transitionTime=B3,this.update()}setCustomShader(t){t.vertexShader&&(t.vertexShader=t.vertexShader.replace("varying vec3 vViewPosition;",` varying vec3 vViewPosition; varying vec3 vWorldPosition; varying vec3 vSurfaceNormal; @@ -5415,13 +5419,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } gl_FragColor = vec4( col, diffuseColor.a ); - `),t.uniforms.pixelTexture=S3.pixelTexture,t.uniforms.noiseTexture=S3.noiseTexture,t.uniforms.cameraDir=Ot.cameraDir,t.uniforms.eye=Ot.eye,t.uniforms.switchItemTime=Ot.switchItemTime,t.uniforms.switchItemDuration=Ot.switchItemDuration,t.uniforms.transitionEffectType=Ot.transitionEffectType,t.uniforms.fadeInAvatarTime=Ot.fadeInAvatarTime)}playFadeOutEffect(){Ot.transitionEffectType.value=Vi.fadeOutAvatar,this.particleEffect.emitSpotLight(),this.particleEffect.emitPixel(),this.particleEffect.emitTeleport(),this.transitionTime=this.frameRate*((E3-Pw)/B3),this.initialFadeOutTimer()}playFadeInEffect(){Ot.transitionEffectType.value=Vi.fadeInAvatar,this.initialFadeInTimer()}playSwitchItemEffect(){Ot.switchItemTime.value=Lye,Ot.transitionEffectType.value=Vi.switchItem,this.transitionTime=b3}setParticle(t,r){this.particleEffect=new Hye(t,r,Ot)}initialFadeOutTimer(){Ot.fadeOutAvatarTime.value=Pw}initialFadeInTimer(){Ot.fadeInAvatarTime.value=BT}update(){setInterval(()=>{this.scene&&this.camera&&!this.initParticle&&(this.setParticle(this.scene,this.camera),this.initParticle=!0),this.initParticle&&this.particleEffect.update(),Ot.transitionEffectType.value===Vi.switchItem?Ot.switchItemTime.valueE3&&(Ot.fadeOutAvatarTime.value=Pw,Ot.transitionEffectType.value=Vi.loadingAvatar)):Ot.transitionEffectType.value===Vi.loadingAvatar||Ot.transitionEffectType.value===Vi.fadeInAvatar&&(Ot.fadeInAvatarTime.value>.1&&Ot.fadeInAvatarTime.value<.5&&(this.particleEffect.emitRing(.5*(1-Ot.fadeInAvatarTime.value)),this.particleEffect.emitRespawnPixel()),Ot.fadeInAvatarTime.value>=.5&&this.particleEffect.removeSpotLight(),Ot.fadeInAvatarTime.value+=Oye,Ot.fadeInAvatarTime.value>Nye&&(Ot.fadeInAvatarTime.value=BT,Ot.transitionEffectType.value=Vi.normal,this.setTransitionEffect("normal"),this.dispatchEvent(new Event("fadeinavatarend")))),this.camera&&(this.cameraDir.set(0,0,-1),this.cameraDir.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),Ot.cameraDir.value.copy(this.cameraDir),Ot.eye.value.copy(this.camera.position))},this.frameRate)}}const zye="_container_1fjfz_1",Gye="_messageWindow_1fjfz_11",Vye="_messageTitle_1fjfz_25",jye="_buttonContainer_1fjfz_36",Dy={container:zye,messageWindow:Gye,messageTitle:Vye,buttonContainer:jye};var mV={exports:{}};/*! + `),t.uniforms.pixelTexture=C3.pixelTexture,t.uniforms.noiseTexture=C3.noiseTexture,t.uniforms.cameraDir=Ot.cameraDir,t.uniforms.eye=Ot.eye,t.uniforms.switchItemTime=Ot.switchItemTime,t.uniforms.switchItemDuration=Ot.switchItemDuration,t.uniforms.transitionEffectType=Ot.transitionEffectType,t.uniforms.fadeInAvatarTime=Ot.fadeInAvatarTime)}playFadeOutEffect(){Ot.transitionEffectType.value=Wi.fadeOutAvatar,this.particleEffect.emitSpotLight(),this.particleEffect.emitPixel(),this.particleEffect.emitTeleport(),this.transitionTime=this.frameRate*((S3-Nw)/M3),this.initialFadeOutTimer()}playFadeInEffect(){Ot.transitionEffectType.value=Wi.fadeInAvatar,this.initialFadeInTimer()}playSwitchItemEffect(){Ot.switchItemTime.value=zye,Ot.transitionEffectType.value=Wi.switchItem,this.transitionTime=B3}setParticle(t,r){this.particleEffect=new Kye(t,r,Ot)}initialFadeOutTimer(){Ot.fadeOutAvatarTime.value=Nw}initialFadeInTimer(){Ot.fadeInAvatarTime.value=CT}update(){setInterval(()=>{this.scene&&this.camera&&!this.initParticle&&(this.setParticle(this.scene,this.camera),this.initParticle=!0),this.initParticle&&this.particleEffect.update(),Ot.transitionEffectType.value===Wi.switchItem?Ot.switchItemTime.valueS3&&(Ot.fadeOutAvatarTime.value=Nw,Ot.transitionEffectType.value=Wi.loadingAvatar)):Ot.transitionEffectType.value===Wi.loadingAvatar||Ot.transitionEffectType.value===Wi.fadeInAvatar&&(Ot.fadeInAvatarTime.value>.1&&Ot.fadeInAvatarTime.value<.5&&(this.particleEffect.emitRing(.5*(1-Ot.fadeInAvatarTime.value)),this.particleEffect.emitRespawnPixel()),Ot.fadeInAvatarTime.value>=.5&&this.particleEffect.removeSpotLight(),Ot.fadeInAvatarTime.value+=jye,Ot.fadeInAvatarTime.value>Vye&&(Ot.fadeInAvatarTime.value=CT,Ot.transitionEffectType.value=Wi.normal,this.setTransitionEffect("normal"),this.dispatchEvent(new Event("fadeinavatarend")))),this.camera&&(this.cameraDir.set(0,0,-1),this.cameraDir.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),Ot.cameraDir.value.copy(this.cameraDir),Ot.eye.value.copy(this.camera.position))},this.frameRate)}}const Yye="_container_1fjfz_1",$ye="_messageWindow_1fjfz_11",Zye="_messageTitle_1fjfz_25",qye="_buttonContainer_1fjfz_36",ky={container:Yye,messageWindow:$ye,messageTitle:Zye,buttonContainer:qye};var vV={exports:{}};/*! Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(n){(function(){var e={}.hasOwnProperty;function t(){for(var s="",o=0;ot.name===n);return await fetch(e.file).then(t=>t.text()).then(t=>new DOMParser().parseFromString(t,"image/svg+xml").firstElementChild)}function Un(n){const{size:e,icon:t,className:r,onClick:i,theme:s,type:o,text:a,onMouseEnter:l,active:c,onSubmit:A,minWidth:u,disabled:f}=n,h=xe.useRef(null);return xe.useEffect(()=>{t&&iwe(t).then(d=>{h.current&&(h.current.innerHTML="",d&&(d.classList.add($n.icon),h.current.append(d)))})},[t]),o&&o==="login"?Q.jsxs("div",{className:ld(r,$n.iconButtonWrap,s&&s==="dark"?$n.dark:$n.light,c&&$n.active),style:{height:e},onClick:i,onMouseEnter:l,children:[Q.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:$n.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[Q.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:$n.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),Q.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:$n.innerBackgroundColor})]}),Q.jsx("span",{ref:h,className:$n.iconWrap})]}):o&&o==="icon"?Q.jsxs("div",{className:ld(r,$n.iconButtonWrap,s&&s==="dark"?$n.dark:$n.light,c&&$n.active),style:{height:e},onClick:i,onMouseEnter:l,children:[Q.jsxs("svg",{className:$n.buttonBackground,width:"69",height:"63",viewBox:"0 0 69 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Q.jsx("path",{d:"M5 2H2.85562L3.00485 4.13918L6.7903 58.4048L6.9201 60.2656H8.78545H62.6772H64.6178L64.6763 58.3259L66.3135 4.06031L66.3756 2H64.3144H5Z",fill:"#efefef",className:$n.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),Q.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:$n.innerBackgroundColor})]}),Q.jsx("span",{ref:h,className:$n.iconWrap})]}):Q.jsx("button",{className:ld(r,$n.buttonWrap,s&&s==="dark"?$n.dark:$n.light),onClick:i,onMouseEnter:l,onSubmit:A,type:o,disabled:f,style:{minWidth:u?u+"px":""},children:Q.jsxs("div",{className:$n.innerWrap,style:{fontSize:e},children:[t&&Q.jsx("span",{ref:h,className:$n.buttonIconWrap,style:{height:e,width:e,opacity:f?"0.4":"1"}}),a&&a]})})}function swe(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?Q.jsx("div",{className:Dy.container,children:Q.jsxs("div",{className:Dy.messageWindow,children:[Q.jsx("div",{className:Dy.messageTitle,children:t}),Q.jsxs("div",{className:Dy.buttonContainer,children:[e&&Q.jsx(Un,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),Q.jsx(Un,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):Q.jsx("div",{})}const owe="_backgroundImg_1yy0g_1",awe="_darkBackground_1yy0g_16",lwe="_logo_1yy0g_29",Ny={backgroundImg:owe,darkBackground:awe,logo:lwe};function cwe(){const{debugMode:n}=q.useContext(pr);return Q.jsxs("div",{className:n?Ny.darkBackground:Ny.backgroundImg,children:[Q.jsx("div",{className:Ny.backgroundBlur}),Q.jsx("div",{className:Ny.Background})]})}const Awe="_buttonContainer_lqksm_1",uwe="_buttonLeft_lqksm_10",fwe="_buttonRight_lqksm_14",hwe="_buttonCenter_lqksm_18",dwe="_sideMenu_lqksm_33",pwe="_scrollContainer_lqksm_44",mwe="_scrollContainerOptions_lqksm_52",gwe="_bottomLine_lqksm_60",vwe="_editorButton_lqksm_94",ywe="_editorText_lqksm_102",wwe="_selectorContainerPos_lqksm_112",_we="_selectorButton_lqksm_137",xwe="_selectorColorPickerUI_lqksm_146",bwe="_selectorColorPickerButton_lqksm_152",Ewe="_selectorColorPickerImg_lqksm_165",Bwe="_uploadContainer_lqksm_171",Swe="_uploadButton_lqksm_184",Mwe="_relativeBox_lqksm_204",Cwe="_blendshapeGroup_lqksm_208",gn={buttonContainer:Awe,buttonLeft:uwe,buttonRight:fwe,buttonCenter:hwe,sideMenu:dwe,scrollContainer:pwe,scrollContainerOptions:mwe,bottomLine:gwe,"editor-container":"_editor-container_lqksm_87",editorButton:vwe,editorText:ywe,selectorContainerPos:wwe,"selector-container":"_selector-container_lqksm_123","selector-container-column":"_selector-container-column_lqksm_129",selectorButton:_we,selectorColorPickerUI:xwe,selectorColorPickerButton:bwe,selectorColorPickerImg:Ewe,uploadContainer:Bwe,uploadButton:Swe,relativeBox:Mwe,blendshapeGroup:Cwe},Twe="_dropArea_1a0z4_1",Iwe={dropArea:Twe};function E0({onFilesDrop:n}){const[e,t]=xe.useState(!1),[r,i]=q.useState(null);xe.useEffect(()=>{const o=l=>{l.preventDefault(),t(!1);const c=l.dataTransfer.files;n&&i(c)},a=l=>{l.preventDefault(),t(!0)};return window.addEventListener("drop",o),window.addEventListener("dragover",a),()=>{window.removeEventListener("drop",o),window.removeEventListener("dragover",a)}},[]),xe.useEffect(()=>{r&&n(r)},[r]);const s=()=>{t(!1)};return Q.jsx("div",{onDragLeave:s,className:Iwe.dropArea,style:{display:e?"flex":"none"}})}const Rwe="_mainTitleWrap_4fb0s_1",Uwe="_mainTitle_4fb0s_1",Fwe="_topLine_4fb0s_18",nS={mainTitleWrap:Rwe,mainTitle:Uwe,topLine:Fwe};function el({title:n,width:e,left:t,right:r}){const i={width:e?`${e}px`:null,left:t?`${t}px`:null,right:r?`${r}px`:null};return n&&Q.jsxs("div",{className:nS.mainTitleWrap,style:i,children:[Q.jsx("div",{className:nS.topLine}),Q.jsx("div",{className:nS.mainTitle,children:n})]})}const Pwe="_ContainerPositionTop_v15ql_2",Lwe="_ContainerPosition_v15ql_2",Dwe="_Container_v15ql_2",Nwe="_topLine_v15ql_68",Owe="_traitInfoTitle_v15ql_96",kwe="_flexSelect_v15ql_105",Hwe="_flexButtons_v15ql_114",Qwe="_flexButtonsTop_v15ql_122",zwe="_optionButtons_v15ql_131",Gwe="_optionButtonsSmall_v15ql_143",gr={ContainerPositionTop:Pwe,ContainerPosition:Lwe,Container:Dwe,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:Nwe,traitInfoTitle:Owe,flexSelect:kwe,flexButtons:Hwe,flexButtonsTop:Qwe,optionButtons:zwe,optionButtonsSmall:Gwe},Vwe="/assets/randomize-green-4388c12b.png",jwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjNiOTBlZjU3LTIwOWItYzQ0Zi05OWNjLTkwYjYxM2Q0MWJiOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjY1ZDdmMmJiLWMxYjctYjc0My1hYmIzLTFmM2VjNjMxYjE0NCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozYjkwZWY1Ny0yMDliLWM0NGYtOTljYy05MGI2MTNkNDFiYjgiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6bbHqfAAAFoklEQVR42u2duWtWQRTFo5hGRNAETKFiIQqCSxGto4iCqSLon6BoQJJCEcEFLASbD7QRRcTKNbihoLgUWhj/AItUCi7gVmjikubzPphAiOYts9659xQHAnl5M2/u73vnzHwvbzra7XaHNg1cPrKadJs0bnSHtEbjWGgr/HxSi9SeRWeLYwCAzOIPmk97u0ITpAMAQE7h+0ivaxR+psZIWwBAvoVfSXpsUfiZelZkBgAgx+dtJTIfaPV5W4nLB9p93lZi8oEEn39iWcRPpK2kzaSPlud4mns+0Ojzk6QTpM5p5+skHSP90ZYPtPn8DVJ3ybkXk65oygdafH6UtKlBW72klxrygfT5/BfSLoe2B0xWELt+oMbnHfoxj3RUaj6Q6vNdAfq0SGI+UOvzDn0UlQ/U+7z2fACfV54P4PPK8wF8Xnk+gM8rzwfweeX5AD6vPB/A55XnA/i88nwAn1eeD+DzyvMBfF55PoDPK88H8Hnl+aBup/aQflp26HrZc3hQaT64Zjnmv0h7nQEwT8u24PNJQdjokA9aVXfdqsaH4fNsQNhJ+mxRj2EXAO41bGw/ihUchH0Na3LXBYC7DRs7T1qOQgUr/lLSuZgA3LL0nkukhSiat8IvIF2wrMWtFABMJdHDpLkoolPxD5mxbOcGwJTekfpRzMaF305662H8kwMwpRekDShuZeHXkp57HHc2ACAfhPP5JAB8MB3+jXyQzOeLJfaLpPcpAPhmjlnmcMtSnQ8cfb6w1BXmPF9TAFB8N9Az7dhtpDfIB8F9vvjQ7Jh2rp6K72mCArDkP39z0GHaIjofOPr8lG3OmXHOJawAmHah57F+4G0+P+sHgyUAHm91/fD5cmtkDYDmfODT57MHQFM+COHzYgCQng9C+bwoACTmg9A+LxIACfkgls+LBiDHfBDb51UAkEs+SOHzagDgnA9S+rw6ADjlAw4+rxaAlPmAk8+rByB2PuDm8wAgUj7g6vMAIHA+4O7zACDc7fqk+a/lbJel1QPgIR9k/cUUAAj7SDX7r6YBgP98wM7nAUCa9YOo83kAwC8f5PIACgDwnA+yegQNADQfsGdlb9rK8HoAQMMBK3vryT0AIB+ARyXX9AgAyAfgYck1PQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlALQAwCSX0+y18V/L/a3BQDJr2cx6UcKAMZz3BRaIADdphZJNo16ldsG0ZIAoP721thY2gmAulvH3iB1AYCot/0rMbaObbJ59KR53UonAAjW907ScTPWUfYOHpK2fXyuADhsHz/kAkBBXMvy5QqjHPNBbgBQnzbW8PnZ1Kq6I9ftxJ6KuWaZrnOaLeQCQDHFJl1zeLPJ3jrtNOnQfIe7AZt8wB0A6sM80lHSH8uxPlPUqm57Nh1cSXps2bnk+YAzANT+AOmT5dg+Ja1q2qZLZ/tIry07m2z9gCMAjj4/Rtpi27aPzg9WrERVrR90awXAzOevWo7dBOmAax98XUg2+YADAGZ2dSyWzwcHIKd8kBoAM5+P6vPRAMghH6QCIKXPRweAcz6IDQAHn08GAMd8EAsATj6fFABu+SAGANx8ngUAXPJBSAC4+jwrADzlg5u2+SAEANx9niUAqfKBTwBy8Xm2AHjKB19Ju2MDkJPPswcgZj5wBSBHn88GgBj5wBaAnH0+OwBC5oOmAEjw+SwBCJUPmrwuXorPZw2Ax3yw3pxnpOS4EXPMOkk+LwKAGflgwrI4p0kPSn5/n3RKms+LAsBDPggh1j4vDgBP+cCHsvB5sQB4ygfifV48AJ7WD8T6vBoAAueDbH1eFQAB8kH2Pq8SAA/5QIzPqwbAIh+I83kAUD8fiPR5APAvCKtJt80dYdz8vEbjWPwFnWtJD/nY2zYAAAAASUVORK5CYII=",Wwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmM2NDY5Y2JiLWFkMzUtYmQ0Ny04M2Q1LWU0NGQ0MTI2YmYwNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjIyNTIzNmU1LWZhMWItZTM0NS04ZDM2LTE5YmQyYTRiZjM1MSIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpjNjQ2OWNiYi1hZDM1LWJkNDctODNkNS1lNDRkNDEyNmJmMDYiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6qPgTwAAAEeUlEQVR42u2dX4tNURiH58KfwR1K0USSj6BoIpdydcY0TUMmIy58BPdK/uTCLReaG7kwooQoH4FQyneQMNw53t2cqdOJPfusvfZa77ve5+JX1DlnOns9PM+cqT0T/X5/wtt6D64ekj2W/ZKtDv582OO18Hbwk7I7sv5/dle2DQDKPPzLsp81h7++6n+EKwBQzsGfkH1ucPCj+yI7CQB2D/6A7GXAwY/utewgAJTj+dAV2QdePR+64vrAu+dDV0wf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5532A5533AZ533gd43nkf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5530wzsHvkr3hQqvfW9nuLgDYKXvGBVa/F50AMATCHtkKF1rdqn+ce1NG4BHZOy589n2QHc35beBZ2VcOIvm+yRa1fBC0SXZN9oeDSbLrss0aPwqmDxR6PggA+ULnZRfpA9uel+ddkJ0LAWB56AOG/fSBLc/L86ZkrwavsxwCwOgPd6q/T9IHuj0vz9kquzl6djEAqPZDdok+0Ol5ed6S7Ps/XjMaAOurfgh0nD5Q4/lp2aea144OwPDHjvRBXs8/b/A1OgOAPtDj+awA0Af5PZ8dAPogr+fVAEAf5PG8OgDog7SeVwuA1z5I7XnVAHjqg1yeNwFAyX2Q2/OmACitDzR43iQA1vtAk+fNAmCxDzR63jwAFvpAs+eLAUBrH2j3fHEAaOkDK54vEoCcfWDN80UDkLIPrHreBQBd94Flz7sCIEYfPCnM8+4AiNEHZ2RzhXjeLQCt+6AQz7sHoFUfFOB5AIjRB4Y9DwAx+8Cg5wEgVh8Y9TwANNjt6rOADT4nuFHg+waAoc3WvOfZQt8zAAxtruY9zwFA+QDM1LznGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANsA3AeAYnYvBIBTsvcAYH4fZaeDf328PHmxt3bzRACwteqWNkvBvz5+5MJs6a3dRBEAbOxWdVOrJmc77j1z9smeAoDaVbe1mRrnTENvnnSst3YzZQDQsepGVtMhZ9n29mkW+6AkABp5vjMAjPZBKQA09nynABjsA+sAjO35JAAY6gOrAAR7PikABvrAGgCtPZ8FAMV9YAmAKJ7PBoDSPrAAQFTPZwdAWR9oBqATz6sBQEkfaASgU8+rAyBzH2gDoHPPqwQgYx9oASCZ51UDkKEPcgOQ3PMmAEjYB7kAyOZ5UwAk6IMcAGT1vDkAOu6DlACo8LxZADrqgxQAqPK8eQAi90GXAKj0fDEAROqDrgBQ6/miAIjQB7EBUO/5IgFo0QexADDj+aIBCOiDtgCY87wLAMbogzYAmPS8GwAa9kEIAKY97w6ADfpgHACK8LxbAEb6YHVwqPM1j5sfPOZ3SZ53D8DgcLfLHsoWah6zIHsk2+HluvwF92zupxEV3NQAAAAASUVORK5CYII=",Kwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmY3YWFkYzZiLWM2ZmEtNjE0OC05YWZkLTgxN2Q1OWRkZTI0MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjc2NTFhZmQyLWU5YTctOTc0Zi1hZWFkLTdiMWMyODQ2YWEzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmN2FhZGM2Yi1jNmZhLTYxNDgtOWFmZC04MTdkNTlkZGUyNDIiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6TWt7cAAAFm0lEQVR42u2dT2xURQCHSTXpQTH0oIJpgfZKi1ETiSK1MV7FbORQNcG0Hmg3oQVjjKARrhDBBDEYMSEYS6kWkxoVAheDiBc9kHBBuaGgMSo1KgTF+pt0JLq6dOe93X3z5zt8SbPdvtmZ37fvvc7Mm5k3MzMzD9KFRkAAGgEBAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABPKO0f3OrWCxWiTViROwQ+8QBcchywL62w77HvLdPdJpjIEAYYd8sHhDPiD3iuLggfhczGblqj/GJ2Cs2il5xCwL4EfoK8bw4LH7MEbQrF8UR8aK4T7QgQPNC77On6jNNDHwuzopXzGdDgMaEvlRsEqc8Cr0ap+2ZoRMB8gdvrulviT8CCP7/7h/GxIMI4B78Q+KjAEOvhrlHeRgB5g7e3FB9GFHwlZi6rUSA/wZ/m3g94uAreVMsRIDZ8J8S3yUU/t98L55OVgDby3Y4weArMf0JXUkJoAo/Ln4i/GtMiyeTEEAV3U3gVXktWgFUuXbxKSHPyWeiIyoBVKG7xXnCrRnTVvdEIYAqsjrniFwjGteciabEuGXKvnbes57ER4MWQBVY60FD/ioOiiHRfb3xfTt/oNu+1/zNLx58/rVBCqAPPlxww52x4/e356jDrfYYXxZcl+GgBCg4/Gk7KaSljvVpsSJcLLBe5SAEMB+04L72JQ08qy0ueKyi7LUABYe/pYn/0r4UiwSxhD9UQIfWuhgkiOGav67A8YzgJeC0n7/+W0KWIOTwj3o0keVoqBKEGv5vYoFHAiwQl0KUIMTwDSM5wuoQg3Ya90HLTvtaR47jjhbcJuWmCOBB+OcyBrTcPgJ25TrHvmKFuDNjGedCkyC08DN9+20vnms5GwM8CzhLEFr45jo73zGUbTnK2+5Y1nxxOSQJQgrf8G4B38gRxzInPWmrcl0E8Ch8w4BDEF11LLfLodwBj9qrnEsAz8I3LHMI4r06ljvpUO4yz9qsnEkA/WG/ZxX5VtxQYwh3NKD8RTWWfaOHzzn0OwmgP2izU5J8qsQJh2/hYMGXnxMePqja5iLAdg8nSk45BPBqA8rf5VD+lIftt81FgC88rMC4QwDvNKD8CYfyxz1sv88RAAG4BHAJSOMmcICbwBw3gRH8G7ioAeUvTObfwEg6giYL6gjqjqIjiK7gzF3Bg6VYuoIjGAwaYTAoruHgywwHFzAc7JkEoxkmamwQfzIhJI4pYd9knK7VU+OUMNOJszxjGV9HPSXMIwlGc0zebLf9BDsrJoWa19pzHHdDEpNCPZHgUrWOjYKmhbclNS3cEwmOeSTAseQeDPFEgq08GsbDoUMFhj+U/MOhnpwJhgmfBSK2ctpniRizx8DSBga/hCVi/JfgZ/FsrUPHjotETbNIVDjLxH1lVwtjmTgWitw8YYXsqWGhyB773gkWiqyPBI/M0f/ebC7YZWHf/0dXsPn5pP2dL5/TLK+7OpbFou8ygzgsAl37gJdpM5aLT5OTeQalQtgwYhchV2V3KlvG9LNlzL8waxA/kdqmUWY7WDaNmm2DtDaNYtu4a9vGDbJxZJobR75RYuPIqlvHfhBx8GYc4X62jk1v82hTFzaPzrh9/H7PNp2qFbPl/duil+3j6zMMu0mcCiD40+IF0RlC2wYhQIUMveJluymUL6GftWsP94XWnsEJUCHDveI5e439oYmBm06sI/abvqKeG1QhQHYZbhIr7fj9HvFxaXYjyDz3D1ftMY6LvfbYq1yfT0SA4qRotcvDm5vJNfZpYXP52CfGxCHLmH3N/G69eMyczkuzW9y3xtxGUQsACAAIAAgACAAIAAgACAAIAAgACAAIAAiAADQCAgACAAIAAgACAAIAAgACAAIAAgACAAIAAkCc/AWkhfX2hx9ZaQAAAABJRU5ErkJggg==",Xwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAATr2AAE69gE6sVc6AAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PslPja4AAAbiSURBVHja7Z17iFVFHMc1K80ybc3SP9K21YrubtLDiIJqK5WMpbYt1MpSKiKkba0gtU0rCCpoyxRXSKrNiJIwCmtD0u2JEWFuSC/t2sueghDU2svbd2D+uFzce89rzvxm5vvHB2TX5Zw758PMufN7zJBSqTSEhAsHgQJwECgAoQCEAhAKQCgAoQCEAhAKQCgAoQCEAhAKQCgAoQDVaO1ZOgWsB7+CAbALLAPDOdCeC4CH3AJKg/AlGM/B9lQAPNxG8HcVARS7wQQOuJ8CPFvj4VMCXwXAAx0BfowoACXwUIA68EcMASiBh0vApzEFoASeCdCZQABK4JEAw0A/JQh7H2A8KFKCsHcCxUugX1qnghlgLrgBzNP/bgXTwTRwAjiEAsQf4AkpJChmJYF+0M1gIegGm8Dn4M+I9/If+B68B3rAneBiMIoCCJwJ8DejwZVgBfgQ7E94/Vqor7ybwVJwOgWwKAH+z3HgJrDR4AOvxU7wIDiFAuQoAX7XZumBV0MtF20UID8JnhMoQUlvjXeAw5kQYl6CVUIlUOwD7WBo8BlBhiVYK1gCxU/giuBTwgxL8IJwCRTvg/qgcwINS/CKAxIolgSdFGpYgjcdkeATMDHYrGDDErzriASK+cGmhZuSAD8/DHzskARrg60LMCjBkQkTVWwuCccGWRhiUIIx4DOHJNgLCkFWBhmUYJzer3dFAhWFnOXjRtAosA6cb0ECFaL+xiEJFAt8E6BXf7Cfq22GGJRgIvjBMQlu9yUWsOUgW6M2JGgAvzgmQYfr0cA3quyPm5KgWEWCaXpLVhWtXqVp11k/6uffCpRgoav5AC9GCJvWS0svw99NVhs0OtHkgBAJ5rmWEbQiRqSs3saOYcTPcTzoAv8KkGCGKzmBnQnCpbkvBwlE2GRZAJXQ2ig9K3hOipi52Jmg7D7aLUvwXdbp81k+/DPAPykTJ1yQYKbld4MPJFYGHZPi4bgowaWWZ4I10gTYmHEKlQsS3GxZgtukFIfeayiPzgUJnrYswVm2G0Q0G06mFC2BCuHq7W1bAmxPW8OYNsBjOtJmUoKvwaQMJOiwPAussiVAXoUZJiVQJWW/gR3gSdXrMME4jIzZJ8kEl+UqgC7EzDu33pQElSxPMB6PWRZANeU8KhcBdJKFDeNNxg4q6Yk5JhcJ2CpemZcA6yxX2YibCVQdoIBlQHGhUQHUWiOk+PLEnCRoTJD0YpM+0wJIybS9xmCnknK6YozNGiFjM8eIAAJ2vsqjYlEaSGQxE2yLMT4PCBmfreBkEwK8JuQDfhTjnpsySNUeGfFaiwVlEd1hQoBXhXy4vpjf0femvF6TYzOAMQGkLAHbY763bEt5vWLEJadb0BIwxeeXQJXZOyLGPT+ewTVrSqDi9EIEmO3718DI07K+50JG16xVlfywgHHpzWMj6CkBH/SWmPe8PCcJHrU4JurUltPyEODoDDdakvJ8gvvuyejaRaES3JVnMMj2UvA7GJvgvu/zdCbYYiMc/IRlCRYlvO8GHfrdoY+42+/4TPBXkqk/q4wgm504dsf5NlDlM0zS4VQTM8Ej0nMD0w5ewWKf3kSxews9i0xK8LKEpND5lpeCMx2QwMRyoFLaxkhJC++yKIBay48IcCY4T1pl0GaLErzuSAu7rGaCzJpHZCnAOD0AtiTYEIgEqyUXhxYSHCSZaahYlal5LME7LpSHTxewSdTioQS7TPQSNNUgYoGAeMFbWdTTm+xPEEMCVbvQ4FqLmEVCIodv62PhRjs6E6iS+7NdbRJ1j6AsmQEtw0r1Fg2uBVdrHtJNoqYKlKDZ9TZxSxxqy2atIHWQfYLLfWkUeTcliC3BTN+OjLmVEkSSQEUqr/f1yJgWQb33vGhS4eKRMY36aw0lECCBrfbwdQ6d6uG1BLbPCeimBHYlkHBYxNyU/QUpgScnhmylBPlLIOoUS71Dd4ASBCpAWW1/LyUIVICyQbxE+IFPXkgg/nx7DMSNQvrveCmBeAEqRJA4I+wD57oqgTMCVHTqlvaO0GcrnyA4ASpeFhdn0AAiKTt1HF8dRHWozaSSIAWoGNyTdM/eDQbjDOq0jvX61JCmFPsdoiTwQoCDNG08R7e0Wa1zA7/SGUFRBnqP3pRSp57dD9rAqWBohjOX1TOQvBagysCP1V3DLgCz9IOdDa4DrarSRjWgBMNcPSuZArglpAgJ+DDclaA/i9mKD8JtCTopQNgS9FOAsCVQdZh1FCBcCfakbZPDgXdbgme4BIQrgWoMWaAA/kqgTiz/oooALdwH8F+C4WCZDjwN6L6GL4HJ3AkkFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIByGD8DzQJyO8fOgE8AAAAAElFTkSuQmCC",Ywe="/assets/play-de4238c5.png",$we="/assets/reverse-e35421b8.png",Zwe="/assets/pause-b6381fd4.png",qwe="/assets/fast-forward-0d3ffae5.png",Jwe="/assets/fast-backward-1f713448.png";function I1({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=xe.useContext(pr),[a,l]=xe.useState(s.userActivated),[c,A]=q.useState((o==null?void 0:o.getCurrentAnimationName())||"");xe.useEffect(()=>{n==null&&(n="T-Pose"),n!=""&&A(n)},[n]);const u=()=>{r()},f=p=>{p?o.play():o.pause(),o.setSpeed(1)},h=p=>{o.play(),o.setSpeed(p)},d=()=>{s.setActive(!a),o.enableMouseLook(!a),l(!a)},m=async()=>{console.log("play next"),await o.loadNextAnimation(),A(o.getCurrentAnimationName())},g=async()=>{console.log("play prev"),await o.loadPreviousAnimation(),A(o.getCurrentAnimationName())};return Q.jsxs("div",{className:gr.Container,children:[Q.jsx("div",{className:gr.ContainerPositionTop,children:Q.jsxs("div",{className:gr.flexButtonsTop,children:[Q.jsx("div",{className:`${gr.optionButtonsSmall}`,onClick:()=>{h(-2)},children:Q.jsx("img",{src:Jwe})}),Q.jsx("div",{className:`${gr.optionButtonsSmall}`,onClick:()=>{h(-1)},children:Q.jsx("img",{src:$we})}),Q.jsx("div",{className:`${gr.optionButtonsSmall}`,onClick:()=>{f(!1)},children:Q.jsx("img",{src:Zwe})}),Q.jsx("div",{className:`${gr.optionButtonsSmall}`,onClick:()=>{f(!0)},children:Q.jsx("img",{src:Ywe})}),Q.jsx("div",{className:`${gr.optionButtonsSmall}`,onClick:()=>{h(2)},children:Q.jsx("img",{src:qwe})})]})}),Q.jsxs("div",{className:gr.ContainerPosition,children:[Q.jsx("div",{className:gr.topLine}),Q.jsxs("div",{className:gr.flexSelect,children:[Q.jsx("div",{className:`${gr["arrow-button"]} ${gr["left-button"]}`,onClick:g}),Q.jsx("div",{className:gr.traitInfoTitle,style:{marginBottom:"10px"},children:c}),Q.jsx("div",{className:`${gr["arrow-button"]} ${gr["right-button"]}`,onClick:m})]}),Q.jsxs("div",{className:gr.flexButtons,children:[e&&Q.jsx("div",{className:`${gr.optionButtons}`,onClick:e,children:Q.jsx("img",{src:Vwe})}),Q.jsx("div",{className:`${gr.optionButtons}`,onClick:d,children:Q.jsx("img",{src:a?Xwe:Kwe})}),Q.jsx("div",{className:`${gr.optionButtons}`,onClick:u,children:Q.jsx("img",{src:i?Wwe:jwe})})]})]})]})}const e_e="_tokenBoxWrap_q4pvo_1",t_e="_mask_q4pvo_7",n_e="_timer_q4pvo_31",r_e="_level_q4pvo_42",i_e="_mythic_q4pvo_55",s_e="_epic_q4pvo_60",o_e="_rare_q4pvo_65",a_e="_uncommon_q4pvo_70",l_e="_common_q4pvo_75",c_e="_none_q4pvo_80",A_e="_value_q4pvo_85",u_e="_frame_q4pvo_95",f_e="_emptyIcon_q4pvo_111",h_e="_badge_q4pvo_123",d_e="_frameActive_q4pvo_131",Tc={tokenBoxWrap:e_e,mask:t_e,timer:n_e,level:r_e,mythic:i_e,epic:s_e,rare:o_e,uncommon:a_e,common:l_e,none:c_e,value:A_e,frame:u_e,emptyIcon:f_e,badge:h_e,frameActive:d_e,default:"_default_q4pvo_159"},p_e="/assets/magic-box-cd45f027.png",kl=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,c]=q.useState(!1),A=()=>{c(!0)};return Q.jsxs("div",{className:Tc.tokenBoxWrap,style:{width:e,height:e},onClick:r,children:[t&&Q.jsx("div",{className:ld(Tc.frame,Tc.frameActive)}),Q.jsx("div",{className:ld(Tc.frame,o&&Tc[o])}),Q.jsx("img",{src:l?p_e:s,className:Tc.emptyIcon,style:a,onError:A}),i&&Q.jsxs("div",{className:ld(Tc.level,o&&Tc[o]),children:["Lv.",i]})]})},m_e="_InformationContainerPos_72ckd_2",g_e="_scrollContainer_72ckd_15",v_e="_traitInfoTitle_72ckd_27",y_e="_traitInfoText_72ckd_35",w_e="_flexSelect_72ckd_62",__e="_checked_72ckd_119",x_e="_checkmark_72ckd_123",b_e="_checkboxHolder_72ckd_136",va={InformationContainerPos:m_e,scrollContainer:g_e,traitInfoTitle:v_e,traitInfoText:y_e,"input-box":"_input-box_72ckd_43",flexSelect:w_e,"arrow-button":"_arrow-button_72ckd_70","left-button":"_left-button_72ckd_86","right-button":"_right-button_72ckd_93","anim-button":"_anim-button_72ckd_100","custom-checkbox":"_custom-checkbox_72ckd_105","checkbox-container":"_checkbox-container_72ckd_110",checked:__e,checkmark:x_e,checkboxHolder:b_e};function p2({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=q.useContext(cs),{characterManager:i}=xe.useContext(pr),[s,o]=xe.useState(0),[a,l]=q.useState({}),[c,A]=q.useState([]),u=m=>{i.setManifest(m),i.loadInitialTraits().then(()=>{r(!1)})};xe.useEffect(()=>{t==!1&&(l(i.getAvatarSelection()),A(Object.keys(i.getAvatarSelection())))},[t]);const f=m=>{i.loadTraitsFromNFTObject(m).then(()=>{r(!1)})},h=async()=>{if(!t)if(r(!0),s>=n.length-1)e?u(n[0]):f(n[0]),o(0);else{const m=s+1;e?u(n[m]):f(n[m]),o(m)}},d=async()=>{if(!t)if(r(!0),s<=0)e?u(n[n.length-1]):f(n[n.length-1]),o(n.length-1);else{const m=s-1;e?u(n[m]):f(n[m]),o(m)}};return(n==null?void 0:n.length)>0?Q.jsxs("div",{className:va.InformationContainerPos,children:[Q.jsx(el,{title:"Trait Selection",width:180,right:20}),Q.jsxs("div",{className:va.scrollContainer,children:[Q.jsxs("div",{className:va.flexSelect,children:[(n==null?void 0:n.length)>1?Q.jsx("div",{className:`${va["arrow-button"]} ${va["left-button"]}`,onClick:d}):Q.jsx(Q.Fragment,{}),(n[s].name||n[s].manifestName)&&Q.jsx("div",{style:{textAlign:"center",flex:1},children:Q.jsx("div",{className:va.traitInfoTitle,children:e?n[s].manifestName:n[s].name})}),(n==null?void 0:n.length)>1?Q.jsx("div",{className:`${va["arrow-button"]} ${va["right-button"]}`,onClick:h}):Q.jsx(Q.Fragment,{})]}),(n[s].thumb||n[s].thumbnail)&&Q.jsx("img",{src:n[s].thumb||n[s].thumbnail,alt:"Selection Thumbnail",style:{width:"280px",height:"460px",display:"block",margin:"20px auto 20px"}}),n[s].attributes&&n[s].attributes.map(m=>Q.jsx("div",{children:Q.jsx("div",{className:va.traitInfoText,children:`${m.trait_type} : ${m.value}`})},`json:${m.trait_type}_${m.value}`)),e&&c.map(m=>Q.jsx("div",{children:Q.jsx("div",{className:va.traitInfoText,children:`${m} : ${a[m].id}`})},`val:${m}`))]})]}):Q.jsx(Q.Fragment,{})}const CT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAXASURBVHgB7ZzNchNHEMd7ZiWf5WtSCSIfVa5cLN+MTRXrEFPcWJwHwNxys/0Etm+5YZ4Ac0pOIG4EU2WlCgffIm4+pIhS8ADKEQlt07OSKKGdlVdSz64K9++kmhlpR3+Pe3qmuwUgCIIgCIIgCIIgCIIgCIIgCIIgXHAUzCDLflDWRfCVgkVA5aOCkgqhRLMt9cdQW0MhNEBhHRFehW2ondaqDZgxZkZg3w9KrTm9RdJtknBlmAwjeLXTgvuzInbuAi//FPieUrv00gdW1GGnHe7nLXRuAkdmoKDvKYUBOCVfoT3IgSvrP295Gn4nG1sB91S0p4Kvvl34/83rszpkTOYrePXGxj1A3E41GKGGCl/Rq7oXQpM2tma/q0PC0R+orFAt0rfwU32eUgcnzx7tQIZkJrDZxNpFdUwvR6/arqgP59pQrdWqTUj52a0iBCT2nRRi14ttXEv72dOSicCpxCVhFeD+i+fVGkzB8s2g7HVgj77anRHDMhO5ABkwUlzjz4Z4d1ph+5w+jTazzZX1oEYmYTfB5av05rQEjtHgmMjmJoiLqKrFFi5xiTtEPTqcJFPpzc0pTk0EraJNBeqBrU9hZA72wAH03ArZ4+PBk18Socadl39UD8ARzgTuHnfVMT2gPNw3K+L2aHbauOTKT3ZmIrwi7NrENWYhR3Ftm1pJz2lnpsKJwGb10jrdjHXQhhYWQid+6Hnimv8a8hwum0siS19wlY7s4AAnApvVC9aH4U5vl2cljbjmv8a4ZZo8FtsY7N6HsMNug83q9YrqX8ujDk+OHt0FZtKKO9i2un7buGj+8Fha4fPcvjH7CtYeWI/BHS/cB2YmEbffbhvfKkC6I/wY8JsIrW7F2uiUxm0aJhXX0PO7a7H3qJGnv4lgFdiYB6vnQHcLwMg04n6cE1jnVF75ceMSMMIqsAnz2NrNxQ0wwSHu6DmFa8AIr4kILUdiMg9cGweXuIbenGqxDo/3jppVYKXpbnaI3n3u1HCK+3FuYXxuZIevASOsApNdK8faMO7Yj4sLcSM0xCMcmPqInfIRjNDFTnm4jWJSU4VpnIlr5hbaj87AiPPrymlwKa6hrS6wwK7FzQpegTG+Ijp6/BXxuYhr4N3kFMYEVu/HEzhLcZU90tIARrg3ubhNG8OvzHrlWuN1OMMCk1/553Abib6Y5r15mAWXfnsfXhusrS6Zb8L2o96Wh7i9OfmWrqncymFYBQ49y9GTaGkIkt6T14ZmElVs7UnfYVJYBTZXknSaawy3K89+DZint6BsiSkUTuK+VuX3gxFs14D+cMwrT3G7McO4eUDEJ8AMu8Bz7+HA1j4Y88rbz02KGZJ5YM+PcJIXkRTzIuHWQjqe5inuletBoLV6HO9xEzN0clROinnRKn6Qp7hRxEUraw6Ei5ihwYnAJuZlEkwsXeU8j79RRj3YkgHVoYt0guiZ4IgowQQhVSQjC3FXbmzsWssVyHNwtXoNzkoI3v5z1vz6m4V3FCK4OWpcZuIi7tn6yK3cefnMSXZnhNMajTevz04vXV6YJ5GXrQPM6mnDztvGGUvMbhhzWvviux9+U4C/gPXxeP/kqPorOCSTDHfyKv6G5Ox2czjZ/+uoegiMmPIwbTZVSKy5q58cPXaegJ1JhrtJ1x+R5V42OcSr6xvXOMqtUtbdRSUEkAGzVwRDoXSTFDJREUz3+OufM/zzK4IZ5Or14AC12ko5vGZqkcMQ/sOBWy5FURK6yy31apkrtFNV0iRcG5v74qi6DRmSS6WnKS0YUaDigiZdNOyfPHdXKpBELpWepuLyy+8XnmiEefobp454TII58IQFvE2u2FPIgfyLwdPVtY0PU93dtMzMzxkYoXUHtsl03JrUdJCdbmjEhwW60ctqEzuP2fxBjq7YPph6ZFSLaGqSP/VnmyQm3cqZ+uUoDlif1R/kEARBEARBEARBEARBEARBEARBEC48HwDC3eeu0ZVWOQAAAABJRU5ErkJggg==",E_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0wMlQxMTo0OTozNy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjBiNWViMTliLTkxMmEtMmI0NS1iOTZlLTliNDUxOGUzZDU4NyIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjg4ODliZDlkLTAxZjItMTQ0Ni04NDE4LWYyYzNjNjQ1ODNlOCI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ODg4OWJkOWQtMDFmMi0xNDQ2LTg0MTgtZjJjM2M2NDU4M2U4IiBzdEV2dDp3aGVuPSIyMDI0LTAxLTAyVDExOjQ5OjM3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0wMlQxMTo1MjoyMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv0y+4AAAASPSURBVHja7ZxrSBVBFMctyqIgC0ujJ5UFaQpZRC/7YoUVQYUUkZQYQoVfJBF62PtBlhlJoJWSUQRSEYUFUVRiSEWRiokVgZqRWUEv7W3/oQkul53Ze+/OXWfyfPh98e6cPfNjnZ2ZPbshnZ2dIUTwIAkkmAQTJJgEk2CCBJNgEkyQYBKsgFnzlsaCanARZICFIJwEqxN8CXR68R08479lgxVgDAkOTPATC8EiXoLbYB9YDeJJsFzucPDLD8FWvABlIBcsAeNBKAn+K3i+Q7ki3oNycAys4eP8gO4oeH2QBFvxFVSAYj6uR3cHwWdcFGzFG1AF8sBakOBkeNFR8AMbAY/BedDqovQPoA6UgghjBbMxkXfGqpMfwUyv4w90wRV+1GTBCyQdmy5oc8hlwQdMFrxF0KlzkjbDwA8XBSebLPikv1cNfusBml0UHGWy4BpBp0olbYaAjgBlselZHBgNloNGm+PbQF8jBfsgKlrQbnuActMtYoWCBkmb68ZO09hNzEbIUzDCq82GAOXekuSRJGl3xGTBmT6IYXsU10Ahn5cGOo5ukeQxCLQL2q0zWXCBizeq7TZD1XdBu1iTBVe4KPieJI9kQZtPYKCRgpF4P/DW5QVDnkUeUVyk1fH3jd2L4Pu1KqSxMfohH6cbfbmS+eqRTdX22ixYck0WnKZAbguY5BV3o8IrPsVkwWUKBMQIYmcpEjzdZMF3eCfaA4C1OxGkld4/WgPdE9ZBLttLGMwJD4AI0F8SvycfPpwIvkuFJ2LBQyXzWl8pck0wmwuCcWCUZrCcwizy3aZg/E13RTBONMXjpL81g+W0wyvf/YpucHPdEpzbxQ8k7djlkesmRTHbnZRt+Ss4T3PBOz1y3aooZq1rj+1xsoMGCd6sKOYFEhxcwRm6Cf4JvmksuIUXlrz2MeZknQTv5k95e4HZvCM6CU73c5O/w2ldskrBqTbL4K4WnCbIL0MS75GrtWkSwZWSNgkaCK63Wao3CeKd0kVwgaRNmGQT2y3BZ236VS6Il6OL4OOSNpEK9gKcCq6y6VetIF6iLoKbRdt5vNhZhzE4UZDfYkm8kboIZpy2OH4C+KyJYFZsPdUrvzmSWM9dL8D2YZpWw4tBlrEyTz4n1mmaxvK5DvLBTY9NIitKdBT8P63k1pPg4ApOMllwBX+9agZYKamqdCI4x0Ec9vg+0lTBhYLYVxQLznYQp65L3jJSILhN9G4a/j5RseAefBW5gy00/PwvuWSq4GKb+PWqBAviR/Ay2UxeTV8pqObJMlVwiU38hmAKlizl4/iCqIjXIS8yeYgIE8SOUTlEGPkyuKKb3FlB7FskWN00jX1sIxVM4/uxTaqnad1dcNAXGiSYBGsjuJoXvJTy95VJsEJWeZ2/N7hBghWXQXnl0Ae8IsHOGSfJ4zAJdv59HVlR9SYS7JxESR4XSbBzLgtyiKebnDqugrEe248pkveISbAD3oEvtNCglRwJ1l1wvuaC95gueJ/mgnNMFxzFH6m84V841YVW/nZ9DH0/mD4xTpBgEkyQYBJMggkSTIJJMEGCteYPxO/zzCRZDV4AAAAASUVORK5CYII=",B_e="/assets/color-palette-71a7a2d4.png";var oo={},B0={},S_e=typeof Pa=="object"&&Pa&&Pa.Object===Object&&Pa,vV=S_e,M_e=vV,C_e=typeof self=="object"&&self&&self.Object===Object&&self,T_e=M_e||C_e||Function("return this")(),al=T_e,I_e=al,R_e=I_e.Symbol,S0=R_e,M3=S0,yV=Object.prototype,U_e=yV.hasOwnProperty,F_e=yV.toString,am=M3?M3.toStringTag:void 0;function P_e(n){var e=U_e.call(n,am),t=n[am];try{n[am]=void 0;var r=!0}catch{}var i=F_e.call(n);return r&&(e?n[am]=t:delete n[am]),i}var L_e=P_e,D_e=Object.prototype,N_e=D_e.toString;function O_e(n){return N_e.call(n)}var k_e=O_e,C3=S0,H_e=L_e,Q_e=k_e,z_e="[object Null]",G_e="[object Undefined]",T3=C3?C3.toStringTag:void 0;function V_e(n){return n==null?n===void 0?G_e:z_e:T3&&T3 in Object(n)?H_e(n):Q_e(n)}var Wu=V_e,j_e=Array.isArray,la=j_e;function W_e(n){return n!=null&&typeof n=="object"}var cc=W_e,K_e=Wu,X_e=la,Y_e=cc,$_e="[object String]";function Z_e(n){return typeof n=="string"||!X_e(n)&&Y_e(n)&&K_e(n)==$_e}var q_e=Z_e;function J_e(n){return function(e,t,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[n?a:++i];if(t(s[l],l,s)===!1)break}return e}}var exe=J_e,txe=exe,nxe=txe(),rxe=nxe;function ixe(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=wxe}var g2=_xe,xxe=Wu,bxe=g2,Exe=cc,Bxe="[object Arguments]",Sxe="[object Array]",Mxe="[object Boolean]",Cxe="[object Date]",Txe="[object Error]",Ixe="[object Function]",Rxe="[object Map]",Uxe="[object Number]",Fxe="[object Object]",Pxe="[object RegExp]",Lxe="[object Set]",Dxe="[object String]",Nxe="[object WeakMap]",Oxe="[object ArrayBuffer]",kxe="[object DataView]",Hxe="[object Float32Array]",Qxe="[object Float64Array]",zxe="[object Int8Array]",Gxe="[object Int16Array]",Vxe="[object Int32Array]",jxe="[object Uint8Array]",Wxe="[object Uint8ClampedArray]",Kxe="[object Uint16Array]",Xxe="[object Uint32Array]",Mn={};Mn[Hxe]=Mn[Qxe]=Mn[zxe]=Mn[Gxe]=Mn[Vxe]=Mn[jxe]=Mn[Wxe]=Mn[Kxe]=Mn[Xxe]=!0;Mn[Bxe]=Mn[Sxe]=Mn[Oxe]=Mn[Mxe]=Mn[kxe]=Mn[Cxe]=Mn[Txe]=Mn[Ixe]=Mn[Rxe]=Mn[Uxe]=Mn[Fxe]=Mn[Pxe]=Mn[Lxe]=Mn[Dxe]=Mn[Nxe]=!1;function Yxe(n){return Exe(n)&&bxe(n.length)&&!!Mn[xxe(n)]}var $xe=Yxe;function Zxe(n){return function(e){return n(e)}}var v2=Zxe,cx={exports:{}};cx.exports;(function(n,e){var t=vV,r=e&&!e.nodeType&&e,i=r&&!0&&n&&!n.nodeType&&n,s=i&&i.exports===r,o=s&&t.process,a=function(){try{var l=i&&i.require&&i.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}}();n.exports=a})(cx,cx.exports);var y2=cx.exports,qxe=$xe,Jxe=v2,R3=y2,U3=R3&&R3.isTypedArray,e1e=U3?Jxe(U3):qxe,bV=e1e,t1e=sxe,n1e=_V,r1e=la,i1e=m2,s1e=xV,o1e=bV,a1e=Object.prototype,l1e=a1e.hasOwnProperty;function c1e(n,e){var t=r1e(n),r=!t&&n1e(n),i=!t&&!r&&i1e(n),s=!t&&!r&&!i&&o1e(n),o=t||r||i||s,a=o?t1e(n.length,String):[],l=a.length;for(var c in n)(e||l1e.call(n,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||s1e(c,l)))&&a.push(c);return a}var EV=c1e,A1e=Object.prototype;function u1e(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||A1e;return n===t}var w2=u1e;function f1e(n,e){return function(t){return n(e(t))}}var BV=f1e,h1e=BV,d1e=h1e(Object.keys,Object),p1e=d1e,m1e=w2,g1e=p1e,v1e=Object.prototype,y1e=v1e.hasOwnProperty;function w1e(n){if(!m1e(n))return g1e(n);var e=[];for(var t in Object(n))y1e.call(n,t)&&t!="constructor"&&e.push(t);return e}var _1e=w1e;function x1e(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var ep=x1e,b1e=Wu,E1e=ep,B1e="[object AsyncFunction]",S1e="[object Function]",M1e="[object GeneratorFunction]",C1e="[object Proxy]";function T1e(n){if(!E1e(n))return!1;var e=b1e(n);return e==S1e||e==M1e||e==B1e||e==C1e}var SV=T1e,I1e=SV,R1e=g2;function U1e(n){return n!=null&&R1e(n.length)&&!I1e(n)}var R1=U1e,F1e=EV,P1e=_1e,L1e=R1;function D1e(n){return L1e(n)?F1e(n):P1e(n)}var M0=D1e,N1e=rxe,O1e=M0;function k1e(n,e){return n&&N1e(n,e,O1e)}var MV=k1e;function H1e(n){return n}var CV=H1e,Q1e=CV;function z1e(n){return typeof n=="function"?n:Q1e}var G1e=z1e,V1e=MV,j1e=G1e;function W1e(n,e){return n&&V1e(n,j1e(e))}var _2=W1e,K1e=BV,X1e=K1e(Object.getPrototypeOf,Object),x2=X1e,Y1e=Wu,$1e=x2,Z1e=cc,q1e="[object Object]",J1e=Function.prototype,ebe=Object.prototype,TV=J1e.toString,tbe=ebe.hasOwnProperty,nbe=TV.call(Object);function rbe(n){if(!Z1e(n)||Y1e(n)!=q1e)return!1;var e=$1e(n);if(e===null)return!0;var t=tbe.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&TV.call(t)==nbe}var ibe=rbe;function sbe(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var _be=wbe,xbe=U1;function bbe(n,e){var t=this.__data__,r=xbe(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var Ebe=bbe,Bbe=abe,Sbe=pbe,Mbe=vbe,Cbe=_be,Tbe=Ebe;function tp(n){var e=-1,t=n==null?0:n.length;for(this.clear();++ea))return!1;var c=s.get(n),A=s.get(e);if(c&&A)return c==e&&A==n;var u=-1,f=!0,h=t&QBe?new NBe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,RTe.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,TTe.default)(r)?(0,MTe.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,BTe.default)(r)&&t.push(r)}),t};B0.default=UTe;var C0={};function FTe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,J2e.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,Z2e.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=eUe({},r[a],s[a])}),i}),r};C0.default=tUe;var T0={};Object.defineProperty(T0,"__esModule",{value:!0});T0.autoprefix=void 0;var nUe=_2,fk=iUe(nUe),rUe=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){uUe(i,r);function i(){var s,o,a,l;AUe(this,i);for(var c=arguments.length,A=Array(c),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){gUe(i,r);function i(){var s,o,a,l;mUe(this,i);for(var c=arguments.length,A=Array(c),u=0;u1&&arguments[1]!==void 0?arguments[1]:!0;r[o]=a};return e===0&&i("first-child"),e===t-1&&i("last-child"),(e===0||e%2===0)&&i("even"),Math.abs(e%2)===1&&i("odd"),i("nth-child",e),r};F2.default=yUe;Object.defineProperty(oo,"__esModule",{value:!0});oo.ReactCSS=oo.loop=oo.handleActive=P2=oo.handleHover=oo.hover=void 0;var wUe=B0,_Ue=op(wUe),xUe=C0,bUe=op(xUe),EUe=T0,BUe=op(EUe),SUe=I0,ej=op(SUe),MUe=R0,CUe=op(MUe),TUe=F2,IUe=op(TUe);function op(n){return n&&n.__esModule?n:{default:n}}oo.hover=ej.default;var P2=oo.handleHover=ej.default;oo.handleActive=CUe.default;oo.loop=IUe.default;var RUe=oo.ReactCSS=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;ia?f=1:f=Math.round(u*100/a)/100,t.a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}else{var h=void 0;if(A<0?h=0:A>o?h=1:h=Math.round(A*100/o)/100,i!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}return null},lS={},FUe=function(e,t,r,i){if(typeof document>"u"&&!i)return null;var s=i?new i:document.createElement("canvas");s.width=r*2,s.height=r*2;var o=s.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,s.width,s.height),o.fillStyle=t,o.fillRect(0,0,r,r),o.translate(r,r),o.fillRect(0,0,r,r),s.toDataURL()):null},PUe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(lS[s])return lS[s];var o=FUe(e,t,r,i);return lS[s]=o,o},pk=Object.assign||function(n){for(var e=1;et.name===n);return await fetch(e.file).then(t=>t.text()).then(t=>new DOMParser().parseFromString(t,"image/svg+xml").firstElementChild)}function Un(n){const{size:e,icon:t,className:r,onClick:i,theme:s,type:o,text:a,onMouseEnter:l,active:c,onSubmit:A,minWidth:u,disabled:f}=n,h=xe.useRef(null);return xe.useEffect(()=>{t&&uwe(t).then(d=>{h.current&&(h.current.innerHTML="",d&&(d.classList.add($n.icon),h.current.append(d)))})},[t]),o&&o==="login"?Q.jsxs("div",{className:Ad(r,$n.iconButtonWrap,s&&s==="dark"?$n.dark:$n.light,c&&$n.active),style:{height:e},onClick:i,onMouseEnter:l,children:[Q.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:$n.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[Q.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:$n.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),Q.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:$n.innerBackgroundColor})]}),Q.jsx("span",{ref:h,className:$n.iconWrap})]}):o&&o==="icon"?Q.jsxs("div",{className:Ad(r,$n.iconButtonWrap,s&&s==="dark"?$n.dark:$n.light,c&&$n.active),style:{height:e},onClick:i,onMouseEnter:l,children:[Q.jsxs("svg",{className:$n.buttonBackground,width:"69",height:"63",viewBox:"0 0 69 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[Q.jsx("path",{d:"M5 2H2.85562L3.00485 4.13918L6.7903 58.4048L6.9201 60.2656H8.78545H62.6772H64.6178L64.6763 58.3259L66.3135 4.06031L66.3756 2H64.3144H5Z",fill:"#efefef",className:$n.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),Q.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:$n.innerBackgroundColor})]}),Q.jsx("span",{ref:h,className:$n.iconWrap})]}):Q.jsx("button",{className:Ad(r,$n.buttonWrap,s&&s==="dark"?$n.dark:$n.light),onClick:i,onMouseEnter:l,onSubmit:A,type:o,disabled:f,style:{minWidth:u?u+"px":""},children:Q.jsxs("div",{className:$n.innerWrap,style:{fontSize:e},children:[t&&Q.jsx("span",{ref:h,className:$n.buttonIconWrap,style:{height:e,width:e,opacity:f?"0.4":"1"}}),a&&a]})})}function fwe(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?Q.jsx("div",{className:ky.container,children:Q.jsxs("div",{className:ky.messageWindow,children:[Q.jsx("div",{className:ky.messageTitle,children:t}),Q.jsxs("div",{className:ky.buttonContainer,children:[e&&Q.jsx(Un,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),Q.jsx(Un,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):Q.jsx("div",{})}const hwe="_backgroundImg_1yy0g_1",dwe="_darkBackground_1yy0g_16",pwe="_logo_1yy0g_29",Hy={backgroundImg:hwe,darkBackground:dwe,logo:pwe};function mwe(){const{debugMode:n}=q.useContext(mr);return Q.jsxs("div",{className:n?Hy.darkBackground:Hy.backgroundImg,children:[Q.jsx("div",{className:Hy.backgroundBlur}),Q.jsx("div",{className:Hy.Background})]})}const gwe="_buttonContainer_lqksm_1",vwe="_buttonLeft_lqksm_10",ywe="_buttonRight_lqksm_14",wwe="_buttonCenter_lqksm_18",_we="_sideMenu_lqksm_33",xwe="_scrollContainer_lqksm_44",bwe="_scrollContainerOptions_lqksm_52",Ewe="_bottomLine_lqksm_60",Bwe="_editorButton_lqksm_94",Swe="_editorText_lqksm_102",Mwe="_selectorContainerPos_lqksm_112",Cwe="_selectorButton_lqksm_137",Twe="_selectorColorPickerUI_lqksm_146",Iwe="_selectorColorPickerButton_lqksm_152",Rwe="_selectorColorPickerImg_lqksm_165",Uwe="_uploadContainer_lqksm_171",Fwe="_uploadButton_lqksm_184",Pwe="_relativeBox_lqksm_204",Lwe="_blendshapeGroup_lqksm_208",gn={buttonContainer:gwe,buttonLeft:vwe,buttonRight:ywe,buttonCenter:wwe,sideMenu:_we,scrollContainer:xwe,scrollContainerOptions:bwe,bottomLine:Ewe,"editor-container":"_editor-container_lqksm_87",editorButton:Bwe,editorText:Swe,selectorContainerPos:Mwe,"selector-container":"_selector-container_lqksm_123","selector-container-column":"_selector-container-column_lqksm_129",selectorButton:Cwe,selectorColorPickerUI:Twe,selectorColorPickerButton:Iwe,selectorColorPickerImg:Rwe,uploadContainer:Uwe,uploadButton:Fwe,relativeBox:Pwe,blendshapeGroup:Lwe},Dwe="_dropArea_1a0z4_1",Nwe={dropArea:Dwe};function S0({onFilesDrop:n}){const[e,t]=xe.useState(!1),[r,i]=q.useState(null);xe.useEffect(()=>{const o=l=>{l.preventDefault(),t(!1);const c=l.dataTransfer.files;n&&i(c)},a=l=>{l.preventDefault(),t(!0)};return window.addEventListener("drop",o),window.addEventListener("dragover",a),()=>{window.removeEventListener("drop",o),window.removeEventListener("dragover",a)}},[]),xe.useEffect(()=>{r&&n(r)},[r]);const s=()=>{t(!1)};return Q.jsx("div",{onDragLeave:s,className:Nwe.dropArea,style:{display:e?"flex":"none"}})}const Owe="_mainTitleWrap_4fb0s_1",kwe="_mainTitle_4fb0s_1",Hwe="_topLine_4fb0s_18",sS={mainTitleWrap:Owe,mainTitle:kwe,topLine:Hwe};function nl({title:n,width:e,left:t,right:r}){const i={width:e?`${e}px`:null,left:t?`${t}px`:null,right:r?`${r}px`:null};return n&&Q.jsxs("div",{className:sS.mainTitleWrap,style:i,children:[Q.jsx("div",{className:sS.topLine}),Q.jsx("div",{className:sS.mainTitle,children:n})]})}const Qwe="_ContainerPositionTop_v15ql_2",zwe="_ContainerPosition_v15ql_2",Gwe="_Container_v15ql_2",Vwe="_topLine_v15ql_68",jwe="_traitInfoTitle_v15ql_96",Wwe="_flexSelect_v15ql_105",Kwe="_flexButtons_v15ql_114",Xwe="_flexButtonsTop_v15ql_122",Ywe="_optionButtons_v15ql_131",$we="_optionButtonsSmall_v15ql_143",vr={ContainerPositionTop:Qwe,ContainerPosition:zwe,Container:Gwe,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:Vwe,traitInfoTitle:jwe,flexSelect:Wwe,flexButtons:Kwe,flexButtonsTop:Xwe,optionButtons:Ywe,optionButtonsSmall:$we},Zwe="/assets/randomize-green-4388c12b.png",qwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjNiOTBlZjU3LTIwOWItYzQ0Zi05OWNjLTkwYjYxM2Q0MWJiOCIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo2NWQ3ZjJiYi1jMWI3LWI3NDMtYWJiMy0xZjNlYzYzMWIxNDQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjY1ZDdmMmJiLWMxYjctYjc0My1hYmIzLTFmM2VjNjMxYjE0NCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo0My0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozYjkwZWY1Ny0yMDliLWM0NGYtOTljYy05MGI2MTNkNDFiYjgiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjAtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6bbHqfAAAFoklEQVR42u2duWtWQRTFo5hGRNAETKFiIQqCSxGto4iCqSLon6BoQJJCEcEFLASbD7QRRcTKNbihoLgUWhj/AItUCi7gVmjikubzPphAiOYts9659xQHAnl5M2/u73vnzHwvbzra7XaHNg1cPrKadJs0bnSHtEbjWGgr/HxSi9SeRWeLYwCAzOIPmk97u0ITpAMAQE7h+0ivaxR+psZIWwBAvoVfSXpsUfiZelZkBgAgx+dtJTIfaPV5W4nLB9p93lZi8oEEn39iWcRPpK2kzaSPlud4mns+0Ojzk6QTpM5p5+skHSP90ZYPtPn8DVJ3ybkXk65oygdafH6UtKlBW72klxrygfT5/BfSLoe2B0xWELt+oMbnHfoxj3RUaj6Q6vNdAfq0SGI+UOvzDn0UlQ/U+7z2fACfV54P4PPK8wF8Xnk+gM8rzwfweeX5AD6vPB/A55XnA/i88nwAn1eeD+DzyvMBfF55PoDPK88H8Hnl+aBup/aQflp26HrZc3hQaT64Zjnmv0h7nQEwT8u24PNJQdjokA9aVXfdqsaH4fNsQNhJ+mxRj2EXAO41bGw/ihUchH0Na3LXBYC7DRs7T1qOQgUr/lLSuZgA3LL0nkukhSiat8IvIF2wrMWtFABMJdHDpLkoolPxD5mxbOcGwJTekfpRzMaF305662H8kwMwpRekDShuZeHXkp57HHc2ACAfhPP5JAB8MB3+jXyQzOeLJfaLpPcpAPhmjlnmcMtSnQ8cfb6w1BXmPF9TAFB8N9Az7dhtpDfIB8F9vvjQ7Jh2rp6K72mCArDkP39z0GHaIjofOPr8lG3OmXHOJawAmHah57F+4G0+P+sHgyUAHm91/fD5cmtkDYDmfODT57MHQFM+COHzYgCQng9C+bwoACTmg9A+LxIACfkgls+LBiDHfBDb51UAkEs+SOHzagDgnA9S+rw6ADjlAw4+rxaAlPmAk8+rByB2PuDm8wAgUj7g6vMAIHA+4O7zACDc7fqk+a/lbJel1QPgIR9k/cUUAAj7SDX7r6YBgP98wM7nAUCa9YOo83kAwC8f5PIACgDwnA+yegQNADQfsGdlb9rK8HoAQMMBK3vryT0AIB+ARyXX9AgAyAfgYck1PQQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlALQAwCSX0+y18V/L/a3BQDJr2cx6UcKAMZz3BRaIADdphZJNo16ldsG0ZIAoP721thY2gmAulvH3iB1AYCot/0rMbaObbJ59KR53UonAAjW907ScTPWUfYOHpK2fXyuADhsHz/kAkBBXMvy5QqjHPNBbgBQnzbW8PnZ1Kq6I9ftxJ6KuWaZrnOaLeQCQDHFJl1zeLPJ3jrtNOnQfIe7AZt8wB0A6sM80lHSH8uxPlPUqm57Nh1cSXps2bnk+YAzANT+AOmT5dg+Ja1q2qZLZ/tIry07m2z9gCMAjj4/Rtpi27aPzg9WrERVrR90awXAzOevWo7dBOmAax98XUg2+YADAGZ2dSyWzwcHIKd8kBoAM5+P6vPRAMghH6QCIKXPRweAcz6IDQAHn08GAMd8EAsATj6fFABu+SAGANx8ngUAXPJBSAC4+jwrADzlg5u2+SAEANx9niUAqfKBTwBy8Xm2AHjKB19Ju2MDkJPPswcgZj5wBSBHn88GgBj5wBaAnH0+OwBC5oOmAEjw+SwBCJUPmrwuXorPZw2Ax3yw3pxnpOS4EXPMOkk+LwKAGflgwrI4p0kPSn5/n3RKms+LAsBDPggh1j4vDgBP+cCHsvB5sQB4ygfifV48AJ7WD8T6vBoAAueDbH1eFQAB8kH2Pq8SAA/5QIzPqwbAIh+I83kAUD8fiPR5APAvCKtJt80dYdz8vEbjWPwFnWtJD/nY2zYAAAAASUVORK5CYII=",Jwe="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmM2NDY5Y2JiLWFkMzUtYmQ0Ny04M2Q1LWU0NGQ0MTI2YmYwNiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDoyMjUyMzZlNS1mYTFiLWUzNDUtOGQzNi0xOWJkMmE0YmYzNTEiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjIyNTIzNmU1LWZhMWItZTM0NS04ZDM2LTE5YmQyYTRiZjM1MSIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyNDo1MS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpjNjQ2OWNiYi1hZDM1LWJkNDctODNkNS1lNDRkNDEyNmJmMDYiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjk6MjYtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6qPgTwAAAEeUlEQVR42u2dX4tNURiH58KfwR1K0USSj6BoIpdydcY0TUMmIy58BPdK/uTCLReaG7kwooQoH4FQyneQMNw53t2cqdOJPfusvfZa77ve5+JX1DlnOns9PM+cqT0T/X5/wtt6D64ekj2W/ZKtDv582OO18Hbwk7I7sv5/dle2DQDKPPzLsp81h7++6n+EKwBQzsGfkH1ucPCj+yI7CQB2D/6A7GXAwY/utewgAJTj+dAV2QdePR+64vrAu+dDV0wf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5532A5533AZ533gd43nkf4HnnfYDnnfcBnnfeB3jeeR/geed9gOed9wGed94HeN55H+B5530wzsHvkr3hQqvfW9nuLgDYKXvGBVa/F50AMATCHtkKF1rdqn+ce1NG4BHZOy589n2QHc35beBZ2VcOIvm+yRa1fBC0SXZN9oeDSbLrss0aPwqmDxR6PggA+ULnZRfpA9uel+ddkJ0LAWB56AOG/fSBLc/L86ZkrwavsxwCwOgPd6q/T9IHuj0vz9kquzl6djEAqPZDdok+0Ol5ed6S7Ps/XjMaAOurfgh0nD5Q4/lp2aea144OwPDHjvRBXs8/b/A1OgOAPtDj+awA0Af5PZ8dAPogr+fVAEAf5PG8OgDog7SeVwuA1z5I7XnVAHjqg1yeNwFAyX2Q2/OmACitDzR43iQA1vtAk+fNAmCxDzR63jwAFvpAs+eLAUBrH2j3fHEAaOkDK54vEoCcfWDN80UDkLIPrHreBQBd94Flz7sCIEYfPCnM8+4AiNEHZ2RzhXjeLQCt+6AQz7sHoFUfFOB5AIjRB4Y9DwAx+8Cg5wEgVh8Y9TwANNjt6rOADT4nuFHg+waAoc3WvOfZQt8zAAxtruY9zwFA+QDM1LznGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANsA3AeAYnYvBIBTsvcAYH4fZaeDf328PHmxt3bzRACwteqWNkvBvz5+5MJs6a3dRBEAbOxWdVOrJmc77j1z9smeAoDaVbe1mRrnTENvnnSst3YzZQDQsepGVtMhZ9n29mkW+6AkABp5vjMAjPZBKQA09nynABjsA+sAjO35JAAY6gOrAAR7PikABvrAGgCtPZ8FAMV9YAmAKJ7PBoDSPrAAQFTPZwdAWR9oBqATz6sBQEkfaASgU8+rAyBzH2gDoHPPqwQgYx9oASCZ51UDkKEPcgOQ3PMmAEjYB7kAyOZ5UwAk6IMcAGT1vDkAOu6DlACo8LxZADrqgxQAqPK8eQAi90GXAKj0fDEAROqDrgBQ6/miAIjQB7EBUO/5IgFo0QexADDj+aIBCOiDtgCY87wLAMbogzYAmPS8GwAa9kEIAKY97w6ADfpgHACK8LxbAEb6YHVwqPM1j5sfPOZ3SZ53D8DgcLfLHsoWah6zIHsk2+HluvwF92zupxEV3NQAAAAASUVORK5CYII=",e_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFu2lUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmY3YWFkYzZiLWM2ZmEtNjE0OC05YWZkLTgxN2Q1OWRkZTI0MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo3NjUxYWZkMi1lOWE3LTk3NGYtYWVhZC03YjFjMjg0NmFhM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjc2NTFhZmQyLWU5YTctOTc0Zi1hZWFkLTdiMWMyODQ2YWEzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0Mi0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmN2FhZGM2Yi1jNmZhLTYxNDgtOWFmZC04MTdkNTlkZGUyNDIiIHN0RXZ0OndoZW49IjIwMjQtMDEtMTdUMDA6Mjg6NTEtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8L3JkZjpTZXE+IDwveG1wTU06SGlzdG9yeT4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz6TWt7cAAAFm0lEQVR42u2dT2xURQCHSTXpQTH0oIJpgfZKi1ETiSK1MV7FbORQNcG0Hmg3oQVjjKARrhDBBDEYMSEYS6kWkxoVAheDiBc9kHBBuaGgMSo1KgTF+pt0JLq6dOe93X3z5zt8SbPdvtmZ37fvvc7Mm5k3MzMzD9KFRkAAGgEBAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABPKO0f3OrWCxWiTViROwQ+8QBcchywL62w77HvLdPdJpjIEAYYd8sHhDPiD3iuLggfhczGblqj/GJ2Cs2il5xCwL4EfoK8bw4LH7MEbQrF8UR8aK4T7QgQPNC77On6jNNDHwuzopXzGdDgMaEvlRsEqc8Cr0ap+2ZoRMB8gdvrulviT8CCP7/7h/GxIMI4B78Q+KjAEOvhrlHeRgB5g7e3FB9GFHwlZi6rUSA/wZ/m3g94uAreVMsRIDZ8J8S3yUU/t98L55OVgDby3Y4weArMf0JXUkJoAo/Ln4i/GtMiyeTEEAV3U3gVXktWgFUuXbxKSHPyWeiIyoBVKG7xXnCrRnTVvdEIYAqsjrniFwjGteciabEuGXKvnbes57ER4MWQBVY60FD/ioOiiHRfb3xfTt/oNu+1/zNLx58/rVBCqAPPlxww52x4/e356jDrfYYXxZcl+GgBCg4/Gk7KaSljvVpsSJcLLBe5SAEMB+04L72JQ08qy0ueKyi7LUABYe/pYn/0r4UiwSxhD9UQIfWuhgkiOGav67A8YzgJeC0n7/+W0KWIOTwj3o0keVoqBKEGv5vYoFHAiwQl0KUIMTwDSM5wuoQg3Ya90HLTvtaR47jjhbcJuWmCOBB+OcyBrTcPgJ25TrHvmKFuDNjGedCkyC08DN9+20vnms5GwM8CzhLEFr45jo73zGUbTnK2+5Y1nxxOSQJQgrf8G4B38gRxzInPWmrcl0E8Ch8w4BDEF11LLfLodwBj9qrnEsAz8I3LHMI4r06ljvpUO4yz9qsnEkA/WG/ZxX5VtxQYwh3NKD8RTWWfaOHzzn0OwmgP2izU5J8qsQJh2/hYMGXnxMePqja5iLAdg8nSk45BPBqA8rf5VD+lIftt81FgC88rMC4QwDvNKD8CYfyxz1sv88RAAG4BHAJSOMmcICbwBw3gRH8G7ioAeUvTObfwEg6giYL6gjqjqIjiK7gzF3Bg6VYuoIjGAwaYTAoruHgywwHFzAc7JkEoxkmamwQfzIhJI4pYd9knK7VU+OUMNOJszxjGV9HPSXMIwlGc0zebLf9BDsrJoWa19pzHHdDEpNCPZHgUrWOjYKmhbclNS3cEwmOeSTAseQeDPFEgq08GsbDoUMFhj+U/MOhnpwJhgmfBSK2ctpniRizx8DSBga/hCVi/JfgZ/FsrUPHjotETbNIVDjLxH1lVwtjmTgWitw8YYXsqWGhyB773gkWiqyPBI/M0f/ebC7YZWHf/0dXsPn5pP2dL5/TLK+7OpbFou8ygzgsAl37gJdpM5aLT5OTeQalQtgwYhchV2V3KlvG9LNlzL8waxA/kdqmUWY7WDaNmm2DtDaNYtu4a9vGDbJxZJobR75RYuPIqlvHfhBx8GYc4X62jk1v82hTFzaPzrh9/H7PNp2qFbPl/duil+3j6zMMu0mcCiD40+IF0RlC2wYhQIUMveJluymUL6GftWsP94XWnsEJUCHDveI5e439oYmBm06sI/abvqKeG1QhQHYZbhIr7fj9HvFxaXYjyDz3D1ftMY6LvfbYq1yfT0SA4qRotcvDm5vJNfZpYXP52CfGxCHLmH3N/G69eMyczkuzW9y3xtxGUQsACAAIAAgACAAIAAgACAAIAAgACAAIAAiAADQCAgACAAIAAgACAAIAAgACAAIAAgACAAIAAkCc/AWkhfX2hx9ZaQAAAABJRU5ErkJggg==",t_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAATr2AAE69gE6sVc6AAAE7mlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMTdUMDA6Mjk6MTQtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4YWVhNTAzZS0zNzRiLWJjNDQtYjhjYy01NDllNjA1MmM2MTMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjhhZWE1MDNlLTM3NGItYmM0NC1iOGNjLTU0OWU2MDUyYzYxMyIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0xN1QwMDoyMjo0OS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PslPja4AAAbiSURBVHja7Z17iFVFHMc1K80ybc3SP9K21YrubtLDiIJqK5WMpbYt1MpSKiKkba0gtU0rCCpoyxRXSKrNiJIwCmtD0u2JEWFuSC/t2sueghDU2svbd2D+uFzce89rzvxm5vvHB2TX5Zw758PMufN7zJBSqTSEhAsHgQJwECgAoQCEAhAKQCgAoQCEAhAKQCgAoQCEAhAKQCgAoQDVaO1ZOgWsB7+CAbALLAPDOdCeC4CH3AJKg/AlGM/B9lQAPNxG8HcVARS7wQQOuJ8CPFvj4VMCXwXAAx0BfowoACXwUIA68EcMASiBh0vApzEFoASeCdCZQABK4JEAw0A/JQh7H2A8KFKCsHcCxUugX1qnghlgLrgBzNP/bgXTwTRwAjiEAsQf4AkpJChmJYF+0M1gIegGm8Dn4M+I9/If+B68B3rAneBiMIoCCJwJ8DejwZVgBfgQ7E94/Vqor7ybwVJwOgWwKAH+z3HgJrDR4AOvxU7wIDiFAuQoAX7XZumBV0MtF20UID8JnhMoQUlvjXeAw5kQYl6CVUIlUOwD7WBo8BlBhiVYK1gCxU/giuBTwgxL8IJwCRTvg/qgcwINS/CKAxIolgSdFGpYgjcdkeATMDHYrGDDErzriASK+cGmhZuSAD8/DHzskARrg60LMCjBkQkTVWwuCccGWRhiUIIx4DOHJNgLCkFWBhmUYJzer3dFAhWFnOXjRtAosA6cb0ECFaL+xiEJFAt8E6BXf7Cfq22GGJRgIvjBMQlu9yUWsOUgW6M2JGgAvzgmQYfr0cA3quyPm5KgWEWCaXpLVhWtXqVp11k/6uffCpRgoav5AC9GCJvWS0svw99NVhs0OtHkgBAJ5rmWEbQiRqSs3saOYcTPcTzoAv8KkGCGKzmBnQnCpbkvBwlE2GRZAJXQ2ig9K3hOipi52Jmg7D7aLUvwXdbp81k+/DPAPykTJ1yQYKbld4MPJFYGHZPi4bgowaWWZ4I10gTYmHEKlQsS3GxZgtukFIfeayiPzgUJnrYswVm2G0Q0G06mFC2BCuHq7W1bAmxPW8OYNsBjOtJmUoKvwaQMJOiwPAussiVAXoUZJiVQJWW/gR3gSdXrMME4jIzZJ8kEl+UqgC7EzDu33pQElSxPMB6PWRZANeU8KhcBdJKFDeNNxg4q6Yk5JhcJ2CpemZcA6yxX2YibCVQdoIBlQHGhUQHUWiOk+PLEnCRoTJD0YpM+0wJIybS9xmCnknK6YozNGiFjM8eIAAJ2vsqjYlEaSGQxE2yLMT4PCBmfreBkEwK8JuQDfhTjnpsySNUeGfFaiwVlEd1hQoBXhXy4vpjf0femvF6TYzOAMQGkLAHbY763bEt5vWLEJadb0BIwxeeXQJXZOyLGPT+ewTVrSqDi9EIEmO3718DI07K+50JG16xVlfywgHHpzWMj6CkBH/SWmPe8PCcJHrU4JurUltPyEODoDDdakvJ8gvvuyejaRaES3JVnMMj2UvA7GJvgvu/zdCbYYiMc/IRlCRYlvO8GHfrdoY+42+/4TPBXkqk/q4wgm504dsf5NlDlM0zS4VQTM8Ej0nMD0w5ewWKf3kSxews9i0xK8LKEpND5lpeCMx2QwMRyoFLaxkhJC++yKIBay48IcCY4T1pl0GaLErzuSAu7rGaCzJpHZCnAOD0AtiTYEIgEqyUXhxYSHCSZaahYlal5LME7LpSHTxewSdTioQS7TPQSNNUgYoGAeMFbWdTTm+xPEEMCVbvQ4FqLmEVCIodv62PhRjs6E6iS+7NdbRJ1j6AsmQEtw0r1Fg2uBVdrHtJNoqYKlKDZ9TZxSxxqy2atIHWQfYLLfWkUeTcliC3BTN+OjLmVEkSSQEUqr/f1yJgWQb33vGhS4eKRMY36aw0lECCBrfbwdQ6d6uG1BLbPCeimBHYlkHBYxNyU/QUpgScnhmylBPlLIOoUS71Dd4ASBCpAWW1/LyUIVICyQbxE+IFPXkgg/nx7DMSNQvrveCmBeAEqRJA4I+wD57oqgTMCVHTqlvaO0GcrnyA4ASpeFhdn0AAiKTt1HF8dRHWozaSSIAWoGNyTdM/eDQbjDOq0jvX61JCmFPsdoiTwQoCDNG08R7e0Wa1zA7/SGUFRBnqP3pRSp57dD9rAqWBohjOX1TOQvBagysCP1V3DLgCz9IOdDa4DrarSRjWgBMNcPSuZArglpAgJ+DDclaA/i9mKD8JtCTopQNgS9FOAsCVQdZh1FCBcCfakbZPDgXdbgme4BIQrgWoMWaAA/kqgTiz/oooALdwH8F+C4WCZDjwN6L6GL4HJ3AkkFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIBCAUgFIBQAEIByGD8DzQJyO8fOgE8AAAAAElFTkSuQmCC",n_e="/assets/play-de4238c5.png",r_e="/assets/reverse-e35421b8.png",i_e="/assets/pause-b6381fd4.png",s_e="/assets/fast-forward-0d3ffae5.png",o_e="/assets/fast-backward-1f713448.png";function F1({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=xe.useContext(mr),[a,l]=xe.useState(s.userActivated),[c,A]=q.useState((o==null?void 0:o.getCurrentAnimationName())||"");xe.useEffect(()=>{n==null&&(n="T-Pose"),n!=""&&A(n)},[n]);const u=()=>{r()},f=p=>{p?o.play():o.pause(),o.setSpeed(1)},h=p=>{o.play(),o.setSpeed(p)},d=()=>{s.setActive(!a),o.enableMouseLook(!a),l(!a)},m=async()=>{console.log("play next"),await o.loadNextAnimation(),A(o.getCurrentAnimationName())},g=async()=>{console.log("play prev"),await o.loadPreviousAnimation(),A(o.getCurrentAnimationName())};return Q.jsxs("div",{className:vr.Container,children:[Q.jsx("div",{className:vr.ContainerPositionTop,children:Q.jsxs("div",{className:vr.flexButtonsTop,children:[Q.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{h(-2)},children:Q.jsx("img",{src:o_e})}),Q.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{h(-1)},children:Q.jsx("img",{src:r_e})}),Q.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{f(!1)},children:Q.jsx("img",{src:i_e})}),Q.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{f(!0)},children:Q.jsx("img",{src:n_e})}),Q.jsx("div",{className:`${vr.optionButtonsSmall}`,onClick:()=>{h(2)},children:Q.jsx("img",{src:s_e})})]})}),Q.jsxs("div",{className:vr.ContainerPosition,children:[Q.jsx("div",{className:vr.topLine}),Q.jsxs("div",{className:vr.flexSelect,children:[Q.jsx("div",{className:`${vr["arrow-button"]} ${vr["left-button"]}`,onClick:g}),Q.jsx("div",{className:vr.traitInfoTitle,style:{marginBottom:"10px"},children:c}),Q.jsx("div",{className:`${vr["arrow-button"]} ${vr["right-button"]}`,onClick:m})]}),Q.jsxs("div",{className:vr.flexButtons,children:[e&&Q.jsx("div",{className:`${vr.optionButtons}`,onClick:e,children:Q.jsx("img",{src:Zwe})}),Q.jsx("div",{className:`${vr.optionButtons}`,onClick:d,children:Q.jsx("img",{src:a?t_e:e_e})}),Q.jsx("div",{className:`${vr.optionButtons}`,onClick:u,children:Q.jsx("img",{src:i?Jwe:qwe})})]})]})]})}const a_e="_tokenBoxWrap_q4pvo_1",l_e="_mask_q4pvo_7",c_e="_timer_q4pvo_31",A_e="_level_q4pvo_42",u_e="_mythic_q4pvo_55",f_e="_epic_q4pvo_60",h_e="_rare_q4pvo_65",d_e="_uncommon_q4pvo_70",p_e="_common_q4pvo_75",m_e="_none_q4pvo_80",g_e="_value_q4pvo_85",v_e="_frame_q4pvo_95",y_e="_emptyIcon_q4pvo_111",w_e="_badge_q4pvo_123",__e="_frameActive_q4pvo_131",Rc={tokenBoxWrap:a_e,mask:l_e,timer:c_e,level:A_e,mythic:u_e,epic:f_e,rare:h_e,uncommon:d_e,common:p_e,none:m_e,value:g_e,frame:v_e,emptyIcon:y_e,badge:w_e,frameActive:__e,default:"_default_q4pvo_159"},x_e="/assets/magic-box-cd45f027.png",zl=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,c]=q.useState(!1),A=()=>{c(!0)};return Q.jsxs("div",{className:Rc.tokenBoxWrap,style:{width:e,height:e},onClick:r,children:[t&&Q.jsx("div",{className:Ad(Rc.frame,Rc.frameActive)}),Q.jsx("div",{className:Ad(Rc.frame,o&&Rc[o])}),Q.jsx("img",{src:l?x_e:s,className:Rc.emptyIcon,style:a,onError:A}),i&&Q.jsxs("div",{className:Ad(Rc.level,o&&Rc[o]),children:["Lv.",i]})]})},b_e="_InformationContainerPos_72ckd_2",E_e="_scrollContainer_72ckd_15",B_e="_traitInfoTitle_72ckd_27",S_e="_traitInfoText_72ckd_35",M_e="_flexSelect_72ckd_62",C_e="_checked_72ckd_119",T_e="_checkmark_72ckd_123",I_e="_checkboxHolder_72ckd_136",ya={InformationContainerPos:b_e,scrollContainer:E_e,traitInfoTitle:B_e,traitInfoText:S_e,"input-box":"_input-box_72ckd_43",flexSelect:M_e,"arrow-button":"_arrow-button_72ckd_70","left-button":"_left-button_72ckd_86","right-button":"_right-button_72ckd_93","anim-button":"_anim-button_72ckd_100","custom-checkbox":"_custom-checkbox_72ckd_105","checkbox-container":"_checkbox-container_72ckd_110",checked:C_e,checkmark:T_e,checkboxHolder:I_e};function g2({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=q.useContext(As),{characterManager:i}=xe.useContext(mr),[s,o]=xe.useState(0),[a,l]=q.useState({}),[c,A]=q.useState([]),u=m=>{i.setManifest(m),i.loadInitialTraits().then(()=>{r(!1)})};xe.useEffect(()=>{t==!1&&(l(i.getAvatarSelection()),A(Object.keys(i.getAvatarSelection())))},[t]);const f=m=>{i.loadTraitsFromNFTObject(m).then(()=>{r(!1)})},h=async()=>{if(!t)if(r(!0),s>=n.length-1)e?u(n[0]):f(n[0]),o(0);else{const m=s+1;e?u(n[m]):f(n[m]),o(m)}},d=async()=>{if(!t)if(r(!0),s<=0)e?u(n[n.length-1]):f(n[n.length-1]),o(n.length-1);else{const m=s-1;e?u(n[m]):f(n[m]),o(m)}};return(n==null?void 0:n.length)>0?Q.jsxs("div",{className:ya.InformationContainerPos,children:[Q.jsx(nl,{title:"Trait Selection",width:180,right:20}),Q.jsxs("div",{className:ya.scrollContainer,children:[Q.jsxs("div",{className:ya.flexSelect,children:[(n==null?void 0:n.length)>1?Q.jsx("div",{className:`${ya["arrow-button"]} ${ya["left-button"]}`,onClick:d}):Q.jsx(Q.Fragment,{}),(n[s].name||n[s].manifestName)&&Q.jsx("div",{style:{textAlign:"center",flex:1},children:Q.jsx("div",{className:ya.traitInfoTitle,children:e?n[s].manifestName:n[s].name})}),(n==null?void 0:n.length)>1?Q.jsx("div",{className:`${ya["arrow-button"]} ${ya["right-button"]}`,onClick:h}):Q.jsx(Q.Fragment,{})]}),(n[s].thumb||n[s].thumbnail)&&Q.jsx("img",{src:n[s].thumb||n[s].thumbnail,alt:"Selection Thumbnail",style:{width:"280px",height:"460px",display:"block",margin:"20px auto 20px"}}),n[s].attributes&&n[s].attributes.map(m=>Q.jsx("div",{children:Q.jsx("div",{className:ya.traitInfoText,children:`${m.trait_type} : ${m.value}`})},`json:${m.trait_type}_${m.value}`)),e&&c.map(m=>Q.jsx("div",{children:Q.jsx("div",{className:ya.traitInfoText,children:`${m} : ${a[m].id}`})},`val:${m}`))]})]}):Q.jsx(Q.Fragment,{})}const RT="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAXASURBVHgB7ZzNchNHEMd7ZiWf5WtSCSIfVa5cLN+MTRXrEFPcWJwHwNxys/0Etm+5YZ4Ac0pOIG4EU2WlCgffIm4+pIhS8ADKEQlt07OSKKGdlVdSz64K9++kmhlpR3+Pe3qmuwUgCIIgCIIgCIIgCIIgCIIgCIIgXHAUzCDLflDWRfCVgkVA5aOCkgqhRLMt9cdQW0MhNEBhHRFehW2ondaqDZgxZkZg3w9KrTm9RdJtknBlmAwjeLXTgvuzInbuAi//FPieUrv00gdW1GGnHe7nLXRuAkdmoKDvKYUBOCVfoT3IgSvrP295Gn4nG1sB91S0p4Kvvl34/83rszpkTOYrePXGxj1A3E41GKGGCl/Rq7oXQpM2tma/q0PC0R+orFAt0rfwU32eUgcnzx7tQIZkJrDZxNpFdUwvR6/arqgP59pQrdWqTUj52a0iBCT2nRRi14ttXEv72dOSicCpxCVhFeD+i+fVGkzB8s2g7HVgj77anRHDMhO5ABkwUlzjz4Z4d1ph+5w+jTazzZX1oEYmYTfB5av05rQEjtHgmMjmJoiLqKrFFi5xiTtEPTqcJFPpzc0pTk0EraJNBeqBrU9hZA72wAH03ArZ4+PBk18Socadl39UD8ARzgTuHnfVMT2gPNw3K+L2aHbauOTKT3ZmIrwi7NrENWYhR3Ftm1pJz2lnpsKJwGb10jrdjHXQhhYWQid+6Hnimv8a8hwum0siS19wlY7s4AAnApvVC9aH4U5vl2cljbjmv8a4ZZo8FtsY7N6HsMNug83q9YrqX8ujDk+OHt0FZtKKO9i2un7buGj+8Fha4fPcvjH7CtYeWI/BHS/cB2YmEbffbhvfKkC6I/wY8JsIrW7F2uiUxm0aJhXX0PO7a7H3qJGnv4lgFdiYB6vnQHcLwMg04n6cE1jnVF75ceMSMMIqsAnz2NrNxQ0wwSHu6DmFa8AIr4kILUdiMg9cGweXuIbenGqxDo/3jppVYKXpbnaI3n3u1HCK+3FuYXxuZIevASOsApNdK8faMO7Yj4sLcSM0xCMcmPqInfIRjNDFTnm4jWJSU4VpnIlr5hbaj87AiPPrymlwKa6hrS6wwK7FzQpegTG+Ijp6/BXxuYhr4N3kFMYEVu/HEzhLcZU90tIARrg3ubhNG8OvzHrlWuN1OMMCk1/553Abib6Y5r15mAWXfnsfXhusrS6Zb8L2o96Wh7i9OfmWrqncymFYBQ49y9GTaGkIkt6T14ZmElVs7UnfYVJYBTZXknSaawy3K89+DZint6BsiSkUTuK+VuX3gxFs14D+cMwrT3G7McO4eUDEJ8AMu8Bz7+HA1j4Y88rbz02KGZJ5YM+PcJIXkRTzIuHWQjqe5inuletBoLV6HO9xEzN0clROinnRKn6Qp7hRxEUraw6Ei5ihwYnAJuZlEkwsXeU8j79RRj3YkgHVoYt0guiZ4IgowQQhVSQjC3FXbmzsWssVyHNwtXoNzkoI3v5z1vz6m4V3FCK4OWpcZuIi7tn6yK3cefnMSXZnhNMajTevz04vXV6YJ5GXrQPM6mnDztvGGUvMbhhzWvviux9+U4C/gPXxeP/kqPorOCSTDHfyKv6G5Ox2czjZ/+uoegiMmPIwbTZVSKy5q58cPXaegJ1JhrtJ1x+R5V42OcSr6xvXOMqtUtbdRSUEkAGzVwRDoXSTFDJREUz3+OufM/zzK4IZ5Or14AC12ko5vGZqkcMQ/sOBWy5FURK6yy31apkrtFNV0iRcG5v74qi6DRmSS6WnKS0YUaDigiZdNOyfPHdXKpBELpWepuLyy+8XnmiEefobp454TII58IQFvE2u2FPIgfyLwdPVtY0PU93dtMzMzxkYoXUHtsl03JrUdJCdbmjEhwW60ctqEzuP2fxBjq7YPph6ZFSLaGqSP/VnmyQm3cqZ+uUoDlif1R/kEARBEARBEARBEARBEARBEARBEC48HwDC3eeu0ZVWOQAAAABJRU5ErkJggg==",R_e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFgAAABYCAYAAABxlTA0AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFyWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wMS0wMlQxMTo0OTozNy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDEtMDJUMTE6NTI6MjMtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgeG1wTU06RG9jdW1lbnRJRD0iYWRvYmU6ZG9jaWQ6cGhvdG9zaG9wOjBiNWViMTliLTkxMmEtMmI0NS1iOTZlLTliNDUxOGUzZDU4NyIgeG1wTU06T3JpZ2luYWxEb2N1bWVudElEPSJ4bXAuZGlkOjg4ODliZDlkLTAxZjItMTQ0Ni04NDE4LWYyYzNjNjQ1ODNlOCI+IDx4bXBNTTpIaXN0b3J5PiA8cmRmOlNlcT4gPHJkZjpsaSBzdEV2dDphY3Rpb249ImNyZWF0ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ODg4OWJkOWQtMDFmMi0xNDQ2LTg0MTgtZjJjM2M2NDU4M2U4IiBzdEV2dDp3aGVuPSIyMDI0LTAxLTAyVDExOjQ5OjM3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiLz4gPHJkZjpsaSBzdEV2dDphY3Rpb249InNhdmVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjBmNjkzZGRkLWI4ZWYtZTU0Ni05YWQ2LTRjNzJkOTg4MTJhNCIgc3RFdnQ6d2hlbj0iMjAyNC0wMS0wMlQxMTo1MjoyMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiBzdEV2dDpjaGFuZ2VkPSIvIi8+IDwvcmRmOlNlcT4gPC94bXBNTTpIaXN0b3J5PiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv0y+4AAAASPSURBVHja7ZxrSBVBFMctyqIgC0ujJ5UFaQpZRC/7YoUVQYUUkZQYQoVfJBF62PtBlhlJoJWSUQRSEYUFUVRiSEWRiokVgZqRWUEv7W3/oQkul53Ze+/OXWfyfPh98e6cPfNjnZ2ZPbshnZ2dIUTwIAkkmAQTJJgEk2CCBJNgEkyQYBKsgFnzlsaCanARZICFIJwEqxN8CXR68R08479lgxVgDAkOTPATC8EiXoLbYB9YDeJJsFzucPDLD8FWvABlIBcsAeNBKAn+K3i+Q7ki3oNycAys4eP8gO4oeH2QBFvxFVSAYj6uR3cHwWdcFGzFG1AF8sBakOBkeNFR8AMbAY/BedDqovQPoA6UgghjBbMxkXfGqpMfwUyv4w90wRV+1GTBCyQdmy5oc8hlwQdMFrxF0KlzkjbDwA8XBSebLPikv1cNfusBml0UHGWy4BpBp0olbYaAjgBlselZHBgNloNGm+PbQF8jBfsgKlrQbnuActMtYoWCBkmb68ZO09hNzEbIUzDCq82GAOXekuSRJGl3xGTBmT6IYXsU10Ahn5cGOo5ukeQxCLQL2q0zWXCBizeq7TZD1XdBu1iTBVe4KPieJI9kQZtPYKCRgpF4P/DW5QVDnkUeUVyk1fH3jd2L4Pu1KqSxMfohH6cbfbmS+eqRTdX22ixYck0WnKZAbguY5BV3o8IrPsVkwWUKBMQIYmcpEjzdZMF3eCfaA4C1OxGkld4/WgPdE9ZBLttLGMwJD4AI0F8SvycfPpwIvkuFJ2LBQyXzWl8pck0wmwuCcWCUZrCcwizy3aZg/E13RTBONMXjpL81g+W0wyvf/YpucHPdEpzbxQ8k7djlkesmRTHbnZRt+Ss4T3PBOz1y3aooZq1rj+1xsoMGCd6sKOYFEhxcwRm6Cf4JvmksuIUXlrz2MeZknQTv5k95e4HZvCM6CU73c5O/w2ldskrBqTbL4K4WnCbIL0MS75GrtWkSwZWSNgkaCK63Wao3CeKd0kVwgaRNmGQT2y3BZ236VS6Il6OL4OOSNpEK9gKcCq6y6VetIF6iLoKbRdt5vNhZhzE4UZDfYkm8kboIZpy2OH4C+KyJYFZsPdUrvzmSWM9dL8D2YZpWw4tBlrEyTz4n1mmaxvK5DvLBTY9NIitKdBT8P63k1pPg4ApOMllwBX+9agZYKamqdCI4x0Ec9vg+0lTBhYLYVxQLznYQp65L3jJSILhN9G4a/j5RseAefBW5gy00/PwvuWSq4GKb+PWqBAviR/Ay2UxeTV8pqObJMlVwiU38hmAKlizl4/iCqIjXIS8yeYgIE8SOUTlEGPkyuKKb3FlB7FskWN00jX1sIxVM4/uxTaqnad1dcNAXGiSYBGsjuJoXvJTy95VJsEJWeZ2/N7hBghWXQXnl0Ae8IsHOGSfJ4zAJdv59HVlR9SYS7JxESR4XSbBzLgtyiKebnDqugrEe248pkveISbAD3oEvtNCglRwJ1l1wvuaC95gueJ/mgnNMFxzFH6m84V841YVW/nZ9DH0/mD4xTpBgEkyQYBJMggkSTIJJMEGCteYPxO/zzCRZDV4AAAAASUVORK5CYII=",U_e="/assets/color-palette-71a7a2d4.png";var ao={},M0={},F_e=typeof La=="object"&&La&&La.Object===Object&&La,wV=F_e,P_e=wV,L_e=typeof self=="object"&&self&&self.Object===Object&&self,D_e=P_e||L_e||Function("return this")(),cl=D_e,N_e=cl,O_e=N_e.Symbol,C0=O_e,T3=C0,_V=Object.prototype,k_e=_V.hasOwnProperty,H_e=_V.toString,lm=T3?T3.toStringTag:void 0;function Q_e(n){var e=k_e.call(n,lm),t=n[lm];try{n[lm]=void 0;var r=!0}catch{}var i=H_e.call(n);return r&&(e?n[lm]=t:delete n[lm]),i}var z_e=Q_e,G_e=Object.prototype,V_e=G_e.toString;function j_e(n){return V_e.call(n)}var W_e=j_e,I3=C0,K_e=z_e,X_e=W_e,Y_e="[object Null]",$_e="[object Undefined]",R3=I3?I3.toStringTag:void 0;function Z_e(n){return n==null?n===void 0?$_e:Y_e:R3&&R3 in Object(n)?K_e(n):X_e(n)}var Yu=Z_e,q_e=Array.isArray,ca=q_e;function J_e(n){return n!=null&&typeof n=="object"}var uc=J_e,exe=Yu,txe=ca,nxe=uc,rxe="[object String]";function ixe(n){return typeof n=="string"||!txe(n)&&nxe(n)&&exe(n)==rxe}var sxe=ixe;function oxe(n){return function(e,t,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var l=o[n?a:++i];if(t(s[l],l,s)===!1)break}return e}}var axe=oxe,lxe=axe,cxe=lxe(),Axe=cxe;function uxe(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=Mxe}var y2=Cxe,Txe=Yu,Ixe=y2,Rxe=uc,Uxe="[object Arguments]",Fxe="[object Array]",Pxe="[object Boolean]",Lxe="[object Date]",Dxe="[object Error]",Nxe="[object Function]",Oxe="[object Map]",kxe="[object Number]",Hxe="[object Object]",Qxe="[object RegExp]",zxe="[object Set]",Gxe="[object String]",Vxe="[object WeakMap]",jxe="[object ArrayBuffer]",Wxe="[object DataView]",Kxe="[object Float32Array]",Xxe="[object Float64Array]",Yxe="[object Int8Array]",$xe="[object Int16Array]",Zxe="[object Int32Array]",qxe="[object Uint8Array]",Jxe="[object Uint8ClampedArray]",e1e="[object Uint16Array]",t1e="[object Uint32Array]",Mn={};Mn[Kxe]=Mn[Xxe]=Mn[Yxe]=Mn[$xe]=Mn[Zxe]=Mn[qxe]=Mn[Jxe]=Mn[e1e]=Mn[t1e]=!0;Mn[Uxe]=Mn[Fxe]=Mn[jxe]=Mn[Pxe]=Mn[Wxe]=Mn[Lxe]=Mn[Dxe]=Mn[Nxe]=Mn[Oxe]=Mn[kxe]=Mn[Hxe]=Mn[Qxe]=Mn[zxe]=Mn[Gxe]=Mn[Vxe]=!1;function n1e(n){return Rxe(n)&&Ixe(n.length)&&!!Mn[Txe(n)]}var r1e=n1e;function i1e(n){return function(e){return n(e)}}var w2=i1e,ux={exports:{}};ux.exports;(function(n,e){var t=wV,r=e&&!e.nodeType&&e,i=r&&!0&&n&&!n.nodeType&&n,s=i&&i.exports===r,o=s&&t.process,a=function(){try{var l=i&&i.require&&i.require("util").types;return l||o&&o.binding&&o.binding("util")}catch{}}();n.exports=a})(ux,ux.exports);var _2=ux.exports,s1e=r1e,o1e=w2,F3=_2,P3=F3&&F3.isTypedArray,a1e=P3?o1e(P3):s1e,BV=a1e,l1e=fxe,c1e=bV,A1e=ca,u1e=v2,f1e=EV,h1e=BV,d1e=Object.prototype,p1e=d1e.hasOwnProperty;function m1e(n,e){var t=A1e(n),r=!t&&c1e(n),i=!t&&!r&&u1e(n),s=!t&&!r&&!i&&h1e(n),o=t||r||i||s,a=o?l1e(n.length,String):[],l=a.length;for(var c in n)(e||p1e.call(n,c))&&!(o&&(c=="length"||i&&(c=="offset"||c=="parent")||s&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||f1e(c,l)))&&a.push(c);return a}var SV=m1e,g1e=Object.prototype;function v1e(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||g1e;return n===t}var x2=v1e;function y1e(n,e){return function(t){return n(e(t))}}var MV=y1e,w1e=MV,_1e=w1e(Object.keys,Object),x1e=_1e,b1e=x2,E1e=x1e,B1e=Object.prototype,S1e=B1e.hasOwnProperty;function M1e(n){if(!b1e(n))return E1e(n);var e=[];for(var t in Object(n))S1e.call(n,t)&&t!="constructor"&&e.push(t);return e}var C1e=M1e;function T1e(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var tp=T1e,I1e=Yu,R1e=tp,U1e="[object AsyncFunction]",F1e="[object Function]",P1e="[object GeneratorFunction]",L1e="[object Proxy]";function D1e(n){if(!R1e(n))return!1;var e=I1e(n);return e==F1e||e==P1e||e==U1e||e==L1e}var CV=D1e,N1e=CV,O1e=y2;function k1e(n){return n!=null&&O1e(n.length)&&!N1e(n)}var P1=k1e,H1e=SV,Q1e=C1e,z1e=P1;function G1e(n){return z1e(n)?H1e(n):Q1e(n)}var T0=G1e,V1e=Axe,j1e=T0;function W1e(n,e){return n&&V1e(n,e,j1e)}var TV=W1e;function K1e(n){return n}var IV=K1e,X1e=IV;function Y1e(n){return typeof n=="function"?n:X1e}var $1e=Y1e,Z1e=TV,q1e=$1e;function J1e(n,e){return n&&Z1e(n,q1e(e))}var b2=J1e,ebe=MV,tbe=ebe(Object.getPrototypeOf,Object),E2=tbe,nbe=Yu,rbe=E2,ibe=uc,sbe="[object Object]",obe=Function.prototype,abe=Object.prototype,RV=obe.toString,lbe=abe.hasOwnProperty,cbe=RV.call(Object);function Abe(n){if(!ibe(n)||nbe(n)!=sbe)return!1;var e=rbe(n);if(e===null)return!0;var t=lbe.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&RV.call(t)==cbe}var ube=Abe;function fbe(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var Cbe=Mbe,Tbe=L1;function Ibe(n,e){var t=this.__data__,r=Tbe(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var Rbe=Ibe,Ube=dbe,Fbe=xbe,Pbe=Bbe,Lbe=Cbe,Dbe=Rbe;function np(n){var e=-1,t=n==null?0:n.length;for(this.clear();++ea))return!1;var c=s.get(n),A=s.get(e);if(c&&A)return c==e&&A==n;var u=-1,f=!0,h=t&XBe?new VBe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,OTe.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,DTe.default)(r)?(0,PTe.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,UTe.default)(r)&&t.push(r)}),t};M0.default=kTe;var I0={};function HTe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,oUe.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,iUe.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=aUe({},r[a],s[a])}),i}),r};I0.default=lUe;var R0={};Object.defineProperty(R0,"__esModule",{value:!0});R0.autoprefix=void 0;var cUe=b2,dk=uUe(cUe),AUe=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){vUe(i,r);function i(){var s,o,a,l;gUe(this,i);for(var c=arguments.length,A=Array(c),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){EUe(i,r);function i(){var s,o,a,l;bUe(this,i);for(var c=arguments.length,A=Array(c),u=0;u1&&arguments[1]!==void 0?arguments[1]:!0;r[o]=a};return e===0&&i("first-child"),e===t-1&&i("last-child"),(e===0||e%2===0)&&i("even"),Math.abs(e%2)===1&&i("odd"),i("nth-child",e),r};L2.default=SUe;Object.defineProperty(ao,"__esModule",{value:!0});ao.ReactCSS=ao.loop=ao.handleActive=D2=ao.handleHover=ao.hover=void 0;var MUe=M0,CUe=ap(MUe),TUe=I0,IUe=ap(TUe),RUe=R0,UUe=ap(RUe),FUe=U0,nj=ap(FUe),PUe=F0,LUe=ap(PUe),DUe=L2,NUe=ap(DUe);function ap(n){return n&&n.__esModule?n:{default:n}}ao.hover=nj.default;var D2=ao.handleHover=nj.default;ao.handleActive=LUe.default;ao.loop=NUe.default;var OUe=ao.ReactCSS=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;ia?f=1:f=Math.round(u*100/a)/100,t.a!==f)return{h:t.h,s:t.s,l:t.l,a:f,source:"rgb"}}else{var h=void 0;if(A<0?h=0:A>o?h=1:h=Math.round(A*100/o)/100,i!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}return null},uS={},HUe=function(e,t,r,i){if(typeof document>"u"&&!i)return null;var s=i?new i:document.createElement("canvas");s.width=r*2,s.height=r*2;var o=s.getContext("2d");return o?(o.fillStyle=e,o.fillRect(0,0,s.width,s.height),o.fillStyle=t,o.fillRect(0,0,r,r),o.translate(r,r),o.fillRect(0,0,r,r),s.toDataURL()):null},QUe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(uS[s])return uS[s];var o=HUe(e,t,r,i);return uS[s]=o,o},gk=Object.assign||function(n){for(var e=1;e-1},XUe=function(e){return Number(String(e).replace(/%/g,""))},YUe=1,Ht=function(n){GUe(e,n);function e(t){QUe(this,e);var r=zUe(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.handleBlur=function(){r.state.blurValue&&r.setState({value:r.state.blurValue,blurValue:null})},r.handleChange=function(i){r.setUpdatedValue(i.target.value,i)},r.handleKeyDown=function(i){var s=XUe(i.target.value);if(!isNaN(s)&&KUe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===tj?s+o:s-o;r.setUpdatedValue(a,i)}},r.handleDrag=function(i){if(r.props.dragLabel){var s=Math.round(r.props.value+i.movementX);s>=0&&s<=r.props.dragMax&&r.props.onChange&&r.props.onChange(r.getValueObjectWithLabel(s),i)}},r.handleMouseDown=function(i){r.props.dragLabel&&(i.preventDefault(),r.handleDrag(i),window.addEventListener("mousemove",r.handleDrag),window.addEventListener("mouseup",r.handleMouseUp))},r.handleMouseUp=function(){r.unbindEventListeners()},r.unbindEventListeners=function(){window.removeEventListener("mousemove",r.handleDrag),window.removeEventListener("mouseup",r.handleMouseUp)},r.state={value:String(t.value).toUpperCase(),blurValue:String(t.value).toUpperCase()},r.inputId="rc-editable-input-"+YUe++,r}return kUe(e,[{key:"componentDidUpdate",value:function(r,i){this.props.value!==this.state.value&&(r.value!==this.props.value||i.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(r){return HUe({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||VUe}},{key:"setUpdatedValue",value:function(r,i){var s=this.props.label?this.getValueObjectWithLabel(r):r;this.props.onChange&&this.props.onChange(s,i),this.setState({value:r})}},{key:"render",value:function(){var r=this,i=gt({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return q.createElement("div",{style:i.wrap},q.createElement("input",{id:this.inputId,style:i.input,ref:function(o){return r.input=o},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?q.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(xe.PureComponent||xe.Component),$Ue=function(e,t,r,i){var s=i.clientWidth,o=i.clientHeight,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=a-(i.getBoundingClientRect().left+window.pageXOffset),A=l-(i.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var u=void 0;if(A<0)u=359;else if(A>o)u=0;else{var f=-(A*100/o)+100;u=360*f/100}if(r.h!==u)return{h:u,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var h=void 0;if(c<0)h=0;else if(c>s)h=359;else{var d=c*100/s;h=360*d/100}if(r.h!==h)return{h,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},ZUe=function(){function n(e,t){for(var r=0;r-1},tFe=function(e){return Number(String(e).replace(/%/g,""))},nFe=1,Ht=function(n){$Ue(e,n);function e(t){XUe(this,e);var r=YUe(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));return r.handleBlur=function(){r.state.blurValue&&r.setState({value:r.state.blurValue,blurValue:null})},r.handleChange=function(i){r.setUpdatedValue(i.target.value,i)},r.handleKeyDown=function(i){var s=tFe(i.target.value);if(!isNaN(s)&&eFe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===rj?s+o:s-o;r.setUpdatedValue(a,i)}},r.handleDrag=function(i){if(r.props.dragLabel){var s=Math.round(r.props.value+i.movementX);s>=0&&s<=r.props.dragMax&&r.props.onChange&&r.props.onChange(r.getValueObjectWithLabel(s),i)}},r.handleMouseDown=function(i){r.props.dragLabel&&(i.preventDefault(),r.handleDrag(i),window.addEventListener("mousemove",r.handleDrag),window.addEventListener("mouseup",r.handleMouseUp))},r.handleMouseUp=function(){r.unbindEventListeners()},r.unbindEventListeners=function(){window.removeEventListener("mousemove",r.handleDrag),window.removeEventListener("mouseup",r.handleMouseUp)},r.state={value:String(t.value).toUpperCase(),blurValue:String(t.value).toUpperCase()},r.inputId="rc-editable-input-"+nFe++,r}return WUe(e,[{key:"componentDidUpdate",value:function(r,i){this.props.value!==this.state.value&&(r.value!==this.props.value||i.value!==this.state.value)&&(this.input===document.activeElement?this.setState({blurValue:String(this.props.value).toUpperCase()}):this.setState({value:String(this.props.value).toUpperCase(),blurValue:!this.state.blurValue&&String(this.props.value).toUpperCase()}))}},{key:"componentWillUnmount",value:function(){this.unbindEventListeners()}},{key:"getValueObjectWithLabel",value:function(r){return KUe({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||ZUe}},{key:"setUpdatedValue",value:function(r,i){var s=this.props.label?this.getValueObjectWithLabel(r):r;this.props.onChange&&this.props.onChange(s,i),this.setState({value:r})}},{key:"render",value:function(){var r=this,i=gt({default:{wrap:{position:"relative"}},"user-override":{wrap:this.props.style&&this.props.style.wrap?this.props.style.wrap:{},input:this.props.style&&this.props.style.input?this.props.style.input:{},label:this.props.style&&this.props.style.label?this.props.style.label:{}},"dragLabel-true":{label:{cursor:"ew-resize"}}},{"user-override":!0},this.props);return q.createElement("div",{style:i.wrap},q.createElement("input",{id:this.inputId,style:i.input,ref:function(o){return r.input=o},value:this.state.value,onKeyDown:this.handleKeyDown,onChange:this.handleChange,onBlur:this.handleBlur,placeholder:this.props.placeholder,spellCheck:"false"}),this.props.label&&!this.props.hideLabel?q.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(xe.PureComponent||xe.Component),rFe=function(e,t,r,i){var s=i.clientWidth,o=i.clientHeight,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=a-(i.getBoundingClientRect().left+window.pageXOffset),A=l-(i.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var u=void 0;if(A<0)u=359;else if(A>o)u=0;else{var f=-(A*100/o)+100;u=360*f/100}if(r.h!==u)return{h:u,s:r.s,l:r.l,a:r.a,source:"hsl"}}else{var h=void 0;if(c<0)h=0;else if(c>s)h=359;else{var d=c*100/s;h=360*d/100}if(r.h!==h)return{h,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},iFe=function(){function n(e,t){for(var r=0;r-1}function uFe(n,e){var t=this.__data__,r=H1(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function Ac(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1&&n%1==0&&n<=RPe}function cp(n){return n!=null&&k2(n.length)&&!D2(n)}function UPe(n){return xA(n)&&cp(n)}function FPe(){return!1}var fj=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Bk=fj&&typeof module=="object"&&module&&!module.nodeType&&module,PPe=Bk&&Bk.exports===fj,Sk=PPe?ca.Buffer:void 0,LPe=Sk?Sk.isBuffer:void 0,DPe=LPe||FPe;const px=DPe;var NPe="[object Object]",OPe=Function.prototype,kPe=Object.prototype,hj=OPe.toString,HPe=kPe.hasOwnProperty,QPe=hj.call(Object);function zPe(n){if(!xA(n)||Xu(n)!=NPe)return!1;var e=Aj(n);if(e===null)return!0;var t=HPe.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&hj.call(t)==QPe}var GPe="[object Arguments]",VPe="[object Array]",jPe="[object Boolean]",WPe="[object Date]",KPe="[object Error]",XPe="[object Function]",YPe="[object Map]",$Pe="[object Number]",ZPe="[object Object]",qPe="[object RegExp]",JPe="[object Set]",eLe="[object String]",tLe="[object WeakMap]",nLe="[object ArrayBuffer]",rLe="[object DataView]",iLe="[object Float32Array]",sLe="[object Float64Array]",oLe="[object Int8Array]",aLe="[object Int16Array]",lLe="[object Int32Array]",cLe="[object Uint8Array]",ALe="[object Uint8ClampedArray]",uLe="[object Uint16Array]",fLe="[object Uint32Array]",Cn={};Cn[iLe]=Cn[sLe]=Cn[oLe]=Cn[aLe]=Cn[lLe]=Cn[cLe]=Cn[ALe]=Cn[uLe]=Cn[fLe]=!0;Cn[GPe]=Cn[VPe]=Cn[nLe]=Cn[jPe]=Cn[rLe]=Cn[WPe]=Cn[KPe]=Cn[XPe]=Cn[YPe]=Cn[$Pe]=Cn[ZPe]=Cn[qPe]=Cn[JPe]=Cn[eLe]=Cn[tLe]=!1;function hLe(n){return xA(n)&&k2(n.length)&&!!Cn[Xu(n)]}function dLe(n){return function(e){return n(e)}}var dj=typeof exports=="object"&&exports&&!exports.nodeType&&exports,og=dj&&typeof module=="object"&&module&&!module.nodeType&&module,pLe=og&&og.exports===dj,AS=pLe&&sj.process,mLe=function(){try{var n=og&&og.require&&og.require("util").types;return n||AS&&AS.binding&&AS.binding("util")}catch{}}();const Mk=mLe;var Ck=Mk&&Mk.isTypedArray,gLe=Ck?dLe(Ck):hLe;const H2=gLe;function LT(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}var vLe=Object.prototype,yLe=vLe.hasOwnProperty;function wLe(n,e,t){var r=n[e];(!(yLe.call(n,e)&&U0(r,t))||t===void 0&&!(e in n))&&N2(n,e,t)}function _Le(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s-1&&n%1==0&&n0){if(++e>=OLe)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var zLe=QLe(NLe);const GLe=zLe;function VLe(n,e){return GLe(PLe(n,e,z1),n+"")}function jLe(n,e,t){if(!xo(t))return!1;var r=typeof e;return(r=="number"?cp(t)&&Q2(e,t.length):r=="string"&&e in t)?U0(t[e],n):!1}function WLe(n){return VLe(function(e,t){var r=-1,i=t.length,s=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(s=n.length>3&&typeof s=="function"?(i--,s):void 0,o&&jLe(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r=e||B<0||u&&M>=s}function p(){var b=uS();if(g(b))return v(b);a=setTimeout(p,m(b))}function v(b){return a=void 0,f&&r?h(b):(r=i=void 0,o)}function w(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function _(){return a===void 0?o:v(uS())}function x(){var b=uS(),B=g(b);if(r=arguments,i=this,l=b,B){if(a===void 0)return d(l);if(u)return clearTimeout(a),a=setTimeout(p,e),h(l)}return a===void 0&&(a=setTimeout(p,e)),o}return x.cancel=w,x.flush=_,x}var aDe="Expected a function";function lDe(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(aDe);return xo(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),vj(n,e,{leading:r,maxWait:e,trailing:i})}var cDe=function(e,t,r){var i=r.getBoundingClientRect(),s=i.width,o=i.height,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=a-(r.getBoundingClientRect().left+window.pageXOffset),A=l-(r.getBoundingClientRect().top+window.pageYOffset);c<0?c=0:c>s&&(c=s),A<0?A=0:A>o&&(A=o);var u=c/s,f=1-A/o;return{h:t.h,s:u,v:f,a:t.a,source:"hsv"}},ADe=function(){function n(e,t){for(var r=0;r-1}function vFe(n,e){var t=this.__data__,r=G1(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function fc(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1&&n%1==0&&n<=OPe}function Ap(n){return n!=null&&Q2(n.length)&&!O2(n)}function kPe(n){return EA(n)&&Ap(n)}function HPe(){return!1}var dj=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Mk=dj&&typeof module=="object"&&module&&!module.nodeType&&module,QPe=Mk&&Mk.exports===dj,Ck=QPe?Aa.Buffer:void 0,zPe=Ck?Ck.isBuffer:void 0,GPe=zPe||HPe;const gx=GPe;var VPe="[object Object]",jPe=Function.prototype,WPe=Object.prototype,pj=jPe.toString,KPe=WPe.hasOwnProperty,XPe=pj.call(Object);function YPe(n){if(!EA(n)||Zu(n)!=VPe)return!1;var e=fj(n);if(e===null)return!0;var t=KPe.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&pj.call(t)==XPe}var $Pe="[object Arguments]",ZPe="[object Array]",qPe="[object Boolean]",JPe="[object Date]",eLe="[object Error]",tLe="[object Function]",nLe="[object Map]",rLe="[object Number]",iLe="[object Object]",sLe="[object RegExp]",oLe="[object Set]",aLe="[object String]",lLe="[object WeakMap]",cLe="[object ArrayBuffer]",ALe="[object DataView]",uLe="[object Float32Array]",fLe="[object Float64Array]",hLe="[object Int8Array]",dLe="[object Int16Array]",pLe="[object Int32Array]",mLe="[object Uint8Array]",gLe="[object Uint8ClampedArray]",vLe="[object Uint16Array]",yLe="[object Uint32Array]",Cn={};Cn[uLe]=Cn[fLe]=Cn[hLe]=Cn[dLe]=Cn[pLe]=Cn[mLe]=Cn[gLe]=Cn[vLe]=Cn[yLe]=!0;Cn[$Pe]=Cn[ZPe]=Cn[cLe]=Cn[qPe]=Cn[ALe]=Cn[JPe]=Cn[eLe]=Cn[tLe]=Cn[nLe]=Cn[rLe]=Cn[iLe]=Cn[sLe]=Cn[oLe]=Cn[aLe]=Cn[lLe]=!1;function wLe(n){return EA(n)&&Q2(n.length)&&!!Cn[Zu(n)]}function _Le(n){return function(e){return n(e)}}var mj=typeof exports=="object"&&exports&&!exports.nodeType&&exports,ag=mj&&typeof module=="object"&&module&&!module.nodeType&&module,xLe=ag&&ag.exports===mj,hS=xLe&&aj.process,bLe=function(){try{var n=ag&&ag.require&&ag.require("util").types;return n||hS&&hS.binding&&hS.binding("util")}catch{}}();const Tk=bLe;var Ik=Tk&&Tk.isTypedArray,ELe=Ik?_Le(Ik):wLe;const z2=ELe;function OT(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}var BLe=Object.prototype,SLe=BLe.hasOwnProperty;function MLe(n,e,t){var r=n[e];(!(SLe.call(n,e)&&P0(r,t))||t===void 0&&!(e in n))&&k2(n,e,t)}function CLe(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s-1&&n%1==0&&n0){if(++e>=jLe)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var YLe=XLe(VLe);const $Le=YLe;function ZLe(n,e){return $Le(QLe(n,e,j1),n+"")}function qLe(n,e,t){if(!bo(t))return!1;var r=typeof e;return(r=="number"?Ap(t)&&G2(e,t.length):r=="string"&&e in t)?P0(t[e],n):!1}function JLe(n){return ZLe(function(e,t){var r=-1,i=t.length,s=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(s=n.length>3&&typeof s=="function"?(i--,s):void 0,o&&qLe(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r=e||B<0||u&&S>=s}function p(){var b=dS();if(g(b))return v(b);a=setTimeout(p,m(b))}function v(b){return a=void 0,f&&r?h(b):(r=i=void 0,o)}function w(){a!==void 0&&clearTimeout(a),c=0,r=l=i=a=void 0}function _(){return a===void 0?o:v(dS())}function x(){var b=dS(),B=g(b);if(r=arguments,i=this,l=b,B){if(a===void 0)return d(l);if(u)return clearTimeout(a),a=setTimeout(p,e),h(l)}return a===void 0&&(a=setTimeout(p,e)),o}return x.cancel=w,x.flush=_,x}var dDe="Expected a function";function pDe(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(dDe);return bo(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),wj(n,e,{leading:r,maxWait:e,trailing:i})}var mDe=function(e,t,r){var i=r.getBoundingClientRect(),s=i.width,o=i.height,a=typeof e.pageX=="number"?e.pageX:e.touches[0].pageX,l=typeof e.pageY=="number"?e.pageY:e.touches[0].pageY,c=a-(r.getBoundingClientRect().left+window.pageXOffset),A=l-(r.getBoundingClientRect().top+window.pageYOffset);c<0?c=0:c>s&&(c=s),A<0?A=0:A>o&&(A=o);var u=c/s,f=1-A/o;return{h:t.h,s:u,v:f,a:t.a,source:"hsv"}},gDe=function(){function n(e,t){for(var r=0;r=0,s=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return st(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(LDe,arguments)},brighten:function(){return this._applyModification(DDe,arguments)},darken:function(){return this._applyModification(NDe,arguments)},desaturate:function(){return this._applyModification(UDe,arguments)},saturate:function(){return this._applyModification(FDe,arguments)},greyscale:function(){return this._applyModification(PDe,arguments)},spin:function(){return this._applyModification(ODe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(QDe,arguments)},complement:function(){return this._applyCombination(kDe,arguments)},monochromatic:function(){return this._applyCombination(zDe,arguments)},splitcomplement:function(){return this._applyCombination(HDe,arguments)},triad:function(){return this._applyCombination(Dk,[3])},tetrad:function(){return this._applyCombination(Dk,[4])}};st.fromRatio=function(n,e){if(mx(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Pm(n[r]));n=t}return st(n,e)};function MDe(n){var e={r:0,g:0,b:0},t=1,r=null,i=null,s=null,o=!1,a=!1;return typeof n=="string"&&(n=KDe(n)),mx(n)=="object"&&(wl(n.r)&&wl(n.g)&&wl(n.b)?(e=CDe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):wl(n.h)&&wl(n.s)&&wl(n.v)?(r=Pm(n.s),i=Pm(n.v),e=IDe(n.h,r,i),o=!0,a="hsv"):wl(n.h)&&wl(n.s)&&wl(n.l)&&(r=Pm(n.s),s=Pm(n.l),e=TDe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=wj(t),{ok:o,format:n.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function CDe(n,e,t){return{r:Ln(n,255)*255,g:Ln(e,255)*255,b:Ln(t,255)*255}}function Uk(n,e,t){n=Ln(n,255),e=Ln(e,255),t=Ln(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=(r+i)/2;if(r==i)s=o=0;else{var l=r-i;switch(o=a>.5?l/(2-r-i):l/(r+i),r){case n:s=(e-t)/l+(e1&&(u-=1),u<1/6?c+(A-c)*6*u:u<1/2?A:u<2/3?c+(A-c)*(2/3-u)*6:c}if(e===0)r=i=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=o(l,a,n+1/3),i=o(l,a,n),s=o(l,a,n-1/3)}return{r:r*255,g:i*255,b:s*255}}function Fk(n,e,t){n=Ln(n,255),e=Ln(e,255),t=Ln(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=r,l=r-i;if(o=r===0?0:l/r,r==i)s=0;else{switch(r){case n:s=(e-t)/l+(e>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(st(r));return s}function zDe(n,e){e=e||6;for(var t=st(n).toHsv(),r=t.h,i=t.s,s=t.v,o=[],a=1/e;e--;)o.push(st({h:r,s:i,v:s})),s=(s+a)%1;return o}st.mix=function(n,e,t){t=t===0?0:t||50;var r=st(n).toRgb(),i=st(e).toRgb(),s=t/100,o={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return st(o)};st.readability=function(n,e){var t=st(n),r=st(e);return(Math.max(t.getLuminance(),r.getLuminance())+.05)/(Math.min(t.getLuminance(),r.getLuminance())+.05)};st.isReadable=function(n,e,t){var r=st.readability(n,e),i,s;switch(s=!1,i=XDe(t),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};st.mostReadable=function(n,e,t){var r=null,i=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;ci&&(i=s,r=st(e[c]));return st.isReadable(n,r,{level:a,size:l})||!o?r:(t.includeFallbackColors=!1,st.mostReadable(n,["#fff","#000"],t))};var DT=st.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},GDe=st.hexNames=VDe(DT);function VDe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function wj(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function Ln(n,e){jDe(n)&&(n="100%");var t=WDe(n);return n=Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(n*e,10)/100),Math.abs(n-e)<1e-6?1:n%e/parseFloat(e)}function j1(n){return Math.min(1,Math.max(0,n))}function gs(n){return parseInt(n,16)}function jDe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function WDe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function qo(n){return n.length==1?"0"+n:""+n}function Pm(n){return n<=1&&(n=n*100+"%"),n}function _j(n){return Math.round(parseFloat(n)*255).toString(16)}function Nk(n){return gs(n)/255}var Qo=function(){var n="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+n+")",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function wl(n){return!!Qo.CSS_UNIT.exec(n)}function KDe(n){n=n.replace(BDe,"").replace(SDe,"").toLowerCase();var e=!1;if(DT[n])n=DT[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=Qo.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=Qo.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=Qo.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=Qo.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=Qo.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=Qo.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=Qo.hex8.exec(n))?{r:gs(t[1]),g:gs(t[2]),b:gs(t[3]),a:Nk(t[4]),format:e?"name":"hex8"}:(t=Qo.hex6.exec(n))?{r:gs(t[1]),g:gs(t[2]),b:gs(t[3]),format:e?"name":"hex"}:(t=Qo.hex4.exec(n))?{r:gs(t[1]+""+t[1]),g:gs(t[2]+""+t[2]),b:gs(t[3]+""+t[3]),a:Nk(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=Qo.hex3.exec(n))?{r:gs(t[1]+""+t[1]),g:gs(t[2]+""+t[2]),b:gs(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function XDe(n){var e,t;return n=n||{level:"AA",size:"small"},e=(n.level||"AA").toUpperCase(),t=(n.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var Ok=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return EDe(t,function(s){if(e[s]&&(r+=1,isNaN(e[s])||(i+=1),s==="s"||s==="l")){var o=/^\d+%$/;o.test(e[s])&&(i+=1)}}),r===i?e:!1},Lm=function(e,t){var r=e.hex?st(e.hex):st(e),i=r.toHsl(),s=r.toHsv(),o=r.toRgb(),a=r.toHex();i.s===0&&(i.h=t||0,s.h=t||0);var l=a==="000000"&&o.a===0;return{hsl:i,hex:l?"transparent":"#"+a,rgb:o,hsv:s,oldHue:e.h||t||i.h,source:e.source}},RA=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&st(e).isValid()},G2=function(e){if(!e)return"#fff";var t=Lm(e);if(t.hex==="transparent")return"rgba(0,0,0,0.4)";var r=(t.rgb.r*299+t.rgb.g*587+t.rgb.b*114)/1e3;return r>=128?"#000":"#fff"},fS=function(e,t){var r=e.replace("°","");return st(t+" ("+r+")")._ok},cm=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){nNe(i,r);function i(){var s,o,a,l;tNe(this,i);for(var c=arguments.length,A=Array(c),u=0;ua))return!1;var c=s.get(n),A=s.get(e);if(c&&A)return c==e&&A==n;var u=-1,f=!0,h=t&dNe?new gx:void 0;for(s.set(n,e),s.set(e,n);++u=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Hy=24,DOe=Rj.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Hy:r,s=n.height,o=s===void 0?Hy:s,a=n.style,l=a===void 0?{}:a,c=LOe(n,["fill","width","height","style"]);return r4.default.createElement("svg",n4({viewBox:"0 0 "+Hy+" "+Hy,style:n4({fill:t,width:i,height:o},l)},c),r4.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},NOe=function(){function n(e,t){for(var r=0;r1&&(i.a=1),r.props.onChange({h:r.props.hsl.h,s:r.props.hsl.s,l:r.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},s)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),r.props.onChange({h:i.h||r.props.hsl.h,s:Number(t4(i.s)?r.props.hsl.s:i.s),l:Number(t4(i.l)?r.props.hsl.l:i.l),source:"hsl"},s))},r.showHighlight=function(i){i.currentTarget.style.background="#eee"},r.hideHighlight=function(i){i.currentTarget.style.background="transparent"},t.hsl.a!==1&&t.view==="hex"?r.state={view:"rgb"}:r.state={view:t.view},r}return NOe(e,[{key:"render",value:function(){var r=this,i=gt({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),s=void 0;return this.state.view==="hex"?s=q.createElement("div",{style:i.fields,className:"flexbox-fix"},q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=q.createElement("div",{style:i.fields,className:"flexbox-fix"},q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),q.createElement("div",{style:i.alpha},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=q.createElement("div",{style:i.fields,className:"flexbox-fix"},q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),q.createElement("div",{style:i.alpha},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),q.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,q.createElement("div",{style:i.toggle},q.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},q.createElement(DOe,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),e}(q.Component);Uj.defaultProps={view:"hex"};var i4=function(){var e=gt({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return q.createElement("div",{style:e.picker})},QOe=function(){var e=gt({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return q.createElement("div",{style:e.picker})},Y2=function(e){var t=e.width,r=e.onChange,i=e.disableAlpha,s=e.rgb,o=e.hsl,a=e.hsv,l=e.hex,c=e.renderers,A=e.styles,u=A===void 0?{}:A,f=e.className,h=f===void 0?"":f,d=e.defaultView,m=gt(As({default:{picker:{width:t,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+s.r+", "+s.g+", "+s.b+", "+s.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},u),{disableAlpha:i});return q.createElement("div",{style:m.picker,className:"chrome-picker "+h},q.createElement("div",{style:m.saturation},q.createElement(V1,{style:m.Saturation,hsl:o,hsv:a,pointer:QOe,onChange:r})),q.createElement("div",{style:m.body},q.createElement("div",{style:m.controls,className:"flexbox-fix"},q.createElement("div",{style:m.color},q.createElement("div",{style:m.swatch},q.createElement("div",{style:m.active}),q.createElement(ap,{renderers:c}))),q.createElement("div",{style:m.toggles},q.createElement("div",{style:m.hue},q.createElement(lp,{style:m.Hue,hsl:o,pointer:i4,onChange:r})),q.createElement("div",{style:m.alpha},q.createElement(L2,{style:m.Alpha,rgb:s,hsl:o,pointer:i4,renderers:c,onChange:r})))),q.createElement(Uj,{rgb:s,hsl:o,hex:l,view:d,onChange:r,disableAlpha:i})))};Y2.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),disableAlpha:Ge.bool,styles:Ge.object,defaultView:Ge.oneOf(["hex","rgb","hsl"])};Y2.defaultProps={width:225,disableAlpha:!1,styles:{}};const zOe=us(Y2);var GOe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=gt({default:{color:{background:t,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:G2(t),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:o,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return q.createElement(Zu,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},q.createElement("div",{style:a.dot}))},VOe=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=gt({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:t},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),o=function(l,c){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},c):i({hex:l.hex,source:"hex"},c)};return q.createElement("div",{style:s.fields,className:"flexbox-fix"},q.createElement("div",{style:s.active}),q.createElement(Ht,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),q.createElement(Ht,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),q.createElement(Ht,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),q.createElement(Ht,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},$2=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.colors,s=e.hex,o=e.rgb,a=e.styles,l=a===void 0?{}:a,c=e.className,A=c===void 0?"":c,u=gt(As({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),f=function(d,m){d.hex?RA(d.hex)&&t({hex:d.hex,source:"hex"},m):t(d,m)};return q.createElement(F0,{style:u.Compact,styles:l},q.createElement("div",{style:u.compact,className:"compact-picker "+A},q.createElement("div",null,qu(i,function(h){return q.createElement(GOe,{key:h,color:h,active:h.toLowerCase()===s,onClick:f,onSwatchHover:r})}),q.createElement("div",{style:u.clear})),q.createElement(VOe,{hex:s,rgb:o,onChange:f})))};$2.propTypes={colors:Ge.arrayOf(Ge.string),styles:Ge.object};$2.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};us($2);var jOe=function(e){var t=e.hover,r=e.color,i=e.onClick,s=e.onSwatchHover,o={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},a=gt({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return q.createElement("div",{style:a.swatch},q.createElement(Zu,{color:r,onClick:i,onHover:s,focusStyle:o}))};const WOe=P2(jOe);var Z2=function(e){var t=e.width,r=e.colors,i=e.onChange,s=e.onSwatchHover,o=e.triangle,a=e.styles,l=a===void 0?{}:a,c=e.className,A=c===void 0?"":c,u=gt(As({default:{card:{width:t,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},l),{"hide-triangle":o==="hide","top-left-triangle":o==="top-left","top-right-triangle":o==="top-right","bottom-left-triangle":o==="bottom-left","bottom-right-triangle":o==="bottom-right"}),f=function(d,m){return i({hex:d,source:"hex"},m)};return q.createElement("div",{style:u.card,className:"github-picker "+A},q.createElement("div",{style:u.triangleShadow}),q.createElement("div",{style:u.triangle}),qu(r,function(h){return q.createElement(WOe,{color:h,key:h,onClick:f,onSwatchHover:s})}))};Z2.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),colors:Ge.arrayOf(Ge.string),triangle:Ge.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Ge.object};Z2.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};us(Z2);var KOe=function(e){var t=e.direction,r=gt({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:t==="vertical"});return q.createElement("div",{style:r.picker})},XOe=Object.assign||function(n){for(var e=1;e.5});return q.createElement("div",{style:r.picker})},qOe=function(){var e=gt({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return q.createElement("div",{style:e.pointer},q.createElement("div",{style:e.left},q.createElement("div",{style:e.leftInside})),q.createElement("div",{style:e.right},q.createElement("div",{style:e.rightInside})))},s4=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=gt({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:s});return q.createElement("div",{style:o.button,onClick:t},r||i)},JOe=function(e){var t=e.rgb,r=e.currentColor,i=gt({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+t.r+","+t.g+", "+t.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:r,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return q.createElement("div",null,q.createElement("div",{style:i.label},"new"),q.createElement("div",{style:i.swatches},q.createElement("div",{style:i.new}),q.createElement("div",{style:i.current})),q.createElement("div",{style:i.label},"current"))},e3e=function(){function n(e,t){for(var r=0;r100&&(A.a=100),A.a/=100,t({h:i.h,s:i.s,l:i.l,a:A.a,source:"rgb"},u))};return q.createElement("div",{style:a.fields,className:"flexbox-fix"},q.createElement("div",{style:a.double},q.createElement(Ht,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),q.createElement("div",{style:a.single},q.createElement(Ht,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),q.createElement("div",{style:a.single},q.createElement(Ht,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),q.createElement("div",{style:a.single},q.createElement(Ht,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),q.createElement("div",{style:a.alpha},q.createElement(Ht,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},s3e=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Qy=24,f3e=Pj.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Qy:r,s=n.height,o=s===void 0?Qy:s,a=n.style,l=a===void 0?{}:a,c=u3e(n,["fill","width","height","style"]);return a4.default.createElement("svg",o4({viewBox:"0 0 "+Qy+" "+Qy,style:o4({fill:t,width:i,height:o},l)},c),a4.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},h3e=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.first,a=e.last,l=e.active,c=gt({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:G2(t),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:o,last:a,active:l,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return q.createElement(Zu,{color:t,style:c.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},q.createElement("div",{style:c.check},q.createElement(f3e,null)))},d3e=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=gt({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return q.createElement("div",{style:o.group},qu(i,function(a,l){return q.createElement(h3e,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},nU=function(e){var t=e.width,r=e.height,i=e.onChange,s=e.onSwatchHover,o=e.colors,a=e.hex,l=e.styles,c=l===void 0?{}:l,A=e.className,u=A===void 0?"":A,f=gt(As({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},c)),h=function(m,g){return i({hex:m,source:"hex"},g)};return q.createElement("div",{style:f.picker,className:"swatches-picker "+u},q.createElement(F0,null,q.createElement("div",{style:f.overflow},q.createElement("div",{style:f.body},qu(o,function(d){return q.createElement(d3e,{key:d.toString(),group:d,active:a,onClick:h,onSwatchHover:s})}),q.createElement("div",{style:f.clear})))))};nU.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),height:Ge.oneOfType([Ge.string,Ge.number]),colors:Ge.arrayOf(Ge.arrayOf(Ge.string)),styles:Ge.object};nU.defaultProps={width:320,height:240,colors:[[Kf[900],Kf[700],Kf[500],Kf[300],Kf[100]],[Xf[900],Xf[700],Xf[500],Xf[300],Xf[100]],[Yf[900],Yf[700],Yf[500],Yf[300],Yf[100]],[$f[900],$f[700],$f[500],$f[300],$f[100]],[Zf[900],Zf[700],Zf[500],Zf[300],Zf[100]],[qf[900],qf[700],qf[500],qf[300],qf[100]],[Jf[900],Jf[700],Jf[500],Jf[300],Jf[100]],[eh[900],eh[700],eh[500],eh[300],eh[100]],[th[900],th[700],th[500],th[300],th[100]],["#194D33",Dm[700],Dm[500],Dm[300],Dm[100]],[nh[900],nh[700],nh[500],nh[300],nh[100]],[rh[900],rh[700],rh[500],rh[300],rh[100]],[ih[900],ih[700],ih[500],ih[300],ih[100]],[sh[900],sh[700],sh[500],sh[300],sh[100]],[oh[900],oh[700],oh[500],oh[300],oh[100]],[ah[900],ah[700],ah[500],ah[300],ah[100]],[lh[900],lh[700],lh[500],lh[300],lh[100]],[ch[900],ch[700],ch[500],ch[300],ch[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};us(nU);var rU=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.hex,s=e.colors,o=e.width,a=e.triangle,l=e.styles,c=l===void 0?{}:l,A=e.className,u=A===void 0?"":A,f=gt(As({default:{card:{width:o,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},c),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right"}),h=function(m,g){RA(m)&&t({hex:m,source:"hex"},g)};return q.createElement("div",{style:f.card,className:"twitter-picker "+u},q.createElement("div",{style:f.triangleShadow}),q.createElement("div",{style:f.triangle}),q.createElement("div",{style:f.body},qu(s,function(d,m){return q.createElement(Zu,{key:m,color:d,hex:d,style:f.swatch,onClick:h,onHover:r,focusStyle:{boxShadow:"0 0 4px "+d}})}),q.createElement("div",{style:f.hash},"#"),q.createElement(Ht,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:h}),q.createElement("div",{style:f.clear})))};rU.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),triangle:Ge.oneOf(["hide","top-left","top-right"]),colors:Ge.arrayOf(Ge.string),styles:Ge.object};rU.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};us(rU);var iU=function(e){var t=gt({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return q.createElement("div",{style:t.picker})};iU.propTypes={hsl:Ge.shape({h:Ge.number,s:Ge.number,l:Ge.number,a:Ge.number})};iU.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var sU=function(e){var t=gt({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return q.createElement("div",{style:t.picker})};sU.propTypes={hsl:Ge.shape({h:Ge.number,s:Ge.number,l:Ge.number,a:Ge.number})};sU.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var p3e=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(h,d){if(h.hex)RA(h.hex)&&t({hex:h.hex,source:"hex"},d);else if(h.rgb){var m=h.rgb.split(",");fS(h.rgb,"rgb")&&t({r:m[0],g:m[1],b:m[2],a:1,source:"rgb"},d)}else if(h.hsv){var g=h.hsv.split(",");fS(h.hsv,"hsv")&&(g[2]=g[2].replace("%",""),g[1]=g[1].replace("%",""),g[0]=g[0].replace("°",""),g[1]==1?g[1]=.01:g[2]==1&&(g[2]=.01),t({h:Number(g[0]),s:Number(g[1]),v:Number(g[2]),source:"hsv"},d))}else if(h.hsl){var p=h.hsl.split(",");fS(h.hsl,"hsl")&&(p[2]=p[2].replace("%",""),p[1]=p[1].replace("%",""),p[0]=p[0].replace("°",""),u[1]==1?u[1]=.01:u[2]==1&&(u[2]=.01),t({h:Number(p[0]),s:Number(p[1]),v:Number(p[2]),source:"hsl"},d))}},l=gt({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),c=r.r+", "+r.g+", "+r.b,A=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",u=Math.round(o.h)+"°, "+Math.round(o.s*100)+"%, "+Math.round(o.v*100)+"%";return q.createElement("div",{style:l.wrap,className:"flexbox-fix"},q.createElement("div",{style:l.fields},q.createElement("div",{style:l.double},q.createElement(Ht,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),q.createElement("div",{style:l.column},q.createElement("div",{style:l.single},q.createElement(Ht,{style:{input:l.input2,label:l.label2},label:"rgb",value:c,onChange:a})),q.createElement("div",{style:l.single},q.createElement(Ht,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),q.createElement("div",{style:l.single},q.createElement(Ht,{style:{input:l.input2,label:l.label2},label:"hsl",value:A,onChange:a})))))},oU=function(e){var t=e.width,r=e.onChange,i=e.rgb,s=e.hsl,o=e.hsv,a=e.hex,l=e.header,c=e.styles,A=c===void 0?{}:c,u=e.className,f=u===void 0?"":u,h=gt(As({default:{picker:{width:t,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},A));return q.createElement("div",{style:h.picker,className:"google-picker "+f},q.createElement("div",{style:h.head},l),q.createElement("div",{style:h.swatch}),q.createElement("div",{style:h.saturation},q.createElement(V1,{hsl:s,hsv:o,pointer:iU,onChange:r})),q.createElement("div",{style:h.body},q.createElement("div",{style:h.controls,className:"flexbox-fix"},q.createElement("div",{style:h.hue},q.createElement(lp,{style:h.Hue,hsl:s,radius:"4px",pointer:sU,onChange:r}))),q.createElement(p3e,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};oU.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),styles:Ge.object,header:Ge.string};oU.defaultProps={width:652,styles:{},header:"Color picker"};us(oU);const m3e="_InformationContainerPos_1yd4c_2",g3e="_scrollContainer_1yd4c_15",dS={InformationContainerPos:m3e,scrollContainer:g3e,"options-container":"_options-container_1yd4c_24"},v3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAABE5AAAROQEb2ZNGAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmU1ZTg4ZDczLWQ3YmItNjg0NS1iNDkxLWYxZTU0YmRhZDE1MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmFhMDRkN2Y4LWVjNjQtZTg0ZC1iMjQzLWQ4ZjRhMjVlN2YzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozNzgwNzA3Yy0zNDg5LTAzNDctYmEwNy1kOTFhY2ZkYmUwODYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MjQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ZTVlODhkNzMtZDdiYi02ODQ1LWI0OTEtZjFlNTRiZGFkMTUyIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjQ3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+okruHwAAA6NJREFUeNrt279LG2EYwHG1CCqKPwKOJQU3cXYqXZ0KofgPuBWcUmsgoouCFArS0UXaWUpTFxHcUnE4cO6fULoUbWnTFk2ftz4p19BoLve+d33vvsN3KWre97lPUvPm7Gs2m32U3xgCABgCAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABABnlV5VR6QH0mOpIq229VSacPj4E/oY7Y9b0TWZtY0AwO7Qp6WH0q70XrqSmh1qSLMO1zKrj9Hp8a90jbu65mkAxBv4svRR+nHD0MOZr5t3uJ75iGsxa18GQPRBl6Sgy0GHu5QWHa5rUR8j6rrMXkoAuH3Ag9KLHgYcbsfh+nZirs3sbRAA/x5uQXrb4zMs3AdpyMH6hvRnx1nbpe6xAIC/hzssHcUcbrjnUr/F9fXrz7S1PrPXYQBcD3dKemdxuKZP0pzFNc7pz7S5RrPnqVwDkAGMSTXLg211auNtmL4NPXW0RrP3sVwC0EOVwNFgW9XjPMv01anueI2By8Or/xKAbHhSeuN4sK3OpPvSQIT1Dej3nCW0RjOLyVwA0Jf9IKHBhk8IX0vFLtZX1K9tJLzGII3/DtJ4q1dLeLDhvkjH0jNpSXqkLem/HevXpLW+WtJvEZP+IKee4nB9qZ7kB0pJPvOPuLiRzgkKmQCgz/xDLmrkDpN4JUjikOeEi9lzJ64Pi1wDOOAixu7AZwBVLmDsqr7/DrAhfeVCRs7MbCMr7wLWuKCRW8vaOYC5cfIbF/bWzIwqWT0J3LRww0eWM7PZzPpnAeUUztl9yMyknJdPA7el71z0P5lZbOftfgDzSvCTi/97BuW83hG0lfNfDM3et/J+T+BKjgGscFfwNYL1DodF+yl/Pm/j/oP9Doc869wVfPNh0Z50Vzr3GMC57mEvjUMeH/8yqKJvh15Ko9I96cJjABe6h1HdUyPJQx4fAdyRFtruz/MdQDG0nwWzRwB0DyJTAPjjUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAhgDMSJ89BmDWPgOA3gGMS0+kVU8zax8HAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIACQlX4BjeT0VuSSEBUAAAAASUVORK5CYII=",y3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4MDc2OWJhLTIwNzQtMjU0Zi1iNjM5LWJiZjEyMTFlMjljNSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmMxMzRkOGNhLTVlMWUtYzM0Yy05ZmM0LTNlZTgyNGQ1YTVhYyIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo4NzUzMzYxZC05NmIzLTgwNDctYTA0ZC0wODcxYmNiNzY4MDAiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6Mjk6NTctMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MDgwNzY5YmEtMjA3NC0yNTRmLWI2MzktYmJmMTIxMWUyOWM1IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjE4LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Yrc/VQAAAzxJREFUeNrt3b9LFnEcwHE3IW1oiUCF/gCXcgibmhyaDEqnWhoCaRXqUQhByKVVXAqsMbQyGgIHA6GhSdpNc7E/IBehp8/h94ErRLzoOc671/Ce7/O572t4/PHc9bTb7R41NzcBADcBAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAinVrudUfPY92o+0ut5uu1Q9AtQCsRe2SWgMAAAAAAAAAAEo/7KHoWnQl12i0USKAjXTN/AzZTEMAdB/AQvQjfRrvtBMdlAjgIF0zP0M20wIA3QewVOJBF20JAAAAAACAbgJYrDCARQD+30EPRjei66nsU/fVaLXCAFbTjKO5ubMdBgEoDuBR9Cv6+VeHFQZweMy82Q6PACgOYLbCB120WQCKA5ipEYAZAAAAoCCAxzUC8BiAk3+3fzeajCZSN6OXNQLwMu3U2W8y7TwEwNENaTe0CQCWW7cbDOA2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACcWQB3GgzgDgDLrbHoa/Ql1+foe40O+nvaKb9jtvMYAMutc9Hl9C3hTgPR0xoBeJp2yu+Y7XzO8wE8IAIAAAAAAABPCQPgTwD3ok/Req6P0V6FD3ovzZifOdvhHgD/9hKI7JPzpVwXoxcVBvAizZifeaDKL5fwsGgPiwYAAAAAAACAswJgKnqf3tzV6W20X+JB76dr5mfIZpoCoPsAeqPz6aeETheiDyUC+JCumZ8hm6kXAO8NBAAAAAAAoFQAfdG7EgFk1+oDoLuHOhI9jB6covvRVokAttI1TzNbtsMIAMUBPKnRXwOfAOD/AQAAAAAAACj04si6APDiyBMOejh6Fs3naqX/pqkLgPW0U37HbOdhAI7eoNXUbwZNAuC7gQAAAAAADQYw3mAA440BkD7svYlWotepV9FmgwFspnvQuR8r6R5N1hHAfIMPumjzdQQw52BP3RwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA2QQwHe1E36JtHdu3dI+mfTVMAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAAV7DcOsgfgT8DmTAAAAABJRU5ErkJggg==",w3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjJkMTY5MDdlLWQyY2EtZDA0Mi05MWRjLTliZTMyYzYyYjlmOSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjAzNmQ1YTFjLWM5NjAtMDE0OS04OWQwLTQ3NDQ0MzAzZDI1ZCIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo2N2JiZmQ0OC0yMGMzLTI0NDktODQyNS1kNWJmOTBlNzMwYjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MTQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MmQxNjkwN2UtZDJjYS1kMDQyLTkxZGMtOWJlMzJjNjJiOWY5IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMzOjExLTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Q6I0lAAAAs1JREFUeNrt3TtrFFEYgOFE2HjFXgv9AyIYsbATMaAWQtqAYBPQ0ibCgoSA/yGbwsJ/o6Ag3gMWEkurTeGlcfwGzoIs7LKT3TXOOU/xFlnYkNnvIRNOZs4sVFW1oHLzIQDgQwBAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAiVt91l2OXkRVi3oTXQVg+uHfjX60bPiDfkUPADj48C+2ePh/dx2AgwF4ncHw695HHQCaA6gy6hYAZQPYAqBsANsAlA1gBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAogDE14tRt359RL3ocbQSLQGQH4Aj0bsJ31tfF3EDgPwAvGzw/t/ROgDlAhhcY7gMQLkABpeXnQSgXAB1mwCUDeAjAGUD6ANQNoB9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOCQ6wFQNoAnQ8fWiXYBKAfAnaFjOxXtATAewIdMhv85Ojp0bGfqq3sBGA/gcrodKrt9guO11Sm+XxkA0gd1P90Y2dbhb4w4rm8ATI5gpYVbx+8On/eHHoJRAdAMwVJ9j3zaNKE3ZmOFw6z+uTaj29HxEcdxLvoKQIHVd/XW9/XN4LcLAC0c/vno04xOLwC0bPj3oi8z/PsCgIYDWExLr/+iTlrkORutTbHYA8AMAXTTuvu8e5XO8XtTLPIAMAcATzNbVgagIYAdAAAAAAAAAAAAAADKA7CdGYA+AM0AbGUG4C0AzQDczAzABgDNAHTSHrs5DL9ebTwGQHME1zIY/vfoQjG7hc8BwXr0s8XDXyvqeQFzQnClhZeXPY8uFffEkDkiOB09ShDq/9rt/4f10/n+YXSiyGcGqfCnhgkAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAAaBp+gMB5Yr6zMTlPAAAAABJRU5ErkJggg==",_3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmFmYmE3YzFhLWI0MTMtMGQ0MS05YmRkLTE2ZGY2MTllOTgyMSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjkxMWMyNDQ0LTUzYzgtYjU0OC1iZjBmLTczZWE4ZmU5NWYzZSIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmNjZhMzQ1Ni02ODczLWQ5NDYtOTRkMy1mZTYwZjQ5NzliNjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6NDQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6YWZiYTdjMWEtYjQxMy0wZDQxLTliZGQtMTZkZjYxOWU5ODIxIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjI2LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+F7DBkwAABCVJREFUeNrt3TtMFEEYwHHuAiYkNjRg74mJpSYUkCiGAhKxsLKXggQ6yi2wQUh8RMCGRJulEgotjgLwVaCVDYYeHzQaKU5FCRo4vwnfRdQgHvu4mZ1/8W/Iec7c/u7gdmd368rlch35Gy8CAHgRAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAJLpUhjkpW5pQfoolaRPjlXSsZs59Jg5AeDgDZ+T2qRFaUcqZyQzl0c6txwA9n/X9+m7ppzR1nWOeQD8DaBD+pzhjV/JzLEDAL9v/JPSmgcbv5KZaysAfv3ev+PRxq80acPfAzYAKEgrHgIwcy4AIAwGpS8eAjBzHgBAGEx7uPErhQAIg6LHAIoACIM5jwHMAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIuA3pjbYBgOwDMOvyNqUZ6azUuGcMjfqz+/qYHQBkC8BXaUI6/p/rE8b13wAgAwB+SOel+irGVC91St8B4DYAs8K4J8LYehJepQyAhAEMVfPO3+eTYAgAbgJYinGMSwBwC8A36VyMY+zU5wSAIwCWpeYYx9gsvQKAOwAe7P2eH8MYzX6ChwBwB8DtOE+60PMWxwHgDoCRBMY5AgB3AIzHeQaufgJMAIC/AQDg8beAZQC4A2Argf0AWwBwa0/gc+lIDONr0OdiT6CjxwJyEcaW41iA2wDeS70RxnZBnwMADq8HMOfhXzzEuHpTuG4BAFJaEWQO5IxKp/61f0C/75vHXEvo4A8Aarwm8J00K13WpV9HtYL+bFYfw5pAT5aFb2osC+e8AABkFcBOxADgGIBt6YU0pUfwhqWrh2xYn2NKn3MbAHYDeCId0713ed2RE0d5fc4W6TEA7APwVuqPsgK4ypXC/XpKGQAsAPBB6qrBuLti2EsIgIgAzFk/fTUce5+OAQA1AjCTxsf+Ab8OZgBQGwDmtiynLRj/mQj3OQBABAAv41z1E2H8LToWAKQMwOy3b7Bg/A06FgCkDOCmRbe7uQWA9AGMWgRgFADpAxizCMAYAAAAAAAAgL8BAJAagOsWAbgBgPQBPJWaLBh/k/QMAOkDMIsz7lkw/rsRFooAIIbDweY27avS65Rb1f+bw8EsCgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCCAoscAigAIg2mPAYQACIPBFC7GZGNmzgMA2L0+z4qHAMycCwDYPf9+0kMAk3He08BZAIqgVVrzaOObuZ6w4bW3AoAiaI9wkqVLmTm22/K62wTA/Cq4kvCNGmvdul5TIA+A/RG0SQspXqwxrYtULurccja95lYB+OOSrd3SvH4ilPR6AC5V0rHP6y1o8za+1lYCIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAFXRT5xealqlzx1wAAAAAElFTkSuQmCC",x3e="_InformationContainerPos_1m76y_2",b3e="_scrollContainer_1m76y_15",E3e="_centerAlign_1m76y_25",B3e="_traitInfoTitle_1m76y_28",S3e="_dropdownFlex_1m76y_38",M3e="_checkboxFlex_1m76y_44",C3e="_simpleFlex_1m76y_49",T3e="_traitInfoText_1m76y_55",I3e="_dropdownBase_1m76y_64",R3e="_dropdownControl_1m76y_74",U3e="_dropdownControlSmall_1m76y_80",F3e="_flexSelect_1m76y_106",P3e="_checked_1m76y_163",L3e="_checkmark_1m76y_167",D3e="_checkboxHolder_1m76y_180",N3e="_actionButton_1m76y_189",O3e="_tabHolder_1m76y_209",k3e="_tabButton_1m76y_215",H3e="_tabButtonSelected_1m76y_235",We={InformationContainerPos:x3e,scrollContainer:b3e,centerAlign:E3e,traitInfoTitle:B3e,dropdownFlex:S3e,checkboxFlex:M3e,simpleFlex:C3e,traitInfoText:T3e,dropdownBase:I3e,dropdownControl:R3e,dropdownControlSmall:U3e,"input-box":"_input-box_1m76y_87",flexSelect:F3e,"arrow-button":"_arrow-button_1m76y_114","left-button":"_left-button_1m76y_130","right-button":"_right-button_1m76y_137","anim-button":"_anim-button_1m76y_144","custom-checkbox":"_custom-checkbox_1m76y_149","checkbox-container":"_checkbox-container_1m76y_154",checked:P3e,checkmark:L3e,checkboxHolder:D3e,actionButton:N3e,tabHolder:O3e,tabButton:k3e,tabButtonSelected:H3e},Q3e="_slider_1y6nx_1",z3e="_infoContainer_1y6nx_13",zy={"slider-container":"_slider-container_1y6nx_1",slider:Q3e,infoContainer:z3e,"input-box":"_input-box_1y6nx_18"};function Hh({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return Q.jsxs(Q.Fragment,{children:[Q.jsxs("div",{className:zy.infoContainer,children:[n,o&&Q.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:zy["input-box"],step:o})]}),Q.jsx("div",{className:zy["slider-container"],children:Q.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:zy.slider,step:s})})]})}function G3e({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=xe.useContext(pr),[i,s]=xe.useState(0),[o,a]=xe.useState(0),[l,c]=xe.useState(0);xe.useEffect(()=>{var d,m,g;e!=null&&(c((d=e.data)==null?void 0:d.cullingLayer),s(((m=e.data)==null?void 0:m.cullingDistance[0])||0),a(((g=e.data)==null?void 0:g.cullingDistance[1])||0))},[e]);const A=d=>{s(d.target.value),e!=null&&e.data&&(e.data.cullingDistance[0]=d.target.value)},u=d=>{a(d.target.value),e!=null&&e.data&&(e.data.cullingDistance[1]=d.target.value)},f=d=>{e!=null&&e.data&&(c(d.target.value),e.data.cullingLayer=d.target.value)},h=()=>{r.updateCullHiddenMeshes()};return Q.jsx("div",{children:Q.jsxs("div",{className:We.InformationContainerPos,children:[Q.jsx(el,{title:"Trait Information",width:180,right:20}),Q.jsx("div",{className:We.scrollContainer,children:n!=null?Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:We.traitInfoTitle,children:"Trait ID"}),Q.jsx("div",{className:We.traitInfoText,children:n==null?void 0:n.id}),Q.jsx("div",{className:We.traitInfoTitle,children:"Trait Name"}),Q.jsx("div",{className:We.traitInfoText,children:n==null?void 0:n.name}),Q.jsx("div",{className:We.traitInfoTitle,children:"Description"}),Q.jsx("div",{className:We.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),Q.jsx("div",{className:We.traitInfoTitle,children:"Culling Options"}),Q.jsx("br",{}),Q.jsxs("div",{className:We.traitInfoText,children:["Culling Layer",Q.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:f,className:We["input-box"],step:1}),Q.jsx("br",{}),Q.jsx("br",{}),Q.jsx(Hh,{title:"Out Distance",value:i,onChange:A,min:0,max:1,step:.001,stepBox:.01}),Q.jsx("br",{}),Q.jsx(Hh,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),Q.jsx("div",{className:We.actionButton,onClick:h,children:Q.jsx("div",{children:"Update Culling "})})]})]}):Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:We.traitInfoTitle,children:"No Trait Selected"})})})]})})}var Lj={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=s(xe),t=r(gV);function r(b){return b&&b.__esModule?b:{default:b}}function i(){if(typeof WeakMap!="function")return null;var b=new WeakMap;return i=function(){return b},b}function s(b){if(b&&b.__esModule)return b;if(b===null||o(b)!=="object"&&typeof b!="function")return{default:b};var B=i();if(B&&B.has(b))return B.get(b);var M={},I=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var S in b)if(Object.prototype.hasOwnProperty.call(b,S)){var L=I?Object.getOwnPropertyDescriptor(b,S):null;L&&(L.get||L.set)?Object.defineProperty(M,S,L):M[S]=b[S]}return M.default=b,B&&B.set(b,M),M}function o(b){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(M){return typeof M}:o=function(M){return M&&typeof Symbol=="function"&&M.constructor===Symbol&&M!==Symbol.prototype?"symbol":typeof M},o(b)}function a(){return a=Object.assign||function(b){for(var B=1;B"u"?w:M.placeholder,value:""},isOpen:!1},I.dropdownRef=(0,e.createRef)(),I.mounted=!0,I.handleDocumentClick=I.handleDocumentClick.bind(g(I)),I.fireChangeEvent=I.fireChangeEvent.bind(g(I)),I}return h(B,[{key:"componentDidUpdate",value:function(I){if(this.props.value!==I.value)if(this.props.value){var S=this.parseValue(this.props.value,this.props.options);S!==this.state.selected&&this.setState({selected:S})}else this.setState({selected:{label:typeof this.props.placeholder>"u"?w:this.props.placeholder,value:""}})}},{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,!1)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,!1)}},{key:"handleMouseDown",value:function(I){this.props.onFocus&&typeof this.props.onFocus=="function"&&this.props.onFocus(this.state.isOpen),!(I.type==="mousedown"&&I.button!==0)&&(I.stopPropagation(),I.preventDefault(),this.props.disabled||this.setState({isOpen:!this.state.isOpen}))}},{key:"parseValue",value:function(I,S){var L;if(typeof I=="string")for(var O=0,T=S.length;O"u"&&(L=I.label||I);var O=I.label||I.value||I,T=L===this.state.selected.value||L===this.state.selected,y=(S={},A(S,"".concat(this.props.baseClassName,"-option"),!0),A(S,I.className,!!I.className),A(S,"is-selected",T),S),E=(0,t.default)(y),U=Object.keys(I.data||{}).reduce(function(P,N){return c({},P,A({},"data-".concat(N),I.data[N]))},{});return e.default.createElement("div",a({key:L,className:E,onMouseDown:this.setValue.bind(this,L,O),onClick:this.setValue.bind(this,L,O),role:"option","aria-selected":T?"true":"false"},U),O)}},{key:"buildMenu",value:function(){var I=this,S=this.props,L=S.options,O=S.baseClassName,T=L.map(function(y){if(y.type==="group"){var E=e.default.createElement("div",{className:"".concat(O,"-title")},y.name),U=y.items.map(function(P){return I.renderOption(P)});return e.default.createElement("div",{className:"".concat(O,"-group"),key:y.name,role:"listbox",tabIndex:"-1"},E,U)}else return I.renderOption(y)});return T.length?T:e.default.createElement("div",{className:"".concat(O,"-noresults")},"No options found")}},{key:"handleDocumentClick",value:function(I){this.mounted&&(this.dropdownRef.current.contains(I.target)||this.state.isOpen&&this.setState({isOpen:!1}))}},{key:"isValueSelected",value:function(){return typeof this.state.selected=="string"||this.state.selected.value!==""}},{key:"render",value:function(){var I,S,L,O,T,y=this.props,E=y.baseClassName,U=y.controlClassName,P=y.placeholderClassName,N=y.menuClassName,z=y.arrowClassName,W=y.arrowClosed,H=y.arrowOpen,C=y.className,K=this.props.disabled?"Dropdown-disabled":"",te=typeof this.state.selected=="string"?this.state.selected:this.state.selected.label,F=(0,t.default)((I={},A(I,"".concat(E,"-root"),!0),A(I,C,!!C),A(I,"is-open",this.state.isOpen),I)),re=(0,t.default)((S={},A(S,"".concat(E,"-control"),!0),A(S,U,!!U),A(S,K,!!K),S)),ce=(0,t.default)((L={},A(L,"".concat(E,"-placeholder"),!0),A(L,P,!!P),A(L,"is-selected",this.isValueSelected()),L)),oe=(0,t.default)((O={},A(O,"".concat(E,"-menu"),!0),A(O,N,!!N),O)),ge=(0,t.default)((T={},A(T,"".concat(E,"-arrow"),!0),A(T,z,!!z),T)),me=e.default.createElement("div",{className:ce},te),ve=this.state.isOpen?e.default.createElement("div",{className:oe,"aria-expanded":"true"},this.buildMenu()):null;return e.default.createElement("div",{ref:this.dropdownRef,className:F},e.default.createElement("div",{className:re,onMouseDown:this.handleMouseDown.bind(this),onTouchEnd:this.handleMouseDown.bind(this),"aria-haspopup":"listbox"},me,e.default.createElement("div",{className:"".concat(E,"-arrow-wrapper")},H&&W?this.state.isOpen?H:W:e.default.createElement("span",{className:ge}))),ve)}}]),B}(e.Component);_.defaultProps={baseClassName:"Dropdown"};var x=_;n.default=x})(Lj);const Nc=ic(Lj);function V3e({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=q.useContext(pr),[s,o]=xe.useState([]),[a,l]=xe.useState(null),c=u=>{(t==null?void 0:t.loras)!=null&&(l(t.loras[u.value]),console.log(t.loras[u.value]))},A=async()=>{const u=i.parent;u.remove(i),await r.createLoraData(a),u.add(i)};return xe.useEffect(()=>{if((t==null?void 0:t.loras)!=null){const u=t.loras.map((f,h)=>({value:h,label:f.name,description:f.description,manifest:f.manifest}));o(u)}},[t]),Q.jsx("div",{children:Q.jsxs("div",{className:We.InformationContainerPos,children:[Q.jsx(el,{title:"Lora Creation",width:180,right:20}),Q.jsxs("div",{className:We.scrollContainer,children:[Q.jsx("div",{className:We.traitInfoTitle,children:"Lora Manifests"}),Q.jsx(Nc,{className:We.dropdownControl,options:s,onChange:c,placeholder:"Select an option"}),";",Q.jsx("div",{className:We.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&Q.jsx("div",{className:We.actionButton,onClick:A,children:Q.jsx("div",{children:" Create Lora Data "})})]})]})})}function j3e({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=q.useContext(pr),[s,o]=xe.useState([]),[a,l]=xe.useState(""),[c,A]=xe.useState(null),u=h=>{(t==null?void 0:t.sprites)!=null&&(l(t.sprites[h.value].description),A(t.sprites[h.value]))},f=async()=>{const h=i.parent;h.remove(i),await r.createSpriteAtlas(c),h.add(i)};return xe.useEffect(()=>{if((t==null?void 0:t.sprites)!=null){const h=t.sprites.map((d,m)=>({value:m,label:d.name,description:d.description,manifest:d.manifest}));o(h)}},[t]),Q.jsx("div",{children:Q.jsxs("div",{className:We.InformationContainerPos,children:[Q.jsx(el,{title:"Sprite Creation",width:180,right:20}),Q.jsxs("div",{className:We.scrollContainer,children:[Q.jsx("div",{className:We.traitInfoTitle,children:"Sprite Manifests"}),Q.jsx(Nc,{className:We.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",Q.jsx("div",{className:We.traitInfoText,children:a||""}),c!=null&&Q.jsx("div",{className:We.actionButton,onClick:f,children:Q.jsx("div",{children:" Create Sprite Data "})})]})]})})}const l4=4096;function W3e({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=q.useContext(pr),[o,a]=xe.useState([]),[l,c]=xe.useState(""),[A,u]=xe.useState(""),[f,h]=xe.useState(""),[d,m]=xe.useState(!1),[g,p]=xe.useState(512),[v,w]=xe.useState(512),[_,x]=xe.useState(.1),[b,B]=xe.useState(.1),[M,I]=xe.useState("center"),[S,L]=xe.useState("center"),[O,T]=xe.useState("center"),[y,E]=xe.useState("head"),[U,P]=xe.useState("chest"),[N,z]=xe.useState(!0),[W,H]=xe.useState(!1),C=[{label:"center"},{label:"left"},{label:"right"}],K=[{label:"center"},{label:"top"},{label:"bottom"}],te=[{label:"center"},{label:"front"},{label:"back"}],F=[{label:"head"},{label:"neck"},{label:"chest"},{label:"spine"},{label:"hips"},{label:"upperLeg"},{label:"lowerLeg"},{label:"foot"}],re=le=>{(t==null?void 0:t.thumbnails)!=null&&(c(t.thumbnails[le.value].description),h(t.thumbnails[le.value].manifest),u(t.thumbnails[le.value].name))},ce=(le,Z,J,ue)=>isNaN(le)?ue:le>J?J:le{const Z=parseInt(le.target.value);p(ce(Z,1,l4,512))},ge=le=>{const Z=parseInt(le.target.value);w(ce(Z,1,l4,512))},me=le=>{const Z=parseFloat(le.target.value);x(ce(Z,0,1,.1))},ve=le=>{const Z=parseFloat(le.target.value);B(ce(Z,0,1,.1))},be=le=>{m(le)},ne=async()=>{const le=i.parent;le.remove(i),await r.createThumbnails(t.thumbnails[0]),le.add(i)},k=(le=!0)=>({topFrameOffset:b,bottomFrameOffset:_,thumbnailsWidth:g,thumbnailsHeight:v,backgroundColor:[0,0,0,0],thumbnailsCollection:[{traitGroup:e,cameraPosition:S+"-"+O+"-"+M,topBoneName:y==="upperLeg"||y==="lowerLeg"||y==="foot"?"left"+y[0].toUpperCase()+y.slice(1):y,topBoneMaxVertex:N,bottomBoneName:U==="upperLeg"||U==="lowerLeg"||y==="foot"?"left"+U[0].toUpperCase()+U.slice(1):U,bottomBoneMaxVertex:W,saveOnlyIDs:le?null:n.id}]}),ae=async(le=!1)=>{s.storeCurrentAvatar();const Z=i.parent;Z.remove(i),le?await r.createThumbnailsWithObjectData(k(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(k(!1),!1),Z.add(i),s.loadStoredAvatar()};return xe.useEffect(()=>{if((t==null?void 0:t.thumbnails)!=null){const le=t.thumbnails.map((Z,J)=>({value:J,label:Z.name,description:Z.description,manifest:Z.manifest}));a(le)}},[t]),Q.jsx("div",{children:Q.jsxs("div",{className:We.InformationContainerPos,children:[Q.jsx(el,{title:"Thumbnail Creation",width:180,right:20}),Q.jsxs("div",{className:We.scrollContainer,children:[Q.jsxs("div",{className:We.tabHolder,children:[Q.jsx("div",{className:We.tabButton+(d?"":" "+We.tabButtonSelected),onClick:()=>{be(!1)},children:Q.jsxs("div",{children:[" ","Custom"," "]})}),Q.jsx("div",{className:We.tabButton+(d?" "+We.tabButtonSelected:""),onClick:()=>{be(!0)},children:Q.jsxs("div",{children:[" ","Manifest"," "]})})]}),Q.jsx("br",{}),d?Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:We.traitInfoTitle+" "+We.centerAlign,children:"Thumbnail Manifests"}),Q.jsx(Nc,{className:We.dropdownControl,options:o,value:A,onChange:re,placeholder:"Select an option"}),";",Q.jsx("div",{className:We.traitInfoText,children:l||""}),f!=""&&Q.jsx("div",{className:We.actionButton,onClick:ne,children:Q.jsx("div",{children:" Create Thumbnails "})})]}):Q.jsxs(Q.Fragment,{children:[Q.jsxs("div",{className:We.traitInfoText,children:[Q.jsx("div",{className:We.traitInfoTitle+" "+We.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",Q.jsx("input",{value:g,className:We["input-box"],step:1,onChange:le=>{p(le.target.value)},onBlur:oe}),Q.jsx("br",{}),"Height ",Q.jsx("input",{value:v,className:We["input-box"],step:1,onChange:le=>{w(le.target.value)},onBlur:ge}),Q.jsx("br",{}),"Top Spacing ",Q.jsx("input",{value:_,className:We["input-box"],step:.1,onChange:le=>{x(le.target.value)},onBlur:me}),Q.jsx("br",{}),"Bottom Spacing ",Q.jsx("input",{value:b,className:We["input-box"],step:.1,onChange:le=>{B(le.target.value)},onBlur:ve}),Q.jsx("br",{}),Q.jsx("div",{className:We.traitInfoTitle+" "+We.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),Q.jsxs("div",{className:We.dropdownFlex,children:[Q.jsx("div",{className:We.traitInfoTitle,style:{margin:"0px"},children:"X"}),Q.jsx(Nc,{className:We.dropdownControlSmall,options:C,onChange:le=>{L(le.label)},value:S})]}),Q.jsxs("div",{className:We.dropdownFlex,children:[Q.jsx("div",{className:We.traitInfoTitle,style:{margin:"0px"},children:"Y"}),Q.jsx(Nc,{className:We.dropdownControlSmall,options:K,onChange:le=>{T(le.label)},value:O})]}),Q.jsxs("div",{className:We.dropdownFlex,children:[Q.jsx("div",{className:We.traitInfoTitle,style:{margin:"0px"},children:"Z"}),Q.jsx(Nc,{className:We.dropdownControlSmall,options:te,onChange:le=>{I(le.label)},value:M})]}),Q.jsx("div",{className:We.traitInfoTitle+" "+We.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),Q.jsxs("div",{className:We.dropdownFlex,style:{justifyContent:"space-between"},children:[Q.jsx("div",{className:We.traitInfoTitle,style:{margin:"0px"},children:"Top"}),Q.jsx(Nc,{className:We.dropdownControlSmall,options:F,onChange:le=>{E(le.label)},value:y})]}),Q.jsxs("div",{className:We.dropdownFlex,style:{justifyContent:"space-between"},children:[Q.jsx("div",{className:We.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),Q.jsx(Nc,{className:We.dropdownControlSmall,options:F,onChange:le=>{P(le.label)},value:U})]}),Q.jsxs("div",{style:{textAlign:"left"},children:[Q.jsxs("div",{className:We.checkboxFlex,style:{marginTop:"20px"},children:[Q.jsx("input",{type:"checkbox",checked:N,onChange:le=>{z(le.target.checked)}}),Q.jsx("div",{className:We.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${N?"uses Top":"uses Low"} Vertex`})]}),Q.jsxs("div",{className:We.checkboxFlex,style:{marginTop:"10px"},children:[Q.jsx("input",{type:"checkbox",checked:W,onChange:le=>{H(le.target.checked)}}),Q.jsx("div",{className:We.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${W?"uses Top":"uses Low"} Vertex`})]})]}),e==""?Q.jsx("div",{className:We.traitInfoText+" "+We.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:We.traitInfoTitle+" "+We.centerAlign,style:{marginTop:"20px"},children:"Generate"}),Q.jsx("div",{className:We.traitInfoText+" "+We.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),Q.jsxs("div",{className:We.simpleFlex,style:{marginTop:"0px"},children:[Q.jsx("div",{className:We.actionButton,style:{margin:"0px"},onClick:()=>{ae(!1)},children:Q.jsx("div",{children:" Current "})}),Q.jsx("div",{className:We.actionButton,style:{margin:"0px"},onClick:()=>{ae(!0)},children:Q.jsx("div",{children:" All "})})]})]})]})]})]})})}function K3e({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=q.useState(""),s=o=>{o!=r?i(o):i("")};return Q.jsxs("div",{children:[r=="Information"&&Q.jsx(G3e,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&Q.jsx(V3e,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&Q.jsx(j3e,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&Q.jsx(W3e,{selectedTrait:n,traitGroupName:t}),Q.jsxs("div",{className:dS.InformationContainerPos,children:[Q.jsx(el,{title:"Tools",width:90,right:0}),Q.jsx("div",{className:dS.scrollContainer,children:Q.jsxs("div",{className:dS.optionsContainer,children:[Q.jsx("div",{onClick:()=>{s("Information")},children:Q.jsx(kl,{size:56,icon:v3e,rarity:r=="Information"?"mythic":"none"})},"Information"),Q.jsx("div",{onClick:()=>{s("LoraCreation")},children:Q.jsx(kl,{size:56,icon:w3e,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),Q.jsx("div",{onClick:()=>{s("SpriteCreation")},children:Q.jsx(kl,{size:56,icon:y3e,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),Q.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:Q.jsx(kl,{size:56,icon:_3e,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation")]})})]})]})}const _l={TRAIT:0,BLEND_SHAPE:1};function X3e(){const{isLoading:n,setViewMode:e,setIsLoading:t}=q.useContext(cs),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,loraDataGenerator:a,spriteAtlasGenerator:l,thumbnailsGenerator:c,sceneElements:A}=q.useContext(pr),[u,f]=q.useState(_l.TRAIT),{playSound:h}=q.useContext(So),{isMute:d}=q.useContext(Bo),{t:m}=xe.useContext(aa),g=()=>{!d&&h("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(yt.CREATE),r(!1)},[p,v]=q.useState(null),[w,_]=q.useState(null),[x,b]=q.useState(""),[B,M]=q.useState(null),[I,S]=q.useState({}),[L,O]=q.useState(null),[T,y]=q.useState(""),[E,U]=q.useState(!1),[P,N]=q.useState({background:"#ffffff"}),z=()=>{!d&&h("backNextButton"),e(yt.SAVE),r(!1)},W=()=>{t(!0),v(null),i.loadRandomTraits().then(()=>{console.log("success"),x!=""&&M(i.getCurrentTraitData(x)),t(!1)}).catch(ne=>{t(!1),console.error("Error loading random traits:",ne.message)})},H=ne=>{N({background:ne.hex})},C=ne=>{N({background:ne.hex}),i.setTraitColor(x,ne.hex)},K=async ne=>{const k=Vl(ne.name),ae=URL.createObjectURL(ne);await s.loadAnimation(ae,!1,0,!0,"",k),y(s.getCurrentAnimationName())},te=ne=>{if(U(!1),x!=""){t(!0);const k=URL.createObjectURL(ne);i.loadCustomTexture(x,k).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},F=ne=>{if(U(!1),x!=""){t(!0);const k=URL.createObjectURL(ne);i.loadCustomTrait(x,k).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},re=ne=>{var k;if(ne.id===(B==null?void 0:B.id)){((k=ne.blendshapeTraits)==null?void 0:k.length)>0&&f(_l.BLEND_SHAPE);return}U(!1),t(!0),i.loadTrait(ne.traitGroup.trait,ne.id).then(()=>{var ae;if(t(!1),((ae=ne.blendshapeTraits)==null?void 0:ae.length)>0){const le=i.getCurrentBlendShapeTraitData(ne.traitGroup.trait);S(Object.entries(le).reduce((Z,[J,ue])=>(Z[J]=ue.id,Z),{})),f(_l.BLEND_SHAPE)}M(ne)})},ce=ne=>{U(!1),i.removeTrait(ne),M(null)},oe=ne=>{U(!1),t(!0),i.loadRandomTrait(ne).then(()=>{t(!1),M(i.getCurrentTraitData(ne))})},ge=ne=>{U(!1);const k=Array.from(ne),ae=[],le=Z=>new Promise((J,ue)=>{var Y;if(Z&&Z.name.toLowerCase().endsWith(".json")){const G=new FileReader,j=`${(Y=i.manifestData)==null?void 0:Y.getAssetsDirectory()}/anata/_thumbnails/t_${Z.name.split("_")[0]}.jpg`;console.log(j),G.onload=function(se){try{const fe=JSON.parse(se.target.result);fe.thumb=j,ae.push(fe),J()}catch(fe){console.error("Error parsing the JSON file:",fe),ue(fe)}},G.readAsText(Z)}});Promise.all(k.map(le)).then(()=>{ae.length>0&&(v(ae),t(!0),i.loadTraitsFromNFTObject(ae[0]).then(()=>{t(!1)}))}).catch(Z=>{console.error("Error processing files:",Z)})},me=async ne=>{const k=ne[0];k&&k.name.toLowerCase().endsWith(".fbx")&&K(k),k&&(k.name.toLowerCase().endsWith(".png")||k.name.toLowerCase().endsWith(".jpg"))&&te(k),k&&k.name.toLowerCase().endsWith(".vrm")&&F(k),k&&k.name.toLowerCase().endsWith(".json")&&ge(ne)},ve=ne=>{if(!d&&h("optionClick"),U(!1),x!==ne.trait){f(_l.TRAIT),_(i.getTraits(ne.trait)),b(ne.trait);const k=i.getCurrentTraitData(ne.trait),ae=i.getCurrentBlendShapeTraitData(ne.trait);M(k),S(Object.entries(ae).reduce((le,[Z,J])=>(le[Z]=J.id,le),{})),O(i.getCurrentTraitVRM(ne.trait)),o({targetY:ne.cameraTarget.height,distance:ne.cameraTarget.distance})}else _(null),b(""),M(null),S({}),o({targetY:.8,distance:3.2})},be=()=>{U(!1);var ne=document.createElement("input");ne.type="file",ne.accept=".vrm",ne.onchange=k=>{var ae=k.target.files[0];if(ae.name.endsWith(".vrm")){const le=URL.createObjectURL(ae);t(!0),i.loadCustomTrait(x,le).then(()=>{t(!1)})}},ne.click()};return Q.jsxs("div",{className:gn.container,children:[Q.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:Q.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),Q.jsx("div",{className:"sectionTitle",children:m("pageTitles.chooseAppearance")}),Q.jsx(E0,{onFilesDrop:me}),Q.jsxs("div",{className:gn.sideMenu,children:[Q.jsx(el,{title:"Appearance",left:20}),Q.jsx("div",{className:gn.bottomLine}),Q.jsx("div",{className:gn.scrollContainer,children:Q.jsx("div",{className:gn["editor-container"],children:i.getGroupTraits().map((ne,k)=>Q.jsxs("div",{className:gn.editorButton,onClick:()=>{ve(ne)},children:[Q.jsx(kl,{size:56,icon:ne.fullIconSvg,rarity:x!==ne.trait?"none":"mythic"}),Q.jsx("div",{className:gn.editorText,children:ne.name})]},"options_"+k))})})]}),!!w&&Q.jsxs("div",{className:gn.selectorContainerPos,children:[Q.jsx(el,{title:x,width:130,left:20}),B&&u==_l.TRAIT&&Q.jsx("div",{className:gn.selectorColorPickerButton,onClick:()=>{U(!E)},children:Q.jsx("img",{className:gn.selectorColorPickerImg,src:B_e})}),u==_l.TRAIT&&!!E&&Q.jsx("div",{draggable:!1,className:gn.selectorColorPickerUI,children:Q.jsx(zOe,{draggable:!1,width:"200px",color:P.background,onChange:H,onChangeComplete:C})}),Q.jsx("div",{className:gn.bottomLine}),Q.jsxs("div",{className:gn.scrollContainerOptions,children:[u==_l.TRAIT&&Q.jsxs("div",{className:gn["selector-container"],children:[Q.jsx("div",{className:`${gn.selectorButton}`,onClick:()=>{oe(x)},children:Q.jsx(kl,{size:56,icon:E_e,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(x)?Q.jsx(Q.Fragment,{}):Q.jsx("div",{className:`${gn.selectorButton}`,icon:CT,onClick:()=>{ce(x)},children:Q.jsx(kl,{size:56,icon:CT,rarity:B==null?"mythic":"none"})},"no-trait"),w.map(ne=>{let k=ne.id===(B==null?void 0:B.id);return Q.jsx("div",{className:`${gn.selectorButton}`,onClick:()=>{re(ne)},children:Q.jsx(kl,{size:56,icon:ne.fullThumbnail,rarity:k?"mythic":"none"})},ne.id)})]}),u==_l.BLEND_SHAPE&&Q.jsx(Y3e,{selectedTrait:B,onBack:()=>{f(_l.TRAIT)},selectedBlendShapeTrait:I,setSelectedBlendshapeTrait:S})]}),Q.jsx("div",{className:gn.uploadContainer,children:Q.jsx("div",{className:gn.uploadButton,onClick:be,children:Q.jsx("div",{children:"Upload "})})})]}),Q.jsx(p2,{jsonSelectionArray:p}),Q.jsx(K3e,{selectedTrait:B,selectedVRM:L,traitGroupName:x}),Q.jsx(I1,{loadedAnimationName:T,randomize:W}),Q.jsxs("div",{className:gn.buttonContainer,children:[Q.jsx(Un,{theme:"light",text:m("callToAction.back"),size:14,className:gn.buttonLeft,onClick:g}),i.canDownload()&&Q.jsx(Un,{theme:"light",text:m("callToAction.next"),size:14,className:gn.buttonRight,onClick:z})]})]})}const Y3e=({selectedTrait:n,onBack:e,selectedBlendShapeTrait:t,setSelectedBlendshapeTrait:r})=>{const{characterManager:i,moveCamera:s}=q.useContext(pr),o=i.getBlendShapeGroupTraits((n==null?void 0:n.traitGroup.trait)||"",(n==null?void 0:n.id)||""),a=(c,A)=>{i.removeBlendShapeTrait(c,A.trait);const u={...t};delete u[A.trait],r(u)},l=c=>{const A=c.parentGroup;i.loadBlendShapeTrait((n==null?void 0:n.traitGroup.trait)||"",A.trait||"",(c==null?void 0:c.id)||""),s({targetY:A.cameraTarget.height,distance:A.cameraTarget.distance});const u={...t};u[A.trait||""]=c.id,r(u)};return Q.jsxs("div",{className:gn["selector-container-column"],children:[Q.jsx(Un,{theme:"dark",text:"Back",size:14,className:gn.buttonLeft,onClick:e}),o&&o.length>0&&o.map(c=>Q.jsxs("div",{className:gn.blendshapeGroup,children:[Q.jsx("div",{children:c.name}),Q.jsxs("div",{className:gn["selector-container"],children:[Q.jsx(c4,{src:CT,active:!t[c.trait],blendshapeID:"cancel",select:()=>a(n.traitGroup.trait,c)},"empty"),c.collection.map(A=>{let u=A.id===t[c.trait];return Q.jsx(c4,{src:A.fullThumbnail||"",active:u,blendshapeID:A.id,select:()=>l(A)},A.id)})]})]},c.trait))]})},c4=({active:n,blendshapeID:e,src:t,select:r})=>Q.jsx("div",{className:`${gn.selectorButton}`,onClick:r,children:Q.jsx(kl,{size:56,icon:t||"",rarity:n?"mythic":"none"})},e),$3e="_InformationContainerPos_rgqwy_1",Z3e="_traitInfoTitle_rgqwy_13",q3e="_traitInfoText_rgqwy_21",J3e="_flexSelect_rgqwy_30",eke="_scrollContainer_rgqwy_65",tke="_checked_rgqwy_90",nke="_checkmark_rgqwy_94",rke="_checkboxHolder_rgqwy_107",ike="_buttonContainer_rgqwy_114",ske="_buttonLeft_rgqwy_123",oke="_buttonRight_rgqwy_127",ake="_buttonCenter_rgqwy_131",Di={InformationContainerPos:$3e,traitInfoTitle:Z3e,traitInfoText:q3e,flexSelect:J3e,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:eke,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:tke,checkmark:nke,checkboxHolder:rke,buttonContainer:ike,buttonLeft:ske,buttonRight:oke,buttonCenter:ake},lke="_InformationContainerPos_11mqa_2",cke="_scrollContainer_11mqa_16",Ake="_traitInfoTitle_11mqa_28",uke="_traitInfoText_11mqa_38",fke="_flexSelect_11mqa_66",hke="_checked_11mqa_124",dke="_checkmark_11mqa_128",pke="_checkboxHolder_11mqa_141",lr={InformationContainerPos:lke,scrollContainer:cke,traitInfoTitle:Ake,traitInfoText:uke,"input-box":"_input-box_11mqa_47",flexSelect:fke,"arrow-button":"_arrow-button_11mqa_76","left-button":"_left-button_11mqa_91","right-button":"_right-button_11mqa_98","anim-button":"_anim-button_11mqa_105","custom-checkbox":"_custom-checkbox_11mqa_110","checkbox-container":"_checkbox-container_11mqa_115",checked:hke,checkmark:dke,checkboxHolder:pke};function aU({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=q.useContext(pr),[a,l]=xe.useState(0),[c,A]=xe.useState(0),[u,f]=xe.useState(0),[h,d]=xe.useState(0),[m,g]=xe.useState(0),[p,v]=xe.useState(0),[w,_]=xe.useState(0),[x,b]=xe.useState(0),[B,M]=xe.useState(0),[I,S]=xe.useState(0);return xe.useEffect(()=>{if(n!=null){const L=Dd(n,"Mesh"),O=Dd(n,"SkinnedMesh");l(L.length),A(O.length);const T=L.concat(O),{stdMats:y,stdCutoutpMats:E,stdTranspMats:U,mToonMats:P,mToonCutoutMats:N,mToonTranspMats:z}=sge(T);f(y.length),d(U.length),g(E.length),v(P.length),_(z.length),b(N.length);const{triangles:W,bones:H}=o.getBoneTriangleCount();M(W),S(H)}},[n]),n!=null?Q.jsx("div",{children:Q.jsxs("div",{className:lr.InformationContainerPos,children:[Q.jsx(el,{title:"Model Information",width:180,right:20}),Q.jsxs("div",{className:lr.scrollContainer,children:[Q.jsxs("div",{className:lr.flexSelect,children:[(t==null?void 0:t.length)>1?Q.jsx("div",{className:`${lr["arrow-button"]} ${lr["left-button"]}`,onClick:s}):Q.jsx(Q.Fragment,{}),e&&Q.jsx("div",{style:{textAlign:"center"},children:Q.jsx("div",{className:lr.traitInfoTitle,style:{margin:"auto",fontSize:"14px",width:"200px",textAlign:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},children:e})}),(t==null?void 0:t.length)>1?Q.jsx("div",{className:`${lr["arrow-button"]} ${lr["right-button"]}`,onClick:i}):Q.jsx(Q.Fragment,{})]}),Q.jsx("div",{className:lr.traitInfoTitle,children:"Geometry info:"}),Q.jsxs("div",{className:lr.traitInfoText,children:["Meshes: ",a]}),Q.jsxs("div",{className:lr.traitInfoText,children:["SkinnedMeshes: ",c]}),Q.jsxs("div",{className:lr.traitInfoText,children:["Triangles: ",B]}),Q.jsxs("div",{className:lr.traitInfoText,children:["Bones: ",I]}),Q.jsx("div",{className:lr.traitInfoTitle,children:"Standard Material Count:"}),Q.jsxs("div",{className:lr.traitInfoText,children:["opaque: ",u]}),Q.jsxs("div",{className:lr.traitInfoText,children:["cutout: ",m]}),Q.jsxs("div",{className:lr.traitInfoText,children:["transparent: ",h]}),Q.jsx("div",{className:lr.traitInfoTitle,children:"MToon Material Count:"}),Q.jsxs("div",{className:lr.traitInfoText,children:["opaque: ",p]}),Q.jsxs("div",{className:lr.traitInfoText,children:["cutout: ",x]}),Q.jsxs("div",{className:lr.traitInfoText,children:["transparent: ",w]})]})]})}):Q.jsx(Q.Fragment,{})}const mke="_InformationContainerPos_b0msk_1",gke="_traitInfoTitle_b0msk_13",vke="_traitInfoText_b0msk_22",yke="_flexSelect_b0msk_33",wke="_scrollContainer_b0msk_68",_ke="_checked_b0msk_93",xke="_checkmark_b0msk_97",bke="_checkboxHolder_b0msk_110",pt={InformationContainerPos:mke,traitInfoTitle:gke,traitInfoText:vke,flexSelect:yke,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:wke,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:_ke,checkmark:xke,checkboxHolder:bke};function K1({showDropToDownload:n,showCreateAtlas:e,mergeMenuTitle:t}){const[r,i]=xe.useState(Qe.mergeOptions_atlas_std_size||6),[s,o]=xe.useState(Qe.mergeOptions_atlas_std_transp_size||6),[a,l]=xe.useState(Qe.mergeOptions_atlas_mtoon_size||6),[c,A]=xe.useState(Qe.mergeOptions_atlas_mtoon_transp_size||6),[u,f]=xe.useState(Qe.mergeOptions_sel_option||0),[h,d]=xe.useState(Qe.mergeOptions_two_sided_mat||!1),[m]=xe.useState(["Merge to Standard","Merge to MToon","Keep Both"]),[g,p]=xe.useState(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm),[v,w]=xe.useState(Qe.mergeOptions_download_vrm_preview==null?!0:Qe.mergeOptions_download_vrm_preview),[_,x]=xe.useState(Qe.mergeOptions_drop_download||!1),[b,B]=xe.useState(Qe.merge_options_ktx_compression||!1),[M,I]=xe.useState(Qe.mergeOptions_create_atlas==null?!0:Qe.mergeOptions_create_atlas),[S,L]=xe.useState(Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora),[O,T]=xe.useState(Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites),y=F=>{x(F.target.checked),Qe.mergeOptions_drop_download=F.target.checked},E=F=>{d(F.target.checked),Qe.mergeOptions_two_sided_mat=F.target.checked},U=F=>{B(F.target.checked),Qe.merge_options_ktx_compression=F.target.checked},P=F=>{I(F.target.checked),Qe.mergeOptions_create_atlas=F.target.checked},N=F=>{p(F.target.checked),Qe.mergeOptions_download_vrm=F.target.checked},z=F=>{w(F.target.checked),Qe.mergeOptions_download_vrm_preview=F.target.checked},W=F=>{L(F.target.checked),Qe.mergeOptions_download_lora=F.target.checked},H=F=>{T(F.target.checked),Qe.mergeOptions_download_sprites=F.target.checked},C=()=>{let F=u;u<=0?F=m.length-1:F-=1,f(F),Qe.mergeOptions_sel_option=F},K=()=>{let F=u;u>=m.length-1?F=0:F+=1,f(F),Qe.mergeOptions_sel_option=F},te=async(F,re)=>{let ce=parseInt(F.target.value);ce>8?ce=8:ce<0&&(ce=0),(ge=>{switch(re){case"standard opaque":i(ge),Qe.mergeOptions_atlas_std_size=ge;break;case"standard transparent":o(ge),Qe.mergeOptions_atlas_std_transp_size=ge;break;case"mtoon opaque":l(ge),Qe.mergeOptions_atlas_mtoon_size=ge;break;case"mtoon transparent":A(ge),Qe.mergeOptions_atlas_mtoon_transp_size=ge;break}})(ce)};return Q.jsxs("div",{className:pt.InformationContainerPos,children:[Q.jsx(el,{title:t,width:180,left:20}),Q.jsxs("div",{className:pt.scrollContainer,children:[Q.jsx("div",{className:pt.traitInfoTitle,children:"Download Options"}),Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:g,onChange:N}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Download VRM"]})})}),Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:v,onChange:z}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Download VRM Preview"]})})}),Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:S,onChange:W}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Download Lora Data"]})})}),Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:O,onChange:H}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Download Sprites Data"]})})}),g&&Q.jsxs(Q.Fragment,{children:[e&&Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:M,onChange:P}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Create Atlas"]})})}),(e==!1||M)&&Q.jsxs(Q.Fragment,{children:[Q.jsx("br",{}),Q.jsx("div",{className:pt.traitInfoTitle,children:"Merge Atlas Type"}),Q.jsx("br",{}),Q.jsxs("div",{className:pt.flexSelect,children:[Q.jsx("div",{className:`${pt["arrow-button"]} ${pt["left-button"]}`,onClick:C}),Q.jsx("div",{className:pt.traitInfoText,style:{marginBottom:"0"},children:m[u]}),Q.jsx("div",{className:`${pt["arrow-button"]} ${pt["right-button"]}`,onClick:K})]}),Q.jsx("br",{}),Q.jsx("br",{}),(u===0||u==2)&&Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:pt.traitInfoTitle,children:"Standard Atlas Size"}),Q.jsx("br",{}),Q.jsxs("div",{className:pt.traitInfoText,children:["Opaque: ",Dn(r)+" x "+Dn(r)]}),Q.jsx(Hh,{value:r,onChange:F=>te(F,"standard opaque"),min:1,max:8,step:1}),Q.jsx("br",{}),Q.jsxs("div",{className:pt.traitInfoText,children:["Transparent: ",Dn(s)+" x "+Dn(s)]}),Q.jsx(Hh,{value:s,onChange:F=>te(F,"standard transparent"),min:1,max:8,step:1}),Q.jsx("br",{})," ",Q.jsx("br",{})]}),(u===1||u==2)&&Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:pt.traitInfoTitle,children:"MToon Atlas Size"}),Q.jsx("br",{}),Q.jsxs("div",{className:pt.traitInfoText,children:["Opaque: ",Dn(a)+" x "+Dn(a)]}),Q.jsx(Hh,{value:a,onChange:F=>te(F,"mtoon opaque"),min:1,max:8,step:1}),Q.jsx("br",{}),Q.jsxs("div",{className:pt.traitInfoText,children:["Transparent: ",Dn(c)+" x "+Dn(c)]}),Q.jsx(Hh,{value:c,onChange:F=>te(F,"mtoon transparent"),min:1,max:8,step:1}),Q.jsx("br",{})," ",Q.jsx("br",{})]}),Q.jsx("div",{className:pt.traitInfoTitle,children:"Options"}),Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:h,onChange:E}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Two Sided Material"]})}),n&&Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:_,onChange:y}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Drag Drop - Download"]})})}),Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:b,onChange:U}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}function Eke(){const{isLoading:n,setViewMode:e,setIsLoading:t}=q.useContext(cs),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:c}=q.useContext(pr),[A,u]=xe.useState(null),[f,h]=xe.useState(""),[d,m]=q.useState(""),{playSound:g}=q.useContext(So),{isMute:p}=q.useContext(Bo),[v,w]=q.useState(null),_=()=>{!p&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(yt.LANDING)},x=()=>{const T=Qe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Dn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Dn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:T===0||T==2,exportMtoonAtlas:T===1||T==2,ktxCompression:Qe.merge_options_ktx_compression||!1,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},b=(T,y=!1)=>{console.log(y),(async()=>{await s.loadTraitsFromNFTObject(v[T]),(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm)&&await s.downloadVRM(v[T].name,x());const P=new Jd,N=c.parent;N.remove(c);const z=Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora;if(z===!0){const H=r.loras.map(async C=>a.createLoraData(C,P));await Promise.all(H)}const W=Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites;if(W===!0){const H=r.sprites.map(async C=>l.createSpriteAtlas(C,P));await Promise.all(H)}(z===!0||W===!0)&&P.saveZip(v[T].name),N.add(c),T{t(!0),b(0,!0)},{t:M}=xe.useContext(aa),I=async T=>{if(s.getCurrentCharacterModel()){const E=Vl(T.name),U=URL.createObjectURL(T);await o.loadAnimation(U,!1,0,!0,"",E),m(o.getCurrentAnimationName()),URL.revokeObjectURL(U)}else console.warn("Please load a vrm model to test animations.")},S=async T=>{const y=URL.createObjectURL(T);await s.loadOptimizerCharacter(y),URL.revokeObjectURL(y);const E=Vl(T.name);h(E),u(s.getCurrentCharacterModel())},L=T=>{const y=Array.from(T),E=[],U=P=>new Promise((N,z)=>{var W;if(P&&P.name.toLowerCase().endsWith(".json")){const H=new FileReader,C=`${(W=s.manifestData)==null?void 0:W.getAssetsDirectory()}/anata/_thumbnails/t_${P.name.split("_")[0]}.jpg`;H.onload=function(K){try{const te=JSON.parse(K.target.result);te.thumb=C,E.push(te),N()}catch(te){console.error("Error parsing the JSON file:",te),z(te)}},H.readAsText(P)}});Promise.all(y.map(U)).then(()=>{E.length>0&&(w(E),t(!0),s.loadTraitsFromNFTObject(E[0]).then(()=>{t(!1)}))}).catch(P=>{console.error("Error processing files:",P)})},O=async T=>{const y=T[0];console.log("anim"),y&&y.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),I(y)),y&&y.name.toLowerCase().endsWith(".vrm")&&S(y),y&&y.name.toLowerCase().endsWith(".json")&&L(T)};return Q.jsxs("div",{className:Di.container,children:[Q.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:Q.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),Q.jsx("div",{className:"sectionTitle",children:"Batch Download"}),Q.jsx(E0,{onFilesDrop:O}),Q.jsx(K1,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),Q.jsx(aU,{model:A}),Q.jsx(p2,{jsonSelectionArray:v}),Q.jsx(I1,{loadedAnimationName:d}),Q.jsxs("div",{className:Di.buttonContainer,children:[Q.jsx(Un,{theme:"light",text:M("callToAction.back"),size:14,className:Di.buttonLeft,onClick:_}),(v==null?void 0:v.length)==1&&Q.jsx(Un,{theme:"light",text:"Download",size:14,className:Di.buttonRight,onClick:B}),(v==null?void 0:v.length)>1&&Q.jsx(Un,{theme:"light",text:"Download All",size:14,className:Di.buttonRight,onClick:B})]})]})}const P0="abi/5.7.0",Qt=new _e(P0),Du={};let A4={calldata:!0,memory:!0,storage:!0},Bke={calldata:!0,memory:!0};function Gy(n,e){if(n==="bytes"||n==="string"){if(A4[e])return!0}else if(n==="address"){if(e==="payable")return!0}else if((n.indexOf("[")>=0||n==="tuple")&&Bke[e])return!0;return(A4[e]||e==="payable")&&Qt.throwArgumentError("invalid modifier","name",e),!1}function Ske(n,e){let t=n;function r(a){Qt.throwArgumentError(`unexpected character at position ${a}`,"param",n)}n=n.replace(/\s/g," ");function i(a){let l={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(l.indexed=!1),l}let s={type:"",name:"",state:{allowType:!0}},o=s;for(let a=0;aJSON.parse(i.format(e)))),JSON.stringify(r)}let t="";return this.baseType==="array"?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==$t.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===$t.full?", ":",")+")"):t+=this.type,e!==$t.sighash&&(this.indexed===!0&&(t+=" indexed"),e===$t.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?zr.fromString(e,t):zr.fromObject(e)}static fromObject(e){return zr.isParamType(e)?e:new zr(Du,{name:e.name||null,type:Ah(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(zr.fromObject):null})}static fromString(e,t){function r(i){return zr.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(Ske(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function qg(n,e){return Tke(n).map(t=>zr.fromString(t,e))}class Hl{constructor(e,t){e!==Du&&Qt.throwError("use a static from method",_e.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Dw(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Hl.isFragment(e)?e:typeof e=="string"?Hl.fromString(e):Hl.fromObject(e)}static fromObject(e){if(Hl.isFragment(e))return e;switch(e.type){case"function":return Fa.fromObject(e);case"event":return Pl.fromObject(e);case"constructor":return Ua.fromObject(e);case"error":return Qc.fromObject(e);case"fallback":case"receive":return null}return Qt.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?Pl.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?Fa.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?Ua.fromString(e.trim()):e.split(" ")[0]==="error"?Qc.fromString(e.substring(5).trim()):Qt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class Pl extends Hl{format(e){if(e||(e=$t.sighash),$t[e]||Qt.throwArgumentError("invalid format type","format",e),e===$t.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==$t.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===$t.full?", ":",")+") ",e!==$t.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?Pl.fromString(e):Pl.fromObject(e)}static fromObject(e){if(Pl.isEventFragment(e))return e;e.type!=="event"&&Qt.throwArgumentError("invalid event object","value",e);const t={name:Jg(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(zr.fromObject):[],type:"event"};return new Pl(Du,t)}static fromString(e){let t=e.match(e0);t||Qt.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":r=!0;break;case"":break;default:Qt.warn("unknown modifier: "+i)}}),Pl.fromObject({name:t[1].trim(),anonymous:r,inputs:qg(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function Dj(n,e){e.gas=null;let t=n.split("@");return t.length!==1?(t.length>2&&Qt.throwArgumentError("invalid human-readable ABI signature","value",n),t[1].match(/^[0-9]+$/)||Qt.throwArgumentError("invalid human-readable ABI signature gas","value",n),e.gas=Ve.from(t[1]),t[0]):n}function Nj(n,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",n.split(" ").forEach(t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}})}function Oj(n){let e={constant:!1,payable:!0,stateMutability:"payable"};return n.stateMutability!=null?(e.stateMutability=n.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",n.constant!=null&&!!n.constant!==e.constant&&Qt.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",n),e.payable=e.stateMutability==="payable",n.payable!=null&&!!n.payable!==e.payable&&Qt.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",n)):n.payable!=null?(e.payable=!!n.payable,n.constant==null&&!e.payable&&n.type!=="constructor"&&Qt.throwArgumentError("unable to determine stateMutability","value",n),e.constant=!!n.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Qt.throwArgumentError("cannot have constant payable function","value",n)):n.constant!=null?(e.constant=!!n.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):n.type!=="constructor"&&Qt.throwArgumentError("unable to determine stateMutability","value",n),e}class Ua extends Hl{format(e){if(e||(e=$t.sighash),$t[e]||Qt.throwArgumentError("invalid format type","format",e),e===$t.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});e===$t.sighash&&Qt.throwError("cannot format a constructor for sighash",_e.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===$t.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?Ua.fromString(e):Ua.fromObject(e)}static fromObject(e){if(Ua.isConstructorFragment(e))return e;e.type!=="constructor"&&Qt.throwArgumentError("invalid constructor object","value",e);let t=Oj(e);t.constant&&Qt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(zr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ve.from(e.gas):null};return new Ua(Du,r)}static fromString(e){let t={type:"constructor"};e=Dj(e,t);let r=e.match(e0);return(!r||r[1].trim()!=="constructor")&&Qt.throwArgumentError("invalid constructor string","value",e),t.inputs=qg(r[2].trim(),!1),Nj(r[3].trim(),t),Ua.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class Fa extends Ua{format(e){if(e||(e=$t.sighash),$t[e]||Qt.throwArgumentError("invalid format type","format",e),e===$t.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e))),outputs:this.outputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==$t.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===$t.full?", ":",")+") ",e!==$t.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map(r=>r.format(e)).join(", ")+") "),this.gas!=null&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return typeof e=="string"?Fa.fromString(e):Fa.fromObject(e)}static fromObject(e){if(Fa.isFunctionFragment(e))return e;e.type!=="function"&&Qt.throwArgumentError("invalid function object","value",e);let t=Oj(e);const r={type:e.type,name:Jg(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(zr.fromObject):[],outputs:e.outputs?e.outputs.map(zr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ve.from(e.gas):null};return new Fa(Du,r)}static fromString(e){let t={type:"function"};e=Dj(e,t);let r=e.split(" returns ");r.length>2&&Qt.throwArgumentError("invalid function string","value",e);let i=r[0].match(e0);if(i||Qt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&Jg(t.name),t.inputs=qg(i[2],!1),Nj(i[3].trim(),t),r.length>1){let s=r[1].match(e0);(s[1].trim()!=""||s[3].trim()!="")&&Qt.throwArgumentError("unexpected tokens","value",e),t.outputs=qg(s[2],!1)}else t.outputs=[];return Fa.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function u4(n){const e=n.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Qt.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",n),n}class Qc extends Hl{format(e){if(e||(e=$t.sighash),$t[e]||Qt.throwArgumentError("invalid format type","format",e),e===$t.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==$t.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===$t.full?", ":",")+") ",t.trim()}static from(e){return typeof e=="string"?Qc.fromString(e):Qc.fromObject(e)}static fromObject(e){if(Qc.isErrorFragment(e))return e;e.type!=="error"&&Qt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:Jg(e.name),inputs:e.inputs?e.inputs.map(zr.fromObject):[]};return u4(new Qc(Du,t))}static fromString(e){let t={type:"error"},r=e.match(e0);return r||Qt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&Jg(t.name),t.inputs=qg(r[2],!1),u4(Qc.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function Ah(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const Cke=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Jg(n){return(!n||!n.match(Cke))&&Qt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const e0=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Tke(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&lU.throwError("value out-of-bounds",_e.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Bs([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class vx{constructor(e,t,r,i){Pe(this,"_data",ft(e)),Pe(this,"wordSize",t||32),Pe(this,"_coerceFunc",r),Pe(this,"allowLoose",i),this._offset=0}get data(){return at(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):vx.coerce(e,t)}_peekBytes(e,t,r){let i=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?i=t:lU.throwError("data out-of-bounds",_e.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new vx(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return Ve.from(this.readBytes(this.wordSize))}}class Rke extends fc{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=oi(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return oi(rr(e.readValue().toHexString(),20))}}class Uke extends fc{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const Qh=new _e(P0);function kj(n,e,t){let r=null;if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(c=>{const A=c.localName;return A||Qh.throwError("cannot encode object for signature with missing names",_e.errors.INVALID_ARGUMENT,{argument:"values",coder:c,value:t}),l[A]&&Qh.throwError("cannot encode object for signature with duplicate names",_e.errors.INVALID_ARGUMENT,{argument:"values",coder:c,value:t}),l[A]=!0,t[A]})}else Qh.throwArgumentError("invalid tuple value","tuple",t);e.length!==r.length&&Qh.throwArgumentError("types/value length mismatch","tuple",t);let i=new QT(n.wordSize),s=new QT(n.wordSize),o=[];e.forEach((l,c)=>{let A=r[c];if(l.dynamic){let u=s.length;l.encode(s,A);let f=i.writeUpdatableValue();o.push(h=>{f(h+u)})}else l.encode(i,A)}),o.forEach(l=>{l(i.length)});let a=n.appendWriter(i);return a+=n.appendWriter(s),a}function Hj(n,e){let t=[],r=n.subReader(0);e.forEach(s=>{let o=null;if(s.dynamic){let a=n.readValue(),l=r.subReader(a.toNumber());try{o=s.decode(l)}catch(c){if(c.code===_e.errors.BUFFER_OVERRUN)throw c;o=c,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(a){if(a.code===_e.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}o!=null&&t.push(o)});const i=e.reduce((s,o)=>{const a=o.localName;return a&&(s[a]||(s[a]=0),s[a]++),s},{});e.forEach((s,o)=>{let a=s.localName;if(!a||i[a]!==1||(a==="length"&&(a="_length"),t[a]!=null))return;const l=t[o];l instanceof Error?Object.defineProperty(t,a,{enumerable:!0,get:()=>{throw l}}):t[a]=l});for(let s=0;s{throw o}})}return Object.freeze(t)}class Fke extends fc{constructor(e,t,r){const i=e.type+"["+(t>=0?t:"")+"]",s=t===-1||e.dynamic;super("array",i,r,s),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;re._data.length&&Qh.throwError("insufficient data length",_e.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let i=0;i{o.dynamic&&(r=!0),i.push(o.type)});const s="tuple("+i.join(",")+")";super("tuple",s,t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach(r=>{e.push(r.defaultValue())});const t=this.coders.reduce((r,i)=>{const s=i.localName;return s&&(r[s]||(r[s]=0),r[s]++),r},{});return this.coders.forEach((r,i)=>{let s=r.localName;!s||t[s]!==1||(s==="length"&&(s="_length"),e[s]==null&&(e[s]=e[i]))}),Object.freeze(e)}encode(e,t){return kj(e,this.coders,t)}decode(e){return e.coerce(this.name,Hj(e,this.coders))}}const jy=new _e(P0),Hke=new RegExp(/^bytes([0-9]*)$/),Qke=new RegExp(/^(u?int)([0-9]*)$/);class zke{constructor(e){Pe(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new Rke(e.name);case"bool":return new Pke(e.name);case"string":return new kke(e.name);case"bytes":return new Lke(e.name);case"array":return new Fke(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Vy((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new Nke(e.name)}let t=e.type.match(Qke);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&jy.throwArgumentError("invalid "+t[1]+" bit length","param",e),new Oke(r/8,t[1]==="int",e.name)}if(t=e.type.match(Hke),t){let r=parseInt(t[1]);return(r===0||r>32)&&jy.throwArgumentError("invalid bytes length","param",e),new Dke(r,e.name)}return jy.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new vx(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new QT(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(zr.from(i)));return new Vy(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&jy.throwError("types/values length mismatch",_e.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(zr.from(o))),i=new Vy(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(zr.from(o)));return new Vy(i,"_").decode(this._getReader(ft(t),r))}}const Gke=new zke,zn=new _e(P0);class Vke extends i0{}class jke extends i0{}class Wke extends i0{}class zT extends i0{static isIndexed(e){return!!(e&&e._isIndexed)}}const Kke={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function f4(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class h4{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Pe(this,"fragments",t.map(r=>Hl.from(r)).filter(r=>r!=null)),Pe(this,"_abiCoder",Ss(new.target,"getAbiCoder")()),Pe(this,"functions",{}),Pe(this,"errors",{}),Pe(this,"events",{}),Pe(this,"structs",{}),this.fragments.forEach(r=>{let i=null;switch(r.type){case"constructor":if(this.deploy){zn.warn("duplicate definition - constructor");return}Pe(this,"deploy",r);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let s=r.format();if(i[s]){zn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Pe(this,"deploy",Ua.from({payable:!1,type:"constructor"})),Pe(this,"_isInterface",!0)}format(e){e||(e=$t.full),e===$t.sighash&&zn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===$t.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return Gke}static getAddress(e){return oi(e)}static getSighash(e){return pi(uh(e.format()),0,4)}static getEventTopic(e){return uh(e.format())}getFunction(e){if(Tt(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];zn.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.functions).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching function","name",r):i.length>1&&zn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[Fa.fromString(e).format()];return t||zn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(Tt(e)){const r=e.toLowerCase();for(const i in this.events)if(r===this.getEventTopic(i))return this.events[i];zn.throwArgumentError("no matching event","topichash",r)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.events).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching event","name",r):i.length>1&&zn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[Pl.fromString(e).format()];return t||zn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Tt(e)){const r=Ss(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}zn.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.errors).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching error","name",r):i.length>1&&zn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[Fa.fromString(e).format()];return t||zn.throwArgumentError("no matching error","signature",e),t}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch{throw t}}return Ss(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),Ss(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){typeof e=="string"&&(e=this.getError(e));const r=ft(t);return at(r.slice(0,4))!==this.getSighash(e)&&zn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",at(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return typeof e=="string"&&(e=this.getError(e)),at(Bs([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){typeof e=="string"&&(e=this.getFunction(e));const r=ft(t);return at(r.slice(0,4))!==this.getSighash(e)&&zn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",at(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return typeof e=="string"&&(e=this.getFunction(e)),at(Bs([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){typeof e=="string"&&(e=this.getFunction(e));let r=ft(t),i=null,s="",o=null,a=null,l=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch{}break;case 4:{const c=at(r.slice(0,4)),A=Kke[c];if(A)o=this._abiCoder.decode(A.inputs,r.slice(4)),a=A.name,l=A.signature,A.reason&&(i=o[0]),a==="Error"?s=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(s=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const u=this.getError(c);o=this._abiCoder.decode(u.inputs,r.slice(4)),a=u.name,l=u.format()}catch{}break}}return zn.throwError("call revert exception"+s,_e.errors.CALL_EXCEPTION,{method:e.format(),data:at(t),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,t){return typeof e=="string"&&(e=this.getFunction(e)),at(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){typeof e=="string"&&(e=this.getEvent(e)),t.length>e.inputs.length&&zn.throwError("too many arguments for "+e.format(),_e.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?uh(o):s.type==="bytes"?Er(at(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=Ve.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),rr(at(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&zn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?zn.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?r.push(s.map(l=>i(a,l))):r.push(i(a,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,t){typeof e=="string"&&(e=this.getEvent(e));const r=[],i=[],s=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&zn.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((o,a)=>{const l=t[a];if(o.indexed)if(o.type==="string")r.push(uh(l));else if(o.type==="bytes")r.push(Er(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(this._abiCoder.encode([o.type],[l]))}else i.push(o),s.push(l)}),{data:this._abiCoder.encode(i,s),topics:r}}decodeEventLog(e,t,r){if(typeof e=="string"&&(e=this.getEvent(e)),r!=null&&!e.anonymous){let f=this.getEventTopic(e);(!Tt(r[0],32)||r[0].toLowerCase()!==f)&&zn.throwError("fragment/topic mismatch",_e.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:f,value:r[0]}),r=r.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((f,h)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(i.push(zr.fromObject({type:"bytes32",name:f.name})),o.push(!0)):(i.push(f),o.push(!1)):(s.push(f),o.push(!1))});let a=r!=null?this._abiCoder.decode(i,Bs(r)):null,l=this._abiCoder.decode(s,t,!0),c=[],A=0,u=0;e.inputs.forEach((f,h)=>{if(f.indexed)if(a==null)c[h]=new zT({_isIndexed:!0,hash:null});else if(o[h])c[h]=new zT({_isIndexed:!0,hash:a[u++]});else try{c[h]=a[u++]}catch(d){c[h]=d}else try{c[h]=l[A++]}catch(d){c[h]=d}if(f.name&&c[f.name]==null){const d=c[h];d instanceof Error?Object.defineProperty(c,f.name,{enumerable:!0,get:()=>{throw f4(`property ${JSON.stringify(f.name)}`,d)}}):c[f.name]=d}});for(let f=0;f{throw f4(`index ${f}`,h)}})}return Object.freeze(c)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new jke({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:Ve.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Vke({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=at(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new Wke({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const Xke="contracts/5.7.0";var Nu=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const ur=new _e(Xke);function yx(n,e){return Nu(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&ur.throwArgumentError("invalid address or ENS name","name",t);try{return oi(t)}catch{}n||ur.throwError("a provider or signer is needed to resolve ENS names",_e.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&ur.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function Nw(n,e,t){return Nu(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>Nw(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield yx(n,e):t.type==="tuple"?yield Nw(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>Nw(n,r,t.arrayChildren))):Promise.reject(ur.makeError("invalid value for array",_e.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function X1(n,e,t){return Nu(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=kn(t.pop())),ur.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=yr({override:yx(n.signer,r.from),signer:n.signer.getAddress()}).then(c=>Nu(this,void 0,void 0,function*(){return oi(c.signer)!==c.override&&ur.throwError("Contract with a Signer cannot override from",_e.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),c.override})):r.from=n.signer.getAddress():r.from&&(r.from=yx(n.provider,r.from));const i=yield yr({args:Nw(n.signer||n.provider,t,e.inputs),address:n.resolvedAddress,overrides:yr(r)||{}}),s=n.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=Ve.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=Ve.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=Ve.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=Ve.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=Ve.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=Hu(a.accessList)),o.gasLimit==null&&e.gas!=null){let c=21e3;const A=ft(s);for(let u=0;ur[c]!=null);return l.length&&ur.throwError(`cannot override ${l.map(c=>JSON.stringify(c)).join(",")}`,_e.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function Yke(n,e){return function(...t){return X1(n,e,t)}}function $ke(n,e){const t=n.signer||n.provider;return function(...r){return Nu(this,void 0,void 0,function*(){t||ur.throwError("estimate require a provider or signer",_e.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield X1(n,e,r);return yield t.estimateGas(i)})}}function Zke(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=Us(s),a=null;try{a=n.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,c)=>n.interface.decodeEventLog(a.eventFragment,l,c),o.event=a.name,o.eventSignature=a.signature),o.removeListener=()=>n.provider,o.getBlock=()=>n.provider.getBlock(i.blockHash),o.getTransaction=()=>n.provider.getTransaction(i.transactionHash),o.getTransactionReceipt=()=>Promise.resolve(i),o}),i))}function zj(n,e,t){const r=n.signer||n.provider;return function(...i){return Nu(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=kn(i.pop());l.blockTag!=null&&(s=yield l.blockTag),delete l.blockTag,i.push(l)}n.deployTransaction!=null&&(yield n._deployed(s));const o=yield X1(n,e,i),a=yield r.call(o,s);try{let l=n.interface.decodeFunctionResult(e,a);return t&&e.outputs.length===1&&(l=l[0]),l}catch(l){throw l.code===_e.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function qke(n,e){return function(...t){return Nu(this,void 0,void 0,function*(){n.signer||ur.throwError("sending a transaction requires a signer",_e.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield X1(n,e,t),i=yield n.signer.sendTransaction(r);return Zke(n,i),i})}}function d4(n,e,t){return e.constant?zj(n,e,t):qke(n,e)}function Gj(n){return n.address&&(n.topics==null||n.topics.length===0)?"*":(n.address||"*")+"@"+(n.topics?n.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class t0{constructor(e,t){Pe(this,"tag",e),Pe(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter(r=>t||r.listener!==e?!0:(t=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter(r=>{const i=e.slice();return setTimeout(()=>{r.listener.apply(this,i)},0),!r.once}),t}prepareEvent(e){}getEmit(e){return[e]}}class Jke extends t0{constructor(){super("error",null)}}class p4 extends t0{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&ur.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(Gj(s),s),Pe(this,"address",e),Pe(this,"interface",t),Pe(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(t,r)=>this.interface.decodeEventLog(this.fragment,t,r);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=Ike(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class m4 extends t0{constructor(e,t){super("*",{address:e}),Pe(this,"address",e),Pe(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(r,i)=>this.interface.decodeEventLog(t.eventFragment,r,i),e.args=t.args}catch{}}}class e4e{constructor(e,t,r){Pe(this,"interface",Ss(new.target,"getInterface")(t)),r==null?(Pe(this,"provider",null),Pe(this,"signer",null)):l0.isSigner(r)?(Pe(this,"provider",r.provider||null),Pe(this,"signer",r)):s0.isProvider(r)?(Pe(this,"provider",r),Pe(this,"signer",null)):ur.throwArgumentError("invalid signer or provider","signerOrProvider",r),Pe(this,"callStatic",{}),Pe(this,"estimateGas",{}),Pe(this,"functions",{}),Pe(this,"populateTransaction",{}),Pe(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];Pe(this.filters,a,(...c)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,c)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?Pe(this.filters,a,this.filters[l[0]]):ur.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Pe(this,"_runningEvents",{}),Pe(this,"_wrappedEmits",{}),e==null&&ur.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Pe(this,"address",e),this.provider)Pe(this,"resolvedAddress",yx(this.provider,e));else try{Pe(this,"resolvedAddress",Promise.resolve(oi(e)))}catch{ur.throwError("provider is required to use ENS name as contract address",_e.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(o=>{});const i={},s={};Object.keys(this.interface.functions).forEach(o=>{const a=this.interface.functions[o];if(s[o]){ur.warn(`Duplicate ABI entry for ${JSON.stringify(o)}`);return}s[o]=!0;{const l=a.name;i[`%${l}`]||(i[`%${l}`]=[]),i[`%${l}`].push(o)}this[o]==null&&Pe(this,o,d4(this,a,!0)),this.functions[o]==null&&Pe(this.functions,o,d4(this,a,!1)),this.callStatic[o]==null&&Pe(this.callStatic,o,zj(this,a,!0)),this.populateTransaction[o]==null&&Pe(this.populateTransaction,o,Yke(this,a)),this.estimateGas[o]==null&&Pe(this.estimateGas,o,$ke(this,a))}),Object.keys(i).forEach(o=>{const a=i[o];if(a.length>1)return;o=o.substring(1);const l=a[0];try{this[o]==null&&Pe(this,o,this[l])}catch{}this.functions[o]==null&&Pe(this.functions,o,this.functions[l]),this.callStatic[o]==null&&Pe(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&Pe(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&Pe(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return hH(e)}static getInterface(e){return h4.isInterface(e)?e:new h4(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(t=>(t==="0x"&&ur.throwError("contract not deployed",_e.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||ur.throwError("sending a transactions require a signer",_e.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=kn(e||{});return["from","to"].forEach(function(r){t[r]!=null&&ur.throwError("cannot override "+r,_e.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new uI(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&Pe(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return zT.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new Jke);if(e==="event")return this._normalizeRunningEvent(new t0("event",null));if(e==="*")return this._normalizeRunningEvent(new m4(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new p4(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const r=e.topics[0];if(typeof r!="string")throw new Error("invalid topic");const i=this.interface.getEvent(r);return this._normalizeRunningEvent(new p4(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new t0(Gj(t),t))}return this._normalizeRunningEvent(new m4(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){const i=Us(t);return i.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(t.blockHash),i.getTransaction=()=>this.provider.getTransaction(t.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(i),i}_addEventListener(e,t,r){if(this.provider||ur.throwError("events require a provider or a signer with a provider",_e.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=s=>{let o=this._wrapEvent(e,s,t);if(o.decodeError==null)try{const a=e.getEmit(o);this.emit(e.filter,...a)}catch(a){o.decodeError=a.error}e.filter!=null&&this.emit("event",o),o.decodeError!=null&&this.emit("error",o.decodeError,o)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,t,r){const i=this._getRunningEvent(e),s=kn(i.filter);return typeof t=="string"&&Tt(t,32)?(r!=null&&ur.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),s.blockHash=t):(s.fromBlock=t??0,s.toBlock=r??"latest"),this.provider.getLogs(s).then(o=>o.map(a=>this._wrapEvent(i,a,null)))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const r=this._getRunningEvent(e),i=r.run(t)>0;return this._checkRunningEvents(r),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((t,r)=>t+this._runningEvents[r].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const t=[];for(let r in this._runningEvents)this._runningEvents[r].listeners().forEach(i=>{t.push(i)});return t}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const r in this._runningEvents){const i=this._runningEvents[r];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class Y1 extends e4e{}const t4e="0x543D43F390b7d681513045e8a85707438c463d80",wx={owner:"0x634B0510C5062CFf8009eAAc2435eB93bc4764ad",address:"0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",abi:[{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"tokenPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"numberOfTokens",type:"uint256"},{internalType:"string",name:"_tokenURI",type:"string"}],name:"mintToken",outputs:[],stateMutability:"payable",type:"function"}]},g4={address:"0x0000000000000aF8FE6E4DE40F4804C90fA8Ea8F",abi:[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AddressMismatch",type:"error"},{inputs:[],name:"AlreadyProxied",type:"error"},{inputs:[],name:"ColdAddressCannotBeTheSameAsHot",type:"error"},{inputs:[],name:"ColdIsAddressZero",type:"error"},{inputs:[],name:"ColdWalletCannotInteractUseHot",type:"error"},{inputs:[],name:"DeliveryCannotBeTheZeroAddress",type:"error"},{inputs:[],name:"DeliveryIsAddressZero",type:"error"},{inputs:[],name:"EthWithdrawFailed",type:"error"},{inputs:[],name:"IncorrectProxyRegisterFee",type:"error"},{inputs:[],name:"MigrationIsAllowedOnceOnly",type:"error"},{inputs:[],name:"NoPaymentPendingForAddress",type:"error"},{inputs:[],name:"NoRecordFoundForAddress",type:"error"},{inputs:[],name:"OnlyHotAddressCanChangeAddress",type:"error"},{inputs:[],name:"ProxyRegisterFeeRequired",type:"error"},{inputs:[],name:"RegisterAddressLocked",type:"error"},{inputs:[],name:"RewardRateIsLocked",type:"error"},{inputs:[],name:"UnknownAmount",type:"error"},{inputs:[],name:"UnrecognisedEPSAPIAmount",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!0,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"address",name:"oldDelivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"DeliveryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"ensReverseRegistrarAddress",type:"address"}],name:"ENSReverseRegistrarSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"erc20",type:"address"},{indexed:!1,internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"ERC20FeeUpdated",type:"event"},{anonymous:!1,inputs:[],name:"MigrationComplete",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"NominationAccepted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"NominationMade",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"ProxyRecordLive",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"enum IEPSProxyRegister.Participant",name:"initiator",type:"uint8"},{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"RecordDeleted",type:"event"},{anonymous:!1,inputs:[],name:"RewardRateLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint96",name:"rewardRate",type:"uint96"}],name:"RewardRateUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newToken",type:"address"}],name:"RewardTokenUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"acceptNomination",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"activeEthAddresses",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"bool",name:"checkingHot_",type:"bool"}],name:"addressIsAvailable",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"beneficiaryBalance",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"id_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf1155",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf20",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryOf",outputs:[{internalType:"address",name:"beneficiary_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"coldToHot",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"provider_",type:"uint256"}],name:"deleteRecord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deletionNominalEth",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ensReverseRegistrar",outputs:[{internalType:"contract ENSReverseRegistrar",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"epsAPIBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegister",outputs:[{internalType:"contract IERC1155DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegister",outputs:[{internalType:"contract IERC20DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"erc20PerTransactionFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegister",outputs:[{internalType:"contract IERC721DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses1155",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses20",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses721",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAllAddresses",outputs:[{internalType:"address[]",name:"erc721Addresses_",type:"address[]"},{internalType:"address[]",name:"erc1155Addresses_",type:"address[]"},{internalType:"address[]",name:"erc20Addresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_receivedAddress",type:"address"}],name:"getColdAndDeliveryAddresses",outputs:[{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"bool",name:"isProxied",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"getProxyRecordForAddress",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"getProxyRecordForCold",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"getProxyRecordForHot",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"hotToRecord",outputs:[{internalType:"uint64",name:"provider",type:"uint64"},{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"bool",name:"feePaid",type:"bool"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"}],name:"isValidAddresses",outputs:[],stateMutability:"pure",type:"function"},{inputs:[],name:"lockERC1155DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC20DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC721DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],internalType:"struct EPSRegister.MigratedRecord[]",name:"migratedRecords_",type:"tuple[]"}],name:"migration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"migrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"nominate",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sender_",type:"address"},{internalType:"uint256",name:"erc20Value_",type:"uint256"},{internalType:"bytes",name:"data_",type:"bytes"}],name:"onTokenTransfer",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxyRegisterFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC1155",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC1155",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"rescueERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC721",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC721",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rewardRate",outputs:[{internalType:"uint88",name:"",type:"uint88"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardRateLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardToken",outputs:[{internalType:"contract IOAT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"deleteNominalEth_",type:"uint256"}],name:"setDeletionNominalEth",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"ensName_",type:"string"}],name:"setENSName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ensReverseRegistrar_",type:"address"}],name:"setENSReverseRegistrar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc1155DelegationRegister_",type:"address"}],name:"setERC1155DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20DelegationRegister_",type:"address"}],name:"setERC20DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20_",type:"address"},{internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"setERC20Fee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc721DelegationRegister_",type:"address"}],name:"setERC721DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"count_",type:"uint256"},{internalType:"uint256",name:"air_",type:"uint256"}],name:"setNNumberOfEthAddressesAndAirdropAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"registerFee_",type:"uint256"}],name:"setRegisterFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint88",name:"rewardRate_",type:"uint88"}],name:"setRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"rewardToken_",type:"address"}],name:"setRewardToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"treasuryAddress_",type:"address"}],name:"setTreasuryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint256",name:"provider_",type:"uint256"}],name:"updateDeliveryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawETH",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]};function Vj(n,e){return function(){return n.apply(e,arguments)}}const{toString:n4e}=Object.prototype,{getPrototypeOf:cU}=Object,$1=(n=>e=>{const t=n4e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Aa=n=>(n=n.toLowerCase(),e=>$1(e)===n),Z1=n=>e=>typeof e===n,{isArray:Ap}=Array,n0=Z1("undefined");function r4e(n){return n!==null&&!n0(n)&&n.constructor!==null&&!n0(n.constructor)&&Ds(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const jj=Aa("ArrayBuffer");function i4e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&jj(n.buffer),e}const s4e=Z1("string"),Ds=Z1("function"),Wj=Z1("number"),q1=n=>n!==null&&typeof n=="object",o4e=n=>n===!0||n===!1,Ow=n=>{if($1(n)!=="object")return!1;const e=cU(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},a4e=Aa("Date"),l4e=Aa("File"),c4e=Aa("Blob"),A4e=Aa("FileList"),u4e=n=>q1(n)&&Ds(n.pipe),f4e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Ds(n.append)&&((e=$1(n))==="formdata"||e==="object"&&Ds(n.toString)&&n.toString()==="[object FormData]"))},h4e=Aa("URLSearchParams"),[d4e,p4e,m4e,g4e]=["ReadableStream","Request","Response","Headers"].map(Aa),v4e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function L0(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),Ap(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const fu=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Xj=n=>!n0(n)&&n!==fu;function GT(){const{caseless:n}=Xj(this)&&this||{},e={},t=(r,i)=>{const s=n&&Kj(e,i)||i;Ow(e[s])&&Ow(r)?e[s]=GT(e[s],r):Ow(r)?e[s]=GT({},r):Ap(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(L0(e,(i,s)=>{t&&Ds(i)?n[s]=Vj(i,t):n[s]=i},{allOwnKeys:r}),n),w4e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),_4e=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},x4e=(n,e,t,r)=>{let i,s,o;const a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),s=i.length;s-- >0;)o=i[s],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&cU(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},b4e=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},E4e=n=>{if(!n)return null;if(Ap(n))return n;let e=n.length;if(!Wj(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},B4e=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&cU(Uint8Array)),S4e=(n,e)=>{const r=(n&&n[Symbol.iterator]).call(n);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(n,s[0],s[1])}},M4e=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},C4e=Aa("HTMLFormElement"),T4e=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),v4=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),I4e=Aa("RegExp"),Yj=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};L0(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},R4e=n=>{Yj(n,(e,t)=>{if(Ds(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Ds(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},U4e=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return Ap(n)?r(n):r(String(n).split(e)),t},F4e=()=>{},P4e=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e,pS="abcdefghijklmnopqrstuvwxyz",y4="0123456789",$j={DIGIT:y4,ALPHA:pS,ALPHA_DIGIT:pS+pS.toUpperCase()+y4},L4e=(n=16,e=$j.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function D4e(n){return!!(n&&Ds(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const N4e=n=>{const e=new Array(10),t=(r,i)=>{if(q1(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=Ap(r)?[]:{};return L0(r,(o,a)=>{const l=t(o,i+1);!n0(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},O4e=Aa("AsyncFunction"),k4e=n=>n&&(q1(n)||Ds(n))&&Ds(n.then)&&Ds(n.catch),Zj=((n,e)=>n?setImmediate:e?((t,r)=>(fu.addEventListener("message",({source:i,data:s})=>{i===fu&&s===t&&r.length&&r.shift()()},!1),i=>{r.push(i),fu.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Ds(fu.postMessage)),H4e=typeof queueMicrotask<"u"?queueMicrotask.bind(fu):typeof process<"u"&&process.nextTick||Zj,Te={isArray:Ap,isArrayBuffer:jj,isBuffer:r4e,isFormData:f4e,isArrayBufferView:i4e,isString:s4e,isNumber:Wj,isBoolean:o4e,isObject:q1,isPlainObject:Ow,isReadableStream:d4e,isRequest:p4e,isResponse:m4e,isHeaders:g4e,isUndefined:n0,isDate:a4e,isFile:l4e,isBlob:c4e,isRegExp:I4e,isFunction:Ds,isStream:u4e,isURLSearchParams:h4e,isTypedArray:B4e,isFileList:A4e,forEach:L0,merge:GT,extend:y4e,trim:v4e,stripBOM:w4e,inherits:_4e,toFlatObject:x4e,kindOf:$1,kindOfTest:Aa,endsWith:b4e,toArray:E4e,forEachEntry:S4e,matchAll:M4e,isHTMLForm:C4e,hasOwnProperty:v4,hasOwnProp:v4,reduceDescriptors:Yj,freezeMethods:R4e,toObjectSet:U4e,toCamelCase:T4e,noop:F4e,toFiniteNumber:P4e,findKey:Kj,global:fu,isContextDefined:Xj,ALPHABET:$j,generateString:L4e,isSpecCompliantForm:D4e,toJSONObject:N4e,isAsyncFn:O4e,isThenable:k4e,setImmediate:Zj,asap:H4e};function xt(n,e,t,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}Te.inherits(xt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Te.toJSONObject(this.config),code:this.code,status:this.status}}});const qj=xt.prototype,Jj={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{Jj[n]={value:n}});Object.defineProperties(xt,Jj);Object.defineProperty(qj,"isAxiosError",{value:!0});xt.from=(n,e,t,r,i,s)=>{const o=Object.create(qj);return Te.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),xt.call(o,n.message,e,t,r,i),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const Q4e=null;function VT(n){return Te.isPlainObject(n)||Te.isArray(n)}function eW(n){return Te.endsWith(n,"[]")?n.slice(0,-2):n}function w4(n,e,t){return n?n.concat(e).map(function(i,s){return i=eW(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function z4e(n){return Te.isArray(n)&&!n.some(VT)}const G4e=Te.toFlatObject(Te,{},null,function(e){return/^is[A-Z]/.test(e)});function J1(n,e,t){if(!Te.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Te.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,g){return!Te.isUndefined(g[m])});const r=t.metaTokens,i=t.visitor||A,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Te.isSpecCompliantForm(e);if(!Te.isFunction(i))throw new TypeError("visitor must be a function");function c(d){if(d===null)return"";if(Te.isDate(d))return d.toISOString();if(!l&&Te.isBlob(d))throw new xt("Blob is not supported. Use a Buffer instead.");return Te.isArrayBuffer(d)||Te.isTypedArray(d)?l&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function A(d,m,g){let p=d;if(d&&!g&&typeof d=="object"){if(Te.endsWith(m,"{}"))m=r?m:m.slice(0,-2),d=JSON.stringify(d);else if(Te.isArray(d)&&z4e(d)||(Te.isFileList(d)||Te.endsWith(m,"[]"))&&(p=Te.toArray(d)))return m=eW(m),p.forEach(function(w,_){!(Te.isUndefined(w)||w===null)&&e.append(o===!0?w4([m],_,s):o===null?m:m+"[]",c(w))}),!1}return VT(d)?!0:(e.append(w4(g,m,s),c(d)),!1)}const u=[],f=Object.assign(G4e,{defaultVisitor:A,convertValue:c,isVisitable:VT});function h(d,m){if(!Te.isUndefined(d)){if(u.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));u.push(d),Te.forEach(d,function(p,v){(!(Te.isUndefined(p)||p===null)&&i.call(e,p,Te.isString(v)?v.trim():v,m,f))===!0&&h(p,m?m.concat(v):[v])}),u.pop()}}if(!Te.isObject(n))throw new TypeError("data must be an object");return h(n),e}function _4(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function AU(n,e){this._pairs=[],n&&J1(n,this,e)}const tW=AU.prototype;tW.append=function(e,t){this._pairs.push([e,t])};tW.toString=function(e){const t=e?function(r){return e.call(this,r,_4)}:_4;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function V4e(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function nW(n,e,t){if(!e)return n;const r=t&&t.encode||V4e,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Te.isURLSearchParams(e)?e.toString():new AU(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class j4e{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Te.forEach(this.handlers,function(r){r!==null&&e(r)})}}const x4=j4e,rW={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},W4e=typeof URLSearchParams<"u"?URLSearchParams:AU,K4e=typeof FormData<"u"?FormData:null,X4e=typeof Blob<"u"?Blob:null,Y4e={isBrowser:!0,classes:{URLSearchParams:W4e,FormData:K4e,Blob:X4e},protocols:["http","https","file","blob","url","data"]},uU=typeof window<"u"&&typeof document<"u",jT=typeof navigator=="object"&&navigator||void 0,$4e=uU&&(!jT||["ReactNative","NativeScript","NS"].indexOf(jT.product)<0),Z4e=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),q4e=uU&&window.location.href||"http://localhost",J4e=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:uU,hasStandardBrowserEnv:$4e,hasStandardBrowserWebWorkerEnv:Z4e,navigator:jT,origin:q4e},Symbol.toStringTag,{value:"Module"})),os={...J4e,...Y4e};function eHe(n,e){return J1(n,new os.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return os.isNode&&Te.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function tHe(n){return Te.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function nHe(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Te.isArray(i)?i.length:o,l?(Te.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Te.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Te.isArray(i[o])&&(i[o]=nHe(i[o])),!a)}if(Te.isFormData(n)&&Te.isFunction(n.entries)){const t={};return Te.forEachEntry(n,(r,i)=>{e(tHe(r),i,t,0)}),t}return null}function rHe(n,e,t){if(Te.isString(n))try{return(e||JSON.parse)(n),Te.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const fU={transitional:rW,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Te.isObject(e);if(s&&Te.isHTMLForm(e)&&(e=new FormData(e)),Te.isFormData(e))return i?JSON.stringify(iW(e)):e;if(Te.isArrayBuffer(e)||Te.isBuffer(e)||Te.isStream(e)||Te.isFile(e)||Te.isBlob(e)||Te.isReadableStream(e))return e;if(Te.isArrayBufferView(e))return e.buffer;if(Te.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return eHe(e,this.formSerializer).toString();if((a=Te.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return J1(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),rHe(e)):e}],transformResponse:[function(e){const t=this.transitional||fU.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(Te.isResponse(e)||Te.isReadableStream(e))return e;if(e&&Te.isString(e)&&(r&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?xt.from(a,xt.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:os.classes.FormData,Blob:os.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Te.forEach(["delete","get","head","post","put","patch"],n=>{fU.headers[n]={}});const hU=fU,iHe=Te.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),sHe=n=>{const e={};let t,r,i;return n&&n.split(` -`).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!t||e[t]&&iHe[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},b4=Symbol("internals");function um(n){return n&&String(n).trim().toLowerCase()}function kw(n){return n===!1||n==null?n:Te.isArray(n)?n.map(kw):String(n)}function oHe(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const aHe=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function mS(n,e,t,r,i){if(Te.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Te.isString(e)){if(Te.isString(r))return e.indexOf(r)!==-1;if(Te.isRegExp(r))return r.test(e)}}function lHe(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function cHe(n,e){const t=Te.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}class eb{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,c){const A=um(l);if(!A)throw new Error("header name must be a non-empty string");const u=Te.findKey(i,A);(!u||i[u]===void 0||c===!0||c===void 0&&i[u]!==!1)&&(i[u||l]=kw(a))}const o=(a,l)=>Te.forEach(a,(c,A)=>s(c,A,l));if(Te.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Te.isString(e)&&(e=e.trim())&&!aHe(e))o(sHe(e),t);else if(Te.isHeaders(e))for(const[a,l]of e.entries())s(l,a,r);else e!=null&&s(t,e,r);return this}get(e,t){if(e=um(e),e){const r=Te.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return oHe(i);if(Te.isFunction(t))return t.call(this,i,r);if(Te.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=um(e),e){const r=Te.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||mS(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=um(o),o){const a=Te.findKey(r,o);a&&(!t||mS(r,r[a],a,t))&&(delete r[a],i=!0)}}return Te.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const s=t[r];(!e||mS(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Te.forEach(this,(i,s)=>{const o=Te.findKey(r,s);if(o){t[o]=kw(i),delete t[s];return}const a=e?lHe(s):String(s).trim();a!==s&&delete t[s],t[a]=kw(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Te.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Te.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` -`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[b4]=this[b4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=um(o);r[a]||(cHe(i,o),r[a]=!0)}return Te.isArray(e)?e.forEach(s):s(e),this}}eb.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Te.reduceDescriptors(eb.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Te.freezeMethods(eb);const na=eb;function gS(n,e){const t=this||hU,r=e||t,i=na.from(r.headers);let s=r.data;return Te.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function sW(n){return!!(n&&n.__CANCEL__)}function up(n,e,t){xt.call(this,n??"canceled",xt.ERR_CANCELED,e,t),this.name="CanceledError"}Te.inherits(up,xt,{__CANCEL__:!0});function oW(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new xt("Request failed with status code "+t.status,[xt.ERR_BAD_REQUEST,xt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function AHe(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function uHe(n,e){n=n||10;const t=new Array(n),r=new Array(n);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),A=r[s];o||(o=c),t[i]=l,r[i]=c;let u=s,f=0;for(;u!==i;)f+=t[u++],u=u%n;if(i=(i+1)%n,i===s&&(s=(s+1)%n),c-o{t=A,i=null,s&&(clearTimeout(s),s=null),n.apply(null,c)};return[(...c)=>{const A=Date.now(),u=A-t;u>=r?o(c,A):(i=c,s||(s=setTimeout(()=>{s=null,o(i)},r-u)))},()=>i&&o(i)]}const _x=(n,e,t=3)=>{let r=0;const i=uHe(50,250);return fHe(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,c=i(l),A=o<=a;r=o;const u={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&A?(a-o)/c:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(u)},t)},E4=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},B4=n=>(...e)=>Te.asap(()=>n(...e)),hHe=os.hasStandardBrowserEnv?function(){const e=os.navigator&&/(msie|trident)/i.test(os.navigator.userAgent),t=document.createElement("a");let r;function i(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(o){const a=Te.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}(),dHe=os.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Te.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Te.isString(r)&&o.push("path="+r),Te.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function pHe(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function mHe(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function aW(n,e){return n&&!pHe(e)?mHe(n,e):e}const S4=n=>n instanceof na?{...n}:n;function Ou(n,e){e=e||{};const t={};function r(c,A,u){return Te.isPlainObject(c)&&Te.isPlainObject(A)?Te.merge.call({caseless:u},c,A):Te.isPlainObject(A)?Te.merge({},A):Te.isArray(A)?A.slice():A}function i(c,A,u){if(Te.isUndefined(A)){if(!Te.isUndefined(c))return r(void 0,c,u)}else return r(c,A,u)}function s(c,A){if(!Te.isUndefined(A))return r(void 0,A)}function o(c,A){if(Te.isUndefined(A)){if(!Te.isUndefined(c))return r(void 0,c)}else return r(void 0,A)}function a(c,A,u){if(u in e)return r(c,A);if(u in n)return r(void 0,c)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,A)=>i(S4(c),S4(A),!0)};return Te.forEach(Object.keys(Object.assign({},n,e)),function(A){const u=l[A]||i,f=u(n[A],e[A],A);Te.isUndefined(f)&&u!==a||(t[A]=f)}),t}const lW=n=>{const e=Ou({},n);let{data:t,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=na.from(o),e.url=nW(aW(e.baseURL,e.url),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let l;if(Te.isFormData(t)){if(os.hasStandardBrowserEnv||os.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((l=o.getContentType())!==!1){const[c,...A]=l?l.split(";").map(u=>u.trim()).filter(Boolean):[];o.setContentType([c||"multipart/form-data",...A].join("; "))}}if(os.hasStandardBrowserEnv&&(r&&Te.isFunction(r)&&(r=r(e)),r||r!==!1&&hHe(e.url))){const c=i&&s&&dHe.read(s);c&&o.set(i,c)}return e},gHe=typeof XMLHttpRequest<"u",vHe=gHe&&function(n){return new Promise(function(t,r){const i=lW(n);let s=i.data;const o=na.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=i,A,u,f,h,d;function m(){h&&h(),d&&d(),i.cancelToken&&i.cancelToken.unsubscribe(A),i.signal&&i.signal.removeEventListener("abort",A)}let g=new XMLHttpRequest;g.open(i.method.toUpperCase(),i.url,!0),g.timeout=i.timeout;function p(){if(!g)return;const w=na.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:w,config:n,request:g};oW(function(B){t(B),m()},function(B){r(B),m()},x),g=null}"onloadend"in g?g.onloadend=p:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(p)},g.onabort=function(){g&&(r(new xt("Request aborted",xt.ECONNABORTED,n,g)),g=null)},g.onerror=function(){r(new xt("Network Error",xt.ERR_NETWORK,n,g)),g=null},g.ontimeout=function(){let _=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const x=i.transitional||rW;i.timeoutErrorMessage&&(_=i.timeoutErrorMessage),r(new xt(_,x.clarifyTimeoutError?xt.ETIMEDOUT:xt.ECONNABORTED,n,g)),g=null},s===void 0&&o.setContentType(null),"setRequestHeader"in g&&Te.forEach(o.toJSON(),function(_,x){g.setRequestHeader(x,_)}),Te.isUndefined(i.withCredentials)||(g.withCredentials=!!i.withCredentials),a&&a!=="json"&&(g.responseType=i.responseType),c&&([f,d]=_x(c,!0),g.addEventListener("progress",f)),l&&g.upload&&([u,h]=_x(l),g.upload.addEventListener("progress",u),g.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(A=w=>{g&&(r(!w||w.type?new up(null,n,g):w),g.abort(),g=null)},i.cancelToken&&i.cancelToken.subscribe(A),i.signal&&(i.signal.aborted?A():i.signal.addEventListener("abort",A)));const v=AHe(i.url);if(v&&os.protocols.indexOf(v)===-1){r(new xt("Unsupported protocol "+v+":",xt.ERR_BAD_REQUEST,n));return}g.send(s||null)})},yHe=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let r=new AbortController,i;const s=function(c){if(!i){i=!0,a();const A=c instanceof Error?c:this.reason;r.abort(A instanceof xt?A:new up(A instanceof Error?A.message:A))}};let o=e&&setTimeout(()=>{o=null,s(new xt(`timeout ${e} of ms exceeded`,xt.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),n=null)};n.forEach(c=>c.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>Te.asap(a),l}},wHe=yHe,_He=function*(n,e){let t=n.byteLength;if(!e||t{const i=xHe(n,e);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:A}=await i.next();if(c){a(),l.close();return}let u=A.byteLength;if(t){let f=s+=u;t(f)}l.enqueue(new Uint8Array(A))}catch(c){throw a(c),c}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},tb=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",cW=tb&&typeof ReadableStream=="function",EHe=tb&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),AW=(n,...e)=>{try{return!!n(...e)}catch{return!1}},BHe=cW&&AW(()=>{let n=!1;const e=new Request(os.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e}),C4=64*1024,WT=cW&&AW(()=>Te.isReadableStream(new Response("").body)),xx={stream:WT&&(n=>n.body)};tb&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!xx[e]&&(xx[e]=Te.isFunction(n[e])?t=>t[e]():(t,r)=>{throw new xt(`Response type '${e}' is not supported`,xt.ERR_NOT_SUPPORT,r)})})})(new Response);const SHe=async n=>{if(n==null)return 0;if(Te.isBlob(n))return n.size;if(Te.isSpecCompliantForm(n))return(await new Request(os.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(Te.isArrayBufferView(n)||Te.isArrayBuffer(n))return n.byteLength;if(Te.isURLSearchParams(n)&&(n=n+""),Te.isString(n))return(await EHe(n)).byteLength},MHe=async(n,e)=>{const t=Te.toFiniteNumber(n.getContentLength());return t??SHe(e)},CHe=tb&&(async n=>{let{url:e,method:t,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:A,withCredentials:u="same-origin",fetchOptions:f}=lW(n);c=c?(c+"").toLowerCase():"text";let h=wHe([i,s&&s.toAbortSignal()],o),d;const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let g;try{if(l&&BHe&&t!=="get"&&t!=="head"&&(g=await MHe(A,r))!==0){let x=new Request(e,{method:"POST",body:r,duplex:"half"}),b;if(Te.isFormData(r)&&(b=x.headers.get("content-type"))&&A.setContentType(b),x.body){const[B,M]=E4(g,_x(B4(l)));r=M4(x.body,C4,B,M)}}Te.isString(u)||(u=u?"include":"omit");const p="credentials"in Request.prototype;d=new Request(e,{...f,signal:h,method:t.toUpperCase(),headers:A.normalize().toJSON(),body:r,duplex:"half",credentials:p?u:void 0});let v=await fetch(d);const w=WT&&(c==="stream"||c==="response");if(WT&&(a||w&&m)){const x={};["status","statusText","headers"].forEach(I=>{x[I]=v[I]});const b=Te.toFiniteNumber(v.headers.get("content-length")),[B,M]=a&&E4(b,_x(B4(a),!0))||[];v=new Response(M4(v.body,C4,B,()=>{M&&M(),m&&m()}),x)}c=c||"text";let _=await xx[Te.findKey(xx,c)||"text"](v,n);return!w&&m&&m(),await new Promise((x,b)=>{oW(x,b,{data:_,headers:na.from(v.headers),status:v.status,statusText:v.statusText,config:n,request:d})})}catch(p){throw m&&m(),p&&p.name==="TypeError"&&/fetch/i.test(p.message)?Object.assign(new xt("Network Error",xt.ERR_NETWORK,n,d),{cause:p.cause||p}):xt.from(p,p&&p.code,n,d)}}),KT={http:Q4e,xhr:vHe,fetch:CHe};Te.forEach(KT,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const T4=n=>`- ${n}`,THe=n=>Te.isFunction(n)||n===null||n===!1,uW={getAdapter:n=>{n=Te.isArray(n)?n:[n];const{length:e}=n;let t,r;const i={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : -`+s.map(T4).join(` -`):" "+T4(s[0]):"as no adapter specified";throw new xt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:KT};function vS(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new up(null,n)}function I4(n){return vS(n),n.headers=na.from(n.headers),n.data=gS.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),uW.getAdapter(n.adapter||hU.adapter)(n).then(function(r){return vS(n),r.data=gS.call(n,n.transformResponse,r),r.headers=na.from(r.headers),r},function(r){return sW(r)||(vS(n),r&&r.response&&(r.response.data=gS.call(n,n.transformResponse,r.response),r.response.headers=na.from(r.response.headers))),Promise.reject(r)})}const fW="1.7.7",dU={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{dU[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const R4={};dU.transitional=function(e,t,r){function i(s,o){return"[Axios v"+fW+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new xt(i(o," has been removed"+(t?" in "+t:"")),xt.ERR_DEPRECATED);return t&&!R4[o]&&(R4[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};function IHe(n,e,t){if(typeof n!="object")throw new xt("options must be an object",xt.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const a=n[s],l=a===void 0||o(a,s,n);if(l!==!0)throw new xt("option "+s+" must be "+l,xt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new xt("Unknown option "+s,xt.ERR_BAD_OPTION)}}const XT={assertOptions:IHe,validators:dU},Ic=XT.validators;class bx{constructor(e){this.defaults=e,this.interceptors={request:new x4,response:new x4}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+s):r.stack=s}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Ou(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&XT.assertOptions(r,{silentJSONParsing:Ic.transitional(Ic.boolean),forcedJSONParsing:Ic.transitional(Ic.boolean),clarifyTimeoutError:Ic.transitional(Ic.boolean)},!1),i!=null&&(Te.isFunction(i)?t.paramsSerializer={serialize:i}:XT.assertOptions(i,{encode:Ic.function,serialize:Ic.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Te.merge(s.common,s[t.method]);s&&Te.forEach(["delete","get","head","post","put","patch","common"],d=>{delete s[d]}),t.headers=na.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let A,u=0,f;if(!l){const d=[I4.bind(this),void 0];for(d.unshift.apply(d,a),d.push.apply(d,c),f=d.length,A=Promise.resolve(t);u{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new up(s,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new pU(function(i){e=i}),cancel:e}}}const RHe=pU;function UHe(n){return function(t){return n.apply(null,t)}}function FHe(n){return Te.isObject(n)&&n.isAxiosError===!0}const YT={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(YT).forEach(([n,e])=>{YT[e]=n});const PHe=YT;function hW(n){const e=new Hw(n),t=Vj(Hw.prototype.request,e);return Te.extend(t,Hw.prototype,e,{allOwnKeys:!0}),Te.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return hW(Ou(n,i))},t}const Mr=hW(hU);Mr.Axios=Hw;Mr.CanceledError=up;Mr.CancelToken=RHe;Mr.isCancel=sW;Mr.VERSION=fW;Mr.toFormData=J1;Mr.AxiosError=xt;Mr.Cancel=Mr.CanceledError;Mr.all=function(e){return Promise.all(e)};Mr.spread=UHe;Mr.isAxiosError=FHe;Mr.mergeConfig=Ou;Mr.AxiosHeaders=na;Mr.formToJSON=n=>iW(Te.isHTMLForm(n)?new FormData(n):n);Mr.getAdapter=uW.getAdapter;Mr.HttpStatusCode=PHe;Mr.default=Mr;const LHe=Mr,DHe={}.VITE_OPENSEA_KEY,NHe={}.VITE_PINATA_API_KEY,OHe={}.VITE_PINATA_API_SECRET,yS="0x89";let Wy;async function kHe(){if(Wy!=null)return Wy;const n=new YH("https://polygon-rpc.com/"),t=await new Y1(wx.address,wx.abi,n).tokenPrice();return Wy=Ve.from(t).mul(1),Wy}function HHe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":DHe}};return console.log(t),new Promise((r,i)=>{fetch("https://api.opensea.io/api/v2/chain/ethereum/account/"+n+"/nfts?collection="+e,t).then(s=>{if(s.ok)return s.json();i("Failed to fetch data from Opensea API")}).then(s=>{r(s)}).catch(s=>{i(s)})})}async function mU(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(yS,16)){const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}else try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:yS}]});const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}catch(e){console.log("polygon not find:",e);try{await window.ethereum.request({method:"wallet_addEthereumChain",params:[{chainId:"0x89",chainName:"Polygon Mainnet",rpcUrls:["https://polygon-rpc.com"],nativeCurrency:{name:"Matic",symbol:"MATIC",decimals:18},blockExplorerUrls:["https://polygonscan.com/"]}]}),await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:yS}]});const t=await window.ethereum.request({method:"eth_requestAccounts"});return t.length>0?t[0]:""}catch(t){console.log("Adding polygon chain failed",t)}}}catch{return""}else return""}async function wS(n,e){if(!n)return console.warn("Error saving to pinata: No file data");const t="https://api.pinata.cloud/pinning/pinFileToIPFS";let r=new FormData;return r.append("file",n,e),(await LHe.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:NHe,pinata_secret_api_key:OHe}})).data}const QHe=n=>{let e=[];return Object.keys(n).map(t=>{Object.keys(n[t]).length!==0&&e.push({trait_type:t,value:n[t].name})}),e};async function zHe(n,e,t,r,i){if(!n)throw new Error("No avatar was provided");if(!e)throw new Error("No screenshot was provided");if(!t)throw new Error("No model was provided");const s=await mU();if(s=="")return"Please Connect Wallet";if(!i||await GHe(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let v=0;v<10;v++)try{return await wS(e,a).catch(_=>{console.error(v,"---",_)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const c=await h0e(t,n,4096);let A;if(c){let v="AvatarGlb_"+Date.now()+".glb";A=await(async()=>{for(let w=0;w<10;w++)try{return await wS(c,v).catch(x=>(console.error(w,"---",x),"Couldn't save glb to pinata"))}catch(_){return console.warn(_),"Couldn't save glb to pinata"}return"Failed to upload glb"})()}else return"Unable to get glb";const u={name:r||"Avatars",description:"Character Studio Avatars.",image:`ipfs://${l.IpfsHash}`,animation_url:`ipfs://${A.IpfsHash}`,attributes:QHe(n)},f=JSON.stringify(u),d=`ipfs://${(await wS(new Blob([f]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let m=await kHe();const g=new hI(window.ethereum).getSigner(),p=new Y1(wx.address,wx.abi,g);try{const v={value:m,from:s};if((await(await p.mintToken(1,d,v)).wait()).transactionHash)return console.log("Mint success!"),"Mint success!"}catch{return"Public Mint failed."}}}const GHe=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=iY("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new Y1(g4.address,g4.abi,t).beneficiaryBalanceOf(e,t4e,1);return parseInt(i)>0?!0:(console.log(`Currently in alpha. You need a genesis pass to mint. - Will be public soon!`),!1)}else return console.log("Please connect your wallet"),!1};function VHe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=q.useContext(cs),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:c}=q.useContext(pr),[A,u]=xe.useState(null),[f,h]=xe.useState(""),{playSound:d}=q.useContext(So),{isMute:m}=q.useContext(Bo);q.useState(null);const[g,p]=q.useState(null),[v,w]=q.useState(""),_=()=>{!m&&d("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(yt.LANDING)},x=()=>{const y=Qe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Dn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Dn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:y===0||y==2,exportMtoonAtlas:y===1||y==2,ktxCompression:Qe.merge_options_ktx_compression||!1,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},b=y=>{const E=g[y].manifestName;(async()=>{(Qe.mergeOptions_download_vrm_preview==null?!0:Qe.mergeOptions_download_vrm_preview)&&i.savePortraitScreenshot(E,512,1024,1.5,-.1),(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm)&&await i.downloadVRM(E,x());const z=new Jd,W=c.parent;W.remove(c);const H=Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora;if(H===!0){const K=r.loras.map(async te=>a.createLoraData(te,z));await Promise.all(K)}const C=Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites;if(C===!0){const K=r.sprites.map(async te=>l.createSpriteAtlas(te,z));await Promise.all(K)}(H===!0||C===!0)&&z.saveZip(g[y].manifestName),W.add(c),y{y==0?(console.log(r.loras[0]),b(y)):(await i.setManifest(g[y]),t(!0),i.loadInitialTraits().then(async()=>{await(U=>new Promise(P=>setTimeout(P,U)))(1),b(y)}))},M=()=>{t(!0),B(0)},{t:I}=xe.useContext(aa),S=async y=>{if(i.getCurrentCharacterModel()){const U=Vl(y.name),P=URL.createObjectURL(y);await s.loadAnimation(P,!1,0,!0,"",U),w(s.getCurrentAnimationName()),URL.revokeObjectURL(P)}else console.warn("Please load a vrm model to test animations.")},L=async y=>{const E=URL.createObjectURL(y);await i.loadOptimizerCharacter(E),URL.revokeObjectURL(E);const U=Vl(y.name);h(U),u(i.getCurrentCharacterModel())},O=y=>{const E=Array.from(y),U=[],P=N=>new Promise((z,W)=>{if(N&&N.name.toLowerCase().endsWith(".json")){const H=new FileReader,C=N.name.replace(/\.[^/.]+$/,"");H.onload=function(K){try{const te=JSON.parse(K.target.result),F=te.thumbnail;te.manifestName=C,U.push(te),z()}catch(te){console.error("Error parsing the JSON file:",te),W(te)}},H.readAsText(N)}});Promise.all(E.map(P)).then(()=>{U.length>0&&(p(U),i.setManifest(U[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(N=>{console.error("Error processing files:",N)})},T=async y=>{const E=y[0];E&&E.name.toLowerCase().endsWith(".fbx")&&S(E),E&&E.name.toLowerCase().endsWith(".vrm")&&L(E),E&&E.name.toLowerCase().endsWith(".json")&&O(y)};return Q.jsxs("div",{className:Di.container,children:[Q.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:Q.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),Q.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),Q.jsx(E0,{onFilesDrop:T}),Q.jsx(K1,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),Q.jsx(aU,{model:A}),Q.jsx(p2,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&Q.jsx(I1,{loadedAnimationName:v}),Q.jsxs("div",{className:Di.buttonContainer,children:[Q.jsx(Un,{theme:"light",text:I("callToAction.back"),size:14,className:Di.buttonLeft,onClick:_}),(g==null?void 0:g.length)==1&&Q.jsx(Un,{theme:"light",text:"Download",size:14,className:Di.buttonRight,onClick:M}),(g==null?void 0:g.length)>1&&Q.jsx(Un,{theme:"light",text:"Download All",size:14,className:Di.buttonRight,onClick:M})]})]})}const jHe="_classdisabled_hpzv8_1",WHe="_container_hpzv8_6",KHe="_classContainer_hpzv8_14",XHe="_icon_hpzv8_39",YHe="_name_hpzv8_70",$He="_description_hpzv8_79",ZHe="_classFrame_hpzv8_84",qHe="_frameContainer_hpzv8_104",JHe="_frame_hpzv8_104",eQe="_image_hpzv8_114",tQe="_lockedContainer_hpzv8_120",nQe="_locked_hpzv8_120",rQe="_buttonContainer_hpzv8_134",iQe="_buttonLeft_hpzv8_143",sQe="_buttonRight_hpzv8_147",oQe="_buttonCenter_hpzv8_151",aQe="_topLine_hpzv8_165",lQe="_bottomLine_hpzv8_191",At={classdisabled:jHe,container:WHe,classContainer:KHe,class:"_class_hpzv8_1",icon:XHe,name:YHe,description:$He,classFrame:ZHe,frameContainer:qHe,frame:JHe,image:eQe,lockedContainer:tQe,locked:nQe,buttonContainer:rQe,buttonLeft:iQe,buttonRight:sQe,buttonCenter:oQe,topLine:aQe,bottomLine:lQe};function cQe(){const{t:n}=xe.useContext(aa),{setViewMode:e,setIsLoading:t,isLoading:r}=q.useContext(cs),{playSound:i}=q.useContext(So),{isMute:s}=q.useContext(Bo),{manifest:o,characterManager:a}=q.useContext(pr),[l,c]=xe.useState([]);xe.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const d=o.characters.map(m=>({name:m.name,image:m.portrait,description:m.description,manifest:m.manifest,icon:m.icon,format:m.format,disabled:!1}));c(d)}},[o]);const A=()=>{e(yt.LANDING),!s&&i("backNextButton")},u=async d=>{t(!0),a.loadManifest(o.characters[d].manifest).then(()=>{e(yt.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{e(yt.BATCHMANIFEST)},h=()=>{!s&&i("classMouseOver")};return Q.jsxs("div",{className:`${At.container} horizontalScroll`,children:[Q.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),Q.jsx("div",{className:At.vrmOptimizerButton}),Q.jsx("div",{className:At.topLine}),Q.jsxs("div",{className:At.classContainer,children:[l.map((d,m)=>Q.jsxs("div",{className:d.disabled?At.classdisabled:At.class,onClick:d.disabled?null:()=>u(m),onMouseOver:d.disabled?null:()=>h(),children:[Q.jsxs("div",{className:At.classFrame,style:{backgroundImage:`url(${d.image})`},children:[Q.jsx("div",{className:At.frameContainer,children:Q.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:At.frame})}),Q.jsx("div",{className:At.lockedContainer,children:d.disabled&&Q.jsx("img",{src:"./assets/icons/locked.svg",className:At.locked})})]}),Q.jsx("div",{className:At.name,children:d.name}),Q.jsx("div",{className:At.description,children:d.description})]},m)),Q.jsxs("div",{className:At.class,onClick:()=>f(),onMouseOver:()=>h(),children:[Q.jsx("div",{className:At.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:Q.jsx("div",{className:At.frameContainer,children:Q.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:At.frame})})}),Q.jsx("div",{className:At.name,children:"Manifest"}),Q.jsx("div",{className:At.description,children:"Load by manifest"})]},"manifest-load")]}),Q.jsx("div",{className:At.bottomLine}),Q.jsx("div",{className:At.buttonContainer,children:Q.jsx(Un,{theme:"light",text:n("callToAction.back"),size:14,className:At.buttonLeft,onClick:A})})]})}function AQe(){const{t:n}=xe.useContext(aa),{setViewMode:e,setIsLoading:t,isLoading:r}=q.useContext(cs),{playSound:i}=q.useContext(So),{isMute:s}=q.useContext(Bo),{manifest:o,characterManager:a}=q.useContext(pr),[l,c]=xe.useState([]);xe.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const h=o.characters.map(d=>({name:d.name,image:d.portrait,description:d.description,manifest:d.manifest,icon:d.icon,format:d.format,disabled:!1}));c(h)}},[o]);const A=()=>{e(yt.LANDING),!s&&i("backNextButton")},u=async h=>{t(!0),a.loadManifest(o.characters[h].manifest).then(()=>{e(yt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{!s&&i("classMouseOver")};return Q.jsxs("div",{className:`${At.container} horizontalScroll`,children:[Q.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),Q.jsx("div",{className:At.vrmOptimizerButton}),Q.jsx("div",{className:At.topLine}),Q.jsx("div",{className:At.classContainer,children:l.map((h,d)=>Q.jsxs("div",{className:h.disabled?At.classdisabled:At.class,onClick:h.disabled?null:()=>u(d),onMouseOver:h.disabled?null:()=>f(),children:[Q.jsxs("div",{className:At.classFrame,style:{backgroundImage:`url(${h.image})`},children:[Q.jsx("div",{className:At.frameContainer,children:Q.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:At.frame})}),Q.jsx("div",{className:At.lockedContainer,children:h.disabled&&Q.jsx("img",{src:"./assets/icons/locked.svg",className:At.locked})})]}),Q.jsx("div",{className:At.name,children:h.name}),Q.jsx("div",{className:At.description,children:h.description})]},d))}),Q.jsx("div",{className:At.bottomLine}),Q.jsx("div",{className:At.buttonContainer,children:Q.jsx(Un,{theme:"light",text:n("callToAction.back"),size:14,className:At.buttonLeft,onClick:A})})]})}const uQe="_buttonContainer_1ueuk_1",fQe="_button_1ueuk_1",Qf={buttonContainer:uQe,button:fQe},U4={}.VITE_OPENSEA_KEY;function hQe(){const{setViewMode:n}=q.useContext(cs),{playSound:e}=q.useContext(So),{isMute:t}=q.useContext(Bo),{characterManager:r}=q.useContext(pr),i=()=>{n(yt.CREATE),!t&&e("backNextButton")},s=()=>{n(yt.CLAIM),!t&&e("backNextButton")},o=()=>{n(yt.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await mU()!=""&&n(yt.WALLET),!t&&e("backNextButton")};return Q.jsx("div",{className:Qf.container,children:Q.jsxs("div",{className:Qf.buttonContainer,children:[Q.jsx("button",{className:Qf.button,onClick:i,children:Q.jsx("img",{src:"./assets/media/btn_create_character.png"})}),Q.jsx("button",{className:Qf.button,onClick:s,children:Q.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),Q.jsx("button",{className:Qf.button,onClick:o,children:Q.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),U4&&U4!=""&&Q.jsx("button",{className:Qf.button,onClick:a,children:Q.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const YA={};var gU={exports:{}},cd=typeof Reflect=="object"?Reflect:null,F4=cd&&typeof cd.apply=="function"?cd.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},Qw;cd&&typeof cd.ownKeys=="function"?Qw=cd.ownKeys:Object.getOwnPropertySymbols?Qw=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Qw=function(e){return Object.getOwnPropertyNames(e)};function dQe(n){console&&console.warn&&console.warn(n)}var dW=Number.isNaN||function(e){return e!==e};function mn(){mn.init.call(this)}gU.exports=mn;gU.exports.once=vQe;mn.EventEmitter=mn;mn.prototype._events=void 0;mn.prototype._eventsCount=0;mn.prototype._maxListeners=void 0;var P4=10;function nb(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(mn,"defaultMaxListeners",{enumerable:!0,get:function(){return P4},set:function(n){if(typeof n!="number"||n<0||dW(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");P4=n}});mn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};mn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||dW(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function pW(n){return n._maxListeners===void 0?mn.defaultMaxListeners:n._maxListeners}mn.prototype.getMaxListeners=function(){return pW(this)};mn.prototype.emit=function(e){for(var t=[],r=1;r0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")F4(l,this,t);else for(var c=l.length,A=wW(l,c),r=0;r0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,dQe(a)}return n}mn.prototype.addListener=function(e,t){return mW(this,e,t,!1)};mn.prototype.on=mn.prototype.addListener;mn.prototype.prependListener=function(e,t){return mW(this,e,t,!0)};function pQe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function gW(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=pQe.bind(r);return i.listener=t,r.wrapFn=i,i}mn.prototype.once=function(e,t){return nb(t),this.on(e,gW(this,e,t)),this};mn.prototype.prependOnceListener=function(e,t){return nb(t),this.prependListener(e,gW(this,e,t)),this};mn.prototype.removeListener=function(e,t){var r,i,s,o,a;if(nb(t),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(s=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,s=o;break}if(s<0)return this;s===0?r.shift():mQe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};mn.prototype.off=mn.prototype.removeListener;mn.prototype.removeAllListeners=function(e){var t,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var s=Object.keys(r),o;for(i=0;i=0;i--)this.removeListener(e,t[i]);return this};function vW(n,e,t){var r=n._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?gQe(i):wW(i,i.length)}mn.prototype.listeners=function(e){return vW(this,e,!0)};mn.prototype.rawListeners=function(e){return vW(this,e,!1)};mn.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):yW.call(n,e)};mn.prototype.listenerCount=yW;function yW(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}mn.prototype.eventNames=function(){return this._eventsCount>0?Qw(this._events):[]};function wW(n,e){for(var t=new Array(e),r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function zw(n,e,t){return bQe()?zw=Reflect.construct:zw=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),c=new l;return o&&Ex(c,o.prototype),c},zw.apply(null,arguments)}function EQe(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Bx(n){var e=typeof Map=="function"?new Map:void 0;return Bx=function(r){if(r===null||!EQe(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return zw(r,arguments,ZT(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Ex(i,r)},Bx(n)}function Ky(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function zf(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function ya(n){return n.hasOwnProperty("result")?n.result:n}var _S=function(n){vU(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="No Ethereum provider was found on window.ethereum.",t}return e}(Bx(Error)),BQe=function(n){vU(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="The user rejected the request.",t}return e}(Bx(Error)),SQe=function(n){vU(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind(Ky(i)),i.handleChainChanged=i.handleChainChanged.bind(Ky(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind(Ky(i)),i.handleClose=i.handleClose.bind(Ky(i)),i}var t=e.prototype;return t.handleChainChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.handleAccountsChanged=function(i){i.length===0?this.emitDeactivate():this.emitUpdate({account:i[0]})},t.handleClose=function(i,s){this.emitDeactivate()},t.handleNetworkChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.activate=function(){try{var i=function(A){if(s)return A;function u(){return $T({provider:window.ethereum},a?{account:a}:{})}var f=function(){if(!a)return Promise.resolve(window.ethereum.enable().then(function(h){return h&&ya(h)[0]})).then(function(h){a=h})}();return f&&f.then?f.then(u):u(f)},s=!1,o=this;if(!window.ethereum)throw new _S;window.ethereum.on&&(window.ethereum.on("chainChanged",o.handleChainChanged),window.ethereum.on("accountsChanged",o.handleAccountsChanged),window.ethereum.on("close",o.handleClose),window.ethereum.on("networkChanged",o.handleNetworkChanged)),window.ethereum.isMetaMask&&(window.ethereum.autoRefreshOnNetworkChange=!1);var a,l=zf(function(){return Promise.resolve(window.ethereum.send("eth_requestAccounts").then(function(c){return ya(c)[0]})).then(function(c){a=c})},function(c){if(c.code===4001)throw new BQe});return Promise.resolve(l&&l.then?l.then(i):i(l))}catch(c){return Promise.reject(c)}},t.getProvider=function(){try{return Promise.resolve(window.ethereum)}catch(i){return Promise.reject(i)}},t.getChainId=function(){try{var i=function(){function l(){if(!s)try{s=ya(window.ethereum.send({method:"net_version"}))}catch{}return s||(window.ethereum.isDapper?s=ya(window.ethereum.cachedResults.net_version):s=window.ethereum.chainId||window.ethereum.netVersion||window.ethereum.networkVersion||window.ethereum._chainId),s}var c=function(){if(!s){var A=zf(function(){return Promise.resolve(window.ethereum.send("net_version").then(ya)).then(function(u){s=u})},function(){});if(A&&A.then)return A.then(function(){})}}();return c&&c.then?c.then(l):l(c)};if(!window.ethereum)throw new _S;var s,o=zf(function(){return Promise.resolve(window.ethereum.send("eth_chainId").then(ya)).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.getAccount=function(){try{var i=function(){function l(){return s||(s=ya(window.ethereum.send({method:"eth_accounts"}))[0]),s}var c=function(){if(!s){var A=zf(function(){return Promise.resolve(window.ethereum.enable().then(function(u){return ya(u)[0]})).then(function(u){s=u})},function(){});if(A&&A.then)return A.then(function(){})}}();return c&&c.then?c.then(l):l(c)};if(!window.ethereum)throw new _S;var s,o=zf(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(a){return ya(a)[0]})).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.deactivate=function(){window.ethereum&&window.ethereum.removeListener&&(window.ethereum.removeListener("chainChanged",this.handleChainChanged),window.ethereum.removeListener("accountsChanged",this.handleAccountsChanged),window.ethereum.removeListener("close",this.handleClose),window.ethereum.removeListener("networkChanged",this.handleNetworkChanged))},t.isAuthorized=function(){try{return window.ethereum?Promise.resolve(zf(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(i){return ya(i).length>0}))},function(){return!1})):Promise.resolve(!1)}catch(i){return Promise.reject(i)}},e}(xQe);function MQe(){const{account:n,library:e,activate:t}=hY(),[r,i]=xe.useState([]),{setViewMode:s}=q.useContext(cs),{playSound:o}=q.useContext(So),{isMute:a}=q.useContext(Bo),l=new SQe({supportedChainIds:[137,1,3,4,5,42,97]});xe.useEffect(()=>{if(n&&e){const f="0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",h=["function balanceOf(address owner) external view returns (uint256)","function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)","function tokenURI(uint256 tokenId) external view returns (string)"],d=new Y1(f,h,e);d.balanceOf(n).then(m=>{const g=[];for(let p=0;p{const v=p.map(w=>d.tokenURI(w));Promise.all(v).then(w=>{i(w)})})})}},[n,e]);const c=()=>{t(l)},A=f=>{!a&&o("backNextButton"),s(yt.APPEARANCE)},u=()=>{s(yt.LANDING),!a&&o("backNextButton")};return Q.jsxs("div",{className:YA.container,children:[!n&&Q.jsxs("div",{className:YA.message,children:["Please connect your wallet to load your characters",Q.jsx("button",{className:YA.button,onClick:()=>c(),children:"Connect"})]}),Q.jsxs("div",{className:YA.characterContainer,children:[Q.jsx("div",{className:YA.title,children:"Load Character"}),r.map((f,h)=>Q.jsx("div",{className:YA.character,onClick:()=>{A()},children:JSON.stringify(f)},h))]}),Q.jsx("button",{className:YA.button,onClick:()=>u(),children:"Back"})]})}const CQe="_container_q73cc_1",TQe="_mintContainer_q73cc_6",IQe="_mainTitleWrap_q73cc_33",RQe="_mainTitle_q73cc_33",UQe="_mintButtonContainer_q73cc_49",FQe="_mintButton_q73cc_49",PQe="_genesisText_q73cc_60",LQe="_required_q73cc_64",DQe="_divider_q73cc_68",NQe="_bottomContainer_q73cc_75",OQe="_mintInfo_q73cc_85",kQe="_topLine_q73cc_91",HQe="_bottomLine_q73cc_104",Gi={container:CQe,mintContainer:TQe,mainTitleWrap:IQe,mainTitle:RQe,mintButtonContainer:UQe,mintButton:FQe,genesisText:PQe,required:LQe,divider:DQe,bottomContainer:NQe,mintInfo:OQe,topLine:kQe,bottomLine:HQe};function QQe(){const{model:n,avatar:e}=q.useContext(pr),{setViewMode:t}=q.useContext(cs),{playSound:r}=q.useContext(So),{isMute:i}=q.useContext(Bo),[s,o]=q.useState(""),[a,l]=q.useState(!1),c=()=>{t(yt.SAVE),!i&&r("backNextButton")};function A(){return Q.jsxs("div",{className:Gi.mainTitleWrap,children:[Q.jsx("div",{className:Gi.topLine}),Q.jsx("div",{className:Gi.mainTitle,children:"Mint"})]})}async function u(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const d=await zHe(e,null,n,{name:"XXXRestore"}.name);o(d),l(!1),console.log(d)}return Q.jsxs("div",{className:Gi.container,children:[Q.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),Q.jsxs("div",{className:Gi.mintContainer,children:[Q.jsx(A,{}),Q.jsxs("div",{className:Gi.mintButtonContainer,children:[Q.jsx(Un,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:Gi.mintButton,disabled:a,onClick:u,minWidth:220}),Q.jsx("div",{className:Gi.divider}),Q.jsx(Un,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:Gi.mintButton,disabled:!0,minWidth:220}),Q.jsxs("span",{className:Gi.genesisText,children:["(",Q.jsx("span",{className:Gi.required,children:"Coming Soon!"}),")"]})]}),Q.jsxs("span",{className:Gi.mintInfo,children:[s," "]})]}),Q.jsx("div",{className:Gi.bottomContainer,children:Q.jsx(Un,{theme:"light",text:"Back",size:14,className:Gi.buttonLeft,onClick:c})})]})}function zQe(){const{isLoading:n,setViewMode:e}=q.useContext(cs),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=q.useContext(pr),{playSound:l}=q.useContext(So),{isMute:c}=q.useContext(Bo),[A,u]=xe.useState(null),[f,h]=xe.useState(""),[d,m]=xe.useState([]),[g,p]=xe.useState(0),[v,w]=q.useState("T-Pose"),_=()=>{!c&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(yt.LANDING)},x=()=>{const E=Qe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Dn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Dn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:E===0||E==2,exportMtoonAtlas:E===1||E==2,ktxCompression:Qe.merge_options_ktx_compression||!1,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},b=async()=>{for(let E=0;E{typeof E!="string"&&(E=f),await(async()=>{var K;(Qe.mergeOptions_download_vrm_preview==null?!0:Qe.mergeOptions_download_vrm_preview)&&r.savePortraitScreenshot(E+"_portrait",512,1024,1.5,-.1),(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm)&&await r.downloadVRM(E+"_merged",x());const z=new Jd,W=s.parent;W.remove(s),(K=r.getCurrentOptimizerCharacterModel().data)==null||K.isVRM0;const H=Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora;if(H===!0){const te=t.loras.map(async F=>o.createLoraData(F,z));await Promise.all(te)}const C=Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites;if(C===!0){const te=t.sprites.map(async F=>a.createSpriteAtlas(F,z));await Promise.all(te)}(H===!0||C===!0)&&z.saveZip(E),W.add(s)})()},{t:M}=xe.useContext(aa),I=async E=>{if(r.getCurrentOptimizerCharacterModel()){const P=Vl(E.name),N=URL.createObjectURL(E);await i.loadAnimation(N,!1,0,!0,"",P),w(i.getCurrentAnimationName()),URL.revokeObjectURL(N)}else console.warn("Please load a vrm model to test animations.")},S=()=>{if(g===0)O(d[d.length-1]),p(d.length-1);else{const E=g-1;O(d[E]),p(E)}},L=()=>{if(g>=d.length-1)O(d[0]),p(0);else{const E=g+1;O(d[E]),p(E)}},O=async E=>{const U=URL.createObjectURL(E);await r.loadOptimizerCharacter(U),URL.revokeObjectURL(U);const P=Vl(E.name);h(P),u({...r.getCurrentCharacterModel()})},T=async E=>{O(E[0]);const U=[];for(let P=0;P{const U=E[0];U&&U.name.toLowerCase().endsWith(".fbx")&&I(U),U&&U.name.toLowerCase().endsWith(".vrm")&&T(E)};return Q.jsxs("div",{className:Di.container,children:[Q.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:Q.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),Q.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),Q.jsx(E0,{onFilesDrop:y}),Q.jsx(K1,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),Q.jsx(aU,{model:A,name:f,files:d,index:g,nextVrm:L,previousVrm:S}),Q.jsx(I1,{loadedAnimationName:v}),Q.jsxs("div",{className:Di.buttonContainer,children:[Q.jsx(Un,{theme:"light",text:M("callToAction.back"),size:14,className:Di.buttonLeft,onClick:_}),(d==null?void 0:d.length)>1!=""&&Q.jsx(Un,{theme:"light",text:"Download All",size:14,className:Di.buttonRight,onClick:b}),A!=""&&Q.jsx(Un,{theme:"light",text:"Download",size:14,className:Di.buttonRight,onClick:B})]})]})}const GQe="_buttonContainer_1fd4o_1",VQe="_buttonLeft_1fd4o_10",jQe="_buttonRight_1fd4o_14",WQe="_buttonCenter_1fd4o_18",Xy={buttonContainer:GQe,buttonLeft:VQe,buttonRight:jQe,buttonCenter:WQe},KQe="_button_13dfi_1",L4={button:KQe},XQe="Anon",YQe=()=>{xe.useContext(aa);const[n]=q.useState(localStorage.getItem("name")||XQe),{model:e,characterManager:t}=xe.useContext(pr),r=()=>{const o=Qe.mergeOptions_sel_option||0;return{createTextureAtlas:Qe.mergeOptions_create_atlas==null?!0:Qe.mergeOptions_create_atlas,mToonAtlasSize:Dn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Dn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_std_transp_size||6),ktxCompression:Qe.merge_options_ktx_compression,exportStdAtlas:o===0||o==2,exportMtoonAtlas:o===1||o==2,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},i=()=>{const o=r();t.downloadVRM(n,o)},s=()=>{const o=r();t.downloadGLB(n,o)};return Q.jsxs(q.Fragment,{children:[Q.jsx(Un,{theme:"light",text:"GLB",icon:"download",size:14,className:L4.button,onClick:()=>{s()}}),Q.jsx(Un,{theme:"light",text:"VRM",icon:"download",size:14,className:L4.button,onClick:i})]})};function $Qe(){const{t:n}=xe.useContext(aa),{playSound:e}=q.useContext(So),{isMute:t}=q.useContext(Bo),{setViewMode:r}=q.useContext(cs),i=()=>{r(yt.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(yt.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return Q.jsxs("div",{className:Xy.container,children:[Q.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),Q.jsxs("div",{className:Xy.buttonContainer,children:[Q.jsx(E0,{onFilesDrop:o}),Q.jsx(Un,{theme:"light",text:n("callToAction.back"),size:14,className:Xy.buttonLeft,onClick:i}),Q.jsx(K1,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),Q.jsx(YQe,{}),Q.jsx(Un,{theme:"light",text:"mint",size:14,className:Xy.buttonRight,onClick:s})]})]})}function ZQe(){const{t:n}=xe.useContext(aa),{setViewMode:e,setIsLoading:t,isLoading:r}=q.useContext(cs),{playSound:i}=q.useContext(So),{isMute:s}=q.useContext(Bo),{manifest:o,characterManager:a}=q.useContext(pr);xe.useState([]);const[l,c]=xe.useState([]);xe.useEffect(()=>{A()},[]);const A=async()=>{const m=await mU();HHe(m,"the-anata-nft").then(g=>{c(g.nfts),console.log(g.nfts)})},u=()=>{e(yt.LANDING),!s&&i("backNextButton")},f=async m=>{t(!0),a.loadManifest(o[m].manifest).then(()=>{e(yt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{console.log("ttt"),a.loadManifest(o[0].manifest).then(()=>{a.loadAppendManifest(o[1].manifest,!0).then(()=>{console.log(a.manifestData)})})},d=()=>{!s&&i("classMouseOver")};return Q.jsxs("div",{className:`${At.container} horizontalScroll`,children:[Q.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),Q.jsx("div",{className:At.vrmOptimizerButton}),Q.jsx("div",{className:At.topLine}),Q.jsx("div",{className:At.classContainer,children:l.map((m,g)=>Q.jsxs("div",{className:At.class,onClick:()=>f(g),onMouseOver:()=>d(),children:[Q.jsx("div",{className:At.classFrame,style:{backgroundImage:`url(${m.image_url})`},children:Q.jsx("div",{className:At.frameContainer,children:Q.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:At.frame})})}),Q.jsx("div",{className:At.name,children:m.name})]},g))}),Q.jsx("div",{className:At.bottomLine}),Q.jsxs("div",{className:At.buttonContainer,children:[Q.jsx(Un,{theme:"light",text:n("callToAction.back"),size:14,className:At.buttonLeft,onClick:u}),Q.jsx(Un,{theme:"light",text:"test",size:14,className:At.buttonLeft,onClick:h})]})]})}const qQe=".//manifest.json",JQe=6,e5e=new $(0,.8,0);new $(-2.2367993753934425,1.1512971720174363,2.2612065299409223);async function t5e(n){try{const e=await fetch(n);if(!e.ok)throw new Error(`Failed to fetch manifest. Status: ${e.status}`);return await e.json()}catch(e){return console.error(`Error fetching manifest: ${e.message}`),[]}}async function n5e(){const n=await t5e(qQe),e=new Qye;return{initialManifest:n,effectManager:e}}const r5e=()=>{let n,e;const r=n5e().then(i=>{n="success",e=i},i=>{n="error",e=i});return{read(){if(n==="error")throw e;if(n==="success")return e;throw r}}},i5e=r5e();function s5e(){const{initialManifest:n,effectManager:e}=i5e.read(),[t,r]=xe.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:c,showEnvironmentModels:A}=xe.useContext(pr),{viewMode:u}=xe.useContext(cs);e.camera=i,e.scene=o;const f=()=>{e.camera&&(a({targetX:0,targetY:e5e.y,targetZ:0,distance:JQe}),s&&([yt.APPEARANCE,yt.SAVE,yt.OPTIMIZER,yt.BATCHDOWNLOAD,yt.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1))},[h,d]=xe.useState(!1),[m,g]=xe.useState(""),[p,v]=xe.useState([]),w=(b,B)=>{g(b),d(!0),v([B])},_={[yt.LANDING]:Q.jsx(hQe,{}),[yt.APPEARANCE]:Q.jsx(X3e,{confirmDialog:w}),[yt.OPTIMIZER]:Q.jsx(zQe,{}),[yt.CREATE]:Q.jsx(AQe,{}),[yt.WALLET]:Q.jsx(ZQe,{}),[yt.CLAIM]:Q.jsx(cQe,{}),[yt.BATCHMANIFEST]:Q.jsx(VHe,{}),[yt.BATCHDOWNLOAD]:Q.jsx(Eke,{}),[yt.LOAD]:Q.jsx(MQe,{}),[yt.MINT]:Q.jsx(QQe,{}),[yt.SAVE]:Q.jsx($Qe,{})};let x=0;return xe.useEffect(()=>{const b=B=>{const M=new Date().getTime(),I=M-x;I<300&&I>10&&B.target.id=="editor-scene"&&r(!t),x=M};return window.addEventListener("touchend",b),window.addEventListener("click",b),()=>{window.removeEventListener("touchend",b),window.removeEventListener("click",b)}},[t]),xe.useEffect(()=>{if(c!=null)return f(),c.enabled=!0,[yt.LANDING,yt.CREATE,yt.CLAIM,yt.LOAD,yt.CLAIM,yt.CLAIM].includes(u)?A(!1):A(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[u,c]),xe.useEffect(()=>{l(n)},[n]),xe.useContext(aa),Q.jsxs(xe.Fragment,{children:[Q.jsx("div",{className:"generalTitle",children:"Character Studio"}),Q.jsx(swe,{confirmDialogText:m,confirmDialogCallback:p,confirmDialogWindow:h,setConfirmDialogWindow:d}),Q.jsx(cwe,{}),_[u]]})}const o5e=n=>{const e=new hI(n);return e.pollingInterval=12e3,e};US.createRoot(document.getElementById("root")).render(Q.jsx(q.StrictMode,{children:Q.jsx(uY,{getLibrary:o5e,children:Q.jsx(xZ,{children:Q.jsx(yye,{children:Q.jsx(wZ,{children:Q.jsx(Y0e,{children:Q.jsx(K0e,{children:Q.jsx(sve,{children:Q.jsx(xe.Suspense,{children:Q.jsx(s5e,{})})})})})})})})})}));export{Pa as c,ic as g}; + `),q.createElement("div",{style:A.white,className:"saturation-white"},q.createElement("div",{style:A.black,className:"saturation-black"}),q.createElement("div",{style:A.pointer},this.props.pointer?q.createElement(this.props.pointer,this.props):q.createElement("div",{style:A.circle}))))}}]),e}(xe.PureComponent||xe.Component);function _De(n,e){for(var t=-1,r=n==null?0:n.length;++t=0,s=!t&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return st(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(zDe,arguments)},brighten:function(){return this._applyModification(GDe,arguments)},darken:function(){return this._applyModification(VDe,arguments)},desaturate:function(){return this._applyModification(kDe,arguments)},saturate:function(){return this._applyModification(HDe,arguments)},greyscale:function(){return this._applyModification(QDe,arguments)},spin:function(){return this._applyModification(jDe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(XDe,arguments)},complement:function(){return this._applyCombination(WDe,arguments)},monochromatic:function(){return this._applyCombination(YDe,arguments)},splitcomplement:function(){return this._applyCombination(KDe,arguments)},triad:function(){return this._applyCombination(Ok,[3])},tetrad:function(){return this._applyCombination(Ok,[4])}};st.fromRatio=function(n,e){if(vx(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Lm(n[r]));n=t}return st(n,e)};function PDe(n){var e={r:0,g:0,b:0},t=1,r=null,i=null,s=null,o=!1,a=!1;return typeof n=="string"&&(n=eNe(n)),vx(n)=="object"&&(xl(n.r)&&xl(n.g)&&xl(n.b)?(e=LDe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):xl(n.h)&&xl(n.s)&&xl(n.v)?(r=Lm(n.s),i=Lm(n.v),e=NDe(n.h,r,i),o=!0,a="hsv"):xl(n.h)&&xl(n.s)&&xl(n.l)&&(r=Lm(n.s),s=Lm(n.l),e=DDe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=xj(t),{ok:o,format:n.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:t}}function LDe(n,e,t){return{r:Ln(n,255)*255,g:Ln(e,255)*255,b:Ln(t,255)*255}}function Pk(n,e,t){n=Ln(n,255),e=Ln(e,255),t=Ln(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=(r+i)/2;if(r==i)s=o=0;else{var l=r-i;switch(o=a>.5?l/(2-r-i):l/(r+i),r){case n:s=(e-t)/l+(e1&&(u-=1),u<1/6?c+(A-c)*6*u:u<1/2?A:u<2/3?c+(A-c)*(2/3-u)*6:c}if(e===0)r=i=s=t;else{var a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;r=o(l,a,n+1/3),i=o(l,a,n),s=o(l,a,n-1/3)}return{r:r*255,g:i*255,b:s*255}}function Lk(n,e,t){n=Ln(n,255),e=Ln(e,255),t=Ln(t,255);var r=Math.max(n,e,t),i=Math.min(n,e,t),s,o,a=r,l=r-i;if(o=r===0?0:l/r,r==i)s=0;else{switch(r){case n:s=(e-t)/l+(e>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(st(r));return s}function YDe(n,e){e=e||6;for(var t=st(n).toHsv(),r=t.h,i=t.s,s=t.v,o=[],a=1/e;e--;)o.push(st({h:r,s:i,v:s})),s=(s+a)%1;return o}st.mix=function(n,e,t){t=t===0?0:t||50;var r=st(n).toRgb(),i=st(e).toRgb(),s=t/100,o={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return st(o)};st.readability=function(n,e){var t=st(n),r=st(e);return(Math.max(t.getLuminance(),r.getLuminance())+.05)/(Math.min(t.getLuminance(),r.getLuminance())+.05)};st.isReadable=function(n,e,t){var r=st.readability(n,e),i,s;switch(s=!1,i=tNe(t),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s};st.mostReadable=function(n,e,t){var r=null,i=0,s,o,a,l;t=t||{},o=t.includeFallbackColors,a=t.level,l=t.size;for(var c=0;ci&&(i=s,r=st(e[c]));return st.isReadable(n,r,{level:a,size:l})||!o?r:(t.includeFallbackColors=!1,st.mostReadable(n,["#fff","#000"],t))};var kT=st.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},$De=st.hexNames=ZDe(kT);function ZDe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function xj(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function Ln(n,e){qDe(n)&&(n="100%");var t=JDe(n);return n=Math.min(e,Math.max(0,parseFloat(n))),t&&(n=parseInt(n*e,10)/100),Math.abs(n-e)<1e-6?1:n%e/parseFloat(e)}function X1(n){return Math.min(1,Math.max(0,n))}function vs(n){return parseInt(n,16)}function qDe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function JDe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function Jo(n){return n.length==1?"0"+n:""+n}function Lm(n){return n<=1&&(n=n*100+"%"),n}function bj(n){return Math.round(parseFloat(n)*255).toString(16)}function kk(n){return vs(n)/255}var zo=function(){var n="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",t="(?:"+e+")|(?:"+n+")",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",i="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function xl(n){return!!zo.CSS_UNIT.exec(n)}function eNe(n){n=n.replace(UDe,"").replace(FDe,"").toLowerCase();var e=!1;if(kT[n])n=kT[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=zo.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=zo.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=zo.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=zo.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=zo.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=zo.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=zo.hex8.exec(n))?{r:vs(t[1]),g:vs(t[2]),b:vs(t[3]),a:kk(t[4]),format:e?"name":"hex8"}:(t=zo.hex6.exec(n))?{r:vs(t[1]),g:vs(t[2]),b:vs(t[3]),format:e?"name":"hex"}:(t=zo.hex4.exec(n))?{r:vs(t[1]+""+t[1]),g:vs(t[2]+""+t[2]),b:vs(t[3]+""+t[3]),a:kk(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=zo.hex3.exec(n))?{r:vs(t[1]+""+t[1]),g:vs(t[2]+""+t[2]),b:vs(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function tNe(n){var e,t;return n=n||{level:"AA",size:"small"},e=(n.level||"AA").toUpperCase(),t=(n.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),t!=="small"&&t!=="large"&&(t="small"),{level:e,size:t}}var Hk=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return RDe(t,function(s){if(e[s]&&(r+=1,isNaN(e[s])||(i+=1),s==="s"||s==="l")){var o=/^\d+%$/;o.test(e[s])&&(i+=1)}}),r===i?e:!1},Dm=function(e,t){var r=e.hex?st(e.hex):st(e),i=r.toHsl(),s=r.toHsv(),o=r.toRgb(),a=r.toHex();i.s===0&&(i.h=t||0,s.h=t||0);var l=a==="000000"&&o.a===0;return{hsl:i,hex:l?"transparent":"#"+a,rgb:o,hsv:s,oldHue:e.h||t||i.h,source:e.source}},FA=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&st(e).isValid()},j2=function(e){if(!e)return"#fff";var t=Dm(e);if(t.hex==="transparent")return"rgba(0,0,0,0.4)";var r=(t.rgb.r*299+t.rgb.g*587+t.rgb.b*114)/1e3;return r>=128?"#000":"#fff"},pS=function(e,t){var r=e.replace("°","");return st(t+" ("+r+")")._ok},Am=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){cNe(i,r);function i(){var s,o,a,l;lNe(this,i);for(var c=arguments.length,A=Array(c),u=0;ua))return!1;var c=s.get(n),A=s.get(e);if(c&&A)return c==e&&A==n;var u=-1,f=!0,h=t&_Ne?new yx:void 0;for(s.set(n,e),s.set(e,n);++u=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Gy=24,GOe=Fj.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Gy:r,s=n.height,o=s===void 0?Gy:s,a=n.style,l=a===void 0?{}:a,c=zOe(n,["fill","width","height","style"]);return s4.default.createElement("svg",i4({viewBox:"0 0 "+Gy+" "+Gy,style:i4({fill:t,width:i,height:o},l)},c),s4.default.createElement("path",{d:"M12,18.17L8.83,15L7.42,16.41L12,21L16.59,16.41L15.17,15M12,5.83L15.17,9L16.58,7.59L12,3L7.41,7.59L8.83,9L12,5.83Z"}))},VOe=function(){function n(e,t){for(var r=0;r1&&(i.a=1),r.props.onChange({h:r.props.hsl.h,s:r.props.hsl.s,l:r.props.hsl.l,a:Math.round(i.a*100)/100,source:"rgb"},s)):(i.h||i.s||i.l)&&(typeof i.s=="string"&&i.s.includes("%")&&(i.s=i.s.replace("%","")),typeof i.l=="string"&&i.l.includes("%")&&(i.l=i.l.replace("%","")),i.s==1?i.s=.01:i.l==1&&(i.l=.01),r.props.onChange({h:i.h||r.props.hsl.h,s:Number(r4(i.s)?r.props.hsl.s:i.s),l:Number(r4(i.l)?r.props.hsl.l:i.l),source:"hsl"},s))},r.showHighlight=function(i){i.currentTarget.style.background="#eee"},r.hideHighlight=function(i){i.currentTarget.style.background="transparent"},t.hsl.a!==1&&t.view==="hex"?r.state={view:"rgb"}:r.state={view:t.view},r}return VOe(e,[{key:"render",value:function(){var r=this,i=gt({default:{wrap:{paddingTop:"16px",display:"flex"},fields:{flex:"1",display:"flex",marginLeft:"-6px"},field:{paddingLeft:"6px",width:"100%"},alpha:{paddingLeft:"6px",width:"100%"},toggle:{width:"32px",textAlign:"right",position:"relative"},icon:{marginRight:"-4px",marginTop:"12px",cursor:"pointer",position:"relative"},iconHighlight:{position:"absolute",width:"24px",height:"28px",background:"#eee",borderRadius:"4px",top:"10px",left:"12px",display:"none"},input:{fontSize:"11px",color:"#333",width:"100%",borderRadius:"2px",border:"none",boxShadow:"inset 0 0 0 1px #dadada",height:"21px",textAlign:"center"},label:{textTransform:"uppercase",fontSize:"11px",lineHeight:"11px",color:"#969696",textAlign:"center",display:"block",marginTop:"12px"},svg:{fill:"#333",width:"24px",height:"24px",border:"1px transparent solid",borderRadius:"5px"}},disableAlpha:{alpha:{display:"none"}}},this.props,this.state),s=void 0;return this.state.view==="hex"?s=q.createElement("div",{style:i.fields,className:"flexbox-fix"},q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=q.createElement("div",{style:i.fields,className:"flexbox-fix"},q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),q.createElement("div",{style:i.alpha},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=q.createElement("div",{style:i.fields,className:"flexbox-fix"},q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),q.createElement("div",{style:i.field},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),q.createElement("div",{style:i.alpha},q.createElement(Ht,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),q.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,q.createElement("div",{style:i.toggle},q.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},q.createElement(GOe,{style:i.svg,onMouseOver:this.showHighlight,onMouseEnter:this.showHighlight,onMouseOut:this.hideHighlight}))))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.hsl.a!==1&&i.view==="hex"?{view:"rgb"}:null}}]),e}(q.Component);Pj.defaultProps={view:"hex"};var o4=function(){var e=gt({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",transform:"translate(-6px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}}});return q.createElement("div",{style:e.picker})},XOe=function(){var e=gt({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return q.createElement("div",{style:e.picker})},Z2=function(e){var t=e.width,r=e.onChange,i=e.disableAlpha,s=e.rgb,o=e.hsl,a=e.hsv,l=e.hex,c=e.renderers,A=e.styles,u=A===void 0?{}:A,f=e.className,h=f===void 0?"":f,d=e.defaultView,m=gt(us({default:{picker:{width:t,background:"#fff",borderRadius:"2px",boxShadow:"0 0 2px rgba(0,0,0,.3), 0 4px 8px rgba(0,0,0,.3)",boxSizing:"initial",fontFamily:"Menlo"},saturation:{width:"100%",paddingBottom:"55%",position:"relative",borderRadius:"2px 2px 0 0",overflow:"hidden"},Saturation:{radius:"2px 2px 0 0"},body:{padding:"16px 16px 12px"},controls:{display:"flex"},color:{width:"32px"},swatch:{marginTop:"6px",width:"16px",height:"16px",borderRadius:"8px",position:"relative",overflow:"hidden"},active:{absolute:"0px 0px 0px 0px",borderRadius:"8px",boxShadow:"inset 0 0 0 1px rgba(0,0,0,.1)",background:"rgba("+s.r+", "+s.g+", "+s.b+", "+s.a+")",zIndex:"2"},toggles:{flex:"1"},hue:{height:"10px",position:"relative",marginBottom:"8px"},Hue:{radius:"2px"},alpha:{height:"10px",position:"relative"},Alpha:{radius:"2px"}},disableAlpha:{color:{width:"22px"},alpha:{display:"none"},hue:{marginBottom:"0px"},swatch:{width:"10px",height:"10px",marginTop:"0px"}}},u),{disableAlpha:i});return q.createElement("div",{style:m.picker,className:"chrome-picker "+h},q.createElement("div",{style:m.saturation},q.createElement(K1,{style:m.Saturation,hsl:o,hsv:a,pointer:XOe,onChange:r})),q.createElement("div",{style:m.body},q.createElement("div",{style:m.controls,className:"flexbox-fix"},q.createElement("div",{style:m.color},q.createElement("div",{style:m.swatch},q.createElement("div",{style:m.active}),q.createElement(lp,{renderers:c}))),q.createElement("div",{style:m.toggles},q.createElement("div",{style:m.hue},q.createElement(cp,{style:m.Hue,hsl:o,pointer:o4,onChange:r})),q.createElement("div",{style:m.alpha},q.createElement(N2,{style:m.Alpha,rgb:s,hsl:o,pointer:o4,renderers:c,onChange:r})))),q.createElement(Pj,{rgb:s,hsl:o,hex:l,view:d,onChange:r,disableAlpha:i})))};Z2.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),disableAlpha:Ge.bool,styles:Ge.object,defaultView:Ge.oneOf(["hex","rgb","hsl"])};Z2.defaultProps={width:225,disableAlpha:!1,styles:{}};const YOe=fs(Z2);var $Oe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=gt({default:{color:{background:t,width:"15px",height:"15px",float:"left",marginRight:"5px",marginBottom:"5px",position:"relative",cursor:"pointer"},dot:{absolute:"5px 5px 5px 5px",background:j2(t),borderRadius:"50%",opacity:"0"}},active:{dot:{opacity:"1"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},dot:{background:"#000"}},transparent:{dot:{background:"#000"}}},{active:o,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return q.createElement(ef,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},q.createElement("div",{style:a.dot}))},ZOe=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=gt({default:{fields:{display:"flex",paddingBottom:"6px",paddingRight:"5px",position:"relative"},active:{position:"absolute",top:"6px",left:"5px",height:"9px",width:"9px",background:t},HEXwrap:{flex:"6",position:"relative"},HEXinput:{width:"80%",padding:"0px",paddingLeft:"20%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},HEXlabel:{display:"none"},RGBwrap:{flex:"3",position:"relative"},RGBinput:{width:"70%",padding:"0px",paddingLeft:"30%",border:"none",outline:"none",background:"none",fontSize:"12px",color:"#333",height:"16px"},RGBlabel:{position:"absolute",top:"3px",left:"0px",lineHeight:"16px",textTransform:"uppercase",fontSize:"12px",color:"#999"}}}),o=function(l,c){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},c):i({hex:l.hex,source:"hex"},c)};return q.createElement("div",{style:s.fields,className:"flexbox-fix"},q.createElement("div",{style:s.active}),q.createElement(Ht,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),q.createElement(Ht,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),q.createElement(Ht,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),q.createElement(Ht,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},q2=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.colors,s=e.hex,o=e.rgb,a=e.styles,l=a===void 0?{}:a,c=e.className,A=c===void 0?"":c,u=gt(us({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),f=function(d,m){d.hex?FA(d.hex)&&t({hex:d.hex,source:"hex"},m):t(d,m)};return q.createElement(L0,{style:u.Compact,styles:l},q.createElement("div",{style:u.compact,className:"compact-picker "+A},q.createElement("div",null,tf(i,function(h){return q.createElement($Oe,{key:h,color:h,active:h.toLowerCase()===s,onClick:f,onSwatchHover:r})}),q.createElement("div",{style:u.clear})),q.createElement(ZOe,{hex:s,rgb:o,onChange:f})))};q2.propTypes={colors:Ge.arrayOf(Ge.string),styles:Ge.object};q2.defaultProps={colors:["#4D4D4D","#999999","#FFFFFF","#F44E3B","#FE9200","#FCDC00","#DBDF00","#A4DD00","#68CCCA","#73D8FF","#AEA1FF","#FDA1FF","#333333","#808080","#cccccc","#D33115","#E27300","#FCC400","#B0BC00","#68BC00","#16A5A5","#009CE0","#7B64FF","#FA28FF","#000000","#666666","#B3B3B3","#9F0500","#C45100","#FB9E00","#808900","#194D33","#0C797D","#0062B1","#653294","#AB149E"],styles:{}};fs(q2);var qOe=function(e){var t=e.hover,r=e.color,i=e.onClick,s=e.onSwatchHover,o={position:"relative",zIndex:"2",outline:"2px solid #fff",boxShadow:"0 0 5px 2px rgba(0,0,0,0.25)"},a=gt({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return q.createElement("div",{style:a.swatch},q.createElement(ef,{color:r,onClick:i,onHover:s,focusStyle:o}))};const JOe=D2(qOe);var J2=function(e){var t=e.width,r=e.colors,i=e.onChange,s=e.onSwatchHover,o=e.triangle,a=e.styles,l=a===void 0?{}:a,c=e.className,A=c===void 0?"":c,u=gt(us({default:{card:{width:t,background:"#fff",border:"1px solid rgba(0,0,0,0.2)",boxShadow:"0 3px 12px rgba(0,0,0,0.15)",borderRadius:"4px",position:"relative",padding:"5px",display:"flex",flexWrap:"wrap"},triangle:{position:"absolute",border:"7px solid transparent",borderBottomColor:"#fff"},triangleShadow:{position:"absolute",border:"8px solid transparent",borderBottomColor:"rgba(0,0,0,0.15)"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-14px",left:"10px"},triangleShadow:{top:"-16px",left:"9px"}},"top-right-triangle":{triangle:{top:"-14px",right:"10px"},triangleShadow:{top:"-16px",right:"9px"}},"bottom-left-triangle":{triangle:{top:"35px",left:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",left:"9px",transform:"rotate(180deg)"}},"bottom-right-triangle":{triangle:{top:"35px",right:"10px",transform:"rotate(180deg)"},triangleShadow:{top:"37px",right:"9px",transform:"rotate(180deg)"}}},l),{"hide-triangle":o==="hide","top-left-triangle":o==="top-left","top-right-triangle":o==="top-right","bottom-left-triangle":o==="bottom-left","bottom-right-triangle":o==="bottom-right"}),f=function(d,m){return i({hex:d,source:"hex"},m)};return q.createElement("div",{style:u.card,className:"github-picker "+A},q.createElement("div",{style:u.triangleShadow}),q.createElement("div",{style:u.triangle}),tf(r,function(h){return q.createElement(JOe,{color:h,key:h,onClick:f,onSwatchHover:s})}))};J2.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),colors:Ge.arrayOf(Ge.string),triangle:Ge.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Ge.object};J2.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};fs(J2);var e3e=function(e){var t=e.direction,r=gt({default:{picker:{width:"18px",height:"18px",borderRadius:"50%",transform:"translate(-9px, -1px)",backgroundColor:"rgb(248, 248, 248)",boxShadow:"0 1px 4px 0 rgba(0, 0, 0, 0.37)"}},vertical:{picker:{transform:"translate(-3px, -9px)"}}},{vertical:t==="vertical"});return q.createElement("div",{style:r.picker})},t3e=Object.assign||function(n){for(var e=1;e.5});return q.createElement("div",{style:r.picker})},s3e=function(){var e=gt({default:{triangle:{width:0,height:0,borderStyle:"solid",borderWidth:"4px 0 4px 6px",borderColor:"transparent transparent transparent #fff",position:"absolute",top:"1px",left:"1px"},triangleBorder:{width:0,height:0,borderStyle:"solid",borderWidth:"5px 0 5px 8px",borderColor:"transparent transparent transparent #555"},left:{Extend:"triangleBorder",transform:"translate(-13px, -4px)"},leftInside:{Extend:"triangle",transform:"translate(-8px, -5px)"},right:{Extend:"triangleBorder",transform:"translate(20px, -14px) rotate(180deg)"},rightInside:{Extend:"triangle",transform:"translate(-8px, -5px)"}}});return q.createElement("div",{style:e.pointer},q.createElement("div",{style:e.left},q.createElement("div",{style:e.leftInside})),q.createElement("div",{style:e.right},q.createElement("div",{style:e.rightInside})))},a4=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=gt({default:{button:{backgroundImage:"linear-gradient(-180deg, #FFFFFF 0%, #E6E6E6 100%)",border:"1px solid #878787",borderRadius:"2px",height:"20px",boxShadow:"0 1px 0 0 #EAEAEA",fontSize:"14px",color:"#000",lineHeight:"20px",textAlign:"center",marginBottom:"10px",cursor:"pointer"}},active:{button:{boxShadow:"0 0 0 1px #878787"}}},{active:s});return q.createElement("div",{style:o.button,onClick:t},r||i)},o3e=function(e){var t=e.rgb,r=e.currentColor,i=gt({default:{swatches:{border:"1px solid #B3B3B3",borderBottom:"1px solid #F0F0F0",marginBottom:"2px",marginTop:"1px"},new:{height:"34px",background:"rgb("+t.r+","+t.g+", "+t.b+")",boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 1px 0 #000"},current:{height:"34px",background:r,boxShadow:"inset 1px 0 0 #000, inset -1px 0 0 #000, inset 0 -1px 0 #000"},label:{fontSize:"14px",color:"#000",textAlign:"center"}}});return q.createElement("div",null,q.createElement("div",{style:i.label},"new"),q.createElement("div",{style:i.swatches},q.createElement("div",{style:i.new}),q.createElement("div",{style:i.current})),q.createElement("div",{style:i.label},"current"))},a3e=function(){function n(e,t){for(var r=0;r100&&(A.a=100),A.a/=100,t({h:i.h,s:i.s,l:i.l,a:A.a,source:"rgb"},u))};return q.createElement("div",{style:a.fields,className:"flexbox-fix"},q.createElement("div",{style:a.double},q.createElement(Ht,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),q.createElement("div",{style:a.single},q.createElement(Ht,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),q.createElement("div",{style:a.single},q.createElement(Ht,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),q.createElement("div",{style:a.single},q.createElement(Ht,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),q.createElement("div",{style:a.alpha},q.createElement(Ht,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},f3e=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Vy=24,y3e=Dj.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Vy:r,s=n.height,o=s===void 0?Vy:s,a=n.style,l=a===void 0?{}:a,c=v3e(n,["fill","width","height","style"]);return c4.default.createElement("svg",l4({viewBox:"0 0 "+Vy+" "+Vy,style:l4({fill:t,width:i,height:o},l)},c),c4.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},w3e=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.first,a=e.last,l=e.active,c=gt({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:j2(t),marginLeft:"8px",display:"none"}},first:{color:{overflow:"hidden",borderRadius:"2px 2px 0 0"}},last:{color:{overflow:"hidden",borderRadius:"0 0 2px 2px"}},active:{check:{display:"block"}},"color-#FFFFFF":{color:{boxShadow:"inset 0 0 0 1px #ddd"},check:{color:"#333"}},transparent:{check:{color:"#333"}}},{first:o,last:a,active:l,"color-#FFFFFF":t==="#FFFFFF",transparent:t==="transparent"});return q.createElement(ef,{color:t,style:c.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},q.createElement("div",{style:c.check},q.createElement(y3e,null)))},_3e=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=gt({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return q.createElement("div",{style:o.group},tf(i,function(a,l){return q.createElement(w3e,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},iU=function(e){var t=e.width,r=e.height,i=e.onChange,s=e.onSwatchHover,o=e.colors,a=e.hex,l=e.styles,c=l===void 0?{}:l,A=e.className,u=A===void 0?"":A,f=gt(us({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},c)),h=function(m,g){return i({hex:m,source:"hex"},g)};return q.createElement("div",{style:f.picker,className:"swatches-picker "+u},q.createElement(L0,null,q.createElement("div",{style:f.overflow},q.createElement("div",{style:f.body},tf(o,function(d){return q.createElement(_3e,{key:d.toString(),group:d,active:a,onClick:h,onSwatchHover:s})}),q.createElement("div",{style:f.clear})))))};iU.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),height:Ge.oneOfType([Ge.string,Ge.number]),colors:Ge.arrayOf(Ge.arrayOf(Ge.string)),styles:Ge.object};iU.defaultProps={width:320,height:240,colors:[[$f[900],$f[700],$f[500],$f[300],$f[100]],[Zf[900],Zf[700],Zf[500],Zf[300],Zf[100]],[qf[900],qf[700],qf[500],qf[300],qf[100]],[Jf[900],Jf[700],Jf[500],Jf[300],Jf[100]],[eh[900],eh[700],eh[500],eh[300],eh[100]],[th[900],th[700],th[500],th[300],th[100]],[nh[900],nh[700],nh[500],nh[300],nh[100]],[rh[900],rh[700],rh[500],rh[300],rh[100]],[ih[900],ih[700],ih[500],ih[300],ih[100]],["#194D33",Nm[700],Nm[500],Nm[300],Nm[100]],[sh[900],sh[700],sh[500],sh[300],sh[100]],[oh[900],oh[700],oh[500],oh[300],oh[100]],[ah[900],ah[700],ah[500],ah[300],ah[100]],[lh[900],lh[700],lh[500],lh[300],lh[100]],[ch[900],ch[700],ch[500],ch[300],ch[100]],[Ah[900],Ah[700],Ah[500],Ah[300],Ah[100]],[uh[900],uh[700],uh[500],uh[300],uh[100]],[fh[900],fh[700],fh[500],fh[300],fh[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};fs(iU);var sU=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.hex,s=e.colors,o=e.width,a=e.triangle,l=e.styles,c=l===void 0?{}:l,A=e.className,u=A===void 0?"":A,f=gt(us({default:{card:{width:o,background:"#fff",border:"0 solid rgba(0,0,0,0.25)",boxShadow:"0 1px 4px rgba(0,0,0,0.25)",borderRadius:"4px",position:"relative"},body:{padding:"15px 9px 9px 15px"},label:{fontSize:"18px",color:"#fff"},triangle:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent #fff transparent",position:"absolute"},triangleShadow:{width:"0px",height:"0px",borderStyle:"solid",borderWidth:"0 9px 10px 9px",borderColor:"transparent transparent rgba(0,0,0,.1) transparent",position:"absolute"},hash:{background:"#F0F0F0",height:"30px",width:"30px",borderRadius:"4px 0 0 4px",float:"left",color:"#98A1A4",display:"flex",alignItems:"center",justifyContent:"center"},input:{width:"100px",fontSize:"14px",color:"#666",border:"0px",outline:"none",height:"28px",boxShadow:"inset 0 0 0 1px #F0F0F0",boxSizing:"content-box",borderRadius:"0 4px 4px 0",float:"left",paddingLeft:"8px"},swatch:{width:"30px",height:"30px",float:"left",borderRadius:"4px",margin:"0 6px 6px 0"},clear:{clear:"both"}},"hide-triangle":{triangle:{display:"none"},triangleShadow:{display:"none"}},"top-left-triangle":{triangle:{top:"-10px",left:"12px"},triangleShadow:{top:"-11px",left:"12px"}},"top-right-triangle":{triangle:{top:"-10px",right:"12px"},triangleShadow:{top:"-11px",right:"12px"}}},c),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right"}),h=function(m,g){FA(m)&&t({hex:m,source:"hex"},g)};return q.createElement("div",{style:f.card,className:"twitter-picker "+u},q.createElement("div",{style:f.triangleShadow}),q.createElement("div",{style:f.triangle}),q.createElement("div",{style:f.body},tf(s,function(d,m){return q.createElement(ef,{key:m,color:d,hex:d,style:f.swatch,onClick:h,onHover:r,focusStyle:{boxShadow:"0 0 4px "+d}})}),q.createElement("div",{style:f.hash},"#"),q.createElement(Ht,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:h}),q.createElement("div",{style:f.clear})))};sU.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),triangle:Ge.oneOf(["hide","top-left","top-right"]),colors:Ge.arrayOf(Ge.string),styles:Ge.object};sU.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};fs(sU);var oU=function(e){var t=gt({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",border:"2px #fff solid",transform:"translate(-12px, -13px)",background:"hsl("+Math.round(e.hsl.h)+", "+Math.round(e.hsl.s*100)+"%, "+Math.round(e.hsl.l*100)+"%)"}}});return q.createElement("div",{style:t.picker})};oU.propTypes={hsl:Ge.shape({h:Ge.number,s:Ge.number,l:Ge.number,a:Ge.number})};oU.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var aU=function(e){var t=gt({default:{picker:{width:"20px",height:"20px",borderRadius:"22px",transform:"translate(-10px, -7px)",background:"hsl("+Math.round(e.hsl.h)+", 100%, 50%)",border:"2px white solid"}}});return q.createElement("div",{style:t.picker})};aU.propTypes={hsl:Ge.shape({h:Ge.number,s:Ge.number,l:Ge.number,a:Ge.number})};aU.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var x3e=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(h,d){if(h.hex)FA(h.hex)&&t({hex:h.hex,source:"hex"},d);else if(h.rgb){var m=h.rgb.split(",");pS(h.rgb,"rgb")&&t({r:m[0],g:m[1],b:m[2],a:1,source:"rgb"},d)}else if(h.hsv){var g=h.hsv.split(",");pS(h.hsv,"hsv")&&(g[2]=g[2].replace("%",""),g[1]=g[1].replace("%",""),g[0]=g[0].replace("°",""),g[1]==1?g[1]=.01:g[2]==1&&(g[2]=.01),t({h:Number(g[0]),s:Number(g[1]),v:Number(g[2]),source:"hsv"},d))}else if(h.hsl){var p=h.hsl.split(",");pS(h.hsl,"hsl")&&(p[2]=p[2].replace("%",""),p[1]=p[1].replace("%",""),p[0]=p[0].replace("°",""),u[1]==1?u[1]=.01:u[2]==1&&(u[2]=.01),t({h:Number(p[0]),s:Number(p[1]),v:Number(p[2]),source:"hsl"},d))}},l=gt({default:{wrap:{display:"flex",height:"100px",marginTop:"4px"},fields:{width:"100%"},column:{paddingTop:"10px",display:"flex",justifyContent:"space-between"},double:{padding:"0px 4.4px",boxSizing:"border-box"},input:{width:"100%",height:"38px",boxSizing:"border-box",padding:"4px 10% 3px",textAlign:"center",border:"1px solid #dadce0",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",fontFamily:"Roboto,Arial,sans-serif"},input2:{height:"38px",width:"100%",border:"1px solid #dadce0",boxSizing:"border-box",fontSize:"11px",textTransform:"lowercase",borderRadius:"5px",outline:"none",paddingLeft:"10px",fontFamily:"Roboto,Arial,sans-serif"},label:{textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"35px",top:"-6px",left:"0",right:"0",marginLeft:"auto",marginRight:"auto",fontFamily:"Roboto,Arial,sans-serif"},label2:{left:"10px",textAlign:"center",fontSize:"12px",background:"#fff",position:"absolute",textTransform:"uppercase",color:"#3c4043",width:"32px",top:"-6px",fontFamily:"Roboto,Arial,sans-serif"},single:{flexGrow:"1",margin:"0px 4.4px"}}}),c=r.r+", "+r.g+", "+r.b,A=Math.round(i.h)+"°, "+Math.round(i.s*100)+"%, "+Math.round(i.l*100)+"%",u=Math.round(o.h)+"°, "+Math.round(o.s*100)+"%, "+Math.round(o.v*100)+"%";return q.createElement("div",{style:l.wrap,className:"flexbox-fix"},q.createElement("div",{style:l.fields},q.createElement("div",{style:l.double},q.createElement(Ht,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),q.createElement("div",{style:l.column},q.createElement("div",{style:l.single},q.createElement(Ht,{style:{input:l.input2,label:l.label2},label:"rgb",value:c,onChange:a})),q.createElement("div",{style:l.single},q.createElement(Ht,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),q.createElement("div",{style:l.single},q.createElement(Ht,{style:{input:l.input2,label:l.label2},label:"hsl",value:A,onChange:a})))))},lU=function(e){var t=e.width,r=e.onChange,i=e.rgb,s=e.hsl,o=e.hsv,a=e.hex,l=e.header,c=e.styles,A=c===void 0?{}:c,u=e.className,f=u===void 0?"":u,h=gt(us({default:{picker:{width:t,background:"#fff",border:"1px solid #dfe1e5",boxSizing:"initial",display:"flex",flexWrap:"wrap",borderRadius:"8px 8px 0px 0px"},head:{height:"57px",width:"100%",paddingTop:"16px",paddingBottom:"16px",paddingLeft:"16px",fontSize:"20px",boxSizing:"border-box",fontFamily:"Roboto-Regular,HelveticaNeue,Arial,sans-serif"},saturation:{width:"70%",padding:"0px",position:"relative",overflow:"hidden"},swatch:{width:"30%",height:"228px",padding:"0px",background:"rgba("+i.r+", "+i.g+", "+i.b+", 1)",position:"relative",overflow:"hidden"},body:{margin:"auto",width:"95%"},controls:{display:"flex",boxSizing:"border-box",height:"52px",paddingTop:"22px"},color:{width:"32px"},hue:{height:"8px",position:"relative",margin:"0px 16px 0px 16px",width:"100%"},Hue:{radius:"2px"}}},A));return q.createElement("div",{style:h.picker,className:"google-picker "+f},q.createElement("div",{style:h.head},l),q.createElement("div",{style:h.swatch}),q.createElement("div",{style:h.saturation},q.createElement(K1,{hsl:s,hsv:o,pointer:oU,onChange:r})),q.createElement("div",{style:h.body},q.createElement("div",{style:h.controls,className:"flexbox-fix"},q.createElement("div",{style:h.hue},q.createElement(cp,{style:h.Hue,hsl:s,radius:"4px",pointer:aU,onChange:r}))),q.createElement(x3e,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};lU.propTypes={width:Ge.oneOfType([Ge.string,Ge.number]),styles:Ge.object,header:Ge.string};lU.defaultProps={width:652,styles:{},header:"Color picker"};fs(lU);const b3e="_InformationContainerPos_1yd4c_2",E3e="_scrollContainer_1yd4c_15",gS={InformationContainerPos:b3e,scrollContainer:E3e,"options-container":"_options-container_1yd4c_24"},B3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAABE5AAAROQEb2ZNGAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6NDctMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmU1ZTg4ZDczLWQ3YmItNjg0NS1iNDkxLWYxZTU0YmRhZDE1MiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDphYTA0ZDdmOC1lYzY0LWU4NGQtYjI0My1kOGY0YTI1ZTdmM2YiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmFhMDRkN2Y4LWVjNjQtZTg0ZC1iMjQzLWQ4ZjRhMjVlN2YzZiIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxODowNS0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDozNzgwNzA3Yy0zNDg5LTAzNDctYmEwNy1kOTFhY2ZkYmUwODYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MjQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6ZTVlODhkNzMtZDdiYi02ODQ1LWI0OTEtZjFlNTRiZGFkMTUyIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjQ3LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+okruHwAAA6NJREFUeNrt279LG2EYwHG1CCqKPwKOJQU3cXYqXZ0KofgPuBWcUmsgoouCFArS0UXaWUpTFxHcUnE4cO6fULoUbWnTFk2ftz4p19BoLve+d33vvsN3KWre97lPUvPm7Gs2m32U3xgCABgCAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABABnlV5VR6QH0mOpIq229VSacPj4E/oY7Y9b0TWZtY0AwO7Qp6WH0q70XrqSmh1qSLMO1zKrj9Hp8a90jbu65mkAxBv4svRR+nHD0MOZr5t3uJ75iGsxa18GQPRBl6Sgy0GHu5QWHa5rUR8j6rrMXkoAuH3Ag9KLHgYcbsfh+nZirs3sbRAA/x5uQXrb4zMs3AdpyMH6hvRnx1nbpe6xAIC/hzssHcUcbrjnUr/F9fXrz7S1PrPXYQBcD3dKemdxuKZP0pzFNc7pz7S5RrPnqVwDkAGMSTXLg211auNtmL4NPXW0RrP3sVwC0EOVwNFgW9XjPMv01anueI2By8Or/xKAbHhSeuN4sK3OpPvSQIT1Dej3nCW0RjOLyVwA0Jf9IKHBhk8IX0vFLtZX1K9tJLzGII3/DtJ4q1dLeLDhvkjH0jNpSXqkLem/HevXpLW+WtJvEZP+IKee4nB9qZ7kB0pJPvOPuLiRzgkKmQCgz/xDLmrkDpN4JUjikOeEi9lzJ64Pi1wDOOAixu7AZwBVLmDsqr7/DrAhfeVCRs7MbCMr7wLWuKCRW8vaOYC5cfIbF/bWzIwqWT0J3LRww0eWM7PZzPpnAeUUztl9yMyknJdPA7el71z0P5lZbOftfgDzSvCTi/97BuW83hG0lfNfDM3et/J+T+BKjgGscFfwNYL1DodF+yl/Pm/j/oP9Doc869wVfPNh0Z50Vzr3GMC57mEvjUMeH/8yqKJvh15Ko9I96cJjABe6h1HdUyPJQx4fAdyRFtruz/MdQDG0nwWzRwB0DyJTAPjjUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAhgDMSJ89BmDWPgOA3gGMS0+kVU8zax8HAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIACQlX4BjeT0VuSSEBUAAAAASUVORK5CYII=",S3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MTgtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjA4MDc2OWJhLTIwNzQtMjU0Zi1iNjM5LWJiZjEyMTFlMjljNSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDpjMTM0ZDhjYS01ZTFlLWMzNGMtOWZjNC0zZWU4MjRkNWE1YWMiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOmMxMzRkOGNhLTVlMWUtYzM0Yy05ZmM0LTNlZTgyNGQ1YTVhYyIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoyMTozMy0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo4NzUzMzYxZC05NmIzLTgwNDctYTA0ZC0wODcxYmNiNzY4MDAiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6Mjk6NTctMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MDgwNzY5YmEtMjA3NC0yNTRmLWI2MzktYmJmMTIxMWUyOWM1IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjE4LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Yrc/VQAAAzxJREFUeNrt3b9LFnEcwHE3IW1oiUCF/gCXcgibmhyaDEqnWhoCaRXqUQhByKVVXAqsMbQyGgIHA6GhSdpNc7E/IBehp8/h94ErRLzoOc671/Ce7/O572t4/PHc9bTb7R41NzcBADcBAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAinVrudUfPY92o+0ut5uu1Q9AtQCsRe2SWgMAAAAAAAAAAEo/7KHoWnQl12i0USKAjXTN/AzZTEMAdB/AQvQjfRrvtBMdlAjgIF0zP0M20wIA3QewVOJBF20JAAAAAACAbgJYrDCARQD+30EPRjei66nsU/fVaLXCAFbTjKO5ubMdBgEoDuBR9Cv6+VeHFQZweMy82Q6PACgOYLbCB120WQCKA5ipEYAZAAAAoCCAxzUC8BiAk3+3fzeajCZSN6OXNQLwMu3U2W8y7TwEwNENaTe0CQCWW7cbDOA2AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACcWQB3GgzgDgDLrbHoa/Ql1+foe40O+nvaKb9jtvMYAMutc9Hl9C3hTgPR0xoBeJp2yu+Y7XzO8wE8IAIAAAAAAABPCQPgTwD3ok/Req6P0V6FD3ovzZifOdvhHgD/9hKI7JPzpVwXoxcVBvAizZifeaDKL5fwsGgPiwYAAAAAAACAswJgKnqf3tzV6W20X+JB76dr5mfIZpoCoPsAeqPz6aeETheiDyUC+JCumZ8hm6kXAO8NBAAAAAAAoFQAfdG7EgFk1+oDoLuHOhI9jB6covvRVokAttI1TzNbtsMIAMUBPKnRXwOfAOD/AQAAAAAAACj04si6APDiyBMOejh6Fs3naqX/pqkLgPW0U37HbOdhAI7eoNXUbwZNAuC7gQAAAAAADQYw3mAA440BkD7svYlWotepV9FmgwFspnvQuR8r6R5N1hHAfIMPumjzdQQw52BP3RwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADA2QQwHe1E36JtHdu3dI+mfTVMAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAAV7DcOsgfgT8DmTAAAAABJRU5ErkJggg==",M3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzM6MTEtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOjJkMTY5MDdlLWQyY2EtZDA0Mi05MWRjLTliZTMyYzYyYjlmOSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowMzZkNWExYy1jOTYwLTAxNDktODlkMC00NzQ0NDMwM2QyNWQiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjAzNmQ1YTFjLWM5NjAtMDE0OS04OWQwLTQ3NDQ0MzAzZDI1ZCIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTozNC0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDo2N2JiZmQ0OC0yMGMzLTI0NDktODQyNS1kNWJmOTBlNzMwYjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6MTQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6MmQxNjkwN2UtZDJjYS1kMDQyLTkxZGMtOWJlMzJjNjJiOWY5IiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMzOjExLTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Q6I0lAAAAs1JREFUeNrt3TtrFFEYgOFE2HjFXgv9AyIYsbATMaAWQtqAYBPQ0ibCgoSA/yGbwsJ/o6Ag3gMWEkurTeGlcfwGzoIs7LKT3TXOOU/xFlnYkNnvIRNOZs4sVFW1oHLzIQDgQwBAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAiAiVt91l2OXkRVi3oTXQVg+uHfjX60bPiDfkUPADj48C+2ePh/dx2AgwF4ncHw695HHQCaA6gy6hYAZQPYAqBsANsAlA1gBwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAogDE14tRt359RL3ocbQSLQGQH4Aj0bsJ31tfF3EDgPwAvGzw/t/ROgDlAhhcY7gMQLkABpeXnQSgXAB1mwCUDeAjAGUD6ANQNoB9AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOCQ6wFQNoAnQ8fWiXYBKAfAnaFjOxXtATAewIdMhv85Ojp0bGfqq3sBGA/gcrodKrt9guO11Sm+XxkA0gd1P90Y2dbhb4w4rm8ATI5gpYVbx+8On/eHHoJRAdAMwVJ9j3zaNKE3ZmOFw6z+uTaj29HxEcdxLvoKQIHVd/XW9/XN4LcLAC0c/vno04xOLwC0bPj3oi8z/PsCgIYDWExLr/+iTlrkORutTbHYA8AMAXTTuvu8e5XO8XtTLPIAMAcATzNbVgagIYAdAAAAAAAAAAAAAADKA7CdGYA+AM0AbGUG4C0AzQDczAzABgDNAHTSHrs5DL9ebTwGQHME1zIY/vfoQjG7hc8BwXr0s8XDXyvqeQFzQnClhZeXPY8uFffEkDkiOB09ShDq/9rt/4f10/n+YXSiyGcGqfCnhgkAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAAaBp+gMB5Yr6zMTlPAAAAABJRU5ErkJggg==",C3e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAGiGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgOS4xLWMwMDEgNzkuMTQ2Mjg5OSwgMjAyMy8wNi8yNS0yMDowMTo1NSAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczpkYz0iaHR0cDovL3B1cmwub3JnL2RjL2VsZW1lbnRzLzEuMS8iIHhtbG5zOnBob3Rvc2hvcD0iaHR0cDovL25zLmFkb2JlLmNvbS9waG90b3Nob3AvMS4wLyIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0RXZ0PSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VFdmVudCMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIiB4bXA6Q3JlYXRlRGF0ZT0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgeG1wOk1vZGlmeURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIHhtcDpNZXRhZGF0YURhdGU9IjIwMjQtMDUtMTVUMTc6MzI6MjYtMDY6MDAiIGRjOmZvcm1hdD0iaW1hZ2UvcG5nIiBwaG90b3Nob3A6Q29sb3JNb2RlPSIzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOmFmYmE3YzFhLWI0MTMtMGQ0MS05YmRkLTE2ZGY2MTllOTgyMSIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo5MTFjMjQ0NC01M2M4LWI1NDgtYmYwZi03M2VhOGZlOTVmM2UiPiA8eG1wTU06SGlzdG9yeT4gPHJkZjpTZXE+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJjcmVhdGVkIiBzdEV2dDppbnN0YW5jZUlEPSJ4bXAuaWlkOjkxMWMyNDQ0LTUzYzgtYjU0OC1iZjBmLTczZWE4ZmU5NWYzZSIgc3RFdnQ6d2hlbj0iMjAyNC0wNS0xNVQxNzoxOTo1Ny0wNjowMCIgc3RFdnQ6c29mdHdhcmVBZ2VudD0iQWRvYmUgUGhvdG9zaG9wIDI1LjEgKFdpbmRvd3MpIi8+IDxyZGY6bGkgc3RFdnQ6YWN0aW9uPSJzYXZlZCIgc3RFdnQ6aW5zdGFuY2VJRD0ieG1wLmlpZDpmNjZhMzQ1Ni02ODczLWQ5NDYtOTRkMy1mZTYwZjQ5NzliNjYiIHN0RXZ0OndoZW49IjIwMjQtMDUtMTVUMTc6MzA6NDQtMDY6MDAiIHN0RXZ0OnNvZnR3YXJlQWdlbnQ9IkFkb2JlIFBob3Rvc2hvcCAyNS4xIChXaW5kb3dzKSIgc3RFdnQ6Y2hhbmdlZD0iLyIvPiA8cmRmOmxpIHN0RXZ0OmFjdGlvbj0ic2F2ZWQiIHN0RXZ0Omluc3RhbmNlSUQ9InhtcC5paWQ6YWZiYTdjMWEtYjQxMy0wZDQxLTliZGQtMTZkZjYxOWU5ODIxIiBzdEV2dDp3aGVuPSIyMDI0LTA1LTE1VDE3OjMyOjI2LTA2OjAwIiBzdEV2dDpzb2Z0d2FyZUFnZW50PSJBZG9iZSBQaG90b3Nob3AgMjUuMSAoV2luZG93cykiIHN0RXZ0OmNoYW5nZWQ9Ii8iLz4gPC9yZGY6U2VxPiA8L3htcE1NOkhpc3Rvcnk+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+F7DBkwAABCVJREFUeNrt3TtMFEEYwHHuAiYkNjRg74mJpSYUkCiGAhKxsLKXggQ6yi2wQUh8RMCGRJulEgotjgLwVaCVDYYeHzQaKU5FCRo4vwnfRdQgHvu4mZ1/8W/Iec7c/u7gdmd368rlch35Gy8CAHgRAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAJLpUhjkpW5pQfoolaRPjlXSsZs59Jg5AeDgDZ+T2qRFaUcqZyQzl0c6txwA9n/X9+m7ppzR1nWOeQD8DaBD+pzhjV/JzLEDAL9v/JPSmgcbv5KZaysAfv3ev+PRxq80acPfAzYAKEgrHgIwcy4AIAwGpS8eAjBzHgBAGEx7uPErhQAIg6LHAIoACIM5jwHMAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIuA3pjbYBgOwDMOvyNqUZ6azUuGcMjfqz+/qYHQBkC8BXaUI6/p/rE8b13wAgAwB+SOel+irGVC91St8B4DYAs8K4J8LYehJepQyAhAEMVfPO3+eTYAgAbgJYinGMSwBwC8A36VyMY+zU5wSAIwCWpeYYx9gsvQKAOwAe7P2eH8MYzX6ChwBwB8DtOE+60PMWxwHgDoCRBMY5AgB3AIzHeQaufgJMAIC/AQDg8beAZQC4A2Argf0AWwBwa0/gc+lIDONr0OdiT6CjxwJyEcaW41iA2wDeS70RxnZBnwMADq8HMOfhXzzEuHpTuG4BAFJaEWQO5IxKp/61f0C/75vHXEvo4A8Aarwm8J00K13WpV9HtYL+bFYfw5pAT5aFb2osC+e8AABkFcBOxADgGIBt6YU0pUfwhqWrh2xYn2NKn3MbAHYDeCId0713ed2RE0d5fc4W6TEA7APwVuqPsgK4ypXC/XpKGQAsAPBB6qrBuLti2EsIgIgAzFk/fTUce5+OAQA1AjCTxsf+Ab8OZgBQGwDmtiynLRj/mQj3OQBABAAv41z1E2H8LToWAKQMwOy3b7Bg/A06FgCkDOCmRbe7uQWA9AGMWgRgFADpAxizCMAYAAAAAAAAgL8BAJAagOsWAbgBgPQBPJWaLBh/k/QMAOkDMIsz7lkw/rsRFooAIIbDweY27avS65Rb1f+bw8EsCgUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcCCAoscAigAIg2mPAYQACIPBFC7GZGNmzgMA2L0+z4qHAMycCwDYPf9+0kMAk3He08BZAIqgVVrzaOObuZ6w4bW3AoAiaI9wkqVLmTm22/K62wTA/Cq4kvCNGmvdul5TIA+A/RG0SQspXqwxrYtULurccja95lYB+OOSrd3SvH4ilPR6AC5V0rHP6y1o8za+1lYCIAAQAAgABAACAAGAAEAAIAAQAAgABAACAAGAAEAAIAAQAAgABAACAFXRT5xealqlzx1wAAAAAElFTkSuQmCC",T3e="_InformationContainerPos_1m76y_2",I3e="_scrollContainer_1m76y_15",R3e="_centerAlign_1m76y_25",U3e="_traitInfoTitle_1m76y_28",F3e="_dropdownFlex_1m76y_38",P3e="_checkboxFlex_1m76y_44",L3e="_simpleFlex_1m76y_49",D3e="_traitInfoText_1m76y_55",N3e="_dropdownBase_1m76y_64",O3e="_dropdownControl_1m76y_74",k3e="_dropdownControlSmall_1m76y_80",H3e="_flexSelect_1m76y_106",Q3e="_checked_1m76y_163",z3e="_checkmark_1m76y_167",G3e="_checkboxHolder_1m76y_180",V3e="_actionButton_1m76y_189",j3e="_tabHolder_1m76y_209",W3e="_tabButton_1m76y_215",K3e="_tabButtonSelected_1m76y_235",We={InformationContainerPos:T3e,scrollContainer:I3e,centerAlign:R3e,traitInfoTitle:U3e,dropdownFlex:F3e,checkboxFlex:P3e,simpleFlex:L3e,traitInfoText:D3e,dropdownBase:N3e,dropdownControl:O3e,dropdownControlSmall:k3e,"input-box":"_input-box_1m76y_87",flexSelect:H3e,"arrow-button":"_arrow-button_1m76y_114","left-button":"_left-button_1m76y_130","right-button":"_right-button_1m76y_137","anim-button":"_anim-button_1m76y_144","custom-checkbox":"_custom-checkbox_1m76y_149","checkbox-container":"_checkbox-container_1m76y_154",checked:Q3e,checkmark:z3e,checkboxHolder:G3e,actionButton:V3e,tabHolder:j3e,tabButton:W3e,tabButtonSelected:K3e},X3e="_slider_1y6nx_1",Y3e="_infoContainer_1y6nx_13",jy={"slider-container":"_slider-container_1y6nx_1",slider:X3e,infoContainer:Y3e,"input-box":"_input-box_1y6nx_18"};function Gh({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return Q.jsxs(Q.Fragment,{children:[Q.jsxs("div",{className:jy.infoContainer,children:[n,o&&Q.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:jy["input-box"],step:o})]}),Q.jsx("div",{className:jy["slider-container"],children:Q.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:jy.slider,step:s})})]})}function $3e({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=xe.useContext(mr),[i,s]=xe.useState(0),[o,a]=xe.useState(0),[l,c]=xe.useState(0);xe.useEffect(()=>{var d,m,g;e!=null&&(c((d=e.data)==null?void 0:d.cullingLayer),s(((m=e.data)==null?void 0:m.cullingDistance[0])||0),a(((g=e.data)==null?void 0:g.cullingDistance[1])||0))},[e]);const A=d=>{s(d.target.value),e!=null&&e.data&&(e.data.cullingDistance[0]=d.target.value)},u=d=>{a(d.target.value),e!=null&&e.data&&(e.data.cullingDistance[1]=d.target.value)},f=d=>{e!=null&&e.data&&(c(d.target.value),e.data.cullingLayer=d.target.value)},h=()=>{r.updateCullHiddenMeshes()};return Q.jsx("div",{children:Q.jsxs("div",{className:We.InformationContainerPos,children:[Q.jsx(nl,{title:"Trait Information",width:180,right:20}),Q.jsx("div",{className:We.scrollContainer,children:n!=null?Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:We.traitInfoTitle,children:"Trait ID"}),Q.jsx("div",{className:We.traitInfoText,children:n==null?void 0:n.id}),Q.jsx("div",{className:We.traitInfoTitle,children:"Trait Name"}),Q.jsx("div",{className:We.traitInfoText,children:n==null?void 0:n.name}),Q.jsx("div",{className:We.traitInfoTitle,children:"Description"}),Q.jsx("div",{className:We.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),Q.jsx("div",{className:We.traitInfoTitle,children:"Culling Options"}),Q.jsx("br",{}),Q.jsxs("div",{className:We.traitInfoText,children:["Culling Layer",Q.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:f,className:We["input-box"],step:1}),Q.jsx("br",{}),Q.jsx("br",{}),Q.jsx(Gh,{title:"Out Distance",value:i,onChange:A,min:0,max:1,step:.001,stepBox:.01}),Q.jsx("br",{}),Q.jsx(Gh,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),Q.jsx("div",{className:We.actionButton,onClick:h,children:Q.jsx("div",{children:"Update Culling "})})]})]}):Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:We.traitInfoTitle,children:"No Trait Selected"})})})]})})}var Nj={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=s(xe),t=r(yV);function r(b){return b&&b.__esModule?b:{default:b}}function i(){if(typeof WeakMap!="function")return null;var b=new WeakMap;return i=function(){return b},b}function s(b){if(b&&b.__esModule)return b;if(b===null||o(b)!=="object"&&typeof b!="function")return{default:b};var B=i();if(B&&B.has(b))return B.get(b);var S={},I=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var M in b)if(Object.prototype.hasOwnProperty.call(b,M)){var P=I?Object.getOwnPropertyDescriptor(b,M):null;P&&(P.get||P.set)?Object.defineProperty(S,M,P):S[M]=b[M]}return S.default=b,B&&B.set(b,S),S}function o(b){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(S){return typeof S}:o=function(S){return S&&typeof Symbol=="function"&&S.constructor===Symbol&&S!==Symbol.prototype?"symbol":typeof S},o(b)}function a(){return a=Object.assign||function(b){for(var B=1;B"u"?w:S.placeholder,value:""},isOpen:!1},I.dropdownRef=(0,e.createRef)(),I.mounted=!0,I.handleDocumentClick=I.handleDocumentClick.bind(g(I)),I.fireChangeEvent=I.fireChangeEvent.bind(g(I)),I}return h(B,[{key:"componentDidUpdate",value:function(I){if(this.props.value!==I.value)if(this.props.value){var M=this.parseValue(this.props.value,this.props.options);M!==this.state.selected&&this.setState({selected:M})}else this.setState({selected:{label:typeof this.props.placeholder>"u"?w:this.props.placeholder,value:""}})}},{key:"componentDidMount",value:function(){document.addEventListener("click",this.handleDocumentClick,!1),document.addEventListener("touchend",this.handleDocumentClick,!1)}},{key:"componentWillUnmount",value:function(){this.mounted=!1,document.removeEventListener("click",this.handleDocumentClick,!1),document.removeEventListener("touchend",this.handleDocumentClick,!1)}},{key:"handleMouseDown",value:function(I){this.props.onFocus&&typeof this.props.onFocus=="function"&&this.props.onFocus(this.state.isOpen),!(I.type==="mousedown"&&I.button!==0)&&(I.stopPropagation(),I.preventDefault(),this.props.disabled||this.setState({isOpen:!this.state.isOpen}))}},{key:"parseValue",value:function(I,M){var P;if(typeof I=="string")for(var D=0,T=M.length;D"u"&&(P=I.label||I);var D=I.label||I.value||I,T=P===this.state.selected.value||P===this.state.selected,y=(M={},A(M,"".concat(this.props.baseClassName,"-option"),!0),A(M,I.className,!!I.className),A(M,"is-selected",T),M),E=(0,t.default)(y),R=Object.keys(I.data||{}).reduce(function(L,N){return c({},L,A({},"data-".concat(N),I.data[N]))},{});return e.default.createElement("div",a({key:P,className:E,onMouseDown:this.setValue.bind(this,P,D),onClick:this.setValue.bind(this,P,D),role:"option","aria-selected":T?"true":"false"},R),D)}},{key:"buildMenu",value:function(){var I=this,M=this.props,P=M.options,D=M.baseClassName,T=P.map(function(y){if(y.type==="group"){var E=e.default.createElement("div",{className:"".concat(D,"-title")},y.name),R=y.items.map(function(L){return I.renderOption(L)});return e.default.createElement("div",{className:"".concat(D,"-group"),key:y.name,role:"listbox",tabIndex:"-1"},E,R)}else return I.renderOption(y)});return T.length?T:e.default.createElement("div",{className:"".concat(D,"-noresults")},"No options found")}},{key:"handleDocumentClick",value:function(I){this.mounted&&(this.dropdownRef.current.contains(I.target)||this.state.isOpen&&this.setState({isOpen:!1}))}},{key:"isValueSelected",value:function(){return typeof this.state.selected=="string"||this.state.selected.value!==""}},{key:"render",value:function(){var I,M,P,D,T,y=this.props,E=y.baseClassName,R=y.controlClassName,L=y.placeholderClassName,N=y.menuClassName,z=y.arrowClassName,W=y.arrowClosed,H=y.arrowOpen,C=y.className,K=this.props.disabled?"Dropdown-disabled":"",ee=typeof this.state.selected=="string"?this.state.selected:this.state.selected.label,F=(0,t.default)((I={},A(I,"".concat(E,"-root"),!0),A(I,C,!!C),A(I,"is-open",this.state.isOpen),I)),re=(0,t.default)((M={},A(M,"".concat(E,"-control"),!0),A(M,R,!!R),A(M,K,!!K),M)),ce=(0,t.default)((P={},A(P,"".concat(E,"-placeholder"),!0),A(P,L,!!L),A(P,"is-selected",this.isValueSelected()),P)),oe=(0,t.default)((D={},A(D,"".concat(E,"-menu"),!0),A(D,N,!!N),D)),ge=(0,t.default)((T={},A(T,"".concat(E,"-arrow"),!0),A(T,z,!!z),T)),me=e.default.createElement("div",{className:ce},ee),ve=this.state.isOpen?e.default.createElement("div",{className:oe,"aria-expanded":"true"},this.buildMenu()):null;return e.default.createElement("div",{ref:this.dropdownRef,className:F},e.default.createElement("div",{className:re,onMouseDown:this.handleMouseDown.bind(this),onTouchEnd:this.handleMouseDown.bind(this),"aria-haspopup":"listbox"},me,e.default.createElement("div",{className:"".concat(E,"-arrow-wrapper")},H&&W?this.state.isOpen?H:W:e.default.createElement("span",{className:ge}))),ve)}}]),B}(e.Component);_.defaultProps={baseClassName:"Dropdown"};var x=_;n.default=x})(Nj);const kc=oc(Nj);function Z3e({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=q.useContext(mr),[s,o]=xe.useState([]),[a,l]=xe.useState(null),c=u=>{(t==null?void 0:t.loras)!=null&&(l(t.loras[u.value]),console.log(t.loras[u.value]))},A=async()=>{const u=i.parent;u.remove(i),await r.createLoraData(a),u.add(i)};return xe.useEffect(()=>{if((t==null?void 0:t.loras)!=null){const u=t.loras.map((f,h)=>({value:h,label:f.name,description:f.description,manifest:f.manifest}));o(u)}},[t]),Q.jsx("div",{children:Q.jsxs("div",{className:We.InformationContainerPos,children:[Q.jsx(nl,{title:"Lora Creation",width:180,right:20}),Q.jsxs("div",{className:We.scrollContainer,children:[Q.jsx("div",{className:We.traitInfoTitle,children:"Lora Manifests"}),Q.jsx(kc,{className:We.dropdownControl,options:s,onChange:c,placeholder:"Select an option"}),";",Q.jsx("div",{className:We.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&Q.jsx("div",{className:We.actionButton,onClick:A,children:Q.jsx("div",{children:" Create Lora Data "})})]})]})})}function q3e({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=q.useContext(mr),[s,o]=xe.useState([]),[a,l]=xe.useState(""),[c,A]=xe.useState(null),u=h=>{(t==null?void 0:t.sprites)!=null&&(l(t.sprites[h.value].description),A(t.sprites[h.value]))},f=async()=>{const h=i.parent;h.remove(i),await r.createSpriteAtlas(c),h.add(i)};return xe.useEffect(()=>{if((t==null?void 0:t.sprites)!=null){const h=t.sprites.map((d,m)=>({value:m,label:d.name,description:d.description,manifest:d.manifest}));o(h)}},[t]),Q.jsx("div",{children:Q.jsxs("div",{className:We.InformationContainerPos,children:[Q.jsx(nl,{title:"Sprite Creation",width:180,right:20}),Q.jsxs("div",{className:We.scrollContainer,children:[Q.jsx("div",{className:We.traitInfoTitle,children:"Sprite Manifests"}),Q.jsx(kc,{className:We.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",Q.jsx("div",{className:We.traitInfoText,children:a||""}),c!=null&&Q.jsx("div",{className:We.actionButton,onClick:f,children:Q.jsx("div",{children:" Create Sprite Data "})})]})]})})}const A4=4096;function J3e({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=q.useContext(mr),[o,a]=xe.useState([]),[l,c]=xe.useState(""),[A,u]=xe.useState(""),[f,h]=xe.useState(""),[d,m]=xe.useState(!1),[g,p]=xe.useState(512),[v,w]=xe.useState(512),[_,x]=xe.useState(.1),[b,B]=xe.useState(.1),[S,I]=xe.useState("center"),[M,P]=xe.useState("center"),[D,T]=xe.useState("center"),[y,E]=xe.useState("head"),[R,L]=xe.useState("chest"),[N,z]=xe.useState(!0),[W,H]=xe.useState(!1),C=[{label:"center"},{label:"left"},{label:"right"}],K=[{label:"center"},{label:"top"},{label:"bottom"}],ee=[{label:"center"},{label:"front"},{label:"back"}],F=[{label:"head"},{label:"neck"},{label:"chest"},{label:"spine"},{label:"hips"},{label:"upperLeg"},{label:"lowerLeg"},{label:"foot"}],re=le=>{(t==null?void 0:t.thumbnails)!=null&&(c(t.thumbnails[le.value].description),h(t.thumbnails[le.value].manifest),u(t.thumbnails[le.value].name))},ce=(le,Z,J,ue)=>isNaN(le)?ue:le>J?J:le{const Z=parseInt(le.target.value);p(ce(Z,1,A4,512))},ge=le=>{const Z=parseInt(le.target.value);w(ce(Z,1,A4,512))},me=le=>{const Z=parseFloat(le.target.value);x(ce(Z,0,1,.1))},ve=le=>{const Z=parseFloat(le.target.value);B(ce(Z,0,1,.1))},be=le=>{m(le)},ne=async()=>{const le=i.parent;le.remove(i),await r.createThumbnails(t.thumbnails[0]),le.add(i)},k=(le=!0)=>({topFrameOffset:b,bottomFrameOffset:_,thumbnailsWidth:g,thumbnailsHeight:v,backgroundColor:[0,0,0,0],thumbnailsCollection:[{traitGroup:e,cameraPosition:M+"-"+D+"-"+S,topBoneName:y==="upperLeg"||y==="lowerLeg"||y==="foot"?"left"+y[0].toUpperCase()+y.slice(1):y,topBoneMaxVertex:N,bottomBoneName:R==="upperLeg"||R==="lowerLeg"||y==="foot"?"left"+R[0].toUpperCase()+R.slice(1):R,bottomBoneMaxVertex:W,saveOnlyIDs:le?null:n.id}]}),ae=async(le=!1)=>{s.storeCurrentAvatar();const Z=i.parent;Z.remove(i),le?await r.createThumbnailsWithObjectData(k(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(k(!1),!1),Z.add(i),s.loadStoredAvatar()};return xe.useEffect(()=>{if((t==null?void 0:t.thumbnails)!=null){const le=t.thumbnails.map((Z,J)=>({value:J,label:Z.name,description:Z.description,manifest:Z.manifest}));a(le)}},[t]),Q.jsx("div",{children:Q.jsxs("div",{className:We.InformationContainerPos,children:[Q.jsx(nl,{title:"Thumbnail Creation",width:180,right:20}),Q.jsxs("div",{className:We.scrollContainer,children:[Q.jsxs("div",{className:We.tabHolder,children:[Q.jsx("div",{className:We.tabButton+(d?"":" "+We.tabButtonSelected),onClick:()=>{be(!1)},children:Q.jsxs("div",{children:[" ","Custom"," "]})}),Q.jsx("div",{className:We.tabButton+(d?" "+We.tabButtonSelected:""),onClick:()=>{be(!0)},children:Q.jsxs("div",{children:[" ","Manifest"," "]})})]}),Q.jsx("br",{}),d?Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:We.traitInfoTitle+" "+We.centerAlign,children:"Thumbnail Manifests"}),Q.jsx(kc,{className:We.dropdownControl,options:o,value:A,onChange:re,placeholder:"Select an option"}),";",Q.jsx("div",{className:We.traitInfoText,children:l||""}),f!=""&&Q.jsx("div",{className:We.actionButton,onClick:ne,children:Q.jsx("div",{children:" Create Thumbnails "})})]}):Q.jsxs(Q.Fragment,{children:[Q.jsxs("div",{className:We.traitInfoText,children:[Q.jsx("div",{className:We.traitInfoTitle+" "+We.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",Q.jsx("input",{value:g,className:We["input-box"],step:1,onChange:le=>{p(le.target.value)},onBlur:oe}),Q.jsx("br",{}),"Height ",Q.jsx("input",{value:v,className:We["input-box"],step:1,onChange:le=>{w(le.target.value)},onBlur:ge}),Q.jsx("br",{}),"Top Spacing ",Q.jsx("input",{value:_,className:We["input-box"],step:.1,onChange:le=>{x(le.target.value)},onBlur:me}),Q.jsx("br",{}),"Bottom Spacing ",Q.jsx("input",{value:b,className:We["input-box"],step:.1,onChange:le=>{B(le.target.value)},onBlur:ve}),Q.jsx("br",{}),Q.jsx("div",{className:We.traitInfoTitle+" "+We.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),Q.jsxs("div",{className:We.dropdownFlex,children:[Q.jsx("div",{className:We.traitInfoTitle,style:{margin:"0px"},children:"X"}),Q.jsx(kc,{className:We.dropdownControlSmall,options:C,onChange:le=>{P(le.label)},value:M})]}),Q.jsxs("div",{className:We.dropdownFlex,children:[Q.jsx("div",{className:We.traitInfoTitle,style:{margin:"0px"},children:"Y"}),Q.jsx(kc,{className:We.dropdownControlSmall,options:K,onChange:le=>{T(le.label)},value:D})]}),Q.jsxs("div",{className:We.dropdownFlex,children:[Q.jsx("div",{className:We.traitInfoTitle,style:{margin:"0px"},children:"Z"}),Q.jsx(kc,{className:We.dropdownControlSmall,options:ee,onChange:le=>{I(le.label)},value:S})]}),Q.jsx("div",{className:We.traitInfoTitle+" "+We.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),Q.jsxs("div",{className:We.dropdownFlex,style:{justifyContent:"space-between"},children:[Q.jsx("div",{className:We.traitInfoTitle,style:{margin:"0px"},children:"Top"}),Q.jsx(kc,{className:We.dropdownControlSmall,options:F,onChange:le=>{E(le.label)},value:y})]}),Q.jsxs("div",{className:We.dropdownFlex,style:{justifyContent:"space-between"},children:[Q.jsx("div",{className:We.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),Q.jsx(kc,{className:We.dropdownControlSmall,options:F,onChange:le=>{L(le.label)},value:R})]}),Q.jsxs("div",{style:{textAlign:"left"},children:[Q.jsxs("div",{className:We.checkboxFlex,style:{marginTop:"20px"},children:[Q.jsx("input",{type:"checkbox",checked:N,onChange:le=>{z(le.target.checked)}}),Q.jsx("div",{className:We.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${N?"uses Top":"uses Low"} Vertex`})]}),Q.jsxs("div",{className:We.checkboxFlex,style:{marginTop:"10px"},children:[Q.jsx("input",{type:"checkbox",checked:W,onChange:le=>{H(le.target.checked)}}),Q.jsx("div",{className:We.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${W?"uses Top":"uses Low"} Vertex`})]})]}),e==""?Q.jsx("div",{className:We.traitInfoText+" "+We.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:We.traitInfoTitle+" "+We.centerAlign,style:{marginTop:"20px"},children:"Generate"}),Q.jsx("div",{className:We.traitInfoText+" "+We.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),Q.jsxs("div",{className:We.simpleFlex,style:{marginTop:"0px"},children:[Q.jsx("div",{className:We.actionButton,style:{margin:"0px"},onClick:()=>{ae(!1)},children:Q.jsx("div",{children:" Current "})}),Q.jsx("div",{className:We.actionButton,style:{margin:"0px"},onClick:()=>{ae(!0)},children:Q.jsx("div",{children:" All "})})]})]})]})]})]})})}function eke({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=q.useState(""),s=o=>{o!=r?i(o):i("")};return Q.jsxs("div",{children:[r=="Information"&&Q.jsx($3e,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&Q.jsx(Z3e,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&Q.jsx(q3e,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&Q.jsx(J3e,{selectedTrait:n,traitGroupName:t}),Q.jsxs("div",{className:gS.InformationContainerPos,children:[Q.jsx(nl,{title:"Tools",width:90,right:0}),Q.jsx("div",{className:gS.scrollContainer,children:Q.jsxs("div",{className:gS.optionsContainer,children:[Q.jsx("div",{onClick:()=>{s("Information")},children:Q.jsx(zl,{size:56,icon:B3e,rarity:r=="Information"?"mythic":"none"})},"Information"),Q.jsx("div",{onClick:()=>{s("LoraCreation")},children:Q.jsx(zl,{size:56,icon:M3e,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),Q.jsx("div",{onClick:()=>{s("SpriteCreation")},children:Q.jsx(zl,{size:56,icon:S3e,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),Q.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:Q.jsx(zl,{size:56,icon:C3e,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation")]})})]})]})}const bl={TRAIT:0,BLEND_SHAPE:1};function tke(){const{isLoading:n,setViewMode:e,setIsLoading:t}=q.useContext(As),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,loraDataGenerator:a,spriteAtlasGenerator:l,thumbnailsGenerator:c,sceneElements:A}=q.useContext(mr),[u,f]=q.useState(bl.TRAIT),{playSound:h}=q.useContext(Mo),{isMute:d}=q.useContext(So),{t:m}=xe.useContext(la),g=()=>{!d&&h("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(yt.CREATE),r(!1)},[p,v]=q.useState(null),[w,_]=q.useState(null),[x,b]=q.useState(""),[B,S]=q.useState(null),[I,M]=q.useState({}),[P,D]=q.useState(null),[T,y]=q.useState(""),[E,R]=q.useState(!1),[L,N]=q.useState({background:"#ffffff"}),z=()=>{!d&&h("backNextButton"),e(yt.SAVE),r(!1)},W=()=>{t(!0),v(null),i.loadRandomTraits().then(()=>{console.log("success"),x!=""&&S(i.getCurrentTraitData(x)),t(!1)}).catch(ne=>{t(!1),console.error("Error loading random traits:",ne.message)})},H=ne=>{N({background:ne.hex})},C=ne=>{N({background:ne.hex}),i.setTraitColor(x,ne.hex)},K=async ne=>{const k=Kl(ne.name),ae=URL.createObjectURL(ne);await s.loadAnimation(ae,!1,0,!0,"",k),y(s.getCurrentAnimationName())},ee=ne=>{if(R(!1),x!=""){t(!0);const k=URL.createObjectURL(ne);i.loadCustomTexture(x,k).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},F=ne=>{if(R(!1),x!=""){t(!0);const k=URL.createObjectURL(ne);i.loadCustomTrait(x,k).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},re=ne=>{var k;if(ne.id===(B==null?void 0:B.id)){((k=ne.blendshapeTraits)==null?void 0:k.length)>0&&f(bl.BLEND_SHAPE);return}R(!1),t(!0),i.loadTrait(ne.traitGroup.trait,ne.id).then(()=>{var ae;if(t(!1),((ae=ne.blendshapeTraits)==null?void 0:ae.length)>0){const le=i.getCurrentBlendShapeTraitData(ne.traitGroup.trait);M(Object.entries(le).reduce((Z,[J,ue])=>(Z[J]=ue.id,Z),{})),f(bl.BLEND_SHAPE)}S(ne)})},ce=ne=>{R(!1),i.removeTrait(ne),S(null)},oe=ne=>{R(!1),t(!0),i.loadRandomTrait(ne).then(()=>{t(!1),S(i.getCurrentTraitData(ne))})},ge=ne=>{R(!1);const k=Array.from(ne),ae=[],le=Z=>new Promise((J,ue)=>{var Y;if(Z&&Z.name.toLowerCase().endsWith(".json")){const G=new FileReader,j=`${(Y=i.manifestData)==null?void 0:Y.getAssetsDirectory()}/anata/_thumbnails/t_${Z.name.split("_")[0]}.jpg`;console.log(j),G.onload=function(se){try{const fe=JSON.parse(se.target.result);fe.thumb=j,ae.push(fe),J()}catch(fe){console.error("Error parsing the JSON file:",fe),ue(fe)}},G.readAsText(Z)}});Promise.all(k.map(le)).then(()=>{ae.length>0&&(v(ae),t(!0),i.loadTraitsFromNFTObject(ae[0]).then(()=>{t(!1)}))}).catch(Z=>{console.error("Error processing files:",Z)})},me=async ne=>{const k=ne[0];k&&k.name.toLowerCase().endsWith(".fbx")&&K(k),k&&(k.name.toLowerCase().endsWith(".png")||k.name.toLowerCase().endsWith(".jpg"))&&ee(k),k&&k.name.toLowerCase().endsWith(".vrm")&&F(k),k&&k.name.toLowerCase().endsWith(".json")&&ge(ne)},ve=ne=>{if(!d&&h("optionClick"),R(!1),x!==ne.trait){f(bl.TRAIT),_(i.getTraits(ne.trait)),b(ne.trait);const k=i.getCurrentTraitData(ne.trait),ae=i.getCurrentBlendShapeTraitData(ne.trait);S(k),M(Object.entries(ae).reduce((le,[Z,J])=>(le[Z]=J.id,le),{})),D(i.getCurrentTraitVRM(ne.trait)),o({targetY:ne.cameraTarget.height,distance:ne.cameraTarget.distance})}else _(null),b(""),S(null),M({}),o({targetY:.8,distance:3.2})},be=()=>{R(!1);var ne=document.createElement("input");ne.type="file",ne.accept=".vrm",ne.onchange=k=>{var ae=k.target.files[0];if(ae.name.endsWith(".vrm")){const le=URL.createObjectURL(ae);t(!0),i.loadCustomTrait(x,le).then(()=>{t(!1)})}},ne.click()};return Q.jsxs("div",{className:gn.container,children:[Q.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:Q.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),Q.jsx("div",{className:"sectionTitle",children:m("pageTitles.chooseAppearance")}),Q.jsx(S0,{onFilesDrop:me}),Q.jsxs("div",{className:gn.sideMenu,children:[Q.jsx(nl,{title:"Appearance",left:20}),Q.jsx("div",{className:gn.bottomLine}),Q.jsx("div",{className:gn.scrollContainer,children:Q.jsx("div",{className:gn["editor-container"],children:i.getGroupTraits().map((ne,k)=>Q.jsxs("div",{className:gn.editorButton,onClick:()=>{ve(ne)},children:[Q.jsx(zl,{size:56,icon:ne.fullIconSvg,rarity:x!==ne.trait?"none":"mythic"}),Q.jsx("div",{className:gn.editorText,children:ne.name})]},"options_"+k))})})]}),!!w&&Q.jsxs("div",{className:gn.selectorContainerPos,children:[Q.jsx(nl,{title:x,width:130,left:20}),B&&u==bl.TRAIT&&Q.jsx("div",{className:gn.selectorColorPickerButton,onClick:()=>{R(!E)},children:Q.jsx("img",{className:gn.selectorColorPickerImg,src:U_e})}),u==bl.TRAIT&&!!E&&Q.jsx("div",{draggable:!1,className:gn.selectorColorPickerUI,children:Q.jsx(YOe,{draggable:!1,width:"200px",color:L.background,onChange:H,onChangeComplete:C})}),Q.jsx("div",{className:gn.bottomLine}),Q.jsxs("div",{className:gn.scrollContainerOptions,children:[u==bl.TRAIT&&Q.jsxs("div",{className:gn["selector-container"],children:[Q.jsx("div",{className:`${gn.selectorButton}`,onClick:()=>{oe(x)},children:Q.jsx(zl,{size:56,icon:R_e,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(x)?Q.jsx(Q.Fragment,{}):Q.jsx("div",{className:`${gn.selectorButton}`,icon:RT,onClick:()=>{ce(x)},children:Q.jsx(zl,{size:56,icon:RT,rarity:B==null?"mythic":"none"})},"no-trait"),w.map(ne=>{let k=ne.id===(B==null?void 0:B.id);return Q.jsx("div",{className:`${gn.selectorButton}`,onClick:()=>{re(ne)},children:Q.jsx(zl,{size:56,icon:ne.fullThumbnail,rarity:k?"mythic":"none"})},ne.id)})]}),u==bl.BLEND_SHAPE&&Q.jsx(nke,{selectedTrait:B,onBack:()=>{f(bl.TRAIT)},selectedBlendShapeTrait:I,setSelectedBlendshapeTrait:M})]}),Q.jsx("div",{className:gn.uploadContainer,children:Q.jsx("div",{className:gn.uploadButton,onClick:be,children:Q.jsx("div",{children:"Upload "})})})]}),Q.jsx(g2,{jsonSelectionArray:p}),Q.jsx(eke,{selectedTrait:B,selectedVRM:P,traitGroupName:x}),Q.jsx(F1,{loadedAnimationName:T,randomize:W}),Q.jsxs("div",{className:gn.buttonContainer,children:[Q.jsx(Un,{theme:"light",text:m("callToAction.back"),size:14,className:gn.buttonLeft,onClick:g}),i.canDownload()&&Q.jsx(Un,{theme:"light",text:m("callToAction.next"),size:14,className:gn.buttonRight,onClick:z})]})]})}const nke=({selectedTrait:n,onBack:e,selectedBlendShapeTrait:t,setSelectedBlendshapeTrait:r})=>{const{characterManager:i,moveCamera:s}=q.useContext(mr),o=i.getBlendShapeGroupTraits((n==null?void 0:n.traitGroup.trait)||"",(n==null?void 0:n.id)||""),a=(c,A)=>{i.removeBlendShapeTrait(c,A.trait);const u={...t};delete u[A.trait],r(u)},l=c=>{const A=c.parentGroup;i.loadBlendShapeTrait((n==null?void 0:n.traitGroup.trait)||"",A.trait||"",(c==null?void 0:c.id)||""),s({targetY:A.cameraTarget.height,distance:A.cameraTarget.distance});const u={...t};u[A.trait||""]=c.id,r(u)};return Q.jsxs("div",{className:gn["selector-container-column"],children:[Q.jsx(Un,{theme:"dark",text:"Back",size:14,className:gn.buttonLeft,onClick:e}),o&&o.length>0&&o.map(c=>Q.jsxs("div",{className:gn.blendshapeGroup,children:[Q.jsx("div",{children:c.name}),Q.jsxs("div",{className:gn["selector-container"],children:[Q.jsx(u4,{src:RT,active:!t[c.trait],blendshapeID:"cancel",select:()=>a(n.traitGroup.trait,c)},"empty"),c.collection.map(A=>{let u=A.id===t[c.trait];return Q.jsx(u4,{src:A.fullThumbnail||"",active:u,blendshapeID:A.id,select:()=>l(A)},A.id)})]})]},c.trait))]})},u4=({active:n,blendshapeID:e,src:t,select:r})=>Q.jsx("div",{className:`${gn.selectorButton}`,onClick:r,children:Q.jsx(zl,{size:56,icon:t||"",rarity:n?"mythic":"none"})},e),rke="_InformationContainerPos_rgqwy_1",ike="_traitInfoTitle_rgqwy_13",ske="_traitInfoText_rgqwy_21",oke="_flexSelect_rgqwy_30",ake="_scrollContainer_rgqwy_65",lke="_checked_rgqwy_90",cke="_checkmark_rgqwy_94",Ake="_checkboxHolder_rgqwy_107",uke="_buttonContainer_rgqwy_114",fke="_buttonLeft_rgqwy_123",hke="_buttonRight_rgqwy_127",dke="_buttonCenter_rgqwy_131",Oi={InformationContainerPos:rke,traitInfoTitle:ike,traitInfoText:ske,flexSelect:oke,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:ake,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:lke,checkmark:cke,checkboxHolder:Ake,buttonContainer:uke,buttonLeft:fke,buttonRight:hke,buttonCenter:dke},pke="_InformationContainerPos_11mqa_2",mke="_scrollContainer_11mqa_16",gke="_traitInfoTitle_11mqa_28",vke="_traitInfoText_11mqa_38",yke="_flexSelect_11mqa_66",wke="_checked_11mqa_124",_ke="_checkmark_11mqa_128",xke="_checkboxHolder_11mqa_141",lr={InformationContainerPos:pke,scrollContainer:mke,traitInfoTitle:gke,traitInfoText:vke,"input-box":"_input-box_11mqa_47",flexSelect:yke,"arrow-button":"_arrow-button_11mqa_76","left-button":"_left-button_11mqa_91","right-button":"_right-button_11mqa_98","anim-button":"_anim-button_11mqa_105","custom-checkbox":"_custom-checkbox_11mqa_110","checkbox-container":"_checkbox-container_11mqa_115",checked:wke,checkmark:_ke,checkboxHolder:xke};function cU({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=q.useContext(mr),[a,l]=xe.useState(0),[c,A]=xe.useState(0),[u,f]=xe.useState(0),[h,d]=xe.useState(0),[m,g]=xe.useState(0),[p,v]=xe.useState(0),[w,_]=xe.useState(0),[x,b]=xe.useState(0),[B,S]=xe.useState(0),[I,M]=xe.useState(0);return xe.useEffect(()=>{if(n!=null){const P=Od(n,"Mesh"),D=Od(n,"SkinnedMesh");l(P.length),A(D.length);const T=P.concat(D),{stdMats:y,stdCutoutpMats:E,stdTranspMats:R,mToonMats:L,mToonCutoutMats:N,mToonTranspMats:z}=uge(T);f(y.length),d(R.length),g(E.length),v(L.length),_(z.length),b(N.length);const{triangles:W,bones:H}=o.getBoneTriangleCount();S(W),M(H)}},[n]),n!=null?Q.jsx("div",{children:Q.jsxs("div",{className:lr.InformationContainerPos,children:[Q.jsx(nl,{title:"Model Information",width:180,right:20}),Q.jsxs("div",{className:lr.scrollContainer,children:[Q.jsxs("div",{className:lr.flexSelect,children:[(t==null?void 0:t.length)>1?Q.jsx("div",{className:`${lr["arrow-button"]} ${lr["left-button"]}`,onClick:s}):Q.jsx(Q.Fragment,{}),e&&Q.jsx("div",{style:{textAlign:"center"},children:Q.jsx("div",{className:lr.traitInfoTitle,style:{margin:"auto",fontSize:"14px",width:"200px",textAlign:"center",textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},children:e})}),(t==null?void 0:t.length)>1?Q.jsx("div",{className:`${lr["arrow-button"]} ${lr["right-button"]}`,onClick:i}):Q.jsx(Q.Fragment,{})]}),Q.jsx("div",{className:lr.traitInfoTitle,children:"Geometry info:"}),Q.jsxs("div",{className:lr.traitInfoText,children:["Meshes: ",a]}),Q.jsxs("div",{className:lr.traitInfoText,children:["SkinnedMeshes: ",c]}),Q.jsxs("div",{className:lr.traitInfoText,children:["Triangles: ",B]}),Q.jsxs("div",{className:lr.traitInfoText,children:["Bones: ",I]}),Q.jsx("div",{className:lr.traitInfoTitle,children:"Standard Material Count:"}),Q.jsxs("div",{className:lr.traitInfoText,children:["opaque: ",u]}),Q.jsxs("div",{className:lr.traitInfoText,children:["cutout: ",m]}),Q.jsxs("div",{className:lr.traitInfoText,children:["transparent: ",h]}),Q.jsx("div",{className:lr.traitInfoTitle,children:"MToon Material Count:"}),Q.jsxs("div",{className:lr.traitInfoText,children:["opaque: ",p]}),Q.jsxs("div",{className:lr.traitInfoText,children:["cutout: ",x]}),Q.jsxs("div",{className:lr.traitInfoText,children:["transparent: ",w]})]})]})}):Q.jsx(Q.Fragment,{})}const bke="_InformationContainerPos_b0msk_1",Eke="_traitInfoTitle_b0msk_13",Bke="_traitInfoText_b0msk_22",Ske="_flexSelect_b0msk_33",Mke="_scrollContainer_b0msk_68",Cke="_checked_b0msk_93",Tke="_checkmark_b0msk_97",Ike="_checkboxHolder_b0msk_110",pt={InformationContainerPos:bke,traitInfoTitle:Eke,traitInfoText:Bke,flexSelect:Ske,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:Mke,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:Cke,checkmark:Tke,checkboxHolder:Ike};function $1({showDropToDownload:n,showCreateAtlas:e,mergeMenuTitle:t}){const[r,i]=xe.useState(Qe.mergeOptions_atlas_std_size||6),[s,o]=xe.useState(Qe.mergeOptions_atlas_std_transp_size||6),[a,l]=xe.useState(Qe.mergeOptions_atlas_mtoon_size||6),[c,A]=xe.useState(Qe.mergeOptions_atlas_mtoon_transp_size||6),[u,f]=xe.useState(Qe.mergeOptions_sel_option||0),[h,d]=xe.useState(Qe.mergeOptions_two_sided_mat||!1),[m]=xe.useState(["Merge to Standard","Merge to MToon","Keep Both"]),[g,p]=xe.useState(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm),[v,w]=xe.useState(Qe.mergeOptions_download_vrm_preview==null?!0:Qe.mergeOptions_download_vrm_preview),[_,x]=xe.useState(Qe.mergeOptions_drop_download||!1),[b,B]=xe.useState(Qe.merge_options_ktx_compression||!1),[S,I]=xe.useState(Qe.mergeOptions_create_atlas==null?!0:Qe.mergeOptions_create_atlas),[M,P]=xe.useState(Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora),[D,T]=xe.useState(Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites),y=F=>{x(F.target.checked),Qe.mergeOptions_drop_download=F.target.checked},E=F=>{d(F.target.checked),Qe.mergeOptions_two_sided_mat=F.target.checked},R=F=>{B(F.target.checked),Qe.merge_options_ktx_compression=F.target.checked},L=F=>{I(F.target.checked),Qe.mergeOptions_create_atlas=F.target.checked},N=F=>{p(F.target.checked),Qe.mergeOptions_download_vrm=F.target.checked},z=F=>{w(F.target.checked),Qe.mergeOptions_download_vrm_preview=F.target.checked},W=F=>{P(F.target.checked),Qe.mergeOptions_download_lora=F.target.checked},H=F=>{T(F.target.checked),Qe.mergeOptions_download_sprites=F.target.checked},C=()=>{let F=u;u<=0?F=m.length-1:F-=1,f(F),Qe.mergeOptions_sel_option=F},K=()=>{let F=u;u>=m.length-1?F=0:F+=1,f(F),Qe.mergeOptions_sel_option=F},ee=async(F,re)=>{let ce=parseInt(F.target.value);ce>8?ce=8:ce<0&&(ce=0),(ge=>{switch(re){case"standard opaque":i(ge),Qe.mergeOptions_atlas_std_size=ge;break;case"standard transparent":o(ge),Qe.mergeOptions_atlas_std_transp_size=ge;break;case"mtoon opaque":l(ge),Qe.mergeOptions_atlas_mtoon_size=ge;break;case"mtoon transparent":A(ge),Qe.mergeOptions_atlas_mtoon_transp_size=ge;break}})(ce)};return Q.jsxs("div",{className:pt.InformationContainerPos,children:[Q.jsx(nl,{title:t,width:180,left:20}),Q.jsxs("div",{className:pt.scrollContainer,children:[Q.jsx("div",{className:pt.traitInfoTitle,children:"Download Options"}),Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:g,onChange:N}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Download VRM"]})})}),Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:v,onChange:z}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Download VRM Preview"]})})}),Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:M,onChange:W}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Download Lora Data"]})})}),Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:D,onChange:H}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Download Sprites Data"]})})}),g&&Q.jsxs(Q.Fragment,{children:[e&&Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:S,onChange:L}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Create Atlas"]})})}),(e==!1||S)&&Q.jsxs(Q.Fragment,{children:[Q.jsx("br",{}),Q.jsx("div",{className:pt.traitInfoTitle,children:"Merge Atlas Type"}),Q.jsx("br",{}),Q.jsxs("div",{className:pt.flexSelect,children:[Q.jsx("div",{className:`${pt["arrow-button"]} ${pt["left-button"]}`,onClick:C}),Q.jsx("div",{className:pt.traitInfoText,style:{marginBottom:"0"},children:m[u]}),Q.jsx("div",{className:`${pt["arrow-button"]} ${pt["right-button"]}`,onClick:K})]}),Q.jsx("br",{}),Q.jsx("br",{}),(u===0||u==2)&&Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:pt.traitInfoTitle,children:"Standard Atlas Size"}),Q.jsx("br",{}),Q.jsxs("div",{className:pt.traitInfoText,children:["Opaque: ",Dn(r)+" x "+Dn(r)]}),Q.jsx(Gh,{value:r,onChange:F=>ee(F,"standard opaque"),min:1,max:8,step:1}),Q.jsx("br",{}),Q.jsxs("div",{className:pt.traitInfoText,children:["Transparent: ",Dn(s)+" x "+Dn(s)]}),Q.jsx(Gh,{value:s,onChange:F=>ee(F,"standard transparent"),min:1,max:8,step:1}),Q.jsx("br",{})," ",Q.jsx("br",{})]}),(u===1||u==2)&&Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:pt.traitInfoTitle,children:"MToon Atlas Size"}),Q.jsx("br",{}),Q.jsxs("div",{className:pt.traitInfoText,children:["Opaque: ",Dn(a)+" x "+Dn(a)]}),Q.jsx(Gh,{value:a,onChange:F=>ee(F,"mtoon opaque"),min:1,max:8,step:1}),Q.jsx("br",{}),Q.jsxs("div",{className:pt.traitInfoText,children:["Transparent: ",Dn(c)+" x "+Dn(c)]}),Q.jsx(Gh,{value:c,onChange:F=>ee(F,"mtoon transparent"),min:1,max:8,step:1}),Q.jsx("br",{})," ",Q.jsx("br",{})]}),Q.jsx("div",{className:pt.traitInfoTitle,children:"Options"}),Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:h,onChange:E}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Two Sided Material"]})}),n&&Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:_,onChange:y}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"Drag Drop - Download"]})})}),Q.jsx(Q.Fragment,{children:Q.jsx("div",{className:pt.traitInfoText,children:Q.jsxs("div",{className:pt.checkboxHolder,children:[Q.jsx("div",{}),Q.jsxs("label",{className:pt["custom-checkbox"],children:[Q.jsx("input",{type:"checkbox",checked:b,onChange:R}),Q.jsx("div",{className:pt["checkbox-container"]})]}),Q.jsx("div",{}),Q.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}function Rke(){const{isLoading:n,setViewMode:e,setIsLoading:t}=q.useContext(As),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:c}=q.useContext(mr),[A,u]=xe.useState(null),[f,h]=xe.useState(""),[d,m]=q.useState(""),{playSound:g}=q.useContext(Mo),{isMute:p}=q.useContext(So),[v,w]=q.useState(null),_=()=>{!p&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(yt.LANDING)},x=()=>{const T=Qe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Dn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Dn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:T===0||T==2,exportMtoonAtlas:T===1||T==2,ktxCompression:Qe.merge_options_ktx_compression||!1,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},b=(T,y=!1)=>{console.log(y),(async()=>{await s.loadTraitsFromNFTObject(v[T]),(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm)&&await s.downloadVRM(v[T].name,x());const L=new ep,N=c.parent;N.remove(c);const z=Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora;if(z===!0){const H=r.loras.map(async C=>a.createLoraData(C,L));await Promise.all(H)}const W=Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites;if(W===!0){const H=r.sprites.map(async C=>l.createSpriteAtlas(C,L));await Promise.all(H)}(z===!0||W===!0)&&L.saveZip(v[T].name),N.add(c),T{t(!0),b(0,!0)},{t:S}=xe.useContext(la),I=async T=>{if(s.getCurrentCharacterModel()){const E=Kl(T.name),R=URL.createObjectURL(T);await o.loadAnimation(R,!1,0,!0,"",E),m(o.getCurrentAnimationName()),URL.revokeObjectURL(R)}else console.warn("Please load a vrm model to test animations.")},M=async T=>{const y=URL.createObjectURL(T);await s.loadOptimizerCharacter(y),URL.revokeObjectURL(y);const E=Kl(T.name);h(E),u(s.getCurrentCharacterModel())},P=T=>{const y=Array.from(T),E=[],R=L=>new Promise((N,z)=>{var W;if(L&&L.name.toLowerCase().endsWith(".json")){const H=new FileReader,C=`${(W=s.manifestData)==null?void 0:W.getAssetsDirectory()}/anata/_thumbnails/t_${L.name.split("_")[0]}.jpg`;H.onload=function(K){try{const ee=JSON.parse(K.target.result);ee.thumb=C,E.push(ee),N()}catch(ee){console.error("Error parsing the JSON file:",ee),z(ee)}},H.readAsText(L)}});Promise.all(y.map(R)).then(()=>{E.length>0&&(w(E),t(!0),s.loadTraitsFromNFTObject(E[0]).then(()=>{t(!1)}))}).catch(L=>{console.error("Error processing files:",L)})},D=async T=>{const y=T[0];console.log("anim"),y&&y.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),I(y)),y&&y.name.toLowerCase().endsWith(".vrm")&&M(y),y&&y.name.toLowerCase().endsWith(".json")&&P(T)};return Q.jsxs("div",{className:Oi.container,children:[Q.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:Q.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),Q.jsx("div",{className:"sectionTitle",children:"Batch Download"}),Q.jsx(S0,{onFilesDrop:D}),Q.jsx($1,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),Q.jsx(cU,{model:A}),Q.jsx(g2,{jsonSelectionArray:v}),Q.jsx(F1,{loadedAnimationName:d}),Q.jsxs("div",{className:Oi.buttonContainer,children:[Q.jsx(Un,{theme:"light",text:S("callToAction.back"),size:14,className:Oi.buttonLeft,onClick:_}),(v==null?void 0:v.length)==1&&Q.jsx(Un,{theme:"light",text:"Download",size:14,className:Oi.buttonRight,onClick:B}),(v==null?void 0:v.length)>1&&Q.jsx(Un,{theme:"light",text:"Download All",size:14,className:Oi.buttonRight,onClick:B})]})]})}const D0="abi/5.7.0",Qt=new _e(D0),ku={};let f4={calldata:!0,memory:!0,storage:!0},Uke={calldata:!0,memory:!0};function Wy(n,e){if(n==="bytes"||n==="string"){if(f4[e])return!0}else if(n==="address"){if(e==="payable")return!0}else if((n.indexOf("[")>=0||n==="tuple")&&Uke[e])return!0;return(f4[e]||e==="payable")&&Qt.throwArgumentError("invalid modifier","name",e),!1}function Fke(n,e){let t=n;function r(a){Qt.throwArgumentError(`unexpected character at position ${a}`,"param",n)}n=n.replace(/\s/g," ");function i(a){let l={type:"",name:"",parent:a,state:{allowType:!0}};return e&&(l.indexed=!1),l}let s={type:"",name:"",state:{allowType:!0}},o=s;for(let a=0;aJSON.parse(i.format(e)))),JSON.stringify(r)}let t="";return this.baseType==="array"?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==$t.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===$t.full?", ":",")+")"):t+=this.type,e!==$t.sighash&&(this.indexed===!0&&(t+=" indexed"),e===$t.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?Vr.fromString(e,t):Vr.fromObject(e)}static fromObject(e){return Vr.isParamType(e)?e:new Vr(ku,{name:e.name||null,type:hh(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(Vr.fromObject):null})}static fromString(e,t){function r(i){return Vr.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(Fke(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function e0(n,e){return Dke(n).map(t=>Vr.fromString(t,e))}class Gl{constructor(e,t){e!==ku&&Qt.throwError("use a static from method",_e.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),kw(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return Gl.isFragment(e)?e:typeof e=="string"?Gl.fromString(e):Gl.fromObject(e)}static fromObject(e){if(Gl.isFragment(e))return e;switch(e.type){case"function":return Pa.fromObject(e);case"event":return Nl.fromObject(e);case"constructor":return Fa.fromObject(e);case"error":return Gc.fromObject(e);case"fallback":case"receive":return null}return Qt.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?Nl.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?Pa.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?Fa.fromString(e.trim()):e.split(" ")[0]==="error"?Gc.fromString(e.substring(5).trim()):Qt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class Nl extends Gl{format(e){if(e||(e=$t.sighash),$t[e]||Qt.throwArgumentError("invalid format type","format",e),e===$t.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==$t.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===$t.full?", ":",")+") ",e!==$t.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?Nl.fromString(e):Nl.fromObject(e)}static fromObject(e){if(Nl.isEventFragment(e))return e;e.type!=="event"&&Qt.throwArgumentError("invalid event object","value",e);const t={name:t0(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Vr.fromObject):[],type:"event"};return new Nl(ku,t)}static fromString(e){let t=e.match(n0);t||Qt.throwArgumentError("invalid event string","value",e);let r=!1;return t[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":r=!0;break;case"":break;default:Qt.warn("unknown modifier: "+i)}}),Nl.fromObject({name:t[1].trim(),anonymous:r,inputs:e0(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function Oj(n,e){e.gas=null;let t=n.split("@");return t.length!==1?(t.length>2&&Qt.throwArgumentError("invalid human-readable ABI signature","value",n),t[1].match(/^[0-9]+$/)||Qt.throwArgumentError("invalid human-readable ABI signature gas","value",n),e.gas=Ve.from(t[1]),t[0]):n}function kj(n,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",n.split(" ").forEach(t=>{switch(t.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+t)}})}function Hj(n){let e={constant:!1,payable:!0,stateMutability:"payable"};return n.stateMutability!=null?(e.stateMutability=n.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",n.constant!=null&&!!n.constant!==e.constant&&Qt.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",n),e.payable=e.stateMutability==="payable",n.payable!=null&&!!n.payable!==e.payable&&Qt.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",n)):n.payable!=null?(e.payable=!!n.payable,n.constant==null&&!e.payable&&n.type!=="constructor"&&Qt.throwArgumentError("unable to determine stateMutability","value",n),e.constant=!!n.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Qt.throwArgumentError("cannot have constant payable function","value",n)):n.constant!=null?(e.constant=!!n.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):n.type!=="constructor"&&Qt.throwArgumentError("unable to determine stateMutability","value",n),e}class Fa extends Gl{format(e){if(e||(e=$t.sighash),$t[e]||Qt.throwArgumentError("invalid format type","format",e),e===$t.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});e===$t.sighash&&Qt.throwError("cannot format a constructor for sighash",_e.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===$t.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?Fa.fromString(e):Fa.fromObject(e)}static fromObject(e){if(Fa.isConstructorFragment(e))return e;e.type!=="constructor"&&Qt.throwArgumentError("invalid constructor object","value",e);let t=Hj(e);t.constant&&Qt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Vr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ve.from(e.gas):null};return new Fa(ku,r)}static fromString(e){let t={type:"constructor"};e=Oj(e,t);let r=e.match(n0);return(!r||r[1].trim()!=="constructor")&&Qt.throwArgumentError("invalid constructor string","value",e),t.inputs=e0(r[2].trim(),!1),kj(r[3].trim(),t),Fa.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class Pa extends Fa{format(e){if(e||(e=$t.sighash),$t[e]||Qt.throwArgumentError("invalid format type","format",e),e===$t.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(r=>JSON.parse(r.format(e))),outputs:this.outputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==$t.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===$t.full?", ":",")+") ",e!==$t.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map(r=>r.format(e)).join(", ")+") "),this.gas!=null&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return typeof e=="string"?Pa.fromString(e):Pa.fromObject(e)}static fromObject(e){if(Pa.isFunctionFragment(e))return e;e.type!=="function"&&Qt.throwArgumentError("invalid function object","value",e);let t=Hj(e);const r={type:e.type,name:t0(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(Vr.fromObject):[],outputs:e.outputs?e.outputs.map(Vr.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ve.from(e.gas):null};return new Pa(ku,r)}static fromString(e){let t={type:"function"};e=Oj(e,t);let r=e.split(" returns ");r.length>2&&Qt.throwArgumentError("invalid function string","value",e);let i=r[0].match(n0);if(i||Qt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&t0(t.name),t.inputs=e0(i[2],!1),kj(i[3].trim(),t),r.length>1){let s=r[1].match(n0);(s[1].trim()!=""||s[3].trim()!="")&&Qt.throwArgumentError("unexpected tokens","value",e),t.outputs=e0(s[2],!1)}else t.outputs=[];return Pa.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function h4(n){const e=n.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Qt.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",n),n}class Gc extends Gl{format(e){if(e||(e=$t.sighash),$t[e]||Qt.throwArgumentError("invalid format type","format",e),e===$t.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==$t.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===$t.full?", ":",")+") ",t.trim()}static from(e){return typeof e=="string"?Gc.fromString(e):Gc.fromObject(e)}static fromObject(e){if(Gc.isErrorFragment(e))return e;e.type!=="error"&&Qt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:t0(e.name),inputs:e.inputs?e.inputs.map(Vr.fromObject):[]};return h4(new Gc(ku,t))}static fromString(e){let t={type:"error"},r=e.match(n0);return r||Qt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&t0(t.name),t.inputs=e0(r[2],!1),h4(Gc.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function hh(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const Lke=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function t0(n){return(!n||!n.match(Lke))&&Qt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const n0=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Dke(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&AU.throwError("value out-of-bounds",_e.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Ss([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class wx{constructor(e,t,r,i){Pe(this,"_data",ft(e)),Pe(this,"wordSize",t||32),Pe(this,"_coerceFunc",r),Pe(this,"allowLoose",i),this._offset=0}get data(){return at(this._data)}get consumed(){return this._offset}static coerce(e,t){let r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):wx.coerce(e,t)}_peekBytes(e,t,r){let i=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?i=t:AU.throwError("data out-of-bounds",_e.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new wx(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}readValue(){return Ve.from(this.readBytes(this.wordSize))}}class Oke extends dc{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=ai(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return ai(rr(e.readValue().toHexString(),20))}}class kke extends dc{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const Vh=new _e(D0);function Qj(n,e,t){let r=null;if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(c=>{const A=c.localName;return A||Vh.throwError("cannot encode object for signature with missing names",_e.errors.INVALID_ARGUMENT,{argument:"values",coder:c,value:t}),l[A]&&Vh.throwError("cannot encode object for signature with duplicate names",_e.errors.INVALID_ARGUMENT,{argument:"values",coder:c,value:t}),l[A]=!0,t[A]})}else Vh.throwArgumentError("invalid tuple value","tuple",t);e.length!==r.length&&Vh.throwArgumentError("types/value length mismatch","tuple",t);let i=new VT(n.wordSize),s=new VT(n.wordSize),o=[];e.forEach((l,c)=>{let A=r[c];if(l.dynamic){let u=s.length;l.encode(s,A);let f=i.writeUpdatableValue();o.push(h=>{f(h+u)})}else l.encode(i,A)}),o.forEach(l=>{l(i.length)});let a=n.appendWriter(i);return a+=n.appendWriter(s),a}function zj(n,e){let t=[],r=n.subReader(0);e.forEach(s=>{let o=null;if(s.dynamic){let a=n.readValue(),l=r.subReader(a.toNumber());try{o=s.decode(l)}catch(c){if(c.code===_e.errors.BUFFER_OVERRUN)throw c;o=c,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(a){if(a.code===_e.errors.BUFFER_OVERRUN)throw a;o=a,o.baseType=s.name,o.name=s.localName,o.type=s.type}o!=null&&t.push(o)});const i=e.reduce((s,o)=>{const a=o.localName;return a&&(s[a]||(s[a]=0),s[a]++),s},{});e.forEach((s,o)=>{let a=s.localName;if(!a||i[a]!==1||(a==="length"&&(a="_length"),t[a]!=null))return;const l=t[o];l instanceof Error?Object.defineProperty(t,a,{enumerable:!0,get:()=>{throw l}}):t[a]=l});for(let s=0;s{throw o}})}return Object.freeze(t)}class Hke extends dc{constructor(e,t,r){const i=e.type+"["+(t>=0?t:"")+"]",s=t===-1||e.dynamic;super("array",i,r,s),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let r=0;re._data.length&&Vh.throwError("insufficient data length",_e.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let r=[];for(let i=0;i{o.dynamic&&(r=!0),i.push(o.type)});const s="tuple("+i.join(",")+")";super("tuple",s,t,r),this.coders=e}defaultValue(){const e=[];this.coders.forEach(r=>{e.push(r.defaultValue())});const t=this.coders.reduce((r,i)=>{const s=i.localName;return s&&(r[s]||(r[s]=0),r[s]++),r},{});return this.coders.forEach((r,i)=>{let s=r.localName;!s||t[s]!==1||(s==="length"&&(s="_length"),e[s]==null&&(e[s]=e[i]))}),Object.freeze(e)}encode(e,t){return Qj(e,this.coders,t)}decode(e){return e.coerce(this.name,zj(e,this.coders))}}const Xy=new _e(D0),Kke=new RegExp(/^bytes([0-9]*)$/),Xke=new RegExp(/^(u?int)([0-9]*)$/);class Yke{constructor(e){Pe(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new Oke(e.name);case"bool":return new Qke(e.name);case"string":return new Wke(e.name);case"bytes":return new zke(e.name);case"array":return new Hke(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Ky((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new Vke(e.name)}let t=e.type.match(Xke);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&Xy.throwArgumentError("invalid "+t[1]+" bit length","param",e),new jke(r/8,t[1]==="int",e.name)}if(t=e.type.match(Kke),t){let r=parseInt(t[1]);return(r===0||r>32)&&Xy.throwArgumentError("invalid bytes length","param",e),new Gke(r,e.name)}return Xy.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new wx(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new VT(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(Vr.from(i)));return new Ky(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Xy.throwError("types/values length mismatch",_e.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(Vr.from(o))),i=new Ky(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(Vr.from(o)));return new Ky(i,"_").decode(this._getReader(ft(t),r))}}const $ke=new Yke,zn=new _e(D0);class Zke extends o0{}class qke extends o0{}class Jke extends o0{}class jT extends o0{static isIndexed(e){return!!(e&&e._isIndexed)}}const e4e={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function d4(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class p4{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Pe(this,"fragments",t.map(r=>Gl.from(r)).filter(r=>r!=null)),Pe(this,"_abiCoder",Ms(new.target,"getAbiCoder")()),Pe(this,"functions",{}),Pe(this,"errors",{}),Pe(this,"events",{}),Pe(this,"structs",{}),this.fragments.forEach(r=>{let i=null;switch(r.type){case"constructor":if(this.deploy){zn.warn("duplicate definition - constructor");return}Pe(this,"deploy",r);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let s=r.format();if(i[s]){zn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Pe(this,"deploy",Fa.from({payable:!1,type:"constructor"})),Pe(this,"_isInterface",!0)}format(e){e||(e=$t.full),e===$t.sighash&&zn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===$t.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return $ke}static getAddress(e){return ai(e)}static getSighash(e){return mi(dh(e.format()),0,4)}static getEventTopic(e){return dh(e.format())}getFunction(e){if(Tt(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];zn.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.functions).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching function","name",r):i.length>1&&zn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[Pa.fromString(e).format()];return t||zn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(Tt(e)){const r=e.toLowerCase();for(const i in this.events)if(r===this.getEventTopic(i))return this.events[i];zn.throwArgumentError("no matching event","topichash",r)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.events).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching event","name",r):i.length>1&&zn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[Nl.fromString(e).format()];return t||zn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Tt(e)){const r=Ms(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}zn.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const r=e.trim(),i=Object.keys(this.errors).filter(s=>s.split("(")[0]===r);return i.length===0?zn.throwArgumentError("no matching error","name",r):i.length>1&&zn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[Pa.fromString(e).format()];return t||zn.throwArgumentError("no matching error","signature",e),t}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch{throw t}}return Ms(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),Ms(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){typeof e=="string"&&(e=this.getError(e));const r=ft(t);return at(r.slice(0,4))!==this.getSighash(e)&&zn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",at(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return typeof e=="string"&&(e=this.getError(e)),at(Ss([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){typeof e=="string"&&(e=this.getFunction(e));const r=ft(t);return at(r.slice(0,4))!==this.getSighash(e)&&zn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",at(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return typeof e=="string"&&(e=this.getFunction(e)),at(Ss([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){typeof e=="string"&&(e=this.getFunction(e));let r=ft(t),i=null,s="",o=null,a=null,l=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch{}break;case 4:{const c=at(r.slice(0,4)),A=e4e[c];if(A)o=this._abiCoder.decode(A.inputs,r.slice(4)),a=A.name,l=A.signature,A.reason&&(i=o[0]),a==="Error"?s=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:a==="Panic"&&(s=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const u=this.getError(c);o=this._abiCoder.decode(u.inputs,r.slice(4)),a=u.name,l=u.format()}catch{}break}}return zn.throwError("call revert exception"+s,_e.errors.CALL_EXCEPTION,{method:e.format(),data:at(t),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,t){return typeof e=="string"&&(e=this.getFunction(e)),at(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){typeof e=="string"&&(e=this.getEvent(e)),t.length>e.inputs.length&&zn.throwError("too many arguments for "+e.format(),_e.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?dh(o):s.type==="bytes"?Er(at(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=Ve.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),rr(at(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&zn.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,s);return}s==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?zn.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,s):Array.isArray(s)?r.push(s.map(l=>i(a,l))):r.push(i(a,s))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,t){typeof e=="string"&&(e=this.getEvent(e));const r=[],i=[],s=[];return e.anonymous||r.push(this.getEventTopic(e)),t.length!==e.inputs.length&&zn.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((o,a)=>{const l=t[a];if(o.indexed)if(o.type==="string")r.push(dh(l));else if(o.type==="bytes")r.push(Er(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(this._abiCoder.encode([o.type],[l]))}else i.push(o),s.push(l)}),{data:this._abiCoder.encode(i,s),topics:r}}decodeEventLog(e,t,r){if(typeof e=="string"&&(e=this.getEvent(e)),r!=null&&!e.anonymous){let f=this.getEventTopic(e);(!Tt(r[0],32)||r[0].toLowerCase()!==f)&&zn.throwError("fragment/topic mismatch",_e.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:f,value:r[0]}),r=r.slice(1)}let i=[],s=[],o=[];e.inputs.forEach((f,h)=>{f.indexed?f.type==="string"||f.type==="bytes"||f.baseType==="tuple"||f.baseType==="array"?(i.push(Vr.fromObject({type:"bytes32",name:f.name})),o.push(!0)):(i.push(f),o.push(!1)):(s.push(f),o.push(!1))});let a=r!=null?this._abiCoder.decode(i,Ss(r)):null,l=this._abiCoder.decode(s,t,!0),c=[],A=0,u=0;e.inputs.forEach((f,h)=>{if(f.indexed)if(a==null)c[h]=new jT({_isIndexed:!0,hash:null});else if(o[h])c[h]=new jT({_isIndexed:!0,hash:a[u++]});else try{c[h]=a[u++]}catch(d){c[h]=d}else try{c[h]=l[A++]}catch(d){c[h]=d}if(f.name&&c[f.name]==null){const d=c[h];d instanceof Error?Object.defineProperty(c,f.name,{enumerable:!0,get:()=>{throw d4(`property ${JSON.stringify(f.name)}`,d)}}):c[f.name]=d}});for(let f=0;f{throw d4(`index ${f}`,h)}})}return Object.freeze(c)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new qke({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:Ve.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new Zke({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=at(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new Jke({args:this._abiCoder.decode(r.inputs,"0x"+t.substring(10)),errorFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const t4e="contracts/5.7.0";var Hu=globalThis&&globalThis.__awaiter||function(n,e,t,r){function i(s){return s instanceof t?s:new t(function(o){o(s)})}return new(t||(t=Promise))(function(s,o){function a(A){try{c(r.next(A))}catch(u){o(u)}}function l(A){try{c(r.throw(A))}catch(u){o(u)}}function c(A){A.done?s(A.value):i(A.value).then(a,l)}c((r=r.apply(n,e||[])).next())})};const ur=new _e(t4e);function _x(n,e){return Hu(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&ur.throwArgumentError("invalid address or ENS name","name",t);try{return ai(t)}catch{}n||ur.throwError("a provider or signer is needed to resolve ENS names",_e.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&ur.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function Hw(n,e,t){return Hu(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>Hw(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield _x(n,e):t.type==="tuple"?yield Hw(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>Hw(n,r,t.arrayChildren))):Promise.reject(ur.makeError("invalid value for array",_e.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function Z1(n,e,t){return Hu(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=kn(t.pop())),ur.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=wr({override:_x(n.signer,r.from),signer:n.signer.getAddress()}).then(c=>Hu(this,void 0,void 0,function*(){return ai(c.signer)!==c.override&&ur.throwError("Contract with a Signer cannot override from",_e.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),c.override})):r.from=n.signer.getAddress():r.from&&(r.from=_x(n.provider,r.from));const i=yield wr({args:Hw(n.signer||n.provider,t,e.inputs),address:n.resolvedAddress,overrides:wr(r)||{}}),s=n.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=Ve.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=Ve.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=Ve.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=Ve.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=Ve.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=Gu(a.accessList)),o.gasLimit==null&&e.gas!=null){let c=21e3;const A=ft(s);for(let u=0;ur[c]!=null);return l.length&&ur.throwError(`cannot override ${l.map(c=>JSON.stringify(c)).join(",")}`,_e.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function n4e(n,e){return function(...t){return Z1(n,e,t)}}function r4e(n,e){const t=n.signer||n.provider;return function(...r){return Hu(this,void 0,void 0,function*(){t||ur.throwError("estimate require a provider or signer",_e.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Z1(n,e,r);return yield t.estimateGas(i)})}}function i4e(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=Fs(s),a=null;try{a=n.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,c)=>n.interface.decodeEventLog(a.eventFragment,l,c),o.event=a.name,o.eventSignature=a.signature),o.removeListener=()=>n.provider,o.getBlock=()=>n.provider.getBlock(i.blockHash),o.getTransaction=()=>n.provider.getTransaction(i.transactionHash),o.getTransactionReceipt=()=>Promise.resolve(i),o}),i))}function Vj(n,e,t){const r=n.signer||n.provider;return function(...i){return Hu(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=kn(i.pop());l.blockTag!=null&&(s=yield l.blockTag),delete l.blockTag,i.push(l)}n.deployTransaction!=null&&(yield n._deployed(s));const o=yield Z1(n,e,i),a=yield r.call(o,s);try{let l=n.interface.decodeFunctionResult(e,a);return t&&e.outputs.length===1&&(l=l[0]),l}catch(l){throw l.code===_e.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function s4e(n,e){return function(...t){return Hu(this,void 0,void 0,function*(){n.signer||ur.throwError("sending a transaction requires a signer",_e.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield Z1(n,e,t),i=yield n.signer.sendTransaction(r);return i4e(n,i),i})}}function m4(n,e,t){return e.constant?Vj(n,e,t):s4e(n,e)}function jj(n){return n.address&&(n.topics==null||n.topics.length===0)?"*":(n.address||"*")+"@"+(n.topics?n.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class r0{constructor(e,t){Pe(this,"tag",e),Pe(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter(r=>t||r.listener!==e?!0:(t=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter(r=>{const i=e.slice();return setTimeout(()=>{r.listener.apply(this,i)},0),!r.once}),t}prepareEvent(e){}getEmit(e){return[e]}}class o4e extends r0{constructor(){super("error",null)}}class g4 extends r0{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&ur.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(jj(s),s),Pe(this,"address",e),Pe(this,"interface",t),Pe(this,"fragment",r)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(t,r)=>this.interface.decodeEventLog(this.fragment,t,r);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=Nke(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class v4 extends r0{constructor(e,t){super("*",{address:e}),Pe(this,"address",e),Pe(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(r,i)=>this.interface.decodeEventLog(t.eventFragment,r,i),e.args=t.args}catch{}}}class a4e{constructor(e,t,r){Pe(this,"interface",Ms(new.target,"getInterface")(t)),r==null?(Pe(this,"provider",null),Pe(this,"signer",null)):A0.isSigner(r)?(Pe(this,"provider",r.provider||null),Pe(this,"signer",r)):a0.isProvider(r)?(Pe(this,"provider",r),Pe(this,"signer",null)):ur.throwArgumentError("invalid signer or provider","signerOrProvider",r),Pe(this,"callStatic",{}),Pe(this,"estimateGas",{}),Pe(this,"functions",{}),Pe(this,"populateTransaction",{}),Pe(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];Pe(this.filters,a,(...c)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,c)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?Pe(this.filters,a,this.filters[l[0]]):ur.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Pe(this,"_runningEvents",{}),Pe(this,"_wrappedEmits",{}),e==null&&ur.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Pe(this,"address",e),this.provider)Pe(this,"resolvedAddress",_x(this.provider,e));else try{Pe(this,"resolvedAddress",Promise.resolve(ai(e)))}catch{ur.throwError("provider is required to use ENS name as contract address",_e.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(o=>{});const i={},s={};Object.keys(this.interface.functions).forEach(o=>{const a=this.interface.functions[o];if(s[o]){ur.warn(`Duplicate ABI entry for ${JSON.stringify(o)}`);return}s[o]=!0;{const l=a.name;i[`%${l}`]||(i[`%${l}`]=[]),i[`%${l}`].push(o)}this[o]==null&&Pe(this,o,m4(this,a,!0)),this.functions[o]==null&&Pe(this.functions,o,m4(this,a,!1)),this.callStatic[o]==null&&Pe(this.callStatic,o,Vj(this,a,!0)),this.populateTransaction[o]==null&&Pe(this.populateTransaction,o,n4e(this,a)),this.estimateGas[o]==null&&Pe(this.estimateGas,o,r4e(this,a))}),Object.keys(i).forEach(o=>{const a=i[o];if(a.length>1)return;o=o.substring(1);const l=a[0];try{this[o]==null&&Pe(this,o,this[l])}catch{}this.functions[o]==null&&Pe(this.functions,o,this.functions[l]),this.callStatic[o]==null&&Pe(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&Pe(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&Pe(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return pH(e)}static getInterface(e){return p4.isInterface(e)?e:new p4(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(t=>(t==="0x"&&ur.throwError("contract not deployed",_e.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||ur.throwError("sending a transactions require a signer",_e.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=kn(e||{});return["from","to"].forEach(function(r){t[r]!=null&&ur.throwError("cannot override "+r,_e.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new dI(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&Pe(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return jT.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new o4e);if(e==="event")return this._normalizeRunningEvent(new r0("event",null));if(e==="*")return this._normalizeRunningEvent(new v4(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new g4(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const r=e.topics[0];if(typeof r!="string")throw new Error("invalid topic");const i=this.interface.getEvent(r);return this._normalizeRunningEvent(new g4(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new r0(jj(t),t))}return this._normalizeRunningEvent(new v4(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,r){const i=Fs(t);return i.removeListener=()=>{r&&(e.removeListener(r),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(t.blockHash),i.getTransaction=()=>this.provider.getTransaction(t.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(i),i}_addEventListener(e,t,r){if(this.provider||ur.throwError("events require a provider or a signer with a provider",_e.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,r),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=s=>{let o=this._wrapEvent(e,s,t);if(o.decodeError==null)try{const a=e.getEmit(o);this.emit(e.filter,...a)}catch(a){o.decodeError=a.error}e.filter!=null&&this.emit("event",o),o.decodeError!=null&&this.emit("error",o.decodeError,o)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,t,r){const i=this._getRunningEvent(e),s=kn(i.filter);return typeof t=="string"&&Tt(t,32)?(r!=null&&ur.throwArgumentError("cannot specify toBlock with blockhash","toBlock",r),s.blockHash=t):(s.fromBlock=t??0,s.toBlock=r??"latest"),this.provider.getLogs(s).then(o=>o.map(a=>this._wrapEvent(i,a,null)))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const r=this._getRunningEvent(e),i=r.run(t)>0;return this._checkRunningEvents(r),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((t,r)=>t+this._runningEvents[r].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const t=[];for(let r in this._runningEvents)this._runningEvents[r].listeners().forEach(i=>{t.push(i)});return t}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const r in this._runningEvents){const i=this._runningEvents[r];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const r=this._getRunningEvent(e);return r.removeListener(t),this._checkRunningEvents(r),this}removeListener(e,t){return this.off(e,t)}}class q1 extends a4e{}const l4e="0x543D43F390b7d681513045e8a85707438c463d80",xx={owner:"0x634B0510C5062CFf8009eAAc2435eB93bc4764ad",address:"0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",abi:[{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"uint256",name:"index",type:"uint256"}],name:"tokenOfOwnerByIndex",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"tokenPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"numberOfTokens",type:"uint256"},{internalType:"string",name:"_tokenURI",type:"string"}],name:"mintToken",outputs:[],stateMutability:"payable",type:"function"}]},y4={address:"0x0000000000000aF8FE6E4DE40F4804C90fA8Ea8F",abi:[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AddressMismatch",type:"error"},{inputs:[],name:"AlreadyProxied",type:"error"},{inputs:[],name:"ColdAddressCannotBeTheSameAsHot",type:"error"},{inputs:[],name:"ColdIsAddressZero",type:"error"},{inputs:[],name:"ColdWalletCannotInteractUseHot",type:"error"},{inputs:[],name:"DeliveryCannotBeTheZeroAddress",type:"error"},{inputs:[],name:"DeliveryIsAddressZero",type:"error"},{inputs:[],name:"EthWithdrawFailed",type:"error"},{inputs:[],name:"IncorrectProxyRegisterFee",type:"error"},{inputs:[],name:"MigrationIsAllowedOnceOnly",type:"error"},{inputs:[],name:"NoPaymentPendingForAddress",type:"error"},{inputs:[],name:"NoRecordFoundForAddress",type:"error"},{inputs:[],name:"OnlyHotAddressCanChangeAddress",type:"error"},{inputs:[],name:"ProxyRegisterFeeRequired",type:"error"},{inputs:[],name:"RegisterAddressLocked",type:"error"},{inputs:[],name:"RewardRateIsLocked",type:"error"},{inputs:[],name:"UnknownAmount",type:"error"},{inputs:[],name:"UnrecognisedEPSAPIAmount",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!0,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"address",name:"oldDelivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"DeliveryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"ensReverseRegistrarAddress",type:"address"}],name:"ENSReverseRegistrarSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"erc20",type:"address"},{indexed:!1,internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"ERC20FeeUpdated",type:"event"},{anonymous:!1,inputs:[],name:"MigrationComplete",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"NominationAccepted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"NominationMade",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"address",name:"delivery",type:"address"},{indexed:!0,internalType:"uint64",name:"provider",type:"uint64"}],name:"ProxyRecordLive",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"enum IEPSProxyRegister.Participant",name:"initiator",type:"uint8"},{indexed:!0,internalType:"address",name:"hot",type:"address"},{indexed:!0,internalType:"address",name:"cold",type:"address"},{indexed:!1,internalType:"uint256",name:"provider",type:"uint256"}],name:"RecordDeleted",type:"event"},{anonymous:!1,inputs:[],name:"RewardRateLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint96",name:"rewardRate",type:"uint96"}],name:"RewardRateUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"newToken",type:"address"}],name:"RewardTokenUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"acceptNomination",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"activeEthAddresses",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"bool",name:"checkingHot_",type:"bool"}],name:"addressIsAvailable",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"beneficiaryBalance",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"id_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf1155",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"},{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryBalanceOf20",outputs:[{internalType:"uint256",name:"balance_",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"tokenContract_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"beneficiaryOf",outputs:[{internalType:"address",name:"beneficiary_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"coldIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"coldToHot",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"uint256",name:"provider_",type:"uint256"}],name:"deleteRecord",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"deletionNominalEth",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"ensReverseRegistrar",outputs:[{internalType:"contract ENSReverseRegistrar",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"epsAPIBalance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegister",outputs:[{internalType:"contract IERC1155DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc1155DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegister",outputs:[{internalType:"contract IERC20DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc20DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"erc20PerTransactionFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegister",outputs:[{internalType:"contract IERC721DelegateRegister",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc721DelegationRegisterAddressLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses1155",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses20",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAddresses721",outputs:[{internalType:"address[]",name:"proxyAddresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"receivedAddress_",type:"address"},{internalType:"uint256",name:"rightsIndex_",type:"uint256"}],name:"getAllAddresses",outputs:[{internalType:"address[]",name:"erc721Addresses_",type:"address[]"},{internalType:"address[]",name:"erc1155Addresses_",type:"address[]"},{internalType:"address[]",name:"erc20Addresses_",type:"address[]"},{internalType:"address",name:"delivery_",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_receivedAddress",type:"address"}],name:"getColdAndDeliveryAddresses",outputs:[{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"bool",name:"isProxied",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"queryAddress_",type:"address"}],name:"getProxyRecordForAddress",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"}],name:"getProxyRecordForCold",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"getProxyRecordForHot",outputs:[{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"},{internalType:"bool",name:"feePaid",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsActiveOnRegister",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"}],name:"hotIsLive",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"hotToRecord",outputs:[{internalType:"uint64",name:"provider",type:"uint64"},{internalType:"enum IEPSProxyRegister.ProxyStatus",name:"status",type:"uint8"},{internalType:"bool",name:"feePaid",type:"bool"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"hot_",type:"address"},{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"}],name:"isValidAddresses",outputs:[],stateMutability:"pure",type:"function"},{inputs:[],name:"lockERC1155DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC20DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockERC721DelegationRegisterAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"lockRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"hot",type:"address"},{internalType:"address",name:"cold",type:"address"},{internalType:"address",name:"delivery",type:"address"}],internalType:"struct EPSRegister.MigratedRecord[]",name:"migratedRecords_",type:"tuple[]"}],name:"migration",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"migrationComplete",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"cold_",type:"address"},{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint64",name:"provider_",type:"uint64"}],name:"nominate",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"sender_",type:"address"},{internalType:"uint256",name:"erc20Value_",type:"uint256"},{internalType:"bytes",name:"data_",type:"bytes"}],name:"onTokenTransfer",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxyRegisterFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC1155",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC1155",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"rescueERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC721",name:"token_",type:"address"},{internalType:"uint256",name:"tokenId_",type:"uint256"}],name:"rescueERC721",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rewardRate",outputs:[{internalType:"uint88",name:"",type:"uint88"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardRateLocked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"rewardToken",outputs:[{internalType:"contract IOAT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"deleteNominalEth_",type:"uint256"}],name:"setDeletionNominalEth",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"ensName_",type:"string"}],name:"setENSName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"ensReverseRegistrar_",type:"address"}],name:"setENSReverseRegistrar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc1155DelegationRegister_",type:"address"}],name:"setERC1155DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20DelegationRegister_",type:"address"}],name:"setERC20DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc20_",type:"address"},{internalType:"uint256",name:"erc20Fee_",type:"uint256"}],name:"setERC20Fee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"erc721DelegationRegister_",type:"address"}],name:"setERC721DelegationRegister",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"count_",type:"uint256"},{internalType:"uint256",name:"air_",type:"uint256"}],name:"setNNumberOfEthAddressesAndAirdropAmount",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"registerFee_",type:"uint256"}],name:"setRegisterFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint88",name:"rewardRate_",type:"uint88"}],name:"setRewardRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"rewardToken_",type:"address"}],name:"setRewardToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"treasuryAddress_",type:"address"}],name:"setTreasuryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"pure",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"delivery_",type:"address"},{internalType:"uint256",name:"provider_",type:"uint256"}],name:"updateDeliveryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"contract IERC20",name:"token_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawERC20",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount_",type:"uint256"}],name:"withdrawETH",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}]};function Wj(n,e){return function(){return n.apply(e,arguments)}}const{toString:c4e}=Object.prototype,{getPrototypeOf:uU}=Object,J1=(n=>e=>{const t=c4e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),ua=n=>(n=n.toLowerCase(),e=>J1(e)===n),eb=n=>e=>typeof e===n,{isArray:up}=Array,i0=eb("undefined");function A4e(n){return n!==null&&!i0(n)&&n.constructor!==null&&!i0(n.constructor)&&Ns(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Kj=ua("ArrayBuffer");function u4e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Kj(n.buffer),e}const f4e=eb("string"),Ns=eb("function"),Xj=eb("number"),tb=n=>n!==null&&typeof n=="object",h4e=n=>n===!0||n===!1,Qw=n=>{if(J1(n)!=="object")return!1;const e=uU(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},d4e=ua("Date"),p4e=ua("File"),m4e=ua("Blob"),g4e=ua("FileList"),v4e=n=>tb(n)&&Ns(n.pipe),y4e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Ns(n.append)&&((e=J1(n))==="formdata"||e==="object"&&Ns(n.toString)&&n.toString()==="[object FormData]"))},w4e=ua("URLSearchParams"),[_4e,x4e,b4e,E4e]=["ReadableStream","Request","Response","Headers"].map(ua),B4e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function N0(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),up(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const du=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),$j=n=>!i0(n)&&n!==du;function WT(){const{caseless:n}=$j(this)&&this||{},e={},t=(r,i)=>{const s=n&&Yj(e,i)||i;Qw(e[s])&&Qw(r)?e[s]=WT(e[s],r):Qw(r)?e[s]=WT({},r):up(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(N0(e,(i,s)=>{t&&Ns(i)?n[s]=Wj(i,t):n[s]=i},{allOwnKeys:r}),n),M4e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),C4e=(n,e,t,r)=>{n.prototype=Object.create(e.prototype,r),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},T4e=(n,e,t,r)=>{let i,s,o;const a={};if(e=e||{},n==null)return e;do{for(i=Object.getOwnPropertyNames(n),s=i.length;s-- >0;)o=i[s],(!r||r(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&uU(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},I4e=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const r=n.indexOf(e,t);return r!==-1&&r===t},R4e=n=>{if(!n)return null;if(up(n))return n;let e=n.length;if(!Xj(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},U4e=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&uU(Uint8Array)),F4e=(n,e)=>{const r=(n&&n[Symbol.iterator]).call(n);let i;for(;(i=r.next())&&!i.done;){const s=i.value;e.call(n,s[0],s[1])}},P4e=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},L4e=ua("HTMLFormElement"),D4e=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),w4=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),N4e=ua("RegExp"),Zj=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};N0(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},O4e=n=>{Zj(n,(e,t)=>{if(Ns(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Ns(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},k4e=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return up(n)?r(n):r(String(n).split(e)),t},H4e=()=>{},Q4e=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e,vS="abcdefghijklmnopqrstuvwxyz",_4="0123456789",qj={DIGIT:_4,ALPHA:vS,ALPHA_DIGIT:vS+vS.toUpperCase()+_4},z4e=(n=16,e=qj.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function G4e(n){return!!(n&&Ns(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const V4e=n=>{const e=new Array(10),t=(r,i)=>{if(tb(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=up(r)?[]:{};return N0(r,(o,a)=>{const l=t(o,i+1);!i0(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},j4e=ua("AsyncFunction"),W4e=n=>n&&(tb(n)||Ns(n))&&Ns(n.then)&&Ns(n.catch),Jj=((n,e)=>n?setImmediate:e?((t,r)=>(du.addEventListener("message",({source:i,data:s})=>{i===du&&s===t&&r.length&&r.shift()()},!1),i=>{r.push(i),du.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",Ns(du.postMessage)),K4e=typeof queueMicrotask<"u"?queueMicrotask.bind(du):typeof process<"u"&&process.nextTick||Jj,Te={isArray:up,isArrayBuffer:Kj,isBuffer:A4e,isFormData:y4e,isArrayBufferView:u4e,isString:f4e,isNumber:Xj,isBoolean:h4e,isObject:tb,isPlainObject:Qw,isReadableStream:_4e,isRequest:x4e,isResponse:b4e,isHeaders:E4e,isUndefined:i0,isDate:d4e,isFile:p4e,isBlob:m4e,isRegExp:N4e,isFunction:Ns,isStream:v4e,isURLSearchParams:w4e,isTypedArray:U4e,isFileList:g4e,forEach:N0,merge:WT,extend:S4e,trim:B4e,stripBOM:M4e,inherits:C4e,toFlatObject:T4e,kindOf:J1,kindOfTest:ua,endsWith:I4e,toArray:R4e,forEachEntry:F4e,matchAll:P4e,isHTMLForm:L4e,hasOwnProperty:w4,hasOwnProp:w4,reduceDescriptors:Zj,freezeMethods:O4e,toObjectSet:k4e,toCamelCase:D4e,noop:H4e,toFiniteNumber:Q4e,findKey:Yj,global:du,isContextDefined:$j,ALPHABET:qj,generateString:z4e,isSpecCompliantForm:G4e,toJSONObject:V4e,isAsyncFn:j4e,isThenable:W4e,setImmediate:Jj,asap:K4e};function xt(n,e,t,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),r&&(this.request=r),i&&(this.response=i,this.status=i.status?i.status:null)}Te.inherits(xt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Te.toJSONObject(this.config),code:this.code,status:this.status}}});const eW=xt.prototype,tW={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{tW[n]={value:n}});Object.defineProperties(xt,tW);Object.defineProperty(eW,"isAxiosError",{value:!0});xt.from=(n,e,t,r,i,s)=>{const o=Object.create(eW);return Te.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),xt.call(o,n.message,e,t,r,i),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const X4e=null;function KT(n){return Te.isPlainObject(n)||Te.isArray(n)}function nW(n){return Te.endsWith(n,"[]")?n.slice(0,-2):n}function x4(n,e,t){return n?n.concat(e).map(function(i,s){return i=nW(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function Y4e(n){return Te.isArray(n)&&!n.some(KT)}const $4e=Te.toFlatObject(Te,{},null,function(e){return/^is[A-Z]/.test(e)});function nb(n,e,t){if(!Te.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Te.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,g){return!Te.isUndefined(g[m])});const r=t.metaTokens,i=t.visitor||A,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Te.isSpecCompliantForm(e);if(!Te.isFunction(i))throw new TypeError("visitor must be a function");function c(d){if(d===null)return"";if(Te.isDate(d))return d.toISOString();if(!l&&Te.isBlob(d))throw new xt("Blob is not supported. Use a Buffer instead.");return Te.isArrayBuffer(d)||Te.isTypedArray(d)?l&&typeof Blob=="function"?new Blob([d]):Buffer.from(d):d}function A(d,m,g){let p=d;if(d&&!g&&typeof d=="object"){if(Te.endsWith(m,"{}"))m=r?m:m.slice(0,-2),d=JSON.stringify(d);else if(Te.isArray(d)&&Y4e(d)||(Te.isFileList(d)||Te.endsWith(m,"[]"))&&(p=Te.toArray(d)))return m=nW(m),p.forEach(function(w,_){!(Te.isUndefined(w)||w===null)&&e.append(o===!0?x4([m],_,s):o===null?m:m+"[]",c(w))}),!1}return KT(d)?!0:(e.append(x4(g,m,s),c(d)),!1)}const u=[],f=Object.assign($4e,{defaultVisitor:A,convertValue:c,isVisitable:KT});function h(d,m){if(!Te.isUndefined(d)){if(u.indexOf(d)!==-1)throw Error("Circular reference detected in "+m.join("."));u.push(d),Te.forEach(d,function(p,v){(!(Te.isUndefined(p)||p===null)&&i.call(e,p,Te.isString(v)?v.trim():v,m,f))===!0&&h(p,m?m.concat(v):[v])}),u.pop()}}if(!Te.isObject(n))throw new TypeError("data must be an object");return h(n),e}function b4(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function fU(n,e){this._pairs=[],n&&nb(n,this,e)}const rW=fU.prototype;rW.append=function(e,t){this._pairs.push([e,t])};rW.toString=function(e){const t=e?function(r){return e.call(this,r,b4)}:b4;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function Z4e(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function iW(n,e,t){if(!e)return n;const r=t&&t.encode||Z4e,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Te.isURLSearchParams(e)?e.toString():new fU(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class q4e{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Te.forEach(this.handlers,function(r){r!==null&&e(r)})}}const E4=q4e,sW={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},J4e=typeof URLSearchParams<"u"?URLSearchParams:fU,eHe=typeof FormData<"u"?FormData:null,tHe=typeof Blob<"u"?Blob:null,nHe={isBrowser:!0,classes:{URLSearchParams:J4e,FormData:eHe,Blob:tHe},protocols:["http","https","file","blob","url","data"]},hU=typeof window<"u"&&typeof document<"u",XT=typeof navigator=="object"&&navigator||void 0,rHe=hU&&(!XT||["ReactNative","NativeScript","NS"].indexOf(XT.product)<0),iHe=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),sHe=hU&&window.location.href||"http://localhost",oHe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:hU,hasStandardBrowserEnv:rHe,hasStandardBrowserWebWorkerEnv:iHe,navigator:XT,origin:sHe},Symbol.toStringTag,{value:"Module"})),as={...oHe,...nHe};function aHe(n,e){return nb(n,new as.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return as.isNode&&Te.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function lHe(n){return Te.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function cHe(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Te.isArray(i)?i.length:o,l?(Te.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Te.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Te.isArray(i[o])&&(i[o]=cHe(i[o])),!a)}if(Te.isFormData(n)&&Te.isFunction(n.entries)){const t={};return Te.forEachEntry(n,(r,i)=>{e(lHe(r),i,t,0)}),t}return null}function AHe(n,e,t){if(Te.isString(n))try{return(e||JSON.parse)(n),Te.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const dU={transitional:sW,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Te.isObject(e);if(s&&Te.isHTMLForm(e)&&(e=new FormData(e)),Te.isFormData(e))return i?JSON.stringify(oW(e)):e;if(Te.isArrayBuffer(e)||Te.isBuffer(e)||Te.isStream(e)||Te.isFile(e)||Te.isBlob(e)||Te.isReadableStream(e))return e;if(Te.isArrayBufferView(e))return e.buffer;if(Te.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(r.indexOf("application/x-www-form-urlencoded")>-1)return aHe(e,this.formSerializer).toString();if((a=Te.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return nb(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),AHe(e)):e}],transformResponse:[function(e){const t=this.transitional||dU.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(Te.isResponse(e)||Te.isReadableStream(e))return e;if(e&&Te.isString(e)&&(r&&!this.responseType||i)){const o=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?xt.from(a,xt.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:as.classes.FormData,Blob:as.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Te.forEach(["delete","get","head","post","put","patch"],n=>{dU.headers[n]={}});const pU=dU,uHe=Te.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),fHe=n=>{const e={};let t,r,i;return n&&n.split(` +`).forEach(function(o){i=o.indexOf(":"),t=o.substring(0,i).trim().toLowerCase(),r=o.substring(i+1).trim(),!(!t||e[t]&&uHe[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},B4=Symbol("internals");function fm(n){return n&&String(n).trim().toLowerCase()}function zw(n){return n===!1||n==null?n:Te.isArray(n)?n.map(zw):String(n)}function hHe(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=t.exec(n);)e[r[1]]=r[2];return e}const dHe=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function yS(n,e,t,r,i){if(Te.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Te.isString(e)){if(Te.isString(r))return e.indexOf(r)!==-1;if(Te.isRegExp(r))return r.test(e)}}function pHe(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function mHe(n,e){const t=Te.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(n,r+t,{value:function(i,s,o){return this[r].call(this,e,i,s,o)},configurable:!0})})}class rb{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,c){const A=fm(l);if(!A)throw new Error("header name must be a non-empty string");const u=Te.findKey(i,A);(!u||i[u]===void 0||c===!0||c===void 0&&i[u]!==!1)&&(i[u||l]=zw(a))}const o=(a,l)=>Te.forEach(a,(c,A)=>s(c,A,l));if(Te.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(Te.isString(e)&&(e=e.trim())&&!dHe(e))o(fHe(e),t);else if(Te.isHeaders(e))for(const[a,l]of e.entries())s(l,a,r);else e!=null&&s(t,e,r);return this}get(e,t){if(e=fm(e),e){const r=Te.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return hHe(i);if(Te.isFunction(t))return t.call(this,i,r);if(Te.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=fm(e),e){const r=Te.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||yS(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=fm(o),o){const a=Te.findKey(r,o);a&&(!t||yS(r,r[a],a,t))&&(delete r[a],i=!0)}}return Te.isArray(e)?e.forEach(s):s(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const s=t[r];(!e||yS(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Te.forEach(this,(i,s)=>{const o=Te.findKey(r,s);if(o){t[o]=zw(i),delete t[s];return}const a=e?pHe(s):String(s).trim();a!==s&&delete t[s],t[a]=zw(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Te.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Te.isArray(r)?r.join(", "):r)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[B4]=this[B4]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=fm(o);r[a]||(mHe(i,o),r[a]=!0)}return Te.isArray(e)?e.forEach(s):s(e),this}}rb.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Te.reduceDescriptors(rb.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Te.freezeMethods(rb);const ra=rb;function wS(n,e){const t=this||pU,r=e||t,i=ra.from(r.headers);let s=r.data;return Te.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function aW(n){return!!(n&&n.__CANCEL__)}function fp(n,e,t){xt.call(this,n??"canceled",xt.ERR_CANCELED,e,t),this.name="CanceledError"}Te.inherits(fp,xt,{__CANCEL__:!0});function lW(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new xt("Request failed with status code "+t.status,[xt.ERR_BAD_REQUEST,xt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function gHe(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function vHe(n,e){n=n||10;const t=new Array(n),r=new Array(n);let i=0,s=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),A=r[s];o||(o=c),t[i]=l,r[i]=c;let u=s,f=0;for(;u!==i;)f+=t[u++],u=u%n;if(i=(i+1)%n,i===s&&(s=(s+1)%n),c-o{t=A,i=null,s&&(clearTimeout(s),s=null),n.apply(null,c)};return[(...c)=>{const A=Date.now(),u=A-t;u>=r?o(c,A):(i=c,s||(s=setTimeout(()=>{s=null,o(i)},r-u)))},()=>i&&o(i)]}const bx=(n,e,t=3)=>{let r=0;const i=vHe(50,250);return yHe(s=>{const o=s.loaded,a=s.lengthComputable?s.total:void 0,l=o-r,c=i(l),A=o<=a;r=o;const u={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&A?(a-o)/c:void 0,event:s,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(u)},t)},S4=(n,e)=>{const t=n!=null;return[r=>e[0]({lengthComputable:t,total:n,loaded:r}),e[1]]},M4=n=>(...e)=>Te.asap(()=>n(...e)),wHe=as.hasStandardBrowserEnv?function(){const e=as.navigator&&/(msie|trident)/i.test(as.navigator.userAgent),t=document.createElement("a");let r;function i(s){let o=s;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return r=i(window.location.href),function(o){const a=Te.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}(),_He=as.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Te.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Te.isString(r)&&o.push("path="+r),Te.isString(i)&&o.push("domain="+i),s===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function xHe(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function bHe(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function cW(n,e){return n&&!xHe(e)?bHe(n,e):e}const C4=n=>n instanceof ra?{...n}:n;function Qu(n,e){e=e||{};const t={};function r(c,A,u){return Te.isPlainObject(c)&&Te.isPlainObject(A)?Te.merge.call({caseless:u},c,A):Te.isPlainObject(A)?Te.merge({},A):Te.isArray(A)?A.slice():A}function i(c,A,u){if(Te.isUndefined(A)){if(!Te.isUndefined(c))return r(void 0,c,u)}else return r(c,A,u)}function s(c,A){if(!Te.isUndefined(A))return r(void 0,A)}function o(c,A){if(Te.isUndefined(A)){if(!Te.isUndefined(c))return r(void 0,c)}else return r(void 0,A)}function a(c,A,u){if(u in e)return r(c,A);if(u in n)return r(void 0,c)}const l={url:s,method:s,data:s,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,A)=>i(C4(c),C4(A),!0)};return Te.forEach(Object.keys(Object.assign({},n,e)),function(A){const u=l[A]||i,f=u(n[A],e[A],A);Te.isUndefined(f)&&u!==a||(t[A]=f)}),t}const AW=n=>{const e=Qu({},n);let{data:t,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:o,auth:a}=e;e.headers=o=ra.from(o),e.url=iW(cW(e.baseURL,e.url),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let l;if(Te.isFormData(t)){if(as.hasStandardBrowserEnv||as.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((l=o.getContentType())!==!1){const[c,...A]=l?l.split(";").map(u=>u.trim()).filter(Boolean):[];o.setContentType([c||"multipart/form-data",...A].join("; "))}}if(as.hasStandardBrowserEnv&&(r&&Te.isFunction(r)&&(r=r(e)),r||r!==!1&&wHe(e.url))){const c=i&&s&&_He.read(s);c&&o.set(i,c)}return e},EHe=typeof XMLHttpRequest<"u",BHe=EHe&&function(n){return new Promise(function(t,r){const i=AW(n);let s=i.data;const o=ra.from(i.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=i,A,u,f,h,d;function m(){h&&h(),d&&d(),i.cancelToken&&i.cancelToken.unsubscribe(A),i.signal&&i.signal.removeEventListener("abort",A)}let g=new XMLHttpRequest;g.open(i.method.toUpperCase(),i.url,!0),g.timeout=i.timeout;function p(){if(!g)return;const w=ra.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),x={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:w,config:n,request:g};lW(function(B){t(B),m()},function(B){r(B),m()},x),g=null}"onloadend"in g?g.onloadend=p:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(p)},g.onabort=function(){g&&(r(new xt("Request aborted",xt.ECONNABORTED,n,g)),g=null)},g.onerror=function(){r(new xt("Network Error",xt.ERR_NETWORK,n,g)),g=null},g.ontimeout=function(){let _=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const x=i.transitional||sW;i.timeoutErrorMessage&&(_=i.timeoutErrorMessage),r(new xt(_,x.clarifyTimeoutError?xt.ETIMEDOUT:xt.ECONNABORTED,n,g)),g=null},s===void 0&&o.setContentType(null),"setRequestHeader"in g&&Te.forEach(o.toJSON(),function(_,x){g.setRequestHeader(x,_)}),Te.isUndefined(i.withCredentials)||(g.withCredentials=!!i.withCredentials),a&&a!=="json"&&(g.responseType=i.responseType),c&&([f,d]=bx(c,!0),g.addEventListener("progress",f)),l&&g.upload&&([u,h]=bx(l),g.upload.addEventListener("progress",u),g.upload.addEventListener("loadend",h)),(i.cancelToken||i.signal)&&(A=w=>{g&&(r(!w||w.type?new fp(null,n,g):w),g.abort(),g=null)},i.cancelToken&&i.cancelToken.subscribe(A),i.signal&&(i.signal.aborted?A():i.signal.addEventListener("abort",A)));const v=gHe(i.url);if(v&&as.protocols.indexOf(v)===-1){r(new xt("Unsupported protocol "+v+":",xt.ERR_BAD_REQUEST,n));return}g.send(s||null)})},SHe=(n,e)=>{const{length:t}=n=n?n.filter(Boolean):[];if(e||t){let r=new AbortController,i;const s=function(c){if(!i){i=!0,a();const A=c instanceof Error?c:this.reason;r.abort(A instanceof xt?A:new fp(A instanceof Error?A.message:A))}};let o=e&&setTimeout(()=>{o=null,s(new xt(`timeout ${e} of ms exceeded`,xt.ETIMEDOUT))},e);const a=()=>{n&&(o&&clearTimeout(o),o=null,n.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),n=null)};n.forEach(c=>c.addEventListener("abort",s));const{signal:l}=r;return l.unsubscribe=()=>Te.asap(a),l}},MHe=SHe,CHe=function*(n,e){let t=n.byteLength;if(!e||t{const i=THe(n,e);let s=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:A}=await i.next();if(c){a(),l.close();return}let u=A.byteLength;if(t){let f=s+=u;t(f)}l.enqueue(new Uint8Array(A))}catch(c){throw a(c),c}},cancel(l){return a(l),i.return()}},{highWaterMark:2})},ib=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",uW=ib&&typeof ReadableStream=="function",RHe=ib&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),fW=(n,...e)=>{try{return!!n(...e)}catch{return!1}},UHe=uW&&fW(()=>{let n=!1;const e=new Request(as.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e}),I4=64*1024,YT=uW&&fW(()=>Te.isReadableStream(new Response("").body)),Ex={stream:YT&&(n=>n.body)};ib&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!Ex[e]&&(Ex[e]=Te.isFunction(n[e])?t=>t[e]():(t,r)=>{throw new xt(`Response type '${e}' is not supported`,xt.ERR_NOT_SUPPORT,r)})})})(new Response);const FHe=async n=>{if(n==null)return 0;if(Te.isBlob(n))return n.size;if(Te.isSpecCompliantForm(n))return(await new Request(as.origin,{method:"POST",body:n}).arrayBuffer()).byteLength;if(Te.isArrayBufferView(n)||Te.isArrayBuffer(n))return n.byteLength;if(Te.isURLSearchParams(n)&&(n=n+""),Te.isString(n))return(await RHe(n)).byteLength},PHe=async(n,e)=>{const t=Te.toFiniteNumber(n.getContentLength());return t??FHe(e)},LHe=ib&&(async n=>{let{url:e,method:t,data:r,signal:i,cancelToken:s,timeout:o,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:A,withCredentials:u="same-origin",fetchOptions:f}=AW(n);c=c?(c+"").toLowerCase():"text";let h=MHe([i,s&&s.toAbortSignal()],o),d;const m=h&&h.unsubscribe&&(()=>{h.unsubscribe()});let g;try{if(l&&UHe&&t!=="get"&&t!=="head"&&(g=await PHe(A,r))!==0){let x=new Request(e,{method:"POST",body:r,duplex:"half"}),b;if(Te.isFormData(r)&&(b=x.headers.get("content-type"))&&A.setContentType(b),x.body){const[B,S]=S4(g,bx(M4(l)));r=T4(x.body,I4,B,S)}}Te.isString(u)||(u=u?"include":"omit");const p="credentials"in Request.prototype;d=new Request(e,{...f,signal:h,method:t.toUpperCase(),headers:A.normalize().toJSON(),body:r,duplex:"half",credentials:p?u:void 0});let v=await fetch(d);const w=YT&&(c==="stream"||c==="response");if(YT&&(a||w&&m)){const x={};["status","statusText","headers"].forEach(I=>{x[I]=v[I]});const b=Te.toFiniteNumber(v.headers.get("content-length")),[B,S]=a&&S4(b,bx(M4(a),!0))||[];v=new Response(T4(v.body,I4,B,()=>{S&&S(),m&&m()}),x)}c=c||"text";let _=await Ex[Te.findKey(Ex,c)||"text"](v,n);return!w&&m&&m(),await new Promise((x,b)=>{lW(x,b,{data:_,headers:ra.from(v.headers),status:v.status,statusText:v.statusText,config:n,request:d})})}catch(p){throw m&&m(),p&&p.name==="TypeError"&&/fetch/i.test(p.message)?Object.assign(new xt("Network Error",xt.ERR_NETWORK,n,d),{cause:p.cause||p}):xt.from(p,p&&p.code,n,d)}}),$T={http:X4e,xhr:BHe,fetch:LHe};Te.forEach($T,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const R4=n=>`- ${n}`,DHe=n=>Te.isFunction(n)||n===null||n===!1,hW={getAdapter:n=>{n=Te.isArray(n)?n:[n];const{length:e}=n;let t,r;const i={};for(let s=0;s`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?s.length>1?`since : +`+s.map(R4).join(` +`):" "+R4(s[0]):"as no adapter specified";throw new xt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:$T};function _S(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new fp(null,n)}function U4(n){return _S(n),n.headers=ra.from(n.headers),n.data=wS.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),hW.getAdapter(n.adapter||pU.adapter)(n).then(function(r){return _S(n),r.data=wS.call(n,n.transformResponse,r),r.headers=ra.from(r.headers),r},function(r){return aW(r)||(_S(n),r&&r.response&&(r.response.data=wS.call(n,n.transformResponse,r.response),r.response.headers=ra.from(r.response.headers))),Promise.reject(r)})}const dW="1.7.7",mU={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{mU[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const F4={};mU.transitional=function(e,t,r){function i(s,o){return"[Axios v"+dW+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new xt(i(o," has been removed"+(t?" in "+t:"")),xt.ERR_DEPRECATED);return t&&!F4[o]&&(F4[o]=!0,console.warn(i(o," has been deprecated since v"+t+" and will be removed in the near future"))),e?e(s,o,a):!0}};function NHe(n,e,t){if(typeof n!="object")throw new xt("options must be an object",xt.ERR_BAD_OPTION_VALUE);const r=Object.keys(n);let i=r.length;for(;i-- >0;){const s=r[i],o=e[s];if(o){const a=n[s],l=a===void 0||o(a,s,n);if(l!==!0)throw new xt("option "+s+" must be "+l,xt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new xt("Unknown option "+s,xt.ERR_BAD_OPTION)}}const ZT={assertOptions:NHe,validators:mU},Uc=ZT.validators;class Bx{constructor(e){this.defaults=e,this.interceptors={request:new E4,response:new E4}}async request(e,t){try{return await this._request(e,t)}catch(r){if(r instanceof Error){let i;Error.captureStackTrace?Error.captureStackTrace(i={}):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+s):r.stack=s}catch{}}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Qu(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&ZT.assertOptions(r,{silentJSONParsing:Uc.transitional(Uc.boolean),forcedJSONParsing:Uc.transitional(Uc.boolean),clarifyTimeoutError:Uc.transitional(Uc.boolean)},!1),i!=null&&(Te.isFunction(i)?t.paramsSerializer={serialize:i}:ZT.assertOptions(i,{encode:Uc.function,serialize:Uc.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Te.merge(s.common,s[t.method]);s&&Te.forEach(["delete","get","head","post","put","patch","common"],d=>{delete s[d]}),t.headers=ra.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(m){typeof m.runWhen=="function"&&m.runWhen(t)===!1||(l=l&&m.synchronous,a.unshift(m.fulfilled,m.rejected))});const c=[];this.interceptors.response.forEach(function(m){c.push(m.fulfilled,m.rejected)});let A,u=0,f;if(!l){const d=[U4.bind(this),void 0];for(d.unshift.apply(d,a),d.push.apply(d,c),f=d.length,A=Promise.resolve(t);u{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const o=new Promise(a=>{r.subscribe(a),s=a}).then(i);return o.cancel=function(){r.unsubscribe(s)},o},e(function(s,o,a){r.reason||(r.reason=new fp(s,o,a),t(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);t!==-1&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=r=>{e.abort(r)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new gU(function(i){e=i}),cancel:e}}}const OHe=gU;function kHe(n){return function(t){return n.apply(null,t)}}function HHe(n){return Te.isObject(n)&&n.isAxiosError===!0}const qT={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(qT).forEach(([n,e])=>{qT[e]=n});const QHe=qT;function pW(n){const e=new Gw(n),t=Wj(Gw.prototype.request,e);return Te.extend(t,Gw.prototype,e,{allOwnKeys:!0}),Te.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return pW(Qu(n,i))},t}const Cr=pW(pU);Cr.Axios=Gw;Cr.CanceledError=fp;Cr.CancelToken=OHe;Cr.isCancel=aW;Cr.VERSION=dW;Cr.toFormData=nb;Cr.AxiosError=xt;Cr.Cancel=Cr.CanceledError;Cr.all=function(e){return Promise.all(e)};Cr.spread=kHe;Cr.isAxiosError=HHe;Cr.mergeConfig=Qu;Cr.AxiosHeaders=ra;Cr.formToJSON=n=>oW(Te.isHTMLForm(n)?new FormData(n):n);Cr.getAdapter=hW.getAdapter;Cr.HttpStatusCode=QHe;Cr.default=Cr;const zHe=Cr,GHe={}.VITE_OPENSEA_KEY,VHe={}.VITE_PINATA_API_KEY,jHe={}.VITE_PINATA_API_SECRET,xS="0x89";let Yy;async function WHe(){if(Yy!=null)return Yy;const n=new ZH("https://polygon-rpc.com/"),t=await new q1(xx.address,xx.abi,n).tokenPrice();return Yy=Ve.from(t).mul(1),Yy}function KHe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":GHe}};return console.log(t),new Promise((r,i)=>{fetch("https://api.opensea.io/api/v2/chain/ethereum/account/"+n+"/nfts?collection="+e,t).then(s=>{if(s.ok)return s.json();i("Failed to fetch data from Opensea API")}).then(s=>{r(s)}).catch(s=>{i(s)})})}async function vU(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(xS,16)){const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}else try{await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:xS}]});const e=await window.ethereum.request({method:"eth_requestAccounts"});return e.length>0?e[0]:""}catch(e){console.log("polygon not find:",e);try{await window.ethereum.request({method:"wallet_addEthereumChain",params:[{chainId:"0x89",chainName:"Polygon Mainnet",rpcUrls:["https://polygon-rpc.com"],nativeCurrency:{name:"Matic",symbol:"MATIC",decimals:18},blockExplorerUrls:["https://polygonscan.com/"]}]}),await window.ethereum.request({method:"wallet_switchEthereumChain",params:[{chainId:xS}]});const t=await window.ethereum.request({method:"eth_requestAccounts"});return t.length>0?t[0]:""}catch(t){console.log("Adding polygon chain failed",t)}}}catch{return""}else return""}async function bS(n,e){if(!n)return console.warn("Error saving to pinata: No file data");const t="https://api.pinata.cloud/pinning/pinFileToIPFS";let r=new FormData;return r.append("file",n,e),(await zHe.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:VHe,pinata_secret_api_key:jHe}})).data}const XHe=n=>{let e=[];return Object.keys(n).map(t=>{Object.keys(n[t]).length!==0&&e.push({trait_type:t,value:n[t].name})}),e};async function YHe(n,e,t,r,i){if(!n)throw new Error("No avatar was provided");if(!e)throw new Error("No screenshot was provided");if(!t)throw new Error("No model was provided");const s=await vU();if(s=="")return"Please Connect Wallet";if(!i||await $He(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let v=0;v<10;v++)try{return await bS(e,a).catch(_=>{console.error(v,"---",_)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const c=await y0e(t,n,4096);let A;if(c){let v="AvatarGlb_"+Date.now()+".glb";A=await(async()=>{for(let w=0;w<10;w++)try{return await bS(c,v).catch(x=>(console.error(w,"---",x),"Couldn't save glb to pinata"))}catch(_){return console.warn(_),"Couldn't save glb to pinata"}return"Failed to upload glb"})()}else return"Unable to get glb";const u={name:r||"Avatars",description:"Character Studio Avatars.",image:`ipfs://${l.IpfsHash}`,animation_url:`ipfs://${A.IpfsHash}`,attributes:XHe(n)},f=JSON.stringify(u),d=`ipfs://${(await bS(new Blob([f]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let m=await WHe();const g=new mI(window.ethereum).getSigner(),p=new q1(xx.address,xx.abi,g);try{const v={value:m,from:s};if((await(await p.mintToken(1,d,v)).wait()).transactionHash)return console.log("Mint success!"),"Mint success!"}catch{return"Public Mint failed."}}}const $He=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=oY("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new q1(y4.address,y4.abi,t).beneficiaryBalanceOf(e,l4e,1);return parseInt(i)>0?!0:(console.log(`Currently in alpha. You need a genesis pass to mint. + Will be public soon!`),!1)}else return console.log("Please connect your wallet"),!1};function ZHe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=q.useContext(As),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:c}=q.useContext(mr),[A,u]=xe.useState(null),[f,h]=xe.useState(""),{playSound:d}=q.useContext(Mo),{isMute:m}=q.useContext(So);q.useState(null);const[g,p]=q.useState(null),[v,w]=q.useState(""),_=()=>{!m&&d("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(yt.LANDING)},x=()=>{const y=Qe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Dn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Dn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:y===0||y==2,exportMtoonAtlas:y===1||y==2,ktxCompression:Qe.merge_options_ktx_compression||!1,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},b=y=>{const E=g[y].manifestName;(async()=>{(Qe.mergeOptions_download_vrm_preview==null?!0:Qe.mergeOptions_download_vrm_preview)&&i.savePortraitScreenshot(E,512,1024,1.5,-.1),(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm)&&await i.downloadVRM(E,x());const z=new ep,W=c.parent;W.remove(c);const H=Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora;if(H===!0){const K=r.loras.map(async ee=>a.createLoraData(ee,z));await Promise.all(K)}const C=Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites;if(C===!0){const K=r.sprites.map(async ee=>l.createSpriteAtlas(ee,z));await Promise.all(K)}(H===!0||C===!0)&&z.saveZip(g[y].manifestName),W.add(c),y{y==0?(console.log(r.loras[0]),b(y)):(await i.setManifest(g[y]),t(!0),i.loadInitialTraits().then(async()=>{await(R=>new Promise(L=>setTimeout(L,R)))(1),b(y)}))},S=()=>{t(!0),B(0)},{t:I}=xe.useContext(la),M=async y=>{if(i.getCurrentCharacterModel()){const R=Kl(y.name),L=URL.createObjectURL(y);await s.loadAnimation(L,!1,0,!0,"",R),w(s.getCurrentAnimationName()),URL.revokeObjectURL(L)}else console.warn("Please load a vrm model to test animations.")},P=async y=>{const E=URL.createObjectURL(y);await i.loadOptimizerCharacter(E),URL.revokeObjectURL(E);const R=Kl(y.name);h(R),u(i.getCurrentCharacterModel())},D=y=>{const E=Array.from(y),R=[],L=N=>new Promise((z,W)=>{if(N&&N.name.toLowerCase().endsWith(".json")){const H=new FileReader,C=N.name.replace(/\.[^/.]+$/,"");H.onload=function(K){try{const ee=JSON.parse(K.target.result),F=ee.thumbnail;ee.manifestName=C,R.push(ee),z()}catch(ee){console.error("Error parsing the JSON file:",ee),W(ee)}},H.readAsText(N)}});Promise.all(E.map(L)).then(()=>{R.length>0&&(p(R),i.setManifest(R[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(N=>{console.error("Error processing files:",N)})},T=async y=>{const E=y[0];E&&E.name.toLowerCase().endsWith(".fbx")&&M(E),E&&E.name.toLowerCase().endsWith(".vrm")&&P(E),E&&E.name.toLowerCase().endsWith(".json")&&D(y)};return Q.jsxs("div",{className:Oi.container,children:[Q.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:Q.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),Q.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),Q.jsx(S0,{onFilesDrop:T}),Q.jsx($1,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),Q.jsx(cU,{model:A}),Q.jsx(g2,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&Q.jsx(F1,{loadedAnimationName:v}),Q.jsxs("div",{className:Oi.buttonContainer,children:[Q.jsx(Un,{theme:"light",text:I("callToAction.back"),size:14,className:Oi.buttonLeft,onClick:_}),(g==null?void 0:g.length)==1&&Q.jsx(Un,{theme:"light",text:"Download",size:14,className:Oi.buttonRight,onClick:S}),(g==null?void 0:g.length)>1&&Q.jsx(Un,{theme:"light",text:"Download All",size:14,className:Oi.buttonRight,onClick:S})]})]})}const qHe="_classdisabled_hpzv8_1",JHe="_container_hpzv8_6",eQe="_classContainer_hpzv8_14",tQe="_icon_hpzv8_39",nQe="_name_hpzv8_70",rQe="_description_hpzv8_79",iQe="_classFrame_hpzv8_84",sQe="_frameContainer_hpzv8_104",oQe="_frame_hpzv8_104",aQe="_image_hpzv8_114",lQe="_lockedContainer_hpzv8_120",cQe="_locked_hpzv8_120",AQe="_buttonContainer_hpzv8_134",uQe="_buttonLeft_hpzv8_143",fQe="_buttonRight_hpzv8_147",hQe="_buttonCenter_hpzv8_151",dQe="_topLine_hpzv8_165",pQe="_bottomLine_hpzv8_191",At={classdisabled:qHe,container:JHe,classContainer:eQe,class:"_class_hpzv8_1",icon:tQe,name:nQe,description:rQe,classFrame:iQe,frameContainer:sQe,frame:oQe,image:aQe,lockedContainer:lQe,locked:cQe,buttonContainer:AQe,buttonLeft:uQe,buttonRight:fQe,buttonCenter:hQe,topLine:dQe,bottomLine:pQe};function mQe(){const{t:n}=xe.useContext(la),{setViewMode:e,setIsLoading:t,isLoading:r}=q.useContext(As),{playSound:i}=q.useContext(Mo),{isMute:s}=q.useContext(So),{manifest:o,characterManager:a}=q.useContext(mr),[l,c]=xe.useState([]);xe.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const d=o.characters.map(m=>({name:m.name,image:m.portrait,description:m.description,manifest:m.manifest,icon:m.icon,format:m.format,disabled:!1}));c(d)}},[o]);const A=()=>{e(yt.LANDING),!s&&i("backNextButton")},u=async d=>{t(!0),a.loadManifest(o.characters[d].manifest).then(()=>{e(yt.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{e(yt.BATCHMANIFEST)},h=()=>{!s&&i("classMouseOver")};return Q.jsxs("div",{className:`${At.container} horizontalScroll`,children:[Q.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),Q.jsx("div",{className:At.vrmOptimizerButton}),Q.jsx("div",{className:At.topLine}),Q.jsxs("div",{className:At.classContainer,children:[l.map((d,m)=>Q.jsxs("div",{className:d.disabled?At.classdisabled:At.class,onClick:d.disabled?null:()=>u(m),onMouseOver:d.disabled?null:()=>h(),children:[Q.jsxs("div",{className:At.classFrame,style:{backgroundImage:`url(${d.image})`},children:[Q.jsx("div",{className:At.frameContainer,children:Q.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:At.frame})}),Q.jsx("div",{className:At.lockedContainer,children:d.disabled&&Q.jsx("img",{src:"./assets/icons/locked.svg",className:At.locked})})]}),Q.jsx("div",{className:At.name,children:d.name}),Q.jsx("div",{className:At.description,children:d.description})]},m)),Q.jsxs("div",{className:At.class,onClick:()=>f(),onMouseOver:()=>h(),children:[Q.jsx("div",{className:At.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:Q.jsx("div",{className:At.frameContainer,children:Q.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:At.frame})})}),Q.jsx("div",{className:At.name,children:"Manifest"}),Q.jsx("div",{className:At.description,children:"Load by manifest"})]},"manifest-load")]}),Q.jsx("div",{className:At.bottomLine}),Q.jsx("div",{className:At.buttonContainer,children:Q.jsx(Un,{theme:"light",text:n("callToAction.back"),size:14,className:At.buttonLeft,onClick:A})})]})}function gQe(){const{t:n}=xe.useContext(la),{setViewMode:e,setIsLoading:t,isLoading:r}=q.useContext(As),{playSound:i}=q.useContext(Mo),{isMute:s}=q.useContext(So),{manifest:o,characterManager:a}=q.useContext(mr),[l,c]=xe.useState([]);xe.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const h=o.characters.map(d=>({name:d.name,image:d.portrait,description:d.description,manifest:d.manifest,icon:d.icon,format:d.format,disabled:!1}));c(h)}},[o]);const A=()=>{e(yt.LANDING),!s&&i("backNextButton")},u=async h=>{t(!0),a.loadManifest(o.characters[h].manifest).then(()=>{e(yt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{!s&&i("classMouseOver")};return Q.jsxs("div",{className:`${At.container} horizontalScroll`,children:[Q.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),Q.jsx("div",{className:At.vrmOptimizerButton}),Q.jsx("div",{className:At.topLine}),Q.jsx("div",{className:At.classContainer,children:l.map((h,d)=>Q.jsxs("div",{className:h.disabled?At.classdisabled:At.class,onClick:h.disabled?null:()=>u(d),onMouseOver:h.disabled?null:()=>f(),children:[Q.jsxs("div",{className:At.classFrame,style:{backgroundImage:`url(${h.image})`},children:[Q.jsx("div",{className:At.frameContainer,children:Q.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:At.frame})}),Q.jsx("div",{className:At.lockedContainer,children:h.disabled&&Q.jsx("img",{src:"./assets/icons/locked.svg",className:At.locked})})]}),Q.jsx("div",{className:At.name,children:h.name}),Q.jsx("div",{className:At.description,children:h.description})]},d))}),Q.jsx("div",{className:At.bottomLine}),Q.jsx("div",{className:At.buttonContainer,children:Q.jsx(Un,{theme:"light",text:n("callToAction.back"),size:14,className:At.buttonLeft,onClick:A})})]})}const vQe="_buttonContainer_1ueuk_1",yQe="_button_1ueuk_1",Vf={buttonContainer:vQe,button:yQe},P4={}.VITE_OPENSEA_KEY;function wQe(){const{setViewMode:n}=q.useContext(As),{playSound:e}=q.useContext(Mo),{isMute:t}=q.useContext(So),{characterManager:r}=q.useContext(mr),i=()=>{n(yt.CREATE),!t&&e("backNextButton")},s=()=>{n(yt.CLAIM),!t&&e("backNextButton")},o=()=>{n(yt.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await vU()!=""&&n(yt.WALLET),!t&&e("backNextButton")};return Q.jsx("div",{className:Vf.container,children:Q.jsxs("div",{className:Vf.buttonContainer,children:[Q.jsx("button",{className:Vf.button,onClick:i,children:Q.jsx("img",{src:"./assets/media/btn_create_character.png"})}),Q.jsx("button",{className:Vf.button,onClick:s,children:Q.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),Q.jsx("button",{className:Vf.button,onClick:o,children:Q.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),P4&&P4!=""&&Q.jsx("button",{className:Vf.button,onClick:a,children:Q.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const ZA={};var yU={exports:{}},ud=typeof Reflect=="object"?Reflect:null,L4=ud&&typeof ud.apply=="function"?ud.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},Vw;ud&&typeof ud.ownKeys=="function"?Vw=ud.ownKeys:Object.getOwnPropertySymbols?Vw=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Vw=function(e){return Object.getOwnPropertyNames(e)};function _Qe(n){console&&console.warn&&console.warn(n)}var mW=Number.isNaN||function(e){return e!==e};function mn(){mn.init.call(this)}yU.exports=mn;yU.exports.once=BQe;mn.EventEmitter=mn;mn.prototype._events=void 0;mn.prototype._eventsCount=0;mn.prototype._maxListeners=void 0;var D4=10;function sb(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(mn,"defaultMaxListeners",{enumerable:!0,get:function(){return D4},set:function(n){if(typeof n!="number"||n<0||mW(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");D4=n}});mn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};mn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||mW(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function gW(n){return n._maxListeners===void 0?mn.defaultMaxListeners:n._maxListeners}mn.prototype.getMaxListeners=function(){return gW(this)};mn.prototype.emit=function(e){for(var t=[],r=1;r0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(l===void 0)return!1;if(typeof l=="function")L4(l,this,t);else for(var c=l.length,A=xW(l,c),r=0;r0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=n,a.type=e,a.count=o.length,_Qe(a)}return n}mn.prototype.addListener=function(e,t){return vW(this,e,t,!1)};mn.prototype.on=mn.prototype.addListener;mn.prototype.prependListener=function(e,t){return vW(this,e,t,!0)};function xQe(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function yW(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=xQe.bind(r);return i.listener=t,r.wrapFn=i,i}mn.prototype.once=function(e,t){return sb(t),this.on(e,yW(this,e,t)),this};mn.prototype.prependOnceListener=function(e,t){return sb(t),this.prependListener(e,yW(this,e,t)),this};mn.prototype.removeListener=function(e,t){var r,i,s,o,a;if(sb(t),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(s=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,s=o;break}if(s<0)return this;s===0?r.shift():bQe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};mn.prototype.off=mn.prototype.removeListener;mn.prototype.removeAllListeners=function(e){var t,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var s=Object.keys(r),o;for(i=0;i=0;i--)this.removeListener(e,t[i]);return this};function wW(n,e,t){var r=n._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?EQe(i):xW(i,i.length)}mn.prototype.listeners=function(e){return wW(this,e,!0)};mn.prototype.rawListeners=function(e){return wW(this,e,!1)};mn.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):_W.call(n,e)};mn.prototype.listenerCount=_W;function _W(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}mn.prototype.eventNames=function(){return this._eventsCount>0?Vw(this._events):[]};function xW(n,e){for(var t=new Array(e),r=0;r"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function jw(n,e,t){return IQe()?jw=Reflect.construct:jw=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),c=new l;return o&&Sx(c,o.prototype),c},jw.apply(null,arguments)}function RQe(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Mx(n){var e=typeof Map=="function"?new Map:void 0;return Mx=function(r){if(r===null||!RQe(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,i)}function i(){return jw(r,arguments,eI(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Sx(i,r)},Mx(n)}function $y(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function jf(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function wa(n){return n.hasOwnProperty("result")?n.result:n}var ES=function(n){wU(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="No Ethereum provider was found on window.ethereum.",t}return e}(Mx(Error)),UQe=function(n){wU(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t.message="The user rejected the request.",t}return e}(Mx(Error)),FQe=function(n){wU(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind($y(i)),i.handleChainChanged=i.handleChainChanged.bind($y(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind($y(i)),i.handleClose=i.handleClose.bind($y(i)),i}var t=e.prototype;return t.handleChainChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.handleAccountsChanged=function(i){i.length===0?this.emitDeactivate():this.emitUpdate({account:i[0]})},t.handleClose=function(i,s){this.emitDeactivate()},t.handleNetworkChanged=function(i){this.emitUpdate({chainId:i,provider:window.ethereum})},t.activate=function(){try{var i=function(A){if(s)return A;function u(){return JT({provider:window.ethereum},a?{account:a}:{})}var f=function(){if(!a)return Promise.resolve(window.ethereum.enable().then(function(h){return h&&wa(h)[0]})).then(function(h){a=h})}();return f&&f.then?f.then(u):u(f)},s=!1,o=this;if(!window.ethereum)throw new ES;window.ethereum.on&&(window.ethereum.on("chainChanged",o.handleChainChanged),window.ethereum.on("accountsChanged",o.handleAccountsChanged),window.ethereum.on("close",o.handleClose),window.ethereum.on("networkChanged",o.handleNetworkChanged)),window.ethereum.isMetaMask&&(window.ethereum.autoRefreshOnNetworkChange=!1);var a,l=jf(function(){return Promise.resolve(window.ethereum.send("eth_requestAccounts").then(function(c){return wa(c)[0]})).then(function(c){a=c})},function(c){if(c.code===4001)throw new UQe});return Promise.resolve(l&&l.then?l.then(i):i(l))}catch(c){return Promise.reject(c)}},t.getProvider=function(){try{return Promise.resolve(window.ethereum)}catch(i){return Promise.reject(i)}},t.getChainId=function(){try{var i=function(){function l(){if(!s)try{s=wa(window.ethereum.send({method:"net_version"}))}catch{}return s||(window.ethereum.isDapper?s=wa(window.ethereum.cachedResults.net_version):s=window.ethereum.chainId||window.ethereum.netVersion||window.ethereum.networkVersion||window.ethereum._chainId),s}var c=function(){if(!s){var A=jf(function(){return Promise.resolve(window.ethereum.send("net_version").then(wa)).then(function(u){s=u})},function(){});if(A&&A.then)return A.then(function(){})}}();return c&&c.then?c.then(l):l(c)};if(!window.ethereum)throw new ES;var s,o=jf(function(){return Promise.resolve(window.ethereum.send("eth_chainId").then(wa)).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.getAccount=function(){try{var i=function(){function l(){return s||(s=wa(window.ethereum.send({method:"eth_accounts"}))[0]),s}var c=function(){if(!s){var A=jf(function(){return Promise.resolve(window.ethereum.enable().then(function(u){return wa(u)[0]})).then(function(u){s=u})},function(){});if(A&&A.then)return A.then(function(){})}}();return c&&c.then?c.then(l):l(c)};if(!window.ethereum)throw new ES;var s,o=jf(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(a){return wa(a)[0]})).then(function(a){s=a})},function(){});return Promise.resolve(o&&o.then?o.then(i):i(o))}catch(a){return Promise.reject(a)}},t.deactivate=function(){window.ethereum&&window.ethereum.removeListener&&(window.ethereum.removeListener("chainChanged",this.handleChainChanged),window.ethereum.removeListener("accountsChanged",this.handleAccountsChanged),window.ethereum.removeListener("close",this.handleClose),window.ethereum.removeListener("networkChanged",this.handleNetworkChanged))},t.isAuthorized=function(){try{return window.ethereum?Promise.resolve(jf(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(i){return wa(i).length>0}))},function(){return!1})):Promise.resolve(!1)}catch(i){return Promise.reject(i)}},e}(TQe);function PQe(){const{account:n,library:e,activate:t}=pY(),[r,i]=xe.useState([]),{setViewMode:s}=q.useContext(As),{playSound:o}=q.useContext(Mo),{isMute:a}=q.useContext(So),l=new FQe({supportedChainIds:[137,1,3,4,5,42,97]});xe.useEffect(()=>{if(n&&e){const f="0x69341F01C2113E2d09Cd4837bbF1786dfbBc41d7",h=["function balanceOf(address owner) external view returns (uint256)","function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256)","function tokenURI(uint256 tokenId) external view returns (string)"],d=new q1(f,h,e);d.balanceOf(n).then(m=>{const g=[];for(let p=0;p{const v=p.map(w=>d.tokenURI(w));Promise.all(v).then(w=>{i(w)})})})}},[n,e]);const c=()=>{t(l)},A=f=>{!a&&o("backNextButton"),s(yt.APPEARANCE)},u=()=>{s(yt.LANDING),!a&&o("backNextButton")};return Q.jsxs("div",{className:ZA.container,children:[!n&&Q.jsxs("div",{className:ZA.message,children:["Please connect your wallet to load your characters",Q.jsx("button",{className:ZA.button,onClick:()=>c(),children:"Connect"})]}),Q.jsxs("div",{className:ZA.characterContainer,children:[Q.jsx("div",{className:ZA.title,children:"Load Character"}),r.map((f,h)=>Q.jsx("div",{className:ZA.character,onClick:()=>{A()},children:JSON.stringify(f)},h))]}),Q.jsx("button",{className:ZA.button,onClick:()=>u(),children:"Back"})]})}const LQe="_container_q73cc_1",DQe="_mintContainer_q73cc_6",NQe="_mainTitleWrap_q73cc_33",OQe="_mainTitle_q73cc_33",kQe="_mintButtonContainer_q73cc_49",HQe="_mintButton_q73cc_49",QQe="_genesisText_q73cc_60",zQe="_required_q73cc_64",GQe="_divider_q73cc_68",VQe="_bottomContainer_q73cc_75",jQe="_mintInfo_q73cc_85",WQe="_topLine_q73cc_91",KQe="_bottomLine_q73cc_104",ji={container:LQe,mintContainer:DQe,mainTitleWrap:NQe,mainTitle:OQe,mintButtonContainer:kQe,mintButton:HQe,genesisText:QQe,required:zQe,divider:GQe,bottomContainer:VQe,mintInfo:jQe,topLine:WQe,bottomLine:KQe};function XQe(){const{model:n,avatar:e}=q.useContext(mr),{setViewMode:t}=q.useContext(As),{playSound:r}=q.useContext(Mo),{isMute:i}=q.useContext(So),[s,o]=q.useState(""),[a,l]=q.useState(!1),c=()=>{t(yt.SAVE),!i&&r("backNextButton")};function A(){return Q.jsxs("div",{className:ji.mainTitleWrap,children:[Q.jsx("div",{className:ji.topLine}),Q.jsx("div",{className:ji.mainTitle,children:"Mint"})]})}async function u(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const d=await YHe(e,null,n,{name:"XXXRestore"}.name);o(d),l(!1),console.log(d)}return Q.jsxs("div",{className:ji.container,children:[Q.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),Q.jsxs("div",{className:ji.mintContainer,children:[Q.jsx(A,{}),Q.jsxs("div",{className:ji.mintButtonContainer,children:[Q.jsx(Un,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:ji.mintButton,disabled:a,onClick:u,minWidth:220}),Q.jsx("div",{className:ji.divider}),Q.jsx(Un,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:ji.mintButton,disabled:!0,minWidth:220}),Q.jsxs("span",{className:ji.genesisText,children:["(",Q.jsx("span",{className:ji.required,children:"Coming Soon!"}),")"]})]}),Q.jsxs("span",{className:ji.mintInfo,children:[s," "]})]}),Q.jsx("div",{className:ji.bottomContainer,children:Q.jsx(Un,{theme:"light",text:"Back",size:14,className:ji.buttonLeft,onClick:c})})]})}function YQe(){const{isLoading:n,setViewMode:e}=q.useContext(As),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=q.useContext(mr),{playSound:l}=q.useContext(Mo),{isMute:c}=q.useContext(So),[A,u]=xe.useState(null),[f,h]=xe.useState(""),[d,m]=xe.useState([]),[g,p]=xe.useState(0),[v,w]=q.useState("T-Pose"),_=()=>{!c&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(yt.LANDING)},x=()=>{const E=Qe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:Dn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Dn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:E===0||E==2,exportMtoonAtlas:E===1||E==2,ktxCompression:Qe.merge_options_ktx_compression||!1,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},b=async()=>{for(let E=0;E{typeof E!="string"&&(E=f),await(async()=>{var K;(Qe.mergeOptions_download_vrm_preview==null?!0:Qe.mergeOptions_download_vrm_preview)&&r.savePortraitScreenshot(E+"_portrait",512,1024,1.5,-.1),(Qe.mergeOptions_download_vrm==null?!0:Qe.mergeOptions_download_vrm)&&await r.downloadVRM(E+"_merged",x());const z=new ep,W=s.parent;W.remove(s),(K=r.getCurrentOptimizerCharacterModel().data)==null||K.isVRM0;const H=Qe.mergeOptions_download_lora==null?!0:Qe.mergeOptions_download_lora;if(H===!0){const ee=t.loras.map(async F=>o.createLoraData(F,z));await Promise.all(ee)}const C=Qe.mergeOptions_download_sprites==null?!0:Qe.mergeOptions_download_sprites;if(C===!0){const ee=t.sprites.map(async F=>a.createSpriteAtlas(F,z));await Promise.all(ee)}(H===!0||C===!0)&&z.saveZip(E),W.add(s)})()},{t:S}=xe.useContext(la),I=async E=>{if(r.getCurrentOptimizerCharacterModel()){const L=Kl(E.name),N=URL.createObjectURL(E);await i.loadAnimation(N,!1,0,!0,"",L),w(i.getCurrentAnimationName()),URL.revokeObjectURL(N)}else console.warn("Please load a vrm model to test animations.")},M=()=>{if(g===0)D(d[d.length-1]),p(d.length-1);else{const E=g-1;D(d[E]),p(E)}},P=()=>{if(g>=d.length-1)D(d[0]),p(0);else{const E=g+1;D(d[E]),p(E)}},D=async E=>{const R=URL.createObjectURL(E);await r.loadOptimizerCharacter(R),URL.revokeObjectURL(R);const L=Kl(E.name);h(L),u({...r.getCurrentCharacterModel()})},T=async E=>{D(E[0]);const R=[];for(let L=0;L{const R=E[0];R&&R.name.toLowerCase().endsWith(".fbx")&&I(R),R&&R.name.toLowerCase().endsWith(".vrm")&&T(E)};return Q.jsxs("div",{className:Oi.container,children:[Q.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:Q.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),Q.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),Q.jsx(S0,{onFilesDrop:y}),Q.jsx($1,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),Q.jsx(cU,{model:A,name:f,files:d,index:g,nextVrm:P,previousVrm:M}),Q.jsx(F1,{loadedAnimationName:v}),Q.jsxs("div",{className:Oi.buttonContainer,children:[Q.jsx(Un,{theme:"light",text:S("callToAction.back"),size:14,className:Oi.buttonLeft,onClick:_}),(d==null?void 0:d.length)>1!=""&&Q.jsx(Un,{theme:"light",text:"Download All",size:14,className:Oi.buttonRight,onClick:b}),A!=""&&Q.jsx(Un,{theme:"light",text:"Download",size:14,className:Oi.buttonRight,onClick:B})]})]})}const $Qe="_buttonContainer_1fd4o_1",ZQe="_buttonLeft_1fd4o_10",qQe="_buttonRight_1fd4o_14",JQe="_buttonCenter_1fd4o_18",Zy={buttonContainer:$Qe,buttonLeft:ZQe,buttonRight:qQe,buttonCenter:JQe},e5e="_button_13dfi_1",N4={button:e5e},t5e="Anon",n5e=()=>{xe.useContext(la);const[n]=q.useState(localStorage.getItem("name")||t5e),{model:e,characterManager:t}=xe.useContext(mr),r=()=>{const o=Qe.mergeOptions_sel_option||0;return{createTextureAtlas:Qe.mergeOptions_create_atlas==null?!0:Qe.mergeOptions_create_atlas,mToonAtlasSize:Dn(Qe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:Dn(Qe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:Dn(Qe.mergeOptions_atlas_std_transp_size||6),ktxCompression:Qe.merge_options_ktx_compression,exportStdAtlas:o===0||o==2,exportMtoonAtlas:o===1||o==2,twoSidedMaterial:Qe.mergeOptions_two_sided_mat||!1}},i=()=>{const o=r();t.downloadVRM(n,o)},s=()=>{const o=r();t.downloadGLB(n,o)};return Q.jsxs(q.Fragment,{children:[Q.jsx(Un,{theme:"light",text:"GLB",icon:"download",size:14,className:N4.button,onClick:()=>{s()}}),Q.jsx(Un,{theme:"light",text:"VRM",icon:"download",size:14,className:N4.button,onClick:i})]})};function r5e(){const{t:n}=xe.useContext(la),{playSound:e}=q.useContext(Mo),{isMute:t}=q.useContext(So),{setViewMode:r}=q.useContext(As),i=()=>{r(yt.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(yt.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return Q.jsxs("div",{className:Zy.container,children:[Q.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),Q.jsxs("div",{className:Zy.buttonContainer,children:[Q.jsx(S0,{onFilesDrop:o}),Q.jsx(Un,{theme:"light",text:n("callToAction.back"),size:14,className:Zy.buttonLeft,onClick:i}),Q.jsx($1,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),Q.jsx(n5e,{}),Q.jsx(Un,{theme:"light",text:"mint",size:14,className:Zy.buttonRight,onClick:s})]})]})}function i5e(){const{t:n}=xe.useContext(la),{setViewMode:e,setIsLoading:t,isLoading:r}=q.useContext(As),{playSound:i}=q.useContext(Mo),{isMute:s}=q.useContext(So),{manifest:o,characterManager:a}=q.useContext(mr);xe.useState([]);const[l,c]=xe.useState([]);xe.useEffect(()=>{A()},[]);const A=async()=>{const m=await vU();KHe(m,"the-anata-nft").then(g=>{c(g.nfts),console.log(g.nfts)})},u=()=>{e(yt.LANDING),!s&&i("backNextButton")},f=async m=>{t(!0),a.loadManifest(o[m].manifest).then(()=>{e(yt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},h=()=>{console.log("ttt"),a.loadManifest(o[0].manifest).then(()=>{a.loadAppendManifest(o[1].manifest,!0).then(()=>{console.log(a.manifestData)})})},d=()=>{!s&&i("classMouseOver")};return Q.jsxs("div",{className:`${At.container} horizontalScroll`,children:[Q.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),Q.jsx("div",{className:At.vrmOptimizerButton}),Q.jsx("div",{className:At.topLine}),Q.jsx("div",{className:At.classContainer,children:l.map((m,g)=>Q.jsxs("div",{className:At.class,onClick:()=>f(g),onMouseOver:()=>d(),children:[Q.jsx("div",{className:At.classFrame,style:{backgroundImage:`url(${m.image_url})`},children:Q.jsx("div",{className:At.frameContainer,children:Q.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:At.frame})})}),Q.jsx("div",{className:At.name,children:m.name})]},g))}),Q.jsx("div",{className:At.bottomLine}),Q.jsxs("div",{className:At.buttonContainer,children:[Q.jsx(Un,{theme:"light",text:n("callToAction.back"),size:14,className:At.buttonLeft,onClick:u}),Q.jsx(Un,{theme:"light",text:"test",size:14,className:At.buttonLeft,onClick:h})]})]})}const s5e=".//manifest.json",o5e=6,a5e=new $(0,.8,0);new $(-2.2367993753934425,1.1512971720174363,2.2612065299409223);async function l5e(n){try{const e=await fetch(n);if(!e.ok)throw new Error(`Failed to fetch manifest. Status: ${e.status}`);return await e.json()}catch(e){return console.error(`Error fetching manifest: ${e.message}`),[]}}async function c5e(){const n=await l5e(s5e),e=new Xye;return{initialManifest:n,effectManager:e}}const A5e=()=>{let n,e;const r=c5e().then(i=>{n="success",e=i},i=>{n="error",e=i});return{read(){if(n==="error")throw e;if(n==="success")return e;throw r}}},u5e=A5e();function f5e(){const{initialManifest:n,effectManager:e}=u5e.read(),[t,r]=xe.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:c,showEnvironmentModels:A}=xe.useContext(mr),{viewMode:u}=xe.useContext(As);e.camera=i,e.scene=o;const f=()=>{e.camera&&(a({targetX:0,targetY:a5e.y,targetZ:0,distance:o5e}),s&&([yt.APPEARANCE,yt.SAVE,yt.OPTIMIZER,yt.BATCHDOWNLOAD,yt.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1))},[h,d]=xe.useState(!1),[m,g]=xe.useState(""),[p,v]=xe.useState([]),w=(b,B)=>{g(b),d(!0),v([B])},_={[yt.LANDING]:Q.jsx(wQe,{}),[yt.APPEARANCE]:Q.jsx(tke,{confirmDialog:w}),[yt.OPTIMIZER]:Q.jsx(YQe,{}),[yt.CREATE]:Q.jsx(gQe,{}),[yt.WALLET]:Q.jsx(i5e,{}),[yt.CLAIM]:Q.jsx(mQe,{}),[yt.BATCHMANIFEST]:Q.jsx(ZHe,{}),[yt.BATCHDOWNLOAD]:Q.jsx(Rke,{}),[yt.LOAD]:Q.jsx(PQe,{}),[yt.MINT]:Q.jsx(XQe,{}),[yt.SAVE]:Q.jsx(r5e,{})};let x=0;return xe.useEffect(()=>{const b=B=>{const S=new Date().getTime(),I=S-x;I<300&&I>10&&B.target.id=="editor-scene"&&r(!t),x=S};return window.addEventListener("touchend",b),window.addEventListener("click",b),()=>{window.removeEventListener("touchend",b),window.removeEventListener("click",b)}},[t]),xe.useEffect(()=>{if(c!=null)return f(),c.enabled=!0,[yt.LANDING,yt.CREATE,yt.CLAIM,yt.LOAD,yt.CLAIM,yt.CLAIM].includes(u)?A(!1):A(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[u,c]),xe.useEffect(()=>{l(n)},[n]),xe.useContext(la),Q.jsxs(xe.Fragment,{children:[Q.jsx("div",{className:"generalTitle",children:"Character Studio"}),Q.jsx(fwe,{confirmDialogText:m,confirmDialogCallback:p,confirmDialogWindow:h,setConfirmDialogWindow:d}),Q.jsx(mwe,{}),_[u]]})}const h5e=n=>{const e=new mI(n);return e.pollingInterval=12e3,e};LS.createRoot(document.getElementById("root")).render(Q.jsx(q.StrictMode,{children:Q.jsx(hY,{getLibrary:h5e,children:Q.jsx(EZ,{children:Q.jsx(Sye,{children:Q.jsx(xZ,{children:Q.jsx(nve,{children:Q.jsx(eve,{children:Q.jsx(fve,{children:Q.jsx(xe.Suspense,{children:Q.jsx(f5e,{})})})})})})})})})}));export{La as c,oc as g}; diff --git a/hdr/studio_small_09_2k.hdr b/hdr/studio_small_09_2k.hdr new file mode 100644 index 00000000..2db65a80 Binary files /dev/null and b/hdr/studio_small_09_2k.hdr differ diff --git a/index.html b/index.html index 47b5e577..fc623c94 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Character Studio - +