diff --git a/assets/howler-1fccfb1e.js b/assets/howler-2ef9e2b7.js similarity index 99% rename from assets/howler-1fccfb1e.js rename to assets/howler-2ef9e2b7.js index be9624c1..4db39f05 100644 --- a/assets/howler-1fccfb1e.js +++ b/assets/howler-2ef9e2b7.js @@ -1,4 +1,4 @@ -import{g as L,c as S}from"./index-3c339844.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-fc34db10.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.3 * howlerjs.com * diff --git a/assets/index-3c339844.js b/assets/index-fc34db10.js similarity index 80% rename from assets/index-3c339844.js rename to assets/index-fc34db10.js index 3d359b2a..19f3e9fa 100644 --- a/assets/index-3c339844.js +++ b/assets/index-fc34db10.js @@ -1,4 +1,4 @@ -var Jz=Object.defineProperty;var qz=(n,e,t)=>e in n?Jz(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var L_=(n,e,t)=>(qz(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 ta=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function bl(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function eG(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 kO={exports:{}},lx={},QO={exports:{}},Rt={};/** +var Jz=Object.defineProperty;var qz=(n,e,t)=>e in n?Jz(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ms=(n,e,t)=>(qz(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 na=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bl(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}function eG(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 kO={exports:{}},Ax={},QO={exports:{}},Rt={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var Jz=Object.defineProperty;var qz=(n,e,t)=>e in n?Jz(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 sg=Symbol.for("react.element"),tG=Symbol.for("react.portal"),nG=Symbol.for("react.fragment"),rG=Symbol.for("react.strict_mode"),iG=Symbol.for("react.profiler"),sG=Symbol.for("react.provider"),oG=Symbol.for("react.context"),aG=Symbol.for("react.forward_ref"),lG=Symbol.for("react.suspense"),AG=Symbol.for("react.memo"),cG=Symbol.for("react.lazy"),R2=Symbol.iterator;function uG(n){return n===null||typeof n!="object"?null:(n=R2&&n[R2]||n["@@iterator"],typeof n=="function"?n:null)}var HO={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},zO=Object.assign,GO={};function Vh(n,e,t){this.props=n,this.context=e,this.refs=GO,this.updater=t||HO}Vh.prototype.isReactComponent={};Vh.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")};Vh.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function VO(){}VO.prototype=Vh.prototype;function BS(n,e,t){this.props=n,this.context=e,this.refs=GO,this.updater=t||HO}var ES=BS.prototype=new VO;ES.constructor=BS;zO(ES,Vh.prototype);ES.isPureReactComponent=!0;var F2=Array.isArray,jO=Object.prototype.hasOwnProperty,CS={current:null},WO={key:!0,ref:!0,__self:!0,__source:!0};function KO(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)jO.call(e,r)&&!WO.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1e in n?Jz(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 mG=ye,gG=Symbol.for("react.element"),vG=Symbol.for("react.fragment"),yG=Object.prototype.hasOwnProperty,wG=mG.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,xG={key:!0,ref:!0,__self:!0,__source:!0};function $O(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)yG.call(e,r)&&!xG.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:gG,type:n,key:s,ref:o,props:i,_owner:wG.current}}lx.Fragment=vG;lx.jsx=$O;lx.jsxs=$O;kO.exports=lx;var k=kO.exports,MS={exports:{}};const _G={},bG=Object.freeze(Object.defineProperty({__proto__:null,default:_G},Symbol.toStringTag,{value:"Module"})),BG=eG(bG);MS.exports;(function(n){(function(e,t){function r(I,v){if(!I)throw new Error(v||"Assertion failed")}function i(I,v){I.super_=v;var E=function(){};E.prototype=v.prototype,I.prototype=new E,I.prototype.constructor=I}function s(I,v,E){if(s.isBN(I))return I;this.negative=0,this.words=null,this.length=0,this.red=null,I!==null&&((v==="le"||v==="be")&&(E=v,v=10),this._init(I||0,v||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=BG.Buffer}catch{}s.isBN=function(v){return v instanceof s?!0:v!==null&&typeof v=="object"&&v.constructor.wordSize===s.wordSize&&Array.isArray(v.words)},s.max=function(v,E){return v.cmp(E)>0?v:E},s.min=function(v,E){return v.cmp(E)<0?v:E},s.prototype._init=function(v,E,U){if(typeof v=="number")return this._initNumber(v,E,U);if(typeof v=="object")return this._initArray(v,E,U);E==="hex"&&(E=16),r(E===(E|0)&&E>=2&&E<=36),v=v.toString().replace(/\s+/g,"");var P=0;v[0]==="-"&&(P++,this.negative=1),P=0;P-=3)z=v[P]|v[P-1]<<8|v[P-2]<<16,this.words[L]|=z<>>26-K&67108863,K+=24,K>=26&&(K-=26,L++);else if(U==="le")for(P=0,L=0;P>>26-K&67108863,K+=24,K>=26&&(K-=26,L++);return this._strip()};function a(I,v){var E=I.charCodeAt(v);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 "+I)}function l(I,v,E){var U=a(I,E);return E-1>=v&&(U|=a(I,E-1)<<4),U}s.prototype._parseHex=function(v,E,U){this.length=Math.ceil((v.length-E)/6),this.words=new Array(this.length);for(var P=0;P=E;P-=2)K=l(v,E,P)<=18?(L-=18,z+=1,this.words[z]|=K>>>26):L+=8;else{var O=v.length-E;for(P=O%2===0?E+1:E;P=18?(L-=18,z+=1,this.words[z]|=K>>>26):L+=8}this._strip()};function A(I,v,E,U){for(var P=0,L=0,z=Math.min(I.length,E),K=v;K=49?L=O-49+10:O>=17?L=O-17+10:L=O,r(O>=0&&L1&&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],p=[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(v,E){v=v||10,E=E|0||1;var U;if(v===16||v==="hex"){U="";for(var P=0,L=0,z=0;z>>24-P&16777215,P+=2,P>=26&&(P-=26,z--),L!==0||z!==this.length-1?U=f[6-O.length]+O+U:U=O+U}for(L!==0&&(U=L.toString(16)+U);U.length%E!==0;)U="0"+U;return this.negative!==0&&(U="-"+U),U}if(v===(v|0)&&v>=2&&v<=36){var B=h[v],W=p[v];U="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var F=ee.modrn(W).toString(v);ee=ee.idivn(W),ee.isZero()?U=F+U:U=f[B-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 v=this.words[0];return this.length===2?v+=this.words[1]*67108864:this.length===3&&this.words[2]===1?v+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-v:v},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(v,E){return this.toArrayLike(o,v,E)}),s.prototype.toArray=function(v,E){return this.toArrayLike(Array,v,E)};var d=function(v,E){return v.allocUnsafe?v.allocUnsafe(E):new v(E)};s.prototype.toArrayLike=function(v,E,U){this._strip();var P=this.byteLength(),L=U||Math.max(1,P);r(P<=L,"byte array longer than desired length"),r(L>0,"Requested array length <= 0");var z=d(v,L),K=E==="le"?"LE":"BE";return this["_toArrayLike"+K](z,P),z},s.prototype._toArrayLikeLE=function(v,E){for(var U=0,P=0,L=0,z=0;L>8&255),U>16&255),z===6?(U>24&255),P=0,z=0):(P=K>>>24,z+=2)}if(U=0&&(v[U--]=K>>8&255),U>=0&&(v[U--]=K>>16&255),z===6?(U>=0&&(v[U--]=K>>24&255),P=0,z=0):(P=K>>>24,z+=2)}if(U>=0)for(v[U--]=P;U>=0;)v[U--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var E=v,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(v){if(v===0)return 26;var E=v,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 v=this.words[this.length-1],E=this._countBits(v);return(this.length-1)*26+E};function g(I){for(var v=new Array(I.bitLength()),E=0;E>>P&1}return v}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,E=0;Ev.length?this.clone().ior(v):v.clone().ior(this)},s.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},s.prototype.iuand=function(v){var E;this.length>v.length?E=v:E=this;for(var U=0;Uv.length?this.clone().iand(v):v.clone().iand(this)},s.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},s.prototype.iuxor=function(v){var E,U;this.length>v.length?(E=this,U=v):(E=v,U=this);for(var P=0;Pv.length?this.clone().ixor(v):v.clone().ixor(this)},s.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},s.prototype.inotn=function(v){r(typeof v=="number"&&v>=0);var E=Math.ceil(v/26)|0,U=v%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(v){return this.clone().inotn(v)},s.prototype.setn=function(v,E){r(typeof v=="number"&&v>=0);var U=v/26|0,P=v%26;return this._expand(U+1),E?this.words[U]=this.words[U]|1<v.length?(U=this,P=v):(U=v,P=this);for(var L=0,z=0;z>>26;for(;L!==0&&z>>26;if(this.length=U.length,L!==0)this.words[this.length]=L,this.length++;else if(U!==this)for(;zv.length?this.clone().iadd(v):v.clone().iadd(this)},s.prototype.isub=function(v){if(v.negative!==0){v.negative=0;var E=this.iadd(v);return v.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var U=this.cmp(v);if(U===0)return this.negative=0,this.length=1,this.words[0]=0,this;var P,L;U>0?(P=this,L=v):(P=v,L=this);for(var z=0,K=0;K>26,this.words[K]=E&67108863;for(;z!==0&&K>26,this.words[K]=E&67108863;if(z===0&&K>>26,ee=O&67108863,F=Math.min(B,v.length-1),X=Math.max(0,B-I.length+1);X<=F;X++){var ue=B-X|0;P=I.words[ue]|0,L=v.words[X]|0,z=P*L+ee,W+=z/67108864|0,ee=z&67108863}E.words[B]=ee|0,O=W|0}return O!==0?E.words[B]=O|0:E.length--,E._strip()}var y=function(v,E,U){var P=v.words,L=E.words,z=U.words,K=0,O,B,W,ee=P[0]|0,F=ee&8191,X=ee>>>13,ue=P[1]|0,le=ue&8191,oe=ue>>>13,re=P[2]|0,pe=re&8191,_e=re>>>13,Re=P[3]|0,Q=Re&8191,de=Re>>>13,Ae=P[4]|0,q=Ae&8191,J=Ae>>>13,ce=P[5]|0,xe=ce&8191,be=ce>>>13,N=P[6]|0,j=N&8191,se=N>>>13,he=P[7]|0,me=he&8191,G=he>>>13,R=P[8]|0,T=R&8191,V=R>>>13,te=P[9]|0,ae=te&8191,ie=te>>>13,Te=L[0]|0,Me=Te&8191,Le=Te>>>13,ke=L[1]|0,De=ke&8191,fe=ke>>>13,Ce=L[2]|0,Se=Ce&8191,Fe=Ce>>>13,We=L[3]|0,qe=We&8191,ut=We>>>13,sn=L[4]|0,Ct=sn&8191,it=sn>>>13,ar=L[5]|0,wt=ar&8191,Yt=ar>>>13,Js=L[6]|0,Vt=Js&8191,Xt=Js>>>13,ne=L[7]|0,ge=ne&8191,Be=ne>>>13,we=L[8]|0,Ee=we&8191,ze=we>>>13,st=L[9]|0,Ze=st&8191,Je=st>>>13;U.negative=v.negative^E.negative,U.length=19,O=Math.imul(F,Me),B=Math.imul(F,Le),B=B+Math.imul(X,Me)|0,W=Math.imul(X,Le);var yt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(yt>>>26)|0,yt&=67108863,O=Math.imul(le,Me),B=Math.imul(le,Le),B=B+Math.imul(oe,Me)|0,W=Math.imul(oe,Le),O=O+Math.imul(F,De)|0,B=B+Math.imul(F,fe)|0,B=B+Math.imul(X,De)|0,W=W+Math.imul(X,fe)|0;var mt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(mt>>>26)|0,mt&=67108863,O=Math.imul(pe,Me),B=Math.imul(pe,Le),B=B+Math.imul(_e,Me)|0,W=Math.imul(_e,Le),O=O+Math.imul(le,De)|0,B=B+Math.imul(le,fe)|0,B=B+Math.imul(oe,De)|0,W=W+Math.imul(oe,fe)|0,O=O+Math.imul(F,Se)|0,B=B+Math.imul(F,Fe)|0,B=B+Math.imul(X,Se)|0,W=W+Math.imul(X,Fe)|0;var gt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(gt>>>26)|0,gt&=67108863,O=Math.imul(Q,Me),B=Math.imul(Q,Le),B=B+Math.imul(de,Me)|0,W=Math.imul(de,Le),O=O+Math.imul(pe,De)|0,B=B+Math.imul(pe,fe)|0,B=B+Math.imul(_e,De)|0,W=W+Math.imul(_e,fe)|0,O=O+Math.imul(le,Se)|0,B=B+Math.imul(le,Fe)|0,B=B+Math.imul(oe,Se)|0,W=W+Math.imul(oe,Fe)|0,O=O+Math.imul(F,qe)|0,B=B+Math.imul(F,ut)|0,B=B+Math.imul(X,qe)|0,W=W+Math.imul(X,ut)|0;var Zt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,O=Math.imul(q,Me),B=Math.imul(q,Le),B=B+Math.imul(J,Me)|0,W=Math.imul(J,Le),O=O+Math.imul(Q,De)|0,B=B+Math.imul(Q,fe)|0,B=B+Math.imul(de,De)|0,W=W+Math.imul(de,fe)|0,O=O+Math.imul(pe,Se)|0,B=B+Math.imul(pe,Fe)|0,B=B+Math.imul(_e,Se)|0,W=W+Math.imul(_e,Fe)|0,O=O+Math.imul(le,qe)|0,B=B+Math.imul(le,ut)|0,B=B+Math.imul(oe,qe)|0,W=W+Math.imul(oe,ut)|0,O=O+Math.imul(F,Ct)|0,B=B+Math.imul(F,it)|0,B=B+Math.imul(X,Ct)|0,W=W+Math.imul(X,it)|0;var Rn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,O=Math.imul(xe,Me),B=Math.imul(xe,Le),B=B+Math.imul(be,Me)|0,W=Math.imul(be,Le),O=O+Math.imul(q,De)|0,B=B+Math.imul(q,fe)|0,B=B+Math.imul(J,De)|0,W=W+Math.imul(J,fe)|0,O=O+Math.imul(Q,Se)|0,B=B+Math.imul(Q,Fe)|0,B=B+Math.imul(de,Se)|0,W=W+Math.imul(de,Fe)|0,O=O+Math.imul(pe,qe)|0,B=B+Math.imul(pe,ut)|0,B=B+Math.imul(_e,qe)|0,W=W+Math.imul(_e,ut)|0,O=O+Math.imul(le,Ct)|0,B=B+Math.imul(le,it)|0,B=B+Math.imul(oe,Ct)|0,W=W+Math.imul(oe,it)|0,O=O+Math.imul(F,wt)|0,B=B+Math.imul(F,Yt)|0,B=B+Math.imul(X,wt)|0,W=W+Math.imul(X,Yt)|0;var Di=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Di>>>26)|0,Di&=67108863,O=Math.imul(j,Me),B=Math.imul(j,Le),B=B+Math.imul(se,Me)|0,W=Math.imul(se,Le),O=O+Math.imul(xe,De)|0,B=B+Math.imul(xe,fe)|0,B=B+Math.imul(be,De)|0,W=W+Math.imul(be,fe)|0,O=O+Math.imul(q,Se)|0,B=B+Math.imul(q,Fe)|0,B=B+Math.imul(J,Se)|0,W=W+Math.imul(J,Fe)|0,O=O+Math.imul(Q,qe)|0,B=B+Math.imul(Q,ut)|0,B=B+Math.imul(de,qe)|0,W=W+Math.imul(de,ut)|0,O=O+Math.imul(pe,Ct)|0,B=B+Math.imul(pe,it)|0,B=B+Math.imul(_e,Ct)|0,W=W+Math.imul(_e,it)|0,O=O+Math.imul(le,wt)|0,B=B+Math.imul(le,Yt)|0,B=B+Math.imul(oe,wt)|0,W=W+Math.imul(oe,Yt)|0,O=O+Math.imul(F,Vt)|0,B=B+Math.imul(F,Xt)|0,B=B+Math.imul(X,Vt)|0,W=W+Math.imul(X,Xt)|0;var qs=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(qs>>>26)|0,qs&=67108863,O=Math.imul(me,Me),B=Math.imul(me,Le),B=B+Math.imul(G,Me)|0,W=Math.imul(G,Le),O=O+Math.imul(j,De)|0,B=B+Math.imul(j,fe)|0,B=B+Math.imul(se,De)|0,W=W+Math.imul(se,fe)|0,O=O+Math.imul(xe,Se)|0,B=B+Math.imul(xe,Fe)|0,B=B+Math.imul(be,Se)|0,W=W+Math.imul(be,Fe)|0,O=O+Math.imul(q,qe)|0,B=B+Math.imul(q,ut)|0,B=B+Math.imul(J,qe)|0,W=W+Math.imul(J,ut)|0,O=O+Math.imul(Q,Ct)|0,B=B+Math.imul(Q,it)|0,B=B+Math.imul(de,Ct)|0,W=W+Math.imul(de,it)|0,O=O+Math.imul(pe,wt)|0,B=B+Math.imul(pe,Yt)|0,B=B+Math.imul(_e,wt)|0,W=W+Math.imul(_e,Yt)|0,O=O+Math.imul(le,Vt)|0,B=B+Math.imul(le,Xt)|0,B=B+Math.imul(oe,Vt)|0,W=W+Math.imul(oe,Xt)|0,O=O+Math.imul(F,ge)|0,B=B+Math.imul(F,Be)|0,B=B+Math.imul(X,ge)|0,W=W+Math.imul(X,Be)|0;var pn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(pn>>>26)|0,pn&=67108863,O=Math.imul(T,Me),B=Math.imul(T,Le),B=B+Math.imul(V,Me)|0,W=Math.imul(V,Le),O=O+Math.imul(me,De)|0,B=B+Math.imul(me,fe)|0,B=B+Math.imul(G,De)|0,W=W+Math.imul(G,fe)|0,O=O+Math.imul(j,Se)|0,B=B+Math.imul(j,Fe)|0,B=B+Math.imul(se,Se)|0,W=W+Math.imul(se,Fe)|0,O=O+Math.imul(xe,qe)|0,B=B+Math.imul(xe,ut)|0,B=B+Math.imul(be,qe)|0,W=W+Math.imul(be,ut)|0,O=O+Math.imul(q,Ct)|0,B=B+Math.imul(q,it)|0,B=B+Math.imul(J,Ct)|0,W=W+Math.imul(J,it)|0,O=O+Math.imul(Q,wt)|0,B=B+Math.imul(Q,Yt)|0,B=B+Math.imul(de,wt)|0,W=W+Math.imul(de,Yt)|0,O=O+Math.imul(pe,Vt)|0,B=B+Math.imul(pe,Xt)|0,B=B+Math.imul(_e,Vt)|0,W=W+Math.imul(_e,Xt)|0,O=O+Math.imul(le,ge)|0,B=B+Math.imul(le,Be)|0,B=B+Math.imul(oe,ge)|0,W=W+Math.imul(oe,Be)|0,O=O+Math.imul(F,Ee)|0,B=B+Math.imul(F,ze)|0,B=B+Math.imul(X,Ee)|0,W=W+Math.imul(X,ze)|0;var bt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(bt>>>26)|0,bt&=67108863,O=Math.imul(ae,Me),B=Math.imul(ae,Le),B=B+Math.imul(ie,Me)|0,W=Math.imul(ie,Le),O=O+Math.imul(T,De)|0,B=B+Math.imul(T,fe)|0,B=B+Math.imul(V,De)|0,W=W+Math.imul(V,fe)|0,O=O+Math.imul(me,Se)|0,B=B+Math.imul(me,Fe)|0,B=B+Math.imul(G,Se)|0,W=W+Math.imul(G,Fe)|0,O=O+Math.imul(j,qe)|0,B=B+Math.imul(j,ut)|0,B=B+Math.imul(se,qe)|0,W=W+Math.imul(se,ut)|0,O=O+Math.imul(xe,Ct)|0,B=B+Math.imul(xe,it)|0,B=B+Math.imul(be,Ct)|0,W=W+Math.imul(be,it)|0,O=O+Math.imul(q,wt)|0,B=B+Math.imul(q,Yt)|0,B=B+Math.imul(J,wt)|0,W=W+Math.imul(J,Yt)|0,O=O+Math.imul(Q,Vt)|0,B=B+Math.imul(Q,Xt)|0,B=B+Math.imul(de,Vt)|0,W=W+Math.imul(de,Xt)|0,O=O+Math.imul(pe,ge)|0,B=B+Math.imul(pe,Be)|0,B=B+Math.imul(_e,ge)|0,W=W+Math.imul(_e,Be)|0,O=O+Math.imul(le,Ee)|0,B=B+Math.imul(le,ze)|0,B=B+Math.imul(oe,Ee)|0,W=W+Math.imul(oe,ze)|0,O=O+Math.imul(F,Ze)|0,B=B+Math.imul(F,Je)|0,B=B+Math.imul(X,Ze)|0,W=W+Math.imul(X,Je)|0;var JA=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(JA>>>26)|0,JA&=67108863,O=Math.imul(ae,De),B=Math.imul(ae,fe),B=B+Math.imul(ie,De)|0,W=Math.imul(ie,fe),O=O+Math.imul(T,Se)|0,B=B+Math.imul(T,Fe)|0,B=B+Math.imul(V,Se)|0,W=W+Math.imul(V,Fe)|0,O=O+Math.imul(me,qe)|0,B=B+Math.imul(me,ut)|0,B=B+Math.imul(G,qe)|0,W=W+Math.imul(G,ut)|0,O=O+Math.imul(j,Ct)|0,B=B+Math.imul(j,it)|0,B=B+Math.imul(se,Ct)|0,W=W+Math.imul(se,it)|0,O=O+Math.imul(xe,wt)|0,B=B+Math.imul(xe,Yt)|0,B=B+Math.imul(be,wt)|0,W=W+Math.imul(be,Yt)|0,O=O+Math.imul(q,Vt)|0,B=B+Math.imul(q,Xt)|0,B=B+Math.imul(J,Vt)|0,W=W+Math.imul(J,Xt)|0,O=O+Math.imul(Q,ge)|0,B=B+Math.imul(Q,Be)|0,B=B+Math.imul(de,ge)|0,W=W+Math.imul(de,Be)|0,O=O+Math.imul(pe,Ee)|0,B=B+Math.imul(pe,ze)|0,B=B+Math.imul(_e,Ee)|0,W=W+Math.imul(_e,ze)|0,O=O+Math.imul(le,Ze)|0,B=B+Math.imul(le,Je)|0,B=B+Math.imul(oe,Ze)|0,W=W+Math.imul(oe,Je)|0;var Fn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,O=Math.imul(ae,Se),B=Math.imul(ae,Fe),B=B+Math.imul(ie,Se)|0,W=Math.imul(ie,Fe),O=O+Math.imul(T,qe)|0,B=B+Math.imul(T,ut)|0,B=B+Math.imul(V,qe)|0,W=W+Math.imul(V,ut)|0,O=O+Math.imul(me,Ct)|0,B=B+Math.imul(me,it)|0,B=B+Math.imul(G,Ct)|0,W=W+Math.imul(G,it)|0,O=O+Math.imul(j,wt)|0,B=B+Math.imul(j,Yt)|0,B=B+Math.imul(se,wt)|0,W=W+Math.imul(se,Yt)|0,O=O+Math.imul(xe,Vt)|0,B=B+Math.imul(xe,Xt)|0,B=B+Math.imul(be,Vt)|0,W=W+Math.imul(be,Xt)|0,O=O+Math.imul(q,ge)|0,B=B+Math.imul(q,Be)|0,B=B+Math.imul(J,ge)|0,W=W+Math.imul(J,Be)|0,O=O+Math.imul(Q,Ee)|0,B=B+Math.imul(Q,ze)|0,B=B+Math.imul(de,Ee)|0,W=W+Math.imul(de,ze)|0,O=O+Math.imul(pe,Ze)|0,B=B+Math.imul(pe,Je)|0,B=B+Math.imul(_e,Ze)|0,W=W+Math.imul(_e,Je)|0;var eo=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(eo>>>26)|0,eo&=67108863,O=Math.imul(ae,qe),B=Math.imul(ae,ut),B=B+Math.imul(ie,qe)|0,W=Math.imul(ie,ut),O=O+Math.imul(T,Ct)|0,B=B+Math.imul(T,it)|0,B=B+Math.imul(V,Ct)|0,W=W+Math.imul(V,it)|0,O=O+Math.imul(me,wt)|0,B=B+Math.imul(me,Yt)|0,B=B+Math.imul(G,wt)|0,W=W+Math.imul(G,Yt)|0,O=O+Math.imul(j,Vt)|0,B=B+Math.imul(j,Xt)|0,B=B+Math.imul(se,Vt)|0,W=W+Math.imul(se,Xt)|0,O=O+Math.imul(xe,ge)|0,B=B+Math.imul(xe,Be)|0,B=B+Math.imul(be,ge)|0,W=W+Math.imul(be,Be)|0,O=O+Math.imul(q,Ee)|0,B=B+Math.imul(q,ze)|0,B=B+Math.imul(J,Ee)|0,W=W+Math.imul(J,ze)|0,O=O+Math.imul(Q,Ze)|0,B=B+Math.imul(Q,Je)|0,B=B+Math.imul(de,Ze)|0,W=W+Math.imul(de,Je)|0;var mu=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(mu>>>26)|0,mu&=67108863,O=Math.imul(ae,Ct),B=Math.imul(ae,it),B=B+Math.imul(ie,Ct)|0,W=Math.imul(ie,it),O=O+Math.imul(T,wt)|0,B=B+Math.imul(T,Yt)|0,B=B+Math.imul(V,wt)|0,W=W+Math.imul(V,Yt)|0,O=O+Math.imul(me,Vt)|0,B=B+Math.imul(me,Xt)|0,B=B+Math.imul(G,Vt)|0,W=W+Math.imul(G,Xt)|0,O=O+Math.imul(j,ge)|0,B=B+Math.imul(j,Be)|0,B=B+Math.imul(se,ge)|0,W=W+Math.imul(se,Be)|0,O=O+Math.imul(xe,Ee)|0,B=B+Math.imul(xe,ze)|0,B=B+Math.imul(be,Ee)|0,W=W+Math.imul(be,ze)|0,O=O+Math.imul(q,Ze)|0,B=B+Math.imul(q,Je)|0,B=B+Math.imul(J,Ze)|0,W=W+Math.imul(J,Je)|0;var Ma=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Ma>>>26)|0,Ma&=67108863,O=Math.imul(ae,wt),B=Math.imul(ae,Yt),B=B+Math.imul(ie,wt)|0,W=Math.imul(ie,Yt),O=O+Math.imul(T,Vt)|0,B=B+Math.imul(T,Xt)|0,B=B+Math.imul(V,Vt)|0,W=W+Math.imul(V,Xt)|0,O=O+Math.imul(me,ge)|0,B=B+Math.imul(me,Be)|0,B=B+Math.imul(G,ge)|0,W=W+Math.imul(G,Be)|0,O=O+Math.imul(j,Ee)|0,B=B+Math.imul(j,ze)|0,B=B+Math.imul(se,Ee)|0,W=W+Math.imul(se,ze)|0,O=O+Math.imul(xe,Ze)|0,B=B+Math.imul(xe,Je)|0,B=B+Math.imul(be,Ze)|0,W=W+Math.imul(be,Je)|0;var qA=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(qA>>>26)|0,qA&=67108863,O=Math.imul(ae,Vt),B=Math.imul(ae,Xt),B=B+Math.imul(ie,Vt)|0,W=Math.imul(ie,Xt),O=O+Math.imul(T,ge)|0,B=B+Math.imul(T,Be)|0,B=B+Math.imul(V,ge)|0,W=W+Math.imul(V,Be)|0,O=O+Math.imul(me,Ee)|0,B=B+Math.imul(me,ze)|0,B=B+Math.imul(G,Ee)|0,W=W+Math.imul(G,ze)|0,O=O+Math.imul(j,Ze)|0,B=B+Math.imul(j,Je)|0,B=B+Math.imul(se,Ze)|0,W=W+Math.imul(se,Je)|0;var lr=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(lr>>>26)|0,lr&=67108863,O=Math.imul(ae,ge),B=Math.imul(ae,Be),B=B+Math.imul(ie,ge)|0,W=Math.imul(ie,Be),O=O+Math.imul(T,Ee)|0,B=B+Math.imul(T,ze)|0,B=B+Math.imul(V,Ee)|0,W=W+Math.imul(V,ze)|0,O=O+Math.imul(me,Ze)|0,B=B+Math.imul(me,Je)|0,B=B+Math.imul(G,Ze)|0,W=W+Math.imul(G,Je)|0;var to=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(to>>>26)|0,to&=67108863,O=Math.imul(ae,Ee),B=Math.imul(ae,ze),B=B+Math.imul(ie,Ee)|0,W=Math.imul(ie,ze),O=O+Math.imul(T,Ze)|0,B=B+Math.imul(T,Je)|0,B=B+Math.imul(V,Ze)|0,W=W+Math.imul(V,Je)|0;var ec=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(ec>>>26)|0,ec&=67108863,O=Math.imul(ae,Ze),B=Math.imul(ae,Je),B=B+Math.imul(ie,Ze)|0,W=Math.imul(ie,Je);var Mr=(K+O|0)+((B&8191)<<13)|0;return K=(W+(B>>>13)|0)+(Mr>>>26)|0,Mr&=67108863,z[0]=yt,z[1]=mt,z[2]=gt,z[3]=Zt,z[4]=Rn,z[5]=Di,z[6]=qs,z[7]=pn,z[8]=bt,z[9]=JA,z[10]=Fn,z[11]=eo,z[12]=mu,z[13]=Ma,z[14]=qA,z[15]=lr,z[16]=to,z[17]=ec,z[18]=Mr,K!==0&&(z[19]=K,U.length++),U};Math.imul||(y=m);function w(I,v,E){E.negative=v.negative^I.negative,E.length=I.length+v.length;for(var U=0,P=0,L=0;L>>26)|0,P+=z>>>26,z&=67108863}E.words[L]=K,U=z,z=P}return U!==0?E.words[L]=U:E.length--,E._strip()}function x(I,v,E){return w(I,v,E)}s.prototype.mulTo=function(v,E){var U,P=this.length+v.length;return this.length===10&&v.length===10?U=y(this,v,E):P<63?U=m(this,v,E):P<1024?U=w(this,v,E):U=x(this,v,E),U},s.prototype.mul=function(v){var E=new s(null);return E.words=new Array(this.length+v.length),this.mulTo(v,E)},s.prototype.mulf=function(v){var E=new s(null);return E.words=new Array(this.length+v.length),x(this,v,E)},s.prototype.imul=function(v){return this.clone().mulTo(v,this)},s.prototype.imuln=function(v){var E=v<0;E&&(v=-v),r(typeof v=="number"),r(v<67108864);for(var U=0,P=0;P>=26,U+=L/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(v){return this.clone().imuln(v)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(v){var E=g(v);if(E.length===0)return new s(1);for(var U=this,P=0;P=0);var E=v%26,U=(v-E)/26,P=67108863>>>26-E<<26-E,L;if(E!==0){var z=0;for(L=0;L>>26-E}z&&(this.words[L]=z,this.length++)}if(U!==0){for(L=this.length-1;L>=0;L--)this.words[L+U]=this.words[L];for(L=0;L=0);var P;E?P=(E-E%26)/26:P=0;var L=v%26,z=Math.min((v-L)/26,this.length),K=67108863^67108863>>>L<z)for(this.length-=z,B=0;B=0&&(W!==0||B>=P);B--){var ee=this.words[B]|0;this.words[B]=W<<26-L|ee>>>L,W=ee&K}return O&&W!==0&&(O.words[O.length++]=W),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,E,U){return r(this.negative===0),this.iushrn(v,E,U)},s.prototype.shln=function(v){return this.clone().ishln(v)},s.prototype.ushln=function(v){return this.clone().iushln(v)},s.prototype.shrn=function(v){return this.clone().ishrn(v)},s.prototype.ushrn=function(v){return this.clone().iushrn(v)},s.prototype.testn=function(v){r(typeof v=="number"&&v>=0);var E=v%26,U=(v-E)/26,P=1<=0);var E=v%26,U=(v-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(v){if(r(typeof v=="number"),r(v<67108864),v<0)return this.iaddn(-v);if(this.negative!==0)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var E=0;E>26)-(O/67108864|0),this.words[L+U]=z&67108863}for(;L>26,this.words[L+U]=z&67108863;if(K===0)return this._strip();for(r(K===-1),K=0,L=0;L>26,this.words[L]=z&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,E){var U=this.length-v.length,P=this.clone(),L=v,z=L.words[L.length-1]|0,K=this._countBits(z);U=26-K,U!==0&&(L=L.ushln(U),P.iushln(U),z=L.words[L.length-1]|0);var O=P.length-L.length,B;if(E!=="mod"){B=new s(null),B.length=O+1,B.words=new Array(B.length);for(var W=0;W=0;F--){var X=(P.words[L.length+F]|0)*67108864+(P.words[L.length+F-1]|0);for(X=Math.min(X/z|0,67108863),P._ishlnsubmul(L,X,F);P.negative!==0;)X--,P.negative=0,P._ishlnsubmul(L,1,F),P.isZero()||(P.negative^=1);B&&(B.words[F]=X)}return B&&B._strip(),P._strip(),E!=="div"&&U!==0&&P.iushrn(U),{div:B||null,mod:P}},s.prototype.divmod=function(v,E,U){if(r(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var P,L,z;return this.negative!==0&&v.negative===0?(z=this.neg().divmod(v,E),E!=="mod"&&(P=z.div.neg()),E!=="div"&&(L=z.mod.neg(),U&&L.negative!==0&&L.iadd(v)),{div:P,mod:L}):this.negative===0&&v.negative!==0?(z=this.divmod(v.neg(),E),E!=="mod"&&(P=z.div.neg()),{div:P,mod:z.mod}):this.negative&v.negative?(z=this.neg().divmod(v.neg(),E),E!=="div"&&(L=z.mod.neg(),U&&L.negative!==0&&L.isub(v)),{div:z.div,mod:L}):v.length>this.length||this.cmp(v)<0?{div:new s(0),mod:this}:v.length===1?E==="div"?{div:this.divn(v.words[0]),mod:null}:E==="mod"?{div:null,mod:new s(this.modrn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new s(this.modrn(v.words[0]))}:this._wordDiv(v,E)},s.prototype.div=function(v){return this.divmod(v,"div",!1).div},s.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},s.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},s.prototype.divRound=function(v){var E=this.divmod(v);if(E.mod.isZero())return E.div;var U=E.div.negative!==0?E.mod.isub(v):E.mod,P=v.ushrn(1),L=v.andln(1),z=U.cmp(P);return z<0||L===1&&z===0?E.div:E.div.negative!==0?E.div.isubn(1):E.div.iaddn(1)},s.prototype.modrn=function(v){var E=v<0;E&&(v=-v),r(v<=67108863);for(var U=(1<<26)%v,P=0,L=this.length-1;L>=0;L--)P=(U*P+(this.words[L]|0))%v;return E?-P:P},s.prototype.modn=function(v){return this.modrn(v)},s.prototype.idivn=function(v){var E=v<0;E&&(v=-v),r(v<=67108863);for(var U=0,P=this.length-1;P>=0;P--){var L=(this.words[P]|0)+U*67108864;this.words[P]=L/v|0,U=L%v}return this._strip(),E?this.ineg():this},s.prototype.divn=function(v){return this.clone().idivn(v)},s.prototype.egcd=function(v){r(v.negative===0),r(!v.isZero());var E=this,U=v.clone();E.negative!==0?E=E.umod(v):E=E.clone();for(var P=new s(1),L=new s(0),z=new s(0),K=new s(1),O=0;E.isEven()&&U.isEven();)E.iushrn(1),U.iushrn(1),++O;for(var B=U.clone(),W=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;)(P.isOdd()||L.isOdd())&&(P.iadd(B),L.isub(W)),P.iushrn(1),L.iushrn(1);for(var X=0,ue=1;!(U.words[0]&ue)&&X<26;++X,ue<<=1);if(X>0)for(U.iushrn(X);X-- >0;)(z.isOdd()||K.isOdd())&&(z.iadd(B),K.isub(W)),z.iushrn(1),K.iushrn(1);E.cmp(U)>=0?(E.isub(U),P.isub(z),L.isub(K)):(U.isub(E),z.isub(P),K.isub(L))}return{a:z,b:K,gcd:U.iushln(O)}},s.prototype._invmp=function(v){r(v.negative===0),r(!v.isZero());var E=this,U=v.clone();E.negative!==0?E=E.umod(v):E=E.clone();for(var P=new s(1),L=new s(0),z=U.clone();E.cmpn(1)>0&&U.cmpn(1)>0;){for(var K=0,O=1;!(E.words[0]&O)&&K<26;++K,O<<=1);if(K>0)for(E.iushrn(K);K-- >0;)P.isOdd()&&P.iadd(z),P.iushrn(1);for(var B=0,W=1;!(U.words[0]&W)&&B<26;++B,W<<=1);if(B>0)for(U.iushrn(B);B-- >0;)L.isOdd()&&L.iadd(z),L.iushrn(1);E.cmp(U)>=0?(E.isub(U),P.isub(L)):(U.isub(E),L.isub(P))}var ee;return E.cmpn(1)===0?ee=P:ee=L,ee.cmpn(0)<0&&ee.iadd(v),ee},s.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var E=this.clone(),U=v.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 L=E.cmp(U);if(L<0){var z=E;E=U,U=z}else if(L===0||U.cmpn(1)===0)break;E.isub(U)}while(!0);return U.iushln(P)},s.prototype.invm=function(v){return this.egcd(v).a.umod(v)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(v){return this.words[0]&v},s.prototype.bincn=function(v){r(typeof v=="number");var E=v%26,U=(v-E)/26,P=1<>>26,K&=67108863,this.words[z]=K}return L!==0&&(this.words[z]=L,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(v){var E=v<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&&(v=-v),r(v<=67108863,"Number is too big");var P=this.words[0]|0;U=P===v?0:Pv.length)return 1;if(this.length=0;U--){var P=this.words[U]|0,L=v.words[U]|0;if(P!==L){PL&&(E=1);break}}return E},s.prototype.gtn=function(v){return this.cmpn(v)===1},s.prototype.gt=function(v){return this.cmp(v)===1},s.prototype.gten=function(v){return this.cmpn(v)>=0},s.prototype.gte=function(v){return this.cmp(v)>=0},s.prototype.ltn=function(v){return this.cmpn(v)===-1},s.prototype.lt=function(v){return this.cmp(v)===-1},s.prototype.lten=function(v){return this.cmpn(v)<=0},s.prototype.lte=function(v){return this.cmp(v)<=0},s.prototype.eqn=function(v){return this.cmpn(v)===0},s.prototype.eq=function(v){return this.cmp(v)===0},s.red=function(v){return new $(v)},s.prototype.toRed=function(v){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),v.convertTo(this)._forceRed(v)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(v){return this.red=v,this},s.prototype.forceRed=function(v){return r(!this.red,"Already a number in reduction context"),this._forceRed(v)},s.prototype.redAdd=function(v){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},s.prototype.redIAdd=function(v){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},s.prototype.redSub=function(v){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},s.prototype.redISub=function(v){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},s.prototype.redShl=function(v){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},s.prototype.redMul=function(v){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},s.prototype.redIMul=function(v){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},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(v){return r(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var _={k256:null,p224:null,p192:null,p25519:null};function C(I,v){this.name=I,this.p=new s(v,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}C.prototype._tmp=function(){var v=new s(null);return v.words=new Array(Math.ceil(this.n/13)),v},C.prototype.ireduce=function(v){var E=v,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},C.prototype.split=function(v,E){v.iushrn(this.n,0,E)},C.prototype.imulK=function(v){return v.imul(this.k)};function S(){C.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(S,C),S.prototype.split=function(v,E){for(var U=4194303,P=Math.min(v.length,9),L=0;L>>22,z=K}z>>>=22,v.words[L-10]=z,z===0&&v.length>10?v.length-=10:v.length-=9},S.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var E=0,U=0;U>>=26,v.words[U]=L,E=P}return E!==0&&(v.words[v.length++]=E),v},s._prime=function(v){if(_[v])return _[v];var E;if(v==="k256")E=new S;else if(v==="p224")E=new b;else if(v==="p192")E=new M;else if(v==="p25519")E=new D;else throw new Error("Unknown prime "+v);return _[v]=E,E};function $(I){if(typeof I=="string"){var v=s._prime(I);this.m=v.p,this.prime=v}else r(I.gtn(1),"modulus must be greater than 1"),this.m=I,this.prime=null}$.prototype._verify1=function(v){r(v.negative===0,"red works only with positives"),r(v.red,"red works only with red numbers")},$.prototype._verify2=function(v,E){r((v.negative|E.negative)===0,"red works only with positives"),r(v.red&&v.red===E.red,"red works only with red numbers")},$.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(c(v,v.umod(this.m)._forceRed(this)),v)},$.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},$.prototype.add=function(v,E){this._verify2(v,E);var U=v.add(E);return U.cmp(this.m)>=0&&U.isub(this.m),U._forceRed(this)},$.prototype.iadd=function(v,E){this._verify2(v,E);var U=v.iadd(E);return U.cmp(this.m)>=0&&U.isub(this.m),U},$.prototype.sub=function(v,E){this._verify2(v,E);var U=v.sub(E);return U.cmpn(0)<0&&U.iadd(this.m),U._forceRed(this)},$.prototype.isub=function(v,E){this._verify2(v,E);var U=v.isub(E);return U.cmpn(0)<0&&U.iadd(this.m),U},$.prototype.shl=function(v,E){return this._verify1(v),this.imod(v.ushln(E))},$.prototype.imul=function(v,E){return this._verify2(v,E),this.imod(v.imul(E))},$.prototype.mul=function(v,E){return this._verify2(v,E),this.imod(v.mul(E))},$.prototype.isqr=function(v){return this.imul(v,v.clone())},$.prototype.sqr=function(v){return this.mul(v,v)},$.prototype.sqrt=function(v){if(v.isZero())return v.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(v,U)}for(var P=this.m.subn(1),L=0;!P.isZero()&&P.andln(1)===0;)L++,P.iushrn(1);r(!P.isZero());var z=new s(1).toRed(this),K=z.redNeg(),O=this.m.subn(1).iushrn(1),B=this.m.bitLength();for(B=new s(2*B*B).toRed(this);this.pow(B,O).cmp(K)!==0;)B.redIAdd(K);for(var W=this.pow(B,P),ee=this.pow(v,P.addn(1).iushrn(1)),F=this.pow(v,P),X=L;F.cmp(z)!==0;){for(var ue=F,le=0;ue.cmp(z)!==0;le++)ue=ue.redSqr();r(le=0;L--){for(var W=E.words[L],ee=B-1;ee>=0;ee--){var F=W>>ee&1;if(z!==P[0]&&(z=this.sqr(z)),F===0&&K===0){O=0;continue}K<<=1,K|=F,O++,!(O!==U&&(L!==0||ee!==0))&&(z=this.mul(z,P[K]),O=0,K=0)}B=26}return z},$.prototype.convertTo=function(v){var E=v.umod(this.m);return E===v?E.clone():E},$.prototype.convertFrom=function(v){var E=v.clone();return E.red=null,E},s.mont=function(v){return new H(v)};function H(I){$.call(this,I),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(H,$),H.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},H.prototype.convertFrom=function(v){var E=this.imod(v.mul(this.rinv));return E.red=null,E},H.prototype.imul=function(v,E){if(v.isZero()||E.isZero())return v.words[0]=0,v.length=1,v;var U=v.imul(E),P=U.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=U.isub(P).iushrn(this.shift),z=L;return L.cmp(this.m)>=0?z=L.isub(this.m):L.cmpn(0)<0&&(z=L.iadd(this.m)),z._forceRed(this)},H.prototype.mul=function(v,E){if(v.isZero()||E.isZero())return new s(0)._forceRed(this);var U=v.mul(E),P=U.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=U.isub(P).iushrn(this.shift),z=L;return L.cmp(this.m)>=0?z=L.isub(this.m):L.cmpn(0)<0&&(z=L.iadd(this.m)),z._forceRed(this)},H.prototype.invm=function(v){var E=this.imod(v._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(n,ta)})(MS);var EG=MS.exports;const vt=bl(EG),CG="logger/5.7.0";let L2=!1,P2=!1;const kv={debug:1,default:2,info:2,warning:3,error:4,off:5};let D2=kv.default,D_=null;function SG(){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 O2=SG();var OB;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(OB||(OB={}));var po;(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"})(po||(po={}));const N2="0123456789abcdef";let ve=class cr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();kv[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(D2>kv[r])&&console.log.apply(console,t)}debug(...e){this._log(cr.levels.DEBUG,e)}info(...e){this._log(cr.levels.INFO,e)}warn(...e){this._log(cr.levels.WARNING,e)}makeError(e,t,r){if(P2)return this.makeError("censored error",t,{});t||(t=cr.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(l=>{const A=r[l];try{if(A instanceof Uint8Array){let c="";for(let u=0;u>4],c+=N2[A[u]&15];i.push(l+"=Uint8Array(0x"+c+")")}else i.push(l+"="+JSON.stringify(A))}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 po.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 po.CALL_EXCEPTION:case po.INSUFFICIENT_FUNDS:case po.MISSING_NEW:case po.NONCE_EXPIRED:case po.REPLACEMENT_UNDERPRICED:case po.TRANSACTION_REPLACED:case po.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,cr.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){O2&&this.throwError("platform missing String.prototype.normalize",cr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:O2})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,cr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,cr.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,cr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",cr.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",cr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",cr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return D_||(D_=new cr(CG)),D_}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",cr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),L2){if(!e)return;this.globalLogger().throwError("error censorship permanent",cr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}P2=!!e,L2=!!t}static setLogLevel(e){const t=kv[e.toLowerCase()];if(t==null){cr.globalLogger().warn("invalid log level - "+e);return}D2=t}static from(e){return new cr(e)}};ve.errors=po;ve.levels=OB;const MG="bytes/5.7.0",Pn=new ve(MG);function YO(n){return!!n.toHexString}function Xf(n){return n.slice||(n.slice=function(){const e=Array.prototype.slice.call(arguments);return Xf(new Uint8Array(Array.prototype.slice.apply(n,e)))}),n}function TS(n){return Et(n)&&!(n.length%2)||Ax(n)}function k2(n){return typeof n=="number"&&n==n&&n%1===0}function Ax(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!k2(n.length)||n.length<0)return!1;for(let e=0;e=256)return!1}return!0}function at(n,e){if(e||(e={}),typeof n=="number"){Pn.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),Xf(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),YO(n)&&(n=n.toHexString()),Et(n)){let t=n.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Pn.throwArgumentError("hex data is odd-length","value",n));const r=[];for(let i=0;iat(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),Xf(r)}function mh(n){let e=at(n);if(e.length===0)return e;let t=0;for(;te&&Pn.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(n,e-n.length),Xf(t)}function Et(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||e&&n.length!==2+2*e)}const O_="0123456789abcdef";function nt(n,e){if(e||(e={}),typeof n=="number"){Pn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=O_[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),YO(n))return n.toHexString();if(Et(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Pn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(Ax(n)){let t="0x";for(let r=0;r>4]+O_[i&15]}return t}return Pn.throwArgumentError("invalid hexlify value","value",n)}function kc(n){if(typeof n!="string")n=nt(n);else if(!Et(n)||n.length%2)return null;return(n.length-2)/2}function zr(n,e,t){return typeof n!="string"?n=nt(n):(!Et(n)||n.length%2)&&Pn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function _i(n){let e="0x";return n.forEach(t=>{e+=nt(t).substring(2)}),e}function cx(n){const e=IG(nt(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function IG(n){typeof n!="string"&&(n=nt(n)),Et(n)||Pn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Pn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function ux(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(TS(n)){let t=at(n);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=nt(t.slice(0,32)),e.s=nt(t.slice(32,64))):t.length===65?(e.r=nt(t.slice(0,32)),e.s=nt(t.slice(32,64)),e.v=t[64]):Pn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Pn.throwArgumentError("signature invalid v byte","signature",n)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=nt(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=TG(at(e._vs),32);e._vs=nt(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Pn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=nt(i);e.s==null?e.s=o:e.s!==o&&Pn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Pn.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&&Pn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!Et(e.r)?Pn.throwArgumentError("signature missing or invalid r","signature",n):e.r=kn(e.r,32),e.s==null||!Et(e.s)?Pn.throwArgumentError("signature missing or invalid s","signature",n):e.s=kn(e.s,32);const t=at(e.s);t[0]>=128&&Pn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=nt(t);e._vs&&(Et(e._vs)||Pn.throwArgumentError("signature invalid _vs","signature",n),e._vs=kn(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Pn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const RG="bignumber/5.7.0";var Sy=vt.BN;const ja=new ve(RG),N_={},Q2=9007199254740991;let H2=!1;class Ge{constructor(e,t){e!==N_&&ja.throwError("cannot call constructor directly; use BigNumber.from",ve.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return mi(Mt(this).fromTwos(e))}toTwos(e){return mi(Mt(this).toTwos(e))}abs(){return this._hex[0]==="-"?Ge.from(this._hex.substring(1)):this}add(e){return mi(Mt(this).add(Mt(e)))}sub(e){return mi(Mt(this).sub(Mt(e)))}div(e){return Ge.from(e).isZero()&&ms("division-by-zero","div"),mi(Mt(this).div(Mt(e)))}mul(e){return mi(Mt(this).mul(Mt(e)))}mod(e){const t=Mt(e);return t.isNeg()&&ms("division-by-zero","mod"),mi(Mt(this).umod(t))}pow(e){const t=Mt(e);return t.isNeg()&&ms("negative-power","pow"),mi(Mt(this).pow(t))}and(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","and"),mi(Mt(this).and(t))}or(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","or"),mi(Mt(this).or(t))}xor(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","xor"),mi(Mt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&ms("negative-width","mask"),mi(Mt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ms("negative-width","shl"),mi(Mt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ms("negative-width","shr"),mi(Mt(this).shrn(e))}eq(e){return Mt(this).eq(Mt(e))}lt(e){return Mt(this).lt(Mt(e))}lte(e){return Mt(this).lte(Mt(e))}gt(e){return Mt(this).gt(Mt(e))}gte(e){return Mt(this).gte(Mt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Mt(this).isZero()}toNumber(){try{return Mt(this).toNumber()}catch{ms("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return ja.throwError("this platform does not support BigInt",ve.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?H2||(H2=!0,ja.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?ja.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ve.errors.UNEXPECTED_ARGUMENT,{}):ja.throwError("BigNumber.toString does not accept parameters",ve.errors.UNEXPECTED_ARGUMENT,{})),Mt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Ge)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Ge(N_,lm(e)):e.match(/^-?[0-9]+$/)?new Ge(N_,lm(new Sy(e))):ja.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&ms("underflow","BigNumber.from",e),(e>=Q2||e<=-Q2)&&ms("overflow","BigNumber.from",e),Ge.from(String(e));const t=e;if(typeof t=="bigint")return Ge.from(t.toString());if(Ax(t))return Ge.from(nt(t));if(t)if(t.toHexString){const r=t.toHexString();if(typeof r=="string")return Ge.from(r)}else{let r=t._hex;if(r==null&&t.type==="BigNumber"&&(r=t.hex),typeof r=="string"&&(Et(r)||r[0]==="-"&&Et(r.substring(1))))return Ge.from(r)}return ja.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function lm(n){if(typeof n!="string")return lm(n.toString(16));if(n[0]==="-")return n=n.substring(1),n[0]==="-"&&ja.throwArgumentError("invalid hex","value",n),n=lm(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 mi(n){return Ge.from(lm(n))}function Mt(n){const e=Ge.from(n).toHexString();return e[0]==="-"?new Sy("-"+e.substring(3),16):new Sy(e.substring(2),16)}function ms(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),ja.throwError(n,ve.errors.NUMERIC_FAULT,r)}function FG(n){return new Sy(n,36).toString(16)}const UG="properties/5.7.0";var LG=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const My=new ve(UG);function Ue(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function Ji(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 qn(n){return LG(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 PG(n,e){(!n||typeof n!="object")&&My.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||My.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function wn(n){const e={};for(const t in n)e[t]=n[t];return e}const DG={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function XO(n){if(n==null||DG[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;tts(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Ue(e,t,ts(r))}return e}return My.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function ts(n){return OG(n)}class og{constructor(e){for(const t in e)this[t]=ts(e[t])}}const NG="abstract-provider/5.7.0";var kG=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const QG=new ve(NG);class HG extends og{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class ag{constructor(){QG.checkAbstract(new.target,ag),Ue(this,"_isProvider",!0)}getFeeData(){return kG(this,void 0,void 0,function*(){const{block:e,gasPrice:t}=yield qn({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=Ge.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 zG="networks/5.7.1",z2=new ve(zG);function GG(n){return n&&typeof n.renetwork=="function"}function Ya(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 Ya(t)},e}function Ty(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return Ty(n,r)},t}const G2={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Ya("homestead")},V2={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Ya("ropsten")},j2={chainId:63,name:"classicMordor",_defaultProvider:Ty("https://www.ethercluster.com/mordor","classicMordor")},Qg={unspecified:{chainId:0,name:"unspecified"},homestead:G2,mainnet:G2,morden:{chainId:2,name:"morden"},ropsten:V2,testnet:V2,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Ya("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Ya("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Ya("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Ya("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:Ty("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:j2,classicTestnet:j2,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Ty("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Ya("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Ya("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 ZO(n){if(n==null)return null;if(typeof n=="number"){for(const r in Qg){const i=Qg[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=Qg[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=Qg[n.name];if(!e)return typeof n.chainId!="number"&&z2.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&z2.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(GG(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 JO(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?v:E},s.min=function(v,E){return v.cmp(E)<0?v:E},s.prototype._init=function(v,E,U){if(typeof v=="number")return this._initNumber(v,E,U);if(typeof v=="object")return this._initArray(v,E,U);E==="hex"&&(E=16),r(E===(E|0)&&E>=2&&E<=36),v=v.toString().replace(/\s+/g,"");var P=0;v[0]==="-"&&(P++,this.negative=1),P=0;P-=3)z=v[P]|v[P-1]<<8|v[P-2]<<16,this.words[L]|=z<>>26-K&67108863,K+=24,K>=26&&(K-=26,L++);else if(U==="le")for(P=0,L=0;P>>26-K&67108863,K+=24,K>=26&&(K-=26,L++);return this._strip()};function a(I,v){var E=I.charCodeAt(v);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 "+I)}function l(I,v,E){var U=a(I,E);return E-1>=v&&(U|=a(I,E-1)<<4),U}s.prototype._parseHex=function(v,E,U){this.length=Math.ceil((v.length-E)/6),this.words=new Array(this.length);for(var P=0;P=E;P-=2)K=l(v,E,P)<=18?(L-=18,z+=1,this.words[z]|=K>>>26):L+=8;else{var O=v.length-E;for(P=O%2===0?E+1:E;P=18?(L-=18,z+=1,this.words[z]|=K>>>26):L+=8}this._strip()};function A(I,v,E,U){for(var P=0,L=0,z=Math.min(I.length,E),K=v;K=49?L=O-49+10:O>=17?L=O-17+10:L=O,r(O>=0&&L1&&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],p=[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(v,E){v=v||10,E=E|0||1;var U;if(v===16||v==="hex"){U="";for(var P=0,L=0,z=0;z>>24-P&16777215,P+=2,P>=26&&(P-=26,z--),L!==0||z!==this.length-1?U=f[6-O.length]+O+U:U=O+U}for(L!==0&&(U=L.toString(16)+U);U.length%E!==0;)U="0"+U;return this.negative!==0&&(U="-"+U),U}if(v===(v|0)&&v>=2&&v<=36){var B=h[v],W=p[v];U="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var F=ee.modrn(W).toString(v);ee=ee.idivn(W),ee.isZero()?U=F+U:U=f[B-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 v=this.words[0];return this.length===2?v+=this.words[1]*67108864:this.length===3&&this.words[2]===1?v+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-v:v},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(v,E){return this.toArrayLike(o,v,E)}),s.prototype.toArray=function(v,E){return this.toArrayLike(Array,v,E)};var d=function(v,E){return v.allocUnsafe?v.allocUnsafe(E):new v(E)};s.prototype.toArrayLike=function(v,E,U){this._strip();var P=this.byteLength(),L=U||Math.max(1,P);r(P<=L,"byte array longer than desired length"),r(L>0,"Requested array length <= 0");var z=d(v,L),K=E==="le"?"LE":"BE";return this["_toArrayLike"+K](z,P),z},s.prototype._toArrayLikeLE=function(v,E){for(var U=0,P=0,L=0,z=0;L>8&255),U>16&255),z===6?(U>24&255),P=0,z=0):(P=K>>>24,z+=2)}if(U=0&&(v[U--]=K>>8&255),U>=0&&(v[U--]=K>>16&255),z===6?(U>=0&&(v[U--]=K>>24&255),P=0,z=0):(P=K>>>24,z+=2)}if(U>=0)for(v[U--]=P;U>=0;)v[U--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var E=v,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(v){if(v===0)return 26;var E=v,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 v=this.words[this.length-1],E=this._countBits(v);return(this.length-1)*26+E};function g(I){for(var v=new Array(I.bitLength()),E=0;E>>P&1}return v}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,E=0;Ev.length?this.clone().ior(v):v.clone().ior(this)},s.prototype.uor=function(v){return this.length>v.length?this.clone().iuor(v):v.clone().iuor(this)},s.prototype.iuand=function(v){var E;this.length>v.length?E=v:E=this;for(var U=0;Uv.length?this.clone().iand(v):v.clone().iand(this)},s.prototype.uand=function(v){return this.length>v.length?this.clone().iuand(v):v.clone().iuand(this)},s.prototype.iuxor=function(v){var E,U;this.length>v.length?(E=this,U=v):(E=v,U=this);for(var P=0;Pv.length?this.clone().ixor(v):v.clone().ixor(this)},s.prototype.uxor=function(v){return this.length>v.length?this.clone().iuxor(v):v.clone().iuxor(this)},s.prototype.inotn=function(v){r(typeof v=="number"&&v>=0);var E=Math.ceil(v/26)|0,U=v%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(v){return this.clone().inotn(v)},s.prototype.setn=function(v,E){r(typeof v=="number"&&v>=0);var U=v/26|0,P=v%26;return this._expand(U+1),E?this.words[U]=this.words[U]|1<v.length?(U=this,P=v):(U=v,P=this);for(var L=0,z=0;z>>26;for(;L!==0&&z>>26;if(this.length=U.length,L!==0)this.words[this.length]=L,this.length++;else if(U!==this)for(;zv.length?this.clone().iadd(v):v.clone().iadd(this)},s.prototype.isub=function(v){if(v.negative!==0){v.negative=0;var E=this.iadd(v);return v.negative=1,E._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var U=this.cmp(v);if(U===0)return this.negative=0,this.length=1,this.words[0]=0,this;var P,L;U>0?(P=this,L=v):(P=v,L=this);for(var z=0,K=0;K>26,this.words[K]=E&67108863;for(;z!==0&&K>26,this.words[K]=E&67108863;if(z===0&&K>>26,ee=O&67108863,F=Math.min(B,v.length-1),X=Math.max(0,B-I.length+1);X<=F;X++){var ue=B-X|0;P=I.words[ue]|0,L=v.words[X]|0,z=P*L+ee,W+=z/67108864|0,ee=z&67108863}E.words[B]=ee|0,O=W|0}return O!==0?E.words[B]=O|0:E.length--,E._strip()}var y=function(v,E,U){var P=v.words,L=E.words,z=U.words,K=0,O,B,W,ee=P[0]|0,F=ee&8191,X=ee>>>13,ue=P[1]|0,le=ue&8191,oe=ue>>>13,re=P[2]|0,pe=re&8191,_e=re>>>13,Re=P[3]|0,Q=Re&8191,de=Re>>>13,Ae=P[4]|0,q=Ae&8191,J=Ae>>>13,ce=P[5]|0,xe=ce&8191,be=ce>>>13,N=P[6]|0,j=N&8191,se=N>>>13,he=P[7]|0,me=he&8191,G=he>>>13,R=P[8]|0,T=R&8191,V=R>>>13,te=P[9]|0,ae=te&8191,ie=te>>>13,Te=L[0]|0,Me=Te&8191,Le=Te>>>13,ke=L[1]|0,De=ke&8191,fe=ke>>>13,Ce=L[2]|0,Se=Ce&8191,Fe=Ce>>>13,We=L[3]|0,qe=We&8191,ut=We>>>13,sn=L[4]|0,Ct=sn&8191,it=sn>>>13,ar=L[5]|0,wt=ar&8191,Yt=ar>>>13,qs=L[6]|0,Vt=qs&8191,Xt=qs>>>13,ne=L[7]|0,ge=ne&8191,Be=ne>>>13,we=L[8]|0,Ee=we&8191,ze=we>>>13,st=L[9]|0,Ze=st&8191,Je=st>>>13;U.negative=v.negative^E.negative,U.length=19,O=Math.imul(F,Me),B=Math.imul(F,Le),B=B+Math.imul(X,Me)|0,W=Math.imul(X,Le);var yt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(yt>>>26)|0,yt&=67108863,O=Math.imul(le,Me),B=Math.imul(le,Le),B=B+Math.imul(oe,Me)|0,W=Math.imul(oe,Le),O=O+Math.imul(F,De)|0,B=B+Math.imul(F,fe)|0,B=B+Math.imul(X,De)|0,W=W+Math.imul(X,fe)|0;var mt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(mt>>>26)|0,mt&=67108863,O=Math.imul(pe,Me),B=Math.imul(pe,Le),B=B+Math.imul(_e,Me)|0,W=Math.imul(_e,Le),O=O+Math.imul(le,De)|0,B=B+Math.imul(le,fe)|0,B=B+Math.imul(oe,De)|0,W=W+Math.imul(oe,fe)|0,O=O+Math.imul(F,Se)|0,B=B+Math.imul(F,Fe)|0,B=B+Math.imul(X,Se)|0,W=W+Math.imul(X,Fe)|0;var gt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(gt>>>26)|0,gt&=67108863,O=Math.imul(Q,Me),B=Math.imul(Q,Le),B=B+Math.imul(de,Me)|0,W=Math.imul(de,Le),O=O+Math.imul(pe,De)|0,B=B+Math.imul(pe,fe)|0,B=B+Math.imul(_e,De)|0,W=W+Math.imul(_e,fe)|0,O=O+Math.imul(le,Se)|0,B=B+Math.imul(le,Fe)|0,B=B+Math.imul(oe,Se)|0,W=W+Math.imul(oe,Fe)|0,O=O+Math.imul(F,qe)|0,B=B+Math.imul(F,ut)|0,B=B+Math.imul(X,qe)|0,W=W+Math.imul(X,ut)|0;var Zt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,O=Math.imul(q,Me),B=Math.imul(q,Le),B=B+Math.imul(J,Me)|0,W=Math.imul(J,Le),O=O+Math.imul(Q,De)|0,B=B+Math.imul(Q,fe)|0,B=B+Math.imul(de,De)|0,W=W+Math.imul(de,fe)|0,O=O+Math.imul(pe,Se)|0,B=B+Math.imul(pe,Fe)|0,B=B+Math.imul(_e,Se)|0,W=W+Math.imul(_e,Fe)|0,O=O+Math.imul(le,qe)|0,B=B+Math.imul(le,ut)|0,B=B+Math.imul(oe,qe)|0,W=W+Math.imul(oe,ut)|0,O=O+Math.imul(F,Ct)|0,B=B+Math.imul(F,it)|0,B=B+Math.imul(X,Ct)|0,W=W+Math.imul(X,it)|0;var Rn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,O=Math.imul(xe,Me),B=Math.imul(xe,Le),B=B+Math.imul(be,Me)|0,W=Math.imul(be,Le),O=O+Math.imul(q,De)|0,B=B+Math.imul(q,fe)|0,B=B+Math.imul(J,De)|0,W=W+Math.imul(J,fe)|0,O=O+Math.imul(Q,Se)|0,B=B+Math.imul(Q,Fe)|0,B=B+Math.imul(de,Se)|0,W=W+Math.imul(de,Fe)|0,O=O+Math.imul(pe,qe)|0,B=B+Math.imul(pe,ut)|0,B=B+Math.imul(_e,qe)|0,W=W+Math.imul(_e,ut)|0,O=O+Math.imul(le,Ct)|0,B=B+Math.imul(le,it)|0,B=B+Math.imul(oe,Ct)|0,W=W+Math.imul(oe,it)|0,O=O+Math.imul(F,wt)|0,B=B+Math.imul(F,Yt)|0,B=B+Math.imul(X,wt)|0,W=W+Math.imul(X,Yt)|0;var Di=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Di>>>26)|0,Di&=67108863,O=Math.imul(j,Me),B=Math.imul(j,Le),B=B+Math.imul(se,Me)|0,W=Math.imul(se,Le),O=O+Math.imul(xe,De)|0,B=B+Math.imul(xe,fe)|0,B=B+Math.imul(be,De)|0,W=W+Math.imul(be,fe)|0,O=O+Math.imul(q,Se)|0,B=B+Math.imul(q,Fe)|0,B=B+Math.imul(J,Se)|0,W=W+Math.imul(J,Fe)|0,O=O+Math.imul(Q,qe)|0,B=B+Math.imul(Q,ut)|0,B=B+Math.imul(de,qe)|0,W=W+Math.imul(de,ut)|0,O=O+Math.imul(pe,Ct)|0,B=B+Math.imul(pe,it)|0,B=B+Math.imul(_e,Ct)|0,W=W+Math.imul(_e,it)|0,O=O+Math.imul(le,wt)|0,B=B+Math.imul(le,Yt)|0,B=B+Math.imul(oe,wt)|0,W=W+Math.imul(oe,Yt)|0,O=O+Math.imul(F,Vt)|0,B=B+Math.imul(F,Xt)|0,B=B+Math.imul(X,Vt)|0,W=W+Math.imul(X,Xt)|0;var eo=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(eo>>>26)|0,eo&=67108863,O=Math.imul(me,Me),B=Math.imul(me,Le),B=B+Math.imul(G,Me)|0,W=Math.imul(G,Le),O=O+Math.imul(j,De)|0,B=B+Math.imul(j,fe)|0,B=B+Math.imul(se,De)|0,W=W+Math.imul(se,fe)|0,O=O+Math.imul(xe,Se)|0,B=B+Math.imul(xe,Fe)|0,B=B+Math.imul(be,Se)|0,W=W+Math.imul(be,Fe)|0,O=O+Math.imul(q,qe)|0,B=B+Math.imul(q,ut)|0,B=B+Math.imul(J,qe)|0,W=W+Math.imul(J,ut)|0,O=O+Math.imul(Q,Ct)|0,B=B+Math.imul(Q,it)|0,B=B+Math.imul(de,Ct)|0,W=W+Math.imul(de,it)|0,O=O+Math.imul(pe,wt)|0,B=B+Math.imul(pe,Yt)|0,B=B+Math.imul(_e,wt)|0,W=W+Math.imul(_e,Yt)|0,O=O+Math.imul(le,Vt)|0,B=B+Math.imul(le,Xt)|0,B=B+Math.imul(oe,Vt)|0,W=W+Math.imul(oe,Xt)|0,O=O+Math.imul(F,ge)|0,B=B+Math.imul(F,Be)|0,B=B+Math.imul(X,ge)|0,W=W+Math.imul(X,Be)|0;var pn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(pn>>>26)|0,pn&=67108863,O=Math.imul(T,Me),B=Math.imul(T,Le),B=B+Math.imul(V,Me)|0,W=Math.imul(V,Le),O=O+Math.imul(me,De)|0,B=B+Math.imul(me,fe)|0,B=B+Math.imul(G,De)|0,W=W+Math.imul(G,fe)|0,O=O+Math.imul(j,Se)|0,B=B+Math.imul(j,Fe)|0,B=B+Math.imul(se,Se)|0,W=W+Math.imul(se,Fe)|0,O=O+Math.imul(xe,qe)|0,B=B+Math.imul(xe,ut)|0,B=B+Math.imul(be,qe)|0,W=W+Math.imul(be,ut)|0,O=O+Math.imul(q,Ct)|0,B=B+Math.imul(q,it)|0,B=B+Math.imul(J,Ct)|0,W=W+Math.imul(J,it)|0,O=O+Math.imul(Q,wt)|0,B=B+Math.imul(Q,Yt)|0,B=B+Math.imul(de,wt)|0,W=W+Math.imul(de,Yt)|0,O=O+Math.imul(pe,Vt)|0,B=B+Math.imul(pe,Xt)|0,B=B+Math.imul(_e,Vt)|0,W=W+Math.imul(_e,Xt)|0,O=O+Math.imul(le,ge)|0,B=B+Math.imul(le,Be)|0,B=B+Math.imul(oe,ge)|0,W=W+Math.imul(oe,Be)|0,O=O+Math.imul(F,Ee)|0,B=B+Math.imul(F,ze)|0,B=B+Math.imul(X,Ee)|0,W=W+Math.imul(X,ze)|0;var bt=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(bt>>>26)|0,bt&=67108863,O=Math.imul(ae,Me),B=Math.imul(ae,Le),B=B+Math.imul(ie,Me)|0,W=Math.imul(ie,Le),O=O+Math.imul(T,De)|0,B=B+Math.imul(T,fe)|0,B=B+Math.imul(V,De)|0,W=W+Math.imul(V,fe)|0,O=O+Math.imul(me,Se)|0,B=B+Math.imul(me,Fe)|0,B=B+Math.imul(G,Se)|0,W=W+Math.imul(G,Fe)|0,O=O+Math.imul(j,qe)|0,B=B+Math.imul(j,ut)|0,B=B+Math.imul(se,qe)|0,W=W+Math.imul(se,ut)|0,O=O+Math.imul(xe,Ct)|0,B=B+Math.imul(xe,it)|0,B=B+Math.imul(be,Ct)|0,W=W+Math.imul(be,it)|0,O=O+Math.imul(q,wt)|0,B=B+Math.imul(q,Yt)|0,B=B+Math.imul(J,wt)|0,W=W+Math.imul(J,Yt)|0,O=O+Math.imul(Q,Vt)|0,B=B+Math.imul(Q,Xt)|0,B=B+Math.imul(de,Vt)|0,W=W+Math.imul(de,Xt)|0,O=O+Math.imul(pe,ge)|0,B=B+Math.imul(pe,Be)|0,B=B+Math.imul(_e,ge)|0,W=W+Math.imul(_e,Be)|0,O=O+Math.imul(le,Ee)|0,B=B+Math.imul(le,ze)|0,B=B+Math.imul(oe,Ee)|0,W=W+Math.imul(oe,ze)|0,O=O+Math.imul(F,Ze)|0,B=B+Math.imul(F,Je)|0,B=B+Math.imul(X,Ze)|0,W=W+Math.imul(X,Je)|0;var qA=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(qA>>>26)|0,qA&=67108863,O=Math.imul(ae,De),B=Math.imul(ae,fe),B=B+Math.imul(ie,De)|0,W=Math.imul(ie,fe),O=O+Math.imul(T,Se)|0,B=B+Math.imul(T,Fe)|0,B=B+Math.imul(V,Se)|0,W=W+Math.imul(V,Fe)|0,O=O+Math.imul(me,qe)|0,B=B+Math.imul(me,ut)|0,B=B+Math.imul(G,qe)|0,W=W+Math.imul(G,ut)|0,O=O+Math.imul(j,Ct)|0,B=B+Math.imul(j,it)|0,B=B+Math.imul(se,Ct)|0,W=W+Math.imul(se,it)|0,O=O+Math.imul(xe,wt)|0,B=B+Math.imul(xe,Yt)|0,B=B+Math.imul(be,wt)|0,W=W+Math.imul(be,Yt)|0,O=O+Math.imul(q,Vt)|0,B=B+Math.imul(q,Xt)|0,B=B+Math.imul(J,Vt)|0,W=W+Math.imul(J,Xt)|0,O=O+Math.imul(Q,ge)|0,B=B+Math.imul(Q,Be)|0,B=B+Math.imul(de,ge)|0,W=W+Math.imul(de,Be)|0,O=O+Math.imul(pe,Ee)|0,B=B+Math.imul(pe,ze)|0,B=B+Math.imul(_e,Ee)|0,W=W+Math.imul(_e,ze)|0,O=O+Math.imul(le,Ze)|0,B=B+Math.imul(le,Je)|0,B=B+Math.imul(oe,Ze)|0,W=W+Math.imul(oe,Je)|0;var Fn=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,O=Math.imul(ae,Se),B=Math.imul(ae,Fe),B=B+Math.imul(ie,Se)|0,W=Math.imul(ie,Fe),O=O+Math.imul(T,qe)|0,B=B+Math.imul(T,ut)|0,B=B+Math.imul(V,qe)|0,W=W+Math.imul(V,ut)|0,O=O+Math.imul(me,Ct)|0,B=B+Math.imul(me,it)|0,B=B+Math.imul(G,Ct)|0,W=W+Math.imul(G,it)|0,O=O+Math.imul(j,wt)|0,B=B+Math.imul(j,Yt)|0,B=B+Math.imul(se,wt)|0,W=W+Math.imul(se,Yt)|0,O=O+Math.imul(xe,Vt)|0,B=B+Math.imul(xe,Xt)|0,B=B+Math.imul(be,Vt)|0,W=W+Math.imul(be,Xt)|0,O=O+Math.imul(q,ge)|0,B=B+Math.imul(q,Be)|0,B=B+Math.imul(J,ge)|0,W=W+Math.imul(J,Be)|0,O=O+Math.imul(Q,Ee)|0,B=B+Math.imul(Q,ze)|0,B=B+Math.imul(de,Ee)|0,W=W+Math.imul(de,ze)|0,O=O+Math.imul(pe,Ze)|0,B=B+Math.imul(pe,Je)|0,B=B+Math.imul(_e,Ze)|0,W=W+Math.imul(_e,Je)|0;var to=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(to>>>26)|0,to&=67108863,O=Math.imul(ae,qe),B=Math.imul(ae,ut),B=B+Math.imul(ie,qe)|0,W=Math.imul(ie,ut),O=O+Math.imul(T,Ct)|0,B=B+Math.imul(T,it)|0,B=B+Math.imul(V,Ct)|0,W=W+Math.imul(V,it)|0,O=O+Math.imul(me,wt)|0,B=B+Math.imul(me,Yt)|0,B=B+Math.imul(G,wt)|0,W=W+Math.imul(G,Yt)|0,O=O+Math.imul(j,Vt)|0,B=B+Math.imul(j,Xt)|0,B=B+Math.imul(se,Vt)|0,W=W+Math.imul(se,Xt)|0,O=O+Math.imul(xe,ge)|0,B=B+Math.imul(xe,Be)|0,B=B+Math.imul(be,ge)|0,W=W+Math.imul(be,Be)|0,O=O+Math.imul(q,Ee)|0,B=B+Math.imul(q,ze)|0,B=B+Math.imul(J,Ee)|0,W=W+Math.imul(J,ze)|0,O=O+Math.imul(Q,Ze)|0,B=B+Math.imul(Q,Je)|0,B=B+Math.imul(de,Ze)|0,W=W+Math.imul(de,Je)|0;var gu=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(gu>>>26)|0,gu&=67108863,O=Math.imul(ae,Ct),B=Math.imul(ae,it),B=B+Math.imul(ie,Ct)|0,W=Math.imul(ie,it),O=O+Math.imul(T,wt)|0,B=B+Math.imul(T,Yt)|0,B=B+Math.imul(V,wt)|0,W=W+Math.imul(V,Yt)|0,O=O+Math.imul(me,Vt)|0,B=B+Math.imul(me,Xt)|0,B=B+Math.imul(G,Vt)|0,W=W+Math.imul(G,Xt)|0,O=O+Math.imul(j,ge)|0,B=B+Math.imul(j,Be)|0,B=B+Math.imul(se,ge)|0,W=W+Math.imul(se,Be)|0,O=O+Math.imul(xe,Ee)|0,B=B+Math.imul(xe,ze)|0,B=B+Math.imul(be,Ee)|0,W=W+Math.imul(be,ze)|0,O=O+Math.imul(q,Ze)|0,B=B+Math.imul(q,Je)|0,B=B+Math.imul(J,Ze)|0,W=W+Math.imul(J,Je)|0;var Ta=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(Ta>>>26)|0,Ta&=67108863,O=Math.imul(ae,wt),B=Math.imul(ae,Yt),B=B+Math.imul(ie,wt)|0,W=Math.imul(ie,Yt),O=O+Math.imul(T,Vt)|0,B=B+Math.imul(T,Xt)|0,B=B+Math.imul(V,Vt)|0,W=W+Math.imul(V,Xt)|0,O=O+Math.imul(me,ge)|0,B=B+Math.imul(me,Be)|0,B=B+Math.imul(G,ge)|0,W=W+Math.imul(G,Be)|0,O=O+Math.imul(j,Ee)|0,B=B+Math.imul(j,ze)|0,B=B+Math.imul(se,Ee)|0,W=W+Math.imul(se,ze)|0,O=O+Math.imul(xe,Ze)|0,B=B+Math.imul(xe,Je)|0,B=B+Math.imul(be,Ze)|0,W=W+Math.imul(be,Je)|0;var ec=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(ec>>>26)|0,ec&=67108863,O=Math.imul(ae,Vt),B=Math.imul(ae,Xt),B=B+Math.imul(ie,Vt)|0,W=Math.imul(ie,Xt),O=O+Math.imul(T,ge)|0,B=B+Math.imul(T,Be)|0,B=B+Math.imul(V,ge)|0,W=W+Math.imul(V,Be)|0,O=O+Math.imul(me,Ee)|0,B=B+Math.imul(me,ze)|0,B=B+Math.imul(G,Ee)|0,W=W+Math.imul(G,ze)|0,O=O+Math.imul(j,Ze)|0,B=B+Math.imul(j,Je)|0,B=B+Math.imul(se,Ze)|0,W=W+Math.imul(se,Je)|0;var lr=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(lr>>>26)|0,lr&=67108863,O=Math.imul(ae,ge),B=Math.imul(ae,Be),B=B+Math.imul(ie,ge)|0,W=Math.imul(ie,Be),O=O+Math.imul(T,Ee)|0,B=B+Math.imul(T,ze)|0,B=B+Math.imul(V,Ee)|0,W=W+Math.imul(V,ze)|0,O=O+Math.imul(me,Ze)|0,B=B+Math.imul(me,Je)|0,B=B+Math.imul(G,Ze)|0,W=W+Math.imul(G,Je)|0;var no=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(no>>>26)|0,no&=67108863,O=Math.imul(ae,Ee),B=Math.imul(ae,ze),B=B+Math.imul(ie,Ee)|0,W=Math.imul(ie,ze),O=O+Math.imul(T,Ze)|0,B=B+Math.imul(T,Je)|0,B=B+Math.imul(V,Ze)|0,W=W+Math.imul(V,Je)|0;var tc=(K+O|0)+((B&8191)<<13)|0;K=(W+(B>>>13)|0)+(tc>>>26)|0,tc&=67108863,O=Math.imul(ae,Ze),B=Math.imul(ae,Je),B=B+Math.imul(ie,Ze)|0,W=Math.imul(ie,Je);var Tr=(K+O|0)+((B&8191)<<13)|0;return K=(W+(B>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,z[0]=yt,z[1]=mt,z[2]=gt,z[3]=Zt,z[4]=Rn,z[5]=Di,z[6]=eo,z[7]=pn,z[8]=bt,z[9]=qA,z[10]=Fn,z[11]=to,z[12]=gu,z[13]=Ta,z[14]=ec,z[15]=lr,z[16]=no,z[17]=tc,z[18]=Tr,K!==0&&(z[19]=K,U.length++),U};Math.imul||(y=m);function w(I,v,E){E.negative=v.negative^I.negative,E.length=I.length+v.length;for(var U=0,P=0,L=0;L>>26)|0,P+=z>>>26,z&=67108863}E.words[L]=K,U=z,z=P}return U!==0?E.words[L]=U:E.length--,E._strip()}function x(I,v,E){return w(I,v,E)}s.prototype.mulTo=function(v,E){var U,P=this.length+v.length;return this.length===10&&v.length===10?U=y(this,v,E):P<63?U=m(this,v,E):P<1024?U=w(this,v,E):U=x(this,v,E),U},s.prototype.mul=function(v){var E=new s(null);return E.words=new Array(this.length+v.length),this.mulTo(v,E)},s.prototype.mulf=function(v){var E=new s(null);return E.words=new Array(this.length+v.length),x(this,v,E)},s.prototype.imul=function(v){return this.clone().mulTo(v,this)},s.prototype.imuln=function(v){var E=v<0;E&&(v=-v),r(typeof v=="number"),r(v<67108864);for(var U=0,P=0;P>=26,U+=L/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(v){return this.clone().imuln(v)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(v){var E=g(v);if(E.length===0)return new s(1);for(var U=this,P=0;P=0);var E=v%26,U=(v-E)/26,P=67108863>>>26-E<<26-E,L;if(E!==0){var z=0;for(L=0;L>>26-E}z&&(this.words[L]=z,this.length++)}if(U!==0){for(L=this.length-1;L>=0;L--)this.words[L+U]=this.words[L];for(L=0;L=0);var P;E?P=(E-E%26)/26:P=0;var L=v%26,z=Math.min((v-L)/26,this.length),K=67108863^67108863>>>L<z)for(this.length-=z,B=0;B=0&&(W!==0||B>=P);B--){var ee=this.words[B]|0;this.words[B]=W<<26-L|ee>>>L,W=ee&K}return O&&W!==0&&(O.words[O.length++]=W),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,E,U){return r(this.negative===0),this.iushrn(v,E,U)},s.prototype.shln=function(v){return this.clone().ishln(v)},s.prototype.ushln=function(v){return this.clone().iushln(v)},s.prototype.shrn=function(v){return this.clone().ishrn(v)},s.prototype.ushrn=function(v){return this.clone().iushrn(v)},s.prototype.testn=function(v){r(typeof v=="number"&&v>=0);var E=v%26,U=(v-E)/26,P=1<=0);var E=v%26,U=(v-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(v){if(r(typeof v=="number"),r(v<67108864),v<0)return this.iaddn(-v);if(this.negative!==0)return this.negative=0,this.iaddn(v),this.negative=1,this;if(this.words[0]-=v,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var E=0;E>26)-(O/67108864|0),this.words[L+U]=z&67108863}for(;L>26,this.words[L+U]=z&67108863;if(K===0)return this._strip();for(r(K===-1),K=0,L=0;L>26,this.words[L]=z&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,E){var U=this.length-v.length,P=this.clone(),L=v,z=L.words[L.length-1]|0,K=this._countBits(z);U=26-K,U!==0&&(L=L.ushln(U),P.iushln(U),z=L.words[L.length-1]|0);var O=P.length-L.length,B;if(E!=="mod"){B=new s(null),B.length=O+1,B.words=new Array(B.length);for(var W=0;W=0;F--){var X=(P.words[L.length+F]|0)*67108864+(P.words[L.length+F-1]|0);for(X=Math.min(X/z|0,67108863),P._ishlnsubmul(L,X,F);P.negative!==0;)X--,P.negative=0,P._ishlnsubmul(L,1,F),P.isZero()||(P.negative^=1);B&&(B.words[F]=X)}return B&&B._strip(),P._strip(),E!=="div"&&U!==0&&P.iushrn(U),{div:B||null,mod:P}},s.prototype.divmod=function(v,E,U){if(r(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var P,L,z;return this.negative!==0&&v.negative===0?(z=this.neg().divmod(v,E),E!=="mod"&&(P=z.div.neg()),E!=="div"&&(L=z.mod.neg(),U&&L.negative!==0&&L.iadd(v)),{div:P,mod:L}):this.negative===0&&v.negative!==0?(z=this.divmod(v.neg(),E),E!=="mod"&&(P=z.div.neg()),{div:P,mod:z.mod}):this.negative&v.negative?(z=this.neg().divmod(v.neg(),E),E!=="div"&&(L=z.mod.neg(),U&&L.negative!==0&&L.isub(v)),{div:z.div,mod:L}):v.length>this.length||this.cmp(v)<0?{div:new s(0),mod:this}:v.length===1?E==="div"?{div:this.divn(v.words[0]),mod:null}:E==="mod"?{div:null,mod:new s(this.modrn(v.words[0]))}:{div:this.divn(v.words[0]),mod:new s(this.modrn(v.words[0]))}:this._wordDiv(v,E)},s.prototype.div=function(v){return this.divmod(v,"div",!1).div},s.prototype.mod=function(v){return this.divmod(v,"mod",!1).mod},s.prototype.umod=function(v){return this.divmod(v,"mod",!0).mod},s.prototype.divRound=function(v){var E=this.divmod(v);if(E.mod.isZero())return E.div;var U=E.div.negative!==0?E.mod.isub(v):E.mod,P=v.ushrn(1),L=v.andln(1),z=U.cmp(P);return z<0||L===1&&z===0?E.div:E.div.negative!==0?E.div.isubn(1):E.div.iaddn(1)},s.prototype.modrn=function(v){var E=v<0;E&&(v=-v),r(v<=67108863);for(var U=(1<<26)%v,P=0,L=this.length-1;L>=0;L--)P=(U*P+(this.words[L]|0))%v;return E?-P:P},s.prototype.modn=function(v){return this.modrn(v)},s.prototype.idivn=function(v){var E=v<0;E&&(v=-v),r(v<=67108863);for(var U=0,P=this.length-1;P>=0;P--){var L=(this.words[P]|0)+U*67108864;this.words[P]=L/v|0,U=L%v}return this._strip(),E?this.ineg():this},s.prototype.divn=function(v){return this.clone().idivn(v)},s.prototype.egcd=function(v){r(v.negative===0),r(!v.isZero());var E=this,U=v.clone();E.negative!==0?E=E.umod(v):E=E.clone();for(var P=new s(1),L=new s(0),z=new s(0),K=new s(1),O=0;E.isEven()&&U.isEven();)E.iushrn(1),U.iushrn(1),++O;for(var B=U.clone(),W=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;)(P.isOdd()||L.isOdd())&&(P.iadd(B),L.isub(W)),P.iushrn(1),L.iushrn(1);for(var X=0,ue=1;!(U.words[0]&ue)&&X<26;++X,ue<<=1);if(X>0)for(U.iushrn(X);X-- >0;)(z.isOdd()||K.isOdd())&&(z.iadd(B),K.isub(W)),z.iushrn(1),K.iushrn(1);E.cmp(U)>=0?(E.isub(U),P.isub(z),L.isub(K)):(U.isub(E),z.isub(P),K.isub(L))}return{a:z,b:K,gcd:U.iushln(O)}},s.prototype._invmp=function(v){r(v.negative===0),r(!v.isZero());var E=this,U=v.clone();E.negative!==0?E=E.umod(v):E=E.clone();for(var P=new s(1),L=new s(0),z=U.clone();E.cmpn(1)>0&&U.cmpn(1)>0;){for(var K=0,O=1;!(E.words[0]&O)&&K<26;++K,O<<=1);if(K>0)for(E.iushrn(K);K-- >0;)P.isOdd()&&P.iadd(z),P.iushrn(1);for(var B=0,W=1;!(U.words[0]&W)&&B<26;++B,W<<=1);if(B>0)for(U.iushrn(B);B-- >0;)L.isOdd()&&L.iadd(z),L.iushrn(1);E.cmp(U)>=0?(E.isub(U),P.isub(L)):(U.isub(E),L.isub(P))}var ee;return E.cmpn(1)===0?ee=P:ee=L,ee.cmpn(0)<0&&ee.iadd(v),ee},s.prototype.gcd=function(v){if(this.isZero())return v.abs();if(v.isZero())return this.abs();var E=this.clone(),U=v.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 L=E.cmp(U);if(L<0){var z=E;E=U,U=z}else if(L===0||U.cmpn(1)===0)break;E.isub(U)}while(!0);return U.iushln(P)},s.prototype.invm=function(v){return this.egcd(v).a.umod(v)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(v){return this.words[0]&v},s.prototype.bincn=function(v){r(typeof v=="number");var E=v%26,U=(v-E)/26,P=1<>>26,K&=67108863,this.words[z]=K}return L!==0&&(this.words[z]=L,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(v){var E=v<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&&(v=-v),r(v<=67108863,"Number is too big");var P=this.words[0]|0;U=P===v?0:Pv.length)return 1;if(this.length=0;U--){var P=this.words[U]|0,L=v.words[U]|0;if(P!==L){PL&&(E=1);break}}return E},s.prototype.gtn=function(v){return this.cmpn(v)===1},s.prototype.gt=function(v){return this.cmp(v)===1},s.prototype.gten=function(v){return this.cmpn(v)>=0},s.prototype.gte=function(v){return this.cmp(v)>=0},s.prototype.ltn=function(v){return this.cmpn(v)===-1},s.prototype.lt=function(v){return this.cmp(v)===-1},s.prototype.lten=function(v){return this.cmpn(v)<=0},s.prototype.lte=function(v){return this.cmp(v)<=0},s.prototype.eqn=function(v){return this.cmpn(v)===0},s.prototype.eq=function(v){return this.cmp(v)===0},s.red=function(v){return new $(v)},s.prototype.toRed=function(v){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),v.convertTo(this)._forceRed(v)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(v){return this.red=v,this},s.prototype.forceRed=function(v){return r(!this.red,"Already a number in reduction context"),this._forceRed(v)},s.prototype.redAdd=function(v){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,v)},s.prototype.redIAdd=function(v){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,v)},s.prototype.redSub=function(v){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,v)},s.prototype.redISub=function(v){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,v)},s.prototype.redShl=function(v){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,v)},s.prototype.redMul=function(v){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.mul(this,v)},s.prototype.redIMul=function(v){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,v),this.red.imul(this,v)},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(v){return r(this.red&&!v.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,v)};var _={k256:null,p224:null,p192:null,p25519:null};function C(I,v){this.name=I,this.p=new s(v,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}C.prototype._tmp=function(){var v=new s(null);return v.words=new Array(Math.ceil(this.n/13)),v},C.prototype.ireduce=function(v){var E=v,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},C.prototype.split=function(v,E){v.iushrn(this.n,0,E)},C.prototype.imulK=function(v){return v.imul(this.k)};function S(){C.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(S,C),S.prototype.split=function(v,E){for(var U=4194303,P=Math.min(v.length,9),L=0;L>>22,z=K}z>>>=22,v.words[L-10]=z,z===0&&v.length>10?v.length-=10:v.length-=9},S.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var E=0,U=0;U>>=26,v.words[U]=L,E=P}return E!==0&&(v.words[v.length++]=E),v},s._prime=function(v){if(_[v])return _[v];var E;if(v==="k256")E=new S;else if(v==="p224")E=new b;else if(v==="p192")E=new M;else if(v==="p25519")E=new D;else throw new Error("Unknown prime "+v);return _[v]=E,E};function $(I){if(typeof I=="string"){var v=s._prime(I);this.m=v.p,this.prime=v}else r(I.gtn(1),"modulus must be greater than 1"),this.m=I,this.prime=null}$.prototype._verify1=function(v){r(v.negative===0,"red works only with positives"),r(v.red,"red works only with red numbers")},$.prototype._verify2=function(v,E){r((v.negative|E.negative)===0,"red works only with positives"),r(v.red&&v.red===E.red,"red works only with red numbers")},$.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(c(v,v.umod(this.m)._forceRed(this)),v)},$.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},$.prototype.add=function(v,E){this._verify2(v,E);var U=v.add(E);return U.cmp(this.m)>=0&&U.isub(this.m),U._forceRed(this)},$.prototype.iadd=function(v,E){this._verify2(v,E);var U=v.iadd(E);return U.cmp(this.m)>=0&&U.isub(this.m),U},$.prototype.sub=function(v,E){this._verify2(v,E);var U=v.sub(E);return U.cmpn(0)<0&&U.iadd(this.m),U._forceRed(this)},$.prototype.isub=function(v,E){this._verify2(v,E);var U=v.isub(E);return U.cmpn(0)<0&&U.iadd(this.m),U},$.prototype.shl=function(v,E){return this._verify1(v),this.imod(v.ushln(E))},$.prototype.imul=function(v,E){return this._verify2(v,E),this.imod(v.imul(E))},$.prototype.mul=function(v,E){return this._verify2(v,E),this.imod(v.mul(E))},$.prototype.isqr=function(v){return this.imul(v,v.clone())},$.prototype.sqr=function(v){return this.mul(v,v)},$.prototype.sqrt=function(v){if(v.isZero())return v.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(v,U)}for(var P=this.m.subn(1),L=0;!P.isZero()&&P.andln(1)===0;)L++,P.iushrn(1);r(!P.isZero());var z=new s(1).toRed(this),K=z.redNeg(),O=this.m.subn(1).iushrn(1),B=this.m.bitLength();for(B=new s(2*B*B).toRed(this);this.pow(B,O).cmp(K)!==0;)B.redIAdd(K);for(var W=this.pow(B,P),ee=this.pow(v,P.addn(1).iushrn(1)),F=this.pow(v,P),X=L;F.cmp(z)!==0;){for(var ue=F,le=0;ue.cmp(z)!==0;le++)ue=ue.redSqr();r(le=0;L--){for(var W=E.words[L],ee=B-1;ee>=0;ee--){var F=W>>ee&1;if(z!==P[0]&&(z=this.sqr(z)),F===0&&K===0){O=0;continue}K<<=1,K|=F,O++,!(O!==U&&(L!==0||ee!==0))&&(z=this.mul(z,P[K]),O=0,K=0)}B=26}return z},$.prototype.convertTo=function(v){var E=v.umod(this.m);return E===v?E.clone():E},$.prototype.convertFrom=function(v){var E=v.clone();return E.red=null,E},s.mont=function(v){return new H(v)};function H(I){$.call(this,I),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(H,$),H.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},H.prototype.convertFrom=function(v){var E=this.imod(v.mul(this.rinv));return E.red=null,E},H.prototype.imul=function(v,E){if(v.isZero()||E.isZero())return v.words[0]=0,v.length=1,v;var U=v.imul(E),P=U.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=U.isub(P).iushrn(this.shift),z=L;return L.cmp(this.m)>=0?z=L.isub(this.m):L.cmpn(0)<0&&(z=L.iadd(this.m)),z._forceRed(this)},H.prototype.mul=function(v,E){if(v.isZero()||E.isZero())return new s(0)._forceRed(this);var U=v.mul(E),P=U.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),L=U.isub(P).iushrn(this.shift),z=L;return L.cmp(this.m)>=0?z=L.isub(this.m):L.cmpn(0)<0&&(z=L.iadd(this.m)),z._forceRed(this)},H.prototype.invm=function(v){var E=this.imod(v._invmp(this.m).mul(this.r2));return E._forceRed(this)}})(n,na)})(MS);var EG=MS.exports;const vt=Bl(EG),CG="logger/5.7.0";let L2=!1,P2=!1;const Qv={debug:1,default:2,info:2,warning:3,error:4,off:5};let D2=Qv.default,D_=null;function SG(){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 O2=SG();var OB;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(OB||(OB={}));var mo;(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"})(mo||(mo={}));const N2="0123456789abcdef";let ve=class cr{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();Qv[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(D2>Qv[r])&&console.log.apply(console,t)}debug(...e){this._log(cr.levels.DEBUG,e)}info(...e){this._log(cr.levels.INFO,e)}warn(...e){this._log(cr.levels.WARNING,e)}makeError(e,t,r){if(P2)return this.makeError("censored error",t,{});t||(t=cr.errors.UNKNOWN_ERROR),r||(r={});const i=[];Object.keys(r).forEach(l=>{const A=r[l];try{if(A instanceof Uint8Array){let c="";for(let u=0;u>4],c+=N2[A[u]&15];i.push(l+"=Uint8Array(0x"+c+")")}else i.push(l+"="+JSON.stringify(A))}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 mo.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 mo.CALL_EXCEPTION:case mo.INSUFFICIENT_FUNDS:case mo.MISSING_NEW:case mo.NONCE_EXPIRED:case mo.REPLACEMENT_UNDERPRICED:case mo.TRANSACTION_REPLACED:case mo.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,cr.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){O2&&this.throwError("platform missing String.prototype.normalize",cr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:O2})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,cr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,cr.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,cr.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",cr.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",cr.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",cr.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return D_||(D_=new cr(CG)),D_}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",cr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),L2){if(!e)return;this.globalLogger().throwError("error censorship permanent",cr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}P2=!!e,L2=!!t}static setLogLevel(e){const t=Qv[e.toLowerCase()];if(t==null){cr.globalLogger().warn("invalid log level - "+e);return}D2=t}static from(e){return new cr(e)}};ve.errors=mo;ve.levels=OB;const MG="bytes/5.7.0",Pn=new ve(MG);function YO(n){return!!n.toHexString}function Zf(n){return n.slice||(n.slice=function(){const e=Array.prototype.slice.call(arguments);return Zf(new Uint8Array(Array.prototype.slice.apply(n,e)))}),n}function TS(n){return Et(n)&&!(n.length%2)||cx(n)}function k2(n){return typeof n=="number"&&n==n&&n%1===0}function cx(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!k2(n.length)||n.length<0)return!1;for(let e=0;e=256)return!1}return!0}function at(n,e){if(e||(e={}),typeof n=="number"){Pn.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),Zf(new Uint8Array(t))}if(e.allowMissingPrefix&&typeof n=="string"&&n.substring(0,2)!=="0x"&&(n="0x"+n),YO(n)&&(n=n.toHexString()),Et(n)){let t=n.substring(2);t.length%2&&(e.hexPad==="left"?t="0"+t:e.hexPad==="right"?t+="0":Pn.throwArgumentError("hex data is odd-length","value",n));const r=[];for(let i=0;iat(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),Zf(r)}function gh(n){let e=at(n);if(e.length===0)return e;let t=0;for(;te&&Pn.throwArgumentError("value out of range","value",arguments[0]);const t=new Uint8Array(e);return t.set(n,e-n.length),Zf(t)}function Et(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||e&&n.length!==2+2*e)}const O_="0123456789abcdef";function nt(n,e){if(e||(e={}),typeof n=="number"){Pn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=O_[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),YO(n))return n.toHexString();if(Et(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Pn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(cx(n)){let t="0x";for(let r=0;r>4]+O_[i&15]}return t}return Pn.throwArgumentError("invalid hexlify value","value",n)}function Qc(n){if(typeof n!="string")n=nt(n);else if(!Et(n)||n.length%2)return null;return(n.length-2)/2}function zr(n,e,t){return typeof n!="string"?n=nt(n):(!Et(n)||n.length%2)&&Pn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function _i(n){let e="0x";return n.forEach(t=>{e+=nt(t).substring(2)}),e}function ux(n){const e=IG(nt(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function IG(n){typeof n!="string"&&(n=nt(n)),Et(n)||Pn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Pn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function fx(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(TS(n)){let t=at(n);t.length===64?(e.v=27+(t[32]>>7),t[32]&=127,e.r=nt(t.slice(0,32)),e.s=nt(t.slice(32,64))):t.length===65?(e.r=nt(t.slice(0,32)),e.s=nt(t.slice(32,64)),e.v=t[64]):Pn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Pn.throwArgumentError("signature invalid v byte","signature",n)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(t[32]|=128),e._vs=nt(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=TG(at(e._vs),32);e._vs=nt(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Pn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=nt(i);e.s==null?e.s=o:e.s!==o&&Pn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Pn.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&&Pn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!Et(e.r)?Pn.throwArgumentError("signature missing or invalid r","signature",n):e.r=kn(e.r,32),e.s==null||!Et(e.s)?Pn.throwArgumentError("signature missing or invalid s","signature",n):e.s=kn(e.s,32);const t=at(e.s);t[0]>=128&&Pn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=nt(t);e._vs&&(Et(e._vs)||Pn.throwArgumentError("signature invalid _vs","signature",n),e._vs=kn(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Pn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const RG="bignumber/5.7.0";var My=vt.BN;const Wa=new ve(RG),N_={},Q2=9007199254740991;let H2=!1;class Ge{constructor(e,t){e!==N_&&Wa.throwError("cannot call constructor directly; use BigNumber.from",ve.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return mi(Mt(this).fromTwos(e))}toTwos(e){return mi(Mt(this).toTwos(e))}abs(){return this._hex[0]==="-"?Ge.from(this._hex.substring(1)):this}add(e){return mi(Mt(this).add(Mt(e)))}sub(e){return mi(Mt(this).sub(Mt(e)))}div(e){return Ge.from(e).isZero()&&gs("division-by-zero","div"),mi(Mt(this).div(Mt(e)))}mul(e){return mi(Mt(this).mul(Mt(e)))}mod(e){const t=Mt(e);return t.isNeg()&&gs("division-by-zero","mod"),mi(Mt(this).umod(t))}pow(e){const t=Mt(e);return t.isNeg()&&gs("negative-power","pow"),mi(Mt(this).pow(t))}and(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&gs("unbound-bitwise-result","and"),mi(Mt(this).and(t))}or(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&gs("unbound-bitwise-result","or"),mi(Mt(this).or(t))}xor(e){const t=Mt(e);return(this.isNegative()||t.isNeg())&&gs("unbound-bitwise-result","xor"),mi(Mt(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&gs("negative-width","mask"),mi(Mt(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&gs("negative-width","shl"),mi(Mt(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&gs("negative-width","shr"),mi(Mt(this).shrn(e))}eq(e){return Mt(this).eq(Mt(e))}lt(e){return Mt(this).lt(Mt(e))}lte(e){return Mt(this).lte(Mt(e))}gt(e){return Mt(this).gt(Mt(e))}gte(e){return Mt(this).gte(Mt(e))}isNegative(){return this._hex[0]==="-"}isZero(){return Mt(this).isZero()}toNumber(){try{return Mt(this).toNumber()}catch{gs("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Wa.throwError("this platform does not support BigInt",ve.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?H2||(H2=!0,Wa.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Wa.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ve.errors.UNEXPECTED_ARGUMENT,{}):Wa.throwError("BigNumber.toString does not accept parameters",ve.errors.UNEXPECTED_ARGUMENT,{})),Mt(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Ge)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new Ge(N_,Am(e)):e.match(/^-?[0-9]+$/)?new Ge(N_,Am(new My(e))):Wa.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&gs("underflow","BigNumber.from",e),(e>=Q2||e<=-Q2)&&gs("overflow","BigNumber.from",e),Ge.from(String(e));const t=e;if(typeof t=="bigint")return Ge.from(t.toString());if(cx(t))return Ge.from(nt(t));if(t)if(t.toHexString){const r=t.toHexString();if(typeof r=="string")return Ge.from(r)}else{let r=t._hex;if(r==null&&t.type==="BigNumber"&&(r=t.hex),typeof r=="string"&&(Et(r)||r[0]==="-"&&Et(r.substring(1))))return Ge.from(r)}return Wa.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Am(n){if(typeof n!="string")return Am(n.toString(16));if(n[0]==="-")return n=n.substring(1),n[0]==="-"&&Wa.throwArgumentError("invalid hex","value",n),n=Am(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 mi(n){return Ge.from(Am(n))}function Mt(n){const e=Ge.from(n).toHexString();return e[0]==="-"?new My("-"+e.substring(3),16):new My(e.substring(2),16)}function gs(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),Wa.throwError(n,ve.errors.NUMERIC_FAULT,r)}function FG(n){return new My(n,36).toString(16)}const UG="properties/5.7.0";var LG=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Ty=new ve(UG);function Ue(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function Ji(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 qn(n){return LG(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 PG(n,e){(!n||typeof n!="object")&&Ty.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||Ty.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function wn(n){const e={};for(const t in n)e[t]=n[t];return e}const DG={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function XO(n){if(n==null||DG[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;tts(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Ue(e,t,ts(r))}return e}return Ty.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function ts(n){return OG(n)}class ag{constructor(e){for(const t in e)this[t]=ts(e[t])}}const NG="abstract-provider/5.7.0";var kG=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const QG=new ve(NG);class HG extends ag{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class lg{constructor(){QG.checkAbstract(new.target,lg),Ue(this,"_isProvider",!0)}getFeeData(){return kG(this,void 0,void 0,function*(){const{block:e,gasPrice:t}=yield qn({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=Ge.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 zG="networks/5.7.1",z2=new ve(zG);function GG(n){return n&&typeof n.renetwork=="function"}function Xa(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 Xa(t)},e}function Iy(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return Iy(n,r)},t}const G2={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Xa("homestead")},V2={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Xa("ropsten")},j2={chainId:63,name:"classicMordor",_defaultProvider:Iy("https://www.ethercluster.com/mordor","classicMordor")},Hg={unspecified:{chainId:0,name:"unspecified"},homestead:G2,mainnet:G2,morden:{chainId:2,name:"morden"},ropsten:V2,testnet:V2,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Xa("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Xa("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Xa("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Xa("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:Iy("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:j2,classicTestnet:j2,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:Iy("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Xa("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Xa("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 ZO(n){if(n==null)return null;if(typeof n=="number"){for(const r in Hg){const i=Hg[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=Hg[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=Hg[n.name];if(!e)return typeof n.chainId!="number"&&z2.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&z2.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(GG(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 JO(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=ue>>5,this.extraBytes=(ue&31)>>3;for(var le=0;le<50;++le)this.s[le]=0}B.prototype.update=function(F){if(this.finalized)throw new Error(t);var X,ue=typeof F;if(ue!=="string"){if(ue==="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);X=!0}for(var le=this.blocks,oe=this.byteCount,re=F.length,pe=this.blockCount,_e=0,Re=this.s,Q,de;_e>2]|=F[_e]<>2]|=de<>2]|=(192|de>>6)<>2]|=(128|de&63)<=57344?(le[Q>>2]|=(224|de>>12)<>2]|=(128|de>>6&63)<>2]|=(128|de&63)<>2]|=(240|de>>18)<>2]|=(128|de>>12&63)<>2]|=(128|de>>6&63)<>2]|=(128|de&63)<=oe){for(this.start=Q-oe,this.block=le[pe],Q=0;Q>8,ue=F&255;ue>0;)oe.unshift(ue),F=F>>8,ue=F&255,++le;return X?oe.push(le):oe.unshift(le),this.update(oe),oe.length},B.prototype.encodeString=function(F){var X,ue=typeof F;if(ue!=="string"){if(ue==="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);X=!0}var le=0,oe=F.length;if(X)le=oe;else for(var re=0;re=57344?le+=3:(pe=65536+((pe&1023)<<10|F.charCodeAt(++re)&1023),le+=4)}return le+=this.encode(le*8),this.update(F),le},B.prototype.bytepad=function(F,X){for(var ue=this.encode(X),le=0;le>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(F[0]=F[ue],X=1;X>4&15]+A[_e&15]+A[_e>>12&15]+A[_e>>8&15]+A[_e>>20&15]+A[_e>>16&15]+A[_e>>28&15]+A[_e>>24&15];re%F===0&&(ee(X),oe=0)}return le&&(_e=X[oe],pe+=A[_e>>4&15]+A[_e&15],le>1&&(pe+=A[_e>>12&15]+A[_e>>8&15]),le>2&&(pe+=A[_e>>20&15]+A[_e>>16&15])),pe},B.prototype.arrayBuffer=function(){this.finalize();var F=this.blockCount,X=this.s,ue=this.outputBlocks,le=this.extraBytes,oe=0,re=0,pe=this.outputBits>>3,_e;le?_e=new ArrayBuffer(ue+1<<2):_e=new ArrayBuffer(pe);for(var Re=new Uint32Array(_e);re>8&255,pe[_e+2]=Re>>16&255,pe[_e+3]=Re>>24&255;re%F===0&&ee(X)}return le&&(_e=re<<2,Re=X[oe],pe[_e]=Re&255,le>1&&(pe[_e+1]=Re>>8&255),le>2&&(pe[_e+2]=Re>>16&255)),pe};function W(F,X,ue){B.call(this,F,X,ue)}W.prototype=new B,W.prototype.finalize=function(){return this.encode(this.outputBits,!0),B.prototype.finalize.call(this)};var ee=function(F){var X,ue,le,oe,re,pe,_e,Re,Q,de,Ae,q,J,ce,xe,be,N,j,se,he,me,G,R,T,V,te,ae,ie,Te,Me,Le,ke,De,fe,Ce,Se,Fe,We,qe,ut,sn,Ct,it,ar,wt,Yt,Js,Vt,Xt,ne,ge,Be,we,Ee,ze,st,Ze,Je,yt,mt,gt,Zt,Rn;for(le=0;le<48;le+=2)oe=F[0]^F[10]^F[20]^F[30]^F[40],re=F[1]^F[11]^F[21]^F[31]^F[41],pe=F[2]^F[12]^F[22]^F[32]^F[42],_e=F[3]^F[13]^F[23]^F[33]^F[43],Re=F[4]^F[14]^F[24]^F[34]^F[44],Q=F[5]^F[15]^F[25]^F[35]^F[45],de=F[6]^F[16]^F[26]^F[36]^F[46],Ae=F[7]^F[17]^F[27]^F[37]^F[47],q=F[8]^F[18]^F[28]^F[38]^F[48],J=F[9]^F[19]^F[29]^F[39]^F[49],X=q^(pe<<1|_e>>>31),ue=J^(_e<<1|pe>>>31),F[0]^=X,F[1]^=ue,F[10]^=X,F[11]^=ue,F[20]^=X,F[21]^=ue,F[30]^=X,F[31]^=ue,F[40]^=X,F[41]^=ue,X=oe^(Re<<1|Q>>>31),ue=re^(Q<<1|Re>>>31),F[2]^=X,F[3]^=ue,F[12]^=X,F[13]^=ue,F[22]^=X,F[23]^=ue,F[32]^=X,F[33]^=ue,F[42]^=X,F[43]^=ue,X=pe^(de<<1|Ae>>>31),ue=_e^(Ae<<1|de>>>31),F[4]^=X,F[5]^=ue,F[14]^=X,F[15]^=ue,F[24]^=X,F[25]^=ue,F[34]^=X,F[35]^=ue,F[44]^=X,F[45]^=ue,X=Re^(q<<1|J>>>31),ue=Q^(J<<1|q>>>31),F[6]^=X,F[7]^=ue,F[16]^=X,F[17]^=ue,F[26]^=X,F[27]^=ue,F[36]^=X,F[37]^=ue,F[46]^=X,F[47]^=ue,X=de^(oe<<1|re>>>31),ue=Ae^(re<<1|oe>>>31),F[8]^=X,F[9]^=ue,F[18]^=X,F[19]^=ue,F[28]^=X,F[29]^=ue,F[38]^=X,F[39]^=ue,F[48]^=X,F[49]^=ue,ce=F[0],xe=F[1],Yt=F[11]<<4|F[10]>>>28,Js=F[10]<<4|F[11]>>>28,ie=F[20]<<3|F[21]>>>29,Te=F[21]<<3|F[20]>>>29,mt=F[31]<<9|F[30]>>>23,gt=F[30]<<9|F[31]>>>23,Ct=F[40]<<18|F[41]>>>14,it=F[41]<<18|F[40]>>>14,fe=F[2]<<1|F[3]>>>31,Ce=F[3]<<1|F[2]>>>31,be=F[13]<<12|F[12]>>>20,N=F[12]<<12|F[13]>>>20,Vt=F[22]<<10|F[23]>>>22,Xt=F[23]<<10|F[22]>>>22,Me=F[33]<<13|F[32]>>>19,Le=F[32]<<13|F[33]>>>19,Zt=F[42]<<2|F[43]>>>30,Rn=F[43]<<2|F[42]>>>30,Ee=F[5]<<30|F[4]>>>2,ze=F[4]<<30|F[5]>>>2,Se=F[14]<<6|F[15]>>>26,Fe=F[15]<<6|F[14]>>>26,j=F[25]<<11|F[24]>>>21,se=F[24]<<11|F[25]>>>21,ne=F[34]<<15|F[35]>>>17,ge=F[35]<<15|F[34]>>>17,ke=F[45]<<29|F[44]>>>3,De=F[44]<<29|F[45]>>>3,T=F[6]<<28|F[7]>>>4,V=F[7]<<28|F[6]>>>4,st=F[17]<<23|F[16]>>>9,Ze=F[16]<<23|F[17]>>>9,We=F[26]<<25|F[27]>>>7,qe=F[27]<<25|F[26]>>>7,he=F[36]<<21|F[37]>>>11,me=F[37]<<21|F[36]>>>11,Be=F[47]<<24|F[46]>>>8,we=F[46]<<24|F[47]>>>8,ar=F[8]<<27|F[9]>>>5,wt=F[9]<<27|F[8]>>>5,te=F[18]<<20|F[19]>>>12,ae=F[19]<<20|F[18]>>>12,Je=F[29]<<7|F[28]>>>25,yt=F[28]<<7|F[29]>>>25,ut=F[38]<<8|F[39]>>>24,sn=F[39]<<8|F[38]>>>24,G=F[48]<<14|F[49]>>>18,R=F[49]<<14|F[48]>>>18,F[0]=ce^~be&j,F[1]=xe^~N&se,F[10]=T^~te&ie,F[11]=V^~ae&Te,F[20]=fe^~Se&We,F[21]=Ce^~Fe&qe,F[30]=ar^~Yt&Vt,F[31]=wt^~Js&Xt,F[40]=Ee^~st&Je,F[41]=ze^~Ze&yt,F[2]=be^~j&he,F[3]=N^~se&me,F[12]=te^~ie&Me,F[13]=ae^~Te&Le,F[22]=Se^~We&ut,F[23]=Fe^~qe&sn,F[32]=Yt^~Vt&ne,F[33]=Js^~Xt&ge,F[42]=st^~Je&mt,F[43]=Ze^~yt>,F[4]=j^~he&G,F[5]=se^~me&R,F[14]=ie^~Me&ke,F[15]=Te^~Le&De,F[24]=We^~ut&Ct,F[25]=qe^~sn&it,F[34]=Vt^~ne&Be,F[35]=Xt^~ge&we,F[44]=Je^~mt&Zt,F[45]=yt^~gt&Rn,F[6]=he^~G&ce,F[7]=me^~R&xe,F[16]=Me^~ke&T,F[17]=Le^~De&V,F[26]=ut^~Ct&fe,F[27]=sn^~it&Ce,F[36]=ne^~Be&ar,F[37]=ge^~we&wt,F[46]=mt^~Zt&Ee,F[47]=gt^~Rn&ze,F[8]=G^~ce&be,F[9]=R^~xe&N,F[18]=ke^~T&te,F[19]=De^~V&ae,F[28]=Ct^~fe&Se,F[29]=it^~Ce&Fe,F[38]=Be^~ar&Yt,F[39]=we^~wt&Js,F[48]=Zt^~Ee&st,F[49]=Rn^~ze&Ze,F[0]^=d[le],F[1]^=d[le+1]};if(a)n.exports=v;else for(U=0;U>6===2;o++)s++;return s}return n===Wi.OVERRUN?t.length-e-1:0}function qG(n,e,t,r,i){return n===Wi.OVERLONG?(r.push(i),0):(r.push(65533),iN(n,e,t))}const eV=Object.freeze({error:JG,ignore:iN,replace:qG});function sN(n,e){e==null&&(e=eV.error),n=at(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(Wi.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(Wi.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(Wi.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(Wi.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(Wi.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(Wi.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function ua(n,e=Am.current){e!=Am.current&&(rN.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 at(t)}function tV(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function lg(n,e){return tV(sN(n,e))}function nV(n,e=Am.current){return sN(ua(n,e))}function bf(n){return rr(ua(n))}const oN="hash/5.7.0";function aN(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 rV(n){const e={};for(let t=0;t>--l&1}const u=31,f=Math.pow(2,u),h=f>>>1,p=h>>1,d=f-1;let g=0;for(let _=0;_1;){let D=C+S>>>1;_>>1|c(),b=b<<1^h,M=(M^h)<<1|h|1;y=b,w=1+M-b}let x=r-4;return m.map(_=>{switch(_-x){case 3:return x+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return x+256+(n[a++]<<8|n[a++]);case 1:return x+n[a++];default:return _-1}})}function sV(n){let e=0;return()=>n[e++]}function oV(n){return sV(iV(n))}function aV(n){return n&1?~n>>1:n>>1}function lV(n,e){let t=Array(n);for(let r=0;re[o]):t}function cV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(fV(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(hV(t,n))}return rV(aN(e))}function uV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function lN(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function fV(n,e){let t=1+e(),r=e(),i=uV(e),s=lN(i.length,1+n,e);return aN(s.map((o,a)=>{const l=o[0],A=o.slice(1);return Array(i[a]).fill(void 0).map((c,u)=>{let f=u*r;return[l+u*t,A.map(h=>h+f)]})}))}function hV(n,e){let t=1+e();return lN(t,1+n,e).map(i=>[i[0],i.slice(1)])}function dV(n){let e=Iy(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let A=Iy(n,e);if(A.length==0)break;r.push({set:new Set(A),node:t()})}r.sort((A,c)=>c.set.size-A.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 pV(){return oV(JO("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 fx=pV(),mV=new Set(Iy(fx)),gV=new Set(Iy(fx)),vV=cV(fx),yV=dV(fx),K2=45,$2=95;function AN(n){return nV(n)}function wV(n){return n.filter(e=>e!=65039)}function cN(n){for(let e of n.split(".")){let t=AN(e);try{for(let r=t.lastIndexOf($2)-1;r>=0;r--)if(t[r]!==$2)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===K2&&t[3]===K2)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function xV(n){return cN(_V(n,wV))}function _V(n,e){let t=AN(n).reverse(),r=[];for(;t.length;){let i=BV(t);if(i){r.push(...e(i));continue}let s=t.pop();if(mV.has(s)){r.push(s);continue}if(gV.has(s))continue;let o=vV[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return cN(bV(String.fromCodePoint(...r)))}function bV(n){return n.normalize("NFC")}function BV(n,e){var t;let r=yV,i,s,o=[],a=n.length;for(e&&(e.length=0);a;){let l=n[--a];if(r=(t=r.branches.find(A=>A.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 EV=new ve(oN),uN=new Uint8Array(32);uN.fill(0);function Y2(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function fN(n){const e=ua(xV(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(Y2(e.slice(r))),t}function Qv(n){typeof n!="string"&&EV.throwArgumentError("invalid ENS name; not a string","name",n);let e=uN;const t=fN(n);for(;t.length;)e=rr(Zi([e,rr(t.pop())]));return nt(e)}function CV(n){return nt(Zi(fN(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 SV="rlp/5.7.0",Go=new ve(SV);function X2(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function Z2(n,e,t){let r=0;for(let i=0;ie+1+r&&Go.throwError("child data too short",ve.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function dN(n,e){if(n.length===0&&Go.throwError("data too short",ve.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&Go.throwError("data short segment too short",ve.errors.BUFFER_OVERRUN,{});const r=Z2(n,e+1,t);return e+1+t+r>n.length&&Go.throwError("data long segment too short",ve.errors.BUFFER_OVERRUN,{}),J2(n,e,e+1+t,t+r)}else if(n[e]>=192){const t=n[e]-192;return e+1+t>n.length&&Go.throwError("data array too short",ve.errors.BUFFER_OVERRUN,{}),J2(n,e,e+1,t)}else if(n[e]>=184){const t=n[e]-183;e+1+t>n.length&&Go.throwError("data array too short",ve.errors.BUFFER_OVERRUN,{});const r=Z2(n,e+1,t);e+1+t+r>n.length&&Go.throwError("data array too short",ve.errors.BUFFER_OVERRUN,{});const i=nt(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&&Go.throwError("data too short",ve.errors.BUFFER_OVERRUN,{});const r=nt(n.slice(e+1,e+1+t));return{consumed:1+t,result:r}}return{consumed:1,result:nt(n[e])}}function IS(n){const e=at(n),t=dN(e,0);return t.consumed!==e.length&&Go.throwArgumentError("invalid rlp data","data",n),t.result}const MV="address/5.7.0",Bf=new ve(MV);function q2(n){Et(n,20)||Bf.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=at(rr(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 TV=9007199254740991;function IV(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const RS={};for(let n=0;n<10;n++)RS[String(n)]=String(n);for(let n=0;n<26;n++)RS[String.fromCharCode(65+n)]=String(10+n);const eI=Math.floor(IV(TV));function RV(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>RS[r]).join("");for(;e.length>=eI;){let r=e.substring(0,eI);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 Dr(n){let e=null;if(typeof n!="string"&&Bf.throwArgumentError("invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/))n.substring(0,2)!=="0x"&&(n="0x"+n),e=q2(n),n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==n&&Bf.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)!==RV(n)&&Bf.throwArgumentError("bad icap checksum","address",n),e=FG(n.substring(4));e.length<40;)e="0"+e;e=q2("0x"+e)}else Bf.throwArgumentError("invalid address","address",n);return e}function pN(n){let e=null;try{e=Dr(n.from)}catch{Bf.throwArgumentError("missing from address","transaction",n)}const t=mh(at(Ge.from(n.nonce).toHexString()));return Dr(zr(rr(hx([e,t])),12))}var FV=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Bn=new ve(oN),mN=new Uint8Array(32);mN.fill(0);const UV=Ge.from(-1),gN=Ge.from(0),vN=Ge.from(1),LV=Ge.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function PV(n){const e=at(n),t=e.length%32;return t?_i([e,mN.slice(t)]):nt(e)}const DV=kn(vN.toHexString(),32),OV=kn(gN.toHexString(),32),tI={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},k_=["name","version","chainId","verifyingContract","salt"];function nI(n){return function(e){return typeof e!="string"&&Bn.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const NV={name:nI("name"),version:nI("version"),chainId:function(n){try{return Ge.from(n).toString()}catch{}return Bn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return Dr(n).toLowerCase()}catch{}return Bn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){try{const e=at(n);if(e.length!==32)throw new Error("bad length");return nt(e)}catch{}return Bn.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function Q_(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))&&Bn.throwArgumentError("invalid numeric width","type",n);const i=LV.mask(t?r-1:r),s=t?i.add(vN).mul(UV):gN;return function(o){const a=Ge.from(o);return(a.lt(s)||a.gt(i))&&Bn.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),kn(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))&&Bn.throwArgumentError("invalid bytes width","type",n),function(r){return at(r).length!==t&&Bn.throwArgumentError(`invalid length for ${n}`,"value",r),PV(r)}}}switch(n){case"address":return function(e){return kn(Dr(e),32)};case"bool":return function(e){return e?DV:OV};case"bytes":return function(e){return rr(e)};case"string":return function(e){return bf(e)}}return null}function rI(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class Gi{constructor(e){Ue(this,"types",Object.freeze(ts(e))),Ue(this,"_encoderCache",{}),Ue(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(A=>{l[A.name]&&Bn.throwArgumentError(`duplicate variable name ${JSON.stringify(A.name)} in ${JSON.stringify(a)}`,"types",e),l[A.name]=!0;const c=A.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===a&&Bn.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!Q_(c)&&(r[c]||Bn.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),r[c].push(a),t[a][c]=!0)})}const s=Object.keys(r).filter(a=>r[a].length===0);s.length===0?Bn.throwArgumentError("missing primary type","types",e):s.length>1&&Bn.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),Ue(this,"primaryType",s[0]);function o(a,l){l[a]&&Bn.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(t[a]).forEach(A=>{r[A]&&(o(A,l),Object.keys(l).forEach(c=>{i[c][A]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=rI(a,e[a])+l.map(A=>rI(A,e[A])).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const i=Q_(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&&Bn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(rr)),rr(_i(l))}}const r=this.types[e];if(r){const i=bf(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const A=this.getEncoder(l)(s[a]);return this._types[l]?rr(A):A});return o.unshift(i),_i(o)}}return Bn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Bn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return rr(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(Q_(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&&Bn.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),{}):Bn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Gi(e)}static getPrimaryType(e){return Gi.from(e).primaryType}static hashStruct(e,t,r){return Gi.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=tI[r];i||Bn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>k_.indexOf(r.name)-k_.indexOf(i.name)),Gi.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return _i(["0x1901",Gi.hashDomain(e),Gi.from(t).hash(r)])}static hash(e,t,r){return rr(Gi.encode(e,t,r))}static resolveNames(e,t,r,i){return FV(this,void 0,void 0,function*(){e=wn(e);const s={};e.verifyingContract&&!Et(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=Gi.from(t);o.visit(r,(a,l)=>(a==="address"&&!Et(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){Gi.hashDomain(e);const i={},s=[];k_.forEach(l=>{const A=e[l];A!=null&&(i[l]=NV[l](A),s.push({name:l,type:tI[l]}))});const o=Gi.from(t),a=wn(t);return a.EIP712Domain?Bn.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,A)=>{if(l.match(/^bytes(\d*)/))return nt(at(A));if(l.match(/^u?int/))return Ge.from(A).toString();switch(l){case"address":return A.toLowerCase();case"bool":return!!A;case"string":return typeof A!="string"&&Bn.throwArgumentError("invalid string","value",A),A}return Bn.throwArgumentError("unsupported type","type",l)})}}}var yN={},Ft={},Ag=wN;function wN(n,e){if(!n)throw new Error(e||"Assertion failed")}wN.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var kB={exports:{}};typeof Object.create=="function"?kB.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:kB.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 kV=kB.exports,QV=Ag,HV=kV;Ft.inherits=HV;function zV(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function GV(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):zV(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}Ft.htonl=xN;function jV(n,e){for(var t="",r=0;r>>0}return s}Ft.join32=WV;function KV(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}Ft.split32=KV;function $V(n,e){return n>>>e|n<<32-e}Ft.rotr32=$V;function YV(n,e){return n<>>32-e}Ft.rotl32=YV;function XV(n,e){return n+e>>>0}Ft.sum32=XV;function ZV(n,e,t){return n+e+t>>>0}Ft.sum32_3=ZV;function JV(n,e,t,r){return n+e+t+r>>>0}Ft.sum32_4=JV;function qV(n,e,t,r,i){return n+e+t+r+i>>>0}Ft.sum32_5=qV;function ej(n,e,t,r){var i=n[e],s=n[e+1],o=r+s>>>0,a=(o>>0,n[e+1]=o}Ft.sum64=ej;function tj(n,e,t,r){var i=e+r>>>0,s=(i>>0}Ft.sum64_hi=tj;function nj(n,e,t,r){var i=e+r;return i>>>0}Ft.sum64_lo=nj;function rj(n,e,t,r,i,s,o,a){var l=0,A=e;A=A+r>>>0,l+=A>>0,l+=A>>0,l+=A>>0}Ft.sum64_4_hi=rj;function ij(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}Ft.sum64_4_lo=ij;function sj(n,e,t,r,i,s,o,a,l,A){var c=0,u=e;u=u+r>>>0,c+=u>>0,c+=u>>0,c+=u>>0,c+=u>>0}Ft.sum64_5_hi=sj;function oj(n,e,t,r,i,s,o,a,l,A){var c=e+r+s+a+A;return c>>>0}Ft.sum64_5_lo=oj;function aj(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}Ft.rotr64_hi=aj;function lj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.rotr64_lo=lj;function Aj(n,e,t){return n>>>t}Ft.shr64_hi=Aj;function cj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.shr64_lo=cj;var jh={},iI=Ft,uj=Ag;function dx(){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}jh.BlockHash=dx;dx.prototype.update=function(e,t){if(e=iI.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=iI.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}xa.g0_256=mj;function gj(n){return ia(n,17)^ia(n,19)^n>>>10}xa.g1_256=gj;var gh=Ft,vj=jh,yj=xa,H_=gh.rotl32,yd=gh.sum32,wj=gh.sum32_5,xj=yj.ft_1,SN=vj.BlockHash,_j=[1518500249,1859775393,2400959708,3395469782];function fa(){if(!(this instanceof fa))return new fa;SN.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}gh.inherits(fa,SN);var bj=fa;fa.blockSize=512;fa.outSize=160;fa.hmacStrength=80;fa.padLength=64;fa.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()),cW(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:at(new Uint8Array(i))}})}var pW=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const co=new ve(fW);function AI(n){return new Promise(e=>{setTimeout(e,n)})}function Fl(n,e){if(n==null)return null;if(typeof n=="string")return n;if(TS(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return lg(n)}catch{}return nt(n)}return n}function mW(n){return ua(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function gW(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;co.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;co.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 A={method:"GET"};let c=!1,u=2*60*1e3;if(typeof n=="string")l=n;else if(typeof n=="object"){if((n==null||n.url==null)&&co.throwArgumentError("missing URL","connection.url",n),l=n.url,typeof n.timeout=="number"&&n.timeout>0&&(u=n.timeout),n.headers)for(const m in n.headers)a[m.toLowerCase()]={key:m,value:String(n.headers[m])},["if-none-match","if-modified-since"].indexOf(m.toLowerCase())>=0&&(c=!0);if(A.allowGzip=!!n.allowGzip,n.user!=null&&n.password!=null){l.substring(0,6)!=="https:"&&n.allowInsecureAuthentication!==!0&&co.throwError("basic authentication requires a secure https url",ve.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const m=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+qO(ua(m))}}n.skipFetchSetup!=null&&(A.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(A.fetchOptions=wn(n.fetchOptions))}const f=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=l?l.match(f):null;if(h)try{const m={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?JO(h[3]):mW(h[3])};let y=m.body;return t&&(y=t(m.body,m)),Promise.resolve(y)}catch(m){co.throwError("processing response error",ve.errors.SERVER_ERROR,{body:Fl(h[1],h[2]),error:m,requestBody:null,requestMethod:"GET",url:l})}e&&(A.method="POST",A.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 p={};Object.keys(a).forEach(m=>{const y=a[m];p[y.key]=y.value}),A.headers=p;const d=function(){let m=null;return{promise:new Promise(function(x,_){u&&(m=setTimeout(()=>{m!=null&&(m=null,_(co.makeError("timeout",ve.errors.TIMEOUT,{requestBody:Fl(A.body,p["content-type"]),requestMethod:A.method,timeout:u,url:l})))},u))}),cancel:function(){m!=null&&(clearTimeout(m),m=null)}}}(),g=function(){return pW(this,void 0,void 0,function*(){for(let m=0;m=300)&&(d.cancel(),co.throwError("bad response",ve.errors.SERVER_ERROR,{status:y.statusCode,headers:y.headers,body:Fl(w,y.headers?y.headers["content-type"]:null),requestBody:Fl(A.body,p["content-type"]),requestMethod:A.method,url:l})),t)try{const x=yield t(w,y);return d.cancel(),x}catch(x){if(x.throttleRetry&&m{let a=null;if(s!=null)try{a=JSON.parse(lg(s))}catch(l){co.throwError("invalid JSON",ve.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=ua(e);const s=typeof n=="string"?{url:n}:wn(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=wn(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return gW(n,i,r)}function Ef(n,e){return e||(e={}),e=wn(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 A(){return n().then(function(c){if(c!==void 0)o()&&t(c);else if(e.oncePoll)e.oncePoll.once("poll",A);else if(e.onceBlock)e.onceBlock.once("block",A);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(A,u)}return null},function(c){o()&&r(c)})}A()})}var Ry="qpzry9x8gf2tvdw0s3jn54khce6mua7l",zB={};for(var zg=0;zg>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 NN(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=Zf(e)^r>>5}for(e=Zf(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=NN(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=Zf(r)^o,i+=Ry.charAt(o)}for(s=0;s<6;++s)r=Zf(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=Ry.charAt(a)}return i}function kN(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=NN(s);if(typeof a=="string")return a;for(var l=[],A=0;A=o.length)&&l.push(u)}return a!==1?"Invalid checksum for "+n:{prefix:s,words:l}}function yW(){var n=kN.apply(null,arguments);if(typeof n=="object")return n}function wW(n){var e=kN.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function mx(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=c&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?d=(f>>1)-g:d=g,h.isubn(d)):d=0,u[p]=d,h.iushrn(1)}return u}t.getNAF=r;function i(l,A){var c=[[],[]];l=l.clone(),A=A.clone();for(var u=0,f=0,h;l.cmpn(-u)>0||A.cmpn(-f)>0;){var p=l.andln(3)+u&3,d=A.andln(3)+f&3;p===3&&(p=-1),d===3&&(d=-1);var g;p&1?(h=l.andln(7)+u&7,(h===3||h===5)&&d===2?g=-p:g=p):g=0,c[0].push(g);var m;d&1?(h=A.andln(7)+f&7,(h===3||h===5)&&p===2?m=-d:m=d):m=0,c[1].push(m),2*u===g+1&&(u=1-u),2*f===m+1&&(f=1-f),l.iushrn(1),A.iushrn(1)}return c}t.getJSF=i;function s(l,A,c){var u="_"+A;l.prototype[A]=function(){return this[u]!==void 0?this[u]:this[u]=c.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 vt(l,"hex","le")}t.intFromLE=a}),Fy=fs.getNAF,SW=fs.getJSF,Uy=fs.assert;function GA(n,e){this.type=n,this.p=new vt(e.p,16),this.red=e.prime?vt.red(e.prime):vt.mont(this.p),this.zero=new vt(0).toRed(this.red),this.one=new vt(1).toRed(this.red),this.two=new vt(2).toRed(this.red),this.n=e.n&&new vt(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 eu=GA;GA.prototype.point=function(){throw new Error("Not implemented")};GA.prototype.validate=function(){throw new Error("Not implemented")};GA.prototype._fixedNafMul=function(e,t){Uy(e.precomputed);var r=e._getDoubles(),i=Fy(t,1,this._bitLength),s=(1<=a;A--)l=(l<<1)+i[A];o.push(l)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),f=s;f>0;f--){for(a=0;a=0;l--){for(var A=0;l>=0&&o[l]===0;l--)A++;if(l>=0&&A++,a=a.dblp(A),l<0)break;var c=o[l];Uy(c!==0),e.type==="affine"?c>0?a=a.mixedAdd(s[c-1>>1]):a=a.mixedAdd(s[-c-1>>1].neg()):c>0?a=a.add(s[c-1>>1]):a=a.add(s[-c-1>>1].neg())}return e.type==="affine"?a.toP():a};GA.prototype._wnafMulAdd=function(e,t,r,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,A=0,c,u,f;for(c=0;c=1;c-=2){var p=c-1,d=c;if(o[p]!==1||o[d]!==1){l[p]=Fy(r[p],o[p],this._bitLength),l[d]=Fy(r[d],o[d],this._bitLength),A=Math.max(l[p].length,A),A=Math.max(l[d].length,A);continue}var g=[t[p],null,null,t[d]];t[p].y.cmp(t[d].y)===0?(g[1]=t[p].add(t[d]),g[2]=t[p].toJ().mixedAdd(t[d].neg())):t[p].y.cmp(t[d].y.redNeg())===0?(g[1]=t[p].toJ().mixedAdd(t[d]),g[2]=t[p].add(t[d].neg())):(g[1]=t[p].toJ().mixedAdd(t[d]),g[2]=t[p].toJ().mixedAdd(t[d].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=SW(r[p],r[d]);for(A=Math.max(y[0].length,A),l[p]=new Array(A),l[d]=new Array(A),u=0;u=0;c--){for(var S=0;c>=0;){var b=!0;for(u=0;u=0&&S++,_=_.dblp(S),c<0)break;for(u=0;u0?f=a[u][M-1>>1]:M<0&&(f=a[u][-M-1>>1].neg()),f.type==="affine"?_=_.mixedAdd(f):_=_.add(f))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step):!1};Ws.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=A,p=c),u.negative&&(u=u.neg(),f=f.neg()),h.negative&&(h=h.neg(),p=p.neg()),[{a:u,b:f},{a:h,b:p}]};Ks.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),A=s.mul(r.b),c=o.mul(i.b),u=e.sub(a).sub(l),f=A.add(c).neg();return{k1:u,k2:f}};Ks.prototype.pointFromX=function(e,t){e=new vt(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)};Ks.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};Ks.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Sr.prototype.isInfinity=function(){return this.inf};Sr.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)};Sr.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)};Sr.prototype.getX=function(){return this.x.fromRed()};Sr.prototype.getY=function(){return this.y.fromRed()};Sr.prototype.mul=function(e){return e=new vt(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)};Sr.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)};Sr.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)};Sr.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)};Sr.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};Sr.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 Nr(n,e,t,r){eu.BasePoint.call(this,n,"jacobian"),e===null&&t===null&&r===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new vt(0)):(this.x=new vt(e,16),this.y=new vt(t,16),this.z=new vt(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}US(Nr,eu.BasePoint);Ks.prototype.jpoint=function(e,t,r){return new Nr(this,e,t,r)};Nr.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)};Nr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Nr.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),A=o.redSub(a);if(l.cmpn(0)===0)return A.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=l.redSqr(),u=c.redMul(l),f=i.redMul(c),h=A.redSqr().redIAdd(u).redISub(f).redISub(f),p=A.redMul(f.redISub(h)).redISub(o.redMul(u)),d=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(h,p,d)};Nr.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 A=a.redSqr(),c=A.redMul(a),u=r.redMul(A),f=l.redSqr().redIAdd(c).redISub(u).redISub(u),h=l.redMul(u.redISub(f)).redISub(s.redMul(c)),p=this.z.redMul(a);return this.curve.jpoint(f,h,p)};Nr.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}};Nr.prototype.inspect=function(){return this.isInfinity()?"":""};Nr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Hv=$h(function(n,e){var t=e;t.base=eu,t.short=TW,t.mont=null,t.edwards=null}),zv=$h(function(n,e){var t=e,r=fs.assert;function i(a){a.type==="short"?this.curve=new Hv.short(a):a.type==="edwards"?this.curve=new Hv.edwards(a):this.curve=new Hv.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 A=new i(l);return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,value:A}),A}})}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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.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:Qo.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",o]})});function RA(n){if(!(this instanceof RA))return new RA(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=wo.toArray(n.entropy,n.entropyEnc||"hex"),t=wo.toArray(n.nonce,n.nonceEnc||"hex"),r=wo.toArray(n.pers,n.persEnc||"hex");FS(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var HN=RA;RA.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};RA.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=wo.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var IW=fs.assert;function gx(n,e){if(n instanceof gx)return n;this._importDER(n,e)||(IW(n.r&&n.s,"Signature without r or s"),this.r=new vt(n.r,16),this.s=new vt(n.s,16),n.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=n.recoveryParam)}var vx=gx;function RW(){this.place=0}function j_(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 uI(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)}gx.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=uI(t),r=uI(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];W_(i,t.length),i=i.concat(t),i.push(2),W_(i,r.length);var s=i.concat(r),o=[48];return W_(o,s.length),o=o.concat(s),fs.encode(o,e)};var FW=function(){throw new Error("unsupported")},zN=fs.assert;function Hs(n){if(!(this instanceof Hs))return new Hs(n);typeof n=="string"&&(zN(Object.prototype.hasOwnProperty.call(zv,n),"Unknown curve "+n),n=zv[n]),n instanceof zv.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 UW=Hs;Hs.prototype.keyPair=function(e){return new LS(this,e)};Hs.prototype.keyFromPrivate=function(e,t){return LS.fromPrivate(this,e,t)};Hs.prototype.keyFromPublic=function(e,t){return LS.fromPublic(this,e,t)};Hs.prototype.genKeyPair=function(e){e||(e={});for(var t=new HN({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||FW(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new vt(2));;){var s=new vt(t.generate(r));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};Hs.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};Hs.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 vt(e,16));for(var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new HN({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),A=this.n.sub(new vt(1)),c=0;;c++){var u=i.k?i.k(c):new vt(l.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(A)>=0)){var f=this.g.mul(u);if(!f.isInfinity()){var h=f.getX(),p=h.umod(this.n);if(p.cmpn(0)!==0){var d=u.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(d=d.umod(this.n),d.cmpn(0)!==0){var g=(f.getY().isOdd()?1:0)|(h.cmp(p)!==0?2:0);return i.canonical&&d.cmp(this.nh)>0&&(d=this.n.sub(d),g^=1),new vx({r:p,s:d,recoveryParam:g})}}}}}};Hs.prototype.verify=function(e,t,r,i){e=this._truncateToN(new vt(e,16)),r=this.keyFromPublic(r,i),t=new vx(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),A=a.mul(s).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(l,r.getPublic(),A),c.isInfinity()?!1:c.eqXToP(s)):(c=this.g.mulAdd(l,r.getPublic(),A),c.isInfinity()?!1:c.getX().umod(this.n).cmp(s)===0)};Hs.prototype.recoverPubKey=function(n,e,t,r){zN((3&t)===t,"The recovery param is more than two bits"),e=new vx(e,r);var i=this.n,s=new vt(n),o=e.r,a=e.s,l=t&1,A=t>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&A)throw new Error("Unable to find sencond key candinate");A?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var c=e.r.invm(i),u=i.sub(s).mul(c).umod(i),f=a.mul(c).umod(i);return this.g.mulAdd(u,o,f)};Hs.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new vx(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 LW=$h(function(n,e){var t=e;t.version="6.5.4",t.utils=fs,t.rand=function(){throw new Error("unsupported")},t.curve=Hv,t.curves=zv,t.ec=UW,t.eddsa=null}),PW=LW.ec;const DW="signing-key/5.7.0",VB=new ve(DW);let K_=null;function jo(){return K_||(K_=new PW("secp256k1")),K_}class OW{constructor(e){Ue(this,"curve","secp256k1"),Ue(this,"privateKey",nt(e)),kc(this.privateKey)!==32&&VB.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=jo().keyFromPrivate(at(this.privateKey));Ue(this,"publicKey","0x"+t.getPublic(!1,"hex")),Ue(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Ue(this,"_isSigningKey",!0)}_addPoint(e){const t=jo().keyFromPublic(at(this.publicKey)),r=jo().keyFromPublic(at(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=jo().keyFromPrivate(at(this.privateKey)),r=at(e);r.length!==32&&VB.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return ux({recoveryParam:i.recoveryParam,r:kn("0x"+i.r.toString(16),32),s:kn("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=jo().keyFromPrivate(at(this.privateKey)),r=jo().keyFromPublic(at(GN(e)));return kn("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function NW(n,e){const t=ux(e),r={r:at(t.r),s:at(t.s)};return"0x"+jo().recoverPubKey(at(n),r,t.recoveryParam).encode("hex",!1)}function GN(n,e){const t=at(n);if(t.length===32){const r=new OW(t);return e?"0x"+jo().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?nt(t):"0x"+jo().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+jo().keyFromPublic(t).getPublic(!0,"hex"):nt(t)}return VB.throwArgumentError("invalid public or private key","key","[REDACTED]")}const kW="transactions/5.7.0",Bl=new ve(kW);var fI;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(fI||(fI={}));function PS(n){return n==="0x"?null:Dr(n)}function Vr(n){return n==="0x"?tN:Ge.from(n)}function QW(n){const e=GN(n);return Dr(zr(rr(zr(e,1)),12))}function VN(n,e){return QW(NW(at(n),e))}function Ki(n,e){const t=mh(Ge.from(n).toHexString());return t.length>32&&Bl.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function $_(n,e){return{address:Dr(n),storageKeys:(e||[]).map((t,r)=>(kc(t)!==32&&Bl.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function tu(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(t.length>2&&Bl.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${r}]`,t),$_(t[0],t[1])):$_(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return $_(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function jN(n){return tu(n).map(e=>[e.address,e.storageKeys])}function HW(n,e){if(n.gasPrice!=null){const r=Ge.from(n.gasPrice),i=Ge.from(n.maxFeePerGas||0);r.eq(i)||Bl.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:i})}const t=[Ki(n.chainId||0,"chainId"),Ki(n.nonce||0,"nonce"),Ki(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ki(n.maxFeePerGas||0,"maxFeePerGas"),Ki(n.gasLimit||0,"gasLimit"),n.to!=null?Dr(n.to):"0x",Ki(n.value||0,"value"),n.data||"0x",jN(n.accessList||[])];if(e){const r=ux(e);t.push(Ki(r.recoveryParam,"recoveryParam")),t.push(mh(r.r)),t.push(mh(r.s))}return _i(["0x02",hx(t)])}function zW(n,e){const t=[Ki(n.chainId||0,"chainId"),Ki(n.nonce||0,"nonce"),Ki(n.gasPrice||0,"gasPrice"),Ki(n.gasLimit||0,"gasLimit"),n.to!=null?Dr(n.to):"0x",Ki(n.value||0,"value"),n.data||"0x",jN(n.accessList||[])];if(e){const r=ux(e);t.push(Ki(r.recoveryParam,"recoveryParam")),t.push(mh(r.r)),t.push(mh(r.s))}return _i(["0x01",hx(t)])}function WN(n,e,t){try{const r=Vr(e[0]).toNumber();if(r!==0&&r!==1)throw new Error("bad recid");n.v=r}catch{Bl.throwArgumentError("invalid v for transaction type: 1","v",e[0])}n.r=kn(e[1],32),n.s=kn(e[2],32);try{const r=rr(t(n));n.from=VN(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function GW(n){const e=IS(n.slice(1));e.length!==9&&e.length!==12&&Bl.throwArgumentError("invalid component count for transaction type: 2","payload",nt(n));const t=Vr(e[2]),r=Vr(e[3]),i={type:2,chainId:Vr(e[0]).toNumber(),nonce:Vr(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:Vr(e[4]),to:PS(e[5]),value:Vr(e[6]),data:e[7],accessList:tu(e[8])};return e.length===9||(i.hash=rr(n),WN(i,e.slice(9),HW)),i}function VW(n){const e=IS(n.slice(1));e.length!==8&&e.length!==11&&Bl.throwArgumentError("invalid component count for transaction type: 1","payload",nt(n));const t={type:1,chainId:Vr(e[0]).toNumber(),nonce:Vr(e[1]).toNumber(),gasPrice:Vr(e[2]),gasLimit:Vr(e[3]),to:PS(e[4]),value:Vr(e[5]),data:e[6],accessList:tu(e[7])};return e.length===8||(t.hash=rr(n),WN(t,e.slice(8),zW)),t}function jW(n){const e=IS(n);e.length!==9&&e.length!==6&&Bl.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:Vr(e[0]).toNumber(),gasPrice:Vr(e[1]),gasLimit:Vr(e[2]),to:PS(e[3]),value:Vr(e[4]),data:e[5],chainId:0};if(e.length===6)return t;try{t.v=Ge.from(e[6]).toNumber()}catch{return t}if(t.r=kn(e[7],32),t.s=kn(e[8],32),Ge.from(t.r).isZero()&&Ge.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(nt(t.chainId)),i.push("0x"),i.push("0x"),r-=t.chainId*2+8);const s=rr(hx(i));try{t.from=VN(s,{r:nt(t.r),s:nt(t.s),recoveryParam:r})}catch{}t.hash=rr(n)}return t.type=null,t}function WW(n){const e=at(n);if(e[0]>127)return jW(e);switch(e[0]){case 1:return VW(e);case 2:return GW(e)}return Bl.throwError(`unsupported transaction type: ${e[0]}`,ve.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const xd=new ve(Jr);let hI=class et{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),A=this.type.bind(this),c=u=>this.data(u,!0);return e.transaction={hash:o,type:A,accessList:et.allowNull(this.accessList.bind(this),null),blockHash:et.allowNull(o,null),blockNumber:et.allowNull(l,null),transactionIndex:et.allowNull(l,null),confirmations:et.allowNull(l,null),from:t,gasPrice:et.allowNull(r),maxPriorityFeePerGas:et.allowNull(r),maxFeePerGas:et.allowNull(r),gasLimit:r,to:et.allowNull(t,null),value:r,nonce:l,data:s,r:et.allowNull(this.uint256),s:et.allowNull(this.uint256),v:et.allowNull(l),creates:et.allowNull(t,null),raw:et.allowNull(s)},e.transactionRequest={from:et.allowNull(t),nonce:et.allowNull(l),gasLimit:et.allowNull(r),gasPrice:et.allowNull(r),maxPriorityFeePerGas:et.allowNull(r),maxFeePerGas:et.allowNull(r),to:et.allowNull(t),value:et.allowNull(r),data:et.allowNull(c),type:et.allowNull(l),accessList:et.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:t,topics:et.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:et.allowNull(this.address,null),from:et.allowNull(this.address,null),contractAddress:et.allowNull(t,null),transactionIndex:l,root:et.allowNull(a),gasUsed:r,logsBloom:et.allowNull(s),blockHash:o,transactionHash:o,logs:et.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:et.allowNull(l,null),cumulativeGasUsed:r,effectiveGasPrice:et.allowNull(r),status:et.allowNull(l),type:A},e.block={hash:et.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:et.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:et.allowNull(t),extraData:s,transactions:et.allowNull(et.arrayOf(o)),baseFeePerGas:et.allowNull(r)},e.blockWithTransactions=wn(e.block),e.blockWithTransactions.transactions=et.allowNull(et.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:et.allowNull(i,void 0),toBlock:et.allowNull(i,void 0),blockHash:et.allowNull(o,void 0),address:et.allowNull(t,void 0),topics:et.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:et.allowNull(l),blockHash:et.allowNull(o),transactionIndex:l,removed:et.allowNull(this.boolean.bind(this)),address:t,data:et.allowFalsish(s,"0x"),topics:et.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return tu(e||[])}number(e){return e==="0x"?0:Ge.from(e).toNumber()}type(e){return e==="0x"||e==null?0:Ge.from(e).toNumber()}bigNumber(e){return Ge.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),Et(e))?e.toLowerCase():xd.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 Dr(e)}callAddress(e){if(!Et(e,32))return null;const t=Dr(zr(e,12));return t===VG?null:t}contractAddress(e){return pN(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"||Et(e))return cx(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return kc(r)!==32?xd.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(e==null)return null;const t=Ge.from(e);try{return t.toNumber()}catch{}return null}uint256(e){if(!Et(e))throw new Error("invalid uint256");return kn(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=et.check(t,e);return i._difficulty=r==null?null:Ge.from(r),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return et.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&Ge.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=et.check(this.formats.transaction,e);if(e.chainId!=null){let r=e.chainId;Et(r)&&(r=Ge.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;r==null&&t.v==null&&(r=e.chainId),Et(r)&&(r=Ge.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 WW(e)}receiptLog(e){return et.check(this.formats.receiptLog,e)}receipt(e){const t=et.check(this.formats.receipt,e);if(t.root!=null)if(t.root.length<=4){const r=Ge.from(t.root).toNumber();r===0||r===1?(t.status!=null&&t.status!==r&&xd.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):xd.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&xd.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 et.check(this.formats.filter,e)}filterLog(e){return et.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 KW(n){return n&&typeof n.isCommunityResource=="function"}function dI(n){return KW(n)&&n.isCommunityResource()}let pI=!1;function yx(){pI||(pI=!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 ht=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Bt=new ve(Jr),$W=10;function mI(n){return n==null?"null":(kc(n)!==32&&Bt.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function gI(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[mI(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return mI(e)}).join("&")}function YW(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 gu(n){if(typeof n=="string"){if(n=n.toLowerCase(),kc(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+gI(n);if(HG.isForkEvent(n))throw Bt.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+gI(n.topics||[])}throw new Error("invalid event - "+n)}function _d(){return new Date().getTime()}function vI(n){return new Promise(e=>{setTimeout(e,n)})}const XW=["block","network","pending","poll"];let ZW=class{constructor(e,t,r){Ue(this,"tag",e),Ue(this,"listener",t),Ue(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=YW(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||XW.indexOf(this.tag)>=0}};const JW={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 Y_(n){return kn(Ge.from(n).toHexString(),32)}function yI(n){return NB.encode(Zi([n,zr(lI(lI(n)),0,4)]))}const KN=new RegExp("^(ipfs)://(.*)$","i"),wI=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),KN,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Gv(n,e){try{return lg(cm(n,e))}catch{}return null}function cm(n,e){if(n==="0x")return null;const t=Ge.from(zr(n,e,e+32)).toNumber(),r=Ge.from(zr(n,t,t+32)).toNumber();return zr(n,t+32,t+32+r)}function X_(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):Bt.throwArgumentError("unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}function xI(n){const e=at(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 qW(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function $N(n){const e=[];let t=0;for(let r=0;rGe.from(e).eq(1)).catch(e=>{if(e.code===ve.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return ht(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:_i([e,Qv(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=_i(["0x9061b923",$N([CV(this.name),r.data])]));try{let s=yield this.provider.call(r);return at(s).length%32===4&&Bt.throwError("resolver threw error",ve.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=cm(s,0)),s}catch(s){if(s.code===ve.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return ht(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?cm(r,0):null})}_getAddress(e,t){const r=JW[String(e)];if(r==null&&Bt.throwError(`unsupported coin type: ${e}`,ve.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),r.ilk==="eth")return this.provider.formatter.address(t);const i=at(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 yI(Zi([[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 yI(Zi([[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=cI.toWords(i.slice(2));return a.unshift(o),cI.encode(r.prefix,a)}}return null}getAddress(e){return ht(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===$G?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===ve.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",Y_(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&Bt.throwError("invalid or unsupported coin data",ve.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return ht(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 Bt.throwError("invalid or unsupported content hash data",ve.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ht(this,void 0,void 0,function*(){let t=ua(e);t=Zi([Y_(64),Y_(t.length),t]),t.length%32!==0&&(t=Zi([t,kn("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",nt(t));return r==null||r==="0x"?null:lg(r)})}}let Z_=null,e9=1;class DS extends ag{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Ue(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=Ji(new.target,"getNetwork")(e);t?(Ue(this,"_network",t),this.emit("network",t,null)):Bt.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ht(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||Bt.throwError("no network detected",ve.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:Ue(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return Ef(()=>this._ready().then(e=>e,e=>{if(!(e.code===ve.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Z_==null&&(Z_=new hI),Z_}static getNetwork(e){return ZO(e??"homestead")}ccipReadFetch(e,t,r){return ht(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 px({url:A,errorPassThrough:!0},c,(h,p)=>(h.status=p.statusCode,h));if(u.data)return u.data;const f=u.message||"unknown error";if(u.status>=400&&u.status<500)return Bt.throwError(`response not found during CCIP fetch: ${f}`,ve.errors.SERVER_ERROR,{url:l,errorMessage:f});o.push(f)}return Bt.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,ve.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return ht(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(_d()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=_d(),r=qn({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=_d();return i=Ge.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return ht(this,void 0,void 0,function*(){const e=e9++,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)Bt.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Bt.makeError("network block skew detected",ve.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(A=>{A.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=A.blockNumber),this._emitted["b:"+A.blockHash]=A.blockNumber,this._emitted["t:"+A.transactionHash]=A.blockNumber,this.emit(s,A)})}).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 ht(this,void 0,void 0,function*(){return Bt.throwError("provider does not support network detection",ve.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ht(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 vI(0),this._network;const r=Bt.makeError("underlying network changed",ve.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=_d();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 ht(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return ht(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 A=!1;const c=function(){return A?!0:(A=!0,l.forEach(f=>{f()}),!1)},u=f=>{f.confirmations{this.removeListener(e,u)}),i){let f=i.startBlock,h=null;const p=d=>ht(this,void 0,void 0,function*(){A||(yield vI(1e3),this.getTransactionCount(i.from).then(g=>ht(this,void 0,void 0,function*(){if(!A){if(g<=i.nonce)f=d;else{{const m=yield this.getTransaction(e);if(m&&m.blockNumber!=null)return}for(h==null&&(h=f-3,h{A||this.once("block",p)}))});if(A)return;this.once("block",p),l.push(()=>{this.removeListener("block",p)})}if(typeof r=="number"&&r>0){const f=setTimeout(()=>{c()||a(Bt.makeError("timeout exceeded",ve.errors.TIMEOUT,{timeout:r}))},r);f.unref&&f.unref(),l.push(()=>{clearTimeout(f)})}})})}getBlockNumber(){return ht(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Ge.from(e)}catch(t){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getBalance",r);try{return Ge.from(i)}catch(s){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getTransactionCount",r);try{return Ge.from(i).toNumber()}catch(s){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getCode",r);try{return nt(i)}catch(s){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then(o=>cx(o))}),s=yield this.perform("getStorageAt",i);try{return nt(s)}catch(o){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&kc(t)!==32)throw new Error("invalid response - sendTransaction");const i=e;return t!=null&&e.hash!==t&&Bt.throwError("Transaction hash mismatch from Provider.sendTransaction.",ve.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>ht(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&&Bt.throwError("transaction failed",ve.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then(s=>nt(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 ht(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?Ge.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?nt(s):null))}),this.formatter.transactionRequest(yield qn(r))})}_getFilter(e){return ht(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 qn(t))})}_call(e,t,r){return ht(this,void 0,void 0,function*(){r>=$W&&Bt.throwError("CCIP read exceeded maximum redirections",ve.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"&&kc(s)%32===4)try{const o=zr(s,4),a=zr(o,0,32);Ge.from(a).eq(i)||Bt.throwError("CCIP Read sender did not match",ve.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],A=Ge.from(zr(o,32,64)).toNumber(),c=Ge.from(zr(o,A,A+32)).toNumber(),u=zr(o,A+32);for(let m=0;mht(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 ht(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Ef(()=>ht(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 ht(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Ef(()=>ht(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 ht(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield qn({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach(i=>{i.removed==null&&(i.removed=!1)}),hI.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return ht(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ht(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Bt.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 ht(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 _I(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return ht(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Bt.throwError("network does not support ENS",ve.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Qv(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ht(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(r){if(Et(e))throw r}typeof e!="string"&&Bt.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return ht(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=Gv(yield this.call({to:r,data:"0x691f3431"+Qv(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ht(this,void 0,void 0,function*(){let t=null;if(Et(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;t=new _I(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==ve.errors.CALL_EXCEPTION)throw a}try{const a=Gv(yield this.call({to:o,data:"0x691f3431"+Qv(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==ve.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 Bt.throwError(e+" not implemented",ve.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 ZW(gu(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=gu(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=gu(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=gu(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=gu(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=gu(e);this._events=this._events.filter(i=>i.tag!==r?!0:(t.push(i),!1))}return t.forEach(r=>{this._stopEvent(r)}),this}}const t9="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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const ys=new ve(t9),n9=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],r9=[ve.errors.INSUFFICIENT_FUNDS,ve.errors.NONCE_EXPIRED,ve.errors.REPLACEMENT_UNDERPRICED];class cg{constructor(){ys.checkAbstract(new.target,cg),Ue(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 qn(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 qn(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)n9.indexOf(r)===-1&&ys.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=wn(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()&&ys.throwArgumentError("from address mismatch","transaction",e),r[0])),t}populateTransaction(e){return ro(this,void 0,void 0,function*(){const t=yield qn(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&&ys.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)?ys.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(t.type===0||t.type===1)&&r&&ys.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&&ys.throwError("network does not support EIP-1559",ve.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):ys.throwError("failed to get consistent fee data",ve.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(r9.indexOf(i.code)>=0)throw i;return ys.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.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]&&ys.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield qn(t)})}_checkProvider(e){this.provider||ys.throwError("missing provider",ve.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class OS extends cg{constructor(e,t){super(),Ue(this,"address",e),Ue(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{ys.throwError(e,ve.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 OS(this.address,e)}}var Wa=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const er=new ve(Jr),i9=["call","estimateGas"];function kp(n,e){if(n==null)return null;if(typeof n.message=="string"&&n.message.match("reverted")){const t=Et(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=kp(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return kp(JSON.parse(n),e)}catch{}return null}function YN(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=kp(e,!0);if(s)return s.data;er.throwError("missing revert data in call exception; Transaction reverted without a reason string",ve.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=kp(e.body,!1);s==null&&(s=kp(e,!1)),s&&er.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===ve.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)&&er.throwError("insufficient funds for intrinsic transaction cost",ve.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&er.throwError("nonce has already been used",ve.errors.NONCE_EXPIRED,{error:e,method:n,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&er.throwError("replacement fee too low",ve.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&er.throwError("legacy pre-eip-155 transactions not supported",ve.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),i9.indexOf(n)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&er.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function bI(n){return new Promise(function(e){setTimeout(e,n)})}function s9(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 bd(n){return n&&n.toLowerCase()}const jB={};class XN extends cg{constructor(e,t,r){if(super(),e!==jB)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Ue(this,"provider",t),r==null&&(r=0),typeof r=="string"?(Ue(this,"_address",this.provider.formatter.address(r)),Ue(this,"_index",null)):typeof r=="number"?(Ue(this,"_index",r),Ue(this,"_address",null)):er.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return er.throwError("cannot alter JSON-RPC Signer connection",ve.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new o9(jB,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&&er.throwError("unknown account #"+this._index,ve.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=wn(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=wn(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>Wa(this,void 0,void 0,function*(){if(r==null)return null;const i=yield this.provider.resolveName(r);return i==null&&er.throwArgumentError("provided ENS name resolves to null","tx.to",r),i}))),qn({tx:qn(e),sender:t}).then(({tx:r,sender:i})=>{r.from!=null?r.from.toLowerCase()!==i&&er.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)&&er.throwError("user rejected transaction",ve.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),YN("sendTransaction",o,s)))})}signTransaction(e){return er.throwError("signing transactions is unsupported",ve.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Wa(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 Ef(()=>Wa(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 Wa(this,void 0,void 0,function*(){const t=typeof e=="string"?ua(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[nt(t),r.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&er.throwError("user rejected signing",ve.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return Wa(this,void 0,void 0,function*(){const t=typeof e=="string"?ua(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),nt(t)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&er.throwError("user rejected signing",ve.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return Wa(this,void 0,void 0,function*(){const i=yield Gi.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(Gi.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&er.throwError("user rejected signing",ve.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return Wa(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class o9 extends XN{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 a9={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class um extends DS{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=Ji(this.constructor,"defaultUrl")()),typeof e=="string"?Ue(this,"connection",Object.freeze({url:e})):Ue(this,"connection",Object.freeze(wn(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 Wa(this,void 0,void 0,function*(){yield bI(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=Ji(this.constructor,"getNetwork");try{return t(Ge.from(e).toNumber())}catch(r){return er.throwError("could not detect network",ve.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return er.throwError("could not detect network",ve.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new XN(jB,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:ts(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=px(this.connection,JSON.stringify(r),s9).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",[bd(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[bd(t.address),t.blockTag]];case"getCode":return["eth_getCode",[bd(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[bd(t.address),kn(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",[Ji(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[Ji(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=bd(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Wa(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=t.transaction;if(i&&i.type!=null&&Ge.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(t=wn(t),t.transaction=wn(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&er.throwError(e+" not implemented",ve.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return YN(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 bI(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=wn(a9);if(t)for(const s in t)t[s]&&(r[s]=!0);PG(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=cx(Ge.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=nt(e[s]))}),e.accessList&&(i.accessList=tu(e.accessList)),i}}let Qp=null;try{if(Qp=WebSocket,Qp==null)throw new Error("inject please")}catch{const e=new ve(Jr);Qp=function(){e.throwError("WebSockets not supported in this environment",ve.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var J_=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Gg=new ve(Jr);let l9=1;class NS extends um{constructor(e,t){t==="any"&&Gg.throwError("WebSocketProvider does not support 'any' network yet",ve.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,t):super("_websocket",t),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?Ue(this,"_websocket",new Qp(this.connection.url)):Ue(this,"_websocket",e),Ue(this,"_requests",{}),Ue(this,"_subs",{}),Ue(this,"_subIds",{}),Ue(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 A=null;o.error?(A=new Error(o.error.message||"unknown error"),Ue(A,"code",o.error.code||null),Ue(A,"response",s)):A=new Error("unknown error"),l.callback(A,void 0),this.emit("debug",{action:"response",error:A,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){Gg.throwError("cannot reset events block on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Gg.throwError("cannot set polling interval on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return J_(this,void 0,void 0,function*(){return null})}set polling(e){e&&Gg.throwError("cannot set polling on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=l9++;return new Promise((i,s)=>{function o(l,A){return l?s(l):i(A)}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 J_(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=Ge.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 J_(this,void 0,void 0,function*(){this.websocket.readyState===Qp.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const dp=new ve(Jr);class ZN extends um{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return A9(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||dp.throwError("no network detected",ve.errors.UNKNOWN_ERROR,{}),this._network==null&&(Ue(this,"_network",t),this.emit("network",t,null))),t})}}class VA extends ZN{constructor(e,t){dp.checkAbstract(new.target,VA),e=Ji(new.target,"getNetwork")(e),t=Ji(new.target,"getApiKey")(t);const r=Ji(new.target,"getUrl")(e,t);super(r,e),typeof t=="string"?Ue(this,"apiKey",t):t!=null&&Object.keys(t).forEach(i=>{Ue(this,i,t[i])})}_startPending(){dp.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return dp.throwError("API provider does not support signing",ve.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return dp.throwError("not implemented; sub-classes must override getUrl",ve.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const BI=new ve(Jr),Vv="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class c9 extends NS{constructor(e,t){const r=new JN(e,t),i=r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,r.network),Ue(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===Vv}}class JN extends VA{static getWebSocketProvider(e,t){return new c9(e,t)}static getApiKey(e){return e==null?Vv:(e&&typeof e!="string"&&BI.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:BI.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===Vv&&yx(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Vv}}const u9=new ve(Jr),Vg="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function f9(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 u9.throwArgumentError("unsupported network","name",n)}class h9 extends VA{isCommunityResource(){return this.apiKey===Vg}static getApiKey(e){return e??Vg}static getUrl(e,t){t==null&&(t=Vg);const r={allowGzip:!0,url:"https://"+f9(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===Vg&&yx(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var d9=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const EI=new ve(Jr);class p9 extends VA{static getApiKey(e){return e!=null&&EI.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:EI.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return d9(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 jg=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const ql=new ve(Jr);function CI(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(nt(r)):t==="accessList"?r="["+tu(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=nt(r),e[t]=r)}return e}function m9(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 SI(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 MI(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function q_(n,e,t){if(n==="call"&&e.code===ve.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,"")),Et(s))return s;ql.throwError("missing revert data in call exception",ve.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===ve.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/)&&ql.throwError("insufficient funds for intrinsic transaction cost",ve.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:t}),r.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ql.throwError("nonce has already been used",ve.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&ql.throwError("replacement fee too low",ve.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:t}),r.match(/execution failed due to an exception|execution reverted/)&&ql.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class g9 extends DS{constructor(e,t){super(e),Ue(this,"baseUrl",this.getBaseUrl()),Ue(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 ql.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 jg(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"?SI:m9;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(c,u)=>(this.isCommunityResource()&&yx(),Promise.resolve(!0))};let l=null;s&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},l=Object.keys(s).map(c=>`${c}=${s[c]}`).join("&"));const A=yield px(a,l,o||SI);return this.emit("debug",{action:"response",request:i,response:ts(A),provider:this}),A})}detectNetwork(){return jg(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return jg(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=>q_("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=CI(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return q_("call",s,t.transaction)}}case"estimateGas":{const i=CI(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return q_("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=MI(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=MI(t.filter.toBlock)),t.filter.address&&(i.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&ql.throwError("unsupported topic count",ve.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),t.filter.topics.length===1)){const a=t.filter.topics[0];(typeof a!="string"||a.length!==66)&&ql.throwError("unsupported topic format",ve.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 v9(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 Ly=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const vc=new ve(Jr);function Wg(){return new Date().getTime()}function TI(n){let e=null;for(let t=0;te?null:(r+i)/2}function Cf(n){if(n===null)return"null";if(typeof n=="number"||typeof n=="boolean")return JSON.stringify(n);if(typeof n=="string")return n;if(Ge.isBigNumber(n))return n.toString();if(Array.isArray(n))return JSON.stringify(n.map(e=>Cf(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=Cf(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let y9=1;function RI(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 w9=[ve.errors.CALL_EXCEPTION,ve.errors.INSUFFICIENT_FUNDS,ve.errors.NONCE_EXPIRED,ve.errors.REPLACEMENT_UNDERPRICED,ve.errors.UNPREDICTABLE_GAS_LIMIT],x9=["address","args","errorArgs","errorSignature","method","transaction"];function Kg(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 _9(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 b9(n,e,t){let r=Cf;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=II(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 II(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=wn(i),i.confirmations=-1,Cf(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=wn(i),i.transactions=i.transactions.map(s=>(s=wn(s),s.confirmations=-1,s)),Cf(i))}:r=function(i){return i==null?null:Cf(i)};break;default:throw new Error("unknown method: "+e)}return _9(r,n.quorum)}function Bd(n,e){return Ly(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:Ef(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function B9(n,e,t,r){return Ly(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&&Et(r.blockTag)&&(i=yield Bd(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&Et(r.blockTag)&&(i=yield Bd(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&Et(r.blockTag)&&(i=yield Bd(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&Et(r.blockTag)&&(i=yield Bd(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&&Et(s.fromBlock)||s.toBlock&&Et(s.toBlock))&&(i=yield Bd(n,e)),i.getLogs(s)}}return vc.throwError("unknown method error",ve.errors.UNKNOWN_ERROR,{method:t,params:r})})}class E9 extends DS{constructor(e,t){e.length===0&&vc.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(ag.isProvider(o)){const c=dI(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:c,priority:1})}const l=wn(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=dI(o)?2e3:750),l.weight==null&&(l.weight=1);const A=l.weight;return(A%1||A>512||A<1)&&vc.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,A),Object.freeze(l)}),i=r.reduce((o,a)=>o+a.weight,0);t==null?t=i/2:t>i&&vc.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=TI(r.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),Ue(this,"providerConfigs",Object.freeze(r)),Ue(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return Ly(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return TI(e)})}perform(e,t){return Ly(this,void 0,void 0,function*(){if(e==="sendTransaction"){const l=yield Promise.all(this.providerConfigs.map(A=>A.provider.sendTransaction(t.signedTransaction).then(c=>c.hash,c=>c)));for(let A=0;Al.priority-A.priority);const s=this._highestBlockNumber;let o=0,a=!0;for(;;){const l=Wg();let A=i.filter(h=>h.runner&&l-h.starth+p.weight,0);for(;A{h.staller=null}),h.runner=B9(h,s,e,t).then(d=>{h.done=!0,h.result=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Kg(h,Wg()),request:{method:e,params:ts(t)},provider:this})},d=>{h.done=!0,h.error=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Kg(h,Wg()),request:{method:e,params:ts(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Kg(h,null),request:{method:e,params:ts(t)},provider:this}),A+=h.weight}const c=[];i.forEach(h=>{h.done||!h.runner||(c.push(h.runner),h.staller&&c.push(h.staller.getPromise()))}),c.length&&(yield Promise.race(c));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(p=>{p.staller&&p.staller.cancel(),p.cancelled=!0}),h;a||(yield RI(100).getPromise()),a=!1}const f=i.reduce((h,p)=>{if(!p.done||p.error==null)return h;const d=p.error.code;return w9.indexOf(d)>=0&&(h[d]||(h[d]={error:p.error,weight:0}),h[d].weight+=p.weight),h},{});if(Object.keys(f).forEach(h=>{const p=f[h];if(p.weight{m.staller&&m.staller.cancel(),m.cancelled=!0});const d=p.error,g={};x9.forEach(m=>{d[m]!=null&&(g[m]=d[m])}),vc.throwError(d.reason||d.message,h,g)}),i.filter(h=>!h.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),vc.throwError("failed to meet quorum",ve.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>Kg(l)),provider:this})})}}const C9=null,jv=new ve(Jr),pp="84842078b09946638c03157f83405213";class S9 extends NS{constructor(e,t){const r=new qN(e,t),i=r.connection;i.password&&jv.throwError("INFURA WebSocket project secrets unsupported",ve.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),Ue(this,"apiKey",r.projectId),Ue(this,"projectId",r.projectId),Ue(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===pp}}class qN extends VA{static getWebSocketProvider(e,t){return new S9(e,t)}static getApiKey(e){const t={apiKey:pp,projectId:pp,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(jv.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),jv.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:jv.throwError("unsupported network",ve.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===pp&&yx(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===pp}}const e1=new ve(Jr),M9="ETHERS_JS_SHARED";class T9 extends VA{static getApiKey(e){return e&&typeof e!="string"&&e1.throwArgumentError("invalid apiKey","apiKey",e),e||M9}static getUrl(e,t){e1.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:e1.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const FI=new ve(Jr),UI="62e1ad51b37b8e00394bda3b";class I9 extends VA{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=UI:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:FI.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:FI.throwError("unsupported network",ve.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===UI}}const LI=new ve(Jr);let R9=1;function PI(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:R9++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:ts(s),provider:this}),e(s,(l,A)=>{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:A,provider:this}),A.error){const c=new Error(A.error.message);return c.code=A.error.code,c.data=A.error.data,a(c)}o(A.result)})})}}function F9(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:ts(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 kS extends um{constructor(e,t){e==null&&LI.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=F9(e)):e.sendAsync?i=PI(e,e.sendAsync.bind(e)):e.send?i=PI(e,e.send.bind(e)):LI.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),Ue(this,"jsonRpcFetchFunc",i),Ue(this,"provider",s)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const DI=new ve(Jr);function U9(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 um(n);case"ws":case"wss":return new NS(n);default:DI.throwArgumentError("unsupported URL scheme","network",n)}}const t=ZO(n);return(!t||!t._defaultProvider)&&DI.throwError("unsupported getDefaultProvider network",ve.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:E9,AlchemyProvider:JN,AnkrProvider:h9,CloudflareProvider:p9,EtherscanProvider:g9,InfuraProvider:qN,JsonRpcProvider:um,NodesmithProvider:T9,PocketProvider:I9,Web3Provider:kS,IpcProvider:C9},e)}var L9=!0,t1="Invariant failed";function tl(n,e){if(!n){if(L9)throw new Error(t1);var t=typeof e=="function"?e():e,r=t?"".concat(t1,": ").concat(t):t1;throw new Error(r)}}var vo;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(vo||(vo={}));function fm(){return fm=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 Wv(n,e,t){return P9()?Wv=Reflect.construct:Wv=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&hm(A,o.prototype),A},Wv.apply(null,arguments)}function D9(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Py(n){var e=typeof Map=="function"?new Map:void 0;return Py=function(r){if(r===null||!D9(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 Wv(r,arguments,WB(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),hm(i,r)},Py(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function OI(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function tk(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)&&tl(!1),e}else return Number.isInteger(n)||tl(!1),n}function nk(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||tl(!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=at(rr(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&&tl(!1),a}var NI=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],A=a[1],c=tk(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(c))throw new rk(c,e.supportedChainIds);var u=A===null?A:nk(A);return{provider:o,chainId:c,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)}},$g=function(n){ek(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(Py(Error)),rk=function(n){ek(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}(Py(Error)),wr;(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"})(wr||(wr={}));function O9(n,e){var t=e.type,r=e.payload;switch(t){case wr.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 wr.UPDATE:{var A=r.provider,c=r.chainId,u=r.account;return fm({},n,A===void 0?{}:{provider:A},c===void 0?{}:{chainId:c},u===void 0?{}:{account:u})}case wr.UPDATE_FROM_ERROR:{var f=r.provider,h=r.chainId,p=r.account;return fm({},n,f===void 0?{}:{provider:f},h===void 0?{}:{chainId:h},p===void 0?{}:{account:p},{error:void 0})}case wr.ERROR:{var d=r.error,g=n.connector,m=n.onError;return{connector:g,error:d,onError:m}}case wr.ERROR_FROM_ACTIVATION:{var y=r.connector,w=r.error;return{connector:y,error:w}}case wr.DEACTIVATE_CONNECTOR:return{}}}function N9(){var n=ye.useReducer(O9,{}),e=n[0],t=n[1],r=e.connector,i=e.provider,s=e.chainId,o=e.account,a=e.onError,l=e.error,A=ye.useRef(-1);A.current+=1;var c=ye.useCallback(function(g,m,y){y===void 0&&(y=!1);try{var w=A.current,x=!1;return Promise.resolve(OI(function(){return Promise.resolve(g.activate().then(function(_){return x=!0,_})).then(function(_){return Promise.resolve(NI(g,_)).then(function(C){if(A.current>w)throw new $g;t({type:wr.ACTIVATE_CONNECTOR,payload:fm({connector:g},C,{onError:m})})})})},function(_){if(_ instanceof $g)x&&g.deactivate();else{if(y)throw x&&g.deactivate(),_;m?(x&&g.deactivate(),m(_)):t({type:wr.ERROR_FROM_ACTIVATION,payload:{connector:g,error:_}})}}))}catch(_){return Promise.reject(_)}},[]),u=ye.useCallback(function(g){t({type:wr.ERROR,payload:{error:g}})},[]),f=ye.useCallback(function(){t({type:wr.DEACTIVATE_CONNECTOR})},[]),h=ye.useCallback(function(g){try{if(!r)throw Error("This should never happen, it's just so Typescript stops complaining");var m=A.current;return Promise.resolve(function(){if(l)return OI(function(){return Promise.resolve(NI(r,g)).then(function(_){if(A.current>m)throw new $g;t({type:wr.UPDATE_FROM_ERROR,payload:_})})},function(_){_ instanceof $g||(a?a(_):t({type:wr.ERROR,payload:{error:_}}))});var y=g.chainId===void 0?void 0:tk(g.chainId);if(y!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(y)){var w=new rk(y,r.supportedChainIds);a?a(w):t({type:wr.ERROR,payload:{error:w}})}else{var x=typeof g.account=="string"?nk(g.account):g.account;t({type:wr.UPDATE,payload:{provider:g.provider,chainId:y,account:x}})}}())}catch(y){return Promise.reject(y)}},[r,l,a]),p=ye.useCallback(function(g){a?a(g):t({type:wr.ERROR,payload:{error:g}})},[a]),d=ye.useCallback(function(){t({type:wr.DEACTIVATE_CONNECTOR})},[]);return ye.useEffect(function(){return function(){r&&r.deactivate()}},[r]),ye.useEffect(function(){return r&&r.on(vo.Update,h).on(vo.Error,p).on(vo.Deactivate,d),function(){r&&r.off(vo.Update,h).off(vo.Error,p).off(vo.Deactivate,d)}},[r,h,p,d]),{connector:r,provider:i,chainId:s,account:o,activate:c,setError:u,deactivate:f,error:l}}var ik="primary",Sf={};function k9(n){Sf[n]&&tl(!1),Sf[n]=ye.createContext({activate:function(){try{return tl(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){tl(!1)},deactivate:function(){tl(!1)},active:!1}),Sf[n].displayName="Web3ReactContext - "+n;var e=Sf[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=N9(),a=o.connector,l=o.provider,A=o.chainId,c=o.account,u=o.activate,f=o.setError,h=o.deactivate,p=o.error,d=a!==void 0&&A!==void 0&&c!==void 0&&!p,g=ye.useMemo(function(){return d&&A!==void 0&&Number.isInteger(A)&&a?i(l,a):void 0},[d,i,l,a,A]),m={connector:a,library:g,chainId:A,account:c,activate:u,setError:f,deactivate:h,active:d,error:p};return Y.createElement(e,{value:m},s)}}var Q9=k9(ik);function H9(n){return n===void 0&&(n=ik),Object.keys(Sf).includes(n)||tl(!1),Sf[n]}function z9(n){return ye.useContext(H9(n))}var KB={},sk={exports:{}},hs={},ok={exports:{}},ak={};/** + */(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=na:s&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&!0&&n.exports,l=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",A="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],u=[4,1024,262144,67108864],f=[1,256,65536,16777216],h=[6,1536,393216,100663296],p=[0,8,16,24],d=[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],m=[128,256],y=["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 x=function(F,X,ue){return function(le){return new B(F,X,F).update(le)[ue]()}},_=function(F,X,ue){return function(le,oe){return new B(F,X,oe).update(le)[ue]()}},C=function(F,X,ue){return function(le,oe,re,pe){return v["cshake"+F].update(le,oe,re,pe)[ue]()}},S=function(F,X,ue){return function(le,oe,re,pe){return v["kmac"+F].update(le,oe,re,pe)[ue]()}},b=function(F,X,ue,le){for(var oe=0;oe>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ue>>5,this.extraBytes=(ue&31)>>3;for(var le=0;le<50;++le)this.s[le]=0}B.prototype.update=function(F){if(this.finalized)throw new Error(t);var X,ue=typeof F;if(ue!=="string"){if(ue==="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);X=!0}for(var le=this.blocks,oe=this.byteCount,re=F.length,pe=this.blockCount,_e=0,Re=this.s,Q,de;_e>2]|=F[_e]<>2]|=de<>2]|=(192|de>>6)<>2]|=(128|de&63)<=57344?(le[Q>>2]|=(224|de>>12)<>2]|=(128|de>>6&63)<>2]|=(128|de&63)<>2]|=(240|de>>18)<>2]|=(128|de>>12&63)<>2]|=(128|de>>6&63)<>2]|=(128|de&63)<=oe){for(this.start=Q-oe,this.block=le[pe],Q=0;Q>8,ue=F&255;ue>0;)oe.unshift(ue),F=F>>8,ue=F&255,++le;return X?oe.push(le):oe.unshift(le),this.update(oe),oe.length},B.prototype.encodeString=function(F){var X,ue=typeof F;if(ue!=="string"){if(ue==="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);X=!0}var le=0,oe=F.length;if(X)le=oe;else for(var re=0;re=57344?le+=3:(pe=65536+((pe&1023)<<10|F.charCodeAt(++re)&1023),le+=4)}return le+=this.encode(le*8),this.update(F),le},B.prototype.bytepad=function(F,X){for(var ue=this.encode(X),le=0;le>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(F[0]=F[ue],X=1;X>4&15]+A[_e&15]+A[_e>>12&15]+A[_e>>8&15]+A[_e>>20&15]+A[_e>>16&15]+A[_e>>28&15]+A[_e>>24&15];re%F===0&&(ee(X),oe=0)}return le&&(_e=X[oe],pe+=A[_e>>4&15]+A[_e&15],le>1&&(pe+=A[_e>>12&15]+A[_e>>8&15]),le>2&&(pe+=A[_e>>20&15]+A[_e>>16&15])),pe},B.prototype.arrayBuffer=function(){this.finalize();var F=this.blockCount,X=this.s,ue=this.outputBlocks,le=this.extraBytes,oe=0,re=0,pe=this.outputBits>>3,_e;le?_e=new ArrayBuffer(ue+1<<2):_e=new ArrayBuffer(pe);for(var Re=new Uint32Array(_e);re>8&255,pe[_e+2]=Re>>16&255,pe[_e+3]=Re>>24&255;re%F===0&&ee(X)}return le&&(_e=re<<2,Re=X[oe],pe[_e]=Re&255,le>1&&(pe[_e+1]=Re>>8&255),le>2&&(pe[_e+2]=Re>>16&255)),pe};function W(F,X,ue){B.call(this,F,X,ue)}W.prototype=new B,W.prototype.finalize=function(){return this.encode(this.outputBits,!0),B.prototype.finalize.call(this)};var ee=function(F){var X,ue,le,oe,re,pe,_e,Re,Q,de,Ae,q,J,ce,xe,be,N,j,se,he,me,G,R,T,V,te,ae,ie,Te,Me,Le,ke,De,fe,Ce,Se,Fe,We,qe,ut,sn,Ct,it,ar,wt,Yt,qs,Vt,Xt,ne,ge,Be,we,Ee,ze,st,Ze,Je,yt,mt,gt,Zt,Rn;for(le=0;le<48;le+=2)oe=F[0]^F[10]^F[20]^F[30]^F[40],re=F[1]^F[11]^F[21]^F[31]^F[41],pe=F[2]^F[12]^F[22]^F[32]^F[42],_e=F[3]^F[13]^F[23]^F[33]^F[43],Re=F[4]^F[14]^F[24]^F[34]^F[44],Q=F[5]^F[15]^F[25]^F[35]^F[45],de=F[6]^F[16]^F[26]^F[36]^F[46],Ae=F[7]^F[17]^F[27]^F[37]^F[47],q=F[8]^F[18]^F[28]^F[38]^F[48],J=F[9]^F[19]^F[29]^F[39]^F[49],X=q^(pe<<1|_e>>>31),ue=J^(_e<<1|pe>>>31),F[0]^=X,F[1]^=ue,F[10]^=X,F[11]^=ue,F[20]^=X,F[21]^=ue,F[30]^=X,F[31]^=ue,F[40]^=X,F[41]^=ue,X=oe^(Re<<1|Q>>>31),ue=re^(Q<<1|Re>>>31),F[2]^=X,F[3]^=ue,F[12]^=X,F[13]^=ue,F[22]^=X,F[23]^=ue,F[32]^=X,F[33]^=ue,F[42]^=X,F[43]^=ue,X=pe^(de<<1|Ae>>>31),ue=_e^(Ae<<1|de>>>31),F[4]^=X,F[5]^=ue,F[14]^=X,F[15]^=ue,F[24]^=X,F[25]^=ue,F[34]^=X,F[35]^=ue,F[44]^=X,F[45]^=ue,X=Re^(q<<1|J>>>31),ue=Q^(J<<1|q>>>31),F[6]^=X,F[7]^=ue,F[16]^=X,F[17]^=ue,F[26]^=X,F[27]^=ue,F[36]^=X,F[37]^=ue,F[46]^=X,F[47]^=ue,X=de^(oe<<1|re>>>31),ue=Ae^(re<<1|oe>>>31),F[8]^=X,F[9]^=ue,F[18]^=X,F[19]^=ue,F[28]^=X,F[29]^=ue,F[38]^=X,F[39]^=ue,F[48]^=X,F[49]^=ue,ce=F[0],xe=F[1],Yt=F[11]<<4|F[10]>>>28,qs=F[10]<<4|F[11]>>>28,ie=F[20]<<3|F[21]>>>29,Te=F[21]<<3|F[20]>>>29,mt=F[31]<<9|F[30]>>>23,gt=F[30]<<9|F[31]>>>23,Ct=F[40]<<18|F[41]>>>14,it=F[41]<<18|F[40]>>>14,fe=F[2]<<1|F[3]>>>31,Ce=F[3]<<1|F[2]>>>31,be=F[13]<<12|F[12]>>>20,N=F[12]<<12|F[13]>>>20,Vt=F[22]<<10|F[23]>>>22,Xt=F[23]<<10|F[22]>>>22,Me=F[33]<<13|F[32]>>>19,Le=F[32]<<13|F[33]>>>19,Zt=F[42]<<2|F[43]>>>30,Rn=F[43]<<2|F[42]>>>30,Ee=F[5]<<30|F[4]>>>2,ze=F[4]<<30|F[5]>>>2,Se=F[14]<<6|F[15]>>>26,Fe=F[15]<<6|F[14]>>>26,j=F[25]<<11|F[24]>>>21,se=F[24]<<11|F[25]>>>21,ne=F[34]<<15|F[35]>>>17,ge=F[35]<<15|F[34]>>>17,ke=F[45]<<29|F[44]>>>3,De=F[44]<<29|F[45]>>>3,T=F[6]<<28|F[7]>>>4,V=F[7]<<28|F[6]>>>4,st=F[17]<<23|F[16]>>>9,Ze=F[16]<<23|F[17]>>>9,We=F[26]<<25|F[27]>>>7,qe=F[27]<<25|F[26]>>>7,he=F[36]<<21|F[37]>>>11,me=F[37]<<21|F[36]>>>11,Be=F[47]<<24|F[46]>>>8,we=F[46]<<24|F[47]>>>8,ar=F[8]<<27|F[9]>>>5,wt=F[9]<<27|F[8]>>>5,te=F[18]<<20|F[19]>>>12,ae=F[19]<<20|F[18]>>>12,Je=F[29]<<7|F[28]>>>25,yt=F[28]<<7|F[29]>>>25,ut=F[38]<<8|F[39]>>>24,sn=F[39]<<8|F[38]>>>24,G=F[48]<<14|F[49]>>>18,R=F[49]<<14|F[48]>>>18,F[0]=ce^~be&j,F[1]=xe^~N&se,F[10]=T^~te&ie,F[11]=V^~ae&Te,F[20]=fe^~Se&We,F[21]=Ce^~Fe&qe,F[30]=ar^~Yt&Vt,F[31]=wt^~qs&Xt,F[40]=Ee^~st&Je,F[41]=ze^~Ze&yt,F[2]=be^~j&he,F[3]=N^~se&me,F[12]=te^~ie&Me,F[13]=ae^~Te&Le,F[22]=Se^~We&ut,F[23]=Fe^~qe&sn,F[32]=Yt^~Vt&ne,F[33]=qs^~Xt&ge,F[42]=st^~Je&mt,F[43]=Ze^~yt>,F[4]=j^~he&G,F[5]=se^~me&R,F[14]=ie^~Me&ke,F[15]=Te^~Le&De,F[24]=We^~ut&Ct,F[25]=qe^~sn&it,F[34]=Vt^~ne&Be,F[35]=Xt^~ge&we,F[44]=Je^~mt&Zt,F[45]=yt^~gt&Rn,F[6]=he^~G&ce,F[7]=me^~R&xe,F[16]=Me^~ke&T,F[17]=Le^~De&V,F[26]=ut^~Ct&fe,F[27]=sn^~it&Ce,F[36]=ne^~Be&ar,F[37]=ge^~we&wt,F[46]=mt^~Zt&Ee,F[47]=gt^~Rn&ze,F[8]=G^~ce&be,F[9]=R^~xe&N,F[18]=ke^~T&te,F[19]=De^~V&ae,F[28]=Ct^~fe&Se,F[29]=it^~Ce&Fe,F[38]=Be^~ar&Yt,F[39]=we^~wt&qs,F[48]=Zt^~Ee&st,F[49]=Rn^~ze&Ze,F[0]^=d[le],F[1]^=d[le+1]};if(a)n.exports=v;else for(U=0;U>6===2;o++)s++;return s}return n===Wi.OVERRUN?t.length-e-1:0}function qG(n,e,t,r,i){return n===Wi.OVERLONG?(r.push(i),0):(r.push(65533),iN(n,e,t))}const eV=Object.freeze({error:JG,ignore:iN,replace:qG});function sN(n,e){e==null&&(e=eV.error),n=at(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(Wi.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(Wi.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(Wi.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(Wi.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(Wi.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(Wi.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function fa(n,e=cm.current){e!=cm.current&&(rN.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 at(t)}function tV(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function Ag(n,e){return tV(sN(n,e))}function nV(n,e=cm.current){return sN(fa(n,e))}function Bf(n){return rr(fa(n))}const oN="hash/5.7.0";function aN(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 rV(n){const e={};for(let t=0;t>--l&1}const u=31,f=Math.pow(2,u),h=f>>>1,p=h>>1,d=f-1;let g=0;for(let _=0;_1;){let D=C+S>>>1;_>>1|c(),b=b<<1^h,M=(M^h)<<1|h|1;y=b,w=1+M-b}let x=r-4;return m.map(_=>{switch(_-x){case 3:return x+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return x+256+(n[a++]<<8|n[a++]);case 1:return x+n[a++];default:return _-1}})}function sV(n){let e=0;return()=>n[e++]}function oV(n){return sV(iV(n))}function aV(n){return n&1?~n>>1:n>>1}function lV(n,e){let t=Array(n);for(let r=0;re[o]):t}function cV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(fV(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(hV(t,n))}return rV(aN(e))}function uV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function lN(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function fV(n,e){let t=1+e(),r=e(),i=uV(e),s=lN(i.length,1+n,e);return aN(s.map((o,a)=>{const l=o[0],A=o.slice(1);return Array(i[a]).fill(void 0).map((c,u)=>{let f=u*r;return[l+u*t,A.map(h=>h+f)]})}))}function hV(n,e){let t=1+e();return lN(t,1+n,e).map(i=>[i[0],i.slice(1)])}function dV(n){let e=Ry(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let A=Ry(n,e);if(A.length==0)break;r.push({set:new Set(A),node:t()})}r.sort((A,c)=>c.set.size-A.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 pV(){return oV(JO("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 hx=pV(),mV=new Set(Ry(hx)),gV=new Set(Ry(hx)),vV=cV(hx),yV=dV(hx),K2=45,$2=95;function AN(n){return nV(n)}function wV(n){return n.filter(e=>e!=65039)}function cN(n){for(let e of n.split(".")){let t=AN(e);try{for(let r=t.lastIndexOf($2)-1;r>=0;r--)if(t[r]!==$2)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===K2&&t[3]===K2)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function xV(n){return cN(_V(n,wV))}function _V(n,e){let t=AN(n).reverse(),r=[];for(;t.length;){let i=BV(t);if(i){r.push(...e(i));continue}let s=t.pop();if(mV.has(s)){r.push(s);continue}if(gV.has(s))continue;let o=vV[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return cN(bV(String.fromCodePoint(...r)))}function bV(n){return n.normalize("NFC")}function BV(n,e){var t;let r=yV,i,s,o=[],a=n.length;for(e&&(e.length=0);a;){let l=n[--a];if(r=(t=r.branches.find(A=>A.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 EV=new ve(oN),uN=new Uint8Array(32);uN.fill(0);function Y2(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function fN(n){const e=fa(xV(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(Y2(e.slice(r))),t}function Hv(n){typeof n!="string"&&EV.throwArgumentError("invalid ENS name; not a string","name",n);let e=uN;const t=fN(n);for(;t.length;)e=rr(Zi([e,rr(t.pop())]));return nt(e)}function CV(n){return nt(Zi(fN(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 SV="rlp/5.7.0",Vo=new ve(SV);function X2(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function Z2(n,e,t){let r=0;for(let i=0;ie+1+r&&Vo.throwError("child data too short",ve.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function dN(n,e){if(n.length===0&&Vo.throwError("data too short",ve.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&Vo.throwError("data short segment too short",ve.errors.BUFFER_OVERRUN,{});const r=Z2(n,e+1,t);return e+1+t+r>n.length&&Vo.throwError("data long segment too short",ve.errors.BUFFER_OVERRUN,{}),J2(n,e,e+1+t,t+r)}else if(n[e]>=192){const t=n[e]-192;return e+1+t>n.length&&Vo.throwError("data array too short",ve.errors.BUFFER_OVERRUN,{}),J2(n,e,e+1,t)}else if(n[e]>=184){const t=n[e]-183;e+1+t>n.length&&Vo.throwError("data array too short",ve.errors.BUFFER_OVERRUN,{});const r=Z2(n,e+1,t);e+1+t+r>n.length&&Vo.throwError("data array too short",ve.errors.BUFFER_OVERRUN,{});const i=nt(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&&Vo.throwError("data too short",ve.errors.BUFFER_OVERRUN,{});const r=nt(n.slice(e+1,e+1+t));return{consumed:1+t,result:r}}return{consumed:1,result:nt(n[e])}}function IS(n){const e=at(n),t=dN(e,0);return t.consumed!==e.length&&Vo.throwArgumentError("invalid rlp data","data",n),t.result}const MV="address/5.7.0",Ef=new ve(MV);function q2(n){Et(n,20)||Ef.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=at(rr(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 TV=9007199254740991;function IV(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const RS={};for(let n=0;n<10;n++)RS[String(n)]=String(n);for(let n=0;n<26;n++)RS[String.fromCharCode(65+n)]=String(10+n);const eI=Math.floor(IV(TV));function RV(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>RS[r]).join("");for(;e.length>=eI;){let r=e.substring(0,eI);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 Dr(n){let e=null;if(typeof n!="string"&&Ef.throwArgumentError("invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/))n.substring(0,2)!=="0x"&&(n="0x"+n),e=q2(n),n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==n&&Ef.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)!==RV(n)&&Ef.throwArgumentError("bad icap checksum","address",n),e=FG(n.substring(4));e.length<40;)e="0"+e;e=q2("0x"+e)}else Ef.throwArgumentError("invalid address","address",n);return e}function pN(n){let e=null;try{e=Dr(n.from)}catch{Ef.throwArgumentError("missing from address","transaction",n)}const t=gh(at(Ge.from(n.nonce).toHexString()));return Dr(zr(rr(dx([e,t])),12))}var FV=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Bn=new ve(oN),mN=new Uint8Array(32);mN.fill(0);const UV=Ge.from(-1),gN=Ge.from(0),vN=Ge.from(1),LV=Ge.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function PV(n){const e=at(n),t=e.length%32;return t?_i([e,mN.slice(t)]):nt(e)}const DV=kn(vN.toHexString(),32),OV=kn(gN.toHexString(),32),tI={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},k_=["name","version","chainId","verifyingContract","salt"];function nI(n){return function(e){return typeof e!="string"&&Bn.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const NV={name:nI("name"),version:nI("version"),chainId:function(n){try{return Ge.from(n).toString()}catch{}return Bn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return Dr(n).toLowerCase()}catch{}return Bn.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){try{const e=at(n);if(e.length!==32)throw new Error("bad length");return nt(e)}catch{}return Bn.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function Q_(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))&&Bn.throwArgumentError("invalid numeric width","type",n);const i=LV.mask(t?r-1:r),s=t?i.add(vN).mul(UV):gN;return function(o){const a=Ge.from(o);return(a.lt(s)||a.gt(i))&&Bn.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),kn(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))&&Bn.throwArgumentError("invalid bytes width","type",n),function(r){return at(r).length!==t&&Bn.throwArgumentError(`invalid length for ${n}`,"value",r),PV(r)}}}switch(n){case"address":return function(e){return kn(Dr(e),32)};case"bool":return function(e){return e?DV:OV};case"bytes":return function(e){return rr(e)};case"string":return function(e){return Bf(e)}}return null}function rI(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class Gi{constructor(e){Ue(this,"types",Object.freeze(ts(e))),Ue(this,"_encoderCache",{}),Ue(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(A=>{l[A.name]&&Bn.throwArgumentError(`duplicate variable name ${JSON.stringify(A.name)} in ${JSON.stringify(a)}`,"types",e),l[A.name]=!0;const c=A.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===a&&Bn.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!Q_(c)&&(r[c]||Bn.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),r[c].push(a),t[a][c]=!0)})}const s=Object.keys(r).filter(a=>r[a].length===0);s.length===0?Bn.throwArgumentError("missing primary type","types",e):s.length>1&&Bn.throwArgumentError(`ambiguous primary types or unused types: ${s.map(a=>JSON.stringify(a)).join(", ")}`,"types",e),Ue(this,"primaryType",s[0]);function o(a,l){l[a]&&Bn.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e),l[a]=!0,Object.keys(t[a]).forEach(A=>{r[A]&&(o(A,l),Object.keys(l).forEach(c=>{i[c][A]=!0}))}),delete l[a]}o(this.primaryType,{});for(const a in i){const l=Object.keys(i[a]);l.sort(),this._types[a]=rI(a,e[a])+l.map(A=>rI(A,e[A])).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const i=Q_(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&&Bn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(rr)),rr(_i(l))}}const r=this.types[e];if(r){const i=Bf(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const A=this.getEncoder(l)(s[a]);return this._types[l]?rr(A):A});return o.unshift(i),_i(o)}}return Bn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Bn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return rr(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(Q_(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&&Bn.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),{}):Bn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Gi(e)}static getPrimaryType(e){return Gi.from(e).primaryType}static hashStruct(e,t,r){return Gi.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=tI[r];i||Bn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>k_.indexOf(r.name)-k_.indexOf(i.name)),Gi.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return _i(["0x1901",Gi.hashDomain(e),Gi.from(t).hash(r)])}static hash(e,t,r){return rr(Gi.encode(e,t,r))}static resolveNames(e,t,r,i){return FV(this,void 0,void 0,function*(){e=wn(e);const s={};e.verifyingContract&&!Et(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=Gi.from(t);o.visit(r,(a,l)=>(a==="address"&&!Et(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){Gi.hashDomain(e);const i={},s=[];k_.forEach(l=>{const A=e[l];A!=null&&(i[l]=NV[l](A),s.push({name:l,type:tI[l]}))});const o=Gi.from(t),a=wn(t);return a.EIP712Domain?Bn.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,A)=>{if(l.match(/^bytes(\d*)/))return nt(at(A));if(l.match(/^u?int/))return Ge.from(A).toString();switch(l){case"address":return A.toLowerCase();case"bool":return!!A;case"string":return typeof A!="string"&&Bn.throwArgumentError("invalid string","value",A),A}return Bn.throwArgumentError("unsupported type","type",l)})}}}var yN={},Ft={},cg=wN;function wN(n,e){if(!n)throw new Error(e||"Assertion failed")}wN.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var kB={exports:{}};typeof Object.create=="function"?kB.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:kB.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 kV=kB.exports,QV=cg,HV=kV;Ft.inherits=HV;function zV(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function GV(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):zV(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}Ft.htonl=xN;function jV(n,e){for(var t="",r=0;r>>0}return s}Ft.join32=WV;function KV(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}Ft.split32=KV;function $V(n,e){return n>>>e|n<<32-e}Ft.rotr32=$V;function YV(n,e){return n<>>32-e}Ft.rotl32=YV;function XV(n,e){return n+e>>>0}Ft.sum32=XV;function ZV(n,e,t){return n+e+t>>>0}Ft.sum32_3=ZV;function JV(n,e,t,r){return n+e+t+r>>>0}Ft.sum32_4=JV;function qV(n,e,t,r,i){return n+e+t+r+i>>>0}Ft.sum32_5=qV;function ej(n,e,t,r){var i=n[e],s=n[e+1],o=r+s>>>0,a=(o>>0,n[e+1]=o}Ft.sum64=ej;function tj(n,e,t,r){var i=e+r>>>0,s=(i>>0}Ft.sum64_hi=tj;function nj(n,e,t,r){var i=e+r;return i>>>0}Ft.sum64_lo=nj;function rj(n,e,t,r,i,s,o,a){var l=0,A=e;A=A+r>>>0,l+=A>>0,l+=A>>0,l+=A>>0}Ft.sum64_4_hi=rj;function ij(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}Ft.sum64_4_lo=ij;function sj(n,e,t,r,i,s,o,a,l,A){var c=0,u=e;u=u+r>>>0,c+=u>>0,c+=u>>0,c+=u>>0,c+=u>>0}Ft.sum64_5_hi=sj;function oj(n,e,t,r,i,s,o,a,l,A){var c=e+r+s+a+A;return c>>>0}Ft.sum64_5_lo=oj;function aj(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}Ft.rotr64_hi=aj;function lj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.rotr64_lo=lj;function Aj(n,e,t){return n>>>t}Ft.shr64_hi=Aj;function cj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.shr64_lo=cj;var Wh={},iI=Ft,uj=cg;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}Wh.BlockHash=px;px.prototype.update=function(e,t){if(e=iI.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=iI.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}_a.g0_256=mj;function gj(n){return sa(n,17)^sa(n,19)^n>>>10}_a.g1_256=gj;var vh=Ft,vj=Wh,yj=_a,H_=vh.rotl32,wd=vh.sum32,wj=vh.sum32_5,xj=yj.ft_1,SN=vj.BlockHash,_j=[1518500249,1859775393,2400959708,3395469782];function ha(){if(!(this instanceof ha))return new ha;SN.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}vh.inherits(ha,SN);var bj=ha;ha.blockSize=512;ha.outSize=160;ha.hmacStrength=80;ha.padLength=64;ha.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()),cW(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:at(new Uint8Array(i))}})}var pW=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const uo=new ve(fW);function AI(n){return new Promise(e=>{setTimeout(e,n)})}function Ul(n,e){if(n==null)return null;if(typeof n=="string")return n;if(TS(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return Ag(n)}catch{}return nt(n)}return n}function mW(n){return fa(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function gW(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;uo.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;uo.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 A={method:"GET"};let c=!1,u=2*60*1e3;if(typeof n=="string")l=n;else if(typeof n=="object"){if((n==null||n.url==null)&&uo.throwArgumentError("missing URL","connection.url",n),l=n.url,typeof n.timeout=="number"&&n.timeout>0&&(u=n.timeout),n.headers)for(const m in n.headers)a[m.toLowerCase()]={key:m,value:String(n.headers[m])},["if-none-match","if-modified-since"].indexOf(m.toLowerCase())>=0&&(c=!0);if(A.allowGzip=!!n.allowGzip,n.user!=null&&n.password!=null){l.substring(0,6)!=="https:"&&n.allowInsecureAuthentication!==!0&&uo.throwError("basic authentication requires a secure https url",ve.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const m=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+qO(fa(m))}}n.skipFetchSetup!=null&&(A.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(A.fetchOptions=wn(n.fetchOptions))}const f=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),h=l?l.match(f):null;if(h)try{const m={statusCode:200,statusMessage:"OK",headers:{"content-type":h[1]||"text/plain"},body:h[2]?JO(h[3]):mW(h[3])};let y=m.body;return t&&(y=t(m.body,m)),Promise.resolve(y)}catch(m){uo.throwError("processing response error",ve.errors.SERVER_ERROR,{body:Ul(h[1],h[2]),error:m,requestBody:null,requestMethod:"GET",url:l})}e&&(A.method="POST",A.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 p={};Object.keys(a).forEach(m=>{const y=a[m];p[y.key]=y.value}),A.headers=p;const d=function(){let m=null;return{promise:new Promise(function(x,_){u&&(m=setTimeout(()=>{m!=null&&(m=null,_(uo.makeError("timeout",ve.errors.TIMEOUT,{requestBody:Ul(A.body,p["content-type"]),requestMethod:A.method,timeout:u,url:l})))},u))}),cancel:function(){m!=null&&(clearTimeout(m),m=null)}}}(),g=function(){return pW(this,void 0,void 0,function*(){for(let m=0;m=300)&&(d.cancel(),uo.throwError("bad response",ve.errors.SERVER_ERROR,{status:y.statusCode,headers:y.headers,body:Ul(w,y.headers?y.headers["content-type"]:null),requestBody:Ul(A.body,p["content-type"]),requestMethod:A.method,url:l})),t)try{const x=yield t(w,y);return d.cancel(),x}catch(x){if(x.throttleRetry&&m{let a=null;if(s!=null)try{a=JSON.parse(Ag(s))}catch(l){uo.throwError("invalid JSON",ve.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=fa(e);const s=typeof n=="string"?{url:n}:wn(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=wn(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return gW(n,i,r)}function Cf(n,e){return e||(e={}),e=wn(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 A(){return n().then(function(c){if(c!==void 0)o()&&t(c);else if(e.oncePoll)e.oncePoll.once("poll",A);else if(e.onceBlock)e.onceBlock.once("block",A);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(A,u)}return null},function(c){o()&&r(c)})}A()})}var Fy="qpzry9x8gf2tvdw0s3jn54khce6mua7l",zB={};for(var Gg=0;Gg>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 NN(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=Jf(e)^r>>5}for(e=Jf(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=NN(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=Jf(r)^o,i+=Fy.charAt(o)}for(s=0;s<6;++s)r=Jf(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=Fy.charAt(a)}return i}function kN(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=NN(s);if(typeof a=="string")return a;for(var l=[],A=0;A=o.length)&&l.push(u)}return a!==1?"Invalid checksum for "+n:{prefix:s,words:l}}function yW(){var n=kN.apply(null,arguments);if(typeof n=="object")return n}function wW(n){var e=kN.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function gx(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=c&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?d=(f>>1)-g:d=g,h.isubn(d)):d=0,u[p]=d,h.iushrn(1)}return u}t.getNAF=r;function i(l,A){var c=[[],[]];l=l.clone(),A=A.clone();for(var u=0,f=0,h;l.cmpn(-u)>0||A.cmpn(-f)>0;){var p=l.andln(3)+u&3,d=A.andln(3)+f&3;p===3&&(p=-1),d===3&&(d=-1);var g;p&1?(h=l.andln(7)+u&7,(h===3||h===5)&&d===2?g=-p:g=p):g=0,c[0].push(g);var m;d&1?(h=A.andln(7)+f&7,(h===3||h===5)&&p===2?m=-d:m=d):m=0,c[1].push(m),2*u===g+1&&(u=1-u),2*f===m+1&&(f=1-f),l.iushrn(1),A.iushrn(1)}return c}t.getJSF=i;function s(l,A,c){var u="_"+A;l.prototype[A]=function(){return this[u]!==void 0?this[u]:this[u]=c.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 vt(l,"hex","le")}t.intFromLE=a}),Uy=fs.getNAF,SW=fs.getJSF,Ly=fs.assert;function VA(n,e){this.type=n,this.p=new vt(e.p,16),this.red=e.prime?vt.red(e.prime):vt.mont(this.p),this.zero=new vt(0).toRed(this.red),this.one=new vt(1).toRed(this.red),this.two=new vt(2).toRed(this.red),this.n=e.n&&new vt(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 tu=VA;VA.prototype.point=function(){throw new Error("Not implemented")};VA.prototype.validate=function(){throw new Error("Not implemented")};VA.prototype._fixedNafMul=function(e,t){Ly(e.precomputed);var r=e._getDoubles(),i=Uy(t,1,this._bitLength),s=(1<=a;A--)l=(l<<1)+i[A];o.push(l)}for(var c=this.jpoint(null,null,null),u=this.jpoint(null,null,null),f=s;f>0;f--){for(a=0;a=0;l--){for(var A=0;l>=0&&o[l]===0;l--)A++;if(l>=0&&A++,a=a.dblp(A),l<0)break;var c=o[l];Ly(c!==0),e.type==="affine"?c>0?a=a.mixedAdd(s[c-1>>1]):a=a.mixedAdd(s[-c-1>>1].neg()):c>0?a=a.add(s[c-1>>1]):a=a.add(s[-c-1>>1].neg())}return e.type==="affine"?a.toP():a};VA.prototype._wnafMulAdd=function(e,t,r,i,s){var o=this._wnafT1,a=this._wnafT2,l=this._wnafT3,A=0,c,u,f;for(c=0;c=1;c-=2){var p=c-1,d=c;if(o[p]!==1||o[d]!==1){l[p]=Uy(r[p],o[p],this._bitLength),l[d]=Uy(r[d],o[d],this._bitLength),A=Math.max(l[p].length,A),A=Math.max(l[d].length,A);continue}var g=[t[p],null,null,t[d]];t[p].y.cmp(t[d].y)===0?(g[1]=t[p].add(t[d]),g[2]=t[p].toJ().mixedAdd(t[d].neg())):t[p].y.cmp(t[d].y.redNeg())===0?(g[1]=t[p].toJ().mixedAdd(t[d]),g[2]=t[p].add(t[d].neg())):(g[1]=t[p].toJ().mixedAdd(t[d]),g[2]=t[p].toJ().mixedAdd(t[d].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],y=SW(r[p],r[d]);for(A=Math.max(y[0].length,A),l[p]=new Array(A),l[d]=new Array(A),u=0;u=0;c--){for(var S=0;c>=0;){var b=!0;for(u=0;u=0&&S++,_=_.dblp(S),c<0)break;for(u=0;u0?f=a[u][M-1>>1]:M<0&&(f=a[u][-M-1>>1].neg()),f.type==="affine"?_=_.mixedAdd(f):_=_.add(f))}}for(c=0;c=Math.ceil((e.bitLength()+1)/t.step):!1};Ks.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=A,p=c),u.negative&&(u=u.neg(),f=f.neg()),h.negative&&(h=h.neg(),p=p.neg()),[{a:u,b:f},{a:h,b:p}]};$s.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),A=s.mul(r.b),c=o.mul(i.b),u=e.sub(a).sub(l),f=A.add(c).neg();return{k1:u,k2:f}};$s.prototype.pointFromX=function(e,t){e=new vt(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)};$s.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};$s.prototype._endoWnafMulAdd=function(e,t,r){for(var i=this._endoWnafT1,s=this._endoWnafT2,o=0;o":""};Mr.prototype.isInfinity=function(){return this.inf};Mr.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)};Mr.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)};Mr.prototype.getX=function(){return this.x.fromRed()};Mr.prototype.getY=function(){return this.y.fromRed()};Mr.prototype.mul=function(e){return e=new vt(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)};Mr.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)};Mr.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)};Mr.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)};Mr.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};Mr.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 Nr(n,e,t,r){tu.BasePoint.call(this,n,"jacobian"),e===null&&t===null&&r===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new vt(0)):(this.x=new vt(e,16),this.y=new vt(t,16),this.z=new vt(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}US(Nr,tu.BasePoint);$s.prototype.jpoint=function(e,t,r){return new Nr(this,e,t,r)};Nr.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)};Nr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Nr.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),A=o.redSub(a);if(l.cmpn(0)===0)return A.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=l.redSqr(),u=c.redMul(l),f=i.redMul(c),h=A.redSqr().redIAdd(u).redISub(f).redISub(f),p=A.redMul(f.redISub(h)).redISub(o.redMul(u)),d=this.z.redMul(e.z).redMul(l);return this.curve.jpoint(h,p,d)};Nr.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 A=a.redSqr(),c=A.redMul(a),u=r.redMul(A),f=l.redSqr().redIAdd(c).redISub(u).redISub(u),h=l.redMul(u.redISub(f)).redISub(s.redMul(c)),p=this.z.redMul(a);return this.curve.jpoint(f,h,p)};Nr.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}};Nr.prototype.inspect=function(){return this.isInfinity()?"":""};Nr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var zv=Yh(function(n,e){var t=e;t.base=tu,t.short=TW,t.mont=null,t.edwards=null}),Gv=Yh(function(n,e){var t=e,r=fs.assert;function i(a){a.type==="short"?this.curve=new zv.short(a):a.type==="edwards"?this.curve=new zv.edwards(a):this.curve=new zv.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 A=new i(l);return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,value:A}),A}})}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:Ho.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:Ho.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:Ho.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:Ho.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:Ho.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:Ho.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:Ho.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:Ho.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=xo.toArray(n.entropy,n.entropyEnc||"hex"),t=xo.toArray(n.nonce,n.nonceEnc||"hex"),r=xo.toArray(n.pers,n.persEnc||"hex");FS(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var HN=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=xo.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var IW=fs.assert;function vx(n,e){if(n instanceof vx)return n;this._importDER(n,e)||(IW(n.r&&n.s,"Signature without r or s"),this.r=new vt(n.r,16),this.s=new vt(n.s,16),n.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=n.recoveryParam)}var yx=vx;function RW(){this.place=0}function j_(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 uI(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)}vx.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=uI(t),r=uI(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];W_(i,t.length),i=i.concat(t),i.push(2),W_(i,r.length);var s=i.concat(r),o=[48];return W_(o,s.length),o=o.concat(s),fs.encode(o,e)};var FW=function(){throw new Error("unsupported")},zN=fs.assert;function zs(n){if(!(this instanceof zs))return new zs(n);typeof n=="string"&&(zN(Object.prototype.hasOwnProperty.call(Gv,n),"Unknown curve "+n),n=Gv[n]),n instanceof Gv.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 UW=zs;zs.prototype.keyPair=function(e){return new LS(this,e)};zs.prototype.keyFromPrivate=function(e,t){return LS.fromPrivate(this,e,t)};zs.prototype.keyFromPublic=function(e,t){return LS.fromPublic(this,e,t)};zs.prototype.genKeyPair=function(e){e||(e={});for(var t=new HN({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||FW(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),i=this.n.sub(new vt(2));;){var s=new vt(t.generate(r));if(!(s.cmp(i)>0))return s.iaddn(1),this.keyFromPrivate(s)}};zs.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};zs.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 vt(e,16));for(var s=this.n.byteLength(),o=t.getPrivate().toArray("be",s),a=e.toArray("be",s),l=new HN({hash:this.hash,entropy:o,nonce:a,pers:i.pers,persEnc:i.persEnc||"utf8"}),A=this.n.sub(new vt(1)),c=0;;c++){var u=i.k?i.k(c):new vt(l.generate(this.n.byteLength()));if(u=this._truncateToN(u,!0),!(u.cmpn(1)<=0||u.cmp(A)>=0)){var f=this.g.mul(u);if(!f.isInfinity()){var h=f.getX(),p=h.umod(this.n);if(p.cmpn(0)!==0){var d=u.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(d=d.umod(this.n),d.cmpn(0)!==0){var g=(f.getY().isOdd()?1:0)|(h.cmp(p)!==0?2:0);return i.canonical&&d.cmp(this.nh)>0&&(d=this.n.sub(d),g^=1),new yx({r:p,s:d,recoveryParam:g})}}}}}};zs.prototype.verify=function(e,t,r,i){e=this._truncateToN(new vt(e,16)),r=this.keyFromPublic(r,i),t=new yx(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),A=a.mul(s).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(l,r.getPublic(),A),c.isInfinity()?!1:c.eqXToP(s)):(c=this.g.mulAdd(l,r.getPublic(),A),c.isInfinity()?!1:c.getX().umod(this.n).cmp(s)===0)};zs.prototype.recoverPubKey=function(n,e,t,r){zN((3&t)===t,"The recovery param is more than two bits"),e=new yx(e,r);var i=this.n,s=new vt(n),o=e.r,a=e.s,l=t&1,A=t>>1;if(o.cmp(this.curve.p.umod(this.curve.n))>=0&&A)throw new Error("Unable to find sencond key candinate");A?o=this.curve.pointFromX(o.add(this.curve.n),l):o=this.curve.pointFromX(o,l);var c=e.r.invm(i),u=i.sub(s).mul(c).umod(i),f=a.mul(c).umod(i);return this.g.mulAdd(u,o,f)};zs.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new yx(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 LW=Yh(function(n,e){var t=e;t.version="6.5.4",t.utils=fs,t.rand=function(){throw new Error("unsupported")},t.curve=zv,t.curves=Gv,t.ec=UW,t.eddsa=null}),PW=LW.ec;const DW="signing-key/5.7.0",VB=new ve(DW);let K_=null;function Wo(){return K_||(K_=new PW("secp256k1")),K_}class OW{constructor(e){Ue(this,"curve","secp256k1"),Ue(this,"privateKey",nt(e)),Qc(this.privateKey)!==32&&VB.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Wo().keyFromPrivate(at(this.privateKey));Ue(this,"publicKey","0x"+t.getPublic(!1,"hex")),Ue(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Ue(this,"_isSigningKey",!0)}_addPoint(e){const t=Wo().keyFromPublic(at(this.publicKey)),r=Wo().keyFromPublic(at(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=Wo().keyFromPrivate(at(this.privateKey)),r=at(e);r.length!==32&&VB.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return fx({recoveryParam:i.recoveryParam,r:kn("0x"+i.r.toString(16),32),s:kn("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=Wo().keyFromPrivate(at(this.privateKey)),r=Wo().keyFromPublic(at(GN(e)));return kn("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function NW(n,e){const t=fx(e),r={r:at(t.r),s:at(t.s)};return"0x"+Wo().recoverPubKey(at(n),r,t.recoveryParam).encode("hex",!1)}function GN(n,e){const t=at(n);if(t.length===32){const r=new OW(t);return e?"0x"+Wo().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?nt(t):"0x"+Wo().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Wo().keyFromPublic(t).getPublic(!0,"hex"):nt(t)}return VB.throwArgumentError("invalid public or private key","key","[REDACTED]")}const kW="transactions/5.7.0",El=new ve(kW);var fI;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(fI||(fI={}));function PS(n){return n==="0x"?null:Dr(n)}function Vr(n){return n==="0x"?tN:Ge.from(n)}function QW(n){const e=GN(n);return Dr(zr(rr(zr(e,1)),12))}function VN(n,e){return QW(NW(at(n),e))}function Ki(n,e){const t=gh(Ge.from(n).toHexString());return t.length>32&&El.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function $_(n,e){return{address:Dr(n),storageKeys:(e||[]).map((t,r)=>(Qc(t)!==32&&El.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function nu(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(t.length>2&&El.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${r}]`,t),$_(t[0],t[1])):$_(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return $_(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function jN(n){return nu(n).map(e=>[e.address,e.storageKeys])}function HW(n,e){if(n.gasPrice!=null){const r=Ge.from(n.gasPrice),i=Ge.from(n.maxFeePerGas||0);r.eq(i)||El.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:i})}const t=[Ki(n.chainId||0,"chainId"),Ki(n.nonce||0,"nonce"),Ki(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Ki(n.maxFeePerGas||0,"maxFeePerGas"),Ki(n.gasLimit||0,"gasLimit"),n.to!=null?Dr(n.to):"0x",Ki(n.value||0,"value"),n.data||"0x",jN(n.accessList||[])];if(e){const r=fx(e);t.push(Ki(r.recoveryParam,"recoveryParam")),t.push(gh(r.r)),t.push(gh(r.s))}return _i(["0x02",dx(t)])}function zW(n,e){const t=[Ki(n.chainId||0,"chainId"),Ki(n.nonce||0,"nonce"),Ki(n.gasPrice||0,"gasPrice"),Ki(n.gasLimit||0,"gasLimit"),n.to!=null?Dr(n.to):"0x",Ki(n.value||0,"value"),n.data||"0x",jN(n.accessList||[])];if(e){const r=fx(e);t.push(Ki(r.recoveryParam,"recoveryParam")),t.push(gh(r.r)),t.push(gh(r.s))}return _i(["0x01",dx(t)])}function WN(n,e,t){try{const r=Vr(e[0]).toNumber();if(r!==0&&r!==1)throw new Error("bad recid");n.v=r}catch{El.throwArgumentError("invalid v for transaction type: 1","v",e[0])}n.r=kn(e[1],32),n.s=kn(e[2],32);try{const r=rr(t(n));n.from=VN(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function GW(n){const e=IS(n.slice(1));e.length!==9&&e.length!==12&&El.throwArgumentError("invalid component count for transaction type: 2","payload",nt(n));const t=Vr(e[2]),r=Vr(e[3]),i={type:2,chainId:Vr(e[0]).toNumber(),nonce:Vr(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:Vr(e[4]),to:PS(e[5]),value:Vr(e[6]),data:e[7],accessList:nu(e[8])};return e.length===9||(i.hash=rr(n),WN(i,e.slice(9),HW)),i}function VW(n){const e=IS(n.slice(1));e.length!==8&&e.length!==11&&El.throwArgumentError("invalid component count for transaction type: 1","payload",nt(n));const t={type:1,chainId:Vr(e[0]).toNumber(),nonce:Vr(e[1]).toNumber(),gasPrice:Vr(e[2]),gasLimit:Vr(e[3]),to:PS(e[4]),value:Vr(e[5]),data:e[6],accessList:nu(e[7])};return e.length===8||(t.hash=rr(n),WN(t,e.slice(8),zW)),t}function jW(n){const e=IS(n);e.length!==9&&e.length!==6&&El.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:Vr(e[0]).toNumber(),gasPrice:Vr(e[1]),gasLimit:Vr(e[2]),to:PS(e[3]),value:Vr(e[4]),data:e[5],chainId:0};if(e.length===6)return t;try{t.v=Ge.from(e[6]).toNumber()}catch{return t}if(t.r=kn(e[7],32),t.s=kn(e[8],32),Ge.from(t.r).isZero()&&Ge.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(nt(t.chainId)),i.push("0x"),i.push("0x"),r-=t.chainId*2+8);const s=rr(dx(i));try{t.from=VN(s,{r:nt(t.r),s:nt(t.s),recoveryParam:r})}catch{}t.hash=rr(n)}return t.type=null,t}function WW(n){const e=at(n);if(e[0]>127)return jW(e);switch(e[0]){case 1:return VW(e);case 2:return GW(e)}return El.throwError(`unsupported transaction type: ${e[0]}`,ve.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const _d=new ve(Jr);let hI=class et{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),A=this.type.bind(this),c=u=>this.data(u,!0);return e.transaction={hash:o,type:A,accessList:et.allowNull(this.accessList.bind(this),null),blockHash:et.allowNull(o,null),blockNumber:et.allowNull(l,null),transactionIndex:et.allowNull(l,null),confirmations:et.allowNull(l,null),from:t,gasPrice:et.allowNull(r),maxPriorityFeePerGas:et.allowNull(r),maxFeePerGas:et.allowNull(r),gasLimit:r,to:et.allowNull(t,null),value:r,nonce:l,data:s,r:et.allowNull(this.uint256),s:et.allowNull(this.uint256),v:et.allowNull(l),creates:et.allowNull(t,null),raw:et.allowNull(s)},e.transactionRequest={from:et.allowNull(t),nonce:et.allowNull(l),gasLimit:et.allowNull(r),gasPrice:et.allowNull(r),maxPriorityFeePerGas:et.allowNull(r),maxFeePerGas:et.allowNull(r),to:et.allowNull(t),value:et.allowNull(r),data:et.allowNull(c),type:et.allowNull(l),accessList:et.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:l,blockNumber:l,transactionHash:o,address:t,topics:et.arrayOf(o),data:s,logIndex:l,blockHash:o},e.receipt={to:et.allowNull(this.address,null),from:et.allowNull(this.address,null),contractAddress:et.allowNull(t,null),transactionIndex:l,root:et.allowNull(a),gasUsed:r,logsBloom:et.allowNull(s),blockHash:o,transactionHash:o,logs:et.arrayOf(this.receiptLog.bind(this)),blockNumber:l,confirmations:et.allowNull(l,null),cumulativeGasUsed:r,effectiveGasPrice:et.allowNull(r),status:et.allowNull(l),type:A},e.block={hash:et.allowNull(o),parentHash:o,number:l,timestamp:l,nonce:et.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:r,gasUsed:r,miner:et.allowNull(t),extraData:s,transactions:et.allowNull(et.arrayOf(o)),baseFeePerGas:et.allowNull(r)},e.blockWithTransactions=wn(e.block),e.blockWithTransactions.transactions=et.allowNull(et.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:et.allowNull(i,void 0),toBlock:et.allowNull(i,void 0),blockHash:et.allowNull(o,void 0),address:et.allowNull(t,void 0),topics:et.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:et.allowNull(l),blockHash:et.allowNull(o),transactionIndex:l,removed:et.allowNull(this.boolean.bind(this)),address:t,data:et.allowFalsish(s,"0x"),topics:et.arrayOf(o),transactionHash:o,logIndex:l},e}accessList(e){return nu(e||[])}number(e){return e==="0x"?0:Ge.from(e).toNumber()}type(e){return e==="0x"||e==null?0:Ge.from(e).toNumber()}bigNumber(e){return Ge.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),Et(e))?e.toLowerCase():_d.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 Dr(e)}callAddress(e){if(!Et(e,32))return null;const t=Dr(zr(e,12));return t===VG?null:t}contractAddress(e){return pN(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"||Et(e))return ux(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return Qc(r)!==32?_d.throwArgumentError("invalid hash","value",e):r}difficulty(e){if(e==null)return null;const t=Ge.from(e);try{return t.toNumber()}catch{}return null}uint256(e){if(!Et(e))throw new Error("invalid uint256");return kn(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=et.check(t,e);return i._difficulty=r==null?null:Ge.from(r),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return et.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&Ge.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=et.check(this.formats.transaction,e);if(e.chainId!=null){let r=e.chainId;Et(r)&&(r=Ge.from(r).toNumber()),t.chainId=r}else{let r=e.networkId;r==null&&t.v==null&&(r=e.chainId),Et(r)&&(r=Ge.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 WW(e)}receiptLog(e){return et.check(this.formats.receiptLog,e)}receipt(e){const t=et.check(this.formats.receipt,e);if(t.root!=null)if(t.root.length<=4){const r=Ge.from(t.root).toNumber();r===0||r===1?(t.status!=null&&t.status!==r&&_d.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):_d.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&_d.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 et.check(this.formats.filter,e)}filterLog(e){return et.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 KW(n){return n&&typeof n.isCommunityResource=="function"}function dI(n){return KW(n)&&n.isCommunityResource()}let pI=!1;function wx(){pI||(pI=!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 ht=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Bt=new ve(Jr),$W=10;function mI(n){return n==null?"null":(Qc(n)!==32&&Bt.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function gI(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[mI(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return mI(e)}).join("&")}function YW(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 vu(n){if(typeof n=="string"){if(n=n.toLowerCase(),Qc(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+gI(n);if(HG.isForkEvent(n))throw Bt.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+gI(n.topics||[])}throw new Error("invalid event - "+n)}function bd(){return new Date().getTime()}function vI(n){return new Promise(e=>{setTimeout(e,n)})}const XW=["block","network","pending","poll"];let ZW=class{constructor(e,t,r){Ue(this,"tag",e),Ue(this,"listener",t),Ue(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=YW(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||XW.indexOf(this.tag)>=0}};const JW={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 Y_(n){return kn(Ge.from(n).toHexString(),32)}function yI(n){return NB.encode(Zi([n,zr(lI(lI(n)),0,4)]))}const KN=new RegExp("^(ipfs)://(.*)$","i"),wI=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),KN,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Vv(n,e){try{return Ag(um(n,e))}catch{}return null}function um(n,e){if(n==="0x")return null;const t=Ge.from(zr(n,e,e+32)).toNumber(),r=Ge.from(zr(n,t,t+32)).toNumber();return zr(n,t+32,t+32+r)}function X_(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):Bt.throwArgumentError("unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}function xI(n){const e=at(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 qW(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function $N(n){const e=[];let t=0;for(let r=0;rGe.from(e).eq(1)).catch(e=>{if(e.code===ve.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return ht(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:_i([e,Hv(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=_i(["0x9061b923",$N([CV(this.name),r.data])]));try{let s=yield this.provider.call(r);return at(s).length%32===4&&Bt.throwError("resolver threw error",ve.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=um(s,0)),s}catch(s){if(s.code===ve.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return ht(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?um(r,0):null})}_getAddress(e,t){const r=JW[String(e)];if(r==null&&Bt.throwError(`unsupported coin type: ${e}`,ve.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),r.ilk==="eth")return this.provider.formatter.address(t);const i=at(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 yI(Zi([[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 yI(Zi([[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=cI.toWords(i.slice(2));return a.unshift(o),cI.encode(r.prefix,a)}}return null}getAddress(e){return ht(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===$G?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===ve.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",Y_(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&Bt.throwError("invalid or unsupported coin data",ve.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return ht(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 Bt.throwError("invalid or unsupported content hash data",ve.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ht(this,void 0,void 0,function*(){let t=fa(e);t=Zi([Y_(64),Y_(t.length),t]),t.length%32!==0&&(t=Zi([t,kn("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",nt(t));return r==null||r==="0x"?null:Ag(r)})}}let Z_=null,e9=1;class DS extends lg{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),Ue(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=Ji(new.target,"getNetwork")(e);t?(Ue(this,"_network",t),this.emit("network",t,null)):Bt.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ht(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||Bt.throwError("no network detected",ve.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:Ue(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return Cf(()=>this._ready().then(e=>e,e=>{if(!(e.code===ve.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Z_==null&&(Z_=new hI),Z_}static getNetwork(e){return ZO(e??"homestead")}ccipReadFetch(e,t,r){return ht(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 mx({url:A,errorPassThrough:!0},c,(h,p)=>(h.status=p.statusCode,h));if(u.data)return u.data;const f=u.message||"unknown error";if(u.status>=400&&u.status<500)return Bt.throwError(`response not found during CCIP fetch: ${f}`,ve.errors.SERVER_ERROR,{url:l,errorMessage:f});o.push(f)}return Bt.throwError(`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,ve.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return ht(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(bd()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=bd(),r=qn({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=bd();return i=Ge.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return ht(this,void 0,void 0,function*(){const e=e9++,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)Bt.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${r})`),this.emit("error",Bt.makeError("network block skew detected",ve.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(A=>{A.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=A.blockNumber),this._emitted["b:"+A.blockHash]=A.blockNumber,this._emitted["t:"+A.transactionHash]=A.blockNumber,this.emit(s,A)})}).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 ht(this,void 0,void 0,function*(){return Bt.throwError("provider does not support network detection",ve.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ht(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 vI(0),this._network;const r=Bt.makeError("underlying network changed",ve.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=bd();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 ht(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return ht(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 A=!1;const c=function(){return A?!0:(A=!0,l.forEach(f=>{f()}),!1)},u=f=>{f.confirmations{this.removeListener(e,u)}),i){let f=i.startBlock,h=null;const p=d=>ht(this,void 0,void 0,function*(){A||(yield vI(1e3),this.getTransactionCount(i.from).then(g=>ht(this,void 0,void 0,function*(){if(!A){if(g<=i.nonce)f=d;else{{const m=yield this.getTransaction(e);if(m&&m.blockNumber!=null)return}for(h==null&&(h=f-3,h{A||this.once("block",p)}))});if(A)return;this.once("block",p),l.push(()=>{this.removeListener("block",p)})}if(typeof r=="number"&&r>0){const f=setTimeout(()=>{c()||a(Bt.makeError("timeout exceeded",ve.errors.TIMEOUT,{timeout:r}))},r);f.unref&&f.unref(),l.push(()=>{clearTimeout(f)})}})})}getBlockNumber(){return ht(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Ge.from(e)}catch(t){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getBalance",r);try{return Ge.from(i)}catch(s){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getTransactionCount",r);try{return Ge.from(i).toNumber()}catch(s){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),i=yield this.perform("getCode",r);try{return nt(i)}catch(s){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield qn({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then(o=>ux(o))}),s=yield this.perform("getStorageAt",i);try{return nt(s)}catch(o){return Bt.throwError("bad result from backend",ve.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&Qc(t)!==32)throw new Error("invalid response - sendTransaction");const i=e;return t!=null&&e.hash!==t&&Bt.throwError("Transaction hash mismatch from Provider.sendTransaction.",ve.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>ht(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&&Bt.throwError("transaction failed",ve.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return ht(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then(s=>nt(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 ht(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?Ge.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?nt(s):null))}),this.formatter.transactionRequest(yield qn(r))})}_getFilter(e){return ht(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 qn(t))})}_call(e,t,r){return ht(this,void 0,void 0,function*(){r>=$W&&Bt.throwError("CCIP read exceeded maximum redirections",ve.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"&&Qc(s)%32===4)try{const o=zr(s,4),a=zr(o,0,32);Ge.from(a).eq(i)||Bt.throwError("CCIP Read sender did not match",ve.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],A=Ge.from(zr(o,32,64)).toNumber(),c=Ge.from(zr(o,A,A+32)).toNumber(),u=zr(o,A+32);for(let m=0;mht(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 ht(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Cf(()=>ht(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 ht(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Cf(()=>ht(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 ht(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield qn({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach(i=>{i.removed==null&&(i.removed=!1)}),hI.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return ht(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ht(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&Bt.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 ht(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 _I(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return ht(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Bt.throwError("network does not support ENS",ve.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Hv(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ht(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(r){if(Et(e))throw r}typeof e!="string"&&Bt.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null})}lookupAddress(e){return ht(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=Vv(yield this.call({to:r,data:"0x691f3431"+Hv(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ht(this,void 0,void 0,function*(){let t=null;if(Et(e)){const s=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",o=yield this._getResolver(s,"getAvatar");if(!o)return null;t=new _I(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==ve.errors.CALL_EXCEPTION)throw a}try{const a=Vv(yield this.call({to:o,data:"0x691f3431"+Hv(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==ve.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 Bt.throwError(e+" not implemented",ve.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 ZW(vu(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=vu(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=vu(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=vu(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=vu(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=vu(e);this._events=this._events.filter(i=>i.tag!==r?!0:(t.push(i),!1))}return t.forEach(r=>{this._stopEvent(r)}),this}}const t9="abstract-signer/5.7.0";var io=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const ws=new ve(t9),n9=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],r9=[ve.errors.INSUFFICIENT_FUNDS,ve.errors.NONCE_EXPIRED,ve.errors.REPLACEMENT_UNDERPRICED];class ug{constructor(){ws.checkAbstract(new.target,ug),Ue(this,"_isSigner",!0)}getBalance(e){return io(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return io(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return io(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const t=yield qn(this.checkTransaction(e));return yield this.provider.estimateGas(t)})}call(e,t){return io(this,void 0,void 0,function*(){this._checkProvider("call");const r=yield qn(this.checkTransaction(e));return yield this.provider.call(r,t)})}sendTransaction(e){return io(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 io(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return io(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return io(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return io(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const r in e)n9.indexOf(r)===-1&&ws.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=wn(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()&&ws.throwArgumentError("from address mismatch","transaction",e),r[0])),t}populateTransaction(e){return io(this,void 0,void 0,function*(){const t=yield qn(this.checkTransaction(e));t.to!=null&&(t.to=Promise.resolve(t.to).then(i=>io(this,void 0,void 0,function*(){if(i==null)return null;const s=yield this.resolveName(i);return s==null&&ws.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)?ws.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(t.type===0||t.type===1)&&r&&ws.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&&ws.throwError("network does not support EIP-1559",ve.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):ws.throwError("failed to get consistent fee data",ve.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(r9.indexOf(i.code)>=0)throw i;return ws.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.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]&&ws.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield qn(t)})}_checkProvider(e){this.provider||ws.throwError("missing provider",ve.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class OS extends ug{constructor(e,t){super(),Ue(this,"address",e),Ue(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then(()=>{ws.throwError(e,ve.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 OS(this.address,e)}}var Ka=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const er=new ve(Jr),i9=["call","estimateGas"];function Qp(n,e){if(n==null)return null;if(typeof n.message=="string"&&n.message.match("reverted")){const t=Et(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=Qp(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return Qp(JSON.parse(n),e)}catch{}return null}function YN(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=Qp(e,!0);if(s)return s.data;er.throwError("missing revert data in call exception; Transaction reverted without a reason string",ve.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=Qp(e.body,!1);s==null&&(s=Qp(e,!1)),s&&er.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===ve.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)&&er.throwError("insufficient funds for intrinsic transaction cost",ve.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&er.throwError("nonce has already been used",ve.errors.NONCE_EXPIRED,{error:e,method:n,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&er.throwError("replacement fee too low",ve.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&er.throwError("legacy pre-eip-155 transactions not supported",ve.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),i9.indexOf(n)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&er.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function bI(n){return new Promise(function(e){setTimeout(e,n)})}function s9(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 Bd(n){return n&&n.toLowerCase()}const jB={};class XN extends ug{constructor(e,t,r){if(super(),e!==jB)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");Ue(this,"provider",t),r==null&&(r=0),typeof r=="string"?(Ue(this,"_address",this.provider.formatter.address(r)),Ue(this,"_index",null)):typeof r=="number"?(Ue(this,"_index",r),Ue(this,"_address",null)):er.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return er.throwError("cannot alter JSON-RPC Signer connection",ve.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new o9(jB,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&&er.throwError("unknown account #"+this._index,ve.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=wn(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=wn(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>Ka(this,void 0,void 0,function*(){if(r==null)return null;const i=yield this.provider.resolveName(r);return i==null&&er.throwArgumentError("provided ENS name resolves to null","tx.to",r),i}))),qn({tx:qn(e),sender:t}).then(({tx:r,sender:i})=>{r.from!=null?r.from.toLowerCase()!==i&&er.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)&&er.throwError("user rejected transaction",ve.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),YN("sendTransaction",o,s)))})}signTransaction(e){return er.throwError("signing transactions is unsupported",ve.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Ka(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 Cf(()=>Ka(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 Ka(this,void 0,void 0,function*(){const t=typeof e=="string"?fa(e):e,r=yield this.getAddress();try{return yield this.provider.send("personal_sign",[nt(t),r.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&er.throwError("user rejected signing",ve.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return Ka(this,void 0,void 0,function*(){const t=typeof e=="string"?fa(e):e,r=yield this.getAddress();try{return yield this.provider.send("eth_sign",[r.toLowerCase(),nt(t)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&er.throwError("user rejected signing",ve.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return Ka(this,void 0,void 0,function*(){const i=yield Gi.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(Gi.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&er.throwError("user rejected signing",ve.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return Ka(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class o9 extends XN{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 a9={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class fm extends DS{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=Ji(this.constructor,"defaultUrl")()),typeof e=="string"?Ue(this,"connection",Object.freeze({url:e})):Ue(this,"connection",Object.freeze(wn(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 Ka(this,void 0,void 0,function*(){yield bI(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=Ji(this.constructor,"getNetwork");try{return t(Ge.from(e).toNumber())}catch(r){return er.throwError("could not detect network",ve.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return er.throwError("could not detect network",ve.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new XN(jB,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:ts(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=mx(this.connection,JSON.stringify(r),s9).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",[Bd(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[Bd(t.address),t.blockTag]];case"getCode":return["eth_getCode",[Bd(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[Bd(t.address),kn(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",[Ji(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[Ji(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=Bd(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Ka(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=t.transaction;if(i&&i.type!=null&&Ge.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const s=yield this.getFeeData();s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null&&(t=wn(t),t.transaction=wn(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&er.throwError(e+" not implemented",ve.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return YN(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 bI(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=wn(a9);if(t)for(const s in t)t[s]&&(r[s]=!0);PG(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=ux(Ge.from(e[s]));s==="gasLimit"&&(s="gas"),i[s]=o}),["from","to","data"].forEach(function(s){e[s]!=null&&(i[s]=nt(e[s]))}),e.accessList&&(i.accessList=nu(e.accessList)),i}}let Hp=null;try{if(Hp=WebSocket,Hp==null)throw new Error("inject please")}catch{const e=new ve(Jr);Hp=function(){e.throwError("WebSockets not supported in this environment",ve.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var J_=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Vg=new ve(Jr);let l9=1;class NS extends fm{constructor(e,t){t==="any"&&Vg.throwError("WebSocketProvider does not support 'any' network yet",ve.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,t):super("_websocket",t),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?Ue(this,"_websocket",new Hp(this.connection.url)):Ue(this,"_websocket",e),Ue(this,"_requests",{}),Ue(this,"_subs",{}),Ue(this,"_subIds",{}),Ue(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 A=null;o.error?(A=new Error(o.error.message||"unknown error"),Ue(A,"code",o.error.code||null),Ue(A,"response",s)):A=new Error("unknown error"),l.callback(A,void 0),this.emit("debug",{action:"response",error:A,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){Vg.throwError("cannot reset events block on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Vg.throwError("cannot set polling interval on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return J_(this,void 0,void 0,function*(){return null})}set polling(e){e&&Vg.throwError("cannot set polling on WebSocketProvider",ve.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=l9++;return new Promise((i,s)=>{function o(l,A){return l?s(l):i(A)}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 J_(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=Ge.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 J_(this,void 0,void 0,function*(){this.websocket.readyState===Hp.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const pp=new ve(Jr);class ZN extends fm{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return A9(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||pp.throwError("no network detected",ve.errors.UNKNOWN_ERROR,{}),this._network==null&&(Ue(this,"_network",t),this.emit("network",t,null))),t})}}class jA extends ZN{constructor(e,t){pp.checkAbstract(new.target,jA),e=Ji(new.target,"getNetwork")(e),t=Ji(new.target,"getApiKey")(t);const r=Ji(new.target,"getUrl")(e,t);super(r,e),typeof t=="string"?Ue(this,"apiKey",t):t!=null&&Object.keys(t).forEach(i=>{Ue(this,i,t[i])})}_startPending(){pp.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return pp.throwError("API provider does not support signing",ve.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return pp.throwError("not implemented; sub-classes must override getUrl",ve.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const BI=new ve(Jr),jv="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class c9 extends NS{constructor(e,t){const r=new JN(e,t),i=r.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,r.network),Ue(this,"apiKey",r.apiKey)}isCommunityResource(){return this.apiKey===jv}}class JN extends jA{static getWebSocketProvider(e,t){return new c9(e,t)}static getApiKey(e){return e==null?jv:(e&&typeof e!="string"&&BI.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:BI.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===jv&&wx(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===jv}}const u9=new ve(Jr),jg="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function f9(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 u9.throwArgumentError("unsupported network","name",n)}class h9 extends jA{isCommunityResource(){return this.apiKey===jg}static getApiKey(e){return e??jg}static getUrl(e,t){t==null&&(t=jg);const r={allowGzip:!0,url:"https://"+f9(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===jg&&wx(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var d9=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const EI=new ve(Jr);class p9 extends jA{static getApiKey(e){return e!=null&&EI.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:EI.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return d9(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 Wg=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const eA=new ve(Jr);function CI(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=ux(nt(r)):t==="accessList"?r="["+nu(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=nt(r),e[t]=r)}return e}function m9(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 SI(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 MI(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function q_(n,e,t){if(n==="call"&&e.code===ve.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,"")),Et(s))return s;eA.throwError("missing revert data in call exception",ve.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===ve.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/)&&eA.throwError("insufficient funds for intrinsic transaction cost",ve.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:t}),r.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&eA.throwError("nonce has already been used",ve.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&eA.throwError("replacement fee too low",ve.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:t}),r.match(/execution failed due to an exception|execution reverted/)&&eA.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ve.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class g9 extends DS{constructor(e,t){super(e),Ue(this,"baseUrl",this.getBaseUrl()),Ue(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 eA.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 Wg(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"?SI:m9;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(c,u)=>(this.isCommunityResource()&&wx(),Promise.resolve(!0))};let l=null;s&&(a.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},l=Object.keys(s).map(c=>`${c}=${s[c]}`).join("&"));const A=yield mx(a,l,o||SI);return this.emit("debug",{action:"response",request:i,response:ts(A),provider:this}),A})}detectNetwork(){return Wg(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return Wg(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=>q_("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=CI(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return q_("call",s,t.transaction)}}case"estimateGas":{const i=CI(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return q_("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=MI(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=MI(t.filter.toBlock)),t.filter.address&&(i.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&eA.throwError("unsupported topic count",ve.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),t.filter.topics.length===1)){const a=t.filter.topics[0];(typeof a!="string"||a.length!==66)&&eA.throwError("unsupported topic format",ve.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 v9(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 Py=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const yc=new ve(Jr);function Kg(){return new Date().getTime()}function TI(n){let e=null;for(let t=0;te?null:(r+i)/2}function Sf(n){if(n===null)return"null";if(typeof n=="number"||typeof n=="boolean")return JSON.stringify(n);if(typeof n=="string")return n;if(Ge.isBigNumber(n))return n.toString();if(Array.isArray(n))return JSON.stringify(n.map(e=>Sf(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=Sf(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let y9=1;function RI(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 w9=[ve.errors.CALL_EXCEPTION,ve.errors.INSUFFICIENT_FUNDS,ve.errors.NONCE_EXPIRED,ve.errors.REPLACEMENT_UNDERPRICED,ve.errors.UNPREDICTABLE_GAS_LIMIT],x9=["address","args","errorArgs","errorSignature","method","transaction"];function $g(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 _9(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 b9(n,e,t){let r=Sf;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=II(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 II(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=wn(i),i.confirmations=-1,Sf(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=wn(i),i.transactions=i.transactions.map(s=>(s=wn(s),s.confirmations=-1,s)),Sf(i))}:r=function(i){return i==null?null:Sf(i)};break;default:throw new Error("unknown method: "+e)}return _9(r,n.quorum)}function Ed(n,e){return Py(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:Cf(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function B9(n,e,t,r){return Py(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&&Et(r.blockTag)&&(i=yield Ed(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&Et(r.blockTag)&&(i=yield Ed(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&Et(r.blockTag)&&(i=yield Ed(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&Et(r.blockTag)&&(i=yield Ed(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&&Et(s.fromBlock)||s.toBlock&&Et(s.toBlock))&&(i=yield Ed(n,e)),i.getLogs(s)}}return yc.throwError("unknown method error",ve.errors.UNKNOWN_ERROR,{method:t,params:r})})}class E9 extends DS{constructor(e,t){e.length===0&&yc.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(lg.isProvider(o)){const c=dI(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:c,priority:1})}const l=wn(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=dI(o)?2e3:750),l.weight==null&&(l.weight=1);const A=l.weight;return(A%1||A>512||A<1)&&yc.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${a}].weight`,A),Object.freeze(l)}),i=r.reduce((o,a)=>o+a.weight,0);t==null?t=i/2:t>i&&yc.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=TI(r.map(o=>o.provider.network));s==null&&(s=new Promise((o,a)=>{setTimeout(()=>{this.detectNetwork().then(o,a)},0)})),super(s),Ue(this,"providerConfigs",Object.freeze(r)),Ue(this,"quorum",t),this._highestBlockNumber=-1}detectNetwork(){return Py(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return TI(e)})}perform(e,t){return Py(this,void 0,void 0,function*(){if(e==="sendTransaction"){const l=yield Promise.all(this.providerConfigs.map(A=>A.provider.sendTransaction(t.signedTransaction).then(c=>c.hash,c=>c)));for(let A=0;Al.priority-A.priority);const s=this._highestBlockNumber;let o=0,a=!0;for(;;){const l=Kg();let A=i.filter(h=>h.runner&&l-h.starth+p.weight,0);for(;A{h.staller=null}),h.runner=B9(h,s,e,t).then(d=>{h.done=!0,h.result=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:$g(h,Kg()),request:{method:e,params:ts(t)},provider:this})},d=>{h.done=!0,h.error=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:$g(h,Kg()),request:{method:e,params:ts(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:$g(h,null),request:{method:e,params:ts(t)},provider:this}),A+=h.weight}const c=[];i.forEach(h=>{h.done||!h.runner||(c.push(h.runner),h.staller&&c.push(h.staller.getPromise()))}),c.length&&(yield Promise.race(c));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(p=>{p.staller&&p.staller.cancel(),p.cancelled=!0}),h;a||(yield RI(100).getPromise()),a=!1}const f=i.reduce((h,p)=>{if(!p.done||p.error==null)return h;const d=p.error.code;return w9.indexOf(d)>=0&&(h[d]||(h[d]={error:p.error,weight:0}),h[d].weight+=p.weight),h},{});if(Object.keys(f).forEach(h=>{const p=f[h];if(p.weight{m.staller&&m.staller.cancel(),m.cancelled=!0});const d=p.error,g={};x9.forEach(m=>{d[m]!=null&&(g[m]=d[m])}),yc.throwError(d.reason||d.message,h,g)}),i.filter(h=>!h.done).length===0)break}return i.forEach(l=>{l.staller&&l.staller.cancel(),l.cancelled=!0}),yc.throwError("failed to meet quorum",ve.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>$g(l)),provider:this})})}}const C9=null,Wv=new ve(Jr),mp="84842078b09946638c03157f83405213";class S9 extends NS{constructor(e,t){const r=new qN(e,t),i=r.connection;i.password&&Wv.throwError("INFURA WebSocket project secrets unsupported",ve.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const s=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(s,e),Ue(this,"apiKey",r.projectId),Ue(this,"projectId",r.projectId),Ue(this,"projectSecret",r.projectSecret)}isCommunityResource(){return this.projectId===mp}}class qN extends jA{static getWebSocketProvider(e,t){return new S9(e,t)}static getApiKey(e){const t={apiKey:mp,projectId:mp,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(Wv.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),Wv.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:Wv.throwError("unsupported network",ve.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===mp&&wx(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===mp}}const e1=new ve(Jr),M9="ETHERS_JS_SHARED";class T9 extends jA{static getApiKey(e){return e&&typeof e!="string"&&e1.throwArgumentError("invalid apiKey","apiKey",e),e||M9}static getUrl(e,t){e1.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:e1.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const FI=new ve(Jr),UI="62e1ad51b37b8e00394bda3b";class I9 extends jA{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=UI:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:FI.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:FI.throwError("unsupported network",ve.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===UI}}const LI=new ve(Jr);let R9=1;function PI(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:R9++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:ts(s),provider:this}),e(s,(l,A)=>{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:A,provider:this}),A.error){const c=new Error(A.error.message);return c.code=A.error.code,c.data=A.error.data,a(c)}o(A.result)})})}}function F9(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:ts(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 kS extends fm{constructor(e,t){e==null&&LI.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=F9(e)):e.sendAsync?i=PI(e,e.sendAsync.bind(e)):e.send?i=PI(e,e.send.bind(e)):LI.throwArgumentError("unsupported provider","provider",e),r||(r="unknown:")),super(r,t),Ue(this,"jsonRpcFetchFunc",i),Ue(this,"provider",s)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const DI=new ve(Jr);function U9(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 fm(n);case"ws":case"wss":return new NS(n);default:DI.throwArgumentError("unsupported URL scheme","network",n)}}const t=ZO(n);return(!t||!t._defaultProvider)&&DI.throwError("unsupported getDefaultProvider network",ve.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:E9,AlchemyProvider:JN,AnkrProvider:h9,CloudflareProvider:p9,EtherscanProvider:g9,InfuraProvider:qN,JsonRpcProvider:fm,NodesmithProvider:T9,PocketProvider:I9,Web3Provider:kS,IpcProvider:C9},e)}var L9=!0,t1="Invariant failed";function nl(n,e){if(!n){if(L9)throw new Error(t1);var t=typeof e=="function"?e():e,r=t?"".concat(t1,": ").concat(t):t1;throw new Error(r)}}var yo;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(yo||(yo={}));function hm(){return hm=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 Kv(n,e,t){return P9()?Kv=Reflect.construct:Kv=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&dm(A,o.prototype),A},Kv.apply(null,arguments)}function D9(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Dy(n){var e=typeof Map=="function"?new Map:void 0;return Dy=function(r){if(r===null||!D9(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 Kv(r,arguments,WB(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),dm(i,r)},Dy(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function OI(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function tk(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)&&nl(!1),e}else return Number.isInteger(n)||nl(!1),n}function nk(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||nl(!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=at(rr(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&&nl(!1),a}var NI=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],A=a[1],c=tk(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(c))throw new rk(c,e.supportedChainIds);var u=A===null?A:nk(A);return{provider:o,chainId:c,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)}},Yg=function(n){ek(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(Dy(Error)),rk=function(n){ek(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}(Dy(Error)),wr;(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"})(wr||(wr={}));function O9(n,e){var t=e.type,r=e.payload;switch(t){case wr.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 wr.UPDATE:{var A=r.provider,c=r.chainId,u=r.account;return hm({},n,A===void 0?{}:{provider:A},c===void 0?{}:{chainId:c},u===void 0?{}:{account:u})}case wr.UPDATE_FROM_ERROR:{var f=r.provider,h=r.chainId,p=r.account;return hm({},n,f===void 0?{}:{provider:f},h===void 0?{}:{chainId:h},p===void 0?{}:{account:p},{error:void 0})}case wr.ERROR:{var d=r.error,g=n.connector,m=n.onError;return{connector:g,error:d,onError:m}}case wr.ERROR_FROM_ACTIVATION:{var y=r.connector,w=r.error;return{connector:y,error:w}}case wr.DEACTIVATE_CONNECTOR:return{}}}function N9(){var n=ye.useReducer(O9,{}),e=n[0],t=n[1],r=e.connector,i=e.provider,s=e.chainId,o=e.account,a=e.onError,l=e.error,A=ye.useRef(-1);A.current+=1;var c=ye.useCallback(function(g,m,y){y===void 0&&(y=!1);try{var w=A.current,x=!1;return Promise.resolve(OI(function(){return Promise.resolve(g.activate().then(function(_){return x=!0,_})).then(function(_){return Promise.resolve(NI(g,_)).then(function(C){if(A.current>w)throw new Yg;t({type:wr.ACTIVATE_CONNECTOR,payload:hm({connector:g},C,{onError:m})})})})},function(_){if(_ instanceof Yg)x&&g.deactivate();else{if(y)throw x&&g.deactivate(),_;m?(x&&g.deactivate(),m(_)):t({type:wr.ERROR_FROM_ACTIVATION,payload:{connector:g,error:_}})}}))}catch(_){return Promise.reject(_)}},[]),u=ye.useCallback(function(g){t({type:wr.ERROR,payload:{error:g}})},[]),f=ye.useCallback(function(){t({type:wr.DEACTIVATE_CONNECTOR})},[]),h=ye.useCallback(function(g){try{if(!r)throw Error("This should never happen, it's just so Typescript stops complaining");var m=A.current;return Promise.resolve(function(){if(l)return OI(function(){return Promise.resolve(NI(r,g)).then(function(_){if(A.current>m)throw new Yg;t({type:wr.UPDATE_FROM_ERROR,payload:_})})},function(_){_ instanceof Yg||(a?a(_):t({type:wr.ERROR,payload:{error:_}}))});var y=g.chainId===void 0?void 0:tk(g.chainId);if(y!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(y)){var w=new rk(y,r.supportedChainIds);a?a(w):t({type:wr.ERROR,payload:{error:w}})}else{var x=typeof g.account=="string"?nk(g.account):g.account;t({type:wr.UPDATE,payload:{provider:g.provider,chainId:y,account:x}})}}())}catch(y){return Promise.reject(y)}},[r,l,a]),p=ye.useCallback(function(g){a?a(g):t({type:wr.ERROR,payload:{error:g}})},[a]),d=ye.useCallback(function(){t({type:wr.DEACTIVATE_CONNECTOR})},[]);return ye.useEffect(function(){return function(){r&&r.deactivate()}},[r]),ye.useEffect(function(){return r&&r.on(yo.Update,h).on(yo.Error,p).on(yo.Deactivate,d),function(){r&&r.off(yo.Update,h).off(yo.Error,p).off(yo.Deactivate,d)}},[r,h,p,d]),{connector:r,provider:i,chainId:s,account:o,activate:c,setError:u,deactivate:f,error:l}}var ik="primary",Mf={};function k9(n){Mf[n]&&nl(!1),Mf[n]=ye.createContext({activate:function(){try{return nl(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){nl(!1)},deactivate:function(){nl(!1)},active:!1}),Mf[n].displayName="Web3ReactContext - "+n;var e=Mf[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=N9(),a=o.connector,l=o.provider,A=o.chainId,c=o.account,u=o.activate,f=o.setError,h=o.deactivate,p=o.error,d=a!==void 0&&A!==void 0&&c!==void 0&&!p,g=ye.useMemo(function(){return d&&A!==void 0&&Number.isInteger(A)&&a?i(l,a):void 0},[d,i,l,a,A]),m={connector:a,library:g,chainId:A,account:c,activate:u,setError:f,deactivate:h,active:d,error:p};return Y.createElement(e,{value:m},s)}}var Q9=k9(ik);function H9(n){return n===void 0&&(n=ik),Object.keys(Mf).includes(n)||nl(!1),Mf[n]}function z9(n){return ye.useContext(H9(n))}var KB={},sk={exports:{}},hs={},ok={exports:{}},ak={};/** * @license React * scheduler.production.min.js * @@ -37,14 +37,14 @@ var Jz=Object.defineProperty;var qz=(n,e,t)=>e in n?Jz(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 lk=ye,ss=G9;function Pe(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"),$B=Object.prototype.hasOwnProperty,V9=/^[: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]*$/,kI={},QI={};function j9(n){return $B.call(QI,n)?!0:$B.call(kI,n)?!1:V9.test(n)?QI[n]=!0:(kI[n]=!0,!1)}function W9(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 K9(n,e,t,r){if(e===null||typeof e>"u"||W9(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 pi(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 Or={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Or[n]=new pi(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Or[e]=new pi(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Or[n]=new pi(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Or[n]=new pi(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){Or[n]=new pi(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Or[n]=new pi(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Or[n]=new pi(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Or[n]=new pi(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Or[n]=new pi(n,5,!1,n.toLowerCase(),null,!1,!1)});var QS=/[\-:]([a-z])/g;function HS(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(QS,HS);Or[e]=new pi(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(QS,HS);Or[e]=new pi(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(QS,HS);Or[e]=new pi(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Or[n]=new pi(n,1,!1,n.toLowerCase(),null,!1,!1)});Or.xlinkHref=new pi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Or[n]=new pi(n,1,!1,n.toLowerCase(),null,!0,!0)});function zS(n,e,t,r){var i=Or.hasOwnProperty(e)?Or[e]:null;(i!==null?i.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$B=Object.prototype.hasOwnProperty,V9=/^[: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]*$/,kI={},QI={};function j9(n){return $B.call(QI,n)?!0:$B.call(kI,n)?!1:V9.test(n)?QI[n]=!0:(kI[n]=!0,!1)}function W9(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 K9(n,e,t,r){if(e===null||typeof e>"u"||W9(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 pi(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 Or={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){Or[n]=new pi(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];Or[e]=new pi(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){Or[n]=new pi(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){Or[n]=new pi(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){Or[n]=new pi(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){Or[n]=new pi(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){Or[n]=new pi(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){Or[n]=new pi(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){Or[n]=new pi(n,5,!1,n.toLowerCase(),null,!1,!1)});var QS=/[\-:]([a-z])/g;function HS(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(QS,HS);Or[e]=new pi(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(QS,HS);Or[e]=new pi(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(QS,HS);Or[e]=new pi(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){Or[n]=new pi(n,1,!1,n.toLowerCase(),null,!1,!1)});Or.xlinkHref=new pi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){Or[n]=new pi(n,1,!1,n.toLowerCase(),null,!0,!0)});function zS(n,e,t,r){var i=Or.hasOwnProperty(e)?Or[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{r1=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?mp(n):""}function $9(n){switch(n.tag){case 5:return mp(n.type);case 16:return mp("Lazy");case 13:return mp("Suspense");case 19:return mp("SuspenseList");case 0:case 2:case 15:return n=i1(n.type,!1),n;case 11:return n=i1(n.type.render,!1),n;case 1:return n=i1(n.type,!0),n;default:return""}}function JB(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 Tf:return"Fragment";case Mf:return"Portal";case YB:return"Profiler";case GS:return"StrictMode";case XB:return"Suspense";case ZB:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case uk:return(n.displayName||"Context")+".Consumer";case ck:return(n._context.displayName||"Context")+".Provider";case VS:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case jS:return e=n.displayName||null,e!==null?e:JB(n.type)||"Memo";case $l:e=n._payload,n=n._init;try{return JB(n(e))}catch{}}return null}function Y9(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 JB(e);case 8:return e===GS?"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 FA(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function hk(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function X9(n){var e=hk(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 Xg(n){n._valueTracker||(n._valueTracker=X9(n))}function dk(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=hk(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function Dy(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 qB(n,e){var t=e.checked;return In({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function zI(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=FA(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 pk(n,e){e=e.checked,e!=null&&zS(n,"checked",e,!1)}function eE(n,e){pk(n,e);var t=FA(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")?tE(n,e.type,t):e.hasOwnProperty("defaultValue")&&tE(n,e.type,FA(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function GI(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 tE(n,e,t){(e!=="number"||Dy(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var gp=Array.isArray;function Jf(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Zg.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function pm(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Hp={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},Z9=["Webkit","ms","Moz","O"];Object.keys(Hp).forEach(function(n){Z9.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Hp[e]=Hp[n]})});function yk(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Hp.hasOwnProperty(n)&&Hp[n]?(""+e).trim():e+"px"}function wk(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=yk(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var J9=In({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 iE(n,e){if(e){if(J9[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Pe(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Pe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Pe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Pe(62))}}function sE(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 oE=null;function WS(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var aE=null,qf=null,eh=null;function WI(n){if(n=hg(n)){if(typeof aE!="function")throw Error(Pe(280));var e=n.stateNode;e&&(e=Bx(e),aE(n.stateNode,n.type,e))}}function xk(n){qf?eh?eh.push(n):eh=[n]:qf=n}function _k(){if(qf){var n=qf,e=eh;if(eh=qf=null,WI(n),e)for(n=0;n>>=0,n===0?32:31-(A7(n)/c7|0)|0}var Jg=64,qg=4194304;function vp(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 Qy(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=vp(a):(s&=o,s!==0&&(r=vp(s)))}else o=t&~i,o!==0?r=vp(o):s!==0&&(r=vp(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 ug(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-_o(e),n[e]=t}function d7(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=Gp),tR=String.fromCharCode(32),nR=!1;function zk(n,e){switch(n){case"keyup":return z7.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gk(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var If=!1;function V7(n,e){switch(n){case"compositionend":return Gk(e);case"keypress":return e.which!==32?null:(nR=!0,tR);case"textInput":return n=e.data,n===tR&&nR?null:n;default:return null}}function j7(n,e){if(If)return n==="compositionend"||!eM&&zk(n,e)?(n=Qk(),$v=ZS=iA=null,If=!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=oR(t)}}function Kk(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?Kk(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function $k(){for(var n=window,e=Dy();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Dy(n.document)}return e}function tM(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 eK(n){var e=$k(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&Kk(t.ownerDocument.documentElement,t)){if(r!==null&&tM(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=aR(t,s);var o=aR(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,Rf=null,hE=null,jp=null,dE=!1;function lR(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;dE||Rf==null||Rf!==Dy(r)||(r=Rf,"selectionStart"in r&&tM(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}),jp&&xm(jp,r)||(jp=r,r=Gy(hE,"onSelect"),0Lf||(n.current=wE[Lf],wE[Lf]=null,Lf--)}function An(n,e){Lf++,wE[Lf]=n.current,n.current=e}var UA={},Zr=WA(UA),Ci=WA(!1),Hc=UA;function xh(n,e){var t=n.type.contextTypes;if(!t)return UA;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 Si(n){return n=n.childContextTypes,n!=null}function jy(){dn(Ci),dn(Zr)}function pR(n,e,t){if(Zr.current!==UA)throw Error(Pe(168));An(Zr,e),An(Ci,t)}function r4(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(Pe(108,Y9(n)||"Unknown",i));return In({},t,r)}function Wy(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||UA,Hc=Zr.current,An(Zr,n),An(Ci,Ci.current),!0}function mR(n,e,t){var r=n.stateNode;if(!r)throw Error(Pe(169));t?(n=r4(n,e,Hc),r.__reactInternalMemoizedMergedChildContext=n,dn(Ci),dn(Zr),An(Zr,n)):dn(Ci),An(Ci,t)}var Xa=null,Ex=!1,v1=!1;function i4(n){Xa===null?Xa=[n]:Xa.push(n)}function fK(n){Ex=!0,i4(n)}function KA(){if(!v1&&Xa!==null){v1=!0;var n=0,e=Jt;try{var t=Xa;for(Jt=1;n>=o,i-=o,nl=1<<32-_o(e)+i|t<b?(M=S,S=null):M=S.sibling;var D=f(m,S,w[b],x);if(D===null){S===null&&(S=M);break}n&&S&&D.alternate===null&&e(m,S),y=s(D,y,b),C===null?_=D:C.sibling=D,C=D,S=M}if(b===w.length)return t(m,S),yn&&fc(m,b),_;if(S===null){for(;bb?(M=S,S=null):M=S.sibling;var $=f(m,S,D.value,x);if($===null){S===null&&(S=M);break}n&&S&&$.alternate===null&&e(m,S),y=s($,y,b),C===null?_=$:C.sibling=$,C=$,S=M}if(D.done)return t(m,S),yn&&fc(m,b),_;if(S===null){for(;!D.done;b++,D=w.next())D=u(m,D.value,x),D!==null&&(y=s(D,y,b),C===null?_=D:C.sibling=D,C=D);return yn&&fc(m,b),_}for(S=r(m,S);!D.done;b++,D=w.next())D=h(S,m,b,D.value,x),D!==null&&(n&&D.alternate!==null&&S.delete(D.key===null?b:D.key),y=s(D,y,b),C===null?_=D:C.sibling=D,C=D);return n&&S.forEach(function(H){return e(m,H)}),yn&&fc(m,b),_}function g(m,y,w,x){if(typeof w=="object"&&w!==null&&w.type===Tf&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Yg:e:{for(var _=w.key,C=y;C!==null;){if(C.key===_){if(_=w.type,_===Tf){if(C.tag===7){t(m,C.sibling),y=i(C,w.props.children),y.return=m,m=y;break e}}else if(C.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===$l&&bR(_)===C.type){t(m,C.sibling),y=i(C,w.props),y.ref=Id(m,C,w),y.return=m,m=y;break e}t(m,C);break}else e(m,C);C=C.sibling}w.type===Tf?(y=Rc(w.props.children,m.mode,x,w.key),y.return=m,m=y):(x=ny(w.type,w.key,w.props,null,m.mode,x),x.ref=Id(m,y,w),x.return=m,m=x)}return o(m);case Mf:e:{for(C=w.key;y!==null;){if(y.key===C)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){t(m,y.sibling),y=i(y,w.children||[]),y.return=m,m=y;break e}else{t(m,y);break}else e(m,y);y=y.sibling}y=C1(w,m.mode,x),y.return=m,m=y}return o(m);case $l:return C=w._init,g(m,y,C(w._payload),x)}if(gp(w))return p(m,y,w,x);if(Ed(w))return d(m,y,w,x);o0(m,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(t(m,y.sibling),y=i(y,w),y.return=m,m=y):(t(m,y),y=E1(w,m.mode,x),y.return=m,m=y),o(m)):t(m,y)}return g}var bh=f4(!0),h4=f4(!1),dg={},la=WA(dg),Em=WA(dg),Cm=WA(dg);function bc(n){if(n===dg)throw Error(Pe(174));return n}function cM(n,e){switch(An(Cm,e),An(Em,n),An(la,dg),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:rE(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=rE(e,n)}dn(la),An(la,e)}function Bh(){dn(la),dn(Em),dn(Cm)}function d4(n){bc(Cm.current);var e=bc(la.current),t=rE(e,n.type);e!==t&&(An(Em,n),An(la,t))}function uM(n){Em.current===n&&(dn(la),dn(Em))}var Cn=WA(0);function Jy(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var y1=[];function fM(){for(var n=0;nt?t:4,n(!0);var r=w1.transition;w1.transition={};try{n(!1),e()}finally{Jt=t,w1.transition=r}}function I4(){return Gs().memoizedState}function mK(n,e,t){var r=_A(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},R4(n))F4(e,t);else if(t=l4(n,e,t,r),t!==null){var i=hi();bo(t,n,r,i),U4(t,e,r)}}function gK(n,e,t){var r=_A(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(R4(n))F4(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,So(a,o)){var l=e.interleaved;l===null?(i.next=i,lM(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=l4(n,e,i,r),t!==null&&(i=hi(),bo(t,n,r,i),U4(t,e,r))}}function R4(n){var e=n.alternate;return n===Tn||e!==null&&e===Tn}function F4(n,e){Wp=qy=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function U4(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,$S(n,t)}}var ew={readContext:zs,useCallback:kr,useContext:kr,useEffect:kr,useImperativeHandle:kr,useInsertionEffect:kr,useLayoutEffect:kr,useMemo:kr,useReducer:kr,useRef:kr,useState:kr,useDebugValue:kr,useDeferredValue:kr,useTransition:kr,useMutableSource:kr,useSyncExternalStore:kr,useId:kr,unstable_isNewReconciler:!1},vK={readContext:zs,useCallback:function(n,e){return Ho().memoizedState=[n,e===void 0?null:e],n},useContext:zs,useEffect:ER,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Jv(4194308,4,E4.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Jv(4194308,4,n,e)},useInsertionEffect:function(n,e){return Jv(4,2,n,e)},useMemo:function(n,e){var t=Ho();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=Ho();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=mK.bind(null,Tn,n),[r.memoizedState,n]},useRef:function(n){var e=Ho();return n={current:n},e.memoizedState=n},useState:BR,useDebugValue:gM,useDeferredValue:function(n){return Ho().memoizedState=n},useTransition:function(){var n=BR(!1),e=n[0];return n=pK.bind(null,n[1]),Ho().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Tn,i=Ho();if(yn){if(t===void 0)throw Error(Pe(407));t=t()}else{if(t=e(),Br===null)throw Error(Pe(349));Gc&30||g4(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,ER(y4.bind(null,r,s,n),[n]),r.flags|=2048,Tm(9,v4.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=Ho(),e=Br.identifierPrefix;if(yn){var t=rl,r=nl;t=(r&~(1<<32-_o(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Sm++,0")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{r1=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?gp(n):""}function $9(n){switch(n.tag){case 5:return gp(n.type);case 16:return gp("Lazy");case 13:return gp("Suspense");case 19:return gp("SuspenseList");case 0:case 2:case 15:return n=i1(n.type,!1),n;case 11:return n=i1(n.type.render,!1),n;case 1:return n=i1(n.type,!0),n;default:return""}}function JB(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 If:return"Fragment";case Tf:return"Portal";case YB:return"Profiler";case GS:return"StrictMode";case XB:return"Suspense";case ZB:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case uk:return(n.displayName||"Context")+".Consumer";case ck:return(n._context.displayName||"Context")+".Provider";case VS:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case jS:return e=n.displayName||null,e!==null?e:JB(n.type)||"Memo";case Yl:e=n._payload,n=n._init;try{return JB(n(e))}catch{}}return null}function Y9(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 JB(e);case 8:return e===GS?"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 UA(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function hk(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function X9(n){var e=hk(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 Zg(n){n._valueTracker||(n._valueTracker=X9(n))}function dk(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=hk(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function Oy(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 qB(n,e){var t=e.checked;return In({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function zI(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=UA(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 pk(n,e){e=e.checked,e!=null&&zS(n,"checked",e,!1)}function eE(n,e){pk(n,e);var t=UA(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")?tE(n,e.type,t):e.hasOwnProperty("defaultValue")&&tE(n,e.type,UA(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function GI(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 tE(n,e,t){(e!=="number"||Oy(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var vp=Array.isArray;function qf(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Jg.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function mm(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var zp={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},Z9=["Webkit","ms","Moz","O"];Object.keys(zp).forEach(function(n){Z9.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),zp[e]=zp[n]})});function yk(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||zp.hasOwnProperty(n)&&zp[n]?(""+e).trim():e+"px"}function wk(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=yk(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var J9=In({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 iE(n,e){if(e){if(J9[n]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Pe(137,n));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Pe(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Pe(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Pe(62))}}function sE(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 oE=null;function WS(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var aE=null,eh=null,th=null;function WI(n){if(n=dg(n)){if(typeof aE!="function")throw Error(Pe(280));var e=n.stateNode;e&&(e=Ex(e),aE(n.stateNode,n.type,e))}}function xk(n){eh?th?th.push(n):th=[n]:eh=n}function _k(){if(eh){var n=eh,e=th;if(th=eh=null,WI(n),e)for(n=0;n>>=0,n===0?32:31-(A7(n)/c7|0)|0}var qg=64,e0=4194304;function yp(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 Hy(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=yp(a):(s&=o,s!==0&&(r=yp(s)))}else o=t&~i,o!==0?r=yp(o):s!==0&&(r=yp(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 fg(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-bo(e),n[e]=t}function d7(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=Vp),tR=String.fromCharCode(32),nR=!1;function zk(n,e){switch(n){case"keyup":return z7.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Gk(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Rf=!1;function V7(n,e){switch(n){case"compositionend":return Gk(e);case"keypress":return e.which!==32?null:(nR=!0,tR);case"textInput":return n=e.data,n===tR&&nR?null:n;default:return null}}function j7(n,e){if(Rf)return n==="compositionend"||!eM&&zk(n,e)?(n=Qk(),Yv=ZS=sA=null,Rf=!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=oR(t)}}function Kk(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?Kk(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function $k(){for(var n=window,e=Oy();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Oy(n.document)}return e}function tM(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 eK(n){var e=$k(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&Kk(t.ownerDocument.documentElement,t)){if(r!==null&&tM(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=aR(t,s);var o=aR(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,Ff=null,hE=null,Wp=null,dE=!1;function lR(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;dE||Ff==null||Ff!==Oy(r)||(r=Ff,"selectionStart"in r&&tM(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}),Wp&&_m(Wp,r)||(Wp=r,r=Vy(hE,"onSelect"),0Pf||(n.current=wE[Pf],wE[Pf]=null,Pf--)}function An(n,e){Pf++,wE[Pf]=n.current,n.current=e}var LA={},Zr=KA(LA),Ci=KA(!1),zc=LA;function _h(n,e){var t=n.type.contextTypes;if(!t)return LA;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 Si(n){return n=n.childContextTypes,n!=null}function Wy(){dn(Ci),dn(Zr)}function pR(n,e,t){if(Zr.current!==LA)throw Error(Pe(168));An(Zr,e),An(Ci,t)}function r4(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(Pe(108,Y9(n)||"Unknown",i));return In({},t,r)}function Ky(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||LA,zc=Zr.current,An(Zr,n),An(Ci,Ci.current),!0}function mR(n,e,t){var r=n.stateNode;if(!r)throw Error(Pe(169));t?(n=r4(n,e,zc),r.__reactInternalMemoizedMergedChildContext=n,dn(Ci),dn(Zr),An(Zr,n)):dn(Ci),An(Ci,t)}var Za=null,Cx=!1,v1=!1;function i4(n){Za===null?Za=[n]:Za.push(n)}function fK(n){Cx=!0,i4(n)}function $A(){if(!v1&&Za!==null){v1=!0;var n=0,e=Jt;try{var t=Za;for(Jt=1;n>=o,i-=o,rl=1<<32-bo(e)+i|t<b?(M=S,S=null):M=S.sibling;var D=f(m,S,w[b],x);if(D===null){S===null&&(S=M);break}n&&S&&D.alternate===null&&e(m,S),y=s(D,y,b),C===null?_=D:C.sibling=D,C=D,S=M}if(b===w.length)return t(m,S),yn&&hc(m,b),_;if(S===null){for(;bb?(M=S,S=null):M=S.sibling;var $=f(m,S,D.value,x);if($===null){S===null&&(S=M);break}n&&S&&$.alternate===null&&e(m,S),y=s($,y,b),C===null?_=$:C.sibling=$,C=$,S=M}if(D.done)return t(m,S),yn&&hc(m,b),_;if(S===null){for(;!D.done;b++,D=w.next())D=u(m,D.value,x),D!==null&&(y=s(D,y,b),C===null?_=D:C.sibling=D,C=D);return yn&&hc(m,b),_}for(S=r(m,S);!D.done;b++,D=w.next())D=h(S,m,b,D.value,x),D!==null&&(n&&D.alternate!==null&&S.delete(D.key===null?b:D.key),y=s(D,y,b),C===null?_=D:C.sibling=D,C=D);return n&&S.forEach(function(H){return e(m,H)}),yn&&hc(m,b),_}function g(m,y,w,x){if(typeof w=="object"&&w!==null&&w.type===If&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Xg:e:{for(var _=w.key,C=y;C!==null;){if(C.key===_){if(_=w.type,_===If){if(C.tag===7){t(m,C.sibling),y=i(C,w.props.children),y.return=m,m=y;break e}}else if(C.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Yl&&bR(_)===C.type){t(m,C.sibling),y=i(C,w.props),y.ref=Rd(m,C,w),y.return=m,m=y;break e}t(m,C);break}else e(m,C);C=C.sibling}w.type===If?(y=Fc(w.props.children,m.mode,x,w.key),y.return=m,m=y):(x=ry(w.type,w.key,w.props,null,m.mode,x),x.ref=Rd(m,y,w),x.return=m,m=x)}return o(m);case Tf:e:{for(C=w.key;y!==null;){if(y.key===C)if(y.tag===4&&y.stateNode.containerInfo===w.containerInfo&&y.stateNode.implementation===w.implementation){t(m,y.sibling),y=i(y,w.children||[]),y.return=m,m=y;break e}else{t(m,y);break}else e(m,y);y=y.sibling}y=C1(w,m.mode,x),y.return=m,m=y}return o(m);case Yl:return C=w._init,g(m,y,C(w._payload),x)}if(vp(w))return p(m,y,w,x);if(Cd(w))return d(m,y,w,x);a0(m,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,y!==null&&y.tag===6?(t(m,y.sibling),y=i(y,w),y.return=m,m=y):(t(m,y),y=E1(w,m.mode,x),y.return=m,m=y),o(m)):t(m,y)}return g}var Bh=f4(!0),h4=f4(!1),pg={},Aa=KA(pg),Cm=KA(pg),Sm=KA(pg);function Bc(n){if(n===pg)throw Error(Pe(174));return n}function cM(n,e){switch(An(Sm,e),An(Cm,n),An(Aa,pg),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:rE(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=rE(e,n)}dn(Aa),An(Aa,e)}function Eh(){dn(Aa),dn(Cm),dn(Sm)}function d4(n){Bc(Sm.current);var e=Bc(Aa.current),t=rE(e,n.type);e!==t&&(An(Cm,n),An(Aa,t))}function uM(n){Cm.current===n&&(dn(Aa),dn(Cm))}var Cn=KA(0);function qy(n){for(var e=n;e!==null;){if(e.tag===13){var t=e.memoizedState;if(t!==null&&(t=t.dehydrated,t===null||t.data==="$?"||t.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===n)break;for(;e.sibling===null;){if(e.return===null||e.return===n)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var y1=[];function fM(){for(var n=0;nt?t:4,n(!0);var r=w1.transition;w1.transition={};try{n(!1),e()}finally{Jt=t,w1.transition=r}}function I4(){return Vs().memoizedState}function mK(n,e,t){var r=bA(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},R4(n))F4(e,t);else if(t=l4(n,e,t,r),t!==null){var i=hi();Bo(t,n,r,i),U4(t,e,r)}}function gK(n,e,t){var r=bA(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(R4(n))F4(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,Mo(a,o)){var l=e.interleaved;l===null?(i.next=i,lM(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=l4(n,e,i,r),t!==null&&(i=hi(),Bo(t,n,r,i),U4(t,e,r))}}function R4(n){var e=n.alternate;return n===Tn||e!==null&&e===Tn}function F4(n,e){Kp=ew=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function U4(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,$S(n,t)}}var tw={readContext:Gs,useCallback:kr,useContext:kr,useEffect:kr,useImperativeHandle:kr,useInsertionEffect:kr,useLayoutEffect:kr,useMemo:kr,useReducer:kr,useRef:kr,useState:kr,useDebugValue:kr,useDeferredValue:kr,useTransition:kr,useMutableSource:kr,useSyncExternalStore:kr,useId:kr,unstable_isNewReconciler:!1},vK={readContext:Gs,useCallback:function(n,e){return zo().memoizedState=[n,e===void 0?null:e],n},useContext:Gs,useEffect:ER,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,qv(4194308,4,E4.bind(null,e,n),t)},useLayoutEffect:function(n,e){return qv(4194308,4,n,e)},useInsertionEffect:function(n,e){return qv(4,2,n,e)},useMemo:function(n,e){var t=zo();return e=e===void 0?null:e,n=n(),t.memoizedState=[n,e],n},useReducer:function(n,e,t){var r=zo();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=mK.bind(null,Tn,n),[r.memoizedState,n]},useRef:function(n){var e=zo();return n={current:n},e.memoizedState=n},useState:BR,useDebugValue:gM,useDeferredValue:function(n){return zo().memoizedState=n},useTransition:function(){var n=BR(!1),e=n[0];return n=pK.bind(null,n[1]),zo().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Tn,i=zo();if(yn){if(t===void 0)throw Error(Pe(407));t=t()}else{if(t=e(),Er===null)throw Error(Pe(349));Vc&30||g4(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,ER(y4.bind(null,r,s,n),[n]),r.flags|=2048,Im(9,v4.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=zo(),e=Er.identifierPrefix;if(yn){var t=il,r=rl;t=(r&~(1<<32-bo(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Mm++,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[$o]=e,n[Bm]=r,z4(n,e,!1,!1),e.stateNode=n;e:{switch(o=sE(t,r),t){case"dialog":cn("cancel",n),cn("close",n),i=r;break;case"iframe":case"object":case"embed":cn("load",n),i=r;break;case"video":case"audio":for(i=0;iCh&&(e.flags|=128,r=!0,Rd(s,!1),e.lanes=4194304)}else{if(!r)if(n=Jy(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Rd(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!yn)return Qr(e),null}else 2*Yn()-s.renderingStartTime>Ch&&t!==1073741824&&(e.flags|=128,r=!0,Rd(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=Yn(),e.sibling=null,t=Cn.current,An(Cn,r?t&1|2:t&1),e):(Qr(e),null);case 22:case 23:return bM(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?ji&1073741824&&(Qr(e),e.subtreeFlags&6&&(e.flags|=8192)):Qr(e),null;case 24:return null;case 25:return null}throw Error(Pe(156,e.tag))}function CK(n,e){switch(rM(e),e.tag){case 1:return Si(e.type)&&jy(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Bh(),dn(Ci),dn(Zr),fM(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return uM(e),null;case 13:if(dn(Cn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Pe(340));_h()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return dn(Cn),null;case 4:return Bh(),null;case 10:return aM(e.type._context),null;case 22:case 23:return bM(),null;case 24:return null;default:return null}}var l0=!1,jr=!1,SK=typeof WeakSet=="function"?WeakSet:Set,Ye=null;function Nf(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){On(n,e,r)}else t.current=null}function FE(n,e,t){try{t()}catch(r){On(n,e,r)}}var LR=!1;function MK(n,e){if(pE=Hy,n=$k(),tM(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,A=0,c=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&&++A===i&&(a=o),f===s&&++c===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(mE={focusedElem:n,selectionRange:t},Hy=!1,Ye=e;Ye!==null;)if(e=Ye,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Ye=n;else for(;Ye!==null;){e=Ye;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var d=p.memoizedProps,g=p.memoizedState,m=e.stateNode,y=m.getSnapshotBeforeUpdate(e.elementType===e.type?d:mo(e.type,d),g);m.__reactInternalSnapshotBeforeUpdate=y}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(Pe(163))}}catch(x){On(e,e.return,x)}if(n=e.sibling,n!==null){n.return=e.return,Ye=n;break}Ye=e.return}return p=LR,LR=!1,p}function Kp(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&&FE(e,t,s)}i=i.next}while(i!==r)}}function Mx(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 UE(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 j4(n){var e=n.alternate;e!==null&&(n.alternate=null,j4(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[$o],delete e[Bm],delete e[yE],delete e[cK],delete e[uK])),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 W4(n){return n.tag===5||n.tag===3||n.tag===4}function PR(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||W4(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 LE(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=Vy));else if(r!==4&&(n=n.child,n!==null))for(LE(n,e,t),n=n.sibling;n!==null;)LE(n,e,t),n=n.sibling}function PE(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(PE(n,e,t),n=n.sibling;n!==null;)PE(n,e,t),n=n.sibling}var Ir=null,go=!1;function Ul(n,e,t){for(t=t.child;t!==null;)K4(n,e,t),t=t.sibling}function K4(n,e,t){if(aa&&typeof aa.onCommitFiberUnmount=="function")try{aa.onCommitFiberUnmount(wx,t)}catch{}switch(t.tag){case 5:jr||Nf(t,e);case 6:var r=Ir,i=go;Ir=null,Ul(n,e,t),Ir=r,go=i,Ir!==null&&(go?(n=Ir,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Ir.removeChild(t.stateNode));break;case 18:Ir!==null&&(go?(n=Ir,t=t.stateNode,n.nodeType===8?g1(n.parentNode,t):n.nodeType===1&&g1(n,t),ym(n)):g1(Ir,t.stateNode));break;case 4:r=Ir,i=go,Ir=t.stateNode.containerInfo,go=!0,Ul(n,e,t),Ir=r,go=i;break;case 0:case 11:case 14:case 15:if(!jr&&(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)&&FE(t,e,o),i=i.next}while(i!==r)}Ul(n,e,t);break;case 1:if(!jr&&(Nf(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){On(t,e,a)}Ul(n,e,t);break;case 21:Ul(n,e,t);break;case 22:t.mode&1?(jr=(r=jr)||t.memoizedState!==null,Ul(n,e,t),jr=r):Ul(n,e,t);break;default:Ul(n,e,t)}}function DR(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new SK),e.forEach(function(r){var i=OK.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function io(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Yn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*IK(r/1960))-r,10n?16:n,sA===null)var r=!1;else{if(n=sA,sA=null,rw=0,Ht&6)throw Error(Pe(331));var i=Ht;for(Ht|=4,Ye=n.current;Ye!==null;){var s=Ye,o=s.child;if(Ye.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lYn()-xM?Ic(n,0):wM|=t),Mi(n,e)}function tQ(n,e){e===0&&(n.mode&1?(e=qg,qg<<=1,!(qg&130023424)&&(qg=4194304)):e=1);var t=hi();n=gl(n,e),n!==null&&(ug(n,e,t),Mi(n,t))}function DK(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),tQ(n,t)}function OK(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(Pe(314))}r!==null&&r.delete(e),tQ(n,t)}var nQ;nQ=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Ci.current)Bi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Bi=!1,BK(n,e,t);Bi=!!(n.flags&131072)}else Bi=!1,yn&&e.flags&1048576&&s4(e,$y,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;qv(n,e),n=e.pendingProps;var i=xh(e,Zr.current);nh(e,t),i=dM(null,e,r,n,i,t);var s=pM();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,Si(r)?(s=!0,Wy(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,AM(e),i.updater=Cx,e.stateNode=i,i._reactInternals=e,EE(e,r,n,t),e=ME(null,e,r,!0,s,t)):(e.tag=0,yn&&s&&nM(e),ii(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(qv(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=kK(r),n=mo(r,n),i){case 0:e=SE(null,e,r,n,t);break e;case 1:e=RR(null,e,r,n,t);break e;case 11:e=TR(null,e,r,n,t);break e;case 14:e=IR(null,e,r,mo(r.type,n),t);break e}throw Error(Pe(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:mo(r,i),SE(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:mo(r,i),RR(n,e,r,i,t);case 3:e:{if(k4(e),n===null)throw Error(Pe(387));r=e.pendingProps,s=e.memoizedState,i=s.element,A4(n,e),Zy(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=Eh(Error(Pe(423)),e),e=FR(n,e,r,t,i);break e}else if(r!==i){i=Eh(Error(Pe(424)),e),e=FR(n,e,r,t,i);break e}else for(qi=yA(e.stateNode.containerInfo.firstChild),ns=e,yn=!0,yo=null,t=h4(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(_h(),r===i){e=vl(n,e,t);break e}ii(n,e,r,t)}e=e.child}return e;case 5:return d4(e),n===null&&_E(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,gE(r,i)?o=null:s!==null&&gE(r,s)&&(e.flags|=32),N4(n,e),ii(n,e,o,t),e.child;case 6:return n===null&&_E(e),null;case 13:return Q4(n,e,t);case 4:return cM(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=bh(e,null,r,t):ii(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:mo(r,i),TR(n,e,r,i,t);case 7:return ii(n,e,e.pendingProps,t),e.child;case 8:return ii(n,e,e.pendingProps.children,t),e.child;case 12:return ii(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,An(Yy,r._currentValue),r._currentValue=o,s!==null)if(So(s.value,o)){if(s.children===i.children&&!Ci.current){e=vl(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=al(-1,t&-t),l.tag=2;var A=s.updateQueue;if(A!==null){A=A.shared;var c=A.pending;c===null?l.next=l:(l.next=c.next,c.next=l),A.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),bE(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(Pe(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),bE(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}ii(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,nh(e,t),i=zs(i),r=r(i),e.flags|=1,ii(n,e,r,t),e.child;case 14:return r=e.type,i=mo(r,e.pendingProps),i=mo(r.type,i),IR(n,e,r,i,t);case 15:return D4(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:mo(r,i),qv(n,e),e.tag=1,Si(r)?(n=!0,Wy(e)):n=!1,nh(e,t),u4(e,r,i),EE(e,r,i,t),ME(null,e,r,!0,n,t);case 19:return H4(n,e,t);case 22:return O4(n,e,t)}throw Error(Pe(156,e.tag))};function rQ(n,e){return Tk(n,e)}function NK(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 Fs(n,e,t,r){return new NK(n,e,t,r)}function EM(n){return n=n.prototype,!(!n||!n.isReactComponent)}function kK(n){if(typeof n=="function")return EM(n)?1:0;if(n!=null){if(n=n.$$typeof,n===VS)return 11;if(n===jS)return 14}return 2}function bA(n,e){var t=n.alternate;return t===null?(t=Fs(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 ny(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")EM(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Tf:return Rc(t.children,i,s,e);case GS:o=8,i|=8;break;case YB:return n=Fs(12,t,e,i|2),n.elementType=YB,n.lanes=s,n;case XB:return n=Fs(13,t,e,i),n.elementType=XB,n.lanes=s,n;case ZB:return n=Fs(19,t,e,i),n.elementType=ZB,n.lanes=s,n;case fk:return Ix(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case ck:o=10;break e;case uk:o=9;break e;case VS:o=11;break e;case jS:o=14;break e;case $l:o=16,r=null;break e}throw Error(Pe(130,n==null?n:typeof n,""))}return e=Fs(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function Rc(n,e,t,r){return n=Fs(7,n,r,e),n.lanes=t,n}function Ix(n,e,t,r){return n=Fs(22,n,r,e),n.elementType=fk,n.lanes=t,n.stateNode={isHidden:!1},n}function E1(n,e,t){return n=Fs(6,n,null,e),n.lanes=t,n}function C1(n,e,t){return e=Fs(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function QK(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=o1(0),this.expirationTimes=o1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=o1(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function CM(n,e,t,r,i,s,o,a,l){return n=new QK(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Fs(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},AM(s),n}function HK(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(aQ)}catch(n){console.error(n)}}aQ(),sk.exports=hs;var WK=sk.exports,VR=WK;KB.createRoot=VR.createRoot,KB.hydrateRoot=VR.hydrateRoot;const KK="/CharacterStudio/assets/cc_bgm_balanced-f542698c.wav",$s=ye.createContext(),$K=({children:n})=>{const[e,t]=ye.useState(!1),r=Y.useRef(null),i=()=>{t(!1);const o=r.current;o.src=KK,o.loop=!0,o.volume=0,o.play();let a=0;const l=5,A=setInterval(()=>{a=Math.max(a+1/(10*l*60),1),a>=1&&clearInterval(A),o.volume=a},1e3/60)},s=()=>{t(!0),r.current.pause()};return k.jsxs($s.Provider,{value:{isMute:e,setMute:t,enableAudio:i,disableAudio:s},children:[k.jsx("audio",{ref:r}),n]})},YK=ye.createContext(),XK=n=>{const[e,t]=ye.useState(null),[r,i]=ye.useState(null),[s,o]=ye.useState(!1),[a,l]=ye.useState([]);return k.jsx(YK.Provider,{value:{walletAddress:e,setWalletAddress:t,ensName:r,setEnsName:i,connected:s,setConnected:o,OTTokens:a,setOTTokens:l},children:n.children})};function $a(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function lQ(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 b1(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function CE(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var xK=typeof WeakMap=="function"?WeakMap:Map;function L4(n,e,t){t=ll(-1,t),t.tag=3,t.payload={element:null};var r=e.value;return t.callback=function(){rw||(rw=!0,DE=r),CE(n,e)},t}function P4(n,e,t){t=ll(-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(){CE(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){CE(n,e),typeof r!="function"&&(_A===null?_A=new Set([this]):_A.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function CR(n,e,t){var r=n.pingCache;if(r===null){r=n.pingCache=new xK;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=PK.bind(null,n,e,t),e.then(n,n))}function SR(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 MR(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=ll(-1,1),e.tag=2,xA(t,e,1))),t.lanes|=1),n)}var _K=Cl.ReactCurrentOwner,Bi=!1;function ii(n,e,t,r){e.child=n===null?h4(e,null,t,r):Bh(e,n.child,t,r)}function TR(n,e,t,r,i){t=t.render;var s=e.ref;return rh(e,i),r=dM(n,e,t,r,s,i),t=pM(),n!==null&&!Bi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,yl(n,e,i)):(yn&&t&&nM(e),e.flags|=1,ii(n,e,r,i),e.child)}function IR(n,e,t,r,i){if(n===null){var s=t.type;return typeof s=="function"&&!EM(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,D4(n,e,s,r,i)):(n=ry(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:_m,t(o,r)&&n.ref===e.ref)return yl(n,e,i)}return e.flags|=1,n=BA(s,r),n.ref=e.ref,n.return=e,e.child=n}function D4(n,e,t,r,i){if(n!==null){var s=n.memoizedProps;if(_m(s,r)&&n.ref===e.ref)if(Bi=!1,e.pendingProps=r=s,(n.lanes&i)!==0)n.flags&131072&&(Bi=!0);else return e.lanes=n.lanes,yl(n,e,i)}return SE(n,e,t,r,i)}function O4(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},An(Qf,ji),ji|=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,An(Qf,ji),ji|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:t,An(Qf,ji),ji|=r}else s!==null?(r=s.baseLanes|t,e.memoizedState=null):r=t,An(Qf,ji),ji|=r;return ii(n,e,i,t),e.child}function N4(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function SE(n,e,t,r,i){var s=Si(t)?zc:Zr.current;return s=_h(e,s),rh(e,i),t=dM(n,e,t,r,s,i),r=pM(),n!==null&&!Bi?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,yl(n,e,i)):(yn&&r&&nM(e),e.flags|=1,ii(n,e,t,i),e.child)}function RR(n,e,t,r,i){if(Si(t)){var s=!0;Ky(e)}else s=!1;if(rh(e,i),e.stateNode===null)ey(n,e),u4(e,t,r),EE(e,t,r,i),r=!0;else if(n===null){var o=e.stateNode,a=e.memoizedProps;o.props=a;var l=o.context,A=t.contextType;typeof A=="object"&&A!==null?A=Gs(A):(A=Si(t)?zc:Zr.current,A=_h(e,A));var c=t.getDerivedStateFromProps,u=typeof c=="function"||typeof o.getSnapshotBeforeUpdate=="function";u||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==A)&&_R(e,o,r,A),Xl=!1;var f=e.memoizedState;o.state=f,Jy(e,r,o,i),l=e.memoizedState,a!==r||f!==l||Ci.current||Xl?(typeof c=="function"&&(BE(e,t,c,r),l=e.memoizedState),(a=Xl||xR(e,t,a,r,f,l,A))?(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=A,r=a):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,A4(n,e),a=e.memoizedProps,A=e.type===e.elementType?a:go(e.type,a),o.props=A,u=e.pendingProps,f=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=Gs(l):(l=Si(t)?zc:Zr.current,l=_h(e,l));var h=t.getDerivedStateFromProps;(c=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==u||f!==l)&&_R(e,o,r,l),Xl=!1,f=e.memoizedState,o.state=f,Jy(e,r,o,i);var p=e.memoizedState;a!==u||f!==p||Ci.current||Xl?(typeof h=="function"&&(BE(e,t,h,r),p=e.memoizedState),(A=Xl||xR(e,t,A,r,f,p,l)||!1)?(c||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,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=p),o.props=r,o.state=p,o.context=l,r=A):(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 ME(n,e,t,r,s,i)}function ME(n,e,t,r,i,s){N4(n,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&mR(e,t,!1),yl(n,e,s);r=e.stateNode,_K.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,n!==null&&o?(e.child=Bh(e,n.child,null,s),e.child=Bh(e,null,a,s)):ii(n,e,a,s),e.memoizedState=r.state,i&&mR(e,t,!0),e.child}function k4(n){var e=n.stateNode;e.pendingContext?pR(n,e.pendingContext,e.pendingContext!==e.context):e.context&&pR(n,e.context,!1),cM(n,e.containerInfo)}function FR(n,e,t,r,i){return bh(),iM(i),e.flags|=256,ii(n,e,t,r),e.child}var TE={dehydrated:null,treeContext:null,retryLane:0};function IE(n){return{baseLanes:n,cachePool:null,transitions:null}}function Q4(n,e,t){var r=e.pendingProps,i=Cn.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),An(Cn,i&1),n===null)return _E(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=Rx(o,r,0,null),n=Fc(n,r,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=IE(t),e.memoizedState=TE,n):vM(e,o));if(i=n.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return bK(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=BA(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=BA(a,s):(s=Fc(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?IE(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=TE,r}return s=n.child,n=s.sibling,r=BA(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 vM(n,e){return e=Rx({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function l0(n,e,t,r){return r!==null&&iM(r),Bh(e,n.child,null,t),n=vM(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function bK(n,e,t,r,i,s,o){if(t)return e.flags&256?(e.flags&=-257,r=b1(Error(Pe(422))),l0(n,e,o,r)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=Rx({mode:"visible",children:r.children},i,0,null),s=Fc(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&Bh(e,n.child,null,o),e.child.memoizedState=IE(o),e.memoizedState=TE,s);if(!(e.mode&1))return l0(n,e,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(Pe(419)),r=b1(s,r,void 0),l0(n,e,o,r)}if(a=(o&n.childLanes)!==0,Bi||a){if(r=Er,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,vl(n,i),Bo(r,n,i,-1))}return BM(),r=b1(Error(Pe(421))),l0(n,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=n.child,e=DK.bind(null,n),i._reactRetry=e,null):(n=s.treeContext,qi=wA(i.nextSibling),ns=e,yn=!0,wo=null,n!==null&&(Ss[Ms++]=rl,Ss[Ms++]=il,Ss[Ms++]=Gc,rl=n.id,il=n.overflow,Gc=e),e=vM(e,r.children),e.flags|=4096,e)}function UR(n,e,t){n.lanes|=e;var r=n.alternate;r!==null&&(r.lanes|=e),bE(n.return,e,t)}function B1(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 H4(n,e,t){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(ii(n,e,r.children,t),r=Cn.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&&UR(n,t,e);else if(n.tag===19)UR(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(An(Cn,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&&qy(n)===null&&(i=t),t=t.sibling;t=i,t===null?(i=e.child,e.child=null):(i=t.sibling,t.sibling=null),B1(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&&qy(n)===null){e.child=i;break}n=i.sibling,i.sibling=t,t=i,i=n}B1(e,!0,t,null,s);break;case"together":B1(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function ey(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function yl(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),jc|=e.lanes,!(t&e.childLanes))return null;if(n!==null&&e.child!==n.child)throw Error(Pe(153));if(e.child!==null){for(n=e.child,t=BA(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=BA(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function BK(n,e,t){switch(e.tag){case 3:k4(e),bh();break;case 5:d4(e);break;case 1:Si(e.type)&&Ky(e);break;case 4:cM(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;An(Xy,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(An(Cn,Cn.current&1),e.flags|=128,null):t&e.child.childLanes?Q4(n,e,t):(An(Cn,Cn.current&1),n=yl(n,e,t),n!==null?n.sibling:null);An(Cn,Cn.current&1);break;case 19:if(r=(t&e.childLanes)!==0,n.flags&128){if(r)return H4(n,e,t);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),An(Cn,Cn.current),r)break;return null;case 22:case 23:return e.lanes=0,O4(n,e,t)}return yl(n,e,t)}var z4,RE,G4,V4;z4=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}};RE=function(){};G4=function(n,e,t,r){var i=n.memoizedProps;if(i!==r){n=e.stateNode,Bc(Aa.current);var s=null;switch(t){case"input":i=qB(n,i),r=qB(n,r),s=[];break;case"select":i=In({},i,{value:void 0}),r=In({},r,{value:void 0}),s=[];break;case"textarea":i=nE(n,i),r=nE(n,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(n.onclick=jy)}iE(t,r);var o;t=null;for(A in i)if(!r.hasOwnProperty(A)&&i.hasOwnProperty(A)&&i[A]!=null)if(A==="style"){var a=i[A];for(o in a)a.hasOwnProperty(o)&&(t||(t={}),t[o]="")}else A!=="dangerouslySetInnerHTML"&&A!=="children"&&A!=="suppressContentEditableWarning"&&A!=="suppressHydrationWarning"&&A!=="autoFocus"&&(pm.hasOwnProperty(A)?s||(s=[]):(s=s||[]).push(A,null));for(A in r){var l=r[A];if(a=i!=null?i[A]:void 0,r.hasOwnProperty(A)&&l!==a&&(l!=null||a!=null))if(A==="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(A,t)),t=l;else A==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(A,l)):A==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(A,""+l):A!=="suppressContentEditableWarning"&&A!=="suppressHydrationWarning"&&(pm.hasOwnProperty(A)?(l!=null&&A==="onScroll"&&cn("scroll",n),s||a===l||(s=[])):(s=s||[]).push(A,l))}t&&(s=s||[]).push("style",t);var A=s;(e.updateQueue=A)&&(e.flags|=4)}};V4=function(n,e,t,r){t!==r&&(e.flags|=4)};function Fd(n,e){if(!yn)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 Qr(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 EK(n,e,t){var r=e.pendingProps;switch(rM(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qr(e),null;case 1:return Si(e.type)&&Wy(),Qr(e),null;case 3:return r=e.stateNode,Eh(),dn(Ci),dn(Zr),fM(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(n===null||n.child===null)&&(o0(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,wo!==null&&(kE(wo),wo=null))),RE(n,e),Qr(e),null;case 5:uM(e);var i=Bc(Sm.current);if(t=e.type,n!==null&&e.stateNode!=null)G4(n,e,t,r,i),n.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(Pe(166));return Qr(e),null}if(n=Bc(Aa.current),o0(e)){r=e.stateNode,t=e.type;var s=e.memoizedProps;switch(r[Yo]=e,r[Em]=s,n=(e.mode&1)!==0,t){case"dialog":cn("cancel",r),cn("close",r);break;case"iframe":case"object":case"embed":cn("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[Yo]=e,n[Em]=r,z4(n,e,!1,!1),e.stateNode=n;e:{switch(o=sE(t,r),t){case"dialog":cn("cancel",n),cn("close",n),i=r;break;case"iframe":case"object":case"embed":cn("load",n),i=r;break;case"video":case"audio":for(i=0;iSh&&(e.flags|=128,r=!0,Fd(s,!1),e.lanes=4194304)}else{if(!r)if(n=qy(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Fd(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!yn)return Qr(e),null}else 2*Yn()-s.renderingStartTime>Sh&&t!==1073741824&&(e.flags|=128,r=!0,Fd(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=Yn(),e.sibling=null,t=Cn.current,An(Cn,r?t&1|2:t&1),e):(Qr(e),null);case 22:case 23:return bM(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?ji&1073741824&&(Qr(e),e.subtreeFlags&6&&(e.flags|=8192)):Qr(e),null;case 24:return null;case 25:return null}throw Error(Pe(156,e.tag))}function CK(n,e){switch(rM(e),e.tag){case 1:return Si(e.type)&&Wy(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return Eh(),dn(Ci),dn(Zr),fM(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return uM(e),null;case 13:if(dn(Cn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Pe(340));bh()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return dn(Cn),null;case 4:return Eh(),null;case 10:return aM(e.type._context),null;case 22:case 23:return bM(),null;case 24:return null;default:return null}}var A0=!1,jr=!1,SK=typeof WeakSet=="function"?WeakSet:Set,Ye=null;function kf(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){On(n,e,r)}else t.current=null}function FE(n,e,t){try{t()}catch(r){On(n,e,r)}}var LR=!1;function MK(n,e){if(pE=zy,n=$k(),tM(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,A=0,c=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&&++A===i&&(a=o),f===s&&++c===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(mE={focusedElem:n,selectionRange:t},zy=!1,Ye=e;Ye!==null;)if(e=Ye,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Ye=n;else for(;Ye!==null;){e=Ye;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var d=p.memoizedProps,g=p.memoizedState,m=e.stateNode,y=m.getSnapshotBeforeUpdate(e.elementType===e.type?d:go(e.type,d),g);m.__reactInternalSnapshotBeforeUpdate=y}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(Pe(163))}}catch(x){On(e,e.return,x)}if(n=e.sibling,n!==null){n.return=e.return,Ye=n;break}Ye=e.return}return p=LR,LR=!1,p}function $p(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&&FE(e,t,s)}i=i.next}while(i!==r)}}function Tx(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 UE(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 j4(n){var e=n.alternate;e!==null&&(n.alternate=null,j4(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Yo],delete e[Em],delete e[yE],delete e[cK],delete e[uK])),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 W4(n){return n.tag===5||n.tag===3||n.tag===4}function PR(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||W4(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 LE(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=jy));else if(r!==4&&(n=n.child,n!==null))for(LE(n,e,t),n=n.sibling;n!==null;)LE(n,e,t),n=n.sibling}function PE(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(PE(n,e,t),n=n.sibling;n!==null;)PE(n,e,t),n=n.sibling}var Rr=null,vo=!1;function Ll(n,e,t){for(t=t.child;t!==null;)K4(n,e,t),t=t.sibling}function K4(n,e,t){if(la&&typeof la.onCommitFiberUnmount=="function")try{la.onCommitFiberUnmount(xx,t)}catch{}switch(t.tag){case 5:jr||kf(t,e);case 6:var r=Rr,i=vo;Rr=null,Ll(n,e,t),Rr=r,vo=i,Rr!==null&&(vo?(n=Rr,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Rr.removeChild(t.stateNode));break;case 18:Rr!==null&&(vo?(n=Rr,t=t.stateNode,n.nodeType===8?g1(n.parentNode,t):n.nodeType===1&&g1(n,t),wm(n)):g1(Rr,t.stateNode));break;case 4:r=Rr,i=vo,Rr=t.stateNode.containerInfo,vo=!0,Ll(n,e,t),Rr=r,vo=i;break;case 0:case 11:case 14:case 15:if(!jr&&(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)&&FE(t,e,o),i=i.next}while(i!==r)}Ll(n,e,t);break;case 1:if(!jr&&(kf(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){On(t,e,a)}Ll(n,e,t);break;case 21:Ll(n,e,t);break;case 22:t.mode&1?(jr=(r=jr)||t.memoizedState!==null,Ll(n,e,t),jr=r):Ll(n,e,t);break;default:Ll(n,e,t)}}function DR(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new SK),e.forEach(function(r){var i=OK.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function so(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=Yn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*IK(r/1960))-r,10n?16:n,oA===null)var r=!1;else{if(n=oA,oA=null,iw=0,Ht&6)throw Error(Pe(331));var i=Ht;for(Ht|=4,Ye=n.current;Ye!==null;){var s=Ye,o=s.child;if(Ye.flags&16){var a=s.deletions;if(a!==null){for(var l=0;lYn()-xM?Rc(n,0):wM|=t),Mi(n,e)}function tQ(n,e){e===0&&(n.mode&1?(e=e0,e0<<=1,!(e0&130023424)&&(e0=4194304)):e=1);var t=hi();n=vl(n,e),n!==null&&(fg(n,e,t),Mi(n,t))}function DK(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),tQ(n,t)}function OK(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(Pe(314))}r!==null&&r.delete(e),tQ(n,t)}var nQ;nQ=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Ci.current)Bi=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Bi=!1,BK(n,e,t);Bi=!!(n.flags&131072)}else Bi=!1,yn&&e.flags&1048576&&s4(e,Yy,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;ey(n,e),n=e.pendingProps;var i=_h(e,Zr.current);rh(e,t),i=dM(null,e,r,n,i,t);var s=pM();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,Si(r)?(s=!0,Ky(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,AM(e),i.updater=Sx,e.stateNode=i,i._reactInternals=e,EE(e,r,n,t),e=ME(null,e,r,!0,s,t)):(e.tag=0,yn&&s&&nM(e),ii(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(ey(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=kK(r),n=go(r,n),i){case 0:e=SE(null,e,r,n,t);break e;case 1:e=RR(null,e,r,n,t);break e;case 11:e=TR(null,e,r,n,t);break e;case 14:e=IR(null,e,r,go(r.type,n),t);break e}throw Error(Pe(306,r,""))}return e;case 0:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:go(r,i),SE(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:go(r,i),RR(n,e,r,i,t);case 3:e:{if(k4(e),n===null)throw Error(Pe(387));r=e.pendingProps,s=e.memoizedState,i=s.element,A4(n,e),Jy(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=Ch(Error(Pe(423)),e),e=FR(n,e,r,t,i);break e}else if(r!==i){i=Ch(Error(Pe(424)),e),e=FR(n,e,r,t,i);break e}else for(qi=wA(e.stateNode.containerInfo.firstChild),ns=e,yn=!0,wo=null,t=h4(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(bh(),r===i){e=yl(n,e,t);break e}ii(n,e,r,t)}e=e.child}return e;case 5:return d4(e),n===null&&_E(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,gE(r,i)?o=null:s!==null&&gE(r,s)&&(e.flags|=32),N4(n,e),ii(n,e,o,t),e.child;case 6:return n===null&&_E(e),null;case 13:return Q4(n,e,t);case 4:return cM(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=Bh(e,null,r,t):ii(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:go(r,i),TR(n,e,r,i,t);case 7:return ii(n,e,e.pendingProps,t),e.child;case 8:return ii(n,e,e.pendingProps.children,t),e.child;case 12:return ii(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,An(Xy,r._currentValue),r._currentValue=o,s!==null)if(Mo(s.value,o)){if(s.children===i.children&&!Ci.current){e=yl(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=ll(-1,t&-t),l.tag=2;var A=s.updateQueue;if(A!==null){A=A.shared;var c=A.pending;c===null?l.next=l:(l.next=c.next,c.next=l),A.pending=l}}s.lanes|=t,l=s.alternate,l!==null&&(l.lanes|=t),bE(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(Pe(341));o.lanes|=t,a=o.alternate,a!==null&&(a.lanes|=t),bE(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}ii(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,rh(e,t),i=Gs(i),r=r(i),e.flags|=1,ii(n,e,r,t),e.child;case 14:return r=e.type,i=go(r,e.pendingProps),i=go(r.type,i),IR(n,e,r,i,t);case 15:return D4(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:go(r,i),ey(n,e),e.tag=1,Si(r)?(n=!0,Ky(e)):n=!1,rh(e,t),u4(e,r,i),EE(e,r,i,t),ME(null,e,r,!0,n,t);case 19:return H4(n,e,t);case 22:return O4(n,e,t)}throw Error(Pe(156,e.tag))};function rQ(n,e){return Tk(n,e)}function NK(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 Us(n,e,t,r){return new NK(n,e,t,r)}function EM(n){return n=n.prototype,!(!n||!n.isReactComponent)}function kK(n){if(typeof n=="function")return EM(n)?1:0;if(n!=null){if(n=n.$$typeof,n===VS)return 11;if(n===jS)return 14}return 2}function BA(n,e){var t=n.alternate;return t===null?(t=Us(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 ry(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")EM(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case If:return Fc(t.children,i,s,e);case GS:o=8,i|=8;break;case YB:return n=Us(12,t,e,i|2),n.elementType=YB,n.lanes=s,n;case XB:return n=Us(13,t,e,i),n.elementType=XB,n.lanes=s,n;case ZB:return n=Us(19,t,e,i),n.elementType=ZB,n.lanes=s,n;case fk:return Rx(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case ck:o=10;break e;case uk:o=9;break e;case VS:o=11;break e;case jS:o=14;break e;case Yl:o=16,r=null;break e}throw Error(Pe(130,n==null?n:typeof n,""))}return e=Us(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function Fc(n,e,t,r){return n=Us(7,n,r,e),n.lanes=t,n}function Rx(n,e,t,r){return n=Us(22,n,r,e),n.elementType=fk,n.lanes=t,n.stateNode={isHidden:!1},n}function E1(n,e,t){return n=Us(6,n,null,e),n.lanes=t,n}function C1(n,e,t){return e=Us(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function QK(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=o1(0),this.expirationTimes=o1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=o1(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function CM(n,e,t,r,i,s,o,a,l){return n=new QK(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Us(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},AM(s),n}function HK(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(aQ)}catch(n){console.error(n)}}aQ(),sk.exports=hs;var WK=sk.exports,VR=WK;KB.createRoot=VR.createRoot,KB.hydrateRoot=VR.hydrateRoot;const KK="/CharacterStudio/assets/cc_bgm_balanced-f542698c.wav",Ys=ye.createContext(),$K=({children:n})=>{const[e,t]=ye.useState(!1),r=Y.useRef(null),i=()=>{t(!1);const o=r.current;o.src=KK,o.loop=!0,o.volume=0,o.play();let a=0;const l=5,A=setInterval(()=>{a=Math.max(a+1/(10*l*60),1),a>=1&&clearInterval(A),o.volume=a},1e3/60)},s=()=>{t(!0),r.current.pause()};return k.jsxs(Ys.Provider,{value:{isMute:e,setMute:t,enableAudio:i,disableAudio:s},children:[k.jsx("audio",{ref:r}),n]})},YK=ye.createContext(),XK=n=>{const[e,t]=ye.useState(null),[r,i]=ye.useState(null),[s,o]=ye.useState(!1),[a,l]=ye.useState([]);return k.jsx(YK.Provider,{value:{walletAddress:e,setWalletAddress:t,ensName:r,setEnsName:i,connected:s,setConnected:o,OTTokens:a,setOTTokens:l},children:n.children})};function Ya(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function lQ(n,e){n.prototype=Object.create(e.prototype),n.prototype.constructor=n,n.__proto__=e}/*! * GSAP 3.11.4 * https://greensock.com * @@ -52,7 +52,7 @@ Error generating stack: `+s.message+` * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com -*/var rs={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Sh={duration:.5,overwrite:!1,delay:0},IM,$r,tr,Us=1e8,rn=1/Us,QE=Math.PI*2,ZK=QE/4,JK=0,AQ=Math.sqrt,qK=Math.cos,e$=Math.sin,Er=function(e){return typeof e=="string"},Nn=function(e){return typeof e=="function"},yl=function(e){return typeof e=="number"},RM=function(e){return typeof e>"u"},pa=function(e){return typeof e=="object"},Ti=function(e){return e!==!1},cQ=function(){return typeof window<"u"},u0=function(e){return Nn(e)||Er(e)},uQ=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Yr=Array.isArray,HE=/(?:-?\.?\d|\.)+/gi,fQ=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Qf=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,S1=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,hQ=/[+-]=-?[.\d]+/,dQ=/[^,'"\[\]\s]+/gi,t$=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Sn,_s,zE,FM,os={},ow={},pQ,mQ=function(e){return(ow=Wc(e,os))&&as},UM=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},aw=function(e,t){return!t&&console.warn(e)},gQ=function(e,t){return e&&(os[e]=t)&&ow&&(ow[e]=t)||os},Rm=function(){return 0},n$={suppressEvents:!0,isStart:!0,kill:!1},ry={suppressEvents:!0,kill:!1},r$={suppressEvents:!0},LM={},BA=[],GE={},vQ,$i={},M1={},jR=30,iy=[],PM="",DM=function(e){var t=e[0],r,i;if(pa(t)||Nn(t)||(e=[e]),!(r=(t._gsap||{}).harness)){for(i=iy.length;i--&&!iy[i].targetTest(t););r=iy[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new QQ(e[i],r)))||e.splice(i,1);return e},Fc=function(e){return e._gsap||DM(Ls(e))[0]._gsap},yQ=function(e,t,r){return(r=e[t])&&Nn(r)?e[t]():RM(r)&&e.getAttribute&&e.getAttribute(t)||r},Ii=function(e,t){return(e=e.split(",")).forEach(t)||e},Kn=function(e){return Math.round(e*1e5)/1e5||0},Rr=function(e){return Math.round(e*1e7)/1e7||0},ih=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},i$=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},Px=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},LA=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove(e),e._act=0},Uc=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},a$=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},VE=function(e,t,r,i){return e._startAt&&($r?e._startAt.revert(ry):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},l$=function n(e){return!e||e._ts&&n(e.parent)},KR=function(e){return e._repeat?Mh(e._tTime,e=e.duration()+e._rDelay)*e:0},Mh=function(e,t){var r=Math.floor(e/=t);return e&&r===e?r-1:r},cw=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},Dx=function(e){return e._end=Rr(e._start+(e._tDur/Math.abs(e._ts||e._rts||rn)||0))},Ox=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=Rr(r._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),Dx(e),r._dirty||Uc(r,e)),e},BQ=function(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=cw(e.rawTime(),t),(!t._dur||pg(0,t.totalDuration(),r)-t._tTime>rn)&&t.render(r,!0)),Uc(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&r.totalTime(r._tTime),r=r._dp;e._zTime=-rn}},Yo=function(e,t,r,i){return t.parent&&LA(t),t._start=Rr((yl(r)?r:r||e!==Sn?xs(e,r,t):e._time)+t._delay),t._end=Rr(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),bQ(e,t,"_first","_last",e._sort?"_start":0),jE(t)||(e._recent=t),i||BQ(e,t),e._ts<0&&Ox(e,e._tTime),e},EQ=function(e,t){return(os.ScrollTrigger||UM("scrollTrigger",t))&&os.ScrollTrigger.create(t,e)},CQ=function(e,t,r,i,s){if(NM(e,t,s),!e._initted)return 1;if(!r&&e._pt&&!$r&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&vQ!==Yi.frame)return BA.push(e),e._lazy=[s,i],1},A$=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},jE=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},c$=function(e,t,r,i){var s=e.ratio,o=t<0||!t&&(!e._start&&A$(e)&&!(!e._initted&&jE(e))||(e._ts<0||e._dp._ts<0)&&!jE(e))?0:1,a=e._rDelay,l=0,A,c,u;if(a&&e._repeat&&(l=pg(0,e._tDur,t),c=Mh(l,a),e._yoyo&&c&1&&(o=1-o),c!==Mh(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||$r||i||e._zTime===rn||!t&&e._zTime){if(!e._initted&&CQ(e,t,i,r,l))return;for(u=e._zTime,e._zTime=t||(r?rn:0),r||(r=t&&!u),e.ratio=o,e._from&&(o=1-o),e._time=0,e._tTime=l,A=e._pt;A;)A.r(o,A.d),A=A._next;t<0&&VE(e,t,r,!0),e._onUpdate&&!r&&Ps(e,"onUpdate"),l&&e._repeat&&!r&&e.parent&&Ps(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&LA(e,1),!r&&!$r&&(Ps(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},u$=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&&Ox(e,e._tTime=e._tDur*a),e.parent&&Dx(e),r||Uc(e.parent,e),e},$R=function(e){return e instanceof bi?Uc(e):Th(e,e._dur)},f$={_start:0,endTime:Rm,totalDuration:Rm},xs=function n(e,t,r){var i=e.labels,s=e._recent||f$,o=e.duration()>=Us?s.endTime(!1):e._dur,a,l,A;return Er(t)&&(isNaN(t)||t in i)?(l=t.charAt(0),A=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)*(A?(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)),A&&r&&(l=l/100*(Yr(r)?r[0]:r).totalDuration()),a>1?n(e,t.substr(0,a-1),r)+l:o+l)):t==null?o:+t},Zp=function(e,t,r){var i=yl(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=Ti(l.vars.inherit)&&l.parent;o.immediateRender=Ti(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new fr(t[0],o,t[s+1])},$A=function(e,t){return e||e===0?t(e):t},pg=function(e,t,r){return rt?t:r},Wr=function(e,t){return!Er(e)||!(t=t$.exec(e))?"":t[1]},h$=function(e,t,r){return $A(r,function(i){return pg(e,t,i)})},WE=[].slice,SQ=function(e,t){return e&&pa(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&pa(e[0]))&&!e.nodeType&&e!==_s},d$=function(e,t,r){return r===void 0&&(r=[]),e.forEach(function(i){var s;return Er(i)&&!t||SQ(i,1)?(s=r).push.apply(s,Ls(i)):r.push(i)})||r},Ls=function(e,t,r){return tr&&!t&&tr.selector?tr.selector(e):Er(e)&&!r&&(zE||!Ih())?WE.call((t||FM).querySelectorAll(e),0):Yr(e)?d$(e,r):SQ(e)?WE.call(e,0):e?[e]:[]},KE=function(e){return e=Ls(e)[0]||aw("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Ls(t,r.querySelectorAll?r:r===e?aw("Invalid scope")||FM.createElement("div"):e)}},MQ=function(e){return e.sort(function(){return .5-Math.random()})},TQ=function(e){if(Nn(e))return e;var t=pa(e)?e:{each:e},r=Lc(t.ease),i=t.from||0,s=parseFloat(t.base)||0,o={},a=i>0&&i<1,l=isNaN(i)||a,A=t.axis,c=i,u=i;return Er(i)?c=u={center:.5,edges:.5,end:1}[i]||0:!a&&l&&(c=i[0],u=i[1]),function(f,h,p){var d=(p||t).length,g=o[d],m,y,w,x,_,C,S,b,M;if(!g){if(M=t.grid==="auto"?0:(t.grid||[1,Us])[1],!M){for(S=-Us;S<(S=p[M++].getBoundingClientRect().left)&&MS&&(S=_),_d?d-1:A?A==="y"?d/M:M:Math.max(M,d/M))||0)*(i==="edges"?-1:1),g.b=d<0?s-d:s,g.u=Wr(t.amount||t.each)||0,r=r&&d<0?OQ(r):r}return d=(g[f]-g.min)/g.max||0,Rr(g.b+(r?r(d):d)*g.v)+g.u}},$E=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var i=Rr(Math.round(parseFloat(r)/e)*e*t);return(i-i%1)/t+(yl(r)?0:Wr(r))}},IQ=function(e,t){var r=Yr(e),i,s;return!r&&pa(e)&&(i=r=e.radius||Us,e.values?(e=Ls(e.values),(s=!yl(e[0]))&&(i*=i)):e=$E(e.increment)),$A(t,r?Nn(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),A=Us,c=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)})},Fm=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?dQ:HE),r+=e.substr(t,i-t)+RQ(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return r+e.substr(t,e.length-t)},UQ=function(e,t,r,i,s){var o=t-e,a=i-r;return $A(s,function(l){return r+((l-e)/o*a||0)})},w$=function n(e,t,r,i){var s=isNaN(e+t)?0:function(h){return(1-h)*e+h*t};if(!s){var o=Er(e),a={},l,A,c,u,f;if(r===!0&&(i=1)&&(r=null),o)e={p:e},t={p:t};else if(Yr(e)&&!Yr(t)){for(c=[],u=e.length,f=u-2,A=1;A(a=Math.abs(a))&&(l=o,s=a);return l},Ps=function(e,t,r){var i=e.vars,s=i[t],o=tr,a=e._ctx,l,A,c;if(s)return l=i[t+"Params"],A=i.callbackScope||e,r&&BA.length&&lw(),a&&(tr=a),c=l?s.apply(A,l):s.call(A),tr=o,c},wp=function(e){return LA(e),e.scrollTrigger&&e.scrollTrigger.kill(!!$r),e.progress()<1&&Ps(e,"onInterrupt"),e},Hf,x$=function(e){e=!e.name&&e.default||e;var t=e.name,r=Nn(e),i=t&&!r&&e.init?function(){this._props=[]}:e,s={init:Rm,render:HM,add:OM,kill:O$,modifier:D$,rawVars:0},o={targetTest:0,get:0,getSetter:QM,aliases:{},register:0};if(Ih(),e!==i){if($i[t])return;Vs(i,Vs(Aw(e,s),o)),Wc(i.prototype,Wc(s,Aw(e,o))),$i[i.prop=t]=i,e.targetTest&&(iy.push(i),LM[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}gQ(t,i),e.register&&e.register(as,i,Ri)},tn=255,xp={aqua:[0,tn,tn],lime:[0,tn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,tn],navy:[0,0,128],white:[tn,tn,tn],olive:[128,128,0],yellow:[tn,tn,0],orange:[tn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[tn,0,0],pink:[tn,192,203],cyan:[0,tn,tn],transparent:[tn,tn,tn,0]},T1=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)*tn+.5|0},LQ=function(e,t,r){var i=e?yl(e)?[e>>16,e>>8&tn,e&tn]:0:xp.black,s,o,a,l,A,c,u,f,h,p;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),xp[e])i=xp[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&tn,i&tn,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&tn,e&tn]}else if(e.substr(0,3)==="hsl"){if(i=p=e.match(HE),!t)l=+i[0]%360/360,A=+i[1]/100,c=+i[2]/100,o=c<=.5?c*(A+1):c+A-c*A,s=c*2-o,i.length>3&&(i[3]*=1),i[0]=T1(l+1/3,s,o),i[1]=T1(l,s,o),i[2]=T1(l-1/3,s,o);else if(~e.indexOf("="))return i=e.match(fQ),r&&i.length<4&&(i[3]=1),i}else i=e.match(HE)||xp.transparent;i=i.map(Number)}return t&&!p&&(s=i[0]/tn,o=i[1]/tn,a=i[2]/tn,u=Math.max(s,o,a),f=Math.min(s,o,a),c=(u+f)/2,u===f?l=A=0:(h=u-f,A=c>.5?h/(2-u-f):h/(u+f),l=u===s?(o-a)/h+(oe&&(r+=m-t),i+=m,_=i-r,w=_-o,(w>0||y)&&(C=++u.frame,f=_-u.time*1e3,u.time=_=_/1e3,o+=w+(w>=s?4:s-w),x=1),y||(l=A(d)),x)for(h=0;h=m&&h--},_listeners:a},u}(),Ih=function(){return!Um&&Yi.wake()},Ot={},b$=/^[\d.\-M][\d.\-,\s]/,B$=/["']/g,E$=function(e){for(var t={},r=e.substr(1,e.length-3).split(":"),i=r[0],s=1,o=r.length,a,l,A;s1&&r.config?r.config.apply(null,~e.indexOf("{")?[E$(t[1])]:C$(e).split(",").map(xQ)):Ot._CE&&b$.test(e)?Ot._CE("",e):r},OQ=function(e){return function(t){return 1-e(1-t)}},NQ=function n(e,t){for(var r=e._first,i;r;)r instanceof bi?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},Lc=function(e,t){return e&&(Nn(e)?e:Ot[e]||S$(e))||t},iu=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 Ii(e,function(a){Ot[a]=os[a]=s,Ot[o=a.toLowerCase()]=r;for(var l in s)Ot[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=Ot[a+"."+l]=s[l]}),s},kQ=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},I1=function n(e,t,r){var i=t>=1?t:1,s=(r||(e?.3:.45))/(t<1?t:1),o=s/QE*(Math.asin(1/i)||0),a=function(c){return c===1?1:i*Math.pow(2,-10*c)*e$((c-o)*s)+1},l=e==="out"?a:e==="in"?function(A){return 1-a(1-A)}:kQ(a);return s=QE/s,l.config=function(A,c){return n(e,A,c)},l},R1=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)}:kQ(r);return i.config=function(s){return n(e,s)},i};Ii("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;iu(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})});Ot.Linear.easeNone=Ot.none=Ot.Linear.easeIn;iu("Elastic",I1("in"),I1("out"),I1());(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,Th(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(r,i){if(Ih(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(Ox(this,r),!s._dp||s.parent||BQ(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)&&Yo(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===rn||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),wQ(this,r,i)),this},e.time=function(r,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+KR(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.ratio},e.progress=function(r,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-r:r)+KR(this),i):this.duration()?Math.min(1,this._time/this._dur):this.ratio},e.iteration=function(r,i){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(r-1)*s,i):this._repeat?Mh(this._tTime,s)+1:1},e.timeScale=function(r){if(!arguments.length)return this._rts===-rn?0:this._rts;if(this._rts===r)return this;var i=this.parent&&this._ts?cw(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-rn?0:this._rts,this.totalTime(pg(-this._delay,this._tDur,i),!0),Dx(this),a$(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):(Ih(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==rn&&(this._tTime-=rn)))),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)&&Yo(i,this,r-this._delay),this}return this._start},e.endTime=function(r){return this._start+(Ti(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?cw(i.rawTime(r),this):this._tTime:this._tTime},e.revert=function(r){r===void 0&&(r=r$);var i=$r;return $r=r,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),$r=i,this},e.globalTime=function(r){for(var i=this,s=arguments.length?r:i.rawTime();i;)s=i._start+s/(i._ts||1),i=i._dp;return!this.parent&&this._sat?this._sat.vars.immediateRender?-1:this._sat.globalTime(r):s},e.repeat=function(r){return arguments.length?(this._repeat=r===1/0?-2:r,$R(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(r){if(arguments.length){var i=this._time;return this._rDelay=r,$R(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(xs(this,r),Ti(i))},e.restart=function(r,i){return this.play().totalTime(r?-this._delay:0,Ti(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?-rn:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-rn,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=Nn(r)?r:_Q,a=function(){var A=i.then;i.then=null,Nn(o)&&(o=o(i))&&(o.then||o===i)&&(i.then=A),s(o),i.then=A};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?a():i._prom=a})},e.kill=function(){wp(this)},n}();Vs(Rh.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:-rn,_prom:0,_ps:!1,_rts:1});var bi=function(n){lQ(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=Ti(r.sortChildren),Sn&&Yo(r.parent||Sn,$a(s),i),r.reversed&&s.reverse(),r.paused&&s.paused(!0),r.scrollTrigger&&EQ($a(s),r.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,o){return Zp(0,arguments,this),this},t.from=function(i,s,o){return Zp(1,arguments,this),this},t.fromTo=function(i,s,o,a){return Zp(2,arguments,this),this},t.set=function(i,s,o){return s.duration=0,s.parent=this,Xp(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new fr(i,s,xs(this,o),1),this},t.call=function(i,s,o){return Yo(this,fr.delayedCall(0,i,s),o)},t.staggerTo=function(i,s,o,a,l,A,c){return o.duration=s,o.stagger=o.stagger||a,o.onComplete=A,o.onCompleteParams=c,o.parent=this,new fr(i,o,xs(this,l)),this},t.staggerFrom=function(i,s,o,a,l,A,c){return o.runBackwards=1,Xp(o).immediateRender=Ti(o.immediateRender),this.staggerTo(i,s,o,a,l,A,c)},t.staggerFromTo=function(i,s,o,a,l,A,c,u){return a.startAt=o,Xp(a).immediateRender=Ti(a.immediateRender),this.staggerTo(i,s,a,l,A,c,u)},t.render=function(i,s,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,A=this._dur,c=i<=0?0:Rr(i),u=this._zTime<0!=i<0&&(this._initted||!A),f,h,p,d,g,m,y,w,x,_,C,S;if(this!==Sn&&c>l&&i>=0&&(c=l),c!==this._tTime||o||u){if(a!==this._time&&A&&(c+=this._time-a,i+=this._time-a),f=c,x=this._start,w=this._ts,m=!w,u&&(A||(a=this._zTime),(i||!s)&&(this._zTime=i)),this._repeat){if(C=this._yoyo,g=A+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(g*100+i,s,o);if(f=Rr(c%g),c===l?(d=this._repeat,f=A):(d=~~(c/g),d&&d===c/g&&(f=A,d--),f>A&&(f=A)),_=Mh(this._tTime,g),!a&&this._tTime&&_!==d&&(_=d),C&&d&1&&(f=A-f,S=1),d!==_&&!this._lock){var b=C&&_&1,M=b===(C&&d&1);if(d<_&&(b=!b),a=b?0:A,this._lock=1,this.render(a||(S?0:Rr(d*g)),s,!A)._lock=0,this._tTime=c,!s&&this.parent&&Ps(this,"onRepeat"),this.vars.repeatRefresh&&!S&&(this.invalidate()._lock=1),a&&a!==this._time||m!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(A=this._dur,l=this._tDur,M&&(this._lock=2,a=b?A:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!S&&this.invalidate()),this._lock=0,!this._ts&&!m)return this;NQ(this,S)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(y=u$(this,Rr(a),Rr(f)),y&&(c-=f-(f=y._start))),this._tTime=c,this._time=f,this._act=!w,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=i,a=0),!a&&f&&!s&&(Ps(this,"onStart"),this._tTime!==c))return this;if(f>=a&&i>=0)for(h=this._first;h;){if(p=h._next,(h._act||f>=h._start)&&h._ts&&y!==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&&!m){y=0,p&&(c+=this._zTime=-rn);break}}h=p}else{h=this._last;for(var D=i<0?i:f;h;){if(p=h._prev,(h._act||D<=h._end)&&h._ts&&y!==h){if(h.parent!==this)return this.render(i,s,o);if(h.render(h._ts>0?(D-h._start)*h._ts:(h._dirty?h.totalDuration():h._tDur)+(D-h._start)*h._ts,s,o||$r&&(h._initted||h._startAt)),f!==this._time||!this._ts&&!m){y=0,p&&(c+=this._zTime=D?-rn:rn);break}}h=p}}if(y&&!s&&(this.pause(),y.render(f>=a?0:-rn)._zTime=f>=a?1:-1,this._ts))return this._start=x,Dx(this),this.render(i,s,o);this._onUpdate&&!s&&Ps(this,"onUpdate",!0),(c===l&&this._tTime>=this.totalDuration()||!c&&a)&&(x===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((i||!A)&&(c===l&&this._ts>0||!c&&this._ts<0)&&LA(this,1),!s&&!(i<0&&!a)&&(c||a||!l)&&(Ps(this,c===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c0)&&this._prom())))}return this},t.add=function(i,s){var o=this;if(yl(s)||(s=xs(this,s,i)),!(i instanceof Rh)){if(Yr(i))return i.forEach(function(a){return o.add(a,s)}),this;if(Er(i))return this.addLabel(i,s);if(Nn(i))i=fr.delayedCall(0,i);else return this}return this!==i?Yo(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=-Us);for(var l=[],A=this._first;A;)A._start>=a&&(A instanceof fr?s&&l.push(A):(o&&l.push(A),i&&l.push.apply(l,A.getChildren(!0,s,o)))),A=A._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 Er(i)?this.removeLabel(i):Nn(i)?this.killTweensOf(i):(Px(this,i),i===this._recent&&(this._recent=this._last),Uc(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Rr(Yi.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]=xs(this,s),this},t.removeLabel=function(i){return delete this.labels[i],this},t.addPause=function(i,s,o){var a=fr.delayedCall(0,s||Rm,o);return a.data="isPause",this._hasPause=1,Yo(this,a,xs(this,i))},t.removePause=function(i){var s=this._first;for(i=xs(this,i);s;)s._start===i&&s.data==="isPause"&&LA(s),s=s._next},t.killTweensOf=function(i,s,o){for(var a=this.getTweensOf(i,o),l=a.length;l--;)oA!==a[l]&&a[l].kill(i,s);return this},t.getTweensOf=function(i,s){for(var o=[],a=Ls(i),l=this._first,A=yl(s),c;l;)l instanceof fr?i$(l._targets,a)&&(A?(!oA||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&o.push(l):(c=l.getTweensOf(a,s)).length&&o.push.apply(o,c),l=l._next;return o},t.tweenTo=function(i,s){s=s||{};var o=this,a=xs(o,i),l=s,A=l.startAt,c=l.onStart,u=l.onStartParams,f=l.immediateRender,h,p=fr.to(o,Vs({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:s.duration||Math.abs((a-(A&&"time"in A?A.time:o._time))/o.timeScale())||rn,onStart:function(){if(o.pause(),!h){var g=s.duration||Math.abs((a-(A&&"time"in A?A.time:o._time))/o.timeScale());p._dur!==g&&Th(p,g,0,1).render(p._time,!0,!0),h=1}c&&c.apply(p,u||[])}},s));return f?p.render(0):p},t.tweenFromTo=function(i,s,o){return this.tweenTo(s,Vs({startAt:{time:xs(this,i)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),YR(this,xs(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),YR(this,xs(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+rn)},t.shiftChildren=function(i,s,o){o===void 0&&(o=0);for(var a=this._first,l=this.labels,A;a;)a._start>=o&&(a._start+=i,a._end+=i),a=a._next;if(s)for(A in l)l[A]>=o&&(l[A]+=i);return Uc(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={}),Uc(this)},t.totalDuration=function(i){var s=0,o=this,a=o._last,l=Us,A,c,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;)A=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,Yo(o,a,c-a._delay,1)._lock=0):l=c,c<0&&a._ts&&(s-=c,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=c/o._ts,o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),l=0),a._end>s&&a._ts&&(s=a._end),a=A;Th(o,o===Sn&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(i){if(Sn._ts&&(wQ(Sn,cw(i,Sn)),vQ=Yi.frame),Yi.frame>=jR){jR+=rs.autoSleep||120;var s=Sn._first;if((!s||!s._ts)&&rs.autoSleep&&Yi._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Yi.sleep()}}},e}(Rh);Vs(bi.prototype,{_lock:0,_hasPause:0,_forcing:0});var M$=function(e,t,r,i,s,o,a){var l=new Ri(this._pt,e,t,0,1,WQ,null,s),A=0,c=0,u,f,h,p,d,g,m,y;for(l.b=r,l.e=i,r+="",i+="",(m=~i.indexOf("random("))&&(i=Fm(i)),o&&(y=[r,i],o(y,e,t),r=y[0],i=y[1]),f=r.match(S1)||[];u=S1.exec(i);)p=u[0],d=i.substring(A,u.index),h?h=(h+1)%5:d.substr(-5)==="rgba("&&(h=1),p!==f[c++]&&(g=parseFloat(f[c-1])||0,l._pt={_next:l._pt,p:d||c===1?d:",",s:g,c:p.charAt(1)==="="?ih(g,p)-g:parseFloat(p)-g,m:h&&h<4?Math.round:0},A=S1.lastIndex);return l.c=A")}),x.duration();else{C={};for(b in p)b==="ease"||b==="easeEach"||F$(b,p[b],C,p.easeEach);for(b in C)for(I=C[b].sort(function(U,P){return U.t-P.t}),H=0,_=0;_l-rn&&!c?l:iA&&(f=A)),m=this._yoyo&&p&1,m&&(x=this._yEase,f=A-f),g=Mh(this._tTime,d),f===a&&!o&&this._initted)return this._tTime=u,this;p!==g&&(w&&this._yEase&&NQ(w,m),this.vars.repeatRefresh&&!m&&!this._lock&&(this._lock=o=1,this.render(Rr(d*p),!0).invalidate()._lock=0))}if(!this._initted){if(CQ(this,c?i:f,o,s,u))return this._tTime=0,this;if(a!==this._time)return this;if(A!==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=y=(x||this._ease)(f/A),this._from&&(this.ratio=y=1-y),f&&!a&&!s&&(Ps(this,"onStart"),this._tTime!==u))return this;for(h=this._pt;h;)h.r(y,h.d),h=h._next;w&&w.render(i<0?i:!f&&m?-rn:w._dur*w._ease(f/this._dur),s,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(c&&VE(this,i,s,o),Ps(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!s&&this.parent&&Ps(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&VE(this,i,!0,!0),(i||!A)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&LA(this,1),!s&&!(c&&!a)&&(u||a||m)&&(Ps(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){Um||Yi.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),A;return this._initted||NM(this,l),A=this._ease(l/this._dur),I$(this,i,s,o,a,A,l)?this.resetTo(i,s,o,a):(Ox(this,0),this.parent||bQ(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?wp(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,oA&&oA.vars.overwrite!==!0)._first||wp(this),this.parent&&o!==this.timeline.totalDuration()&&Th(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=i?Ls(i):a,A=this._ptLookup,c=this._pt,u,f,h,p,d,g,m;if((!s||s==="all")&&o$(a,l))return s==="all"&&(this._pt=0),wp(this);for(u=this._op=this._op||[],s!=="all"&&(Er(s)&&(d={},Ii(s,function(y){return d[y]=1}),s=d),s=R$(a,s)),m=a.length;m--;)if(~l.indexOf(a[m])){f=A[m],s==="all"?(u[m]=s,p=f,h={}):(h=u[m]=u[m]||{},p=s);for(d in p)g=f&&f[d],g&&((!("kill"in g.d)||g.d.kill(d)===!0)&&Px(this,g,"_pt"),delete f[d]),h!=="all"&&(h[d]=1)}return this._initted&&!this._pt&&c&&wp(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return Zp(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 Zp(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 Sn.killTweensOf(i,s,o)},e}(Rh);Vs(fr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});Ii("staggerTo,staggerFrom,staggerFromTo",function(n){fr[n]=function(){var e=new bi,t=WE.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var kM=function(e,t,r){return e[t]=r},VQ=function(e,t,r){return e[t](r)},U$=function(e,t,r,i){return e[t](i.fp,r)},L$=function(e,t,r){return e.setAttribute(t,r)},QM=function(e,t){return Nn(e[t])?VQ:RM(e[t])&&e.setAttribute?L$:kM},jQ=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},P$=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},WQ=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)},HM=function(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next},D$=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},O$=function(e){for(var t=this._pt,r,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?Px(this,t,"_pt"):t.dep||(r=1),t=i;return!r},N$=function(e,t,r,i){i.mSet(e,t,i.m.call(i.tween,r,i.mt),i)},KQ=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},Ri=function(){function n(t,r,i,s,o,a,l,A,c){this.t=r,this.s=s,this.c=o,this.p=i,this.r=a||jQ,this.d=l||this,this.set=A||kM,this.pr=c||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=N$,this.m=r,this.mt=s,this.tween=i},n}();Ii(PM+"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 LM[n]=1});os.TweenMax=os.TweenLite=fr;os.TimelineLite=os.TimelineMax=bi;Sn=new bi({sortChildren:!1,defaults:Sh,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});rs.stringFilter=DQ;var Fh=[],sy={},k$=[],ZR=0,F1=function(e){return(sy[e]||k$).map(function(t){return t()})},XE=function(){var e=Date.now(),t=[];e-ZR>2&&(F1("matchMediaInit"),Fh.forEach(function(r){var i=r.queries,s=r.conditions,o,a,l,A;for(a in i)o=_s.matchMedia(i[a]).matches,o&&(l=1),o!==s[a]&&(s[a]=o,A=1);A&&(r.revert(),l&&t.push(r))}),F1("matchMediaRevert"),t.forEach(function(r){return r.onMatch(r)}),ZR=e,F1("matchMedia"))},$Q=function(){function n(t,r){this.selector=r&&KE(r),this.data=[],this._r=[],this.isReverted=!1,t&&this.add(t)}var e=n.prototype;return e.add=function(r,i,s){Nn(r)&&(s=i,i=r,r=Nn);var o=this,a=function(){var A=tr,c=o.selector,u;return A&&A!==o&&A.data.push(o),s&&(o.selector=KE(s)),tr=o,u=i.apply(o,arguments),Nn(u)&&o._r.push(u),tr=A,o.selector=c,o.isReverted=!1,u};return o.last=a,r===Nn?a(o):r?o[r]=a:a},e.ignore=function(r){var i=tr;tr=null,r(this),tr=i},e.getTweens=function(){var r=[];return this.data.forEach(function(i){return i instanceof n?r.push.apply(r,i.getTweens()):i instanceof fr&&!(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){var o=this.getTweens();this.data.forEach(function(l){l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(A){return o.splice(o.indexOf(A),1)}))}),o.map(function(l){return{g:l.globalTime(0),t:l}}).sort(function(l,A){return A.g-l.g||-1}).forEach(function(l){return l.t.revert(r)}),this.data.forEach(function(l){return!(l instanceof Rh)&&l.revert&&l.revert(r)}),this._r.forEach(function(l){return l(r,s)}),this.isReverted=!0}else this.data.forEach(function(l){return l.kill&&l.kill()});if(this.clear(),i){var a=Fh.indexOf(this);~a&&Fh.splice(a,1)}},e.revert=function(r){this.kill(r||{})},n}(),Q$=function(){function n(t){this.contexts=[],this.scope=t}var e=n.prototype;return e.add=function(r,i,s){pa(r)||(r={matches:r});var o=new $Q(0,s||this.scope),a=o.conditions={},l,A,c;this.contexts.push(o),i=o.add("onMatch",i),o.queries=r;for(A in r)A==="all"?c=1:(l=_s.matchMedia(r[A]),l&&(Fh.indexOf(o)<0&&Fh.push(o),(a[A]=l.matches)&&(c=1),l.addListener?l.addListener(XE):l.addEventListener("change",XE)));return c&&i(o),this},e.revert=function(r){this.kill(r||{})},e.kill=function(r){this.contexts.forEach(function(i){return i.kill(r,!0)})},n}(),uw={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r1){var i=e.map(function(c){return as.quickSetter(c,t,r)}),s=i.length;return function(c){for(var u=s;u--;)i[u](c)}}e=e[0]||{};var o=$i[t],a=Fc(e),l=a.harness&&(a.harness.aliases||{})[t]||t,A=o?function(c){var u=new o;Hf._pt=0,u.init(e,r?c+r:c,Hf,0,[e]),u.render(1,u),Hf._pt&&HM(1,Hf)}:a.set(e,l);return o?A:function(c){return A(e,l,r?c+r:c,a,1)}},quickTo:function(e,t,r){var i,s=as.to(e,Wc((i={},i[t]="+=0.1",i.paused=!0,i),r||{})),o=function(l,A,c){return s.resetTo(t,l,A,c)};return o.tween=s,o},isTweening:function(e){return Sn.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=Lc(e.ease,Sh.ease)),WR(Sh,e||{})},config:function(e){return WR(rs,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&&!$i[a]&&!os[a]&&aw(t+" effect requires "+a+" plugin.")}),M1[t]=function(a,l,A){return r(Ls(a),Vs(l||{},s),A)},o&&(bi.prototype[t]=function(a,l,A){return this.add(M1[t](a,pa(l)?l:(A=l)&&{},this),A)})},registerEase:function(e,t){Ot[e]=Lc(t)},parseEase:function(e,t){return arguments.length?Lc(e,t):Ot},getById:function(e){return Sn.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var r=new bi(e),i,s;for(r.smoothChildTiming=Ti(e.smoothChildTiming),Sn.remove(r),r._dp=0,r._time=r._tTime=Sn._time,i=Sn._first;i;)s=i._next,(t||!(!i._dur&&i instanceof fr&&i.vars.onComplete===i._targets[0]))&&Yo(r,i,i._start-i._delay),i=s;return Yo(Sn,r,0),r},context:function(e,t){return e?new $Q(e,t):tr},matchMedia:function(e){return new Q$(e)},matchMediaRefresh:function(){return Fh.forEach(function(e){var t=e.conditions,r,i;for(i in t)t[i]&&(t[i]=!1,r=1);r&&e.revert()})||XE()},addEventListener:function(e,t){var r=sy[e]||(sy[e]=[]);~r.indexOf(t)||r.push(t)},removeEventListener:function(e,t){var r=sy[e],i=r&&r.indexOf(t);i>=0&&r.splice(i,1)},utils:{wrap:v$,wrapYoyo:y$,distribute:TQ,random:RQ,snap:IQ,normalize:g$,getUnit:Wr,clamp:h$,splitColor:LQ,toArray:Ls,selector:KE,mapRange:UQ,pipe:p$,unitize:m$,interpolate:w$,shuffle:MQ},install:mQ,effects:M1,ticker:Yi,updateRoot:bi.updateRoot,plugins:$i,globalTimeline:Sn,core:{PropTween:Ri,globals:gQ,Tween:fr,Timeline:bi,Animation:Rh,getCache:Fc,_removeLinkedListItem:Px,reverting:function(){return $r},context:function(e){return e&&tr&&(tr.data.push(e),e._ctx=tr),tr},suppressOverwrites:function(e){return IM=e}}};Ii("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return uw[n]=fr[n]});Yi.add(bi.updateRoot);Hf=uw.to({},{duration:0});var H$=function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r},z$=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=H$(o,i)),o&&o.modifier&&o.modifier(t[i],e,r[s],i))},U1=function(e,t){return{name:e,rawVars:1,init:function(i,s,o){o._onInit=function(a){var l,A;if(Er(s)&&(l={},Ii(s,function(c){return l[c]=1}),s=l),t){l={};for(A in s)l[A]=t(s[A]);s=l}z$(a,s)}}}},as=uw.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;)$r?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)}},U1("roundProps",$E),U1("modifiers"),U1("snap",IQ))||uw;fr.version=bi.version=as.version="3.11.4";pQ=1;cQ()&&Ih();Ot.Power0;Ot.Power1;Ot.Power2;Ot.Power3;Ot.Power4;Ot.Linear;Ot.Quad;Ot.Cubic;Ot.Quart;Ot.Quint;Ot.Strong;Ot.Elastic;Ot.Back;Ot.SteppedEase;Ot.Bounce;Ot.Sine;Ot.Expo;Ot.Circ;/*! +*/var rs={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Mh={duration:.5,overwrite:!1,delay:0},IM,$r,tr,Ls=1e8,rn=1/Ls,QE=Math.PI*2,ZK=QE/4,JK=0,AQ=Math.sqrt,qK=Math.cos,e$=Math.sin,Cr=function(e){return typeof e=="string"},Nn=function(e){return typeof e=="function"},wl=function(e){return typeof e=="number"},RM=function(e){return typeof e>"u"},ma=function(e){return typeof e=="object"},Ti=function(e){return e!==!1},cQ=function(){return typeof window<"u"},f0=function(e){return Nn(e)||Cr(e)},uQ=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Yr=Array.isArray,HE=/(?:-?\.?\d|\.)+/gi,fQ=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,Hf=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,S1=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,hQ=/[+-]=-?[.\d]+/,dQ=/[^,'"\[\]\s]+/gi,t$=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,Sn,bs,zE,FM,os={},aw={},pQ,mQ=function(e){return(aw=Kc(e,os))&&as},UM=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},lw=function(e,t){return!t&&console.warn(e)},gQ=function(e,t){return e&&(os[e]=t)&&aw&&(aw[e]=t)||os},Fm=function(){return 0},n$={suppressEvents:!0,isStart:!0,kill:!1},iy={suppressEvents:!0,kill:!1},r$={suppressEvents:!0},LM={},EA=[],GE={},vQ,$i={},M1={},jR=30,sy=[],PM="",DM=function(e){var t=e[0],r,i;if(ma(t)||Nn(t)||(e=[e]),!(r=(t._gsap||{}).harness)){for(i=sy.length;i--&&!sy[i].targetTest(t););r=sy[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new QQ(e[i],r)))||e.splice(i,1);return e},Uc=function(e){return e._gsap||DM(Ps(e))[0]._gsap},yQ=function(e,t,r){return(r=e[t])&&Nn(r)?e[t]():RM(r)&&e.getAttribute&&e.getAttribute(t)||r},Ii=function(e,t){return(e=e.split(",")).forEach(t)||e},Kn=function(e){return Math.round(e*1e5)/1e5||0},Fr=function(e){return Math.round(e*1e7)/1e7||0},sh=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},i$=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},Dx=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),e._act=0},Lc=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},a$=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},VE=function(e,t,r,i){return e._startAt&&($r?e._startAt.revert(iy):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},l$=function n(e){return!e||e._ts&&n(e.parent)},KR=function(e){return e._repeat?Th(e._tTime,e=e.duration()+e._rDelay)*e:0},Th=function(e,t){var r=Math.floor(e/=t);return e&&r===e?r-1:r},uw=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},Ox=function(e){return e._end=Fr(e._start+(e._tDur/Math.abs(e._ts||e._rts||rn)||0))},Nx=function(e,t){var r=e._dp;return r&&r.smoothChildTiming&&e._ts&&(e._start=Fr(r._time-(e._ts>0?t/e._ts:((e._dirty?e.totalDuration():e._tDur)-t)/-e._ts)),Ox(e),r._dirty||Lc(r,e)),e},BQ=function(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=uw(e.rawTime(),t),(!t._dur||mg(0,t.totalDuration(),r)-t._tTime>rn)&&t.render(r,!0)),Lc(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&r.totalTime(r._tTime),r=r._dp;e._zTime=-rn}},Xo=function(e,t,r,i){return t.parent&&PA(t),t._start=Fr((wl(r)?r:r||e!==Sn?_s(e,r,t):e._time)+t._delay),t._end=Fr(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),bQ(e,t,"_first","_last",e._sort?"_start":0),jE(t)||(e._recent=t),i||BQ(e,t),e._ts<0&&Nx(e,e._tTime),e},EQ=function(e,t){return(os.ScrollTrigger||UM("scrollTrigger",t))&&os.ScrollTrigger.create(t,e)},CQ=function(e,t,r,i,s){if(NM(e,t,s),!e._initted)return 1;if(!r&&e._pt&&!$r&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&vQ!==Yi.frame)return EA.push(e),e._lazy=[s,i],1},A$=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},jE=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},c$=function(e,t,r,i){var s=e.ratio,o=t<0||!t&&(!e._start&&A$(e)&&!(!e._initted&&jE(e))||(e._ts<0||e._dp._ts<0)&&!jE(e))?0:1,a=e._rDelay,l=0,A,c,u;if(a&&e._repeat&&(l=mg(0,e._tDur,t),c=Th(l,a),e._yoyo&&c&1&&(o=1-o),c!==Th(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||$r||i||e._zTime===rn||!t&&e._zTime){if(!e._initted&&CQ(e,t,i,r,l))return;for(u=e._zTime,e._zTime=t||(r?rn:0),r||(r=t&&!u),e.ratio=o,e._from&&(o=1-o),e._time=0,e._tTime=l,A=e._pt;A;)A.r(o,A.d),A=A._next;t<0&&VE(e,t,r,!0),e._onUpdate&&!r&&Ds(e,"onUpdate"),l&&e._repeat&&!r&&e.parent&&Ds(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&PA(e,1),!r&&!$r&&(Ds(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},u$=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&&Nx(e,e._tTime=e._tDur*a),e.parent&&Ox(e),r||Lc(e.parent,e),e},$R=function(e){return e instanceof bi?Lc(e):Ih(e,e._dur)},f$={_start:0,endTime:Fm,totalDuration:Fm},_s=function n(e,t,r){var i=e.labels,s=e._recent||f$,o=e.duration()>=Ls?s.endTime(!1):e._dur,a,l,A;return Cr(t)&&(isNaN(t)||t in i)?(l=t.charAt(0),A=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)*(A?(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)),A&&r&&(l=l/100*(Yr(r)?r[0]:r).totalDuration()),a>1?n(e,t.substr(0,a-1),r)+l:o+l)):t==null?o:+t},Jp=function(e,t,r){var i=wl(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=Ti(l.vars.inherit)&&l.parent;o.immediateRender=Ti(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new fr(t[0],o,t[s+1])},YA=function(e,t){return e||e===0?t(e):t},mg=function(e,t,r){return rt?t:r},Wr=function(e,t){return!Cr(e)||!(t=t$.exec(e))?"":t[1]},h$=function(e,t,r){return YA(r,function(i){return mg(e,t,i)})},WE=[].slice,SQ=function(e,t){return e&&ma(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&ma(e[0]))&&!e.nodeType&&e!==bs},d$=function(e,t,r){return r===void 0&&(r=[]),e.forEach(function(i){var s;return Cr(i)&&!t||SQ(i,1)?(s=r).push.apply(s,Ps(i)):r.push(i)})||r},Ps=function(e,t,r){return tr&&!t&&tr.selector?tr.selector(e):Cr(e)&&!r&&(zE||!Rh())?WE.call((t||FM).querySelectorAll(e),0):Yr(e)?d$(e,r):SQ(e)?WE.call(e,0):e?[e]:[]},KE=function(e){return e=Ps(e)[0]||lw("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Ps(t,r.querySelectorAll?r:r===e?lw("Invalid scope")||FM.createElement("div"):e)}},MQ=function(e){return e.sort(function(){return .5-Math.random()})},TQ=function(e){if(Nn(e))return e;var t=ma(e)?e:{each:e},r=Pc(t.ease),i=t.from||0,s=parseFloat(t.base)||0,o={},a=i>0&&i<1,l=isNaN(i)||a,A=t.axis,c=i,u=i;return Cr(i)?c=u={center:.5,edges:.5,end:1}[i]||0:!a&&l&&(c=i[0],u=i[1]),function(f,h,p){var d=(p||t).length,g=o[d],m,y,w,x,_,C,S,b,M;if(!g){if(M=t.grid==="auto"?0:(t.grid||[1,Ls])[1],!M){for(S=-Ls;S<(S=p[M++].getBoundingClientRect().left)&&MS&&(S=_),_d?d-1:A?A==="y"?d/M:M:Math.max(M,d/M))||0)*(i==="edges"?-1:1),g.b=d<0?s-d:s,g.u=Wr(t.amount||t.each)||0,r=r&&d<0?OQ(r):r}return d=(g[f]-g.min)/g.max||0,Fr(g.b+(r?r(d):d)*g.v)+g.u}},$E=function(e){var t=Math.pow(10,((e+"").split(".")[1]||"").length);return function(r){var i=Fr(Math.round(parseFloat(r)/e)*e*t);return(i-i%1)/t+(wl(r)?0:Wr(r))}},IQ=function(e,t){var r=Yr(e),i,s;return!r&&ma(e)&&(i=r=e.radius||Ls,e.values?(e=Ps(e.values),(s=!wl(e[0]))&&(i*=i)):e=$E(e.increment)),YA(t,r?Nn(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),A=Ls,c=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)})},Um=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?dQ:HE),r+=e.substr(t,i-t)+RQ(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return r+e.substr(t,e.length-t)},UQ=function(e,t,r,i,s){var o=t-e,a=i-r;return YA(s,function(l){return r+((l-e)/o*a||0)})},w$=function n(e,t,r,i){var s=isNaN(e+t)?0:function(h){return(1-h)*e+h*t};if(!s){var o=Cr(e),a={},l,A,c,u,f;if(r===!0&&(i=1)&&(r=null),o)e={p:e},t={p:t};else if(Yr(e)&&!Yr(t)){for(c=[],u=e.length,f=u-2,A=1;A(a=Math.abs(a))&&(l=o,s=a);return l},Ds=function(e,t,r){var i=e.vars,s=i[t],o=tr,a=e._ctx,l,A,c;if(s)return l=i[t+"Params"],A=i.callbackScope||e,r&&EA.length&&Aw(),a&&(tr=a),c=l?s.apply(A,l):s.call(A),tr=o,c},xp=function(e){return PA(e),e.scrollTrigger&&e.scrollTrigger.kill(!!$r),e.progress()<1&&Ds(e,"onInterrupt"),e},zf,x$=function(e){e=!e.name&&e.default||e;var t=e.name,r=Nn(e),i=t&&!r&&e.init?function(){this._props=[]}:e,s={init:Fm,render:HM,add:OM,kill:O$,modifier:D$,rawVars:0},o={targetTest:0,get:0,getSetter:QM,aliases:{},register:0};if(Rh(),e!==i){if($i[t])return;js(i,js(cw(e,s),o)),Kc(i.prototype,Kc(s,cw(e,o))),$i[i.prop=t]=i,e.targetTest&&(sy.push(i),LM[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}gQ(t,i),e.register&&e.register(as,i,Ri)},tn=255,_p={aqua:[0,tn,tn],lime:[0,tn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,tn],navy:[0,0,128],white:[tn,tn,tn],olive:[128,128,0],yellow:[tn,tn,0],orange:[tn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[tn,0,0],pink:[tn,192,203],cyan:[0,tn,tn],transparent:[tn,tn,tn,0]},T1=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)*tn+.5|0},LQ=function(e,t,r){var i=e?wl(e)?[e>>16,e>>8&tn,e&tn]:0:_p.black,s,o,a,l,A,c,u,f,h,p;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),_p[e])i=_p[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&tn,i&tn,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&tn,e&tn]}else if(e.substr(0,3)==="hsl"){if(i=p=e.match(HE),!t)l=+i[0]%360/360,A=+i[1]/100,c=+i[2]/100,o=c<=.5?c*(A+1):c+A-c*A,s=c*2-o,i.length>3&&(i[3]*=1),i[0]=T1(l+1/3,s,o),i[1]=T1(l,s,o),i[2]=T1(l-1/3,s,o);else if(~e.indexOf("="))return i=e.match(fQ),r&&i.length<4&&(i[3]=1),i}else i=e.match(HE)||_p.transparent;i=i.map(Number)}return t&&!p&&(s=i[0]/tn,o=i[1]/tn,a=i[2]/tn,u=Math.max(s,o,a),f=Math.min(s,o,a),c=(u+f)/2,u===f?l=A=0:(h=u-f,A=c>.5?h/(2-u-f):h/(u+f),l=u===s?(o-a)/h+(oe&&(r+=m-t),i+=m,_=i-r,w=_-o,(w>0||y)&&(C=++u.frame,f=_-u.time*1e3,u.time=_=_/1e3,o+=w+(w>=s?4:s-w),x=1),y||(l=A(d)),x)for(h=0;h=m&&h--},_listeners:a},u}(),Rh=function(){return!Lm&&Yi.wake()},Ot={},b$=/^[\d.\-M][\d.\-,\s]/,B$=/["']/g,E$=function(e){for(var t={},r=e.substr(1,e.length-3).split(":"),i=r[0],s=1,o=r.length,a,l,A;s1&&r.config?r.config.apply(null,~e.indexOf("{")?[E$(t[1])]:C$(e).split(",").map(xQ)):Ot._CE&&b$.test(e)?Ot._CE("",e):r},OQ=function(e){return function(t){return 1-e(1-t)}},NQ=function n(e,t){for(var r=e._first,i;r;)r instanceof bi?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},Pc=function(e,t){return e&&(Nn(e)?e:Ot[e]||S$(e))||t},su=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 Ii(e,function(a){Ot[a]=os[a]=s,Ot[o=a.toLowerCase()]=r;for(var l in s)Ot[o+(l==="easeIn"?".in":l==="easeOut"?".out":".inOut")]=Ot[a+"."+l]=s[l]}),s},kQ=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},I1=function n(e,t,r){var i=t>=1?t:1,s=(r||(e?.3:.45))/(t<1?t:1),o=s/QE*(Math.asin(1/i)||0),a=function(c){return c===1?1:i*Math.pow(2,-10*c)*e$((c-o)*s)+1},l=e==="out"?a:e==="in"?function(A){return 1-a(1-A)}:kQ(a);return s=QE/s,l.config=function(A,c){return n(e,A,c)},l},R1=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)}:kQ(r);return i.config=function(s){return n(e,s)},i};Ii("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;su(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})});Ot.Linear.easeNone=Ot.none=Ot.Linear.easeIn;su("Elastic",I1("in"),I1("out"),I1());(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,Ih(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(r,i){if(Rh(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(Nx(this,r),!s._dp||s.parent||BQ(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)&&Xo(this._dp,this,this._start-this._delay)}return(this._tTime!==r||!this._dur&&!i||this._initted&&Math.abs(this._zTime)===rn||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),wQ(this,r,i)),this},e.time=function(r,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+KR(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.ratio},e.progress=function(r,i){return arguments.length?this.totalTime(this.duration()*(this._yoyo&&!(this.iteration()&1)?1-r:r)+KR(this),i):this.duration()?Math.min(1,this._time/this._dur):this.ratio},e.iteration=function(r,i){var s=this.duration()+this._rDelay;return arguments.length?this.totalTime(this._time+(r-1)*s,i):this._repeat?Th(this._tTime,s)+1:1},e.timeScale=function(r){if(!arguments.length)return this._rts===-rn?0:this._rts;if(this._rts===r)return this;var i=this.parent&&this._ts?uw(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-rn?0:this._rts,this.totalTime(mg(-this._delay,this._tDur,i),!0),Ox(this),a$(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):(Rh(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==rn&&(this._tTime-=rn)))),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)&&Xo(i,this,r-this._delay),this}return this._start},e.endTime=function(r){return this._start+(Ti(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?uw(i.rawTime(r),this):this._tTime:this._tTime},e.revert=function(r){r===void 0&&(r=r$);var i=$r;return $r=r,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),$r=i,this},e.globalTime=function(r){for(var i=this,s=arguments.length?r:i.rawTime();i;)s=i._start+s/(i._ts||1),i=i._dp;return!this.parent&&this._sat?this._sat.vars.immediateRender?-1:this._sat.globalTime(r):s},e.repeat=function(r){return arguments.length?(this._repeat=r===1/0?-2:r,$R(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(r){if(arguments.length){var i=this._time;return this._rDelay=r,$R(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(_s(this,r),Ti(i))},e.restart=function(r,i){return this.play().totalTime(r?-this._delay:0,Ti(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?-rn:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-rn,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=Nn(r)?r:_Q,a=function(){var A=i.then;i.then=null,Nn(o)&&(o=o(i))&&(o.then||o===i)&&(i.then=A),s(o),i.then=A};i._initted&&i.totalProgress()===1&&i._ts>=0||!i._tTime&&i._ts<0?a():i._prom=a})},e.kill=function(){xp(this)},n}();js(Fh.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:-rn,_prom:0,_ps:!1,_rts:1});var bi=function(n){lQ(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=Ti(r.sortChildren),Sn&&Xo(r.parent||Sn,Ya(s),i),r.reversed&&s.reverse(),r.paused&&s.paused(!0),r.scrollTrigger&&EQ(Ya(s),r.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,o){return Jp(0,arguments,this),this},t.from=function(i,s,o){return Jp(1,arguments,this),this},t.fromTo=function(i,s,o,a){return Jp(2,arguments,this),this},t.set=function(i,s,o){return s.duration=0,s.parent=this,Zp(s).repeatDelay||(s.repeat=0),s.immediateRender=!!s.immediateRender,new fr(i,s,_s(this,o),1),this},t.call=function(i,s,o){return Xo(this,fr.delayedCall(0,i,s),o)},t.staggerTo=function(i,s,o,a,l,A,c){return o.duration=s,o.stagger=o.stagger||a,o.onComplete=A,o.onCompleteParams=c,o.parent=this,new fr(i,o,_s(this,l)),this},t.staggerFrom=function(i,s,o,a,l,A,c){return o.runBackwards=1,Zp(o).immediateRender=Ti(o.immediateRender),this.staggerTo(i,s,o,a,l,A,c)},t.staggerFromTo=function(i,s,o,a,l,A,c,u){return a.startAt=o,Zp(a).immediateRender=Ti(a.immediateRender),this.staggerTo(i,s,a,l,A,c,u)},t.render=function(i,s,o){var a=this._time,l=this._dirty?this.totalDuration():this._tDur,A=this._dur,c=i<=0?0:Fr(i),u=this._zTime<0!=i<0&&(this._initted||!A),f,h,p,d,g,m,y,w,x,_,C,S;if(this!==Sn&&c>l&&i>=0&&(c=l),c!==this._tTime||o||u){if(a!==this._time&&A&&(c+=this._time-a,i+=this._time-a),f=c,x=this._start,w=this._ts,m=!w,u&&(A||(a=this._zTime),(i||!s)&&(this._zTime=i)),this._repeat){if(C=this._yoyo,g=A+this._rDelay,this._repeat<-1&&i<0)return this.totalTime(g*100+i,s,o);if(f=Fr(c%g),c===l?(d=this._repeat,f=A):(d=~~(c/g),d&&d===c/g&&(f=A,d--),f>A&&(f=A)),_=Th(this._tTime,g),!a&&this._tTime&&_!==d&&(_=d),C&&d&1&&(f=A-f,S=1),d!==_&&!this._lock){var b=C&&_&1,M=b===(C&&d&1);if(d<_&&(b=!b),a=b?0:A,this._lock=1,this.render(a||(S?0:Fr(d*g)),s,!A)._lock=0,this._tTime=c,!s&&this.parent&&Ds(this,"onRepeat"),this.vars.repeatRefresh&&!S&&(this.invalidate()._lock=1),a&&a!==this._time||m!==!this._ts||this.vars.onRepeat&&!this.parent&&!this._act)return this;if(A=this._dur,l=this._tDur,M&&(this._lock=2,a=b?A:-1e-4,this.render(a,!0),this.vars.repeatRefresh&&!S&&this.invalidate()),this._lock=0,!this._ts&&!m)return this;NQ(this,S)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(y=u$(this,Fr(a),Fr(f)),y&&(c-=f-(f=y._start))),this._tTime=c,this._time=f,this._act=!w,this._initted||(this._onUpdate=this.vars.onUpdate,this._initted=1,this._zTime=i,a=0),!a&&f&&!s&&(Ds(this,"onStart"),this._tTime!==c))return this;if(f>=a&&i>=0)for(h=this._first;h;){if(p=h._next,(h._act||f>=h._start)&&h._ts&&y!==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&&!m){y=0,p&&(c+=this._zTime=-rn);break}}h=p}else{h=this._last;for(var D=i<0?i:f;h;){if(p=h._prev,(h._act||D<=h._end)&&h._ts&&y!==h){if(h.parent!==this)return this.render(i,s,o);if(h.render(h._ts>0?(D-h._start)*h._ts:(h._dirty?h.totalDuration():h._tDur)+(D-h._start)*h._ts,s,o||$r&&(h._initted||h._startAt)),f!==this._time||!this._ts&&!m){y=0,p&&(c+=this._zTime=D?-rn:rn);break}}h=p}}if(y&&!s&&(this.pause(),y.render(f>=a?0:-rn)._zTime=f>=a?1:-1,this._ts))return this._start=x,Ox(this),this.render(i,s,o);this._onUpdate&&!s&&Ds(this,"onUpdate",!0),(c===l&&this._tTime>=this.totalDuration()||!c&&a)&&(x===this._start||Math.abs(w)!==Math.abs(this._ts))&&(this._lock||((i||!A)&&(c===l&&this._ts>0||!c&&this._ts<0)&&PA(this,1),!s&&!(i<0&&!a)&&(c||a||!l)&&(Ds(this,c===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c0)&&this._prom())))}return this},t.add=function(i,s){var o=this;if(wl(s)||(s=_s(this,s,i)),!(i instanceof Fh)){if(Yr(i))return i.forEach(function(a){return o.add(a,s)}),this;if(Cr(i))return this.addLabel(i,s);if(Nn(i))i=fr.delayedCall(0,i);else return this}return this!==i?Xo(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=-Ls);for(var l=[],A=this._first;A;)A._start>=a&&(A instanceof fr?s&&l.push(A):(o&&l.push(A),i&&l.push.apply(l,A.getChildren(!0,s,o)))),A=A._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 Cr(i)?this.removeLabel(i):Nn(i)?this.killTweensOf(i):(Dx(this,i),i===this._recent&&(this._recent=this._last),Lc(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Fr(Yi.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]=_s(this,s),this},t.removeLabel=function(i){return delete this.labels[i],this},t.addPause=function(i,s,o){var a=fr.delayedCall(0,s||Fm,o);return a.data="isPause",this._hasPause=1,Xo(this,a,_s(this,i))},t.removePause=function(i){var s=this._first;for(i=_s(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--;)aA!==a[l]&&a[l].kill(i,s);return this},t.getTweensOf=function(i,s){for(var o=[],a=Ps(i),l=this._first,A=wl(s),c;l;)l instanceof fr?i$(l._targets,a)&&(A?(!aA||l._initted&&l._ts)&&l.globalTime(0)<=s&&l.globalTime(l.totalDuration())>s:!s||l.isActive())&&o.push(l):(c=l.getTweensOf(a,s)).length&&o.push.apply(o,c),l=l._next;return o},t.tweenTo=function(i,s){s=s||{};var o=this,a=_s(o,i),l=s,A=l.startAt,c=l.onStart,u=l.onStartParams,f=l.immediateRender,h,p=fr.to(o,js({ease:s.ease||"none",lazy:!1,immediateRender:!1,time:a,overwrite:"auto",duration:s.duration||Math.abs((a-(A&&"time"in A?A.time:o._time))/o.timeScale())||rn,onStart:function(){if(o.pause(),!h){var g=s.duration||Math.abs((a-(A&&"time"in A?A.time:o._time))/o.timeScale());p._dur!==g&&Ih(p,g,0,1).render(p._time,!0,!0),h=1}c&&c.apply(p,u||[])}},s));return f?p.render(0):p},t.tweenFromTo=function(i,s,o){return this.tweenTo(s,js({startAt:{time:_s(this,i)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),YR(this,_s(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),YR(this,_s(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+rn)},t.shiftChildren=function(i,s,o){o===void 0&&(o=0);for(var a=this._first,l=this.labels,A;a;)a._start>=o&&(a._start+=i,a._end+=i),a=a._next;if(s)for(A in l)l[A]>=o&&(l[A]+=i);return Lc(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={}),Lc(this)},t.totalDuration=function(i){var s=0,o=this,a=o._last,l=Ls,A,c,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;)A=a._prev,a._dirty&&a.totalDuration(),c=a._start,c>l&&o._sort&&a._ts&&!o._lock?(o._lock=1,Xo(o,a,c-a._delay,1)._lock=0):l=c,c<0&&a._ts&&(s-=c,(!u&&!o._dp||u&&u.smoothChildTiming)&&(o._start+=c/o._ts,o._time-=c,o._tTime-=c),o.shiftChildren(-c,!1,-1/0),l=0),a._end>s&&a._ts&&(s=a._end),a=A;Ih(o,o===Sn&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(i){if(Sn._ts&&(wQ(Sn,uw(i,Sn)),vQ=Yi.frame),Yi.frame>=jR){jR+=rs.autoSleep||120;var s=Sn._first;if((!s||!s._ts)&&rs.autoSleep&&Yi._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Yi.sleep()}}},e}(Fh);js(bi.prototype,{_lock:0,_hasPause:0,_forcing:0});var M$=function(e,t,r,i,s,o,a){var l=new Ri(this._pt,e,t,0,1,WQ,null,s),A=0,c=0,u,f,h,p,d,g,m,y;for(l.b=r,l.e=i,r+="",i+="",(m=~i.indexOf("random("))&&(i=Um(i)),o&&(y=[r,i],o(y,e,t),r=y[0],i=y[1]),f=r.match(S1)||[];u=S1.exec(i);)p=u[0],d=i.substring(A,u.index),h?h=(h+1)%5:d.substr(-5)==="rgba("&&(h=1),p!==f[c++]&&(g=parseFloat(f[c-1])||0,l._pt={_next:l._pt,p:d||c===1?d:",",s:g,c:p.charAt(1)==="="?sh(g,p)-g:parseFloat(p)-g,m:h&&h<4?Math.round:0},A=S1.lastIndex);return l.c=A")}),x.duration();else{C={};for(b in p)b==="ease"||b==="easeEach"||F$(b,p[b],C,p.easeEach);for(b in C)for(I=C[b].sort(function(U,P){return U.t-P.t}),H=0,_=0;_l-rn&&!c?l:iA&&(f=A)),m=this._yoyo&&p&1,m&&(x=this._yEase,f=A-f),g=Th(this._tTime,d),f===a&&!o&&this._initted)return this._tTime=u,this;p!==g&&(w&&this._yEase&&NQ(w,m),this.vars.repeatRefresh&&!m&&!this._lock&&(this._lock=o=1,this.render(Fr(d*p),!0).invalidate()._lock=0))}if(!this._initted){if(CQ(this,c?i:f,o,s,u))return this._tTime=0,this;if(a!==this._time)return this;if(A!==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=y=(x||this._ease)(f/A),this._from&&(this.ratio=y=1-y),f&&!a&&!s&&(Ds(this,"onStart"),this._tTime!==u))return this;for(h=this._pt;h;)h.r(y,h.d),h=h._next;w&&w.render(i<0?i:!f&&m?-rn:w._dur*w._ease(f/this._dur),s,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(c&&VE(this,i,s,o),Ds(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!s&&this.parent&&Ds(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&VE(this,i,!0,!0),(i||!A)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&PA(this,1),!s&&!(c&&!a)&&(u||a||m)&&(Ds(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){Lm||Yi.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),A;return this._initted||NM(this,l),A=this._ease(l/this._dur),I$(this,i,s,o,a,A,l)?this.resetTo(i,s,o,a):(Nx(this,0),this.parent||bQ(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?xp(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,aA&&aA.vars.overwrite!==!0)._first||xp(this),this.parent&&o!==this.timeline.totalDuration()&&Ih(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=i?Ps(i):a,A=this._ptLookup,c=this._pt,u,f,h,p,d,g,m;if((!s||s==="all")&&o$(a,l))return s==="all"&&(this._pt=0),xp(this);for(u=this._op=this._op||[],s!=="all"&&(Cr(s)&&(d={},Ii(s,function(y){return d[y]=1}),s=d),s=R$(a,s)),m=a.length;m--;)if(~l.indexOf(a[m])){f=A[m],s==="all"?(u[m]=s,p=f,h={}):(h=u[m]=u[m]||{},p=s);for(d in p)g=f&&f[d],g&&((!("kill"in g.d)||g.d.kill(d)===!0)&&Dx(this,g,"_pt"),delete f[d]),h!=="all"&&(h[d]=1)}return this._initted&&!this._pt&&c&&xp(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return Jp(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 Jp(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 Sn.killTweensOf(i,s,o)},e}(Fh);js(fr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});Ii("staggerTo,staggerFrom,staggerFromTo",function(n){fr[n]=function(){var e=new bi,t=WE.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var kM=function(e,t,r){return e[t]=r},VQ=function(e,t,r){return e[t](r)},U$=function(e,t,r,i){return e[t](i.fp,r)},L$=function(e,t,r){return e.setAttribute(t,r)},QM=function(e,t){return Nn(e[t])?VQ:RM(e[t])&&e.setAttribute?L$:kM},jQ=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},P$=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},WQ=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)},HM=function(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next},D$=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},O$=function(e){for(var t=this._pt,r,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?Dx(this,t,"_pt"):t.dep||(r=1),t=i;return!r},N$=function(e,t,r,i){i.mSet(e,t,i.m.call(i.tween,r,i.mt),i)},KQ=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},Ri=function(){function n(t,r,i,s,o,a,l,A,c){this.t=r,this.s=s,this.c=o,this.p=i,this.r=a||jQ,this.d=l||this,this.set=A||kM,this.pr=c||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=N$,this.m=r,this.mt=s,this.tween=i},n}();Ii(PM+"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 LM[n]=1});os.TweenMax=os.TweenLite=fr;os.TimelineLite=os.TimelineMax=bi;Sn=new bi({sortChildren:!1,defaults:Mh,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});rs.stringFilter=DQ;var Uh=[],oy={},k$=[],ZR=0,F1=function(e){return(oy[e]||k$).map(function(t){return t()})},XE=function(){var e=Date.now(),t=[];e-ZR>2&&(F1("matchMediaInit"),Uh.forEach(function(r){var i=r.queries,s=r.conditions,o,a,l,A;for(a in i)o=bs.matchMedia(i[a]).matches,o&&(l=1),o!==s[a]&&(s[a]=o,A=1);A&&(r.revert(),l&&t.push(r))}),F1("matchMediaRevert"),t.forEach(function(r){return r.onMatch(r)}),ZR=e,F1("matchMedia"))},$Q=function(){function n(t,r){this.selector=r&&KE(r),this.data=[],this._r=[],this.isReverted=!1,t&&this.add(t)}var e=n.prototype;return e.add=function(r,i,s){Nn(r)&&(s=i,i=r,r=Nn);var o=this,a=function(){var A=tr,c=o.selector,u;return A&&A!==o&&A.data.push(o),s&&(o.selector=KE(s)),tr=o,u=i.apply(o,arguments),Nn(u)&&o._r.push(u),tr=A,o.selector=c,o.isReverted=!1,u};return o.last=a,r===Nn?a(o):r?o[r]=a:a},e.ignore=function(r){var i=tr;tr=null,r(this),tr=i},e.getTweens=function(){var r=[];return this.data.forEach(function(i){return i instanceof n?r.push.apply(r,i.getTweens()):i instanceof fr&&!(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){var o=this.getTweens();this.data.forEach(function(l){l.data==="isFlip"&&(l.revert(),l.getChildren(!0,!0,!1).forEach(function(A){return o.splice(o.indexOf(A),1)}))}),o.map(function(l){return{g:l.globalTime(0),t:l}}).sort(function(l,A){return A.g-l.g||-1}).forEach(function(l){return l.t.revert(r)}),this.data.forEach(function(l){return!(l instanceof Fh)&&l.revert&&l.revert(r)}),this._r.forEach(function(l){return l(r,s)}),this.isReverted=!0}else this.data.forEach(function(l){return l.kill&&l.kill()});if(this.clear(),i){var a=Uh.indexOf(this);~a&&Uh.splice(a,1)}},e.revert=function(r){this.kill(r||{})},n}(),Q$=function(){function n(t){this.contexts=[],this.scope=t}var e=n.prototype;return e.add=function(r,i,s){ma(r)||(r={matches:r});var o=new $Q(0,s||this.scope),a=o.conditions={},l,A,c;this.contexts.push(o),i=o.add("onMatch",i),o.queries=r;for(A in r)A==="all"?c=1:(l=bs.matchMedia(r[A]),l&&(Uh.indexOf(o)<0&&Uh.push(o),(a[A]=l.matches)&&(c=1),l.addListener?l.addListener(XE):l.addEventListener("change",XE)));return c&&i(o),this},e.revert=function(r){this.kill(r||{})},e.kill=function(r){this.contexts.forEach(function(i){return i.kill(r,!0)})},n}(),fw={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r1){var i=e.map(function(c){return as.quickSetter(c,t,r)}),s=i.length;return function(c){for(var u=s;u--;)i[u](c)}}e=e[0]||{};var o=$i[t],a=Uc(e),l=a.harness&&(a.harness.aliases||{})[t]||t,A=o?function(c){var u=new o;zf._pt=0,u.init(e,r?c+r:c,zf,0,[e]),u.render(1,u),zf._pt&&HM(1,zf)}:a.set(e,l);return o?A:function(c){return A(e,l,r?c+r:c,a,1)}},quickTo:function(e,t,r){var i,s=as.to(e,Kc((i={},i[t]="+=0.1",i.paused=!0,i),r||{})),o=function(l,A,c){return s.resetTo(t,l,A,c)};return o.tween=s,o},isTweening:function(e){return Sn.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=Pc(e.ease,Mh.ease)),WR(Mh,e||{})},config:function(e){return WR(rs,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&&!$i[a]&&!os[a]&&lw(t+" effect requires "+a+" plugin.")}),M1[t]=function(a,l,A){return r(Ps(a),js(l||{},s),A)},o&&(bi.prototype[t]=function(a,l,A){return this.add(M1[t](a,ma(l)?l:(A=l)&&{},this),A)})},registerEase:function(e,t){Ot[e]=Pc(t)},parseEase:function(e,t){return arguments.length?Pc(e,t):Ot},getById:function(e){return Sn.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var r=new bi(e),i,s;for(r.smoothChildTiming=Ti(e.smoothChildTiming),Sn.remove(r),r._dp=0,r._time=r._tTime=Sn._time,i=Sn._first;i;)s=i._next,(t||!(!i._dur&&i instanceof fr&&i.vars.onComplete===i._targets[0]))&&Xo(r,i,i._start-i._delay),i=s;return Xo(Sn,r,0),r},context:function(e,t){return e?new $Q(e,t):tr},matchMedia:function(e){return new Q$(e)},matchMediaRefresh:function(){return Uh.forEach(function(e){var t=e.conditions,r,i;for(i in t)t[i]&&(t[i]=!1,r=1);r&&e.revert()})||XE()},addEventListener:function(e,t){var r=oy[e]||(oy[e]=[]);~r.indexOf(t)||r.push(t)},removeEventListener:function(e,t){var r=oy[e],i=r&&r.indexOf(t);i>=0&&r.splice(i,1)},utils:{wrap:v$,wrapYoyo:y$,distribute:TQ,random:RQ,snap:IQ,normalize:g$,getUnit:Wr,clamp:h$,splitColor:LQ,toArray:Ps,selector:KE,mapRange:UQ,pipe:p$,unitize:m$,interpolate:w$,shuffle:MQ},install:mQ,effects:M1,ticker:Yi,updateRoot:bi.updateRoot,plugins:$i,globalTimeline:Sn,core:{PropTween:Ri,globals:gQ,Tween:fr,Timeline:bi,Animation:Fh,getCache:Uc,_removeLinkedListItem:Dx,reverting:function(){return $r},context:function(e){return e&&tr&&(tr.data.push(e),e._ctx=tr),tr},suppressOverwrites:function(e){return IM=e}}};Ii("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return fw[n]=fr[n]});Yi.add(bi.updateRoot);zf=fw.to({},{duration:0});var H$=function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r},z$=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=H$(o,i)),o&&o.modifier&&o.modifier(t[i],e,r[s],i))},U1=function(e,t){return{name:e,rawVars:1,init:function(i,s,o){o._onInit=function(a){var l,A;if(Cr(s)&&(l={},Ii(s,function(c){return l[c]=1}),s=l),t){l={};for(A in s)l[A]=t(s[A]);s=l}z$(a,s)}}}},as=fw.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;)$r?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)}},U1("roundProps",$E),U1("modifiers"),U1("snap",IQ))||fw;fr.version=bi.version=as.version="3.11.4";pQ=1;cQ()&&Rh();Ot.Power0;Ot.Power1;Ot.Power2;Ot.Power3;Ot.Power4;Ot.Linear;Ot.Quad;Ot.Cubic;Ot.Quart;Ot.Quint;Ot.Strong;Ot.Elastic;Ot.Back;Ot.SteppedEase;Ot.Bounce;Ot.Sine;Ot.Expo;Ot.Circ;/*! * CSSPlugin 3.11.4 * https://greensock.com * @@ -60,15 +60,15 @@ Error generating stack: `+s.message+` * Subject to the terms at https://greensock.com/standard-license or for * Club GreenSock members, the agreement issued with that membership. * @author: Jack Doyle, jack@greensock.com -*/var JR,aA,sh,zM,Bc,qR,GM,G$=function(){return typeof window<"u"},wl={},dc=180/Math.PI,oh=Math.PI/180,yu=Math.atan2,eF=1e8,VM=/([A-Z])/g,V$=/(left|right|width|margin|padding|x)/i,j$=/[\s,\(]\S/,il={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},ZE=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},W$=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)},K$=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)},$$=function(e,t){var r=t.s+t.c*e;t.set(t.t,t.p,~~(r+(r<0?-.5:.5))+t.u,t)},YQ=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},XQ=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},Y$=function(e,t,r){return e.style[t]=r},X$=function(e,t,r){return e.style.setProperty(t,r)},Z$=function(e,t,r){return e._gsap[t]=r},J$=function(e,t,r){return e._gsap.scaleX=e._gsap.scaleY=r},q$=function(e,t,r,i,s){var o=e._gsap;o.scaleX=o.scaleY=r,o.renderTransform(s,o)},eY=function(e,t,r,i,s){var o=e._gsap;o[t]=r,o.renderTransform(s,o)},Mn="transform",Bo=Mn+"Origin",tY=function(e,t){var r=this,i=this.target,s=i.style;if(e in wl){if(this.tfm=this.tfm||{},e!=="transform"&&(e=il[e]||e,~e.indexOf(",")?e.split(",").forEach(function(o){return r.tfm[o]=Za(i,o)}):this.tfm[e]=i._gsap.x?i._gsap[e]:Za(i,e)),this.props.indexOf(Mn)>=0)return;i._gsap.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(Bo,t,"")),e=Mn}(s||t)&&this.props.push(e,t,s[e])},ZQ=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},nY=function(){var e=this.props,t=this.target,r=t.style,i=t._gsap,s,o;for(s=0;s=0?tF[o]:"")+e},qE=function(){G$()&&window.document&&(JR=window,aA=JR.document,sh=aA.documentElement,Bc=JE("div")||{style:{}},JE("div"),Mn=Uh(Mn),Bo=Mn+"Origin",Bc.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",qQ=!!Uh("perspective"),GM=as.core.reverting,zM=1)},L1=function n(e){var t=JE("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(sh.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)),sh.removeChild(t),this.style.cssText=s,o},nF=function(e,t){for(var r=t.length;r--;)if(e.hasAttribute(t[r]))return e.getAttribute(t[r])},eH=function(e){var t;try{t=e.getBBox()}catch{t=L1.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===L1||(t=L1.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+nF(e,["x","cx","x1"])||0,y:+nF(e,["y","cy","y1"])||0,width:0,height:0}:t},tH=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&eH(e))},Lm=function(e,t){if(t){var r=e.style;t in wl&&t!==Bo&&(t=Mn),r.removeProperty?((t.substr(0,2)==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),r.removeProperty(t.replace(VM,"-$1").toLowerCase())):r.removeAttribute(t)}},lA=function(e,t,r,i,s,o){var a=new Ri(e._pt,t,r,0,1,o?XQ:YQ);return e._pt=a,a.b=i,a.e=s,e._props.push(r),a},rF={deg:1,rad:1,turn:1},rY={grid:1,flex:1},PA=function n(e,t,r,i){var s=parseFloat(r)||0,o=(r+"").trim().substr((s+"").length)||"px",a=Bc.style,l=V$.test(t),A=e.tagName.toLowerCase()==="svg",c=(A?"client":"offset")+(l?"Width":"Height"),u=100,f=i==="px",h=i==="%",p,d,g,m;return i===o||!s||rF[i]||rF[o]?s:(o!=="px"&&!f&&(s=n(e,t,r,"px")),m=e.getCTM&&tH(e),(h||o==="%")&&(wl[t]||~t.indexOf("adius"))?(p=m?e.getBBox()[l?"width":"height"]:e[c],Kn(h?s/p*u:s/100*p)):(a[l?"width":"height"]=u+(f?o:i),d=~t.indexOf("adius")||i==="em"&&e.appendChild&&!A?e:e.parentNode,m&&(d=(e.ownerSVGElement||{}).parentNode),(!d||d===aA||!d.appendChild)&&(d=aA.body),g=d._gsap,g&&h&&g.width&&l&&g.time===Yi.time&&!g.uncache?Kn(s/g.width*u):((h||o==="%")&&!rY[Aa(d,"display")]&&(a.position=Aa(e,"position")),d===e&&(a.position="static"),d.appendChild(Bc),p=Bc[c],d.removeChild(Bc),a.position="absolute",l&&h&&(g=Fc(d),g.time=Yi.time,g.width=d[c]),Kn(f?p*s/u:p&&s?u/p*s:0))))},Za=function(e,t,r,i){var s;return zM||qE(),t in il&&t!=="transform"&&(t=il[t],~t.indexOf(",")&&(t=t.split(",")[0])),wl[t]&&t!=="transform"?(s=Dm(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:hw(Aa(e,Bo))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=fw[t]&&fw[t](e,t,r)||Aa(e,t)||yQ(e,t)||(t==="opacity"?1:0))),r&&!~(s+"").trim().indexOf(" ")?PA(e,t,s,r)+r:s},iY=function(e,t,r,i){if(!r||r==="none"){var s=Uh(t,e,1),o=s&&Aa(e,s,1);o&&o!==r?(t=s,r=o):t==="borderColor"&&(r=Aa(e,"borderTopColor"))}var a=new Ri(this._pt,e.style,t,0,1,WQ),l=0,A=0,c,u,f,h,p,d,g,m,y,w,x,_;if(a.b=r,a.e=i,r+="",i+="",i==="auto"&&(e.style[t]=i,i=Aa(e,t)||i,e.style[t]=r),c=[r,i],DQ(c),r=c[0],i=c[1],f=r.match(Qf)||[],_=i.match(Qf)||[],_.length){for(;u=Qf.exec(i);)g=u[0],y=i.substring(l,u.index),p?p=(p+1)%5:(y.substr(-5)==="rgba("||y.substr(-5)==="hsla(")&&(p=1),g!==(d=f[A++]||"")&&(h=parseFloat(d)||0,x=d.substr((h+"").length),g.charAt(1)==="="&&(g=ih(h,g)+x),m=parseFloat(g),w=g.substr((m+"").length),l=Qf.lastIndex-w.length,w||(w=w||rs.units[t]||x,l===i.length&&(i+=w,a.e+=w)),x!==w&&(h=PA(e,t,d,w)||0),a._pt={_next:a._pt,p:y||A===1?y:",",s:h,c:m-h,m:p&&p<4||t==="zIndex"?Math.round:0});a.c=l-1;)a=s[A],wl[a]&&(l=1,a=a==="transformOrigin"?Bo:Mn),Lm(r,a);l&&(Lm(r,Mn),o&&(o.svg&&r.removeAttribute("transform"),Dm(r,1),o.uncache=1,ZQ(i)))}},fw={clearProps:function(e,t,r,i,s){if(s.data!=="isFromStart"){var o=e._pt=new Ri(e._pt,t,r,0,0,oY);return o.u=i,o.pr=-10,o.tween=s,e._props.push(r),1}}},Pm=[1,0,0,1,0,0],nH={},rH=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},sF=function(e){var t=Aa(e,Mn);return rH(t)?Pm:t.substr(7).match(fQ).map(Kn)},jM=function(e,t){var r=e._gsap||Fc(e),i=e.style,s=sF(e),o,a,l,A;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"?Pm:s):(s===Pm&&!e.offsetParent&&e!==sh&&!r.svg&&(l=i.display,i.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(A=1,a=e.nextElementSibling,sh.appendChild(e)),s=sF(e),l?i.display=l:Lm(e,"display"),A&&(a?o.insertBefore(e,a):o?o.appendChild(e):sh.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},eC=function(e,t,r,i,s,o){var a=e._gsap,l=s||jM(e,!0),A=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,f=a.yOffset||0,h=l[0],p=l[1],d=l[2],g=l[3],m=l[4],y=l[5],w=t.split(" "),x=parseFloat(w[0])||0,_=parseFloat(w[1])||0,C,S,b,M;r?l!==Pm&&(S=h*g-p*d)&&(b=x*(g/S)+_*(-d/S)+(d*y-g*m)/S,M=x*(-p/S)+_*(h/S)-(h*y-p*m)/S,x=b,_=M):(C=eH(e),x=C.x+(~w[0].indexOf("%")?x/100*C.width:x),_=C.y+(~(w[1]||w[0]).indexOf("%")?_/100*C.height:_)),i||i!==!1&&a.smooth?(m=x-A,y=_-c,a.xOffset=u+(m*h+y*d)-m,a.yOffset=f+(m*p+y*g)-y):a.xOffset=a.yOffset=0,a.xOrigin=x,a.yOrigin=_,a.smooth=!!i,a.origin=t,a.originIsAbsolute=!!r,e.style[Bo]="0px 0px",o&&(lA(o,a,"xOrigin",A,x),lA(o,a,"yOrigin",c,_),lA(o,a,"xOffset",u,a.xOffset),lA(o,a,"yOffset",f,a.yOffset)),e.setAttribute("data-svg-origin",x+" "+_)},Dm=function(e,t){var r=e._gsap||new QQ(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),A=Aa(e,Bo)||"0",c,u,f,h,p,d,g,m,y,w,x,_,C,S,b,M,D,$,H,I,v,E,U,P,L,z,K,O,B,W,ee,F;return c=u=f=d=g=m=y=w=x=0,h=p=1,r.svg=!!(e.getCTM&&tH(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Mn]=(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[Mn]!=="none"?l[Mn]:"")),i.scale=i.rotate=i.translate="none"),S=jM(e,r.svg),r.svg&&(r.uncache?(L=e.getBBox(),A=r.xOrigin-L.x+"px "+(r.yOrigin-L.y)+"px",P=""):P=!t&&e.getAttribute("data-svg-origin"),eC(e,P||A,!!P||r.originIsAbsolute,r.smooth!==!1,S)),_=r.xOrigin||0,C=r.yOrigin||0,S!==Pm&&($=S[0],H=S[1],I=S[2],v=S[3],c=E=S[4],u=U=S[5],S.length===6?(h=Math.sqrt($*$+H*H),p=Math.sqrt(v*v+I*I),d=$||H?yu(H,$)*dc:0,y=I||v?yu(I,v)*dc+d:0,y&&(p*=Math.abs(Math.cos(y*oh))),r.svg&&(c-=_-(_*$+C*I),u-=C-(_*H+C*v))):(F=S[6],W=S[7],K=S[8],O=S[9],B=S[10],ee=S[11],c=S[12],u=S[13],f=S[14],b=yu(F,B),g=b*dc,b&&(M=Math.cos(-b),D=Math.sin(-b),P=E*M+K*D,L=U*M+O*D,z=F*M+B*D,K=E*-D+K*M,O=U*-D+O*M,B=F*-D+B*M,ee=W*-D+ee*M,E=P,U=L,F=z),b=yu(-I,B),m=b*dc,b&&(M=Math.cos(-b),D=Math.sin(-b),P=$*M-K*D,L=H*M-O*D,z=I*M-B*D,ee=v*D+ee*M,$=P,H=L,I=z),b=yu(H,$),d=b*dc,b&&(M=Math.cos(b),D=Math.sin(b),P=$*M+H*D,L=E*M+U*D,H=H*M-$*D,U=U*M-E*D,$=P,E=L),g&&Math.abs(g)+Math.abs(d)>359.9&&(g=d=0,m=180-m),h=Kn(Math.sqrt($*$+H*H+I*I)),p=Kn(Math.sqrt(U*U+F*F)),b=yu(E,U),y=Math.abs(b)>2e-4?b*dc:0,x=ee?1/(ee<0?-ee:ee):0),r.svg&&(P=e.getAttribute("transform"),r.forceCSS=e.setAttribute("transform","")||!rH(Aa(e,Mn)),P&&e.setAttribute("transform",P))),Math.abs(y)>90&&Math.abs(y)<270&&(s?(h*=-1,y+=d<=0?180:-180,d+=d<=0?180:-180):(p*=-1,y+=y<=0?180:-180)),t=t||r.uncache,r.x=c-((r.xPercent=c&&(!t&&r.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-c)?-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=Kn(h),r.scaleY=Kn(p),r.rotation=Kn(d)+a,r.rotationX=Kn(g)+a,r.rotationY=Kn(m)+a,r.skewX=y+a,r.skewY=w+a,r.transformPerspective=x+o,(r.zOrigin=parseFloat(A.split(" ")[2])||0)&&(i[Bo]=hw(A)),r.xOffset=r.yOffset=0,r.force3D=rs.force3D,r.renderTransform=r.svg?lY:qQ?iH:aY,r.uncache=0,r},hw=function(e){return(e=e.split(" "))[0]+" "+e[1]},P1=function(e,t,r){var i=Wr(t);return Kn(parseFloat(t)+parseFloat(PA(e,"x",r+"px",i)))+i},aY=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,iH(e,t)},tc="0deg",Ud="0px",nc=") ",iH=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.z,A=r.rotation,c=r.rotationY,u=r.rotationX,f=r.skewX,h=r.skewY,p=r.scaleX,d=r.scaleY,g=r.transformPerspective,m=r.force3D,y=r.target,w=r.zOrigin,x="",_=m==="auto"&&e&&e!==1||m===!0;if(w&&(u!==tc||c!==tc)){var C=parseFloat(c)*oh,S=Math.sin(C),b=Math.cos(C),M;C=parseFloat(u)*oh,M=Math.cos(C),o=P1(y,o,S*M*-w),a=P1(y,a,-Math.sin(C)*-w),l=P1(y,l,b*M*-w+w)}g!==Ud&&(x+="perspective("+g+nc),(i||s)&&(x+="translate("+i+"%, "+s+"%) "),(_||o!==Ud||a!==Ud||l!==Ud)&&(x+=l!==Ud||_?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+nc),A!==tc&&(x+="rotate("+A+nc),c!==tc&&(x+="rotateY("+c+nc),u!==tc&&(x+="rotateX("+u+nc),(f!==tc||h!==tc)&&(x+="skew("+f+", "+h+nc),(p!==1||d!==1)&&(x+="scale("+p+", "+d+nc),y.style[Mn]=x||"translate(0, 0)"},lY=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.rotation,A=r.skewX,c=r.skewY,u=r.scaleX,f=r.scaleY,h=r.target,p=r.xOrigin,d=r.yOrigin,g=r.xOffset,m=r.yOffset,y=r.forceCSS,w=parseFloat(o),x=parseFloat(a),_,C,S,b,M;l=parseFloat(l),A=parseFloat(A),c=parseFloat(c),c&&(c=parseFloat(c),A+=c,l+=c),l||A?(l*=oh,A*=oh,_=Math.cos(l)*u,C=Math.sin(l)*u,S=Math.sin(l-A)*-f,b=Math.cos(l-A)*f,A&&(c*=oh,M=Math.tan(A-c),M=Math.sqrt(1+M*M),S*=M,b*=M,c&&(M=Math.tan(c),M=Math.sqrt(1+M*M),_*=M,C*=M)),_=Kn(_),C=Kn(C),S=Kn(S),b=Kn(b)):(_=u,b=f,C=S=0),(w&&!~(o+"").indexOf("px")||x&&!~(a+"").indexOf("px"))&&(w=PA(h,"x",o,"px"),x=PA(h,"y",a,"px")),(p||d||g||m)&&(w=Kn(w+p-(p*_+d*S)+g),x=Kn(x+d-(p*C+d*b)+m)),(i||s)&&(M=h.getBBox(),w=Kn(w+i/100*M.width),x=Kn(x+s/100*M.height)),M="matrix("+_+","+C+","+S+","+b+","+w+","+x+")",h.setAttribute("transform",M),y&&(h.style[Mn]=M)},AY=function(e,t,r,i,s){var o=360,a=Er(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?dc:1),A=l-i,c=i+A+"deg",u,f;return a&&(u=s.split("_")[1],u==="short"&&(A%=o,A!==A%(o/2)&&(A+=A<0?o:-o)),u==="cw"&&A<0?A=(A+o*eF)%o-~~(A/o)*o:u==="ccw"&&A>0&&(A=(A-o*eF)%o-~~(A/o)*o)),e._pt=f=new Ri(e._pt,t,r,i,A,W$),f.e=c,f.u="deg",e._props.push(r),f},oF=function(e,t){for(var r in t)e[r]=t[r];return e},cY=function(e,t,r){var i=oF({},r._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=r.style,a,l,A,c,u,f,h,p;i.svg?(A=r.getAttribute("transform"),r.setAttribute("transform",""),o[Mn]=t,a=Dm(r,1),Lm(r,Mn),r.setAttribute("transform",A)):(A=getComputedStyle(r)[Mn],o[Mn]=t,a=Dm(r,1),o[Mn]=A);for(l in wl)A=i[l],c=a[l],A!==c&&s.indexOf(l)<0&&(h=Wr(A),p=Wr(c),u=h!==p?PA(r,l,A,p):parseFloat(A),f=parseFloat(c),e._pt=new Ri(e._pt,a,l,u,f-u,ZE),e._pt.u=p||0,e._props.push(l));oF(a,i)};Ii("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});fw[e>1?"border"+n:n]=function(a,l,A,c,u){var f,h;if(arguments.length<4)return f=o.map(function(p){return Za(a,p,A)}),h=f.join(" "),h.split(f[0]).length===5?f[0]:h;f=(c+"").split(" "),h={},o.forEach(function(p,d){return h[p]=f[d]=f[d]||f[(d-1)/2|0]}),a.init(l,h,u)}});var sH={name:"css",register:qE,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,A,c,u,f,h,p,d,g,m,y,w,x,_,C,S,b;zM||qE(),this.styles=this.styles||JQ(e),b=this.styles.props,this.tween=r;for(d in t)if(d!=="autoRound"&&(c=t[d],!($i[d]&&HQ(d,t,r,i,e,s)))){if(h=typeof c,p=fw[d],h==="function"&&(c=c.call(r,i,e,s),h=typeof c),h==="string"&&~c.indexOf("random(")&&(c=Fm(c)),p)p(this,e,d,c,r)&&(S=1);else if(d.substr(0,2)==="--")A=(getComputedStyle(e).getPropertyValue(d)+"").trim(),c+="",EA.lastIndex=0,EA.test(A)||(g=Wr(A),m=Wr(c)),m?g!==m&&(A=PA(e,d,A,m)+m):g&&(c+=g),this.add(a,"setProperty",A,c,i,s,0,0,d),o.push(d),b.push(d,0,a[d]);else if(h!=="undefined"){if(l&&d in l?(A=typeof l[d]=="function"?l[d].call(r,i,e,s):l[d],Er(A)&&~A.indexOf("random(")&&(A=Fm(A)),Wr(A+"")||(A+=rs.units[d]||Wr(Za(e,d))||""),(A+"").charAt(1)==="="&&(A=Za(e,d))):A=Za(e,d),f=parseFloat(A),y=h==="string"&&c.charAt(1)==="="&&c.substr(0,2),y&&(c=c.substr(2)),u=parseFloat(c),d in il&&(d==="autoAlpha"&&(f===1&&Za(e,"visibility")==="hidden"&&u&&(f=0),b.push("visibility",0,a.visibility),lA(this,a,"visibility",f?"inherit":"hidden",u?"inherit":"hidden",!u)),d!=="scale"&&d!=="transform"&&(d=il[d],~d.indexOf(",")&&(d=d.split(",")[0]))),w=d in wl,w){if(this.styles.save(d),x||(_=e._gsap,_.renderTransform&&!t.parseTransform||Dm(e,t.parseTransform),C=t.smoothOrigin!==!1&&_.smooth,x=this._pt=new Ri(this._pt,a,Mn,0,1,_.renderTransform,_,0,-1),x.dep=1),d==="scale")this._pt=new Ri(this._pt,_,"scaleY",_.scaleY,(y?ih(_.scaleY,y+u):u)-_.scaleY||0,ZE),this._pt.u=0,o.push("scaleY",d),d+="X";else if(d==="transformOrigin"){b.push(Bo,0,a[Bo]),c=sY(c),_.svg?eC(e,c,0,C,0,this):(m=parseFloat(c.split(" ")[2])||0,m!==_.zOrigin&&lA(this,_,"zOrigin",_.zOrigin,m),lA(this,a,d,hw(A),hw(c)));continue}else if(d==="svgOrigin"){eC(e,c,1,C,0,this);continue}else if(d in nH){AY(this,_,d,f,y?ih(f,y+c):c);continue}else if(d==="smoothOrigin"){lA(this,_,"smooth",_.smooth,c);continue}else if(d==="force3D"){_[d]=c;continue}else if(d==="transform"){cY(this,c,e);continue}}else d in a||(d=Uh(d)||d);if(w||(u||u===0)&&(f||f===0)&&!j$.test(c)&&d in a)g=(A+"").substr((f+"").length),u||(u=0),m=Wr(c)||(d in rs.units?rs.units[d]:g),g!==m&&(f=PA(e,d,A,m)),this._pt=new Ri(this._pt,w?_:a,d,f,(y?ih(f,y+u):u)-f,!w&&(m==="px"||d==="zIndex")&&t.autoRound!==!1?$$:ZE),this._pt.u=m||0,g!==m&&m!=="%"&&(this._pt.b=A,this._pt.r=K$);else if(d in a)iY.call(this,e,d,A,y?y+c:c);else if(d in e)this.add(e,d,A||e[d],y?y+c:c,i,s);else if(d!=="parseTransform"){UM(d,c);continue}w||(d in a?b.push(d,0,a[d]):b.push(d,1,A||e[d])),o.push(d)}}S&&KQ(this)},render:function(e,t){if(t.tween._time||!GM())for(var r=t._pt;r;)r.r(e,r.d),r=r._next;else t.styles.revert()},get:Za,aliases:il,getSetter:function(e,t,r){var i=il[t];return i&&i.indexOf(",")<0&&(t=i),t in wl&&t!==Bo&&(e._gsap.x||Za(e,"x"))?r&&qR===r?t==="scale"?J$:Z$:(qR=r||{})&&(t==="scale"?q$:eY):e.style&&!RM(e.style[t])?Y$:~t.indexOf("-")?X$:QM(e,t)},core:{_removeProperty:Lm,_getMatrix:jM}};as.utils.checkPrefix=Uh;as.core.getStyleSaver=JQ;(function(n,e,t,r){var i=Ii(n+","+e+","+t,function(s){wl[s]=1});Ii(e,function(s){rs.units[s]="deg",nH[s]=1}),il[i[13]]=n+","+e,Ii(r,function(s){var o=s.split(":");il[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");Ii("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){rs.units[n]="px"});as.registerPlugin(sH);var tC=as.registerPlugin(sH)||as;tC.core.Tween;function Zh(){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})}Zh.prototype.key=function(n){return Object.keys(this)[n]};Zh.prototype.getItem=function(n){try{return JSON.parse(this[n])}catch{}return this[n]};Zh.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};Zh.prototype.removeItem=function(n){delete this[n]};Zh.prototype.clear=function(){Object.keys(this).forEach(n=>delete this[n])};let uY=new Zh;const fY=n=>({get(e,t){return n.getItem(String(t))},set(e,t,r){return n.setItem(String(t),r),!0}}),hY=(n=uY)=>new Proxy({},fY(n)),Oe=hY();/** +*/var JR,lA,oh,zM,Ec,qR,GM,G$=function(){return typeof window<"u"},xl={},pc=180/Math.PI,ah=Math.PI/180,wu=Math.atan2,eF=1e8,VM=/([A-Z])/g,V$=/(left|right|width|margin|padding|x)/i,j$=/[\s,\(]\S/,sl={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},ZE=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},W$=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)},K$=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)},$$=function(e,t){var r=t.s+t.c*e;t.set(t.t,t.p,~~(r+(r<0?-.5:.5))+t.u,t)},YQ=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},XQ=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},Y$=function(e,t,r){return e.style[t]=r},X$=function(e,t,r){return e.style.setProperty(t,r)},Z$=function(e,t,r){return e._gsap[t]=r},J$=function(e,t,r){return e._gsap.scaleX=e._gsap.scaleY=r},q$=function(e,t,r,i,s){var o=e._gsap;o.scaleX=o.scaleY=r,o.renderTransform(s,o)},eY=function(e,t,r,i,s){var o=e._gsap;o[t]=r,o.renderTransform(s,o)},Mn="transform",Eo=Mn+"Origin",tY=function(e,t){var r=this,i=this.target,s=i.style;if(e in xl){if(this.tfm=this.tfm||{},e!=="transform"&&(e=sl[e]||e,~e.indexOf(",")?e.split(",").forEach(function(o){return r.tfm[o]=Ja(i,o)}):this.tfm[e]=i._gsap.x?i._gsap[e]:Ja(i,e)),this.props.indexOf(Mn)>=0)return;i._gsap.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(Eo,t,"")),e=Mn}(s||t)&&this.props.push(e,t,s[e])},ZQ=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},nY=function(){var e=this.props,t=this.target,r=t.style,i=t._gsap,s,o;for(s=0;s=0?tF[o]:"")+e},qE=function(){G$()&&window.document&&(JR=window,lA=JR.document,oh=lA.documentElement,Ec=JE("div")||{style:{}},JE("div"),Mn=Lh(Mn),Eo=Mn+"Origin",Ec.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",qQ=!!Lh("perspective"),GM=as.core.reverting,zM=1)},L1=function n(e){var t=JE("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(oh.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)),oh.removeChild(t),this.style.cssText=s,o},nF=function(e,t){for(var r=t.length;r--;)if(e.hasAttribute(t[r]))return e.getAttribute(t[r])},eH=function(e){var t;try{t=e.getBBox()}catch{t=L1.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===L1||(t=L1.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+nF(e,["x","cx","x1"])||0,y:+nF(e,["y","cy","y1"])||0,width:0,height:0}:t},tH=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&eH(e))},Pm=function(e,t){if(t){var r=e.style;t in xl&&t!==Eo&&(t=Mn),r.removeProperty?((t.substr(0,2)==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),r.removeProperty(t.replace(VM,"-$1").toLowerCase())):r.removeAttribute(t)}},AA=function(e,t,r,i,s,o){var a=new Ri(e._pt,t,r,0,1,o?XQ:YQ);return e._pt=a,a.b=i,a.e=s,e._props.push(r),a},rF={deg:1,rad:1,turn:1},rY={grid:1,flex:1},DA=function n(e,t,r,i){var s=parseFloat(r)||0,o=(r+"").trim().substr((s+"").length)||"px",a=Ec.style,l=V$.test(t),A=e.tagName.toLowerCase()==="svg",c=(A?"client":"offset")+(l?"Width":"Height"),u=100,f=i==="px",h=i==="%",p,d,g,m;return i===o||!s||rF[i]||rF[o]?s:(o!=="px"&&!f&&(s=n(e,t,r,"px")),m=e.getCTM&&tH(e),(h||o==="%")&&(xl[t]||~t.indexOf("adius"))?(p=m?e.getBBox()[l?"width":"height"]:e[c],Kn(h?s/p*u:s/100*p)):(a[l?"width":"height"]=u+(f?o:i),d=~t.indexOf("adius")||i==="em"&&e.appendChild&&!A?e:e.parentNode,m&&(d=(e.ownerSVGElement||{}).parentNode),(!d||d===lA||!d.appendChild)&&(d=lA.body),g=d._gsap,g&&h&&g.width&&l&&g.time===Yi.time&&!g.uncache?Kn(s/g.width*u):((h||o==="%")&&!rY[ca(d,"display")]&&(a.position=ca(e,"position")),d===e&&(a.position="static"),d.appendChild(Ec),p=Ec[c],d.removeChild(Ec),a.position="absolute",l&&h&&(g=Uc(d),g.time=Yi.time,g.width=d[c]),Kn(f?p*s/u:p&&s?u/p*s:0))))},Ja=function(e,t,r,i){var s;return zM||qE(),t in sl&&t!=="transform"&&(t=sl[t],~t.indexOf(",")&&(t=t.split(",")[0])),xl[t]&&t!=="transform"?(s=Om(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:dw(ca(e,Eo))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=hw[t]&&hw[t](e,t,r)||ca(e,t)||yQ(e,t)||(t==="opacity"?1:0))),r&&!~(s+"").trim().indexOf(" ")?DA(e,t,s,r)+r:s},iY=function(e,t,r,i){if(!r||r==="none"){var s=Lh(t,e,1),o=s&&ca(e,s,1);o&&o!==r?(t=s,r=o):t==="borderColor"&&(r=ca(e,"borderTopColor"))}var a=new Ri(this._pt,e.style,t,0,1,WQ),l=0,A=0,c,u,f,h,p,d,g,m,y,w,x,_;if(a.b=r,a.e=i,r+="",i+="",i==="auto"&&(e.style[t]=i,i=ca(e,t)||i,e.style[t]=r),c=[r,i],DQ(c),r=c[0],i=c[1],f=r.match(Hf)||[],_=i.match(Hf)||[],_.length){for(;u=Hf.exec(i);)g=u[0],y=i.substring(l,u.index),p?p=(p+1)%5:(y.substr(-5)==="rgba("||y.substr(-5)==="hsla(")&&(p=1),g!==(d=f[A++]||"")&&(h=parseFloat(d)||0,x=d.substr((h+"").length),g.charAt(1)==="="&&(g=sh(h,g)+x),m=parseFloat(g),w=g.substr((m+"").length),l=Hf.lastIndex-w.length,w||(w=w||rs.units[t]||x,l===i.length&&(i+=w,a.e+=w)),x!==w&&(h=DA(e,t,d,w)||0),a._pt={_next:a._pt,p:y||A===1?y:",",s:h,c:m-h,m:p&&p<4||t==="zIndex"?Math.round:0});a.c=l-1;)a=s[A],xl[a]&&(l=1,a=a==="transformOrigin"?Eo:Mn),Pm(r,a);l&&(Pm(r,Mn),o&&(o.svg&&r.removeAttribute("transform"),Om(r,1),o.uncache=1,ZQ(i)))}},hw={clearProps:function(e,t,r,i,s){if(s.data!=="isFromStart"){var o=e._pt=new Ri(e._pt,t,r,0,0,oY);return o.u=i,o.pr=-10,o.tween=s,e._props.push(r),1}}},Dm=[1,0,0,1,0,0],nH={},rH=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},sF=function(e){var t=ca(e,Mn);return rH(t)?Dm:t.substr(7).match(fQ).map(Kn)},jM=function(e,t){var r=e._gsap||Uc(e),i=e.style,s=sF(e),o,a,l,A;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"?Dm:s):(s===Dm&&!e.offsetParent&&e!==oh&&!r.svg&&(l=i.display,i.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(A=1,a=e.nextElementSibling,oh.appendChild(e)),s=sF(e),l?i.display=l:Pm(e,"display"),A&&(a?o.insertBefore(e,a):o?o.appendChild(e):oh.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},eC=function(e,t,r,i,s,o){var a=e._gsap,l=s||jM(e,!0),A=a.xOrigin||0,c=a.yOrigin||0,u=a.xOffset||0,f=a.yOffset||0,h=l[0],p=l[1],d=l[2],g=l[3],m=l[4],y=l[5],w=t.split(" "),x=parseFloat(w[0])||0,_=parseFloat(w[1])||0,C,S,b,M;r?l!==Dm&&(S=h*g-p*d)&&(b=x*(g/S)+_*(-d/S)+(d*y-g*m)/S,M=x*(-p/S)+_*(h/S)-(h*y-p*m)/S,x=b,_=M):(C=eH(e),x=C.x+(~w[0].indexOf("%")?x/100*C.width:x),_=C.y+(~(w[1]||w[0]).indexOf("%")?_/100*C.height:_)),i||i!==!1&&a.smooth?(m=x-A,y=_-c,a.xOffset=u+(m*h+y*d)-m,a.yOffset=f+(m*p+y*g)-y):a.xOffset=a.yOffset=0,a.xOrigin=x,a.yOrigin=_,a.smooth=!!i,a.origin=t,a.originIsAbsolute=!!r,e.style[Eo]="0px 0px",o&&(AA(o,a,"xOrigin",A,x),AA(o,a,"yOrigin",c,_),AA(o,a,"xOffset",u,a.xOffset),AA(o,a,"yOffset",f,a.yOffset)),e.setAttribute("data-svg-origin",x+" "+_)},Om=function(e,t){var r=e._gsap||new QQ(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),A=ca(e,Eo)||"0",c,u,f,h,p,d,g,m,y,w,x,_,C,S,b,M,D,$,H,I,v,E,U,P,L,z,K,O,B,W,ee,F;return c=u=f=d=g=m=y=w=x=0,h=p=1,r.svg=!!(e.getCTM&&tH(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Mn]=(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[Mn]!=="none"?l[Mn]:"")),i.scale=i.rotate=i.translate="none"),S=jM(e,r.svg),r.svg&&(r.uncache?(L=e.getBBox(),A=r.xOrigin-L.x+"px "+(r.yOrigin-L.y)+"px",P=""):P=!t&&e.getAttribute("data-svg-origin"),eC(e,P||A,!!P||r.originIsAbsolute,r.smooth!==!1,S)),_=r.xOrigin||0,C=r.yOrigin||0,S!==Dm&&($=S[0],H=S[1],I=S[2],v=S[3],c=E=S[4],u=U=S[5],S.length===6?(h=Math.sqrt($*$+H*H),p=Math.sqrt(v*v+I*I),d=$||H?wu(H,$)*pc:0,y=I||v?wu(I,v)*pc+d:0,y&&(p*=Math.abs(Math.cos(y*ah))),r.svg&&(c-=_-(_*$+C*I),u-=C-(_*H+C*v))):(F=S[6],W=S[7],K=S[8],O=S[9],B=S[10],ee=S[11],c=S[12],u=S[13],f=S[14],b=wu(F,B),g=b*pc,b&&(M=Math.cos(-b),D=Math.sin(-b),P=E*M+K*D,L=U*M+O*D,z=F*M+B*D,K=E*-D+K*M,O=U*-D+O*M,B=F*-D+B*M,ee=W*-D+ee*M,E=P,U=L,F=z),b=wu(-I,B),m=b*pc,b&&(M=Math.cos(-b),D=Math.sin(-b),P=$*M-K*D,L=H*M-O*D,z=I*M-B*D,ee=v*D+ee*M,$=P,H=L,I=z),b=wu(H,$),d=b*pc,b&&(M=Math.cos(b),D=Math.sin(b),P=$*M+H*D,L=E*M+U*D,H=H*M-$*D,U=U*M-E*D,$=P,E=L),g&&Math.abs(g)+Math.abs(d)>359.9&&(g=d=0,m=180-m),h=Kn(Math.sqrt($*$+H*H+I*I)),p=Kn(Math.sqrt(U*U+F*F)),b=wu(E,U),y=Math.abs(b)>2e-4?b*pc:0,x=ee?1/(ee<0?-ee:ee):0),r.svg&&(P=e.getAttribute("transform"),r.forceCSS=e.setAttribute("transform","")||!rH(ca(e,Mn)),P&&e.setAttribute("transform",P))),Math.abs(y)>90&&Math.abs(y)<270&&(s?(h*=-1,y+=d<=0?180:-180,d+=d<=0?180:-180):(p*=-1,y+=y<=0?180:-180)),t=t||r.uncache,r.x=c-((r.xPercent=c&&(!t&&r.xPercent||(Math.round(e.offsetWidth/2)===Math.round(-c)?-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=Kn(h),r.scaleY=Kn(p),r.rotation=Kn(d)+a,r.rotationX=Kn(g)+a,r.rotationY=Kn(m)+a,r.skewX=y+a,r.skewY=w+a,r.transformPerspective=x+o,(r.zOrigin=parseFloat(A.split(" ")[2])||0)&&(i[Eo]=dw(A)),r.xOffset=r.yOffset=0,r.force3D=rs.force3D,r.renderTransform=r.svg?lY:qQ?iH:aY,r.uncache=0,r},dw=function(e){return(e=e.split(" "))[0]+" "+e[1]},P1=function(e,t,r){var i=Wr(t);return Kn(parseFloat(t)+parseFloat(DA(e,"x",r+"px",i)))+i},aY=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,iH(e,t)},nc="0deg",Ld="0px",rc=") ",iH=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.z,A=r.rotation,c=r.rotationY,u=r.rotationX,f=r.skewX,h=r.skewY,p=r.scaleX,d=r.scaleY,g=r.transformPerspective,m=r.force3D,y=r.target,w=r.zOrigin,x="",_=m==="auto"&&e&&e!==1||m===!0;if(w&&(u!==nc||c!==nc)){var C=parseFloat(c)*ah,S=Math.sin(C),b=Math.cos(C),M;C=parseFloat(u)*ah,M=Math.cos(C),o=P1(y,o,S*M*-w),a=P1(y,a,-Math.sin(C)*-w),l=P1(y,l,b*M*-w+w)}g!==Ld&&(x+="perspective("+g+rc),(i||s)&&(x+="translate("+i+"%, "+s+"%) "),(_||o!==Ld||a!==Ld||l!==Ld)&&(x+=l!==Ld||_?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+rc),A!==nc&&(x+="rotate("+A+rc),c!==nc&&(x+="rotateY("+c+rc),u!==nc&&(x+="rotateX("+u+rc),(f!==nc||h!==nc)&&(x+="skew("+f+", "+h+rc),(p!==1||d!==1)&&(x+="scale("+p+", "+d+rc),y.style[Mn]=x||"translate(0, 0)"},lY=function(e,t){var r=t||this,i=r.xPercent,s=r.yPercent,o=r.x,a=r.y,l=r.rotation,A=r.skewX,c=r.skewY,u=r.scaleX,f=r.scaleY,h=r.target,p=r.xOrigin,d=r.yOrigin,g=r.xOffset,m=r.yOffset,y=r.forceCSS,w=parseFloat(o),x=parseFloat(a),_,C,S,b,M;l=parseFloat(l),A=parseFloat(A),c=parseFloat(c),c&&(c=parseFloat(c),A+=c,l+=c),l||A?(l*=ah,A*=ah,_=Math.cos(l)*u,C=Math.sin(l)*u,S=Math.sin(l-A)*-f,b=Math.cos(l-A)*f,A&&(c*=ah,M=Math.tan(A-c),M=Math.sqrt(1+M*M),S*=M,b*=M,c&&(M=Math.tan(c),M=Math.sqrt(1+M*M),_*=M,C*=M)),_=Kn(_),C=Kn(C),S=Kn(S),b=Kn(b)):(_=u,b=f,C=S=0),(w&&!~(o+"").indexOf("px")||x&&!~(a+"").indexOf("px"))&&(w=DA(h,"x",o,"px"),x=DA(h,"y",a,"px")),(p||d||g||m)&&(w=Kn(w+p-(p*_+d*S)+g),x=Kn(x+d-(p*C+d*b)+m)),(i||s)&&(M=h.getBBox(),w=Kn(w+i/100*M.width),x=Kn(x+s/100*M.height)),M="matrix("+_+","+C+","+S+","+b+","+w+","+x+")",h.setAttribute("transform",M),y&&(h.style[Mn]=M)},AY=function(e,t,r,i,s){var o=360,a=Cr(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?pc:1),A=l-i,c=i+A+"deg",u,f;return a&&(u=s.split("_")[1],u==="short"&&(A%=o,A!==A%(o/2)&&(A+=A<0?o:-o)),u==="cw"&&A<0?A=(A+o*eF)%o-~~(A/o)*o:u==="ccw"&&A>0&&(A=(A-o*eF)%o-~~(A/o)*o)),e._pt=f=new Ri(e._pt,t,r,i,A,W$),f.e=c,f.u="deg",e._props.push(r),f},oF=function(e,t){for(var r in t)e[r]=t[r];return e},cY=function(e,t,r){var i=oF({},r._gsap),s="perspective,force3D,transformOrigin,svgOrigin",o=r.style,a,l,A,c,u,f,h,p;i.svg?(A=r.getAttribute("transform"),r.setAttribute("transform",""),o[Mn]=t,a=Om(r,1),Pm(r,Mn),r.setAttribute("transform",A)):(A=getComputedStyle(r)[Mn],o[Mn]=t,a=Om(r,1),o[Mn]=A);for(l in xl)A=i[l],c=a[l],A!==c&&s.indexOf(l)<0&&(h=Wr(A),p=Wr(c),u=h!==p?DA(r,l,A,p):parseFloat(A),f=parseFloat(c),e._pt=new Ri(e._pt,a,l,u,f-u,ZE),e._pt.u=p||0,e._props.push(l));oF(a,i)};Ii("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});hw[e>1?"border"+n:n]=function(a,l,A,c,u){var f,h;if(arguments.length<4)return f=o.map(function(p){return Ja(a,p,A)}),h=f.join(" "),h.split(f[0]).length===5?f[0]:h;f=(c+"").split(" "),h={},o.forEach(function(p,d){return h[p]=f[d]=f[d]||f[(d-1)/2|0]}),a.init(l,h,u)}});var sH={name:"css",register:qE,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,A,c,u,f,h,p,d,g,m,y,w,x,_,C,S,b;zM||qE(),this.styles=this.styles||JQ(e),b=this.styles.props,this.tween=r;for(d in t)if(d!=="autoRound"&&(c=t[d],!($i[d]&&HQ(d,t,r,i,e,s)))){if(h=typeof c,p=hw[d],h==="function"&&(c=c.call(r,i,e,s),h=typeof c),h==="string"&&~c.indexOf("random(")&&(c=Um(c)),p)p(this,e,d,c,r)&&(S=1);else if(d.substr(0,2)==="--")A=(getComputedStyle(e).getPropertyValue(d)+"").trim(),c+="",CA.lastIndex=0,CA.test(A)||(g=Wr(A),m=Wr(c)),m?g!==m&&(A=DA(e,d,A,m)+m):g&&(c+=g),this.add(a,"setProperty",A,c,i,s,0,0,d),o.push(d),b.push(d,0,a[d]);else if(h!=="undefined"){if(l&&d in l?(A=typeof l[d]=="function"?l[d].call(r,i,e,s):l[d],Cr(A)&&~A.indexOf("random(")&&(A=Um(A)),Wr(A+"")||(A+=rs.units[d]||Wr(Ja(e,d))||""),(A+"").charAt(1)==="="&&(A=Ja(e,d))):A=Ja(e,d),f=parseFloat(A),y=h==="string"&&c.charAt(1)==="="&&c.substr(0,2),y&&(c=c.substr(2)),u=parseFloat(c),d in sl&&(d==="autoAlpha"&&(f===1&&Ja(e,"visibility")==="hidden"&&u&&(f=0),b.push("visibility",0,a.visibility),AA(this,a,"visibility",f?"inherit":"hidden",u?"inherit":"hidden",!u)),d!=="scale"&&d!=="transform"&&(d=sl[d],~d.indexOf(",")&&(d=d.split(",")[0]))),w=d in xl,w){if(this.styles.save(d),x||(_=e._gsap,_.renderTransform&&!t.parseTransform||Om(e,t.parseTransform),C=t.smoothOrigin!==!1&&_.smooth,x=this._pt=new Ri(this._pt,a,Mn,0,1,_.renderTransform,_,0,-1),x.dep=1),d==="scale")this._pt=new Ri(this._pt,_,"scaleY",_.scaleY,(y?sh(_.scaleY,y+u):u)-_.scaleY||0,ZE),this._pt.u=0,o.push("scaleY",d),d+="X";else if(d==="transformOrigin"){b.push(Eo,0,a[Eo]),c=sY(c),_.svg?eC(e,c,0,C,0,this):(m=parseFloat(c.split(" ")[2])||0,m!==_.zOrigin&&AA(this,_,"zOrigin",_.zOrigin,m),AA(this,a,d,dw(A),dw(c)));continue}else if(d==="svgOrigin"){eC(e,c,1,C,0,this);continue}else if(d in nH){AY(this,_,d,f,y?sh(f,y+c):c);continue}else if(d==="smoothOrigin"){AA(this,_,"smooth",_.smooth,c);continue}else if(d==="force3D"){_[d]=c;continue}else if(d==="transform"){cY(this,c,e);continue}}else d in a||(d=Lh(d)||d);if(w||(u||u===0)&&(f||f===0)&&!j$.test(c)&&d in a)g=(A+"").substr((f+"").length),u||(u=0),m=Wr(c)||(d in rs.units?rs.units[d]:g),g!==m&&(f=DA(e,d,A,m)),this._pt=new Ri(this._pt,w?_:a,d,f,(y?sh(f,y+u):u)-f,!w&&(m==="px"||d==="zIndex")&&t.autoRound!==!1?$$:ZE),this._pt.u=m||0,g!==m&&m!=="%"&&(this._pt.b=A,this._pt.r=K$);else if(d in a)iY.call(this,e,d,A,y?y+c:c);else if(d in e)this.add(e,d,A||e[d],y?y+c:c,i,s);else if(d!=="parseTransform"){UM(d,c);continue}w||(d in a?b.push(d,0,a[d]):b.push(d,1,A||e[d])),o.push(d)}}S&&KQ(this)},render:function(e,t){if(t.tween._time||!GM())for(var r=t._pt;r;)r.r(e,r.d),r=r._next;else t.styles.revert()},get:Ja,aliases:sl,getSetter:function(e,t,r){var i=sl[t];return i&&i.indexOf(",")<0&&(t=i),t in xl&&t!==Eo&&(e._gsap.x||Ja(e,"x"))?r&&qR===r?t==="scale"?J$:Z$:(qR=r||{})&&(t==="scale"?q$:eY):e.style&&!RM(e.style[t])?Y$:~t.indexOf("-")?X$:QM(e,t)},core:{_removeProperty:Pm,_getMatrix:jM}};as.utils.checkPrefix=Lh;as.core.getStyleSaver=JQ;(function(n,e,t,r){var i=Ii(n+","+e+","+t,function(s){xl[s]=1});Ii(e,function(s){rs.units[s]="deg",nH[s]=1}),sl[i[13]]=n+","+e,Ii(r,function(s){var o=s.split(":");sl[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");Ii("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){rs.units[n]="px"});as.registerPlugin(sH);var tC=as.registerPlugin(sH)||as;tC.core.Tween;function Jh(){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})}Jh.prototype.key=function(n){return Object.keys(this)[n]};Jh.prototype.getItem=function(n){try{return JSON.parse(this[n])}catch{}return this[n]};Jh.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};Jh.prototype.removeItem=function(n){delete this[n]};Jh.prototype.clear=function(){Object.keys(this).forEach(n=>delete this[n])};let uY=new Jh;const fY=n=>({get(e,t){return n.getItem(String(t))},set(e,t,r){return n.setItem(String(t),r),!0}}),hY=(n=uY)=>new Proxy({},fY(n)),Oe=hY();/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const Ms="149",wu={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},xu={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},dY=0,aF=1,pY=2,oH=1,mY=2,_p=3,ls=0,Xr=1,ui=2,CA=0,ah=1,Kc=2,lF=3,AF=4,gY=5,tf=100,vY=101,yY=102,cF=103,uF=104,wY=200,xY=201,_Y=202,bY=203,aH=204,lH=205,BY=206,EY=207,CY=208,SY=209,MY=210,TY=0,IY=1,RY=2,nC=3,FY=4,UY=5,LY=6,PY=7,Nx=0,DY=1,OY=2,ll=0,NY=1,kY=2,QY=3,HY=4,zY=5,AH=300,Lh=301,Ph=302,dw=303,rC=304,kx=306,As=1e3,Ai=1001,Om=1002,$n=1003,pw=1004,qp=1005,si=1006,WM=1007,DA=1008,OA=1009,GY=1010,VY=1011,cH=1012,jY=1013,Ec=1014,AA=1015,Nm=1016,WY=1017,KY=1018,lh=1020,$Y=1021,br=1023,YY=1024,XY=1025,Pc=1026,Dh=1027,ZY=1028,JY=1029,qY=1030,eX=1031,tX=1033,D1=33776,O1=33777,N1=33778,k1=33779,fF=35840,hF=35841,dF=35842,pF=35843,nX=36196,mF=37492,gF=37496,vF=37808,yF=37809,wF=37810,xF=37811,_F=37812,bF=37813,BF=37814,EF=37815,CF=37816,SF=37817,MF=37818,TF=37819,IF=37820,RF=37821,Q1=36492,rX=36283,FF=36284,UF=36285,LF=36286,iX=2200,sX=2201,oX=2202,Oh=2300,$c=2301,H1=2302,zf=2400,Gf=2401,mw=2402,KM=2500,aX=2501,lX=0,uH=1,iC=2,cs=3e3,pt=3001,AX=3200,cX=3201,Jh=0,uX=1,fX="",Vo="srgb",km="srgb-linear",z1=7680,hX=519,sC=35044,dX=35048,PF="300 es",oC=1035;class YA{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]+Hr[n>>16&255]+Hr[n>>24&255]+"-"+Hr[e&255]+Hr[e>>8&255]+"-"+Hr[e>>16&15|64]+Hr[e>>24&255]+"-"+Hr[t&63|128]+Hr[t>>8&255]+"-"+Hr[t>>16&255]+Hr[t>>24&255]+Hr[r&255]+Hr[r>>8&255]+Hr[r>>16&255]+Hr[r>>24&255]).toLowerCase()}function hr(n,e,t){return Math.max(e,Math.min(t,n))}function $M(n,e){return(n%e+e)%e}function pX(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function mX(n,e,t){return n!==e?(t-n)/(e-n):0}function tm(n,e,t){return(1-t)*n+t*e}function gX(n,e,t,r){return tm(n,e,1-Math.exp(-t*r))}function vX(n,e=1){return e-Math.abs($M(n,e*2)-e)}function yX(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function wX(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function xX(n,e){return n+Math.floor(Math.random()*(e-n+1))}function _X(n,e){return n+Math.random()*(e-n)}function bX(n){return n*(.5-Math.random())}function BX(n){n!==void 0&&(DF=n);let e=DF+=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 EX(n){return n*em}function CX(n){return n*Qm}function aC(n){return(n&n-1)===0&&n!==0}function fH(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function gw(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function SX(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),A=s((e+r)/2),c=o((e+r)/2),u=s((e-r)/2),f=o((e-r)/2),h=s((r-e)/2),p=o((r-e)/2);switch(i){case"XYX":n.set(a*c,l*u,l*f,a*A);break;case"YZY":n.set(l*f,a*c,l*u,a*A);break;case"ZXZ":n.set(l*u,l*f,a*c,a*A);break;case"XZX":n.set(a*c,l*p,l*h,a*A);break;case"YXY":n.set(l*h,a*c,l*p,a*A);break;case"ZYZ":n.set(l*p,l*h,a*c,a*A);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function sl(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function nn(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var Lt=Object.freeze({__proto__:null,DEG2RAD:em,RAD2DEG:Qm,ceilPowerOfTwo:fH,clamp:hr,damp:gX,degToRad:EX,denormalize:sl,euclideanModulo:$M,floorPowerOfTwo:gw,generateUUID:Eo,inverseLerp:mX,isPowerOfTwo:aC,lerp:tm,mapLinear:pX,normalize:nn,pingpong:vX,radToDeg:CX,randFloat:_X,randFloatSpread:bX,randInt:xX,seededRandom:BX,setQuaternionFromProperEuler:SX,smootherstep:wX,smoothstep:yX});class $e{constructor(e=0,t=0){$e.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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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}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 En{constructor(){En.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,r,i,s,o,a,l,A){const c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=s,c[5]=l,c[6]=r,c[7]=o,c[8]=A,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],A=r[1],c=r[4],u=r[7],f=r[2],h=r[5],p=r[8],d=i[0],g=i[3],m=i[6],y=i[1],w=i[4],x=i[7],_=i[2],C=i[5],S=i[8];return s[0]=o*d+a*y+l*_,s[3]=o*g+a*w+l*C,s[6]=o*m+a*x+l*S,s[1]=A*d+c*y+u*_,s[4]=A*g+c*w+u*C,s[7]=A*m+c*x+u*S,s[2]=f*d+h*y+p*_,s[5]=f*g+h*w+p*C,s[8]=f*m+h*x+p*S,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],A=e[7],c=e[8];return t*o*c-t*a*A-r*s*c+r*a*l+i*s*A-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],A=e[7],c=e[8],u=c*o-a*A,f=a*l-c*s,h=A*s-o*l,p=t*u+r*f+i*h;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const d=1/p;return e[0]=u*d,e[1]=(i*A-c*r)*d,e[2]=(a*r-i*o)*d,e[3]=f*d,e[4]=(c*t-i*l)*d,e[5]=(i*s-a*t)*d,e[6]=h*d,e[7]=(r*l-A*t)*d,e[8]=(o*t-r*s)*d,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),A=Math.sin(s);return this.set(r*l,r*A,-r*(l*o+A*a)+o+e,-i*A,i*l,-i*(-A*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(G1.makeScale(e,t)),this}rotate(e){return this.premultiply(G1.makeRotation(-e)),this}translate(e,t){return this.premultiply(G1.makeTranslation(e,t)),this}makeTranslation(e,t){return 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 G1=new En;function hH(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Hm(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Dc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function oy(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const V1={[Vo]:{[km]:Dc},[km]:{[Vo]:oy}},ei={legacyMode:!0,get workingColorSpace(){return km},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.legacyMode||e===t||!e||!t)return n;if(V1[e]&&V1[e][t]!==void 0){const r=V1[e][t];return n.r=r(n.r),n.g=r(n.g),n.b=r(n.b),n}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}},dH={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},Ar={r:0,g:0,b:0},so={h:0,s:0,l:0},f0={h:0,s:0,l:0};function j1(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}function h0(n,e){return e.r=n.r,e.g=n.g,e.b=n.b,e}class Qe{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&r===void 0?this.set(e):this.setRGB(e,t,r)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Vo){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ei.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=ei.workingColorSpace){return this.r=e,this.g=t,this.b=r,ei.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=ei.workingColorSpace){if(e=$M(e,1),t=hr(t,0,1),r=hr(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=j1(o,s,e+1/3),this.g=j1(o,s,e),this.b=j1(o,s,e-1/3)}return ei.toWorkingColorSpace(this,i),this}setStyle(e,t=Vo){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.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 this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,ei.toWorkingColorSpace(this,t),r(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,ei.toWorkingColorSpace(this,t),r(s[4]),this;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)){const l=parseFloat(s[1])/360,A=parseFloat(s[2])/100,c=parseFloat(s[3])/100;return r(s[4]),this.setHSL(l,A,c,t)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,ei.toWorkingColorSpace(this,t),this;if(o===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,ei.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=Vo){const r=dH[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=Dc(e.r),this.g=Dc(e.g),this.b=Dc(e.b),this}copyLinearToSRGB(e){return this.r=oy(e.r),this.g=oy(e.g),this.b=oy(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Vo){return ei.fromWorkingColorSpace(h0(this,Ar),e),hr(Ar.r*255,0,255)<<16^hr(Ar.g*255,0,255)<<8^hr(Ar.b*255,0,255)<<0}getHexString(e=Vo){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ei.workingColorSpace){ei.fromWorkingColorSpace(h0(this,Ar),t);const r=Ar.r,i=Ar.g,s=Ar.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,A;const c=(a+o)/2;if(a===o)l=0,A=0;else{const u=o-a;switch(A=c<=.5?u/(o+a):u/(2-o-a),o){case r:l=(i-s)/u+(i"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{_u===void 0&&(_u=Hm("canvas")),_u.width=e.width,_u.height=e.height;const r=_u.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=_u}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=Hm("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!==AH)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case As:e.x=e.x-Math.floor(e.x);break;case Ai:e.x=e.x<0?0:1;break;case Om: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 As:e.y=e.y-Math.floor(e.y);break;case Ai:e.y=e.y<0?0:1;break;case Om: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)}}Qn.DEFAULT_IMAGE=null;Qn.DEFAULT_MAPPING=AH;Qn.DEFAULT_ANISOTROPY=1;class Qt{constructor(e=0,t=0,r=0,i=1){Qt.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,A=l[0],c=l[4],u=l[8],f=l[1],h=l[5],p=l[9],d=l[2],g=l[6],m=l[10];if(Math.abs(c-f)<.01&&Math.abs(u-d)<.01&&Math.abs(p-g)<.01){if(Math.abs(c+f)<.1&&Math.abs(u+d)<.1&&Math.abs(p+g)<.1&&Math.abs(A+h+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(A+1)/2,x=(h+1)/2,_=(m+1)/2,C=(c+f)/4,S=(u+d)/4,b=(p+g)/4;return w>x&&w>_?w<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(w),i=C/r,s=S/r):x>_?x<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),r=C/i,s=b/i):_<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(_),r=S/s,i=b/s),this.set(r,i,s,t),this}let y=Math.sqrt((g-p)*(g-p)+(u-d)*(u-d)+(f-c)*(f-c));return Math.abs(y)<.001&&(y=1),this.x=(g-p)/y,this.y=(u-d)/y,this.z=(f-c)/y,this.w=Math.acos((A+h+m-1)/2),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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 ma extends YA{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Qt(0,0,e,t),this.scissorTest=!1,this.viewport=new Qt(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new Qn(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps!==void 0?r.generateMipmaps:!1,this.texture.internalFormat=r.internalFormat!==void 0?r.internalFormat:null,this.texture.minFilter=r.minFilter!==void 0?r.minFilter:si,this.depthBuffer=r.depthBuffer!==void 0?r.depthBuffer:!0,this.stencilBuffer=r.stencilBuffer!==void 0?r.stencilBuffer:!1,this.depthTexture=r.depthTexture!==void 0?r.depthTexture:null,this.samples=r.samples!==void 0?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new YM(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class mH extends Qn{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=$n,this.minFilter=$n,this.wrapR=Ai,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class TX extends Qn{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=$n,this.minFilter=$n,this.wrapR=Ai,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rt{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,s,o,a){let l=r[i+0],A=r[i+1],c=r[i+2],u=r[i+3];const f=s[o+0],h=s[o+1],p=s[o+2],d=s[o+3];if(a===0){e[t+0]=l,e[t+1]=A,e[t+2]=c,e[t+3]=u;return}if(a===1){e[t+0]=f,e[t+1]=h,e[t+2]=p,e[t+3]=d;return}if(u!==d||l!==f||A!==h||c!==p){let g=1-a;const m=l*f+A*h+c*p+u*d,y=m>=0?1:-1,w=1-m*m;if(w>Number.EPSILON){const _=Math.sqrt(w),C=Math.atan2(_,m*y);g=Math.sin(g*C)/_,a=Math.sin(a*C)/_}const x=a*y;if(l=l*g+f*x,A=A*g+h*x,c=c*g+p*x,u=u*g+d*x,g===1-a){const _=1/Math.sqrt(l*l+A*A+c*c+u*u);l*=_,A*=_,c*=_,u*=_}}e[t]=l,e[t+1]=A,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],A=r[i+2],c=r[i+3],u=s[o],f=s[o+1],h=s[o+2],p=s[o+3];return e[t]=a*p+c*u+l*h-A*f,e[t+1]=l*p+c*f+A*u-a*h,e[t+2]=A*p+c*h+a*f-l*u,e[t+3]=c*p-a*u-l*f-A*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){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,A=a(r/2),c=a(i/2),u=a(s/2),f=l(r/2),h=l(i/2),p=l(s/2);switch(o){case"XYZ":this._x=f*c*u+A*h*p,this._y=A*h*u-f*c*p,this._z=A*c*p+f*h*u,this._w=A*c*u-f*h*p;break;case"YXZ":this._x=f*c*u+A*h*p,this._y=A*h*u-f*c*p,this._z=A*c*p-f*h*u,this._w=A*c*u+f*h*p;break;case"ZXY":this._x=f*c*u-A*h*p,this._y=A*h*u+f*c*p,this._z=A*c*p+f*h*u,this._w=A*c*u-f*h*p;break;case"ZYX":this._x=f*c*u-A*h*p,this._y=A*h*u+f*c*p,this._z=A*c*p-f*h*u,this._w=A*c*u+f*h*p;break;case"YZX":this._x=f*c*u+A*h*p,this._y=A*h*u+f*c*p,this._z=A*c*p-f*h*u,this._w=A*c*u-f*h*p;break;case"XZY":this._x=f*c*u-A*h*p,this._y=A*h*u-f*c*p,this._z=A*c*p+f*h*u,this._w=A*c*u+f*h*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&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],A=t[2],c=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=(c-l)*h,this._y=(s-A)*h,this._z=(o-i)*h}else if(r>a&&r>u){const h=2*Math.sqrt(1+r-a-u);this._w=(c-l)/h,this._x=.25*h,this._y=(i+o)/h,this._z=(s+A)/h}else if(a>u){const h=2*Math.sqrt(1+a-r-u);this._w=(s-A)/h,this._x=(i+o)/h,this._y=.25*h,this._z=(l+c)/h}else{const h=2*Math.sqrt(1+u-r-a);this._w=(o-i)/h,this._x=(s+A)/h,this._y=(l+c)/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(hr(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,A=t._z,c=t._w;return this._x=r*c+o*a+i*A-s*l,this._y=i*c+o*l+s*a-r*A,this._z=s*c+o*A+r*l-i*a,this._w=o*c-r*a-i*l-s*A,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._onChangeCallback(),this}const A=Math.sqrt(l),c=Math.atan2(A,a),u=Math.sin((1-t)*c)/A,f=Math.sin(t*c)/A;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=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),r*Math.sin(s),r*Math.cos(s),t*Math.sin(i))}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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Z{constructor(e=0,t=0,r=0){Z.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(OF.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(OF.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,A=l*t+o*i-a*r,c=l*r+a*t-s*i,u=l*i+s*r-o*t,f=-s*t-o*r-a*i;return this.x=A*l+f*-s+c*-a-u*-o,this.y=c*l+f*-o+u*-s-A*-a,this.z=u*l+f*-a+A*-o-c*-s,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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 K1.copy(this).projectOnVector(e),this.sub(K1)}reflect(e){return this.sub(K1.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(hr(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}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()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const K1=new Z,OF=new rt;class ps{constructor(e=new Z(1/0,1/0,1/0),t=new Z(-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){let t=1/0,r=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,A=e.length;ls&&(s=c),u>o&&(o=u),f>a&&(a=f)}return this.min.set(t,r,i),this.max.set(s,o,a),this}setFromBufferAttribute(e){let t=1/0,r=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,A=e.count;ls&&(s=c),u>o&&(o=u),f>a&&(a=f)}return this.min.set(t,r,i),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;tthis.max.x||e.ythis.max.y||e.zthis.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,rc),rc.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(Ld),d0.subVectors(this.max,Ld),bu.subVectors(e.a,Ld),Bu.subVectors(e.b,Ld),Eu.subVectors(e.c,Ld),Ll.subVectors(Bu,bu),Pl.subVectors(Eu,Bu),ic.subVectors(bu,Eu);let t=[0,-Ll.z,Ll.y,0,-Pl.z,Pl.y,0,-ic.z,ic.y,Ll.z,0,-Ll.x,Pl.z,0,-Pl.x,ic.z,0,-ic.x,-Ll.y,Ll.x,0,-Pl.y,Pl.x,0,-ic.y,ic.x,0];return!Y1(t,bu,Bu,Eu,d0)||(t=[1,0,0,0,1,0,0,0,1],!Y1(t,bu,Bu,Eu,d0))?!1:(p0.crossVectors(Ll,Pl),t=[p0.x,p0.y,p0.z],Y1(t,bu,Bu,Eu,d0))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return rc.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(rc).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:(Ta[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ta[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ta[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ta[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ta[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ta[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ta[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ta[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ta),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 Ta=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],rc=new Z,$1=new ps,bu=new Z,Bu=new Z,Eu=new Z,Ll=new Z,Pl=new Z,ic=new Z,Ld=new Z,d0=new Z,p0=new Z,sc=new Z;function Y1(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){sc.fromArray(n,s);const a=i.x*Math.abs(sc.x)+i.y*Math.abs(sc.y)+i.z*Math.abs(sc.z),l=e.dot(sc),A=t.dot(sc),c=r.dot(sc);if(Math.max(-Math.max(l,A,c),Math.min(l,A,c))>a)return!1}return!0}const IX=new ps,Pd=new Z,X1=new Z;class su{constructor(e=new Z,t=-1){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):IX.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;Pd.subVectors(e,this.center);const t=Pd.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Pd,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):(X1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Pd.copy(e.center).add(X1)),this.expandByPoint(Pd.copy(e.center).sub(X1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ia=new Z,Z1=new Z,m0=new Z,Dl=new Z,J1=new Z,g0=new Z,q1=new Z;class mg{constructor(e=new Z,t=new Z(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.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ia)),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.direction).multiplyScalar(r).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ia.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ia.copy(this.direction).multiplyScalar(t).add(this.origin),Ia.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){Z1.copy(e).add(t).multiplyScalar(.5),m0.copy(t).sub(e).normalize(),Dl.copy(this.origin).sub(Z1);const s=e.distanceTo(t)*.5,o=-this.direction.dot(m0),a=Dl.dot(this.direction),l=-Dl.dot(m0),A=Dl.lengthSq(),c=Math.abs(1-o*o);let u,f,h,p;if(c>0)if(u=o*l-a,f=o*a-l,p=s*c,u>=0)if(f>=-p)if(f<=p){const d=1/c;u*=d,f*=d,h=u*(u+o*f+2*a)+f*(o*u+f+2*l)+A}else f=s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+A;else f=-s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+A;else f<=-p?(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)+A):f<=p?(u=0,f=Math.min(Math.max(-s,-l),s),h=f*(f+2*l)+A):(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)+A);else f=o>0?-s:s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+A;return r&&r.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(m0).multiplyScalar(f).add(Z1),h}intersectSphere(e,t){Ia.subVectors(e.center,this.origin);const r=Ia.dot(this.direction),i=Ia.dot(Ia)-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 a<0&&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 A=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,f=this.origin;return A>=0?(r=(e.min.x-f.x)*A,i=(e.max.x-f.x)*A):(r=(e.max.x-f.x)*A,i=(e.min.x-f.x)*A),c>=0?(s=(e.min.y-f.y)*c,o=(e.max.y-f.y)*c):(s=(e.max.y-f.y)*c,o=(e.min.y-f.y)*c),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,Ia)!==null}intersectTriangle(e,t,r,i,s){J1.subVectors(t,e),g0.subVectors(r,e),q1.crossVectors(J1,g0);let o=this.direction.dot(q1),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Dl.subVectors(this.origin,e);const l=a*this.direction.dot(g0.crossVectors(Dl,g0));if(l<0)return null;const A=a*this.direction.dot(J1.cross(Dl));if(A<0||l+A>o)return null;const c=-a*Dl.dot(q1);return c<0?null:this.at(c/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 je{constructor(){je.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,r,i,s,o,a,l,A,c,u,f,h,p,d,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=r,m[12]=i,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=A,m[6]=c,m[10]=u,m[14]=f,m[3]=h,m[7]=p,m[11]=d,m[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 je().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/Cu.setFromMatrixColumn(e,0).length(),s=1/Cu.setFromMatrixColumn(e,1).length(),o=1/Cu.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),A=Math.sin(i),c=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const f=o*c,h=o*u,p=a*c,d=a*u;t[0]=l*c,t[4]=-l*u,t[8]=A,t[1]=h+p*A,t[5]=f-d*A,t[9]=-a*l,t[2]=d-f*A,t[6]=p+h*A,t[10]=o*l}else if(e.order==="YXZ"){const f=l*c,h=l*u,p=A*c,d=A*u;t[0]=f+d*a,t[4]=p*a-h,t[8]=o*A,t[1]=o*u,t[5]=o*c,t[9]=-a,t[2]=h*a-p,t[6]=d+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*c,h=l*u,p=A*c,d=A*u;t[0]=f-d*a,t[4]=-o*u,t[8]=p+h*a,t[1]=h+p*a,t[5]=o*c,t[9]=d-f*a,t[2]=-o*A,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*c,h=o*u,p=a*c,d=a*u;t[0]=l*c,t[4]=p*A-h,t[8]=f*A+d,t[1]=l*u,t[5]=d*A+f,t[9]=h*A-p,t[2]=-A,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,h=o*A,p=a*l,d=a*A;t[0]=l*c,t[4]=d-f*u,t[8]=p*u+h,t[1]=u,t[5]=o*c,t[9]=-a*c,t[2]=-A*c,t[6]=h*u+p,t[10]=f-d*u}else if(e.order==="XZY"){const f=o*l,h=o*A,p=a*l,d=a*A;t[0]=l*c,t[4]=-u,t[8]=A*c,t[1]=f*u+d,t[5]=o*c,t[9]=h*u-p,t[2]=p*u-h,t[6]=a*c,t[10]=d*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(RX,e,FX)}lookAt(e,t,r){const i=this.elements;return Oi.subVectors(e,t),Oi.lengthSq()===0&&(Oi.z=1),Oi.normalize(),Ol.crossVectors(r,Oi),Ol.lengthSq()===0&&(Math.abs(r.z)===1?Oi.x+=1e-4:Oi.z+=1e-4,Oi.normalize(),Ol.crossVectors(r,Oi)),Ol.normalize(),v0.crossVectors(Oi,Ol),i[0]=Ol.x,i[4]=v0.x,i[8]=Oi.x,i[1]=Ol.y,i[5]=v0.y,i[9]=Oi.y,i[2]=Ol.z,i[6]=v0.z,i[10]=Oi.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],A=r[12],c=r[1],u=r[5],f=r[9],h=r[13],p=r[2],d=r[6],g=r[10],m=r[14],y=r[3],w=r[7],x=r[11],_=r[15],C=i[0],S=i[4],b=i[8],M=i[12],D=i[1],$=i[5],H=i[9],I=i[13],v=i[2],E=i[6],U=i[10],P=i[14],L=i[3],z=i[7],K=i[11],O=i[15];return s[0]=o*C+a*D+l*v+A*L,s[4]=o*S+a*$+l*E+A*z,s[8]=o*b+a*H+l*U+A*K,s[12]=o*M+a*I+l*P+A*O,s[1]=c*C+u*D+f*v+h*L,s[5]=c*S+u*$+f*E+h*z,s[9]=c*b+u*H+f*U+h*K,s[13]=c*M+u*I+f*P+h*O,s[2]=p*C+d*D+g*v+m*L,s[6]=p*S+d*$+g*E+m*z,s[10]=p*b+d*H+g*U+m*K,s[14]=p*M+d*I+g*P+m*O,s[3]=y*C+w*D+x*v+_*L,s[7]=y*S+w*$+x*E+_*z,s[11]=y*b+w*H+x*U+_*K,s[15]=y*M+w*I+x*P+_*O,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],A=e[13],c=e[2],u=e[6],f=e[10],h=e[14],p=e[3],d=e[7],g=e[11],m=e[15];return p*(+s*l*u-i*A*u-s*a*f+r*A*f+i*a*h-r*l*h)+d*(+t*l*h-t*A*f+s*o*f-i*o*h+i*A*c-s*l*c)+g*(+t*A*u-t*a*h-s*o*u+r*o*h+s*a*c-r*A*c)+m*(-i*a*c-t*l*u+t*a*f+i*o*u-r*o*f+r*l*c)}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],A=e[7],c=e[8],u=e[9],f=e[10],h=e[11],p=e[12],d=e[13],g=e[14],m=e[15],y=u*g*A-d*f*A+d*l*h-a*g*h-u*l*m+a*f*m,w=p*f*A-c*g*A-p*l*h+o*g*h+c*l*m-o*f*m,x=c*d*A-p*u*A+p*a*h-o*d*h-c*a*m+o*u*m,_=p*u*l-c*d*l-p*a*f+o*d*f+c*a*g-o*u*g,C=t*y+r*w+i*x+s*_;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/C;return e[0]=y*S,e[1]=(d*f*s-u*g*s-d*i*h+r*g*h+u*i*m-r*f*m)*S,e[2]=(a*g*s-d*l*s+d*i*A-r*g*A-a*i*m+r*l*m)*S,e[3]=(u*l*s-a*f*s-u*i*A+r*f*A+a*i*h-r*l*h)*S,e[4]=w*S,e[5]=(c*g*s-p*f*s+p*i*h-t*g*h-c*i*m+t*f*m)*S,e[6]=(p*l*s-o*g*s-p*i*A+t*g*A+o*i*m-t*l*m)*S,e[7]=(o*f*s-c*l*s+c*i*A-t*f*A-o*i*h+t*l*h)*S,e[8]=x*S,e[9]=(p*u*s-c*d*s-p*r*h+t*d*h+c*r*m-t*u*m)*S,e[10]=(o*d*s-p*a*s+p*r*A-t*d*A-o*r*m+t*a*m)*S,e[11]=(c*a*s-o*u*s-c*r*A+t*u*A+o*r*h-t*a*h)*S,e[12]=_*S,e[13]=(c*d*i-p*u*i+p*r*f-t*d*f-c*r*g+t*u*g)*S,e[14]=(p*a*i-o*d*i-p*r*l+t*d*l+o*r*g-t*a*g)*S,e[15]=(o*u*i-c*a*i+c*r*l-t*u*l-o*r*f+t*a*f)*S,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 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,A=s*o,c=s*a;return this.set(A*o+r,A*a-i*l,A*l+i*a,0,A*a+i*l,c*a+r,c*l-i*o,0,A*l-i*a,c*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,A=s+s,c=o+o,u=a+a,f=s*A,h=s*c,p=s*u,d=o*c,g=o*u,m=a*u,y=l*A,w=l*c,x=l*u,_=r.x,C=r.y,S=r.z;return i[0]=(1-(d+m))*_,i[1]=(h+x)*_,i[2]=(p-w)*_,i[3]=0,i[4]=(h-x)*C,i[5]=(1-(f+m))*C,i[6]=(g+y)*C,i[7]=0,i[8]=(p+w)*S,i[9]=(g-y)*S,i[10]=(1-(f+d))*S,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=Cu.set(i[0],i[1],i[2]).length();const o=Cu.set(i[4],i[5],i[6]).length(),a=Cu.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],oo.copy(this);const A=1/s,c=1/o,u=1/a;return oo.elements[0]*=A,oo.elements[1]*=A,oo.elements[2]*=A,oo.elements[4]*=c,oo.elements[5]*=c,oo.elements[6]*=c,oo.elements[8]*=u,oo.elements[9]*=u,oo.elements[10]*=u,t.setFromRotationMatrix(oo),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o){const a=this.elements,l=2*s/(t-e),A=2*s/(r-i),c=(t+e)/(t-e),u=(r+i)/(r-i),f=-(o+s)/(o-s),h=-2*o*s/(o-s);return a[0]=l,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=A,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=f,a[14]=h,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,r,i,s,o){const a=this.elements,l=1/(t-e),A=1/(r-i),c=1/(o-s),u=(t+e)*l,f=(r+i)*A,h=(o+s)*c;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*A,a[9]=0,a[13]=-f,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-h,a[3]=0,a[7]=0,a[11]=0,a[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 Cu=new Z,oo=new je,RX=new Z(0,0,0),FX=new Z(1,1,1),Ol=new Z,v0=new Z,Oi=new Z,NF=new je,kF=new rt;class fi{constructor(e=0,t=0,r=0,i=fi.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],A=i[5],c=i[9],u=i[2],f=i[6],h=i[10];switch(t){case"XYZ":this._y=Math.asin(hr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,h),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,A),this._z=0);break;case"YXZ":this._x=Math.asin(-hr(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,A)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(hr(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-o,A)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-hr(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,A));break;case"YZX":this._z=Math.asin(hr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,A),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-hr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,A),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,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 NF.makeRotationFromQuaternion(e),this.setFromRotationMatrix(NF,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return kF.setFromEuler(this),this.setFromQuaternion(kF,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}}fi.DEFAULT_ORDER="XYZ";class XM{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&&(r=r.concat(o))}return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Dd,e,LX),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Dd,PX,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let r=0,i=t.length;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.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()));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 A=0,c=l.length;A0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),A.length>0&&(r.textures=A),c.length>0&&(r.images=c),u.length>0&&(r.shapes=u),f.length>0&&(r.skeletons=f),h.length>0&&(r.animations=h),p.length>0&&(r.nodes=p)}return r.object=i,r;function o(a){const l=[];for(const A in a){const c=a[A];delete c.metadata,l.push(c)}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.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.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){ao.subVectors(i,t),Fa.subVectors(r,t),eb.subVectors(e,t);const o=ao.dot(ao),a=ao.dot(Fa),l=ao.dot(eb),A=Fa.dot(Fa),c=Fa.dot(eb),u=o*A-a*a;if(u===0)return s.set(-2,-1,-1);const f=1/u,h=(A*l-a*c)*f,p=(o*c-a*l)*f;return s.set(1-h-p,p,h)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,Ua),Ua.x>=0&&Ua.y>=0&&Ua.x+Ua.y<=1}static getUV(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,Ua),l.set(0,0),l.addScaledVector(s,Ua.x),l.addScaledVector(o,Ua.y),l.addScaledVector(a,Ua.z),l}static isFrontFacing(e,t,r,i){return ao.subVectors(r,t),Fa.subVectors(e,t),ao.cross(Fa).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 ao.subVectors(this.c,this.b),Fa.subVectors(this.a,this.b),ao.cross(Fa).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Xi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Xi.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,s){return Xi.getUV(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Xi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Xi.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;Mu.subVectors(i,r),Tu.subVectors(s,r),tb.subVectors(e,r);const l=Mu.dot(tb),A=Tu.dot(tb);if(l<=0&&A<=0)return t.copy(r);nb.subVectors(e,i);const c=Mu.dot(nb),u=Tu.dot(nb);if(c>=0&&u<=c)return t.copy(i);const f=l*u-c*A;if(f<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(r).addScaledVector(Mu,o);rb.subVectors(e,s);const h=Mu.dot(rb),p=Tu.dot(rb);if(p>=0&&h<=p)return t.copy(s);const d=h*A-l*p;if(d<=0&&A>=0&&p<=0)return a=A/(A-p),t.copy(r).addScaledVector(Tu,a);const g=c*p-h*u;if(g<=0&&u-c>=0&&h-p>=0)return jF.subVectors(s,i),a=(u-c)/(u-c+(h-p)),t.copy(i).addScaledVector(jF,a);const m=1/(g+d+f);return o=d*m,a=f*m,t.copy(r).addScaledVector(Mu,o).addScaledVector(Tu,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let OX=0,is=class extends YA{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:OX++}),this.uuid=Eo(),this.name="",this.type="Material",this.blending=ah,this.side=ls,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=aH,this.blendDst=lH,this.blendEquation=tf,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=nC,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=hX,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=z1,this.stencilZFail=z1,this.stencilZPass=z1,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}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: '"+t+"' parameter is undefined.");continue}const i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");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.5,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&&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.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.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.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!==ah&&(r.blending=this.blending),this.side!==ls&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,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.alphaToCoverage===!0&&(r.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(r.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(r.wireframe=this.wireframe),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=this.flatShading),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.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.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++}};class Ei extends is{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Qe(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.combine=Nx,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.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 Xn=new Z,w0=new $e;class At{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=sC,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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}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 A in l)l[A]!==void 0&&(e[A]=l[A]);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 A=r[l];e.data.attributes[l]=A.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const A=this.morphAttributes[l],c=[];for(let u=0,f=A.length;u0&&(i[l]=c,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 A in i){const c=i[A];this.setAttribute(A,c.clone(t))}const s=e.morphAttributes;for(const A in s){const c=[],u=s[A];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;st.far?null:{distance:A,point:E0.clone(),object:n}}function C0(n,e,t,r,i,s,o,a,l){n.getVertexPosition(o,Nd),n.getVertexPosition(a,kd),n.getVertexPosition(l,Qd);const A=kX(n,e,t,r,Nd,kd,Qd,ab);if(A){i&&(_0.fromBufferAttribute(i,o),b0.fromBufferAttribute(i,a),B0.fromBufferAttribute(i,l),A.uv=Xi.getUV(ab,Nd,kd,Qd,_0,b0,B0,new $e)),s&&(_0.fromBufferAttribute(s,o),b0.fromBufferAttribute(s,a),B0.fromBufferAttribute(s,l),A.uv2=Xi.getUV(ab,Nd,kd,Qd,_0,b0,B0,new $e));const c={a:o,b:a,c:l,normal:new Z,materialIndex:0};Xi.getNormal(Nd,kd,Qd,c.normal),A.face=c}return A}class gg extends $t{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=[],A=[],c=[],u=[];let f=0,h=0;p("z","y","x",-1,-1,r,t,e,o,s,0),p("z","y","x",1,-1,r,t,-e,o,s,1),p("x","z","y",1,1,e,r,t,i,o,2),p("x","z","y",1,-1,e,r,-t,i,o,3),p("x","y","z",1,-1,e,t,r,i,s,4),p("x","y","z",-1,-1,e,t,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new an(A,3)),this.setAttribute("normal",new an(c,3)),this.setAttribute("uv",new an(u,2));function p(d,g,m,y,w,x,_,C,S,b,M){const D=x/S,$=_/b,H=x/2,I=_/2,v=C/2,E=S+1,U=b+1;let P=0,L=0;const z=new Z;for(let K=0;K0?1:-1,c.push(z.x,z.y,z.z),u.push(B/S),u.push(1-K/b),P+=1}}for(let K=0;K>8&255]+Hr[n>>16&255]+Hr[n>>24&255]+"-"+Hr[e&255]+Hr[e>>8&255]+"-"+Hr[e>>16&15|64]+Hr[e>>24&255]+"-"+Hr[t&63|128]+Hr[t>>8&255]+"-"+Hr[t>>16&255]+Hr[t>>24&255]+Hr[r&255]+Hr[r>>8&255]+Hr[r>>16&255]+Hr[r>>24&255]).toLowerCase()}function hr(n,e,t){return Math.max(e,Math.min(t,n))}function $M(n,e){return(n%e+e)%e}function pX(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function mX(n,e,t){return n!==e?(t-n)/(e-n):0}function nm(n,e,t){return(1-t)*n+t*e}function gX(n,e,t,r){return nm(n,e,1-Math.exp(-t*r))}function vX(n,e=1){return e-Math.abs($M(n,e*2)-e)}function yX(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function wX(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function xX(n,e){return n+Math.floor(Math.random()*(e-n+1))}function _X(n,e){return n+Math.random()*(e-n)}function bX(n){return n*(.5-Math.random())}function BX(n){n!==void 0&&(DF=n);let e=DF+=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 EX(n){return n*tm}function CX(n){return n*Hm}function aC(n){return(n&n-1)===0&&n!==0}function fH(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function vw(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function SX(n,e,t,r,i){const s=Math.cos,o=Math.sin,a=s(t/2),l=o(t/2),A=s((e+r)/2),c=o((e+r)/2),u=s((e-r)/2),f=o((e-r)/2),h=s((r-e)/2),p=o((r-e)/2);switch(i){case"XYX":n.set(a*c,l*u,l*f,a*A);break;case"YZY":n.set(l*f,a*c,l*u,a*A);break;case"ZXZ":n.set(l*u,l*f,a*c,a*A);break;case"XZX":n.set(a*c,l*p,l*h,a*A);break;case"YXY":n.set(l*h,a*c,l*p,a*A);break;case"ZYZ":n.set(l*p,l*h,a*c,a*A);break;default:console.warn("THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: "+i)}}function ol(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return n/65535;case Uint8Array:return n/255;case Int16Array:return Math.max(n/32767,-1);case Int8Array:return Math.max(n/127,-1);default:throw new Error("Invalid component type.")}}function nn(n,e){switch(e.constructor){case Float32Array:return n;case Uint16Array:return Math.round(n*65535);case Uint8Array:return Math.round(n*255);case Int16Array:return Math.round(n*32767);case Int8Array:return Math.round(n*127);default:throw new Error("Invalid component type.")}}var Lt=Object.freeze({__proto__:null,DEG2RAD:tm,RAD2DEG:Hm,ceilPowerOfTwo:fH,clamp:hr,damp:gX,degToRad:EX,denormalize:ol,euclideanModulo:$M,floorPowerOfTwo:vw,generateUUID:Co,inverseLerp:mX,isPowerOfTwo:aC,lerp:nm,mapLinear:pX,normalize:nn,pingpong:vX,radToDeg:CX,randFloat:_X,randFloatSpread:bX,randInt:xX,seededRandom:BX,setQuaternionFromProperEuler:SX,smootherstep:wX,smoothstep:yX});class $e{constructor(e=0,t=0){$e.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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(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}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 En{constructor(){En.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1]}set(e,t,r,i,s,o,a,l,A){const c=this.elements;return c[0]=e,c[1]=i,c[2]=a,c[3]=t,c[4]=s,c[5]=l,c[6]=r,c[7]=o,c[8]=A,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],A=r[1],c=r[4],u=r[7],f=r[2],h=r[5],p=r[8],d=i[0],g=i[3],m=i[6],y=i[1],w=i[4],x=i[7],_=i[2],C=i[5],S=i[8];return s[0]=o*d+a*y+l*_,s[3]=o*g+a*w+l*C,s[6]=o*m+a*x+l*S,s[1]=A*d+c*y+u*_,s[4]=A*g+c*w+u*C,s[7]=A*m+c*x+u*S,s[2]=f*d+h*y+p*_,s[5]=f*g+h*w+p*C,s[8]=f*m+h*x+p*S,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],A=e[7],c=e[8];return t*o*c-t*a*A-r*s*c+r*a*l+i*s*A-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],A=e[7],c=e[8],u=c*o-a*A,f=a*l-c*s,h=A*s-o*l,p=t*u+r*f+i*h;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);const d=1/p;return e[0]=u*d,e[1]=(i*A-c*r)*d,e[2]=(a*r-i*o)*d,e[3]=f*d,e[4]=(c*t-i*l)*d,e[5]=(i*s-a*t)*d,e[6]=h*d,e[7]=(r*l-A*t)*d,e[8]=(o*t-r*s)*d,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),A=Math.sin(s);return this.set(r*l,r*A,-r*(l*o+A*a)+o+e,-i*A,i*l,-i*(-A*o+l*a)+a+t,0,0,1),this}scale(e,t){return this.premultiply(G1.makeScale(e,t)),this}rotate(e){return this.premultiply(G1.makeRotation(-e)),this}translate(e,t){return this.premultiply(G1.makeTranslation(e,t)),this}makeTranslation(e,t){return 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 G1=new En;function hH(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function zm(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Oc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function ay(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const V1={[jo]:{[Qm]:Oc},[Qm]:{[jo]:ay}},ei={legacyMode:!0,get workingColorSpace(){return Qm},set workingColorSpace(n){console.warn("THREE.ColorManagement: .workingColorSpace is readonly.")},convert:function(n,e,t){if(this.legacyMode||e===t||!e||!t)return n;if(V1[e]&&V1[e][t]!==void 0){const r=V1[e][t];return n.r=r(n.r),n.g=r(n.g),n.b=r(n.b),n}throw new Error("Unsupported color space conversion.")},fromWorkingColorSpace:function(n,e){return this.convert(n,this.workingColorSpace,e)},toWorkingColorSpace:function(n,e){return this.convert(n,e,this.workingColorSpace)}},dH={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},Ar={r:0,g:0,b:0},oo={h:0,s:0,l:0},h0={h:0,s:0,l:0};function j1(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}function d0(n,e){return e.r=n.r,e.g=n.g,e.b=n.b,e}class Qe{constructor(e,t,r){return this.isColor=!0,this.r=1,this.g=1,this.b=1,t===void 0&&r===void 0?this.set(e):this.setRGB(e,t,r)}set(e){return e&&e.isColor?this.copy(e):typeof e=="number"?this.setHex(e):typeof e=="string"&&this.setStyle(e),this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=jo){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ei.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=ei.workingColorSpace){return this.r=e,this.g=t,this.b=r,ei.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=ei.workingColorSpace){if(e=$M(e,1),t=hr(t,0,1),r=hr(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=j1(o,s,e+1/3),this.g=j1(o,s,e),this.b=j1(o,s,e-1/3)}return ei.toWorkingColorSpace(this,i),this}setStyle(e,t=jo){function r(s){s!==void 0&&parseFloat(s)<1&&console.warn("THREE.Color: Alpha component of "+e+" will be ignored.")}let i;if(i=/^((?:rgb|hsl)a?)\(([^\)]*)\)/.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 this.r=Math.min(255,parseInt(s[1],10))/255,this.g=Math.min(255,parseInt(s[2],10))/255,this.b=Math.min(255,parseInt(s[3],10))/255,ei.toWorkingColorSpace(this,t),r(s[4]),this;if(s=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(a))return this.r=Math.min(100,parseInt(s[1],10))/100,this.g=Math.min(100,parseInt(s[2],10))/100,this.b=Math.min(100,parseInt(s[3],10))/100,ei.toWorkingColorSpace(this,t),r(s[4]),this;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)){const l=parseFloat(s[1])/360,A=parseFloat(s[2])/100,c=parseFloat(s[3])/100;return r(s[4]),this.setHSL(l,A,c,t)}break}}else if(i=/^\#([A-Fa-f\d]+)$/.exec(e)){const s=i[1],o=s.length;if(o===3)return this.r=parseInt(s.charAt(0)+s.charAt(0),16)/255,this.g=parseInt(s.charAt(1)+s.charAt(1),16)/255,this.b=parseInt(s.charAt(2)+s.charAt(2),16)/255,ei.toWorkingColorSpace(this,t),this;if(o===6)return this.r=parseInt(s.charAt(0)+s.charAt(1),16)/255,this.g=parseInt(s.charAt(2)+s.charAt(3),16)/255,this.b=parseInt(s.charAt(4)+s.charAt(5),16)/255,ei.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=jo){const r=dH[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=Oc(e.r),this.g=Oc(e.g),this.b=Oc(e.b),this}copyLinearToSRGB(e){return this.r=ay(e.r),this.g=ay(e.g),this.b=ay(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=jo){return ei.fromWorkingColorSpace(d0(this,Ar),e),hr(Ar.r*255,0,255)<<16^hr(Ar.g*255,0,255)<<8^hr(Ar.b*255,0,255)<<0}getHexString(e=jo){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ei.workingColorSpace){ei.fromWorkingColorSpace(d0(this,Ar),t);const r=Ar.r,i=Ar.g,s=Ar.b,o=Math.max(r,i,s),a=Math.min(r,i,s);let l,A;const c=(a+o)/2;if(a===o)l=0,A=0;else{const u=o-a;switch(A=c<=.5?u/(o+a):u/(2-o-a),o){case r:l=(i-s)/u+(i"u")return e.src;let t;if(e instanceof HTMLCanvasElement)t=e;else{bu===void 0&&(bu=zm("canvas")),bu.width=e.width,bu.height=e.height;const r=bu.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=bu}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=zm("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!==AH)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case As:e.x=e.x-Math.floor(e.x);break;case Ai:e.x=e.x<0?0:1;break;case Nm: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 As:e.y=e.y-Math.floor(e.y);break;case Ai:e.y=e.y<0?0:1;break;case Nm: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)}}Qn.DEFAULT_IMAGE=null;Qn.DEFAULT_MAPPING=AH;Qn.DEFAULT_ANISOTROPY=1;class Qt{constructor(e=0,t=0,r=0,i=1){Qt.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,A=l[0],c=l[4],u=l[8],f=l[1],h=l[5],p=l[9],d=l[2],g=l[6],m=l[10];if(Math.abs(c-f)<.01&&Math.abs(u-d)<.01&&Math.abs(p-g)<.01){if(Math.abs(c+f)<.1&&Math.abs(u+d)<.1&&Math.abs(p+g)<.1&&Math.abs(A+h+m-3)<.1)return this.set(1,0,0,0),this;t=Math.PI;const w=(A+1)/2,x=(h+1)/2,_=(m+1)/2,C=(c+f)/4,S=(u+d)/4,b=(p+g)/4;return w>x&&w>_?w<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(w),i=C/r,s=S/r):x>_?x<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),r=C/i,s=b/i):_<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(_),r=S/s,i=b/s),this.set(r,i,s,t),this}let y=Math.sqrt((g-p)*(g-p)+(u-d)*(u-d)+(f-c)*(f-c));return Math.abs(y)<.001&&(y=1),this.x=(g-p)/y,this.y=(u-d)/y,this.z=(f-c)/y,this.w=Math.acos((A+h+m-1)/2),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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(this.z),this.w=this.w<0?Math.ceil(this.w):Math.floor(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 ga extends XA{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Qt(0,0,e,t),this.scissorTest=!1,this.viewport=new Qt(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new Qn(i,r.mapping,r.wrapS,r.wrapT,r.magFilter,r.minFilter,r.format,r.type,r.anisotropy,r.encoding),this.texture.isRenderTargetTexture=!0,this.texture.flipY=!1,this.texture.generateMipmaps=r.generateMipmaps!==void 0?r.generateMipmaps:!1,this.texture.internalFormat=r.internalFormat!==void 0?r.internalFormat:null,this.texture.minFilter=r.minFilter!==void 0?r.minFilter:si,this.depthBuffer=r.depthBuffer!==void 0?r.depthBuffer:!0,this.stencilBuffer=r.stencilBuffer!==void 0?r.stencilBuffer:!1,this.depthTexture=r.depthTexture!==void 0?r.depthTexture:null,this.samples=r.samples!==void 0?r.samples:0}setSize(e,t,r=1){(this.width!==e||this.height!==t||this.depth!==r)&&(this.width=e,this.height=t,this.depth=r,this.texture.image.width=e,this.texture.image.height=t,this.texture.image.depth=r,this.dispose()),this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.viewport.copy(e.viewport),this.texture=e.texture.clone(),this.texture.isRenderTargetTexture=!0;const t=Object.assign({},e.texture.image);return this.texture.source=new YM(t),this.depthBuffer=e.depthBuffer,this.stencilBuffer=e.stencilBuffer,e.depthTexture!==null&&(this.depthTexture=e.depthTexture.clone()),this.samples=e.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class mH extends Qn{constructor(e=null,t=1,r=1,i=1){super(null),this.isDataArrayTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=$n,this.minFilter=$n,this.wrapR=Ai,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class TX extends Qn{constructor(e=null,t=1,r=1,i=1){super(null),this.isData3DTexture=!0,this.image={data:e,width:t,height:r,depth:i},this.magFilter=$n,this.minFilter=$n,this.wrapR=Ai,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rt{constructor(e=0,t=0,r=0,i=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=r,this._w=i}static slerpFlat(e,t,r,i,s,o,a){let l=r[i+0],A=r[i+1],c=r[i+2],u=r[i+3];const f=s[o+0],h=s[o+1],p=s[o+2],d=s[o+3];if(a===0){e[t+0]=l,e[t+1]=A,e[t+2]=c,e[t+3]=u;return}if(a===1){e[t+0]=f,e[t+1]=h,e[t+2]=p,e[t+3]=d;return}if(u!==d||l!==f||A!==h||c!==p){let g=1-a;const m=l*f+A*h+c*p+u*d,y=m>=0?1:-1,w=1-m*m;if(w>Number.EPSILON){const _=Math.sqrt(w),C=Math.atan2(_,m*y);g=Math.sin(g*C)/_,a=Math.sin(a*C)/_}const x=a*y;if(l=l*g+f*x,A=A*g+h*x,c=c*g+p*x,u=u*g+d*x,g===1-a){const _=1/Math.sqrt(l*l+A*A+c*c+u*u);l*=_,A*=_,c*=_,u*=_}}e[t]=l,e[t+1]=A,e[t+2]=c,e[t+3]=u}static multiplyQuaternionsFlat(e,t,r,i,s,o){const a=r[i],l=r[i+1],A=r[i+2],c=r[i+3],u=s[o],f=s[o+1],h=s[o+2],p=s[o+3];return e[t]=a*p+c*u+l*h-A*f,e[t+1]=l*p+c*f+A*u-a*h,e[t+2]=A*p+c*h+a*f-l*u,e[t+3]=c*p-a*u-l*f-A*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){const r=e._x,i=e._y,s=e._z,o=e._order,a=Math.cos,l=Math.sin,A=a(r/2),c=a(i/2),u=a(s/2),f=l(r/2),h=l(i/2),p=l(s/2);switch(o){case"XYZ":this._x=f*c*u+A*h*p,this._y=A*h*u-f*c*p,this._z=A*c*p+f*h*u,this._w=A*c*u-f*h*p;break;case"YXZ":this._x=f*c*u+A*h*p,this._y=A*h*u-f*c*p,this._z=A*c*p-f*h*u,this._w=A*c*u+f*h*p;break;case"ZXY":this._x=f*c*u-A*h*p,this._y=A*h*u+f*c*p,this._z=A*c*p+f*h*u,this._w=A*c*u-f*h*p;break;case"ZYX":this._x=f*c*u-A*h*p,this._y=A*h*u+f*c*p,this._z=A*c*p-f*h*u,this._w=A*c*u+f*h*p;break;case"YZX":this._x=f*c*u+A*h*p,this._y=A*h*u+f*c*p,this._z=A*c*p-f*h*u,this._w=A*c*u-f*h*p;break;case"XZY":this._x=f*c*u-A*h*p,this._y=A*h*u-f*c*p,this._z=A*c*p+f*h*u,this._w=A*c*u+f*h*p;break;default:console.warn("THREE.Quaternion: .setFromEuler() encountered an unknown order: "+o)}return t!==!1&&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],A=t[2],c=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=(c-l)*h,this._y=(s-A)*h,this._z=(o-i)*h}else if(r>a&&r>u){const h=2*Math.sqrt(1+r-a-u);this._w=(c-l)/h,this._x=.25*h,this._y=(i+o)/h,this._z=(s+A)/h}else if(a>u){const h=2*Math.sqrt(1+a-r-u);this._w=(s-A)/h,this._x=(i+o)/h,this._y=.25*h,this._z=(l+c)/h}else{const h=2*Math.sqrt(1+u-r-a);this._w=(o-i)/h,this._x=(s+A)/h,this._y=(l+c)/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(hr(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,A=t._z,c=t._w;return this._x=r*c+o*a+i*A-s*l,this._y=i*c+o*l+s*a-r*A,this._z=s*c+o*A+r*l-i*a,this._w=o*c-r*a-i*l-s*A,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._onChangeCallback(),this}const A=Math.sqrt(l),c=Math.atan2(A,a),u=Math.sin((1-t)*c)/A,f=Math.sin(t*c)/A;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=Math.random(),t=Math.sqrt(1-e),r=Math.sqrt(e),i=2*Math.PI*Math.random(),s=2*Math.PI*Math.random();return this.set(t*Math.cos(i),r*Math.sin(s),r*Math.cos(s),t*Math.sin(i))}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}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class Z{constructor(e=0,t=0,r=0){Z.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(OF.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(OF.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,A=l*t+o*i-a*r,c=l*r+a*t-s*i,u=l*i+s*r-o*t,f=-s*t-o*r-a*i;return this.x=A*l+f*-s+c*-a-u*-o,this.y=c*l+f*-o+u*-s-A*-a,this.z=u*l+f*-a+A*-o-c*-s,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=this.x<0?Math.ceil(this.x):Math.floor(this.x),this.y=this.y<0?Math.ceil(this.y):Math.floor(this.y),this.z=this.z<0?Math.ceil(this.z):Math.floor(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 K1.copy(this).projectOnVector(e),this.sub(K1)}reflect(e){return this.sub(K1.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(hr(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}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()-.5)*2,t=Math.random()*Math.PI*2,r=Math.sqrt(1-e**2);return this.x=r*Math.cos(t),this.y=r*Math.sin(t),this.z=e,this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const K1=new Z,OF=new rt;class ps{constructor(e=new Z(1/0,1/0,1/0),t=new Z(-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){let t=1/0,r=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,A=e.length;ls&&(s=c),u>o&&(o=u),f>a&&(a=f)}return this.min.set(t,r,i),this.max.set(s,o,a),this}setFromBufferAttribute(e){let t=1/0,r=1/0,i=1/0,s=-1/0,o=-1/0,a=-1/0;for(let l=0,A=e.count;ls&&(s=c),u>o&&(o=u),f>a&&(a=f)}return this.min.set(t,r,i),this.max.set(s,o,a),this}setFromPoints(e){this.makeEmpty();for(let t=0,r=e.length;tthis.max.x||e.ythis.max.y||e.zthis.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.xthis.max.x||e.max.ythis.max.y||e.max.zthis.max.z)}intersectsSphere(e){return this.clampPoint(e.center,ic),ic.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(Pd),p0.subVectors(this.max,Pd),Bu.subVectors(e.a,Pd),Eu.subVectors(e.b,Pd),Cu.subVectors(e.c,Pd),Pl.subVectors(Eu,Bu),Dl.subVectors(Cu,Eu),sc.subVectors(Bu,Cu);let t=[0,-Pl.z,Pl.y,0,-Dl.z,Dl.y,0,-sc.z,sc.y,Pl.z,0,-Pl.x,Dl.z,0,-Dl.x,sc.z,0,-sc.x,-Pl.y,Pl.x,0,-Dl.y,Dl.x,0,-sc.y,sc.x,0];return!Y1(t,Bu,Eu,Cu,p0)||(t=[1,0,0,0,1,0,0,0,1],!Y1(t,Bu,Eu,Cu,p0))?!1:(m0.crossVectors(Pl,Dl),t=[m0.x,m0.y,m0.z],Y1(t,Bu,Eu,Cu,p0))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return ic.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(ic).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:(Ia[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ia[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ia[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ia[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ia[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ia[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ia[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ia[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ia),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 Ia=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],ic=new Z,$1=new ps,Bu=new Z,Eu=new Z,Cu=new Z,Pl=new Z,Dl=new Z,sc=new Z,Pd=new Z,p0=new Z,m0=new Z,oc=new Z;function Y1(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){oc.fromArray(n,s);const a=i.x*Math.abs(oc.x)+i.y*Math.abs(oc.y)+i.z*Math.abs(oc.z),l=e.dot(oc),A=t.dot(oc),c=r.dot(oc);if(Math.max(-Math.max(l,A,c),Math.min(l,A,c))>a)return!1}return!0}const IX=new ps,Dd=new Z,X1=new Z;class ou{constructor(e=new Z,t=-1){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):IX.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;Dd.subVectors(e,this.center);const t=Dd.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Dd,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):(X1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Dd.copy(e.center).add(X1)),this.expandByPoint(Dd.copy(e.center).sub(X1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Ra=new Z,Z1=new Z,g0=new Z,Ol=new Z,J1=new Z,v0=new Z,q1=new Z;class gg{constructor(e=new Z,t=new Z(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.direction).multiplyScalar(e).add(this.origin)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Ra)),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.direction).multiplyScalar(r).add(this.origin)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){const t=Ra.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Ra.copy(this.direction).multiplyScalar(t).add(this.origin),Ra.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){Z1.copy(e).add(t).multiplyScalar(.5),g0.copy(t).sub(e).normalize(),Ol.copy(this.origin).sub(Z1);const s=e.distanceTo(t)*.5,o=-this.direction.dot(g0),a=Ol.dot(this.direction),l=-Ol.dot(g0),A=Ol.lengthSq(),c=Math.abs(1-o*o);let u,f,h,p;if(c>0)if(u=o*l-a,f=o*a-l,p=s*c,u>=0)if(f>=-p)if(f<=p){const d=1/c;u*=d,f*=d,h=u*(u+o*f+2*a)+f*(o*u+f+2*l)+A}else f=s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+A;else f=-s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+A;else f<=-p?(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)+A):f<=p?(u=0,f=Math.min(Math.max(-s,-l),s),h=f*(f+2*l)+A):(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)+A);else f=o>0?-s:s,u=Math.max(0,-(o*f+a)),h=-u*u+f*(f+2*l)+A;return r&&r.copy(this.direction).multiplyScalar(u).add(this.origin),i&&i.copy(g0).multiplyScalar(f).add(Z1),h}intersectSphere(e,t){Ra.subVectors(e.center,this.origin);const r=Ra.dot(this.direction),i=Ra.dot(Ra)-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 a<0&&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 A=1/this.direction.x,c=1/this.direction.y,u=1/this.direction.z,f=this.origin;return A>=0?(r=(e.min.x-f.x)*A,i=(e.max.x-f.x)*A):(r=(e.max.x-f.x)*A,i=(e.min.x-f.x)*A),c>=0?(s=(e.min.y-f.y)*c,o=(e.max.y-f.y)*c):(s=(e.max.y-f.y)*c,o=(e.min.y-f.y)*c),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,Ra)!==null}intersectTriangle(e,t,r,i,s){J1.subVectors(t,e),v0.subVectors(r,e),q1.crossVectors(J1,v0);let o=this.direction.dot(q1),a;if(o>0){if(i)return null;a=1}else if(o<0)a=-1,o=-o;else return null;Ol.subVectors(this.origin,e);const l=a*this.direction.dot(v0.crossVectors(Ol,v0));if(l<0)return null;const A=a*this.direction.dot(J1.cross(Ol));if(A<0||l+A>o)return null;const c=-a*Ol.dot(q1);return c<0?null:this.at(c/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 je{constructor(){je.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]}set(e,t,r,i,s,o,a,l,A,c,u,f,h,p,d,g){const m=this.elements;return m[0]=e,m[4]=t,m[8]=r,m[12]=i,m[1]=s,m[5]=o,m[9]=a,m[13]=l,m[2]=A,m[6]=c,m[10]=u,m[14]=f,m[3]=h,m[7]=p,m[11]=d,m[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 je().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/Su.setFromMatrixColumn(e,0).length(),s=1/Su.setFromMatrixColumn(e,1).length(),o=1/Su.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),A=Math.sin(i),c=Math.cos(s),u=Math.sin(s);if(e.order==="XYZ"){const f=o*c,h=o*u,p=a*c,d=a*u;t[0]=l*c,t[4]=-l*u,t[8]=A,t[1]=h+p*A,t[5]=f-d*A,t[9]=-a*l,t[2]=d-f*A,t[6]=p+h*A,t[10]=o*l}else if(e.order==="YXZ"){const f=l*c,h=l*u,p=A*c,d=A*u;t[0]=f+d*a,t[4]=p*a-h,t[8]=o*A,t[1]=o*u,t[5]=o*c,t[9]=-a,t[2]=h*a-p,t[6]=d+f*a,t[10]=o*l}else if(e.order==="ZXY"){const f=l*c,h=l*u,p=A*c,d=A*u;t[0]=f-d*a,t[4]=-o*u,t[8]=p+h*a,t[1]=h+p*a,t[5]=o*c,t[9]=d-f*a,t[2]=-o*A,t[6]=a,t[10]=o*l}else if(e.order==="ZYX"){const f=o*c,h=o*u,p=a*c,d=a*u;t[0]=l*c,t[4]=p*A-h,t[8]=f*A+d,t[1]=l*u,t[5]=d*A+f,t[9]=h*A-p,t[2]=-A,t[6]=a*l,t[10]=o*l}else if(e.order==="YZX"){const f=o*l,h=o*A,p=a*l,d=a*A;t[0]=l*c,t[4]=d-f*u,t[8]=p*u+h,t[1]=u,t[5]=o*c,t[9]=-a*c,t[2]=-A*c,t[6]=h*u+p,t[10]=f-d*u}else if(e.order==="XZY"){const f=o*l,h=o*A,p=a*l,d=a*A;t[0]=l*c,t[4]=-u,t[8]=A*c,t[1]=f*u+d,t[5]=o*c,t[9]=h*u-p,t[2]=p*u-h,t[6]=a*c,t[10]=d*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(RX,e,FX)}lookAt(e,t,r){const i=this.elements;return Oi.subVectors(e,t),Oi.lengthSq()===0&&(Oi.z=1),Oi.normalize(),Nl.crossVectors(r,Oi),Nl.lengthSq()===0&&(Math.abs(r.z)===1?Oi.x+=1e-4:Oi.z+=1e-4,Oi.normalize(),Nl.crossVectors(r,Oi)),Nl.normalize(),y0.crossVectors(Oi,Nl),i[0]=Nl.x,i[4]=y0.x,i[8]=Oi.x,i[1]=Nl.y,i[5]=y0.y,i[9]=Oi.y,i[2]=Nl.z,i[6]=y0.z,i[10]=Oi.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],A=r[12],c=r[1],u=r[5],f=r[9],h=r[13],p=r[2],d=r[6],g=r[10],m=r[14],y=r[3],w=r[7],x=r[11],_=r[15],C=i[0],S=i[4],b=i[8],M=i[12],D=i[1],$=i[5],H=i[9],I=i[13],v=i[2],E=i[6],U=i[10],P=i[14],L=i[3],z=i[7],K=i[11],O=i[15];return s[0]=o*C+a*D+l*v+A*L,s[4]=o*S+a*$+l*E+A*z,s[8]=o*b+a*H+l*U+A*K,s[12]=o*M+a*I+l*P+A*O,s[1]=c*C+u*D+f*v+h*L,s[5]=c*S+u*$+f*E+h*z,s[9]=c*b+u*H+f*U+h*K,s[13]=c*M+u*I+f*P+h*O,s[2]=p*C+d*D+g*v+m*L,s[6]=p*S+d*$+g*E+m*z,s[10]=p*b+d*H+g*U+m*K,s[14]=p*M+d*I+g*P+m*O,s[3]=y*C+w*D+x*v+_*L,s[7]=y*S+w*$+x*E+_*z,s[11]=y*b+w*H+x*U+_*K,s[15]=y*M+w*I+x*P+_*O,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],A=e[13],c=e[2],u=e[6],f=e[10],h=e[14],p=e[3],d=e[7],g=e[11],m=e[15];return p*(+s*l*u-i*A*u-s*a*f+r*A*f+i*a*h-r*l*h)+d*(+t*l*h-t*A*f+s*o*f-i*o*h+i*A*c-s*l*c)+g*(+t*A*u-t*a*h-s*o*u+r*o*h+s*a*c-r*A*c)+m*(-i*a*c-t*l*u+t*a*f+i*o*u-r*o*f+r*l*c)}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],A=e[7],c=e[8],u=e[9],f=e[10],h=e[11],p=e[12],d=e[13],g=e[14],m=e[15],y=u*g*A-d*f*A+d*l*h-a*g*h-u*l*m+a*f*m,w=p*f*A-c*g*A-p*l*h+o*g*h+c*l*m-o*f*m,x=c*d*A-p*u*A+p*a*h-o*d*h-c*a*m+o*u*m,_=p*u*l-c*d*l-p*a*f+o*d*f+c*a*g-o*u*g,C=t*y+r*w+i*x+s*_;if(C===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const S=1/C;return e[0]=y*S,e[1]=(d*f*s-u*g*s-d*i*h+r*g*h+u*i*m-r*f*m)*S,e[2]=(a*g*s-d*l*s+d*i*A-r*g*A-a*i*m+r*l*m)*S,e[3]=(u*l*s-a*f*s-u*i*A+r*f*A+a*i*h-r*l*h)*S,e[4]=w*S,e[5]=(c*g*s-p*f*s+p*i*h-t*g*h-c*i*m+t*f*m)*S,e[6]=(p*l*s-o*g*s-p*i*A+t*g*A+o*i*m-t*l*m)*S,e[7]=(o*f*s-c*l*s+c*i*A-t*f*A-o*i*h+t*l*h)*S,e[8]=x*S,e[9]=(p*u*s-c*d*s-p*r*h+t*d*h+c*r*m-t*u*m)*S,e[10]=(o*d*s-p*a*s+p*r*A-t*d*A-o*r*m+t*a*m)*S,e[11]=(c*a*s-o*u*s-c*r*A+t*u*A+o*r*h-t*a*h)*S,e[12]=_*S,e[13]=(c*d*i-p*u*i+p*r*f-t*d*f-c*r*g+t*u*g)*S,e[14]=(p*a*i-o*d*i-p*r*l+t*d*l+o*r*g-t*a*g)*S,e[15]=(o*u*i-c*a*i+c*r*l-t*u*l-o*r*f+t*a*f)*S,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 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,A=s*o,c=s*a;return this.set(A*o+r,A*a-i*l,A*l+i*a,0,A*a+i*l,c*a+r,c*l-i*o,0,A*l-i*a,c*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,A=s+s,c=o+o,u=a+a,f=s*A,h=s*c,p=s*u,d=o*c,g=o*u,m=a*u,y=l*A,w=l*c,x=l*u,_=r.x,C=r.y,S=r.z;return i[0]=(1-(d+m))*_,i[1]=(h+x)*_,i[2]=(p-w)*_,i[3]=0,i[4]=(h-x)*C,i[5]=(1-(f+m))*C,i[6]=(g+y)*C,i[7]=0,i[8]=(p+w)*S,i[9]=(g-y)*S,i[10]=(1-(f+d))*S,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=Su.set(i[0],i[1],i[2]).length();const o=Su.set(i[4],i[5],i[6]).length(),a=Su.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],ao.copy(this);const A=1/s,c=1/o,u=1/a;return ao.elements[0]*=A,ao.elements[1]*=A,ao.elements[2]*=A,ao.elements[4]*=c,ao.elements[5]*=c,ao.elements[6]*=c,ao.elements[8]*=u,ao.elements[9]*=u,ao.elements[10]*=u,t.setFromRotationMatrix(ao),r.x=s,r.y=o,r.z=a,this}makePerspective(e,t,r,i,s,o){const a=this.elements,l=2*s/(t-e),A=2*s/(r-i),c=(t+e)/(t-e),u=(r+i)/(r-i),f=-(o+s)/(o-s),h=-2*o*s/(o-s);return a[0]=l,a[4]=0,a[8]=c,a[12]=0,a[1]=0,a[5]=A,a[9]=u,a[13]=0,a[2]=0,a[6]=0,a[10]=f,a[14]=h,a[3]=0,a[7]=0,a[11]=-1,a[15]=0,this}makeOrthographic(e,t,r,i,s,o){const a=this.elements,l=1/(t-e),A=1/(r-i),c=1/(o-s),u=(t+e)*l,f=(r+i)*A,h=(o+s)*c;return a[0]=2*l,a[4]=0,a[8]=0,a[12]=-u,a[1]=0,a[5]=2*A,a[9]=0,a[13]=-f,a[2]=0,a[6]=0,a[10]=-2*c,a[14]=-h,a[3]=0,a[7]=0,a[11]=0,a[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 Su=new Z,ao=new je,RX=new Z(0,0,0),FX=new Z(1,1,1),Nl=new Z,y0=new Z,Oi=new Z,NF=new je,kF=new rt;class fi{constructor(e=0,t=0,r=0,i=fi.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],A=i[5],c=i[9],u=i[2],f=i[6],h=i[10];switch(t){case"XYZ":this._y=Math.asin(hr(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-c,h),this._z=Math.atan2(-o,s)):(this._x=Math.atan2(f,A),this._z=0);break;case"YXZ":this._x=Math.asin(-hr(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(a,h),this._z=Math.atan2(l,A)):(this._y=Math.atan2(-u,s),this._z=0);break;case"ZXY":this._x=Math.asin(hr(f,-1,1)),Math.abs(f)<.9999999?(this._y=Math.atan2(-u,h),this._z=Math.atan2(-o,A)):(this._y=0,this._z=Math.atan2(l,s));break;case"ZYX":this._y=Math.asin(-hr(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,A));break;case"YZX":this._z=Math.asin(hr(l,-1,1)),Math.abs(l)<.9999999?(this._x=Math.atan2(-c,A),this._y=Math.atan2(-u,s)):(this._x=0,this._y=Math.atan2(a,h));break;case"XZY":this._z=Math.asin(-hr(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(f,A),this._y=Math.atan2(a,s)):(this._x=Math.atan2(-c,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 NF.makeRotationFromQuaternion(e),this.setFromRotationMatrix(NF,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return kF.setFromEuler(this),this.setFromQuaternion(kF,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}}fi.DEFAULT_ORDER="XYZ";class XM{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&&(r=r.concat(o))}return r}getWorldPosition(e){return this.updateWorldMatrix(!0,!1),e.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Od,e,LX),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Od,PX,e),e}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(t[8],t[9],t[10]).normalize()}raycast(){}traverse(e){e(this);const t=this.children;for(let r=0,i=t.length;r0&&(i.userData=this.userData),i.layers=this.layers.mask,i.matrix=this.matrix.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()));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 A=0,c=l.length;A0){i.children=[];for(let a=0;a0){i.animations=[];for(let a=0;a0&&(r.geometries=a),l.length>0&&(r.materials=l),A.length>0&&(r.textures=A),c.length>0&&(r.images=c),u.length>0&&(r.shapes=u),f.length>0&&(r.skeletons=f),h.length>0&&(r.animations=h),p.length>0&&(r.nodes=p)}return r.object=i,r;function o(a){const l=[];for(const A in a){const c=a[A];delete c.metadata,l.push(c)}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.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,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.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),Ua.subVectors(r,t),eb.subVectors(e,t);const o=lo.dot(lo),a=lo.dot(Ua),l=lo.dot(eb),A=Ua.dot(Ua),c=Ua.dot(eb),u=o*A-a*a;if(u===0)return s.set(-2,-1,-1);const f=1/u,h=(A*l-a*c)*f,p=(o*c-a*l)*f;return s.set(1-h-p,p,h)}static containsPoint(e,t,r,i){return this.getBarycoord(e,t,r,i,La),La.x>=0&&La.y>=0&&La.x+La.y<=1}static getUV(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,La),l.set(0,0),l.addScaledVector(s,La.x),l.addScaledVector(o,La.y),l.addScaledVector(a,La.z),l}static isFrontFacing(e,t,r,i){return lo.subVectors(r,t),Ua.subVectors(e,t),lo.cross(Ua).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),Ua.subVectors(this.a,this.b),lo.cross(Ua).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Xi.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Xi.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,s){return Xi.getUV(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Xi.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Xi.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;Tu.subVectors(i,r),Iu.subVectors(s,r),tb.subVectors(e,r);const l=Tu.dot(tb),A=Iu.dot(tb);if(l<=0&&A<=0)return t.copy(r);nb.subVectors(e,i);const c=Tu.dot(nb),u=Iu.dot(nb);if(c>=0&&u<=c)return t.copy(i);const f=l*u-c*A;if(f<=0&&l>=0&&c<=0)return o=l/(l-c),t.copy(r).addScaledVector(Tu,o);rb.subVectors(e,s);const h=Tu.dot(rb),p=Iu.dot(rb);if(p>=0&&h<=p)return t.copy(s);const d=h*A-l*p;if(d<=0&&A>=0&&p<=0)return a=A/(A-p),t.copy(r).addScaledVector(Iu,a);const g=c*p-h*u;if(g<=0&&u-c>=0&&h-p>=0)return jF.subVectors(s,i),a=(u-c)/(u-c+(h-p)),t.copy(i).addScaledVector(jF,a);const m=1/(g+d+f);return o=d*m,a=f*m,t.copy(r).addScaledVector(Tu,o).addScaledVector(Iu,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let OX=0,is=class extends XA{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:OX++}),this.uuid=Co(),this.name="",this.type="Material",this.blending=lh,this.side=ls,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=aH,this.blendDst=lH,this.blendEquation=nf,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=nC,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=hX,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=z1,this.stencilZFail=z1,this.stencilZPass=z1,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(e){this._alphaTest>0!=e>0&&this.version++,this._alphaTest=e}onBuild(){}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: '"+t+"' parameter is undefined.");continue}const i=this[t];if(i===void 0){console.warn("THREE."+this.type+": '"+t+"' is not a property of this material.");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.5,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&&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.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.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.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!==lh&&(r.blending=this.blending),this.side!==ls&&(r.side=this.side),this.vertexColors&&(r.vertexColors=!0),this.opacity<1&&(r.opacity=this.opacity),this.transparent===!0&&(r.transparent=this.transparent),r.depthFunc=this.depthFunc,r.depthTest=this.depthTest,r.depthWrite=this.depthWrite,r.colorWrite=this.colorWrite,r.stencilWrite=this.stencilWrite,r.stencilWriteMask=this.stencilWriteMask,r.stencilFunc=this.stencilFunc,r.stencilRef=this.stencilRef,r.stencilFuncMask=this.stencilFuncMask,r.stencilFail=this.stencilFail,r.stencilZFail=this.stencilZFail,r.stencilZPass=this.stencilZPass,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.alphaToCoverage===!0&&(r.alphaToCoverage=this.alphaToCoverage),this.premultipliedAlpha===!0&&(r.premultipliedAlpha=this.premultipliedAlpha),this.forceSinglePass===!0&&(r.forceSinglePass=this.forceSinglePass),this.wireframe===!0&&(r.wireframe=this.wireframe),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=this.flatShading),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.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.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++}};class Ei extends is{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new Qe(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.combine=kx,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.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 Xn=new Z,x0=new $e;class At{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=sC,this.updateRange={offset:0,count:-1},this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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}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 A in l)l[A]!==void 0&&(e[A]=l[A]);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 A=r[l];e.data.attributes[l]=A.toJSON(e.data)}const i={};let s=!1;for(const l in this.morphAttributes){const A=this.morphAttributes[l],c=[];for(let u=0,f=A.length;u0&&(i[l]=c,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 A in i){const c=i[A];this.setAttribute(A,c.clone(t))}const s=e.morphAttributes;for(const A in s){const c=[],u=s[A];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;st.far?null:{distance:A,point:C0.clone(),object:n}}function S0(n,e,t,r,i,s,o,a,l){n.getVertexPosition(o,kd),n.getVertexPosition(a,Qd),n.getVertexPosition(l,Hd);const A=kX(n,e,t,r,kd,Qd,Hd,ab);if(A){i&&(b0.fromBufferAttribute(i,o),B0.fromBufferAttribute(i,a),E0.fromBufferAttribute(i,l),A.uv=Xi.getUV(ab,kd,Qd,Hd,b0,B0,E0,new $e)),s&&(b0.fromBufferAttribute(s,o),B0.fromBufferAttribute(s,a),E0.fromBufferAttribute(s,l),A.uv2=Xi.getUV(ab,kd,Qd,Hd,b0,B0,E0,new $e));const c={a:o,b:a,c:l,normal:new Z,materialIndex:0};Xi.getNormal(kd,Qd,Hd,c.normal),A.face=c}return A}class vg extends $t{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=[],A=[],c=[],u=[];let f=0,h=0;p("z","y","x",-1,-1,r,t,e,o,s,0),p("z","y","x",1,-1,r,t,-e,o,s,1),p("x","z","y",1,1,e,r,t,i,o,2),p("x","z","y",1,-1,e,r,-t,i,o,3),p("x","y","z",1,-1,e,t,r,i,s,4),p("x","y","z",-1,-1,e,t,-r,i,s,5),this.setIndex(l),this.setAttribute("position",new an(A,3)),this.setAttribute("normal",new an(c,3)),this.setAttribute("uv",new an(u,2));function p(d,g,m,y,w,x,_,C,S,b,M){const D=x/S,$=_/b,H=x/2,I=_/2,v=C/2,E=S+1,U=b+1;let P=0,L=0;const z=new Z;for(let K=0;K0?1:-1,c.push(z.x,z.y,z.z),u.push(B/S),u.push(1-K/b),P+=1}}for(let K=0;K0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader;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 yH extends It{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new je,this.projectionMatrix=new je,this.projectionMatrixInverse=new je}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}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)}}class Fr extends yH{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=Qm*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(em*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Qm*2*Math.atan(Math.tan(em*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}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(em*.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,A=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/A,i*=o.width/l,r*=o.height/A}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,e,this.far),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 Fu=-90,Uu=1;class GX extends It{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r;const i=new Fr(Fu,Uu,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);const s=new Fr(Fu,Uu,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const o=new Fr(Fu,Uu,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new Fr(Fu,Uu,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const l=new Fr(Fu,Uu,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const A=new Fr(Fu,Uu,e,t);A.layers=this.layers,A.up.set(0,1,0),A.lookAt(0,0,-1),this.add(A)}update(e,t){this.parent===null&&this.updateMatrixWorld();const r=this.renderTarget,[i,s,o,a,l,A]=this.children,c=e.getRenderTarget(),u=e.toneMapping,f=e.xr.enabled;e.toneMapping=ll,e.xr.enabled=!1;const h=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,i),e.setRenderTarget(r,1),e.render(t,s),e.setRenderTarget(r,2),e.render(t,o),e.setRenderTarget(r,3),e.render(t,a),e.setRenderTarget(r,4),e.render(t,l),r.texture.generateMipmaps=h,e.setRenderTarget(r,5),e.render(t,A),e.setRenderTarget(c),e.toneMapping=u,e.xr.enabled=f,r.texture.needsPMREMUpdate=!0}}class wH extends Qn{constructor(e,t,r,i,s,o,a,l,A,c){e=e!==void 0?e:[],t=t!==void 0?t:Lh,super(e,t,r,i,s,o,a,l,A,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class VX extends ma{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 wH(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:si}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;const r={uniforms:{tEquirect:{value:null}},vertexShader:` +}`;class Sr extends is{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=HX,this.fragmentShader=zX,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv2:[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=kh(e.uniforms),this.uniformsGroups=QX(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;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 yH extends It{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new je,this.projectionMatrix=new je,this.projectionMatrixInverse=new je}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this}getWorldDirection(e){this.updateWorldMatrix(!0,!1);const t=this.matrixWorld.elements;return e.set(-t[8],-t[9],-t[10]).normalize()}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)}}class br extends yH{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=Hm*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(tm*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Hm*2*Math.atan(Math.tan(tm*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}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(tm*.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,A=o.fullHeight;s+=o.offsetX*i/l,t-=o.offsetY*r/A,i*=o.width/l,r*=o.height/A}const a=this.filmOffset;a!==0&&(s+=e*a/this.getFilmWidth()),this.projectionMatrix.makePerspective(s,s+i,t,t-r,e,this.far),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 Uu=-90,Lu=1;class GX extends It{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r;const i=new br(Uu,Lu,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);const s=new br(Uu,Lu,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const o=new br(Uu,Lu,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new br(Uu,Lu,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const l=new br(Uu,Lu,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const A=new br(Uu,Lu,e,t);A.layers=this.layers,A.up.set(0,1,0),A.lookAt(0,0,-1),this.add(A)}update(e,t){this.parent===null&&this.updateMatrixWorld();const r=this.renderTarget,[i,s,o,a,l,A]=this.children,c=e.getRenderTarget(),u=e.toneMapping,f=e.xr.enabled;e.toneMapping=Al,e.xr.enabled=!1;const h=r.texture.generateMipmaps;r.texture.generateMipmaps=!1,e.setRenderTarget(r,0),e.render(t,i),e.setRenderTarget(r,1),e.render(t,s),e.setRenderTarget(r,2),e.render(t,o),e.setRenderTarget(r,3),e.render(t,a),e.setRenderTarget(r,4),e.render(t,l),r.texture.generateMipmaps=h,e.setRenderTarget(r,5),e.render(t,A),e.setRenderTarget(c),e.toneMapping=u,e.xr.enabled=f,r.texture.needsPMREMUpdate=!0}}class wH extends Qn{constructor(e,t,r,i,s,o,a,l,A,c){e=e!==void 0?e:[],t=t!==void 0?t:Ph,super(e,t,r,i,s,o,a,l,A,c),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}}class VX extends ga{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 wH(i,t.mapping,t.wrapS,t.wrapT,t.magFilter,t.minFilter,t.format,t.type,t.anisotropy,t.encoding),this.texture.isRenderTargetTexture=!0,this.texture.generateMipmaps=t.generateMipmaps!==void 0?t.generateMipmaps:!1,this.texture.minFilter=t.minFilter!==void 0?t.minFilter:si}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.encoding=t.encoding,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,7 +103,7 @@ Error generating stack: `+s.message+` gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},i=new gg(5,5,5),s=new Cr({name:"CubemapFromEquirect",uniforms:Nh(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:Xr,blending:CA});s.uniforms.tEquirect.value=t;const o=new xn(i,s),a=t.minFilter;return t.minFilter===DA&&(t.minFilter=si),new GX(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 lb=new Z,jX=new Z,WX=new En;class Ja{constructor(e=new Z(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=lb.subVectors(r,t).cross(jX.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(this.normal).multiplyScalar(-this.distanceToPoint(e)).add(e)}intersectLine(e,t){const r=e.delta(lb),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(r).multiplyScalar(s).add(e.start)}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||WX.getNormalMatrix(e),i=this.coplanarPoint(lb).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 Lu=new su,S0=new Z;class JM{constructor(e=new Ja,t=new Ja,r=new Ja,i=new Ja,s=new Ja,o=new Ja){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){const t=this.planes,r=e.elements,i=r[0],s=r[1],o=r[2],a=r[3],l=r[4],A=r[5],c=r[6],u=r[7],f=r[8],h=r[9],p=r[10],d=r[11],g=r[12],m=r[13],y=r[14],w=r[15];return t[0].setComponents(a-i,u-l,d-f,w-g).normalize(),t[1].setComponents(a+i,u+l,d+f,w+g).normalize(),t[2].setComponents(a+s,u+A,d+h,w+m).normalize(),t[3].setComponents(a-s,u-A,d-h,w-m).normalize(),t[4].setComponents(a-o,u-c,d-p,w-y).normalize(),t[5].setComponents(a+o,u+c,d+p,w+y).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Lu.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Lu)}intersectsSprite(e){return Lu.center.set(0,0,0),Lu.radius=.7071067811865476,Lu.applyMatrix4(e.matrixWorld),this.intersectsSphere(Lu)}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,S0.y=i.normal.y>0?e.max.y:e.min.y,S0.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(S0)<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 xH(){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 KX(n,e){const t=e.isWebGL2,r=new WeakMap;function i(A,c){const u=A.array,f=A.usage,h=n.createBuffer();n.bindBuffer(c,h),n.bufferData(c,u,f),A.onUploadCallback();let p;if(u instanceof Float32Array)p=5126;else if(u instanceof Uint16Array)if(A.isFloat16BufferAttribute)if(t)p=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else p=5123;else if(u instanceof Int16Array)p=5122;else if(u instanceof Uint32Array)p=5125;else if(u instanceof Int32Array)p=5124;else if(u instanceof Int8Array)p=5120;else if(u instanceof Uint8Array)p=5121;else if(u instanceof Uint8ClampedArray)p=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:h,type:p,bytesPerElement:u.BYTES_PER_ELEMENT,version:A.version}}function s(A,c,u){const f=c.array,h=c.updateRange;n.bindBuffer(u,A),h.count===-1?n.bufferSubData(u,0,f):(t?n.bufferSubData(u,h.offset*f.BYTES_PER_ELEMENT,f,h.offset,h.count):n.bufferSubData(u,h.offset*f.BYTES_PER_ELEMENT,f.subarray(h.offset,h.offset+h.count)),h.count=-1),c.onUploadCallback()}function o(A){return A.isInterleavedBufferAttribute&&(A=A.data),r.get(A)}function a(A){A.isInterleavedBufferAttribute&&(A=A.data);const c=r.get(A);c&&(n.deleteBuffer(c.buffer),r.delete(A))}function l(A,c){if(A.isGLBufferAttribute){const f=r.get(A);(!f||f.version1?null:t.copy(r).multiplyScalar(s).add(e.start)}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||WX.getNormalMatrix(e),i=this.coplanarPoint(lb).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 Pu=new ou,M0=new Z;class JM{constructor(e=new qa,t=new qa,r=new qa,i=new qa,s=new qa,o=new qa){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){const t=this.planes,r=e.elements,i=r[0],s=r[1],o=r[2],a=r[3],l=r[4],A=r[5],c=r[6],u=r[7],f=r[8],h=r[9],p=r[10],d=r[11],g=r[12],m=r[13],y=r[14],w=r[15];return t[0].setComponents(a-i,u-l,d-f,w-g).normalize(),t[1].setComponents(a+i,u+l,d+f,w+g).normalize(),t[2].setComponents(a+s,u+A,d+h,w+m).normalize(),t[3].setComponents(a-s,u-A,d-h,w-m).normalize(),t[4].setComponents(a-o,u-c,d-p,w-y).normalize(),t[5].setComponents(a+o,u+c,d+p,w+y).normalize(),this}intersectsObject(e){const t=e.geometry;return t.boundingSphere===null&&t.computeBoundingSphere(),Pu.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Pu)}intersectsSprite(e){return Pu.center.set(0,0,0),Pu.radius=.7071067811865476,Pu.applyMatrix4(e.matrixWorld),this.intersectsSphere(Pu)}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,M0.y=i.normal.y>0?e.max.y:e.min.y,M0.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(M0)<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 xH(){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 KX(n,e){const t=e.isWebGL2,r=new WeakMap;function i(A,c){const u=A.array,f=A.usage,h=n.createBuffer();n.bindBuffer(c,h),n.bufferData(c,u,f),A.onUploadCallback();let p;if(u instanceof Float32Array)p=5126;else if(u instanceof Uint16Array)if(A.isFloat16BufferAttribute)if(t)p=5131;else throw new Error("THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.");else p=5123;else if(u instanceof Int16Array)p=5122;else if(u instanceof Uint32Array)p=5125;else if(u instanceof Int32Array)p=5124;else if(u instanceof Int8Array)p=5120;else if(u instanceof Uint8Array)p=5121;else if(u instanceof Uint8ClampedArray)p=5121;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+u);return{buffer:h,type:p,bytesPerElement:u.BYTES_PER_ELEMENT,version:A.version}}function s(A,c,u){const f=c.array,h=c.updateRange;n.bindBuffer(u,A),h.count===-1?n.bufferSubData(u,0,f):(t?n.bufferSubData(u,h.offset*f.BYTES_PER_ELEMENT,f,h.offset,h.count):n.bufferSubData(u,h.offset*f.BYTES_PER_ELEMENT,f.subarray(h.offset,h.offset+h.count)),h.count=-1),c.onUploadCallback()}function o(A){return A.isInterleavedBufferAttribute&&(A=A.data),r.get(A)}function a(A){A.isInterleavedBufferAttribute&&(A=A.data);const c=r.get(A);c&&(n.deleteBuffer(c.buffer),r.delete(A))}function l(A,c){if(A.isGLBufferAttribute){const f=r.get(A);(!f||f.version #include #include -}`,xt={alphamap_fragment:$X,alphamap_pars_fragment:YX,alphatest_fragment:XX,alphatest_pars_fragment:ZX,aomap_fragment:JX,aomap_pars_fragment:qX,begin_vertex:eZ,beginnormal_vertex:tZ,bsdfs:nZ,iridescence_fragment:rZ,bumpmap_pars_fragment:iZ,clipping_planes_fragment:sZ,clipping_planes_pars_fragment:oZ,clipping_planes_pars_vertex:aZ,clipping_planes_vertex:lZ,color_fragment:AZ,color_pars_fragment:cZ,color_pars_vertex:uZ,color_vertex:fZ,common:hZ,cube_uv_reflection_fragment:dZ,defaultnormal_vertex:pZ,displacementmap_pars_vertex:mZ,displacementmap_vertex:gZ,emissivemap_fragment:vZ,emissivemap_pars_fragment:yZ,encodings_fragment:wZ,encodings_pars_fragment:xZ,envmap_fragment:_Z,envmap_common_pars_fragment:bZ,envmap_pars_fragment:BZ,envmap_pars_vertex:EZ,envmap_physical_pars_fragment:OZ,envmap_vertex:CZ,fog_vertex:SZ,fog_pars_vertex:MZ,fog_fragment:TZ,fog_pars_fragment:IZ,gradientmap_pars_fragment:RZ,lightmap_fragment:FZ,lightmap_pars_fragment:UZ,lights_lambert_fragment:LZ,lights_lambert_pars_fragment:PZ,lights_pars_begin:DZ,lights_toon_fragment:NZ,lights_toon_pars_fragment:kZ,lights_phong_fragment:QZ,lights_phong_pars_fragment:HZ,lights_physical_fragment:zZ,lights_physical_pars_fragment:GZ,lights_fragment_begin:VZ,lights_fragment_maps:jZ,lights_fragment_end:WZ,logdepthbuf_fragment:KZ,logdepthbuf_pars_fragment:$Z,logdepthbuf_pars_vertex:YZ,logdepthbuf_vertex:XZ,map_fragment:ZZ,map_pars_fragment:JZ,map_particle_fragment:qZ,map_particle_pars_fragment:eJ,metalnessmap_fragment:tJ,metalnessmap_pars_fragment:nJ,morphcolor_vertex:rJ,morphnormal_vertex:iJ,morphtarget_pars_vertex:sJ,morphtarget_vertex:oJ,normal_fragment_begin:aJ,normal_fragment_maps:lJ,normal_pars_fragment:AJ,normal_pars_vertex:cJ,normal_vertex:uJ,normalmap_pars_fragment:fJ,clearcoat_normal_fragment_begin:hJ,clearcoat_normal_fragment_maps:dJ,clearcoat_pars_fragment:pJ,iridescence_pars_fragment:mJ,output_fragment:gJ,packing:vJ,premultiplied_alpha_fragment:yJ,project_vertex:wJ,dithering_fragment:xJ,dithering_pars_fragment:_J,roughnessmap_fragment:bJ,roughnessmap_pars_fragment:BJ,shadowmap_pars_fragment:EJ,shadowmap_pars_vertex:CJ,shadowmap_vertex:SJ,shadowmask_pars_fragment:MJ,skinbase_vertex:TJ,skinning_pars_vertex:IJ,skinning_vertex:RJ,skinnormal_vertex:FJ,specularmap_fragment:UJ,specularmap_pars_fragment:LJ,tonemapping_fragment:PJ,tonemapping_pars_fragment:DJ,transmission_fragment:OJ,transmission_pars_fragment:NJ,uv_pars_fragment:kJ,uv_pars_vertex:QJ,uv_vertex:HJ,uv2_pars_fragment:zJ,uv2_pars_vertex:GJ,uv2_vertex:VJ,worldpos_vertex:jJ,background_vert:WJ,background_frag:KJ,backgroundCube_vert:$J,backgroundCube_frag:YJ,cube_vert:XJ,cube_frag:ZJ,depth_vert:JJ,depth_frag:qJ,distanceRGBA_vert:eq,distanceRGBA_frag:tq,equirect_vert:nq,equirect_frag:rq,linedashed_vert:iq,linedashed_frag:sq,meshbasic_vert:oq,meshbasic_frag:aq,meshlambert_vert:lq,meshlambert_frag:Aq,meshmatcap_vert:cq,meshmatcap_frag:uq,meshnormal_vert:fq,meshnormal_frag:hq,meshphong_vert:dq,meshphong_frag:pq,meshphysical_vert:mq,meshphysical_frag:gq,meshtoon_vert:vq,meshtoon_frag:yq,points_vert:wq,points_frag:xq,shadow_vert:_q,shadow_frag:bq,sprite_vert:Bq,sprite_frag:Eq},Ne={common:{diffuse:{value:new Qe(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new En},uv2Transform:{value:new En},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new $e(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Qe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 Qe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new En}},sprite:{diffuse:{value:new Qe(16777215)},opacity:{value:1},center:{value:new $e(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new En}}},Wo={basic:{uniforms:ri([Ne.common,Ne.specularmap,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.fog]),vertexShader:xt.meshbasic_vert,fragmentShader:xt.meshbasic_frag},lambert:{uniforms:ri([Ne.common,Ne.specularmap,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.fog,Ne.lights,{emissive:{value:new Qe(0)}}]),vertexShader:xt.meshlambert_vert,fragmentShader:xt.meshlambert_frag},phong:{uniforms:ri([Ne.common,Ne.specularmap,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.fog,Ne.lights,{emissive:{value:new Qe(0)},specular:{value:new Qe(1118481)},shininess:{value:30}}]),vertexShader:xt.meshphong_vert,fragmentShader:xt.meshphong_frag},standard:{uniforms:ri([Ne.common,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.roughnessmap,Ne.metalnessmap,Ne.fog,Ne.lights,{emissive:{value:new Qe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag},toon:{uniforms:ri([Ne.common,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.gradientmap,Ne.fog,Ne.lights,{emissive:{value:new Qe(0)}}]),vertexShader:xt.meshtoon_vert,fragmentShader:xt.meshtoon_frag},matcap:{uniforms:ri([Ne.common,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.fog,{matcap:{value:null}}]),vertexShader:xt.meshmatcap_vert,fragmentShader:xt.meshmatcap_frag},points:{uniforms:ri([Ne.points,Ne.fog]),vertexShader:xt.points_vert,fragmentShader:xt.points_frag},dashed:{uniforms:ri([Ne.common,Ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xt.linedashed_vert,fragmentShader:xt.linedashed_frag},depth:{uniforms:ri([Ne.common,Ne.displacementmap]),vertexShader:xt.depth_vert,fragmentShader:xt.depth_frag},normal:{uniforms:ri([Ne.common,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,{opacity:{value:1}}]),vertexShader:xt.meshnormal_vert,fragmentShader:xt.meshnormal_frag},sprite:{uniforms:ri([Ne.sprite,Ne.fog]),vertexShader:xt.sprite_vert,fragmentShader:xt.sprite_frag},background:{uniforms:{uvTransform:{value:new En},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:xt.background_vert,fragmentShader:xt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:xt.backgroundCube_vert,fragmentShader:xt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:xt.cube_vert,fragmentShader:xt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:xt.equirect_vert,fragmentShader:xt.equirect_frag},distanceRGBA:{uniforms:ri([Ne.common,Ne.displacementmap,{referencePosition:{value:new Z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:xt.distanceRGBA_vert,fragmentShader:xt.distanceRGBA_frag},shadow:{uniforms:ri([Ne.lights,Ne.fog,{color:{value:new Qe(0)},opacity:{value:1}}]),vertexShader:xt.shadow_vert,fragmentShader:xt.shadow_frag}};Wo.physical={uniforms:ri([Wo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new $e(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Qe(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new $e},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Qe(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Qe(1,1,1)},specularColorMap:{value:null}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag};const M0={r:0,b:0,g:0};function Cq(n,e,t,r,i,s,o){const a=new Qe(0);let l=s===!0?0:1,A,c,u=null,f=0,h=null;function p(g,m){let y=!1,w=m.isScene===!0?m.background:null;w&&w.isTexture&&(w=(m.backgroundBlurriness>0?t:e).get(w));const x=n.xr,_=x.getSession&&x.getSession();_&&_.environmentBlendMode==="additive"&&(w=null),w===null?d(a,l):w&&w.isColor&&(d(w,1),y=!0),(n.autoClear||y)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),w&&(w.isCubeTexture||w.mapping===kx)?(c===void 0&&(c=new xn(new gg(1,1,1),new Cr({name:"BackgroundCubeMaterial",uniforms:Nh(Wo.backgroundCube.uniforms),vertexShader:Wo.backgroundCube.vertexShader,fragmentShader:Wo.backgroundCube.fragmentShader,side:Xr,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(C,S,b){this.matrixWorld.copyPosition(b.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=w,c.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=m.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,c.material.toneMapped=w.encoding!==pt,(u!==w||f!==w.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,u=w,f=w.version,h=n.toneMapping),c.layers.enableAll(),g.unshift(c,c.geometry,c.material,0,0,null)):w&&w.isTexture&&(A===void 0&&(A=new xn(new ou(2,2),new Cr({name:"BackgroundMaterial",uniforms:Nh(Wo.background.uniforms),vertexShader:Wo.background.vertexShader,fragmentShader:Wo.background.fragmentShader,side:ls,depthTest:!1,depthWrite:!1,fog:!1})),A.geometry.deleteAttribute("normal"),Object.defineProperty(A.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(A)),A.material.uniforms.t2D.value=w,A.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,A.material.toneMapped=w.encoding!==pt,w.matrixAutoUpdate===!0&&w.updateMatrix(),A.material.uniforms.uvTransform.value.copy(w.matrix),(u!==w||f!==w.version||h!==n.toneMapping)&&(A.material.needsUpdate=!0,u=w,f=w.version,h=n.toneMapping),A.layers.enableAll(),g.unshift(A,A.geometry,A.material,0,0,null))}function d(g,m){g.getRGB(M0,vH(n)),r.buffers.color.setClear(M0.r,M0.g,M0.b,m,o)}return{getClearColor:function(){return a},setClearColor:function(g,m=1){a.set(g),l=m,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(g){l=g,d(a,l)},render:p}}function Sq(n,e,t,r){const i=n.getParameter(34921),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||s!==null,a={},l=g(null);let A=l,c=!1;function u(v,E,U,P,L){let z=!1;if(o){const K=d(P,U,E);A!==K&&(A=K,h(A.object)),z=m(v,P,U,L),z&&y(v,P,U,L)}else{const K=E.wireframe===!0;(A.geometry!==P.id||A.program!==U.id||A.wireframe!==K)&&(A.geometry=P.id,A.program=U.id,A.wireframe=K,z=!0)}L!==null&&t.update(L,34963),(z||c)&&(c=!1,b(v,E,U,P),L!==null&&n.bindBuffer(34963,t.get(L).buffer))}function f(){return r.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function h(v){return r.isWebGL2?n.bindVertexArray(v):s.bindVertexArrayOES(v)}function p(v){return r.isWebGL2?n.deleteVertexArray(v):s.deleteVertexArrayOES(v)}function d(v,E,U){const P=U.wireframe===!0;let L=a[v.id];L===void 0&&(L={},a[v.id]=L);let z=L[E.id];z===void 0&&(z={},L[E.id]=z);let K=z[P];return K===void 0&&(K=g(f()),z[P]=K),K}function g(v){const E=[],U=[],P=[];for(let L=0;L=0){const ee=L[B];let F=z[B];if(F===void 0&&(B==="instanceMatrix"&&v.instanceMatrix&&(F=v.instanceMatrix),B==="instanceColor"&&v.instanceColor&&(F=v.instanceColor)),ee===void 0||ee.attribute!==F||F&&ee.data!==F.data)return!0;K++}return A.attributesNum!==K||A.index!==P}function y(v,E,U,P){const L={},z=E.attributes;let K=0;const O=U.getAttributes();for(const B in O)if(O[B].location>=0){let ee=z[B];ee===void 0&&(B==="instanceMatrix"&&v.instanceMatrix&&(ee=v.instanceMatrix),B==="instanceColor"&&v.instanceColor&&(ee=v.instanceColor));const F={};F.attribute=ee,ee&&ee.data&&(F.data=ee.data),L[B]=F,K++}A.attributes=L,A.attributesNum=K,A.index=P}function w(){const v=A.newAttributes;for(let E=0,U=v.length;E=0){let W=L[O];if(W===void 0&&(O==="instanceMatrix"&&v.instanceMatrix&&(W=v.instanceMatrix),O==="instanceColor"&&v.instanceColor&&(W=v.instanceColor)),W!==void 0){const ee=W.normalized,F=W.itemSize,X=t.get(W);if(X===void 0)continue;const ue=X.buffer,le=X.type,oe=X.bytesPerElement;if(W.isInterleavedBufferAttribute){const re=W.data,pe=re.stride,_e=W.offset;if(re.isInstancedInterleavedBuffer){for(let Re=0;Re0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";S="mediump"}return S==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext;let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const A=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,u=n.getParameter(34930),f=n.getParameter(35660),h=n.getParameter(3379),p=n.getParameter(34076),d=n.getParameter(34921),g=n.getParameter(36347),m=n.getParameter(36348),y=n.getParameter(36349),w=f>0,x=o||e.has("OES_texture_float"),_=w&&x,C=o?n.getParameter(36183):0;return{isWebGL2:o,drawBuffers:A,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:f,maxTextureSize:h,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:g,maxVaryings:m,maxFragmentUniforms:y,vertexTextures:w,floatFragmentTextures:x,floatVertexTextures:_,maxSamples:C}}function Iq(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new Ja,a=new En,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,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,f){t=c(u,f,0)},this.setState=function(u,f,h){const p=u.clippingPlanes,d=u.clipIntersection,g=u.clipShadows,m=n.get(u);if(!i||p===null||p.length===0||s&&!g)s?c(null):A();else{const y=s?0:r,w=y*4;let x=m.clippingState||null;l.value=x,x=c(p,f,w,h);for(let _=0;_!==w;++_)x[_]=t[_];m.clippingState=x,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=y}};function A(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function c(u,f,h,p){const d=u!==null?u.length:0;let g=null;if(d!==0){if(g=l.value,p!==!0||g===null){const m=h+d*4,y=f.matrixWorldInverse;a.getNormalMatrix(y),(g===null||g.length0){const A=new VX(l.height/2);return A.fromEquirectangularTexture(n,o),e.set(o,A),o.addEventListener("dispose",i),t(A.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 qh extends yH{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 A=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=A*this.view.offsetX,o=s+A*this.view.width,a-=c*this.view.offsetY,l=a-c*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far),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 Vf=4,KF=[.125,.215,.35,.446,.526,.582],yc=20,Ab=new qh,$F=new Qe;let cb=null;const pc=(1+Math.sqrt(5))/2,Pu=1/pc,YF=[new Z(1,1,1),new Z(-1,1,1),new Z(1,1,-1),new Z(-1,1,-1),new Z(0,pc,Pu),new Z(0,pc,-Pu),new Z(Pu,0,pc),new Z(-Pu,0,pc),new Z(pc,Pu,0),new Z(-pc,Pu,0)];class XF{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){cb=this._renderer.getRenderTarget(),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=qF(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=JF(),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),c.setRenderTarget(i),d&&c.render(p,a),c.render(e,a)}p.geometry.dispose(),p.material.dispose(),c.toneMapping=f,c.autoClear=u,e.background=g}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===Lh||e.mapping===Ph;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=qF()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=JF());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new xn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;T0(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,Ab)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;iyc&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${yc}`);const m=[];let y=0;for(let S=0;Sw-Vf?i-w+Vf:0),C=4*(this._cubeSize-x);T0(t,_,C,3*x,2*x),l.setRenderTarget(t),l.render(u,Ab)}}function Fq(n){const e=[],t=[],r=[];let i=n;const s=n-Vf+1+KF.length;for(let o=0;on-Vf?l=KF[o-n+Vf-1]:o===0&&(l=0),r.push(l);const A=1/(a-2),c=-A,u=1+A,f=[c,c,u,c,u,u,c,c,u,u,c,u],h=6,p=6,d=3,g=2,m=1,y=new Float32Array(d*p*h),w=new Float32Array(g*p*h),x=new Float32Array(m*p*h);for(let C=0;C2?0:-1,M=[S,b,0,S+2/3,b,0,S+2/3,b+1,0,S,b,0,S+2/3,b+1,0,S,b+1,0];y.set(M,d*p*C),w.set(f,g*p*C);const D=[C,C,C,C,C,C];x.set(D,m*p*C)}const _=new $t;_.setAttribute("position",new At(y,d)),_.setAttribute("uv",new At(w,g)),_.setAttribute("faceIndex",new At(x,m)),e.push(_),i>Vf&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function ZF(n,e,t){const r=new ma(n,e,t);return r.texture.mapping=kx,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function T0(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function Uq(n,e,t){const r=new Float32Array(yc),i=new Z(0,1,0);return new Cr({name:"SphericalGaussianBlur",defines:{n:yc,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:qM(),fragmentShader:` +}`,xt={alphamap_fragment:$X,alphamap_pars_fragment:YX,alphatest_fragment:XX,alphatest_pars_fragment:ZX,aomap_fragment:JX,aomap_pars_fragment:qX,begin_vertex:eZ,beginnormal_vertex:tZ,bsdfs:nZ,iridescence_fragment:rZ,bumpmap_pars_fragment:iZ,clipping_planes_fragment:sZ,clipping_planes_pars_fragment:oZ,clipping_planes_pars_vertex:aZ,clipping_planes_vertex:lZ,color_fragment:AZ,color_pars_fragment:cZ,color_pars_vertex:uZ,color_vertex:fZ,common:hZ,cube_uv_reflection_fragment:dZ,defaultnormal_vertex:pZ,displacementmap_pars_vertex:mZ,displacementmap_vertex:gZ,emissivemap_fragment:vZ,emissivemap_pars_fragment:yZ,encodings_fragment:wZ,encodings_pars_fragment:xZ,envmap_fragment:_Z,envmap_common_pars_fragment:bZ,envmap_pars_fragment:BZ,envmap_pars_vertex:EZ,envmap_physical_pars_fragment:OZ,envmap_vertex:CZ,fog_vertex:SZ,fog_pars_vertex:MZ,fog_fragment:TZ,fog_pars_fragment:IZ,gradientmap_pars_fragment:RZ,lightmap_fragment:FZ,lightmap_pars_fragment:UZ,lights_lambert_fragment:LZ,lights_lambert_pars_fragment:PZ,lights_pars_begin:DZ,lights_toon_fragment:NZ,lights_toon_pars_fragment:kZ,lights_phong_fragment:QZ,lights_phong_pars_fragment:HZ,lights_physical_fragment:zZ,lights_physical_pars_fragment:GZ,lights_fragment_begin:VZ,lights_fragment_maps:jZ,lights_fragment_end:WZ,logdepthbuf_fragment:KZ,logdepthbuf_pars_fragment:$Z,logdepthbuf_pars_vertex:YZ,logdepthbuf_vertex:XZ,map_fragment:ZZ,map_pars_fragment:JZ,map_particle_fragment:qZ,map_particle_pars_fragment:eJ,metalnessmap_fragment:tJ,metalnessmap_pars_fragment:nJ,morphcolor_vertex:rJ,morphnormal_vertex:iJ,morphtarget_pars_vertex:sJ,morphtarget_vertex:oJ,normal_fragment_begin:aJ,normal_fragment_maps:lJ,normal_pars_fragment:AJ,normal_pars_vertex:cJ,normal_vertex:uJ,normalmap_pars_fragment:fJ,clearcoat_normal_fragment_begin:hJ,clearcoat_normal_fragment_maps:dJ,clearcoat_pars_fragment:pJ,iridescence_pars_fragment:mJ,output_fragment:gJ,packing:vJ,premultiplied_alpha_fragment:yJ,project_vertex:wJ,dithering_fragment:xJ,dithering_pars_fragment:_J,roughnessmap_fragment:bJ,roughnessmap_pars_fragment:BJ,shadowmap_pars_fragment:EJ,shadowmap_pars_vertex:CJ,shadowmap_vertex:SJ,shadowmask_pars_fragment:MJ,skinbase_vertex:TJ,skinning_pars_vertex:IJ,skinning_vertex:RJ,skinnormal_vertex:FJ,specularmap_fragment:UJ,specularmap_pars_fragment:LJ,tonemapping_fragment:PJ,tonemapping_pars_fragment:DJ,transmission_fragment:OJ,transmission_pars_fragment:NJ,uv_pars_fragment:kJ,uv_pars_vertex:QJ,uv_vertex:HJ,uv2_pars_fragment:zJ,uv2_pars_vertex:GJ,uv2_vertex:VJ,worldpos_vertex:jJ,background_vert:WJ,background_frag:KJ,backgroundCube_vert:$J,backgroundCube_frag:YJ,cube_vert:XJ,cube_frag:ZJ,depth_vert:JJ,depth_frag:qJ,distanceRGBA_vert:eq,distanceRGBA_frag:tq,equirect_vert:nq,equirect_frag:rq,linedashed_vert:iq,linedashed_frag:sq,meshbasic_vert:oq,meshbasic_frag:aq,meshlambert_vert:lq,meshlambert_frag:Aq,meshmatcap_vert:cq,meshmatcap_frag:uq,meshnormal_vert:fq,meshnormal_frag:hq,meshphong_vert:dq,meshphong_frag:pq,meshphysical_vert:mq,meshphysical_frag:gq,meshtoon_vert:vq,meshtoon_frag:yq,points_vert:wq,points_frag:xq,shadow_vert:_q,shadow_frag:bq,sprite_vert:Bq,sprite_frag:Eq},Ne={common:{diffuse:{value:new Qe(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new En},uv2Transform:{value:new En},alphaMap:{value:null},alphaTest:{value:0}},specularmap:{specularMap:{value:null}},envmap:{envMap:{value:null},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1}},emissivemap:{emissiveMap:{value:null}},bumpmap:{bumpMap:{value:null},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalScale:{value:new $e(1,1)}},displacementmap:{displacementMap:{value:null},displacementScale:{value:1},displacementBias:{value:0}},roughnessmap:{roughnessMap:{value:null}},metalnessmap:{metalnessMap:{value:null}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Qe(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{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 Qe(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new En}},sprite:{diffuse:{value:new Qe(16777215)},opacity:{value:1},center:{value:new $e(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new En}}},Ko={basic:{uniforms:ri([Ne.common,Ne.specularmap,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.fog]),vertexShader:xt.meshbasic_vert,fragmentShader:xt.meshbasic_frag},lambert:{uniforms:ri([Ne.common,Ne.specularmap,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.fog,Ne.lights,{emissive:{value:new Qe(0)}}]),vertexShader:xt.meshlambert_vert,fragmentShader:xt.meshlambert_frag},phong:{uniforms:ri([Ne.common,Ne.specularmap,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.fog,Ne.lights,{emissive:{value:new Qe(0)},specular:{value:new Qe(1118481)},shininess:{value:30}}]),vertexShader:xt.meshphong_vert,fragmentShader:xt.meshphong_frag},standard:{uniforms:ri([Ne.common,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.roughnessmap,Ne.metalnessmap,Ne.fog,Ne.lights,{emissive:{value:new Qe(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag},toon:{uniforms:ri([Ne.common,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.gradientmap,Ne.fog,Ne.lights,{emissive:{value:new Qe(0)}}]),vertexShader:xt.meshtoon_vert,fragmentShader:xt.meshtoon_frag},matcap:{uniforms:ri([Ne.common,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.fog,{matcap:{value:null}}]),vertexShader:xt.meshmatcap_vert,fragmentShader:xt.meshmatcap_frag},points:{uniforms:ri([Ne.points,Ne.fog]),vertexShader:xt.points_vert,fragmentShader:xt.points_frag},dashed:{uniforms:ri([Ne.common,Ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xt.linedashed_vert,fragmentShader:xt.linedashed_frag},depth:{uniforms:ri([Ne.common,Ne.displacementmap]),vertexShader:xt.depth_vert,fragmentShader:xt.depth_frag},normal:{uniforms:ri([Ne.common,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,{opacity:{value:1}}]),vertexShader:xt.meshnormal_vert,fragmentShader:xt.meshnormal_frag},sprite:{uniforms:ri([Ne.sprite,Ne.fog]),vertexShader:xt.sprite_vert,fragmentShader:xt.sprite_frag},background:{uniforms:{uvTransform:{value:new En},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:xt.background_vert,fragmentShader:xt.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1}},vertexShader:xt.backgroundCube_vert,fragmentShader:xt.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:xt.cube_vert,fragmentShader:xt.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:xt.equirect_vert,fragmentShader:xt.equirect_frag},distanceRGBA:{uniforms:ri([Ne.common,Ne.displacementmap,{referencePosition:{value:new Z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:xt.distanceRGBA_vert,fragmentShader:xt.distanceRGBA_frag},shadow:{uniforms:ri([Ne.lights,Ne.fog,{color:{value:new Qe(0)},opacity:{value:1}}]),vertexShader:xt.shadow_vert,fragmentShader:xt.shadow_frag}};Ko.physical={uniforms:ri([Ko.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new $e(1,1)},clearcoatNormalMap:{value:null},iridescence:{value:0},iridescenceMap:{value:null},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},sheen:{value:0},sheenColor:{value:new Qe(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new $e},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new Qe(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new Qe(1,1,1)},specularColorMap:{value:null}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag};const T0={r:0,b:0,g:0};function Cq(n,e,t,r,i,s,o){const a=new Qe(0);let l=s===!0?0:1,A,c,u=null,f=0,h=null;function p(g,m){let y=!1,w=m.isScene===!0?m.background:null;w&&w.isTexture&&(w=(m.backgroundBlurriness>0?t:e).get(w));const x=n.xr,_=x.getSession&&x.getSession();_&&_.environmentBlendMode==="additive"&&(w=null),w===null?d(a,l):w&&w.isColor&&(d(w,1),y=!0),(n.autoClear||y)&&n.clear(n.autoClearColor,n.autoClearDepth,n.autoClearStencil),w&&(w.isCubeTexture||w.mapping===Qx)?(c===void 0&&(c=new xn(new vg(1,1,1),new Sr({name:"BackgroundCubeMaterial",uniforms:kh(Ko.backgroundCube.uniforms),vertexShader:Ko.backgroundCube.vertexShader,fragmentShader:Ko.backgroundCube.fragmentShader,side:Xr,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(C,S,b){this.matrixWorld.copyPosition(b.matrixWorld)},Object.defineProperty(c.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(c)),c.material.uniforms.envMap.value=w,c.material.uniforms.flipEnvMap.value=w.isCubeTexture&&w.isRenderTargetTexture===!1?-1:1,c.material.uniforms.backgroundBlurriness.value=m.backgroundBlurriness,c.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,c.material.toneMapped=w.encoding!==pt,(u!==w||f!==w.version||h!==n.toneMapping)&&(c.material.needsUpdate=!0,u=w,f=w.version,h=n.toneMapping),c.layers.enableAll(),g.unshift(c,c.geometry,c.material,0,0,null)):w&&w.isTexture&&(A===void 0&&(A=new xn(new au(2,2),new Sr({name:"BackgroundMaterial",uniforms:kh(Ko.background.uniforms),vertexShader:Ko.background.vertexShader,fragmentShader:Ko.background.fragmentShader,side:ls,depthTest:!1,depthWrite:!1,fog:!1})),A.geometry.deleteAttribute("normal"),Object.defineProperty(A.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(A)),A.material.uniforms.t2D.value=w,A.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,A.material.toneMapped=w.encoding!==pt,w.matrixAutoUpdate===!0&&w.updateMatrix(),A.material.uniforms.uvTransform.value.copy(w.matrix),(u!==w||f!==w.version||h!==n.toneMapping)&&(A.material.needsUpdate=!0,u=w,f=w.version,h=n.toneMapping),A.layers.enableAll(),g.unshift(A,A.geometry,A.material,0,0,null))}function d(g,m){g.getRGB(T0,vH(n)),r.buffers.color.setClear(T0.r,T0.g,T0.b,m,o)}return{getClearColor:function(){return a},setClearColor:function(g,m=1){a.set(g),l=m,d(a,l)},getClearAlpha:function(){return l},setClearAlpha:function(g){l=g,d(a,l)},render:p}}function Sq(n,e,t,r){const i=n.getParameter(34921),s=r.isWebGL2?null:e.get("OES_vertex_array_object"),o=r.isWebGL2||s!==null,a={},l=g(null);let A=l,c=!1;function u(v,E,U,P,L){let z=!1;if(o){const K=d(P,U,E);A!==K&&(A=K,h(A.object)),z=m(v,P,U,L),z&&y(v,P,U,L)}else{const K=E.wireframe===!0;(A.geometry!==P.id||A.program!==U.id||A.wireframe!==K)&&(A.geometry=P.id,A.program=U.id,A.wireframe=K,z=!0)}L!==null&&t.update(L,34963),(z||c)&&(c=!1,b(v,E,U,P),L!==null&&n.bindBuffer(34963,t.get(L).buffer))}function f(){return r.isWebGL2?n.createVertexArray():s.createVertexArrayOES()}function h(v){return r.isWebGL2?n.bindVertexArray(v):s.bindVertexArrayOES(v)}function p(v){return r.isWebGL2?n.deleteVertexArray(v):s.deleteVertexArrayOES(v)}function d(v,E,U){const P=U.wireframe===!0;let L=a[v.id];L===void 0&&(L={},a[v.id]=L);let z=L[E.id];z===void 0&&(z={},L[E.id]=z);let K=z[P];return K===void 0&&(K=g(f()),z[P]=K),K}function g(v){const E=[],U=[],P=[];for(let L=0;L=0){const ee=L[B];let F=z[B];if(F===void 0&&(B==="instanceMatrix"&&v.instanceMatrix&&(F=v.instanceMatrix),B==="instanceColor"&&v.instanceColor&&(F=v.instanceColor)),ee===void 0||ee.attribute!==F||F&&ee.data!==F.data)return!0;K++}return A.attributesNum!==K||A.index!==P}function y(v,E,U,P){const L={},z=E.attributes;let K=0;const O=U.getAttributes();for(const B in O)if(O[B].location>=0){let ee=z[B];ee===void 0&&(B==="instanceMatrix"&&v.instanceMatrix&&(ee=v.instanceMatrix),B==="instanceColor"&&v.instanceColor&&(ee=v.instanceColor));const F={};F.attribute=ee,ee&&ee.data&&(F.data=ee.data),L[B]=F,K++}A.attributes=L,A.attributesNum=K,A.index=P}function w(){const v=A.newAttributes;for(let E=0,U=v.length;E=0){let W=L[O];if(W===void 0&&(O==="instanceMatrix"&&v.instanceMatrix&&(W=v.instanceMatrix),O==="instanceColor"&&v.instanceColor&&(W=v.instanceColor)),W!==void 0){const ee=W.normalized,F=W.itemSize,X=t.get(W);if(X===void 0)continue;const ue=X.buffer,le=X.type,oe=X.bytesPerElement;if(W.isInterleavedBufferAttribute){const re=W.data,pe=re.stride,_e=W.offset;if(re.isInstancedInterleavedBuffer){for(let Re=0;Re0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";S="mediump"}return S==="mediump"&&n.getShaderPrecisionFormat(35633,36337).precision>0&&n.getShaderPrecisionFormat(35632,36337).precision>0?"mediump":"lowp"}const o=typeof WebGL2RenderingContext<"u"&&n instanceof WebGL2RenderingContext;let a=t.precision!==void 0?t.precision:"highp";const l=s(a);l!==a&&(console.warn("THREE.WebGLRenderer:",a,"not supported, using",l,"instead."),a=l);const A=o||e.has("WEBGL_draw_buffers"),c=t.logarithmicDepthBuffer===!0,u=n.getParameter(34930),f=n.getParameter(35660),h=n.getParameter(3379),p=n.getParameter(34076),d=n.getParameter(34921),g=n.getParameter(36347),m=n.getParameter(36348),y=n.getParameter(36349),w=f>0,x=o||e.has("OES_texture_float"),_=w&&x,C=o?n.getParameter(36183):0;return{isWebGL2:o,drawBuffers:A,getMaxAnisotropy:i,getMaxPrecision:s,precision:a,logarithmicDepthBuffer:c,maxTextures:u,maxVertexTextures:f,maxTextureSize:h,maxCubemapSize:p,maxAttributes:d,maxVertexUniforms:g,maxVaryings:m,maxFragmentUniforms:y,vertexTextures:w,floatFragmentTextures:x,floatVertexTextures:_,maxSamples:C}}function Iq(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new qa,a=new En,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,c(null)},this.endShadows=function(){s=!1},this.setGlobalState=function(u,f){t=c(u,f,0)},this.setState=function(u,f,h){const p=u.clippingPlanes,d=u.clipIntersection,g=u.clipShadows,m=n.get(u);if(!i||p===null||p.length===0||s&&!g)s?c(null):A();else{const y=s?0:r,w=y*4;let x=m.clippingState||null;l.value=x,x=c(p,f,w,h);for(let _=0;_!==w;++_)x[_]=t[_];m.clippingState=x,this.numIntersection=d?this.numPlanes:0,this.numPlanes+=y}};function A(){l.value!==t&&(l.value=t,l.needsUpdate=r>0),e.numPlanes=r,e.numIntersection=0}function c(u,f,h,p){const d=u!==null?u.length:0;let g=null;if(d!==0){if(g=l.value,p!==!0||g===null){const m=h+d*4,y=f.matrixWorldInverse;a.getNormalMatrix(y),(g===null||g.length0){const A=new VX(l.height/2);return A.fromEquirectangularTexture(n,o),e.set(o,A),o.addEventListener("dispose",i),t(A.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 ed extends yH{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 A=(this.right-this.left)/this.view.fullWidth/this.zoom,c=(this.top-this.bottom)/this.view.fullHeight/this.zoom;s+=A*this.view.offsetX,o=s+A*this.view.width,a-=c*this.view.offsetY,l=a-c*this.view.height}this.projectionMatrix.makeOrthographic(s,o,a,l,this.near,this.far),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 jf=4,KF=[.125,.215,.35,.446,.526,.582],wc=20,Ab=new ed,$F=new Qe;let cb=null;const mc=(1+Math.sqrt(5))/2,Du=1/mc,YF=[new Z(1,1,1),new Z(-1,1,1),new Z(1,1,-1),new Z(-1,1,-1),new Z(0,mc,Du),new Z(0,mc,-Du),new Z(Du,0,mc),new Z(-Du,0,mc),new Z(mc,Du,0),new Z(-mc,Du,0)];class XF{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){cb=this._renderer.getRenderTarget(),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=qF(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=JF(),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),c.setRenderTarget(i),d&&c.render(p,a),c.render(e,a)}p.geometry.dispose(),p.material.dispose(),c.toneMapping=f,c.autoClear=u,e.background=g}_textureToCubeUV(e,t){const r=this._renderer,i=e.mapping===Ph||e.mapping===Dh;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=qF()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=JF());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new xn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;I0(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,Ab)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;iwc&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${wc}`);const m=[];let y=0;for(let S=0;Sw-jf?i-w+jf:0),C=4*(this._cubeSize-x);I0(t,_,C,3*x,2*x),l.setRenderTarget(t),l.render(u,Ab)}}function Fq(n){const e=[],t=[],r=[];let i=n;const s=n-jf+1+KF.length;for(let o=0;on-jf?l=KF[o-n+jf-1]:o===0&&(l=0),r.push(l);const A=1/(a-2),c=-A,u=1+A,f=[c,c,u,c,u,u,c,c,u,u,c,u],h=6,p=6,d=3,g=2,m=1,y=new Float32Array(d*p*h),w=new Float32Array(g*p*h),x=new Float32Array(m*p*h);for(let C=0;C2?0:-1,M=[S,b,0,S+2/3,b,0,S+2/3,b+1,0,S,b,0,S+2/3,b+1,0,S,b+1,0];y.set(M,d*p*C),w.set(f,g*p*C);const D=[C,C,C,C,C,C];x.set(D,m*p*C)}const _=new $t;_.setAttribute("position",new At(y,d)),_.setAttribute("uv",new At(w,g)),_.setAttribute("faceIndex",new At(x,m)),e.push(_),i>jf&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function ZF(n,e,t){const r=new ga(n,e,t);return r.texture.mapping=Qx,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function I0(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function Uq(n,e,t){const r=new Float32Array(wc),i=new Z(0,1,0);return new Sr({name:"SphericalGaussianBlur",defines:{n:wc,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:qM(),fragmentShader:` precision mediump float; precision mediump int; @@ -3053,7 +3053,7 @@ void main() { } } - `,blending:CA,depthTest:!1,depthWrite:!1})}function JF(){return new Cr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:qM(),fragmentShader:` + `,blending:SA,depthTest:!1,depthWrite:!1})}function JF(){return new Sr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:qM(),fragmentShader:` precision mediump float; precision mediump int; @@ -3072,7 +3072,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:CA,depthTest:!1,depthWrite:!1})}function qF(){return new Cr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:qM(),fragmentShader:` + `,blending:SA,depthTest:!1,depthWrite:!1})}function qF(){return new Sr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:qM(),fragmentShader:` precision mediump float; precision mediump int; @@ -3088,7 +3088,7 @@ void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } - `,blending:CA,depthTest:!1,depthWrite:!1})}function qM(){return` + `,blending:SA,depthTest:!1,depthWrite:!1})}function qM(){return` precision mediump float; precision mediump int; @@ -3143,27 +3143,27 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function Lq(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,A=l===dw||l===rC,c=l===Lh||l===Ph;if(A||c)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let u=e.get(a);return t===null&&(t=new XF(n)),u=A?t.fromEquirectangular(a,u):t.fromCubemap(a,u),e.set(a,u),u.texture}else{if(e.has(a))return e.get(a).texture;{const u=a.image;if(A&&u&&u.height>0||c&&u&&i(u)){t===null&&(t=new XF(n));const f=A?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function i(a){let l=0;const A=6;for(let c=0;ce.maxTextureSize&&($=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const H=new Float32Array(D*$*4*d),I=new mH(H,D,$,d);I.type=AA,I.needsUpdate=!0;const v=M*4;for(let U=0;U0)return n;const i=e*t;let s=eU[i];if(s===void 0&&(s=new Float32Array(i),eU[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 mr(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t0||c&&u&&i(u)){t===null&&(t=new XF(n));const f=A?t.fromEquirectangular(a):t.fromCubemap(a);return e.set(a,f),a.addEventListener("dispose",s),f.texture}else return null}}}return a}function i(a){let l=0;const A=6;for(let c=0;ce.maxTextureSize&&($=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const H=new Float32Array(D*$*4*d),I=new mH(H,D,$,d);I.type=cA,I.needsUpdate=!0;const v=M*4;for(let U=0;U0)return n;const i=e*t;let s=eU[i];if(s===void 0&&(s=new Float32Array(i),eU[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 mr(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t":" "} ${a}: ${t[o]}`)}return r.join(` `)}function Pee(n){switch(n){case cs:return["Linear","( value )"];case pt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function aU(n,e,t){const r=n.getShaderParameter(e,35713),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+` -`+Lee(n.getShaderSource(e),o)}else return i}function Dee(n,e){const t=Pee(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function Oee(n,e){let t;switch(e){case NY:t="Linear";break;case kY:t="Reinhard";break;case QY:t="OptimizedCineon";break;case HY:t="ACESFilmic";break;case zY:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Nee(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.tangentSpaceNormalMap||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(bp).join(` +`+Lee(n.getShaderSource(e),o)}else return i}function Dee(n,e){const t=Pee(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function Oee(n,e){let t;switch(e){case NY:t="Linear";break;case kY:t="Reinhard";break;case QY:t="OptimizedCineon";break;case HY:t="ACESFilmic";break;case zY:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function Nee(n){return[n.extensionDerivatives||n.envMapCubeUVHeight||n.bumpMap||n.tangentSpaceNormalMap||n.clearcoatNormalMap||n.flatShading||n.shaderID==="physical"?"#extension GL_OES_standard_derivatives : enable":"",(n.extensionFragDepth||n.logarithmicDepthBuffer)&&n.rendererExtensionFragDepth?"#extension GL_EXT_frag_depth : enable":"",n.extensionDrawBuffers&&n.rendererExtensionDrawBuffers?"#extension GL_EXT_draw_buffers : require":"",(n.extensionShaderTextureLOD||n.envMap||n.transmission)&&n.rendererExtensionShaderTextureLod?"#extension GL_EXT_shader_texture_lod : enable":""].filter(Bp).join(` `)}function kee(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(` -`)}function Qee(n,e){const t={},r=n.getProgramParameter(e,35721);for(let i=0;i/gm;function lC(n){return n.replace(Hee,zee)}function zee(n,e){const t=xt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return lC(t)}const Gee=/#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 cU(n){return n.replace(Gee,Vee)}function Vee(n,e,t,r){let i="";for(let s=parseInt(e);s/gm;function lC(n){return n.replace(Hee,zee)}function zee(n,e){const t=xt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return lC(t)}const Gee=/#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 cU(n){return n.replace(Gee,Vee)}function Vee(n,e,t,r){let i="";for(let s=parseInt(e);s0&&(g+=` -`),m=[h,p].filter(bp).join(` +`),m=[h,p].filter(Bp).join(` `),m.length>0&&(m+=` `)):(g=[uU(t),"#define SHADER_NAME "+t.shaderName,p,t.instancing?"#define USE_INSTANCING":"",t.instancingColor?"#define USE_INSTANCING_COLOR":"",t.supportsVertexTextures?"#define VERTEX_TEXTURES":"",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 "+c:"",t.lightMap?"#define USE_LIGHTMAP":"",t.aoMap?"#define USE_AOMAP":"",t.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",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.displacementMap&&t.supportsVertexTextures?"#define USE_DISPLACEMENTMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",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&&t.isWebGL2?"#define USE_MORPHCOLORS":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE":"",t.morphTargetsCount>0&&t.isWebGL2?"#define MORPHTARGETS_TEXTURE_STRIDE "+t.morphTextureStride:"",t.morphTargetsCount>0&&t.isWebGL2?"#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.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","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","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_TANGENT"," attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )"," attribute vec4 color;","#elif defined( USE_COLOR )"," attribute vec3 color;","#endif","#if ( defined( USE_MORPHTARGETS ) && ! defined( MORPHTARGETS_TEXTURE ) )"," attribute vec3 morphTarget0;"," attribute vec3 morphTarget1;"," attribute vec3 morphTarget2;"," attribute vec3 morphTarget3;"," #ifdef USE_MORPHNORMALS"," attribute vec3 morphNormal0;"," attribute vec3 morphNormal1;"," attribute vec3 morphNormal2;"," attribute vec3 morphNormal3;"," #else"," attribute vec3 morphTarget4;"," attribute vec3 morphTarget5;"," attribute vec3 morphTarget6;"," attribute vec3 morphTarget7;"," #endif","#endif","#ifdef USE_SKINNING"," attribute vec4 skinIndex;"," attribute vec4 skinWeight;","#endif",` -`].filter(bp).join(` -`),m=[h,uU(t),"#define SHADER_NAME "+t.shaderName,p,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+A:"",t.envMap?"#define "+c:"",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.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",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.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==ll?"#define TONE_MAPPING":"",t.toneMapping!==ll?xt.tonemapping_pars_fragment:"",t.toneMapping!==ll?Oee("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",xt.encodings_pars_fragment,Dee("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` -`].filter(bp).join(` +`].filter(Bp).join(` +`),m=[h,uU(t),"#define SHADER_NAME "+t.shaderName,p,t.useFog&&t.fog?"#define USE_FOG":"",t.useFog&&t.fogExp2?"#define FOG_EXP2":"",t.map?"#define USE_MAP":"",t.matcap?"#define USE_MATCAP":"",t.envMap?"#define USE_ENVMAP":"",t.envMap?"#define "+A:"",t.envMap?"#define "+c:"",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.emissiveMap?"#define USE_EMISSIVEMAP":"",t.bumpMap?"#define USE_BUMPMAP":"",t.normalMap?"#define USE_NORMALMAP":"",t.normalMap&&t.objectSpaceNormalMap?"#define OBJECTSPACE_NORMALMAP":"",t.normalMap&&t.tangentSpaceNormalMap?"#define TANGENTSPACE_NORMALMAP":"",t.clearcoat?"#define USE_CLEARCOAT":"",t.clearcoatMap?"#define USE_CLEARCOATMAP":"",t.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",t.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",t.iridescence?"#define USE_IRIDESCENCE":"",t.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",t.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",t.specularMap?"#define USE_SPECULARMAP":"",t.specularIntensityMap?"#define USE_SPECULARINTENSITYMAP":"",t.specularColorMap?"#define USE_SPECULARCOLORMAP":"",t.roughnessMap?"#define USE_ROUGHNESSMAP":"",t.metalnessMap?"#define USE_METALNESSMAP":"",t.alphaMap?"#define USE_ALPHAMAP":"",t.alphaTest?"#define USE_ALPHATEST":"",t.sheen?"#define USE_SHEEN":"",t.sheenColorMap?"#define USE_SHEENCOLORMAP":"",t.sheenRoughnessMap?"#define USE_SHEENROUGHNESSMAP":"",t.transmission?"#define USE_TRANSMISSION":"",t.transmissionMap?"#define USE_TRANSMISSIONMAP":"",t.thicknessMap?"#define USE_THICKNESSMAP":"",t.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",t.vertexTangents?"#define USE_TANGENT":"",t.vertexColors||t.instancingColor?"#define USE_COLOR":"",t.vertexAlphas?"#define USE_COLOR_ALPHA":"",t.vertexUvs?"#define USE_UV":"",t.uvsVertexOnly?"#define UVS_VERTEX_ONLY":"",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.physicallyCorrectLights?"#define PHYSICALLY_CORRECT_LIGHTS":"",t.logarithmicDepthBuffer?"#define USE_LOGDEPTHBUF":"",t.logarithmicDepthBuffer&&t.rendererExtensionFragDepth?"#define USE_LOGDEPTHBUF_EXT":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",t.toneMapping!==Al?"#define TONE_MAPPING":"",t.toneMapping!==Al?xt.tonemapping_pars_fragment:"",t.toneMapping!==Al?Oee("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",xt.encodings_pars_fragment,Dee("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`].filter(Bp).join(` `)),o=lC(o),o=lU(o,t),o=AU(o,t),a=lC(a),a=lU(a,t),a=AU(a,t),o=cU(o),a=cU(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es `,g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` @@ -3173,7 +3173,7 @@ precision `+n.precision+" int;";return n.precision==="highp"?e+=` Program Info Log: `+M+` `+v+` -`+E)}else M!==""?console.warn("THREE.WebGLProgram: Program Info Log:",M):(D===""||$==="")&&(I=!1);I&&(this.diagnostics={runnable:H,programLog:M,vertexShader:{log:D,prefix:g},fragmentShader:{log:$,prefix:m}})}i.deleteShader(_),i.deleteShader(C);let S;this.getUniforms=function(){return S===void 0&&(S=new ay(i,d)),S};let b;return this.getAttributes=function(){return b===void 0&&(b=Qee(i,d)),b},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(d),this.program=void 0},this.name=t.shaderName,this.id=Uee++,this.cacheKey=e,this.usedTimes=1,this.program=d,this.vertexShader=_,this.fragmentShader=C,this}let Zee=0;class Jee{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 qee(e),t.set(e,r)),r}}class qee{constructor(e){this.id=Zee++,this.code=e,this.usedTimes=0}}function ete(n,e,t,r,i,s,o){const a=new XM,l=new Jee,A=[],c=i.isWebGL2,u=i.logarithmicDepthBuffer,f=i.vertexTextures;let h=i.precision;const p={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 d(b,M,D,$,H){const I=$.fog,v=H.geometry,E=b.isMeshStandardMaterial?$.environment:null,U=(b.isMeshStandardMaterial?t:e).get(b.envMap||E),P=U&&U.mapping===kx?U.image.height:null,L=p[b.type];b.precision!==null&&(h=i.getMaxPrecision(b.precision),h!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",h,"instead."));const z=v.morphAttributes.position||v.morphAttributes.normal||v.morphAttributes.color,K=z!==void 0?z.length:0;let O=0;v.morphAttributes.position!==void 0&&(O=1),v.morphAttributes.normal!==void 0&&(O=2),v.morphAttributes.color!==void 0&&(O=3);let B,W,ee,F;if(L){const pe=Wo[L];B=pe.vertexShader,W=pe.fragmentShader}else B=b.vertexShader,W=b.fragmentShader,l.update(b),ee=l.getVertexShaderID(b),F=l.getFragmentShaderID(b);const X=n.getRenderTarget(),ue=b.alphaTest>0,le=b.clearcoat>0,oe=b.iridescence>0;return{isWebGL2:c,shaderID:L,shaderName:b.type,vertexShader:B,fragmentShader:W,defines:b.defines,customVertexShaderID:ee,customFragmentShaderID:F,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:h,instancing:H.isInstancedMesh===!0,instancingColor:H.isInstancedMesh===!0&&H.instanceColor!==null,supportsVertexTextures:f,outputEncoding:X===null?n.outputEncoding:X.isXRRenderTarget===!0?X.texture.encoding:cs,map:!!b.map,matcap:!!b.matcap,envMap:!!U,envMapMode:U&&U.mapping,envMapCubeUVHeight:P,lightMap:!!b.lightMap,aoMap:!!b.aoMap,emissiveMap:!!b.emissiveMap,bumpMap:!!b.bumpMap,normalMap:!!b.normalMap,objectSpaceNormalMap:b.normalMapType===uX,tangentSpaceNormalMap:b.normalMapType===Jh,decodeVideoTexture:!!b.map&&b.map.isVideoTexture===!0&&b.map.encoding===pt,clearcoat:le,clearcoatMap:le&&!!b.clearcoatMap,clearcoatRoughnessMap:le&&!!b.clearcoatRoughnessMap,clearcoatNormalMap:le&&!!b.clearcoatNormalMap,iridescence:oe,iridescenceMap:oe&&!!b.iridescenceMap,iridescenceThicknessMap:oe&&!!b.iridescenceThicknessMap,displacementMap:!!b.displacementMap,roughnessMap:!!b.roughnessMap,metalnessMap:!!b.metalnessMap,specularMap:!!b.specularMap,specularIntensityMap:!!b.specularIntensityMap,specularColorMap:!!b.specularColorMap,opaque:b.transparent===!1&&b.blending===ah,alphaMap:!!b.alphaMap,alphaTest:ue,gradientMap:!!b.gradientMap,sheen:b.sheen>0,sheenColorMap:!!b.sheenColorMap,sheenRoughnessMap:!!b.sheenRoughnessMap,transmission:b.transmission>0,transmissionMap:!!b.transmissionMap,thicknessMap:!!b.thicknessMap,combine:b.combine,vertexTangents:!!b.normalMap&&!!v.attributes.tangent,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!v.attributes.color&&v.attributes.color.itemSize===4,vertexUvs:!!b.map||!!b.bumpMap||!!b.normalMap||!!b.specularMap||!!b.alphaMap||!!b.emissiveMap||!!b.roughnessMap||!!b.metalnessMap||!!b.clearcoatMap||!!b.clearcoatRoughnessMap||!!b.clearcoatNormalMap||!!b.iridescenceMap||!!b.iridescenceThicknessMap||!!b.displacementMap||!!b.transmissionMap||!!b.thicknessMap||!!b.specularIntensityMap||!!b.specularColorMap||!!b.sheenColorMap||!!b.sheenRoughnessMap,uvsVertexOnly:!(b.map||b.bumpMap||b.normalMap||b.specularMap||b.alphaMap||b.emissiveMap||b.roughnessMap||b.metalnessMap||b.clearcoatNormalMap||b.iridescenceMap||b.iridescenceThicknessMap||b.transmission>0||b.transmissionMap||b.thicknessMap||b.specularIntensityMap||b.specularColorMap||b.sheen>0||b.sheenColorMap||b.sheenRoughnessMap)&&!!b.displacementMap,fog:!!I,useFog:b.fog===!0,fogExp2:I&&I.isFogExp2,flatShading:!!b.flatShading,sizeAttenuation:b.sizeAttenuation,logarithmicDepthBuffer:u,skinning:H.isSkinnedMesh===!0,morphTargets:v.morphAttributes.position!==void 0,morphNormals:v.morphAttributes.normal!==void 0,morphColors:v.morphAttributes.color!==void 0,morphTargetsCount:K,morphTextureStride:O,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&D.length>0,shadowMapType:n.shadowMap.type,toneMapping:b.toneMapped?n.toneMapping:ll,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===ui,flipSided:b.side===Xr,useDepthPacking:!!b.depthPacking,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:b.extensions&&b.extensions.derivatives,extensionFragDepth:b.extensions&&b.extensions.fragDepth,extensionDrawBuffers:b.extensions&&b.extensions.drawBuffers,extensionShaderTextureLOD:b.extensions&&b.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function g(b){const M=[];if(b.shaderID?M.push(b.shaderID):(M.push(b.customVertexShaderID),M.push(b.customFragmentShaderID)),b.defines!==void 0)for(const D in b.defines)M.push(D),M.push(b.defines[D]);return b.isRawShaderMaterial===!1&&(m(M,b),y(M,b),M.push(n.outputEncoding)),M.push(b.customProgramCacheKey),M.join()}function m(b,M){b.push(M.precision),b.push(M.outputEncoding),b.push(M.envMapMode),b.push(M.envMapCubeUVHeight),b.push(M.combine),b.push(M.vertexUvs),b.push(M.fogExp2),b.push(M.sizeAttenuation),b.push(M.morphTargetsCount),b.push(M.morphAttributeCount),b.push(M.numDirLights),b.push(M.numPointLights),b.push(M.numSpotLights),b.push(M.numSpotLightMaps),b.push(M.numHemiLights),b.push(M.numRectAreaLights),b.push(M.numDirLightShadows),b.push(M.numPointLightShadows),b.push(M.numSpotLightShadows),b.push(M.numSpotLightShadowsWithMaps),b.push(M.shadowMapType),b.push(M.toneMapping),b.push(M.numClippingPlanes),b.push(M.numClipIntersection),b.push(M.depthPacking)}function y(b,M){a.disableAll(),M.isWebGL2&&a.enable(0),M.supportsVertexTextures&&a.enable(1),M.instancing&&a.enable(2),M.instancingColor&&a.enable(3),M.map&&a.enable(4),M.matcap&&a.enable(5),M.envMap&&a.enable(6),M.lightMap&&a.enable(7),M.aoMap&&a.enable(8),M.emissiveMap&&a.enable(9),M.bumpMap&&a.enable(10),M.normalMap&&a.enable(11),M.objectSpaceNormalMap&&a.enable(12),M.tangentSpaceNormalMap&&a.enable(13),M.clearcoat&&a.enable(14),M.clearcoatMap&&a.enable(15),M.clearcoatRoughnessMap&&a.enable(16),M.clearcoatNormalMap&&a.enable(17),M.iridescence&&a.enable(18),M.iridescenceMap&&a.enable(19),M.iridescenceThicknessMap&&a.enable(20),M.displacementMap&&a.enable(21),M.specularMap&&a.enable(22),M.roughnessMap&&a.enable(23),M.metalnessMap&&a.enable(24),M.gradientMap&&a.enable(25),M.alphaMap&&a.enable(26),M.alphaTest&&a.enable(27),M.vertexColors&&a.enable(28),M.vertexAlphas&&a.enable(29),M.vertexUvs&&a.enable(30),M.vertexTangents&&a.enable(31),M.uvsVertexOnly&&a.enable(32),b.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.skinning&&a.enable(4),M.morphTargets&&a.enable(5),M.morphNormals&&a.enable(6),M.morphColors&&a.enable(7),M.premultipliedAlpha&&a.enable(8),M.shadowMapEnabled&&a.enable(9),M.physicallyCorrectLights&&a.enable(10),M.doubleSided&&a.enable(11),M.flipSided&&a.enable(12),M.useDepthPacking&&a.enable(13),M.dithering&&a.enable(14),M.specularIntensityMap&&a.enable(15),M.specularColorMap&&a.enable(16),M.transmission&&a.enable(17),M.transmissionMap&&a.enable(18),M.thicknessMap&&a.enable(19),M.sheen&&a.enable(20),M.sheenColorMap&&a.enable(21),M.sheenRoughnessMap&&a.enable(22),M.decodeVideoTexture&&a.enable(23),M.opaque&&a.enable(24),b.push(a.mask)}function w(b){const M=p[b.type];let D;if(M){const $=Wo[M];D=ZM.clone($.uniforms)}else D=b.uniforms;return D}function x(b,M){let D;for(let $=0,H=A.length;$0?r.push(m):h.transparent===!0?i.push(m):t.push(m)}function l(u,f,h,p,d,g){const m=o(u,f,h,p,d,g);h.transmission>0?r.unshift(m):h.transparent===!0?i.unshift(m):t.unshift(m)}function A(u,f){t.length>1&&t.sort(u||nte),r.length>1&&r.sort(f||fU),i.length>1&&i.sort(f||fU)}function c(){for(let u=e,f=n.length;u=s.length?(o=new hU,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function ite(){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 Z,color:new Qe};break;case"SpotLight":t={position:new Z,direction:new Z,color:new Qe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Z,color:new Qe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Z,skyColor:new Qe,groundColor:new Qe};break;case"RectAreaLight":t={color:new Qe,position:new Z,halfWidth:new Z,halfHeight:new Z};break}return n[e.id]=t,t}}}function ste(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let ote=0;function ate(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function lte(n,e){const t=new ite,r=ste(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let c=0;c<9;c++)i.probe.push(new Z);const s=new Z,o=new je,a=new je;function l(c,u){let f=0,h=0,p=0;for(let $=0;$<9;$++)i.probe[$].set(0,0,0);let d=0,g=0,m=0,y=0,w=0,x=0,_=0,C=0,S=0,b=0;c.sort(ate);const M=u!==!0?Math.PI:1;for(let $=0,H=c.length;$0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ne.LTC_FLOAT_1,i.rectAreaLTC2=Ne.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Ne.LTC_HALF_1,i.rectAreaLTC2=Ne.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=f,i.ambient[1]=h,i.ambient[2]=p;const D=i.hash;(D.directionalLength!==d||D.pointLength!==g||D.spotLength!==m||D.rectAreaLength!==y||D.hemiLength!==w||D.numDirectionalShadows!==x||D.numPointShadows!==_||D.numSpotShadows!==C||D.numSpotMaps!==S)&&(i.directional.length=d,i.spot.length=m,i.rectArea.length=y,i.point.length=g,i.hemi.length=w,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=_,i.pointShadowMap.length=_,i.spotShadow.length=C,i.spotShadowMap.length=C,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=_,i.spotLightMatrix.length=C+S-b,i.spotLightMap.length=S,i.numSpotLightShadowsWithMaps=b,D.directionalLength=d,D.pointLength=g,D.spotLength=m,D.rectAreaLength=y,D.hemiLength=w,D.numDirectionalShadows=x,D.numPointShadows=_,D.numSpotShadows=C,D.numSpotMaps=S,i.version=ote++)}function A(c,u){let f=0,h=0,p=0,d=0,g=0;const m=u.matrixWorldInverse;for(let y=0,w=c.length;y=a.length?(l=new dU(n,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class cte extends is{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=AX,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 ute extends is{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Z,this.nearDistance=1,this.farDistance=1e3,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.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const fte=`void main() { +`+E)}else M!==""?console.warn("THREE.WebGLProgram: Program Info Log:",M):(D===""||$==="")&&(I=!1);I&&(this.diagnostics={runnable:H,programLog:M,vertexShader:{log:D,prefix:g},fragmentShader:{log:$,prefix:m}})}i.deleteShader(_),i.deleteShader(C);let S;this.getUniforms=function(){return S===void 0&&(S=new ly(i,d)),S};let b;return this.getAttributes=function(){return b===void 0&&(b=Qee(i,d)),b},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(d),this.program=void 0},this.name=t.shaderName,this.id=Uee++,this.cacheKey=e,this.usedTimes=1,this.program=d,this.vertexShader=_,this.fragmentShader=C,this}let Zee=0;class Jee{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 qee(e),t.set(e,r)),r}}class qee{constructor(e){this.id=Zee++,this.code=e,this.usedTimes=0}}function ete(n,e,t,r,i,s,o){const a=new XM,l=new Jee,A=[],c=i.isWebGL2,u=i.logarithmicDepthBuffer,f=i.vertexTextures;let h=i.precision;const p={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 d(b,M,D,$,H){const I=$.fog,v=H.geometry,E=b.isMeshStandardMaterial?$.environment:null,U=(b.isMeshStandardMaterial?t:e).get(b.envMap||E),P=U&&U.mapping===Qx?U.image.height:null,L=p[b.type];b.precision!==null&&(h=i.getMaxPrecision(b.precision),h!==b.precision&&console.warn("THREE.WebGLProgram.getParameters:",b.precision,"not supported, using",h,"instead."));const z=v.morphAttributes.position||v.morphAttributes.normal||v.morphAttributes.color,K=z!==void 0?z.length:0;let O=0;v.morphAttributes.position!==void 0&&(O=1),v.morphAttributes.normal!==void 0&&(O=2),v.morphAttributes.color!==void 0&&(O=3);let B,W,ee,F;if(L){const pe=Ko[L];B=pe.vertexShader,W=pe.fragmentShader}else B=b.vertexShader,W=b.fragmentShader,l.update(b),ee=l.getVertexShaderID(b),F=l.getFragmentShaderID(b);const X=n.getRenderTarget(),ue=b.alphaTest>0,le=b.clearcoat>0,oe=b.iridescence>0;return{isWebGL2:c,shaderID:L,shaderName:b.type,vertexShader:B,fragmentShader:W,defines:b.defines,customVertexShaderID:ee,customFragmentShaderID:F,isRawShaderMaterial:b.isRawShaderMaterial===!0,glslVersion:b.glslVersion,precision:h,instancing:H.isInstancedMesh===!0,instancingColor:H.isInstancedMesh===!0&&H.instanceColor!==null,supportsVertexTextures:f,outputEncoding:X===null?n.outputEncoding:X.isXRRenderTarget===!0?X.texture.encoding:cs,map:!!b.map,matcap:!!b.matcap,envMap:!!U,envMapMode:U&&U.mapping,envMapCubeUVHeight:P,lightMap:!!b.lightMap,aoMap:!!b.aoMap,emissiveMap:!!b.emissiveMap,bumpMap:!!b.bumpMap,normalMap:!!b.normalMap,objectSpaceNormalMap:b.normalMapType===uX,tangentSpaceNormalMap:b.normalMapType===qh,decodeVideoTexture:!!b.map&&b.map.isVideoTexture===!0&&b.map.encoding===pt,clearcoat:le,clearcoatMap:le&&!!b.clearcoatMap,clearcoatRoughnessMap:le&&!!b.clearcoatRoughnessMap,clearcoatNormalMap:le&&!!b.clearcoatNormalMap,iridescence:oe,iridescenceMap:oe&&!!b.iridescenceMap,iridescenceThicknessMap:oe&&!!b.iridescenceThicknessMap,displacementMap:!!b.displacementMap,roughnessMap:!!b.roughnessMap,metalnessMap:!!b.metalnessMap,specularMap:!!b.specularMap,specularIntensityMap:!!b.specularIntensityMap,specularColorMap:!!b.specularColorMap,opaque:b.transparent===!1&&b.blending===lh,alphaMap:!!b.alphaMap,alphaTest:ue,gradientMap:!!b.gradientMap,sheen:b.sheen>0,sheenColorMap:!!b.sheenColorMap,sheenRoughnessMap:!!b.sheenRoughnessMap,transmission:b.transmission>0,transmissionMap:!!b.transmissionMap,thicknessMap:!!b.thicknessMap,combine:b.combine,vertexTangents:!!b.normalMap&&!!v.attributes.tangent,vertexColors:b.vertexColors,vertexAlphas:b.vertexColors===!0&&!!v.attributes.color&&v.attributes.color.itemSize===4,vertexUvs:!!b.map||!!b.bumpMap||!!b.normalMap||!!b.specularMap||!!b.alphaMap||!!b.emissiveMap||!!b.roughnessMap||!!b.metalnessMap||!!b.clearcoatMap||!!b.clearcoatRoughnessMap||!!b.clearcoatNormalMap||!!b.iridescenceMap||!!b.iridescenceThicknessMap||!!b.displacementMap||!!b.transmissionMap||!!b.thicknessMap||!!b.specularIntensityMap||!!b.specularColorMap||!!b.sheenColorMap||!!b.sheenRoughnessMap,uvsVertexOnly:!(b.map||b.bumpMap||b.normalMap||b.specularMap||b.alphaMap||b.emissiveMap||b.roughnessMap||b.metalnessMap||b.clearcoatNormalMap||b.iridescenceMap||b.iridescenceThicknessMap||b.transmission>0||b.transmissionMap||b.thicknessMap||b.specularIntensityMap||b.specularColorMap||b.sheen>0||b.sheenColorMap||b.sheenRoughnessMap)&&!!b.displacementMap,fog:!!I,useFog:b.fog===!0,fogExp2:I&&I.isFogExp2,flatShading:!!b.flatShading,sizeAttenuation:b.sizeAttenuation,logarithmicDepthBuffer:u,skinning:H.isSkinnedMesh===!0,morphTargets:v.morphAttributes.position!==void 0,morphNormals:v.morphAttributes.normal!==void 0,morphColors:v.morphAttributes.color!==void 0,morphTargetsCount:K,morphTextureStride:O,numDirLights:M.directional.length,numPointLights:M.point.length,numSpotLights:M.spot.length,numSpotLightMaps:M.spotLightMap.length,numRectAreaLights:M.rectArea.length,numHemiLights:M.hemi.length,numDirLightShadows:M.directionalShadowMap.length,numPointLightShadows:M.pointShadowMap.length,numSpotLightShadows:M.spotShadowMap.length,numSpotLightShadowsWithMaps:M.numSpotLightShadowsWithMaps,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:b.dithering,shadowMapEnabled:n.shadowMap.enabled&&D.length>0,shadowMapType:n.shadowMap.type,toneMapping:b.toneMapped?n.toneMapping:Al,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===ui,flipSided:b.side===Xr,useDepthPacking:!!b.depthPacking,depthPacking:b.depthPacking||0,index0AttributeName:b.index0AttributeName,extensionDerivatives:b.extensions&&b.extensions.derivatives,extensionFragDepth:b.extensions&&b.extensions.fragDepth,extensionDrawBuffers:b.extensions&&b.extensions.drawBuffers,extensionShaderTextureLOD:b.extensions&&b.extensions.shaderTextureLOD,rendererExtensionFragDepth:c||r.has("EXT_frag_depth"),rendererExtensionDrawBuffers:c||r.has("WEBGL_draw_buffers"),rendererExtensionShaderTextureLod:c||r.has("EXT_shader_texture_lod"),customProgramCacheKey:b.customProgramCacheKey()}}function g(b){const M=[];if(b.shaderID?M.push(b.shaderID):(M.push(b.customVertexShaderID),M.push(b.customFragmentShaderID)),b.defines!==void 0)for(const D in b.defines)M.push(D),M.push(b.defines[D]);return b.isRawShaderMaterial===!1&&(m(M,b),y(M,b),M.push(n.outputEncoding)),M.push(b.customProgramCacheKey),M.join()}function m(b,M){b.push(M.precision),b.push(M.outputEncoding),b.push(M.envMapMode),b.push(M.envMapCubeUVHeight),b.push(M.combine),b.push(M.vertexUvs),b.push(M.fogExp2),b.push(M.sizeAttenuation),b.push(M.morphTargetsCount),b.push(M.morphAttributeCount),b.push(M.numDirLights),b.push(M.numPointLights),b.push(M.numSpotLights),b.push(M.numSpotLightMaps),b.push(M.numHemiLights),b.push(M.numRectAreaLights),b.push(M.numDirLightShadows),b.push(M.numPointLightShadows),b.push(M.numSpotLightShadows),b.push(M.numSpotLightShadowsWithMaps),b.push(M.shadowMapType),b.push(M.toneMapping),b.push(M.numClippingPlanes),b.push(M.numClipIntersection),b.push(M.depthPacking)}function y(b,M){a.disableAll(),M.isWebGL2&&a.enable(0),M.supportsVertexTextures&&a.enable(1),M.instancing&&a.enable(2),M.instancingColor&&a.enable(3),M.map&&a.enable(4),M.matcap&&a.enable(5),M.envMap&&a.enable(6),M.lightMap&&a.enable(7),M.aoMap&&a.enable(8),M.emissiveMap&&a.enable(9),M.bumpMap&&a.enable(10),M.normalMap&&a.enable(11),M.objectSpaceNormalMap&&a.enable(12),M.tangentSpaceNormalMap&&a.enable(13),M.clearcoat&&a.enable(14),M.clearcoatMap&&a.enable(15),M.clearcoatRoughnessMap&&a.enable(16),M.clearcoatNormalMap&&a.enable(17),M.iridescence&&a.enable(18),M.iridescenceMap&&a.enable(19),M.iridescenceThicknessMap&&a.enable(20),M.displacementMap&&a.enable(21),M.specularMap&&a.enable(22),M.roughnessMap&&a.enable(23),M.metalnessMap&&a.enable(24),M.gradientMap&&a.enable(25),M.alphaMap&&a.enable(26),M.alphaTest&&a.enable(27),M.vertexColors&&a.enable(28),M.vertexAlphas&&a.enable(29),M.vertexUvs&&a.enable(30),M.vertexTangents&&a.enable(31),M.uvsVertexOnly&&a.enable(32),b.push(a.mask),a.disableAll(),M.fog&&a.enable(0),M.useFog&&a.enable(1),M.flatShading&&a.enable(2),M.logarithmicDepthBuffer&&a.enable(3),M.skinning&&a.enable(4),M.morphTargets&&a.enable(5),M.morphNormals&&a.enable(6),M.morphColors&&a.enable(7),M.premultipliedAlpha&&a.enable(8),M.shadowMapEnabled&&a.enable(9),M.physicallyCorrectLights&&a.enable(10),M.doubleSided&&a.enable(11),M.flipSided&&a.enable(12),M.useDepthPacking&&a.enable(13),M.dithering&&a.enable(14),M.specularIntensityMap&&a.enable(15),M.specularColorMap&&a.enable(16),M.transmission&&a.enable(17),M.transmissionMap&&a.enable(18),M.thicknessMap&&a.enable(19),M.sheen&&a.enable(20),M.sheenColorMap&&a.enable(21),M.sheenRoughnessMap&&a.enable(22),M.decodeVideoTexture&&a.enable(23),M.opaque&&a.enable(24),b.push(a.mask)}function w(b){const M=p[b.type];let D;if(M){const $=Ko[M];D=ZM.clone($.uniforms)}else D=b.uniforms;return D}function x(b,M){let D;for(let $=0,H=A.length;$0?r.push(m):h.transparent===!0?i.push(m):t.push(m)}function l(u,f,h,p,d,g){const m=o(u,f,h,p,d,g);h.transmission>0?r.unshift(m):h.transparent===!0?i.unshift(m):t.unshift(m)}function A(u,f){t.length>1&&t.sort(u||nte),r.length>1&&r.sort(f||fU),i.length>1&&i.sort(f||fU)}function c(){for(let u=e,f=n.length;u=s.length?(o=new hU,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function ite(){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 Z,color:new Qe};break;case"SpotLight":t={position:new Z,direction:new Z,color:new Qe,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Z,color:new Qe,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Z,skyColor:new Qe,groundColor:new Qe};break;case"RectAreaLight":t={color:new Qe,position:new Z,halfWidth:new Z,halfHeight:new Z};break}return n[e.id]=t,t}}}function ste(){const n={};return{get:function(e){if(n[e.id]!==void 0)return n[e.id];let t;switch(e.type){case"DirectionalLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new $e,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let ote=0;function ate(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function lte(n,e){const t=new ite,r=ste(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-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};for(let c=0;c<9;c++)i.probe.push(new Z);const s=new Z,o=new je,a=new je;function l(c,u){let f=0,h=0,p=0;for(let $=0;$<9;$++)i.probe[$].set(0,0,0);let d=0,g=0,m=0,y=0,w=0,x=0,_=0,C=0,S=0,b=0;c.sort(ate);const M=u!==!0?Math.PI:1;for(let $=0,H=c.length;$0&&(e.isWebGL2||n.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=Ne.LTC_FLOAT_1,i.rectAreaLTC2=Ne.LTC_FLOAT_2):n.has("OES_texture_half_float_linear")===!0?(i.rectAreaLTC1=Ne.LTC_HALF_1,i.rectAreaLTC2=Ne.LTC_HALF_2):console.error("THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.")),i.ambient[0]=f,i.ambient[1]=h,i.ambient[2]=p;const D=i.hash;(D.directionalLength!==d||D.pointLength!==g||D.spotLength!==m||D.rectAreaLength!==y||D.hemiLength!==w||D.numDirectionalShadows!==x||D.numPointShadows!==_||D.numSpotShadows!==C||D.numSpotMaps!==S)&&(i.directional.length=d,i.spot.length=m,i.rectArea.length=y,i.point.length=g,i.hemi.length=w,i.directionalShadow.length=x,i.directionalShadowMap.length=x,i.pointShadow.length=_,i.pointShadowMap.length=_,i.spotShadow.length=C,i.spotShadowMap.length=C,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=_,i.spotLightMatrix.length=C+S-b,i.spotLightMap.length=S,i.numSpotLightShadowsWithMaps=b,D.directionalLength=d,D.pointLength=g,D.spotLength=m,D.rectAreaLength=y,D.hemiLength=w,D.numDirectionalShadows=x,D.numPointShadows=_,D.numSpotShadows=C,D.numSpotMaps=S,i.version=ote++)}function A(c,u){let f=0,h=0,p=0,d=0,g=0;const m=u.matrixWorldInverse;for(let y=0,w=c.length;y=a.length?(l=new dU(n,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class cte extends is{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=AX,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 ute extends is{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.referencePosition=new Z,this.nearDistance=1,this.farDistance=1e3,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.referencePosition.copy(e.referencePosition),this.nearDistance=e.nearDistance,this.farDistance=e.farDistance,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}}const fte=`void main() { gl_Position = vec4( position, 1.0 ); }`,hte=`uniform sampler2D shadow_pass; uniform vec2 resolution; @@ -3201,17 +3201,17 @@ void main() { squared_mean = squared_mean / samples; float std_dev = sqrt( squared_mean - mean * mean ); gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function dte(n,e,t){let r=new JM;const i=new $e,s=new $e,o=new Qt,a=new cte({depthPacking:cX}),l=new ute,A={},c=t.maxTextureSize,u={[ls]:Xr,[Xr]:ls,[ui]:ui},f=new Cr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new $e},radius:{value:4}},vertexShader:fte,fragmentShader:hte}),h=f.clone();h.defines.HORIZONTAL_PASS=1;const p=new $t;p.setAttribute("position",new At(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const d=new xn(p,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=oH,this.render=function(x,_,C){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||x.length===0)return;const S=n.getRenderTarget(),b=n.getActiveCubeFace(),M=n.getActiveMipmapLevel(),D=n.state;D.setBlending(CA),D.buffers.color.setClear(1,1,1,1),D.buffers.depth.setTest(!0),D.setScissorTest(!1);for(let $=0,H=x.length;$c||i.y>c)&&(i.x>c&&(s.x=Math.floor(c/E.x),i.x=s.x*E.x,v.mapSize.x=s.x),i.y>c&&(s.y=Math.floor(c/E.y),i.y=s.y*E.y,v.mapSize.y=s.y)),v.map===null){const P=this.type!==_p?{minFilter:$n,magFilter:$n}:{};v.map=new ma(i.x,i.y,P),v.map.texture.name=I.name+".shadowMap",v.camera.updateProjectionMatrix()}n.setRenderTarget(v.map),n.clear();const U=v.getViewportCount();for(let P=0;P0||_.map&&_.alphaTest>0){const H=D.uuid,I=_.uuid;let v=A[H];v===void 0&&(v={},A[H]=v);let E=v[I];E===void 0&&(E=D.clone(),v[I]=E),D=E}return D.visible=_.visible,D.wireframe=_.wireframe,M===_p?D.side=_.shadowSide!==null?_.shadowSide:_.side:D.side=_.shadowSide!==null?_.shadowSide:u[_.side],D.alphaMap=_.alphaMap,D.alphaTest=_.alphaTest,D.map=_.map,D.clipShadows=_.clipShadows,D.clippingPlanes=_.clippingPlanes,D.clipIntersection=_.clipIntersection,D.displacementMap=_.displacementMap,D.displacementScale=_.displacementScale,D.displacementBias=_.displacementBias,D.wireframeLinewidth=_.wireframeLinewidth,D.linewidth=_.linewidth,C.isPointLight===!0&&D.isMeshDistanceMaterial===!0&&(D.referencePosition.setFromMatrixPosition(C.matrixWorld),D.nearDistance=S,D.farDistance=b),D}function w(x,_,C,S,b){if(x.visible===!1)return;if(x.layers.test(_.layers)&&(x.isMesh||x.isLine||x.isPoints)&&(x.castShadow||x.receiveShadow&&b===_p)&&(!x.frustumCulled||r.intersectsObject(x))){x.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,x.matrixWorld);const $=e.update(x),H=x.material;if(Array.isArray(H)){const I=$.groups;for(let v=0,E=I.length;v=1):L.indexOf("OpenGL ES")!==-1&&(P=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),U=P>=2);let z=null,K={};const O=n.getParameter(3088),B=n.getParameter(2978),W=new Qt().fromArray(O),ee=new Qt().fromArray(B);function F(fe,Ce,Se){const Fe=new Uint8Array(4),We=n.createTexture();n.bindTexture(fe,We),n.texParameteri(fe,10241,9728),n.texParameteri(fe,10240,9728);for(let qe=0;qe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap;let d;const g=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(N,j){return m?new OffscreenCanvas(N,j):Hm("canvas")}function w(N,j,se,he){let me=1;if((N.width>he||N.height>he)&&(me=he/Math.max(N.width,N.height)),me<1||j===!0)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap){const G=j?gw:Math.floor,R=G(me*N.width),T=G(me*N.height);d===void 0&&(d=y(R,T));const V=se?y(R,T):d;return V.width=R,V.height=T,V.getContext("2d").drawImage(N,0,0,R,T),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+N.width+"x"+N.height+") to ("+R+"x"+T+")."),V}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+N.width+"x"+N.height+")."),N;return N}function x(N){return aC(N.width)&&aC(N.height)}function _(N){return a?!1:N.wrapS!==Ai||N.wrapT!==Ai||N.minFilter!==$n&&N.minFilter!==si}function C(N,j){return N.generateMipmaps&&j&&N.minFilter!==$n&&N.minFilter!==si}function S(N){n.generateMipmap(N)}function b(N,j,se,he,me=!1){if(a===!1)return j;if(N!==null){if(n[N]!==void 0)return n[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let G=j;return j===6403&&(se===5126&&(G=33326),se===5131&&(G=33325),se===5121&&(G=33321)),j===33319&&(se===5126&&(G=33328),se===5131&&(G=33327),se===5121&&(G=33323)),j===6408&&(se===5126&&(G=34836),se===5131&&(G=34842),se===5121&&(G=he===pt&&me===!1?35907:32856),se===32819&&(G=32854),se===32820&&(G=32855)),(G===33325||G===33326||G===33327||G===33328||G===34842||G===34836)&&e.get("EXT_color_buffer_float"),G}function M(N,j,se){return C(N,se)===!0||N.isFramebufferTexture&&N.minFilter!==$n&&N.minFilter!==si?Math.log2(Math.max(j.width,j.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?j.mipmaps.length:1}function D(N){return N===$n||N===pw||N===qp?9728:9729}function $(N){const j=N.target;j.removeEventListener("dispose",$),I(j),j.isVideoTexture&&p.delete(j)}function H(N){const j=N.target;j.removeEventListener("dispose",H),E(j)}function I(N){const j=r.get(N);if(j.__webglInit===void 0)return;const se=N.source,he=g.get(se);if(he){const me=he[j.__cacheKey];me.usedTimes--,me.usedTimes===0&&v(N),Object.keys(he).length===0&&g.delete(se)}r.remove(N)}function v(N){const j=r.get(N);n.deleteTexture(j.__webglTexture);const se=N.source,he=g.get(se);delete he[j.__cacheKey],o.memory.textures--}function E(N){const j=N.texture,se=r.get(N),he=r.get(j);if(he.__webglTexture!==void 0&&(n.deleteTexture(he.__webglTexture),o.memory.textures--),N.depthTexture&&N.depthTexture.dispose(),N.isWebGLCubeRenderTarget)for(let me=0;me<6;me++)n.deleteFramebuffer(se.__webglFramebuffer[me]),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer[me]);else{if(n.deleteFramebuffer(se.__webglFramebuffer),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer),se.__webglMultisampledFramebuffer&&n.deleteFramebuffer(se.__webglMultisampledFramebuffer),se.__webglColorRenderbuffer)for(let me=0;me=l&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+l),U+=1,N}function z(N){const j=[];return j.push(N.wrapS),j.push(N.wrapT),j.push(N.wrapR||0),j.push(N.magFilter),j.push(N.minFilter),j.push(N.anisotropy),j.push(N.internalFormat),j.push(N.format),j.push(N.type),j.push(N.generateMipmaps),j.push(N.premultiplyAlpha),j.push(N.flipY),j.push(N.unpackAlignment),j.push(N.encoding),j.join()}function K(N,j){const se=r.get(N);if(N.isVideoTexture&&xe(N),N.isRenderTargetTexture===!1&&N.version>0&&se.__version!==N.version){const he=N.image;if(he===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(he.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{le(se,N,j);return}}t.bindTexture(3553,se.__webglTexture,33984+j)}function O(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){le(se,N,j);return}t.bindTexture(35866,se.__webglTexture,33984+j)}function B(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){le(se,N,j);return}t.bindTexture(32879,se.__webglTexture,33984+j)}function W(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){oe(se,N,j);return}t.bindTexture(34067,se.__webglTexture,33984+j)}const ee={[As]:10497,[Ai]:33071,[Om]:33648},F={[$n]:9728,[pw]:9984,[qp]:9986,[si]:9729,[WM]:9985,[DA]:9987};function X(N,j,se){if(se?(n.texParameteri(N,10242,ee[j.wrapS]),n.texParameteri(N,10243,ee[j.wrapT]),(N===32879||N===35866)&&n.texParameteri(N,32882,ee[j.wrapR]),n.texParameteri(N,10240,F[j.magFilter]),n.texParameteri(N,10241,F[j.minFilter])):(n.texParameteri(N,10242,33071),n.texParameteri(N,10243,33071),(N===32879||N===35866)&&n.texParameteri(N,32882,33071),(j.wrapS!==Ai||j.wrapT!==Ai)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(N,10240,D(j.magFilter)),n.texParameteri(N,10241,D(j.minFilter)),j.minFilter!==$n&&j.minFilter!==si&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const he=e.get("EXT_texture_filter_anisotropic");if(j.magFilter===$n||j.minFilter!==qp&&j.minFilter!==DA||j.type===AA&&e.has("OES_texture_float_linear")===!1||a===!1&&j.type===Nm&&e.has("OES_texture_half_float_linear")===!1)return;(j.anisotropy>1||r.get(j).__currentAnisotropy)&&(n.texParameterf(N,he.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(j.anisotropy,i.getMaxAnisotropy())),r.get(j).__currentAnisotropy=j.anisotropy)}}function ue(N,j){let se=!1;N.__webglInit===void 0&&(N.__webglInit=!0,j.addEventListener("dispose",$));const he=j.source;let me=g.get(he);me===void 0&&(me={},g.set(he,me));const G=z(j);if(G!==N.__cacheKey){me[G]===void 0&&(me[G]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,se=!0),me[G].usedTimes++;const R=me[N.__cacheKey];R!==void 0&&(me[N.__cacheKey].usedTimes--,R.usedTimes===0&&v(j)),N.__cacheKey=G,N.__webglTexture=me[G].texture}return se}function le(N,j,se){let he=3553;(j.isDataArrayTexture||j.isCompressedArrayTexture)&&(he=35866),j.isData3DTexture&&(he=32879);const me=ue(N,j),G=j.source;t.bindTexture(he,N.__webglTexture,33984+se);const R=r.get(G);if(G.version!==R.__version||me===!0){t.activeTexture(33984+se),n.pixelStorei(37440,j.flipY),n.pixelStorei(37441,j.premultiplyAlpha),n.pixelStorei(3317,j.unpackAlignment),n.pixelStorei(37443,0);const T=_(j)&&x(j.image)===!1;let V=w(j.image,T,!1,c);V=be(j,V);const te=x(V)||a,ae=s.convert(j.format,j.encoding);let ie=s.convert(j.type),Te=b(j.internalFormat,ae,ie,j.encoding,j.isVideoTexture);X(he,j,te);let Me;const Le=j.mipmaps,ke=a&&j.isVideoTexture!==!0,De=R.__version===void 0||me===!0,fe=M(j,V,te);if(j.isDepthTexture)Te=6402,a?j.type===AA?Te=36012:j.type===Ec?Te=33190:j.type===lh?Te=35056:Te=33189:j.type===AA&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),j.format===Pc&&Te===6402&&j.type!==cH&&j.type!==Ec&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),j.type=Ec,ie=s.convert(j.type)),j.format===Dh&&Te===6402&&(Te=34041,j.type!==lh&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),j.type=lh,ie=s.convert(j.type))),De&&(ke?t.texStorage2D(3553,1,Te,V.width,V.height):t.texImage2D(3553,0,Te,V.width,V.height,0,ae,ie,null));else if(j.isDataTexture)if(Le.length>0&&te){ke&&De&&t.texStorage2D(3553,fe,Te,Le[0].width,Le[0].height);for(let Ce=0,Se=Le.length;Ce>=1,Se>>=1}}else if(Le.length>0&&te){ke&&De&&t.texStorage2D(3553,fe,Te,Le[0].width,Le[0].height);for(let Ce=0,Se=Le.length;Ce0&&De++,t.texStorage2D(34067,De,Me,V[0].width,V[0].height));for(let Ce=0;Ce<6;Ce++)if(T){Le?t.texSubImage2D(34069+Ce,0,0,0,V[Ce].width,V[Ce].height,ie,Te,V[Ce].data):t.texImage2D(34069+Ce,0,Me,V[Ce].width,V[Ce].height,0,ie,Te,V[Ce].data);for(let Se=0;Se=34069&&me<=34074)&&n.framebufferTexture2D(36160,he,me,r.get(se).__webglTexture,0),t.bindFramebuffer(36160,null)}function pe(N,j,se){if(n.bindRenderbuffer(36161,N),j.depthBuffer&&!j.stencilBuffer){let he=33189;if(se||ce(j)){const me=j.depthTexture;me&&me.isDepthTexture&&(me.type===AA?he=36012:me.type===Ec&&(he=33190));const G=J(j);ce(j)?f.renderbufferStorageMultisampleEXT(36161,G,he,j.width,j.height):n.renderbufferStorageMultisample(36161,G,he,j.width,j.height)}else n.renderbufferStorage(36161,he,j.width,j.height);n.framebufferRenderbuffer(36160,36096,36161,N)}else if(j.depthBuffer&&j.stencilBuffer){const he=J(j);se&&ce(j)===!1?n.renderbufferStorageMultisample(36161,he,35056,j.width,j.height):ce(j)?f.renderbufferStorageMultisampleEXT(36161,he,35056,j.width,j.height):n.renderbufferStorage(36161,34041,j.width,j.height),n.framebufferRenderbuffer(36160,33306,36161,N)}else{const he=j.isWebGLMultipleRenderTargets===!0?j.texture:[j.texture];for(let me=0;me0&&ce(N)===!1){const T=G?j:[j];se.__webglMultisampledFramebuffer=n.createFramebuffer(),se.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,se.__webglMultisampledFramebuffer);for(let V=0;V0&&ce(N)===!1){const j=N.isWebGLMultipleRenderTargets?N.texture:[N.texture],se=N.width,he=N.height;let me=16384;const G=[],R=N.stencilBuffer?33306:36096,T=r.get(N),V=N.isWebGLMultipleRenderTargets===!0;if(V)for(let te=0;te0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&j.__useRenderToTexture!==!1}function xe(N){const j=o.render.frame;p.get(N)!==j&&(p.set(N,j),N.update())}function be(N,j){const se=N.encoding,he=N.format,me=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||N.format===oC||se!==cs&&(se===pt?a===!1?e.has("EXT_sRGB")===!0&&he===br?(N.format=oC,N.minFilter=si,N.generateMipmaps=!1):j=pH.sRGBToLinear(j):(he!==br||me!==OA)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",se)),j}this.allocateTextureUnit=L,this.resetTextureUnits=P,this.setTexture2D=K,this.setTexture2DArray=O,this.setTexture3D=B,this.setTextureCube=W,this.rebindTextures=Q,this.setupRenderTarget=de,this.updateRenderTargetMipmap=Ae,this.updateMultisampleRenderTarget=q,this.setupDepthRenderbuffer=Re,this.setupFrameBufferTexture=re,this.useMultisampledRTT=ce}function gte(n,e,t){const r=t.isWebGL2;function i(s,o=null){let a;if(s===OA)return 5121;if(s===WY)return 32819;if(s===KY)return 32820;if(s===GY)return 5120;if(s===VY)return 5122;if(s===cH)return 5123;if(s===jY)return 5124;if(s===Ec)return 5125;if(s===AA)return 5126;if(s===Nm)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===$Y)return 6406;if(s===br)return 6408;if(s===YY)return 6409;if(s===XY)return 6410;if(s===Pc)return 6402;if(s===Dh)return 34041;if(s===oC)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===ZY)return 6403;if(s===JY)return 36244;if(s===qY)return 33319;if(s===eX)return 33320;if(s===tX)return 36249;if(s===D1||s===O1||s===N1||s===k1)if(o===pt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===D1)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===O1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===N1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===k1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===D1)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===O1)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===N1)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===k1)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===fF||s===hF||s===dF||s===pF)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===fF)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===hF)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===dF)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===pF)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===nX)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===mF||s===gF)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===mF)return o===pt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===gF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===vF||s===yF||s===wF||s===xF||s===_F||s===bF||s===BF||s===EF||s===CF||s===SF||s===MF||s===TF||s===IF||s===RF)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===vF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===yF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===wF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===xF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===_F)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===bF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===BF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===EF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===CF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===SF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===MF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===TF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===IF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===RF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Q1)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Q1)return o===pt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===rX||s===FF||s===UF||s===LF)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===Q1)return a.COMPRESSED_RED_RGTC1_EXT;if(s===FF)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===UF)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===LF)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===lh?r?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:i}}class vte extends Fr{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ur extends It{constructor(){super(),this.isGroup=!0,this.type="Group"}}const yte={type:"move"};class fb{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ur,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 Ur,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ur,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),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,A=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(A&&e.hand){o=!0;for(const d of e.hand.values()){const g=t.getJointPose(d,r),m=this._getHandJoint(A,d);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=g.radius),m.visible=g!==null}const c=A.joints["index-finger-tip"],u=A.joints["thumb-tip"],f=c.position.distanceTo(u.position),h=.02,p=.005;A.inputState.pinching&&f>h+p?(A.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!A.inputState.pinching&&f<=h-p&&(A.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),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),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(yte)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),A!==null&&(A.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new Ur;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class CH extends Qn{constructor(e,t,r,i,s,o,a,l,A,c){if(c=c!==void 0?c:Pc,c!==Pc&&c!==Dh)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&c===Pc&&(r=Ec),r===void 0&&c===Dh&&(r=lh),super(null,i,s,o,a,l,c,r,A),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:$n,this.minFilter=l!==void 0?l:$n,this.flipY=!1,this.generateMipmaps=!1}}class wte extends YA{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,A=null,c=null,u=null,f=null,h=null,p=null;const d=t.getContextAttributes();let g=null,m=null;const y=[],w=[],x=new Set,_=new Map,C=new Fr;C.layers.enable(1),C.viewport=new Qt;const S=new Fr;S.layers.enable(2),S.viewport=new Qt;const b=[C,S],M=new vte;M.layers.enable(1),M.layers.enable(2);let D=null,$=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getTargetRaySpace()},this.getControllerGrip=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getGripSpace()},this.getHand=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getHandSpace()};function H(B){const W=w.indexOf(B.inputSource);if(W===-1)return;const ee=y[W];ee!==void 0&&ee.dispatchEvent({type:B.type,data:B.inputSource})}function I(){i.removeEventListener("select",H),i.removeEventListener("selectstart",H),i.removeEventListener("selectend",H),i.removeEventListener("squeeze",H),i.removeEventListener("squeezestart",H),i.removeEventListener("squeezeend",H),i.removeEventListener("end",I),i.removeEventListener("inputsourceschange",v);for(let B=0;B=0&&(w[F]=null,y[F].disconnect(ee))}for(let W=0;W=w.length){w.push(ee),F=ue;break}else if(w[ue]===null){w[ue]=ee,F=ue;break}if(F===-1)break}const X=y[F];X&&X.connect(ee)}}const E=new Z,U=new Z;function P(B,W,ee){E.setFromMatrixPosition(W.matrixWorld),U.setFromMatrixPosition(ee.matrixWorld);const F=E.distanceTo(U),X=W.projectionMatrix.elements,ue=ee.projectionMatrix.elements,le=X[14]/(X[10]-1),oe=X[14]/(X[10]+1),re=(X[9]+1)/X[5],pe=(X[9]-1)/X[5],_e=(X[8]-1)/X[0],Re=(ue[8]+1)/ue[0],Q=le*_e,de=le*Re,Ae=F/(-_e+Re),q=Ae*-_e;W.matrixWorld.decompose(B.position,B.quaternion,B.scale),B.translateX(q),B.translateZ(Ae),B.matrixWorld.compose(B.position,B.quaternion,B.scale),B.matrixWorldInverse.copy(B.matrixWorld).invert();const J=le+Ae,ce=oe+Ae,xe=Q-q,be=de+(F-q),N=re*oe/ce*J,j=pe*oe/ce*J;B.projectionMatrix.makePerspective(xe,be,N,j,J,ce)}function L(B,W){W===null?B.matrixWorld.copy(B.matrix):B.matrixWorld.multiplyMatrices(W.matrixWorld,B.matrix),B.matrixWorldInverse.copy(B.matrixWorld).invert()}this.updateCamera=function(B){if(i===null)return;M.near=S.near=C.near=B.near,M.far=S.far=C.far=B.far,(D!==M.near||$!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),D=M.near,$=M.far);const W=B.parent,ee=M.cameras;L(M,W);for(let X=0;XX&&(_.set(F,F.lastChangedTime),r.dispatchEvent({type:"planechanged",data:F}))}}p=null}const O=new xH;O.setAnimationLoop(K),this.setAnimationLoop=function(B){z=B},this.dispose=function(){}}}function xte(n,e){function t(d,g){g.color.getRGB(d.fogColor.value,vH(n)),g.isFog?(d.fogNear.value=g.near,d.fogFar.value=g.far):g.isFogExp2&&(d.fogDensity.value=g.density)}function r(d,g,m,y,w){g.isMeshBasicMaterial||g.isMeshLambertMaterial?i(d,g):g.isMeshToonMaterial?(i(d,g),c(d,g)):g.isMeshPhongMaterial?(i(d,g),A(d,g)):g.isMeshStandardMaterial?(i(d,g),u(d,g),g.isMeshPhysicalMaterial&&f(d,g,w)):g.isMeshMatcapMaterial?(i(d,g),h(d,g)):g.isMeshDepthMaterial?i(d,g):g.isMeshDistanceMaterial?(i(d,g),p(d,g)):g.isMeshNormalMaterial?i(d,g):g.isLineBasicMaterial?(s(d,g),g.isLineDashedMaterial&&o(d,g)):g.isPointsMaterial?a(d,g,m,y):g.isSpriteMaterial?l(d,g):g.isShadowMaterial?(d.color.value.copy(g.color),d.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function i(d,g){d.opacity.value=g.opacity,g.color&&d.diffuse.value.copy(g.color),g.emissive&&d.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.bumpMap&&(d.bumpMap.value=g.bumpMap,d.bumpScale.value=g.bumpScale,g.side===Xr&&(d.bumpScale.value*=-1)),g.displacementMap&&(d.displacementMap.value=g.displacementMap,d.displacementScale.value=g.displacementScale,d.displacementBias.value=g.displacementBias),g.emissiveMap&&(d.emissiveMap.value=g.emissiveMap),g.normalMap&&(d.normalMap.value=g.normalMap,d.normalScale.value.copy(g.normalScale),g.side===Xr&&d.normalScale.value.negate()),g.specularMap&&(d.specularMap.value=g.specularMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);const m=e.get(g).envMap;if(m&&(d.envMap.value=m,d.flipEnvMap.value=m.isCubeTexture&&m.isRenderTargetTexture===!1?-1:1,d.reflectivity.value=g.reflectivity,d.ior.value=g.ior,d.refractionRatio.value=g.refractionRatio),g.lightMap){d.lightMap.value=g.lightMap;const x=n.physicallyCorrectLights!==!0?Math.PI:1;d.lightMapIntensity.value=g.lightMapIntensity*x}g.aoMap&&(d.aoMap.value=g.aoMap,d.aoMapIntensity.value=g.aoMapIntensity);let y;g.map?y=g.map:g.specularMap?y=g.specularMap:g.displacementMap?y=g.displacementMap:g.normalMap?y=g.normalMap:g.bumpMap?y=g.bumpMap:g.roughnessMap?y=g.roughnessMap:g.metalnessMap?y=g.metalnessMap:g.alphaMap?y=g.alphaMap:g.emissiveMap?y=g.emissiveMap:g.clearcoatMap?y=g.clearcoatMap:g.clearcoatNormalMap?y=g.clearcoatNormalMap:g.clearcoatRoughnessMap?y=g.clearcoatRoughnessMap:g.iridescenceMap?y=g.iridescenceMap:g.iridescenceThicknessMap?y=g.iridescenceThicknessMap:g.specularIntensityMap?y=g.specularIntensityMap:g.specularColorMap?y=g.specularColorMap:g.transmissionMap?y=g.transmissionMap:g.thicknessMap?y=g.thicknessMap:g.sheenColorMap?y=g.sheenColorMap:g.sheenRoughnessMap&&(y=g.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),d.uvTransform.value.copy(y.matrix));let w;g.aoMap?w=g.aoMap:g.lightMap&&(w=g.lightMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),d.uv2Transform.value.copy(w.matrix))}function s(d,g){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity}function o(d,g){d.dashSize.value=g.dashSize,d.totalSize.value=g.dashSize+g.gapSize,d.scale.value=g.scale}function a(d,g,m,y){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity,d.size.value=g.size*m,d.scale.value=y*.5,g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);let w;g.map?w=g.map:g.alphaMap&&(w=g.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),d.uvTransform.value.copy(w.matrix))}function l(d,g){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity,d.rotation.value=g.rotation,g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);let m;g.map?m=g.map:g.alphaMap&&(m=g.alphaMap),m!==void 0&&(m.matrixAutoUpdate===!0&&m.updateMatrix(),d.uvTransform.value.copy(m.matrix))}function A(d,g){d.specular.value.copy(g.specular),d.shininess.value=Math.max(g.shininess,1e-4)}function c(d,g){g.gradientMap&&(d.gradientMap.value=g.gradientMap)}function u(d,g){d.roughness.value=g.roughness,d.metalness.value=g.metalness,g.roughnessMap&&(d.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(d.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(d.envMapIntensity.value=g.envMapIntensity)}function f(d,g,m){d.ior.value=g.ior,g.sheen>0&&(d.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),d.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(d.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(d.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(d.clearcoat.value=g.clearcoat,d.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(d.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(d.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),d.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===Xr&&d.clearcoatNormalScale.value.negate())),g.iridescence>0&&(d.iridescence.value=g.iridescence,d.iridescenceIOR.value=g.iridescenceIOR,d.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(d.iridescenceMap.value=g.iridescenceMap),g.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=g.iridescenceThicknessMap)),g.transmission>0&&(d.transmission.value=g.transmission,d.transmissionSamplerMap.value=m.texture,d.transmissionSamplerSize.value.set(m.width,m.height),g.transmissionMap&&(d.transmissionMap.value=g.transmissionMap),d.thickness.value=g.thickness,g.thicknessMap&&(d.thicknessMap.value=g.thicknessMap),d.attenuationDistance.value=g.attenuationDistance,d.attenuationColor.value.copy(g.attenuationColor)),d.specularIntensity.value=g.specularIntensity,d.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(d.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(d.specularColorMap.value=g.specularColorMap)}function h(d,g){g.matcap&&(d.matcap.value=g.matcap)}function p(d,g){d.referencePosition.value.copy(g.referencePosition),d.nearDistance.value=g.nearDistance,d.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function _te(n,e,t,r){let i={},s={},o=[];const a=t.isWebGL2?n.getParameter(35375):0;function l(y,w){const x=w.program;r.uniformBlockBinding(y,x)}function A(y,w){let x=i[y.id];x===void 0&&(p(y),x=c(y),i[y.id]=x,y.addEventListener("dispose",g));const _=w.program;r.updateUBOMapping(y,_);const C=e.render.frame;s[y.id]!==C&&(f(y),s[y.id]=C)}function c(y){const w=u();y.__bindingPointIndex=w;const x=n.createBuffer(),_=y.__size,C=y.usage;return n.bindBuffer(35345,x),n.bufferData(35345,_,C),n.bindBuffer(35345,null),n.bindBufferBase(35345,w,x),x}function u(){for(let y=0;y0){C=x%_;const H=_-C;C!==0&&H-D.boundary<0&&(x+=_-C,M.__offset=x)}x+=D.storage}return C=x%_,C>0&&(x+=_-C),y.__size=x,y.__cache={},this}function d(y){const w={boundary:0,storage:0};return typeof y=="number"?(w.boundary=4,w.storage=4):y.isVector2?(w.boundary=8,w.storage=8):y.isVector3||y.isColor?(w.boundary=16,w.storage=12):y.isVector4?(w.boundary=16,w.storage=16):y.isMatrix3?(w.boundary=48,w.storage=48):y.isMatrix4?(w.boundary=64,w.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),w}function g(y){const w=y.target;w.removeEventListener("dispose",g);const x=o.indexOf(w.__bindingPointIndex);o.splice(x,1),n.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function m(){for(const y in i)n.deleteBuffer(i[y]);o=[],i={},s={}}return{bind:l,update:A,dispose:m}}function bte(){const n=Hm("canvas");return n.style.display="block",n}function vg(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:bte(),t=n.context!==void 0?n.context:null,r=n.depth!==void 0?n.depth:!0,i=n.stencil!==void 0?n.stencil:!0,s=n.antialias!==void 0?n.antialias:!1,o=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,a=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,l=n.powerPreference!==void 0?n.powerPreference:"default",A=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1;let c;t!==null?c=t.getContextAttributes().alpha:c=n.alpha!==void 0?n.alpha:!1;let u=null,f=null;const h=[],p=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=cs,this.physicallyCorrectLights=!1,this.toneMapping=ll,this.toneMappingExposure=1;const d=this;let g=!1,m=0,y=0,w=null,x=-1,_=null;const C=new Qt,S=new Qt;let b=null,M=e.width,D=e.height,$=1,H=null,I=null;const v=new Qt(0,0,M,D),E=new Qt(0,0,M,D);let U=!1;const P=new JM;let L=!1,z=!1,K=null;const O=new je,B=new $e,W=new Z,ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function F(){return w===null?$:1}let X=t;function ue(ne,ge){for(let Be=0;Be0?f=p[p.length-1]:f=null,h.pop(),h.length>0?u=h[h.length-1]:u=null};function ut(ne,ge,Be,we){if(ne.visible===!1)return;if(ne.layers.test(ge.layers)){if(ne.isGroup)Be=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(ge);else if(ne.isLight)f.pushLight(ne),ne.castShadow&&f.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||P.intersectsSprite(ne)){we&&W.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(O);const st=J.update(ne),Ze=ne.material;Ze.visible&&u.push(ne,st,Ze,Be,W.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(ne.isSkinnedMesh&&ne.skeleton.frame!==pe.render.frame&&(ne.skeleton.update(),ne.skeleton.frame=pe.render.frame),!ne.frustumCulled||P.intersectsObject(ne))){we&&W.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(O);const st=J.update(ne),Ze=ne.material;if(Array.isArray(Ze)){const Je=st.groups;for(let yt=0,mt=Je.length;yt0&&Ct(Ee,ge,Be),we&&re.viewport(C.copy(we)),Ee.length>0&&it(Ee,ge,Be),ze.length>0&&it(ze,ge,Be),st.length>0&&it(st,ge,Be),re.buffers.depth.setTest(!0),re.buffers.depth.setMask(!0),re.buffers.color.setMask(!0),re.setPolygonOffset(!1)}function Ct(ne,ge,Be){const we=oe.isWebGL2;K===null&&(K=new ma(1,1,{generateMipmaps:!0,type:le.has("EXT_color_buffer_half_float")?Nm:OA,minFilter:DA,samples:we&&s===!0?4:0})),d.getDrawingBufferSize(B),we?K.setSize(B.x,B.y):K.setSize(gw(B.x),gw(B.y));const Ee=d.getRenderTarget();d.setRenderTarget(K),d.clear();const ze=d.toneMapping;d.toneMapping=ll,it(ne,ge,Be),d.toneMapping=ze,Re.updateMultisampleRenderTarget(K),Re.updateRenderTargetMipmap(K),d.setRenderTarget(Ee)}function it(ne,ge,Be){const we=ge.isScene===!0?ge.overrideMaterial:null;for(let Ee=0,ze=ne.length;Ee0&&Re.useMultisampledRTT(ne)===!1?Ee=_e.get(ne).__webglMultisampledFramebuffer:Ee=mt,C.copy(ne.viewport),S.copy(ne.scissor),b=ne.scissorTest}else C.copy(v).multiplyScalar($).floor(),S.copy(E).multiplyScalar($).floor(),b=U;if(re.bindFramebuffer(36160,Ee)&&oe.drawBuffers&&we&&re.drawBuffers(ne,Ee),re.viewport(C),re.scissor(S),re.setScissorTest(b),ze){const Je=_e.get(ne.texture);X.framebufferTexture2D(36160,36064,34069+ge,Je.__webglTexture,Be)}else if(st){const Je=_e.get(ne.texture),yt=ge||0;X.framebufferTextureLayer(36160,36064,Je.__webglTexture,Be||0,yt)}x=-1},this.readRenderTargetPixels=function(ne,ge,Be,we,Ee,ze,st){if(!(ne&&ne.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ze=_e.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&st!==void 0&&(Ze=Ze[st]),Ze){re.bindFramebuffer(36160,Ze);try{const Je=ne.texture,yt=Je.format,mt=Je.type;if(yt!==br&&T.convert(yt)!==X.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const gt=mt===Nm&&(le.has("EXT_color_buffer_half_float")||oe.isWebGL2&&le.has("EXT_color_buffer_float"));if(mt!==OA&&T.convert(mt)!==X.getParameter(35738)&&!(mt===AA&&(oe.isWebGL2||le.has("OES_texture_float")||le.has("WEBGL_color_buffer_float")))&&!gt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ge>=0&&ge<=ne.width-we&&Be>=0&&Be<=ne.height-Ee&&X.readPixels(ge,Be,we,Ee,T.convert(yt),T.convert(mt),ze)}finally{const Je=w!==null?_e.get(w).__webglFramebuffer:null;re.bindFramebuffer(36160,Je)}}},this.copyFramebufferToTexture=function(ne,ge,Be=0){const we=Math.pow(2,-Be),Ee=Math.floor(ge.image.width*we),ze=Math.floor(ge.image.height*we);Re.setTexture2D(ge,0),X.copyTexSubImage2D(3553,Be,0,0,ne.x,ne.y,Ee,ze),re.unbindTexture()},this.copyTextureToTexture=function(ne,ge,Be,we=0){const Ee=ge.image.width,ze=ge.image.height,st=T.convert(Be.format),Ze=T.convert(Be.type);Re.setTexture2D(Be,0),X.pixelStorei(37440,Be.flipY),X.pixelStorei(37441,Be.premultiplyAlpha),X.pixelStorei(3317,Be.unpackAlignment),ge.isDataTexture?X.texSubImage2D(3553,we,ne.x,ne.y,Ee,ze,st,Ze,ge.image.data):ge.isCompressedTexture?X.compressedTexSubImage2D(3553,we,ne.x,ne.y,ge.mipmaps[0].width,ge.mipmaps[0].height,st,ge.mipmaps[0].data):X.texSubImage2D(3553,we,ne.x,ne.y,st,Ze,ge.image),we===0&&Be.generateMipmaps&&X.generateMipmap(3553),re.unbindTexture()},this.copyTextureToTexture3D=function(ne,ge,Be,we,Ee=0){if(d.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ze=ne.max.x-ne.min.x+1,st=ne.max.y-ne.min.y+1,Ze=ne.max.z-ne.min.z+1,Je=T.convert(we.format),yt=T.convert(we.type);let mt;if(we.isData3DTexture)Re.setTexture3D(we,0),mt=32879;else if(we.isDataArrayTexture)Re.setTexture2DArray(we,0),mt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}X.pixelStorei(37440,we.flipY),X.pixelStorei(37441,we.premultiplyAlpha),X.pixelStorei(3317,we.unpackAlignment);const gt=X.getParameter(3314),Zt=X.getParameter(32878),Rn=X.getParameter(3316),Di=X.getParameter(3315),qs=X.getParameter(32877),pn=Be.isCompressedTexture?Be.mipmaps[0]:Be.image;X.pixelStorei(3314,pn.width),X.pixelStorei(32878,pn.height),X.pixelStorei(3316,ne.min.x),X.pixelStorei(3315,ne.min.y),X.pixelStorei(32877,ne.min.z),Be.isDataTexture||Be.isData3DTexture?X.texSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,yt,pn.data):Be.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),X.compressedTexSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,pn.data)):X.texSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,yt,pn),X.pixelStorei(3314,gt),X.pixelStorei(32878,Zt),X.pixelStorei(3316,Rn),X.pixelStorei(3315,Di),X.pixelStorei(32877,qs),Ee===0&&we.generateMipmaps&&X.generateMipmap(mt),re.unbindTexture()},this.initTexture=function(ne){ne.isCubeTexture?Re.setTextureCube(ne,0):ne.isData3DTexture?Re.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Re.setTexture2DArray(ne,0):Re.setTexture2D(ne,0),re.unbindTexture()},this.resetState=function(){m=0,y=0,w=null,re.reset(),V.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class Bte extends vg{}Bte.prototype.isWebGL1Renderer=!0;class vw extends It{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,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,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}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Ete{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=sC,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Eo()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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;il)continue;f.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(f);be.far||t.push({distance:b,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,o.start),y=Math.min(g.count,o.start+o.count);for(let w=m,x=y-1;wl)continue;f.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(f);Ce.far||t.push({distance:C,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0){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:A,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class Rte{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,A;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),A=r[i]-o,A<0)a=i+1;else if(A>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const c=r[i],f=r[i+1]-c,h=(o-c)/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 $e:new Z);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 Z,i=[],s=[],o=[],a=new Z,l=new je;for(let h=0;h<=e;h++){const p=h/e;i[h]=this.getTangentAt(p,new Z)}s[0]=new Z,o[0]=new Z;let A=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);c<=A&&(A=c,r.set(1,0,0)),u<=A&&(A=u,r.set(0,1,0)),f<=A&&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 p=Math.acos(hr(i[h-1].dot(i[h]),-1,1));s[h].applyMatrix4(l.makeRotationAxis(a,p))}o[h].crossVectors(i[h],s[h])}if(t===!0){let h=Math.acos(hr(s[0].dot(s[e]),-1,1));h/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(h=-h);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(i[p],h*p)),o[p].crossVectors(i[p],s[p])}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.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Gx extends $t{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 A=this;i=Math.floor(i),s=Math.floor(s);const c=[],u=[],f=[],h=[];let p=0;const d=[],g=r/2;let m=0;y(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(c),this.setAttribute("position",new an(u,3)),this.setAttribute("normal",new an(f,3)),this.setAttribute("uv",new an(h,2));function y(){const x=new Z,_=new Z;let C=0;const S=(t-e)/r;for(let b=0;b<=s;b++){const M=[],D=b/s,$=D*(t-e)+e;for(let H=0;H<=i;H++){const I=H/i,v=I*l+a,E=Math.sin(v),U=Math.cos(v);_.x=$*E,_.y=-D*r+g,_.z=$*U,u.push(_.x,_.y,_.z),x.set(E,S,U).normalize(),f.push(x.x,x.y,x.z),h.push(I,1-D),M.push(p++)}d.push(M)}for(let b=0;b0)&&h.push(w,x,C),(m!==r-1||l0!=e>0&&this.version++,this._sheen=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 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.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.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 db extends is{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Qe(16777215),this.specular=new Qe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Jh,this.normalScale=new $e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Nx,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.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 Fte extends is{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Jh,this.normalScale=new $e(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 Ute extends is{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Qe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=Jh,this.normalScale=new $e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Nx,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.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 Nl(n,e,t){return TH(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function L0(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 TH(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Lte(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 TU(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 IH(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 wg{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=Nl(r,s,o),this.values=Nl(this.values,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&&TH(i))for(let a=0,l=i.length;a!==l;++a){const A=i[a];if(isNaN(A)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,A),e=!1;break}}return e}optimize(){const e=Nl(this.times),t=Nl(this.values),r=this.getValueSize(),i=this.getInterpolation()===H1,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,A=0;A!==r;++A)t[l+A]=t[a+A];++o}return o!==e.length?(this.times=Nl(e,0,o),this.values=Nl(t,0,o*r)):(this.times=e,this.values=t),this}clone(){const e=Nl(this.times,0),t=Nl(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}_a.prototype.TimeBufferType=Float32Array;_a.prototype.ValueBufferType=Float32Array;_a.prototype.DefaultInterpolation=$c;class nd extends _a{}nd.prototype.ValueTypeName="bool";nd.prototype.ValueBufferType=Array;nd.prototype.DefaultInterpolation=Oh;nd.prototype.InterpolantFactoryMethodLinear=void 0;nd.prototype.InterpolantFactoryMethodSmooth=void 0;class FH extends _a{}FH.prototype.ValueTypeName="color";class Qh extends _a{}Qh.prototype.ValueTypeName="number";class Ote extends wg{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 A=e*a;for(let c=A+a;A!==c;A+=4)rt.slerpFlat(s,0,o,A-a,o,A,l);return s}}class ga extends _a{InterpolantFactoryMethodLinear(e){return new Ote(this.times,this.values,this.getValueSize(),e)}}ga.prototype.ValueTypeName="quaternion";ga.prototype.DefaultInterpolation=$c;ga.prototype.InterpolantFactoryMethodSmooth=void 0;class rd extends _a{}rd.prototype.ValueTypeName="string";rd.prototype.ValueBufferType=Array;rd.prototype.DefaultInterpolation=Oh;rd.prototype.InterpolantFactoryMethodLinear=void 0;rd.prototype.InterpolantFactoryMethodSmooth=void 0;class NA extends _a{}NA.prototype.ValueTypeName="vector";class Yc{constructor(e,t=-1,r,i=KM){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=Eo(),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(kte(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(_a.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const u=c[1];let f=i[u];f||(i[u]=f=[]),f.push(A)}}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,p,d){if(h.length!==0){const g=[],m=[];IH(h,g,m,p),g.length!==0&&d.push(new u(f,g,m))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const A=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if(La[e]!==void 0){La[e].push({onLoad:t,onProgress:r,onError:i});return}La[e]=[],La[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(A=>{if(A.status===200||A.status===0){if(A.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||A.body===void 0||A.body.getReader===void 0)return A;const c=La[e],u=A.body.getReader(),f=A.headers.get("Content-Length")||A.headers.get("X-File-Size"),h=f?parseInt(f):0,p=h!==0;let d=0;const g=new ReadableStream({start(m){y();function y(){u.read().then(({done:w,value:x})=>{if(w)m.close();else{d+=x.byteLength;const _=new ProgressEvent("progress",{lengthComputable:p,loaded:d,total:h});for(let C=0,S=c.length;C{switch(l){case"arraybuffer":return A.arrayBuffer();case"blob":return A.blob();case"document":return A.text().then(c=>new DOMParser().parseFromString(c,a));case"json":return A.json();default:if(a===void 0)return A.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,h=new TextDecoder(f);return A.arrayBuffer().then(p=>h.decode(p))}}}).then(A=>{Hh.add(e,A);const c=La[e];delete La[e];for(let u=0,f=c.length;u{const c=La[e];if(c===void 0)throw this.manager.itemError(e),A;delete La[e];for(let u=0,f=c.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 LH extends id{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=Hh.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Hm("img");function l(){c(),Hh.add(e,this),t&&t(this),s.manager.itemEnd(e)}function A(u){c(),i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}function c(){a.removeEventListener("load",l,!1),a.removeEventListener("error",A,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",A,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class lu extends id{constructor(e){super(e)}load(e,t,r,i){const s=new Qn,o=new LH(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 Vx extends It{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Qe(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()),t}}const pb=new je,IU=new Z,RU=new Z;class rT{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new $e(512,512),this.map=null,this.mapPass=null,this.matrix=new je,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new JM,this._frameExtents=new $e(1,1),this._viewportCount=1,this._viewports=[new Qt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;IU.setFromMatrixPosition(e.matrixWorld),t.position.copy(IU),RU.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(RU),t.updateMatrixWorld(),pb.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(pb),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(pb)}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.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.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 zte extends rT{constructor(){super(new Fr(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=Qm*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 PH extends Vx{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(It.DEFAULT_UP),this.updateMatrix(),this.target=new It,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new zte}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 FU=new je,zd=new Z,mb=new Z;class Gte extends rT{constructor(){super(new Fr(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new $e(4,2),this._viewportCount=6,this._viewports=[new Qt(2,1,1,1),new Qt(0,1,1,1),new Qt(3,1,1,1),new Qt(1,1,1,1),new Qt(3,0,1,1),new Qt(1,0,1,1)],this._cubeDirections=[new Z(1,0,0),new Z(-1,0,0),new Z(0,0,1),new Z(0,0,-1),new Z(0,1,0),new Z(0,-1,0)],this._cubeUps=[new Z(0,1,0),new Z(0,1,0),new Z(0,1,0),new Z(0,1,0),new Z(0,0,1),new Z(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()),zd.setFromMatrixPosition(e.matrixWorld),r.position.copy(zd),mb.copy(r.position),mb.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(mb),r.updateMatrixWorld(),i.makeTranslation(-zd.x,-zd.y,-zd.z),FU.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(FU)}}class cC extends Vx{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 Gte}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 Vte extends rT{constructor(){super(new qh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class iT extends Vx{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(It.DEFAULT_UP),this.updateMatrix(),this.target=new It,this.shadow=new Vte}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class DH extends Vx{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class xw{static decodeText(e){if(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=Hh.get(e);if(o!==void 0)return s.manager.itemStart(e),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,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){Hh.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}class OH{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=UU(),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=UU();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function UU(){return(typeof performance>"u"?Date:performance).now()}class Wte{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,A=t+t;l!==A;++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){rt.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;rt.multiplyQuaternionsFlat(e,o,e,t,e,r),rt.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 sT="\\[\\]\\.:\\/",Kte=new RegExp("["+sT+"]","g"),oT="[^"+sT+"]",$te="[^"+sT.replace("\\.","")+"]",Yte=/((?:WC+[\/:])*)/.source.replace("WC",oT),Xte=/(WCOD+)?/.source.replace("WCOD",$te),Zte=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",oT),Jte=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",oT),qte=new RegExp("^"+Yte+Xte+Zte+Jte+"$"),ene=["material","materials","bones","map"];class tne{constructor(e,t,r){const i=r||_t.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 _t{constructor(e,t,r){this.path=t,this.parsedPath=r||_t.parseTrackName(t),this.node=_t.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new _t.Composite(e,t,r):new _t(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Kte,"")}static parseTrackName(e){const t=qte.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);ene.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,A=this._propertyBindings;switch(this.blendMode){case aX:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].accumulateAdditive(a);break;case KM:default:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].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===oX;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===iX){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 A=e<0;this._setEndings(A,!A,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=Gf,i.endingEnd=Gf):(e?i.endingStart=this.zeroSlopeAtStart?Gf:zf:i.endingStart=mw,t?i.endingEnd=this.zeroSlopeAtEnd?Gf:zf:i.endingEnd=mw)}_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 rne=new Float32Array(1);class ine extends YA{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,A=this._bindingsByRootAndName;let c=A[l];c===void 0&&(c={},A[l]=c);for(let u=0;u!==s;++u){const f=i[u],h=f.name;let p=c[h];if(p!==void 0)++p.referenceCount,o[u]=p;else{if(p=o[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,h));continue}const d=t&&t._propertyBindings[u].binding.parsedPath;p=new Wte(_t.create(r,h,d),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,h),o[u]=p}a[u].resultBuffer=p.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 A=0;A!==r;++A)t[A]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let A=0;A!==l;++A)a[A].apply(o);return this}setTime(e){this.time=0;for(let t=0;tMath.PI&&(ke-=Te),De<-Math.PI?De+=Te:De>Math.PI&&(De-=Te),ke<=De?a.theta=Math.max(ke,Math.min(De,a.theta)):a.theta=a.theta>(ke+De)/2?Math.max(ke,a.theta):Math.min(De,a.theta)),a.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=A,a.radius=Math.max(r.minDistance,Math.min(r.maxDistance,a.radius)),r.enableDamping===!0?r.target.addScaledVector(c,r.dampingFactor):r.target.add(c),T.setFromSpherical(a),T.applyQuaternion(te),Le.copy(r.target).add(T),r.object.lookAt(r.target),r.enableDamping===!0?(l.theta*=1-r.dampingFactor,l.phi*=1-r.dampingFactor,c.multiplyScalar(1-r.dampingFactor)):(l.set(0,0,0),c.set(0,0,0)),A=1,u||ae.distanceToSquared(r.object.position)>o||8*(1-ie.dot(r.object.quaternion))>o?(r.dispatchEvent(NU),ae.copy(r.object.position),ie.copy(r.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",se),r.domElement.removeEventListener("pointerdown",Q),r.domElement.removeEventListener("pointercancel",q),r.domElement.removeEventListener("wheel",xe),r.domElement.removeEventListener("pointermove",de),r.domElement.removeEventListener("pointerup",Ae),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",be)};const r=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=i.NONE;const o=1e-6,a=new DU,l=new DU;let A=1;const c=new Z;let u=!1;const f=new $e,h=new $e,p=new $e,d=new $e,g=new $e,m=new $e,y=new $e,w=new $e,x=new $e,_=[],C={};function S(){return 2*Math.PI/60/60*r.autoRotateSpeed}function b(){return Math.pow(.95,r.zoomSpeed)}function M(T){l.theta-=T}function D(T){l.phi-=T}const $=function(){const T=new Z;return function(te,ae){T.setFromMatrixColumn(ae,0),T.multiplyScalar(-te),c.add(T)}}(),H=function(){const T=new Z;return function(te,ae){r.screenSpacePanning===!0?T.setFromMatrixColumn(ae,1):(T.setFromMatrixColumn(ae,0),T.crossVectors(r.object.up,T)),T.multiplyScalar(te),c.add(T)}}(),I=function(){const T=new Z;return function(te,ae){const ie=r.domElement;if(r.object.isPerspectiveCamera){const Te=r.object.position;T.copy(Te).sub(r.target);let Me=T.length();Me*=Math.tan(r.object.fov/2*Math.PI/180),$(2*te*Me/ie.clientHeight,r.object.matrix),H(2*ae*Me/ie.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?($(te*(r.object.right-r.object.left)/r.object.zoom/ie.clientWidth,r.object.matrix),H(ae*(r.object.top-r.object.bottom)/r.object.zoom/ie.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function v(T){r.object.isPerspectiveCamera?A/=T:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*T)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function E(T){r.object.isPerspectiveCamera?A*=T:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/T)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function U(T){f.set(T.clientX,T.clientY)}function P(T){y.set(T.clientX,T.clientY)}function L(T){d.set(T.clientX,T.clientY)}function z(T){h.set(T.clientX,T.clientY),p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const V=r.domElement;M(2*Math.PI*p.x/V.clientHeight),D(2*Math.PI*p.y/V.clientHeight),f.copy(h),r.update()}function K(T){w.set(T.clientX,T.clientY),x.subVectors(w,y),x.y>0?v(b()):x.y<0&&E(b()),y.copy(w),r.update()}function O(T){g.set(T.clientX,T.clientY),m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g),r.update()}function B(T){T.deltaY<0?E(b()):T.deltaY>0&&v(b()),r.update()}function W(T){let V=!1;switch(T.code){case r.keys.UP:T.ctrlKey||T.metaKey||T.shiftKey?D(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,r.keyPanSpeed),V=!0;break;case r.keys.BOTTOM:T.ctrlKey||T.metaKey||T.shiftKey?D(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,-r.keyPanSpeed),V=!0;break;case r.keys.LEFT:T.ctrlKey||T.metaKey||T.shiftKey?M(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(r.keyPanSpeed,0),V=!0;break;case r.keys.RIGHT:T.ctrlKey||T.metaKey||T.shiftKey?M(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(-r.keyPanSpeed,0),V=!0;break}V&&(T.preventDefault(),r.update())}function ee(){if(_.length===1)f.set(_[0].pageX,_[0].pageY);else{const T=.5*(_[0].pageX+_[1].pageX),V=.5*(_[0].pageY+_[1].pageY);f.set(T,V)}}function F(){if(_.length===1)d.set(_[0].pageX,_[0].pageY);else{const T=.5*(_[0].pageX+_[1].pageX),V=.5*(_[0].pageY+_[1].pageY);d.set(T,V)}}function X(){const T=_[0].pageX-_[1].pageX,V=_[0].pageY-_[1].pageY,te=Math.sqrt(T*T+V*V);y.set(0,te)}function ue(){r.enableZoom&&X(),r.enablePan&&F()}function le(){r.enableZoom&&X(),r.enableRotate&&ee()}function oe(T){if(_.length==1)h.set(T.pageX,T.pageY);else{const te=R(T),ae=.5*(T.pageX+te.x),ie=.5*(T.pageY+te.y);h.set(ae,ie)}p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const V=r.domElement;M(2*Math.PI*p.x/V.clientHeight),D(2*Math.PI*p.y/V.clientHeight),f.copy(h)}function re(T){if(_.length===1)g.set(T.pageX,T.pageY);else{const V=R(T),te=.5*(T.pageX+V.x),ae=.5*(T.pageY+V.y);g.set(te,ae)}m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g)}function pe(T){const V=R(T),te=T.pageX-V.x,ae=T.pageY-V.y,ie=Math.sqrt(te*te+ae*ae);w.set(0,ie),x.set(0,Math.pow(w.y/y.y,r.zoomSpeed)),v(x.y),y.copy(w)}function _e(T){r.enableZoom&&pe(T),r.enablePan&&re(T)}function Re(T){r.enableZoom&&pe(T),r.enableRotate&&oe(T)}function Q(T){r.enabled!==!1&&(_.length===0&&(r.domElement.setPointerCapture(T.pointerId),r.domElement.addEventListener("pointermove",de),r.domElement.addEventListener("pointerup",Ae)),he(T),T.pointerType==="touch"?N(T):J(T))}function de(T){r.enabled!==!1&&(T.pointerType==="touch"?j(T):ce(T))}function Ae(T){me(T),_.length===0&&(r.domElement.releasePointerCapture(T.pointerId),r.domElement.removeEventListener("pointermove",de),r.domElement.removeEventListener("pointerup",Ae)),r.dispatchEvent(kU),s=i.NONE}function q(T){me(T)}function J(T){let V;switch(T.button){case 0:V=r.mouseButtons.LEFT;break;case 1:V=r.mouseButtons.MIDDLE;break;case 2:V=r.mouseButtons.RIGHT;break;default:V=-1}switch(V){case wu.DOLLY:if(r.enableZoom===!1)return;P(T),s=i.DOLLY;break;case wu.ROTATE:if(T.ctrlKey||T.metaKey||T.shiftKey){if(r.enablePan===!1)return;L(T),s=i.PAN}else{if(r.enableRotate===!1)return;U(T),s=i.ROTATE}break;case wu.PAN:if(T.ctrlKey||T.metaKey||T.shiftKey){if(r.enableRotate===!1)return;U(T),s=i.ROTATE}else{if(r.enablePan===!1)return;L(T),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(gb)}function ce(T){switch(s){case i.ROTATE:if(r.enableRotate===!1)return;z(T);break;case i.DOLLY:if(r.enableZoom===!1)return;K(T);break;case i.PAN:if(r.enablePan===!1)return;O(T);break}}function xe(T){r.enabled===!1||r.enableZoom===!1||s!==i.NONE||(T.preventDefault(),r.dispatchEvent(gb),B(T),r.dispatchEvent(kU))}function be(T){r.enabled===!1||r.enablePan===!1||W(T)}function N(T){switch(G(T),_.length){case 1:switch(r.touches.ONE){case xu.ROTATE:if(r.enableRotate===!1)return;ee(),s=i.TOUCH_ROTATE;break;case xu.PAN:if(r.enablePan===!1)return;F(),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(r.touches.TWO){case xu.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ue(),s=i.TOUCH_DOLLY_PAN;break;case xu.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;le(),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(gb)}function j(T){switch(G(T),s){case i.TOUCH_ROTATE:if(r.enableRotate===!1)return;oe(T),r.update();break;case i.TOUCH_PAN:if(r.enablePan===!1)return;re(T),r.update();break;case i.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;_e(T),r.update();break;case i.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Re(T),r.update();break;default:s=i.NONE}}function se(T){r.enabled!==!1&&T.preventDefault()}function he(T){_.push(T)}function me(T){delete C[T.pointerId];for(let V=0;V<_.length;V++)if(_[V].pointerId==T.pointerId){_.splice(V,1);return}}function G(T){let V=C[T.pointerId];V===void 0&&(V=new $e,C[T.pointerId]=V),V.set(T.pageX,T.pageY)}function R(T){const V=T.pointerId===_[0].pointerId?_[1]:_[0];return C[V.pointerId]}r.domElement.addEventListener("contextmenu",se),r.domElement.addEventListener("pointerdown",Q),r.domElement.addEventListener("pointercancel",q),r.domElement.addEventListener("wheel",xe,{passive:!1}),this.update()}}function kH(n){let e,t,r,i=0;for(let a=0;a=2.0 are supported."));return}const A=new Pne(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});A.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}A.setExtensions(o),A.setPlugins(a),A.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function ane(){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 kt={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_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_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_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class lne{constructor(e){this.parser=e,this.name=kt.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 yne{constructor(e){this.parser=e,this.name=kt.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 A=r.options.manager.getHandler(a.uri);A!==null&&(l=A)}return this.detectSupport().then(function(A){if(A)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 wne{constructor(e){this.name=kt.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,A=i.byteLength||0,c=i.count,u=i.byteStride,f=new Uint8Array(a,l,A);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(c,u,f,i.mode,i.filter).then(function(h){return h.buffer}):o.ready.then(function(){const h=new ArrayBuffer(c*u);return o.decodeGltfBuffer(new Uint8Array(h),c,u,f,i.mode,i.filter),h})})}else return null}}class xne{constructor(e){this.name=kt.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 A of i.primitives)if(A.mode!==bs.TRIANGLES&&A.mode!==bs.TRIANGLE_STRIP&&A.mode!==bs.TRIANGLE_FAN&&A.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const A in o)a.push(this.parser.getDependency("accessor",o[A]).then(c=>(l[A]=c,l[A])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(A=>{const c=A.pop(),u=c.isGroup?c.children:[c],f=A[0].count,h=[];for(const p of u){const d=new je,g=new Z,m=new rt,y=new Z(1,1,1),w=new zx(p.geometry,p.material,f);for(let x=0;x0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Lne=new je;class Pne{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ane,this.associations=new Map,this.primitiveCache={},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;typeof navigator<"u"&&(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||r||i&&s<98?this.textureLoader=new lu(this.options.manager):this.textureLoader=new jte(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new nT(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._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:{}};Vd(s,a,i),Xl(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){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[A,c]of o.children.entries())s(c,a.children[A])};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(M,C[S*l+1]),l>=3&&g.setZ(M,C[S*l+2]),l>=4&&g.setW(M,C[S*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}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 A=this.loadImageSource(t,r).then(function(c){c.flipY=!1,c.name=o.name||a.name||"";const f=(s.samplers||{})[o.sampler]||{};return c.magFilter=zU[f.magFilter]||si,c.minFilter=zU[f.minFilter]||DA,c.wrapS=GU[f.wrapS]||As,c.wrapT=GU[f.wrapT]||As,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=A,A}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||"",A=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(u){A=!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 c=Promise.resolve(l).then(function(u){return new Promise(function(f,h){let p=f;t.isImageBitmapLoader===!0&&(p=function(d){const g=new Qn(d);g.needsUpdate=!0,f(g)}),t.load(xw.resolveURL(u,s.path),p,void 0,h)})}).then(function(u){return A===!0&&a.revokeObjectURL(l),u.userData.mimeType=o.mimeType||Une(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=c,c}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&&!(t==="aoMap"&&r.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),s.extensions[kt.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[kt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[kt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.encoding=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 MH,is.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 Cl,is.prototype.copy.call(l,r),l.color.copy(r.color),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}r.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=r}getMaterialType(){return kh}loadMaterial(e){const t=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},A=[];if(l[kt.KHR_MATERIALS_UNLIT]){const u=i[kt.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),A.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new Qe(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.fromArray(f),a.opacity=f[3]}u.baseColorTexture!==void 0&&A.push(t.assignTexture(a,"map",u.baseColorTexture,pt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(A.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),A.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),A.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=ui);const c=s.alphaMode||yb.OPAQUE;if(c===yb.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===yb.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Ei&&(A.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new $e(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}return s.occlusionTexture!==void 0&&o!==Ei&&(A.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Ei&&(a.emissive=new Qe().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==Ei&&A.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,pt)),Promise.all(A).then(function(){const u=new o(a);return s.name&&(u.name=s.name),Xl(u,s),t.associations.set(u,{materials:e}),s.extensions&&Vd(i,u,s),u})}createUniqueName(e){const t=_t.sanitizeNodeName(e||"");let r=t;for(let i=1;this.nodeNamesUsed[r];++i)r=t+"_"+i;return this.nodeNamesUsed[r]=!0,r}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[kt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return jU(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&Rne(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),Xl(m,s),g.extensions&&Vd(i,m,g),t.assignFinalMaterial(m),u.push(m)}for(let h=0,p=u.length;h1?u=new Ur:l.length===1?u=l[0]:u=new It,u!==l[0])for(let f=0,h=l.length;f{const u=new Map;for(const[f,h]of i.associations)(f instanceof is||f instanceof Qn)&&u.set(f,h);return c.traverse(f=>{const h=i.associations.get(f);h!=null&&u.set(f,h)}),u};return i.associations=A(s),s})}}function Dne(n,e,t){const r=e.attributes,i=new ps;if(r.POSITION!==void 0){const a=t.json.accessors[r.POSITION],l=a.min,A=a.max;if(l!==void 0&&A!==void 0){if(i.set(new Z(l[0],l[1],l[2]),new Z(A[0],A[1],A[2])),a.normalized){const c=hC(Ah[a.componentType]);i.min.multiplyScalar(c),i.max.multiplyScalar(c)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new Z,l=new Z;for(let A=0,c=s.length;Ac||i.y>c)&&(i.x>c&&(s.x=Math.floor(c/E.x),i.x=s.x*E.x,v.mapSize.x=s.x),i.y>c&&(s.y=Math.floor(c/E.y),i.y=s.y*E.y,v.mapSize.y=s.y)),v.map===null){const P=this.type!==bp?{minFilter:$n,magFilter:$n}:{};v.map=new ga(i.x,i.y,P),v.map.texture.name=I.name+".shadowMap",v.camera.updateProjectionMatrix()}n.setRenderTarget(v.map),n.clear();const U=v.getViewportCount();for(let P=0;P0||_.map&&_.alphaTest>0){const H=D.uuid,I=_.uuid;let v=A[H];v===void 0&&(v={},A[H]=v);let E=v[I];E===void 0&&(E=D.clone(),v[I]=E),D=E}return D.visible=_.visible,D.wireframe=_.wireframe,M===bp?D.side=_.shadowSide!==null?_.shadowSide:_.side:D.side=_.shadowSide!==null?_.shadowSide:u[_.side],D.alphaMap=_.alphaMap,D.alphaTest=_.alphaTest,D.map=_.map,D.clipShadows=_.clipShadows,D.clippingPlanes=_.clippingPlanes,D.clipIntersection=_.clipIntersection,D.displacementMap=_.displacementMap,D.displacementScale=_.displacementScale,D.displacementBias=_.displacementBias,D.wireframeLinewidth=_.wireframeLinewidth,D.linewidth=_.linewidth,C.isPointLight===!0&&D.isMeshDistanceMaterial===!0&&(D.referencePosition.setFromMatrixPosition(C.matrixWorld),D.nearDistance=S,D.farDistance=b),D}function w(x,_,C,S,b){if(x.visible===!1)return;if(x.layers.test(_.layers)&&(x.isMesh||x.isLine||x.isPoints)&&(x.castShadow||x.receiveShadow&&b===bp)&&(!x.frustumCulled||r.intersectsObject(x))){x.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,x.matrixWorld);const $=e.update(x),H=x.material;if(Array.isArray(H)){const I=$.groups;for(let v=0,E=I.length;v=1):L.indexOf("OpenGL ES")!==-1&&(P=parseFloat(/^OpenGL ES (\d)/.exec(L)[1]),U=P>=2);let z=null,K={};const O=n.getParameter(3088),B=n.getParameter(2978),W=new Qt().fromArray(O),ee=new Qt().fromArray(B);function F(fe,Ce,Se){const Fe=new Uint8Array(4),We=n.createTexture();n.bindTexture(fe,We),n.texParameteri(fe,10241,9728),n.texParameteri(fe,10240,9728);for(let qe=0;qe"u"?!1:/OculusBrowser/g.test(navigator.userAgent),p=new WeakMap;let d;const g=new WeakMap;let m=!1;try{m=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function y(N,j){return m?new OffscreenCanvas(N,j):zm("canvas")}function w(N,j,se,he){let me=1;if((N.width>he||N.height>he)&&(me=he/Math.max(N.width,N.height)),me<1||j===!0)if(typeof HTMLImageElement<"u"&&N instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&N instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&N instanceof ImageBitmap){const G=j?vw:Math.floor,R=G(me*N.width),T=G(me*N.height);d===void 0&&(d=y(R,T));const V=se?y(R,T):d;return V.width=R,V.height=T,V.getContext("2d").drawImage(N,0,0,R,T),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+N.width+"x"+N.height+") to ("+R+"x"+T+")."),V}else return"data"in N&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+N.width+"x"+N.height+")."),N;return N}function x(N){return aC(N.width)&&aC(N.height)}function _(N){return a?!1:N.wrapS!==Ai||N.wrapT!==Ai||N.minFilter!==$n&&N.minFilter!==si}function C(N,j){return N.generateMipmaps&&j&&N.minFilter!==$n&&N.minFilter!==si}function S(N){n.generateMipmap(N)}function b(N,j,se,he,me=!1){if(a===!1)return j;if(N!==null){if(n[N]!==void 0)return n[N];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+N+"'")}let G=j;return j===6403&&(se===5126&&(G=33326),se===5131&&(G=33325),se===5121&&(G=33321)),j===33319&&(se===5126&&(G=33328),se===5131&&(G=33327),se===5121&&(G=33323)),j===6408&&(se===5126&&(G=34836),se===5131&&(G=34842),se===5121&&(G=he===pt&&me===!1?35907:32856),se===32819&&(G=32854),se===32820&&(G=32855)),(G===33325||G===33326||G===33327||G===33328||G===34842||G===34836)&&e.get("EXT_color_buffer_float"),G}function M(N,j,se){return C(N,se)===!0||N.isFramebufferTexture&&N.minFilter!==$n&&N.minFilter!==si?Math.log2(Math.max(j.width,j.height))+1:N.mipmaps!==void 0&&N.mipmaps.length>0?N.mipmaps.length:N.isCompressedTexture&&Array.isArray(N.image)?j.mipmaps.length:1}function D(N){return N===$n||N===mw||N===em?9728:9729}function $(N){const j=N.target;j.removeEventListener("dispose",$),I(j),j.isVideoTexture&&p.delete(j)}function H(N){const j=N.target;j.removeEventListener("dispose",H),E(j)}function I(N){const j=r.get(N);if(j.__webglInit===void 0)return;const se=N.source,he=g.get(se);if(he){const me=he[j.__cacheKey];me.usedTimes--,me.usedTimes===0&&v(N),Object.keys(he).length===0&&g.delete(se)}r.remove(N)}function v(N){const j=r.get(N);n.deleteTexture(j.__webglTexture);const se=N.source,he=g.get(se);delete he[j.__cacheKey],o.memory.textures--}function E(N){const j=N.texture,se=r.get(N),he=r.get(j);if(he.__webglTexture!==void 0&&(n.deleteTexture(he.__webglTexture),o.memory.textures--),N.depthTexture&&N.depthTexture.dispose(),N.isWebGLCubeRenderTarget)for(let me=0;me<6;me++)n.deleteFramebuffer(se.__webglFramebuffer[me]),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer[me]);else{if(n.deleteFramebuffer(se.__webglFramebuffer),se.__webglDepthbuffer&&n.deleteRenderbuffer(se.__webglDepthbuffer),se.__webglMultisampledFramebuffer&&n.deleteFramebuffer(se.__webglMultisampledFramebuffer),se.__webglColorRenderbuffer)for(let me=0;me=l&&console.warn("THREE.WebGLTextures: Trying to use "+N+" texture units while this GPU supports only "+l),U+=1,N}function z(N){const j=[];return j.push(N.wrapS),j.push(N.wrapT),j.push(N.wrapR||0),j.push(N.magFilter),j.push(N.minFilter),j.push(N.anisotropy),j.push(N.internalFormat),j.push(N.format),j.push(N.type),j.push(N.generateMipmaps),j.push(N.premultiplyAlpha),j.push(N.flipY),j.push(N.unpackAlignment),j.push(N.encoding),j.join()}function K(N,j){const se=r.get(N);if(N.isVideoTexture&&xe(N),N.isRenderTargetTexture===!1&&N.version>0&&se.__version!==N.version){const he=N.image;if(he===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(he.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{le(se,N,j);return}}t.bindTexture(3553,se.__webglTexture,33984+j)}function O(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){le(se,N,j);return}t.bindTexture(35866,se.__webglTexture,33984+j)}function B(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){le(se,N,j);return}t.bindTexture(32879,se.__webglTexture,33984+j)}function W(N,j){const se=r.get(N);if(N.version>0&&se.__version!==N.version){oe(se,N,j);return}t.bindTexture(34067,se.__webglTexture,33984+j)}const ee={[As]:10497,[Ai]:33071,[Nm]:33648},F={[$n]:9728,[mw]:9984,[em]:9986,[si]:9729,[WM]:9985,[OA]:9987};function X(N,j,se){if(se?(n.texParameteri(N,10242,ee[j.wrapS]),n.texParameteri(N,10243,ee[j.wrapT]),(N===32879||N===35866)&&n.texParameteri(N,32882,ee[j.wrapR]),n.texParameteri(N,10240,F[j.magFilter]),n.texParameteri(N,10241,F[j.minFilter])):(n.texParameteri(N,10242,33071),n.texParameteri(N,10243,33071),(N===32879||N===35866)&&n.texParameteri(N,32882,33071),(j.wrapS!==Ai||j.wrapT!==Ai)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(N,10240,D(j.magFilter)),n.texParameteri(N,10241,D(j.minFilter)),j.minFilter!==$n&&j.minFilter!==si&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.")),e.has("EXT_texture_filter_anisotropic")===!0){const he=e.get("EXT_texture_filter_anisotropic");if(j.magFilter===$n||j.minFilter!==em&&j.minFilter!==OA||j.type===cA&&e.has("OES_texture_float_linear")===!1||a===!1&&j.type===km&&e.has("OES_texture_half_float_linear")===!1)return;(j.anisotropy>1||r.get(j).__currentAnisotropy)&&(n.texParameterf(N,he.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(j.anisotropy,i.getMaxAnisotropy())),r.get(j).__currentAnisotropy=j.anisotropy)}}function ue(N,j){let se=!1;N.__webglInit===void 0&&(N.__webglInit=!0,j.addEventListener("dispose",$));const he=j.source;let me=g.get(he);me===void 0&&(me={},g.set(he,me));const G=z(j);if(G!==N.__cacheKey){me[G]===void 0&&(me[G]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,se=!0),me[G].usedTimes++;const R=me[N.__cacheKey];R!==void 0&&(me[N.__cacheKey].usedTimes--,R.usedTimes===0&&v(j)),N.__cacheKey=G,N.__webglTexture=me[G].texture}return se}function le(N,j,se){let he=3553;(j.isDataArrayTexture||j.isCompressedArrayTexture)&&(he=35866),j.isData3DTexture&&(he=32879);const me=ue(N,j),G=j.source;t.bindTexture(he,N.__webglTexture,33984+se);const R=r.get(G);if(G.version!==R.__version||me===!0){t.activeTexture(33984+se),n.pixelStorei(37440,j.flipY),n.pixelStorei(37441,j.premultiplyAlpha),n.pixelStorei(3317,j.unpackAlignment),n.pixelStorei(37443,0);const T=_(j)&&x(j.image)===!1;let V=w(j.image,T,!1,c);V=be(j,V);const te=x(V)||a,ae=s.convert(j.format,j.encoding);let ie=s.convert(j.type),Te=b(j.internalFormat,ae,ie,j.encoding,j.isVideoTexture);X(he,j,te);let Me;const Le=j.mipmaps,ke=a&&j.isVideoTexture!==!0,De=R.__version===void 0||me===!0,fe=M(j,V,te);if(j.isDepthTexture)Te=6402,a?j.type===cA?Te=36012:j.type===Cc?Te=33190:j.type===Ah?Te=35056:Te=33189:j.type===cA&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),j.format===Dc&&Te===6402&&j.type!==cH&&j.type!==Cc&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),j.type=Cc,ie=s.convert(j.type)),j.format===Oh&&Te===6402&&(Te=34041,j.type!==Ah&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),j.type=Ah,ie=s.convert(j.type))),De&&(ke?t.texStorage2D(3553,1,Te,V.width,V.height):t.texImage2D(3553,0,Te,V.width,V.height,0,ae,ie,null));else if(j.isDataTexture)if(Le.length>0&&te){ke&&De&&t.texStorage2D(3553,fe,Te,Le[0].width,Le[0].height);for(let Ce=0,Se=Le.length;Ce>=1,Se>>=1}}else if(Le.length>0&&te){ke&&De&&t.texStorage2D(3553,fe,Te,Le[0].width,Le[0].height);for(let Ce=0,Se=Le.length;Ce0&&De++,t.texStorage2D(34067,De,Me,V[0].width,V[0].height));for(let Ce=0;Ce<6;Ce++)if(T){Le?t.texSubImage2D(34069+Ce,0,0,0,V[Ce].width,V[Ce].height,ie,Te,V[Ce].data):t.texImage2D(34069+Ce,0,Me,V[Ce].width,V[Ce].height,0,ie,Te,V[Ce].data);for(let Se=0;Se=34069&&me<=34074)&&n.framebufferTexture2D(36160,he,me,r.get(se).__webglTexture,0),t.bindFramebuffer(36160,null)}function pe(N,j,se){if(n.bindRenderbuffer(36161,N),j.depthBuffer&&!j.stencilBuffer){let he=33189;if(se||ce(j)){const me=j.depthTexture;me&&me.isDepthTexture&&(me.type===cA?he=36012:me.type===Cc&&(he=33190));const G=J(j);ce(j)?f.renderbufferStorageMultisampleEXT(36161,G,he,j.width,j.height):n.renderbufferStorageMultisample(36161,G,he,j.width,j.height)}else n.renderbufferStorage(36161,he,j.width,j.height);n.framebufferRenderbuffer(36160,36096,36161,N)}else if(j.depthBuffer&&j.stencilBuffer){const he=J(j);se&&ce(j)===!1?n.renderbufferStorageMultisample(36161,he,35056,j.width,j.height):ce(j)?f.renderbufferStorageMultisampleEXT(36161,he,35056,j.width,j.height):n.renderbufferStorage(36161,34041,j.width,j.height),n.framebufferRenderbuffer(36160,33306,36161,N)}else{const he=j.isWebGLMultipleRenderTargets===!0?j.texture:[j.texture];for(let me=0;me0&&ce(N)===!1){const T=G?j:[j];se.__webglMultisampledFramebuffer=n.createFramebuffer(),se.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,se.__webglMultisampledFramebuffer);for(let V=0;V0&&ce(N)===!1){const j=N.isWebGLMultipleRenderTargets?N.texture:[N.texture],se=N.width,he=N.height;let me=16384;const G=[],R=N.stencilBuffer?33306:36096,T=r.get(N),V=N.isWebGLMultipleRenderTargets===!0;if(V)for(let te=0;te0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&j.__useRenderToTexture!==!1}function xe(N){const j=o.render.frame;p.get(N)!==j&&(p.set(N,j),N.update())}function be(N,j){const se=N.encoding,he=N.format,me=N.type;return N.isCompressedTexture===!0||N.isVideoTexture===!0||N.format===oC||se!==cs&&(se===pt?a===!1?e.has("EXT_sRGB")===!0&&he===Br?(N.format=oC,N.minFilter=si,N.generateMipmaps=!1):j=pH.sRGBToLinear(j):(he!==Br||me!==NA)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",se)),j}this.allocateTextureUnit=L,this.resetTextureUnits=P,this.setTexture2D=K,this.setTexture2DArray=O,this.setTexture3D=B,this.setTextureCube=W,this.rebindTextures=Q,this.setupRenderTarget=de,this.updateRenderTargetMipmap=Ae,this.updateMultisampleRenderTarget=q,this.setupDepthRenderbuffer=Re,this.setupFrameBufferTexture=re,this.useMultisampledRTT=ce}function gte(n,e,t){const r=t.isWebGL2;function i(s,o=null){let a;if(s===NA)return 5121;if(s===WY)return 32819;if(s===KY)return 32820;if(s===GY)return 5120;if(s===VY)return 5122;if(s===cH)return 5123;if(s===jY)return 5124;if(s===Cc)return 5125;if(s===cA)return 5126;if(s===km)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===$Y)return 6406;if(s===Br)return 6408;if(s===YY)return 6409;if(s===XY)return 6410;if(s===Dc)return 6402;if(s===Oh)return 34041;if(s===oC)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===ZY)return 6403;if(s===JY)return 36244;if(s===qY)return 33319;if(s===eX)return 33320;if(s===tX)return 36249;if(s===D1||s===O1||s===N1||s===k1)if(o===pt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===D1)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===O1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===N1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===k1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===D1)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===O1)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===N1)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===k1)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===fF||s===hF||s===dF||s===pF)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===fF)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===hF)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===dF)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===pF)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===nX)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===mF||s===gF)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===mF)return o===pt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===gF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===vF||s===yF||s===wF||s===xF||s===_F||s===bF||s===BF||s===EF||s===CF||s===SF||s===MF||s===TF||s===IF||s===RF)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===vF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===yF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===wF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===xF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===_F)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===bF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===BF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===EF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===CF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===SF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===MF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===TF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===IF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===RF)return o===pt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===Q1)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===Q1)return o===pt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===rX||s===FF||s===UF||s===LF)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===Q1)return a.COMPRESSED_RED_RGTC1_EXT;if(s===FF)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===UF)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===LF)return a.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return s===Ah?r?34042:(a=e.get("WEBGL_depth_texture"),a!==null?a.UNSIGNED_INT_24_8_WEBGL:null):n[s]!==void 0?n[s]:null}return{convert:i}}class vte extends br{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Ur extends It{constructor(){super(),this.isGroup=!0,this.type="Group"}}const yte={type:"move"};class fb{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Ur,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 Ur,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new Z,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new Z),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new Ur,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new Z,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new Z),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,A=this._hand;if(e&&t.session.visibilityState!=="visible-blurred"){if(A&&e.hand){o=!0;for(const d of e.hand.values()){const g=t.getJointPose(d,r),m=this._getHandJoint(A,d);g!==null&&(m.matrix.fromArray(g.transform.matrix),m.matrix.decompose(m.position,m.rotation,m.scale),m.jointRadius=g.radius),m.visible=g!==null}const c=A.joints["index-finger-tip"],u=A.joints["thumb-tip"],f=c.position.distanceTo(u.position),h=.02,p=.005;A.inputState.pinching&&f>h+p?(A.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:e.handedness,target:this})):!A.inputState.pinching&&f<=h-p&&(A.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),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),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(yte)))}return a!==null&&(a.visible=i!==null),l!==null&&(l.visible=s!==null),A!==null&&(A.visible=o!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){const r=new Ur;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class CH extends Qn{constructor(e,t,r,i,s,o,a,l,A,c){if(c=c!==void 0?c:Dc,c!==Dc&&c!==Oh)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&c===Dc&&(r=Cc),r===void 0&&c===Oh&&(r=Ah),super(null,i,s,o,a,l,c,r,A),this.isDepthTexture=!0,this.image={width:e,height:t},this.magFilter=a!==void 0?a:$n,this.minFilter=l!==void 0?l:$n,this.flipY=!1,this.generateMipmaps=!1}}class wte extends XA{constructor(e,t){super();const r=this;let i=null,s=1,o=null,a="local-floor",l=1,A=null,c=null,u=null,f=null,h=null,p=null;const d=t.getContextAttributes();let g=null,m=null;const y=[],w=[],x=new Set,_=new Map,C=new br;C.layers.enable(1),C.viewport=new Qt;const S=new br;S.layers.enable(2),S.viewport=new Qt;const b=[C,S],M=new vte;M.layers.enable(1),M.layers.enable(2);let D=null,$=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getTargetRaySpace()},this.getControllerGrip=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getGripSpace()},this.getHand=function(B){let W=y[B];return W===void 0&&(W=new fb,y[B]=W),W.getHandSpace()};function H(B){const W=w.indexOf(B.inputSource);if(W===-1)return;const ee=y[W];ee!==void 0&&ee.dispatchEvent({type:B.type,data:B.inputSource})}function I(){i.removeEventListener("select",H),i.removeEventListener("selectstart",H),i.removeEventListener("selectend",H),i.removeEventListener("squeeze",H),i.removeEventListener("squeezestart",H),i.removeEventListener("squeezeend",H),i.removeEventListener("end",I),i.removeEventListener("inputsourceschange",v);for(let B=0;B=0&&(w[F]=null,y[F].disconnect(ee))}for(let W=0;W=w.length){w.push(ee),F=ue;break}else if(w[ue]===null){w[ue]=ee,F=ue;break}if(F===-1)break}const X=y[F];X&&X.connect(ee)}}const E=new Z,U=new Z;function P(B,W,ee){E.setFromMatrixPosition(W.matrixWorld),U.setFromMatrixPosition(ee.matrixWorld);const F=E.distanceTo(U),X=W.projectionMatrix.elements,ue=ee.projectionMatrix.elements,le=X[14]/(X[10]-1),oe=X[14]/(X[10]+1),re=(X[9]+1)/X[5],pe=(X[9]-1)/X[5],_e=(X[8]-1)/X[0],Re=(ue[8]+1)/ue[0],Q=le*_e,de=le*Re,Ae=F/(-_e+Re),q=Ae*-_e;W.matrixWorld.decompose(B.position,B.quaternion,B.scale),B.translateX(q),B.translateZ(Ae),B.matrixWorld.compose(B.position,B.quaternion,B.scale),B.matrixWorldInverse.copy(B.matrixWorld).invert();const J=le+Ae,ce=oe+Ae,xe=Q-q,be=de+(F-q),N=re*oe/ce*J,j=pe*oe/ce*J;B.projectionMatrix.makePerspective(xe,be,N,j,J,ce)}function L(B,W){W===null?B.matrixWorld.copy(B.matrix):B.matrixWorld.multiplyMatrices(W.matrixWorld,B.matrix),B.matrixWorldInverse.copy(B.matrixWorld).invert()}this.updateCamera=function(B){if(i===null)return;M.near=S.near=C.near=B.near,M.far=S.far=C.far=B.far,(D!==M.near||$!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),D=M.near,$=M.far);const W=B.parent,ee=M.cameras;L(M,W);for(let X=0;XX&&(_.set(F,F.lastChangedTime),r.dispatchEvent({type:"planechanged",data:F}))}}p=null}const O=new xH;O.setAnimationLoop(K),this.setAnimationLoop=function(B){z=B},this.dispose=function(){}}}function xte(n,e){function t(d,g){g.color.getRGB(d.fogColor.value,vH(n)),g.isFog?(d.fogNear.value=g.near,d.fogFar.value=g.far):g.isFogExp2&&(d.fogDensity.value=g.density)}function r(d,g,m,y,w){g.isMeshBasicMaterial||g.isMeshLambertMaterial?i(d,g):g.isMeshToonMaterial?(i(d,g),c(d,g)):g.isMeshPhongMaterial?(i(d,g),A(d,g)):g.isMeshStandardMaterial?(i(d,g),u(d,g),g.isMeshPhysicalMaterial&&f(d,g,w)):g.isMeshMatcapMaterial?(i(d,g),h(d,g)):g.isMeshDepthMaterial?i(d,g):g.isMeshDistanceMaterial?(i(d,g),p(d,g)):g.isMeshNormalMaterial?i(d,g):g.isLineBasicMaterial?(s(d,g),g.isLineDashedMaterial&&o(d,g)):g.isPointsMaterial?a(d,g,m,y):g.isSpriteMaterial?l(d,g):g.isShadowMaterial?(d.color.value.copy(g.color),d.opacity.value=g.opacity):g.isShaderMaterial&&(g.uniformsNeedUpdate=!1)}function i(d,g){d.opacity.value=g.opacity,g.color&&d.diffuse.value.copy(g.color),g.emissive&&d.emissive.value.copy(g.emissive).multiplyScalar(g.emissiveIntensity),g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.bumpMap&&(d.bumpMap.value=g.bumpMap,d.bumpScale.value=g.bumpScale,g.side===Xr&&(d.bumpScale.value*=-1)),g.displacementMap&&(d.displacementMap.value=g.displacementMap,d.displacementScale.value=g.displacementScale,d.displacementBias.value=g.displacementBias),g.emissiveMap&&(d.emissiveMap.value=g.emissiveMap),g.normalMap&&(d.normalMap.value=g.normalMap,d.normalScale.value.copy(g.normalScale),g.side===Xr&&d.normalScale.value.negate()),g.specularMap&&(d.specularMap.value=g.specularMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);const m=e.get(g).envMap;if(m&&(d.envMap.value=m,d.flipEnvMap.value=m.isCubeTexture&&m.isRenderTargetTexture===!1?-1:1,d.reflectivity.value=g.reflectivity,d.ior.value=g.ior,d.refractionRatio.value=g.refractionRatio),g.lightMap){d.lightMap.value=g.lightMap;const x=n.physicallyCorrectLights!==!0?Math.PI:1;d.lightMapIntensity.value=g.lightMapIntensity*x}g.aoMap&&(d.aoMap.value=g.aoMap,d.aoMapIntensity.value=g.aoMapIntensity);let y;g.map?y=g.map:g.specularMap?y=g.specularMap:g.displacementMap?y=g.displacementMap:g.normalMap?y=g.normalMap:g.bumpMap?y=g.bumpMap:g.roughnessMap?y=g.roughnessMap:g.metalnessMap?y=g.metalnessMap:g.alphaMap?y=g.alphaMap:g.emissiveMap?y=g.emissiveMap:g.clearcoatMap?y=g.clearcoatMap:g.clearcoatNormalMap?y=g.clearcoatNormalMap:g.clearcoatRoughnessMap?y=g.clearcoatRoughnessMap:g.iridescenceMap?y=g.iridescenceMap:g.iridescenceThicknessMap?y=g.iridescenceThicknessMap:g.specularIntensityMap?y=g.specularIntensityMap:g.specularColorMap?y=g.specularColorMap:g.transmissionMap?y=g.transmissionMap:g.thicknessMap?y=g.thicknessMap:g.sheenColorMap?y=g.sheenColorMap:g.sheenRoughnessMap&&(y=g.sheenRoughnessMap),y!==void 0&&(y.isWebGLRenderTarget&&(y=y.texture),y.matrixAutoUpdate===!0&&y.updateMatrix(),d.uvTransform.value.copy(y.matrix));let w;g.aoMap?w=g.aoMap:g.lightMap&&(w=g.lightMap),w!==void 0&&(w.isWebGLRenderTarget&&(w=w.texture),w.matrixAutoUpdate===!0&&w.updateMatrix(),d.uv2Transform.value.copy(w.matrix))}function s(d,g){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity}function o(d,g){d.dashSize.value=g.dashSize,d.totalSize.value=g.dashSize+g.gapSize,d.scale.value=g.scale}function a(d,g,m,y){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity,d.size.value=g.size*m,d.scale.value=y*.5,g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);let w;g.map?w=g.map:g.alphaMap&&(w=g.alphaMap),w!==void 0&&(w.matrixAutoUpdate===!0&&w.updateMatrix(),d.uvTransform.value.copy(w.matrix))}function l(d,g){d.diffuse.value.copy(g.color),d.opacity.value=g.opacity,d.rotation.value=g.rotation,g.map&&(d.map.value=g.map),g.alphaMap&&(d.alphaMap.value=g.alphaMap),g.alphaTest>0&&(d.alphaTest.value=g.alphaTest);let m;g.map?m=g.map:g.alphaMap&&(m=g.alphaMap),m!==void 0&&(m.matrixAutoUpdate===!0&&m.updateMatrix(),d.uvTransform.value.copy(m.matrix))}function A(d,g){d.specular.value.copy(g.specular),d.shininess.value=Math.max(g.shininess,1e-4)}function c(d,g){g.gradientMap&&(d.gradientMap.value=g.gradientMap)}function u(d,g){d.roughness.value=g.roughness,d.metalness.value=g.metalness,g.roughnessMap&&(d.roughnessMap.value=g.roughnessMap),g.metalnessMap&&(d.metalnessMap.value=g.metalnessMap),e.get(g).envMap&&(d.envMapIntensity.value=g.envMapIntensity)}function f(d,g,m){d.ior.value=g.ior,g.sheen>0&&(d.sheenColor.value.copy(g.sheenColor).multiplyScalar(g.sheen),d.sheenRoughness.value=g.sheenRoughness,g.sheenColorMap&&(d.sheenColorMap.value=g.sheenColorMap),g.sheenRoughnessMap&&(d.sheenRoughnessMap.value=g.sheenRoughnessMap)),g.clearcoat>0&&(d.clearcoat.value=g.clearcoat,d.clearcoatRoughness.value=g.clearcoatRoughness,g.clearcoatMap&&(d.clearcoatMap.value=g.clearcoatMap),g.clearcoatRoughnessMap&&(d.clearcoatRoughnessMap.value=g.clearcoatRoughnessMap),g.clearcoatNormalMap&&(d.clearcoatNormalScale.value.copy(g.clearcoatNormalScale),d.clearcoatNormalMap.value=g.clearcoatNormalMap,g.side===Xr&&d.clearcoatNormalScale.value.negate())),g.iridescence>0&&(d.iridescence.value=g.iridescence,d.iridescenceIOR.value=g.iridescenceIOR,d.iridescenceThicknessMinimum.value=g.iridescenceThicknessRange[0],d.iridescenceThicknessMaximum.value=g.iridescenceThicknessRange[1],g.iridescenceMap&&(d.iridescenceMap.value=g.iridescenceMap),g.iridescenceThicknessMap&&(d.iridescenceThicknessMap.value=g.iridescenceThicknessMap)),g.transmission>0&&(d.transmission.value=g.transmission,d.transmissionSamplerMap.value=m.texture,d.transmissionSamplerSize.value.set(m.width,m.height),g.transmissionMap&&(d.transmissionMap.value=g.transmissionMap),d.thickness.value=g.thickness,g.thicknessMap&&(d.thicknessMap.value=g.thicknessMap),d.attenuationDistance.value=g.attenuationDistance,d.attenuationColor.value.copy(g.attenuationColor)),d.specularIntensity.value=g.specularIntensity,d.specularColor.value.copy(g.specularColor),g.specularIntensityMap&&(d.specularIntensityMap.value=g.specularIntensityMap),g.specularColorMap&&(d.specularColorMap.value=g.specularColorMap)}function h(d,g){g.matcap&&(d.matcap.value=g.matcap)}function p(d,g){d.referencePosition.value.copy(g.referencePosition),d.nearDistance.value=g.nearDistance,d.farDistance.value=g.farDistance}return{refreshFogUniforms:t,refreshMaterialUniforms:r}}function _te(n,e,t,r){let i={},s={},o=[];const a=t.isWebGL2?n.getParameter(35375):0;function l(y,w){const x=w.program;r.uniformBlockBinding(y,x)}function A(y,w){let x=i[y.id];x===void 0&&(p(y),x=c(y),i[y.id]=x,y.addEventListener("dispose",g));const _=w.program;r.updateUBOMapping(y,_);const C=e.render.frame;s[y.id]!==C&&(f(y),s[y.id]=C)}function c(y){const w=u();y.__bindingPointIndex=w;const x=n.createBuffer(),_=y.__size,C=y.usage;return n.bindBuffer(35345,x),n.bufferData(35345,_,C),n.bindBuffer(35345,null),n.bindBufferBase(35345,w,x),x}function u(){for(let y=0;y0){C=x%_;const H=_-C;C!==0&&H-D.boundary<0&&(x+=_-C,M.__offset=x)}x+=D.storage}return C=x%_,C>0&&(x+=_-C),y.__size=x,y.__cache={},this}function d(y){const w={boundary:0,storage:0};return typeof y=="number"?(w.boundary=4,w.storage=4):y.isVector2?(w.boundary=8,w.storage=8):y.isVector3||y.isColor?(w.boundary=16,w.storage=12):y.isVector4?(w.boundary=16,w.storage=16):y.isMatrix3?(w.boundary=48,w.storage=48):y.isMatrix4?(w.boundary=64,w.storage=64):y.isTexture?console.warn("THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group."):console.warn("THREE.WebGLRenderer: Unsupported uniform value type.",y),w}function g(y){const w=y.target;w.removeEventListener("dispose",g);const x=o.indexOf(w.__bindingPointIndex);o.splice(x,1),n.deleteBuffer(i[w.id]),delete i[w.id],delete s[w.id]}function m(){for(const y in i)n.deleteBuffer(i[y]);o=[],i={},s={}}return{bind:l,update:A,dispose:m}}function bte(){const n=zm("canvas");return n.style.display="block",n}function yg(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:bte(),t=n.context!==void 0?n.context:null,r=n.depth!==void 0?n.depth:!0,i=n.stencil!==void 0?n.stencil:!0,s=n.antialias!==void 0?n.antialias:!1,o=n.premultipliedAlpha!==void 0?n.premultipliedAlpha:!0,a=n.preserveDrawingBuffer!==void 0?n.preserveDrawingBuffer:!1,l=n.powerPreference!==void 0?n.powerPreference:"default",A=n.failIfMajorPerformanceCaveat!==void 0?n.failIfMajorPerformanceCaveat:!1;let c;t!==null?c=t.getContextAttributes().alpha:c=n.alpha!==void 0?n.alpha:!1;let u=null,f=null;const h=[],p=[];this.domElement=e,this.debug={checkShaderErrors:!0},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.outputEncoding=cs,this.physicallyCorrectLights=!1,this.toneMapping=Al,this.toneMappingExposure=1;const d=this;let g=!1,m=0,y=0,w=null,x=-1,_=null;const C=new Qt,S=new Qt;let b=null,M=e.width,D=e.height,$=1,H=null,I=null;const v=new Qt(0,0,M,D),E=new Qt(0,0,M,D);let U=!1;const P=new JM;let L=!1,z=!1,K=null;const O=new je,B=new $e,W=new Z,ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function F(){return w===null?$:1}let X=t;function ue(ne,ge){for(let Be=0;Be0?f=p[p.length-1]:f=null,h.pop(),h.length>0?u=h[h.length-1]:u=null};function ut(ne,ge,Be,we){if(ne.visible===!1)return;if(ne.layers.test(ge.layers)){if(ne.isGroup)Be=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(ge);else if(ne.isLight)f.pushLight(ne),ne.castShadow&&f.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||P.intersectsSprite(ne)){we&&W.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(O);const st=J.update(ne),Ze=ne.material;Ze.visible&&u.push(ne,st,Ze,Be,W.z,null)}}else if((ne.isMesh||ne.isLine||ne.isPoints)&&(ne.isSkinnedMesh&&ne.skeleton.frame!==pe.render.frame&&(ne.skeleton.update(),ne.skeleton.frame=pe.render.frame),!ne.frustumCulled||P.intersectsObject(ne))){we&&W.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(O);const st=J.update(ne),Ze=ne.material;if(Array.isArray(Ze)){const Je=st.groups;for(let yt=0,mt=Je.length;yt0&&Ct(Ee,ge,Be),we&&re.viewport(C.copy(we)),Ee.length>0&&it(Ee,ge,Be),ze.length>0&&it(ze,ge,Be),st.length>0&&it(st,ge,Be),re.buffers.depth.setTest(!0),re.buffers.depth.setMask(!0),re.buffers.color.setMask(!0),re.setPolygonOffset(!1)}function Ct(ne,ge,Be){const we=oe.isWebGL2;K===null&&(K=new ga(1,1,{generateMipmaps:!0,type:le.has("EXT_color_buffer_half_float")?km:NA,minFilter:OA,samples:we&&s===!0?4:0})),d.getDrawingBufferSize(B),we?K.setSize(B.x,B.y):K.setSize(vw(B.x),vw(B.y));const Ee=d.getRenderTarget();d.setRenderTarget(K),d.clear();const ze=d.toneMapping;d.toneMapping=Al,it(ne,ge,Be),d.toneMapping=ze,Re.updateMultisampleRenderTarget(K),Re.updateRenderTargetMipmap(K),d.setRenderTarget(Ee)}function it(ne,ge,Be){const we=ge.isScene===!0?ge.overrideMaterial:null;for(let Ee=0,ze=ne.length;Ee0&&Re.useMultisampledRTT(ne)===!1?Ee=_e.get(ne).__webglMultisampledFramebuffer:Ee=mt,C.copy(ne.viewport),S.copy(ne.scissor),b=ne.scissorTest}else C.copy(v).multiplyScalar($).floor(),S.copy(E).multiplyScalar($).floor(),b=U;if(re.bindFramebuffer(36160,Ee)&&oe.drawBuffers&&we&&re.drawBuffers(ne,Ee),re.viewport(C),re.scissor(S),re.setScissorTest(b),ze){const Je=_e.get(ne.texture);X.framebufferTexture2D(36160,36064,34069+ge,Je.__webglTexture,Be)}else if(st){const Je=_e.get(ne.texture),yt=ge||0;X.framebufferTextureLayer(36160,36064,Je.__webglTexture,Be||0,yt)}x=-1},this.readRenderTargetPixels=function(ne,ge,Be,we,Ee,ze,st){if(!(ne&&ne.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Ze=_e.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&st!==void 0&&(Ze=Ze[st]),Ze){re.bindFramebuffer(36160,Ze);try{const Je=ne.texture,yt=Je.format,mt=Je.type;if(yt!==Br&&T.convert(yt)!==X.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const gt=mt===km&&(le.has("EXT_color_buffer_half_float")||oe.isWebGL2&&le.has("EXT_color_buffer_float"));if(mt!==NA&&T.convert(mt)!==X.getParameter(35738)&&!(mt===cA&&(oe.isWebGL2||le.has("OES_texture_float")||le.has("WEBGL_color_buffer_float")))&&!gt){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ge>=0&&ge<=ne.width-we&&Be>=0&&Be<=ne.height-Ee&&X.readPixels(ge,Be,we,Ee,T.convert(yt),T.convert(mt),ze)}finally{const Je=w!==null?_e.get(w).__webglFramebuffer:null;re.bindFramebuffer(36160,Je)}}},this.copyFramebufferToTexture=function(ne,ge,Be=0){const we=Math.pow(2,-Be),Ee=Math.floor(ge.image.width*we),ze=Math.floor(ge.image.height*we);Re.setTexture2D(ge,0),X.copyTexSubImage2D(3553,Be,0,0,ne.x,ne.y,Ee,ze),re.unbindTexture()},this.copyTextureToTexture=function(ne,ge,Be,we=0){const Ee=ge.image.width,ze=ge.image.height,st=T.convert(Be.format),Ze=T.convert(Be.type);Re.setTexture2D(Be,0),X.pixelStorei(37440,Be.flipY),X.pixelStorei(37441,Be.premultiplyAlpha),X.pixelStorei(3317,Be.unpackAlignment),ge.isDataTexture?X.texSubImage2D(3553,we,ne.x,ne.y,Ee,ze,st,Ze,ge.image.data):ge.isCompressedTexture?X.compressedTexSubImage2D(3553,we,ne.x,ne.y,ge.mipmaps[0].width,ge.mipmaps[0].height,st,ge.mipmaps[0].data):X.texSubImage2D(3553,we,ne.x,ne.y,st,Ze,ge.image),we===0&&Be.generateMipmaps&&X.generateMipmap(3553),re.unbindTexture()},this.copyTextureToTexture3D=function(ne,ge,Be,we,Ee=0){if(d.isWebGL1Renderer){console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.");return}const ze=ne.max.x-ne.min.x+1,st=ne.max.y-ne.min.y+1,Ze=ne.max.z-ne.min.z+1,Je=T.convert(we.format),yt=T.convert(we.type);let mt;if(we.isData3DTexture)Re.setTexture3D(we,0),mt=32879;else if(we.isDataArrayTexture)Re.setTexture2DArray(we,0),mt=35866;else{console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: only supports THREE.DataTexture3D and THREE.DataTexture2DArray.");return}X.pixelStorei(37440,we.flipY),X.pixelStorei(37441,we.premultiplyAlpha),X.pixelStorei(3317,we.unpackAlignment);const gt=X.getParameter(3314),Zt=X.getParameter(32878),Rn=X.getParameter(3316),Di=X.getParameter(3315),eo=X.getParameter(32877),pn=Be.isCompressedTexture?Be.mipmaps[0]:Be.image;X.pixelStorei(3314,pn.width),X.pixelStorei(32878,pn.height),X.pixelStorei(3316,ne.min.x),X.pixelStorei(3315,ne.min.y),X.pixelStorei(32877,ne.min.z),Be.isDataTexture||Be.isData3DTexture?X.texSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,yt,pn.data):Be.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),X.compressedTexSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,pn.data)):X.texSubImage3D(mt,Ee,ge.x,ge.y,ge.z,ze,st,Ze,Je,yt,pn),X.pixelStorei(3314,gt),X.pixelStorei(32878,Zt),X.pixelStorei(3316,Rn),X.pixelStorei(3315,Di),X.pixelStorei(32877,eo),Ee===0&&we.generateMipmaps&&X.generateMipmap(mt),re.unbindTexture()},this.initTexture=function(ne){ne.isCubeTexture?Re.setTextureCube(ne,0):ne.isData3DTexture?Re.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?Re.setTexture2DArray(ne,0):Re.setTexture2D(ne,0),re.unbindTexture()},this.resetState=function(){m=0,y=0,w=null,re.reset(),V.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class Bte extends yg{}Bte.prototype.isWebGL1Renderer=!0;class yw extends It{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,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,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}get autoUpdate(){return console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate}set autoUpdate(e){console.warn("THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144."),this.matrixWorldAutoUpdate=e}}class Ete{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=sC,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Co()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}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;il)continue;f.applyMatrix4(this.matrixWorld);const b=e.ray.origin.distanceTo(f);be.far||t.push({distance:b,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}else{const m=Math.max(0,o.start),y=Math.min(g.count,o.start+o.count);for(let w=m,x=y-1;wl)continue;f.applyMatrix4(this.matrixWorld);const C=e.ray.origin.distanceTo(f);Ce.far||t.push({distance:C,point:u.clone().applyMatrix4(this.matrixWorld),index:w,face:null,faceIndex:null,object:this})}}}updateMorphTargets(){const t=this.geometry.morphAttributes,r=Object.keys(t);if(r.length>0){const i=t[r[0]];if(i!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let s=0,o=i.length;s0){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:A,distanceToRay:Math.sqrt(a),point:l,index:e,face:null,object:o})}}class Rte{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,A;for(;a<=l;)if(i=Math.floor(a+(l-a)/2),A=r[i]-o,A<0)a=i+1;else if(A>0)l=i-1;else{l=i;break}if(i=l,r[i]===o)return i/(s-1);const c=r[i],f=r[i+1]-c,h=(o-c)/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 $e:new Z);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 Z,i=[],s=[],o=[],a=new Z,l=new je;for(let h=0;h<=e;h++){const p=h/e;i[h]=this.getTangentAt(p,new Z)}s[0]=new Z,o[0]=new Z;let A=Number.MAX_VALUE;const c=Math.abs(i[0].x),u=Math.abs(i[0].y),f=Math.abs(i[0].z);c<=A&&(A=c,r.set(1,0,0)),u<=A&&(A=u,r.set(0,1,0)),f<=A&&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 p=Math.acos(hr(i[h-1].dot(i[h]),-1,1));s[h].applyMatrix4(l.makeRotationAxis(a,p))}o[h].crossVectors(i[h],s[h])}if(t===!0){let h=Math.acos(hr(s[0].dot(s[e]),-1,1));h/=e,i[0].dot(a.crossVectors(s[0],s[e]))>0&&(h=-h);for(let p=1;p<=e;p++)s[p].applyMatrix4(l.makeRotationAxis(i[p],h*p)),o[p].crossVectors(i[p],s[p])}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.5,type:"Curve",generator:"Curve.toJSON"}};return e.arcLengthDivisions=this.arcLengthDivisions,e.type=this.type,e}fromJSON(e){return this.arcLengthDivisions=e.arcLengthDivisions,this}}class Vx extends $t{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 A=this;i=Math.floor(i),s=Math.floor(s);const c=[],u=[],f=[],h=[];let p=0;const d=[],g=r/2;let m=0;y(),o===!1&&(e>0&&w(!0),t>0&&w(!1)),this.setIndex(c),this.setAttribute("position",new an(u,3)),this.setAttribute("normal",new an(f,3)),this.setAttribute("uv",new an(h,2));function y(){const x=new Z,_=new Z;let C=0;const S=(t-e)/r;for(let b=0;b<=s;b++){const M=[],D=b/s,$=D*(t-e)+e;for(let H=0;H<=i;H++){const I=H/i,v=I*l+a,E=Math.sin(v),U=Math.cos(v);_.x=$*E,_.y=-D*r+g,_.z=$*U,u.push(_.x,_.y,_.z),x.set(E,S,U).normalize(),f.push(x.x,x.y,x.z),h.push(I,1-D),M.push(p++)}d.push(M)}for(let b=0;b0)&&h.push(w,x,C),(m!==r-1||l0!=e>0&&this.version++,this._sheen=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 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.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.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 db extends is{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new Qe(16777215),this.specular=new Qe(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qh,this.normalScale=new $e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=kx,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.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 Fte extends is{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qh,this.normalScale=new $e(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 Ute extends is{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new Qe(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Qe(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=qh,this.normalScale=new $e(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=kx,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.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 kl(n,e,t){return TH(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function P0(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 TH(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function Lte(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 TU(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 IH(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 xg{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=kl(r,s,o),this.values=kl(this.values,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&&TH(i))for(let a=0,l=i.length;a!==l;++a){const A=i[a];if(isNaN(A)){console.error("THREE.KeyframeTrack: Value is not a valid number.",this,a,A),e=!1;break}}return e}optimize(){const e=kl(this.times),t=kl(this.values),r=this.getValueSize(),i=this.getInterpolation()===H1,s=e.length-1;let o=1;for(let a=1;a0){e[o]=e[s];for(let a=s*r,l=o*r,A=0;A!==r;++A)t[l+A]=t[a+A];++o}return o!==e.length?(this.times=kl(e,0,o),this.values=kl(t,0,o*r)):(this.times=e,this.values=t),this}clone(){const e=kl(this.times,0),t=kl(this.values,0),r=this.constructor,i=new r(this.name,e,t);return i.createInterpolant=this.createInterpolant,i}}ba.prototype.TimeBufferType=Float32Array;ba.prototype.ValueBufferType=Float32Array;ba.prototype.DefaultInterpolation=Yc;class rd extends ba{}rd.prototype.ValueTypeName="bool";rd.prototype.ValueBufferType=Array;rd.prototype.DefaultInterpolation=Nh;rd.prototype.InterpolantFactoryMethodLinear=void 0;rd.prototype.InterpolantFactoryMethodSmooth=void 0;class FH extends ba{}FH.prototype.ValueTypeName="color";class Hh extends ba{}Hh.prototype.ValueTypeName="number";class Ote extends xg{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 A=e*a;for(let c=A+a;A!==c;A+=4)rt.slerpFlat(s,0,o,A-a,o,A,l);return s}}class va extends ba{InterpolantFactoryMethodLinear(e){return new Ote(this.times,this.values,this.getValueSize(),e)}}va.prototype.ValueTypeName="quaternion";va.prototype.DefaultInterpolation=Yc;va.prototype.InterpolantFactoryMethodSmooth=void 0;class id extends ba{}id.prototype.ValueTypeName="string";id.prototype.ValueBufferType=Array;id.prototype.DefaultInterpolation=Nh;id.prototype.InterpolantFactoryMethodLinear=void 0;id.prototype.InterpolantFactoryMethodSmooth=void 0;class kA extends ba{}kA.prototype.ValueTypeName="vector";class Xc{constructor(e,t=-1,r,i=KM){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=Co(),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(kte(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(ba.toJSON(r[s]));return i}static CreateFromMorphTargetSequence(e,t,r,i){const s=t.length,o=[];for(let a=0;a1){const u=c[1];let f=i[u];f||(i[u]=f=[]),f.push(A)}}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,p,d){if(h.length!==0){const g=[],m=[];IH(h,g,m,p),g.length!==0&&d.push(new u(f,g,m))}},i=[],s=e.name||"default",o=e.fps||30,a=e.blendMode;let l=e.length||-1;const A=e.hierarchy||[];for(let u=0;u{t&&t(s),this.manager.itemEnd(e)},0),s;if(Pa[e]!==void 0){Pa[e].push({onLoad:t,onProgress:r,onError:i});return}Pa[e]=[],Pa[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(A=>{if(A.status===200||A.status===0){if(A.status===0&&console.warn("THREE.FileLoader: HTTP Status 0 received."),typeof ReadableStream>"u"||A.body===void 0||A.body.getReader===void 0)return A;const c=Pa[e],u=A.body.getReader(),f=A.headers.get("Content-Length")||A.headers.get("X-File-Size"),h=f?parseInt(f):0,p=h!==0;let d=0;const g=new ReadableStream({start(m){y();function y(){u.read().then(({done:w,value:x})=>{if(w)m.close();else{d+=x.byteLength;const _=new ProgressEvent("progress",{lengthComputable:p,loaded:d,total:h});for(let C=0,S=c.length;C{switch(l){case"arraybuffer":return A.arrayBuffer();case"blob":return A.blob();case"document":return A.text().then(c=>new DOMParser().parseFromString(c,a));case"json":return A.json();default:if(a===void 0)return A.text();{const u=/charset="?([^;"\s]*)"?/i.exec(a),f=u&&u[1]?u[1].toLowerCase():void 0,h=new TextDecoder(f);return A.arrayBuffer().then(p=>h.decode(p))}}}).then(A=>{zh.add(e,A);const c=Pa[e];delete Pa[e];for(let u=0,f=c.length;u{const c=Pa[e];if(c===void 0)throw this.manager.itemError(e),A;delete Pa[e];for(let u=0,f=c.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 LH extends sd{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=zh.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=zm("img");function l(){c(),zh.add(e,this),t&&t(this),s.manager.itemEnd(e)}function A(u){c(),i&&i(u),s.manager.itemError(e),s.manager.itemEnd(e)}function c(){a.removeEventListener("load",l,!1),a.removeEventListener("error",A,!1)}return a.addEventListener("load",l,!1),a.addEventListener("error",A,!1),e.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(a.crossOrigin=this.crossOrigin),s.manager.itemStart(e),a.src=e,a}}class Au extends sd{constructor(e){super(e)}load(e,t,r,i){const s=new Qn,o=new LH(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 jx extends It{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new Qe(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()),t}}const pb=new je,IU=new Z,RU=new Z;class rT{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new $e(512,512),this.map=null,this.mapPass=null,this.matrix=new je,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new JM,this._frameExtents=new $e(1,1),this._viewportCount=1,this._viewports=[new Qt(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;IU.setFromMatrixPosition(e.matrixWorld),t.position.copy(IU),RU.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(RU),t.updateMatrixWorld(),pb.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(pb),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(pb)}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.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.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 zte extends rT{constructor(){super(new br(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=Hm*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 PH extends jx{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(It.DEFAULT_UP),this.updateMatrix(),this.target=new It,this.distance=r,this.angle=i,this.penumbra=s,this.decay=o,this.map=null,this.shadow=new zte}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 FU=new je,Gd=new Z,mb=new Z;class Gte extends rT{constructor(){super(new br(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new $e(4,2),this._viewportCount=6,this._viewports=[new Qt(2,1,1,1),new Qt(0,1,1,1),new Qt(3,1,1,1),new Qt(1,1,1,1),new Qt(3,0,1,1),new Qt(1,0,1,1)],this._cubeDirections=[new Z(1,0,0),new Z(-1,0,0),new Z(0,0,1),new Z(0,0,-1),new Z(0,1,0),new Z(0,-1,0)],this._cubeUps=[new Z(0,1,0),new Z(0,1,0),new Z(0,1,0),new Z(0,1,0),new Z(0,0,1),new Z(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()),Gd.setFromMatrixPosition(e.matrixWorld),r.position.copy(Gd),mb.copy(r.position),mb.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(mb),r.updateMatrixWorld(),i.makeTranslation(-Gd.x,-Gd.y,-Gd.z),FU.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(FU)}}class cC extends jx{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 Gte}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 Vte extends rT{constructor(){super(new ed(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class iT extends jx{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(It.DEFAULT_UP),this.updateMatrix(),this.target=new It,this.shadow=new Vte}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class DH extends jx{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class _w{static decodeText(e){if(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=zh.get(e);if(o!==void 0)return s.manager.itemStart(e),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,fetch(e,a).then(function(l){return l.blob()}).then(function(l){return createImageBitmap(l,Object.assign(s.options,{colorSpaceConversion:"none"}))}).then(function(l){zh.add(e,l),t&&t(l),s.manager.itemEnd(e)}).catch(function(l){i&&i(l),s.manager.itemError(e),s.manager.itemEnd(e)}),s.manager.itemStart(e)}}class OH{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=UU(),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=UU();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function UU(){return(typeof performance>"u"?Date:performance).now()}class Wte{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,A=t+t;l!==A;++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){rt.slerpFlat(e,t,e,t,e,r,i)}_slerpAdditive(e,t,r,i,s){const o=this._workIndex*s;rt.multiplyQuaternionsFlat(e,o,e,t,e,r),rt.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 sT="\\[\\]\\.:\\/",Kte=new RegExp("["+sT+"]","g"),oT="[^"+sT+"]",$te="[^"+sT.replace("\\.","")+"]",Yte=/((?:WC+[\/:])*)/.source.replace("WC",oT),Xte=/(WCOD+)?/.source.replace("WCOD",$te),Zte=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",oT),Jte=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",oT),qte=new RegExp("^"+Yte+Xte+Zte+Jte+"$"),ene=["material","materials","bones","map"];class tne{constructor(e,t,r){const i=r||_t.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 _t{constructor(e,t,r){this.path=t,this.parsedPath=r||_t.parseTrackName(t),this.node=_t.findNode(e,this.parsedPath.nodeName)||e,this.rootNode=e,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(e,t,r){return e&&e.isAnimationObjectGroup?new _t.Composite(e,t,r):new _t(e,t,r)}static sanitizeNodeName(e){return e.replace(/\s/g,"_").replace(Kte,"")}static parseTrackName(e){const t=qte.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);ene.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,A=this._propertyBindings;switch(this.blendMode){case aX:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].accumulateAdditive(a);break;case KM:default:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].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===oX;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===iX){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 A=e<0;this._setEndings(A,!A,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=Vf,i.endingEnd=Vf):(e?i.endingStart=this.zeroSlopeAtStart?Vf:Gf:i.endingStart=gw,t?i.endingEnd=this.zeroSlopeAtEnd?Vf:Gf:i.endingEnd=gw)}_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 rne=new Float32Array(1);class ine extends XA{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,A=this._bindingsByRootAndName;let c=A[l];c===void 0&&(c={},A[l]=c);for(let u=0;u!==s;++u){const f=i[u],h=f.name;let p=c[h];if(p!==void 0)++p.referenceCount,o[u]=p;else{if(p=o[u],p!==void 0){p._cacheIndex===null&&(++p.referenceCount,this._addInactiveBinding(p,l,h));continue}const d=t&&t._propertyBindings[u].binding.parsedPath;p=new Wte(_t.create(r,h,d),f.ValueTypeName,f.getValueSize()),++p.referenceCount,this._addInactiveBinding(p,l,h),o[u]=p}a[u].resultBuffer=p.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 A=0;A!==r;++A)t[A]._update(i,e,s,o);const a=this._bindings,l=this._nActiveBindings;for(let A=0;A!==l;++A)a[A].apply(o);return this}setTime(e){this.time=0;for(let t=0;tMath.PI&&(ke-=Te),De<-Math.PI?De+=Te:De>Math.PI&&(De-=Te),ke<=De?a.theta=Math.max(ke,Math.min(De,a.theta)):a.theta=a.theta>(ke+De)/2?Math.max(ke,a.theta):Math.min(De,a.theta)),a.phi=Math.max(r.minPolarAngle,Math.min(r.maxPolarAngle,a.phi)),a.makeSafe(),a.radius*=A,a.radius=Math.max(r.minDistance,Math.min(r.maxDistance,a.radius)),r.enableDamping===!0?r.target.addScaledVector(c,r.dampingFactor):r.target.add(c),T.setFromSpherical(a),T.applyQuaternion(te),Le.copy(r.target).add(T),r.object.lookAt(r.target),r.enableDamping===!0?(l.theta*=1-r.dampingFactor,l.phi*=1-r.dampingFactor,c.multiplyScalar(1-r.dampingFactor)):(l.set(0,0,0),c.set(0,0,0)),A=1,u||ae.distanceToSquared(r.object.position)>o||8*(1-ie.dot(r.object.quaternion))>o?(r.dispatchEvent(NU),ae.copy(r.object.position),ie.copy(r.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",se),r.domElement.removeEventListener("pointerdown",Q),r.domElement.removeEventListener("pointercancel",q),r.domElement.removeEventListener("wheel",xe),r.domElement.removeEventListener("pointermove",de),r.domElement.removeEventListener("pointerup",Ae),r._domElementKeyEvents!==null&&r._domElementKeyEvents.removeEventListener("keydown",be)};const r=this,i={NONE:-1,ROTATE:0,DOLLY:1,PAN:2,TOUCH_ROTATE:3,TOUCH_PAN:4,TOUCH_DOLLY_PAN:5,TOUCH_DOLLY_ROTATE:6};let s=i.NONE;const o=1e-6,a=new DU,l=new DU;let A=1;const c=new Z;let u=!1;const f=new $e,h=new $e,p=new $e,d=new $e,g=new $e,m=new $e,y=new $e,w=new $e,x=new $e,_=[],C={};function S(){return 2*Math.PI/60/60*r.autoRotateSpeed}function b(){return Math.pow(.95,r.zoomSpeed)}function M(T){l.theta-=T}function D(T){l.phi-=T}const $=function(){const T=new Z;return function(te,ae){T.setFromMatrixColumn(ae,0),T.multiplyScalar(-te),c.add(T)}}(),H=function(){const T=new Z;return function(te,ae){r.screenSpacePanning===!0?T.setFromMatrixColumn(ae,1):(T.setFromMatrixColumn(ae,0),T.crossVectors(r.object.up,T)),T.multiplyScalar(te),c.add(T)}}(),I=function(){const T=new Z;return function(te,ae){const ie=r.domElement;if(r.object.isPerspectiveCamera){const Te=r.object.position;T.copy(Te).sub(r.target);let Me=T.length();Me*=Math.tan(r.object.fov/2*Math.PI/180),$(2*te*Me/ie.clientHeight,r.object.matrix),H(2*ae*Me/ie.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?($(te*(r.object.right-r.object.left)/r.object.zoom/ie.clientWidth,r.object.matrix),H(ae*(r.object.top-r.object.bottom)/r.object.zoom/ie.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function v(T){r.object.isPerspectiveCamera?A/=T:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*T)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function E(T){r.object.isPerspectiveCamera?A*=T:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/T)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function U(T){f.set(T.clientX,T.clientY)}function P(T){y.set(T.clientX,T.clientY)}function L(T){d.set(T.clientX,T.clientY)}function z(T){h.set(T.clientX,T.clientY),p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const V=r.domElement;M(2*Math.PI*p.x/V.clientHeight),D(2*Math.PI*p.y/V.clientHeight),f.copy(h),r.update()}function K(T){w.set(T.clientX,T.clientY),x.subVectors(w,y),x.y>0?v(b()):x.y<0&&E(b()),y.copy(w),r.update()}function O(T){g.set(T.clientX,T.clientY),m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g),r.update()}function B(T){T.deltaY<0?E(b()):T.deltaY>0&&v(b()),r.update()}function W(T){let V=!1;switch(T.code){case r.keys.UP:T.ctrlKey||T.metaKey||T.shiftKey?D(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,r.keyPanSpeed),V=!0;break;case r.keys.BOTTOM:T.ctrlKey||T.metaKey||T.shiftKey?D(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,-r.keyPanSpeed),V=!0;break;case r.keys.LEFT:T.ctrlKey||T.metaKey||T.shiftKey?M(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(r.keyPanSpeed,0),V=!0;break;case r.keys.RIGHT:T.ctrlKey||T.metaKey||T.shiftKey?M(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(-r.keyPanSpeed,0),V=!0;break}V&&(T.preventDefault(),r.update())}function ee(){if(_.length===1)f.set(_[0].pageX,_[0].pageY);else{const T=.5*(_[0].pageX+_[1].pageX),V=.5*(_[0].pageY+_[1].pageY);f.set(T,V)}}function F(){if(_.length===1)d.set(_[0].pageX,_[0].pageY);else{const T=.5*(_[0].pageX+_[1].pageX),V=.5*(_[0].pageY+_[1].pageY);d.set(T,V)}}function X(){const T=_[0].pageX-_[1].pageX,V=_[0].pageY-_[1].pageY,te=Math.sqrt(T*T+V*V);y.set(0,te)}function ue(){r.enableZoom&&X(),r.enablePan&&F()}function le(){r.enableZoom&&X(),r.enableRotate&&ee()}function oe(T){if(_.length==1)h.set(T.pageX,T.pageY);else{const te=R(T),ae=.5*(T.pageX+te.x),ie=.5*(T.pageY+te.y);h.set(ae,ie)}p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const V=r.domElement;M(2*Math.PI*p.x/V.clientHeight),D(2*Math.PI*p.y/V.clientHeight),f.copy(h)}function re(T){if(_.length===1)g.set(T.pageX,T.pageY);else{const V=R(T),te=.5*(T.pageX+V.x),ae=.5*(T.pageY+V.y);g.set(te,ae)}m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g)}function pe(T){const V=R(T),te=T.pageX-V.x,ae=T.pageY-V.y,ie=Math.sqrt(te*te+ae*ae);w.set(0,ie),x.set(0,Math.pow(w.y/y.y,r.zoomSpeed)),v(x.y),y.copy(w)}function _e(T){r.enableZoom&&pe(T),r.enablePan&&re(T)}function Re(T){r.enableZoom&&pe(T),r.enableRotate&&oe(T)}function Q(T){r.enabled!==!1&&(_.length===0&&(r.domElement.setPointerCapture(T.pointerId),r.domElement.addEventListener("pointermove",de),r.domElement.addEventListener("pointerup",Ae)),he(T),T.pointerType==="touch"?N(T):J(T))}function de(T){r.enabled!==!1&&(T.pointerType==="touch"?j(T):ce(T))}function Ae(T){me(T),_.length===0&&(r.domElement.releasePointerCapture(T.pointerId),r.domElement.removeEventListener("pointermove",de),r.domElement.removeEventListener("pointerup",Ae)),r.dispatchEvent(kU),s=i.NONE}function q(T){me(T)}function J(T){let V;switch(T.button){case 0:V=r.mouseButtons.LEFT;break;case 1:V=r.mouseButtons.MIDDLE;break;case 2:V=r.mouseButtons.RIGHT;break;default:V=-1}switch(V){case xu.DOLLY:if(r.enableZoom===!1)return;P(T),s=i.DOLLY;break;case xu.ROTATE:if(T.ctrlKey||T.metaKey||T.shiftKey){if(r.enablePan===!1)return;L(T),s=i.PAN}else{if(r.enableRotate===!1)return;U(T),s=i.ROTATE}break;case xu.PAN:if(T.ctrlKey||T.metaKey||T.shiftKey){if(r.enableRotate===!1)return;U(T),s=i.ROTATE}else{if(r.enablePan===!1)return;L(T),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(gb)}function ce(T){switch(s){case i.ROTATE:if(r.enableRotate===!1)return;z(T);break;case i.DOLLY:if(r.enableZoom===!1)return;K(T);break;case i.PAN:if(r.enablePan===!1)return;O(T);break}}function xe(T){r.enabled===!1||r.enableZoom===!1||s!==i.NONE||(T.preventDefault(),r.dispatchEvent(gb),B(T),r.dispatchEvent(kU))}function be(T){r.enabled===!1||r.enablePan===!1||W(T)}function N(T){switch(G(T),_.length){case 1:switch(r.touches.ONE){case _u.ROTATE:if(r.enableRotate===!1)return;ee(),s=i.TOUCH_ROTATE;break;case _u.PAN:if(r.enablePan===!1)return;F(),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(r.touches.TWO){case _u.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ue(),s=i.TOUCH_DOLLY_PAN;break;case _u.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;le(),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(gb)}function j(T){switch(G(T),s){case i.TOUCH_ROTATE:if(r.enableRotate===!1)return;oe(T),r.update();break;case i.TOUCH_PAN:if(r.enablePan===!1)return;re(T),r.update();break;case i.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;_e(T),r.update();break;case i.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;Re(T),r.update();break;default:s=i.NONE}}function se(T){r.enabled!==!1&&T.preventDefault()}function he(T){_.push(T)}function me(T){delete C[T.pointerId];for(let V=0;V<_.length;V++)if(_[V].pointerId==T.pointerId){_.splice(V,1);return}}function G(T){let V=C[T.pointerId];V===void 0&&(V=new $e,C[T.pointerId]=V),V.set(T.pageX,T.pageY)}function R(T){const V=T.pointerId===_[0].pointerId?_[1]:_[0];return C[V.pointerId]}r.domElement.addEventListener("contextmenu",se),r.domElement.addEventListener("pointerdown",Q),r.domElement.addEventListener("pointercancel",q),r.domElement.addEventListener("wheel",xe,{passive:!1}),this.update()}}function kH(n){let e,t,r,i=0;for(let a=0;a=2.0 are supported."));return}const A=new Pne(s,{path:t||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});A.fileLoader.setRequestHeader(this.requestHeader);for(let c=0;c=0&&a[u]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+u+'".')}}A.setExtensions(o),A.setPlugins(a),A.parse(r,i)}parseAsync(e,t){const r=this;return new Promise(function(i,s){r.parse(e,t,i,s)})}}function ane(){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 kt={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_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_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_TEXTURE_WEBP:"EXT_texture_webp",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class lne{constructor(e){this.parser=e,this.name=kt.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 yne{constructor(e){this.parser=e,this.name=kt.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 A=r.options.manager.getHandler(a.uri);A!==null&&(l=A)}return this.detectSupport().then(function(A){if(A)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 wne{constructor(e){this.name=kt.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,A=i.byteLength||0,c=i.count,u=i.byteStride,f=new Uint8Array(a,l,A);return o.decodeGltfBufferAsync?o.decodeGltfBufferAsync(c,u,f,i.mode,i.filter).then(function(h){return h.buffer}):o.ready.then(function(){const h=new ArrayBuffer(c*u);return o.decodeGltfBuffer(new Uint8Array(h),c,u,f,i.mode,i.filter),h})})}else return null}}class xne{constructor(e){this.name=kt.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 A of i.primitives)if(A.mode!==Bs.TRIANGLES&&A.mode!==Bs.TRIANGLE_STRIP&&A.mode!==Bs.TRIANGLE_FAN&&A.mode!==void 0)return null;const o=r.extensions[this.name].attributes,a=[],l={};for(const A in o)a.push(this.parser.getDependency("accessor",o[A]).then(c=>(l[A]=c,l[A])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(A=>{const c=A.pop(),u=c.isGroup?c.children:[c],f=A[0].count,h=[];for(const p of u){const d=new je,g=new Z,m=new rt,y=new Z(1,1,1),w=new Gx(p.geometry,p.material,f);for(let x=0;x0||n.search(/^data\:image\/jpeg/)===0?"image/jpeg":n.search(/\.webp($|\?)/i)>0||n.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const Lne=new je;class Pne{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new ane,this.associations=new Map,this.primitiveCache={},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;typeof navigator<"u"&&(r=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,i=navigator.userAgent.indexOf("Firefox")>-1,s=i?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||r||i&&s<98?this.textureLoader=new Au(this.options.manager):this.textureLoader=new jte(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new nT(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._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:{}};jd(s,a,i),Zl(a,i),Promise.all(r._invokeAll(function(l){return l.afterRoot&&l.afterRoot(a)})).then(function(){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[A,c]of o.children.entries())s(c,a.children[A])};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(M,C[S*l+1]),l>=3&&g.setZ(M,C[S*l+2]),l>=4&&g.setW(M,C[S*l+3]),l>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}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 A=this.loadImageSource(t,r).then(function(c){c.flipY=!1,c.name=o.name||a.name||"";const f=(s.samplers||{})[o.sampler]||{};return c.magFilter=zU[f.magFilter]||si,c.minFilter=zU[f.minFilter]||OA,c.wrapS=GU[f.wrapS]||As,c.wrapT=GU[f.wrapT]||As,i.associations.set(c,{textures:e}),c}).catch(function(){return null});return this.textureCache[l]=A,A}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||"",A=!1;if(o.bufferView!==void 0)l=r.getDependency("bufferView",o.bufferView).then(function(u){A=!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 c=Promise.resolve(l).then(function(u){return new Promise(function(f,h){let p=f;t.isImageBitmapLoader===!0&&(p=function(d){const g=new Qn(d);g.needsUpdate=!0,f(g)}),t.load(_w.resolveURL(u,s.path),p,void 0,h)})}).then(function(u){return A===!0&&a.revokeObjectURL(l),u.userData.mimeType=o.mimeType||Une(o.uri),u}).catch(function(u){throw console.error("THREE.GLTFLoader: Couldn't load texture",l),u});return this.sourceCache[e]=c,c}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&&!(t==="aoMap"&&r.texCoord==1)&&console.warn("THREE.GLTFLoader: Custom UV set "+r.texCoord+" for texture "+t+" not yet supported."),s.extensions[kt.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[kt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[kt.KHR_TEXTURE_TRANSFORM].extendTexture(o,a),s.associations.set(o,l)}}return i!==void 0&&(o.encoding=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 MH,is.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 Sl,is.prototype.copy.call(l,r),l.color.copy(r.color),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}r.aoMap&&t.attributes.uv2===void 0&&t.attributes.uv!==void 0&&t.setAttribute("uv2",t.attributes.uv),e.material=r}getMaterialType(){return Qh}loadMaterial(e){const t=this,r=this.json,i=this.extensions,s=r.materials[e];let o;const a={},l=s.extensions||{},A=[];if(l[kt.KHR_MATERIALS_UNLIT]){const u=i[kt.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),A.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new Qe(1,1,1),a.opacity=1,Array.isArray(u.baseColorFactor)){const f=u.baseColorFactor;a.color.fromArray(f),a.opacity=f[3]}u.baseColorTexture!==void 0&&A.push(t.assignTexture(a,"map",u.baseColorTexture,pt)),a.metalness=u.metallicFactor!==void 0?u.metallicFactor:1,a.roughness=u.roughnessFactor!==void 0?u.roughnessFactor:1,u.metallicRoughnessTexture!==void 0&&(A.push(t.assignTexture(a,"metalnessMap",u.metallicRoughnessTexture)),A.push(t.assignTexture(a,"roughnessMap",u.metallicRoughnessTexture))),o=this._invokeOne(function(f){return f.getMaterialType&&f.getMaterialType(e)}),A.push(Promise.all(this._invokeAll(function(f){return f.extendMaterialParams&&f.extendMaterialParams(e,a)})))}s.doubleSided===!0&&(a.side=ui);const c=s.alphaMode||yb.OPAQUE;if(c===yb.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===yb.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Ei&&(A.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new $e(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}return s.occlusionTexture!==void 0&&o!==Ei&&(A.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Ei&&(a.emissive=new Qe().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==Ei&&A.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,pt)),Promise.all(A).then(function(){const u=new o(a);return s.name&&(u.name=s.name),Zl(u,s),t.associations.set(u,{materials:e}),s.extensions&&jd(i,u,s),u})}createUniqueName(e){const t=_t.sanitizeNodeName(e||"");let r=t;for(let i=1;this.nodeNamesUsed[r];++i)r=t+"_"+i;return this.nodeNamesUsed[r]=!0,r}loadGeometries(e){const t=this,r=this.extensions,i=this.primitiveCache;function s(a){return r[kt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return jU(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&Rne(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),Zl(m,s),g.extensions&&jd(i,m,g),t.assignFinalMaterial(m),u.push(m)}for(let h=0,p=u.length;h1?u=new Ur:l.length===1?u=l[0]:u=new It,u!==l[0])for(let f=0,h=l.length;f{const u=new Map;for(const[f,h]of i.associations)(f instanceof is||f instanceof Qn)&&u.set(f,h);return c.traverse(f=>{const h=i.associations.get(f);h!=null&&u.set(f,h)}),u};return i.associations=A(s),s})}}function Dne(n,e,t){const r=e.attributes,i=new ps;if(r.POSITION!==void 0){const a=t.json.accessors[r.POSITION],l=a.min,A=a.max;if(l!==void 0&&A!==void 0){if(i.set(new Z(l[0],l[1],l[2]),new Z(A[0],A[1],A[2])),a.normalized){const c=hC(ch[a.componentType]);i.min.multiplyScalar(c),i.max.multiplyScalar(c)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const s=e.targets;if(s!==void 0){const a=new Z,l=new Z;for(let A=0,c=s.length;A Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE version 0.6.9 -*/var WU=function(n){return URL.createObjectURL(new Blob([n],{type:"text/javascript"}))};try{URL.revokeObjectURL(WU(""))}catch{WU=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}var Is=Uint8Array,cA=Uint16Array,dC=Uint32Array,GH=new Is([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]),VH=new Is([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]),One=new Is([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jH=function(n,e){for(var t=new cA(31),r=0;r<31;++r)t[r]=e+=1<>>1|(hn&21845)<<1;Ql=(Ql&52428)>>>2|(Ql&13107)<<2,Ql=(Ql&61680)>>>4|(Ql&3855)<<4,pC[hn]=((Ql&65280)>>>8|(Ql&255)<<8)>>>1}var nm=function(n,e,t){for(var r=n.length,i=0,s=new cA(e);i>>l]=A}else for(a=new cA(r),i=0;i>>15-n[i]);return a},xg=new Is(288);for(var hn=0;hn<144;++hn)xg[hn]=8;for(var hn=144;hn<256;++hn)xg[hn]=9;for(var hn=256;hn<280;++hn)xg[hn]=7;for(var hn=280;hn<288;++hn)xg[hn]=8;var $H=new Is(32);for(var hn=0;hn<32;++hn)$H[hn]=5;var Hne=nm(xg,9,1),zne=nm($H,5,1),wb=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},lo=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},xb=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Gne=function(n){return(n/8|0)+(n&7&&1)},Vne=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof cA?cA:n instanceof dC?dC:Is)(t-e);return r.set(n.subarray(e,t)),r},jne=function(n,e,t){var r=n.length;if(!r||t&&!t.l&&r<5)return e||new Is(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new Is(r*3));var o=function(X){var ue=e.length;if(X>ue){var le=new Is(Math.max(ue*2,X));le.set(e),e=le}},a=t.f||0,l=t.p||0,A=t.b||0,c=t.l,u=t.d,f=t.m,h=t.n,p=r*8;do{if(!c){t.f=a=lo(n,l,1);var d=lo(n,l+1,3);if(l+=3,d)if(d==1)c=Hne,u=zne,f=9,h=5;else if(d==2){var w=lo(n,l,31)+257,x=lo(n,l+10,15)+4,_=w+lo(n,l+5,31)+1;l+=14;for(var C=new Is(_),S=new Is(19),b=0;b>>4;if(g<16)C[b++]=g;else{var I=0,v=0;for(g==16?(v=3+lo(n,l,3),l+=2,I=C[b-1]):g==17?(v=3+lo(n,l,7),l+=3):g==18&&(v=11+lo(n,l,127),l+=7);v--;)C[b++]=I}}var E=C.subarray(0,w),U=C.subarray(w);f=wb(E),h=wb(U),c=nm(E,f,1),u=nm(U,h,1)}else throw"invalid block type";else{var g=Gne(l)+4,m=n[g-4]|n[g-3]<<8,y=g+m;if(y>r){if(s)throw"unexpected EOF";break}i&&o(A+m),e.set(n.subarray(g,y),A),t.b=A+=m,t.p=l=y*8;continue}if(l>p){if(s)throw"unexpected EOF";break}}i&&o(A+131072);for(var P=(1<>>4;if(l+=I&15,l>p){if(s)throw"unexpected EOF";break}if(!I)throw"invalid length/literal";if(K<256)e[A++]=K;else if(K==256){z=l,c=null;break}else{var O=K-254;if(K>264){var b=K-257,B=GH[b];O=lo(n,l,(1<>>4;if(!W)throw"invalid distance";l+=W&15;var U=Qne[ee];if(ee>3){var B=VH[ee];U+=xb(n,l)&(1<p){if(s)throw"unexpected EOF";break}i&&o(A+131072);for(var F=A+O;A>>4>7||(n[0]<<8|n[1])%31)throw"invalid zlib data";if(n[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function $ne(n,e){return jne((Kne(n),n.subarray(2,-4)),e)}var Yne=typeof TextDecoder<"u"&&new TextDecoder,Xne=0;try{Yne.decode(Wne,{stream:!0}),Xne=1}catch{}function YH(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=d&&(p[h][0]=p[f][0]/a[y+1][m],g=p[h][0]*a[m][y]);const w=m>=-1?1:-m,x=u-1<=y?d-1:t-u;for(let C=w;C<=x;++C)p[h][C]=(p[f][C]-p[f][C-1])/a[y+1][m+C],g+=p[h][C]*a[m+C][y];u<=y&&(p[h][d]=-p[f][d-1]/a[y+1][u],g+=p[h][d]*a[u][y]),o[d][u]=g;const _=f;f=h,h=_}}let c=t;for(let u=1;u<=r;++u){for(let f=0;f<=t;++f)o[u][f]*=c;c*=t-u}return o}function ere(n,e,t,r,i){const s=i0,l=typeof s.Content=="string"&&s.Content!=="";if(a||l){const A=this.parseImage(r[i]);t[s.RelativeFilename||s.Filename]=A}}}}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?As:Ai,r.wrapT=a===0?As:Ai,"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){let r;const i=this.textureLoader.path,s=jn.get(e.id).children;s!==void 0&&s.length>0&&t[s[0].ID]!==void 0&&(r=t[s[0].ID],(r.indexOf("blob:")===0||r.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o;const a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new Qn):(l.setPath(this.textureLoader.path),o=l.load(r))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new Qn):o=this.textureLoader.load(r);return this.textureLoader.setPath(i),o}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),!jn.has(r))return null;const o=this.parseParameters(e,t,r);let a;switch(s.toLowerCase()){case"phong":a=new db;break;case"lambert":a=new Ute;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new db;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=new Qe().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new Qe().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new Qe().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new Qe().fromArray(e.EmissiveColor.value)),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=new Qe().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new Qe().fromArray(e.SpecularColor.value));const s=this;return jn.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.encoding=pt);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.encoding=pt);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=dw,i.envMap.encoding=pt);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&(i.specularMap.encoding=pt);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=jn.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=jn.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 je().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 db({color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new Al(s,o),i.normalizeSkinWeights()):i=new xn(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 Cl({color:3342591,linewidth:1});return new td(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=JH(t.RotationOrder.value):r.eulerOrder="ZYX","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&&jn.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),vi.add(e.target)):e.lookAt(new Z().fromArray(o))}}})}bindSkeleton(e,t,r){const i=this.parsePoseNodes();for(const s in e){const o=e[s];jn.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const A=l.ID;jn.get(A).parents.forEach(function(u){r.has(u.ID)&&r.get(u.ID).bind(new XA(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 je().fromArray(s.Matrix.a)}):e[i.Node]=new je().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in St&&"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 Qe(t,r,i);vi.add(new DH(s,1))}}}}class are{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=jn.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],A={};"RotationOrder"in l&&(A.eulerOrder=JH(l.RotationOrder.value)),"InheritType"in l&&(A.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(A.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(A.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(A.scale=l.GeometricScaling.value);const c=ZH(A);return this.genGeometry(t,a,s,c)}genGeometry(e,t,r,i){const s=new $t;e.attrName&&(s.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),l=new an(a.vertex,3);if(l.applyMatrix4(i),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new an(a.colors,3)),t&&(s.setAttribute("skinIndex",new Qx(a.weightsIndices,4)),s.setAttribute("skinWeight",new an(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const A=new En().getNormalMatrix(i),c=new an(a.normal,3);c.applyNormalMatrix(A),s.setAttribute("normal",c)}if(a.uvs.forEach(function(A,c){let u="uv"+(c+1).toString();c===0&&(u="uv"),s.setAttribute(u,new an(a.uvs[c],2))}),o.material&&o.material.mappingType!=="AllSame"){let A=a.materialIndex[0],c=0;if(a.materialIndex.forEach(function(u,f){u!==A&&(s.addGroup(c,f-c,A),A=u,c=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,A)}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=[],A=[],c=[],u=[];const f=this;return e.vertexIndices.forEach(function(h,p){let d,g=!1;h<0&&(h=h^-1,g=!0);let m=[],y=[];if(o.push(h*3,h*3+1,h*3+2),e.color){const w=D0(p,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){y.push(w.weight),m.push(w.id)}),y.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],x=[0,0,0,0];y.forEach(function(_,C){let S=_,b=m[C];x.forEach(function(M,D,$){if(S>M){$[D]=S,S=M;const H=w[D];w[D]=b,b=H}})}),m=w,y=x}for(;y.length<4;)y.push(0),m.push(0);for(let w=0;w<4;++w)c.push(y[w]),u.push(m[w])}if(e.normal){const w=D0(p,r,h,e.normal);a.push(w[0],w[1],w[2])}e.material&&e.material.mappingType!=="AllSame"&&(d=D0(p,r,h,e.material)[0],d<0&&(f.negativeMaterialIndices=!0,d=0)),e.uv&&e.uv.forEach(function(w,x){const _=D0(p,r,h,w);A[x]===void 0&&(A[x]=[]),A[x].push(_[0]),A[x].push(_[1])}),i++,g&&(i>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),f.genFace(t,e,o,d,a,l,A,c,u,i),r++,i=0,o=[],a=[],l=[],A=[],c=[],u=[])}),t}genFace(e,t,r,i,s,o,a,l,A,c){for(let u=2;u1&&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 Yc(e.name,-1,t)}generateTracks(e){const t=[];let r=new Z,i=new rt,s=new Z;if(e.transform&&e.transform.decompose(r,i,s),r=r.toArray(),i=new fi().setFromQuaternion(i,e.eulerOrder).toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");o!==void 0&&t.push(o)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const o=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);o!==void 0&&t.push(o)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");o!==void 0&&t.push(o)}if(e.DeformPercent!==void 0){const o=this.generateMorphTrack(e);o!==void 0&&t.push(o)}return t}generateVectorTrack(e,t,r,i){const s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,r);return new NA(e+"."+i,s,o)}generateRotationTrack(e,t,r,i,s,o){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Lt.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Lt.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Lt.degToRad));const a=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(a,t,r);i!==void 0&&(i=i.map(Lt.degToRad),i.push(o),i=new fi().fromArray(i),i=new rt().setFromEuler(i)),s!==void 0&&(s=s.map(Lt.degToRad),s.push(o),s=new fi().fromArray(s),s=new rt().setFromEuler(s).invert());const A=new rt,c=new fi,u=[];for(let f=0;f1){let r=1,i=t[0];for(let s=1;s=180){const o=s/180,a=i/o;let l=r+a;const A=e.times[t-1],u=(e.times[t]-A)/o;let f=A+u;const h=[],p=[];for(;f1&&(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),A=parseInt(l[0]),c=parseInt(l[1]);let u=s.split(",").slice(3);u=u.map(function(f){return f.trim().replace(/^"/,"")}),i="connections",s=[A,c],pre(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=bb(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=bb(t.a))}parseNodeSpecialProperty(e,t,r){const i=r.split('",').map(function(c){return c.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],o=i[1],a=i[2],l=i[3];let A=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":A=parseFloat(A);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":A=bb(A);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:A},this.setCurrentProp(this.getPrevNode(),s)}}class cre{parse(e){const t=new KU(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 XH;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]:"",c=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 A=="number"&&(r.id=A),c!==""&&(r.attrName=c),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=$ne(new Uint8Array(e.getArrayBuffer(o))),l=new KU(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 KU{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 XH{add(e,t){this[e]=t}}function ure(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===qH(n,0,e.length)}function fre(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=Lt.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 e6(n){return Math.ceil(n/4)*4}function Bb(n,e=0){const t=e6(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 eL(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 Ere{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,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=new Blob(s,{type:"application/octet-stream"}),A=Object.keys(a);if(A.length>0&&(o.extensionsUsed=A),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=l.size),r.binary===!0){const c=new FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){const u=Bb(c.result),f=new DataView(new ArrayBuffer(JU));f.setUint32(0,u.byteLength,!0),f.setUint32(4,xre,!0);const h=Bb(_re(JSON.stringify(o)),32),p=new DataView(new ArrayBuffer(JU));p.setUint32(0,h.byteLength,!0),p.setUint32(4,wre,!0);const d=new ArrayBuffer(ZU),g=new DataView(d);g.setUint32(0,vre,!0),g.setUint32(4,yre,!0);const m=ZU+p.byteLength+h.byteLength+f.byteLength+u.byteLength;g.setUint32(8,m,!0);const y=new Blob([d,p,h,f,u],{type:"application/octet-stream"}),w=new FileReader;w.readAsArrayBuffer(y),w.onloadend=function(){t(w.result)}}}else if(o.buffers&&o.buffers.length>0){const c=new FileReader;c.readAsDataURL(l),c.onloadend=function(){const u=c.result;o.buffers[0].uri=u,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 Z;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 Z;for(let s=0,o=r.count;s4?d=e.array[h*e.itemSize+p]:(p===0?d=e.getX(h):p===1?d=e.getY(h):p===2?d=e.getZ(h):p===3&&(d=e.getW(h)),e.normalized===!0&&(d=Lt.normalize(d,e.array))),t===qt.FLOAT?A.setFloat32(c,d,!0):t===qt.UNSIGNED_INT?A.setUint32(c,d,!0):t===qt.UNSIGNED_SHORT?A.setUint16(c,d,!0):t===qt.UNSIGNED_BYTE&&A.setUint8(c,d),c+=a}const u={buffer:this.processBuffer(A.buffer),byteOffset:this.byteOffset,byteLength:l};return s!==void 0&&(u.target=s),s===qt.ARRAY_BUFFER&&(u.byteStride=e.itemSize*a),this.byteOffset+=l,o.bufferViews.push(u),{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=Bb(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",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=qt.FLOAT;else if(e.array.constructor===Uint32Array)a=qt.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)a=qt.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)a=qt.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(r===void 0&&(r=0),i===void 0&&(i=e.count),i===0)return null;const l=Bre(e,r,i);let A;t!==void 0&&(A=e===t.index?qt.ELEMENT_ARRAY_BUFFER:qt.ARRAY_BUFFER);const c=this.processBufferView(e,a,r,i,A),u={bufferView:c.id,byteOffset:c.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,A=s.pending;o.images.has(e)||o.images.set(e,{});const c=o.images.get(e),u=i+":flipY/"+r.toString();if(c[u]!==void 0)return c[u];a.images||(a.images=[]);const f={mimeType:i},h=qU();h.width=Math.min(e.width,l.maxTextureSize),h.height=Math.min(e.height,l.maxTextureSize);const p=h.getContext("2d");if(r===!0&&(p.translate(0,h.height),p.scale(1,-1)),e.data!==void 0){t!==br&&console.error("GLTFExporter: Only RGBAFormat is supported."),(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 m=0;ms.processBufferViewImage(g)).then(g=>{f.bufferView=g})):h.toDataURL!==void 0?f.uri=h.toDataURL(i):A.push(eL(h,i).then(g=>new FileReader().readAsDataURL(g)).then(g=>{f.uri=g}));const d=a.images.push(f)-1;return c[u]=d,d}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:es[e.magFilter],minFilter:es[e.minFilter],wrapS:es[e.wrapS],wrapT:es[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);let i=e.userData.mimeType;i==="image/webp"&&(i="image/png");const s={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)};e.name&&(s.name=e.name),this._invokeAll(function(a){a.writeTexture&&a.writeTexture(e,s)});const o=r.textures.push(s)-1;return t.textures.set(e,o),o}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(Bp(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)};this.applyTextureTransform(l,a),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const a={index:this.processTexture(e.map)};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),l=Math.max(a.r,a.g,a.b);if(l>1&&(a.multiplyScalar(1/l),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),l>0&&(i.emissiveFactor=a.toArray()),e.emissiveMap){const A={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(A,e.emissiveMap),i.emissiveTexture=A}}if(e.normalMap){const a={index:this.processTexture(e.normalMap)};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:1};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===ui&&(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 w=0,x=e.material.length;w0){const w=[],x=[],_={};if(e.morphTargetDictionary!==void 0)for(const C in e.morphTargetDictionary)_[e.morphTargetDictionary[C]]=C;for(let C=0;C0&&(l.extras={},l.extras.targetNames=x)}const d=Array.isArray(e.material);if(d&&o.groups.length===0)return null;const g=d?e.material:[e.material],m=d?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let w=0,x=m.length;w0&&(_.targets=u),o.index!==null){let S=this.getUID(o.index);(m[w].start!==void 0||m[w].count!==void 0)&&(S+=":"+m[w].start+":"+m[w].count),t.attributes.has(S)?_.indices=t.attributes.get(S):(_.indices=this.processAccessor(o.index,o,m[w].start,m[w].count),t.attributes.set(S,_.indices)),_.indices===null&&delete _.indices}const C=this.processMaterial(g[m[w].materialIndex]);C!==null&&(_.material=C),c.push(_)}l.primitives=c,r.meshes||(r.meshes=[]),this._invokeAll(function(w){w.writeMesh&&w.writeMesh(e,l)});const y=r.meshes.push(l)-1;return t.meshes.set(s,y),y}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:Lt.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=aT.Utils.mergeMorphTargetTracks(e.clone(),t);const s=e.tracks,o=[],a=[];for(let l=0;l0){const a=[];for(let l=0,A=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 vw;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=(e.penumbra-1)*e.angle*-1,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 Sre{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 Mre{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)};r.applyTextureTransform(o,e.clearcoatMap),s.clearcoatTexture=o}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const o={index:r.processTexture(e.clearcoatRoughnessMap)};r.applyTextureTransform(o,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){const o={index:r.processTexture(e.clearcoatNormalMap)};r.applyTextureTransform(o,e.clearcoatNormalMap),s.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Tre{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)};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)};r.applyTextureTransform(o,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Ire{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)};r.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Rre{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)};r.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}s.attenuationDistance=e.attenuationDistance,s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Fre{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 Ure{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(gre)&&!e.specularIntensityMap&&!e.specularColorTexture)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.specularIntensityMap){const o={index:r.processTexture(e.specularIntensityMap)};r.applyTextureTransform(o,e.specularIntensityMap),s.specularTexture=o}if(e.specularColorMap){const o={index:r.processTexture(e.specularColorMap)};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}}aT.Utils={insertKeyframe:function(n,e){const r=n.getValueSize(),i=new n.TimeBufferType(n.times.length+1),s=new n.ValueBufferType(n.values.length+r),o=n.createInterpolant(new n.ValueBufferType(r));let a;if(n.times.length===0){i[0]=e;for(let l=0;ln.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 Dre(n){var e=n6(n),t=e[0],r=e[1];return(t+r)*3/4-r}function Ore(n,e,t){return(e+t)*3/4-t}function Nre(n){var e,t=n6(n),r=t[0],i=t[1],s=new Lre(Ore(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=Bs[n.charCodeAt(l)]<<2|Bs[n.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=Bs[n.charCodeAt(l)]<<10|Bs[n.charCodeAt(l+1)]<<4|Bs[n.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function kre(n){return Xo[n>>18&63]+Xo[n>>12&63]+Xo[n>>6&63]+Xo[n&63]}function Qre(n,e,t){for(var r,i=[],s=e;sa?a:o+s));return r===1?(e=n[t-1],i.push(Xo[e>>2]+Xo[e<<4&63]+"==")):r===2&&(e=(n[t-2]<<8)+n[t-1],i.push(Xo[e>>10]+Xo[e>>4&63]+Xo[e<<2&63]+"=")),i.join("")}var lT={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */lT.read=function(n,e,t,r,i){var s,o,a=i*8-r-1,l=(1<>1,c=-7,u=t?i-1:0,f=t?-1:1,h=n[e+u];for(u+=f,s=h&(1<<-c)-1,h>>=-c,c+=a;c>0;s=s*256+n[e+u],u+=f,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=r;c>0;o=o*256+n[e+u],u+=f,c-=8);if(s===0)s=1-A;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-A}return(h?-1:1)*o*Math.pow(2,s-r)};lT.write=function(n,e,t,r,i,s){var o,a,l,A=s*8-i-1,c=(1<>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,p=r?1:-1,d=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=c):(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>=c?(a=0,o=c):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+=p,a/=256,i-=8);for(o=o<0;n[t+h]=o&255,h+=p,o/=256,A-=8);n[t+h-p]|=d*128};/*! +*/var WU=function(n){return URL.createObjectURL(new Blob([n],{type:"text/javascript"}))};try{URL.revokeObjectURL(WU(""))}catch{WU=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}var Rs=Uint8Array,uA=Uint16Array,dC=Uint32Array,GH=new Rs([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]),VH=new Rs([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]),One=new Rs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jH=function(n,e){for(var t=new uA(31),r=0;r<31;++r)t[r]=e+=1<>>1|(hn&21845)<<1;Hl=(Hl&52428)>>>2|(Hl&13107)<<2,Hl=(Hl&61680)>>>4|(Hl&3855)<<4,pC[hn]=((Hl&65280)>>>8|(Hl&255)<<8)>>>1}var rm=function(n,e,t){for(var r=n.length,i=0,s=new uA(e);i>>l]=A}else for(a=new uA(r),i=0;i>>15-n[i]);return a},_g=new Rs(288);for(var hn=0;hn<144;++hn)_g[hn]=8;for(var hn=144;hn<256;++hn)_g[hn]=9;for(var hn=256;hn<280;++hn)_g[hn]=7;for(var hn=280;hn<288;++hn)_g[hn]=8;var $H=new Rs(32);for(var hn=0;hn<32;++hn)$H[hn]=5;var Hne=rm(_g,9,1),zne=rm($H,5,1),wb=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},Ao=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},xb=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Gne=function(n){return(n/8|0)+(n&7&&1)},Vne=function(n,e,t){(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length);var r=new(n instanceof uA?uA:n instanceof dC?dC:Rs)(t-e);return r.set(n.subarray(e,t)),r},jne=function(n,e,t){var r=n.length;if(!r||t&&!t.l&&r<5)return e||new Rs(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new Rs(r*3));var o=function(X){var ue=e.length;if(X>ue){var le=new Rs(Math.max(ue*2,X));le.set(e),e=le}},a=t.f||0,l=t.p||0,A=t.b||0,c=t.l,u=t.d,f=t.m,h=t.n,p=r*8;do{if(!c){t.f=a=Ao(n,l,1);var d=Ao(n,l+1,3);if(l+=3,d)if(d==1)c=Hne,u=zne,f=9,h=5;else if(d==2){var w=Ao(n,l,31)+257,x=Ao(n,l+10,15)+4,_=w+Ao(n,l+5,31)+1;l+=14;for(var C=new Rs(_),S=new Rs(19),b=0;b>>4;if(g<16)C[b++]=g;else{var I=0,v=0;for(g==16?(v=3+Ao(n,l,3),l+=2,I=C[b-1]):g==17?(v=3+Ao(n,l,7),l+=3):g==18&&(v=11+Ao(n,l,127),l+=7);v--;)C[b++]=I}}var E=C.subarray(0,w),U=C.subarray(w);f=wb(E),h=wb(U),c=rm(E,f,1),u=rm(U,h,1)}else throw"invalid block type";else{var g=Gne(l)+4,m=n[g-4]|n[g-3]<<8,y=g+m;if(y>r){if(s)throw"unexpected EOF";break}i&&o(A+m),e.set(n.subarray(g,y),A),t.b=A+=m,t.p=l=y*8;continue}if(l>p){if(s)throw"unexpected EOF";break}}i&&o(A+131072);for(var P=(1<>>4;if(l+=I&15,l>p){if(s)throw"unexpected EOF";break}if(!I)throw"invalid length/literal";if(K<256)e[A++]=K;else if(K==256){z=l,c=null;break}else{var O=K-254;if(K>264){var b=K-257,B=GH[b];O=Ao(n,l,(1<>>4;if(!W)throw"invalid distance";l+=W&15;var U=Qne[ee];if(ee>3){var B=VH[ee];U+=xb(n,l)&(1<p){if(s)throw"unexpected EOF";break}i&&o(A+131072);for(var F=A+O;A>>4>7||(n[0]<<8|n[1])%31)throw"invalid zlib data";if(n[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function $ne(n,e){return jne((Kne(n),n.subarray(2,-4)),e)}var Yne=typeof TextDecoder<"u"&&new TextDecoder,Xne=0;try{Yne.decode(Wne,{stream:!0}),Xne=1}catch{}function YH(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=d&&(p[h][0]=p[f][0]/a[y+1][m],g=p[h][0]*a[m][y]);const w=m>=-1?1:-m,x=u-1<=y?d-1:t-u;for(let C=w;C<=x;++C)p[h][C]=(p[f][C]-p[f][C-1])/a[y+1][m+C],g+=p[h][C]*a[m+C][y];u<=y&&(p[h][d]=-p[f][d-1]/a[y+1][u],g+=p[h][d]*a[u][y]),o[d][u]=g;const _=f;f=h,h=_}}let c=t;for(let u=1;u<=r;++u){for(let f=0;f<=t;++f)o[u][f]*=c;c*=t-u}return o}function ere(n,e,t,r,i){const s=i0,l=typeof s.Content=="string"&&s.Content!=="";if(a||l){const A=this.parseImage(r[i]);t[s.RelativeFilename||s.Filename]=A}}}}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?As:Ai,r.wrapT=a===0?As:Ai,"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){let r;const i=this.textureLoader.path,s=jn.get(e.id).children;s!==void 0&&s.length>0&&t[s[0].ID]!==void 0&&(r=t[s[0].ID],(r.indexOf("blob:")===0||r.indexOf("data:")===0)&&this.textureLoader.setPath(void 0));let o;const a=e.FileName.slice(-3).toLowerCase();if(a==="tga"){const l=this.manager.getHandler(".tga");l===null?(console.warn("FBXLoader: TGA loader not found, creating placeholder texture for",e.RelativeFilename),o=new Qn):(l.setPath(this.textureLoader.path),o=l.load(r))}else a==="psd"?(console.warn("FBXLoader: PSD textures are not supported, creating placeholder texture for",e.RelativeFilename),o=new Qn):o=this.textureLoader.load(r);return this.textureLoader.setPath(i),o}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),!jn.has(r))return null;const o=this.parseParameters(e,t,r);let a;switch(s.toLowerCase()){case"phong":a=new db;break;case"lambert":a=new Ute;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new db;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=new Qe().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new Qe().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new Qe().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new Qe().fromArray(e.EmissiveColor.value)),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=new Qe().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new Qe().fromArray(e.SpecularColor.value));const s=this;return jn.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.encoding=pt);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.encoding=pt);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=pw,i.envMap.encoding=pt);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&(i.specularMap.encoding=pt);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=jn.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=jn.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 je().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 db({color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new cl(s,o),i.normalizeSkinWeights()):i=new xn(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 Sl({color:3342591,linewidth:1});return new nd(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=JH(t.RotationOrder.value):r.eulerOrder="ZYX","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&&jn.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),vi.add(e.target)):e.lookAt(new Z().fromArray(o))}}})}bindSkeleton(e,t,r){const i=this.parsePoseNodes();for(const s in e){const o=e[s];jn.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const A=l.ID;jn.get(A).parents.forEach(function(u){r.has(u.ID)&&r.get(u.ID).bind(new ZA(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 je().fromArray(s.Matrix.a)}):e[i.Node]=new je().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in St&&"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 Qe(t,r,i);vi.add(new DH(s,1))}}}}class are{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=jn.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],A={};"RotationOrder"in l&&(A.eulerOrder=JH(l.RotationOrder.value)),"InheritType"in l&&(A.inheritType=parseInt(l.InheritType.value)),"GeometricTranslation"in l&&(A.translation=l.GeometricTranslation.value),"GeometricRotation"in l&&(A.rotation=l.GeometricRotation.value),"GeometricScaling"in l&&(A.scale=l.GeometricScaling.value);const c=ZH(A);return this.genGeometry(t,a,s,c)}genGeometry(e,t,r,i){const s=new $t;e.attrName&&(s.name=e.attrName);const o=this.parseGeoNode(e,t),a=this.genBuffers(o),l=new an(a.vertex,3);if(l.applyMatrix4(i),s.setAttribute("position",l),a.colors.length>0&&s.setAttribute("color",new an(a.colors,3)),t&&(s.setAttribute("skinIndex",new Hx(a.weightsIndices,4)),s.setAttribute("skinWeight",new an(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const A=new En().getNormalMatrix(i),c=new an(a.normal,3);c.applyNormalMatrix(A),s.setAttribute("normal",c)}if(a.uvs.forEach(function(A,c){let u="uv"+(c+1).toString();c===0&&(u="uv"),s.setAttribute(u,new an(a.uvs[c],2))}),o.material&&o.material.mappingType!=="AllSame"){let A=a.materialIndex[0],c=0;if(a.materialIndex.forEach(function(u,f){u!==A&&(s.addGroup(c,f-c,A),A=u,c=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,A)}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=[],A=[],c=[],u=[];const f=this;return e.vertexIndices.forEach(function(h,p){let d,g=!1;h<0&&(h=h^-1,g=!0);let m=[],y=[];if(o.push(h*3,h*3+1,h*3+2),e.color){const w=O0(p,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){y.push(w.weight),m.push(w.id)}),y.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],x=[0,0,0,0];y.forEach(function(_,C){let S=_,b=m[C];x.forEach(function(M,D,$){if(S>M){$[D]=S,S=M;const H=w[D];w[D]=b,b=H}})}),m=w,y=x}for(;y.length<4;)y.push(0),m.push(0);for(let w=0;w<4;++w)c.push(y[w]),u.push(m[w])}if(e.normal){const w=O0(p,r,h,e.normal);a.push(w[0],w[1],w[2])}e.material&&e.material.mappingType!=="AllSame"&&(d=O0(p,r,h,e.material)[0],d<0&&(f.negativeMaterialIndices=!0,d=0)),e.uv&&e.uv.forEach(function(w,x){const _=O0(p,r,h,w);A[x]===void 0&&(A[x]=[]),A[x].push(_[0]),A[x].push(_[1])}),i++,g&&(i>4&&console.warn("THREE.FBXLoader: Polygons with more than four sides are not supported. Make sure to triangulate the geometry during export."),f.genFace(t,e,o,d,a,l,A,c,u,i),r++,i=0,o=[],a=[],l=[],A=[],c=[],u=[])}),t}genFace(e,t,r,i,s,o,a,l,A,c){for(let u=2;u1&&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 Xc(e.name,-1,t)}generateTracks(e){const t=[];let r=new Z,i=new rt,s=new Z;if(e.transform&&e.transform.decompose(r,i,s),r=r.toArray(),i=new fi().setFromQuaternion(i,e.eulerOrder).toArray(),s=s.toArray(),e.T!==void 0&&Object.keys(e.T.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.T.curves,r,"position");o!==void 0&&t.push(o)}if(e.R!==void 0&&Object.keys(e.R.curves).length>0){const o=this.generateRotationTrack(e.modelName,e.R.curves,i,e.preRotation,e.postRotation,e.eulerOrder);o!==void 0&&t.push(o)}if(e.S!==void 0&&Object.keys(e.S.curves).length>0){const o=this.generateVectorTrack(e.modelName,e.S.curves,s,"scale");o!==void 0&&t.push(o)}if(e.DeformPercent!==void 0){const o=this.generateMorphTrack(e);o!==void 0&&t.push(o)}return t}generateVectorTrack(e,t,r,i){const s=this.getTimesForAllAxes(t),o=this.getKeyframeTrackValues(s,t,r);return new kA(e+"."+i,s,o)}generateRotationTrack(e,t,r,i,s,o){t.x!==void 0&&(this.interpolateRotations(t.x),t.x.values=t.x.values.map(Lt.degToRad)),t.y!==void 0&&(this.interpolateRotations(t.y),t.y.values=t.y.values.map(Lt.degToRad)),t.z!==void 0&&(this.interpolateRotations(t.z),t.z.values=t.z.values.map(Lt.degToRad));const a=this.getTimesForAllAxes(t),l=this.getKeyframeTrackValues(a,t,r);i!==void 0&&(i=i.map(Lt.degToRad),i.push(o),i=new fi().fromArray(i),i=new rt().setFromEuler(i)),s!==void 0&&(s=s.map(Lt.degToRad),s.push(o),s=new fi().fromArray(s),s=new rt().setFromEuler(s).invert());const A=new rt,c=new fi,u=[];for(let f=0;f1){let r=1,i=t[0];for(let s=1;s=180){const o=s/180,a=i/o;let l=r+a;const A=e.times[t-1],u=(e.times[t]-A)/o;let f=A+u;const h=[],p=[];for(;f1&&(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),A=parseInt(l[0]),c=parseInt(l[1]);let u=s.split(",").slice(3);u=u.map(function(f){return f.trim().replace(/^"/,"")}),i="connections",s=[A,c],pre(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=bb(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=bb(t.a))}parseNodeSpecialProperty(e,t,r){const i=r.split('",').map(function(c){return c.trim().replace(/^\"/,"").replace(/\s/,"_")}),s=i[0],o=i[1],a=i[2],l=i[3];let A=i[4];switch(o){case"int":case"enum":case"bool":case"ULongLong":case"double":case"Number":case"FieldOfView":A=parseFloat(A);break;case"Color":case"ColorRGB":case"Vector3D":case"Lcl_Translation":case"Lcl_Rotation":case"Lcl_Scaling":A=bb(A);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:A},this.setCurrentProp(this.getPrevNode(),s)}}class cre{parse(e){const t=new KU(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 XH;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]:"",c=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 A=="number"&&(r.id=A),c!==""&&(r.attrName=c),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=$ne(new Uint8Array(e.getArrayBuffer(o))),l=new KU(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 KU{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 XH{add(e,t){this[e]=t}}function ure(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===qH(n,0,e.length)}function fre(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=Lt.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 e6(n){return Math.ceil(n/4)*4}function Bb(n,e=0){const t=e6(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 eL(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 Ere{constructor(){this.plugins=[],this.options={},this.pending=[],this.buffers=[],this.byteOffset=0,this.buffers=[],this.nodeMap=new Map,this.skins=[],this.extensionsUsed={},this.uids=new Map,this.uid=0,this.json={asset:{version:"2.0",generator:"THREE.GLTFExporter"}},this.cache={meshes:new Map,attributes:new Map,attributesNormalized:new Map,materials:new Map,textures:new Map,images:new Map}}setPlugins(e){this.plugins=e}async write(e,t,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=new Blob(s,{type:"application/octet-stream"}),A=Object.keys(a);if(A.length>0&&(o.extensionsUsed=A),o.buffers&&o.buffers.length>0&&(o.buffers[0].byteLength=l.size),r.binary===!0){const c=new FileReader;c.readAsArrayBuffer(l),c.onloadend=function(){const u=Bb(c.result),f=new DataView(new ArrayBuffer(JU));f.setUint32(0,u.byteLength,!0),f.setUint32(4,xre,!0);const h=Bb(_re(JSON.stringify(o)),32),p=new DataView(new ArrayBuffer(JU));p.setUint32(0,h.byteLength,!0),p.setUint32(4,wre,!0);const d=new ArrayBuffer(ZU),g=new DataView(d);g.setUint32(0,vre,!0),g.setUint32(4,yre,!0);const m=ZU+p.byteLength+h.byteLength+f.byteLength+u.byteLength;g.setUint32(8,m,!0);const y=new Blob([d,p,h,f,u],{type:"application/octet-stream"}),w=new FileReader;w.readAsArrayBuffer(y),w.onloadend=function(){t(w.result)}}}else if(o.buffers&&o.buffers.length>0){const c=new FileReader;c.readAsDataURL(l),c.onloadend=function(){const u=c.result;o.buffers[0].uri=u,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 Z;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 Z;for(let s=0,o=r.count;s4?d=e.array[h*e.itemSize+p]:(p===0?d=e.getX(h):p===1?d=e.getY(h):p===2?d=e.getZ(h):p===3&&(d=e.getW(h)),e.normalized===!0&&(d=Lt.normalize(d,e.array))),t===qt.FLOAT?A.setFloat32(c,d,!0):t===qt.UNSIGNED_INT?A.setUint32(c,d,!0):t===qt.UNSIGNED_SHORT?A.setUint16(c,d,!0):t===qt.UNSIGNED_BYTE&&A.setUint8(c,d),c+=a}const u={buffer:this.processBuffer(A.buffer),byteOffset:this.byteOffset,byteLength:l};return s!==void 0&&(u.target=s),s===qt.ARRAY_BUFFER&&(u.byteStride=e.itemSize*a),this.byteOffset+=l,o.bufferViews.push(u),{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=Bb(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",16:"MAT4"};let a;if(e.array.constructor===Float32Array)a=qt.FLOAT;else if(e.array.constructor===Uint32Array)a=qt.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)a=qt.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)a=qt.UNSIGNED_BYTE;else throw new Error("THREE.GLTFExporter: Unsupported bufferAttribute component type.");if(r===void 0&&(r=0),i===void 0&&(i=e.count),i===0)return null;const l=Bre(e,r,i);let A;t!==void 0&&(A=e===t.index?qt.ELEMENT_ARRAY_BUFFER:qt.ARRAY_BUFFER);const c=this.processBufferView(e,a,r,i,A),u={bufferView:c.id,byteOffset:c.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,A=s.pending;o.images.has(e)||o.images.set(e,{});const c=o.images.get(e),u=i+":flipY/"+r.toString();if(c[u]!==void 0)return c[u];a.images||(a.images=[]);const f={mimeType:i},h=qU();h.width=Math.min(e.width,l.maxTextureSize),h.height=Math.min(e.height,l.maxTextureSize);const p=h.getContext("2d");if(r===!0&&(p.translate(0,h.height),p.scale(1,-1)),e.data!==void 0){t!==Br&&console.error("GLTFExporter: Only RGBAFormat is supported."),(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 m=0;ms.processBufferViewImage(g)).then(g=>{f.bufferView=g})):h.toDataURL!==void 0?f.uri=h.toDataURL(i):A.push(eL(h,i).then(g=>new FileReader().readAsDataURL(g)).then(g=>{f.uri=g}));const d=a.images.push(f)-1;return c[u]=d,d}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:es[e.magFilter],minFilter:es[e.minFilter],wrapS:es[e.wrapS],wrapT:es[e.wrapT]};return t.samplers.push(r)-1}processTexture(e){const t=this.cache,r=this.json;if(t.textures.has(e))return t.textures.get(e);r.textures||(r.textures=[]);let i=e.userData.mimeType;i==="image/webp"&&(i="image/png");const s={sampler:this.processSampler(e),source:this.processImage(e.image,e.format,e.flipY,i)};e.name&&(s.name=e.name),this._invokeAll(function(a){a.writeTexture&&a.writeTexture(e,s)});const o=r.textures.push(s)-1;return t.textures.set(e,o),o}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(Ep(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)};this.applyTextureTransform(l,a),i.pbrMetallicRoughness.metallicRoughnessTexture=l}if(e.map){const a={index:this.processTexture(e.map)};this.applyTextureTransform(a,e.map),i.pbrMetallicRoughness.baseColorTexture=a}if(e.emissive){const a=e.emissive.clone().multiplyScalar(e.emissiveIntensity),l=Math.max(a.r,a.g,a.b);if(l>1&&(a.multiplyScalar(1/l),console.warn("THREE.GLTFExporter: Some emissive components exceed 1; emissive has been limited")),l>0&&(i.emissiveFactor=a.toArray()),e.emissiveMap){const A={index:this.processTexture(e.emissiveMap)};this.applyTextureTransform(A,e.emissiveMap),i.emissiveTexture=A}}if(e.normalMap){const a={index:this.processTexture(e.normalMap)};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:1};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===ui&&(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 w=0,x=e.material.length;w0){const w=[],x=[],_={};if(e.morphTargetDictionary!==void 0)for(const C in e.morphTargetDictionary)_[e.morphTargetDictionary[C]]=C;for(let C=0;C0&&(l.extras={},l.extras.targetNames=x)}const d=Array.isArray(e.material);if(d&&o.groups.length===0)return null;const g=d?e.material:[e.material],m=d?o.groups:[{materialIndex:0,start:void 0,count:void 0}];for(let w=0,x=m.length;w0&&(_.targets=u),o.index!==null){let S=this.getUID(o.index);(m[w].start!==void 0||m[w].count!==void 0)&&(S+=":"+m[w].start+":"+m[w].count),t.attributes.has(S)?_.indices=t.attributes.get(S):(_.indices=this.processAccessor(o.index,o,m[w].start,m[w].count),t.attributes.set(S,_.indices)),_.indices===null&&delete _.indices}const C=this.processMaterial(g[m[w].materialIndex]);C!==null&&(_.material=C),c.push(_)}l.primitives=c,r.meshes||(r.meshes=[]),this._invokeAll(function(w){w.writeMesh&&w.writeMesh(e,l)});const y=r.meshes.push(l)-1;return t.meshes.set(s,y),y}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:Lt.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=aT.Utils.mergeMorphTargetTracks(e.clone(),t);const s=e.tracks,o=[],a=[];for(let l=0;l0){const a=[];for(let l=0,A=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 yw;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=(e.penumbra-1)*e.angle*-1,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 Sre{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 Mre{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)};r.applyTextureTransform(o,e.clearcoatMap),s.clearcoatTexture=o}if(s.clearcoatRoughnessFactor=e.clearcoatRoughness,e.clearcoatRoughnessMap){const o={index:r.processTexture(e.clearcoatRoughnessMap)};r.applyTextureTransform(o,e.clearcoatRoughnessMap),s.clearcoatRoughnessTexture=o}if(e.clearcoatNormalMap){const o={index:r.processTexture(e.clearcoatNormalMap)};r.applyTextureTransform(o,e.clearcoatNormalMap),s.clearcoatNormalTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Tre{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)};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)};r.applyTextureTransform(o,e.iridescenceThicknessMap),s.iridescenceThicknessTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Ire{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)};r.applyTextureTransform(o,e.transmissionMap),s.transmissionTexture=o}t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Rre{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)};r.applyTextureTransform(o,e.thicknessMap),s.thicknessTexture=o}s.attenuationDistance=e.attenuationDistance,s.attenuationColor=e.attenuationColor.toArray(),t.extensions=t.extensions||{},t.extensions[this.name]=s,i[this.name]=!0}}class Fre{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 Ure{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(gre)&&!e.specularIntensityMap&&!e.specularColorTexture)return;const r=this.writer,i=r.extensionsUsed,s={};if(e.specularIntensityMap){const o={index:r.processTexture(e.specularIntensityMap)};r.applyTextureTransform(o,e.specularIntensityMap),s.specularTexture=o}if(e.specularColorMap){const o={index:r.processTexture(e.specularColorMap)};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}}aT.Utils={insertKeyframe:function(n,e){const r=n.getValueSize(),i=new n.TimeBufferType(n.times.length+1),s=new n.ValueBufferType(n.values.length+r),o=n.createInterpolant(new n.ValueBufferType(r));let a;if(n.times.length===0){i[0]=e;for(let l=0;ln.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 Dre(n){var e=n6(n),t=e[0],r=e[1];return(t+r)*3/4-r}function Ore(n,e,t){return(e+t)*3/4-t}function Nre(n){var e,t=n6(n),r=t[0],i=t[1],s=new Lre(Ore(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=Es[n.charCodeAt(l)]<<2|Es[n.charCodeAt(l+1)]>>4,s[o++]=e&255),i===1&&(e=Es[n.charCodeAt(l)]<<10|Es[n.charCodeAt(l+1)]<<4|Es[n.charCodeAt(l+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function kre(n){return Zo[n>>18&63]+Zo[n>>12&63]+Zo[n>>6&63]+Zo[n&63]}function Qre(n,e,t){for(var r,i=[],s=e;sa?a:o+s));return r===1?(e=n[t-1],i.push(Zo[e>>2]+Zo[e<<4&63]+"==")):r===2&&(e=(n[t-2]<<8)+n[t-1],i.push(Zo[e>>10]+Zo[e>>4&63]+Zo[e<<2&63]+"=")),i.join("")}var lT={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */lT.read=function(n,e,t,r,i){var s,o,a=i*8-r-1,l=(1<>1,c=-7,u=t?i-1:0,f=t?-1:1,h=n[e+u];for(u+=f,s=h&(1<<-c)-1,h>>=-c,c+=a;c>0;s=s*256+n[e+u],u+=f,c-=8);for(o=s&(1<<-c)-1,s>>=-c,c+=r;c>0;o=o*256+n[e+u],u+=f,c-=8);if(s===0)s=1-A;else{if(s===l)return o?NaN:(h?-1:1)*(1/0);o=o+Math.pow(2,r),s=s-A}return(h?-1:1)*o*Math.pow(2,s-r)};lT.write=function(n,e,t,r,i,s){var o,a,l,A=s*8-i-1,c=(1<>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=r?0:s-1,p=r?1:-1,d=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=c):(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>=c?(a=0,o=c):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+=p,a/=256,i-=8);for(o=o<0;n[t+h]=o&255,h+=p,o/=256,A-=8);n[t+h-p]|=d*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */(function(n){const e=jx,t=lT,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=a,n.SlowBuffer=y,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 G=new Uint8Array(1),R={foo:function(){return 42}};return Object.setPrototypeOf(R,Uint8Array.prototype),Object.setPrototypeOf(G,R),G.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(G){if(G>i)throw new RangeError('The value "'+G+'" is invalid for option "size"');const R=new Uint8Array(G);return Object.setPrototypeOf(R,a.prototype),R}function a(G,R,T){if(typeof G=="number"){if(typeof R=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(G)}return l(G,R,T)}a.poolSize=8192;function l(G,R,T){if(typeof G=="string")return f(G,R);if(ArrayBuffer.isView(G))return p(G);if(G==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof G);if(N(G,ArrayBuffer)||G&&N(G.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(N(G,SharedArrayBuffer)||G&&N(G.buffer,SharedArrayBuffer)))return d(G,R,T);if(typeof G=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const V=G.valueOf&&G.valueOf();if(V!=null&&V!==G)return a.from(V,R,T);const te=g(G);if(te)return te;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof G[Symbol.toPrimitive]=="function")return a.from(G[Symbol.toPrimitive]("string"),R,T);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof G)}a.from=function(G,R,T){return l(G,R,T)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function A(G){if(typeof G!="number")throw new TypeError('"size" argument must be of type number');if(G<0)throw new RangeError('The value "'+G+'" is invalid for option "size"')}function c(G,R,T){return A(G),G<=0?o(G):R!==void 0?typeof T=="string"?o(G).fill(R,T):o(G).fill(R):o(G)}a.alloc=function(G,R,T){return c(G,R,T)};function u(G){return A(G),o(G<0?0:m(G)|0)}a.allocUnsafe=function(G){return u(G)},a.allocUnsafeSlow=function(G){return u(G)};function f(G,R){if((typeof R!="string"||R==="")&&(R="utf8"),!a.isEncoding(R))throw new TypeError("Unknown encoding: "+R);const T=w(G,R)|0;let V=o(T);const te=V.write(G,R);return te!==T&&(V=V.slice(0,te)),V}function h(G){const R=G.length<0?0:m(G.length)|0,T=o(R);for(let V=0;V=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return G|0}function y(G){return+G!=G&&(G=0),a.alloc(+G)}a.isBuffer=function(R){return R!=null&&R._isBuffer===!0&&R!==a.prototype},a.compare=function(R,T){if(N(R,Uint8Array)&&(R=a.from(R,R.offset,R.byteLength)),N(T,Uint8Array)&&(T=a.from(T,T.offset,T.byteLength)),!a.isBuffer(R)||!a.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(R===T)return 0;let V=R.length,te=T.length;for(let ae=0,ie=Math.min(V,te);aete.length?(a.isBuffer(ie)||(ie=a.from(ie)),ie.copy(te,ae)):Uint8Array.prototype.set.call(te,ie,ae);else if(a.isBuffer(ie))ie.copy(te,ae);else throw new TypeError('"list" argument must be an Array of Buffers');ae+=ie.length}return te};function w(G,R){if(a.isBuffer(G))return G.length;if(ArrayBuffer.isView(G)||N(G,ArrayBuffer))return G.byteLength;if(typeof G!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof G);const T=G.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&T===0)return 0;let te=!1;for(;;)switch(R){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return q(G).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T*2;case"hex":return T>>>1;case"base64":return xe(G).length;default:if(te)return V?-1:q(G).length;R=(""+R).toLowerCase(),te=!0}}a.byteLength=w;function x(G,R,T){let V=!1;if((R===void 0||R<0)&&(R=0),R>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0,R>>>=0,T<=R))return"";for(G||(G="utf8");;)switch(G){case"hex":return z(this,R,T);case"utf8":case"utf-8":return v(this,R,T);case"ascii":return P(this,R,T);case"latin1":case"binary":return L(this,R,T);case"base64":return I(this,R,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,R,T);default:if(V)throw new TypeError("Unknown encoding: "+G);G=(G+"").toLowerCase(),V=!0}}a.prototype._isBuffer=!0;function _(G,R,T){const V=G[R];G[R]=G[T],G[T]=V}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 T=0;TT&&(R+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(R,T,V,te,ae){if(N(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(T===void 0&&(T=0),V===void 0&&(V=R?R.length:0),te===void 0&&(te=0),ae===void 0&&(ae=this.length),T<0||V>R.length||te<0||ae>this.length)throw new RangeError("out of range index");if(te>=ae&&T>=V)return 0;if(te>=ae)return-1;if(T>=V)return 1;if(T>>>=0,V>>>=0,te>>>=0,ae>>>=0,this===R)return 0;let ie=ae-te,Te=V-T;const Me=Math.min(ie,Te),Le=this.slice(te,ae),ke=R.slice(T,V);for(let De=0;De2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),T=+T,j(T)&&(T=te?0:G.length-1),T<0&&(T=G.length+T),T>=G.length){if(te)return-1;T=G.length-1}else if(T<0)if(te)T=0;else return-1;if(typeof R=="string"&&(R=a.from(R,V)),a.isBuffer(R))return R.length===0?-1:S(G,R,T,V,te);if(typeof R=="number")return R=R&255,typeof Uint8Array.prototype.indexOf=="function"?te?Uint8Array.prototype.indexOf.call(G,R,T):Uint8Array.prototype.lastIndexOf.call(G,R,T):S(G,[R],T,V,te);throw new TypeError("val must be string, number or Buffer")}function S(G,R,T,V,te){let ae=1,ie=G.length,Te=R.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(G.length<2||R.length<2)return-1;ae=2,ie/=2,Te/=2,T/=2}function Me(ke,De){return ae===1?ke[De]:ke.readUInt16BE(De*ae)}let Le;if(te){let ke=-1;for(Le=T;Leie&&(T=ie-Te),Le=T;Le>=0;Le--){let ke=!0;for(let De=0;Dete&&(V=te)):V=te;const ae=R.length;V>ae/2&&(V=ae/2);let ie;for(ie=0;ie>>0,isFinite(V)?(V=V>>>0,te===void 0&&(te="utf8")):(te=V,V=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ae=this.length-T;if((V===void 0||V>ae)&&(V=ae),R.length>0&&(V<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");te||(te="utf8");let ie=!1;for(;;)switch(te){case"hex":return b(this,R,T,V);case"utf8":case"utf-8":return M(this,R,T,V);case"ascii":case"latin1":case"binary":return D(this,R,T,V);case"base64":return $(this,R,T,V);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,R,T,V);default:if(ie)throw new TypeError("Unknown encoding: "+te);te=(""+te).toLowerCase(),ie=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function I(G,R,T){return R===0&&T===G.length?e.fromByteArray(G):e.fromByteArray(G.slice(R,T))}function v(G,R,T){T=Math.min(G.length,T);const V=[];let te=R;for(;te239?4:ae>223?3:ae>191?2:1;if(te+Te<=T){let Me,Le,ke,De;switch(Te){case 1:ae<128&&(ie=ae);break;case 2:Me=G[te+1],(Me&192)===128&&(De=(ae&31)<<6|Me&63,De>127&&(ie=De));break;case 3:Me=G[te+1],Le=G[te+2],(Me&192)===128&&(Le&192)===128&&(De=(ae&15)<<12|(Me&63)<<6|Le&63,De>2047&&(De<55296||De>57343)&&(ie=De));break;case 4:Me=G[te+1],Le=G[te+2],ke=G[te+3],(Me&192)===128&&(Le&192)===128&&(ke&192)===128&&(De=(ae&15)<<18|(Me&63)<<12|(Le&63)<<6|ke&63,De>65535&&De<1114112&&(ie=De))}}ie===null?(ie=65533,Te=1):ie>65535&&(ie-=65536,V.push(ie>>>10&1023|55296),ie=56320|ie&1023),V.push(ie),te+=Te}return U(V)}const E=4096;function U(G){const R=G.length;if(R<=E)return String.fromCharCode.apply(String,G);let T="",V=0;for(;VV)&&(T=V);let te="";for(let ae=R;aeV&&(R=V),T<0?(T+=V,T<0&&(T=0)):T>V&&(T=V),TT)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(R,T,V){R=R>>>0,T=T>>>0,V||O(R,T,this.length);let te=this[R],ae=1,ie=0;for(;++ie>>0,T=T>>>0,V||O(R,T,this.length);let te=this[R+--T],ae=1;for(;T>0&&(ae*=256);)te+=this[R+--T]*ae;return te},a.prototype.readUint8=a.prototype.readUInt8=function(R,T){return R=R>>>0,T||O(R,1,this.length),this[R]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(R,T){return R=R>>>0,T||O(R,2,this.length),this[R]|this[R+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(R,T){return R=R>>>0,T||O(R,2,this.length),this[R]<<8|this[R+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(R,T){return R=R>>>0,T||O(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,T){return R=R>>>0,T||O(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,Re(R,"offset");const T=this[R],V=this[R+7];(T===void 0||V===void 0)&&Q(R,this.length-8);const te=T+this[++R]*2**8+this[++R]*2**16+this[++R]*2**24,ae=this[++R]+this[++R]*2**8+this[++R]*2**16+V*2**24;return BigInt(te)+(BigInt(ae)<>>0,Re(R,"offset");const T=this[R],V=this[R+7];(T===void 0||V===void 0)&&Q(R,this.length-8);const te=T*2**24+this[++R]*2**16+this[++R]*2**8+this[++R],ae=this[++R]*2**24+this[++R]*2**16+this[++R]*2**8+V;return(BigInt(te)<>>0,T=T>>>0,V||O(R,T,this.length);let te=this[R],ae=1,ie=0;for(;++ie=ae&&(te-=Math.pow(2,8*T)),te},a.prototype.readIntBE=function(R,T,V){R=R>>>0,T=T>>>0,V||O(R,T,this.length);let te=T,ae=1,ie=this[R+--te];for(;te>0&&(ae*=256);)ie+=this[R+--te]*ae;return ae*=128,ie>=ae&&(ie-=Math.pow(2,8*T)),ie},a.prototype.readInt8=function(R,T){return R=R>>>0,T||O(R,1,this.length),this[R]&128?(255-this[R]+1)*-1:this[R]},a.prototype.readInt16LE=function(R,T){R=R>>>0,T||O(R,2,this.length);const V=this[R]|this[R+1]<<8;return V&32768?V|4294901760:V},a.prototype.readInt16BE=function(R,T){R=R>>>0,T||O(R,2,this.length);const V=this[R+1]|this[R]<<8;return V&32768?V|4294901760:V},a.prototype.readInt32LE=function(R,T){return R=R>>>0,T||O(R,4,this.length),this[R]|this[R+1]<<8|this[R+2]<<16|this[R+3]<<24},a.prototype.readInt32BE=function(R,T){return R=R>>>0,T||O(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,Re(R,"offset");const T=this[R],V=this[R+7];(T===void 0||V===void 0)&&Q(R,this.length-8);const te=this[R+4]+this[R+5]*2**8+this[R+6]*2**16+(V<<24);return(BigInt(te)<>>0,Re(R,"offset");const T=this[R],V=this[R+7];(T===void 0||V===void 0)&&Q(R,this.length-8);const te=(T<<24)+this[++R]*2**16+this[++R]*2**8+this[++R];return(BigInt(te)<>>0,T||O(R,4,this.length),t.read(this,R,!0,23,4)},a.prototype.readFloatBE=function(R,T){return R=R>>>0,T||O(R,4,this.length),t.read(this,R,!1,23,4)},a.prototype.readDoubleLE=function(R,T){return R=R>>>0,T||O(R,8,this.length),t.read(this,R,!0,52,8)},a.prototype.readDoubleBE=function(R,T){return R=R>>>0,T||O(R,8,this.length),t.read(this,R,!1,52,8)};function B(G,R,T,V,te,ae){if(!a.isBuffer(G))throw new TypeError('"buffer" argument must be a Buffer instance');if(R>te||RG.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(R,T,V,te){if(R=+R,T=T>>>0,V=V>>>0,!te){const Te=Math.pow(2,8*V)-1;B(this,R,T,V,Te,0)}let ae=1,ie=0;for(this[T]=R&255;++ie>>0,V=V>>>0,!te){const Te=Math.pow(2,8*V)-1;B(this,R,T,V,Te,0)}let ae=V-1,ie=1;for(this[T+ae]=R&255;--ae>=0&&(ie*=256);)this[T+ae]=R/ie&255;return T+V},a.prototype.writeUint8=a.prototype.writeUInt8=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,1,255,0),this[T]=R&255,T+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,2,65535,0),this[T]=R&255,this[T+1]=R>>>8,T+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,2,65535,0),this[T]=R>>>8,this[T+1]=R&255,T+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,4,4294967295,0),this[T+3]=R>>>24,this[T+2]=R>>>16,this[T+1]=R>>>8,this[T]=R&255,T+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,4,4294967295,0),this[T]=R>>>24,this[T+1]=R>>>16,this[T+2]=R>>>8,this[T+3]=R&255,T+4};function W(G,R,T,V,te){_e(R,V,te,G,T,7);let ae=Number(R&BigInt(4294967295));G[T++]=ae,ae=ae>>8,G[T++]=ae,ae=ae>>8,G[T++]=ae,ae=ae>>8,G[T++]=ae;let ie=Number(R>>BigInt(32)&BigInt(4294967295));return G[T++]=ie,ie=ie>>8,G[T++]=ie,ie=ie>>8,G[T++]=ie,ie=ie>>8,G[T++]=ie,T}function ee(G,R,T,V,te){_e(R,V,te,G,T,7);let ae=Number(R&BigInt(4294967295));G[T+7]=ae,ae=ae>>8,G[T+6]=ae,ae=ae>>8,G[T+5]=ae,ae=ae>>8,G[T+4]=ae;let ie=Number(R>>BigInt(32)&BigInt(4294967295));return G[T+3]=ie,ie=ie>>8,G[T+2]=ie,ie=ie>>8,G[T+1]=ie,ie=ie>>8,G[T]=ie,T+8}a.prototype.writeBigUInt64LE=he(function(R,T=0){return W(this,R,T,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=he(function(R,T=0){return ee(this,R,T,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(R,T,V,te){if(R=+R,T=T>>>0,!te){const Me=Math.pow(2,8*V-1);B(this,R,T,V,Me-1,-Me)}let ae=0,ie=1,Te=0;for(this[T]=R&255;++ae>0)-Te&255;return T+V},a.prototype.writeIntBE=function(R,T,V,te){if(R=+R,T=T>>>0,!te){const Me=Math.pow(2,8*V-1);B(this,R,T,V,Me-1,-Me)}let ae=V-1,ie=1,Te=0;for(this[T+ae]=R&255;--ae>=0&&(ie*=256);)R<0&&Te===0&&this[T+ae+1]!==0&&(Te=1),this[T+ae]=(R/ie>>0)-Te&255;return T+V},a.prototype.writeInt8=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,1,127,-128),R<0&&(R=255+R+1),this[T]=R&255,T+1},a.prototype.writeInt16LE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,2,32767,-32768),this[T]=R&255,this[T+1]=R>>>8,T+2},a.prototype.writeInt16BE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,2,32767,-32768),this[T]=R>>>8,this[T+1]=R&255,T+2},a.prototype.writeInt32LE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,4,2147483647,-2147483648),this[T]=R&255,this[T+1]=R>>>8,this[T+2]=R>>>16,this[T+3]=R>>>24,T+4},a.prototype.writeInt32BE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,4,2147483647,-2147483648),R<0&&(R=4294967295+R+1),this[T]=R>>>24,this[T+1]=R>>>16,this[T+2]=R>>>8,this[T+3]=R&255,T+4},a.prototype.writeBigInt64LE=he(function(R,T=0){return W(this,R,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=he(function(R,T=0){return ee(this,R,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(G,R,T,V,te,ae){if(T+V>G.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function X(G,R,T,V,te){return R=+R,T=T>>>0,te||F(G,R,T,4),t.write(G,R,T,V,23,4),T+4}a.prototype.writeFloatLE=function(R,T,V){return X(this,R,T,!0,V)},a.prototype.writeFloatBE=function(R,T,V){return X(this,R,T,!1,V)};function ue(G,R,T,V,te){return R=+R,T=T>>>0,te||F(G,R,T,8),t.write(G,R,T,V,52,8),T+8}a.prototype.writeDoubleLE=function(R,T,V){return ue(this,R,T,!0,V)},a.prototype.writeDoubleBE=function(R,T,V){return ue(this,R,T,!1,V)},a.prototype.copy=function(R,T,V,te){if(!a.isBuffer(R))throw new TypeError("argument should be a Buffer");if(V||(V=0),!te&&te!==0&&(te=this.length),T>=R.length&&(T=R.length),T||(T=0),te>0&&te=this.length)throw new RangeError("Index out of range");if(te<0)throw new RangeError("sourceEnd out of bounds");te>this.length&&(te=this.length),R.length-T>>0,V=V===void 0?this.length:V>>>0,R||(R=0);let ae;if(typeof R=="number")for(ae=T;ae2**32?te=re(String(T)):typeof T=="bigint"&&(te=String(T),(T>BigInt(2)**BigInt(32)||T<-(BigInt(2)**BigInt(32)))&&(te=re(te)),te+="n"),V+=` It must be ${R}. Received ${te}`,V},RangeError);function re(G){let R="",T=G.length;const V=G[0]==="-"?1:0;for(;T>=V+4;T-=3)R=`_${G.slice(T-3,T)}${R}`;return`${G.slice(0,T)}${R}`}function pe(G,R,T){Re(R,"offset"),(G[R]===void 0||G[R+T]===void 0)&&Q(R,G.length-(T+1))}function _e(G,R,T,V,te,ae){if(G>T||G3?R===0||R===BigInt(0)?Te=`>= 0${ie} and < 2${ie} ** ${(ae+1)*8}${ie}`:Te=`>= -(2${ie} ** ${(ae+1)*8-1}${ie}) and < 2 ** ${(ae+1)*8-1}${ie}`:Te=`>= ${R}${ie} and <= ${T}${ie}`,new le.ERR_OUT_OF_RANGE("value",Te,G)}pe(V,te,ae)}function Re(G,R){if(typeof G!="number")throw new le.ERR_INVALID_ARG_TYPE(R,"number",G)}function Q(G,R,T){throw Math.floor(G)!==G?(Re(G,T),new le.ERR_OUT_OF_RANGE(T||"offset","an integer",G)):R<0?new le.ERR_BUFFER_OUT_OF_BOUNDS:new le.ERR_OUT_OF_RANGE(T||"offset",`>= ${T?1:0} and <= ${R}`,G)}const de=/[^+/0-9A-Za-z-_]/g;function Ae(G){if(G=G.split("=")[0],G=G.trim().replace(de,""),G.length<2)return"";for(;G.length%4!==0;)G=G+"=";return G}function q(G,R){R=R||1/0;let T;const V=G.length;let te=null;const ae=[];for(let ie=0;ie55295&&T<57344){if(!te){if(T>56319){(R-=3)>-1&&ae.push(239,191,189);continue}else if(ie+1===V){(R-=3)>-1&&ae.push(239,191,189);continue}te=T;continue}if(T<56320){(R-=3)>-1&&ae.push(239,191,189),te=T;continue}T=(te-55296<<10|T-56320)+65536}else te&&(R-=3)>-1&&ae.push(239,191,189);if(te=null,T<128){if((R-=1)<0)break;ae.push(T)}else if(T<2048){if((R-=2)<0)break;ae.push(T>>6|192,T&63|128)}else if(T<65536){if((R-=3)<0)break;ae.push(T>>12|224,T>>6&63|128,T&63|128)}else if(T<1114112){if((R-=4)<0)break;ae.push(T>>18|240,T>>12&63|128,T>>6&63|128,T&63|128)}else throw new Error("Invalid code point")}return ae}function J(G){const R=[];for(let T=0;T>8,te=T%256,ae.push(te),ae.push(V);return ae}function xe(G){return e.toByteArray(Ae(G))}function be(G,R,T,V){let te;for(te=0;te=R.length||te>=G.length);++te)R[te+T]=G[te];return te}function N(G,R){return G instanceof R||G!=null&&G.constructor!=null&&G.constructor.name!=null&&G.constructor.name===R.name}function j(G){return G!==G}const se=function(){const G="0123456789abcdef",R=new Array(256);for(let T=0;T<16;++T){const V=T*16;for(let te=0;te<16;++te)R[V+te]=G[T]+G[te]}return R}();function he(G){return typeof BigInt>"u"?me:G}function me(){throw new Error("BigInt not supported")}})(t6);/*! + */(function(n){const e=Wx,t=lT,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=a,n.SlowBuffer=y,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 G=new Uint8Array(1),R={foo:function(){return 42}};return Object.setPrototypeOf(R,Uint8Array.prototype),Object.setPrototypeOf(G,R),G.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(G){if(G>i)throw new RangeError('The value "'+G+'" is invalid for option "size"');const R=new Uint8Array(G);return Object.setPrototypeOf(R,a.prototype),R}function a(G,R,T){if(typeof G=="number"){if(typeof R=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(G)}return l(G,R,T)}a.poolSize=8192;function l(G,R,T){if(typeof G=="string")return f(G,R);if(ArrayBuffer.isView(G))return p(G);if(G==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof G);if(N(G,ArrayBuffer)||G&&N(G.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(N(G,SharedArrayBuffer)||G&&N(G.buffer,SharedArrayBuffer)))return d(G,R,T);if(typeof G=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const V=G.valueOf&&G.valueOf();if(V!=null&&V!==G)return a.from(V,R,T);const te=g(G);if(te)return te;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof G[Symbol.toPrimitive]=="function")return a.from(G[Symbol.toPrimitive]("string"),R,T);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof G)}a.from=function(G,R,T){return l(G,R,T)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function A(G){if(typeof G!="number")throw new TypeError('"size" argument must be of type number');if(G<0)throw new RangeError('The value "'+G+'" is invalid for option "size"')}function c(G,R,T){return A(G),G<=0?o(G):R!==void 0?typeof T=="string"?o(G).fill(R,T):o(G).fill(R):o(G)}a.alloc=function(G,R,T){return c(G,R,T)};function u(G){return A(G),o(G<0?0:m(G)|0)}a.allocUnsafe=function(G){return u(G)},a.allocUnsafeSlow=function(G){return u(G)};function f(G,R){if((typeof R!="string"||R==="")&&(R="utf8"),!a.isEncoding(R))throw new TypeError("Unknown encoding: "+R);const T=w(G,R)|0;let V=o(T);const te=V.write(G,R);return te!==T&&(V=V.slice(0,te)),V}function h(G){const R=G.length<0?0:m(G.length)|0,T=o(R);for(let V=0;V=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return G|0}function y(G){return+G!=G&&(G=0),a.alloc(+G)}a.isBuffer=function(R){return R!=null&&R._isBuffer===!0&&R!==a.prototype},a.compare=function(R,T){if(N(R,Uint8Array)&&(R=a.from(R,R.offset,R.byteLength)),N(T,Uint8Array)&&(T=a.from(T,T.offset,T.byteLength)),!a.isBuffer(R)||!a.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(R===T)return 0;let V=R.length,te=T.length;for(let ae=0,ie=Math.min(V,te);aete.length?(a.isBuffer(ie)||(ie=a.from(ie)),ie.copy(te,ae)):Uint8Array.prototype.set.call(te,ie,ae);else if(a.isBuffer(ie))ie.copy(te,ae);else throw new TypeError('"list" argument must be an Array of Buffers');ae+=ie.length}return te};function w(G,R){if(a.isBuffer(G))return G.length;if(ArrayBuffer.isView(G)||N(G,ArrayBuffer))return G.byteLength;if(typeof G!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof G);const T=G.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&T===0)return 0;let te=!1;for(;;)switch(R){case"ascii":case"latin1":case"binary":return T;case"utf8":case"utf-8":return q(G).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T*2;case"hex":return T>>>1;case"base64":return xe(G).length;default:if(te)return V?-1:q(G).length;R=(""+R).toLowerCase(),te=!0}}a.byteLength=w;function x(G,R,T){let V=!1;if((R===void 0||R<0)&&(R=0),R>this.length||((T===void 0||T>this.length)&&(T=this.length),T<=0)||(T>>>=0,R>>>=0,T<=R))return"";for(G||(G="utf8");;)switch(G){case"hex":return z(this,R,T);case"utf8":case"utf-8":return v(this,R,T);case"ascii":return P(this,R,T);case"latin1":case"binary":return L(this,R,T);case"base64":return I(this,R,T);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,R,T);default:if(V)throw new TypeError("Unknown encoding: "+G);G=(G+"").toLowerCase(),V=!0}}a.prototype._isBuffer=!0;function _(G,R,T){const V=G[R];G[R]=G[T],G[T]=V}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 T=0;TT&&(R+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(R,T,V,te,ae){if(N(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(T===void 0&&(T=0),V===void 0&&(V=R?R.length:0),te===void 0&&(te=0),ae===void 0&&(ae=this.length),T<0||V>R.length||te<0||ae>this.length)throw new RangeError("out of range index");if(te>=ae&&T>=V)return 0;if(te>=ae)return-1;if(T>=V)return 1;if(T>>>=0,V>>>=0,te>>>=0,ae>>>=0,this===R)return 0;let ie=ae-te,Te=V-T;const Me=Math.min(ie,Te),Le=this.slice(te,ae),ke=R.slice(T,V);for(let De=0;De2147483647?T=2147483647:T<-2147483648&&(T=-2147483648),T=+T,j(T)&&(T=te?0:G.length-1),T<0&&(T=G.length+T),T>=G.length){if(te)return-1;T=G.length-1}else if(T<0)if(te)T=0;else return-1;if(typeof R=="string"&&(R=a.from(R,V)),a.isBuffer(R))return R.length===0?-1:S(G,R,T,V,te);if(typeof R=="number")return R=R&255,typeof Uint8Array.prototype.indexOf=="function"?te?Uint8Array.prototype.indexOf.call(G,R,T):Uint8Array.prototype.lastIndexOf.call(G,R,T):S(G,[R],T,V,te);throw new TypeError("val must be string, number or Buffer")}function S(G,R,T,V,te){let ae=1,ie=G.length,Te=R.length;if(V!==void 0&&(V=String(V).toLowerCase(),V==="ucs2"||V==="ucs-2"||V==="utf16le"||V==="utf-16le")){if(G.length<2||R.length<2)return-1;ae=2,ie/=2,Te/=2,T/=2}function Me(ke,De){return ae===1?ke[De]:ke.readUInt16BE(De*ae)}let Le;if(te){let ke=-1;for(Le=T;Leie&&(T=ie-Te),Le=T;Le>=0;Le--){let ke=!0;for(let De=0;Dete&&(V=te)):V=te;const ae=R.length;V>ae/2&&(V=ae/2);let ie;for(ie=0;ie>>0,isFinite(V)?(V=V>>>0,te===void 0&&(te="utf8")):(te=V,V=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const ae=this.length-T;if((V===void 0||V>ae)&&(V=ae),R.length>0&&(V<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");te||(te="utf8");let ie=!1;for(;;)switch(te){case"hex":return b(this,R,T,V);case"utf8":case"utf-8":return M(this,R,T,V);case"ascii":case"latin1":case"binary":return D(this,R,T,V);case"base64":return $(this,R,T,V);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,R,T,V);default:if(ie)throw new TypeError("Unknown encoding: "+te);te=(""+te).toLowerCase(),ie=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function I(G,R,T){return R===0&&T===G.length?e.fromByteArray(G):e.fromByteArray(G.slice(R,T))}function v(G,R,T){T=Math.min(G.length,T);const V=[];let te=R;for(;te239?4:ae>223?3:ae>191?2:1;if(te+Te<=T){let Me,Le,ke,De;switch(Te){case 1:ae<128&&(ie=ae);break;case 2:Me=G[te+1],(Me&192)===128&&(De=(ae&31)<<6|Me&63,De>127&&(ie=De));break;case 3:Me=G[te+1],Le=G[te+2],(Me&192)===128&&(Le&192)===128&&(De=(ae&15)<<12|(Me&63)<<6|Le&63,De>2047&&(De<55296||De>57343)&&(ie=De));break;case 4:Me=G[te+1],Le=G[te+2],ke=G[te+3],(Me&192)===128&&(Le&192)===128&&(ke&192)===128&&(De=(ae&15)<<18|(Me&63)<<12|(Le&63)<<6|ke&63,De>65535&&De<1114112&&(ie=De))}}ie===null?(ie=65533,Te=1):ie>65535&&(ie-=65536,V.push(ie>>>10&1023|55296),ie=56320|ie&1023),V.push(ie),te+=Te}return U(V)}const E=4096;function U(G){const R=G.length;if(R<=E)return String.fromCharCode.apply(String,G);let T="",V=0;for(;VV)&&(T=V);let te="";for(let ae=R;aeV&&(R=V),T<0?(T+=V,T<0&&(T=0)):T>V&&(T=V),TT)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(R,T,V){R=R>>>0,T=T>>>0,V||O(R,T,this.length);let te=this[R],ae=1,ie=0;for(;++ie>>0,T=T>>>0,V||O(R,T,this.length);let te=this[R+--T],ae=1;for(;T>0&&(ae*=256);)te+=this[R+--T]*ae;return te},a.prototype.readUint8=a.prototype.readUInt8=function(R,T){return R=R>>>0,T||O(R,1,this.length),this[R]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(R,T){return R=R>>>0,T||O(R,2,this.length),this[R]|this[R+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(R,T){return R=R>>>0,T||O(R,2,this.length),this[R]<<8|this[R+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(R,T){return R=R>>>0,T||O(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,T){return R=R>>>0,T||O(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,Re(R,"offset");const T=this[R],V=this[R+7];(T===void 0||V===void 0)&&Q(R,this.length-8);const te=T+this[++R]*2**8+this[++R]*2**16+this[++R]*2**24,ae=this[++R]+this[++R]*2**8+this[++R]*2**16+V*2**24;return BigInt(te)+(BigInt(ae)<>>0,Re(R,"offset");const T=this[R],V=this[R+7];(T===void 0||V===void 0)&&Q(R,this.length-8);const te=T*2**24+this[++R]*2**16+this[++R]*2**8+this[++R],ae=this[++R]*2**24+this[++R]*2**16+this[++R]*2**8+V;return(BigInt(te)<>>0,T=T>>>0,V||O(R,T,this.length);let te=this[R],ae=1,ie=0;for(;++ie=ae&&(te-=Math.pow(2,8*T)),te},a.prototype.readIntBE=function(R,T,V){R=R>>>0,T=T>>>0,V||O(R,T,this.length);let te=T,ae=1,ie=this[R+--te];for(;te>0&&(ae*=256);)ie+=this[R+--te]*ae;return ae*=128,ie>=ae&&(ie-=Math.pow(2,8*T)),ie},a.prototype.readInt8=function(R,T){return R=R>>>0,T||O(R,1,this.length),this[R]&128?(255-this[R]+1)*-1:this[R]},a.prototype.readInt16LE=function(R,T){R=R>>>0,T||O(R,2,this.length);const V=this[R]|this[R+1]<<8;return V&32768?V|4294901760:V},a.prototype.readInt16BE=function(R,T){R=R>>>0,T||O(R,2,this.length);const V=this[R+1]|this[R]<<8;return V&32768?V|4294901760:V},a.prototype.readInt32LE=function(R,T){return R=R>>>0,T||O(R,4,this.length),this[R]|this[R+1]<<8|this[R+2]<<16|this[R+3]<<24},a.prototype.readInt32BE=function(R,T){return R=R>>>0,T||O(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,Re(R,"offset");const T=this[R],V=this[R+7];(T===void 0||V===void 0)&&Q(R,this.length-8);const te=this[R+4]+this[R+5]*2**8+this[R+6]*2**16+(V<<24);return(BigInt(te)<>>0,Re(R,"offset");const T=this[R],V=this[R+7];(T===void 0||V===void 0)&&Q(R,this.length-8);const te=(T<<24)+this[++R]*2**16+this[++R]*2**8+this[++R];return(BigInt(te)<>>0,T||O(R,4,this.length),t.read(this,R,!0,23,4)},a.prototype.readFloatBE=function(R,T){return R=R>>>0,T||O(R,4,this.length),t.read(this,R,!1,23,4)},a.prototype.readDoubleLE=function(R,T){return R=R>>>0,T||O(R,8,this.length),t.read(this,R,!0,52,8)},a.prototype.readDoubleBE=function(R,T){return R=R>>>0,T||O(R,8,this.length),t.read(this,R,!1,52,8)};function B(G,R,T,V,te,ae){if(!a.isBuffer(G))throw new TypeError('"buffer" argument must be a Buffer instance');if(R>te||RG.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(R,T,V,te){if(R=+R,T=T>>>0,V=V>>>0,!te){const Te=Math.pow(2,8*V)-1;B(this,R,T,V,Te,0)}let ae=1,ie=0;for(this[T]=R&255;++ie>>0,V=V>>>0,!te){const Te=Math.pow(2,8*V)-1;B(this,R,T,V,Te,0)}let ae=V-1,ie=1;for(this[T+ae]=R&255;--ae>=0&&(ie*=256);)this[T+ae]=R/ie&255;return T+V},a.prototype.writeUint8=a.prototype.writeUInt8=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,1,255,0),this[T]=R&255,T+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,2,65535,0),this[T]=R&255,this[T+1]=R>>>8,T+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,2,65535,0),this[T]=R>>>8,this[T+1]=R&255,T+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,4,4294967295,0),this[T+3]=R>>>24,this[T+2]=R>>>16,this[T+1]=R>>>8,this[T]=R&255,T+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,4,4294967295,0),this[T]=R>>>24,this[T+1]=R>>>16,this[T+2]=R>>>8,this[T+3]=R&255,T+4};function W(G,R,T,V,te){_e(R,V,te,G,T,7);let ae=Number(R&BigInt(4294967295));G[T++]=ae,ae=ae>>8,G[T++]=ae,ae=ae>>8,G[T++]=ae,ae=ae>>8,G[T++]=ae;let ie=Number(R>>BigInt(32)&BigInt(4294967295));return G[T++]=ie,ie=ie>>8,G[T++]=ie,ie=ie>>8,G[T++]=ie,ie=ie>>8,G[T++]=ie,T}function ee(G,R,T,V,te){_e(R,V,te,G,T,7);let ae=Number(R&BigInt(4294967295));G[T+7]=ae,ae=ae>>8,G[T+6]=ae,ae=ae>>8,G[T+5]=ae,ae=ae>>8,G[T+4]=ae;let ie=Number(R>>BigInt(32)&BigInt(4294967295));return G[T+3]=ie,ie=ie>>8,G[T+2]=ie,ie=ie>>8,G[T+1]=ie,ie=ie>>8,G[T]=ie,T+8}a.prototype.writeBigUInt64LE=he(function(R,T=0){return W(this,R,T,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=he(function(R,T=0){return ee(this,R,T,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(R,T,V,te){if(R=+R,T=T>>>0,!te){const Me=Math.pow(2,8*V-1);B(this,R,T,V,Me-1,-Me)}let ae=0,ie=1,Te=0;for(this[T]=R&255;++ae>0)-Te&255;return T+V},a.prototype.writeIntBE=function(R,T,V,te){if(R=+R,T=T>>>0,!te){const Me=Math.pow(2,8*V-1);B(this,R,T,V,Me-1,-Me)}let ae=V-1,ie=1,Te=0;for(this[T+ae]=R&255;--ae>=0&&(ie*=256);)R<0&&Te===0&&this[T+ae+1]!==0&&(Te=1),this[T+ae]=(R/ie>>0)-Te&255;return T+V},a.prototype.writeInt8=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,1,127,-128),R<0&&(R=255+R+1),this[T]=R&255,T+1},a.prototype.writeInt16LE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,2,32767,-32768),this[T]=R&255,this[T+1]=R>>>8,T+2},a.prototype.writeInt16BE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,2,32767,-32768),this[T]=R>>>8,this[T+1]=R&255,T+2},a.prototype.writeInt32LE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,4,2147483647,-2147483648),this[T]=R&255,this[T+1]=R>>>8,this[T+2]=R>>>16,this[T+3]=R>>>24,T+4},a.prototype.writeInt32BE=function(R,T,V){return R=+R,T=T>>>0,V||B(this,R,T,4,2147483647,-2147483648),R<0&&(R=4294967295+R+1),this[T]=R>>>24,this[T+1]=R>>>16,this[T+2]=R>>>8,this[T+3]=R&255,T+4},a.prototype.writeBigInt64LE=he(function(R,T=0){return W(this,R,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=he(function(R,T=0){return ee(this,R,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(G,R,T,V,te,ae){if(T+V>G.length)throw new RangeError("Index out of range");if(T<0)throw new RangeError("Index out of range")}function X(G,R,T,V,te){return R=+R,T=T>>>0,te||F(G,R,T,4),t.write(G,R,T,V,23,4),T+4}a.prototype.writeFloatLE=function(R,T,V){return X(this,R,T,!0,V)},a.prototype.writeFloatBE=function(R,T,V){return X(this,R,T,!1,V)};function ue(G,R,T,V,te){return R=+R,T=T>>>0,te||F(G,R,T,8),t.write(G,R,T,V,52,8),T+8}a.prototype.writeDoubleLE=function(R,T,V){return ue(this,R,T,!0,V)},a.prototype.writeDoubleBE=function(R,T,V){return ue(this,R,T,!1,V)},a.prototype.copy=function(R,T,V,te){if(!a.isBuffer(R))throw new TypeError("argument should be a Buffer");if(V||(V=0),!te&&te!==0&&(te=this.length),T>=R.length&&(T=R.length),T||(T=0),te>0&&te=this.length)throw new RangeError("Index out of range");if(te<0)throw new RangeError("sourceEnd out of bounds");te>this.length&&(te=this.length),R.length-T>>0,V=V===void 0?this.length:V>>>0,R||(R=0);let ae;if(typeof R=="number")for(ae=T;ae2**32?te=re(String(T)):typeof T=="bigint"&&(te=String(T),(T>BigInt(2)**BigInt(32)||T<-(BigInt(2)**BigInt(32)))&&(te=re(te)),te+="n"),V+=` It must be ${R}. Received ${te}`,V},RangeError);function re(G){let R="",T=G.length;const V=G[0]==="-"?1:0;for(;T>=V+4;T-=3)R=`_${G.slice(T-3,T)}${R}`;return`${G.slice(0,T)}${R}`}function pe(G,R,T){Re(R,"offset"),(G[R]===void 0||G[R+T]===void 0)&&Q(R,G.length-(T+1))}function _e(G,R,T,V,te,ae){if(G>T||G3?R===0||R===BigInt(0)?Te=`>= 0${ie} and < 2${ie} ** ${(ae+1)*8}${ie}`:Te=`>= -(2${ie} ** ${(ae+1)*8-1}${ie}) and < 2 ** ${(ae+1)*8-1}${ie}`:Te=`>= ${R}${ie} and <= ${T}${ie}`,new le.ERR_OUT_OF_RANGE("value",Te,G)}pe(V,te,ae)}function Re(G,R){if(typeof G!="number")throw new le.ERR_INVALID_ARG_TYPE(R,"number",G)}function Q(G,R,T){throw Math.floor(G)!==G?(Re(G,T),new le.ERR_OUT_OF_RANGE(T||"offset","an integer",G)):R<0?new le.ERR_BUFFER_OUT_OF_BOUNDS:new le.ERR_OUT_OF_RANGE(T||"offset",`>= ${T?1:0} and <= ${R}`,G)}const de=/[^+/0-9A-Za-z-_]/g;function Ae(G){if(G=G.split("=")[0],G=G.trim().replace(de,""),G.length<2)return"";for(;G.length%4!==0;)G=G+"=";return G}function q(G,R){R=R||1/0;let T;const V=G.length;let te=null;const ae=[];for(let ie=0;ie55295&&T<57344){if(!te){if(T>56319){(R-=3)>-1&&ae.push(239,191,189);continue}else if(ie+1===V){(R-=3)>-1&&ae.push(239,191,189);continue}te=T;continue}if(T<56320){(R-=3)>-1&&ae.push(239,191,189),te=T;continue}T=(te-55296<<10|T-56320)+65536}else te&&(R-=3)>-1&&ae.push(239,191,189);if(te=null,T<128){if((R-=1)<0)break;ae.push(T)}else if(T<2048){if((R-=2)<0)break;ae.push(T>>6|192,T&63|128)}else if(T<65536){if((R-=3)<0)break;ae.push(T>>12|224,T>>6&63|128,T&63|128)}else if(T<1114112){if((R-=4)<0)break;ae.push(T>>18|240,T>>12&63|128,T>>6&63|128,T&63|128)}else throw new Error("Invalid code point")}return ae}function J(G){const R=[];for(let T=0;T>8,te=T%256,ae.push(te),ae.push(V);return ae}function xe(G){return e.toByteArray(Ae(G))}function be(G,R,T,V){let te;for(te=0;te=R.length||te>=G.length);++te)R[te+T]=G[te];return te}function N(G,R){return G instanceof R||G!=null&&G.constructor!=null&&G.constructor.name!=null&&G.constructor.name===R.name}function j(G){return G!==G}const se=function(){const G="0123456789abcdef",R=new Array(256);for(let T=0;T<16;++T){const V=T*16;for(let te=0;te<16;++te)R[V+te]=G[T]+G[te]}return R}();function he(G){return typeof BigInt>"u"?me:G}function me(){throw new Error("BigInt not supported")}})(t6);/*! * html2canvas 1.4.1 * Copyright (c) 2022 Niklas von Hertzen * Released under MIT License @@ -3228,7 +3228,7 @@ 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 mC=function(n,e){return mC=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])},mC(n,e)};function Mo(n,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");mC(n,e);function t(){this.constructor=n}n.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function ws(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function ki(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(A){return function(c){return l([A,c])}}function l(A){if(r)throw new TypeError("Generator is already executing.");for(;t;)try{if(r=1,i&&(s=A[0]&2?i.return:A[0]?i.throw||((s=i.return)&&s.call(i),0):i.next)&&!(s=s.call(i,A[1])).done)return s;switch(i=0,s&&(A=[A[0]&2,s.value]),A[0]){case 0:case 1:s=A;break;case 4:return t.label++,{value:A[1],done:!1};case 5:t.label++,i=A[1],A=[0];continue;case 7:A=t.ops.pop(),t.trys.pop();continue;default:if(s=t.trys,!(s=s.length>0&&s[s.length-1])&&(A[0]===6||A[0]===2)){t=0;continue}if(A[0]===3&&(!s||A[1]>s[0]&&A[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},tL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zre=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var O0=0;O0"u"?[]:new Uint8Array(256);for(var N0=0;N0>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},Vre=function(n){for(var e=n.length,t=[],r=0;r>Oc,Kre=1<>Oc,Yre=r6+$re,Xre=Yre,Zre=32,Jre=Xre+Zre,qre=65536>>cT,eie=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Oc],t=(t<>Oc)],t=(t<>cT),t=this.index[t],t+=e>>Oc&tie,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var k0=0;k0sL?(i.push(!0),a-=sL):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(o),t.push(yC);if(a===lie||a===gC){if(o===0)return r.push(o),t.push(wc);var l=t[o-1];return mie.indexOf(l)===-1?(r.push(r[o-1]),t.push(l)):(r.push(o),t.push(wc))}if(r.push(o),a===hie)return t.push(e==="strict"?wC:zm);if(a===a6||a===fie)return t.push(wc);if(a===die)return s>=131072&&s<=196605||s>=196608&&s<=262141?t.push(zm):t.push(wc);t.push(a)}),[r,t,i]},Ib=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!==uA)break}if(i===uA)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!==uA)break}if(a!==uA)break}return!1},fL=function(n,e){for(var t=n;t>=0;){var r=e[t];if(r===uA)t--;else return r}return 0},yie=function(n,e,t,r,i){if(t[r]===0)return Tt;var s=r-1;if(Array.isArray(i)&&i[s]===!0)return Tt;var o=s-1,a=s+1,l=e[s],A=o>=0?e[o]:0,c=e[a];if(l===i6&&c===s6)return Tt;if(CC.indexOf(l)!==-1)return l6;if(CC.indexOf(c)!==-1||A6.indexOf(c)!==-1)return Tt;if(fL(s,e)===o6)return G0;if(EC.get(n[s])===gC||(l===H0||l===z0)&&EC.get(n[a])===gC||l===oL||c===oL||l===aL||[uA,vC,Cp].indexOf(l)===-1&&c===aL||[Q0,jd,uie,Nu,ku].indexOf(c)!==-1||fL(s,e)===Wd||Ib(Mb,Wd,s,e)||Ib([Q0,jd],wC,s,e)||Ib(lL,lL,s,e))return Tt;if(l===uA)return G0;if(l===Mb||c===Mb)return Tt;if(c===yC||l===yC)return G0;if([vC,Cp,wC].indexOf(c)!==-1||l===cie||A===bC&&gie.indexOf(l)!==-1||l===ku&&c===bC||c===AL||Pa.indexOf(c)!==-1&&l===Qi||Pa.indexOf(l)!==-1&&c===Qi||l===Mp&&[zm,H0,z0].indexOf(c)!==-1||[zm,H0,z0].indexOf(l)!==-1&&c===Sp||Pa.indexOf(l)!==-1&&cL.indexOf(c)!==-1||cL.indexOf(l)!==-1&&Pa.indexOf(c)!==-1||[Mp,Sp].indexOf(l)!==-1&&(c===Qi||[Wd,Cp].indexOf(c)!==-1&&e[a+1]===Qi)||[Wd,Cp].indexOf(l)!==-1&&c===Qi||l===Qi&&[Qi,ku,Nu].indexOf(c)!==-1)return Tt;if([Qi,ku,Nu,Q0,jd].indexOf(c)!==-1)for(var u=s;u>=0;){var f=e[u];if(f===Qi)return Tt;if([ku,Nu].indexOf(f)!==-1)u--;else break}if([Mp,Sp].indexOf(c)!==-1)for(var u=[Q0,jd].indexOf(l)!==-1?o:s;u>=0;){var f=e[u];if(f===Qi)return Tt;if([ku,Nu].indexOf(f)!==-1)u--;else break}if(BC===l&&[BC,ly,xC,_C].indexOf(c)!==-1||[ly,xC].indexOf(l)!==-1&&[ly,Ay].indexOf(c)!==-1||[Ay,_C].indexOf(l)!==-1&&c===Ay||uL.indexOf(l)!==-1&&[AL,Sp].indexOf(c)!==-1||uL.indexOf(c)!==-1&&l===Mp||Pa.indexOf(l)!==-1&&Pa.indexOf(c)!==-1||l===Nu&&Pa.indexOf(c)!==-1||Pa.concat(Qi).indexOf(l)!==-1&&c===Wd&&pie.indexOf(n[a])===-1||Pa.concat(Qi).indexOf(c)!==-1&&l===jd)return Tt;if(l===Tb&&c===Tb){for(var h=t[s],p=1;h>0&&(h--,e[h]===Tb);)p++;if(p%2!==0)return Tt}return l===H0&&c===z0?Tt:G0},wie=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=vie(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[Qi,wc,a6].indexOf(a)!==-1?zm: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]},xie=function(){function n(e,t,r,i){this.codePoints=e,this.required=t===l6,this.start=r,this.end=i}return n.prototype.slice=function(){return Vn.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),_ie=function(n,e){var t=Wx(n),r=wie(t,e),i=r[0],s=r[1],o=r[2],a=t.length,l=0,A=0;return{next:function(){if(A>=a)return{done:!0,value:null};for(var c=Tt;A=c6&&n<=57},nse=function(n){return n>=55296&&n<=57343},Qu=function(n){return Gr(n)||n>=h6&&n<=p6||n>=u6&&n<=Zie},rse=function(n){return n>=u6&&n<=qie},ise=function(n){return n>=h6&&n<=tse},sse=function(n){return rse(n)||ise(n)},ose=function(n){return n>=Hie},$0=function(n){return n===_w||n===Eie||n===Cie},bw=function(n){return sse(n)||ose(n)||n===Iie},gL=function(n){return bw(n)||Gr(n)||n===wi},ase=function(n){return n>=jie&&n<=Wie||n===Kie||n>=$ie&&n<=Yie||n===Xie},Zl=function(n,e){return n!==rm?!1:e!==_w},Y0=function(n,e,t){return n===wi?bw(e)||Zl(e,t):bw(n)?!0:!!(n===rm&&Zl(n,e))},Fb=function(n,e,t){return n===Cc||n===wi?Gr(e)?!0:e===Gm&&Gr(t):Gr(n===Gm?e:n)},lse=function(n){var e=0,t=1;(n[e]===Cc||n[e]===wi)&&(n[e]===wi&&(t=-1),e++);for(var r=[];Gr(n[e]);)r.push(n[e++]);var i=r.length?parseInt(Vn.apply(void 0,r),10):0;n[e]===Gm&&e++;for(var s=[];Gr(n[e]);)s.push(n[e++]);var o=s.length,a=o?parseInt(Vn.apply(void 0,s),10):0;(n[e]===d6||n[e]===f6)&&e++;var l=1;(n[e]===Cc||n[e]===wi)&&(n[e]===wi&&(l=-1),e++);for(var A=[];Gr(n[e]);)A.push(n[e++]);var c=A.length?parseInt(Vn.apply(void 0,A),10):0;return t*(i+a*Math.pow(10,-o))*Math.pow(10,l*c)},Ase={type:2},cse={type:3},use={type:4},fse={type:13},hse={type:8},dse={type:21},pse={type:9},mse={type:10},gse={type:11},vse={type:12},yse={type:14},X0={type:23},wse={type:1},xse={type:25},_se={type:24},bse={type:26},Bse={type:27},Ese={type:28},Cse={type:29},Sse={type:31},SC={type:32},m6=function(){function n(){this._value=[]}return n.prototype.write=function(e){this._value=this._value.concat(Wx(e))},n.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==SC;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case V0:return this.consumeStringToken(V0);case Sie:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),i=this.peekCodePoint(2);if(gL(t)||Zl(r,i)){var s=Y0(t,r,i)?Bie:bie,o=this.consumeName();return{type:5,value:o,flags:s}}break;case Mie:if(this.peekCodePoint(0)===Kd)return this.consumeCodePoint(),fse;break;case j0:return this.consumeStringToken(j0);case W0:return Ase;case $d:return cse;case Rb:if(this.peekCodePoint(0)===Kd)return this.consumeCodePoint(),yse;break;case Cc:if(Fb(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case zie:return use;case wi:var a=e,l=this.peekCodePoint(0),A=this.peekCodePoint(1);if(Fb(a,l,A))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(Y0(a,l,A))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===wi&&A===Uie)return this.consumeCodePoint(),this.consumeCodePoint(),_se;break;case Gm:if(Fb(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case dL:if(this.peekCodePoint(0)===Rb)for(this.consumeCodePoint();;){var c=this.consumeCodePoint();if(c===Rb&&(c=this.consumeCodePoint(),c===dL))return this.consumeToken();if(c===Uo)return this.consumeToken()}break;case Gie:return bse;case Vie:return Bse;case Fie:if(this.peekCodePoint(0)===Rie&&this.peekCodePoint(1)===wi&&this.peekCodePoint(2)===wi)return this.consumeCodePoint(),this.consumeCodePoint(),xse;break;case Lie:var u=this.peekCodePoint(0),f=this.peekCodePoint(1),h=this.peekCodePoint(2);if(Y0(u,f,h)){var o=this.consumeName();return{type:7,value:o}}break;case Pie:return Ese;case rm:if(Zl(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Die:return Cse;case Oie:if(this.peekCodePoint(0)===Kd)return this.consumeCodePoint(),hse;break;case Nie:return gse;case kie:return vse;case Jie:case ese:var p=this.peekCodePoint(0),d=this.peekCodePoint(1);return p===Cc&&(Qu(d)||d===K0)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case pL:if(this.peekCodePoint(0)===Kd)return this.consumeCodePoint(),pse;if(this.peekCodePoint(0)===pL)return this.consumeCodePoint(),dse;break;case Qie:if(this.peekCodePoint(0)===Kd)return this.consumeCodePoint(),mse;break;case Uo:return SC}return $0(e)?(this.consumeWhiteSpace(),Sse):Gr(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):bw(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Vn(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();Qu(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===K0&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var i=parseInt(Vn.apply(void 0,e.map(function(l){return l===K0?c6:l})),16),s=parseInt(Vn.apply(void 0,e.map(function(l){return l===K0?p6:l})),16);return{type:30,start:i,end:s}}var o=parseInt(Vn.apply(void 0,e),16);if(this.peekCodePoint(0)===wi&&Qu(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];Qu(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var s=parseInt(Vn.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)===W0?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===W0?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Uo)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===j0||t===V0){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Uo||this.peekCodePoint(0)===$d)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),X0)}for(;;){var i=this.consumeCodePoint();if(i===Uo||i===$d)return{type:22,value:Vn.apply(void 0,e)};if($0(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Uo||this.peekCodePoint(0)===$d?(this.consumeCodePoint(),{type:22,value:Vn.apply(void 0,e)}):(this.consumeBadUrlRemnants(),X0);if(i===V0||i===j0||i===W0||ase(i))return this.consumeBadUrlRemnants(),X0;if(i===rm)if(Zl(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),X0;else e.push(i)}},n.prototype.consumeWhiteSpace=function(){for(;$0(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===$d||e===Uo)return;Zl(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+=Vn.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===Uo||i===void 0||i===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(i===_w)return this._value.splice(0,r),wse;if(i===rm){var s=this._value[r+1];s!==Uo&&s!==void 0&&(s===_w?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):Zl(i,s)&&(t+=this.consumeStringSlice(r),t+=Vn(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=_g,r=this.peekCodePoint(0);for((r===Cc||r===wi)&&e.push(this.consumeCodePoint());Gr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(r===Gm&&Gr(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=hL;Gr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),i=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===d6||r===f6)&&((i===Cc||i===wi)&&Gr(s)||Gr(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=hL;Gr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[lse(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(Y0(i,s,o)){var a=this.consumeName();return{type:15,number:t,flags:r,unit:a}}return i===Tie?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Qu(e)){for(var t=Vn(e);Qu(this.peekCodePoint(0))&&t.length<6;)t+=Vn(this.consumeCodePoint());$0(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||nse(r)||r>1114111?mL:r}return e===Uo?mL:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(gL(t))e+=Vn(t);else if(Zl(t,this.peekCodePoint(0)))e+=Vn(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),g6=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new m6;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||Mse(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"?SC:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),bg=function(n){return n.type===15},Kx=function(n){return n.type===17},Hn=function(n){return n.type===20},MC=function(n,e){return Hn(n)&&n.value===e},$x=function(n){return n.type!==31&&n.type!==4},ba=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},Mse=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},kA=function(n){return n.type===17||n.type===15},nr=function(n){return n.type===16||kA(n)},v6=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},Lr={type:17,number:0,flags:_g},uT={type:16,number:50,flags:_g},fA={type:16,number:100,flags:_g},Tp=function(n,e,t){var r=n[0],i=n[1];return[ln(r,e),ln(typeof i<"u"?i:r,t)]},ln=function(n,e){if(n.type===16)return n.number/100*e;if(bg(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},y6="deg",w6="grad",x6="rad",_6="turn",Yx={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case y6:return Math.PI*e.number/180;case w6:return Math.PI/200*e.number;case x6:return e.number;case _6:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},b6=function(n){return n.type===15&&(n.unit===y6||n.unit===w6||n.unit===x6||n.unit===_6)},B6=function(n){var e=n.filter(Hn).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Lr,Lr];case"to top":case"bottom":return Ds(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Lr,fA];case"to right":case"left":return Ds(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[fA,fA];case"to bottom":case"top":return Ds(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[fA,Lr];case"to left":case"right":return Ds(270)}return 0},Ds=function(n){return Math.PI*n/180},SA={name:"color",parse:function(n,e){if(e.type===18){var t=Tse[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 hA(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 hA(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 hA(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 hA(parseInt(r,16),parseInt(i,16),parseInt(s,16),parseInt(o,16)/255)}}if(e.type===20){var a=Vm[e.value.toUpperCase()];if(typeof a<"u")return a}return Vm.TRANSPARENT}},ch=function(n){return(255&n)===0},yr=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+")"},hA=function(n,e,t,r){return(n<<24|e<<16|t<<8|Math.round(r*255)<<0)>>>0},vL=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},yL=function(n,e){var t=e.filter($x);if(t.length===3){var r=t.map(vL),i=r[0],s=r[1],o=r[2];return hA(i,s,o,1)}if(t.length===4){var a=t.map(vL),i=a[0],s=a[1],o=a[2],l=a[3];return hA(i,s,o,l)}return 0};function Ub(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 wL=function(n,e){var t=e.filter($x),r=t[0],i=t[1],s=t[2],o=t[3],a=(r.type===17?Ds(r.number):Yx.parse(n,r))/(Math.PI*2),l=nr(i)?i.number/100:0,A=nr(s)?s.number/100:0,c=typeof o<"u"&&nr(o)?ln(o,1):1;if(l===0)return hA(A*255,A*255,A*255,1);var u=A<=.5?A*(l+1):A+l-A*l,f=A*2-u,h=Ub(f,u,a+1/3),p=Ub(f,u,a),d=Ub(f,u,a-1/3);return hA(h*255,p*255,d*255,c)},Tse={hsl:wL,hsla:wL,rgb:yL,rgba:yL},xL=function(n,e){return SA.parse(n,g6.create(e).parseComponentValue())},Vm={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},Ise={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(Hn(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Rse={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Xx=function(n,e){var t=SA.parse(n,e[0]),r=e[1];return r&&nr(r)?{color:t,stop:r}:{color:t,stop:null}},_L=function(n,e){var t=n[0],r=n[n.length-1];t.stop===null&&(t.stop=Lr),r.stop===null&&(r.stop=fA);for(var i=[],s=0,o=0;os?i.push(l):i.push(s),s=l}else i.push(null)}for(var A=null,o=0;oo.optimumDistance)?{optimumCorner:a,optimumDistance:c}:o},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},Lse=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(uo(e,t),uo(e,t-i),uo(e-r,t),uo(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=bL(r,i,e,t,!0),A=l[0],c=l[1];s=uo(A-e,(c-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(uo(e,t),uo(e,t-i),uo(e-r,t),uo(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=bL(r,i,e,t,!1),A=u[0],c=u[1];s=uo(A-e,(c-t)/a),o=a*s}break}return Array.isArray(n.size)&&(s=ln(n.size[0],r),o=n.size.length===2?ln(n.size[1],i):s),[s,o]},Pse=function(n,e){var t=Ds(180),r=[];return ba(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&o.value==="to"){t=B6(i);return}else if(b6(o)){t=Yx.parse(n,o);return}}var a=Xx(n,i);r.push(a)}),{angle:t,stops:r,type:1}},Z0=function(n,e){var t=Ds(180),r=[];return ba(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=B6(i);return}else if(b6(o)){t=(Yx.parse(n,o)+Ds(270))%Ds(360);return}}var a=Xx(n,i);r.push(a)}),{angle:t,stops:r,type:1}},Dse=function(n,e){var t=Ds(180),r=[],i=1,s=0,o=3,a=[];return ba(e).forEach(function(l,A){var c=l[0];if(A===0){if(Hn(c)&&c.value==="linear"){i=1;return}else if(Hn(c)&&c.value==="radial"){i=2;return}}if(c.type===18){if(c.name==="from"){var u=SA.parse(n,c.values[0]);r.push({stop:Lr,color:u})}else if(c.name==="to"){var u=SA.parse(n,c.values[0]);r.push({stop:fA,color:u})}else if(c.name==="color-stop"){var f=c.values.filter($x);if(f.length===2){var u=SA.parse(n,f[1]),h=f[0];Kx(h)&&r.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(t+Ds(180))%Ds(360),stops:r,type:i}:{size:o,shape:s,stops:r,position:a,type:i}},E6="closest-side",C6="farthest-side",S6="closest-corner",M6="farthest-corner",T6="circle",I6="ellipse",R6="cover",F6="contain",Ose=function(n,e){var t=0,r=3,i=[],s=[];return ba(e).forEach(function(o,a){var l=!0;if(a===0){var A=!1;l=o.reduce(function(u,f){if(A)if(Hn(f))switch(f.value){case"center":return s.push(uT),u;case"top":case"left":return s.push(Lr),u;case"right":case"bottom":return s.push(fA),u}else(nr(f)||kA(f))&&s.push(f);else if(Hn(f))switch(f.value){case T6:return t=0,!1;case I6:return t=1,!1;case"at":return A=!0,!1;case E6:return r=0,!1;case R6:case C6:return r=1,!1;case F6:case S6:return r=2,!1;case M6:return r=3,!1}else if(kA(f)||nr(f))return Array.isArray(r)||(r=[]),r.push(f),!1;return u},l)}if(l){var c=Xx(n,o);i.push(c)}}),{size:r,shape:t,stops:i,position:s,type:2}},J0=function(n,e){var t=0,r=3,i=[],s=[];return ba(e).forEach(function(o,a){var l=!0;if(a===0?l=o.reduce(function(c,u){if(Hn(u))switch(u.value){case"center":return s.push(uT),!1;case"top":case"left":return s.push(Lr),!1;case"right":case"bottom":return s.push(fA),!1}else if(nr(u)||kA(u))return s.push(u),!1;return c},l):a===1&&(l=o.reduce(function(c,u){if(Hn(u))switch(u.value){case T6:return t=0,!1;case I6:return t=1,!1;case F6:case E6:return r=0,!1;case C6:return r=1,!1;case S6:return r=2,!1;case R6:case M6:return r=3,!1}else if(kA(u)||nr(u))return Array.isArray(r)||(r=[]),r.push(u),!1;return c},l)),l){var A=Xx(n,o);i.push(A)}}),{size:r,shape:t,stops:i,position:s,type:2}},Nse=function(n){return n.type===1},kse=function(n){return n.type===2},fT={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=U6[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 Qse(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!U6[n.name])}var U6={"linear-gradient":Pse,"-moz-linear-gradient":Z0,"-ms-linear-gradient":Z0,"-o-linear-gradient":Z0,"-webkit-linear-gradient":Z0,"radial-gradient":Ose,"-moz-radial-gradient":J0,"-ms-radial-gradient":J0,"-o-radial-gradient":J0,"-webkit-radial-gradient":J0,"-webkit-gradient":Dse},Hse={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 $x(r)&&Qse(r)}).map(function(r){return fT.parse(n,r)})}},zse={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(Hn(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Gse={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return ba(e).map(function(t){return t.filter(nr)}).map(v6)}},Vse={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return ba(e).map(function(t){return t.filter(Hn).map(function(r){return r.value}).join(" ")}).map(jse)}},jse=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}},uh;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(uh||(uh={}));var Wse={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return ba(e).map(function(t){return t.filter(Kse)})}},Kse=function(n){return Hn(n)||nr(n)},Zx=function(n){return{name:"border-"+n+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},$se=Zx("top"),Yse=Zx("right"),Xse=Zx("bottom"),Zse=Zx("left"),Jx=function(n){return{name:"border-radius-"+n,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return v6(t.filter(nr))}}},Jse=Jx("top-left"),qse=Jx("top-right"),eoe=Jx("bottom-right"),toe=Jx("bottom-left"),qx=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}}},noe=qx("top"),roe=qx("right"),ioe=qx("bottom"),soe=qx("left"),e_=function(n){return{name:"border-"+n+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return bg(t)?t.number:0}}},ooe=e_("top"),aoe=e_("right"),loe=e_("bottom"),Aoe=e_("left"),coe={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},uoe={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},foe={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(Hn).reduce(function(t,r){return t|hoe(r.value)},0)}},hoe=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},doe={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}},poe={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}},Bw;(function(n){n.NORMAL="normal",n.STRICT="strict"})(Bw||(Bw={}));var moe={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return Bw.STRICT;case"normal":default:return Bw.NORMAL}}},goe={name:"line-height",initialValue:"normal",prefix:!1,type:4},BL=function(n,e){return Hn(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:nr(n)?ln(n,e):e},voe={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:fT.parse(n,e)}},yoe={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}}},woe={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}}},t_=function(n){return{name:"margin-"+n,initialValue:"0",prefix:!1,type:4}},xoe=t_("top"),_oe=t_("right"),boe=t_("bottom"),Boe=t_("left"),Eoe={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(Hn).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}})}},Coe={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"}}},n_=function(n){return{name:"padding-"+n,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Soe=n_("top"),Moe=n_("right"),Toe=n_("bottom"),Ioe=n_("left"),Roe={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}}},Foe={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}},Uoe={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&MC(e[0],"none")?[]:ba(e).map(function(t){for(var r={color:Vm.TRANSPARENT,offsetX:Lr,offsetY:Lr,blur:Lr},i=0,s=0;s"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},Doe=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},Ooe=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},Noe={matrix:Doe,matrix3d:Ooe},EL={type:16,number:50,flags:_g},koe=[EL,EL],Qoe={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(nr);return t.length!==2?koe:[t[0],t[1]]}},Hoe={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}}},im;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(im||(im={}));var zoe={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return im.BREAK_ALL;case"keep-all":return im.KEEP_ALL;case"normal":default:return im.NORMAL}}},Goe={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if(Kx(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},L6={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")}},Voe={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return Kx(e)?e.number:1}},joe={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Woe={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(Hn).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})}},Koe={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+"'"})}},$oe={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Yoe={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if(Kx(e))return e.number;if(Hn(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},Xoe={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(Hn).map(function(t){return t.value})}},Zoe={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"}}},dr=function(n,e){return(n&e)!==0},Joe={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(bg).map(function(t){return L6.parse(n,t)})}},qoe={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&MC(e[0],"none")?[]:ba(e).map(function(t){for(var r={color:255,offsetX:Lr,offsetY:Lr,blur:Lr,spread:Lr,inset:!1},i=0,s=0;s1?1:0],this.overflowWrap=Xe(e,Coe,t.overflowWrap),this.paddingTop=Xe(e,Soe,t.paddingTop),this.paddingRight=Xe(e,Moe,t.paddingRight),this.paddingBottom=Xe(e,Toe,t.paddingBottom),this.paddingLeft=Xe(e,Ioe,t.paddingLeft),this.paintOrder=Xe(e,eae,t.paintOrder),this.position=Xe(e,Foe,t.position),this.textAlign=Xe(e,Roe,t.textAlign),this.textDecorationColor=Xe(e,joe,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=Xe(e,Woe,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=Xe(e,Uoe,t.textShadow),this.textTransform=Xe(e,Loe,t.textTransform),this.transform=Xe(e,Poe,t.transform),this.transformOrigin=Xe(e,Qoe,t.transformOrigin),this.visibility=Xe(e,Hoe,t.visibility),this.webkitTextStrokeColor=Xe(e,tae,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Xe(e,nae,t.webkitTextStrokeWidth),this.wordBreak=Xe(e,zoe,t.wordBreak),this.zIndex=Xe(e,Goe,t.zIndex)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return ch(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 dr(this.display,4)||dr(this.display,33554432)||dr(this.display,268435456)||dr(this.display,536870912)||dr(this.display,67108864)||dr(this.display,134217728)},n}(),Xe=function(n,e,t){var r=new m6,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(i);var s=new g6(r.read());switch(e.type){case 2:var o=s.parseComponentValue();return e.parse(n,Hn(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 Yx.parse(n,s.parseComponentValue());case"color":return SA.parse(n,s.parseComponentValue());case"image":return fT.parse(n,s.parseComponentValue());case"length":var a=s.parseComponentValue();return kA(a)?a:Lr;case"length-percentage":var l=s.parseComponentValue();return nr(l)?l:Lr;case"time":return L6.parse(n,s.parseComponentValue())}break}},iae="data-html2canvas-debug",sae=function(n){var e=n.getAttribute(iae);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},CL=function(n,e){var t=sae(n);return t===1||e===t},Ba=function(){function n(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,CL(t,3))debugger;this.styles=new rae(e,window.getComputedStyle(t,null)),sle(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=AT(this.context,t),CL(t,4)&&(this.flags|=16)}return n}(),oae="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",SL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ip=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var q0=0;q0>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},lae=function(n){for(var e=n.length,t=[],r=0;r>Nc,uae=1<>Nc,hae=P6+fae,dae=hae,pae=32,mae=dae+pae,gae=65536>>hT,vae=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Nc],t=(t<>Nc)],t=(t<>hT),t=this.index[t],t+=e>>Nc&yae,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var ev=0;ev=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},Mae=xae(oae),Es="×",Hb="÷",Tae=function(n){return Mae.get(n)},Iae=function(n,e,t){var r=t-2,i=e[r],s=e[t-1],o=e[t];if(s===Db&&o===Ob)return Es;if(s===Db||s===Ob||s===IL||o===Db||o===Ob||o===IL)return Hb;if(s===FL&&[FL,Nb,UL,LL].indexOf(o)!==-1||(s===UL||s===Nb)&&(o===Nb||o===kb)||(s===LL||s===kb)&&o===kb||o===PL||o===RL||o===Eae||s===Bae)return Es;if(s===PL&&o===DL){for(;i===RL;)i=e[--r];if(i===DL)return Es}if(s===Qb&&o===Qb){for(var a=0;i===Qb;)a++,i=e[--r];if(a%2===0)return Es}return Hb},Rae=function(n){var e=Cae(n),t=e.length,r=0,i=0,s=e.map(Tae);return{next:function(){if(r>=t)return{done:!0,value:null};for(var o=Es;ro.x||c.y>o.y;return o=c,A===0?!0:u});return n.body.removeChild(e),a},Pae=function(){return typeof new Image().crossOrigin<"u"},Dae=function(){return typeof new XMLHttpRequest().responseType=="string"},Oae=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},OL=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},Nae=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=TC(t,t,0,0,i);return r.fillStyle="red",r.fillRect(0,0,t,t),NL(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 A=n.createElement("div");return A.style.backgroundImage="url("+s+")",A.style.height=t+"px",OL(l)?NL(TC(t,t,0,0,A)):Promise.reject(!1)}).then(function(a){return r.drawImage(a,0,0),OL(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},TC=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},NL=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))})},Vi={get SUPPORT_RANGE_BOUNDS(){var n=Uae(document);return Object.defineProperty(Vi,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=Vi.SUPPORT_RANGE_BOUNDS&&Lae(document);return Object.defineProperty(Vi,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=Oae(document);return Object.defineProperty(Vi,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?Nae(document):Promise.resolve(!1);return Object.defineProperty(Vi,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=Pae();return Object.defineProperty(Vi,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=Dae();return Object.defineProperty(Vi,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Vi,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Vi,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},sm=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),kae=function(n,e,t,r){var i=zae(e,t),s=[],o=0;return i.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(Vi.SUPPORT_RANGE_BOUNDS){var l=kL(r,o,a.length).getClientRects();if(l.length>1){var A=dT(a),c=0;A.forEach(function(f){s.push(new sm(f,Xc.fromDOMRectList(n,kL(r,c+o,f.length).getClientRects()))),c+=f.length})}else s.push(new sm(a,Xc.fromDOMRectList(n,l)))}else{var u=r.splitText(a.length);s.push(new sm(a,Qae(n,r))),r=u}else Vi.SUPPORT_RANGE_BOUNDS||(r=r.splitText(a.length));o+=a.length}),s},Qae=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=AT(n,r);return r.firstChild&&i.replaceChild(r.firstChild,r),s}}return Xc.EMPTY},kL=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},dT=function(n){if(Vi.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 Fae(n)},Hae=function(n,e){if(Vi.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 Vae(n,e)},zae=function(n,e){return e.letterSpacing!==0?dT(n):Hae(n,e)},Gae=[32,160,4961,65792,65793,4153,4241],Vae=function(n,e){for(var t=_ie(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=Wx(o),l="";a.forEach(function(A){Gae.indexOf(A)===-1?l+=Vn(A):(l.length&&r.push(l),r.push(Vn(A)),l="")}),l.length&&r.push(l)}};!(i=t.next()).done;)s();return r},jae=function(){function n(e,t,r){this.text=Wae(t.data,r.textTransform),this.textBounds=kae(e,this.text,r,t)}return n}(),Wae=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(Kae,$ae);case 2:return n.toUpperCase();default:return n}},Kae=/(^|\s|:|-|\(|\))([a-z])/g,$ae=function(n,e,t){return n.length>0?e+t.toUpperCase():n},D6=function(n){Mo(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}(Ba),O6=function(n){Mo(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}(Ba),N6=function(n){Mo(e,n);function e(t,r){var i=n.call(this,t,r)||this,s=new XMLSerializer,o=AT(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}(Ba),k6=function(n){Mo(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.value=r.value,i}return e}(Ba),IC=function(n){Mo(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}(Ba),Yae=[{type:15,flags:0,unit:"px",number:3}],Xae=[{type:16,flags:0,number:50}],Zae=function(n){return n.width>n.height?new Xc(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width0)t.textNodes.push(new jae(n,i,t.styles));else if(V6(i))if(dle(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return cy(n,a,t,r)});else{var o=G6(n,i);o.styles.isVisible()&&(nle(i,o,r)?o.flags|=4:rle(o.styles)&&(o.flags|=2),ele.indexOf(i.tagName)!==-1&&(o.flags|=8),t.elements.push(o),i.slot,i.shadowRoot?cy(n,i.shadowRoot,o,r):!W6(i)&&!j6(i)&&!K6(i)&&cy(n,i,o,r))}},G6=function(n,e){return fle(e)?new D6(n,e):ule(e)?new O6(n,e):j6(e)?new N6(n,e):ale(e)?new k6(n,e):lle(e)?new IC(n,e):Ale(e)?new pT(n,e):K6(e)?new Q6(n,e):W6(e)?new H6(n,e):hle(e)?new z6(n,e):new Ba(n,e)},tle=function(n,e){var t=G6(n,e);return t.flags|=4,cy(n,e,t,t),t},nle=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||cle(n)&&t.styles.isTransparent()},rle=function(n){return n.isPositioned()||n.isFloating()},ile=function(n){return n.nodeType===Node.TEXT_NODE},V6=function(n){return n.nodeType===Node.ELEMENT_NODE},sle=function(n){return V6(n)&&typeof n.style<"u"&&!ole(n)},ole=function(n){return typeof n.className=="object"},ale=function(n){return n.tagName==="LI"},lle=function(n){return n.tagName==="OL"},Ale=function(n){return n.tagName==="INPUT"},j6=function(n){return n.tagName==="svg"},cle=function(n){return n.tagName==="BODY"},ule=function(n){return n.tagName==="CANVAS"},fle=function(n){return n.tagName==="IMG"},hle=function(n){return n.tagName==="IFRAME"},W6=function(n){return n.tagName==="TEXTAREA"},K6=function(n){return n.tagName==="SELECT"},dle=function(n){return n.tagName==="SLOT"},HL={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"]},zL={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},ple={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},mle={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},Hu=function(n,e,t,r,i,s){return nt?mT(n,i,s.length>0):r.integers.reduce(function(o,a,l){for(;n>=a;)n-=a,o+=r.values[l];return o},"")+s},$6=function(n,e,t,r){var i="";do t||n--,i=r(n)+i,n/=e;while(n*e>=e);return i},zn=function(n,e,t,r,i){var s=t-e+1;return(n<0?"-":"")+($6(Math.abs(n),s,r,function(o){return Vn(Math.floor(o%s)+e)})+i)},oc=function(n,e,t){t===void 0&&(t=". ");var r=e.length;return $6(Math.abs(n),r,!1,function(i){return e[Math.floor(i%r)]})+t},nf=1,Wl=2,Kl=4,Rp=8,Da=function(n,e,t,r,i,s){if(n<-9999||n>9999)return mT(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 A=o%10;A===0&&dr(s,nf)&&a!==""?a=e[A]+a:A>1||A===1&&l===0||A===1&&l===1&&dr(s,Wl)||A===1&&l===1&&dr(s,Kl)&&n>100||A===1&&l>1&&dr(s,Rp)?a=e[A]+(l>0?t[l-1]:"")+a:A===1&&l>0&&(a=t[l-1]+a),o=Math.floor(o/10)}return(n<0?r:"")+a},GL="十百千萬",VL="拾佰仟萬",jL="マイナス",zb="마이너스",mT=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=zn(n,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return oc(n,"〇一二三四五六七八九",i);case 6:return Hu(n,1,3999,HL,3,r).toLowerCase();case 7:return Hu(n,1,3999,HL,3,r);case 8:return zn(n,945,969,!1,r);case 9:return zn(n,97,122,!1,r);case 10:return zn(n,65,90,!1,r);case 11:return zn(n,1632,1641,!0,r);case 12:case 49:return Hu(n,1,9999,zL,3,r);case 35:return Hu(n,1,9999,zL,3,r).toLowerCase();case 13:return zn(n,2534,2543,!0,r);case 14:case 30:return zn(n,6112,6121,!0,r);case 15:return oc(n,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return oc(n,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return Da(n,"零一二三四五六七八九",GL,"負",i,Wl|Kl|Rp);case 47:return Da(n,"零壹貳參肆伍陸柒捌玖",VL,"負",i,nf|Wl|Kl|Rp);case 42:return Da(n,"零一二三四五六七八九",GL,"负",i,Wl|Kl|Rp);case 41:return Da(n,"零壹贰叁肆伍陆柒捌玖",VL,"负",i,nf|Wl|Kl|Rp);case 26:return Da(n,"〇一二三四五六七八九","十百千万",jL,i,0);case 25:return Da(n,"零壱弐参四伍六七八九","拾百千万",jL,i,nf|Wl|Kl);case 31:return Da(n,"영일이삼사오육칠팔구","십백천만",zb,s,nf|Wl|Kl);case 33:return Da(n,"零一二三四五六七八九","十百千萬",zb,s,0);case 32:return Da(n,"零壹貳參四五六七八九","拾百千",zb,s,nf|Wl|Kl);case 18:return zn(n,2406,2415,!0,r);case 20:return Hu(n,1,19999,mle,3,r);case 21:return zn(n,2790,2799,!0,r);case 22:return zn(n,2662,2671,!0,r);case 22:return Hu(n,1,10999,ple,3,r);case 23:return oc(n,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return oc(n,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return zn(n,3302,3311,!0,r);case 28:return oc(n,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return oc(n,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return zn(n,3792,3801,!0,r);case 37:return zn(n,6160,6169,!0,r);case 38:return zn(n,4160,4169,!0,r);case 39:return zn(n,2918,2927,!0,r);case 40:return zn(n,1776,1785,!0,r);case 43:return zn(n,3046,3055,!0,r);case 44:return zn(n,3174,3183,!0,r);case 45:return zn(n,3664,3673,!0,r);case 46:return zn(n,3872,3881,!0,r);case 3:default:return zn(n,48,57,!0,r)}},WL;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(WL||(WL={}));var gle=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}(),Ke=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}(),zu=function(n,e,t){return new Ke(n.x+(e.x-n.x)*t,n.y+(e.y-n.y)*t)},tv=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=zu(this.start,this.startControl,e),i=zu(this.startControl,this.endControl,e),s=zu(this.endControl,this.end,e),o=zu(r,i,e),a=zu(i,s,e),l=zu(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}(),Ts=function(n){return n.type===1},vle=function(){function n(e){var t=e.styles,r=e.bounds,i=Tp(t.borderTopLeftRadius,r.width,r.height),s=i[0],o=i[1],a=Tp(t.borderTopRightRadius,r.width,r.height),l=a[0],A=a[1],c=Tp(t.borderBottomRightRadius,r.width,r.height),u=c[0],f=c[1],h=Tp(t.borderBottomLeftRadius,r.width,r.height),p=h[0],d=h[1],g=[];g.push((s+l)/r.width),g.push((p+u)/r.width),g.push((o+d)/r.height),g.push((A+f)/r.height);var m=Math.max.apply(Math,g);m>1&&(s/=m,o/=m,l/=m,A/=m,u/=m,f/=m,p/=m,d/=m);var y=r.width-l,w=r.height-f,x=r.width-u,_=r.height-d,C=t.borderTopWidth,S=t.borderRightWidth,b=t.borderBottomWidth,M=t.borderLeftWidth,D=ln(t.paddingTop,e.bounds.width),$=ln(t.paddingRight,e.bounds.width),H=ln(t.paddingBottom,e.bounds.width),I=ln(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?mn(r.left+M/3,r.top+C/3,s-M/3,o-C/3,jt.TOP_LEFT):new Ke(r.left+M/3,r.top+C/3),this.topRightBorderDoubleOuterBox=s>0||o>0?mn(r.left+y,r.top+C/3,l-S/3,A-C/3,jt.TOP_RIGHT):new Ke(r.left+r.width-S/3,r.top+C/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?mn(r.left+x,r.top+w,u-S/3,f-b/3,jt.BOTTOM_RIGHT):new Ke(r.left+r.width-S/3,r.top+r.height-b/3),this.bottomLeftBorderDoubleOuterBox=p>0||d>0?mn(r.left+M/3,r.top+_,p-M/3,d-b/3,jt.BOTTOM_LEFT):new Ke(r.left+M/3,r.top+r.height-b/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?mn(r.left+M*2/3,r.top+C*2/3,s-M*2/3,o-C*2/3,jt.TOP_LEFT):new Ke(r.left+M*2/3,r.top+C*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?mn(r.left+y,r.top+C*2/3,l-S*2/3,A-C*2/3,jt.TOP_RIGHT):new Ke(r.left+r.width-S*2/3,r.top+C*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?mn(r.left+x,r.top+w,u-S*2/3,f-b*2/3,jt.BOTTOM_RIGHT):new Ke(r.left+r.width-S*2/3,r.top+r.height-b*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||d>0?mn(r.left+M*2/3,r.top+_,p-M*2/3,d-b*2/3,jt.BOTTOM_LEFT):new Ke(r.left+M*2/3,r.top+r.height-b*2/3),this.topLeftBorderStroke=s>0||o>0?mn(r.left+M/2,r.top+C/2,s-M/2,o-C/2,jt.TOP_LEFT):new Ke(r.left+M/2,r.top+C/2),this.topRightBorderStroke=s>0||o>0?mn(r.left+y,r.top+C/2,l-S/2,A-C/2,jt.TOP_RIGHT):new Ke(r.left+r.width-S/2,r.top+C/2),this.bottomRightBorderStroke=u>0||f>0?mn(r.left+x,r.top+w,u-S/2,f-b/2,jt.BOTTOM_RIGHT):new Ke(r.left+r.width-S/2,r.top+r.height-b/2),this.bottomLeftBorderStroke=p>0||d>0?mn(r.left+M/2,r.top+_,p-M/2,d-b/2,jt.BOTTOM_LEFT):new Ke(r.left+M/2,r.top+r.height-b/2),this.topLeftBorderBox=s>0||o>0?mn(r.left,r.top,s,o,jt.TOP_LEFT):new Ke(r.left,r.top),this.topRightBorderBox=l>0||A>0?mn(r.left+y,r.top,l,A,jt.TOP_RIGHT):new Ke(r.left+r.width,r.top),this.bottomRightBorderBox=u>0||f>0?mn(r.left+x,r.top+w,u,f,jt.BOTTOM_RIGHT):new Ke(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=p>0||d>0?mn(r.left,r.top+_,p,d,jt.BOTTOM_LEFT):new Ke(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||o>0?mn(r.left+M,r.top+C,Math.max(0,s-M),Math.max(0,o-C),jt.TOP_LEFT):new Ke(r.left+M,r.top+C),this.topRightPaddingBox=l>0||A>0?mn(r.left+Math.min(y,r.width-S),r.top+C,y>r.width+S?0:Math.max(0,l-S),Math.max(0,A-C),jt.TOP_RIGHT):new Ke(r.left+r.width-S,r.top+C),this.bottomRightPaddingBox=u>0||f>0?mn(r.left+Math.min(x,r.width-M),r.top+Math.min(w,r.height-b),Math.max(0,u-S),Math.max(0,f-b),jt.BOTTOM_RIGHT):new Ke(r.left+r.width-S,r.top+r.height-b),this.bottomLeftPaddingBox=p>0||d>0?mn(r.left+M,r.top+Math.min(_,r.height-b),Math.max(0,p-M),Math.max(0,d-b),jt.BOTTOM_LEFT):new Ke(r.left+M,r.top+r.height-b),this.topLeftContentBox=s>0||o>0?mn(r.left+M+I,r.top+C+D,Math.max(0,s-(M+I)),Math.max(0,o-(C+D)),jt.TOP_LEFT):new Ke(r.left+M+I,r.top+C+D),this.topRightContentBox=l>0||A>0?mn(r.left+Math.min(y,r.width+M+I),r.top+C+D,y>r.width+M+I?0:l-M+I,A-(C+D),jt.TOP_RIGHT):new Ke(r.left+r.width-(S+$),r.top+C+D),this.bottomRightContentBox=u>0||f>0?mn(r.left+Math.min(x,r.width-(M+I)),r.top+Math.min(w,r.height+C+D),Math.max(0,u-(S+$)),f-(b+H),jt.BOTTOM_RIGHT):new Ke(r.left+r.width-(S+$),r.top+r.height-(b+H)),this.bottomLeftContentBox=p>0||d>0?mn(r.left+M+I,r.top+_,Math.max(0,p-(M+I)),d-(b+H),jt.BOTTOM_LEFT):new Ke(r.left+M+I,r.top+r.height-(b+H))}return n}(),jt;(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"})(jt||(jt={}));var mn=function(n,e,t,r,i){var s=4*((Math.sqrt(2)-1)/3),o=t*s,a=r*s,l=n+t,A=e+r;switch(i){case jt.TOP_LEFT:return new tv(new Ke(n,A),new Ke(n,A-a),new Ke(l-o,e),new Ke(l,e));case jt.TOP_RIGHT:return new tv(new Ke(n,e),new Ke(n+o,e),new Ke(l,A-a),new Ke(l,A));case jt.BOTTOM_RIGHT:return new tv(new Ke(l,e),new Ke(l,e+a),new Ke(n+o,A),new Ke(n,A));case jt.BOTTOM_LEFT:default:return new tv(new Ke(l,A),new Ke(l-o,A),new Ke(n,e+a),new Ke(n,e))}},Sw=function(n){return[n.topLeftBorderBox,n.topRightBorderBox,n.bottomRightBorderBox,n.bottomLeftBorderBox]},yle=function(n){return[n.topLeftContentBox,n.topRightContentBox,n.bottomRightContentBox,n.bottomLeftContentBox]},Mw=function(n){return[n.topLeftPaddingBox,n.topRightPaddingBox,n.bottomRightPaddingBox,n.bottomLeftPaddingBox]},wle=function(){function n(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return n}(),nv=function(){function n(e,t){this.path=e,this.target=t,this.type=1}return n}(),xle=function(){function n(e){this.opacity=e,this.type=2,this.target=6}return n}(),_le=function(n){return n.type===0},Y6=function(n){return n.type===1},ble=function(n){return n.type===2},KL=function(n,e){return n.length===e.length?n.some(function(t,r){return t===e[r]}):!1},Ble=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})},X6=function(){function n(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return n}(),Z6=function(){function n(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new vle(this.container),this.container.styles.opacity<1&&this.effects.push(new xle(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 wle(r,i,s))}if(this.container.styles.overflowX!==0){var o=Sw(this.curves),a=Mw(this.curves);KL(o,a)?this.effects.push(new nv(o,6)):(this.effects.push(new nv(o,2)),this.effects.push(new nv(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!Y6(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=Sw(r.curves),a=Mw(r.curves);KL(o,a)||i.unshift(new nv(a,6))}}else i.unshift.apply(i,s);r=r.parent}return i.filter(function(l){return dr(l.target,e)})},n}(),RC=function(n,e,t,r){n.container.elements.forEach(function(i){var s=dr(i.flags,4),o=dr(i.flags,2),a=new Z6(i,n);dr(i.styles.display,2048)&&r.push(a);var l=dr(i.flags,8)?[]:r;if(s||o){var A=s||i.styles.isPositioned()?t:e,c=new X6(a);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var f=0;A.negativeZIndex.some(function(p,d){return u>p.element.container.styles.zIndex.order?(f=d,!1):f>0}),A.negativeZIndex.splice(f,0,c)}else if(u>0){var h=0;A.positiveZIndex.some(function(p,d){return u>=p.element.container.styles.zIndex.order?(h=d+1,!1):h>0}),A.positiveZIndex.splice(h,0,c)}else A.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else i.styles.isFloating()?A.nonPositionedFloats.push(c):A.nonPositionedInlineLevel.push(c);RC(a,c,s?c:t,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),RC(a,e,t,l);dr(i.flags,8)&&J6(i,l)})},J6=function(n,e){for(var t=n instanceof IC?n.start:1,r=n instanceof IC?n.reversed:!1,i=0;i"u"?n[0]:t},Fle=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 Ke(Math.round(r.left),Math.round(r.top+o)),new Ke(Math.round(r.left+r.width),Math.round(r.top+o)),new Ke(Math.round(r.left+r.width),Math.round(l+r.top+o)),new Ke(Math.round(r.left),Math.round(l+r.top+o))];case 3:return[new Ke(Math.round(r.left+s),Math.round(r.top)),new Ke(Math.round(r.left+s+a),Math.round(r.top)),new Ke(Math.round(r.left+s+a),Math.round(r.height+r.top)),new Ke(Math.round(r.left+s),Math.round(r.height+r.top))];case 1:return[new Ke(Math.round(r.left+s),Math.round(r.top+o)),new Ke(Math.round(r.left+s+a),Math.round(r.top+o)),new Ke(Math.round(r.left+s+a),Math.round(r.top+o+l)),new Ke(Math.round(r.left+s),Math.round(r.top+o+l))];default:return[new Ke(Math.round(i.left),Math.round(i.top)),new Ke(Math.round(i.left+i.width),Math.round(i.top)),new Ke(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Ke(Math.round(i.left),Math.round(i.height+i.top))]}},Ule="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",YL="Hidden Text",Lle=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=Ule,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(YL)),r.appendChild(s),r.appendChild(i);var a=i.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(YL)),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}(),e5=function(){function n(e,t){this.context=e,this.options=t}return n}(),Ple=1e4;(function(n){Mo(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 Lle(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(),ble(t)&&(this.ctx.globalAlpha=t.opacity),_le(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)),Y6(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 ws(this,void 0,void 0,function(){var r;return ki(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 ws(this,void 0,void 0,function(){return ki(this,function(r){switch(r.label){case 0:if(dr(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=dT(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=Qle(t.fontFamily).join(", "),s=bg(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 ws(this,void 0,void 0,function(){var i,s,o,a,l,A,c,u,f=this;return ki(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),A=l.baseline,c=l.middle,u=r.paintOrder,t.textBounds.forEach(function(p){u.forEach(function(d){switch(d){case 0:f.ctx.fillStyle=yr(r.color),f.renderTextWithLetterSpacing(p,r.letterSpacing,A);var g=r.textShadow;g.length&&p.text.trim().length&&(g.slice(0).reverse().forEach(function(m){f.ctx.shadowColor=yr(m.color),f.ctx.shadowOffsetX=m.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=m.offsetY.number*f.options.scale,f.ctx.shadowBlur=m.blur.number,f.renderTextWithLetterSpacing(p,r.letterSpacing,A)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),r.textDecorationLine.length&&(f.ctx.fillStyle=yr(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(m){switch(m){case 1:f.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top+A),p.bounds.width,1);break;case 2:f.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top),p.bounds.width,1);break;case 3:f.ctx.fillRect(p.bounds.left,Math.ceil(p.bounds.top+c),p.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&p.text.trim().length&&(f.ctx.strokeStyle=yr(r.webkitTextStrokeColor),f.ctx.lineWidth=r.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(p.text,p.bounds.left,p.bounds.top+A)),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=Tw(t),o=Mw(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 ws(this,void 0,void 0,function(){var r,i,s,o,a,l,y,y,A,c,u,f,x,h,p,_,d,g,m,y,w,x,_;return ki(this,function(C){switch(C.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,i=t.curves,s=r.styles,o=0,a=r.textNodes,C.label=1;case 1:return o0&&v>0&&(b=s.ctx.createPattern(_,"repeat"),s.renderRepeat(D,b,U,P))):kse(c)&&(M=Gb(t,r,[null,null,null]),D=M[0],$=M[1],H=M[2],I=M[3],v=M[4],E=c.position.length===0?[uT]:c.position,U=ln(E[0],I),P=ln(E[E.length-1],v),L=Lse(c,U,P,I,v),z=L[0],K=L[1],z>0&&K>0&&(O=s.ctx.createRadialGradient($+U,H+P,0,$+U,H+P,z),_L(c.stops,z*2).forEach(function(ue){return O.addColorStop(ue.stop,yr(ue.color))}),s.path(D),s.ctx.fillStyle=O,z!==K?(B=t.bounds.left+.5*t.bounds.width,W=t.bounds.top+.5*t.bounds.height,ee=K/z,F=1/ee,s.ctx.save(),s.ctx.translate(B,W),s.ctx.transform(1,0,0,ee,0,0),s.ctx.translate(-B,-W),s.ctx.fillRect($,F*(H-W)+W,I,v*F),s.ctx.restore()):s.ctx.fill())),X.label=6;case 6:return r--,[2]}})},s=this,o=0,a=t.styles.backgroundImage.slice(0).reverse(),A.label=1;case 1:return o0?c.style!==2?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,a,t.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return c.style!==3?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,a,t.curves,3)];case 6:return f.sent(),[3,11];case 7:return c.style!==4?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,a,t.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.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 ws(this,void 0,void 0,function(){var a,l,A,c,u,f,h,p,d,g,m,y,w,x,_,C,_,C;return ki(this,function(S){return this.ctx.save(),a=Mle(s,i),l=$L(s,i),o===2&&(this.path(l),this.ctx.clip()),Ts(l[0])?(A=l[0].start.x,c=l[0].start.y):(A=l[0].x,c=l[0].y),Ts(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(A-u):h=Math.abs(c-f),this.ctx.beginPath(),o===3?this.formatPath(a):this.formatPath(l.slice(0,2)),p=r<3?r*3:r*2,d=r<3?r*2:r,o===3&&(p=r,d=r),g=!0,h<=p*2?g=!1:h<=p*2+d?(m=h/(2*p+d),p*=m,d*=m):(y=Math.floor((h+d)/(p+d)),w=(h-y*p)/(y-1),x=(h-(y+1)*p)/y,d=x<=0||Math.abs(d-w)0&&s[s.length-1])&&(A[0]===6||A[0]===2)){t=0;continue}if(A[0]===3&&(!s||A[1]>s[0]&&A[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},tL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zre=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var N0=0;N0"u"?[]:new Uint8Array(256);for(var k0=0;k0>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},Vre=function(n){for(var e=n.length,t=[],r=0;r>Nc,Kre=1<>Nc,Yre=r6+$re,Xre=Yre,Zre=32,Jre=Xre+Zre,qre=65536>>cT,eie=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Nc],t=(t<>Nc)],t=(t<>cT),t=this.index[t],t+=e>>Nc&tie,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var Q0=0;Q0sL?(i.push(!0),a-=sL):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(o),t.push(yC);if(a===lie||a===gC){if(o===0)return r.push(o),t.push(xc);var l=t[o-1];return mie.indexOf(l)===-1?(r.push(r[o-1]),t.push(l)):(r.push(o),t.push(xc))}if(r.push(o),a===hie)return t.push(e==="strict"?wC:Gm);if(a===a6||a===fie)return t.push(xc);if(a===die)return s>=131072&&s<=196605||s>=196608&&s<=262141?t.push(Gm):t.push(xc);t.push(a)}),[r,t,i]},Ib=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!==fA)break}if(i===fA)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!==fA)break}if(a!==fA)break}return!1},fL=function(n,e){for(var t=n;t>=0;){var r=e[t];if(r===fA)t--;else return r}return 0},yie=function(n,e,t,r,i){if(t[r]===0)return Tt;var s=r-1;if(Array.isArray(i)&&i[s]===!0)return Tt;var o=s-1,a=s+1,l=e[s],A=o>=0?e[o]:0,c=e[a];if(l===i6&&c===s6)return Tt;if(CC.indexOf(l)!==-1)return l6;if(CC.indexOf(c)!==-1||A6.indexOf(c)!==-1)return Tt;if(fL(s,e)===o6)return V0;if(EC.get(n[s])===gC||(l===z0||l===G0)&&EC.get(n[a])===gC||l===oL||c===oL||l===aL||[fA,vC,Sp].indexOf(l)===-1&&c===aL||[H0,Wd,uie,ku,Qu].indexOf(c)!==-1||fL(s,e)===Kd||Ib(Mb,Kd,s,e)||Ib([H0,Wd],wC,s,e)||Ib(lL,lL,s,e))return Tt;if(l===fA)return V0;if(l===Mb||c===Mb)return Tt;if(c===yC||l===yC)return V0;if([vC,Sp,wC].indexOf(c)!==-1||l===cie||A===bC&&gie.indexOf(l)!==-1||l===Qu&&c===bC||c===AL||Da.indexOf(c)!==-1&&l===Qi||Da.indexOf(l)!==-1&&c===Qi||l===Tp&&[Gm,z0,G0].indexOf(c)!==-1||[Gm,z0,G0].indexOf(l)!==-1&&c===Mp||Da.indexOf(l)!==-1&&cL.indexOf(c)!==-1||cL.indexOf(l)!==-1&&Da.indexOf(c)!==-1||[Tp,Mp].indexOf(l)!==-1&&(c===Qi||[Kd,Sp].indexOf(c)!==-1&&e[a+1]===Qi)||[Kd,Sp].indexOf(l)!==-1&&c===Qi||l===Qi&&[Qi,Qu,ku].indexOf(c)!==-1)return Tt;if([Qi,Qu,ku,H0,Wd].indexOf(c)!==-1)for(var u=s;u>=0;){var f=e[u];if(f===Qi)return Tt;if([Qu,ku].indexOf(f)!==-1)u--;else break}if([Tp,Mp].indexOf(c)!==-1)for(var u=[H0,Wd].indexOf(l)!==-1?o:s;u>=0;){var f=e[u];if(f===Qi)return Tt;if([Qu,ku].indexOf(f)!==-1)u--;else break}if(BC===l&&[BC,Ay,xC,_C].indexOf(c)!==-1||[Ay,xC].indexOf(l)!==-1&&[Ay,cy].indexOf(c)!==-1||[cy,_C].indexOf(l)!==-1&&c===cy||uL.indexOf(l)!==-1&&[AL,Mp].indexOf(c)!==-1||uL.indexOf(c)!==-1&&l===Tp||Da.indexOf(l)!==-1&&Da.indexOf(c)!==-1||l===ku&&Da.indexOf(c)!==-1||Da.concat(Qi).indexOf(l)!==-1&&c===Kd&&pie.indexOf(n[a])===-1||Da.concat(Qi).indexOf(c)!==-1&&l===Wd)return Tt;if(l===Tb&&c===Tb){for(var h=t[s],p=1;h>0&&(h--,e[h]===Tb);)p++;if(p%2!==0)return Tt}return l===z0&&c===G0?Tt:V0},wie=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=vie(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[Qi,xc,a6].indexOf(a)!==-1?Gm: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]},xie=function(){function n(e,t,r,i){this.codePoints=e,this.required=t===l6,this.start=r,this.end=i}return n.prototype.slice=function(){return Vn.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),_ie=function(n,e){var t=Kx(n),r=wie(t,e),i=r[0],s=r[1],o=r[2],a=t.length,l=0,A=0;return{next:function(){if(A>=a)return{done:!0,value:null};for(var c=Tt;A=c6&&n<=57},nse=function(n){return n>=55296&&n<=57343},Hu=function(n){return Gr(n)||n>=h6&&n<=p6||n>=u6&&n<=Zie},rse=function(n){return n>=u6&&n<=qie},ise=function(n){return n>=h6&&n<=tse},sse=function(n){return rse(n)||ise(n)},ose=function(n){return n>=Hie},Y0=function(n){return n===bw||n===Eie||n===Cie},Bw=function(n){return sse(n)||ose(n)||n===Iie},gL=function(n){return Bw(n)||Gr(n)||n===wi},ase=function(n){return n>=jie&&n<=Wie||n===Kie||n>=$ie&&n<=Yie||n===Xie},Jl=function(n,e){return n!==im?!1:e!==bw},X0=function(n,e,t){return n===wi?Bw(e)||Jl(e,t):Bw(n)?!0:!!(n===im&&Jl(n,e))},Fb=function(n,e,t){return n===Sc||n===wi?Gr(e)?!0:e===Vm&&Gr(t):Gr(n===Vm?e:n)},lse=function(n){var e=0,t=1;(n[e]===Sc||n[e]===wi)&&(n[e]===wi&&(t=-1),e++);for(var r=[];Gr(n[e]);)r.push(n[e++]);var i=r.length?parseInt(Vn.apply(void 0,r),10):0;n[e]===Vm&&e++;for(var s=[];Gr(n[e]);)s.push(n[e++]);var o=s.length,a=o?parseInt(Vn.apply(void 0,s),10):0;(n[e]===d6||n[e]===f6)&&e++;var l=1;(n[e]===Sc||n[e]===wi)&&(n[e]===wi&&(l=-1),e++);for(var A=[];Gr(n[e]);)A.push(n[e++]);var c=A.length?parseInt(Vn.apply(void 0,A),10):0;return t*(i+a*Math.pow(10,-o))*Math.pow(10,l*c)},Ase={type:2},cse={type:3},use={type:4},fse={type:13},hse={type:8},dse={type:21},pse={type:9},mse={type:10},gse={type:11},vse={type:12},yse={type:14},Z0={type:23},wse={type:1},xse={type:25},_se={type:24},bse={type:26},Bse={type:27},Ese={type:28},Cse={type:29},Sse={type:31},SC={type:32},m6=function(){function n(){this._value=[]}return n.prototype.write=function(e){this._value=this._value.concat(Kx(e))},n.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==SC;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case j0:return this.consumeStringToken(j0);case Sie:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),i=this.peekCodePoint(2);if(gL(t)||Jl(r,i)){var s=X0(t,r,i)?Bie:bie,o=this.consumeName();return{type:5,value:o,flags:s}}break;case Mie:if(this.peekCodePoint(0)===$d)return this.consumeCodePoint(),fse;break;case W0:return this.consumeStringToken(W0);case K0:return Ase;case Yd:return cse;case Rb:if(this.peekCodePoint(0)===$d)return this.consumeCodePoint(),yse;break;case Sc:if(Fb(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case zie:return use;case wi:var a=e,l=this.peekCodePoint(0),A=this.peekCodePoint(1);if(Fb(a,l,A))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(X0(a,l,A))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===wi&&A===Uie)return this.consumeCodePoint(),this.consumeCodePoint(),_se;break;case Vm:if(Fb(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case dL:if(this.peekCodePoint(0)===Rb)for(this.consumeCodePoint();;){var c=this.consumeCodePoint();if(c===Rb&&(c=this.consumeCodePoint(),c===dL))return this.consumeToken();if(c===Lo)return this.consumeToken()}break;case Gie:return bse;case Vie:return Bse;case Fie:if(this.peekCodePoint(0)===Rie&&this.peekCodePoint(1)===wi&&this.peekCodePoint(2)===wi)return this.consumeCodePoint(),this.consumeCodePoint(),xse;break;case Lie:var u=this.peekCodePoint(0),f=this.peekCodePoint(1),h=this.peekCodePoint(2);if(X0(u,f,h)){var o=this.consumeName();return{type:7,value:o}}break;case Pie:return Ese;case im:if(Jl(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Die:return Cse;case Oie:if(this.peekCodePoint(0)===$d)return this.consumeCodePoint(),hse;break;case Nie:return gse;case kie:return vse;case Jie:case ese:var p=this.peekCodePoint(0),d=this.peekCodePoint(1);return p===Sc&&(Hu(d)||d===$0)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case pL:if(this.peekCodePoint(0)===$d)return this.consumeCodePoint(),pse;if(this.peekCodePoint(0)===pL)return this.consumeCodePoint(),dse;break;case Qie:if(this.peekCodePoint(0)===$d)return this.consumeCodePoint(),mse;break;case Lo:return SC}return Y0(e)?(this.consumeWhiteSpace(),Sse):Gr(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):Bw(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:Vn(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();Hu(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===$0&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var i=parseInt(Vn.apply(void 0,e.map(function(l){return l===$0?c6:l})),16),s=parseInt(Vn.apply(void 0,e.map(function(l){return l===$0?p6:l})),16);return{type:30,start:i,end:s}}var o=parseInt(Vn.apply(void 0,e),16);if(this.peekCodePoint(0)===wi&&Hu(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];Hu(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var s=parseInt(Vn.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)===K0?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===K0?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Lo)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===W0||t===j0){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Lo||this.peekCodePoint(0)===Yd)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),Z0)}for(;;){var i=this.consumeCodePoint();if(i===Lo||i===Yd)return{type:22,value:Vn.apply(void 0,e)};if(Y0(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Lo||this.peekCodePoint(0)===Yd?(this.consumeCodePoint(),{type:22,value:Vn.apply(void 0,e)}):(this.consumeBadUrlRemnants(),Z0);if(i===j0||i===W0||i===K0||ase(i))return this.consumeBadUrlRemnants(),Z0;if(i===im)if(Jl(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),Z0;else e.push(i)}},n.prototype.consumeWhiteSpace=function(){for(;Y0(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Yd||e===Lo)return;Jl(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+=Vn.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===Lo||i===void 0||i===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(i===bw)return this._value.splice(0,r),wse;if(i===im){var s=this._value[r+1];s!==Lo&&s!==void 0&&(s===bw?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):Jl(i,s)&&(t+=this.consumeStringSlice(r),t+=Vn(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=bg,r=this.peekCodePoint(0);for((r===Sc||r===wi)&&e.push(this.consumeCodePoint());Gr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(r===Vm&&Gr(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=hL;Gr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),i=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===d6||r===f6)&&((i===Sc||i===wi)&&Gr(s)||Gr(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=hL;Gr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[lse(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(X0(i,s,o)){var a=this.consumeName();return{type:15,number:t,flags:r,unit:a}}return i===Tie?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Hu(e)){for(var t=Vn(e);Hu(this.peekCodePoint(0))&&t.length<6;)t+=Vn(this.consumeCodePoint());Y0(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||nse(r)||r>1114111?mL:r}return e===Lo?mL:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(gL(t))e+=Vn(t);else if(Jl(t,this.peekCodePoint(0)))e+=Vn(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),g6=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new m6;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||Mse(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"?SC:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),Bg=function(n){return n.type===15},$x=function(n){return n.type===17},Hn=function(n){return n.type===20},MC=function(n,e){return Hn(n)&&n.value===e},Yx=function(n){return n.type!==31&&n.type!==4},Ba=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},Mse=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},QA=function(n){return n.type===17||n.type===15},nr=function(n){return n.type===16||QA(n)},v6=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},Lr={type:17,number:0,flags:bg},uT={type:16,number:50,flags:bg},hA={type:16,number:100,flags:bg},Ip=function(n,e,t){var r=n[0],i=n[1];return[ln(r,e),ln(typeof i<"u"?i:r,t)]},ln=function(n,e){if(n.type===16)return n.number/100*e;if(Bg(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},y6="deg",w6="grad",x6="rad",_6="turn",Xx={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case y6:return Math.PI*e.number/180;case w6:return Math.PI/200*e.number;case x6:return e.number;case _6:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},b6=function(n){return n.type===15&&(n.unit===y6||n.unit===w6||n.unit===x6||n.unit===_6)},B6=function(n){var e=n.filter(Hn).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Lr,Lr];case"to top":case"bottom":return Os(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Lr,hA];case"to right":case"left":return Os(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[hA,hA];case"to bottom":case"top":return Os(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[hA,Lr];case"to left":case"right":return Os(270)}return 0},Os=function(n){return Math.PI*n/180},MA={name:"color",parse:function(n,e){if(e.type===18){var t=Tse[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 dA(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 dA(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 dA(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 dA(parseInt(r,16),parseInt(i,16),parseInt(s,16),parseInt(o,16)/255)}}if(e.type===20){var a=jm[e.value.toUpperCase()];if(typeof a<"u")return a}return jm.TRANSPARENT}},uh=function(n){return(255&n)===0},yr=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+")"},dA=function(n,e,t,r){return(n<<24|e<<16|t<<8|Math.round(r*255)<<0)>>>0},vL=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},yL=function(n,e){var t=e.filter(Yx);if(t.length===3){var r=t.map(vL),i=r[0],s=r[1],o=r[2];return dA(i,s,o,1)}if(t.length===4){var a=t.map(vL),i=a[0],s=a[1],o=a[2],l=a[3];return dA(i,s,o,l)}return 0};function Ub(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 wL=function(n,e){var t=e.filter(Yx),r=t[0],i=t[1],s=t[2],o=t[3],a=(r.type===17?Os(r.number):Xx.parse(n,r))/(Math.PI*2),l=nr(i)?i.number/100:0,A=nr(s)?s.number/100:0,c=typeof o<"u"&&nr(o)?ln(o,1):1;if(l===0)return dA(A*255,A*255,A*255,1);var u=A<=.5?A*(l+1):A+l-A*l,f=A*2-u,h=Ub(f,u,a+1/3),p=Ub(f,u,a),d=Ub(f,u,a-1/3);return dA(h*255,p*255,d*255,c)},Tse={hsl:wL,hsla:wL,rgb:yL,rgba:yL},xL=function(n,e){return MA.parse(n,g6.create(e).parseComponentValue())},jm={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},Ise={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(Hn(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Rse={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Zx=function(n,e){var t=MA.parse(n,e[0]),r=e[1];return r&&nr(r)?{color:t,stop:r}:{color:t,stop:null}},_L=function(n,e){var t=n[0],r=n[n.length-1];t.stop===null&&(t.stop=Lr),r.stop===null&&(r.stop=hA);for(var i=[],s=0,o=0;os?i.push(l):i.push(s),s=l}else i.push(null)}for(var A=null,o=0;oo.optimumDistance)?{optimumCorner:a,optimumDistance:c}:o},{optimumDistance:i?1/0:-1/0,optimumCorner:null}).optimumCorner},Lse=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(fo(e,t),fo(e,t-i),fo(e-r,t),fo(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=bL(r,i,e,t,!0),A=l[0],c=l[1];s=fo(A-e,(c-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(fo(e,t),fo(e,t-i),fo(e-r,t),fo(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=bL(r,i,e,t,!1),A=u[0],c=u[1];s=fo(A-e,(c-t)/a),o=a*s}break}return Array.isArray(n.size)&&(s=ln(n.size[0],r),o=n.size.length===2?ln(n.size[1],i):s),[s,o]},Pse=function(n,e){var t=Os(180),r=[];return Ba(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&o.value==="to"){t=B6(i);return}else if(b6(o)){t=Xx.parse(n,o);return}}var a=Zx(n,i);r.push(a)}),{angle:t,stops:r,type:1}},J0=function(n,e){var t=Os(180),r=[];return Ba(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=B6(i);return}else if(b6(o)){t=(Xx.parse(n,o)+Os(270))%Os(360);return}}var a=Zx(n,i);r.push(a)}),{angle:t,stops:r,type:1}},Dse=function(n,e){var t=Os(180),r=[],i=1,s=0,o=3,a=[];return Ba(e).forEach(function(l,A){var c=l[0];if(A===0){if(Hn(c)&&c.value==="linear"){i=1;return}else if(Hn(c)&&c.value==="radial"){i=2;return}}if(c.type===18){if(c.name==="from"){var u=MA.parse(n,c.values[0]);r.push({stop:Lr,color:u})}else if(c.name==="to"){var u=MA.parse(n,c.values[0]);r.push({stop:hA,color:u})}else if(c.name==="color-stop"){var f=c.values.filter(Yx);if(f.length===2){var u=MA.parse(n,f[1]),h=f[0];$x(h)&&r.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(t+Os(180))%Os(360),stops:r,type:i}:{size:o,shape:s,stops:r,position:a,type:i}},E6="closest-side",C6="farthest-side",S6="closest-corner",M6="farthest-corner",T6="circle",I6="ellipse",R6="cover",F6="contain",Ose=function(n,e){var t=0,r=3,i=[],s=[];return Ba(e).forEach(function(o,a){var l=!0;if(a===0){var A=!1;l=o.reduce(function(u,f){if(A)if(Hn(f))switch(f.value){case"center":return s.push(uT),u;case"top":case"left":return s.push(Lr),u;case"right":case"bottom":return s.push(hA),u}else(nr(f)||QA(f))&&s.push(f);else if(Hn(f))switch(f.value){case T6:return t=0,!1;case I6:return t=1,!1;case"at":return A=!0,!1;case E6:return r=0,!1;case R6:case C6:return r=1,!1;case F6:case S6:return r=2,!1;case M6:return r=3,!1}else if(QA(f)||nr(f))return Array.isArray(r)||(r=[]),r.push(f),!1;return u},l)}if(l){var c=Zx(n,o);i.push(c)}}),{size:r,shape:t,stops:i,position:s,type:2}},q0=function(n,e){var t=0,r=3,i=[],s=[];return Ba(e).forEach(function(o,a){var l=!0;if(a===0?l=o.reduce(function(c,u){if(Hn(u))switch(u.value){case"center":return s.push(uT),!1;case"top":case"left":return s.push(Lr),!1;case"right":case"bottom":return s.push(hA),!1}else if(nr(u)||QA(u))return s.push(u),!1;return c},l):a===1&&(l=o.reduce(function(c,u){if(Hn(u))switch(u.value){case T6:return t=0,!1;case I6:return t=1,!1;case F6:case E6:return r=0,!1;case C6:return r=1,!1;case S6:return r=2,!1;case R6:case M6:return r=3,!1}else if(QA(u)||nr(u))return Array.isArray(r)||(r=[]),r.push(u),!1;return c},l)),l){var A=Zx(n,o);i.push(A)}}),{size:r,shape:t,stops:i,position:s,type:2}},Nse=function(n){return n.type===1},kse=function(n){return n.type===2},fT={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=U6[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 Qse(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!U6[n.name])}var U6={"linear-gradient":Pse,"-moz-linear-gradient":J0,"-ms-linear-gradient":J0,"-o-linear-gradient":J0,"-webkit-linear-gradient":J0,"radial-gradient":Ose,"-moz-radial-gradient":q0,"-ms-radial-gradient":q0,"-o-radial-gradient":q0,"-webkit-radial-gradient":q0,"-webkit-gradient":Dse},Hse={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 Yx(r)&&Qse(r)}).map(function(r){return fT.parse(n,r)})}},zse={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(Hn(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Gse={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return Ba(e).map(function(t){return t.filter(nr)}).map(v6)}},Vse={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return Ba(e).map(function(t){return t.filter(Hn).map(function(r){return r.value}).join(" ")}).map(jse)}},jse=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}},fh;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(fh||(fh={}));var Wse={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return Ba(e).map(function(t){return t.filter(Kse)})}},Kse=function(n){return Hn(n)||nr(n)},Jx=function(n){return{name:"border-"+n+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},$se=Jx("top"),Yse=Jx("right"),Xse=Jx("bottom"),Zse=Jx("left"),qx=function(n){return{name:"border-radius-"+n,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return v6(t.filter(nr))}}},Jse=qx("top-left"),qse=qx("top-right"),eoe=qx("bottom-right"),toe=qx("bottom-left"),e_=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}}},noe=e_("top"),roe=e_("right"),ioe=e_("bottom"),soe=e_("left"),t_=function(n){return{name:"border-"+n+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return Bg(t)?t.number:0}}},ooe=t_("top"),aoe=t_("right"),loe=t_("bottom"),Aoe=t_("left"),coe={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},uoe={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},foe={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(Hn).reduce(function(t,r){return t|hoe(r.value)},0)}},hoe=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},doe={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}},poe={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}},Ew;(function(n){n.NORMAL="normal",n.STRICT="strict"})(Ew||(Ew={}));var moe={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return Ew.STRICT;case"normal":default:return Ew.NORMAL}}},goe={name:"line-height",initialValue:"normal",prefix:!1,type:4},BL=function(n,e){return Hn(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:nr(n)?ln(n,e):e},voe={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:fT.parse(n,e)}},yoe={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}}},woe={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}}},n_=function(n){return{name:"margin-"+n,initialValue:"0",prefix:!1,type:4}},xoe=n_("top"),_oe=n_("right"),boe=n_("bottom"),Boe=n_("left"),Eoe={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(Hn).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}})}},Coe={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"}}},r_=function(n){return{name:"padding-"+n,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},Soe=r_("top"),Moe=r_("right"),Toe=r_("bottom"),Ioe=r_("left"),Roe={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}}},Foe={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}},Uoe={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&MC(e[0],"none")?[]:Ba(e).map(function(t){for(var r={color:jm.TRANSPARENT,offsetX:Lr,offsetY:Lr,blur:Lr},i=0,s=0;s"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},Doe=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},Ooe=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},Noe={matrix:Doe,matrix3d:Ooe},EL={type:16,number:50,flags:bg},koe=[EL,EL],Qoe={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(nr);return t.length!==2?koe:[t[0],t[1]]}},Hoe={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}}},sm;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(sm||(sm={}));var zoe={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return sm.BREAK_ALL;case"keep-all":return sm.KEEP_ALL;case"normal":default:return sm.NORMAL}}},Goe={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if($x(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},L6={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")}},Voe={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return $x(e)?e.number:1}},joe={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Woe={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(Hn).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})}},Koe={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+"'"})}},$oe={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},Yoe={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if($x(e))return e.number;if(Hn(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},Xoe={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(Hn).map(function(t){return t.value})}},Zoe={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"}}},dr=function(n,e){return(n&e)!==0},Joe={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(Bg).map(function(t){return L6.parse(n,t)})}},qoe={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&MC(e[0],"none")?[]:Ba(e).map(function(t){for(var r={color:255,offsetX:Lr,offsetY:Lr,blur:Lr,spread:Lr,inset:!1},i=0,s=0;s1?1:0],this.overflowWrap=Xe(e,Coe,t.overflowWrap),this.paddingTop=Xe(e,Soe,t.paddingTop),this.paddingRight=Xe(e,Moe,t.paddingRight),this.paddingBottom=Xe(e,Toe,t.paddingBottom),this.paddingLeft=Xe(e,Ioe,t.paddingLeft),this.paintOrder=Xe(e,eae,t.paintOrder),this.position=Xe(e,Foe,t.position),this.textAlign=Xe(e,Roe,t.textAlign),this.textDecorationColor=Xe(e,joe,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=Xe(e,Woe,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=Xe(e,Uoe,t.textShadow),this.textTransform=Xe(e,Loe,t.textTransform),this.transform=Xe(e,Poe,t.transform),this.transformOrigin=Xe(e,Qoe,t.transformOrigin),this.visibility=Xe(e,Hoe,t.visibility),this.webkitTextStrokeColor=Xe(e,tae,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=Xe(e,nae,t.webkitTextStrokeWidth),this.wordBreak=Xe(e,zoe,t.wordBreak),this.zIndex=Xe(e,Goe,t.zIndex)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return uh(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 dr(this.display,4)||dr(this.display,33554432)||dr(this.display,268435456)||dr(this.display,536870912)||dr(this.display,67108864)||dr(this.display,134217728)},n}(),Xe=function(n,e,t){var r=new m6,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(i);var s=new g6(r.read());switch(e.type){case 2:var o=s.parseComponentValue();return e.parse(n,Hn(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 Xx.parse(n,s.parseComponentValue());case"color":return MA.parse(n,s.parseComponentValue());case"image":return fT.parse(n,s.parseComponentValue());case"length":var a=s.parseComponentValue();return QA(a)?a:Lr;case"length-percentage":var l=s.parseComponentValue();return nr(l)?l:Lr;case"time":return L6.parse(n,s.parseComponentValue())}break}},iae="data-html2canvas-debug",sae=function(n){var e=n.getAttribute(iae);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},CL=function(n,e){var t=sae(n);return t===1||e===t},Ea=function(){function n(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,CL(t,3))debugger;this.styles=new rae(e,window.getComputedStyle(t,null)),sle(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=AT(this.context,t),CL(t,4)&&(this.flags|=16)}return n}(),oae="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",SL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Rp=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var ev=0;ev>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},lae=function(n){for(var e=n.length,t=[],r=0;r>kc,uae=1<>kc,hae=P6+fae,dae=hae,pae=32,mae=dae+pae,gae=65536>>hT,vae=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>kc],t=(t<>kc)],t=(t<>hT),t=this.index[t],t+=e>>kc&yae,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var tv=0;tv=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},Mae=xae(oae),Cs="×",Hb="÷",Tae=function(n){return Mae.get(n)},Iae=function(n,e,t){var r=t-2,i=e[r],s=e[t-1],o=e[t];if(s===Db&&o===Ob)return Cs;if(s===Db||s===Ob||s===IL||o===Db||o===Ob||o===IL)return Hb;if(s===FL&&[FL,Nb,UL,LL].indexOf(o)!==-1||(s===UL||s===Nb)&&(o===Nb||o===kb)||(s===LL||s===kb)&&o===kb||o===PL||o===RL||o===Eae||s===Bae)return Cs;if(s===PL&&o===DL){for(;i===RL;)i=e[--r];if(i===DL)return Cs}if(s===Qb&&o===Qb){for(var a=0;i===Qb;)a++,i=e[--r];if(a%2===0)return Cs}return Hb},Rae=function(n){var e=Cae(n),t=e.length,r=0,i=0,s=e.map(Tae);return{next:function(){if(r>=t)return{done:!0,value:null};for(var o=Cs;ro.x||c.y>o.y;return o=c,A===0?!0:u});return n.body.removeChild(e),a},Pae=function(){return typeof new Image().crossOrigin<"u"},Dae=function(){return typeof new XMLHttpRequest().responseType=="string"},Oae=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},OL=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},Nae=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=TC(t,t,0,0,i);return r.fillStyle="red",r.fillRect(0,0,t,t),NL(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 A=n.createElement("div");return A.style.backgroundImage="url("+s+")",A.style.height=t+"px",OL(l)?NL(TC(t,t,0,0,A)):Promise.reject(!1)}).then(function(a){return r.drawImage(a,0,0),OL(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},TC=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},NL=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))})},Vi={get SUPPORT_RANGE_BOUNDS(){var n=Uae(document);return Object.defineProperty(Vi,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=Vi.SUPPORT_RANGE_BOUNDS&&Lae(document);return Object.defineProperty(Vi,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=Oae(document);return Object.defineProperty(Vi,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?Nae(document):Promise.resolve(!1);return Object.defineProperty(Vi,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=Pae();return Object.defineProperty(Vi,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=Dae();return Object.defineProperty(Vi,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Vi,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Vi,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},om=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),kae=function(n,e,t,r){var i=zae(e,t),s=[],o=0;return i.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(Vi.SUPPORT_RANGE_BOUNDS){var l=kL(r,o,a.length).getClientRects();if(l.length>1){var A=dT(a),c=0;A.forEach(function(f){s.push(new om(f,Zc.fromDOMRectList(n,kL(r,c+o,f.length).getClientRects()))),c+=f.length})}else s.push(new om(a,Zc.fromDOMRectList(n,l)))}else{var u=r.splitText(a.length);s.push(new om(a,Qae(n,r))),r=u}else Vi.SUPPORT_RANGE_BOUNDS||(r=r.splitText(a.length));o+=a.length}),s},Qae=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=AT(n,r);return r.firstChild&&i.replaceChild(r.firstChild,r),s}}return Zc.EMPTY},kL=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},dT=function(n){if(Vi.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 Fae(n)},Hae=function(n,e){if(Vi.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 Vae(n,e)},zae=function(n,e){return e.letterSpacing!==0?dT(n):Hae(n,e)},Gae=[32,160,4961,65792,65793,4153,4241],Vae=function(n,e){for(var t=_ie(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=Kx(o),l="";a.forEach(function(A){Gae.indexOf(A)===-1?l+=Vn(A):(l.length&&r.push(l),r.push(Vn(A)),l="")}),l.length&&r.push(l)}};!(i=t.next()).done;)s();return r},jae=function(){function n(e,t,r){this.text=Wae(t.data,r.textTransform),this.textBounds=kae(e,this.text,r,t)}return n}(),Wae=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(Kae,$ae);case 2:return n.toUpperCase();default:return n}},Kae=/(^|\s|:|-|\(|\))([a-z])/g,$ae=function(n,e,t){return n.length>0?e+t.toUpperCase():n},D6=function(n){To(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}(Ea),O6=function(n){To(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}(Ea),N6=function(n){To(e,n);function e(t,r){var i=n.call(this,t,r)||this,s=new XMLSerializer,o=AT(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}(Ea),k6=function(n){To(e,n);function e(t,r){var i=n.call(this,t,r)||this;return i.value=r.value,i}return e}(Ea),IC=function(n){To(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}(Ea),Yae=[{type:15,flags:0,unit:"px",number:3}],Xae=[{type:16,flags:0,number:50}],Zae=function(n){return n.width>n.height?new Zc(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width0)t.textNodes.push(new jae(n,i,t.styles));else if(V6(i))if(dle(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return uy(n,a,t,r)});else{var o=G6(n,i);o.styles.isVisible()&&(nle(i,o,r)?o.flags|=4:rle(o.styles)&&(o.flags|=2),ele.indexOf(i.tagName)!==-1&&(o.flags|=8),t.elements.push(o),i.slot,i.shadowRoot?uy(n,i.shadowRoot,o,r):!W6(i)&&!j6(i)&&!K6(i)&&uy(n,i,o,r))}},G6=function(n,e){return fle(e)?new D6(n,e):ule(e)?new O6(n,e):j6(e)?new N6(n,e):ale(e)?new k6(n,e):lle(e)?new IC(n,e):Ale(e)?new pT(n,e):K6(e)?new Q6(n,e):W6(e)?new H6(n,e):hle(e)?new z6(n,e):new Ea(n,e)},tle=function(n,e){var t=G6(n,e);return t.flags|=4,uy(n,e,t,t),t},nle=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||cle(n)&&t.styles.isTransparent()},rle=function(n){return n.isPositioned()||n.isFloating()},ile=function(n){return n.nodeType===Node.TEXT_NODE},V6=function(n){return n.nodeType===Node.ELEMENT_NODE},sle=function(n){return V6(n)&&typeof n.style<"u"&&!ole(n)},ole=function(n){return typeof n.className=="object"},ale=function(n){return n.tagName==="LI"},lle=function(n){return n.tagName==="OL"},Ale=function(n){return n.tagName==="INPUT"},j6=function(n){return n.tagName==="svg"},cle=function(n){return n.tagName==="BODY"},ule=function(n){return n.tagName==="CANVAS"},fle=function(n){return n.tagName==="IMG"},hle=function(n){return n.tagName==="IFRAME"},W6=function(n){return n.tagName==="TEXTAREA"},K6=function(n){return n.tagName==="SELECT"},dle=function(n){return n.tagName==="SLOT"},HL={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"]},zL={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},ple={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},mle={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},zu=function(n,e,t,r,i,s){return nt?mT(n,i,s.length>0):r.integers.reduce(function(o,a,l){for(;n>=a;)n-=a,o+=r.values[l];return o},"")+s},$6=function(n,e,t,r){var i="";do t||n--,i=r(n)+i,n/=e;while(n*e>=e);return i},zn=function(n,e,t,r,i){var s=t-e+1;return(n<0?"-":"")+($6(Math.abs(n),s,r,function(o){return Vn(Math.floor(o%s)+e)})+i)},ac=function(n,e,t){t===void 0&&(t=". ");var r=e.length;return $6(Math.abs(n),r,!1,function(i){return e[Math.floor(i%r)]})+t},rf=1,Kl=2,$l=4,Fp=8,Oa=function(n,e,t,r,i,s){if(n<-9999||n>9999)return mT(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 A=o%10;A===0&&dr(s,rf)&&a!==""?a=e[A]+a:A>1||A===1&&l===0||A===1&&l===1&&dr(s,Kl)||A===1&&l===1&&dr(s,$l)&&n>100||A===1&&l>1&&dr(s,Fp)?a=e[A]+(l>0?t[l-1]:"")+a:A===1&&l>0&&(a=t[l-1]+a),o=Math.floor(o/10)}return(n<0?r:"")+a},GL="十百千萬",VL="拾佰仟萬",jL="マイナス",zb="마이너스",mT=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=zn(n,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return ac(n,"〇一二三四五六七八九",i);case 6:return zu(n,1,3999,HL,3,r).toLowerCase();case 7:return zu(n,1,3999,HL,3,r);case 8:return zn(n,945,969,!1,r);case 9:return zn(n,97,122,!1,r);case 10:return zn(n,65,90,!1,r);case 11:return zn(n,1632,1641,!0,r);case 12:case 49:return zu(n,1,9999,zL,3,r);case 35:return zu(n,1,9999,zL,3,r).toLowerCase();case 13:return zn(n,2534,2543,!0,r);case 14:case 30:return zn(n,6112,6121,!0,r);case 15:return ac(n,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return ac(n,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return Oa(n,"零一二三四五六七八九",GL,"負",i,Kl|$l|Fp);case 47:return Oa(n,"零壹貳參肆伍陸柒捌玖",VL,"負",i,rf|Kl|$l|Fp);case 42:return Oa(n,"零一二三四五六七八九",GL,"负",i,Kl|$l|Fp);case 41:return Oa(n,"零壹贰叁肆伍陆柒捌玖",VL,"负",i,rf|Kl|$l|Fp);case 26:return Oa(n,"〇一二三四五六七八九","十百千万",jL,i,0);case 25:return Oa(n,"零壱弐参四伍六七八九","拾百千万",jL,i,rf|Kl|$l);case 31:return Oa(n,"영일이삼사오육칠팔구","십백천만",zb,s,rf|Kl|$l);case 33:return Oa(n,"零一二三四五六七八九","十百千萬",zb,s,0);case 32:return Oa(n,"零壹貳參四五六七八九","拾百千",zb,s,rf|Kl|$l);case 18:return zn(n,2406,2415,!0,r);case 20:return zu(n,1,19999,mle,3,r);case 21:return zn(n,2790,2799,!0,r);case 22:return zn(n,2662,2671,!0,r);case 22:return zu(n,1,10999,ple,3,r);case 23:return ac(n,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return ac(n,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return zn(n,3302,3311,!0,r);case 28:return ac(n,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return ac(n,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return zn(n,3792,3801,!0,r);case 37:return zn(n,6160,6169,!0,r);case 38:return zn(n,4160,4169,!0,r);case 39:return zn(n,2918,2927,!0,r);case 40:return zn(n,1776,1785,!0,r);case 43:return zn(n,3046,3055,!0,r);case 44:return zn(n,3174,3183,!0,r);case 45:return zn(n,3664,3673,!0,r);case 46:return zn(n,3872,3881,!0,r);case 3:default:return zn(n,48,57,!0,r)}},WL;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(WL||(WL={}));var gle=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}(),Ke=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}(),Gu=function(n,e,t){return new Ke(n.x+(e.x-n.x)*t,n.y+(e.y-n.y)*t)},nv=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=Gu(this.start,this.startControl,e),i=Gu(this.startControl,this.endControl,e),s=Gu(this.endControl,this.end,e),o=Gu(r,i,e),a=Gu(i,s,e),l=Gu(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}(),Is=function(n){return n.type===1},vle=function(){function n(e){var t=e.styles,r=e.bounds,i=Ip(t.borderTopLeftRadius,r.width,r.height),s=i[0],o=i[1],a=Ip(t.borderTopRightRadius,r.width,r.height),l=a[0],A=a[1],c=Ip(t.borderBottomRightRadius,r.width,r.height),u=c[0],f=c[1],h=Ip(t.borderBottomLeftRadius,r.width,r.height),p=h[0],d=h[1],g=[];g.push((s+l)/r.width),g.push((p+u)/r.width),g.push((o+d)/r.height),g.push((A+f)/r.height);var m=Math.max.apply(Math,g);m>1&&(s/=m,o/=m,l/=m,A/=m,u/=m,f/=m,p/=m,d/=m);var y=r.width-l,w=r.height-f,x=r.width-u,_=r.height-d,C=t.borderTopWidth,S=t.borderRightWidth,b=t.borderBottomWidth,M=t.borderLeftWidth,D=ln(t.paddingTop,e.bounds.width),$=ln(t.paddingRight,e.bounds.width),H=ln(t.paddingBottom,e.bounds.width),I=ln(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?mn(r.left+M/3,r.top+C/3,s-M/3,o-C/3,jt.TOP_LEFT):new Ke(r.left+M/3,r.top+C/3),this.topRightBorderDoubleOuterBox=s>0||o>0?mn(r.left+y,r.top+C/3,l-S/3,A-C/3,jt.TOP_RIGHT):new Ke(r.left+r.width-S/3,r.top+C/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?mn(r.left+x,r.top+w,u-S/3,f-b/3,jt.BOTTOM_RIGHT):new Ke(r.left+r.width-S/3,r.top+r.height-b/3),this.bottomLeftBorderDoubleOuterBox=p>0||d>0?mn(r.left+M/3,r.top+_,p-M/3,d-b/3,jt.BOTTOM_LEFT):new Ke(r.left+M/3,r.top+r.height-b/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?mn(r.left+M*2/3,r.top+C*2/3,s-M*2/3,o-C*2/3,jt.TOP_LEFT):new Ke(r.left+M*2/3,r.top+C*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?mn(r.left+y,r.top+C*2/3,l-S*2/3,A-C*2/3,jt.TOP_RIGHT):new Ke(r.left+r.width-S*2/3,r.top+C*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?mn(r.left+x,r.top+w,u-S*2/3,f-b*2/3,jt.BOTTOM_RIGHT):new Ke(r.left+r.width-S*2/3,r.top+r.height-b*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||d>0?mn(r.left+M*2/3,r.top+_,p-M*2/3,d-b*2/3,jt.BOTTOM_LEFT):new Ke(r.left+M*2/3,r.top+r.height-b*2/3),this.topLeftBorderStroke=s>0||o>0?mn(r.left+M/2,r.top+C/2,s-M/2,o-C/2,jt.TOP_LEFT):new Ke(r.left+M/2,r.top+C/2),this.topRightBorderStroke=s>0||o>0?mn(r.left+y,r.top+C/2,l-S/2,A-C/2,jt.TOP_RIGHT):new Ke(r.left+r.width-S/2,r.top+C/2),this.bottomRightBorderStroke=u>0||f>0?mn(r.left+x,r.top+w,u-S/2,f-b/2,jt.BOTTOM_RIGHT):new Ke(r.left+r.width-S/2,r.top+r.height-b/2),this.bottomLeftBorderStroke=p>0||d>0?mn(r.left+M/2,r.top+_,p-M/2,d-b/2,jt.BOTTOM_LEFT):new Ke(r.left+M/2,r.top+r.height-b/2),this.topLeftBorderBox=s>0||o>0?mn(r.left,r.top,s,o,jt.TOP_LEFT):new Ke(r.left,r.top),this.topRightBorderBox=l>0||A>0?mn(r.left+y,r.top,l,A,jt.TOP_RIGHT):new Ke(r.left+r.width,r.top),this.bottomRightBorderBox=u>0||f>0?mn(r.left+x,r.top+w,u,f,jt.BOTTOM_RIGHT):new Ke(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=p>0||d>0?mn(r.left,r.top+_,p,d,jt.BOTTOM_LEFT):new Ke(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||o>0?mn(r.left+M,r.top+C,Math.max(0,s-M),Math.max(0,o-C),jt.TOP_LEFT):new Ke(r.left+M,r.top+C),this.topRightPaddingBox=l>0||A>0?mn(r.left+Math.min(y,r.width-S),r.top+C,y>r.width+S?0:Math.max(0,l-S),Math.max(0,A-C),jt.TOP_RIGHT):new Ke(r.left+r.width-S,r.top+C),this.bottomRightPaddingBox=u>0||f>0?mn(r.left+Math.min(x,r.width-M),r.top+Math.min(w,r.height-b),Math.max(0,u-S),Math.max(0,f-b),jt.BOTTOM_RIGHT):new Ke(r.left+r.width-S,r.top+r.height-b),this.bottomLeftPaddingBox=p>0||d>0?mn(r.left+M,r.top+Math.min(_,r.height-b),Math.max(0,p-M),Math.max(0,d-b),jt.BOTTOM_LEFT):new Ke(r.left+M,r.top+r.height-b),this.topLeftContentBox=s>0||o>0?mn(r.left+M+I,r.top+C+D,Math.max(0,s-(M+I)),Math.max(0,o-(C+D)),jt.TOP_LEFT):new Ke(r.left+M+I,r.top+C+D),this.topRightContentBox=l>0||A>0?mn(r.left+Math.min(y,r.width+M+I),r.top+C+D,y>r.width+M+I?0:l-M+I,A-(C+D),jt.TOP_RIGHT):new Ke(r.left+r.width-(S+$),r.top+C+D),this.bottomRightContentBox=u>0||f>0?mn(r.left+Math.min(x,r.width-(M+I)),r.top+Math.min(w,r.height+C+D),Math.max(0,u-(S+$)),f-(b+H),jt.BOTTOM_RIGHT):new Ke(r.left+r.width-(S+$),r.top+r.height-(b+H)),this.bottomLeftContentBox=p>0||d>0?mn(r.left+M+I,r.top+_,Math.max(0,p-(M+I)),d-(b+H),jt.BOTTOM_LEFT):new Ke(r.left+M+I,r.top+r.height-(b+H))}return n}(),jt;(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"})(jt||(jt={}));var mn=function(n,e,t,r,i){var s=4*((Math.sqrt(2)-1)/3),o=t*s,a=r*s,l=n+t,A=e+r;switch(i){case jt.TOP_LEFT:return new nv(new Ke(n,A),new Ke(n,A-a),new Ke(l-o,e),new Ke(l,e));case jt.TOP_RIGHT:return new nv(new Ke(n,e),new Ke(n+o,e),new Ke(l,A-a),new Ke(l,A));case jt.BOTTOM_RIGHT:return new nv(new Ke(l,e),new Ke(l,e+a),new Ke(n+o,A),new Ke(n,A));case jt.BOTTOM_LEFT:default:return new nv(new Ke(l,A),new Ke(l-o,A),new Ke(n,e+a),new Ke(n,e))}},Mw=function(n){return[n.topLeftBorderBox,n.topRightBorderBox,n.bottomRightBorderBox,n.bottomLeftBorderBox]},yle=function(n){return[n.topLeftContentBox,n.topRightContentBox,n.bottomRightContentBox,n.bottomLeftContentBox]},Tw=function(n){return[n.topLeftPaddingBox,n.topRightPaddingBox,n.bottomRightPaddingBox,n.bottomLeftPaddingBox]},wle=function(){function n(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return n}(),rv=function(){function n(e,t){this.path=e,this.target=t,this.type=1}return n}(),xle=function(){function n(e){this.opacity=e,this.type=2,this.target=6}return n}(),_le=function(n){return n.type===0},Y6=function(n){return n.type===1},ble=function(n){return n.type===2},KL=function(n,e){return n.length===e.length?n.some(function(t,r){return t===e[r]}):!1},Ble=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})},X6=function(){function n(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return n}(),Z6=function(){function n(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new vle(this.container),this.container.styles.opacity<1&&this.effects.push(new xle(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 wle(r,i,s))}if(this.container.styles.overflowX!==0){var o=Mw(this.curves),a=Tw(this.curves);KL(o,a)?this.effects.push(new rv(o,6)):(this.effects.push(new rv(o,2)),this.effects.push(new rv(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!Y6(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=Mw(r.curves),a=Tw(r.curves);KL(o,a)||i.unshift(new rv(a,6))}}else i.unshift.apply(i,s);r=r.parent}return i.filter(function(l){return dr(l.target,e)})},n}(),RC=function(n,e,t,r){n.container.elements.forEach(function(i){var s=dr(i.flags,4),o=dr(i.flags,2),a=new Z6(i,n);dr(i.styles.display,2048)&&r.push(a);var l=dr(i.flags,8)?[]:r;if(s||o){var A=s||i.styles.isPositioned()?t:e,c=new X6(a);if(i.styles.isPositioned()||i.styles.opacity<1||i.styles.isTransformed()){var u=i.styles.zIndex.order;if(u<0){var f=0;A.negativeZIndex.some(function(p,d){return u>p.element.container.styles.zIndex.order?(f=d,!1):f>0}),A.negativeZIndex.splice(f,0,c)}else if(u>0){var h=0;A.positiveZIndex.some(function(p,d){return u>=p.element.container.styles.zIndex.order?(h=d+1,!1):h>0}),A.positiveZIndex.splice(h,0,c)}else A.zeroOrAutoZIndexOrTransformedOrOpacity.push(c)}else i.styles.isFloating()?A.nonPositionedFloats.push(c):A.nonPositionedInlineLevel.push(c);RC(a,c,s?c:t,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),RC(a,e,t,l);dr(i.flags,8)&&J6(i,l)})},J6=function(n,e){for(var t=n instanceof IC?n.start:1,r=n instanceof IC?n.reversed:!1,i=0;i"u"?n[0]:t},Fle=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 Ke(Math.round(r.left),Math.round(r.top+o)),new Ke(Math.round(r.left+r.width),Math.round(r.top+o)),new Ke(Math.round(r.left+r.width),Math.round(l+r.top+o)),new Ke(Math.round(r.left),Math.round(l+r.top+o))];case 3:return[new Ke(Math.round(r.left+s),Math.round(r.top)),new Ke(Math.round(r.left+s+a),Math.round(r.top)),new Ke(Math.round(r.left+s+a),Math.round(r.height+r.top)),new Ke(Math.round(r.left+s),Math.round(r.height+r.top))];case 1:return[new Ke(Math.round(r.left+s),Math.round(r.top+o)),new Ke(Math.round(r.left+s+a),Math.round(r.top+o)),new Ke(Math.round(r.left+s+a),Math.round(r.top+o+l)),new Ke(Math.round(r.left+s),Math.round(r.top+o+l))];default:return[new Ke(Math.round(i.left),Math.round(i.top)),new Ke(Math.round(i.left+i.width),Math.round(i.top)),new Ke(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Ke(Math.round(i.left),Math.round(i.height+i.top))]}},Ule="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",YL="Hidden Text",Lle=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=Ule,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(YL)),r.appendChild(s),r.appendChild(i);var a=i.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(YL)),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}(),e5=function(){function n(e,t){this.context=e,this.options=t}return n}(),Ple=1e4;(function(n){To(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 Lle(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(),ble(t)&&(this.ctx.globalAlpha=t.opacity),_le(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)),Y6(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 xs(this,void 0,void 0,function(){var r;return ki(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 xs(this,void 0,void 0,function(){return ki(this,function(r){switch(r.label){case 0:if(dr(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=dT(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=Qle(t.fontFamily).join(", "),s=Bg(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 xs(this,void 0,void 0,function(){var i,s,o,a,l,A,c,u,f=this;return ki(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),A=l.baseline,c=l.middle,u=r.paintOrder,t.textBounds.forEach(function(p){u.forEach(function(d){switch(d){case 0:f.ctx.fillStyle=yr(r.color),f.renderTextWithLetterSpacing(p,r.letterSpacing,A);var g=r.textShadow;g.length&&p.text.trim().length&&(g.slice(0).reverse().forEach(function(m){f.ctx.shadowColor=yr(m.color),f.ctx.shadowOffsetX=m.offsetX.number*f.options.scale,f.ctx.shadowOffsetY=m.offsetY.number*f.options.scale,f.ctx.shadowBlur=m.blur.number,f.renderTextWithLetterSpacing(p,r.letterSpacing,A)}),f.ctx.shadowColor="",f.ctx.shadowOffsetX=0,f.ctx.shadowOffsetY=0,f.ctx.shadowBlur=0),r.textDecorationLine.length&&(f.ctx.fillStyle=yr(r.textDecorationColor||r.color),r.textDecorationLine.forEach(function(m){switch(m){case 1:f.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top+A),p.bounds.width,1);break;case 2:f.ctx.fillRect(p.bounds.left,Math.round(p.bounds.top),p.bounds.width,1);break;case 3:f.ctx.fillRect(p.bounds.left,Math.ceil(p.bounds.top+c),p.bounds.width,1);break}}));break;case 1:r.webkitTextStrokeWidth&&p.text.trim().length&&(f.ctx.strokeStyle=yr(r.webkitTextStrokeColor),f.ctx.lineWidth=r.webkitTextStrokeWidth,f.ctx.lineJoin=window.chrome?"miter":"round",f.ctx.strokeText(p.text,p.bounds.left,p.bounds.top+A)),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=Iw(t),o=Tw(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 xs(this,void 0,void 0,function(){var r,i,s,o,a,l,y,y,A,c,u,f,x,h,p,_,d,g,m,y,w,x,_;return ki(this,function(C){switch(C.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,i=t.curves,s=r.styles,o=0,a=r.textNodes,C.label=1;case 1:return o0&&v>0&&(b=s.ctx.createPattern(_,"repeat"),s.renderRepeat(D,b,U,P))):kse(c)&&(M=Gb(t,r,[null,null,null]),D=M[0],$=M[1],H=M[2],I=M[3],v=M[4],E=c.position.length===0?[uT]:c.position,U=ln(E[0],I),P=ln(E[E.length-1],v),L=Lse(c,U,P,I,v),z=L[0],K=L[1],z>0&&K>0&&(O=s.ctx.createRadialGradient($+U,H+P,0,$+U,H+P,z),_L(c.stops,z*2).forEach(function(ue){return O.addColorStop(ue.stop,yr(ue.color))}),s.path(D),s.ctx.fillStyle=O,z!==K?(B=t.bounds.left+.5*t.bounds.width,W=t.bounds.top+.5*t.bounds.height,ee=K/z,F=1/ee,s.ctx.save(),s.ctx.translate(B,W),s.ctx.transform(1,0,0,ee,0,0),s.ctx.translate(-B,-W),s.ctx.fillRect($,F*(H-W)+W,I,v*F),s.ctx.restore()):s.ctx.fill())),X.label=6;case 6:return r--,[2]}})},s=this,o=0,a=t.styles.backgroundImage.slice(0).reverse(),A.label=1;case 1:return o0?c.style!==2?[3,5]:[4,this.renderDashedDottedBorder(c.color,c.width,a,t.curves,2)]:[3,11]):[3,13];case 4:return f.sent(),[3,11];case 5:return c.style!==3?[3,7]:[4,this.renderDashedDottedBorder(c.color,c.width,a,t.curves,3)];case 6:return f.sent(),[3,11];case 7:return c.style!==4?[3,9]:[4,this.renderDoubleBorder(c.color,c.width,a,t.curves)];case 8:return f.sent(),[3,11];case 9:return[4,this.renderSolidBorder(c.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 xs(this,void 0,void 0,function(){var a,l,A,c,u,f,h,p,d,g,m,y,w,x,_,C,_,C;return ki(this,function(S){return this.ctx.save(),a=Mle(s,i),l=$L(s,i),o===2&&(this.path(l),this.ctx.clip()),Is(l[0])?(A=l[0].start.x,c=l[0].start.y):(A=l[0].x,c=l[0].y),Is(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(A-u):h=Math.abs(c-f),this.ctx.beginPath(),o===3?this.formatPath(a):this.formatPath(l.slice(0,2)),p=r<3?r*3:r*2,d=r<3?r*2:r,o===3&&(p=r,d=r),g=!0,h<=p*2?g=!1:h<=p*2+d?(m=h/(2*p+d),p*=m,d*=m):(y=Math.floor((h+d)/(p+d)),w=(h-y*p)/(y-1),x=(h-(y+1)*p)/y,d=x<=0||Math.abs(d-w)i.applyWeight(r))}clearAppliedWeight(){this._binds.forEach(e=>e.clearAppliedWeight())}}function zt(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function t5(n,e,t){var r,i;const s=n.parser.json,o=(r=s.nodes)===null||r===void 0?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||i===void 0?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 A=l.primitives.length,c=[];return t.traverse(u=>{c.length{const s=t5(n,i,r);s!=null&&t.set(i,s)}),t})}function qL(n,e){var t,r;const i=parseInt(Ms,10);let s=null;if(i>=133)s=(r=(t=n.associations.get(e))===null||t===void 0?void 0:t.materials)!==null&&r!==void 0?r:null;else{const a=n.associations.get(e);(a==null?void 0:a.type)==="materials"&&(s=a.index)}return s}const oi={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 n5(n){return Math.max(Math.min(n,1),0)}class Iw{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(oi));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},t=new Set(Object.values(oi));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 Iw().copy(this)}getExpression(e){var t;return(t=this._expressionMap[e])!==null&&t!==void 0?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!==void 0?t:null}setValue(e,t){const r=this.getExpression(e);r&&(r.weight=n5(t))}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}}}const Yd={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},zle={_Color:Yd.Color,_EmissionColor:Yd.EmissionColor,_ShadeColor:Yd.ShadeColor,_RimColor:Yd.RimColor,_OutlineColor:Yd.OutlineColor},Gle=new Qe;class jm{constructor({material:e,type:t,targetValue:r}){var i,s,o;this.material=e,this.type=t,this.targetValue=r;const a=(i=Object.entries(jm._propertyNameMapMap).find(([A])=>e[A]===!0))===null||i===void 0?void 0:i[1],l=(s=a==null?void 0:a[t])!==null&&s!==void 0?s:null;if(l==null)console.warn(`Tried to add a material color bind to the material ${(o=e.name)!==null&&o!==void 0?o:"(no name)"}, the type ${t} but the material or the type is not supported.`),this._state=null;else{const c=e[l].clone(),u=new Qe(r.r-c.r,r.g-c.g,r.b-c.b);this._state={propertyName:l,initialValue:c,deltaValue:u}}}applyWeight(e){if(this._state==null)return;const{propertyName:t,deltaValue:r}=this._state,i=this.material[t];i!==void 0&&(i.add(Gle.copy(r).multiplyScalar(e)),typeof this.material.shouldApplyUniforms=="boolean"&&(this.material.shouldApplyUniforms=!0))}clearAppliedWeight(){if(this._state==null)return;const{propertyName:e,initialValue:t}=this._state,r=this.material[e];r!==void 0&&(r.copy(t),typeof this.material.shouldApplyUniforms=="boolean"&&(this.material.shouldApplyUniforms=!0))}}jm._propertyNameMapMap={isMeshStandardMaterial:{color:"color",emissionColor:"emissive"},isMeshBasicMaterial:{color:"color"},isMToonMaterial:{color:"color",emissionColor:"emissive",outlineColor:"outlineColorFactor",matcapColor:"matcapFactor",rimColor:"parametricRimColorFactor",shadeColor:"shadeColorFactor"}};class e3{constructor({primitives:e,index:t,weight:r}){this.primitives=e,this.index=t,this.weight=r}applyWeight(e){this.primitives.forEach(t=>{var r;((r=t.morphTargetInfluences)===null||r===void 0?void 0:r[this.index])!=null&&(t.morphTargetInfluences[this.index]+=this.weight*e)})}clearAppliedWeight(){this.primitives.forEach(e=>{var t;((t=e.morphTargetInfluences)===null||t===void 0?void 0:t[this.index])!=null&&(e.morphTargetInfluences[this.index]=0)})}}const t3=new $e;class Wm{constructor({material:e,scale:t,offset:r}){var i,s;this.material=e,this.scale=t,this.offset=r;const o=(i=Object.entries(Wm._propertyNamesMap).find(([a])=>e[a]===!0))===null||i===void 0?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!==null&&s!==void 0?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const A=(l=e[a])===null||l===void 0?void 0:l.clone();if(!A)return null;e[a]=A;const c=A.offset.clone(),u=A.repeat.clone(),f=r.clone().sub(c),h=t.clone().sub(u);this._properties.push({name:a,initialOffset:c,deltaOffset:f,initialScale:u,deltaScale:h})}))}applyWeight(e){this._properties.forEach(t=>{const r=this.material[t.name];r!==void 0&&(r.offset.add(t3.copy(t.deltaOffset).multiplyScalar(e)),r.repeat.add(t3.copy(t.deltaScale).multiplyScalar(e)),r.needsUpdate=!0)})}clearAppliedWeight(){this._properties.forEach(e=>{const t=this.material[e.name];t!==void 0&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale),t.needsUpdate=!0)})}}Wm._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};const Vle=new Set(["1.0","1.0-beta"]);class r_{constructor(e){this.parser=e}get name(){return"VRMExpressionLoaderPlugin"}afterRoot(e){return zt(this,void 0,void 0,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return zt(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t)return t;const r=yield this._v0Import(e);return r||null})}_v1Import(e){var t,r;return zt(this,void 0,void 0,function*(){const i=this.parser.json;if(!(((t=i.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)===null||r===void 0?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Vle.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const A=new Set(Object.values(oi)),c=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([f,h])=>{if(h!=null){if(!A.has(f)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${f}" detected. Ignoring the expression`);return}c.set(f,h)}}),l.custom!=null&&Object.entries(l.custom).forEach(([f,h])=>{if(A.has(f)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${f}". Ignoring the expression`);return}c.set(f,h)});const u=new Iw;return yield Promise.all(Array.from(c.entries()).map(([f,h])=>zt(this,void 0,void 0,function*(){var p,d,g,m,y,w,x;const _=new XL(f);if(e.scene.add(_),_.isBinary=(p=h.isBinary)!==null&&p!==void 0?p:!1,_.overrideBlink=(d=h.overrideBlink)!==null&&d!==void 0?d:"none",_.overrideLookAt=(g=h.overrideLookAt)!==null&&g!==void 0?g:"none",_.overrideMouth=(m=h.overrideMouth)!==null&&m!==void 0?m:"none",(y=h.morphTargetBinds)===null||y===void 0||y.forEach(C=>zt(this,void 0,void 0,function*(){var S;if(C.node===void 0||C.index===void 0)return;const b=yield ZL(e,C.node),M=C.index;if(!b.every(D=>Array.isArray(D.morphTargetInfluences)&&M{const b=S.material;b&&C.push(b)}),(w=h.materialColorBinds)===null||w===void 0||w.forEach(S=>zt(this,void 0,void 0,function*(){C.filter(M=>{const D=qL(this.parser,M);return S.material===D}).forEach(M=>{_.addBind(new jm({material:M,type:S.type,targetValue:new Qe().fromArray(S.targetValue)}))})})),(x=h.textureTransformBinds)===null||x===void 0||x.forEach(S=>zt(this,void 0,void 0,function*(){C.filter(M=>{const D=qL(this.parser,M);return S.material===D}).forEach(M=>{var D,$;_.addBind(new Wm({material:M,offset:new $e().fromArray((D=S.offset)!==null&&D!==void 0?D:[0,0]),scale:new $e().fromArray(($=S.scale)!==null&&$!==void 0?$:[1,1])}))})}))}u.registerExpression(_)}))),u})}_v0Import(e){var t;return zt(this,void 0,void 0,function*(){const r=this.parser.json,i=(t=r.extensions)===null||t===void 0?void 0:t.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new Iw,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(A=>zt(this,void 0,void 0,function*(){var c;const u=A.presetName,f=u!=null&&r_.v0v1PresetNameMap[u]||null,h=f??A.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 p=new XL(h);e.scene.add(p),p.isBinary=(c=A.isBinary)!==null&&c!==void 0?c:!1,A.binds&&A.binds.forEach(g=>zt(this,void 0,void 0,function*(){var m;if(g.mesh===void 0||g.index===void 0)return;const y=[];(m=r.nodes)===null||m===void 0||m.forEach((x,_)=>{x.mesh===g.mesh&&y.push(_)});const w=g.index;yield Promise.all(y.map(x=>zt(this,void 0,void 0,function*(){var _;const C=yield ZL(e,x);if(!C.every(S=>Array.isArray(S.morphTargetInfluences)&&w{if(g.materialName===void 0||g.propertyName===void 0||g.targetValue===void 0)return;const m=[];e.scene.traverse(w=>{if(w.material){const x=w.material;Array.isArray(x)?m.push(...x.filter(_=>(_.name===g.materialName||_.name===g.materialName+" (Outline)")&&m.indexOf(_)===-1)):x.name===g.materialName&&m.indexOf(x)===-1&&m.push(x)}});const y=g.propertyName;m.forEach(w=>{if(y==="_MainTex_ST"){const _=new $e(g.targetValue[0],g.targetValue[1]),C=new $e(g.targetValue[2],g.targetValue[3]);p.addBind(new Wm({material:w,scale:_,offset:C}));return}const x=zle[y];if(x){p.addBind(new jm({material:w,type:x,targetValue:new Qe(...g.targetValue.slice(0,3))}));return}console.warn(y+" is not supported")})}),o.registerExpression(p)}))),o})}}r_.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"};class Zo{constructor(e,t){this._firstPersonOnlyLayer=Zo.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Zo.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 Zo(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Zo.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=Zo.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])||c[1]>0&&i.includes(u[1])||c[2]>0&&i.includes(u[2])||c[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 p=t[A],d=r[A];p[0]>0&&i.includes(d[0])||p[1]>0&&i.includes(d[1])||p[2]>0&&i.includes(d[2])||p[3]>0&&i.includes(d[3])||(e[s++]=a,e[s++]=l,e[s++]=A)}return s}_createErasedMesh(e,t){const r=new Al(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 LU?[]:s.array,a=[];for(let d=0;d{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 Ur;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}}Zo.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;Zo.DEFAULT_THIRDPERSON_ONLY_LAYER=10;const jle=new Set(["1.0","1.0-beta"]);class Wle{constructor(e){this.parser=e}get name(){return"VRMFirstPersonLoaderPlugin"}afterRoot(e){return zt(this,void 0,void 0,function*(){const t=e.userData.vrmHumanoid;if(t!==null){if(t===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");e.userData.vrmFirstPerson=yield this._import(e,t)}})}_import(e,t){return zt(this,void 0,void 0,function*(){if(t==null)return null;const r=yield this._v1Import(e,t);if(r)return r;const i=yield this._v0Import(e,t);return i||null})}_v1Import(e,t){var r,i;return zt(this,void 0,void 0,function*(){const s=this.parser.json;if(!(((r=s.extensionsUsed)===null||r===void 0?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const a=(i=s.extensions)===null||i===void 0?void 0:i.VRMC_vrm;if(!a)return null;const l=a.specVersion;if(!jle.has(l))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${l}"`),null;const A=a.firstPerson;if(!A)return null;const c=[],u=yield JL(e);return Array.from(u.entries()).forEach(([f,h])=>{var p;const d=A.meshAnnotations?A.meshAnnotations.find(g=>g.node===f):void 0;c.push({meshes:h,type:(p=d==null?void 0:d.type)!==null&&p!==void 0?p:"both"})}),new Zo(t,c)})}_v0Import(e,t){var r;return zt(this,void 0,void 0,function*(){const i=this.parser.json,s=(r=i.extensions)===null||r===void 0?void 0:r.VRM;if(!s)return null;const o=s.firstPerson;if(!o)return null;const a=[],l=yield JL(e);return Array.from(l.entries()).forEach(([A,c])=>{const u=i.nodes[A],f=o.meshAnnotations?o.meshAnnotations.find(h=>h.mesh===u.mesh):void 0;a.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new Zo(t,a)})}_convertV0FlagToV1Type(e){return e==="FirstPersonOnly"?"firstPersonOnly":e==="ThirdPersonOnly"?"thirdPersonOnly":e==="Auto"?"auto":"both"}}const n3=new Z,r3=new Z,Kle=new rt;class i3 extends Ur{constructor(e){super(),this.vrmHumanoid=e,this._boneAxesMap=new Map,Object.values(e.humanBones).forEach(t=>{const r=new sne(1);r.matrixAutoUpdate=!1,r.material.depthTest=!1,r.material.depthWrite=!1,this.add(r),this._boneAxesMap.set(t,r)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(e=>{e.geometry.dispose(),e.material.dispose()})}updateMatrixWorld(e){Array.from(this._boneAxesMap.entries()).forEach(([t,r])=>{t.node.updateWorldMatrix(!0,!1),t.node.matrixWorld.decompose(n3,Kle,r3);const i=n3.set(.1,.1,.1).divide(r3);r.matrix.copy(t.node.matrixWorld).scale(i)}),super.updateMatrixWorld(e)}}const Vb=["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"],Km={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"},$le={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 r5(n){return n.invert?n.invert():n.inverse(),n}const ac=new Z,lc=new rt;class FC{constructor(e){this.humanBones=e,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const e={};return Object.keys(this.humanBones).forEach(t=>{const r=t,i=this.getBoneNode(r);i&&(ac.copy(i.position),lc.copy(i.quaternion),e[r]={position:ac.toArray(),rotation:lc.toArray()})}),e}getPose(){const e={};return Object.keys(this.humanBones).forEach(t=>{const r=t,i=this.getBoneNode(r);if(!i)return;ac.set(0,0,0),lc.identity();const s=this.restPose[r];s!=null&&s.position&&ac.fromArray(s.position).negate(),s!=null&&s.rotation&&r5(lc.fromArray(s.rotation)),ac.add(i.position),lc.premultiply(i.quaternion),e[r]={position:ac.toArray(),rotation:lc.toArray()}}),e}setPose(e){Object.entries(e).forEach(([t,r])=>{const i=t,s=this.getBoneNode(i);if(!s)return;const o=this.restPose[i];o&&(r!=null&&r.position&&(s.position.fromArray(r.position),o.position&&s.position.add(ac.fromArray(o.position))),r!=null&&r.rotation&&(s.quaternion.fromArray(r.rotation),o.rotation&&s.quaternion.multiply(lc.fromArray(o.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([e,t])=>{const r=this.getBoneNode(e);r&&(t!=null&&t.position&&r.position.fromArray(t.position),t!=null&&t.rotation&&r.quaternion.fromArray(t.rotation))})}getBone(e){var t;return(t=this.humanBones[e])!==null&&t!==void 0?t:void 0}getBoneNode(e){var t,r;return(r=(t=this.humanBones[e])===null||t===void 0?void 0:t.node)!==null&&r!==void 0?r:null}}const Yle=new Z,Xle=new rt,Zle=new Z;class Rw extends FC{constructor(e){const{rigBones:t,root:r,parentWorldRotations:i,boneRotations:s}=Rw._setupTransforms(e);super(t),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}static _setupTransforms(e){const t=new It;t.name="VRMHumanoidRig";const r={},i={},s={};Vb.forEach(l=>{const A=e.getBoneNode(l);if(A){const c=new Z,u=new rt;A.updateWorldMatrix(!0,!1),A.matrixWorld.decompose(c,u,Yle),r[l]=c,i[l]=u,s[l]=A.quaternion.clone()}});const o={},a={};return Vb.forEach(l=>{var A;const c=e.getBoneNode(l);if(c){const u=r[l];let f=l,h,p;for(;h==null&&(f=$le[f],f!=null);)h=r[f],p=i[f];const d=new It;d.name="Normalized_"+c.name,(f?(A=a[f])===null||A===void 0?void 0:A.node:t).add(d),d.position.copy(u),h&&d.position.sub(h),a[l]={node:d},o[l]=p??new rt}}),{rigBones:a,root:t,parentWorldRotations:o,boneRotations:s}}update(){Vb.forEach(e=>{const t=this.original.getBoneNode(e);if(t!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=Xle.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(Zle);t.parent.updateWorldMatrix(!0,!1);const l=t.parent.matrixWorld,A=a.applyMatrix4(l.invert());t.position.copy(A)}}})}}class Fw{constructor(e,t){var r;this.autoUpdateHumanBones=(r=t==null?void 0:t.autoUpdateHumanBones)!==null&&r!==void 0?r:!0,this._rawHumanBones=new FC(e),this._normalizedHumanBones=new Rw(this._rawHumanBones)}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}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new FC(e.humanBones),this._normalizedHumanBones=new Rw(this._rawHumanBones),this}clone(){return new Fw(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()}}const Jle={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"},qle=new Set(["1.0","1.0-beta"]),s3={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"};class eAe{constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot,this.autoUpdateHumanBones=t==null?void 0:t.autoUpdateHumanBones}get name(){return"VRMHumanoidLoaderPlugin"}afterRoot(e){return zt(this,void 0,void 0,function*(){e.userData.vrmHumanoid=yield this._import(e)})}_import(e){return zt(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t)return t;const r=yield this._v0Import(e);return r||null})}_v1Import(e){var t,r;return zt(this,void 0,void 0,function*(){const i=this.parser.json;if(!(((t=i.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)===null||r===void 0?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!qle.has(a))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.humanoid;if(!l)return null;const A=l.humanBones.leftThumbIntermediate!=null||l.humanBones.rightThumbIntermediate!=null,c={};l.humanBones!=null&&(yield Promise.all(Object.entries(l.humanBones).map(([f,h])=>zt(this,void 0,void 0,function*(){let p=f;const d=h.node;if(A){const m=s3[p];m!=null&&(p=m)}const g=yield this.parser.getDependency("node",d);if(g==null){console.warn(`A glTF node bound to the humanoid bone ${p} (index = ${d}) does not exist`);return}c[p]={node:g}}))));const u=new Fw(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(u.normalizedHumanBonesRoot),this.helperRoot){const f=new i3(u);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return u})}_v0Import(e){var t;return zt(this,void 0,void 0,function*(){const i=(t=this.parser.json.extensions)===null||t===void 0?void 0:t.VRM;if(!i)return null;const s=i.humanoid;if(!s)return null;const o={};s.humanBones!=null&&(yield Promise.all(s.humanBones.map(l=>zt(this,void 0,void 0,function*(){const A=l.bone,c=l.node;if(A==null||c==null)return;const u=yield this.parser.getDependency("node",c);if(u==null){console.warn(`A glTF node bound to the humanoid bone ${A} (index = ${c}) does not exist`);return}const f=s3[A],h=f??A;if(o[h]!=null){console.warn(`Multiple bone entries for ${h} detected (index = ${c}), ignoring duplicated entries.`);return}o[h]={node:u}}))));const a=new Fw(this._ensureRequiredBonesExist(o),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(a.normalizedHumanBonesRoot),this.helperRoot){const l=new i3(a);this.helperRoot.add(l),l.renderOrder=this.helperRoot.renderOrder}return a})}_ensureRequiredBonesExist(e){const t=Object.values(Jle).filter(r=>e[r]==null);if(t.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${t.join(", ")}`);return e}}class o3 extends $t{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new At(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(3*63),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,e=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),e&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let e=0;e<64;e++){const t=e/63*this._currentTheta;this._attrPos.setXYZ(e+1,this._currentRadius*Math.sin(t),0,this._currentRadius*Math.cos(t))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<63;e++)this._attrIndex.setXYZ(e*3,0,e+1,e+2);this._attrIndex.needsUpdate=!0}}class tAe extends $t{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new Z,this._currentTail=new Z,this._attrPos=new At(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}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 e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const sv=new rt,a3=new rt,Xd=new Z,l3=new Z,A3=Math.sqrt(2)/2,nAe=new rt(0,0,-A3,A3),rAe=new Z(0,1,0);class iAe extends Ur{constructor(e){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=e;{const t=new o3;t.radius=.5;const r=new Ei({color:65280,transparent:!0,opacity:.5,side:ui,depthTest:!1,depthWrite:!1});this._meshPitch=new xn(t,r),this.add(this._meshPitch)}{const t=new o3;t.radius=.5;const r=new Ei({color:16711680,transparent:!0,opacity:.5,side:ui,depthTest:!1,depthWrite:!1});this._meshYaw=new xn(t,r),this.add(this._meshYaw)}{const t=new tAe;t.radius=.1;const r=new Cl({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new yg(t,r),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(e){const t=Lt.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=t,this._meshYaw.geometry.update();const r=Lt.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=r,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(Xd),this.vrmLookAt.getLookAtWorldQuaternion(sv),sv.multiply(this.vrmLookAt.getFaceFrontQuaternion(a3)),this._meshYaw.position.copy(Xd),this._meshYaw.quaternion.copy(sv),this._meshPitch.position.copy(Xd),this._meshPitch.quaternion.copy(sv),this._meshPitch.quaternion.multiply(a3.setFromAxisAngle(rAe,t)),this._meshPitch.quaternion.multiply(nAe);const{target:i,autoUpdate:s}=this.vrmLookAt;i!=null&&s&&(i.getWorldPosition(l3).sub(Xd),this._lineTarget.geometry.tail.copy(l3),this._lineTarget.geometry.update(),this._lineTarget.position.copy(Xd)),super.updateMatrixWorld(e)}}const sAe=new Z,oAe=new Z;function UC(n,e){return n.matrixWorld.decompose(sAe,e,oAe),e}function uy(n){return[Math.atan2(-n.z,n.x),Math.atan2(n.y,Math.sqrt(n.x*n.x+n.z*n.z))]}function c3(n){const e=Math.round(n/2/Math.PI);return n-2*Math.PI*e}const u3=new Z(0,0,1),aAe=new Z,lAe=new Z,AAe=new Z,cAe=new rt,jb=new rt,f3=new rt,uAe=new rt,Wb=new fi;class i_{constructor(e,t){this.offsetFromHeadBone=new Z,this.autoUpdate=!0,this.faceFront=new Z(0,0,1),this.humanoid=e,this.applier=t,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new rt)}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 fi)}getEuler(e){return e.set(Lt.DEG2RAD*this._pitch,Lt.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 i_(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 UC(t,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(u3)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,r]=uy(this.faceFront);return Wb.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(Wb).premultiply(uAe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(jb),this.getFaceFrontQuaternion(f3),e.copy(u3).applyQuaternion(jb).applyQuaternion(f3).applyEuler(this.getEuler(Wb))}lookAt(e){const t=cAe.copy(this._restHeadWorldQuaternion).multiply(r5(this.getLookAtWorldQuaternion(jb))),r=this.getLookAtWorldPosition(lAe),i=AAe.copy(e).sub(r).applyQuaternion(t).normalize(),[s,o]=uy(this.faceFront),[a,l]=uy(i),A=c3(a-s),c=c3(o-l);this._yaw=Lt.RAD2DEG*A,this._pitch=Lt.RAD2DEG*c,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(aAe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}}i_.EULER_ORDER="YXZ";const fAe=new Z(0,0,1),Lo=new rt,Vu=new rt,vs=new fi(0,0,0,"YXZ");class fy{constructor(e,t,r,i,s){this.humanoid=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=r,this.rangeMapVerticalDown=i,this.rangeMapVerticalUp=s,this.faceFront=new Z(0,0,1),this._restQuatLeftEye=new rt,this._restQuatRightEye=new rt,this._restLeftEyeParentWorldQuat=new rt,this._restRightEyeParentWorldQuat=new rt;const o=this.humanoid.getRawBoneNode("leftEye"),a=this.humanoid.getRawBoneNode("rightEye");o&&(this._restQuatLeftEye.copy(o.quaternion),UC(o.parent,this._restLeftEyeParentWorldQuat)),a&&(this._restQuatRightEye.copy(a.quaternion),UC(a.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(e,t){const r=this.humanoid.getRawBoneNode("leftEye"),i=this.humanoid.getRawBoneNode("rightEye"),s=this.humanoid.getNormalizedBoneNode("leftEye"),o=this.humanoid.getNormalizedBoneNode("rightEye");r&&(t<0?vs.x=-Lt.DEG2RAD*this.rangeMapVerticalDown.map(-t):vs.x=Lt.DEG2RAD*this.rangeMapVerticalUp.map(t),e<0?vs.y=-Lt.DEG2RAD*this.rangeMapHorizontalInner.map(-e):vs.y=Lt.DEG2RAD*this.rangeMapHorizontalOuter.map(e),Lo.setFromEuler(vs),this._getWorldFaceFrontQuat(Vu),s.quaternion.copy(Vu).multiply(Lo).multiply(Vu.invert()),Lo.copy(this._restLeftEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(Lo).premultiply(Lo.invert()).multiply(this._restQuatLeftEye)),i&&(t<0?vs.x=-Lt.DEG2RAD*this.rangeMapVerticalDown.map(-t):vs.x=Lt.DEG2RAD*this.rangeMapVerticalUp.map(t),e<0?vs.y=-Lt.DEG2RAD*this.rangeMapHorizontalOuter.map(-e):vs.y=Lt.DEG2RAD*this.rangeMapHorizontalInner.map(e),Lo.setFromEuler(vs),this._getWorldFaceFrontQuat(Vu),o.quaternion.copy(Vu).multiply(Lo).multiply(Vu.invert()),Lo.copy(this._restRightEyeParentWorldQuat),i.quaternion.copy(o.quaternion).multiply(Lo).premultiply(Lo.invert()).multiply(this._restQuatRightEye))}lookAt(e){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const t=Lt.RAD2DEG*e.y,r=Lt.RAD2DEG*e.x;this.applyYawPitch(t,r)}_getWorldFaceFrontQuat(e){if(this.faceFront.distanceToSquared(fAe)<.01)return e.identity();const[t,r]=uy(this.faceFront);return vs.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(vs)}}fy.type="bone";class LC{constructor(e,t,r,i,s){this.expressions=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=r,this.rangeMapVerticalDown=i,this.rangeMapVerticalUp=s}applyYawPitch(e,t){t<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-t))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(t))),e<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-e))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(e)))}lookAt(e){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const t=Lt.RAD2DEG*e.y,r=Lt.RAD2DEG*e.x;this.applyYawPitch(t,r)}}LC.type="expression";class h3{constructor(e,t){this.inputMaxValue=e,this.outputScale=t}map(e){return this.outputScale*n5(e/this.inputMaxValue)}}const hAe=new Set(["1.0","1.0-beta"]);class dAe{constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}get name(){return"VRMLookAtLoaderPlugin"}afterRoot(e){return zt(this,void 0,void 0,function*(){const t=e.userData.vrmHumanoid;if(t===null)return;if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const r=e.userData.vrmExpressionManager;if(r!==null){if(r===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");e.userData.vrmLookAt=yield this._import(e,t,r)}})}_import(e,t,r){return zt(this,void 0,void 0,function*(){if(t==null||r==null)return null;const i=yield this._v1Import(e,t,r);if(i)return i;const s=yield this._v0Import(e,t,r);return s||null})}_v1Import(e,t,r){var i,s,o;return zt(this,void 0,void 0,function*(){const a=this.parser.json;if(!(((i=a.extensionsUsed)===null||i===void 0?void 0:i.indexOf("VRMC_vrm"))!==-1))return null;const A=(s=a.extensions)===null||s===void 0?void 0:s.VRMC_vrm;if(!A)return null;const c=A.specVersion;if(!hAe.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const u=A.lookAt;if(!u)return null;const f=u.type==="expression"?1:10,h=this._v1ImportRangeMap(u.rangeMapHorizontalInner,f),p=this._v1ImportRangeMap(u.rangeMapHorizontalOuter,f),d=this._v1ImportRangeMap(u.rangeMapVerticalDown,f),g=this._v1ImportRangeMap(u.rangeMapVerticalUp,f);let m;u.type==="expression"?m=new LC(r,h,p,d,g):m=new fy(t,h,p,d,g);const y=this._importLookAt(t,m);return y.offsetFromHeadBone.fromArray((o=u.offsetFromHeadBone)!==null&&o!==void 0?o:[0,.06,0]),y})}_v1ImportRangeMap(e,t){var r,i;return new h3((r=e==null?void 0:e.inputMaxValue)!==null&&r!==void 0?r:90,(i=e==null?void 0:e.outputScale)!==null&&i!==void 0?i:t)}_v0Import(e,t,r){var i,s,o,a;return zt(this,void 0,void 0,function*(){const A=(i=this.parser.json.extensions)===null||i===void 0?void 0:i.VRM;if(!A)return null;const c=A.firstPerson;if(!c)return null;const u=c.lookAtTypeName==="BlendShape"?1:10,f=this._v0ImportDegreeMap(c.lookAtHorizontalInner,u),h=this._v0ImportDegreeMap(c.lookAtHorizontalOuter,u),p=this._v0ImportDegreeMap(c.lookAtVerticalDown,u),d=this._v0ImportDegreeMap(c.lookAtVerticalUp,u);let g;c.lookAtTypeName==="BlendShape"?g=new LC(r,f,h,p,d):g=new fy(t,f,h,p,d);const m=this._importLookAt(t,g);return c.firstPersonBoneOffset?m.offsetFromHeadBone.set((s=c.firstPersonBoneOffset.x)!==null&&s!==void 0?s:0,(o=c.firstPersonBoneOffset.y)!==null&&o!==void 0?o:.06,-((a=c.firstPersonBoneOffset.z)!==null&&a!==void 0?a:0)):m.offsetFromHeadBone.set(0,.06,0),m.faceFront.set(0,0,-1),g instanceof fy&&g.faceFront.set(0,0,-1),m})}_v0ImportDegreeMap(e,t){var r,i;const s=e==null?void 0:e.curve;return JSON.stringify(s)!=="[0,0,0,1,1,1,1,0]"&&console.warn("Curves of LookAtDegreeMap defined in VRM 0.0 are not supported"),new h3((r=e==null?void 0:e.xRange)!==null&&r!==void 0?r:90,(i=e==null?void 0:e.yRange)!==null&&i!==void 0?i:t)}_importLookAt(e,t){const r=new i_(e,t);if(this.helperRoot){const i=new iAe(r);this.helperRoot.add(i),i.renderOrder=this.helperRoot.renderOrder}return r}}function pAe(n,e){return typeof n!="string"||n===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(n)&&(e=e.replace(/(^https?:\/\/[^/]+).*/i,"$1")),/^(https?:)?\/\//i.test(n)||/^data:.*,.*$/i.test(n)||/^blob:.*$/i.test(n)?n:e+n)}const mAe=new Set(["1.0","1.0-beta"]);class gAe{constructor(e,t){var r,i,s;this.parser=e,this.needThumbnailImage=(r=t==null?void 0:t.needThumbnailImage)!==null&&r!==void 0?r:!0,this.acceptLicenseUrls=(i=t==null?void 0:t.acceptLicenseUrls)!==null&&i!==void 0?i:["https://vrm.dev/licenses/1.0/"],this.acceptV0Meta=(s=t==null?void 0:t.acceptV0Meta)!==null&&s!==void 0?s:!0}get name(){return"VRMMetaLoaderPlugin"}afterRoot(e){return zt(this,void 0,void 0,function*(){e.userData.vrmMeta=yield this._import(e)})}_import(e){return zt(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){var t,r,i;return zt(this,void 0,void 0,function*(){const s=this.parser.json;if(!(((t=s.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const a=(r=s.extensions)===null||r===void 0?void 0:r.VRMC_vrm;if(a==null)return null;const l=a.specVersion;if(!mAe.has(l))return console.warn(`VRMMetaLoaderPlugin: Unknown VRMC_vrm specVersion "${l}"`),null;const A=a.meta;if(!A)return null;const c=A.licenseUrl;if(!new Set(this.acceptLicenseUrls).has(c))throw new Error(`VRMMetaLoaderPlugin: The license url "${c}" is not accepted`);let f;return this.needThumbnailImage&&A.thumbnailImage!=null&&(f=(i=yield this._extractGLTFImage(A.thumbnailImage))!==null&&i!==void 0?i:void 0),{metaVersion:"1",name:A.name,version:A.version,authors:A.authors,copyrightInformation:A.copyrightInformation,contactInformation:A.contactInformation,references:A.references,thirdPartyLicenses:A.thirdPartyLicenses,thumbnailImage:f,licenseUrl:A.licenseUrl,avatarPermission:A.avatarPermission,allowExcessivelyViolentUsage:A.allowExcessivelyViolentUsage,allowExcessivelySexualUsage:A.allowExcessivelySexualUsage,commercialUsage:A.commercialUsage,allowPoliticalOrReligiousUsage:A.allowPoliticalOrReligiousUsage,allowAntisocialOrHateUsage:A.allowAntisocialOrHateUsage,creditNotation:A.creditNotation,allowRedistribution:A.allowRedistribution,modification:A.modification,otherLicenseUrl:A.otherLicenseUrl}})}_v0Import(e){var t;return zt(this,void 0,void 0,function*(){const i=(t=this.parser.json.extensions)===null||t===void 0?void 0:t.VRM;if(!i)return null;const s=i.meta;if(!s)return null;if(!this.acceptV0Meta)throw new Error("VRMMetaLoaderPlugin: Attempted to load VRM0.0 meta but acceptV0Meta is false");let o;return this.needThumbnailImage&&s.texture!=null&&s.texture!==-1&&(o=yield this.parser.getDependency("texture",s.texture)),{metaVersion:"0",allowedUserName:s.allowedUserName,author:s.author,commercialUssageName:s.commercialUssageName,contactInformation:s.contactInformation,licenseName:s.licenseName,otherLicenseUrl:s.otherLicenseUrl,otherPermissionUrl:s.otherPermissionUrl,reference:s.reference,sexualUssageName:s.sexualUssageName,texture:o??void 0,title:s.title,version:s.version,violentUssageName:s.violentUssageName}})}_extractGLTFImage(e){var t;return zt(this,void 0,void 0,function*(){const i=(t=this.parser.json.images)===null||t===void 0?void 0:t[e];if(i==null)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${e}] of glTF as a thumbnail but the image doesn't exist`),null;let s=i.uri;if(i.bufferView!=null){const a=yield this.parser.getDependency("bufferView",i.bufferView),l=new Blob([a],{type:i.mimeType});s=URL.createObjectURL(l)}return s==null?(console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${e}] of glTF as a thumbnail but the image couldn't load properly`),null):yield new LH().loadAsync(pAe(s,this.parser.options.path)).catch(a=>(console.error(a),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}}class vAe{constructor(e){this.scene=e.scene,this.meta=e.meta,this.humanoid=e.humanoid,this.expressionManager=e.expressionManager,this.firstPerson=e.firstPerson,this.lookAt=e.lookAt}update(e){this.humanoid.update(),this.lookAt&&this.lookAt.update(e),this.expressionManager&&this.expressionManager.update()}}class yAe extends vAe{constructor(e){super(e),this.materials=e.materials,this.springBoneManager=e.springBoneManager,this.nodeConstraintManager=e.nodeConstraintManager}update(e){super.update(e),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(e),this.materials&&this.materials.forEach(t=>{t.update&&t.update(e)})}}function ov(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}/*! + */class XL extends It{constructor(e){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${e}`,this.expressionName=e,this.type="VRMExpression",this.visible=!1}get overrideBlinkAmount(){return this.overrideBlink==="block"?0i.applyWeight(r))}clearAppliedWeight(){this._binds.forEach(e=>e.clearAppliedWeight())}}function zt(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function t5(n,e,t){var r,i;const s=n.parser.json,o=(r=s.nodes)===null||r===void 0?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||i===void 0?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 A=l.primitives.length,c=[];return t.traverse(u=>{c.length{const s=t5(n,i,r);s!=null&&t.set(i,s)}),t})}function qL(n,e){var t,r;const i=parseInt(Ts,10);let s=null;if(i>=133)s=(r=(t=n.associations.get(e))===null||t===void 0?void 0:t.materials)!==null&&r!==void 0?r:null;else{const a=n.associations.get(e);(a==null?void 0:a.type)==="materials"&&(s=a.index)}return s}const oi={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 n5(n){return Math.max(Math.min(n,1),0)}class Rw{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(oi));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},t=new Set(Object.values(oi));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 Rw().copy(this)}getExpression(e){var t;return(t=this._expressionMap[e])!==null&&t!==void 0?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!==void 0?t:null}setValue(e,t){const r=this.getExpression(e);r&&(r.weight=n5(t))}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}}}const Xd={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},zle={_Color:Xd.Color,_EmissionColor:Xd.EmissionColor,_ShadeColor:Xd.ShadeColor,_RimColor:Xd.RimColor,_OutlineColor:Xd.OutlineColor},Gle=new Qe;class Wm{constructor({material:e,type:t,targetValue:r}){var i,s,o;this.material=e,this.type=t,this.targetValue=r;const a=(i=Object.entries(Wm._propertyNameMapMap).find(([A])=>e[A]===!0))===null||i===void 0?void 0:i[1],l=(s=a==null?void 0:a[t])!==null&&s!==void 0?s:null;if(l==null)console.warn(`Tried to add a material color bind to the material ${(o=e.name)!==null&&o!==void 0?o:"(no name)"}, the type ${t} but the material or the type is not supported.`),this._state=null;else{const c=e[l].clone(),u=new Qe(r.r-c.r,r.g-c.g,r.b-c.b);this._state={propertyName:l,initialValue:c,deltaValue:u}}}applyWeight(e){if(this._state==null)return;const{propertyName:t,deltaValue:r}=this._state,i=this.material[t];i!==void 0&&(i.add(Gle.copy(r).multiplyScalar(e)),typeof this.material.shouldApplyUniforms=="boolean"&&(this.material.shouldApplyUniforms=!0))}clearAppliedWeight(){if(this._state==null)return;const{propertyName:e,initialValue:t}=this._state,r=this.material[e];r!==void 0&&(r.copy(t),typeof this.material.shouldApplyUniforms=="boolean"&&(this.material.shouldApplyUniforms=!0))}}Wm._propertyNameMapMap={isMeshStandardMaterial:{color:"color",emissionColor:"emissive"},isMeshBasicMaterial:{color:"color"},isMToonMaterial:{color:"color",emissionColor:"emissive",outlineColor:"outlineColorFactor",matcapColor:"matcapFactor",rimColor:"parametricRimColorFactor",shadeColor:"shadeColorFactor"}};class e3{constructor({primitives:e,index:t,weight:r}){this.primitives=e,this.index=t,this.weight=r}applyWeight(e){this.primitives.forEach(t=>{var r;((r=t.morphTargetInfluences)===null||r===void 0?void 0:r[this.index])!=null&&(t.morphTargetInfluences[this.index]+=this.weight*e)})}clearAppliedWeight(){this.primitives.forEach(e=>{var t;((t=e.morphTargetInfluences)===null||t===void 0?void 0:t[this.index])!=null&&(e.morphTargetInfluences[this.index]=0)})}}const t3=new $e;class Km{constructor({material:e,scale:t,offset:r}){var i,s;this.material=e,this.scale=t,this.offset=r;const o=(i=Object.entries(Km._propertyNamesMap).find(([a])=>e[a]===!0))===null||i===void 0?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!==null&&s!==void 0?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const A=(l=e[a])===null||l===void 0?void 0:l.clone();if(!A)return null;e[a]=A;const c=A.offset.clone(),u=A.repeat.clone(),f=r.clone().sub(c),h=t.clone().sub(u);this._properties.push({name:a,initialOffset:c,deltaOffset:f,initialScale:u,deltaScale:h})}))}applyWeight(e){this._properties.forEach(t=>{const r=this.material[t.name];r!==void 0&&(r.offset.add(t3.copy(t.deltaOffset).multiplyScalar(e)),r.repeat.add(t3.copy(t.deltaScale).multiplyScalar(e)),r.needsUpdate=!0)})}clearAppliedWeight(){this._properties.forEach(e=>{const t=this.material[e.name];t!==void 0&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale),t.needsUpdate=!0)})}}Km._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};const Vle=new Set(["1.0","1.0-beta"]);class i_{constructor(e){this.parser=e}get name(){return"VRMExpressionLoaderPlugin"}afterRoot(e){return zt(this,void 0,void 0,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return zt(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t)return t;const r=yield this._v0Import(e);return r||null})}_v1Import(e){var t,r;return zt(this,void 0,void 0,function*(){const i=this.parser.json;if(!(((t=i.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)===null||r===void 0?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!Vle.has(a))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.expressions;if(!l)return null;const A=new Set(Object.values(oi)),c=new Map;l.preset!=null&&Object.entries(l.preset).forEach(([f,h])=>{if(h!=null){if(!A.has(f)){console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${f}" detected. Ignoring the expression`);return}c.set(f,h)}}),l.custom!=null&&Object.entries(l.custom).forEach(([f,h])=>{if(A.has(f)){console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${f}". Ignoring the expression`);return}c.set(f,h)});const u=new Rw;return yield Promise.all(Array.from(c.entries()).map(([f,h])=>zt(this,void 0,void 0,function*(){var p,d,g,m,y,w,x;const _=new XL(f);if(e.scene.add(_),_.isBinary=(p=h.isBinary)!==null&&p!==void 0?p:!1,_.overrideBlink=(d=h.overrideBlink)!==null&&d!==void 0?d:"none",_.overrideLookAt=(g=h.overrideLookAt)!==null&&g!==void 0?g:"none",_.overrideMouth=(m=h.overrideMouth)!==null&&m!==void 0?m:"none",(y=h.morphTargetBinds)===null||y===void 0||y.forEach(C=>zt(this,void 0,void 0,function*(){var S;if(C.node===void 0||C.index===void 0)return;const b=yield ZL(e,C.node),M=C.index;if(!b.every(D=>Array.isArray(D.morphTargetInfluences)&&M{const b=S.material;b&&C.push(b)}),(w=h.materialColorBinds)===null||w===void 0||w.forEach(S=>zt(this,void 0,void 0,function*(){C.filter(M=>{const D=qL(this.parser,M);return S.material===D}).forEach(M=>{_.addBind(new Wm({material:M,type:S.type,targetValue:new Qe().fromArray(S.targetValue)}))})})),(x=h.textureTransformBinds)===null||x===void 0||x.forEach(S=>zt(this,void 0,void 0,function*(){C.filter(M=>{const D=qL(this.parser,M);return S.material===D}).forEach(M=>{var D,$;_.addBind(new Km({material:M,offset:new $e().fromArray((D=S.offset)!==null&&D!==void 0?D:[0,0]),scale:new $e().fromArray(($=S.scale)!==null&&$!==void 0?$:[1,1])}))})}))}u.registerExpression(_)}))),u})}_v0Import(e){var t;return zt(this,void 0,void 0,function*(){const r=this.parser.json,i=(t=r.extensions)===null||t===void 0?void 0:t.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new Rw,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(A=>zt(this,void 0,void 0,function*(){var c;const u=A.presetName,f=u!=null&&i_.v0v1PresetNameMap[u]||null,h=f??A.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 p=new XL(h);e.scene.add(p),p.isBinary=(c=A.isBinary)!==null&&c!==void 0?c:!1,A.binds&&A.binds.forEach(g=>zt(this,void 0,void 0,function*(){var m;if(g.mesh===void 0||g.index===void 0)return;const y=[];(m=r.nodes)===null||m===void 0||m.forEach((x,_)=>{x.mesh===g.mesh&&y.push(_)});const w=g.index;yield Promise.all(y.map(x=>zt(this,void 0,void 0,function*(){var _;const C=yield ZL(e,x);if(!C.every(S=>Array.isArray(S.morphTargetInfluences)&&w{if(g.materialName===void 0||g.propertyName===void 0||g.targetValue===void 0)return;const m=[];e.scene.traverse(w=>{if(w.material){const x=w.material;Array.isArray(x)?m.push(...x.filter(_=>(_.name===g.materialName||_.name===g.materialName+" (Outline)")&&m.indexOf(_)===-1)):x.name===g.materialName&&m.indexOf(x)===-1&&m.push(x)}});const y=g.propertyName;m.forEach(w=>{if(y==="_MainTex_ST"){const _=new $e(g.targetValue[0],g.targetValue[1]),C=new $e(g.targetValue[2],g.targetValue[3]);p.addBind(new Km({material:w,scale:_,offset:C}));return}const x=zle[y];if(x){p.addBind(new Wm({material:w,type:x,targetValue:new Qe(...g.targetValue.slice(0,3))}));return}console.warn(y+" is not supported")})}),o.registerExpression(p)}))),o})}}i_.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"};class Jo{constructor(e,t){this._firstPersonOnlyLayer=Jo.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=Jo.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 Jo(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=Jo.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=Jo.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])||c[1]>0&&i.includes(u[1])||c[2]>0&&i.includes(u[2])||c[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 p=t[A],d=r[A];p[0]>0&&i.includes(d[0])||p[1]>0&&i.includes(d[1])||p[2]>0&&i.includes(d[2])||p[3]>0&&i.includes(d[3])||(e[s++]=a,e[s++]=l,e[s++]=A)}return s}_createErasedMesh(e,t){const r=new cl(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 LU?[]:s.array,a=[];for(let d=0;d{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 Ur;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}}Jo.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;Jo.DEFAULT_THIRDPERSON_ONLY_LAYER=10;const jle=new Set(["1.0","1.0-beta"]);class Wle{constructor(e){this.parser=e}get name(){return"VRMFirstPersonLoaderPlugin"}afterRoot(e){return zt(this,void 0,void 0,function*(){const t=e.userData.vrmHumanoid;if(t!==null){if(t===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");e.userData.vrmFirstPerson=yield this._import(e,t)}})}_import(e,t){return zt(this,void 0,void 0,function*(){if(t==null)return null;const r=yield this._v1Import(e,t);if(r)return r;const i=yield this._v0Import(e,t);return i||null})}_v1Import(e,t){var r,i;return zt(this,void 0,void 0,function*(){const s=this.parser.json;if(!(((r=s.extensionsUsed)===null||r===void 0?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const a=(i=s.extensions)===null||i===void 0?void 0:i.VRMC_vrm;if(!a)return null;const l=a.specVersion;if(!jle.has(l))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${l}"`),null;const A=a.firstPerson;if(!A)return null;const c=[],u=yield JL(e);return Array.from(u.entries()).forEach(([f,h])=>{var p;const d=A.meshAnnotations?A.meshAnnotations.find(g=>g.node===f):void 0;c.push({meshes:h,type:(p=d==null?void 0:d.type)!==null&&p!==void 0?p:"both"})}),new Jo(t,c)})}_v0Import(e,t){var r;return zt(this,void 0,void 0,function*(){const i=this.parser.json,s=(r=i.extensions)===null||r===void 0?void 0:r.VRM;if(!s)return null;const o=s.firstPerson;if(!o)return null;const a=[],l=yield JL(e);return Array.from(l.entries()).forEach(([A,c])=>{const u=i.nodes[A],f=o.meshAnnotations?o.meshAnnotations.find(h=>h.mesh===u.mesh):void 0;a.push({meshes:c,type:this._convertV0FlagToV1Type(f==null?void 0:f.firstPersonFlag)})}),new Jo(t,a)})}_convertV0FlagToV1Type(e){return e==="FirstPersonOnly"?"firstPersonOnly":e==="ThirdPersonOnly"?"thirdPersonOnly":e==="Auto"?"auto":"both"}}const n3=new Z,r3=new Z,Kle=new rt;class i3 extends Ur{constructor(e){super(),this.vrmHumanoid=e,this._boneAxesMap=new Map,Object.values(e.humanBones).forEach(t=>{const r=new sne(1);r.matrixAutoUpdate=!1,r.material.depthTest=!1,r.material.depthWrite=!1,this.add(r),this._boneAxesMap.set(t,r)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(e=>{e.geometry.dispose(),e.material.dispose()})}updateMatrixWorld(e){Array.from(this._boneAxesMap.entries()).forEach(([t,r])=>{t.node.updateWorldMatrix(!0,!1),t.node.matrixWorld.decompose(n3,Kle,r3);const i=n3.set(.1,.1,.1).divide(r3);r.matrix.copy(t.node.matrixWorld).scale(i)}),super.updateMatrixWorld(e)}}const Vb=["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"],$m={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"},$le={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 r5(n){return n.invert?n.invert():n.inverse(),n}const lc=new Z,Ac=new rt;class FC{constructor(e){this.humanBones=e,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const e={};return Object.keys(this.humanBones).forEach(t=>{const r=t,i=this.getBoneNode(r);i&&(lc.copy(i.position),Ac.copy(i.quaternion),e[r]={position:lc.toArray(),rotation:Ac.toArray()})}),e}getPose(){const e={};return Object.keys(this.humanBones).forEach(t=>{const r=t,i=this.getBoneNode(r);if(!i)return;lc.set(0,0,0),Ac.identity();const s=this.restPose[r];s!=null&&s.position&&lc.fromArray(s.position).negate(),s!=null&&s.rotation&&r5(Ac.fromArray(s.rotation)),lc.add(i.position),Ac.premultiply(i.quaternion),e[r]={position:lc.toArray(),rotation:Ac.toArray()}}),e}setPose(e){Object.entries(e).forEach(([t,r])=>{const i=t,s=this.getBoneNode(i);if(!s)return;const o=this.restPose[i];o&&(r!=null&&r.position&&(s.position.fromArray(r.position),o.position&&s.position.add(lc.fromArray(o.position))),r!=null&&r.rotation&&(s.quaternion.fromArray(r.rotation),o.rotation&&s.quaternion.multiply(Ac.fromArray(o.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([e,t])=>{const r=this.getBoneNode(e);r&&(t!=null&&t.position&&r.position.fromArray(t.position),t!=null&&t.rotation&&r.quaternion.fromArray(t.rotation))})}getBone(e){var t;return(t=this.humanBones[e])!==null&&t!==void 0?t:void 0}getBoneNode(e){var t,r;return(r=(t=this.humanBones[e])===null||t===void 0?void 0:t.node)!==null&&r!==void 0?r:null}}const Yle=new Z,Xle=new rt,Zle=new Z;class Fw extends FC{constructor(e){const{rigBones:t,root:r,parentWorldRotations:i,boneRotations:s}=Fw._setupTransforms(e);super(t),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}static _setupTransforms(e){const t=new It;t.name="VRMHumanoidRig";const r={},i={},s={};Vb.forEach(l=>{const A=e.getBoneNode(l);if(A){const c=new Z,u=new rt;A.updateWorldMatrix(!0,!1),A.matrixWorld.decompose(c,u,Yle),r[l]=c,i[l]=u,s[l]=A.quaternion.clone()}});const o={},a={};return Vb.forEach(l=>{var A;const c=e.getBoneNode(l);if(c){const u=r[l];let f=l,h,p;for(;h==null&&(f=$le[f],f!=null);)h=r[f],p=i[f];const d=new It;d.name="Normalized_"+c.name,(f?(A=a[f])===null||A===void 0?void 0:A.node:t).add(d),d.position.copy(u),h&&d.position.sub(h),a[l]={node:d},o[l]=p??new rt}}),{rigBones:a,root:t,parentWorldRotations:o,boneRotations:s}}update(){Vb.forEach(e=>{const t=this.original.getBoneNode(e);if(t!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=Xle.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(Zle);t.parent.updateWorldMatrix(!0,!1);const l=t.parent.matrixWorld,A=a.applyMatrix4(l.invert());t.position.copy(A)}}})}}class Uw{constructor(e,t){var r;this.autoUpdateHumanBones=(r=t==null?void 0:t.autoUpdateHumanBones)!==null&&r!==void 0?r:!0,this._rawHumanBones=new FC(e),this._normalizedHumanBones=new Fw(this._rawHumanBones)}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}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new FC(e.humanBones),this._normalizedHumanBones=new Fw(this._rawHumanBones),this}clone(){return new Uw(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()}}const Jle={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"},qle=new Set(["1.0","1.0-beta"]),s3={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"};class eAe{constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot,this.autoUpdateHumanBones=t==null?void 0:t.autoUpdateHumanBones}get name(){return"VRMHumanoidLoaderPlugin"}afterRoot(e){return zt(this,void 0,void 0,function*(){e.userData.vrmHumanoid=yield this._import(e)})}_import(e){return zt(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t)return t;const r=yield this._v0Import(e);return r||null})}_v1Import(e){var t,r;return zt(this,void 0,void 0,function*(){const i=this.parser.json;if(!(((t=i.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)===null||r===void 0?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!qle.has(a))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.humanoid;if(!l)return null;const A=l.humanBones.leftThumbIntermediate!=null||l.humanBones.rightThumbIntermediate!=null,c={};l.humanBones!=null&&(yield Promise.all(Object.entries(l.humanBones).map(([f,h])=>zt(this,void 0,void 0,function*(){let p=f;const d=h.node;if(A){const m=s3[p];m!=null&&(p=m)}const g=yield this.parser.getDependency("node",d);if(g==null){console.warn(`A glTF node bound to the humanoid bone ${p} (index = ${d}) does not exist`);return}c[p]={node:g}}))));const u=new Uw(this._ensureRequiredBonesExist(c),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(u.normalizedHumanBonesRoot),this.helperRoot){const f=new i3(u);this.helperRoot.add(f),f.renderOrder=this.helperRoot.renderOrder}return u})}_v0Import(e){var t;return zt(this,void 0,void 0,function*(){const i=(t=this.parser.json.extensions)===null||t===void 0?void 0:t.VRM;if(!i)return null;const s=i.humanoid;if(!s)return null;const o={};s.humanBones!=null&&(yield Promise.all(s.humanBones.map(l=>zt(this,void 0,void 0,function*(){const A=l.bone,c=l.node;if(A==null||c==null)return;const u=yield this.parser.getDependency("node",c);if(u==null){console.warn(`A glTF node bound to the humanoid bone ${A} (index = ${c}) does not exist`);return}const f=s3[A],h=f??A;if(o[h]!=null){console.warn(`Multiple bone entries for ${h} detected (index = ${c}), ignoring duplicated entries.`);return}o[h]={node:u}}))));const a=new Uw(this._ensureRequiredBonesExist(o),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(a.normalizedHumanBonesRoot),this.helperRoot){const l=new i3(a);this.helperRoot.add(l),l.renderOrder=this.helperRoot.renderOrder}return a})}_ensureRequiredBonesExist(e){const t=Object.values(Jle).filter(r=>e[r]==null);if(t.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${t.join(", ")}`);return e}}class o3 extends $t{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new At(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(3*63),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,e=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),e&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let e=0;e<64;e++){const t=e/63*this._currentTheta;this._attrPos.setXYZ(e+1,this._currentRadius*Math.sin(t),0,this._currentRadius*Math.cos(t))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<63;e++)this._attrIndex.setXYZ(e*3,0,e+1,e+2);this._attrIndex.needsUpdate=!0}}class tAe extends $t{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new Z,this._currentTail=new Z,this._attrPos=new At(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}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 e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const ov=new rt,a3=new rt,Zd=new Z,l3=new Z,A3=Math.sqrt(2)/2,nAe=new rt(0,0,-A3,A3),rAe=new Z(0,1,0);class iAe extends Ur{constructor(e){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=e;{const t=new o3;t.radius=.5;const r=new Ei({color:65280,transparent:!0,opacity:.5,side:ui,depthTest:!1,depthWrite:!1});this._meshPitch=new xn(t,r),this.add(this._meshPitch)}{const t=new o3;t.radius=.5;const r=new Ei({color:16711680,transparent:!0,opacity:.5,side:ui,depthTest:!1,depthWrite:!1});this._meshYaw=new xn(t,r),this.add(this._meshYaw)}{const t=new tAe;t.radius=.1;const r=new Sl({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new wg(t,r),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(e){const t=Lt.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=t,this._meshYaw.geometry.update();const r=Lt.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=r,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(Zd),this.vrmLookAt.getLookAtWorldQuaternion(ov),ov.multiply(this.vrmLookAt.getFaceFrontQuaternion(a3)),this._meshYaw.position.copy(Zd),this._meshYaw.quaternion.copy(ov),this._meshPitch.position.copy(Zd),this._meshPitch.quaternion.copy(ov),this._meshPitch.quaternion.multiply(a3.setFromAxisAngle(rAe,t)),this._meshPitch.quaternion.multiply(nAe);const{target:i,autoUpdate:s}=this.vrmLookAt;i!=null&&s&&(i.getWorldPosition(l3).sub(Zd),this._lineTarget.geometry.tail.copy(l3),this._lineTarget.geometry.update(),this._lineTarget.position.copy(Zd)),super.updateMatrixWorld(e)}}const sAe=new Z,oAe=new Z;function UC(n,e){return n.matrixWorld.decompose(sAe,e,oAe),e}function fy(n){return[Math.atan2(-n.z,n.x),Math.atan2(n.y,Math.sqrt(n.x*n.x+n.z*n.z))]}function c3(n){const e=Math.round(n/2/Math.PI);return n-2*Math.PI*e}const u3=new Z(0,0,1),aAe=new Z,lAe=new Z,AAe=new Z,cAe=new rt,jb=new rt,f3=new rt,uAe=new rt,Wb=new fi;class s_{constructor(e,t){this.offsetFromHeadBone=new Z,this.autoUpdate=!0,this.faceFront=new Z(0,0,1),this.humanoid=e,this.applier=t,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new rt)}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 fi)}getEuler(e){return e.set(Lt.DEG2RAD*this._pitch,Lt.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 s_(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 UC(t,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(u3)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,r]=fy(this.faceFront);return Wb.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(Wb).premultiply(uAe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(jb),this.getFaceFrontQuaternion(f3),e.copy(u3).applyQuaternion(jb).applyQuaternion(f3).applyEuler(this.getEuler(Wb))}lookAt(e){const t=cAe.copy(this._restHeadWorldQuaternion).multiply(r5(this.getLookAtWorldQuaternion(jb))),r=this.getLookAtWorldPosition(lAe),i=AAe.copy(e).sub(r).applyQuaternion(t).normalize(),[s,o]=fy(this.faceFront),[a,l]=fy(i),A=c3(a-s),c=c3(o-l);this._yaw=Lt.RAD2DEG*A,this._pitch=Lt.RAD2DEG*c,this._needsUpdate=!0}update(e){this.target!=null&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(aAe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}}s_.EULER_ORDER="YXZ";const fAe=new Z(0,0,1),Po=new rt,ju=new rt,ys=new fi(0,0,0,"YXZ");class hy{constructor(e,t,r,i,s){this.humanoid=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=r,this.rangeMapVerticalDown=i,this.rangeMapVerticalUp=s,this.faceFront=new Z(0,0,1),this._restQuatLeftEye=new rt,this._restQuatRightEye=new rt,this._restLeftEyeParentWorldQuat=new rt,this._restRightEyeParentWorldQuat=new rt;const o=this.humanoid.getRawBoneNode("leftEye"),a=this.humanoid.getRawBoneNode("rightEye");o&&(this._restQuatLeftEye.copy(o.quaternion),UC(o.parent,this._restLeftEyeParentWorldQuat)),a&&(this._restQuatRightEye.copy(a.quaternion),UC(a.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(e,t){const r=this.humanoid.getRawBoneNode("leftEye"),i=this.humanoid.getRawBoneNode("rightEye"),s=this.humanoid.getNormalizedBoneNode("leftEye"),o=this.humanoid.getNormalizedBoneNode("rightEye");r&&(t<0?ys.x=-Lt.DEG2RAD*this.rangeMapVerticalDown.map(-t):ys.x=Lt.DEG2RAD*this.rangeMapVerticalUp.map(t),e<0?ys.y=-Lt.DEG2RAD*this.rangeMapHorizontalInner.map(-e):ys.y=Lt.DEG2RAD*this.rangeMapHorizontalOuter.map(e),Po.setFromEuler(ys),this._getWorldFaceFrontQuat(ju),s.quaternion.copy(ju).multiply(Po).multiply(ju.invert()),Po.copy(this._restLeftEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(Po).premultiply(Po.invert()).multiply(this._restQuatLeftEye)),i&&(t<0?ys.x=-Lt.DEG2RAD*this.rangeMapVerticalDown.map(-t):ys.x=Lt.DEG2RAD*this.rangeMapVerticalUp.map(t),e<0?ys.y=-Lt.DEG2RAD*this.rangeMapHorizontalOuter.map(-e):ys.y=Lt.DEG2RAD*this.rangeMapHorizontalInner.map(e),Po.setFromEuler(ys),this._getWorldFaceFrontQuat(ju),o.quaternion.copy(ju).multiply(Po).multiply(ju.invert()),Po.copy(this._restRightEyeParentWorldQuat),i.quaternion.copy(o.quaternion).multiply(Po).premultiply(Po.invert()).multiply(this._restQuatRightEye))}lookAt(e){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const t=Lt.RAD2DEG*e.y,r=Lt.RAD2DEG*e.x;this.applyYawPitch(t,r)}_getWorldFaceFrontQuat(e){if(this.faceFront.distanceToSquared(fAe)<.01)return e.identity();const[t,r]=fy(this.faceFront);return ys.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(ys)}}hy.type="bone";class LC{constructor(e,t,r,i,s){this.expressions=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=r,this.rangeMapVerticalDown=i,this.rangeMapVerticalUp=s}applyYawPitch(e,t){t<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-t))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(t))),e<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-e))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(e)))}lookAt(e){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const t=Lt.RAD2DEG*e.y,r=Lt.RAD2DEG*e.x;this.applyYawPitch(t,r)}}LC.type="expression";class h3{constructor(e,t){this.inputMaxValue=e,this.outputScale=t}map(e){return this.outputScale*n5(e/this.inputMaxValue)}}const hAe=new Set(["1.0","1.0-beta"]);class dAe{constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}get name(){return"VRMLookAtLoaderPlugin"}afterRoot(e){return zt(this,void 0,void 0,function*(){const t=e.userData.vrmHumanoid;if(t===null)return;if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const r=e.userData.vrmExpressionManager;if(r!==null){if(r===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");e.userData.vrmLookAt=yield this._import(e,t,r)}})}_import(e,t,r){return zt(this,void 0,void 0,function*(){if(t==null||r==null)return null;const i=yield this._v1Import(e,t,r);if(i)return i;const s=yield this._v0Import(e,t,r);return s||null})}_v1Import(e,t,r){var i,s,o;return zt(this,void 0,void 0,function*(){const a=this.parser.json;if(!(((i=a.extensionsUsed)===null||i===void 0?void 0:i.indexOf("VRMC_vrm"))!==-1))return null;const A=(s=a.extensions)===null||s===void 0?void 0:s.VRMC_vrm;if(!A)return null;const c=A.specVersion;if(!hAe.has(c))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${c}"`),null;const u=A.lookAt;if(!u)return null;const f=u.type==="expression"?1:10,h=this._v1ImportRangeMap(u.rangeMapHorizontalInner,f),p=this._v1ImportRangeMap(u.rangeMapHorizontalOuter,f),d=this._v1ImportRangeMap(u.rangeMapVerticalDown,f),g=this._v1ImportRangeMap(u.rangeMapVerticalUp,f);let m;u.type==="expression"?m=new LC(r,h,p,d,g):m=new hy(t,h,p,d,g);const y=this._importLookAt(t,m);return y.offsetFromHeadBone.fromArray((o=u.offsetFromHeadBone)!==null&&o!==void 0?o:[0,.06,0]),y})}_v1ImportRangeMap(e,t){var r,i;return new h3((r=e==null?void 0:e.inputMaxValue)!==null&&r!==void 0?r:90,(i=e==null?void 0:e.outputScale)!==null&&i!==void 0?i:t)}_v0Import(e,t,r){var i,s,o,a;return zt(this,void 0,void 0,function*(){const A=(i=this.parser.json.extensions)===null||i===void 0?void 0:i.VRM;if(!A)return null;const c=A.firstPerson;if(!c)return null;const u=c.lookAtTypeName==="BlendShape"?1:10,f=this._v0ImportDegreeMap(c.lookAtHorizontalInner,u),h=this._v0ImportDegreeMap(c.lookAtHorizontalOuter,u),p=this._v0ImportDegreeMap(c.lookAtVerticalDown,u),d=this._v0ImportDegreeMap(c.lookAtVerticalUp,u);let g;c.lookAtTypeName==="BlendShape"?g=new LC(r,f,h,p,d):g=new hy(t,f,h,p,d);const m=this._importLookAt(t,g);return c.firstPersonBoneOffset?m.offsetFromHeadBone.set((s=c.firstPersonBoneOffset.x)!==null&&s!==void 0?s:0,(o=c.firstPersonBoneOffset.y)!==null&&o!==void 0?o:.06,-((a=c.firstPersonBoneOffset.z)!==null&&a!==void 0?a:0)):m.offsetFromHeadBone.set(0,.06,0),m.faceFront.set(0,0,-1),g instanceof hy&&g.faceFront.set(0,0,-1),m})}_v0ImportDegreeMap(e,t){var r,i;const s=e==null?void 0:e.curve;return JSON.stringify(s)!=="[0,0,0,1,1,1,1,0]"&&console.warn("Curves of LookAtDegreeMap defined in VRM 0.0 are not supported"),new h3((r=e==null?void 0:e.xRange)!==null&&r!==void 0?r:90,(i=e==null?void 0:e.yRange)!==null&&i!==void 0?i:t)}_importLookAt(e,t){const r=new s_(e,t);if(this.helperRoot){const i=new iAe(r);this.helperRoot.add(i),i.renderOrder=this.helperRoot.renderOrder}return r}}function pAe(n,e){return typeof n!="string"||n===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(n)&&(e=e.replace(/(^https?:\/\/[^/]+).*/i,"$1")),/^(https?:)?\/\//i.test(n)||/^data:.*,.*$/i.test(n)||/^blob:.*$/i.test(n)?n:e+n)}const mAe=new Set(["1.0","1.0-beta"]);class gAe{constructor(e,t){var r,i,s;this.parser=e,this.needThumbnailImage=(r=t==null?void 0:t.needThumbnailImage)!==null&&r!==void 0?r:!0,this.acceptLicenseUrls=(i=t==null?void 0:t.acceptLicenseUrls)!==null&&i!==void 0?i:["https://vrm.dev/licenses/1.0/"],this.acceptV0Meta=(s=t==null?void 0:t.acceptV0Meta)!==null&&s!==void 0?s:!0}get name(){return"VRMMetaLoaderPlugin"}afterRoot(e){return zt(this,void 0,void 0,function*(){e.userData.vrmMeta=yield this._import(e)})}_import(e){return zt(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){var t,r,i;return zt(this,void 0,void 0,function*(){const s=this.parser.json;if(!(((t=s.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const a=(r=s.extensions)===null||r===void 0?void 0:r.VRMC_vrm;if(a==null)return null;const l=a.specVersion;if(!mAe.has(l))return console.warn(`VRMMetaLoaderPlugin: Unknown VRMC_vrm specVersion "${l}"`),null;const A=a.meta;if(!A)return null;const c=A.licenseUrl;if(!new Set(this.acceptLicenseUrls).has(c))throw new Error(`VRMMetaLoaderPlugin: The license url "${c}" is not accepted`);let f;return this.needThumbnailImage&&A.thumbnailImage!=null&&(f=(i=yield this._extractGLTFImage(A.thumbnailImage))!==null&&i!==void 0?i:void 0),{metaVersion:"1",name:A.name,version:A.version,authors:A.authors,copyrightInformation:A.copyrightInformation,contactInformation:A.contactInformation,references:A.references,thirdPartyLicenses:A.thirdPartyLicenses,thumbnailImage:f,licenseUrl:A.licenseUrl,avatarPermission:A.avatarPermission,allowExcessivelyViolentUsage:A.allowExcessivelyViolentUsage,allowExcessivelySexualUsage:A.allowExcessivelySexualUsage,commercialUsage:A.commercialUsage,allowPoliticalOrReligiousUsage:A.allowPoliticalOrReligiousUsage,allowAntisocialOrHateUsage:A.allowAntisocialOrHateUsage,creditNotation:A.creditNotation,allowRedistribution:A.allowRedistribution,modification:A.modification,otherLicenseUrl:A.otherLicenseUrl}})}_v0Import(e){var t;return zt(this,void 0,void 0,function*(){const i=(t=this.parser.json.extensions)===null||t===void 0?void 0:t.VRM;if(!i)return null;const s=i.meta;if(!s)return null;if(!this.acceptV0Meta)throw new Error("VRMMetaLoaderPlugin: Attempted to load VRM0.0 meta but acceptV0Meta is false");let o;return this.needThumbnailImage&&s.texture!=null&&s.texture!==-1&&(o=yield this.parser.getDependency("texture",s.texture)),{metaVersion:"0",allowedUserName:s.allowedUserName,author:s.author,commercialUssageName:s.commercialUssageName,contactInformation:s.contactInformation,licenseName:s.licenseName,otherLicenseUrl:s.otherLicenseUrl,otherPermissionUrl:s.otherPermissionUrl,reference:s.reference,sexualUssageName:s.sexualUssageName,texture:o??void 0,title:s.title,version:s.version,violentUssageName:s.violentUssageName}})}_extractGLTFImage(e){var t;return zt(this,void 0,void 0,function*(){const i=(t=this.parser.json.images)===null||t===void 0?void 0:t[e];if(i==null)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${e}] of glTF as a thumbnail but the image doesn't exist`),null;let s=i.uri;if(i.bufferView!=null){const a=yield this.parser.getDependency("bufferView",i.bufferView),l=new Blob([a],{type:i.mimeType});s=URL.createObjectURL(l)}return s==null?(console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${e}] of glTF as a thumbnail but the image couldn't load properly`),null):yield new LH().loadAsync(pAe(s,this.parser.options.path)).catch(a=>(console.error(a),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}}class vAe{constructor(e){this.scene=e.scene,this.meta=e.meta,this.humanoid=e.humanoid,this.expressionManager=e.expressionManager,this.firstPerson=e.firstPerson,this.lookAt=e.lookAt}update(e){this.humanoid.update(),this.lookAt&&this.lookAt.update(e),this.expressionManager&&this.expressionManager.update()}}class yAe extends vAe{constructor(e){super(e),this.materials=e.materials,this.springBoneManager=e.springBoneManager,this.nodeConstraintManager=e.nodeConstraintManager}update(e){super.update(e),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(e),this.materials&&this.materials.forEach(t=>{t.update&&t.update(e)})}}function av(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}/*! * @pixiv/three-vrm-materials-mtoon v1.0.9 * MToon (toon material) module for @pixiv/three-vrm * * Copyright (c) 2020-2023 pixiv Inc. * @pixiv/three-vrm-materials-mtoon is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */function Sc(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}var wAe=`// #define PHONG + */function Mc(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}var wAe=`// #define PHONG varying vec3 vViewPosition; @@ -4066,40 +4066,40 @@ void main() { gl_FragColor = vec4( col, diffuseColor.a ); postCorrection(); } -`;const _Ae={None:"none",Normal:"normal",LitShadeRate:"litShadeRate",UV:"uv"},Kb={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},bAe=3002,BAe=3004,EAe=3005,CAe=3006,SAe=3007,MAe=n=>{if(parseInt(Ms,10)>=136)switch(n){case cs:return["Linear","( value )"];case pt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}else switch(n){case cs:return["Linear","( value )"];case pt:return["sRGB","( value )"];case bAe:return["RGBE","( value )"];case BAe:return["RGBM","( value, 7.0 )"];case EAe:return["RGBM","( value, 16.0 )"];case CAe:return["RGBD","( value, 256.0 )"];case SAe:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+n)}},$b=(n,e)=>{const t=MAe(e);return"vec4 "+n+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"};function Yb(n,e){let t;return n&&n.isTexture?t=n.encoding:t=cs,parseInt(Ms,10)>=133&&e&&n&&n.isTexture&&n.format===br&&n.type===OA&&n.encoding===pt&&(t=cs),t}class hy extends Cr{constructor(e={}){super({vertexShader:wAe,fragmentShader:xAe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=Jh,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=_Ae.None,this._outlineWidthMode=Kb.None,this._isOutline=!1,e.transparentWithZWrite&&(e.depthWrite=!0),delete e.transparentWithZWrite,e.fog=!0,e.lights=!0,e.clipping=!0,parseInt(Ms,10)<129&&(e.skinning=e.skinning||!1),parseInt(Ms,10)<131&&(e.morphTargets=e.morphTargets||!1,e.morphNormals=e.morphNormals||!1),this.uniforms=ZM.merge([Ne.common,Ne.normalmap,Ne.emissivemap,Ne.fog,Ne.lights,{litFactor:{value:new Qe(1,1,1)},mapUvTransform:{value:new En},colorAlpha:{value:1},normalMapUvTransform:{value:new En},shadeColorFactor:{value:new Qe(.97,.81,.86)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new En},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new En},shadingShiftTextureScale:{value:null},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new Qe(0,0,0)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new En},parametricRimColorFactor:{value:new Qe(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new En},rimLightingMixFactor:{value:0},parametricRimFresnelPowerFactor:{value:1},parametricRimLiftFactor:{value:0},emissive:{value:new Qe(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new En},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new En},outlineWidthFactor:{value:.5},outlineColorFactor:{value:new Qe(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new En},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},e.uniforms]),this.setValues(e),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([t,r])=>`${t}:${r}`),this.matcapTexture?`matcapTextureEncoding:${this.matcapTexture.encoding}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureEncoding:${this.shadeMultiplyTexture.encoding}`:"",this.rimMultiplyTexture?`rimMultiplyTextureEncoding:${this.rimMultiplyTexture.encoding}`:""].join(","),this.onBeforeCompile=(t,r)=>{const i=r.capabilities.isWebGL2,s=parseInt(Ms,10),o=Object.entries(Object.assign(Object.assign({},this._generateDefines()),this.defines)).filter(([l,A])=>!!A).map(([l,A])=>`#define ${l} ${A}`).join(` +`;const _Ae={None:"none",Normal:"normal",LitShadeRate:"litShadeRate",UV:"uv"},Kb={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},bAe=3002,BAe=3004,EAe=3005,CAe=3006,SAe=3007,MAe=n=>{if(parseInt(Ts,10)>=136)switch(n){case cs:return["Linear","( value )"];case pt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}else switch(n){case cs:return["Linear","( value )"];case pt:return["sRGB","( value )"];case bAe:return["RGBE","( value )"];case BAe:return["RGBM","( value, 7.0 )"];case EAe:return["RGBM","( value, 16.0 )"];case CAe:return["RGBD","( value, 256.0 )"];case SAe:return["Gamma","( value, float( GAMMA_FACTOR ) )"];default:throw new Error("unsupported encoding: "+n)}},$b=(n,e)=>{const t=MAe(e);return"vec4 "+n+"( vec4 value ) { return "+t[0]+"ToLinear"+t[1]+"; }"};function Yb(n,e){let t;return n&&n.isTexture?t=n.encoding:t=cs,parseInt(Ts,10)>=133&&e&&n&&n.isTexture&&n.format===Br&&n.type===NA&&n.encoding===pt&&(t=cs),t}class dy extends Sr{constructor(e={}){super({vertexShader:wAe,fragmentShader:xAe}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=qh,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=_Ae.None,this._outlineWidthMode=Kb.None,this._isOutline=!1,e.transparentWithZWrite&&(e.depthWrite=!0),delete e.transparentWithZWrite,e.fog=!0,e.lights=!0,e.clipping=!0,parseInt(Ts,10)<129&&(e.skinning=e.skinning||!1),parseInt(Ts,10)<131&&(e.morphTargets=e.morphTargets||!1,e.morphNormals=e.morphNormals||!1),this.uniforms=ZM.merge([Ne.common,Ne.normalmap,Ne.emissivemap,Ne.fog,Ne.lights,{litFactor:{value:new Qe(1,1,1)},mapUvTransform:{value:new En},colorAlpha:{value:1},normalMapUvTransform:{value:new En},shadeColorFactor:{value:new Qe(.97,.81,.86)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new En},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new En},shadingShiftTextureScale:{value:null},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new Qe(0,0,0)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new En},parametricRimColorFactor:{value:new Qe(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new En},rimLightingMixFactor:{value:0},parametricRimFresnelPowerFactor:{value:1},parametricRimLiftFactor:{value:0},emissive:{value:new Qe(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new En},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new En},outlineWidthFactor:{value:.5},outlineColorFactor:{value:new Qe(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new En},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},e.uniforms]),this.setValues(e),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([t,r])=>`${t}:${r}`),this.matcapTexture?`matcapTextureEncoding:${this.matcapTexture.encoding}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureEncoding:${this.shadeMultiplyTexture.encoding}`:"",this.rimMultiplyTexture?`rimMultiplyTextureEncoding:${this.rimMultiplyTexture.encoding}`:""].join(","),this.onBeforeCompile=(t,r)=>{const i=r.capabilities.isWebGL2,s=parseInt(Ts,10),o=Object.entries(Object.assign(Object.assign({},this._generateDefines()),this.defines)).filter(([l,A])=>!!A).map(([l,A])=>`#define ${l} ${A}`).join(` `)+` -`;let a="";parseInt(Ms,10)<137&&(a=(this.matcapTexture!==null?$b("matcapTextureTexelToLinear",Yb(this.matcapTexture,i))+` +`;let a="";parseInt(Ts,10)<137&&(a=(this.matcapTexture!==null?$b("matcapTextureTexelToLinear",Yb(this.matcapTexture,i))+` `:"")+(this.shadeMultiplyTexture!==null?$b("shadeMultiplyTextureTexelToLinear",Yb(this.shadeMultiplyTexture,i))+` `:"")+(this.rimMultiplyTexture!==null?$b("rimMultiplyTextureTexelToLinear",Yb(this.rimMultiplyTexture,i))+` -`:"")),t.vertexShader=o+t.vertexShader,t.fragmentShader=o+a+t.fragmentShader,s<132&&(t.fragmentShader=t.fragmentShader.replace("#include ",""),t.fragmentShader=t.fragmentShader.replace("#include ",""))}}get color(){return this.uniforms.litFactor.value}set color(e){this.uniforms.litFactor.value=e}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e}get normalMap(){return this.uniforms.normalMap.value}set normalMap(e){this.uniforms.normalMap.value=e}get normalScale(){return this.uniforms.normalScale.value}set normalScale(e){this.uniforms.normalScale.value=e}get emissive(){return this.uniforms.emissive.value}set emissive(e){this.uniforms.emissive.value=e}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(e){this.uniforms.emissiveIntensity.value=e}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(e){this.uniforms.emissiveMap.value=e}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(e){this.uniforms.shadeColorFactor.value=e}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(e){this.uniforms.shadeMultiplyTexture.value=e}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(e){this.uniforms.shadingShiftFactor.value=e}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(e){this.uniforms.shadingShiftTexture.value=e}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(e){this.uniforms.shadingShiftTextureScale.value=e}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(e){this.uniforms.shadingToonyFactor.value=e}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(e){this.uniforms.giEqualizationFactor.value=e}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(e){this.uniforms.matcapFactor.value=e}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(e){this.uniforms.matcapTexture.value=e}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(e){this.uniforms.parametricRimColorFactor.value=e}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(e){this.uniforms.rimMultiplyTexture.value=e}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(e){this.uniforms.rimLightingMixFactor.value=e}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(e){this.uniforms.parametricRimFresnelPowerFactor.value=e}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(e){this.uniforms.parametricRimLiftFactor.value=e}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(e){this.uniforms.outlineWidthMultiplyTexture.value=e}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(e){this.uniforms.outlineWidthFactor.value=e}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(e){this.uniforms.outlineColorFactor.value=e}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(e){this.uniforms.outlineLightingMixFactor.value=e}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(e){this.uniforms.uvAnimationMaskTexture.value=e}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(e){this.uniforms.uvAnimationScrollXOffset.value=e}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(e){this.uniforms.uvAnimationScrollYOffset.value=e}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(e){this.uniforms.uvAnimationRotationPhase.value=e}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(e){this._ignoreVertexColor=e,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(e){this._v0CompatShade=e,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(e){this._debugMode=e,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(e){this._outlineWidthMode=e,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(e){this._isOutline=e,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(e){this._uploadUniformsWorkaround(),this._updateUVAnimation(e)}copy(e){return super.copy(e),this.map=e.map,this.normalMap=e.normalMap,this.emissiveMap=e.emissiveMap,this.shadeMultiplyTexture=e.shadeMultiplyTexture,this.shadingShiftTexture=e.shadingShiftTexture,this.matcapTexture=e.matcapTexture,this.rimMultiplyTexture=e.rimMultiplyTexture,this.outlineWidthMultiplyTexture=e.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=e.uvAnimationMaskTexture,this.normalMapType=e.normalMapType,this.uvAnimationScrollXSpeedFactor=e.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=e.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=e.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=e.ignoreVertexColor,this.v0CompatShade=e.v0CompatShade,this.debugMode=e.debugMode,this.outlineWidthMode=e.outlineWidthMode,this.isOutline=e.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(e){this.uniforms.uvAnimationScrollXOffset.value+=e*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=e*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=e*this.uvAnimationRotationSpeedFactor,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),parseInt(Ms,10)>=132&&(this.uniforms.alphaTest.value=this.alphaTest),this.uniformsNeedUpdate=!0}_generateDefines(){const e=parseInt(Ms,10),t=this.outlineWidthMultiplyTexture!==null,r=this.map!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:e,OUTLINE:this._isOutline,MTOON_USE_UV:t||r,MTOON_UVS_VERTEX_ONLY:t&&!r,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_WORLD:this._isOutline&&this._outlineWidthMode===Kb.WorldCoordinates,OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===Kb.ScreenCoordinates}}_updateTextureMatrix(e,t){e.value&&(e.value.matrixAutoUpdate&&e.value.updateMatrix(),t.value.copy(e.value.matrix))}}class TAe{constructor(e,t){this._parser=e,this._materialParams=t,this._pendings=[]}get pending(){return Promise.all(this._pendings)}assignPrimitive(e,t){t!=null&&(this._materialParams[e]=t)}assignColor(e,t,r){t!=null&&(this._materialParams[e]=new Qe().fromArray(t),r&&this._materialParams[e].convertSRGBToLinear())}assignTexture(e,t,r){return Sc(this,void 0,void 0,function*(){const i=(()=>Sc(this,void 0,void 0,function*(){t!=null&&(yield this._parser.assignTexture(this._materialParams,e,t),r&&(this._materialParams[e].encoding=pt))}))();return this._pendings.push(i),i})}assignTextureByIndex(e,t,r){return Sc(this,void 0,void 0,function*(){return this.assignTexture(e,t!=null?{index:t}:void 0,r)})}}const IAe=new Set(["1.0","1.0-beta"]);class fh{constructor(e,t={}){var r,i,s;this.parser=e,this.renderOrderOffset=(r=t.renderOrderOffset)!==null&&r!==void 0?r:0,this.v0CompatShade=(i=t.v0CompatShade)!==null&&i!==void 0?i:!1,this.debugMode=(s=t.debugMode)!==null&&s!==void 0?s:"none",this._mToonMaterialSet=new Set}get name(){return fh.EXTENSION_NAME}beforeRoot(){return Sc(this,void 0,void 0,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return Sc(this,void 0,void 0,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?hy:null}extendMaterialParams(e,t){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,t):null}loadMesh(e){var t;return Sc(this,void 0,void 0,function*(){const r=this.parser,s=(t=r.json.meshes)===null||t===void 0?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,A=o[0].material;A!=null&&this._setupPrimitive(l,A)}else{const l=a;for(let A=0;A{var o;this._getMToonExtension(s)&&(!((o=i.extensions)===null||o===void 0)&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var t,r;const o=(t=this.parser.json.materials)===null||t===void 0?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||r===void 0?void 0:r[fh.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!IAe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${fh.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,t){var r;return Sc(this,void 0,void 0,function*(){delete t.metalness,delete t.roughness;const i=new TAe(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||r===void 0?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}}_generateOutline(e){const t=e.material;if(!(t instanceof hy)||t.outlineWidthMode==="none"||t.outlineWidthFactor<=0)return;e.material=[t];const r=t.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=Xr,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)i instanceof hy&&this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var t;return(e.transparentWithZWrite?0:19)+((t=e.renderQueueOffsetNumber)!==null&&t!==void 0?t:0)}}fh.EXTENSION_NAME="VRMC_materials_mtoon";/*! +`:"")),t.vertexShader=o+t.vertexShader,t.fragmentShader=o+a+t.fragmentShader,s<132&&(t.fragmentShader=t.fragmentShader.replace("#include ",""),t.fragmentShader=t.fragmentShader.replace("#include ",""))}}get color(){return this.uniforms.litFactor.value}set color(e){this.uniforms.litFactor.value=e}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e}get normalMap(){return this.uniforms.normalMap.value}set normalMap(e){this.uniforms.normalMap.value=e}get normalScale(){return this.uniforms.normalScale.value}set normalScale(e){this.uniforms.normalScale.value=e}get emissive(){return this.uniforms.emissive.value}set emissive(e){this.uniforms.emissive.value=e}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(e){this.uniforms.emissiveIntensity.value=e}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(e){this.uniforms.emissiveMap.value=e}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(e){this.uniforms.shadeColorFactor.value=e}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(e){this.uniforms.shadeMultiplyTexture.value=e}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(e){this.uniforms.shadingShiftFactor.value=e}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(e){this.uniforms.shadingShiftTexture.value=e}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(e){this.uniforms.shadingShiftTextureScale.value=e}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(e){this.uniforms.shadingToonyFactor.value=e}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(e){this.uniforms.giEqualizationFactor.value=e}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(e){this.uniforms.matcapFactor.value=e}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(e){this.uniforms.matcapTexture.value=e}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(e){this.uniforms.parametricRimColorFactor.value=e}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(e){this.uniforms.rimMultiplyTexture.value=e}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(e){this.uniforms.rimLightingMixFactor.value=e}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(e){this.uniforms.parametricRimFresnelPowerFactor.value=e}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(e){this.uniforms.parametricRimLiftFactor.value=e}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(e){this.uniforms.outlineWidthMultiplyTexture.value=e}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(e){this.uniforms.outlineWidthFactor.value=e}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(e){this.uniforms.outlineColorFactor.value=e}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(e){this.uniforms.outlineLightingMixFactor.value=e}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(e){this.uniforms.uvAnimationMaskTexture.value=e}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(e){this.uniforms.uvAnimationScrollXOffset.value=e}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(e){this.uniforms.uvAnimationScrollYOffset.value=e}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(e){this.uniforms.uvAnimationRotationPhase.value=e}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(e){this._ignoreVertexColor=e,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(e){this._v0CompatShade=e,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(e){this._debugMode=e,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(e){this._outlineWidthMode=e,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(e){this._isOutline=e,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(e){this._uploadUniformsWorkaround(),this._updateUVAnimation(e)}copy(e){return super.copy(e),this.map=e.map,this.normalMap=e.normalMap,this.emissiveMap=e.emissiveMap,this.shadeMultiplyTexture=e.shadeMultiplyTexture,this.shadingShiftTexture=e.shadingShiftTexture,this.matcapTexture=e.matcapTexture,this.rimMultiplyTexture=e.rimMultiplyTexture,this.outlineWidthMultiplyTexture=e.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=e.uvAnimationMaskTexture,this.normalMapType=e.normalMapType,this.uvAnimationScrollXSpeedFactor=e.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=e.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=e.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=e.ignoreVertexColor,this.v0CompatShade=e.v0CompatShade,this.debugMode=e.debugMode,this.outlineWidthMode=e.outlineWidthMode,this.isOutline=e.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(e){this.uniforms.uvAnimationScrollXOffset.value+=e*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=e*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=e*this.uvAnimationRotationSpeedFactor,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),parseInt(Ts,10)>=132&&(this.uniforms.alphaTest.value=this.alphaTest),this.uniformsNeedUpdate=!0}_generateDefines(){const e=parseInt(Ts,10),t=this.outlineWidthMultiplyTexture!==null,r=this.map!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:e,OUTLINE:this._isOutline,MTOON_USE_UV:t||r,MTOON_UVS_VERTEX_ONLY:t&&!r,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_WORLD:this._isOutline&&this._outlineWidthMode===Kb.WorldCoordinates,OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===Kb.ScreenCoordinates}}_updateTextureMatrix(e,t){e.value&&(e.value.matrixAutoUpdate&&e.value.updateMatrix(),t.value.copy(e.value.matrix))}}class TAe{constructor(e,t){this._parser=e,this._materialParams=t,this._pendings=[]}get pending(){return Promise.all(this._pendings)}assignPrimitive(e,t){t!=null&&(this._materialParams[e]=t)}assignColor(e,t,r){t!=null&&(this._materialParams[e]=new Qe().fromArray(t),r&&this._materialParams[e].convertSRGBToLinear())}assignTexture(e,t,r){return Mc(this,void 0,void 0,function*(){const i=(()=>Mc(this,void 0,void 0,function*(){t!=null&&(yield this._parser.assignTexture(this._materialParams,e,t),r&&(this._materialParams[e].encoding=pt))}))();return this._pendings.push(i),i})}assignTextureByIndex(e,t,r){return Mc(this,void 0,void 0,function*(){return this.assignTexture(e,t!=null?{index:t}:void 0,r)})}}const IAe=new Set(["1.0","1.0-beta"]);class hh{constructor(e,t={}){var r,i,s;this.parser=e,this.renderOrderOffset=(r=t.renderOrderOffset)!==null&&r!==void 0?r:0,this.v0CompatShade=(i=t.v0CompatShade)!==null&&i!==void 0?i:!1,this.debugMode=(s=t.debugMode)!==null&&s!==void 0?s:"none",this._mToonMaterialSet=new Set}get name(){return hh.EXTENSION_NAME}beforeRoot(){return Mc(this,void 0,void 0,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return Mc(this,void 0,void 0,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?dy:null}extendMaterialParams(e,t){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,t):null}loadMesh(e){var t;return Mc(this,void 0,void 0,function*(){const r=this.parser,s=(t=r.json.meshes)===null||t===void 0?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,A=o[0].material;A!=null&&this._setupPrimitive(l,A)}else{const l=a;for(let A=0;A{var o;this._getMToonExtension(s)&&(!((o=i.extensions)===null||o===void 0)&&o.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var t,r;const o=(t=this.parser.json.materials)===null||t===void 0?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||r===void 0?void 0:r[hh.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!IAe.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${hh.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,t){var r;return Mc(this,void 0,void 0,function*(){delete t.metalness,delete t.roughness;const i=new TAe(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||r===void 0?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}}_generateOutline(e){const t=e.material;if(!(t instanceof dy)||t.outlineWidthMode==="none"||t.outlineWidthFactor<=0)return;e.material=[t];const r=t.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=Xr,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)i instanceof dy&&this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var t;return(e.transparentWithZWrite?0:19)+((t=e.renderQueueOffsetNumber)!==null&&t!==void 0?t:0)}}hh.EXTENSION_NAME="VRMC_materials_mtoon";/*! * @pixiv/three-vrm-materials-hdr-emissive-multiplier v1.0.9 * Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm * * Copyright (c) 2020-2023 pixiv Inc. * @pixiv/three-vrm-materials-hdr-emissive-multiplier is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */function RAe(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}class $m{constructor(e){this.parser=e}get name(){return $m.EXTENSION_NAME}extendMaterialParams(e,t){return RAe(this,void 0,void 0,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||t===void 0?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||r===void 0?void 0:r[$m.EXTENSION_NAME];if(a!=null)return a}}$m.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";/*! + */function RAe(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}class Ym{constructor(e){this.parser=e}get name(){return Ym.EXTENSION_NAME}extendMaterialParams(e,t){return RAe(this,void 0,void 0,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||t===void 0?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||r===void 0?void 0:r[Ym.EXTENSION_NAME];if(a!=null)return a}}Ym.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";/*! * @pixiv/three-vrm-materials-v0compat v1.0.9 * VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm * * Copyright (c) 2020-2023 pixiv Inc. * @pixiv/three-vrm-materials-v0compat is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */function FAe(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function ju(n){return Math.pow(n,2.2)}class UAe{constructor(e){var t;this.parser=e,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const r=this.parser.json;r.extensionsUsed=(t=r.extensionsUsed)!==null&&t!==void 0?t:[],r.extensionsUsed.indexOf("KHR_texture_transform")===-1&&r.extensionsUsed.push("KHR_texture_transform")}get name(){return"VRMMaterialsV0CompatPlugin"}beforeRoot(){var e;return FAe(this,void 0,void 0,function*(){const t=this.parser.json,r=(e=t.extensions)===null||e===void 0?void 0:e.VRM,i=r==null?void 0:r.materialProperties;i&&(this._populateRenderQueueMap(i),i.forEach((s,o)=>{var a,l;const A=(a=t.materials)===null||a===void 0?void 0:a[o];if(A==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${o}] of glTF but the material doesn't exist`);return}if(s.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(s,A);t.materials[o]=c}else if(!((l=s.shader)===null||l===void 0)&&l.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(s,A);t.materials[o]=c}else s.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${s.shader}`)}))})}_parseV0MToonProperties(e,t){var r,i,s,o,a,l,A,c,u,f,h,p,d,g,m,y,w,x,_,C,S,b,M,D,$,H,I,v,E,U,P,L,z,K,O,B,W,ee,F,X,ue,le,oe,re;const pe=(i=(r=e.keywordMap)===null||r===void 0?void 0:r._ALPHABLEND_ON)!==null&&i!==void 0?i:!1,Re=((s=e.floatProperties)===null||s===void 0?void 0:s._ZWrite)===1&&pe,Q=this._v0ParseRenderQueue(e),de=(a=(o=e.keywordMap)===null||o===void 0?void 0:o._ALPHATEST_ON)!==null&&a!==void 0?a:!1,Ae=pe?"BLEND":de?"MASK":"OPAQUE",q=de?(l=e.floatProperties)===null||l===void 0?void 0:l._Cutoff:void 0,ce=((c=(A=e.floatProperties)===null||A===void 0?void 0:A._CullMode)!==null&&c!==void 0?c:2)===0,xe=this._portTextureTransform(e),be=(f=(u=e.vectorProperties)===null||u===void 0?void 0:u._Color)===null||f===void 0?void 0:f.map((Ee,ze)=>ze===3?Ee:ju(Ee)),N=(h=e.textureProperties)===null||h===void 0?void 0:h._MainTex,j=N!=null?{index:N,extensions:Object.assign({},xe)}:void 0,se=(p=e.floatProperties)===null||p===void 0?void 0:p._BumpScale,he=(d=e.textureProperties)===null||d===void 0?void 0:d._BumpMap,me=he!=null?{index:he,scale:se,extensions:Object.assign({},xe)}:void 0,G=(m=(g=e.vectorProperties)===null||g===void 0?void 0:g._EmissionColor)===null||m===void 0?void 0:m.map(ju),R=(y=e.textureProperties)===null||y===void 0?void 0:y._EmissionMap,T=R!=null?{index:R,extensions:Object.assign({},xe)}:void 0,V=(x=(w=e.vectorProperties)===null||w===void 0?void 0:w._ShadeColor)===null||x===void 0?void 0:x.map(ju),te=(_=e.textureProperties)===null||_===void 0?void 0:_._ShadeTexture,ae=te!=null?{index:te,extensions:Object.assign({},xe)}:void 0;let ie=(S=(C=e.floatProperties)===null||C===void 0?void 0:C._ShadeShift)!==null&&S!==void 0?S:0,Te=(M=(b=e.floatProperties)===null||b===void 0?void 0:b._ShadeToony)!==null&&M!==void 0?M:.9;Te=Lt.lerp(Te,1,.5+.5*ie),ie=-ie-(1-Te);const Me=(D=e.floatProperties)===null||D===void 0?void 0:D._IndirectLightIntensity,Le=Me?1-Me:void 0,ke=($=e.textureProperties)===null||$===void 0?void 0:$._SphereAdd,De=ke!=null?[1,1,1]:void 0,fe=ke!=null?{index:ke}:void 0,Ce=(H=e.floatProperties)===null||H===void 0?void 0:H._RimLightingMix,Se=(I=e.textureProperties)===null||I===void 0?void 0:I._RimTexture,Fe=Se!=null?{index:Se,extensions:Object.assign({},xe)}:void 0,We=(E=(v=e.vectorProperties)===null||v===void 0?void 0:v._RimColor)===null||E===void 0?void 0:E.map(ju),qe=(U=e.floatProperties)===null||U===void 0?void 0:U._RimFresnelPower,ut=(P=e.floatProperties)===null||P===void 0?void 0:P._RimLift,sn=["none","worldCoordinates","screenCoordinates"][(z=(L=e.floatProperties)===null||L===void 0?void 0:L._OutlineWidthMode)!==null&&z!==void 0?z:0];let Ct=(O=(K=e.floatProperties)===null||K===void 0?void 0:K._OutlineWidth)!==null&&O!==void 0?O:0;Ct=.01*Ct;const it=(B=e.textureProperties)===null||B===void 0?void 0:B._OutlineWidthTexture,ar=it!=null?{index:it,extensions:Object.assign({},xe)}:void 0,wt=(ee=(W=e.vectorProperties)===null||W===void 0?void 0:W._OutlineColor)===null||ee===void 0?void 0:ee.map(ju),Js=((F=e.floatProperties)===null||F===void 0?void 0:F._OutlineColorMode)===1?(X=e.floatProperties)===null||X===void 0?void 0:X._OutlineLightingMix:0,Vt=(ue=e.textureProperties)===null||ue===void 0?void 0:ue._UvAnimMaskTexture,Xt=Vt!=null?{index:Vt,extensions:Object.assign({},xe)}:void 0,ne=(le=e.floatProperties)===null||le===void 0?void 0:le._UvAnimScrollX;let ge=(oe=e.floatProperties)===null||oe===void 0?void 0:oe._UvAnimScrollY;ge!=null&&(ge=-ge);const Be=(re=e.floatProperties)===null||re===void 0?void 0:re._UvAnimRotation,we={specVersion:"1.0",transparentWithZWrite:Re,renderQueueOffsetNumber:Q,shadeColorFactor:V,shadeMultiplyTexture:ae,shadingShiftFactor:ie,shadingToonyFactor:Te,giEqualizationFactor:Le,matcapFactor:De,matcapTexture:fe,rimLightingMixFactor:Ce,rimMultiplyTexture:Fe,parametricRimColorFactor:We,parametricRimFresnelPowerFactor:qe,parametricRimLiftFactor:ut,outlineWidthMode:sn,outlineWidthFactor:Ct,outlineWidthMultiplyTexture:ar,outlineColorFactor:wt,outlineLightingMixFactor:Js,uvAnimationMaskTexture:Xt,uvAnimationScrollXSpeedFactor:ne,uvAnimationScrollYSpeedFactor:ge,uvAnimationRotationSpeedFactor:Be};return Object.assign(Object.assign({},t),{pbrMetallicRoughness:{baseColorFactor:be,baseColorTexture:j},normalTexture:me,emissiveTexture:T,emissiveFactor:G,alphaMode:Ae,alphaCutoff:q,doubleSided:ce,extensions:{VRMC_materials_mtoon:we}})}_parseV0UnlitProperties(e,t){var r,i,s,o;const a=e.shader==="VRM/UnlitTransparentZWrite",l=e.shader==="VRM/UnlitTransparent"||a,A=this._v0ParseRenderQueue(e),c=e.shader==="VRM/UnlitCutout",u=l?"BLEND":c?"MASK":"OPAQUE",f=c?(r=e.floatProperties)===null||r===void 0?void 0:r._Cutoff:void 0,h=this._portTextureTransform(e),p=(s=(i=e.vectorProperties)===null||i===void 0?void 0:i._Color)===null||s===void 0?void 0:s.map(ju),d=(o=e.textureProperties)===null||o===void 0?void 0:o._MainTex,g=d!=null?{index:d,extensions:Object.assign({},h)}:void 0,m={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:A,shadeColorFactor:p,shadeMultiplyTexture:g};return Object.assign(Object.assign({},t),{pbrMetallicRoughness:{baseColorFactor:p,baseColorTexture:g},alphaMode:u,alphaCutoff:f,extensions:{VRMC_materials_mtoon:m}})}_portTextureTransform(e){var t,r,i,s,o;const a=(t=e.vectorProperties)===null||t===void 0?void 0:t._MainTex;if(a==null)return{};const l=[(r=a==null?void 0:a[0])!==null&&r!==void 0?r:0,(i=a==null?void 0:a[1])!==null&&i!==void 0?i:0],A=[(s=a==null?void 0:a[2])!==null&&s!==void 0?s:1,(o=a==null?void 0:a[3])!==null&&o!==void 0?o:1];return l[1]=A[1]*(1-l[1])%1,{KHR_texture_transform:{offset:l,scale:A}}}_v0ParseRenderQueue(e){var t,r,i;const s=(r=(t=e.keywordMap)===null||t===void 0?void 0:t._ALPHABLEND_ON)!==null&&r!==void 0?r:!1,o=((i=e.floatProperties)===null||i===void 0?void 0:i._ZWrite)===1;let a=0;if(s){const l=e.renderQueue;l!=null&&(o?a=this._renderQueueMapTransparentZWrite.get(l):a=this._renderQueueMapTransparent.get(l))}return a}_populateRenderQueueMap(e){const t=new Set,r=new Set;e.forEach(i=>{var s,o,a;const l=(o=(s=i.keywordMap)===null||s===void 0?void 0:s._ALPHABLEND_ON)!==null&&o!==void 0?o:!1,A=((a=i.floatProperties)===null||a===void 0?void 0:a._ZWrite)===1;if(l){const c=i.renderQueue;c!=null&&(A?r.add(c):t.add(c))}}),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),r.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${r.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(t).sort().forEach((i,s)=>{const o=Math.min(Math.max(s-t.size+1,-9),0);this._renderQueueMapTransparent.set(i,o)}),Array.from(r).sort().forEach((i,s)=>{const o=Math.min(Math.max(s,0),9);this._renderQueueMapTransparentZWrite.set(i,o)})}}/*! + */function FAe(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function Wu(n){return Math.pow(n,2.2)}class UAe{constructor(e){var t;this.parser=e,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const r=this.parser.json;r.extensionsUsed=(t=r.extensionsUsed)!==null&&t!==void 0?t:[],r.extensionsUsed.indexOf("KHR_texture_transform")===-1&&r.extensionsUsed.push("KHR_texture_transform")}get name(){return"VRMMaterialsV0CompatPlugin"}beforeRoot(){var e;return FAe(this,void 0,void 0,function*(){const t=this.parser.json,r=(e=t.extensions)===null||e===void 0?void 0:e.VRM,i=r==null?void 0:r.materialProperties;i&&(this._populateRenderQueueMap(i),i.forEach((s,o)=>{var a,l;const A=(a=t.materials)===null||a===void 0?void 0:a[o];if(A==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${o}] of glTF but the material doesn't exist`);return}if(s.shader==="VRM/MToon"){const c=this._parseV0MToonProperties(s,A);t.materials[o]=c}else if(!((l=s.shader)===null||l===void 0)&&l.startsWith("VRM/Unlit")){const c=this._parseV0UnlitProperties(s,A);t.materials[o]=c}else s.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${s.shader}`)}))})}_parseV0MToonProperties(e,t){var r,i,s,o,a,l,A,c,u,f,h,p,d,g,m,y,w,x,_,C,S,b,M,D,$,H,I,v,E,U,P,L,z,K,O,B,W,ee,F,X,ue,le,oe,re;const pe=(i=(r=e.keywordMap)===null||r===void 0?void 0:r._ALPHABLEND_ON)!==null&&i!==void 0?i:!1,Re=((s=e.floatProperties)===null||s===void 0?void 0:s._ZWrite)===1&&pe,Q=this._v0ParseRenderQueue(e),de=(a=(o=e.keywordMap)===null||o===void 0?void 0:o._ALPHATEST_ON)!==null&&a!==void 0?a:!1,Ae=pe?"BLEND":de?"MASK":"OPAQUE",q=de?(l=e.floatProperties)===null||l===void 0?void 0:l._Cutoff:void 0,ce=((c=(A=e.floatProperties)===null||A===void 0?void 0:A._CullMode)!==null&&c!==void 0?c:2)===0,xe=this._portTextureTransform(e),be=(f=(u=e.vectorProperties)===null||u===void 0?void 0:u._Color)===null||f===void 0?void 0:f.map((Ee,ze)=>ze===3?Ee:Wu(Ee)),N=(h=e.textureProperties)===null||h===void 0?void 0:h._MainTex,j=N!=null?{index:N,extensions:Object.assign({},xe)}:void 0,se=(p=e.floatProperties)===null||p===void 0?void 0:p._BumpScale,he=(d=e.textureProperties)===null||d===void 0?void 0:d._BumpMap,me=he!=null?{index:he,scale:se,extensions:Object.assign({},xe)}:void 0,G=(m=(g=e.vectorProperties)===null||g===void 0?void 0:g._EmissionColor)===null||m===void 0?void 0:m.map(Wu),R=(y=e.textureProperties)===null||y===void 0?void 0:y._EmissionMap,T=R!=null?{index:R,extensions:Object.assign({},xe)}:void 0,V=(x=(w=e.vectorProperties)===null||w===void 0?void 0:w._ShadeColor)===null||x===void 0?void 0:x.map(Wu),te=(_=e.textureProperties)===null||_===void 0?void 0:_._ShadeTexture,ae=te!=null?{index:te,extensions:Object.assign({},xe)}:void 0;let ie=(S=(C=e.floatProperties)===null||C===void 0?void 0:C._ShadeShift)!==null&&S!==void 0?S:0,Te=(M=(b=e.floatProperties)===null||b===void 0?void 0:b._ShadeToony)!==null&&M!==void 0?M:.9;Te=Lt.lerp(Te,1,.5+.5*ie),ie=-ie-(1-Te);const Me=(D=e.floatProperties)===null||D===void 0?void 0:D._IndirectLightIntensity,Le=Me?1-Me:void 0,ke=($=e.textureProperties)===null||$===void 0?void 0:$._SphereAdd,De=ke!=null?[1,1,1]:void 0,fe=ke!=null?{index:ke}:void 0,Ce=(H=e.floatProperties)===null||H===void 0?void 0:H._RimLightingMix,Se=(I=e.textureProperties)===null||I===void 0?void 0:I._RimTexture,Fe=Se!=null?{index:Se,extensions:Object.assign({},xe)}:void 0,We=(E=(v=e.vectorProperties)===null||v===void 0?void 0:v._RimColor)===null||E===void 0?void 0:E.map(Wu),qe=(U=e.floatProperties)===null||U===void 0?void 0:U._RimFresnelPower,ut=(P=e.floatProperties)===null||P===void 0?void 0:P._RimLift,sn=["none","worldCoordinates","screenCoordinates"][(z=(L=e.floatProperties)===null||L===void 0?void 0:L._OutlineWidthMode)!==null&&z!==void 0?z:0];let Ct=(O=(K=e.floatProperties)===null||K===void 0?void 0:K._OutlineWidth)!==null&&O!==void 0?O:0;Ct=.01*Ct;const it=(B=e.textureProperties)===null||B===void 0?void 0:B._OutlineWidthTexture,ar=it!=null?{index:it,extensions:Object.assign({},xe)}:void 0,wt=(ee=(W=e.vectorProperties)===null||W===void 0?void 0:W._OutlineColor)===null||ee===void 0?void 0:ee.map(Wu),qs=((F=e.floatProperties)===null||F===void 0?void 0:F._OutlineColorMode)===1?(X=e.floatProperties)===null||X===void 0?void 0:X._OutlineLightingMix:0,Vt=(ue=e.textureProperties)===null||ue===void 0?void 0:ue._UvAnimMaskTexture,Xt=Vt!=null?{index:Vt,extensions:Object.assign({},xe)}:void 0,ne=(le=e.floatProperties)===null||le===void 0?void 0:le._UvAnimScrollX;let ge=(oe=e.floatProperties)===null||oe===void 0?void 0:oe._UvAnimScrollY;ge!=null&&(ge=-ge);const Be=(re=e.floatProperties)===null||re===void 0?void 0:re._UvAnimRotation,we={specVersion:"1.0",transparentWithZWrite:Re,renderQueueOffsetNumber:Q,shadeColorFactor:V,shadeMultiplyTexture:ae,shadingShiftFactor:ie,shadingToonyFactor:Te,giEqualizationFactor:Le,matcapFactor:De,matcapTexture:fe,rimLightingMixFactor:Ce,rimMultiplyTexture:Fe,parametricRimColorFactor:We,parametricRimFresnelPowerFactor:qe,parametricRimLiftFactor:ut,outlineWidthMode:sn,outlineWidthFactor:Ct,outlineWidthMultiplyTexture:ar,outlineColorFactor:wt,outlineLightingMixFactor:qs,uvAnimationMaskTexture:Xt,uvAnimationScrollXSpeedFactor:ne,uvAnimationScrollYSpeedFactor:ge,uvAnimationRotationSpeedFactor:Be};return Object.assign(Object.assign({},t),{pbrMetallicRoughness:{baseColorFactor:be,baseColorTexture:j},normalTexture:me,emissiveTexture:T,emissiveFactor:G,alphaMode:Ae,alphaCutoff:q,doubleSided:ce,extensions:{VRMC_materials_mtoon:we}})}_parseV0UnlitProperties(e,t){var r,i,s,o;const a=e.shader==="VRM/UnlitTransparentZWrite",l=e.shader==="VRM/UnlitTransparent"||a,A=this._v0ParseRenderQueue(e),c=e.shader==="VRM/UnlitCutout",u=l?"BLEND":c?"MASK":"OPAQUE",f=c?(r=e.floatProperties)===null||r===void 0?void 0:r._Cutoff:void 0,h=this._portTextureTransform(e),p=(s=(i=e.vectorProperties)===null||i===void 0?void 0:i._Color)===null||s===void 0?void 0:s.map(Wu),d=(o=e.textureProperties)===null||o===void 0?void 0:o._MainTex,g=d!=null?{index:d,extensions:Object.assign({},h)}:void 0,m={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:A,shadeColorFactor:p,shadeMultiplyTexture:g};return Object.assign(Object.assign({},t),{pbrMetallicRoughness:{baseColorFactor:p,baseColorTexture:g},alphaMode:u,alphaCutoff:f,extensions:{VRMC_materials_mtoon:m}})}_portTextureTransform(e){var t,r,i,s,o;const a=(t=e.vectorProperties)===null||t===void 0?void 0:t._MainTex;if(a==null)return{};const l=[(r=a==null?void 0:a[0])!==null&&r!==void 0?r:0,(i=a==null?void 0:a[1])!==null&&i!==void 0?i:0],A=[(s=a==null?void 0:a[2])!==null&&s!==void 0?s:1,(o=a==null?void 0:a[3])!==null&&o!==void 0?o:1];return l[1]=A[1]*(1-l[1])%1,{KHR_texture_transform:{offset:l,scale:A}}}_v0ParseRenderQueue(e){var t,r,i;const s=(r=(t=e.keywordMap)===null||t===void 0?void 0:t._ALPHABLEND_ON)!==null&&r!==void 0?r:!1,o=((i=e.floatProperties)===null||i===void 0?void 0:i._ZWrite)===1;let a=0;if(s){const l=e.renderQueue;l!=null&&(o?a=this._renderQueueMapTransparentZWrite.get(l):a=this._renderQueueMapTransparent.get(l))}return a}_populateRenderQueueMap(e){const t=new Set,r=new Set;e.forEach(i=>{var s,o,a;const l=(o=(s=i.keywordMap)===null||s===void 0?void 0:s._ALPHABLEND_ON)!==null&&o!==void 0?o:!1,A=((a=i.floatProperties)===null||a===void 0?void 0:a._ZWrite)===1;if(l){const c=i.renderQueue;c!=null&&(A?r.add(c):t.add(c))}}),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),r.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${r.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(t).sort().forEach((i,s)=>{const o=Math.min(Math.max(s-t.size+1,-9),0);this._renderQueueMapTransparent.set(i,o)}),Array.from(r).sort().forEach((i,s)=>{const o=Math.min(Math.max(s,0),9);this._renderQueueMapTransparentZWrite.set(i,o)})}}/*! * @pixiv/three-vrm-node-constraint v1.0.9 * Node constraint module for @pixiv/three-vrm * * Copyright (c) 2020-2023 pixiv Inc. * @pixiv/three-vrm-node-constraint is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */const Hl=new Z;class Xb extends Ur{constructor(e){super(),this._attrPosition=new At(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(dX);const t=new $t;t.setAttribute("position",this._attrPosition);const r=new Cl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new td(t,r),this.add(this._line),this.constraint=e}updateMatrixWorld(e){Hl.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,Hl.x,Hl.y,Hl.z),this.constraint.source&&Hl.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,Hl.x,Hl.y,Hl.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(e)}}function d3(n,e){return e.set(n.elements[12],n.elements[13],n.elements[14])}const LAe=new Z,PAe=new Z;function DAe(n,e){return n.decompose(LAe,e,PAe),e}function Uw(n){return n.invert?n.invert():n.inverse(),n}class gT{constructor(e,t){this.destination=e,this.source=t,this.weight=1}}const OAe=new Z,NAe=new Z,kAe=new Z,QAe=new rt,HAe=new rt,zAe=new rt;class GAe extends gT{constructor(e,t){super(e,t),this._aimAxis="PositiveX",this._v3AimAxis=new Z(1,0,0),this._dstRestQuat=new rt}get aimAxis(){return this._aimAxis}set aimAxis(e){this._aimAxis=e,this._v3AimAxis.set(e==="PositiveX"?1:e==="NegativeX"?-1:0,e==="PositiveY"?1:e==="NegativeY"?-1:0,e==="PositiveZ"?1:e==="NegativeZ"?-1:0)}get dependencies(){const e=new Set([this.source]);return this.destination.parent&&e.add(this.destination.parent),e}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const e=QAe.identity(),t=HAe.identity();this.destination.parent&&(DAe(this.destination.parent.matrixWorld,e),Uw(t.copy(e)));const r=OAe.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(e),i=d3(this.source.matrixWorld,NAe).sub(d3(this.destination.matrixWorld,kAe)).normalize(),s=zAe.setFromUnitVectors(r,i).premultiply(t).multiply(e).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(s,this.weight)}}function p3(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function VAe(n,e){const t=[n];let r=n.parent;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}class jAe{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(e){this._constraints.add(e);let t=this._objectConstraintsMap.get(e.destination);t==null&&(t=new Set,this._objectConstraintsMap.set(e.destination,t)),t.add(e)}deleteConstraint(e){this._constraints.delete(e),this._objectConstraintsMap.get(e.destination).delete(e)}setInitState(){const e=new Set,t=new Set;for(const r of this._constraints)this._processConstraint(r,e,t,i=>i.setInitState())}update(){const e=new Set,t=new Set;for(const r of this._constraints)this._processConstraint(r,e,t,i=>i.update())}_processConstraint(e,t,r,i){if(r.has(e))return;if(t.has(e))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");t.add(e);const s=e.dependencies;for(const o of s)VAe(o,a=>{const l=this._objectConstraintsMap.get(a);if(l)for(const A of l)this._processConstraint(A,t,r,i)});i(e),r.add(e)}}const WAe=new rt,KAe=new rt;class $Ae extends gT{constructor(e,t){super(e,t),this._dstRestQuat=new rt,this._invSrcRestQuat=new rt}get dependencies(){return new Set([this.source])}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Uw(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const e=WAe.copy(this._invSrcRestQuat).multiply(this.source.quaternion),t=KAe.copy(this._dstRestQuat).multiply(e);this.destination.quaternion.copy(this._dstRestQuat).slerp(t,this.weight)}}const YAe=new Z,XAe=new rt,ZAe=new rt;class JAe extends gT{constructor(e,t){super(e,t),this._rollAxis="X",this._v3RollAxis=new Z(1,0,0),this._dstRestQuat=new rt,this._invDstRestQuat=new rt,this._invSrcRestQuatMulDstRestQuat=new rt}get rollAxis(){return this._rollAxis}set rollAxis(e){this._rollAxis=e,this._v3RollAxis.set(e==="X"?1:0,e==="Y"?1:0,e==="Z"?1:0)}get dependencies(){return new Set([this.source])}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Uw(this._invDstRestQuat.copy(this._dstRestQuat)),Uw(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const e=XAe.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),t=YAe.copy(this._v3RollAxis).applyQuaternion(e),i=ZAe.setFromUnitVectors(t,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(e);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}}const qAe=new Set(["1.0","1.0-beta"]);class Mc{constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}get name(){return Mc.EXTENSION_NAME}afterRoot(e){return p3(this,void 0,void 0,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){var t;return p3(this,void 0,void 0,function*(){const r=this.parser.json;if(!(((t=r.extensionsUsed)===null||t===void 0?void 0:t.indexOf(Mc.EXTENSION_NAME))!==-1))return null;const s=new jAe,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var A;const c=r.nodes[l],u=(A=c==null?void 0:c.extensions)===null||A===void 0?void 0:A[Mc.EXTENSION_NAME];if(u==null)return;const f=u.specVersion;if(!qAe.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Mc.EXTENSION_NAME} specVersion "${f}"`);return}const h=u.constraint;if(h.roll!=null){const p=this._importRollConstraint(a,o,h.roll);s.addConstraint(p)}else if(h.aim!=null){const p=this._importAimConstraint(a,o,h.aim);s.addConstraint(p)}else if(h.rotation!=null){const p=this._importRotationConstraint(a,o,h.rotation);s.addConstraint(p)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,t,r){const{source:i,rollAxis:s,weight:o}=r,a=t[i],l=new JAe(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const A=new Xb(l);this.helperRoot.add(A)}return l}_importAimConstraint(e,t,r){const{source:i,aimAxis:s,weight:o}=r,a=t[i],l=new GAe(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const A=new Xb(l);this.helperRoot.add(A)}return l}_importRotationConstraint(e,t,r){const{source:i,weight:s}=r,o=t[i],a=new $Ae(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new Xb(a);this.helperRoot.add(l)}return a}}Mc.EXTENSION_NAME="VRMC_node_constraint";/*! + */const zl=new Z;class Xb extends Ur{constructor(e){super(),this._attrPosition=new At(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(dX);const t=new $t;t.setAttribute("position",this._attrPosition);const r=new Sl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new nd(t,r),this.add(this._line),this.constraint=e}updateMatrixWorld(e){zl.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,zl.x,zl.y,zl.z),this.constraint.source&&zl.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,zl.x,zl.y,zl.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(e)}}function d3(n,e){return e.set(n.elements[12],n.elements[13],n.elements[14])}const LAe=new Z,PAe=new Z;function DAe(n,e){return n.decompose(LAe,e,PAe),e}function Lw(n){return n.invert?n.invert():n.inverse(),n}class gT{constructor(e,t){this.destination=e,this.source=t,this.weight=1}}const OAe=new Z,NAe=new Z,kAe=new Z,QAe=new rt,HAe=new rt,zAe=new rt;class GAe extends gT{constructor(e,t){super(e,t),this._aimAxis="PositiveX",this._v3AimAxis=new Z(1,0,0),this._dstRestQuat=new rt}get aimAxis(){return this._aimAxis}set aimAxis(e){this._aimAxis=e,this._v3AimAxis.set(e==="PositiveX"?1:e==="NegativeX"?-1:0,e==="PositiveY"?1:e==="NegativeY"?-1:0,e==="PositiveZ"?1:e==="NegativeZ"?-1:0)}get dependencies(){const e=new Set([this.source]);return this.destination.parent&&e.add(this.destination.parent),e}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const e=QAe.identity(),t=HAe.identity();this.destination.parent&&(DAe(this.destination.parent.matrixWorld,e),Lw(t.copy(e)));const r=OAe.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(e),i=d3(this.source.matrixWorld,NAe).sub(d3(this.destination.matrixWorld,kAe)).normalize(),s=zAe.setFromUnitVectors(r,i).premultiply(t).multiply(e).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(s,this.weight)}}function p3(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function VAe(n,e){const t=[n];let r=n.parent;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}class jAe{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(e){this._constraints.add(e);let t=this._objectConstraintsMap.get(e.destination);t==null&&(t=new Set,this._objectConstraintsMap.set(e.destination,t)),t.add(e)}deleteConstraint(e){this._constraints.delete(e),this._objectConstraintsMap.get(e.destination).delete(e)}setInitState(){const e=new Set,t=new Set;for(const r of this._constraints)this._processConstraint(r,e,t,i=>i.setInitState())}update(){const e=new Set,t=new Set;for(const r of this._constraints)this._processConstraint(r,e,t,i=>i.update())}_processConstraint(e,t,r,i){if(r.has(e))return;if(t.has(e))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");t.add(e);const s=e.dependencies;for(const o of s)VAe(o,a=>{const l=this._objectConstraintsMap.get(a);if(l)for(const A of l)this._processConstraint(A,t,r,i)});i(e),r.add(e)}}const WAe=new rt,KAe=new rt;class $Ae extends gT{constructor(e,t){super(e,t),this._dstRestQuat=new rt,this._invSrcRestQuat=new rt}get dependencies(){return new Set([this.source])}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Lw(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const e=WAe.copy(this._invSrcRestQuat).multiply(this.source.quaternion),t=KAe.copy(this._dstRestQuat).multiply(e);this.destination.quaternion.copy(this._dstRestQuat).slerp(t,this.weight)}}const YAe=new Z,XAe=new rt,ZAe=new rt;class JAe extends gT{constructor(e,t){super(e,t),this._rollAxis="X",this._v3RollAxis=new Z(1,0,0),this._dstRestQuat=new rt,this._invDstRestQuat=new rt,this._invSrcRestQuatMulDstRestQuat=new rt}get rollAxis(){return this._rollAxis}set rollAxis(e){this._rollAxis=e,this._v3RollAxis.set(e==="X"?1:0,e==="Y"?1:0,e==="Z"?1:0)}get dependencies(){return new Set([this.source])}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Lw(this._invDstRestQuat.copy(this._dstRestQuat)),Lw(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const e=XAe.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),t=YAe.copy(this._v3RollAxis).applyQuaternion(e),i=ZAe.setFromUnitVectors(t,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(e);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}}const qAe=new Set(["1.0","1.0-beta"]);class Tc{constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}get name(){return Tc.EXTENSION_NAME}afterRoot(e){return p3(this,void 0,void 0,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){var t;return p3(this,void 0,void 0,function*(){const r=this.parser.json;if(!(((t=r.extensionsUsed)===null||t===void 0?void 0:t.indexOf(Tc.EXTENSION_NAME))!==-1))return null;const s=new jAe,o=yield this.parser.getDependencies("node");return o.forEach((a,l)=>{var A;const c=r.nodes[l],u=(A=c==null?void 0:c.extensions)===null||A===void 0?void 0:A[Tc.EXTENSION_NAME];if(u==null)return;const f=u.specVersion;if(!qAe.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Tc.EXTENSION_NAME} specVersion "${f}"`);return}const h=u.constraint;if(h.roll!=null){const p=this._importRollConstraint(a,o,h.roll);s.addConstraint(p)}else if(h.aim!=null){const p=this._importAimConstraint(a,o,h.aim);s.addConstraint(p)}else if(h.rotation!=null){const p=this._importRotationConstraint(a,o,h.rotation);s.addConstraint(p)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,t,r){const{source:i,rollAxis:s,weight:o}=r,a=t[i],l=new JAe(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const A=new Xb(l);this.helperRoot.add(A)}return l}_importAimConstraint(e,t,r){const{source:i,aimAxis:s,weight:o}=r,a=t[i],l=new GAe(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const A=new Xb(l);this.helperRoot.add(A)}return l}_importRotationConstraint(e,t,r){const{source:i,weight:s}=r,o=t[i],a=new $Ae(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new Xb(a);this.helperRoot.add(l)}return a}}Tc.EXTENSION_NAME="VRMC_node_constraint";/*! * @pixiv/three-vrm-springbone v1.0.9 * Spring bone module for @pixiv/three-vrm * * Copyright (c) 2020-2023 pixiv Inc. * @pixiv/three-vrm-springbone is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */class i5{}const Zb=new Z,Ac=new Z;class s5 extends i5{constructor(e){var t,r,i;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new Z(0,0,0),this.tail=(r=e==null?void 0:e.tail)!==null&&r!==void 0?r:new Z(0,0,0),this.radius=(i=e==null?void 0:e.radius)!==null&&i!==void 0?i:0}get type(){return"capsule"}calculateCollision(e,t,r,i){Zb.copy(this.offset).applyMatrix4(e),Ac.copy(this.tail).applyMatrix4(e),Ac.sub(Zb);const s=Ac.lengthSq();i.copy(t).sub(Zb);const o=Ac.dot(i);o<=0||(s<=o||Ac.multiplyScalar(o/s),i.sub(Ac));const a=r+this.radius,l=i.length()-a;return i.normalize(),l}}class o5 extends i5{constructor(e){var t,r;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new Z(0,0,0),this.radius=(r=e==null?void 0:e.radius)!==null&&r!==void 0?r:0}get type(){return"sphere"}calculateCollision(e,t,r,i){i.copy(this.offset).applyMatrix4(e),i.negate().add(t);const s=r+this.radius,o=i.length()-s;return i.normalize(),o}}const Po=new Z;class ece extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._currentTail=new Z,this._shape=e,this._attrPos=new At(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0);const r=Po.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(r)>1e-10&&(this._currentTail.copy(r),e=!0),e&&this._buildPosition()}_buildPosition(){Po.copy(this._currentTail).sub(this._currentOffset);const e=Po.length()/this._currentRadius;for(let i=0;i<=16;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(i,-Math.sin(s),-Math.cos(s),0),this._attrPos.setXYZ(17+i,e+Math.sin(s),Math.cos(s),0),this._attrPos.setXYZ(34+i,-Math.sin(s),0,-Math.cos(s)),this._attrPos.setXYZ(51+i,e+Math.sin(s),0,Math.cos(s))}for(let i=0;i<32;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(68+i,0,Math.sin(s),Math.cos(s)),this._attrPos.setXYZ(100+i,e,Math.sin(s),Math.cos(s))}const t=Math.atan2(Po.y,Math.sqrt(Po.x*Po.x+Po.z*Po.z)),r=-Math.atan2(Po.z,Po.x);this.rotateZ(t),this.rotateY(r),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 e=0;e<34;e++){const t=(e+1)%34;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(68+e*2,34+e,34+t)}for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(136+e*2,68+e,68+t),this._attrIndex.setXY(200+e*2,100+e,100+t)}this._attrIndex.needsUpdate=!0}}class tce extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._shape=e,this._attrPos=new At(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(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 e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.needsUpdate=!0}}const nce=new Z;class m3 extends Ur{constructor(e){if(super(),this.matrixAutoUpdate=!1,this.collider=e,this.collider.shape instanceof o5)this._geometry=new tce(this.collider.shape);else if(this.collider.shape instanceof s5)this._geometry=new ece(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const t=new Cl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new yg(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=nce.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class rce extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new Z,this._springBone=e,this._attrPos=new At(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}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 e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const ice=new Z;class sce extends Ur{constructor(e){super(),this.matrixAutoUpdate=!1,this.springBone=e,this._geometry=new rce(this.springBone);const t=new Cl({color:16776960,depthTest:!1,depthWrite:!1});this._line=new yg(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=ice.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class g3 extends It{constructor(e){super(),this.shape=e}}const oce=new je;function a5(n){return n.invert?n.invert():n.getInverse(oce.copy(n)),n}class ace{constructor(e){this._inverseCache=new je,this._shouldUpdateInverse=!0,this.matrix=e;const t={set:(r,i,s)=>(this._shouldUpdateInverse=!0,r[i]=s,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,t)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.copy(this.matrix),a5(this._inverseCache),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const lce=new je,Oa=new Z,Zd=new Z,Ace=new Z,Wu=new Z,v3=new Z,Jd=new Z,y3=new rt,Ku=new je,cce=new je;class uce{constructor(e,t,r={},i=[]){var s,o,a,l,A,c;this._currentTail=new Z,this._prevTail=new Z,this._boneAxis=new Z,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new je,this._initialLocalRotation=new rt,this._initialLocalChildPosition=new Z,this.bone=e,this.bone.matrixAutoUpdate=!1,this.child=t,this.settings={hitRadius:(s=r.hitRadius)!==null&&s!==void 0?s:0,stiffness:(o=r.stiffness)!==null&&o!==void 0?o:1,gravityPower:(a=r.gravityPower)!==null&&a!==void 0?a:0,gravityDir:(A=(l=r.gravityDir)===null||l===void 0?void 0:l.clone())!==null&&A!==void 0?A:new Z(0,-1,0),dragForce:(c=r.dragForce)!==null&&c!==void 0?c:.4},this.colliderGroups=i}get center(){return this._center}set center(e){var t;!((t=this._center)===null||t===void 0)&&t.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=e,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new ace(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:lce}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 e=this._getMatrixWorldToCenter(Ku);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),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 e=this._getMatrixWorldToCenter(Ku);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail)}update(e){if(e<=0)return;this._calcWorldSpaceBoneLength(),Wu.setFromMatrixPosition(this.bone.matrixWorld);let t=this._getMatrixWorldToCenter(Ku);v3.copy(Wu).applyMatrix4(t);const r=y3.setFromRotationMatrix(t),i=cce.copy(t).multiply(this._parentMatrixWorld),s=Zd.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(v3).normalize(),o=Ace.copy(this.settings.gravityDir).applyQuaternion(r).normalize(),a=this._getMatrixCenterToWorld(Ku);Jd.copy(this._currentTail).add(Oa.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(Oa.copy(s).multiplyScalar(this.settings.stiffness*e)).add(Oa.copy(o).multiplyScalar(this.settings.gravityPower*e)).applyMatrix4(a),Jd.sub(Wu).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Wu),this._collision(Jd),t=this._getMatrixWorldToCenter(Ku),this._prevTail.copy(this._currentTail),this._currentTail.copy(Oa.copy(Jd).applyMatrix4(t));const l=a5(Ku.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),A=y3.setFromUnitVectors(this._boneAxis,Oa.copy(Jd).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(A),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(e){this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{const i=r.shape.calculateCollision(r.matrixWorld,e,this.settings.hitRadius,Oa);i<0&&(e.add(Oa.multiplyScalar(-i)),e.sub(Wu).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Wu))})})}_calcWorldSpaceBoneLength(){Oa.setFromMatrixPosition(this.bone.matrixWorld),this.child?Zd.setFromMatrixPosition(this.child.matrixWorld):(Zd.copy(this._initialLocalChildPosition),Zd.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Oa.sub(Zd).length()}_getMatrixCenterToWorld(e){return this._center?e.copy(this._center.matrixWorld):e.identity(),e}_getMatrixWorldToCenter(e){return this._center?e.copy(this._center.userData.inverseCacheProxy.inverse):e.identity(),e}}function av(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function fce(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function l5(n,e){n.children.forEach(t=>{e(t)||l5(t,e)})}class w3{constructor(){this._joints=new Set,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 e=new Set;return this._joints.forEach(t=>{t.colliderGroups.forEach(r=>{e.add(r)})}),Array.from(e)}get colliders(){const e=new Set;return this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{e.add(r)})}),Array.from(e)}addJoint(e){this._joints.add(e);let t=this._objectSpringBonesMap.get(e.bone);t==null&&(t=new Set,this._objectSpringBonesMap.set(e.bone,t)),t.add(e)}addSpringBone(e){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(e)}deleteJoint(e){this._joints.delete(e),this._objectSpringBonesMap.get(e.bone).delete(e)}deleteSpringBone(e){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(e)}setInitState(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.setInitState())}reset(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.reset())}update(e){const t=new Set,r=new Set,i=new Set;for(const s of this._joints)this._processSpringBone(s,t,r,i,o=>o.update(e)),l5(s.bone,o=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(o))===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:0)>0?!0:(o.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(e,t,r,i,s){if(r.has(e))return;if(t.has(e))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating springbones");t.add(e);const o=this._getDependencies(e);for(const a of o)fce(a,l=>{const A=this._objectSpringBonesMap.get(l);if(A)for(const c of A)this._processSpringBone(c,t,r,i,s);else i.has(l)||(l.updateWorldMatrix(!1,!1),i.add(l))});e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),s(e),i.add(e.bone),r.add(e)}_getDependencies(e){const t=new Set,r=e.bone.parent;return r&&t.add(r),e.colliderGroups.forEach(i=>{i.colliders.forEach(s=>{t.add(s)})}),t}}const hce=new Set(["1.0","1.0-beta"]);class Tc{constructor(e,t){this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot}get name(){return Tc.EXTENSION_NAME}afterRoot(e){return av(this,void 0,void 0,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return av(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){var t,r,i,s,o;return av(this,void 0,void 0,function*(){const a=e.parser.json;if(!(((t=a.extensionsUsed)===null||t===void 0?void 0:t.indexOf(Tc.EXTENSION_NAME))!==-1))return null;const A=new w3,c=yield e.parser.getDependencies("node"),u=(r=a.extensions)===null||r===void 0?void 0:r[Tc.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!hce.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Tc.EXTENSION_NAME} specVersion "${f}"`),null;const h=(i=u.colliders)===null||i===void 0?void 0:i.map((d,g)=>{var m,y,w,x,_;const C=c[d.node],S=d.shape;if(S.sphere)return this._importSphereCollider(C,{offset:new Z().fromArray((m=S.sphere.offset)!==null&&m!==void 0?m:[0,0,0]),radius:(y=S.sphere.radius)!==null&&y!==void 0?y:0});if(S.capsule)return this._importCapsuleCollider(C,{offset:new Z().fromArray((w=S.capsule.offset)!==null&&w!==void 0?w:[0,0,0]),radius:(x=S.capsule.radius)!==null&&x!==void 0?x:0,tail:new Z().fromArray((_=S.capsule.tail)!==null&&_!==void 0?_:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),p=(s=u.colliderGroups)===null||s===void 0?void 0:s.map((d,g)=>{var m;return{colliders:((m=d.colliders)!==null&&m!==void 0?m:[]).map(w=>{const x=h==null?void 0:h[w];if(x==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${g} attempted to use a collider #${w} but not found`);return x}),name:d.name}});return(o=u.springs)===null||o===void 0||o.forEach((d,g)=>{var m;const y=d.joints,w=(m=d.colliderGroups)===null||m===void 0?void 0:m.map(C=>{const S=p==null?void 0:p[C];if(S==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${C} but not found`);return S}),x=d.center!=null?c[d.center]:void 0;let _;y.forEach(C=>{if(_){const S=_.node,b=c[S],M=C.node,D=c[M],$={hitRadius:_.hitRadius,dragForce:_.dragForce,gravityPower:_.gravityPower,stiffness:_.stiffness,gravityDir:_.gravityDir!=null?new Z().fromArray(_.gravityDir):void 0},H=this._importJoint(b,D,$,w);x&&(H.center=x),A.addJoint(H)}_=C})}),A.setInitState(),A})}_v0Import(e){var t,r,i;return av(this,void 0,void 0,function*(){const s=e.parser.json;if(!(((t=s.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)===null||r===void 0?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const A=l==null?void 0:l.boneGroups;if(!A)return null;const c=new w3,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)===null||i===void 0?void 0:i.map(h=>{var p;const d=u[h.node];return{colliders:((p=h.colliders)!==null&&p!==void 0?p:[]).map((m,y)=>{var w,x,_;const C=new Z(0,0,0);return m.offset&&C.set((w=m.offset.x)!==null&&w!==void 0?w:0,(x=m.offset.y)!==null&&x!==void 0?x:0,m.offset.z?-m.offset.z:0),this._importSphereCollider(d,{offset:C,radius:(_=m.radius)!==null&&_!==void 0?_:0})})}});return A==null||A.forEach((h,p)=>{const d=h.bones;d&&d.forEach(g=>{var m,y,w,x;const _=u[g],C=new Z;h.gravityDir?C.set((m=h.gravityDir.x)!==null&&m!==void 0?m:0,(y=h.gravityDir.y)!==null&&y!==void 0?y:0,(w=h.gravityDir.z)!==null&&w!==void 0?w:0):C.set(0,-1,0);const S=h.center!=null?u[h.center]:void 0,b={hitRadius:h.hitRadius,dragForce:h.dragForce,gravityPower:h.gravityPower,stiffness:h.stiffiness,gravityDir:C},M=(x=h.colliderGroups)===null||x===void 0?void 0:x.map(D=>{const $=f==null?void 0:f[D];if($==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${p} attempted to use a colliderGroup ${D} but not found`);return $});_.traverse(D=>{var $;const H=($=D.children[0])!==null&&$!==void 0?$:null,I=this._importJoint(D,H,b,M);S&&(I.center=S),c.addJoint(I)})})}),e.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(e,t,r,i){const s=new uce(e,t,r,i);if(this.jointHelperRoot){const o=new sce(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const{offset:r,radius:i}=t,s=new o5({offset:r,radius:i}),o=new g3(s);if(e.add(o),this.colliderHelperRoot){const a=new m3(o);this.colliderHelperRoot.add(a),a.renderOrder=this.colliderHelperRoot.renderOrder}return o}_importCapsuleCollider(e,t){const{offset:r,radius:i,tail:s}=t,o=new s5({offset:r,radius:i,tail:s}),a=new g3(o);if(e.add(a),this.colliderHelperRoot){const l=new m3(a);this.colliderHelperRoot.add(l),l.renderOrder=this.colliderHelperRoot.renderOrder}return a}}Tc.EXTENSION_NAME="VRMC_springBone";class dce{constructor(e,t){var r,i,s,o,a,l,A,c,u,f;this.parser=e;const h=t==null?void 0:t.helperRoot,p=t==null?void 0:t.autoUpdateHumanBones;this.expressionPlugin=(r=t==null?void 0:t.expressionPlugin)!==null&&r!==void 0?r:new r_(e),this.firstPersonPlugin=(i=t==null?void 0:t.firstPersonPlugin)!==null&&i!==void 0?i:new Wle(e),this.humanoidPlugin=(s=t==null?void 0:t.humanoidPlugin)!==null&&s!==void 0?s:new eAe(e,{helperRoot:h,autoUpdateHumanBones:p}),this.lookAtPlugin=(o=t==null?void 0:t.lookAtPlugin)!==null&&o!==void 0?o:new dAe(e,{helperRoot:h}),this.metaPlugin=(a=t==null?void 0:t.metaPlugin)!==null&&a!==void 0?a:new gAe(e),this.mtoonMaterialPlugin=(l=t==null?void 0:t.mtoonMaterialPlugin)!==null&&l!==void 0?l:new fh(e),this.materialsHDREmissiveMultiplierPlugin=(A=t==null?void 0:t.materialsHDREmissiveMultiplierPlugin)!==null&&A!==void 0?A:new $m(e),this.materialsV0CompatPlugin=(c=t==null?void 0:t.materialsV0CompatPlugin)!==null&&c!==void 0?c:new UAe(e),this.springBonePlugin=(u=t==null?void 0:t.springBonePlugin)!==null&&u!==void 0?u:new Tc(e,{colliderHelperRoot:h,jointHelperRoot:h}),this.nodeConstraintPlugin=(f=t==null?void 0:t.nodeConstraintPlugin)!==null&&f!==void 0?f:new Mc(e,{helperRoot:h})}get name(){return"VRMLoaderPlugin"}beforeRoot(){return ov(this,void 0,void 0,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return ov(this,void 0,void 0,function*(){return yield this.mtoonMaterialPlugin.loadMesh(e)})}getMaterialType(e){const t=this.mtoonMaterialPlugin.getMaterialType(e);return t??null}extendMaterialParams(e,t){return ov(this,void 0,void 0,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,t),yield this.mtoonMaterialPlugin.extendMaterialParams(e,t)})}afterRoot(e){return ov(this,void 0,void 0,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e),yield this.springBonePlugin.afterRoot(e),yield this.nodeConstraintPlugin.afterRoot(e),yield this.mtoonMaterialPlugin.afterRoot(e);const t=e.userData.vrmMeta,r=e.userData.vrmHumanoid;if(t&&r){const i=new yAe({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:r,lookAt:e.userData.vrmLookAt,meta:t,materials:e.userData.vrmMToonMaterials,springBoneManager:e.userData.vrmSpringBoneManager,nodeConstraintManager:e.userData.vrmNodeConstraintManager});e.userData.vrm=i}})}}function x3(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 pce(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=>x3(i)):r&&x3(r))}function mce(n){n.traverse(pce)}function gce(n){const e=new Map;n.traverse(t=>{if(t.type!=="SkinnedMesh")return;const r=t,s=r.geometry.getAttribute("skinIndex");let o=e.get(s);if(!o){const a=[],l=[],A={},c=s.array;for(let u=0;u{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,A=l.index;if(A==null)return;const c=e.get(l);if(c!=null){a.geometry=c;return}const u=new $t;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(d=>{u.addGroup(d.start,d.count,d.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)===null||r===void 0?void 0:r.clone())!==null&&i!==void 0?i:null,u.boundingSphere=(o=(s=l.boundingSphere)===null||s===void 0?void 0:s.clone())!==null&&o!==void 0?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],h=[];{const d=A.array,g=new d.constructor(d.length);let m=0;for(let y=0;y{const g=l.attributes[d];if(g.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const m=g.array,{itemSize:y,normalized:w}=g,x=new m.constructor(h.length*y);h.forEach((_,C)=>{for(let S=0;S{u.morphAttributes[d]=[];const g=l.morphAttributes[d];for(let m=0;m{for(let M=0;MS===0),u.morphAttributes[d][m]=new At(C,x,_)}}),p&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function yce(n){var e;((e=n.meta)===null||e===void 0?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}class Bg{constructor(){}}Bg.deepDispose=mce;Bg.removeUnnecessaryJoints=gce;Bg.removeUnnecessaryVertices=vce;Bg.rotateVRM0=yce;var Jn;(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"})(Jn||(Jn={}));const Lw="blend_",_3="vrmColliderSphere";class wce{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},A={},c={},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((re,pe,_e)=>_e.findIndex(Re=>Re.name===re.name.replace(" (Outline)",""))===pe).map(re=>re),p=h.map(re=>re.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(re=>re.map).map(re=>{if(!re.map)throw new Error(re.name+" map is null");return{name:re.name,imageBitmap:re.map.image}}),m=h.filter(re=>re.userData.shadeTexture).map(re=>{if(!re.userData.shadeTexture)throw new Error(re.userData.shadeTexture+" map is null");return{name:re.name+"_shade",imageBitmap:re.userData.shadeTexture.image}}),y=g.concat(m),w=Ece(y,d),x=Cce(w),_=Sce(w),C=Bce(h,y),S=t.children.filter(re=>re.children.length>0&&re.children[0].type===ai.Bone)[0],b=A5(S).filter(re=>re.name!==_3),M=b.map(re=>re.name),D=b.map(re=>({children:re.children.filter(pe=>pe.name!==_3).map(pe=>M.indexOf(pe.name)),name:re.name,rotation:[re.quaternion.x,re.quaternion.y,re.quaternion.z,re.quaternion.w],scale:[re.scale.x,re.scale.y,re.scale.z],translation:[re.position.x,re.position.y,re.position.z]})),$=[],H=t.children.filter(re=>re.type===ai.Group||re.type===ai.SkinnedMesh),I=[];H.forEach(re=>{const pe=re.type===ai.Group?re.children[0]:re,_e=pe.geometry.attributes;I.push(new Na(_e.position,Jn.FLOAT,Wt.POSITION,ho.VEC3,pe.name,void 0)),I.push(new Na(_e.normal,Jn.FLOAT,Wt.NORMAL,ho.VEC3,pe.name,void 0)),I.push(new Na(_e.uv,Jn.FLOAT,Wt.UV,ho.VEC2,pe.name,void 0)),I.push(new Na(_e.skinWeight,Jn.FLOAT,Wt.SKIN_WEIGHT,ho.VEC4,pe.name,void 0)),I.push(new Na(_e.skinIndex,Jn.UNSIGNED_SHORT,Wt.SKIN_INDEX,ho.VEC4,pe.name,void 0)),(re.type===ai.Group?re.children.map(Q=>Q):[re]).forEach(Q=>{if(!Q.geometry.index)throw new Error(Q.name+" geometry.index is null");I.push(new Na(Q.geometry.index,Jn.UNSIGNED_INT,Wt.INDEX,ho.SCALAR,pe.name,Q.name))}),pe.morphTargetDictionary||(pe.morphTargetDictionary={},pe.morphTargetInfluences=[],pe.geometry.morphAttributes={},pe.updateMorphTargets()),pe.geometry.userData.targetNames=[];for(const Q in e.expressionManager.expressionMap){const de=e.expressionManager.expressionMap[Q],Ae=de._binds.map(J=>({node:b.length,index:J.index,weight:J.weight}));let q=!1;for(const J in oi)if(Q.toLowerCase()===oi[J].toLowerCase()){l[oi[J]]={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth},q=!0;break}!q&&Q.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth},q=!0),q===!1&&(A[Q]={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth})}for(const Q in pe.morphTargetDictionary){pe.geometry.userData.targetNames.push(Q);const de=pe.morphTargetDictionary[Q],Ae=pe.geometry.morphAttributes;I.push(new Na(Ae.position[de],Jn.FLOAT,Wt.BLEND_POSITION,ho.VEC3,pe.name,Lw+Q)),I.push(new Na(Ae.normal[de],Jn.FLOAT,Wt.BLEND_NORMAL,ho.VEC3,pe.name,Lw+Q))}}),Object.keys(l).length>0&&(c.preset=l),Object.keys(A).length>0&&(c.custom=A),H.forEach(re=>{const pe=re.type===ai.Group?re.children[0]:re,_e=new Float32Array(pe.skeleton.boneInverses.map(Re=>Re.elements).flat());I.push(new Na(new At(_e,16),Jn.FLOAT,Wt.BIND_MATRIX,ho.MAT4,pe.name,pe.name))}),$.push(...I.map(re=>({bufferView:-1,byteOffset:0,componentType:re.valueType,count:re.attribute.count,max:re.max,min:re.min,normalized:!1,type:re.accessorsType})));const v=_ce(H,I,p);H.forEach((re,pe)=>{D.push({mesh:pe,name:re.name,rotation:[re.quaternion.x,re.quaternion.y,re.quaternion.z,re.quaternion.w],scale:[re.scale.x,re.scale.y,re.scale.z],skin:pe,translation:[re.position.x,re.position.y,re.position.z]})});const E=bce(H,I,M),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 re in s.humanBones)P.humanBones[re]={node:M.indexOf(s.humanBones[re].node.name)};const L=o,z=[];z.push(...y.map(re=>({buffer:b3(re.imageBitmap),type:Wt.IMAGE}))),z.push(...I.map(re=>({buffer:re.buffer,type:re.type}))),d&&z.push({buffer:b3(d.imageBitmap),type:Wt.IMAGE});let K=0,O=0,B=0;const W=z.map((re,pe)=>{const _e={buffer:0,byteLength:re.buffer.byteLength,byteOffset:K,target:re.type===Wt.IMAGE||re.type===Wt.BIND_MATRIX?void 0:re.type===Wt.INDEX?Jn.ELEMENT_ARRAY_BUFFER:Jn.ARRAY_BUFFER};return K+=re.buffer.byteLength,re.type===Wt.IMAGE?w[O++].bufferView=pe:$[B++].bufferView=pe,_e}),ee=Mce(t,D),F={accessors:$,asset:f,buffers:[{byteLength:K}],bufferViews:W,extensions:{VRMC_vrm:{expressions:c,humanoid:P,lookAt:U,meta:L,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:w,materials:C,meshes:v,nodes:D,samplers:x,avatar:0,scenes:ee,skins:E,textures:_},X=new B3(DC(JSON.stringify(F,void 0,2)),"JSON"),ue=new B3(Fp(z.map(re=>re.buffer)),"BIN\0"),le=Fp([X.buffer,ue.buffer]),oe=Fp([DC("glTF"),PC(2,4),PC(le.byteLength+12,4)]);i(Fp([oe,le]))}}function A5(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>A5(e)).flat())}function b3(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?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Jn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Jn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}let B3=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=Fp([PC(r.byteLength,4),DC(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===Wt.POSITION||r===Wt.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 jf;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(jf||(jf={}));var ho;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(ho||(ho={}));var Wt;(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"})(Wt||(Wt={}));var ai;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(ai||(ai={}));const _ce=(n,e,t)=>n.map(r=>{const i=r.type===ai.Group?r.children[0]:r,s=r.type===ai.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Wt.SKIN_INDEX),NORMAL:a.indexOf(Wt.NORMAL),POSITION:a.indexOf(Wt.POSITION),TEXCOORD_0:a.indexOf(Wt.UV),WEIGHTS_0:a.indexOf(Wt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Wt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>({NORMAL:e.map(c=>c.type===Wt.BLEND_NORMAL&&c.meshName===i.name?c.name:null).indexOf(Lw+A),POSITION:e.map(c=>c.type===Wt.BLEND_POSITION&&c.meshName===i.name?c.name:null).indexOf(Lw+A)})):void 0}})}}),bce=(n,e,t)=>n.map(r=>{const i=r.type===ai.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Wt.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)}}),Bce=(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(c=>c.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const A=t;r=A.color?[A.color.r,A.color.g,A.color.b,1]:void 0}let s=-1;t.map?s=e.map(A=>A.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(A=>A.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 jf.MeshStandardMaterial:return t.metalness;case jf.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case jf.MeshStandardMaterial:return t.roughness;case jf.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}}}),Ece=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),Cce=n=>n.map(()=>({magFilter:Jn.LINEAR,minFilter:Jn.LINEAR,wrapS:Jn.REPEAT,wrapT:Jn.REPEAT})),Sce=n=>n.map((e,t)=>({sampler:0,source:t})),Mce=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===ai.Object3D||r.type===ai.SkinnedMesh||r.type===ai.Group||r.type===ai.Bone).map(r=>t.indexOf(r.name))}]},c5=0,Tce=1,u5=2,E3=2,Jb=1.25,C3=1,dy=6*4+4+4,OC=65535,Ice=Math.pow(2,-24);class lv{constructor(){}}function Jo(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 S3(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 M3(n,e){e.set(n)}function T3(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 Av(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 qd(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)}function Rce(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;let i;t>65535?i=new Uint32Array(new r(4*t)):i=new Uint16Array(new r(2*t)),n.setIndex(new At(i,1));for(let s=0;si-s);for(let i=0;il&&(l=S),m&&xp&&(p=x);const b=n[y+2],M=n[y+3],D=b-M,$=b+M;DA&&(A=$),m&&bd&&(d=b);const H=n[y+4],I=n[y+5],v=H-I,E=H+I;vc&&(c=E),m&&Hg&&(g=H)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=A,r[5]=c,m&&(i[0]=u,i[1]=f,i[2]=h,i[3]=p,i[4]=d,i[5]=g)}function Uce(n,e,t,r){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,A=-1/0;for(let c=e*6,u=(e+t)*6;ca&&(a=f);const h=n[c+2];hl&&(l=h);const p=n[c+4];pA&&(A=p)}r[0]=i,r[1]=s,r[2]=o,r[3]=a,r[4]=l,r[5]=A}function Lce(n,e,t,r,i){let s=t,o=t+r-1;const a=i.pos,l=i.axis*2;for(;;){for(;s<=o&&e[s*6+l]=a;)o--;if(sn.candidate-e.candidate,zl=new Array(Ga).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),cv=new Float32Array(6);function Dce(n,e,t,r,i,s){let o=-1,a=0;if(s===c5)o=S3(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===Tce)o=S3(n),o!==-1&&(a=Oce(t,r,i,o));else if(s===u5){const l=qd(n);let A=Jb*i;const c=r*6,u=(r+i)*6;for(let f=0;f<3;f++){const h=e[f],g=(e[f+3]-h)/Ga;if(i=S.candidate?Av(x,t,S.rightCacheBounds):(Av(x,t,S.leftCacheBounds),S.count++)}}for(let x=0;x=Ga&&(C=Ga-1);const S=zl[C];S.count++,Av(w,t,S.bounds)}const m=zl[Ga-1];M3(m.bounds,m.rightCacheBounds);for(let w=Ga-2;w>=0;w--){const x=zl[w],_=zl[w+1];T3(x.bounds,_.rightCacheBounds,x.rightCacheBounds)}let y=0;for(let w=0;wC&&(C=w),x>C&&(C=x);const S=(C-_)/2,b=m*2;s[h+b+0]=_+S,s[h+b+1]=S+(Math.abs(_)+S)*Ice,_e[m+3]&&(e[m+3]=C)}}return s}function kce(n,e){function t(m){f&&f(m/h)}function r(m,y,w,x=null,_=0){if(!p&&_>=l&&(p=!0,A&&(console.warn(`MeshBVH: Max depth of ${l} reached when generating BVH. Consider increasing maxDepth.`),console.warn(n))),w<=c||_>=l)return t(y+w),m.offset=y,m.count=w,m;const C=Dce(m.boundingData,x,o,y,w,u);if(C.axis===-1)return t(y+w),m.offset=y,m.count=w,m;const S=Lce(a,o,y,w,C);if(S===y||S===y+w)t(y+w),m.offset=y,m.count=w;else{m.splitAxis=C.axis;const b=new lv,M=y,D=S-y;m.left=b,b.boundingData=new Float32Array(6),qb(o,M,D,b.boundingData,s),r(b,M,D,s,_+1);const $=new lv,H=S,I=w-D;m.right=$,$.boundingData=new Float32Array(6),qb(o,H,I,$.boundingData,s),r($,H,I,s,_+1)}return m}Rce(n,e);const i=new Float32Array(6),s=new Float32Array(6),o=Nce(n,i),a=n.index.array,l=e.maxDepth,A=e.verbose,c=e.maxLeafTris,u=e.strategy,f=e.onProgress,h=n.index.count/3;let p=!1;const d=[],g=Fce(n);if(g.length===1){const m=g[0],y=new lv;y.boundingData=i,Uce(o,m.offset,m.count,s),r(y,m.offset,m.count,s),d.push(y)}else for(let m of g){const y=new lv;y.boundingData=new Float32Array(6),qb(o,m.offset,m.count,y.boundingData,s),r(y,m.offset,m.count,s),d.push(y)}return d}function Qce(n,e){const t=kce(n,e);let r,i,s;const o=[],a=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;cMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return i[f+6]=w/4,w=A(w,m),i[f+7]=y,w}}}class xl{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}}xl.prototype.setFromBox=function(){const n=new Z;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 A=0;A<=1;A++)for(let c=0;c<=1;c++){n.x=i.x*l+s.x*(1-l),n.y=i.y*A+s.y*(1-A),n.z=i.z*c+s.z*(1-c);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const Hce=function(){const n=new Z,e=new Z,t=new Z;return function(i,s,o){const a=i.start,l=n,A=s.start,c=e;t.subVectors(a,A),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(c),f=c.dot(l),h=c.dot(c),p=t.dot(l),g=l.dot(l)*h-f*f;let m,y;g!==0?m=(u*f-p*h)/g:m=0,y=(u+m*f)/h,o.x=m,o.y=y}}(),vT=function(){const n=new $e,e=new Z,t=new Z;return function(i,s,o,a){Hce(i,s,n);let l=n.x,A=n.y;if(l>=0&&l<=1&&A>=0&&A<=1){i.at(l,o),s.at(A,a);return}else if(l>=0&&l<=1){A<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(A>=0&&A<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let c;l<0?c=i.start:c=i.end;let u;A<0?u=s.start:u=s.end;const f=e,h=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(c,!0,t),f.distanceToSquared(u)<=h.distanceToSquared(c)){o.copy(f),a.copy(u);return}else{o.copy(c),a.copy(h);return}}}}(),zce=function(){const n=new Z,e=new Z,t=new Ja,r=new cl;return function(s,o){const{radius:a,center:l}=s,{a:A,b:c,c:u}=o;if(r.start=A,r.end=c,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const d=o.getPlane(t);if(Math.abs(d.distanceToPoint(l))<=a){const m=d.projectPoint(l,e);if(o.containsPoint(m))return!0}return!1}}(),Gce=1e-15;function $u(n){return Math.abs(n)new Z),this.satBounds=new Array(4).fill().map(()=>new xl),this.points=[this.a,this.b,this.c],this.sphere=new su,this.plane=new Ja,this.needsUpdate=!0}intersectsSphere(e){return zce(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 A=s[1],c=o[1];A.subVectors(e,t),c.setFromPoints(A,i);const u=s[2],f=o[2];u.subVectors(t,r),f.setFromPoints(u,i);const h=s[3],p=o[3];h.subVectors(r,e),p.setFromPoints(h,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}_l.prototype.closestPointToSegment=function(){const n=new Z,e=new Z,t=new cl;return function(i,s=null,o=null){const{start:a,end:l}=i,A=this.points;let c,u=1/0;for(let f=0;f<3;f++){const h=(f+1)%3;t.start.copy(A[f]),t.end.copy(A[h]),vT(t,i,n,e),c=n.distanceToSquared(e),c1-1e-10){const y=this.satBounds,w=this.satAxes;t[0]=h.a,t[1]=h.b,t[2]=h.c;for(let C=0;C<4;C++){const S=y[C],b=w[C];if(r.setFromPoints(b,t),S.isSeparated(r))return!1}const x=h.satBounds,_=h.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let C=0;C<4;C++){const S=x[C],b=_[C];if(r.setFromPoints(b,e),S.isSeparated(r))return!1}for(let C=0;C<4;C++){const S=w[C];for(let b=0;b<4;b++){const M=_[b];if(s.crossVectors(S,M),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return p&&(d||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 y=this.points;let w=!1,x=0;for(let v=0;v<3;v++){const E=y[v],U=y[(v+1)%3];A.start.copy(E),A.end.copy(U),A.delta(o);const P=w?c.start:c.end,L=$u(m.distanceToPoint(E));if($u(m.normal.dot(o))&&L){c.copy(A),x=2;break}if((m.intersectLine(A,P)||L)&&!$u(P.distanceTo(U))){if(x++,w)break;w=!0}}if(x===1&&h.containsPoint(c.end))return p&&(p.start.copy(c.end),p.end.copy(c.end)),!0;if(x!==2)return!1;const _=h.points;let C=!1,S=0;for(let v=0;v<3;v++){const E=_[v],U=_[(v+1)%3];A.start.copy(E),A.end.copy(U),A.delta(a);const P=C?u.start:u.end,L=$u(g.distanceToPoint(E));if($u(g.normal.dot(a))&&L){u.copy(A),S=2;break}if((g.intersectLine(A,P)||L)&&!$u(P.distanceTo(U))){if(S++,C)break;C=!0}}if(S===1&&this.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(S!==2)return!1;if(c.delta(o),u.delta(a),o.dot(a)<0){let v=u.start;u.start=u.end,u.end=v}const b=c.start.dot(o),M=c.end.dot(o),D=u.start.dot(o),$=u.end.dot(o),H=M0?p.start.copy(c.start):p.start.copy(u.start),l.subVectors(c.end,u.end),l.dot(o)<0?p.end.copy(c.end):p.end.copy(u.end)),!0)}}}();_l.prototype.distanceToPoint=function(){const n=new Z;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();_l.prototype.distanceToTriangle=function(){const n=new Z,e=new Z,t=["a","b","c"],r=new cl,i=new cl;return function(o,a=null,l=null){const A=a||l?r:null;if(this.intersectsTriangle(o,A))return(a||l)&&(a&&A.getCenter(a),l&&A.getCenter(l)),0;let c=1/0;for(let u=0;u<3;u++){let f;const h=t[u],p=o[h];this.closestPointToPoint(p,n),f=p.distanceToSquared(n),fnew Z),this.satAxes=new Array(3).fill().map(()=>new Z),this.satBounds=new Array(3).fill().map(()=>new xl),this.alignedSatBounds=new Array(3).fill().map(()=>new xl),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}}va.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let A=0;A<=1;A++)for(let c=0;c<=1;c++)for(let u=0;u<=1;u++){const f=1*A|2*c|4*u,h=i[f];h.x=A?r.x:t.x,h.y=c?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 A=0;A<3;A++){const c=o[A],u=s[A],f=1<new cl),t=new Array(12).fill().map(()=>new cl),r=new Z,i=new Z;return function(o,a=0,l=null,A=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||A)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),A&&A.copy(i)),0;const c=a*a,u=o.min,f=o.max,h=this.points;let p=1/0;for(let g=0;g<8;g++){const m=h[g];i.copy(m).clamp(u,f);const y=m.distanceToSquared(i);if(yt.far)?null:n}function Ko(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,A=e+2;t&&(a=t.getX(e),l=t.getX(e+1),A=t.getX(e+2)),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(A),o.y=r.getY(A),o.z=r.getZ(A)}function P3(n,e,t,r,i,s,o){const a=t.index,l=t.attributes.position;for(let A=n,c=e+n;A=0;let h,p;f?(h=Xm(n),p=Zm(n,a)):(h=Zm(n,a),p=Xm(n));const g=Dw(h,s,r,Pw)?kC(h,e,t,r):null;if(g){const w=g.point[c];if(f?w<=s[p+A]:w>=s[p+A+3])return g}const y=Dw(p,s,r,Pw)?kC(p,e,t,r):null;return g&&y?g.distance<=y.distance?g:y:g||y||null}}const Xce=function(){let n,e;const t=[],r=new h5(()=>new ps);return function(...o){n=r.getPrimitive(),e=r.getPrimitive(),t.push(n,e);const a=i(...o);r.releasePrimitive(n),r.releasePrimitive(e),t.pop(),t.pop();const l=t.length;return l>0&&(e=t[l-1],n=t[l-2]),a};function i(s,o,a,l,A=null,c=0,u=0){function f(w){let x=w*2,_=MA,C=TA;for(;!nA(x,_);)w=Xm(w),x=w*2;return hh(w,C)}function h(w){let x=w*2,_=MA,C=TA;for(;!nA(x,_);)w=Zm(w,C),x=w*2;return hh(w,C)+Ym(x,_)}let p=s*2,d=sd,g=MA,m=TA;if(nA(p,g)){const w=hh(s,m),x=Ym(p,g);return Jo(s,d,n),l(w,x,!1,u,c+s,n)}else{const w=Xm(s),x=Zm(s,m);let _=w,C=x,S,b,M,D;if(A&&(M=n,D=e,Jo(_,d,M),Jo(C,d,D),S=A(M),b=A(D),bi.intersectsBox(b),intersectsTriangle:b=>{b.a.applyMatrix4(A),b.b.applyMatrix4(A),b.c.applyMatrix4(A),b.needsUpdate=!0;for(let M=_*3,D=(C+_)*3;Mnew _l);class om{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),om.serialize(arguments[0],{cloneBuffers:arguments[2]===void 0?!0:arguments[2]});t={cloneBuffers:!0,...t};const r=e.geometry,i=e._roots,s=r.getIndex();let o;return t.cloneBuffers?o={roots:i.map(a=>a.slice()),index:s.array.slice()}:o={roots:i,index:s.array},o}static deserialize(e,t,r={}){if(typeof r=="boolean")return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),om.deserialize(arguments[0],arguments[1],{setIndex:arguments[2]===void 0?!0:arguments[2]});r={setIndex:!0,...r};const{index:i,roots:s}=e,o=new om(t,{...r,[eB]:!0});if(o._roots=s,r.setIndex){const a=t.getIndex();if(a===null){const l=new At(e.index,1,!1);t.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}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({strategy:c5,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[eB]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[eB]||(this._roots=Qce(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new ps))),this.geometry=e}refit(e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=this.geometry,r=t.index.array,i=t.attributes.position;let s,o,a,l,A=0;const c=this._roots;for(let f=0,h=c.length;fC&&(C=H),IS&&(S=I),v<_&&(_=v),v>b&&(b=v)}return l[f+0]!==w||l[f+1]!==x||l[f+2]!==_||l[f+3]!==C||l[f+4]!==S||l[f+5]!==b?(l[f+0]=w,l[f+1]=x,l[f+2]=_,l[f+3]=C,l[f+4]=S,l[f+5]=b,!0):!1}else{const m=f+8,y=o[f+6],w=m+h,x=y+h;let _=p,C=!1,S=!1;e?_||(C=e.has(w),S=e.has(x),_=!C&&!S):(C=!0,S=!0);const b=_||C,M=_||S;let D=!1;b&&(D=u(m,h,_));let $=!1;M&&($=u(y,h,_));const H=D||$;if(H)for(let I=0;I<3;I++){const v=m+I,E=y+I,U=l[v],P=l[v+3],L=l[E],z=l[E+3];l[f+I]=Uz?P:z}return H}}}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 A=a*2,c=s[A+15]===OC;if(c){const u=i[a+6],f=s[A+14];e(l,c,new Float32Array(r,a*4,6),u,f)}else{const u=a+dy/4,f=i[a+6],h=i[a+7];e(l,c,new Float32Array(r,a*4,6),h)||(o(u,l+1),o(f,l+1))}}}raycast(e,t=ls){const r=this._roots,i=this.geometry,s=[],o=t.isMaterial,a=Array.isArray(t),l=i.groups,A=o?t.side:t;for(let c=0,u=r.length;c{const m=p*3;return f(h,m,m+1,m+2,d,g)}}e={boundsTraverseOrder:r,intersectsBounds:e,intersectsTriangle:t,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}const s=Do.getPrimitive();let{boundsTraverseOrder:o,intersectsBounds:a,intersectsRange:l,intersectsTriangle:A}=e;if(l&&A){const f=l;l=(h,p,d,g,m)=>f(h,p,d,g,m)?!0:P3(h,p,i,A,d,g,s)}else l||(A?l=(f,h,p,d)=>P3(f,h,i,A,p,d,s):l=(f,h,p)=>p);let c=!1,u=0;for(const f of this._roots){if(Up(f),c=Xce(0,i,a,l,o,u),dv(),c)break;u+=f.byteLength}return Do.releasePrimitive(s),c}bvhcast(e,t,r){let{intersectsRanges:i,intersectsTriangles:s}=r;const o=this.geometry.index,a=this.geometry.attributes.position,l=e.geometry.index,A=e.geometry.attributes.position;Yu.copy(t).invert();const c=Do.getPrimitive(),u=Do.getPrimitive();if(s){let h=function(p,d,g,m,y,w,x,_){for(let C=g,S=g+m;CnB.intersectsBox(h),intersectsRange:(h,p,d,g,m,y)=>(tB.copy(y),tB.applyMatrix4(Yu),e.shapecast({intersectsBounds:w=>tB.intersectsBox(w),intersectsRange:(w,x,_,C,S)=>i(h,p,w,x,g,m,C,S)}))});return Do.releasePrimitive(c),Do.releasePrimitive(u),f}intersectsBox(e,t){return cc.set(e.min,e.max,t),cc.needsUpdate=!0,this.shapecast({intersectsBounds:r=>cc.intersectsBox(r),intersectsTriangle:r=>cc.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){e.boundingBox||e.computeBoundingBox(),cc.set(e.boundingBox.min,e.boundingBox.max,t),cc.needsUpdate=!0;const a=this.geometry,l=a.attributes.position,A=a.index,c=e.attributes.position,u=e.index,f=Do.getPrimitive(),h=Do.getPrimitive();let p=pv,d=Jce,g=null,m=null;i&&(g=qce,m=eue);let y=1/0,w=null,x=null;return Yu.copy(t).invert(),ep.matrix.copy(Yu),this.shapecast({boundsTraverseOrder:_=>cc.distanceToBox(_),intersectsBounds:(_,C,S)=>S{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:S=>ep.distanceToBox(S),intersectsBounds:(S,b,M)=>M{for(let M=S*3,D=(S+b)*3;M(tp.copy(e).clamp(c.min,c.max),tp.distanceToSquared(e)),intersectsBounds:(c,u,f)=>f{c.closestPointToPoint(e,tp);const f=e.distanceToSquared(tp);return f{Jo(0,new Float32Array(r),D3),e.union(D3)}),e}}const rB=new mg,O3=new je,tue=xn.prototype.raycast;function nue(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;O3.copy(this.matrixWorld).invert(),rB.copy(n.ray).applyMatrix4(O3);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const r=L3(t.raycastFirst(rB,this.material),this,n);r&&e.push(r)}else{const r=t.raycast(rB,this.material);for(let i=0,s=r.length;i{const e=n.attributes.position,t=n.index,r=new Xi,i=new Z,s=new Z,o=new Z,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&&my(n.userData.cancelMesh))},d5=n=>{var e,t;n.userData.cullingClone&&(my(n.userData.cullingClone),n.userData.cullingClone=null,my(n.userData.cullingCloneP),n.userData.cullingCloneP=null,my(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))},uue=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=[];Lp=n[0].parent,Lp.lines!=null&&(Lp.lines.forEach(i=>{i.visible=!1}),Lp.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=cue(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=aue,a.userData.cancelMesh=o,a.material=lue,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)})},fue=n=>{let e=sue,t=oue;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},hue=(n,e,t,r,i,s,o=!1)=>{const a=[],l=fue(s);let A=l[0],c=l[1];mv.far=A+c;for(let f=0;f=0;y--)A-m[y].distance>=m[y].object.userData.maxCullDistance&&m.splice(y,1);if(m.length===0){for(let y=0;y<3;y++)a.push(n[h+y]);break}else{const y=m.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(d===0)p=m.map(w=>w.object);else if(p=m.map(w=>{if(p.indexOf(w.object)!==-1)return w.object}),p=p.filter(w=>w),d===2&&p.filter(w=>w).length===0)for(let w=0;w<3;w++)a.push(n[h+w]);o&&due(iB,np.clone().multiplyScalar(-1),mv.far,16711680,Lp)}}}const u=new Uint32Array(a);return new At(u,1,!1)};function due(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new Z;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new $t().setFromPoints(o),l=[];l.push(new Qe(0)),l.push(new Qe(16777215));let A=new Cl({color:r});var c=new td(a,A);c.renderOrder=100,i.add(c),i.lines.push(c)}let sB,ka,gv,vv,yv,zi,Xu;function pue(){zi!=null&&zi.clear(!0,!0)}function mue(n,e,t){const r=e*t,i=new Uint8Array(4*r),s=Math.floor(n.r*255),o=Math.floor(n.g*255),a=Math.floor(n.b*255);for(let A=0;Atypeof window>"u"?await wue({meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s}):await xue({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o}),wue=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(S=>{const b=S.material;let M=a.find(D=>D.material===b);if(!M)a.push({material:b,mesh:S});else{const{dest:D}=yT({meshes:[M.mesh,S]});M.mesh.geometry=D}});const l=Object.fromEntries(o.map(S=>[S,p5({width:s,height:s,transparent:i})])),A=Math.floor(Math.sqrt(n.length)+1),c=s/A,u=new Map(a.map((S,b)=>{const M=new $e(b%A,Math.floor(b/A)).multiplyScalar(1/A),D=new $e(M.x+1/A,M.y+1/A);return[S.mesh,{min:M,max:D}]})),f={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},h=[],p=[];a.forEach(S=>{const{min:b,max:M}=u.get(S.mesh);p.push(M),h.push(b)});const d=new $e(Math.max(...p.map(S=>S.x)),Math.max(...p.map(S=>S.y))),g=new $e(Math.min(...h.map(S=>S.x)),Math.min(...h.map(S=>S.y))),m=1/(d.x-g.x),y=1/(d.y-g.y),w=c*m,x=c*y,_=new Map(a.map(S=>{let{min:b,max:M}=u.get(S.mesh);return b.x=b.x*m,b.y=b.y*y,M.x=M.x*m,M.y=M.y*y,[S.mesh,{min:b,max:M}]}));a.forEach(S=>{const{material:b,mesh:M}=S,{min:D,max:$}=_.get(M);o.forEach(E=>{const U=l[E];U.globalCompositeOperation="source-over";let P=HC(b,f[E].find(L=>HC(b,L)));if(P!==""&&P!==void 0)try{const L=new Uint8ClampedArray(P.data),z=new ImageData(L,w,x),K=document.createElement("canvas");K.width=w,K.height=x;const O=K.getContext("2d");O.putImageData(z,0,0),O.save(),U.drawImage(K,D.x*s,D.y*s,w,x)}catch(L){console.error("error",L)}else U.fillStyle=E==="diffuse"?`#${b.color.clone().getHexString()}`:E==="normal"?"#8080ff":E==="orm"?`#${new Qe(b.aoMapIntensity,b.roughness,b.metalness).getHexString()}`:"#7F7F7F",U.fillRect(D.x*s,D.y*s,w,x)});const H=M.geometry,I=H.attributes.uv;if(I)for(let E=0;E{const b=new Qn(l[S].canvas);return b.flipY=!1,[S,b]})));return{bakeObjects:a,textures:C,uvs:_}},xue=async({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o})=>{pue();const a=t,l=r?["diffuse"]:["diffuse","orm","normal"],A=[];let c=null;e.forEach(v=>{v=v.clone();const E=v.material.length==null?v.material:v.material[0];r&&c==null&&E.type=="ShaderMaterial"&&(c=E.clone());let U=A.find(P=>{P.material});if(!U)A.push({material:E,mesh:v});else{const{dest:P}=yT({meshes:[U.mesh,v]});U.mesh.geometry=P}});const u=Object.fromEntries(l.map(v=>[v,p5({width:a,height:a,transparent:s&&v=="diffuse"})])),f=Math.floor(Math.sqrt(e.length)+1),h=a/f,p=new Map(A.map((v,E)=>{const U=new $e(E%f,Math.floor(E/f)).multiplyScalar(1/f),P=new $e(U.x+1/f,U.y+1/f);return[v.mesh,{min:U,max:P}]})),d={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},g=[],m=[];A.forEach(v=>{const{min:E,max:U}=p.get(v.mesh);m.push(U),g.push(E)});const y=new $e(Math.max(...m.map(v=>v.x)),Math.max(...m.map(v=>v.y))),w=new $e(Math.min(...g.map(v=>v.x)),Math.min(...g.map(v=>v.y))),x=1/(y.x-w.x),_=1/(y.y-w.y),C=h*x,S=h*_,b=new Map(A.map(v=>{let{min:E,max:U}=p.get(v.mesh);return E.x=E.x*x,E.y=E.y*_,U.x=U.x*x,U.y=U.y*_,[v.mesh,{min:E,max:U}]}));let M=!1;A.forEach(v=>{const{material:E,mesh:U}=v,{min:P,max:L}=b.get(U);l.forEach(B=>{var le;const W=u[B];W.globalCompositeOperation="source-over";let ee,F=new Qe(1,1,1);switch(B){case"diffuse":ee=E.color||n,(le=E.uniforms)!=null&&le.litFactor?F=E.uniforms.litFactor.value:F=E.color;break;case"normal":ee=new Qe(8421631);break;case"orm":ee=new Qe(0,E.roughness,E.metalness);break;default:ee=new Qe(1,1,1);break}let X=vue(E,d[B].find(oe=>HC(E,oe)));M==!1&&B=="normal"&&X!=null&&(M=!0);const ue=gue(X,F,ee,a,a,B=="diffuse"&&s,B!="normal");createImageBitmap(ue).then(oe=>W.drawImage(oe,P.x*a,P.y*a,C,S))});const z=U.geometry.clone();U.geometry=z;const K=z.attributes.uv.clone();if(z.attributes.uv=K,K)for(let B=0;B{const E=new Qn(u[v].canvas);return E.flipY=!1,[v,E]}))),$=o?ui:ls;let H;const I=i?"transparent":"opaque";return r?(H=new kh({map:D.diffuse,transparent:i,side:$}),c==null&&(c=new hy),c.side=$,c.uniforms.map=D.diffuse,c.uniforms.shadeMultiplyTexture=D.diffuse,c.transparent=i,s&&!i&&(H.alphaTest=.5,c.alphaTest=.5),H.userData.vrmMaterial=c,H.userData.shadeTexture=D.uniformColor,H.name="mToon_"+I,H.map.name=H.name):(H=new kh({map:D.diffuse,roughnessMap:D.orm,metalnessMap:D.orm,normalMap:M?D.normal:null,transparent:i,side:$}),s&&!i&&(H.alphaTest=.5),H.name="standard_"+I,H.roughnessMap!=null&&(H.roughnessMap.name=H.name+"_orm"),H.normalMap!=null&&(H.normalMap.name=H.name+"_normal")),{bakeObjects:A,material:H}};function m5(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 XA(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function g5(n,e){const t=new Map;new Z(-1,1,-1),new je,new Z;let r=0;n.forEach(l=>{if(l.skeleton){var A=m5(l);const c=A.bones;A.bones.forEach((u,f)=>{var h;if(c.indexOf(u)!==-1){const p=t.get(u.name);if(p==null){const d={index:r,boneInverses:A.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,d)}else u.userData.VRMcolliders!=null&&(p.bone.userData.VRMcolliders==null?p.bone.userData.VRMcolliders=u.userData.VRMcolliders:u.userData.VRMcollidersID!=p.bone.userData.VRMcollidersID&&(p.bone.userData.VRMcolliders=[...p.bone.userData.VRMcolliders,...u.userData.VRMcolliders]))}})}});const i=[],s=[];[...t.values()].forEach(l=>{var A;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const c=(A=t.get(l.parentName))==null?void 0:A.bone;c&&c.add(l.bone)}});const a=new XA(i,s);return a.bones.forEach(l=>{var c;const A=(c=l.userData)==null?void 0:c.vrm0RestPosition;A&&l.position.set(-A.x,A.y,-A.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function _ue(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(c=>c.name===o.name),A=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,A)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function bue(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 Ow(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function Cue(n,e){const{scale:t,isVrm0:r}=e,i=[],s=[];zh(n,"SkinnedMesh").forEach(A=>{const c=A.clone();i.push(c),Array.isArray(A.material)?s.push(...A.material):s.push(A.material)});const a=g5(i,t),l=new It;return l.name="AvatarRoot",i.forEach(A=>{var C;const c=new $t,u={};for(const S in A.geometry.attributes){const b=A.geometry.attributes[S];u[S]=b.clone()}if((C=A.userData)!=null&&C.isVRM0)for(let S=0;S[S,S.geometry.morphAttributes])),p=new Map([A].map(S=>[S,S.morphTargetDictionary||{}]));if(f.morphAttributes=y5({meshes:[A],sourceMorphAttributes:h,sourceMorphTargetDictionaries:p,destMorphTargetDictionary:f.morphTargetDictionary,scale:t},r),r)for(let S=0;Sh.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new Z(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],A=[],c=t.geometry.attributes.position.array,u=new Z,f=e.userData.isVRM0?-1:1;for(let h=0;h0){const{bakeObjects:D,material:$}=await yue({transparentColor:t,atlasSize:b.size,meshes:M,mtoon:b.isMtoon,transparentMaterial:b.transparentMaterial,transparentTexture:w,twoSidedMaterial:u}),H=D.map(L=>L.mesh),I=[];H.forEach(L=>{L.type=="Mesh"&&(L=Mue(_,L)),I.push(L);const z=L.geometry,K=z.index.array,O=v5(L.geometry.index.array),B=[];for(let F=0;F{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function Rue({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]=kH(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function Fue({sourceMorphTargetDictionaries:n}){const e=new Set;Array.from(n.values()).forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map((i,s)=>{r[i]=s}),r}function y5({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),A={};l.forEach(u=>{A[u]=[],Object.entries(r).forEach(([f,h])=>{A[u][h]=[],n.forEach(p=>{let d;const g=e.get(p);if(g.hasOwnProperty(f)&&p.geometry.morphAttributes[u]){const m=g[f];d=p.geometry.morphAttributes[u][m]}else{const m=p.geometry.attributes[u],y=new m.array.constructor(new Array(m.array.length).fill(0));d=new At(y,m.itemSize,m.normalized)}A[u][h].push(d)})})});const c={};return l.forEach(u=>{c[u]=[];for(let f=0;f{const i=r.geometry.index;for(var s=0;s{var l;if(r+=a.geometry.attributes.uv.count,(l=a.userData)!=null&&l.isVRM0)for(let A=0;A[a,a.geometry.attributes])),morphAttributes:new Map(n.map(a=>[a,a.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(a=>[a,a.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(a=>[a,a.morphTargetInfluences||[]]))},s={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};s.attributes=Rue({sourceAttributes:i.attributes});const o=Fue({sourceMorphTargetDictionaries:i.morphTargetDictionaries});return s.morphTargetDictionary=o,s.morphAttributes=y5({meshes:n,sourceMorphAttributes:i.morphAttributes,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o,scale:e},t),s.morphTargetInfluences=Iue({meshes:n,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o}),s.index=Uue({meshes:n}),s.animations={},{source:i,dest:s}}function ct(n){return n==null?[]:Array.isArray(n)?n:[n]}function Lue(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function Pue(n,e){const r=await new lu().load(e);r.encoding=pt,r.flipY=!1,n.traverse(i=>{if(i instanceof xn){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)})}}uue(e)};function Due(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var A;const l=ct(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((A=l.uniforms.alphaTest)==null?void 0:A.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 Oue(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{ct(a.material).forEach(A=>{A.type=="ShaderMaterial"?A.transparent==!0?o.push(A):A.uniforms.alphaTest.value!=0?s.push(A):i.push(A):A.transparent==!0?r.push(A):A.alphaTest!=0?t.push(A):e.push(A)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function k3(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function Nue(n,e){if(n.data!=null)return n.data[e]}function kue(n){const e=Nue(n,"cullingMeshes");e&&(e.forEach(t=>{d5(t)}),n.data.cullingMeshes=null)}function vn(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 Que(n){const e=n.scene;kue(n),e.traverse(t=>{t.material&&zC(t.material),t.geometry&&(d5(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),Bg.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&&zC(i.material)})})});for(const t in n)n[t]=null}const zC=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 Z(e,t,r)},w5=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},Hue=n=>{var t,r,i,s,o,a,l,A,c,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!=((A=e.spine)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((c=e.neck)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let h in Km)h=h.charAt(0).toLowerCase()+h.slice(1),(f=e[h])!=null&&f.node&&(e[h].node.name=h)};function x5({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),x5({candidates:n,predicate:e}))}function _5(n,e){return x5({candidates:[n],predicate:t=>t.name===e})}function b5({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),b5({candidates:n,predicate:e,results:t})}function zh(n,e){return b5({candidates:[n],predicate:t=>ct(e).includes(t.type)})}const zue={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 B5(n,e,t){var d;const r=Yc.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new rt,o=new rt,a=new rt,l=new Z,A=e.getObjectByName("mixamorigHips").position.y,c=(d=t.humanoid)==null?void 0:d.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,h=Math.abs(c-u)/A;return r.tracks.forEach(g=>{const m=g.clone(),y=m.name.split("."),w=y[0],_=zue[w],C=e.getObjectByName(w);if(_!=null){const S=y[1];if(C.getWorldQuaternion(s).invert(),C.parent.getWorldQuaternion(o),m instanceof ga){for(let b=0;b{m.values[$+b]=D})}i.push(new ga(`${_}.${S}`,m.times,m.values.map((b,M)=>{var D;return((D=t.meta)==null?void 0:D.metaVersion)==="0"&&M%2===0?-b:b})))}else if(m instanceof NA){const b=m.values.map((M,D)=>{var $;return((($=t.meta)==null?void 0:$.metaVersion)==="0"&&D%3!==1?-M:M)*h});i.push(new NA(`${_}.${S}`,m.times,b))}}}),new Yc("vrmAnimation",r.duration,i)}const Gue=new sre,Vue=new QH,aB=.2,jue=n=>Math.floor(Math.random()*n);class Q3{constructor(e,t,r,i,s,o,a){var l,A,c,u;this.mixer=new ine(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=(A=(l=r==null?void 0:r.humanoid)==null?void 0:l.humanBones)==null?void 0:A.neck,this.spineBone=(u=(c=r==null?void 0:r.humanoid)==null?void 0:c.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=B5(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 Wue{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!=""?"/":"")+ct(e)[0];o=o==""?ul(a):o,this.currentAnimationName=o;const A=await(i?Gue:Vue).loadAsync(a);A.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(A.animations);const c=Yc.findByName(A.animations,"mixamo.com");c!=null?(this.mixamoModel=A.clone(),this.mixamoAnimations=A.animations,this.currentClip=c):(this.mixamoModel=null,this.animations=A.animations,this.currentClip=A.animations[0]),this.mainControl==null&&(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new Q3(this,A,null,A.animations,this.curAnimID,this.lastAnimID,t),this.animationControls.push(this.mainControl)),this.animationControls.forEach(u=>{u.setAnimations(A.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=ct(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=ct(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=jue(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-aB)},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*aB):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*aB):this.weightOut=0)}}const Kue={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` + */class i5{}const Zb=new Z,cc=new Z;class s5 extends i5{constructor(e){var t,r,i;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new Z(0,0,0),this.tail=(r=e==null?void 0:e.tail)!==null&&r!==void 0?r:new Z(0,0,0),this.radius=(i=e==null?void 0:e.radius)!==null&&i!==void 0?i:0}get type(){return"capsule"}calculateCollision(e,t,r,i){Zb.copy(this.offset).applyMatrix4(e),cc.copy(this.tail).applyMatrix4(e),cc.sub(Zb);const s=cc.lengthSq();i.copy(t).sub(Zb);const o=cc.dot(i);o<=0||(s<=o||cc.multiplyScalar(o/s),i.sub(cc));const a=r+this.radius,l=i.length()-a;return i.normalize(),l}}class o5 extends i5{constructor(e){var t,r;super(),this.offset=(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:new Z(0,0,0),this.radius=(r=e==null?void 0:e.radius)!==null&&r!==void 0?r:0}get type(){return"sphere"}calculateCollision(e,t,r,i){i.copy(this.offset).applyMatrix4(e),i.negate().add(t);const s=r+this.radius,o=i.length()-s;return i.normalize(),o}}const Do=new Z;class ece extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._currentTail=new Z,this._shape=e,this._attrPos=new At(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0);const r=Do.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(r)>1e-10&&(this._currentTail.copy(r),e=!0),e&&this._buildPosition()}_buildPosition(){Do.copy(this._currentTail).sub(this._currentOffset);const e=Do.length()/this._currentRadius;for(let i=0;i<=16;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(i,-Math.sin(s),-Math.cos(s),0),this._attrPos.setXYZ(17+i,e+Math.sin(s),Math.cos(s),0),this._attrPos.setXYZ(34+i,-Math.sin(s),0,-Math.cos(s)),this._attrPos.setXYZ(51+i,e+Math.sin(s),0,Math.cos(s))}for(let i=0;i<32;i++){const s=i/16*Math.PI;this._attrPos.setXYZ(68+i,0,Math.sin(s),Math.cos(s)),this._attrPos.setXYZ(100+i,e,Math.sin(s),Math.cos(s))}const t=Math.atan2(Do.y,Math.sqrt(Do.x*Do.x+Do.z*Do.z)),r=-Math.atan2(Do.z,Do.x);this.rotateZ(t),this.rotateY(r),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 e=0;e<34;e++){const t=(e+1)%34;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(68+e*2,34+e,34+t)}for(let e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(136+e*2,68+e,68+t),this._attrIndex.setXY(200+e*2,100+e,100+t)}this._attrIndex.needsUpdate=!0}}class tce extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._shape=e,this._attrPos=new At(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._shape.radius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(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 e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.needsUpdate=!0}}const nce=new Z;class m3 extends Ur{constructor(e){if(super(),this.matrixAutoUpdate=!1,this.collider=e,this.collider.shape instanceof o5)this._geometry=new tce(this.collider.shape);else if(this.collider.shape instanceof s5)this._geometry=new ece(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const t=new Sl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new wg(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=nce.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class rce extends $t{constructor(e){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new Z,this._springBone=e,this._attrPos=new At(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new At(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;const t=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==t&&(this._currentRadius=t,e=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}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 e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(e*2,e,t),this._attrIndex.setXY(64+e*2,32+e,32+t),this._attrIndex.setXY(128+e*2,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const ice=new Z;class sce extends Ur{constructor(e){super(),this.matrixAutoUpdate=!1,this.springBone=e,this._geometry=new rce(this.springBone);const t=new Sl({color:16776960,depthTest:!1,depthWrite:!1});this._line=new wg(this._geometry,t),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(e){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const t=this.matrix.elements;this._geometry.worldScale=ice.set(t[0],t[1],t[2]).length(),this._geometry.update(),super.updateMatrixWorld(e)}}class g3 extends It{constructor(e){super(),this.shape=e}}const oce=new je;function a5(n){return n.invert?n.invert():n.getInverse(oce.copy(n)),n}class ace{constructor(e){this._inverseCache=new je,this._shouldUpdateInverse=!0,this.matrix=e;const t={set:(r,i,s)=>(this._shouldUpdateInverse=!0,r[i]=s,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,t)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.copy(this.matrix),a5(this._inverseCache),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const lce=new je,Na=new Z,Jd=new Z,Ace=new Z,Ku=new Z,v3=new Z,qd=new Z,y3=new rt,$u=new je,cce=new je;class uce{constructor(e,t,r={},i=[]){var s,o,a,l,A,c;this._currentTail=new Z,this._prevTail=new Z,this._boneAxis=new Z,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new je,this._initialLocalRotation=new rt,this._initialLocalChildPosition=new Z,this.bone=e,this.bone.matrixAutoUpdate=!1,this.child=t,this.settings={hitRadius:(s=r.hitRadius)!==null&&s!==void 0?s:0,stiffness:(o=r.stiffness)!==null&&o!==void 0?o:1,gravityPower:(a=r.gravityPower)!==null&&a!==void 0?a:0,gravityDir:(A=(l=r.gravityDir)===null||l===void 0?void 0:l.clone())!==null&&A!==void 0?A:new Z(0,-1,0),dragForce:(c=r.dragForce)!==null&&c!==void 0?c:.4},this.colliderGroups=i}get center(){return this._center}set center(e){var t;!((t=this._center)===null||t===void 0)&&t.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=e,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new ace(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:lce}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 e=this._getMatrixWorldToCenter($u);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),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 e=this._getMatrixWorldToCenter($u);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(e),this._prevTail.copy(this._currentTail)}update(e){if(e<=0)return;this._calcWorldSpaceBoneLength(),Ku.setFromMatrixPosition(this.bone.matrixWorld);let t=this._getMatrixWorldToCenter($u);v3.copy(Ku).applyMatrix4(t);const r=y3.setFromRotationMatrix(t),i=cce.copy(t).multiply(this._parentMatrixWorld),s=Jd.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(v3).normalize(),o=Ace.copy(this.settings.gravityDir).applyQuaternion(r).normalize(),a=this._getMatrixCenterToWorld($u);qd.copy(this._currentTail).add(Na.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(Na.copy(s).multiplyScalar(this.settings.stiffness*e)).add(Na.copy(o).multiplyScalar(this.settings.gravityPower*e)).applyMatrix4(a),qd.sub(Ku).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Ku),this._collision(qd),t=this._getMatrixWorldToCenter($u),this._prevTail.copy(this._currentTail),this._currentTail.copy(Na.copy(qd).applyMatrix4(t));const l=a5($u.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),A=y3.setFromUnitVectors(this._boneAxis,Na.copy(qd).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(A),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(e){this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{const i=r.shape.calculateCollision(r.matrixWorld,e,this.settings.hitRadius,Na);i<0&&(e.add(Na.multiplyScalar(-i)),e.sub(Ku).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Ku))})})}_calcWorldSpaceBoneLength(){Na.setFromMatrixPosition(this.bone.matrixWorld),this.child?Jd.setFromMatrixPosition(this.child.matrixWorld):(Jd.copy(this._initialLocalChildPosition),Jd.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Na.sub(Jd).length()}_getMatrixCenterToWorld(e){return this._center?e.copy(this._center.matrixWorld):e.identity(),e}_getMatrixWorldToCenter(e){return this._center?e.copy(this._center.userData.inverseCacheProxy.inverse):e.identity(),e}}function lv(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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})}function fce(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function l5(n,e){n.children.forEach(t=>{e(t)||l5(t,e)})}class w3{constructor(){this._joints=new Set,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 e=new Set;return this._joints.forEach(t=>{t.colliderGroups.forEach(r=>{e.add(r)})}),Array.from(e)}get colliders(){const e=new Set;return this.colliderGroups.forEach(t=>{t.colliders.forEach(r=>{e.add(r)})}),Array.from(e)}addJoint(e){this._joints.add(e);let t=this._objectSpringBonesMap.get(e.bone);t==null&&(t=new Set,this._objectSpringBonesMap.set(e.bone,t)),t.add(e)}addSpringBone(e){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(e)}deleteJoint(e){this._joints.delete(e),this._objectSpringBonesMap.get(e.bone).delete(e)}deleteSpringBone(e){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(e)}setInitState(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.setInitState())}reset(){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.reset())}update(e){const t=new Set,r=new Set,i=new Set;for(const s of this._joints)this._processSpringBone(s,t,r,i,o=>o.update(e)),l5(s.bone,o=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(o))===null||a===void 0?void 0:a.size)!==null&&l!==void 0?l:0)>0?!0:(o.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(e,t,r,i,s){if(r.has(e))return;if(t.has(e))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating springbones");t.add(e);const o=this._getDependencies(e);for(const a of o)fce(a,l=>{const A=this._objectSpringBonesMap.get(l);if(A)for(const c of A)this._processSpringBone(c,t,r,i,s);else i.has(l)||(l.updateWorldMatrix(!1,!1),i.add(l))});e.bone.updateMatrix(),e.bone.updateWorldMatrix(!1,!1),s(e),i.add(e.bone),r.add(e)}_getDependencies(e){const t=new Set,r=e.bone.parent;return r&&t.add(r),e.colliderGroups.forEach(i=>{i.colliders.forEach(s=>{t.add(s)})}),t}}const hce=new Set(["1.0","1.0-beta"]);class Ic{constructor(e,t){this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot}get name(){return Ic.EXTENSION_NAME}afterRoot(e){return lv(this,void 0,void 0,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return lv(this,void 0,void 0,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){var t,r,i,s,o;return lv(this,void 0,void 0,function*(){const a=e.parser.json;if(!(((t=a.extensionsUsed)===null||t===void 0?void 0:t.indexOf(Ic.EXTENSION_NAME))!==-1))return null;const A=new w3,c=yield e.parser.getDependencies("node"),u=(r=a.extensions)===null||r===void 0?void 0:r[Ic.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!hce.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Ic.EXTENSION_NAME} specVersion "${f}"`),null;const h=(i=u.colliders)===null||i===void 0?void 0:i.map((d,g)=>{var m,y,w,x,_;const C=c[d.node],S=d.shape;if(S.sphere)return this._importSphereCollider(C,{offset:new Z().fromArray((m=S.sphere.offset)!==null&&m!==void 0?m:[0,0,0]),radius:(y=S.sphere.radius)!==null&&y!==void 0?y:0});if(S.capsule)return this._importCapsuleCollider(C,{offset:new Z().fromArray((w=S.capsule.offset)!==null&&w!==void 0?w:[0,0,0]),radius:(x=S.capsule.radius)!==null&&x!==void 0?x:0,tail:new Z().fromArray((_=S.capsule.tail)!==null&&_!==void 0?_:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),p=(s=u.colliderGroups)===null||s===void 0?void 0:s.map((d,g)=>{var m;return{colliders:((m=d.colliders)!==null&&m!==void 0?m:[]).map(w=>{const x=h==null?void 0:h[w];if(x==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${g} attempted to use a collider #${w} but not found`);return x}),name:d.name}});return(o=u.springs)===null||o===void 0||o.forEach((d,g)=>{var m;const y=d.joints,w=(m=d.colliderGroups)===null||m===void 0?void 0:m.map(C=>{const S=p==null?void 0:p[C];if(S==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${C} but not found`);return S}),x=d.center!=null?c[d.center]:void 0;let _;y.forEach(C=>{if(_){const S=_.node,b=c[S],M=C.node,D=c[M],$={hitRadius:_.hitRadius,dragForce:_.dragForce,gravityPower:_.gravityPower,stiffness:_.stiffness,gravityDir:_.gravityDir!=null?new Z().fromArray(_.gravityDir):void 0},H=this._importJoint(b,D,$,w);x&&(H.center=x),A.addJoint(H)}_=C})}),A.setInitState(),A})}_v0Import(e){var t,r,i;return lv(this,void 0,void 0,function*(){const s=e.parser.json;if(!(((t=s.extensionsUsed)===null||t===void 0?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)===null||r===void 0?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const A=l==null?void 0:l.boneGroups;if(!A)return null;const c=new w3,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)===null||i===void 0?void 0:i.map(h=>{var p;const d=u[h.node];return{colliders:((p=h.colliders)!==null&&p!==void 0?p:[]).map((m,y)=>{var w,x,_;const C=new Z(0,0,0);return m.offset&&C.set((w=m.offset.x)!==null&&w!==void 0?w:0,(x=m.offset.y)!==null&&x!==void 0?x:0,m.offset.z?-m.offset.z:0),this._importSphereCollider(d,{offset:C,radius:(_=m.radius)!==null&&_!==void 0?_:0})})}});return A==null||A.forEach((h,p)=>{const d=h.bones;d&&d.forEach(g=>{var m,y,w,x;const _=u[g],C=new Z;h.gravityDir?C.set((m=h.gravityDir.x)!==null&&m!==void 0?m:0,(y=h.gravityDir.y)!==null&&y!==void 0?y:0,(w=h.gravityDir.z)!==null&&w!==void 0?w:0):C.set(0,-1,0);const S=h.center!=null?u[h.center]:void 0,b={hitRadius:h.hitRadius,dragForce:h.dragForce,gravityPower:h.gravityPower,stiffness:h.stiffiness,gravityDir:C},M=(x=h.colliderGroups)===null||x===void 0?void 0:x.map(D=>{const $=f==null?void 0:f[D];if($==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${p} attempted to use a colliderGroup ${D} but not found`);return $});_.traverse(D=>{var $;const H=($=D.children[0])!==null&&$!==void 0?$:null,I=this._importJoint(D,H,b,M);S&&(I.center=S),c.addJoint(I)})})}),e.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(e,t,r,i){const s=new uce(e,t,r,i);if(this.jointHelperRoot){const o=new sce(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const{offset:r,radius:i}=t,s=new o5({offset:r,radius:i}),o=new g3(s);if(e.add(o),this.colliderHelperRoot){const a=new m3(o);this.colliderHelperRoot.add(a),a.renderOrder=this.colliderHelperRoot.renderOrder}return o}_importCapsuleCollider(e,t){const{offset:r,radius:i,tail:s}=t,o=new s5({offset:r,radius:i,tail:s}),a=new g3(o);if(e.add(a),this.colliderHelperRoot){const l=new m3(a);this.colliderHelperRoot.add(l),l.renderOrder=this.colliderHelperRoot.renderOrder}return a}}Ic.EXTENSION_NAME="VRMC_springBone";class dce{constructor(e,t){var r,i,s,o,a,l,A,c,u,f;this.parser=e;const h=t==null?void 0:t.helperRoot,p=t==null?void 0:t.autoUpdateHumanBones;this.expressionPlugin=(r=t==null?void 0:t.expressionPlugin)!==null&&r!==void 0?r:new i_(e),this.firstPersonPlugin=(i=t==null?void 0:t.firstPersonPlugin)!==null&&i!==void 0?i:new Wle(e),this.humanoidPlugin=(s=t==null?void 0:t.humanoidPlugin)!==null&&s!==void 0?s:new eAe(e,{helperRoot:h,autoUpdateHumanBones:p}),this.lookAtPlugin=(o=t==null?void 0:t.lookAtPlugin)!==null&&o!==void 0?o:new dAe(e,{helperRoot:h}),this.metaPlugin=(a=t==null?void 0:t.metaPlugin)!==null&&a!==void 0?a:new gAe(e),this.mtoonMaterialPlugin=(l=t==null?void 0:t.mtoonMaterialPlugin)!==null&&l!==void 0?l:new hh(e),this.materialsHDREmissiveMultiplierPlugin=(A=t==null?void 0:t.materialsHDREmissiveMultiplierPlugin)!==null&&A!==void 0?A:new Ym(e),this.materialsV0CompatPlugin=(c=t==null?void 0:t.materialsV0CompatPlugin)!==null&&c!==void 0?c:new UAe(e),this.springBonePlugin=(u=t==null?void 0:t.springBonePlugin)!==null&&u!==void 0?u:new Ic(e,{colliderHelperRoot:h,jointHelperRoot:h}),this.nodeConstraintPlugin=(f=t==null?void 0:t.nodeConstraintPlugin)!==null&&f!==void 0?f:new Tc(e,{helperRoot:h})}get name(){return"VRMLoaderPlugin"}beforeRoot(){return av(this,void 0,void 0,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return av(this,void 0,void 0,function*(){return yield this.mtoonMaterialPlugin.loadMesh(e)})}getMaterialType(e){const t=this.mtoonMaterialPlugin.getMaterialType(e);return t??null}extendMaterialParams(e,t){return av(this,void 0,void 0,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,t),yield this.mtoonMaterialPlugin.extendMaterialParams(e,t)})}afterRoot(e){return av(this,void 0,void 0,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e),yield this.springBonePlugin.afterRoot(e),yield this.nodeConstraintPlugin.afterRoot(e),yield this.mtoonMaterialPlugin.afterRoot(e);const t=e.userData.vrmMeta,r=e.userData.vrmHumanoid;if(t&&r){const i=new yAe({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:r,lookAt:e.userData.vrmLookAt,meta:t,materials:e.userData.vrmMToonMaterials,springBoneManager:e.userData.vrmSpringBoneManager,nodeConstraintManager:e.userData.vrmNodeConstraintManager});e.userData.vrm=i}})}}function x3(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 pce(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=>x3(i)):r&&x3(r))}function mce(n){n.traverse(pce)}function gce(n){const e=new Map;n.traverse(t=>{if(t.type!=="SkinnedMesh")return;const r=t,s=r.geometry.getAttribute("skinIndex");let o=e.get(s);if(!o){const a=[],l=[],A={},c=s.array;for(let u=0;u{var r,i,s,o;if(!t.isMesh)return;const a=t,l=a.geometry,A=l.index;if(A==null)return;const c=e.get(l);if(c!=null){a.geometry=c;return}const u=new $t;u.name=l.name,u.morphTargetsRelative=l.morphTargetsRelative,l.groups.forEach(d=>{u.addGroup(d.start,d.count,d.materialIndex)}),u.boundingBox=(i=(r=l.boundingBox)===null||r===void 0?void 0:r.clone())!==null&&i!==void 0?i:null,u.boundingSphere=(o=(s=l.boundingSphere)===null||s===void 0?void 0:s.clone())!==null&&o!==void 0?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],h=[];{const d=A.array,g=new d.constructor(d.length);let m=0;for(let y=0;y{const g=l.attributes[d];if(g.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");const m=g.array,{itemSize:y,normalized:w}=g,x=new m.constructor(h.length*y);h.forEach((_,C)=>{for(let S=0;S{u.morphAttributes[d]=[];const g=l.morphAttributes[d];for(let m=0;m{for(let M=0;MS===0),u.morphAttributes[d][m]=new At(C,x,_)}}),p&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function yce(n){var e;((e=n.meta)===null||e===void 0?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}class Eg{constructor(){}}Eg.deepDispose=mce;Eg.removeUnnecessaryJoints=gce;Eg.removeUnnecessaryVertices=vce;Eg.rotateVRM0=yce;var Jn;(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"})(Jn||(Jn={}));const Pw="blend_",_3="vrmColliderSphere";class wce{parse(e,t,r,i){const s=e.humanoid,o=e.meta,a=e.materials,l={},A={},c={},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((re,pe,_e)=>_e.findIndex(Re=>Re.name===re.name.replace(" (Outline)",""))===pe).map(re=>re),p=h.map(re=>re.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(re=>re.map).map(re=>{if(!re.map)throw new Error(re.name+" map is null");return{name:re.name,imageBitmap:re.map.image}}),m=h.filter(re=>re.userData.shadeTexture).map(re=>{if(!re.userData.shadeTexture)throw new Error(re.userData.shadeTexture+" map is null");return{name:re.name+"_shade",imageBitmap:re.userData.shadeTexture.image}}),y=g.concat(m),w=Ece(y,d),x=Cce(w),_=Sce(w),C=Bce(h,y),S=t.children.filter(re=>re.children.length>0&&re.children[0].type===ai.Bone)[0],b=A5(S).filter(re=>re.name!==_3),M=b.map(re=>re.name),D=b.map(re=>({children:re.children.filter(pe=>pe.name!==_3).map(pe=>M.indexOf(pe.name)),name:re.name,rotation:[re.quaternion.x,re.quaternion.y,re.quaternion.z,re.quaternion.w],scale:[re.scale.x,re.scale.y,re.scale.z],translation:[re.position.x,re.position.y,re.position.z]})),$=[],H=t.children.filter(re=>re.type===ai.Group||re.type===ai.SkinnedMesh),I=[];H.forEach(re=>{const pe=re.type===ai.Group?re.children[0]:re,_e=pe.geometry.attributes;I.push(new ka(_e.position,Jn.FLOAT,Wt.POSITION,po.VEC3,pe.name,void 0)),I.push(new ka(_e.normal,Jn.FLOAT,Wt.NORMAL,po.VEC3,pe.name,void 0)),I.push(new ka(_e.uv,Jn.FLOAT,Wt.UV,po.VEC2,pe.name,void 0)),I.push(new ka(_e.skinWeight,Jn.FLOAT,Wt.SKIN_WEIGHT,po.VEC4,pe.name,void 0)),I.push(new ka(_e.skinIndex,Jn.UNSIGNED_SHORT,Wt.SKIN_INDEX,po.VEC4,pe.name,void 0)),(re.type===ai.Group?re.children.map(Q=>Q):[re]).forEach(Q=>{if(!Q.geometry.index)throw new Error(Q.name+" geometry.index is null");I.push(new ka(Q.geometry.index,Jn.UNSIGNED_INT,Wt.INDEX,po.SCALAR,pe.name,Q.name))}),pe.morphTargetDictionary||(pe.morphTargetDictionary={},pe.morphTargetInfluences=[],pe.geometry.morphAttributes={},pe.updateMorphTargets()),pe.geometry.userData.targetNames=[];for(const Q in e.expressionManager.expressionMap){const de=e.expressionManager.expressionMap[Q],Ae=de._binds.map(J=>({node:b.length,index:J.index,weight:J.weight}));let q=!1;for(const J in oi)if(Q.toLowerCase()===oi[J].toLowerCase()){l[oi[J]]={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth},q=!0;break}!q&&Q.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth},q=!0),q===!1&&(A[Q]={morphTargetBinds:Ae,isBinary:de.isBinary,overrideBlink:de.overrideBlink,overrideLookAt:de.overrideLookAt,overrideMouth:de.overrideMouth})}for(const Q in pe.morphTargetDictionary){pe.geometry.userData.targetNames.push(Q);const de=pe.morphTargetDictionary[Q],Ae=pe.geometry.morphAttributes;I.push(new ka(Ae.position[de],Jn.FLOAT,Wt.BLEND_POSITION,po.VEC3,pe.name,Pw+Q)),I.push(new ka(Ae.normal[de],Jn.FLOAT,Wt.BLEND_NORMAL,po.VEC3,pe.name,Pw+Q))}}),Object.keys(l).length>0&&(c.preset=l),Object.keys(A).length>0&&(c.custom=A),H.forEach(re=>{const pe=re.type===ai.Group?re.children[0]:re,_e=new Float32Array(pe.skeleton.boneInverses.map(Re=>Re.elements).flat());I.push(new ka(new At(_e,16),Jn.FLOAT,Wt.BIND_MATRIX,po.MAT4,pe.name,pe.name))}),$.push(...I.map(re=>({bufferView:-1,byteOffset:0,componentType:re.valueType,count:re.attribute.count,max:re.max,min:re.min,normalized:!1,type:re.accessorsType})));const v=_ce(H,I,p);H.forEach((re,pe)=>{D.push({mesh:pe,name:re.name,rotation:[re.quaternion.x,re.quaternion.y,re.quaternion.z,re.quaternion.w],scale:[re.scale.x,re.scale.y,re.scale.z],skin:pe,translation:[re.position.x,re.position.y,re.position.z]})});const E=bce(H,I,M),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 re in s.humanBones)P.humanBones[re]={node:M.indexOf(s.humanBones[re].node.name)};const L=o,z=[];z.push(...y.map(re=>({buffer:b3(re.imageBitmap),type:Wt.IMAGE}))),z.push(...I.map(re=>({buffer:re.buffer,type:re.type}))),d&&z.push({buffer:b3(d.imageBitmap),type:Wt.IMAGE});let K=0,O=0,B=0;const W=z.map((re,pe)=>{const _e={buffer:0,byteLength:re.buffer.byteLength,byteOffset:K,target:re.type===Wt.IMAGE||re.type===Wt.BIND_MATRIX?void 0:re.type===Wt.INDEX?Jn.ELEMENT_ARRAY_BUFFER:Jn.ARRAY_BUFFER};return K+=re.buffer.byteLength,re.type===Wt.IMAGE?w[O++].bufferView=pe:$[B++].bufferView=pe,_e}),ee=Mce(t,D),F={accessors:$,asset:f,buffers:[{byteLength:K}],bufferViews:W,extensions:{VRMC_vrm:{expressions:c,humanoid:P,lookAt:U,meta:L,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:w,materials:C,meshes:v,nodes:D,samplers:x,avatar:0,scenes:ee,skins:E,textures:_},X=new B3(DC(JSON.stringify(F,void 0,2)),"JSON"),ue=new B3(Up(z.map(re=>re.buffer)),"BIN\0"),le=Up([X.buffer,ue.buffer]),oe=Up([DC("glTF"),PC(2,4),PC(le.byteLength+12,4)]);i(Up([oe,le]))}}function A5(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>A5(e)).flat())}function b3(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?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Jn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Jn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}let B3=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=Up([PC(r.byteLength,4),DC(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===Wt.POSITION||r===Wt.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 Wf;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Wf||(Wf={}));var po;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(po||(po={}));var Wt;(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"})(Wt||(Wt={}));var ai;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(ai||(ai={}));const _ce=(n,e,t)=>n.map(r=>{const i=r.type===ai.Group?r.children[0]:r,s=r.type===ai.Group?r.children.map(o=>o):[r];return{name:r.name,primitives:s.map(o=>{const a=e.map(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Wt.SKIN_INDEX),NORMAL:a.indexOf(Wt.NORMAL),POSITION:a.indexOf(Wt.POSITION),TEXCOORD_0:a.indexOf(Wt.UV),WEIGHTS_0:a.indexOf(Wt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Wt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>({NORMAL:e.map(c=>c.type===Wt.BLEND_NORMAL&&c.meshName===i.name?c.name:null).indexOf(Pw+A),POSITION:e.map(c=>c.type===Wt.BLEND_POSITION&&c.meshName===i.name?c.name:null).indexOf(Pw+A)})):void 0}})}}),bce=(n,e,t)=>n.map(r=>{const i=r.type===ai.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Wt.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)}}),Bce=(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(c=>c.name).indexOf(t.uniforms.shadeMultiplyTexture.name)},r=t.color?[1,1,1,1]:void 0;else{const A=t;r=A.color?[A.color.r,A.color.g,A.color.b,1]:void 0}let s=-1;t.map?s=e.map(A=>A.name).indexOf(t.name):t.uniforms&&t.uniforms.map&&(s=e.map(A=>A.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 Wf.MeshStandardMaterial:return t.metalness;case Wf.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case Wf.MeshStandardMaterial:return t.roughness;case Wf.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}}}),Ece=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),Cce=n=>n.map(()=>({magFilter:Jn.LINEAR,minFilter:Jn.LINEAR,wrapS:Jn.REPEAT,wrapT:Jn.REPEAT})),Sce=n=>n.map((e,t)=>({sampler:0,source:t})),Mce=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===ai.Object3D||r.type===ai.SkinnedMesh||r.type===ai.Group||r.type===ai.Bone).map(r=>t.indexOf(r.name))}]},c5=0,Tce=1,u5=2,E3=2,Jb=1.25,C3=1,py=6*4+4+4,OC=65535,Ice=Math.pow(2,-24);class Av{constructor(){}}function qo(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 S3(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 M3(n,e){e.set(n)}function T3(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 cv(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 ep(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)}function Rce(n,e){if(!n.index){const t=n.attributes.position.count,r=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;let i;t>65535?i=new Uint32Array(new r(4*t)):i=new Uint16Array(new r(2*t)),n.setIndex(new At(i,1));for(let s=0;si-s);for(let i=0;il&&(l=S),m&&xp&&(p=x);const b=n[y+2],M=n[y+3],D=b-M,$=b+M;DA&&(A=$),m&&bd&&(d=b);const H=n[y+4],I=n[y+5],v=H-I,E=H+I;vc&&(c=E),m&&Hg&&(g=H)}r[0]=s,r[1]=o,r[2]=a,r[3]=l,r[4]=A,r[5]=c,m&&(i[0]=u,i[1]=f,i[2]=h,i[3]=p,i[4]=d,i[5]=g)}function Uce(n,e,t,r){let i=1/0,s=1/0,o=1/0,a=-1/0,l=-1/0,A=-1/0;for(let c=e*6,u=(e+t)*6;ca&&(a=f);const h=n[c+2];hl&&(l=h);const p=n[c+4];pA&&(A=p)}r[0]=i,r[1]=s,r[2]=o,r[3]=a,r[4]=l,r[5]=A}function Lce(n,e,t,r,i){let s=t,o=t+r-1;const a=i.pos,l=i.axis*2;for(;;){for(;s<=o&&e[s*6+l]=a;)o--;if(sn.candidate-e.candidate,Gl=new Array(Va).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),uv=new Float32Array(6);function Dce(n,e,t,r,i,s){let o=-1,a=0;if(s===c5)o=S3(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===Tce)o=S3(n),o!==-1&&(a=Oce(t,r,i,o));else if(s===u5){const l=ep(n);let A=Jb*i;const c=r*6,u=(r+i)*6;for(let f=0;f<3;f++){const h=e[f],g=(e[f+3]-h)/Va;if(i=S.candidate?cv(x,t,S.rightCacheBounds):(cv(x,t,S.leftCacheBounds),S.count++)}}for(let x=0;x=Va&&(C=Va-1);const S=Gl[C];S.count++,cv(w,t,S.bounds)}const m=Gl[Va-1];M3(m.bounds,m.rightCacheBounds);for(let w=Va-2;w>=0;w--){const x=Gl[w],_=Gl[w+1];T3(x.bounds,_.rightCacheBounds,x.rightCacheBounds)}let y=0;for(let w=0;wC&&(C=w),x>C&&(C=x);const S=(C-_)/2,b=m*2;s[h+b+0]=_+S,s[h+b+1]=S+(Math.abs(_)+S)*Ice,_e[m+3]&&(e[m+3]=C)}}return s}function kce(n,e){function t(m){f&&f(m/h)}function r(m,y,w,x=null,_=0){if(!p&&_>=l&&(p=!0,A&&(console.warn(`MeshBVH: Max depth of ${l} reached when generating BVH. Consider increasing maxDepth.`),console.warn(n))),w<=c||_>=l)return t(y+w),m.offset=y,m.count=w,m;const C=Dce(m.boundingData,x,o,y,w,u);if(C.axis===-1)return t(y+w),m.offset=y,m.count=w,m;const S=Lce(a,o,y,w,C);if(S===y||S===y+w)t(y+w),m.offset=y,m.count=w;else{m.splitAxis=C.axis;const b=new Av,M=y,D=S-y;m.left=b,b.boundingData=new Float32Array(6),qb(o,M,D,b.boundingData,s),r(b,M,D,s,_+1);const $=new Av,H=S,I=w-D;m.right=$,$.boundingData=new Float32Array(6),qb(o,H,I,$.boundingData,s),r($,H,I,s,_+1)}return m}Rce(n,e);const i=new Float32Array(6),s=new Float32Array(6),o=Nce(n,i),a=n.index.array,l=e.maxDepth,A=e.verbose,c=e.maxLeafTris,u=e.strategy,f=e.onProgress,h=n.index.count/3;let p=!1;const d=[],g=Fce(n);if(g.length===1){const m=g[0],y=new Av;y.boundingData=i,Uce(o,m.offset,m.count,s),r(y,m.offset,m.count,s),d.push(y)}else for(let m of g){const y=new Av;y.boundingData=new Float32Array(6),qb(o,m.offset,m.count,y.boundingData,s),r(y,m.offset,m.count,s),d.push(y)}return d}function Qce(n,e){const t=kce(n,e);let r,i,s;const o=[],a=e.useSharedArrayBuffer?SharedArrayBuffer:ArrayBuffer;for(let c=0;cMath.pow(2,32))throw new Error("MeshBVH: Cannot store child pointer greater than 32 bits.");return i[f+6]=w/4,w=A(w,m),i[f+7]=y,w}}}class _l{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}}_l.prototype.setFromBox=function(){const n=new Z;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 A=0;A<=1;A++)for(let c=0;c<=1;c++){n.x=i.x*l+s.x*(1-l),n.y=i.y*A+s.y*(1-A),n.z=i.z*c+s.z*(1-c);const u=t.dot(n);o=Math.min(u,o),a=Math.max(u,a)}this.min=o,this.max=a}}();const Hce=function(){const n=new Z,e=new Z,t=new Z;return function(i,s,o){const a=i.start,l=n,A=s.start,c=e;t.subVectors(a,A),n.subVectors(i.end,i.start),e.subVectors(s.end,s.start);const u=t.dot(c),f=c.dot(l),h=c.dot(c),p=t.dot(l),g=l.dot(l)*h-f*f;let m,y;g!==0?m=(u*f-p*h)/g:m=0,y=(u+m*f)/h,o.x=m,o.y=y}}(),vT=function(){const n=new $e,e=new Z,t=new Z;return function(i,s,o,a){Hce(i,s,n);let l=n.x,A=n.y;if(l>=0&&l<=1&&A>=0&&A<=1){i.at(l,o),s.at(A,a);return}else if(l>=0&&l<=1){A<0?s.at(0,a):s.at(1,a),i.closestPointToPoint(a,!0,o);return}else if(A>=0&&A<=1){l<0?i.at(0,o):i.at(1,o),s.closestPointToPoint(o,!0,a);return}else{let c;l<0?c=i.start:c=i.end;let u;A<0?u=s.start:u=s.end;const f=e,h=t;if(i.closestPointToPoint(u,!0,e),s.closestPointToPoint(c,!0,t),f.distanceToSquared(u)<=h.distanceToSquared(c)){o.copy(f),a.copy(u);return}else{o.copy(c),a.copy(h);return}}}}(),zce=function(){const n=new Z,e=new Z,t=new qa,r=new ul;return function(s,o){const{radius:a,center:l}=s,{a:A,b:c,c:u}=o;if(r.start=A,r.end=c,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a||(r.start=A,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a)||(r.start=c,r.end=u,r.closestPointToPoint(l,!0,n).distanceTo(l)<=a))return!0;const d=o.getPlane(t);if(Math.abs(d.distanceToPoint(l))<=a){const m=d.projectPoint(l,e);if(o.containsPoint(m))return!0}return!1}}(),Gce=1e-15;function Yu(n){return Math.abs(n)new Z),this.satBounds=new Array(4).fill().map(()=>new _l),this.points=[this.a,this.b,this.c],this.sphere=new ou,this.plane=new qa,this.needsUpdate=!0}intersectsSphere(e){return zce(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 A=s[1],c=o[1];A.subVectors(e,t),c.setFromPoints(A,i);const u=s[2],f=o[2];u.subVectors(t,r),f.setFromPoints(u,i);const h=s[3],p=o[3];h.subVectors(r,e),p.setFromPoints(h,i),this.sphere.setFromPoints(this.points),this.plane.setFromNormalAndCoplanarPoint(a,e),this.needsUpdate=!1}}bl.prototype.closestPointToSegment=function(){const n=new Z,e=new Z,t=new ul;return function(i,s=null,o=null){const{start:a,end:l}=i,A=this.points;let c,u=1/0;for(let f=0;f<3;f++){const h=(f+1)%3;t.start.copy(A[f]),t.end.copy(A[h]),vT(t,i,n,e),c=n.distanceToSquared(e),c1-1e-10){const y=this.satBounds,w=this.satAxes;t[0]=h.a,t[1]=h.b,t[2]=h.c;for(let C=0;C<4;C++){const S=y[C],b=w[C];if(r.setFromPoints(b,t),S.isSeparated(r))return!1}const x=h.satBounds,_=h.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let C=0;C<4;C++){const S=x[C],b=_[C];if(r.setFromPoints(b,e),S.isSeparated(r))return!1}for(let C=0;C<4;C++){const S=w[C];for(let b=0;b<4;b++){const M=_[b];if(s.crossVectors(S,M),r.setFromPoints(s,e),i.setFromPoints(s,t),r.isSeparated(i))return!1}}return p&&(d||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 y=this.points;let w=!1,x=0;for(let v=0;v<3;v++){const E=y[v],U=y[(v+1)%3];A.start.copy(E),A.end.copy(U),A.delta(o);const P=w?c.start:c.end,L=Yu(m.distanceToPoint(E));if(Yu(m.normal.dot(o))&&L){c.copy(A),x=2;break}if((m.intersectLine(A,P)||L)&&!Yu(P.distanceTo(U))){if(x++,w)break;w=!0}}if(x===1&&h.containsPoint(c.end))return p&&(p.start.copy(c.end),p.end.copy(c.end)),!0;if(x!==2)return!1;const _=h.points;let C=!1,S=0;for(let v=0;v<3;v++){const E=_[v],U=_[(v+1)%3];A.start.copy(E),A.end.copy(U),A.delta(a);const P=C?u.start:u.end,L=Yu(g.distanceToPoint(E));if(Yu(g.normal.dot(a))&&L){u.copy(A),S=2;break}if((g.intersectLine(A,P)||L)&&!Yu(P.distanceTo(U))){if(S++,C)break;C=!0}}if(S===1&&this.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(S!==2)return!1;if(c.delta(o),u.delta(a),o.dot(a)<0){let v=u.start;u.start=u.end,u.end=v}const b=c.start.dot(o),M=c.end.dot(o),D=u.start.dot(o),$=u.end.dot(o),H=M0?p.start.copy(c.start):p.start.copy(u.start),l.subVectors(c.end,u.end),l.dot(o)<0?p.end.copy(c.end):p.end.copy(u.end)),!0)}}}();bl.prototype.distanceToPoint=function(){const n=new Z;return function(t){return this.closestPointToPoint(t,n),t.distanceTo(n)}}();bl.prototype.distanceToTriangle=function(){const n=new Z,e=new Z,t=["a","b","c"],r=new ul,i=new ul;return function(o,a=null,l=null){const A=a||l?r:null;if(this.intersectsTriangle(o,A))return(a||l)&&(a&&A.getCenter(a),l&&A.getCenter(l)),0;let c=1/0;for(let u=0;u<3;u++){let f;const h=t[u],p=o[h];this.closestPointToPoint(p,n),f=p.distanceToSquared(n),fnew Z),this.satAxes=new Array(3).fill().map(()=>new Z),this.satBounds=new Array(3).fill().map(()=>new _l),this.alignedSatBounds=new Array(3).fill().map(()=>new _l),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}}ya.prototype.update=function(){return function(){const e=this.matrix,t=this.min,r=this.max,i=this.points;for(let A=0;A<=1;A++)for(let c=0;c<=1;c++)for(let u=0;u<=1;u++){const f=1*A|2*c|4*u,h=i[f];h.x=A?r.x:t.x,h.y=c?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 A=0;A<3;A++){const c=o[A],u=s[A],f=1<new ul),t=new Array(12).fill().map(()=>new ul),r=new Z,i=new Z;return function(o,a=0,l=null,A=null){if(this.needsUpdate&&this.update(),this.intersectsBox(o))return(l||A)&&(o.getCenter(i),this.closestPointToPoint(i,r),o.closestPointToPoint(r,i),l&&l.copy(r),A&&A.copy(i)),0;const c=a*a,u=o.min,f=o.max,h=this.points;let p=1/0;for(let g=0;g<8;g++){const m=h[g];i.copy(m).clamp(u,f);const y=m.distanceToSquared(i);if(yt.far)?null:n}function $o(n,e,t,r){const i=n.a,s=n.b,o=n.c;let a=e,l=e+1,A=e+2;t&&(a=t.getX(e),l=t.getX(e+1),A=t.getX(e+2)),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(A),o.y=r.getY(A),o.z=r.getZ(A)}function P3(n,e,t,r,i,s,o){const a=t.index,l=t.attributes.position;for(let A=n,c=e+n;A=0;let h,p;f?(h=Zm(n),p=Jm(n,a)):(h=Jm(n,a),p=Zm(n));const g=Ow(h,s,r,Dw)?kC(h,e,t,r):null;if(g){const w=g.point[c];if(f?w<=s[p+A]:w>=s[p+A+3])return g}const y=Ow(p,s,r,Dw)?kC(p,e,t,r):null;return g&&y?g.distance<=y.distance?g:y:g||y||null}}const Xce=function(){let n,e;const t=[],r=new h5(()=>new ps);return function(...o){n=r.getPrimitive(),e=r.getPrimitive(),t.push(n,e);const a=i(...o);r.releasePrimitive(n),r.releasePrimitive(e),t.pop(),t.pop();const l=t.length;return l>0&&(e=t[l-1],n=t[l-2]),a};function i(s,o,a,l,A=null,c=0,u=0){function f(w){let x=w*2,_=TA,C=IA;for(;!rA(x,_);)w=Zm(w),x=w*2;return dh(w,C)}function h(w){let x=w*2,_=TA,C=IA;for(;!rA(x,_);)w=Jm(w,C),x=w*2;return dh(w,C)+Xm(x,_)}let p=s*2,d=od,g=TA,m=IA;if(rA(p,g)){const w=dh(s,m),x=Xm(p,g);return qo(s,d,n),l(w,x,!1,u,c+s,n)}else{const w=Zm(s),x=Jm(s,m);let _=w,C=x,S,b,M,D;if(A&&(M=n,D=e,qo(_,d,M),qo(C,d,D),S=A(M),b=A(D),bi.intersectsBox(b),intersectsTriangle:b=>{b.a.applyMatrix4(A),b.b.applyMatrix4(A),b.c.applyMatrix4(A),b.needsUpdate=!0;for(let M=_*3,D=(C+_)*3;Mnew bl);class am{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),am.serialize(arguments[0],{cloneBuffers:arguments[2]===void 0?!0:arguments[2]});t={cloneBuffers:!0,...t};const r=e.geometry,i=e._roots,s=r.getIndex();let o;return t.cloneBuffers?o={roots:i.map(a=>a.slice()),index:s.array.slice()}:o={roots:i,index:s.array},o}static deserialize(e,t,r={}){if(typeof r=="boolean")return console.warn("MeshBVH.deserialize: The arguments for the function have changed. See documentation for new signature."),am.deserialize(arguments[0],arguments[1],{setIndex:arguments[2]===void 0?!0:arguments[2]});r={setIndex:!0,...r};const{index:i,roots:s}=e,o=new am(t,{...r,[eB]:!0});if(o._roots=s,r.setIndex){const a=t.getIndex();if(a===null){const l=new At(e.index,1,!1);t.setIndex(l)}else a.array!==i&&(a.array.set(i),a.needsUpdate=!0)}return o}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({strategy:c5,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[eB]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[eB]||(this._roots=Qce(e,t),!e.boundingBox&&t.setBoundingBox&&(e.boundingBox=this.getBoundingBox(new ps))),this.geometry=e}refit(e=null){e&&Array.isArray(e)&&(e=new Set(e));const t=this.geometry,r=t.index.array,i=t.attributes.position;let s,o,a,l,A=0;const c=this._roots;for(let f=0,h=c.length;fC&&(C=H),IS&&(S=I),v<_&&(_=v),v>b&&(b=v)}return l[f+0]!==w||l[f+1]!==x||l[f+2]!==_||l[f+3]!==C||l[f+4]!==S||l[f+5]!==b?(l[f+0]=w,l[f+1]=x,l[f+2]=_,l[f+3]=C,l[f+4]=S,l[f+5]=b,!0):!1}else{const m=f+8,y=o[f+6],w=m+h,x=y+h;let _=p,C=!1,S=!1;e?_||(C=e.has(w),S=e.has(x),_=!C&&!S):(C=!0,S=!0);const b=_||C,M=_||S;let D=!1;b&&(D=u(m,h,_));let $=!1;M&&($=u(y,h,_));const H=D||$;if(H)for(let I=0;I<3;I++){const v=m+I,E=y+I,U=l[v],P=l[v+3],L=l[E],z=l[E+3];l[f+I]=Uz?P:z}return H}}}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 A=a*2,c=s[A+15]===OC;if(c){const u=i[a+6],f=s[A+14];e(l,c,new Float32Array(r,a*4,6),u,f)}else{const u=a+py/4,f=i[a+6],h=i[a+7];e(l,c,new Float32Array(r,a*4,6),h)||(o(u,l+1),o(f,l+1))}}}raycast(e,t=ls){const r=this._roots,i=this.geometry,s=[],o=t.isMaterial,a=Array.isArray(t),l=i.groups,A=o?t.side:t;for(let c=0,u=r.length;c{const m=p*3;return f(h,m,m+1,m+2,d,g)}}e={boundsTraverseOrder:r,intersectsBounds:e,intersectsTriangle:t,intersectsRange:null},console.warn("MeshBVH: Shapecast function signature has changed and now takes an object of callbacks as a second argument. See docs for new signature.")}const s=Oo.getPrimitive();let{boundsTraverseOrder:o,intersectsBounds:a,intersectsRange:l,intersectsTriangle:A}=e;if(l&&A){const f=l;l=(h,p,d,g,m)=>f(h,p,d,g,m)?!0:P3(h,p,i,A,d,g,s)}else l||(A?l=(f,h,p,d)=>P3(f,h,i,A,p,d,s):l=(f,h,p)=>p);let c=!1,u=0;for(const f of this._roots){if(Lp(f),c=Xce(0,i,a,l,o,u),pv(),c)break;u+=f.byteLength}return Oo.releasePrimitive(s),c}bvhcast(e,t,r){let{intersectsRanges:i,intersectsTriangles:s}=r;const o=this.geometry.index,a=this.geometry.attributes.position,l=e.geometry.index,A=e.geometry.attributes.position;Xu.copy(t).invert();const c=Oo.getPrimitive(),u=Oo.getPrimitive();if(s){let h=function(p,d,g,m,y,w,x,_){for(let C=g,S=g+m;CnB.intersectsBox(h),intersectsRange:(h,p,d,g,m,y)=>(tB.copy(y),tB.applyMatrix4(Xu),e.shapecast({intersectsBounds:w=>tB.intersectsBox(w),intersectsRange:(w,x,_,C,S)=>i(h,p,w,x,g,m,C,S)}))});return Oo.releasePrimitive(c),Oo.releasePrimitive(u),f}intersectsBox(e,t){return uc.set(e.min,e.max,t),uc.needsUpdate=!0,this.shapecast({intersectsBounds:r=>uc.intersectsBox(r),intersectsTriangle:r=>uc.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){e.boundingBox||e.computeBoundingBox(),uc.set(e.boundingBox.min,e.boundingBox.max,t),uc.needsUpdate=!0;const a=this.geometry,l=a.attributes.position,A=a.index,c=e.attributes.position,u=e.index,f=Oo.getPrimitive(),h=Oo.getPrimitive();let p=mv,d=Jce,g=null,m=null;i&&(g=qce,m=eue);let y=1/0,w=null,x=null;return Xu.copy(t).invert(),tp.matrix.copy(Xu),this.shapecast({boundsTraverseOrder:_=>uc.distanceToBox(_),intersectsBounds:(_,C,S)=>S{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:S=>tp.distanceToBox(S),intersectsBounds:(S,b,M)=>M{for(let M=S*3,D=(S+b)*3;M(np.copy(e).clamp(c.min,c.max),np.distanceToSquared(e)),intersectsBounds:(c,u,f)=>f{c.closestPointToPoint(e,np);const f=e.distanceToSquared(np);return f{qo(0,new Float32Array(r),D3),e.union(D3)}),e}}const rB=new gg,O3=new je,tue=xn.prototype.raycast;function nue(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;O3.copy(this.matrixWorld).invert(),rB.copy(n.ray).applyMatrix4(O3);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const r=L3(t.raycastFirst(rB,this.material),this,n);r&&e.push(r)}else{const r=t.raycast(rB,this.material);for(let i=0,s=r.length;i{const e=n.attributes.position,t=n.index,r=new Xi,i=new Z,s=new Z,o=new Z,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&&gy(n.userData.cancelMesh))},d5=n=>{var e,t;n.userData.cullingClone&&(gy(n.userData.cullingClone),n.userData.cullingClone=null,gy(n.userData.cullingCloneP),n.userData.cullingCloneP=null,gy(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))},uue=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=[];Pp=n[0].parent,Pp.lines!=null&&(Pp.lines.forEach(i=>{i.visible=!1}),Pp.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=cue(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=aue,a.userData.cancelMesh=o,a.material=lue,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)})},fue=n=>{let e=sue,t=oue;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},hue=(n,e,t,r,i,s,o=!1)=>{const a=[],l=fue(s);let A=l[0],c=l[1];gv.far=A+c;for(let f=0;f=0;y--)A-m[y].distance>=m[y].object.userData.maxCullDistance&&m.splice(y,1);if(m.length===0){for(let y=0;y<3;y++)a.push(n[h+y]);break}else{const y=m.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(d===0)p=m.map(w=>w.object);else if(p=m.map(w=>{if(p.indexOf(w.object)!==-1)return w.object}),p=p.filter(w=>w),d===2&&p.filter(w=>w).length===0)for(let w=0;w<3;w++)a.push(n[h+w]);o&&due(iB,rp.clone().multiplyScalar(-1),gv.far,16711680,Pp)}}}const u=new Uint32Array(a);return new At(u,1,!1)};function due(n,e,t,r,i){i.lines==null&&(i.lines=[]);let s=new Z;s.addVectors(n,e.clone().multiplyScalar(t));const o=[];o.push(n),o.push(s);const a=new $t().setFromPoints(o),l=[];l.push(new Qe(0)),l.push(new Qe(16777215));let A=new Sl({color:r});var c=new nd(a,A);c.renderOrder=100,i.add(c),i.lines.push(c)}let sB,Qa,vv,yv,wv,zi,Zu;function pue(){zi!=null&&zi.clear(!0,!0)}function mue(n,e,t){const r=e*t,i=new Uint8Array(4*r),s=Math.floor(n.r*255),o=Math.floor(n.g*255),a=Math.floor(n.b*255);for(let A=0;Atypeof window>"u"?await wue({meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s}):await xue({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o}),wue=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(S=>{const b=S.material;let M=a.find(D=>D.material===b);if(!M)a.push({material:b,mesh:S});else{const{dest:D}=yT({meshes:[M.mesh,S]});M.mesh.geometry=D}});const l=Object.fromEntries(o.map(S=>[S,p5({width:s,height:s,transparent:i})])),A=Math.floor(Math.sqrt(n.length)+1),c=s/A,u=new Map(a.map((S,b)=>{const M=new $e(b%A,Math.floor(b/A)).multiplyScalar(1/A),D=new $e(M.x+1/A,M.y+1/A);return[S.mesh,{min:M,max:D}]})),f={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},h=[],p=[];a.forEach(S=>{const{min:b,max:M}=u.get(S.mesh);p.push(M),h.push(b)});const d=new $e(Math.max(...p.map(S=>S.x)),Math.max(...p.map(S=>S.y))),g=new $e(Math.min(...h.map(S=>S.x)),Math.min(...h.map(S=>S.y))),m=1/(d.x-g.x),y=1/(d.y-g.y),w=c*m,x=c*y,_=new Map(a.map(S=>{let{min:b,max:M}=u.get(S.mesh);return b.x=b.x*m,b.y=b.y*y,M.x=M.x*m,M.y=M.y*y,[S.mesh,{min:b,max:M}]}));a.forEach(S=>{const{material:b,mesh:M}=S,{min:D,max:$}=_.get(M);o.forEach(E=>{const U=l[E];U.globalCompositeOperation="source-over";let P=HC(b,f[E].find(L=>HC(b,L)));if(P!==""&&P!==void 0)try{const L=new Uint8ClampedArray(P.data),z=new ImageData(L,w,x),K=document.createElement("canvas");K.width=w,K.height=x;const O=K.getContext("2d");O.putImageData(z,0,0),O.save(),U.drawImage(K,D.x*s,D.y*s,w,x)}catch(L){console.error("error",L)}else U.fillStyle=E==="diffuse"?`#${b.color.clone().getHexString()}`:E==="normal"?"#8080ff":E==="orm"?`#${new Qe(b.aoMapIntensity,b.roughness,b.metalness).getHexString()}`:"#7F7F7F",U.fillRect(D.x*s,D.y*s,w,x)});const H=M.geometry,I=H.attributes.uv;if(I)for(let E=0;E{const b=new Qn(l[S].canvas);return b.flipY=!1,[S,b]})));return{bakeObjects:a,textures:C,uvs:_}},xue=async({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o})=>{pue();const a=t,l=r?["diffuse"]:["diffuse","orm","normal"],A=[];let c=null;e.forEach(v=>{v=v.clone();const E=v.material.length==null?v.material:v.material[0];r&&c==null&&E.type=="ShaderMaterial"&&(c=E.clone());let U=A.find(P=>{P.material});if(!U)A.push({material:E,mesh:v});else{const{dest:P}=yT({meshes:[U.mesh,v]});U.mesh.geometry=P}});const u=Object.fromEntries(l.map(v=>[v,p5({width:a,height:a,transparent:s&&v=="diffuse"})])),f=Math.floor(Math.sqrt(e.length)+1),h=a/f,p=new Map(A.map((v,E)=>{const U=new $e(E%f,Math.floor(E/f)).multiplyScalar(1/f),P=new $e(U.x+1/f,U.y+1/f);return[v.mesh,{min:U,max:P}]})),d={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},g=[],m=[];A.forEach(v=>{const{min:E,max:U}=p.get(v.mesh);m.push(U),g.push(E)});const y=new $e(Math.max(...m.map(v=>v.x)),Math.max(...m.map(v=>v.y))),w=new $e(Math.min(...g.map(v=>v.x)),Math.min(...g.map(v=>v.y))),x=1/(y.x-w.x),_=1/(y.y-w.y),C=h*x,S=h*_,b=new Map(A.map(v=>{let{min:E,max:U}=p.get(v.mesh);return E.x=E.x*x,E.y=E.y*_,U.x=U.x*x,U.y=U.y*_,[v.mesh,{min:E,max:U}]}));let M=!1;A.forEach(v=>{const{material:E,mesh:U}=v,{min:P,max:L}=b.get(U);l.forEach(B=>{var le;const W=u[B];W.globalCompositeOperation="source-over";let ee,F=new Qe(1,1,1);switch(B){case"diffuse":ee=E.color||n,(le=E.uniforms)!=null&&le.litFactor?F=E.uniforms.litFactor.value:F=E.color;break;case"normal":ee=new Qe(8421631);break;case"orm":ee=new Qe(0,E.roughness,E.metalness);break;default:ee=new Qe(1,1,1);break}let X=vue(E,d[B].find(oe=>HC(E,oe)));M==!1&&B=="normal"&&X!=null&&(M=!0);const ue=gue(X,F,ee,a,a,B=="diffuse"&&s,B!="normal");createImageBitmap(ue).then(oe=>W.drawImage(oe,P.x*a,P.y*a,C,S))});const z=U.geometry.clone();U.geometry=z;const K=z.attributes.uv.clone();if(z.attributes.uv=K,K)for(let B=0;B{const E=new Qn(u[v].canvas);return E.flipY=!1,[v,E]}))),$=o?ui:ls;let H;const I=i?"transparent":"opaque";return r?(H=new Qh({map:D.diffuse,transparent:i,side:$}),c==null&&(c=new dy),c.side=$,c.uniforms.map=D.diffuse,c.uniforms.shadeMultiplyTexture=D.diffuse,c.transparent=i,s&&!i&&(H.alphaTest=.5,c.alphaTest=.5),H.userData.vrmMaterial=c,H.userData.shadeTexture=D.uniformColor,H.name="mToon_"+I,H.map.name=H.name):(H=new Qh({map:D.diffuse,roughnessMap:D.orm,metalnessMap:D.orm,normalMap:M?D.normal:null,transparent:i,side:$}),s&&!i&&(H.alphaTest=.5),H.name="standard_"+I,H.roughnessMap!=null&&(H.roughnessMap.name=H.name+"_orm"),H.normalMap!=null&&(H.normalMap.name=H.name+"_normal")),{bakeObjects:A,material:H}};function m5(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 ZA(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function g5(n,e){const t=new Map;new Z(-1,1,-1),new je,new Z;let r=0;n.forEach(l=>{if(l.skeleton){var A=m5(l);const c=A.bones;A.bones.forEach((u,f)=>{var h;if(c.indexOf(u)!==-1){const p=t.get(u.name);if(p==null){const d={index:r,boneInverses:A.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,d)}else u.userData.VRMcolliders!=null&&(p.bone.userData.VRMcolliders==null?p.bone.userData.VRMcolliders=u.userData.VRMcolliders:u.userData.VRMcollidersID!=p.bone.userData.VRMcollidersID&&(p.bone.userData.VRMcolliders=[...p.bone.userData.VRMcolliders,...u.userData.VRMcolliders]))}})}});const i=[],s=[];[...t.values()].forEach(l=>{var A;if(i.push(l.bone),s.push(l.boneInverses),l.parentName!=null){const c=(A=t.get(l.parentName))==null?void 0:A.bone;c&&c.add(l.bone)}});const a=new ZA(i,s);return a.bones.forEach(l=>{var c;const A=(c=l.userData)==null?void 0:c.vrm0RestPosition;A&&l.position.set(-A.x,A.y,-A.z),l.position.set(l.position.x*e,l.position.y*e,l.position.z*e)}),a}function _ue(n,e){if(!e.skeleton)return;const t=new Map;if(e.skeleton){e.skeleton.bones.forEach((o,a)=>{const l=n.bones.filter(c=>c.name===o.name),A=l.length>0?n.bones.indexOf(l[0]):-1;t.set(a,A)});const r=[],i=e.geometry.attributes.skinIndex.array;for(let o=0;oe.indexOf(t)===r)}function bue(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 Nw(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function Cue(n,e){const{scale:t,isVrm0:r}=e,i=[],s=[];Gh(n,"SkinnedMesh").forEach(A=>{const c=A.clone();i.push(c),Array.isArray(A.material)?s.push(...A.material):s.push(A.material)});const a=g5(i,t),l=new It;return l.name="AvatarRoot",i.forEach(A=>{var C;const c=new $t,u={};for(const S in A.geometry.attributes){const b=A.geometry.attributes[S];u[S]=b.clone()}if((C=A.userData)!=null&&C.isVRM0)for(let S=0;S[S,S.geometry.morphAttributes])),p=new Map([A].map(S=>[S,S.morphTargetDictionary||{}]));if(f.morphAttributes=y5({meshes:[A],sourceMorphAttributes:h,sourceMorphTargetDictionaries:p,destMorphTargetDictionary:f.morphTargetDictionary,scale:t},r),r)for(let S=0;Sh.name===e.userData.boneName),s=e.userData.globalPosition,o=e.userData.globalScale||new Z(1,1,1),a=e.userData.globalRotationMatrix;t.add(r.bones[0]);const l=[],A=[],c=t.geometry.attributes.position.array,u=new Z,f=e.userData.isVRM0?-1:1;for(let h=0;h0){const{bakeObjects:D,material:$}=await yue({transparentColor:t,atlasSize:b.size,meshes:M,mtoon:b.isMtoon,transparentMaterial:b.transparentMaterial,transparentTexture:w,twoSidedMaterial:u}),H=D.map(L=>L.mesh),I=[];H.forEach(L=>{L.type=="Mesh"&&(L=Mue(_,L)),I.push(L);const z=L.geometry,K=z.index.array,O=v5(L.geometry.index.array),B=[];for(let F=0;F{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function Rue({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]=kH(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function Fue({sourceMorphTargetDictionaries:n}){const e=new Set;Array.from(n.values()).forEach(i=>{Object.keys(i).forEach(s=>e.add(s))});const r={};return Array.from(e.keys()).map((i,s)=>{r[i]=s}),r}function y5({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),A={};l.forEach(u=>{A[u]=[],Object.entries(r).forEach(([f,h])=>{A[u][h]=[],n.forEach(p=>{let d;const g=e.get(p);if(g.hasOwnProperty(f)&&p.geometry.morphAttributes[u]){const m=g[f];d=p.geometry.morphAttributes[u][m]}else{const m=p.geometry.attributes[u],y=new m.array.constructor(new Array(m.array.length).fill(0));d=new At(y,m.itemSize,m.normalized)}A[u][h].push(d)})})});const c={};return l.forEach(u=>{c[u]=[];for(let f=0;f{const i=r.geometry.index;for(var s=0;s{var l;if(r+=a.geometry.attributes.uv.count,(l=a.userData)!=null&&l.isVRM0)for(let A=0;A[a,a.geometry.attributes])),morphAttributes:new Map(n.map(a=>[a,a.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(a=>[a,a.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(a=>[a,a.morphTargetInfluences||[]]))},s={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};s.attributes=Rue({sourceAttributes:i.attributes});const o=Fue({sourceMorphTargetDictionaries:i.morphTargetDictionaries});return s.morphTargetDictionary=o,s.morphAttributes=y5({meshes:n,sourceMorphAttributes:i.morphAttributes,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o,scale:e},t),s.morphTargetInfluences=Iue({meshes:n,sourceMorphTargetDictionaries:i.morphTargetDictionaries,destMorphTargetDictionary:o}),s.index=Uue({meshes:n}),s.animations={},{source:i,dest:s}}function ct(n){return n==null?[]:Array.isArray(n)?n:[n]}function Lue(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function Pue(n,e){const r=await new Au().load(e);r.encoding=pt,r.flipY=!1,n.traverse(i=>{if(i instanceof xn){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)})}}uue(e)};function Due(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var A;const l=ct(o.material)[0];l.type=="ShaderMaterial"?l.transparent==!0?(i.push(o),s=!0):(r.push(o),((A=l.uniforms.alphaTest)==null?void 0:A.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 Oue(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{ct(a.material).forEach(A=>{A.type=="ShaderMaterial"?A.transparent==!0?o.push(A):A.uniforms.alphaTest.value!=0?s.push(A):i.push(A):A.transparent==!0?r.push(A):A.alphaTest!=0?t.push(A):e.push(A)})}),{stdMats:e,stdCutoutpMats:t,stdTranspMats:r,mToonMats:i,mToonCutoutMats:s,mToonTranspMats:o}}function k3(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function Nue(n,e){if(n.data!=null)return n.data[e]}function kue(n){const e=Nue(n,"cullingMeshes");e&&(e.forEach(t=>{d5(t)}),n.data.cullingMeshes=null)}function vn(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 Que(n){const e=n.scene;kue(n),e.traverse(t=>{t.material&&zC(t.material),t.geometry&&(d5(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),Eg.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&&zC(i.material)})})});for(const t in n)n[t]=null}const zC=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 Z(e,t,r)},w5=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},Hue=n=>{var t,r,i,s,o,a,l,A,c,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!=((A=e.spine)==null?void 0:A.node)&&e.rightUpperArm.node.parent!=((c=e.neck)==null?void 0:c.node)&&e.rightUpperArm.node.parent!=((u=e.head)==null?void 0:u.node),e.rightShoulder={node:e.rightUpperArm.node.parent});for(let h in $m)h=h.charAt(0).toLowerCase()+h.slice(1),(f=e[h])!=null&&f.node&&(e[h].node.name=h)};function x5({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),x5({candidates:n,predicate:e}))}function _5(n,e){return x5({candidates:[n],predicate:t=>t.name===e})}function b5({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),b5({candidates:n,predicate:e,results:t})}function Gh(n,e){return b5({candidates:[n],predicate:t=>ct(e).includes(t.type)})}const zue={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 B5(n,e,t){var d;const r=Xc.findByName(n,"mixamo.com");if(r==null)return null;const i=[],s=new rt,o=new rt,a=new rt,l=new Z,A=e.getObjectByName("mixamorigHips").position.y,c=(d=t.humanoid)==null?void 0:d.getNormalizedBoneNode("hips").getWorldPosition(l).y,u=t.scene.getWorldPosition(l).y,h=Math.abs(c-u)/A;return r.tracks.forEach(g=>{const m=g.clone(),y=m.name.split("."),w=y[0],_=zue[w],C=e.getObjectByName(w);if(_!=null){const S=y[1];if(C.getWorldQuaternion(s).invert(),C.parent.getWorldQuaternion(o),m instanceof va){for(let b=0;b{m.values[$+b]=D})}i.push(new va(`${_}.${S}`,m.times,m.values.map((b,M)=>{var D;return((D=t.meta)==null?void 0:D.metaVersion)==="0"&&M%2===0?-b:b})))}else if(m instanceof kA){const b=m.values.map((M,D)=>{var $;return((($=t.meta)==null?void 0:$.metaVersion)==="0"&&D%3!==1?-M:M)*h});i.push(new kA(`${_}.${S}`,m.times,b))}}}),new Xc("vrmAnimation",r.duration,i)}const Gue=new sre,Vue=new QH,aB=.2,jue=n=>Math.floor(Math.random()*n);class Q3{constructor(e,t,r,i,s,o,a){var l,A,c,u;this.mixer=new ine(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=(A=(l=r==null?void 0:r.humanoid)==null?void 0:l.humanBones)==null?void 0:A.neck,this.spineBone=(u=(c=r==null?void 0:r.humanoid)==null?void 0:c.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=B5(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 Wue{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!=""?"/":"")+ct(e)[0];o=o==""?fl(a):o,this.currentAnimationName=o;const A=await(i?Gue:Vue).loadAsync(a);A.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(A.animations);const c=Xc.findByName(A.animations,"mixamo.com");c!=null?(this.mixamoModel=A.clone(),this.mixamoAnimations=A.animations,this.currentClip=c):(this.mixamoModel=null,this.animations=A.animations,this.currentClip=A.animations[0]),this.mainControl==null&&(this.curAnimID=0,this.lastAnimID=-1,this.mainControl=new Q3(this,A,null,A.animations,this.curAnimID,this.lastAnimID,t),this.animationControls.push(this.mainControl)),this.animationControls.forEach(u=>{u.setAnimations(A.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=ct(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=ct(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=jue(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-aB)},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*aB):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*aB):this.weightOut=0)}}const Kue={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; @@ -4122,7 +4122,7 @@ void main() { gl_FragColor.a *= opacity; - }`};class od{constructor(){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 $ue=new qh(-1,1,1,-1,0,1),xT=new $t;xT.setAttribute("position",new an([-1,3,0,-1,-1,0,3,-1,0],3));xT.setAttribute("uv",new an([0,2,0,0,2,0],2));class _T{constructor(e){this._mesh=new xn(xT,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,$ue)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Yue extends od{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof Cr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=ZM.clone(e.uniforms),this.material=new Cr({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new _T(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 H3 extends od{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.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 Xue extends od{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class Zue{constructor(e,t){if(this.renderer=e,t===void 0){const r=e.getSize(new $e);this._pixelRatio=e.getPixelRatio(),this._width=r.width,this._height=r.height,t=new ma(this._width*this._pixelRatio,this._height*this._pixelRatio),t.texture.name="EffectComposer.rt1"}else this._pixelRatio=1,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 Yue(Kue),this.clock=new OH}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 wv(n,e,t){const r=new ma(n.x,n.y,t?{depthTexture:new CH(n.x,n.y),depthBuffer:!0}:void 0);return r.texture.format=e,r.texture.minFilter=$n,r.texture.magFilter=$n,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,r}class efe extends od{constructor(e){super(),this.resolution=e,this.fsQuad=new _T(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 Cr({uniforms:{tDiffuse:{value:null},resolution:{value:new Qt(this.resolution.x,this.resolution.y,1/this.resolution.x,1/this.resolution.y)}},vertexShader:` + `})}}function xv(n,e,t){const r=new ga(n.x,n.y,t?{depthTexture:new CH(n.x,n.y),depthBuffer:!0}:void 0);return r.texture.format=e,r.texture.minFilter=$n,r.texture.magFilter=$n,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,r}class efe extends ad{constructor(e){super(),this.resolution=e,this.fsQuad=new _T(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 Sr({uniforms:{tDiffuse:{value:null},resolution:{value:new Qt(this.resolution.x,this.resolution.y,1/this.resolution.x,1/this.resolution.y)}},vertexShader:` varying vec2 vUv; void main() { vUv = uv; @@ -4209,7 +4209,7 @@ void main() { texel.rgb = pow(texel.rgb, vec3(1.0 / 2.2)); gl_FragColor = texel; } - `})}}const Nw=4096,rp=new Z;class tfe{constructor(e,t,r){const i=new vg({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new $e(Nw,Nw);i.setClearColor(0,0),i.outputEncoding=cs,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 Zue(i);a.addPass(new Jue(e,t)),this._renderPixelPass=new que(o,e,t),this._pixelPass=new efe(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new $e(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 nfe{constructor(e,t){this.renderer=new vg({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputEncoding=pt,this.renderer.setSize(Nw,Nw),this.camera=new Fr(30,1,.1,1e3),this.textureLoader=new lu,this.sceneBackground=new Qe(.1,.1,.1),this.sceneBackgroundAlpha=1,this.frameOffset={min:.2,max:.2},this.usesBackgroundImage=!1,this.backgroundMaterial=new Ei({color:16777215,transparent:!0,opacity:.5});const r=new ou(1e3,1e3),i=new xn(r,this.backgroundMaterial);i.renderOrder=-1,this.backgroundPlane=i,this.pixelRenderer=new tfe(t,this.camera,20),this.boneOffsets={head:null,neck:null,chest:null,hips:null,spine:null,leftUpperLeg:null,leftLowerLeg:null,leftFoot:null,rightUpperLeg:null,rightLowerLeg:null,rightFoot:null}}setScene(e){this.scene=e}setupCamera(e,t,r=30){this.camera.position.copy(e),this.camera.lookAt(t),this.camera.fov=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}}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){const o=this._getBoneWorldPositionWithOffset(e,i),a=this._getBoneWorldPositionWithOffset(t,s);o.y-=this.frameOffset.max,a.y+=this.frameOffset.min,r=r||new Z(0,0,0),this.positionCameraBetweenPoints(o,a,r)}setBottomFrameOffset(e){this.frameOffset.min=e}setTopFrameOffset(e){this.frameOffset.max=e}async calculateBoneOffsets(e){for(const t in this.boneOffsets){const r=await this._getMinMaxOffsetByBone(this.characterManager.characterModel,t,e);this.boneOffsets[t]=r}}_getBoneWorldPositionWithOffset(e,t){const r=this._getFirstBoneWithName(e);if(!r||!this.boneOffsets[e])return new Z;const i=new Z;r.getWorldPosition(i);const s=t?this.boneOffsets[e].max:this.boneOffsets[e].min;return i.y+=s.y,i}_getBoneWorldPosition(e){const t=this._getFirstBoneWithName(e);return t!=null?new Z().setFromMatrixPosition(t.matrixWorld):(console.warn(`Bone with name '${e}' not found in one of the skinned meshes.`),new Z(0,0,0))}_getFirstBoneWithName(e){let t=null;return this.characterManager.characterModel.traverse(r=>{if(r instanceof Al){if(!r.geometry){console.error("Invalid skinned mesh found in children.");return}const i=r.skeleton.bones.findIndex(s=>s.name===e);if(i!==-1){t=r.skeleton.bones[i];return}}}),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}}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 Z(1/0,1/0,1/0),a=new Z(-1/0,-1/0,-1/0),l=[];e.traverse(async u=>{u instanceof Al&&(l.push(this._saveBonesPos(u.skeleton)),u.skeleton.pose())});let A=0;await(u=>new Promise(f=>setTimeout(f,u)))(10),e.traverse(u=>{if(u instanceof Al){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"),p=u.geometry.getAttribute("skinWeight"),d=u.geometry.getAttribute("skinIndex");for(let g=0;g=r){const x=u.skeleton.bones[f],_=new Z().setFromMatrixPosition(x.matrixWorld),C=m.clone().sub(_);o.min(C),a.max(C)}}this._restoreSavedPose(l[A],u.skeleton),A++}}),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 ps;s.expandByPoint(e),s.expandByPoint(t),this.camera.fov=i;const o=this.camera.fov*(Math.PI/180),l=s.getSize(new Z).length()/(2*Math.tan(o/2));s.getCenter(rp),this.camera.position.copy(rp),r.y*=.5,this.camera.lookAt(rp.clone().sub(r));const A=new Z;this.camera.getWorldDirection(A),this.camera.position.addScaledVector(A,-l),this.camera.updateProjectionMatrix()}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,rp.set(0,0,-1),this.cameraDir=rp.applyQuaternion(this.camera.quaternion),this.cameraDir.normalize(),this.camera.position.x-=this.cameraDir.x*t,this.camera.position.z-=this.cameraDir.z*t}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 Qe(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=As,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 Z(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 Qn(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=t6.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 rfe=2;class ife{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new OH,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=rfe,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(oi.Blink,1-this._eyeOpen),e.expressionManager.update()})}}function E5(){return(E5=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;f%8&&(f+=8-f%8);let h=[],p=new DataView(new ArrayBuffer(24*n.levels.length)),d=(f||u+s.byteLength)+t.byteLength;for(let y=0;y0?f:0),!0),m.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(sp([new Uint8Array(Tr).buffer,g,p.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...h]))}var VC,jC,ufe={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},WC=new OffscreenCanvas(128,128),j3=WC.getContext("2d",{willReadFrequently:!0}),C5=typeof document>"u";function ffe(n){return createImageBitmap(n).then(function(e){return WC.width=e.width,WC.height=e.height,j3.drawImage(e,0,0),j3.getImageData(0,0,e.width,e.height)})}function hfe(n,e){return e===void 0&&(e={}),pfe().then(function(t){var r=new t.BasisEncoder;return dfe(e,r),r.setTexType(VC.cBASISTexType2D),ofe(n,ArrayBuffer)&&(n=new Blob([n])),ffe(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,jC.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=lfe(s);if(e.kvData){for(var A in e.kvData)l.keyValue[A]=e.kvData[A];a=cfe(l,{keepWriter:!0})}return a})})}function dfe(n,e){n===void 0&&(n={}),(n=sfe({},ufe,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 lB=null;function pfe(){return lB||(lB=new Promise(function(n,e){C5?(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)})),lB}C5&&self.addEventListener("message",function(n){hfe(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class mfe{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 A=new this.libktx.ktxBasisParams;A.uastc=!1,A.noSSE=!0,A.verbose=!1,A.qualityLevel=100,A.compressionLevel=2,s.basisu_options=A}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 gfe{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new mfe(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 Dn;(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"})(Dn||(Dn={}));const KC="blend_",W3="vrmColliderSphere";function vfe(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 yfe(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function wfe(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 xfe(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 _fe{async parse(e,t,r,i,s,o,a){var be;const l=vfe(e.meta),A=yfe(e.humanoid),c=e.materials,u=[],f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(A)if(l){if(!c)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=c.filter((N,j,se)=>se.findIndex(he=>he.name===N.name.replace(" (Outline)",""))===j).map(N=>N),p=h.map(N=>N.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(N=>N.map).map(N=>{if(!N.map)throw new Error(N.name+" map is null");return{name:N.name,imageBitmap:N.map.image}}),m=h.filter(N=>N.userData.shadeTexture).map(N=>{if(!N.userData.shadeTexture)throw new Error(N.userData.shadeTexture+" map is null");return{name:N.name+"_shade",imageBitmap:N.userData.shadeTexture.image}}),y=h.filter(N=>N.roughnessMap).map(N=>N.roughnessMap?{name:N.name+"_orm",imageBitmap:N.roughnessMap.image}:null),w=h.filter(N=>N.roughnessMap).map(N=>N.normalMap?{name:N.name+"_normal",imageBitmap:N.normalMap.image}:null),x=[...g,...m,...y,...w].filter(N=>N!==null),_=Mfe(x,d,s?"image/ktx2":"image/png"),C=Tfe(_),S=Ife(_,s),b=Sfe(h,x),M=t.children.filter(N=>N.children.length>0&&N.children[0].type===li.Bone)[0],D=S5(M).filter(N=>N.name!==W3),$=D.map(N=>N.name),H=D.map(N=>{const j=N.children.filter(se=>se.name!==W3).map(se=>$.indexOf(se.name));return{name:N.name,rotation:[N.quaternion.x,N.quaternion.y,N.quaternion.z,N.quaternion.w],scale:[N.scale.x,N.scale.y,N.scale.z],translation:[N.position.x,N.position.y,N.position.z],children:j.length>0?j:void 0}}),I=[],v=t.children.filter(N=>N.type===li.Group||N.type===li.SkinnedMesh),E=[];v.forEach((N,j)=>{const se=N.type===li.Group?N.children[0]:N,he=se.geometry.attributes,me=new Gl(he.position,Dn.FLOAT,Kt.POSITION,zo.VEC3,se.name,void 0);E.push(me);const G=E.length-1,R=he.normal.array,T=new Float32Array(R.length);for(let ie=0;ieie):[N]).forEach(ie=>{if(!ie.geometry.index)throw new Error(ie.name+" geometry.index is null");E.push(new Gl(ie.geometry.index,Dn.UNSIGNED_INT,Kt.INDEX,zo.SCALAR,se.name,ie.name))}),se.morphTargetDictionary||(se.morphTargetDictionary={},se.morphTargetInfluences=[],se.geometry.morphAttributes={},se.updateMorphTargets()),se.geometry.userData.targetNames=[];const ae=(ie,Te,Me,Le)=>{const ke=[],De=[];for(let fe=0;fe0){const fe=[...ke].sort((Fe,We)=>Fe-We),Ce=[];for(let Fe=0;Fe({mesh:0,index:he.index,weight:he.weight*100}));if(se.length>0){let he=!1;for(const me in oi)if(N===oi[me]&&N!=="surprised"){u.push({name:N,presetName:wfe(N),binds:se,isBinary:j.isBinary}),he=!0;break}he===!1&&u.push({name:N,presetName:"unknown",binds:se,isBinary:j.isBinary})}}v.forEach(N=>{const j=N.type===li.Group?N.children[0]:N,se=new Float32Array(j.skeleton.boneInverses.map(he=>he.elements).flat());E.push(new Gl(new At(se,16),Dn.FLOAT,Kt.BIND_MATRIX,zo.MAT4,j.name,j.name))}),I.push(...E.map(N=>({componentType:N.valueType,count:N.attribute.count,max:N.max,min:N.min,normalized:!1,type:N.accessorsType})));const U=Efe(v,E,p);v.forEach((N,j)=>{H.push({mesh:j,name:N.name,rotation:[N.quaternion.x,N.quaternion.y,N.quaternion.z,N.quaternion.w],scale:[N.scale.x,N.scale.y,N.scale.z],skin:j,translation:[N.position.x,N.position.y,N.position.z]})});const P=Cfe(v,E,$),L={humanBones:[]};A.humanBones.forEach(N=>{$.indexOf(N.node.name)!=-1&&L.humanBones.push({bone:xfe(N.bone),node:$.indexOf(N.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]}},K={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},O=[];h.forEach(N=>{N.type=="ShaderMaterial"?O.push(Object.assign({},z)):O.push(Object.assign({},K))});const B=l;i.forEach(N=>{for(let j=0;jN.isSkinnedMesh))==null?void 0:be.skeleton)||null;for(let N=0;N{const me=he.sphere;se.colliders.push({radius:me.radius*o,offset:{x:me.offset[0]*o,y:me.offset[1]*o,z:me.offset[2]*o}})}),W.push(se)}}console.log("COLLIDER GROUPS",W);const F=N=>{for(let j=0;j{var G;const j=F(N.name);if(j===-1){console.warn("Spring bone "+N.name+" was removed during cleanup process. Skipping.");return}const se=[];N.colliderGroups.forEach(R=>{const T=R.colliders[0];if(T!=null){const V=T.parent,te=W.findIndex(ae=>ae.name===V.name);te!=-1&&(se.includes(te)||se.push(te))}});let he=F((G=N.center)==null?void 0:G.name);he==-1&&console.warn("no center bone for spring bone "+N.name);const me=N.settings;X.push({bones:[j],center:he,colliderGroups:se,dragForce:me.dragForce,gravityDir:{x:me.gravityDir.x,y:me.gravityDir.y,z:me.gravityDir.z},gravityPower:me.gravityPower,hitRadius:me.hitRadius,stiffiness:me.stiffness})});const ue={boneGroups:X,colliderGroups:W};console.log(ue),B.texture=d?_.length-1:void 0;const le=await Promise.all(x.map(async N=>({buffer:s?await K3(N.imageBitmap):$3(N.imageBitmap),type:Kt.IMAGE})));E.forEach((N,j)=>{N.buffer?le.push({buffer:N.buffer,typeString:"",type:N.type}):N.sparse&&(le.push({buffer:N.sparse.indices,typeString:"indices",type:N.type,count:N.sparse.count}),le.push({buffer:N.sparse.values,typeString:"values",type:N.type})),le.length-1}),d&&le.push({buffer:s?await K3(d.imageBitmap):$3(d.imageBitmap),type:Kt.IMAGE});let oe=0,re=0,pe=0,_e=0;const Re=le.map(N=>{const j={buffer:0,byteLength:N.buffer.byteLength,byteOffset:oe,target:N.type===Kt.IMAGE||N.type===Kt.BIND_MATRIX||N.typeString==="indices"||N.typeString==="values"?void 0:N.type===Kt.INDEX?Dn.ELEMENT_ARRAY_BUFFER:Dn.ARRAY_BUFFER};return oe+=N.buffer.byteLength,N.type===Kt.IMAGE?(_[re++].bufferView=_e,_e++):E[pe].sparse?(I[pe].sparse==null&&(I[pe].sparse={}),N.typeString==="indices"&&(I[pe].sparse.count=N.count,I[pe].sparse[N.typeString]={bufferView:_e,byteOffset:0,componentType:Dn.UNSIGNED_INT}),N.typeString==="values"&&(I[pe].sparse[N.typeString]={bufferView:_e,byteOffset:0}),N.typeString==="values"&&pe++,_e++):(E[pe].bufferIndex=_e,I[pe].bufferView=_e,pe++,_e++),j}),Q=Rfe(t,H);bfe(B);const de=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&de.push("KHR_texture_basisu");const Ae={accessors:I,asset:f,buffers:[{byteLength:oe}],bufferViews:Re,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new Z,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:O,humanoid:L,meta:B,secondaryAnimation:ue,specVersion:"0.0"}},extensionsUsed:de,images:_,materials:b,meshes:U,nodes:H,samplers:C,scenes:Q,skins:P,textures:S};console.log("output",Ae);const q=new Y3(YC(JSON.stringify(Ae,void 0,2)),"JSON"),J=new Y3(Pp(le.map(N=>N.buffer)),"BIN\0"),ce=Pp([q.buffer,J.buffer]),xe=Pp([YC("glTF"),$C(2,4),$C(ce.byteLength+12,4)]);a(Pp([xe,ce]))}}function bfe(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 S5(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>S5(e)).flat())}const Bfe=new gfe;async function K3(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 Bfe.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 $3(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?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Dn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Dn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}class Y3{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Pp([$C(r.byteLength,4),YC(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 X3=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===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(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Kt.SKIN_INDEX),NORMAL:a.indexOf(Kt.NORMAL),POSITION:a.indexOf(Kt.POSITION),TEXCOORD_0:a.indexOf(Kt.UV),WEIGHTS_0:a.indexOf(Kt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Kt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>{const c=e.map(h=>h.type===Kt.BLEND_NORMAL&&h.meshName===i.name?h.name:null).indexOf(KC+A),u=e.map(h=>h.type===Kt.BLEND_POSITION&&h.meshName===i.name?h.name:null).indexOf(KC+A),f={};return u!==-1&&(f.POSITION=u),c!==-1&&(f.NORMAL=c),f}):void 0}})}}),Cfe=(n,e,t)=>n.map(r=>{const i=r.type===li.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Kt.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)}}),Sfe=(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(p=>p.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,A={baseColorFactor:r,baseColorTexture:l},c=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(c)A.metallicRoughnessTexture=c;else{const h=(()=>{switch(t.type){case Kf.MeshStandardMaterial:return t.metalness;case Kf.MeshBasicMaterial:return 0;default:return 0}})(),p=(()=>{switch(t.type){case Kf.MeshStandardMaterial:return t.roughness;case Kf.MeshBasicMaterial:return .9;default:return .9}})();A.metallicFactor=h,A.roughnessFactor=p}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:A};return u&&(f.normalTexture=u),f}),Mfe=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),Tfe=n=>n.map(()=>({magFilter:Dn.LINEAR,minFilter:Dn.LINEAR,wrapS:Dn.REPEAT,wrapT:Dn.REPEAT})),Ife=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),Rfe=(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))}]};function Ffe(n,e,t){var a,l;const r=[],i=[];for(const A in n)((l=(a=n[A])==null?void 0:a.vrm)==null?void 0:l.meta)!=null&&(n[A].vrm.meta.authors!=null?i.push(n[A].vrm.meta):r.push(n[A].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=Lfe(r),o=Ufe(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function Ufe(n,e){let{authors:t=[],otherLicenseUrl:r=[],contactInformation:i=[],references:s=[],allowExcessivelyViolentUsage:o=void 0,allowExcessivelySexualUsage:a=void 0,commercialUsage:l=void 0,copyrightInformation:A="",avatarPermission:c=void 0,otherPermissionUrl:u=[]}=n,f,h,p,d="unnecessary",g,m=[];e.forEach(b=>{t=t.concat(ct(b.authors)),r=r.concat(ct(b.otherLicenseUrl)),i=i.concat(ct(b.contactInformation)),s=s.concat(ct(b.references)),u=u.concat(ct(b.otherPermissionUrl)),b.allowExcessivelyViolentUsage===!1&&(o=!1),b.allowExcessivelySexualUsage===!1&&(a=!1),l=qa(Ofe,l,b.commercialUsage),A=qa(M5,A,b.copyrightInformation),c=qa(Nfe,c,b.avatarPermission),b.allowAntisocialOrHateUsage===!1&&(f=f=!1),b.allowPoliticalOrReligiousUsage===!1&&(h=h=!1),b.allowRedistribution===!1&&(p=p=!1),b.creditNotation==="required"&&(d="required"),m=m.concat(ct(b.thirdPartyLicenses)),g=qa(Dfe,g,b.modification)});const y=[...new Set(t)].filter(b=>b!=""&&b!=null&&b!="undefined"),w=[...new Set(r)].filter(b=>b!=""&&b!=null&&b!="undefined"),x=[...new Set(i)].filter(b=>b!=""&&b!=null&&b!="undefined"),_=[...new Set(s)].filter(b=>b!=""&&b!=null&&b!="undefined"),C=[...new Set(u)].filter(b=>b!=""&&b!=null&&b!="undefined"),S=[...new Set(m)].filter(b=>b!=""&&b!=null&&b!="undefined");return{authors:y,otherLicenseUrl:w.length==0?"":w.join(", "),contactInformation:x.length==0?"":x.join(", "),references:_,otherPermissionUrl:C.length==0?"":C.join(", "),thirdPartyLicenses:S.length==0?"":S.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:A,avatarPermission:c,allowAntisocialOrHateUsage:f,allowPoliticalOrReligiousUsage:h,allowRedistribution:p,creditNotation:d,modification:g}}function Lfe(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,A,c;n.forEach(g=>{e=e.concat(ct(g.author)),t=t.concat(ct(g.contactInformation)),r=r.concat(ct(g.reference)),i=i.concat(ct(g.otherPermissionUrl)),s=s.concat(ct(g.otherLicenseUrl)),o=qa(kfe,o,g.allowedUsername),a=qa(cB,a,g.violentUssageName),l=qa(cB,l,g.sexualUssageName),A=qa(cB,A,g.commercialUssageName),c=qa(M5,c,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"),p=[...new Set(i)].filter(g=>g!=""&&g!=null&&g!="undefined"),d=[...new Set(s)].filter(g=>g!=""&&g!=null&&g!="undefined");return{authors:u,otherLicenseUrl:d,contactInformation:f,references:h,allowExcessivelyViolentUsage:a==="Allow",allowExcessivelySexualUsage:l==="Allow",commercialUsage:A==="Allow"?"personalProfit":"personalNonProfit",copyrightInformation:c,avatarPermission:Pfe(o),otherPermissionUrl:p}}function Pfe(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const Dfe={prohibited:0,allowModification:1,allowModificationRedistribution:2},Ofe={personalNonProfit:0,personalProfit:1,corporation:2},Nfe={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},kfe={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},cB={Disallow:0,Allow:1},M5={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 qa(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 Qfe(n){const e=T5(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=m5(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 kh,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new Ur;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function Hfe(n,e,t){const r=await bT(n,t),i=await I5(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function zfe(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;Gfe(n,e,r).then(a=>{F5(a,`${o}.vrm`),i()})})}async function Gfe(n,e,t){const r=await bT(n,t);return I5(r,e,t)}function bT(n,e){const t=T5(n),{createTextureAtlas:r=!0}=e;return r?Tue(t,e):(console.log("no atlas"),Cue(t,e))}async function Vfe(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await bT(n,t):Qfe(n);jfe(s).then(o=>{if(o instanceof ArrayBuffer)F5(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);Xfe(a,`${r}.gltf`)}})}function jfe(n){return new Promise(e=>new aT().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function Wfe(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(A=>A.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 Km)if(s.bone.parent.name==Km[o]){t.push(s);break}}),t}function Kfe(n){const e={};return n.skeleton.bones.map(t=>{for(const r in Km)if(Km[r]===t.name){e[t.name]={node:t};break}}),e}function $fe(n,e){const t=zh(n,"SkinnedMesh");return{humanBones:Kfe(t[0]),materials:n.userData.atlasMaterial,meta:Yfe(e)}}function Yfe(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 I5(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=Ffe(e,s,a);return new Promise(async A=>{const c=i?new _fe:new wce,u={...Jfe(e),...$fe(n,l)};let f;n.traverse(d=>{d.isSkinnedMesh&&(f=d)}),(()=>{for(let d=0;d{d.updateMatrix(),d.updateMatrixWorld()}),f.skeleton.calculateInverses(),f.skeleton.computeBoneTexture(),f.skeleton.update()})(),f.skeleton.bones.filter(d=>d.name==="head")[0];const p=Wfe(e);c.parse(u,n,r,p,t.ktxCompression,o,d=>{A(d)})})}function R5(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 Xfe(n,e){R5(new Blob([n],{type:"text/plain"}),e)}function F5(n,e){R5(Zfe(n),e)}function Zfe(n){return new Blob([n],{type:"application/octet-stream"})}function Jfe(n){for(const e in n)if(n[e].vrm)return n[e].vrm}const qfe=n=>{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?ehe(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?the(n):console.warn("No valid vrm file was provided")},ehe=n=>{var a,l,A;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:A.colliderGroups,s=[],o=r.map(c=>U5(c.name,s));i!=null&&i.forEach(c=>{const u=o[c.node],f=_5(t,u);if(f!=null){const h=c.colliders;f.userData.VRMcolliders=h.map(p=>({sphere:{radius:p.radius,offset:[p.offset.x,p.offset.y,p.offset.z]}}))}f.userData.VRMcollidersID=w5()})},the=n=>{var l,A,c,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:A.colliderGroups,s=(u=(c=e.extensions)==null?void 0:c.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(f=>U5(f.name,o));i!=null&&i.forEach(f=>{const h=ct(f.colliders);let p=-1,d=null;h.forEach(g=>{if(p!=s[g].node){p=s[g].node;const m=a[p];d=_5(t,m),d.userData.VRMcolliders=[]}if(d!=null){const m=s[g].shape;for(const y in m){const w=m[y];w!=null&&w.offset&&(w.offset[0]=-w.offset[0])}d.userData.VRMcollidersID=w5(),d.userData.VRMcolliders.push(m)}else console.error("no node with name "+a[p]+" was found")})})},U5=(n,e)=>{const t=_t.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},kw=[0,400,560,2400,4800],Qw=[0,500,700,3e3,6e3],XC=[],Va=[],BT=1024,L5=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=Hw.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=BT,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=Hw.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(oi.Oh,0),this.vrm.expressionManager.setValue(oi.Ah,0),this.vrm.expressionManager.setValue(oi.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(oi.Oh,i),this.vrm.expressionManager.setValue(oi.Ah,r),this.vrm.expressionManager.setValue(oi.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(A){const u=new Float32Array(A.length);for(let f=0;f0&&(i[A]+=r[c]);i[A]/=Va[A+1]-Va[A]}for(let A=0;A0&&(s[A]+=r[c]);i[A]/=Va[A+1]-Va[A],s[A]=s[A]/(XC[A+1]-XC[A])}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 A=0;A=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 uB=new Z;class nhe{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new $e,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,A,c={x:window.innerWidth,y:window.innerHeight};return e<=c.x/2&&(o=c.x/2-e,a=o/(c.x/2)*100,i=r.maxx*a/100*-1),e>=c.x/2&&(o=e-c.x/2,a=o/(c.x/2)*100,i=r.minx*a/100),t<=c.y/2&&(l=c.y/2-t,A=l/(c.y/2)*100,s=r.maxy*.5*A/100*-1),t>=c.y/2&&(l=t-c.y/2,A=l/(c.y/2)*100,s=r.miny*A/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(Lt.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Lt.degToRad(s.y*r),e.rotation.x,o)}}update(){uB.set(0,0,1),uB.applyQuaternion(this.camera.quaternion);const e=uB.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 fB{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:A,requiredTraits:c,randomTraits:u,colliderTraits:f,lipSyncTraits:h,blinkerTraits:p,typeRestrictions:d,defaultCullingLayer:g,defaultCullingDistance:m,offset:y,vrmMeta:w,traits:x,textureCollections:_,colorCollections:C,canDownload:S=!0,downloadOptions:b={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=ct(o),this.requiredTraits=ct(c),this.randomTraits=ct(u),this.initialTraits=A||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=ct(f),this.lipSyncTraits=ct(h),this.blinkerTraits=ct(p),this.typeRestrictions=d,this.defaultCullingLayer=g,this.defaultCullingDistance=m,this.offset=y,this.canDownload=S,this.downloadOptions=b;const M=()=>{const H=[];for(const I in x)H.push(x[I].trait);return H};this.allTraits=M(),M(),(()=>{if(this.typeRestrictions)for(const H in this.typeRestrictions)ct(this.typeRestrictions[H]).forEach(v=>{this.typeRestrictions[v]==null&&(this.typeRestrictions[v]=[]),this.typeRestrictions[v].indexOf(H)==-1&&this.typeRestrictions[v].push(H)})})(),(()=>{b.vrmMeta=b.vrmMeta||w,b.scale=b.scale||a||1,b.mToonAtlasSize=b.mToonAtlasSize||2048,b.mToonAtlasSizeTransp=b.mToonAtlasSizeTransp||1024,b.stdAtlasSize=b.stdAtlasSize||2048,b.stdAtlasSizeTransp=b.stdAtlasSizeTransp||1024,b.exportStdAtlas=b.exportStdAtlas||!1,b.exportMtoonAtlas=b.exportMtoonAtlas||!0,b.screenshotFaceDistance=b.screenshotFaceDistance||1,b.screenshotFaceOffset=b.screenshotFaceOffset||[0,0,0],b.screenshotResolution=b.screenshotResolution||[512,512],b.screenshotBackground=b.screenshotBackground||[.1,.1,.1],b.screenshotFOV=b.screenshotFOV||75,!b.exportStdAtlas&&!b.exportMtoonAtlas&&(b.exportMtoonAtlas=!0)})(),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(_),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(C),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(x)}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)}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=ct(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 hB(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 hB(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 hB(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=[]),ct(e).forEach(r=>{this.modelTraits.push(new rhe(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=[]),ct(e).forEach(r=>{this.textureTraits.push(new ihe(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),ct(e).forEach(r=>{this.colorTraits.push(new she(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class rhe{constructor(e,t){const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:A,restrictedTraits:c=[],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=c,this.restrictedTypes=u,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(A)}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=[]),ct(e).forEach(r=>{this.collection.push(new Z3(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new Z3(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 ihe{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=[]),ct(e).forEach(r=>{this.collection.push(new ohe(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 she{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=[]),ct(e).forEach(r=>{this.collection.push(new ahe(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 Z3{constructor(e,t){const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:A=[],textureCollection:c,colorCollection:u,fullDirectory:f,fullThumbnail:h}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,f)this.fullDirectory=f;else if(Array.isArray(i)){this.fullDirectory=[];for(let p=0;p0&&this.manifestData.restrictedTypes>0){haveCommonValue=(i,s)=>{if(i==null||s==null)return!1;for(let o=0;ohaveCommonValue(r[i],traitTypes))}return!1}}class ohe{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{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(Qa)}),Qa.z+=.3,Qa.y+=s,this.screenshotManager.setCamera(Qa,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(A=>{A.isMesh&&A.userData.origIndexBuffer&&(A.userData.clippedIndexGeometry=A.geometry.index.clone(),A.geometry.setIndex(A.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&A.geometry.setIndex(A.userData.clippedIndexGeometry)})},o=(A,c)=>{for(let u=0;u{var d,g;const u=A.object,f=A.face,h=[f.a,f.b,f.c],p=(g=(d=u.userData)==null?void 0:d.clippedIndexGeometry)==null?void 0:g.array;if(p!=null){const m=o(p,h),y=Array.from(p);if(m==-1&&!c){const w=[...y,...h];u.userData.clippedIndexGeometry=new At(new Uint32Array(w),1,!1)}m!=1&&c&&(y.splice(m,3),u.userData.clippedIndexGeometry=new At(new Uint32Array(y),1,!1))}};dB.x=e,dB.y=t,i(),J3.setFromCamera(dB,this.renderCamera);const l=J3.intersectObjects(this.characterModel.children);if(l.length>0){const A=l[0];a(A,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new gy({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 zfe(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};Vfe(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()}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}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(ct(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))}})}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(ct(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(ct(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 Pue(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 Qe(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 Qe(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 gy({traitGroupID:e,traitModel:null});this._addLoadedData(i),oB(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){oB(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new fB(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 fB(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 fB(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=ct(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(ct(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 gy({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),oB(this.avatar)})}async _animationManagerSetup(e,t,r){const i=ct(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(Qa)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],A=r[1];Qa.x+=s[0],Qa.y+=s[1],Qa.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.setCamera(Qa,i,a);const c=e?this.screenshotManager.getScreenshotBlob(l,A):this.screenshotManager.getScreenshotTexture(l,A);return this.blinkManager.disableScreenshot(),c}_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 Qe(o,a,l)},r=new Ei({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(k3(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&qfe(e),Hue(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new Hw(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 A=new It;A.name="newRootNode",Lue(o.scene,A),A.add(o.humanoid.humanBones.hips.node)}o.humanoid.humanBones.hips.node.parent.rotateY(3.14159),o.scene.traverse(A=>{var c;if(A.isSkinnedMesh){const u={},f=ct((c=A.geometry.userData)==null?void 0:c.targetNames);for(let h=0;h{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 A=this.manifest,c=this.manifestData.getModelGroup(r);k3(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:c.cullingLayer!=null?c.cullingLayer:A.defaultCullingLayer!=null?A.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:c.cullingDistance!=null?c.cullingDistance:A.defaultCullingDistance!=null?A.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,f)=>{if(i){const h=i[f]||i[0];h!=null&&ct(u.material).map(p=>{che(p,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 Qe(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),Que(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 A=null;o.map(c=>{c!=null&&(A=this._VRMBaseSetup(c,r,t,a,l))}),A!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(A),this._displayModel(A),this._applyManagers(A),console.log(this.characterModel),this.avatar[t]={traitInfo:r,textureInfo:i,colorInfo:s,name:r.name,model:A&&A.scene,vrm:A})}}class Ahe{constructor(){const e=new UH;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new QH(e);t.crossOrigin="anonymous",t.register(i=>new dce(i,{autoUpdateHumanBones:!0}));const r=new lu(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 c,u,f;if(s==null){r[o]=null;return}const a=await Promise.all(ct((c=s==null?void 0:s.traitModel)==null?void 0:c.fullDirectory).map(async h=>{try{return await this.gltfLoader.loadAsync(h)}catch(p){return console.error(`Error loading modelsss ${h}:`,p),null}})),l=await Promise.all(ct((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(h=>new Promise(p=>{this.textureLoader.load(h,d=>{d.flipY=!1,d.encoding=pt,p(d)},null,d=>{console.error("error loading texture: ",d),p(null)})}))),A=ct((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(h=>new Qe(h));r[o]=new gy({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:A})});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 gy{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 che(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 uhe(n){const e=new vw,t=new DH(16777215,.5);e.add(t);const r=new iT(16777215,.5);r.position.set(0,1,1),e.add(r);const i=new It;e.add(i);const s=new Fr(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new lhe({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new vg({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),A=new one(s,l.domElement);A.minDistance=1,A.maxDistance=4,A.maxPolarAngle=Math.PI/2,A.enablePan=!0,A.target=new Z(0,1,0),A.enableDamping=!0,A.dampingFactor=.1;const c=new Z(-.5,0,-.5),u=new Z(.5,1.5,.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.outputEncoding=pt;const h=()=>{requestAnimationFrame(h),A.target.clamp(c,u),A==null||A.update(),o.update(),l.render(e,s)};h();const p=g=>{const m=g.ctrlKey,y=a.getBoundingClientRect(),w=(g.clientX-y.left)/y.width*2-1,x=-((g.clientY-y.top)/y.height)*2+1;o.cameraRaycastCulling(w,x,m)};async function d(){}return d(),a.addEventListener("click",p),{scene:e,camera:s,controls:A,characterManager:o,sceneElements:i}}function xv(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 P5={exports:{}};/*! + `})}}const ip=new Z;class tfe{constructor(e){ms(this,"camera",null);ms(this,"frameOffset",{min:.2,max:.2});ms(this,"boneOffsets");ms(this,"cameraDir",new Z);ms(this,"frameTarget",null);this.camera=e||new br,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 Z(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 Z;const s=new Z;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 cl){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 Z(1/0,1/0,1/0),a=new Z(-1/0,-1/0,-1/0),l=[];e.traverse(async u=>{u instanceof cl&&(l.push(this._saveBonesPos(u.skeleton)),u.skeleton.pose())});let A=0;await(u=>new Promise(f=>setTimeout(f,u)))(10),e.traverse(u=>{if(u instanceof cl){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"),p=u.geometry.getAttribute("skinWeight"),d=u.geometry.getAttribute("skinIndex");for(let g=0;g=r){const x=u.skeleton.bones[f],_=new Z().setFromMatrixPosition(x.matrixWorld),C=m.clone().sub(_);o.min(C),a.max(C)}}this._restoreSavedPose(l[A],u.skeleton),A++}}),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 ps;s.expandByPoint(e),s.expandByPoint(t),this.camera.fov=i;const o=this.camera.fov*(Math.PI/180),l=s.getSize(new Z).length()/(2*Math.tan(o/2));s.getCenter(ip),this.camera.position.copy(ip),r.y*=.5,this.camera.lookAt(ip.clone().sub(r));const A=new Z;this.camera.getWorldDirection(A),this.camera.position.addScaledVector(A,-l),this.camera.updateProjectionMatrix()}setCamera(e,t,r=30){this.camera.position.copy(e),this.camera.fov=r,ip.set(0,0,-1),this.cameraDir=ip.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 kw=4096;class nfe{constructor(e,t,r){const i=new yg({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new $e(kw,kw);i.setClearColor(0,0),i.outputEncoding=cs,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 Zue(i);a.addPass(new Jue(e,t)),this._renderPixelPass=new que(o,e,t),this._pixelPass=new efe(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new $e(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 rfe{constructor(e,t){ms(this,"cameraFrameManager");this.renderer=new yg({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputEncoding=pt,this.renderer.setSize(kw,kw);const r=new br(30,1,.1,1e3);this.textureLoader=new Au,this.sceneBackground=new Qe(.1,.1,.1),this.sceneBackgroundAlpha=1,this.usesBackgroundImage=!1,this.backgroundMaterial=new Ei({color:16777215,transparent:!0,opacity:.5});const i=new au(1e3,1e3),s=new xn(i,this.backgroundMaterial);s.renderOrder=-1,this.backgroundPlane=s,this.pixelRenderer=new nfe(t,r,20),this.cameraFrameManager=new tfe(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 Z().setFromMatrixPosition(r.matrixWorld):(console.warn(`Bone with name '${e}' not found in one of the skinned meshes.`),new Z(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 Qe(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=As,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 Z(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 Qn(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=t6.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 ife=2;class sfe{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new OH,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=ife,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(oi.Blink,1-this._eyeOpen),e.expressionManager.update()})}}function E5(){return(E5=Object.assign||function(n){for(var e=1;e0?u+s.byteLength:0;f%8&&(f+=8-f%8);let h=[],p=new DataView(new ArrayBuffer(24*n.levels.length)),d=(f||u+s.byteLength)+t.byteLength;for(let y=0;y0?f:0),!0),m.setBigUint64(60,BigInt(t.byteLength),!0),new Uint8Array(op([new Uint8Array(Ir).buffer,g,p.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...h]))}var VC,jC,ffe={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},WC=new OffscreenCanvas(128,128),j3=WC.getContext("2d",{willReadFrequently:!0}),C5=typeof document>"u";function hfe(n){return createImageBitmap(n).then(function(e){return WC.width=e.width,WC.height=e.height,j3.drawImage(e,0,0),j3.getImageData(0,0,e.width,e.height)})}function dfe(n,e){return e===void 0&&(e={}),mfe().then(function(t){var r=new t.BasisEncoder;return pfe(e,r),r.setTexType(VC.cBASISTexType2D),afe(n,ArrayBuffer)&&(n=new Blob([n])),hfe(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,jC.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=Afe(s);if(e.kvData){for(var A in e.kvData)l.keyValue[A]=e.kvData[A];a=ufe(l,{keepWriter:!0})}return a})})}function pfe(n,e){n===void 0&&(n={}),(n=ofe({},ffe,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 lB=null;function mfe(){return lB||(lB=new Promise(function(n,e){C5?(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)})),lB}C5&&self.addEventListener("message",function(n){dfe(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class gfe{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 A=new this.libktx.ktxBasisParams;A.uastc=!1,A.noSSE=!0,A.verbose=!1,A.qualityLevel=100,A.compressionLevel=2,s.basisu_options=A}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 vfe{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new gfe(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 Dn;(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"})(Dn||(Dn={}));const KC="blend_",W3="vrmColliderSphere";function yfe(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 wfe(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function xfe(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 _fe(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 bfe{async parse(e,t,r,i,s,o,a){var be;const l=yfe(e.meta),A=wfe(e.humanoid),c=e.materials,u=[],f={generator:"UniGLTF-2.0.0",version:"2.0"};if(t)if(A)if(l){if(!c)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=c.filter((N,j,se)=>se.findIndex(he=>he.name===N.name.replace(" (Outline)",""))===j).map(N=>N),p=h.map(N=>N.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(N=>N.map).map(N=>{if(!N.map)throw new Error(N.name+" map is null");return{name:N.name,imageBitmap:N.map.image}}),m=h.filter(N=>N.userData.shadeTexture).map(N=>{if(!N.userData.shadeTexture)throw new Error(N.userData.shadeTexture+" map is null");return{name:N.name+"_shade",imageBitmap:N.userData.shadeTexture.image}}),y=h.filter(N=>N.roughnessMap).map(N=>N.roughnessMap?{name:N.name+"_orm",imageBitmap:N.roughnessMap.image}:null),w=h.filter(N=>N.roughnessMap).map(N=>N.normalMap?{name:N.name+"_normal",imageBitmap:N.normalMap.image}:null),x=[...g,...m,...y,...w].filter(N=>N!==null),_=Tfe(x,d,s?"image/ktx2":"image/png"),C=Ife(_),S=Rfe(_,s),b=Mfe(h,x),M=t.children.filter(N=>N.children.length>0&&N.children[0].type===li.Bone)[0],D=S5(M).filter(N=>N.name!==W3),$=D.map(N=>N.name),H=D.map(N=>{const j=N.children.filter(se=>se.name!==W3).map(se=>$.indexOf(se.name));return{name:N.name,rotation:[N.quaternion.x,N.quaternion.y,N.quaternion.z,N.quaternion.w],scale:[N.scale.x,N.scale.y,N.scale.z],translation:[N.position.x,N.position.y,N.position.z],children:j.length>0?j:void 0}}),I=[],v=t.children.filter(N=>N.type===li.Group||N.type===li.SkinnedMesh),E=[];v.forEach((N,j)=>{const se=N.type===li.Group?N.children[0]:N,he=se.geometry.attributes,me=new Vl(he.position,Dn.FLOAT,Kt.POSITION,Go.VEC3,se.name,void 0);E.push(me);const G=E.length-1,R=he.normal.array,T=new Float32Array(R.length);for(let ie=0;ieie):[N]).forEach(ie=>{if(!ie.geometry.index)throw new Error(ie.name+" geometry.index is null");E.push(new Vl(ie.geometry.index,Dn.UNSIGNED_INT,Kt.INDEX,Go.SCALAR,se.name,ie.name))}),se.morphTargetDictionary||(se.morphTargetDictionary={},se.morphTargetInfluences=[],se.geometry.morphAttributes={},se.updateMorphTargets()),se.geometry.userData.targetNames=[];const ae=(ie,Te,Me,Le)=>{const ke=[],De=[];for(let fe=0;fe0){const fe=[...ke].sort((Fe,We)=>Fe-We),Ce=[];for(let Fe=0;Fe({mesh:0,index:he.index,weight:he.weight*100}));if(se.length>0){let he=!1;for(const me in oi)if(N===oi[me]&&N!=="surprised"){u.push({name:N,presetName:xfe(N),binds:se,isBinary:j.isBinary}),he=!0;break}he===!1&&u.push({name:N,presetName:"unknown",binds:se,isBinary:j.isBinary})}}v.forEach(N=>{const j=N.type===li.Group?N.children[0]:N,se=new Float32Array(j.skeleton.boneInverses.map(he=>he.elements).flat());E.push(new Vl(new At(se,16),Dn.FLOAT,Kt.BIND_MATRIX,Go.MAT4,j.name,j.name))}),I.push(...E.map(N=>({componentType:N.valueType,count:N.attribute.count,max:N.max,min:N.min,normalized:!1,type:N.accessorsType})));const U=Cfe(v,E,p);v.forEach((N,j)=>{H.push({mesh:j,name:N.name,rotation:[N.quaternion.x,N.quaternion.y,N.quaternion.z,N.quaternion.w],scale:[N.scale.x,N.scale.y,N.scale.z],skin:j,translation:[N.position.x,N.position.y,N.position.z]})});const P=Sfe(v,E,$),L={humanBones:[]};A.humanBones.forEach(N=>{$.indexOf(N.node.name)!=-1&&L.humanBones.push({bone:_fe(N.bone),node:$.indexOf(N.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]}},K={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},O=[];h.forEach(N=>{N.type=="ShaderMaterial"?O.push(Object.assign({},z)):O.push(Object.assign({},K))});const B=l;i.forEach(N=>{for(let j=0;jN.isSkinnedMesh))==null?void 0:be.skeleton)||null;for(let N=0;N{const me=he.sphere;se.colliders.push({radius:me.radius*o,offset:{x:me.offset[0]*o,y:me.offset[1]*o,z:me.offset[2]*o}})}),W.push(se)}}console.log("COLLIDER GROUPS",W);const F=N=>{for(let j=0;j{var G;const j=F(N.name);if(j===-1){console.warn("Spring bone "+N.name+" was removed during cleanup process. Skipping.");return}const se=[];N.colliderGroups.forEach(R=>{const T=R.colliders[0];if(T!=null){const V=T.parent,te=W.findIndex(ae=>ae.name===V.name);te!=-1&&(se.includes(te)||se.push(te))}});let he=F((G=N.center)==null?void 0:G.name);he==-1&&console.warn("no center bone for spring bone "+N.name);const me=N.settings;X.push({bones:[j],center:he,colliderGroups:se,dragForce:me.dragForce,gravityDir:{x:me.gravityDir.x,y:me.gravityDir.y,z:me.gravityDir.z},gravityPower:me.gravityPower,hitRadius:me.hitRadius,stiffiness:me.stiffness})});const ue={boneGroups:X,colliderGroups:W};console.log(ue),B.texture=d?_.length-1:void 0;const le=await Promise.all(x.map(async N=>({buffer:s?await K3(N.imageBitmap):$3(N.imageBitmap),type:Kt.IMAGE})));E.forEach((N,j)=>{N.buffer?le.push({buffer:N.buffer,typeString:"",type:N.type}):N.sparse&&(le.push({buffer:N.sparse.indices,typeString:"indices",type:N.type,count:N.sparse.count}),le.push({buffer:N.sparse.values,typeString:"values",type:N.type})),le.length-1}),d&&le.push({buffer:s?await K3(d.imageBitmap):$3(d.imageBitmap),type:Kt.IMAGE});let oe=0,re=0,pe=0,_e=0;const Re=le.map(N=>{const j={buffer:0,byteLength:N.buffer.byteLength,byteOffset:oe,target:N.type===Kt.IMAGE||N.type===Kt.BIND_MATRIX||N.typeString==="indices"||N.typeString==="values"?void 0:N.type===Kt.INDEX?Dn.ELEMENT_ARRAY_BUFFER:Dn.ARRAY_BUFFER};return oe+=N.buffer.byteLength,N.type===Kt.IMAGE?(_[re++].bufferView=_e,_e++):E[pe].sparse?(I[pe].sparse==null&&(I[pe].sparse={}),N.typeString==="indices"&&(I[pe].sparse.count=N.count,I[pe].sparse[N.typeString]={bufferView:_e,byteOffset:0,componentType:Dn.UNSIGNED_INT}),N.typeString==="values"&&(I[pe].sparse[N.typeString]={bufferView:_e,byteOffset:0}),N.typeString==="values"&&pe++,_e++):(E[pe].bufferIndex=_e,I[pe].bufferView=_e,pe++,_e++),j}),Q=Ffe(t,H);Bfe(B);const de=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&de.push("KHR_texture_basisu");const Ae={accessors:I,asset:f,buffers:[{byteLength:oe}],bufferViews:Re,extensions:{VRM:{blendShapeMaster:{blendShapeGroups:u},firstPerson:{firstPersonBone:44,firstPersonBoneOffset:new Z,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:O,humanoid:L,meta:B,secondaryAnimation:ue,specVersion:"0.0"}},extensionsUsed:de,images:_,materials:b,meshes:U,nodes:H,samplers:C,scenes:Q,skins:P,textures:S};console.log("output",Ae);const q=new Y3(YC(JSON.stringify(Ae,void 0,2)),"JSON"),J=new Y3(Dp(le.map(N=>N.buffer)),"BIN\0"),ce=Dp([q.buffer,J.buffer]),xe=Dp([YC("glTF"),$C(2,4),$C(ce.byteLength+12,4)]);a(Dp([xe,ce]))}}function Bfe(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 S5(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>S5(e)).flat())}const Efe=new vfe;async function K3(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 Efe.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 $3(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?A=r[a*n.itemSize+l]:l===0?A=n.getX(a):l===1?A=n.getY(a):l===2?A=n.getZ(a):A=n.getW(a),e===Dn.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===Dn.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}class Y3{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Dp([$C(r.byteLength,4),YC(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 X3=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===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(A=>A.meshName===i.name?A.type:null),l=Array.isArray(o.material)?o.material[0].name:o.material.name;return{attributes:{JOINTS_0:a.indexOf(Kt.SKIN_INDEX),NORMAL:a.indexOf(Kt.NORMAL),POSITION:a.indexOf(Kt.POSITION),TEXCOORD_0:a.indexOf(Kt.UV),WEIGHTS_0:a.indexOf(Kt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Kt.INDEX&&A.meshName===i.name?A.name:null).indexOf(o.name),material:t.indexOf(l),mode:4,targets:i.geometry.userData.targetNames?i.geometry.userData.targetNames.map(A=>{const c=e.map(h=>h.type===Kt.BLEND_NORMAL&&h.meshName===i.name?h.name:null).indexOf(KC+A),u=e.map(h=>h.type===Kt.BLEND_POSITION&&h.meshName===i.name?h.name:null).indexOf(KC+A),f={};return u!==-1&&(f.POSITION=u),c!==-1&&(f.NORMAL=c),f}):void 0}})}}),Sfe=(n,e,t)=>n.map(r=>{const i=r.type===li.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Kt.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)}}),Mfe=(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(p=>p.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,A={baseColorFactor:r,baseColorTexture:l},c=o>=0?{index:o,texCoord:0}:void 0,u=a>=0?{index:a,texCoord:0}:void 0;if(c)A.metallicRoughnessTexture=c;else{const h=(()=>{switch(t.type){case $f.MeshStandardMaterial:return t.metalness;case $f.MeshBasicMaterial:return 0;default:return 0}})(),p=(()=>{switch(t.type){case $f.MeshStandardMaterial:return t.roughness;case $f.MeshBasicMaterial:return .9;default:return .9}})();A.metallicFactor=h,A.roughnessFactor=p}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:A};return u&&(f.normalTexture=u),f}),Tfe=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),Ife=n=>n.map(()=>({magFilter:Dn.LINEAR,minFilter:Dn.LINEAR,wrapS:Dn.REPEAT,wrapT:Dn.REPEAT})),Rfe=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),Ffe=(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))}]};function Ufe(n,e,t){var a,l;const r=[],i=[];for(const A in n)((l=(a=n[A])==null?void 0:a.vrm)==null?void 0:l.meta)!=null&&(n[A].vrm.meta.authors!=null?i.push(n[A].vrm.meta):r.push(n[A].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=Pfe(r),o=Lfe(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function Lfe(n,e){let{authors:t=[],otherLicenseUrl:r=[],contactInformation:i=[],references:s=[],allowExcessivelyViolentUsage:o=void 0,allowExcessivelySexualUsage:a=void 0,commercialUsage:l=void 0,copyrightInformation:A="",avatarPermission:c=void 0,otherPermissionUrl:u=[]}=n,f,h,p,d="unnecessary",g,m=[];e.forEach(b=>{t=t.concat(ct(b.authors)),r=r.concat(ct(b.otherLicenseUrl)),i=i.concat(ct(b.contactInformation)),s=s.concat(ct(b.references)),u=u.concat(ct(b.otherPermissionUrl)),b.allowExcessivelyViolentUsage===!1&&(o=!1),b.allowExcessivelySexualUsage===!1&&(a=!1),l=el(Nfe,l,b.commercialUsage),A=el(M5,A,b.copyrightInformation),c=el(kfe,c,b.avatarPermission),b.allowAntisocialOrHateUsage===!1&&(f=f=!1),b.allowPoliticalOrReligiousUsage===!1&&(h=h=!1),b.allowRedistribution===!1&&(p=p=!1),b.creditNotation==="required"&&(d="required"),m=m.concat(ct(b.thirdPartyLicenses)),g=el(Ofe,g,b.modification)});const y=[...new Set(t)].filter(b=>b!=""&&b!=null&&b!="undefined"),w=[...new Set(r)].filter(b=>b!=""&&b!=null&&b!="undefined"),x=[...new Set(i)].filter(b=>b!=""&&b!=null&&b!="undefined"),_=[...new Set(s)].filter(b=>b!=""&&b!=null&&b!="undefined"),C=[...new Set(u)].filter(b=>b!=""&&b!=null&&b!="undefined"),S=[...new Set(m)].filter(b=>b!=""&&b!=null&&b!="undefined");return{authors:y,otherLicenseUrl:w.length==0?"":w.join(", "),contactInformation:x.length==0?"":x.join(", "),references:_,otherPermissionUrl:C.length==0?"":C.join(", "),thirdPartyLicenses:S.length==0?"":S.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:A,avatarPermission:c,allowAntisocialOrHateUsage:f,allowPoliticalOrReligiousUsage:h,allowRedistribution:p,creditNotation:d,modification:g}}function Pfe(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,A,c;n.forEach(g=>{e=e.concat(ct(g.author)),t=t.concat(ct(g.contactInformation)),r=r.concat(ct(g.reference)),i=i.concat(ct(g.otherPermissionUrl)),s=s.concat(ct(g.otherLicenseUrl)),o=el(Qfe,o,g.allowedUsername),a=el(cB,a,g.violentUssageName),l=el(cB,l,g.sexualUssageName),A=el(cB,A,g.commercialUssageName),c=el(M5,c,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"),p=[...new Set(i)].filter(g=>g!=""&&g!=null&&g!="undefined"),d=[...new Set(s)].filter(g=>g!=""&&g!=null&&g!="undefined");return{authors:u,otherLicenseUrl:d,contactInformation:f,references:h,allowExcessivelyViolentUsage:a==="Allow",allowExcessivelySexualUsage:l==="Allow",commercialUsage:A==="Allow"?"personalProfit":"personalNonProfit",copyrightInformation:c,avatarPermission:Dfe(o),otherPermissionUrl:p}}function Dfe(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const Ofe={prohibited:0,allowModification:1,allowModificationRedistribution:2},Nfe={personalNonProfit:0,personalProfit:1,corporation:2},kfe={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},Qfe={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},cB={Disallow:0,Allow:1},M5={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 el(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 Hfe(n){const e=T5(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=m5(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 Qh,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new Ur;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function zfe(n,e,t){const r=await bT(n,t),i=await I5(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function Gfe(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;Vfe(n,e,r).then(a=>{F5(a,`${o}.vrm`),i()})})}async function Vfe(n,e,t){const r=await bT(n,t);return I5(r,e,t)}function bT(n,e){const t=T5(n),{createTextureAtlas:r=!0}=e;return r?Tue(t,e):(console.log("no atlas"),Cue(t,e))}async function jfe(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await bT(n,t):Hfe(n);Wfe(s).then(o=>{if(o instanceof ArrayBuffer)F5(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);Zfe(a,`${r}.gltf`)}})}function Wfe(n){return new Promise(e=>new aT().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function Kfe(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(A=>A.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 $m)if(s.bone.parent.name==$m[o]){t.push(s);break}}),t}function $fe(n){const e={};return n.skeleton.bones.map(t=>{for(const r in $m)if($m[r]===t.name){e[t.name]={node:t};break}}),e}function Yfe(n,e){const t=Gh(n,"SkinnedMesh");return{humanBones:$fe(t[0]),materials:n.userData.atlasMaterial,meta:Xfe(e)}}function Xfe(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 I5(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=Ufe(e,s,a);return new Promise(async A=>{const c=i?new bfe:new wce,u={...qfe(e),...Yfe(n,l)};let f;n.traverse(d=>{d.isSkinnedMesh&&(f=d)}),(()=>{for(let d=0;d{d.updateMatrix(),d.updateMatrixWorld()}),f.skeleton.calculateInverses(),f.skeleton.computeBoneTexture(),f.skeleton.update()})(),f.skeleton.bones.filter(d=>d.name==="head")[0];const p=Kfe(e);c.parse(u,n,r,p,t.ktxCompression,o,d=>{A(d)})})}function R5(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 Zfe(n,e){R5(new Blob([n],{type:"text/plain"}),e)}function F5(n,e){R5(Jfe(n),e)}function Jfe(n){return new Blob([n],{type:"application/octet-stream"})}function qfe(n){for(const e in n)if(n[e].vrm)return n[e].vrm}const ehe=n=>{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?the(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?nhe(n):console.warn("No valid vrm file was provided")},the=n=>{var a,l,A;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=(a=e.extensions)==null?void 0:a.VRM)==null?void 0:l.secondaryAnimation)==null?void 0:A.colliderGroups,s=[],o=r.map(c=>U5(c.name,s));i!=null&&i.forEach(c=>{const u=o[c.node],f=_5(t,u);if(f!=null){const h=c.colliders;f.userData.VRMcolliders=h.map(p=>({sphere:{radius:p.radius,offset:[p.offset.x,p.offset.y,p.offset.z]}}))}f.userData.VRMcollidersID=w5()})},nhe=n=>{var l,A,c,u;const e=n.parser.json,t=n.scene,r=e.nodes,i=(A=(l=e.extensions)==null?void 0:l.VRMC_springBone)==null?void 0:A.colliderGroups,s=(u=(c=e.extensions)==null?void 0:c.VRMC_springBone)==null?void 0:u.colliders,o=[],a=r.map(f=>U5(f.name,o));i!=null&&i.forEach(f=>{const h=ct(f.colliders);let p=-1,d=null;h.forEach(g=>{if(p!=s[g].node){p=s[g].node;const m=a[p];d=_5(t,m),d.userData.VRMcolliders=[]}if(d!=null){const m=s[g].shape;for(const y in m){const w=m[y];w!=null&&w.offset&&(w.offset[0]=-w.offset[0])}d.userData.VRMcollidersID=w5(),d.userData.VRMcolliders.push(m)}else console.error("no node with name "+a[p]+" was found")})})},U5=(n,e)=>{const t=_t.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},Qw=[0,400,560,2400,4800],Hw=[0,500,700,3e3,6e3],XC=[],ja=[],BT=1024,L5=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=zw.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=BT,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=zw.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(oi.Oh,0),this.vrm.expressionManager.setValue(oi.Ah,0),this.vrm.expressionManager.setValue(oi.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(oi.Oh,i),this.vrm.expressionManager.setValue(oi.Ah,r),this.vrm.expressionManager.setValue(oi.Ee,s),this.vrm.expressionManager.update(e)}}}update2(){function e(A){const u=new Float32Array(A.length);for(let f=0;f0&&(i[A]+=r[c]);i[A]/=ja[A+1]-ja[A]}for(let A=0;A0&&(s[A]+=r[c]);i[A]/=ja[A+1]-ja[A],s[A]=s[A]/(XC[A+1]-XC[A])}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 A=0;A=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 uB=new Z;class rhe{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new $e,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,A,c={x:window.innerWidth,y:window.innerHeight};return e<=c.x/2&&(o=c.x/2-e,a=o/(c.x/2)*100,i=r.maxx*a/100*-1),e>=c.x/2&&(o=e-c.x/2,a=o/(c.x/2)*100,i=r.minx*a/100),t<=c.y/2&&(l=c.y/2-t,A=l/(c.y/2)*100,s=r.maxy*.5*A/100*-1),t>=c.y/2&&(l=t-c.y/2,A=l/(c.y/2)*100,s=r.miny*A/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(Lt.degToRad(s.x),e.rotation.y,o),e.rotation.x=this.lerp(Lt.degToRad(s.y*r),e.rotation.x,o)}}update(){uB.set(0,0,1),uB.applyQuaternion(this.camera.quaternion);const e=uB.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 fB{constructor(e){const{assetsLocation:t,traitsDirectory:r,thumbnailsDirectory:i,traitIconsDirectorySvg:s,animationPath:o,exportScale:a,displayScale:l,initialTraits:A,requiredTraits:c,randomTraits:u,colliderTraits:f,lipSyncTraits:h,blinkerTraits:p,typeRestrictions:d,defaultCullingLayer:g,defaultCullingDistance:m,offset:y,vrmMeta:w,traits:x,textureCollections:_,colorCollections:C,canDownload:S=!0,downloadOptions:b={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=ct(o),this.requiredTraits=ct(c),this.randomTraits=ct(u),this.initialTraits=A||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=ct(f),this.lipSyncTraits=ct(h),this.blinkerTraits=ct(p),this.typeRestrictions=d,this.defaultCullingLayer=g,this.defaultCullingDistance=m,this.offset=y,this.canDownload=S,this.downloadOptions=b;const M=()=>{const H=[];for(const I in x)H.push(x[I].trait);return H};this.allTraits=M(),M(),(()=>{if(this.typeRestrictions)for(const H in this.typeRestrictions)ct(this.typeRestrictions[H]).forEach(v=>{this.typeRestrictions[v]==null&&(this.typeRestrictions[v]=[]),this.typeRestrictions[v].indexOf(H)==-1&&this.typeRestrictions[v].push(H)})})(),(()=>{b.vrmMeta=b.vrmMeta||w,b.scale=b.scale||a||1,b.mToonAtlasSize=b.mToonAtlasSize||2048,b.mToonAtlasSizeTransp=b.mToonAtlasSizeTransp||1024,b.stdAtlasSize=b.stdAtlasSize||2048,b.stdAtlasSizeTransp=b.stdAtlasSizeTransp||1024,b.exportStdAtlas=b.exportStdAtlas||!1,b.exportMtoonAtlas=b.exportMtoonAtlas||!0,b.screenshotFaceDistance=b.screenshotFaceDistance||1,b.screenshotFaceOffset=b.screenshotFaceOffset||[0,0,0],b.screenshotResolution=b.screenshotResolution||[512,512],b.screenshotBackground=b.screenshotBackground||[.1,.1,.1],b.screenshotFOV=b.screenshotFOV||75,!b.exportStdAtlas&&!b.exportMtoonAtlas&&(b.exportMtoonAtlas=!0)})(),this.textureTraits=[],this.textureTraitsMap=null,this.createTextureTraits(_),this.colorTraits=[],this.colorTraitsMap=null,this.createColorTraits(C),this.modelTraits=[],this.modelTraitsMap=null,this.createModelTraits(x)}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)}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=ct(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 hB(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 hB(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 hB(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=[]),ct(e).forEach(r=>{this.modelTraits.push(new ihe(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=[]),ct(e).forEach(r=>{this.textureTraits.push(new she(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),ct(e).forEach(r=>{this.colorTraits.push(new ohe(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class ihe{constructor(e,t){const{trait:r,name:i,iconSvg:s,cameraTarget:o={distance:3,height:1},cullingDistance:a,cullingLayer:l,collection:A,restrictedTraits:c=[],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=c,this.restrictedTypes=u,this.cameraTarget=o,this.cullingDistance=a,this.cullingLayer=l,this.collection=[],this.collectionMap=null,this.createCollection(A)}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=[]),ct(e).forEach(r=>{this.collection.push(new Z3(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new Z3(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 she{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=[]),ct(e).forEach(r=>{this.collection.push(new ahe(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 ohe{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=[]),ct(e).forEach(r=>{this.collection.push(new lhe(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 Z3{constructor(e,t){const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:A=[],textureCollection:c,colorCollection:u,fullDirectory:f,fullThumbnail:h}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,f)this.fullDirectory=f;else if(Array.isArray(i)){this.fullDirectory=[];for(let p=0;p0&&this.manifestData.restrictedTypes>0){haveCommonValue=(i,s)=>{if(i==null||s==null)return!1;for(let o=0;ohaveCommonValue(r[i],traitTypes))}return!1}}class ahe{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{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(Ha)}),Ha.z+=.3,Ha.y+=s,this.screenshotManager.cameraFrameManager.setCamera(Ha,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(A=>{A.isMesh&&A.userData.origIndexBuffer&&(A.userData.clippedIndexGeometry=A.geometry.index.clone(),A.geometry.setIndex(A.userData.origIndexBuffer))})},s=()=>{this.characterModel.traverse(A=>{A.isMesh&&A.userData.origIndexBuffer&&A.geometry.setIndex(A.userData.clippedIndexGeometry)})},o=(A,c)=>{for(let u=0;u{var d,g;const u=A.object,f=A.face,h=[f.a,f.b,f.c],p=(g=(d=u.userData)==null?void 0:d.clippedIndexGeometry)==null?void 0:g.array;if(p!=null){const m=o(p,h),y=Array.from(p);if(m==-1&&!c){const w=[...y,...h];u.userData.clippedIndexGeometry=new At(new Uint32Array(w),1,!1)}m!=1&&c&&(y.splice(m,3),u.userData.clippedIndexGeometry=new At(new Uint32Array(y),1,!1))}};dB.x=e,dB.y=t,i(),J3.setFromCamera(dB,this.renderCamera);const l=J3.intersectObjects(this.characterModel.children);if(l.length>0){const A=l[0];a(A,r)}s()}removeCurrentCharacter(){const e=[];for(const t in this.avatar)e.push(new vy({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 Gfe(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};jfe(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()}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}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(ct(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))}})}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(ct(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(ct(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 Pue(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 Qe(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 Qe(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 vy({traitGroupID:e,traitModel:null});this._addLoadedData(i),oB(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){oB(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new fB(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 fB(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 fB(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=ct(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(ct(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 vy({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),oB(this.avatar)})}async _animationManagerSetup(e,t,r){const i=ct(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(Ha)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],A=r[1];Ha.x+=s[0],Ha.y+=s[1],Ha.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.cameraFrameManager.setCamera(Ha,i,a);const c=e?this.screenshotManager.getScreenshotBlob(l,A):this.screenshotManager.getScreenshotTexture(l,A);return this.blinkManager.disableScreenshot(),c}_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 Qe(o,a,l)},r=new Ei({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(k3(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&ehe(e),Hue(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new zw(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 A=new It;A.name="newRootNode",Lue(o.scene,A),A.add(o.humanoid.humanBones.hips.node)}o.humanoid.humanBones.hips.node.parent.rotateY(3.14159),o.scene.traverse(A=>{var c;if(A.isSkinnedMesh){const u={},f=ct((c=A.geometry.userData)==null?void 0:c.targetNames);for(let h=0;h{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 A=this.manifest,c=this.manifestData.getModelGroup(r);k3(e,{cullingLayer:t.cullingLayer!=null?t.cullingLayer:c.cullingLayer!=null?c.cullingLayer:A.defaultCullingLayer!=null?A.defaultCullingLayer:-1,cullingDistance:t.cullingDistance!=null?t.cullingDistance:c.cullingDistance!=null?c.cullingDistance:A.defaultCullingDistance!=null?A.defaultCullingDistance:null,maxCullingDistance:t.maxCullingDistance!=null?t.maxCullingDistance:c.maxCullingDistance!=null?c.maxCullingDistance:A.maxCullingDistance!=null?A.maxCullingDistance:1/0,cullingMeshes:l}),o.map((u,f)=>{if(i){const h=i[f]||i[0];h!=null&&ct(u.material).map(p=>{uhe(p,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 Qe(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),Que(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 A=null;o.map(c=>{c!=null&&(A=this._VRMBaseSetup(c,r,t,a,l))}),A!=null&&(this.avatar[t]&&this.avatar[t].vrm&&this._disposeTrait(this.avatar[t].vrm),this._positionModel(A),this._displayModel(A),this._applyManagers(A),console.log(this.characterModel),this.avatar[t]={traitInfo:r,textureInfo:i,colorInfo:s,name:r.name,model:A&&A.scene,vrm:A})}}class che{constructor(){const e=new UH;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new QH(e);t.crossOrigin="anonymous",t.register(i=>new dce(i,{autoUpdateHumanBones:!0}));const r=new Au(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 c,u,f;if(s==null){r[o]=null;return}const a=await Promise.all(ct((c=s==null?void 0:s.traitModel)==null?void 0:c.fullDirectory).map(async h=>{try{return await this.gltfLoader.loadAsync(h)}catch(p){return console.error(`Error loading modelsss ${h}:`,p),null}})),l=await Promise.all(ct((u=s==null?void 0:s.traitTexture)==null?void 0:u.fullDirectory).map(h=>new Promise(p=>{this.textureLoader.load(h,d=>{d.flipY=!1,d.encoding=pt,p(d)},null,d=>{console.error("error loading texture: ",d),p(null)})}))),A=ct((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(h=>new Qe(h));r[o]=new vy({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:A})});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 vy{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 uhe(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 fhe(n){const e=new yw,t=new DH(16777215,.5);e.add(t);const r=new iT(16777215,.5);r.position.set(0,1,1),e.add(r);const i=new It;e.add(i);const s=new br(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new Ahe({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new yg({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),A=new one(s,l.domElement);A.minDistance=1,A.maxDistance=4,A.maxPolarAngle=Math.PI/2,A.enablePan=!0,A.target=new Z(0,1,0),A.enableDamping=!0,A.dampingFactor=.1;const c=new Z(-.5,0,-.5),u=new Z(.5,1.5,.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.outputEncoding=pt;const h=()=>{requestAnimationFrame(h),A.target.clamp(c,u),A==null||A.update(),o.update(),l.render(e,s)};h();const p=g=>{const m=g.ctrlKey,y=a.getBoundingClientRect(),w=(g.clientX-y.left)/y.width*2-1,x=-((g.clientY-y.top)/y.height)*2+1;o.cameraRaycastCulling(w,x,m)};async function d(){}return d(),a.addEventListener("click",p),{scene:e,camera:s,controls:A,characterManager:o,sceneElements:i}}function _v(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 P5={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -4219,9 +4219,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(A,c){if(!i[A]){if(!r[A]){var u=typeof xv=="function"&&xv;if(!c&&u)return u(A,!0);if(a)return a(A,!0);var f=new Error("Cannot find module '"+A+"'");throw f.code="MODULE_NOT_FOUND",f}var h=i[A]={exports:{}};r[A][0].call(h.exports,function(p){var d=r[A][1][p];return o(d||p)},h,h.exports,t,r,i,s)}return i[A].exports}for(var a=typeof xv=="function"&&xv,l=0;l>2,h=(3&A)<<4|c>>4,p=1>6:64,d=2>4,c=(15&f)<<4|(h=a.indexOf(l.charAt(d++)))>>2,u=(3&h)<<6|(p=a.indexOf(l.charAt(d++))),y[g++]=A,h!==64&&(y[g++]=c),p!==64&&(y[g++]=u);return y}},{"./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 A(c,u,f,h,p){this.compressedSize=c,this.uncompressedSize=u,this.crc32=f,this.compression=h,this.compressedContent=p}A.prototype={getContentWorker:function(){var c=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return c.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},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)}},A.createWorkerFrom=function(c,u,f){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(u.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",u)},r.exports=A},{"./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=[],A=0;A<256;A++){a=A;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[A]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(A,c,u,f){var h=o,p=f+u;A^=-1;for(var d=f;d>>8^h[255&(A^c[d])];return-1^A}(0|l,a,a.length,0):function(A,c,u,f){var h=o,p=f+u;A^=-1;for(var d=f;d>>8^h[255&(A^c.charCodeAt(d))];return-1^A}(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"),A=s?"uint8array":"array";function c(u,f){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(A,u.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new 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 c("Deflate",u)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,i){function s(h,p){var d,g="";for(d=0;d>>=8;return g}function o(h,p,d,g,m,y){var w,x,_=h.file,C=h.compression,S=y!==A.utf8encode,b=a.transformTo("string",y(_.name)),M=a.transformTo("string",A.utf8encode(_.name)),D=_.comment,$=a.transformTo("string",y(D)),H=a.transformTo("string",A.utf8encode(D)),I=M.length!==_.name.length,v=H.length!==D.length,E="",U="",P="",L=_.dir,z=_.date,K={crc32:0,compressedSize:0,uncompressedSize:0};p&&!d||(K.crc32=h.crc32,K.compressedSize=h.compressedSize,K.uncompressedSize=h.uncompressedSize);var O=0;p&&(O|=8),S||!I&&!v||(O|=2048);var B=0,W=0;L&&(B|=16),m==="UNIX"?(W=798,B|=function(F,X){var ue=F;return F||(ue=X?16893:33204),(65535&ue)<<16}(_.unixPermissions,L)):(W=20,B|=function(F){return 63&(F||0)}(_.dosPermissions)),w=z.getUTCHours(),w<<=6,w|=z.getUTCMinutes(),w<<=5,w|=z.getUTCSeconds()/2,x=z.getUTCFullYear()-1980,x<<=4,x|=z.getUTCMonth()+1,x<<=5,x|=z.getUTCDate(),I&&(U=s(1,1)+s(c(b),4)+M,E+="up"+s(U.length,2)+U),v&&(P=s(1,1)+s(c($),4)+H,E+="uc"+s(P.length,2)+P);var ee="";return ee+=` -\0`,ee+=s(O,2),ee+=C.magic,ee+=s(w,2),ee+=s(x,2),ee+=s(K.crc32,4),ee+=s(K.compressedSize,4),ee+=s(K.uncompressedSize,4),ee+=s(b.length,2),ee+=s(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+ee+b+E,dirRecord:u.CENTRAL_FILE_HEADER+s(W,2)+ee+s($.length,2)+"\0\0\0\0"+s(B,4)+s(g,4)+b+E+$}}var a=t("../utils"),l=t("../stream/GenericWorker"),A=t("../utf8"),c=t("../crc32"),u=t("../signature");function f(h,p,d,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=d,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 p=h.meta.percent||0,d=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:d?(p+100*(d-g-1))/d:100}}))},f.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var p=this.streamFiles&&!h.file.dir;if(p){var d=o(h,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:d.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(h){this.accumulate=!1;var p=this.streamFiles&&!h.file.dir,d=o(h,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(d.dirRecord),p)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:d.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var h=this.bytesWritten,p=0;p=this.index;l--)A=(A<<8)+this.byteAt(l);return this.index+=a,A},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"),A=t("./NodeBufferReader"),c=t("./Uint8ArrayReader");r.exports=function(u){var f=s.getTypeOf(u);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new A(u):o.uint8array?new c(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 A=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=A+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 A=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){A.dataIsReady=!0,A.data=c,A.max=c&&c.length||0,A.type=s.getTypeOf(c),A.isPaused||A._tickAndRepeat()},function(c){A.error(c)})}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,A=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,A);break;case"uint8array":l=this.data.subarray(this.index,A);break;case"array":case"nodebuffer":l=this.data.slice(this.index,A)}return this.index=A,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"),A=t("../support"),c=t("../external"),u=null;if(A.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(p,d){return new c.Promise(function(g,m){var y=[],w=p._internalType,x=p._outputType,_=p._mimeType;p.on("data",function(C,S){y.push(C),d&&d(S)}).on("error",function(C){y=[],m(C)}).on("end",function(){try{var C=function(S,b,M){switch(S){case"blob":return s.newBlob(s.transformTo("arraybuffer",b),M);case"base64":return l.encode(b);default:return s.transformTo(S,b)}}(x,function(S,b){var M,D=0,$=null,H=0;for(M=0;M"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"),A=new Array(256),c=0;c<256;c++)A[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;A[254]=A[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(p){var d,g,m,y,w,x=p.length,_=0;for(y=0;y>>6:(g<65536?d[w++]=224|g>>>12:(d[w++]=240|g>>>18,d[w++]=128|g>>>12&63),d[w++]=128|g>>>6&63),d[w++]=128|63&g);return d}(h)},i.utf8decode=function(h){return o.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(p){var d,g,m,y,w=p.length,x=new Array(2*w);for(d=g=0;d>10&1023,x[g++]=56320|1023&m)}return x.length!==g&&(x.subarray?x=x.subarray(0,g):x.length=g),s.applyFromCharCode(x)}(h=s.transformTo(o.uint8array?"uint8array":"array",h))},s.inherits(u,l),u.prototype.processChunk=function(h){var p=s.transformTo(o.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var d=p;(p=new Uint8Array(d.length+this.leftOver.length)).set(this.leftOver,0),p.set(d,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var g=function(y,w){var x;for((w=w||y.length)>y.length&&(w=y.length),x=w-1;0<=x&&(192&y[x])==128;)x--;return x<0||x===0?w:x+A[y[x]]>w?x:w}(p),m=p;g!==p.length&&(o.uint8array?(m=p.subarray(0,g),this.leftOver=p.subarray(g,p.length)):(m=p.slice(0,g),this.leftOver=p.slice(g,p.length))),this.push({data:i.utf8decode(m),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 A(d){return d}function c(d,g){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=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 p,d,g,m=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 c(u,u.length)},i.binstring2buf=function(u){for(var f=new s.Buf8(u.length),h=0,p=f.length;h>10&1023,y[p++]=56320|1023&d)}return c(y,p)},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 A=65535&s|0,c=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,A){var c=s,u=A+l;o^=-1;for(var f=A;f>>8^c[255&(o^a[f])];return-1^o}},{}],46:[function(t,r,i){var s,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),A=t("./crc32"),c=t("./messages"),u=0,f=4,h=0,p=-2,d=-1,g=4,m=2,y=8,w=9,x=286,_=30,C=19,S=2*x+1,b=15,M=3,D=258,$=D+M+1,H=42,I=113,v=1,E=2,U=3,P=4;function L(Q,de){return Q.msg=c[de],de}function z(Q){return(Q<<1)-(4Q.avail_out&&(Ae=Q.avail_out),Ae!==0&&(o.arraySet(Q.output,de.pending_buf,de.pending_out,Ae,Q.next_out),Q.next_out+=Ae,de.pending_out+=Ae,Q.total_out+=Ae,Q.avail_out-=Ae,de.pending-=Ae,de.pending===0&&(de.pending_out=0))}function B(Q,de){a._tr_flush_block(Q,0<=Q.block_start?Q.block_start:-1,Q.strstart-Q.block_start,de),Q.block_start=Q.strstart,O(Q.strm)}function W(Q,de){Q.pending_buf[Q.pending++]=de}function ee(Q,de){Q.pending_buf[Q.pending++]=de>>>8&255,Q.pending_buf[Q.pending++]=255&de}function F(Q,de){var Ae,q,J=Q.max_chain_length,ce=Q.strstart,xe=Q.prev_length,be=Q.nice_match,N=Q.strstart>Q.w_size-$?Q.strstart-(Q.w_size-$):0,j=Q.window,se=Q.w_mask,he=Q.prev,me=Q.strstart+D,G=j[ce+xe-1],R=j[ce+xe];Q.prev_length>=Q.good_match&&(J>>=2),be>Q.lookahead&&(be=Q.lookahead);do if(j[(Ae=de)+xe]===R&&j[Ae+xe-1]===G&&j[Ae]===j[ce]&&j[++Ae]===j[ce+1]){ce+=2,Ae++;do;while(j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&ceN&&--J!=0);return xe<=Q.lookahead?xe:Q.lookahead}function X(Q){var de,Ae,q,J,ce,xe,be,N,j,se,he=Q.w_size;do{if(J=Q.window_size-Q.lookahead-Q.strstart,Q.strstart>=he+(he-$)){for(o.arraySet(Q.window,Q.window,he,he,0),Q.match_start-=he,Q.strstart-=he,Q.block_start-=he,de=Ae=Q.hash_size;q=Q.head[--de],Q.head[de]=he<=q?q-he:0,--Ae;);for(de=Ae=he;q=Q.prev[--de],Q.prev[de]=he<=q?q-he:0,--Ae;);J+=he}if(Q.strm.avail_in===0)break;if(xe=Q.strm,be=Q.window,N=Q.strstart+Q.lookahead,j=J,se=void 0,se=xe.avail_in,j=M)for(ce=Q.strstart-Q.insert,Q.ins_h=Q.window[ce],Q.ins_h=(Q.ins_h<=M&&(Q.ins_h=(Q.ins_h<=M)if(q=a._tr_tally(Q,Q.strstart-Q.match_start,Q.match_length-M),Q.lookahead-=Q.match_length,Q.match_length<=Q.max_lazy_match&&Q.lookahead>=M){for(Q.match_length--;Q.strstart++,Q.ins_h=(Q.ins_h<=M&&(Q.ins_h=(Q.ins_h<=M&&Q.match_length<=Q.prev_length){for(J=Q.strstart+Q.lookahead-M,q=a._tr_tally(Q,Q.strstart-1-Q.prev_match,Q.prev_length-M),Q.lookahead-=Q.prev_length-1,Q.prev_length-=2;++Q.strstart<=J&&(Q.ins_h=(Q.ins_h<Q.pending_buf_size-5&&(Ae=Q.pending_buf_size-5);;){if(Q.lookahead<=1){if(X(Q),Q.lookahead===0&&de===u)return v;if(Q.lookahead===0)break}Q.strstart+=Q.lookahead,Q.lookahead=0;var q=Q.block_start+Ae;if((Q.strstart===0||Q.strstart>=q)&&(Q.lookahead=Q.strstart-q,Q.strstart=q,B(Q,!1),Q.strm.avail_out===0)||Q.strstart-Q.block_start>=Q.w_size-$&&(B(Q,!1),Q.strm.avail_out===0))return v}return Q.insert=0,de===f?(B(Q,!0),Q.strm.avail_out===0?U:P):(Q.strstart>Q.block_start&&(B(Q,!1),Q.strm.avail_out),v)}),new oe(4,4,8,4,ue),new oe(4,5,16,8,ue),new oe(4,6,32,32,ue),new oe(4,4,16,16,le),new oe(8,16,32,32,le),new oe(8,16,128,128,le),new oe(8,32,128,256,le),new oe(32,128,258,1024,le),new oe(32,258,258,4096,le)],i.deflateInit=function(Q,de){return Re(Q,de,y,15,8,0)},i.deflateInit2=Re,i.deflateReset=_e,i.deflateResetKeep=pe,i.deflateSetHeader=function(Q,de){return Q&&Q.state?Q.state.wrap!==2?p:(Q.state.gzhead=de,h):p},i.deflate=function(Q,de){var Ae,q,J,ce;if(!Q||!Q.state||5>8&255),W(q,q.gzhead.time>>16&255),W(q,q.gzhead.time>>24&255),W(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),W(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(W(q,255&q.gzhead.extra.length),W(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(Q.adler=A(Q.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(W(q,0),W(q,0),W(q,0),W(q,0),W(q,0),W(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),W(q,3),q.status=I);else{var xe=y+(q.w_bits-8<<4)<<8;xe|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(xe|=32),xe+=31-xe%31,q.status=I,ee(q,xe),q.strstart!==0&&(ee(q,Q.adler>>>16),ee(q,65535&Q.adler)),Q.adler=1}if(q.status===69)if(q.gzhead.extra){for(J=q.pending;q.gzindex<(65535&q.gzhead.extra.length)&&(q.pending!==q.pending_buf_size||(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending!==q.pending_buf_size));)W(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),q.gzindex===q.gzhead.extra.length&&(q.gzindex=0,q.status=73)}else q.status=73;if(q.status===73)if(q.gzhead.name){J=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),ce===0&&(q.gzindex=0,q.status=91)}else q.status=91;if(q.status===91)if(q.gzhead.comment){J=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),ce===0&&(q.status=103)}else q.status=103;if(q.status===103&&(q.gzhead.hcrc?(q.pending+2>q.pending_buf_size&&O(Q),q.pending+2<=q.pending_buf_size&&(W(q,255&Q.adler),W(q,Q.adler>>8&255),Q.adler=0,q.status=I)):q.status=I),q.pending!==0){if(O(Q),Q.avail_out===0)return q.last_flush=-1,h}else if(Q.avail_in===0&&z(de)<=z(Ae)&&de!==f)return L(Q,-5);if(q.status===666&&Q.avail_in!==0)return L(Q,-5);if(Q.avail_in!==0||q.lookahead!==0||de!==u&&q.status!==666){var be=q.strategy===2?function(N,j){for(var se;;){if(N.lookahead===0&&(X(N),N.lookahead===0)){if(j===u)return v;break}if(N.match_length=0,se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++,se&&(B(N,!1),N.strm.avail_out===0))return v}return N.insert=0,j===f?(B(N,!0),N.strm.avail_out===0?U:P):N.last_lit&&(B(N,!1),N.strm.avail_out===0)?v:E}(q,de):q.strategy===3?function(N,j){for(var se,he,me,G,R=N.window;;){if(N.lookahead<=D){if(X(N),N.lookahead<=D&&j===u)return v;if(N.lookahead===0)break}if(N.match_length=0,N.lookahead>=M&&0N.lookahead&&(N.match_length=N.lookahead)}if(N.match_length>=M?(se=a._tr_tally(N,1,N.match_length-M),N.lookahead-=N.match_length,N.strstart+=N.match_length,N.match_length=0):(se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++),se&&(B(N,!1),N.strm.avail_out===0))return v}return N.insert=0,j===f?(B(N,!0),N.strm.avail_out===0?U:P):N.last_lit&&(B(N,!1),N.strm.avail_out===0)?v:E}(q,de):s[q.level].func(q,de);if(be!==U&&be!==P||(q.status=666),be===v||be===U)return Q.avail_out===0&&(q.last_flush=-1),h;if(be===E&&(de===1?a._tr_align(q):de!==5&&(a._tr_stored_block(q,0,0,!1),de===3&&(K(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),O(Q),Q.avail_out===0))return q.last_flush=-1,h}return de!==f?h:q.wrap<=0?1:(q.wrap===2?(W(q,255&Q.adler),W(q,Q.adler>>8&255),W(q,Q.adler>>16&255),W(q,Q.adler>>24&255),W(q,255&Q.total_in),W(q,Q.total_in>>8&255),W(q,Q.total_in>>16&255),W(q,Q.total_in>>24&255)):(ee(q,Q.adler>>>16),ee(q,65535&Q.adler)),O(Q),0=Ae.w_size&&(ce===0&&(K(Ae.head),Ae.strstart=0,Ae.block_start=0,Ae.insert=0),j=new o.Buf8(Ae.w_size),o.arraySet(j,de,se-Ae.w_size,Ae.w_size,0),de=j,se=Ae.w_size),xe=Q.avail_in,be=Q.next_in,N=Q.input,Q.avail_in=se,Q.next_in=0,Q.input=de,X(Ae);Ae.lookahead>=M;){for(q=Ae.strstart,J=Ae.lookahead-(M-1);Ae.ins_h=(Ae.ins_h<>>=M=b>>>24,w-=M,(M=b>>>16&255)===0)E[c++]=65535&b;else{if(!(16&M)){if(!(64&M)){b=x[(65535&b)+(y&(1<>>=M,w-=M),w<15&&(y+=v[l++]<>>=M=b>>>24,w-=M,!(16&(M=b>>>16&255))){if(!(64&M)){b=_[(65535&b)+(y&(1<>>=M,w-=M,(M=c-u)<$){if(d<(M=$-M)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(I=m,(H=0)===g){if(H+=p-M,M>3,y&=(1<<(w-=D<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(H>>>8&65280)+((65280&H)<<8)+((255&H)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new 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(H){var I;return H&&H.state?(I=H.state,H.total_in=H.total_out=I.total=0,H.msg="",I.wrap&&(H.adler=1&I.wrap),I.mode=p,I.last=0,I.havedict=0,I.dmax=32768,I.head=null,I.hold=0,I.bits=0,I.lencode=I.lendyn=new s.Buf32(d),I.distcode=I.distdyn=new s.Buf32(g),I.sane=1,I.back=-1,f):h}function x(H){var I;return H&&H.state?((I=H.state).wsize=0,I.whave=0,I.wnext=0,w(H)):h}function _(H,I){var v,E;return H&&H.state?(E=H.state,I<0?(v=0,I=-I):(v=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15=P.wsize?(s.arraySet(P.window,I,v-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(E<(U=P.wsize-P.wnext)&&(U=E),s.arraySet(P.window,I,v-E,U,P.wnext),(E-=U)?(s.arraySet(P.window,I,v-E,E,0),P.wnext=E,P.whave=P.wsize):(P.wnext+=U,P.wnext===P.wsize&&(P.wnext=0),P.whave>>8&255,v.check=a(v.check,ce,2,0),B=O=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&O)<<8)+(O>>8))%31){H.msg="incorrect header check",v.mode=30;break}if((15&O)!=8){H.msg="unknown compression method",v.mode=30;break}if(B-=4,Q=8+(15&(O>>>=4)),v.wbits===0)v.wbits=Q;else if(Q>v.wbits){H.msg="invalid window size",v.mode=30;break}v.dmax=1<>8&1),512&v.flags&&(ce[0]=255&O,ce[1]=O>>>8&255,v.check=a(v.check,ce,2,0)),B=O=0,v.mode=3;case 3:for(;B<32;){if(z===0)break e;z--,O+=E[P++]<>>8&255,ce[2]=O>>>16&255,ce[3]=O>>>24&255,v.check=a(v.check,ce,4,0)),B=O=0,v.mode=4;case 4:for(;B<16;){if(z===0)break e;z--,O+=E[P++]<>8),512&v.flags&&(ce[0]=255&O,ce[1]=O>>>8&255,v.check=a(v.check,ce,2,0)),B=O=0,v.mode=5;case 5:if(1024&v.flags){for(;B<16;){if(z===0)break e;z--,O+=E[P++]<>>8&255,v.check=a(v.check,ce,2,0)),B=O=0}else v.head&&(v.head.extra=null);v.mode=6;case 6:if(1024&v.flags&&(z<(F=v.length)&&(F=z),F&&(v.head&&(Q=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),s.arraySet(v.head.extra,E,P,F,Q)),512&v.flags&&(v.check=a(v.check,E,F,P)),z-=F,P+=F,v.length-=F),v.length))break e;v.length=0,v.mode=7;case 7:if(2048&v.flags){if(z===0)break e;for(F=0;Q=E[P+F++],v.head&&Q&&v.length<65536&&(v.head.name+=String.fromCharCode(Q)),Q&&F>9&1,v.head.done=!0),H.adler=v.check=0,v.mode=12;break;case 10:for(;B<32;){if(z===0)break e;z--,O+=E[P++]<>>=7&B,B-=7&B,v.mode=27;break}for(;B<3;){if(z===0)break e;z--,O+=E[P++]<>>=1)){case 0:v.mode=14;break;case 1:if(D(v),v.mode=20,I!==6)break;O>>>=2,B-=2;break e;case 2:v.mode=17;break;case 3:H.msg="invalid block type",v.mode=30}O>>>=2,B-=2;break;case 14:for(O>>>=7&B,B-=7&B;B<32;){if(z===0)break e;z--,O+=E[P++]<>>16^65535)){H.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&O,B=O=0,v.mode=15,I===6)break e;case 15:v.mode=16;case 16:if(F=v.length){if(z>>=5,B-=5,v.ndist=1+(31&O),O>>>=5,B-=5,v.ncode=4+(15&O),O>>>=4,B-=4,286>>=3,B-=3}for(;v.have<19;)v.lens[xe[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,Ae={bits:v.lenbits},de=A(0,v.lens,0,19,v.lencode,0,v.work,Ae),v.lenbits=Ae.bits,de){H.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=le,B-=le,v.lens[v.have++]=re;else{if(re===16){for(q=le+2;B>>=le,B-=le,v.have===0){H.msg="invalid bit length repeat",v.mode=30;break}Q=v.lens[v.have-1],F=3+(3&O),O>>>=2,B-=2}else if(re===17){for(q=le+3;B>>=le)),O>>>=3,B-=3}else{for(q=le+7;B>>=le)),O>>>=7,B-=7}if(v.have+F>v.nlen+v.ndist){H.msg="invalid bit length repeat",v.mode=30;break}for(;F--;)v.lens[v.have++]=Q}}if(v.mode===30)break;if(v.lens[256]===0){H.msg="invalid code -- missing end-of-block",v.mode=30;break}if(v.lenbits=9,Ae={bits:v.lenbits},de=A(c,v.lens,0,v.nlen,v.lencode,0,v.work,Ae),v.lenbits=Ae.bits,de){H.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,Ae={bits:v.distbits},de=A(u,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,Ae),v.distbits=Ae.bits,de){H.msg="invalid distances set",v.mode=30;break}if(v.mode=20,I===6)break e;case 20:v.mode=21;case 21:if(6<=z&&258<=K){H.next_out=L,H.avail_out=K,H.next_in=P,H.avail_in=z,v.hold=O,v.bits=B,l(H,ee),L=H.next_out,U=H.output,K=H.avail_out,P=H.next_in,E=H.input,z=H.avail_in,O=v.hold,B=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;oe=(J=v.lencode[O&(1<>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>pe)])>>>16&255,re=65535&J,!(pe+(le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=pe,B-=pe,v.back+=pe}if(O>>>=le,B-=le,v.back+=le,v.length=re,oe===0){v.mode=26;break}if(32&oe){v.back=-1,v.mode=12;break}if(64&oe){H.msg="invalid literal/length code",v.mode=30;break}v.extra=15&oe,v.mode=22;case 22:if(v.extra){for(q=v.extra;B>>=v.extra,B-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;oe=(J=v.distcode[O&(1<>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>pe)])>>>16&255,re=65535&J,!(pe+(le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=pe,B-=pe,v.back+=pe}if(O>>>=le,B-=le,v.back+=le,64&oe){H.msg="invalid distance code",v.mode=30;break}v.offset=re,v.extra=15&oe,v.mode=24;case 24:if(v.extra){for(q=v.extra;B>>=v.extra,B-=v.extra,v.back+=v.extra}if(v.offset>v.dmax){H.msg="invalid distance too far back",v.mode=30;break}v.mode=25;case 25:if(K===0)break e;if(F=ee-K,v.offset>F){if((F=v.offset-F)>v.whave&&v.sane){H.msg="invalid distance too far back",v.mode=30;break}X=F>v.wnext?(F-=v.wnext,v.wsize-F):v.wnext-F,F>v.length&&(F=v.length),ue=v.window}else ue=U,X=L-v.offset,F=v.length;for(KS?(M=X[ue+g[I]],B[W+g[I]]):(M=96,0),y=1<>L)+(w-=y)]=b<<24|M<<16|D|0,w!==0;);for(y=1<>=1;if(y!==0?(O&=y-1,O+=y):O=0,I++,--ee[H]==0){if(H===E)break;H=u[f+g[I]]}if(U>>7)]}function W(J,ce){J.pending_buf[J.pending++]=255&ce,J.pending_buf[J.pending++]=ce>>>8&255}function ee(J,ce,xe){J.bi_valid>m-xe?(J.bi_buf|=ce<>m-J.bi_valid,J.bi_valid+=xe-m):(J.bi_buf|=ce<>>=1,xe<<=1,0<--ce;);return xe>>>1}function ue(J,ce,xe){var be,N,j=new Array(g+1),se=0;for(be=1;be<=g;be++)j[be]=se=se+xe[be-1]<<1;for(N=0;N<=ce;N++){var he=J[2*N+1];he!==0&&(J[2*N]=X(j[he]++,he))}}function le(J){var ce;for(ce=0;ce>1;1<=xe;xe--)pe(J,j,xe);for(N=me;xe=J.heap[1],J.heap[1]=J.heap[J.heap_len--],pe(J,j,1),be=J.heap[1],J.heap[--J.heap_max]=xe,J.heap[--J.heap_max]=be,j[2*N]=j[2*xe]+j[2*be],J.depth[N]=(J.depth[xe]>=J.depth[be]?J.depth[xe]:J.depth[be])+1,j[2*xe+1]=j[2*be+1]=N,J.heap[1]=N++,pe(J,j,1),2<=J.heap_len;);J.heap[--J.heap_max]=J.heap[1],function(R,T){var V,te,ae,ie,Te,Me,Le=T.dyn_tree,ke=T.max_code,De=T.stat_desc.static_tree,fe=T.stat_desc.has_stree,Ce=T.stat_desc.extra_bits,Se=T.stat_desc.extra_base,Fe=T.stat_desc.max_length,We=0;for(ie=0;ie<=g;ie++)R.bl_count[ie]=0;for(Le[2*R.heap[R.heap_max]+1]=0,V=R.heap_max+1;V>=7;N>>=1)if(1&G&&he.dyn_ltree[2*me]!==0)return o;if(he.dyn_ltree[18]!==0||he.dyn_ltree[20]!==0||he.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(j=J.static_len+3+7>>>3)<=N&&(N=j)):N=j=xe+5,xe+4<=N&&ce!==-1?q(J,ce,xe,be):J.strategy===4||j===N?(ee(J,2+(be?1:0),3),_e(J,$,H)):(ee(J,4+(be?1:0),3),function(he,me,G,R){var T;for(ee(he,me-257,5),ee(he,G-1,5),ee(he,R-4,4),T=0;T>>8&255,J.pending_buf[J.d_buf+2*J.last_lit+1]=255&ce,J.pending_buf[J.l_buf+J.last_lit]=255&xe,J.last_lit++,ce===0?J.dyn_ltree[2*xe]++:(J.matches++,ce--,J.dyn_ltree[2*(v[xe]+u+1)]++,J.dyn_dtree[2*B(ce)]++),J.last_lit===J.lit_bufsize-1},i._tr_align=function(J){ee(J,2,3),F(J,w,$),function(ce){ce.bi_valid===16?(W(ce,ce.bi_buf),ce.bi_buf=0,ce.bi_valid=0):8<=ce.bi_valid&&(ce.pending_buf[ce.pending++]=255&ce.bi_buf,ce.bi_buf>>=8,ce.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,A,c,u,f=1,h={},p=!1,d=o.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(o);g=g&&g.setTimeout?g:o,l={}.toString.call(o.process)==="[object process]"?function(x){process.nextTick(function(){y(x)})}:function(){if(o.postMessage&&!o.importScripts){var x=!0,_=o.onmessage;return o.onmessage=function(){x=!1},o.postMessage("","*"),o.onmessage=_,x}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(x){o.postMessage(u+x,"*")}):o.MessageChannel?((c=new MessageChannel).port1.onmessage=function(x){y(x.data)},function(x){c.port2.postMessage(x)}):d&&"onreadystatechange"in d.createElement("script")?(A=d.documentElement,function(x){var _=d.createElement("script");_.onreadystatechange=function(){y(x),_.onreadystatechange=null,A.removeChild(_),_=null},A.appendChild(_)}):function(x){setTimeout(y,0,x)},g.setImmediate=function(x){typeof x!="function"&&(x=new Function(""+x));for(var _=new Array(arguments.length-1),C=0;C<_.length;C++)_[C]=arguments[C+1];var S={callback:x,args:_};return h[f]=S,l(f),f++},g.clearImmediate=m}function m(x){delete h[x]}function y(x){if(p)setTimeout(y,0,x);else{var _=h[x];if(_){p=!0;try{(function(C){var S=C.callback,b=C.args;switch(b.length){case 0:S();break;case 1:S(b[0]);break;case 2:S(b[0],b[1]);break;case 3:S(b[0],b[1],b[2]);break;default:S.apply(a,b)}})(_)}finally{m(x),p=!1}}}}function w(x){x.source===o&&typeof x.data=="string"&&x.data.indexOf(u)===0&&y(+x.data.slice(u.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof ta<"u"?ta:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(P5);var fhe=P5.exports;const hhe=bl(fhe);class ad{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 hhe;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 A=a.extension!="txt";o.file(a.name+"."+a.extension,a.data,{base64:A})})}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+"")}}}new Z;class dhe{constructor(e){this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager,this.temptime=0}async createLoraData(e,t=null,r="",i){const s=e.manifest,o=e.name?"loraData/"+e.name:"loraData",a=await this._fetchManifest(s),{assetsLocation:l="",animationsDirectory:A="",backgroundGrayscale:c=1,topFrameOffsetPixels:u=64,bottomFrameOffsetPixels:f=64,backgroundDescription:h="",width:p=512,height:d=512,dataCollection:g}=a,m=l+A+"/";this.screenshotManager.setBackground([c,c,c]),this.blinkManager.enableScreenshot(),await this.screenshotManager.calculateBoneOffsets(.2);let y=0;const w=this;if(Array.isArray(g)){const x=t??new ad;await(async()=>{if(Array.isArray(g))for(let C=0;C{const K=[];return ct(U).forEach(B=>{K.push({id:B})}),K},L=U==null?y.characterManager.getTraits(S):P();if(L==null){console.log("SKipping Thumbnail Generation for trait group "+S+", its not present in the character manifest.");continue}const z=wT(b);E?y.screenshotManager.setCameraFrameWithName(E,z):y.screenshotManager.frameShot(M,$,z,D,H);for(let K=0;K{const[e,t]=ye.useState(null),[r,i]=ye.useState(null),[s,o]=ye.useState(null),[a,l]=ye.useState(null),[A,c]=ye.useState(null),[u,f]=ye.useState(null),[h,p]=ye.useState(null),[d,g]=ye.useState(null),[m,y]=ye.useState(null),[w,x]=ye.useState(null),[_,C]=ye.useState(null),[S,b]=ye.useState(!1);let M=!1,[D,$]=ye.useState(!1);ye.useEffect(()=>{if(M||D)return;$(!0),M=!0;const{scene:E,camera:U,controls:P,characterManager:L,sceneElements:z}=uhe("editor-scene");y(U),g(E),t(L),c(z),f(L.animationManager),p(L.lookAtManager),x(P),i(new dhe(L)),o(new phe(L)),l(new mhe(L))},[]);const H=E=>{E==null&&(E=!S),b(E),d.traverse(U=>{U.isMesh&&U.setDebugMode&&U.setDebugMode(E)})};ye.useEffect(()=>{if(_!=null&&_.defaultAnimations){const E=_.defaultAnimations.map(U=>U.location);u.storeDefaultAnimationPaths(E,"")}},[_]);const I=E=>{E?d.add(A):d.remove(A)},v=E=>{w&&(tC.to(w.target,{x:E.targetX??0,y:E.targetY??0,z:E.targetZ??0,duration:1}),tC.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 k.jsx(or.Provider,{value:{manifest:_,setManifest:C,scene:d,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:a,showEnvironmentModels:I,debugMode:S,toggleDebugMode:H,animationManager:u,lookAtManager:h,camera:m,moveCamera:v,controls:w,sceneElements:A},children:n.children})},vhe={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},dt={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",SAVE:"SAVE",MINT:"MINT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},Ui=Y.createContext(),yhe=n=>{const[e,t]=Y.useState(vhe.NORMAL),[r,i]=Y.useState(dt.LANDING),[s,o]=Y.useState(!1),[a,l]=Y.useState(!1);return k.jsx(Ui.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},whe="modulepreload",xhe=function(n){return"/CharacterStudio/"+n},q3={},_he=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=xhe(s),s in q3)return;q3[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const u=i[c];if(u.href===s&&(!o||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const A=document.createElement("link");if(A.rel=o?"stylesheet":whe,o||(A.as="script",A.crossOrigin=""),A.href=s,document.head.appendChild(A),o)return new Promise((c,u)=>{A.addEventListener("load",c),A.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 zw(){return zw=Object.assign||function(n){for(var e=1;e=0)&&(t[i]=n[i]);return t}function Bhe(n){ye.useEffect(n,[])}function Ehe(n,e){e===void 0&&(e={});var t=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,A=t.interrupt,c=A===void 0?!1:A,u=t.onload,f=bhe(t,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),h=Y.useRef(null),p=Y.useRef(!1),d=Y.useState(null),g=d[0],m=d[1],y=Y.useState(null),w=y[0],x=y[1],_=function(){typeof u=="function"&&u.call(this),p.current&&m(this.duration()*1e3),x(this)};Bhe(function(){return _he(()=>import("./howler-1fccfb1e.js").then(D=>D.h),[]).then(function(D){if(!p.current){var $;h.current=($=D.Howl)!==null&&$!==void 0?$:D.default.Howl,p.current=!0,new h.current(zw({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:_},f))}}),function(){p.current=!1}}),Y.useEffect(function(){h.current&&w&&x(new h.current(zw({src:Array.isArray(n)?n:[n],volume:i,onload:_},f)))},[JSON.stringify(n)]),Y.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var C=Y.useCallback(function(D){typeof D>"u"&&(D={}),!(!w||!l&&!D.forceSoundEnabled)&&(c&&w.stop(),D.playbackRate&&w.rate(D.playbackRate),w.play(D.id))},[w,l,c]),S=Y.useCallback(function(D){w&&w.stop(D)},[w]),b=Y.useCallback(function(D){w&&w.pause(D)},[w]),M=[C,{sound:w,stop:S,pause:b,duration:g}];return M}const Che=[{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}],She="/CharacterStudio/assets/sounds-3322d50e.mp3",Ys=ye.createContext(),Mhe=n=>{const e=i=>Che.find(s=>i.test(s.name)),[t]=Ehe(She,{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 k.jsx(Ys.Provider,{value:{playSound:r},children:n.children})};function ks(n){"@babel/helpers - typeof";return ks=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},ks(n)}function Xs(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function The(n,e){if(ks(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(ks(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function D5(n){var e=The(n,"string");return ks(e)=="symbol"?e:e+""}function eP(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,r=new Array(e);t1&&arguments[1]!==void 0?arguments[1]:{};Xs(this,n),this.init(e,t)}return Zs(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||Fhe,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 sP(n,e,t){var r=ET(n,e,Object),i=r.obj,s=r.k;i[s]=t}function Phe(n,e,t,r){var i=ET(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 Gw(n,e){var t=ET(n,e),r=t.obj,i=t.k;if(r)return r[i]}function oP(n,e,t){var r=Gw(n,t);return r!==void 0?r:Gw(e,t)}function Q5(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]):Q5(n[r],e[r],t):n[r]=e[r]);return n}function Zu(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Dhe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Ohe(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return Dhe[e]}):n}var o_=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Nhe=[" ",",","?","!",";"];function khe(n,e,t){e=e||"",t=t||"";var r=Nhe.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 aP(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 _v(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 H5(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 A=r.slice(s+o).join(t);return A?H5(l,A,t):void 0}i=i[r[s]]}return i}}var zhe=function(n){s_(t,n);var e=Qhe(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Xs(this,t),i=e.call(this),o_&&QA.call(IA(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 Zs(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,A=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,c=[i,s];o&&typeof o!="string"&&(c=c.concat(o)),o&&typeof o=="string"&&(c=c.concat(l?o.split(l):o)),i.indexOf(".")>-1&&(c=i.split("."));var u=Gw(this.data,c);return u||!A||typeof o!="string"?u:H5(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},A=this.options.keySeparator;A===void 0&&(A=".");var c=[i,s];o&&(c=c.concat(A?o.split(A):o)),i.indexOf(".")>-1&&(c=i.split("."),a=s,s=c[1]),this.addNamespaces(s),sP(this.data,c,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 A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},c=[i,s];i.indexOf(".")>-1&&(c=i.split("."),a=o,o=s,s=c[1]),this.addNamespaces(s);var u=Gw(this.data,c)||{};a?Q5(u,o,l):u=_v(_v({},u),o),sP(this.data,c,u),A.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"?_v(_v({},{}),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}(QA),z5={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 lP(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 ni(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 AP={},cP=function(n){s_(t,n);var e=Ghe(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Xs(this,t),i=e.call(this),o_&&QA.call(IA(i)),Lhe(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,IA(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=na.create("translator"),i}return Zs(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||[],A=o&&i.indexOf(o)>-1,c=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!khe(i,o,a);if(A&&!c){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(ks(s)!=="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),s||(s={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,A=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,c=this.extractFromKey(i[i.length-1],s),u=c.key,f=c.namespaces,h=f[f.length-1],p=s.lng||this.language,d=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&p.toLowerCase()==="cimode"){if(d){var g=s.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(h).concat(g).concat(u),usedKey:u,exactUsedKey:u,usedLng:p,usedNS:h}:"".concat(h).concat(g).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:p,usedNS:h}:u}var m=this.resolve(i,s),y=m&&m.res,w=m&&m.usedKey||u,x=m&&m.exactUsedKey||u,_=Object.prototype.toString.apply(y),C=["[object Number]","[object Function]","[object RegExp]"],S=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,M=typeof y!="string"&&typeof y!="boolean"&&typeof y!="number";if(b&&y&&M&&C.indexOf(_)<0&&!(typeof S=="string"&&_==="[object Array]")){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var D=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,y,ni(ni({},s),{},{ns:f})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(m.res=D,m):D}if(A){var $=_==="[object Array]",H=$?[]:{},I=$?x:w;for(var v in y)if(Object.prototype.hasOwnProperty.call(y,v)){var E="".concat(I).concat(A).concat(v);H[v]=this.translate(E,ni(ni({},s),{joinArrays:!1,ns:f})),H[v]===E&&(H[v]=y[v])}y=H}}else if(b&&typeof S=="string"&&_==="[object Array]")y=y.join(S),y&&(y=this.extendTranslation(y,i,s,o));else{var U=!1,P=!1,L=s.count!==void 0&&typeof s.count!="string",z=t.hasDefaultValue(s),K=L?this.pluralResolver.getSuffix(p,s.count,s):"",O=s["defaultValue".concat(K)]||s.defaultValue;!this.isValidLookup(y)&&z&&(U=!0,y=O),this.isValidLookup(y)||(P=!0,y=u);var B=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,W=B&&P?void 0:y,ee=z&&O!==y&&this.options.updateMissing;if(P||U||ee){if(this.logger.log(ee?"updateKey":"missingKey",p,h,u,ee?O:y),A){var F=this.resolve(u,ni(ni({},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 X=[],ue=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ue&&ue[0])for(var le=0;le1&&arguments[1]!==void 0?arguments[1]:{},a,l,A,c,u;return typeof i=="string"&&(i=[i]),i.forEach(function(f){if(!s.isValidLookup(a)){var h=s.extractFromKey(f,o),p=h.key;l=p;var d=h.namespaces;s.options.fallbackNS&&(d=d.concat(s.options.fallbackNS));var g=o.count!==void 0&&typeof o.count!="string",m=g&&!o.ordinal&&o.count===0&&s.pluralResolver.shouldUseIntlApi(),y=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);d.forEach(function(x){s.isValidLookup(a)||(u=x,!AP["".concat(w[0],"-").concat(x)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(AP["".concat(w[0],"-").concat(x)]=!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(_){if(!s.isValidLookup(a)){c=_;var C=[p];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(C,p,_,x,o);else{var S;g&&(S=s.pluralResolver.getSuffix(_,o.count,o));var b="".concat(s.options.pluralSeparator,"zero");if(g&&(C.push(p+S),m&&C.push(p+b)),y){var M="".concat(p).concat(s.options.contextSeparator).concat(o.context);C.push(M),g&&(C.push(M+S),m&&C.push(M+b))}}for(var D;D=C.pop();)s.isValidLookup(a)||(A=D,a=s.getResource(_,x,D,o))}}))})}}),{res:a,usedKey:l,exactUsedKey:A,usedLng:c,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}(QA);function pB(n){return n.charAt(0).toUpperCase()+n.slice(1)}var uP=function(){function n(e){Xs(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=na.create("languageUtils")}return Zs(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]=pB(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]=pB(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=pB(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.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(A){A&&(i.isSupportedCode(A)?o.push(A):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(A)))};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}(),jhe=[{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}],Whe={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}},Khe=["v1","v2","v3"],fP={zero:0,one:1,two:2,few:3,many:4,other:5};function $he(){var n={};return jhe.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:Whe[e.fc]}})}),n}var Yhe=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Xs(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=$he()}return Zs(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 fP[o]-fP[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!Khe.includes(this.options.compatibilityJSON)}}]),n}();function hP(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 Ao(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Xs(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 Zs(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:Ohe,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Zu(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Zu(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?Zu(r.nestingPrefix):r.nestingPrefixEscaped||Zu("$t("),this.nestingSuffix=r.nestingSuffix?Zu(r.nestingSuffix):r.nestingSuffixEscaped||Zu(")"),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,A,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(g){return g.replace(/\$/g,"$$$$")}var f=function(m){if(m.indexOf(o.formatSeparator)<0){var y=oP(r,c,m);return o.alwaysFormat?o.format(y,void 0,i,Ao(Ao(Ao({},s),r),{},{interpolationkey:m})):y}var w=m.split(o.formatSeparator),x=w.shift().trim(),_=w.join(o.formatSeparator).trim();return o.format(oP(r,c,x),_,i,Ao(Ao(Ao({},s),r),{},{interpolationkey:x}))};this.resetRegExp();var h=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,p=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,d=[{regex:this.regexpUnescape,safeValue:function(m){return u(m)}},{regex:this.regexp,safeValue:function(m){return o.escapeValue?u(o.escape(m)):u(m)}}];return d.forEach(function(g){for(A=0;a=g.regex.exec(t);){var m=a[1].trim();if(l=f(m),l===void 0)if(typeof h=="function"){var y=h(t,a,s);l=typeof y=="string"?y:""}else if(s&&Object.prototype.hasOwnProperty.call(s,m))l="";else if(p){l=a[0];continue}else o.logger.warn("missed to pass in variable ".concat(m," for interpolating ").concat(t)),l="";else typeof l!="string"&&!o.useRawValueToEscape&&(l=iP(l));var w=g.safeValue(l);if(t=t.replace(a[0],w),p?(g.regex.lastIndex+=l.length,g.regex.lastIndex-=a[0].length):g.regex.lastIndex=0,A++,A>=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 A(h,p){var d=this.nestingOptionsSeparator;if(h.indexOf(d)<0)return h;var g=h.split(new RegExp("".concat(d,"[ ]*{"))),m="{".concat(g[1]);h=g[0],m=this.interpolate(m,l);var y=m.match(/'/g),w=m.match(/"/g);(y&&y.length%2===0&&!w||w.length%2!==0)&&(m=m.replace(/'/g,'"'));try{l=JSON.parse(m),p&&(l=Ao(Ao({},p),l))}catch(x){return this.logger.warn("failed parsing options string in nesting for key ".concat(h),x),"".concat(h).concat(d).concat(m)}return delete l.defaultValue,h}for(;o=this.nestingRegexp.exec(t);){var c=[];l=Ao({},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(),c=f,u=!0}if(a=r(A.call(this,o[1].trim(),l),l),a&&o[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=iP(a)),a||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),a=""),u&&(a=c.reduce(function(h,p){return i.format(h,p,s.lng,Ao(Ao({},s),{},{interpolationkey:o[1].trim()}))},a.trim())),t=t.replace(o[0],a),this.regexp.lastIndex=0}return t}}]),n}();function dP(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 Ha(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=Rhe(a),A=l[0],c=l.slice(1),u=c.join(":").trim().replace(/^'+|'+$/g,"");t[A.trim()]||(t[A.trim()]=u),u==="false"&&(t[A.trim()]=!1),u==="true"&&(t[A.trim()]=!0),isNaN(u)||(t[A.trim()]=parseInt(u,10))}})}}return{formatName:e,formatOptions:t}}function Ju(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 Jhe=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xs(this,n),this.logger=na.create("formatter"),this.options=e,this.formats={number:Ju(function(t,r){var i=new Intl.NumberFormat(t,Ha({},r));return function(s){return i.format(s)}}),currency:Ju(function(t,r){var i=new Intl.NumberFormat(t,Ha(Ha({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:Ju(function(t,r){var i=new Intl.DateTimeFormat(t,Ha({},r));return function(s){return i.format(s)}}),relativetime:Ju(function(t,r){var i=new Intl.RelativeTimeFormat(t,Ha({},r));return function(s){return i.format(s,r.range||"day")}}),list:Ju(function(t,r){var i=new Intl.ListFormat(t,Ha({},r));return function(s){return i.format(s)}})},this.init(e)}return Zs(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()]=Ju(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(A,c){var u=Zhe(c),f=u.formatName,h=u.formatOptions;if(s.formats[f]){var p=A;try{var d=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},g=d.locale||d.lng||o.locale||o.lng||i;p=s.formats[f](A,g,Ha(Ha(Ha({},h),o),d))}catch(m){s.logger.warn(m)}return p}else s.logger.warn("there was no format function for ".concat(f));return A},t);return l}}]),n}();function pP(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 mP(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 tde(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var nde=function(n){s_(t,n);var e=qhe(t);function t(r,i,s){var o,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Xs(this,t),o=e.call(this),o_&&QA.call(IA(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 Zs(t,[{key:"queueLoad",value:function(i,s,o,a){var l=this,A={},c={},u={},f={};return i.forEach(function(h){var p=!0;s.forEach(function(d){var g="".concat(h,"|").concat(d);!o.reload&&l.store.hasResourceBundle(h,d)?l.state[g]=2:l.state[g]<0||(l.state[g]===1?c[g]===void 0&&(c[g]=!0):(l.state[g]=1,p=!1,c[g]===void 0&&(c[g]=!0),A[g]===void 0&&(A[g]=!0),f[d]===void 0&&(f[d]=!0)))}),p||(u[h]=!0)}),(Object.keys(A).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(A),pending:Object.keys(c),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(f)}}},{key:"loaded",value:function(i,s,o){var a=i.split("|"),l=a[0],A=a[1];s&&this.emit("failedLoading",l,A,s),o&&this.store.addResourceBundle(l,A,o),this.state[i]=s?-1:2;var c={};this.queue.forEach(function(u){Phe(u.loaded,[l],A),tde(u,i),s&&u.errors.push(s),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(f){c[f]||(c[f]={});var h=u.loaded[f];h.length&&h.forEach(function(p){c[f][p]===void 0&&(c[f][p]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",c),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,A=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,c=arguments.length>5?arguments[5]:void 0;if(!i.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:s,fcName:o,tried:l,wait:A,callback:c});return}this.readingCalls++;var u=function(d,g){if(a.readingCalls--,a.waitingReads.length>0){var m=a.waitingReads.shift();a.read(m.lng,m.ns,m.fcName,m.tried,m.wait,m.callback)}if(d&&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 A=this.queueLoad(i,s,a,l);if(!A.toLoad.length)return A.pending.length||l(),null;A.toLoad.forEach(function(c){o.loadOne(c)})}},{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],A=a[1];this.read(l,A,"read",void 0,void 0,function(c,u){c&&s.logger.warn("".concat(o,"loading namespace ").concat(A," for language ").concat(l," failed"),c),!c&&u&&s.logger.log("".concat(o,"loaded namespace ").concat(A," for language ").concat(l),u),s.loaded(i,c,u)})}},{key:"saveMissing",value:function(i,s,o,a,l){var A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=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=mP(mP({},A),{},{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(p){return c(null,p)}).catch(c):c(null,h)}catch(p){c(p)}else f(i,s,o,a,c,u)}!i||!i[0]||this.store.addResource(i[0],s,o,a)}}}]),t}(QA);function gP(){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(ks(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),ks(e[2])==="object"||ks(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 vP(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 yP(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;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 bv(){}function sde(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var Vw=function(n){s_(t,n);var e=rde(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(Xs(this,t),r=e.call(this),o_&&QA.call(IA(r)),r.options=vP(i),r.services={},r.logger=na,r.modules={external:[]},sde(IA(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),Eg(r,IA(r));setTimeout(function(){r.init(i,s)},0)}return r}return Zs(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=gP();this.options=Oo(Oo(Oo({},a),this.options),vP(s)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=Oo(Oo({},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(m){return m?typeof m=="function"?new m:m:null}if(!this.options.isClone){this.modules.logger?na.init(l(this.modules.logger),this.options):na.init(null,this.options);var A;this.modules.formatter?A=this.modules.formatter:typeof Intl<"u"&&(A=Jhe);var c=new uP(this.options);this.store=new zhe(this.options.resources,this.options);var u=this.services;u.logger=na,u.resourceStore=this.store,u.languageUtils=c,u.pluralResolver=new Yhe(c,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),A&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(u.formatter=l(A),u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new Xhe(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new nde(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(m){for(var y=arguments.length,w=new Array(y>1?y-1:0),x=1;x1?y-1:0),x=1;x0&&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(m){i[m]=function(){var y;return(y=i.store)[m].apply(y,arguments)}});var p=["addResource","addResources","addResourceBundle","removeResourceBundle"];p.forEach(function(m){i[m]=function(){var y;return(y=i.store)[m].apply(y,arguments),i}});var d=op(),g=function(){var y=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),d.resolve(_),o(x,_)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return y(null,i.t.bind(i));i.changeLanguage(i.options.lng,y)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),d}},{key:"loadResources",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:bv,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 A=[],c=function(h){if(h){var p=s.services.languageUtils.toResolveHierarchy(h);p.forEach(function(d){A.indexOf(d)<0&&A.push(d)})}};if(l)c(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(f){return c(f)})}this.options.preload&&this.options.preload.forEach(function(f){return c(f)}),this.services.backendConnector.load(A,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=op();return i||(i=this.languages),s||(s=this.options.ns),o||(o=bv),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"&&z5.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=op();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)},A=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)})},c=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(p){A(p,h)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(i),a}},{key:"getFixedT",value:function(i,s,o){var a=this,l=function A(c,u){var f;if(ks(u)!=="object"){for(var h=arguments.length,p=new Array(h>2?h-2:0),d=2;d1&&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=this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,A=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var c=function(h,p){var d=s.services.backendConnector.state["".concat(h,"|").concat(p)];return d===-1||d===2};if(o.precheck){var u=o.precheck(this,c);if(u!==void 0)return u}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(a,i)&&(!l||c(A,i)))}},{key:"loadNamespaces",value:function(i,s){var o=this,a=op();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=op();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(A){return a.indexOf(A)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(A){o.resolve(),s&&s(A)}),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 uP(gP());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]:bv,a=Oo(Oo(Oo({},this.options),s),{isClone:!0}),l=new t(a);(s.debug!==void 0||s.prefix!==void 0)&&(l.logger=l.logger.clone(s));var A=["store","services","language"];return A.forEach(function(c){l[c]=i[c]}),l.services=Oo({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new cP(l.services,l.options),l.translator.on("*",function(c){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 Vw(n,e)});var qr=Vw.createInstance();qr.createInstance=Vw.createInstance;qr.createInstance;qr.dir;qr.init;qr.loadResources;qr.reloadResources;qr.use;qr.changeLanguage;qr.getFixedT;qr.t;qr.exists;qr.setDefaultNamespace;qr.hasLoadedNamespace;qr.loadNamespaces;qr.loadLanguages;function ode(){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,A){var c=e.services.backendConnector.state["".concat(l,"|").concat(A)];return c===-1||c===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 lde(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return JC("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(n,{precheck:function(s,o){if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!o(s.isLanguageChangingTo,n))return!1}}):ade(n,e,t)}var Ade=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,cde={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},ude=function(e){return cde[e]},fde=function(e){return e.replace(Ade,ude)};function _P(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 bP(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};qC=bP(bP({},qC),n)}function dde(){return qC}var G5;function pde(n){G5=n}function mde(){return G5}var gde={type:"3rdParty",init:function(e){hde(e.options.react),pde(e)}},vde=ye.createContext(),yde=function(){function n(){Xs(this,n),this.usedNamespaces={}}return Zs(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 wde(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,A=!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(c){A=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(A)throw i}}return a}}function xde(n,e){return O5(n)||wde(n,e)||N5(n,e)||k5()}function BP(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 mB(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=ye.useContext(vde)||{},i=r.i18n,s=r.defaultNS,o=t||i||mde();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new yde),!o){JC("You will need to pass in an i18next instance by using initReactI18next");var a=function(M,D){return typeof D=="string"?D:D&&ks(D)==="object"&&typeof D.defaultValue=="string"?D.defaultValue:Array.isArray(M)?M[M.length-1]:M},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}o.options.react&&o.options.react.wait!==void 0&&JC("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var A=mB(mB(mB({},dde()),o.options.react),e),c=A.useSuspense,u=A.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(b){return lde(b,o,A)});function p(){return o.getFixedT(null,A.nsMode==="fallback"?f:f[0],u)}var d=ye.useState(p),g=xde(d,2),m=g[0],y=g[1],w=f.join(),x=_de(w),_=ye.useRef(!0);ye.useEffect(function(){var b=A.bindI18n,M=A.bindI18nStore;_.current=!0,!h&&!c&&xP(o,f,function(){_.current&&y(p)}),h&&x&&x!==w&&_.current&&y(p);function D(){_.current&&y(p)}return b&&o&&o.on(b,D),M&&o&&o.store.on(M,D),function(){_.current=!1,b&&o&&b.split(" ").forEach(function($){return o.off($,D)}),M&&o&&M.split(" ").forEach(function($){return o.store.off($,D)})}},[o,w]);var C=ye.useRef(!0);ye.useEffect(function(){_.current&&!C.current&&y(p),C.current=!1},[o,u]);var S=[m,o,h];if(S.t=m,S.i18n=o,S.ready=h,h||!h&&!c)return S;throw new Promise(function(b){xP(o,f,function(){b()})})}var V5=[],Bde=V5.forEach,Ede=V5.slice;function Cde(n){return Bde.call(Ede.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var EP=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Sde=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(!EP.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!EP.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},CP={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=Sde(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}},ap=null,SP=function(){if(ap!==null)return ap;try{ap=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{ap=!1}return ap},Ide={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&SP()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&SP()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},lp=null,MP=function(){if(lp!==null)return lp;try{lp=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{lp=!1}return lp},Rde={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&MP()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&MP()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Fde={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},Ude={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}},Lde={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}},Pde={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 Dde(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var j5=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Xs(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return Zs(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,this.options=Cde(r,this.options||{},Dde()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(Mde),this.addDetector(Tde),this.addDetector(Ide),this.addDetector(Rde),this.addDetector(Fde),this.addDetector(Ude),this.addDetector(Lde),this.addDetector(Pde)}},{key:"addDetector",value:function(t){this.detectors[t.name]=t}},{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))}}),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}();j5.type="languageDetector";const Ode={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!"}}},Nde={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 генерации голоса временно отключен на техническое обслуживание."}}},kde={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暂时关闭进行维护!"}}},Qde={en:Ode,ru:Nde,zh:kde};qr.use(j5).use(gde).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:Qde});const To=ye.createContext(),Hde=n=>{const{t:e}=bde();return k.jsx(To.Provider,{value:{t:e},children:n.children})},zde=` +*/(function(n,e){(function(t){n.exports=t()})(function(){return function t(r,i,s){function o(A,c){if(!i[A]){if(!r[A]){var u=typeof _v=="function"&&_v;if(!c&&u)return u(A,!0);if(a)return a(A,!0);var f=new Error("Cannot find module '"+A+"'");throw f.code="MODULE_NOT_FOUND",f}var h=i[A]={exports:{}};r[A][0].call(h.exports,function(p){var d=r[A][1][p];return o(d||p)},h,h.exports,t,r,i,s)}return i[A].exports}for(var a=typeof _v=="function"&&_v,l=0;l>2,h=(3&A)<<4|c>>4,p=1>6:64,d=2>4,c=(15&f)<<4|(h=a.indexOf(l.charAt(d++)))>>2,u=(3&h)<<6|(p=a.indexOf(l.charAt(d++))),y[g++]=A,h!==64&&(y[g++]=c),p!==64&&(y[g++]=u);return y}},{"./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 A(c,u,f,h,p){this.compressedSize=c,this.uncompressedSize=u,this.crc32=f,this.compression=h,this.compressedContent=p}A.prototype={getContentWorker:function(){var c=new o(s.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new l("data_length")),u=this;return c.on("end",function(){if(this.streamInfo.data_length!==u.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),c},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)}},A.createWorkerFrom=function(c,u,f){return c.pipe(new a).pipe(new l("uncompressedSize")).pipe(u.compressWorker(f)).pipe(new l("compressedSize")).withStreamInfo("compression",u)},r.exports=A},{"./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=[],A=0;A<256;A++){a=A;for(var c=0;c<8;c++)a=1&a?3988292384^a>>>1:a>>>1;l[A]=a}return l}();r.exports=function(a,l){return a!==void 0&&a.length?s.getTypeOf(a)!=="string"?function(A,c,u,f){var h=o,p=f+u;A^=-1;for(var d=f;d>>8^h[255&(A^c[d])];return-1^A}(0|l,a,a.length,0):function(A,c,u,f){var h=o,p=f+u;A^=-1;for(var d=f;d>>8^h[255&(A^c.charCodeAt(d))];return-1^A}(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"),A=s?"uint8array":"array";function c(u,f){l.call(this,"FlateWorker/"+u),this._pako=null,this._pakoAction=u,this._pakoOptions=f,this.meta={}}i.magic="\b\0",a.inherits(c,l),c.prototype.processChunk=function(u){this.meta=u.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(A,u.data),!1)},c.prototype.flush=function(){l.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new 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 c("Deflate",u)},i.uncompressWorker=function(){return new c("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(t,r,i){function s(h,p){var d,g="";for(d=0;d>>=8;return g}function o(h,p,d,g,m,y){var w,x,_=h.file,C=h.compression,S=y!==A.utf8encode,b=a.transformTo("string",y(_.name)),M=a.transformTo("string",A.utf8encode(_.name)),D=_.comment,$=a.transformTo("string",y(D)),H=a.transformTo("string",A.utf8encode(D)),I=M.length!==_.name.length,v=H.length!==D.length,E="",U="",P="",L=_.dir,z=_.date,K={crc32:0,compressedSize:0,uncompressedSize:0};p&&!d||(K.crc32=h.crc32,K.compressedSize=h.compressedSize,K.uncompressedSize=h.uncompressedSize);var O=0;p&&(O|=8),S||!I&&!v||(O|=2048);var B=0,W=0;L&&(B|=16),m==="UNIX"?(W=798,B|=function(F,X){var ue=F;return F||(ue=X?16893:33204),(65535&ue)<<16}(_.unixPermissions,L)):(W=20,B|=function(F){return 63&(F||0)}(_.dosPermissions)),w=z.getUTCHours(),w<<=6,w|=z.getUTCMinutes(),w<<=5,w|=z.getUTCSeconds()/2,x=z.getUTCFullYear()-1980,x<<=4,x|=z.getUTCMonth()+1,x<<=5,x|=z.getUTCDate(),I&&(U=s(1,1)+s(c(b),4)+M,E+="up"+s(U.length,2)+U),v&&(P=s(1,1)+s(c($),4)+H,E+="uc"+s(P.length,2)+P);var ee="";return ee+=` +\0`,ee+=s(O,2),ee+=C.magic,ee+=s(w,2),ee+=s(x,2),ee+=s(K.crc32,4),ee+=s(K.compressedSize,4),ee+=s(K.uncompressedSize,4),ee+=s(b.length,2),ee+=s(E.length,2),{fileRecord:u.LOCAL_FILE_HEADER+ee+b+E,dirRecord:u.CENTRAL_FILE_HEADER+s(W,2)+ee+s($.length,2)+"\0\0\0\0"+s(B,4)+s(g,4)+b+E+$}}var a=t("../utils"),l=t("../stream/GenericWorker"),A=t("../utf8"),c=t("../crc32"),u=t("../signature");function f(h,p,d,g){l.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=p,this.zipPlatform=d,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 p=h.meta.percent||0,d=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:d?(p+100*(d-g-1))/d:100}}))},f.prototype.openedSource=function(h){this.currentSourceOffset=this.bytesWritten,this.currentFile=h.file.name;var p=this.streamFiles&&!h.file.dir;if(p){var d=o(h,p,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:d.fileRecord,meta:{percent:0}})}else this.accumulate=!0},f.prototype.closedSource=function(h){this.accumulate=!1;var p=this.streamFiles&&!h.file.dir,d=o(h,p,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(d.dirRecord),p)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:d.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},f.prototype.flush=function(){for(var h=this.bytesWritten,p=0;p=this.index;l--)A=(A<<8)+this.byteAt(l);return this.index+=a,A},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"),A=t("./NodeBufferReader"),c=t("./Uint8ArrayReader");r.exports=function(u){var f=s.getTypeOf(u);return s.checkSupport(f),f!=="string"||o.uint8array?f==="nodebuffer"?new A(u):o.uint8array?new c(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 A=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=A+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 A=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,l.then(function(c){A.dataIsReady=!0,A.data=c,A.max=c&&c.length||0,A.type=s.getTypeOf(c),A.isPaused||A._tickAndRepeat()},function(c){A.error(c)})}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,A=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,A);break;case"uint8array":l=this.data.subarray(this.index,A);break;case"array":case"nodebuffer":l=this.data.slice(this.index,A)}return this.index=A,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"),A=t("../support"),c=t("../external"),u=null;if(A.nodestream)try{u=t("../nodejs/NodejsStreamOutputAdapter")}catch{}function f(p,d){return new c.Promise(function(g,m){var y=[],w=p._internalType,x=p._outputType,_=p._mimeType;p.on("data",function(C,S){y.push(C),d&&d(S)}).on("error",function(C){y=[],m(C)}).on("end",function(){try{var C=function(S,b,M){switch(S){case"blob":return s.newBlob(s.transformTo("arraybuffer",b),M);case"base64":return l.encode(b);default:return s.transformTo(S,b)}}(x,function(S,b){var M,D=0,$=null,H=0;for(M=0;M"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"),A=new Array(256),c=0;c<256;c++)A[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;A[254]=A[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(p){var d,g,m,y,w,x=p.length,_=0;for(y=0;y>>6:(g<65536?d[w++]=224|g>>>12:(d[w++]=240|g>>>18,d[w++]=128|g>>>12&63),d[w++]=128|g>>>6&63),d[w++]=128|63&g);return d}(h)},i.utf8decode=function(h){return o.nodebuffer?s.transformTo("nodebuffer",h).toString("utf-8"):function(p){var d,g,m,y,w=p.length,x=new Array(2*w);for(d=g=0;d>10&1023,x[g++]=56320|1023&m)}return x.length!==g&&(x.subarray?x=x.subarray(0,g):x.length=g),s.applyFromCharCode(x)}(h=s.transformTo(o.uint8array?"uint8array":"array",h))},s.inherits(u,l),u.prototype.processChunk=function(h){var p=s.transformTo(o.uint8array?"uint8array":"array",h.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var d=p;(p=new Uint8Array(d.length+this.leftOver.length)).set(this.leftOver,0),p.set(d,this.leftOver.length)}else p=this.leftOver.concat(p);this.leftOver=null}var g=function(y,w){var x;for((w=w||y.length)>y.length&&(w=y.length),x=w-1;0<=x&&(192&y[x])==128;)x--;return x<0||x===0?w:x+A[y[x]]>w?x:w}(p),m=p;g!==p.length&&(o.uint8array?(m=p.subarray(0,g),this.leftOver=p.subarray(g,p.length)):(m=p.slice(0,g),this.leftOver=p.slice(g,p.length))),this.push({data:i.utf8decode(m),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 A(d){return d}function c(d,g){for(var m=0;m>8;this.dir=!!(16&this.externalFileAttributes),h==0&&(this.dosPermissions=63&this.externalFileAttributes),h==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var h=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 p,d,g,m=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 c(u,u.length)},i.binstring2buf=function(u){for(var f=new s.Buf8(u.length),h=0,p=f.length;h>10&1023,y[p++]=56320|1023&d)}return c(y,p)},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 A=65535&s|0,c=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,A){var c=s,u=A+l;o^=-1;for(var f=A;f>>8^c[255&(o^a[f])];return-1^o}},{}],46:[function(t,r,i){var s,o=t("../utils/common"),a=t("./trees"),l=t("./adler32"),A=t("./crc32"),c=t("./messages"),u=0,f=4,h=0,p=-2,d=-1,g=4,m=2,y=8,w=9,x=286,_=30,C=19,S=2*x+1,b=15,M=3,D=258,$=D+M+1,H=42,I=113,v=1,E=2,U=3,P=4;function L(Q,de){return Q.msg=c[de],de}function z(Q){return(Q<<1)-(4Q.avail_out&&(Ae=Q.avail_out),Ae!==0&&(o.arraySet(Q.output,de.pending_buf,de.pending_out,Ae,Q.next_out),Q.next_out+=Ae,de.pending_out+=Ae,Q.total_out+=Ae,Q.avail_out-=Ae,de.pending-=Ae,de.pending===0&&(de.pending_out=0))}function B(Q,de){a._tr_flush_block(Q,0<=Q.block_start?Q.block_start:-1,Q.strstart-Q.block_start,de),Q.block_start=Q.strstart,O(Q.strm)}function W(Q,de){Q.pending_buf[Q.pending++]=de}function ee(Q,de){Q.pending_buf[Q.pending++]=de>>>8&255,Q.pending_buf[Q.pending++]=255&de}function F(Q,de){var Ae,q,J=Q.max_chain_length,ce=Q.strstart,xe=Q.prev_length,be=Q.nice_match,N=Q.strstart>Q.w_size-$?Q.strstart-(Q.w_size-$):0,j=Q.window,se=Q.w_mask,he=Q.prev,me=Q.strstart+D,G=j[ce+xe-1],R=j[ce+xe];Q.prev_length>=Q.good_match&&(J>>=2),be>Q.lookahead&&(be=Q.lookahead);do if(j[(Ae=de)+xe]===R&&j[Ae+xe-1]===G&&j[Ae]===j[ce]&&j[++Ae]===j[ce+1]){ce+=2,Ae++;do;while(j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&j[++ce]===j[++Ae]&&ceN&&--J!=0);return xe<=Q.lookahead?xe:Q.lookahead}function X(Q){var de,Ae,q,J,ce,xe,be,N,j,se,he=Q.w_size;do{if(J=Q.window_size-Q.lookahead-Q.strstart,Q.strstart>=he+(he-$)){for(o.arraySet(Q.window,Q.window,he,he,0),Q.match_start-=he,Q.strstart-=he,Q.block_start-=he,de=Ae=Q.hash_size;q=Q.head[--de],Q.head[de]=he<=q?q-he:0,--Ae;);for(de=Ae=he;q=Q.prev[--de],Q.prev[de]=he<=q?q-he:0,--Ae;);J+=he}if(Q.strm.avail_in===0)break;if(xe=Q.strm,be=Q.window,N=Q.strstart+Q.lookahead,j=J,se=void 0,se=xe.avail_in,j=M)for(ce=Q.strstart-Q.insert,Q.ins_h=Q.window[ce],Q.ins_h=(Q.ins_h<=M&&(Q.ins_h=(Q.ins_h<=M)if(q=a._tr_tally(Q,Q.strstart-Q.match_start,Q.match_length-M),Q.lookahead-=Q.match_length,Q.match_length<=Q.max_lazy_match&&Q.lookahead>=M){for(Q.match_length--;Q.strstart++,Q.ins_h=(Q.ins_h<=M&&(Q.ins_h=(Q.ins_h<=M&&Q.match_length<=Q.prev_length){for(J=Q.strstart+Q.lookahead-M,q=a._tr_tally(Q,Q.strstart-1-Q.prev_match,Q.prev_length-M),Q.lookahead-=Q.prev_length-1,Q.prev_length-=2;++Q.strstart<=J&&(Q.ins_h=(Q.ins_h<Q.pending_buf_size-5&&(Ae=Q.pending_buf_size-5);;){if(Q.lookahead<=1){if(X(Q),Q.lookahead===0&&de===u)return v;if(Q.lookahead===0)break}Q.strstart+=Q.lookahead,Q.lookahead=0;var q=Q.block_start+Ae;if((Q.strstart===0||Q.strstart>=q)&&(Q.lookahead=Q.strstart-q,Q.strstart=q,B(Q,!1),Q.strm.avail_out===0)||Q.strstart-Q.block_start>=Q.w_size-$&&(B(Q,!1),Q.strm.avail_out===0))return v}return Q.insert=0,de===f?(B(Q,!0),Q.strm.avail_out===0?U:P):(Q.strstart>Q.block_start&&(B(Q,!1),Q.strm.avail_out),v)}),new oe(4,4,8,4,ue),new oe(4,5,16,8,ue),new oe(4,6,32,32,ue),new oe(4,4,16,16,le),new oe(8,16,32,32,le),new oe(8,16,128,128,le),new oe(8,32,128,256,le),new oe(32,128,258,1024,le),new oe(32,258,258,4096,le)],i.deflateInit=function(Q,de){return Re(Q,de,y,15,8,0)},i.deflateInit2=Re,i.deflateReset=_e,i.deflateResetKeep=pe,i.deflateSetHeader=function(Q,de){return Q&&Q.state?Q.state.wrap!==2?p:(Q.state.gzhead=de,h):p},i.deflate=function(Q,de){var Ae,q,J,ce;if(!Q||!Q.state||5>8&255),W(q,q.gzhead.time>>16&255),W(q,q.gzhead.time>>24&255),W(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),W(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(W(q,255&q.gzhead.extra.length),W(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(Q.adler=A(Q.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(W(q,0),W(q,0),W(q,0),W(q,0),W(q,0),W(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),W(q,3),q.status=I);else{var xe=y+(q.w_bits-8<<4)<<8;xe|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(xe|=32),xe+=31-xe%31,q.status=I,ee(q,xe),q.strstart!==0&&(ee(q,Q.adler>>>16),ee(q,65535&Q.adler)),Q.adler=1}if(q.status===69)if(q.gzhead.extra){for(J=q.pending;q.gzindex<(65535&q.gzhead.extra.length)&&(q.pending!==q.pending_buf_size||(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending!==q.pending_buf_size));)W(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),q.gzindex===q.gzhead.extra.length&&(q.gzindex=0,q.status=73)}else q.status=73;if(q.status===73)if(q.gzhead.name){J=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),ce===0&&(q.gzindex=0,q.status=91)}else q.status=91;if(q.status===91)if(q.gzhead.comment){J=q.pending;do{if(q.pending===q.pending_buf_size&&(q.gzhead.hcrc&&q.pending>J&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),O(Q),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(Q.adler=A(Q.adler,q.pending_buf,q.pending-J,J)),ce===0&&(q.status=103)}else q.status=103;if(q.status===103&&(q.gzhead.hcrc?(q.pending+2>q.pending_buf_size&&O(Q),q.pending+2<=q.pending_buf_size&&(W(q,255&Q.adler),W(q,Q.adler>>8&255),Q.adler=0,q.status=I)):q.status=I),q.pending!==0){if(O(Q),Q.avail_out===0)return q.last_flush=-1,h}else if(Q.avail_in===0&&z(de)<=z(Ae)&&de!==f)return L(Q,-5);if(q.status===666&&Q.avail_in!==0)return L(Q,-5);if(Q.avail_in!==0||q.lookahead!==0||de!==u&&q.status!==666){var be=q.strategy===2?function(N,j){for(var se;;){if(N.lookahead===0&&(X(N),N.lookahead===0)){if(j===u)return v;break}if(N.match_length=0,se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++,se&&(B(N,!1),N.strm.avail_out===0))return v}return N.insert=0,j===f?(B(N,!0),N.strm.avail_out===0?U:P):N.last_lit&&(B(N,!1),N.strm.avail_out===0)?v:E}(q,de):q.strategy===3?function(N,j){for(var se,he,me,G,R=N.window;;){if(N.lookahead<=D){if(X(N),N.lookahead<=D&&j===u)return v;if(N.lookahead===0)break}if(N.match_length=0,N.lookahead>=M&&0N.lookahead&&(N.match_length=N.lookahead)}if(N.match_length>=M?(se=a._tr_tally(N,1,N.match_length-M),N.lookahead-=N.match_length,N.strstart+=N.match_length,N.match_length=0):(se=a._tr_tally(N,0,N.window[N.strstart]),N.lookahead--,N.strstart++),se&&(B(N,!1),N.strm.avail_out===0))return v}return N.insert=0,j===f?(B(N,!0),N.strm.avail_out===0?U:P):N.last_lit&&(B(N,!1),N.strm.avail_out===0)?v:E}(q,de):s[q.level].func(q,de);if(be!==U&&be!==P||(q.status=666),be===v||be===U)return Q.avail_out===0&&(q.last_flush=-1),h;if(be===E&&(de===1?a._tr_align(q):de!==5&&(a._tr_stored_block(q,0,0,!1),de===3&&(K(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),O(Q),Q.avail_out===0))return q.last_flush=-1,h}return de!==f?h:q.wrap<=0?1:(q.wrap===2?(W(q,255&Q.adler),W(q,Q.adler>>8&255),W(q,Q.adler>>16&255),W(q,Q.adler>>24&255),W(q,255&Q.total_in),W(q,Q.total_in>>8&255),W(q,Q.total_in>>16&255),W(q,Q.total_in>>24&255)):(ee(q,Q.adler>>>16),ee(q,65535&Q.adler)),O(Q),0=Ae.w_size&&(ce===0&&(K(Ae.head),Ae.strstart=0,Ae.block_start=0,Ae.insert=0),j=new o.Buf8(Ae.w_size),o.arraySet(j,de,se-Ae.w_size,Ae.w_size,0),de=j,se=Ae.w_size),xe=Q.avail_in,be=Q.next_in,N=Q.input,Q.avail_in=se,Q.next_in=0,Q.input=de,X(Ae);Ae.lookahead>=M;){for(q=Ae.strstart,J=Ae.lookahead-(M-1);Ae.ins_h=(Ae.ins_h<>>=M=b>>>24,w-=M,(M=b>>>16&255)===0)E[c++]=65535&b;else{if(!(16&M)){if(!(64&M)){b=x[(65535&b)+(y&(1<>>=M,w-=M),w<15&&(y+=v[l++]<>>=M=b>>>24,w-=M,!(16&(M=b>>>16&255))){if(!(64&M)){b=_[(65535&b)+(y&(1<>>=M,w-=M,(M=c-u)<$){if(d<(M=$-M)&&a.sane){s.msg="invalid distance too far back",a.mode=30;break e}if(I=m,(H=0)===g){if(H+=p-M,M>3,y&=(1<<(w-=D<<3))-1,s.next_in=l,s.next_out=c,s.avail_in=l>>24&255)+(H>>>8&65280)+((65280&H)<<8)+((255&H)<<24)}function y(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new 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(H){var I;return H&&H.state?(I=H.state,H.total_in=H.total_out=I.total=0,H.msg="",I.wrap&&(H.adler=1&I.wrap),I.mode=p,I.last=0,I.havedict=0,I.dmax=32768,I.head=null,I.hold=0,I.bits=0,I.lencode=I.lendyn=new s.Buf32(d),I.distcode=I.distdyn=new s.Buf32(g),I.sane=1,I.back=-1,f):h}function x(H){var I;return H&&H.state?((I=H.state).wsize=0,I.whave=0,I.wnext=0,w(H)):h}function _(H,I){var v,E;return H&&H.state?(E=H.state,I<0?(v=0,I=-I):(v=1+(I>>4),I<48&&(I&=15)),I&&(I<8||15=P.wsize?(s.arraySet(P.window,I,v-P.wsize,P.wsize,0),P.wnext=0,P.whave=P.wsize):(E<(U=P.wsize-P.wnext)&&(U=E),s.arraySet(P.window,I,v-E,U,P.wnext),(E-=U)?(s.arraySet(P.window,I,v-E,E,0),P.wnext=E,P.whave=P.wsize):(P.wnext+=U,P.wnext===P.wsize&&(P.wnext=0),P.whave>>8&255,v.check=a(v.check,ce,2,0),B=O=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&O)<<8)+(O>>8))%31){H.msg="incorrect header check",v.mode=30;break}if((15&O)!=8){H.msg="unknown compression method",v.mode=30;break}if(B-=4,Q=8+(15&(O>>>=4)),v.wbits===0)v.wbits=Q;else if(Q>v.wbits){H.msg="invalid window size",v.mode=30;break}v.dmax=1<>8&1),512&v.flags&&(ce[0]=255&O,ce[1]=O>>>8&255,v.check=a(v.check,ce,2,0)),B=O=0,v.mode=3;case 3:for(;B<32;){if(z===0)break e;z--,O+=E[P++]<>>8&255,ce[2]=O>>>16&255,ce[3]=O>>>24&255,v.check=a(v.check,ce,4,0)),B=O=0,v.mode=4;case 4:for(;B<16;){if(z===0)break e;z--,O+=E[P++]<>8),512&v.flags&&(ce[0]=255&O,ce[1]=O>>>8&255,v.check=a(v.check,ce,2,0)),B=O=0,v.mode=5;case 5:if(1024&v.flags){for(;B<16;){if(z===0)break e;z--,O+=E[P++]<>>8&255,v.check=a(v.check,ce,2,0)),B=O=0}else v.head&&(v.head.extra=null);v.mode=6;case 6:if(1024&v.flags&&(z<(F=v.length)&&(F=z),F&&(v.head&&(Q=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),s.arraySet(v.head.extra,E,P,F,Q)),512&v.flags&&(v.check=a(v.check,E,F,P)),z-=F,P+=F,v.length-=F),v.length))break e;v.length=0,v.mode=7;case 7:if(2048&v.flags){if(z===0)break e;for(F=0;Q=E[P+F++],v.head&&Q&&v.length<65536&&(v.head.name+=String.fromCharCode(Q)),Q&&F>9&1,v.head.done=!0),H.adler=v.check=0,v.mode=12;break;case 10:for(;B<32;){if(z===0)break e;z--,O+=E[P++]<>>=7&B,B-=7&B,v.mode=27;break}for(;B<3;){if(z===0)break e;z--,O+=E[P++]<>>=1)){case 0:v.mode=14;break;case 1:if(D(v),v.mode=20,I!==6)break;O>>>=2,B-=2;break e;case 2:v.mode=17;break;case 3:H.msg="invalid block type",v.mode=30}O>>>=2,B-=2;break;case 14:for(O>>>=7&B,B-=7&B;B<32;){if(z===0)break e;z--,O+=E[P++]<>>16^65535)){H.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&O,B=O=0,v.mode=15,I===6)break e;case 15:v.mode=16;case 16:if(F=v.length){if(z>>=5,B-=5,v.ndist=1+(31&O),O>>>=5,B-=5,v.ncode=4+(15&O),O>>>=4,B-=4,286>>=3,B-=3}for(;v.have<19;)v.lens[xe[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,Ae={bits:v.lenbits},de=A(0,v.lens,0,19,v.lencode,0,v.work,Ae),v.lenbits=Ae.bits,de){H.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=le,B-=le,v.lens[v.have++]=re;else{if(re===16){for(q=le+2;B>>=le,B-=le,v.have===0){H.msg="invalid bit length repeat",v.mode=30;break}Q=v.lens[v.have-1],F=3+(3&O),O>>>=2,B-=2}else if(re===17){for(q=le+3;B>>=le)),O>>>=3,B-=3}else{for(q=le+7;B>>=le)),O>>>=7,B-=7}if(v.have+F>v.nlen+v.ndist){H.msg="invalid bit length repeat",v.mode=30;break}for(;F--;)v.lens[v.have++]=Q}}if(v.mode===30)break;if(v.lens[256]===0){H.msg="invalid code -- missing end-of-block",v.mode=30;break}if(v.lenbits=9,Ae={bits:v.lenbits},de=A(c,v.lens,0,v.nlen,v.lencode,0,v.work,Ae),v.lenbits=Ae.bits,de){H.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,Ae={bits:v.distbits},de=A(u,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,Ae),v.distbits=Ae.bits,de){H.msg="invalid distances set",v.mode=30;break}if(v.mode=20,I===6)break e;case 20:v.mode=21;case 21:if(6<=z&&258<=K){H.next_out=L,H.avail_out=K,H.next_in=P,H.avail_in=z,v.hold=O,v.bits=B,l(H,ee),L=H.next_out,U=H.output,K=H.avail_out,P=H.next_in,E=H.input,z=H.avail_in,O=v.hold,B=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;oe=(J=v.lencode[O&(1<>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>pe)])>>>16&255,re=65535&J,!(pe+(le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=pe,B-=pe,v.back+=pe}if(O>>>=le,B-=le,v.back+=le,v.length=re,oe===0){v.mode=26;break}if(32&oe){v.back=-1,v.mode=12;break}if(64&oe){H.msg="invalid literal/length code",v.mode=30;break}v.extra=15&oe,v.mode=22;case 22:if(v.extra){for(q=v.extra;B>>=v.extra,B-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;oe=(J=v.distcode[O&(1<>>16&255,re=65535&J,!((le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>pe)])>>>16&255,re=65535&J,!(pe+(le=J>>>24)<=B);){if(z===0)break e;z--,O+=E[P++]<>>=pe,B-=pe,v.back+=pe}if(O>>>=le,B-=le,v.back+=le,64&oe){H.msg="invalid distance code",v.mode=30;break}v.offset=re,v.extra=15&oe,v.mode=24;case 24:if(v.extra){for(q=v.extra;B>>=v.extra,B-=v.extra,v.back+=v.extra}if(v.offset>v.dmax){H.msg="invalid distance too far back",v.mode=30;break}v.mode=25;case 25:if(K===0)break e;if(F=ee-K,v.offset>F){if((F=v.offset-F)>v.whave&&v.sane){H.msg="invalid distance too far back",v.mode=30;break}X=F>v.wnext?(F-=v.wnext,v.wsize-F):v.wnext-F,F>v.length&&(F=v.length),ue=v.window}else ue=U,X=L-v.offset,F=v.length;for(KS?(M=X[ue+g[I]],B[W+g[I]]):(M=96,0),y=1<>L)+(w-=y)]=b<<24|M<<16|D|0,w!==0;);for(y=1<>=1;if(y!==0?(O&=y-1,O+=y):O=0,I++,--ee[H]==0){if(H===E)break;H=u[f+g[I]]}if(U>>7)]}function W(J,ce){J.pending_buf[J.pending++]=255&ce,J.pending_buf[J.pending++]=ce>>>8&255}function ee(J,ce,xe){J.bi_valid>m-xe?(J.bi_buf|=ce<>m-J.bi_valid,J.bi_valid+=xe-m):(J.bi_buf|=ce<>>=1,xe<<=1,0<--ce;);return xe>>>1}function ue(J,ce,xe){var be,N,j=new Array(g+1),se=0;for(be=1;be<=g;be++)j[be]=se=se+xe[be-1]<<1;for(N=0;N<=ce;N++){var he=J[2*N+1];he!==0&&(J[2*N]=X(j[he]++,he))}}function le(J){var ce;for(ce=0;ce>1;1<=xe;xe--)pe(J,j,xe);for(N=me;xe=J.heap[1],J.heap[1]=J.heap[J.heap_len--],pe(J,j,1),be=J.heap[1],J.heap[--J.heap_max]=xe,J.heap[--J.heap_max]=be,j[2*N]=j[2*xe]+j[2*be],J.depth[N]=(J.depth[xe]>=J.depth[be]?J.depth[xe]:J.depth[be])+1,j[2*xe+1]=j[2*be+1]=N,J.heap[1]=N++,pe(J,j,1),2<=J.heap_len;);J.heap[--J.heap_max]=J.heap[1],function(R,T){var V,te,ae,ie,Te,Me,Le=T.dyn_tree,ke=T.max_code,De=T.stat_desc.static_tree,fe=T.stat_desc.has_stree,Ce=T.stat_desc.extra_bits,Se=T.stat_desc.extra_base,Fe=T.stat_desc.max_length,We=0;for(ie=0;ie<=g;ie++)R.bl_count[ie]=0;for(Le[2*R.heap[R.heap_max]+1]=0,V=R.heap_max+1;V>=7;N>>=1)if(1&G&&he.dyn_ltree[2*me]!==0)return o;if(he.dyn_ltree[18]!==0||he.dyn_ltree[20]!==0||he.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(j=J.static_len+3+7>>>3)<=N&&(N=j)):N=j=xe+5,xe+4<=N&&ce!==-1?q(J,ce,xe,be):J.strategy===4||j===N?(ee(J,2+(be?1:0),3),_e(J,$,H)):(ee(J,4+(be?1:0),3),function(he,me,G,R){var T;for(ee(he,me-257,5),ee(he,G-1,5),ee(he,R-4,4),T=0;T>>8&255,J.pending_buf[J.d_buf+2*J.last_lit+1]=255&ce,J.pending_buf[J.l_buf+J.last_lit]=255&xe,J.last_lit++,ce===0?J.dyn_ltree[2*xe]++:(J.matches++,ce--,J.dyn_ltree[2*(v[xe]+u+1)]++,J.dyn_dtree[2*B(ce)]++),J.last_lit===J.lit_bufsize-1},i._tr_align=function(J){ee(J,2,3),F(J,w,$),function(ce){ce.bi_valid===16?(W(ce,ce.bi_buf),ce.bi_buf=0,ce.bi_valid=0):8<=ce.bi_valid&&(ce.pending_buf[ce.pending++]=255&ce.bi_buf,ce.bi_buf>>=8,ce.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,A,c,u,f=1,h={},p=!1,d=o.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(o);g=g&&g.setTimeout?g:o,l={}.toString.call(o.process)==="[object process]"?function(x){process.nextTick(function(){y(x)})}:function(){if(o.postMessage&&!o.importScripts){var x=!0,_=o.onmessage;return o.onmessage=function(){x=!1},o.postMessage("","*"),o.onmessage=_,x}}()?(u="setImmediate$"+Math.random()+"$",o.addEventListener?o.addEventListener("message",w,!1):o.attachEvent("onmessage",w),function(x){o.postMessage(u+x,"*")}):o.MessageChannel?((c=new MessageChannel).port1.onmessage=function(x){y(x.data)},function(x){c.port2.postMessage(x)}):d&&"onreadystatechange"in d.createElement("script")?(A=d.documentElement,function(x){var _=d.createElement("script");_.onreadystatechange=function(){y(x),_.onreadystatechange=null,A.removeChild(_),_=null},A.appendChild(_)}):function(x){setTimeout(y,0,x)},g.setImmediate=function(x){typeof x!="function"&&(x=new Function(""+x));for(var _=new Array(arguments.length-1),C=0;C<_.length;C++)_[C]=arguments[C+1];var S={callback:x,args:_};return h[f]=S,l(f),f++},g.clearImmediate=m}function m(x){delete h[x]}function y(x){if(p)setTimeout(y,0,x);else{var _=h[x];if(_){p=!0;try{(function(C){var S=C.callback,b=C.args;switch(b.length){case 0:S();break;case 1:S(b[0]);break;case 2:S(b[0],b[1]);break;case 3:S(b[0],b[1],b[2]);break;default:S.apply(a,b)}})(_)}finally{m(x),p=!1}}}}function w(x){x.source===o&&typeof x.data=="string"&&x.data.indexOf(u)===0&&y(+x.data.slice(u.length))}})(typeof self>"u"?s===void 0?this:s:self)}).call(this,typeof na<"u"?na:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(P5);var hhe=P5.exports;const dhe=Bl(hhe);class ld{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 dhe;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 A=a.extension!="txt";o.file(a.name+"."+a.extension,a.data,{base64:A})})}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 phe{constructor(e){ms(this,"screenshotManager");this.characterManager=e,this.screenshotManager=e.screenshotManager,this.blinkManager=e.blinkManager,this.animationManager=this.characterManager.animationManager,this.temptime=0}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:A=1,backgroundDescription:c="",width:u=512,height:f=512,dataCollection:h}=o,p=a+l+"/";this.screenshotManager.setBackground([A,A,A]),this.blinkManager.enableScreenshot(),await this.screenshotManager.cameraFrameManager.calculateBoneOffsets(this.characterManager.characterModel,.2);let d=0;const g=this;if(Array.isArray(h)){const m=t??new ld;await(async()=>{if(Array.isArray(h))for(let w=0;w{if(Array.isArray(g))for(const C of g){const{animationName:S,animationPath:b,framesNumber:M,lookAtCamera:D,expression:$,cameraPosition:H,cameraFrame:I}=C;y++;const v=s+"/"+(S||y.toString().padStart(2,"0"));await w.animationManager.loadAnimation(m+b,!0,0);const E=wT(H);w.screenshotManager.cameraFrameManager.setCameraFrameWithName(I,E);const P=w.animationManager.getCurrentClipDuration()/M;for(let L=0;L{for(const C of d){const{traitGroup:S,cameraPosition:b="front",bottomBoneName:M,bottomBoneMaxVertex:D=!1,topBoneName:$,topBoneMaxVertex:H=!0,groupTopOffset:I,groupBotomOffset:v,cameraFrame:E,saveOnlyIDs:U}=C;if((!M||!$)&&(E||console.warn("missing bonename info or camera frame. Skipping")),!S){console.warn("missing trait group for thumbnail info. Skipping");continue}const P=()=>{const K=[];return ct(U).forEach(B=>{K.push({id:B})}),K},L=U==null?y.characterManager.getTraits(S):P();if(L==null){console.log("SKipping Thumbnail Generation for trait group "+S+", its not present in the character manifest.");continue}const z=wT(b);E?y.screenshotManager.cameraFrameManager.setCameraFrameWithName(E,z):y.screenshotManager.cameraFrameManager.frameShot(M,$,z,D,H);for(let K=0;K{const[e,t]=ye.useState(null),[r,i]=ye.useState(null),[s,o]=ye.useState(null),[a,l]=ye.useState(null),[A,c]=ye.useState(null),[u,f]=ye.useState(null),[h,p]=ye.useState(null),[d,g]=ye.useState(null),[m,y]=ye.useState(null),[w,x]=ye.useState(null),[_,C]=ye.useState(null),[S,b]=ye.useState(!1);let M=!1,[D,$]=ye.useState(!1);ye.useEffect(()=>{if(M||D)return;$(!0),M=!0;const{scene:E,camera:U,controls:P,characterManager:L,sceneElements:z}=fhe("editor-scene");y(U),g(E),t(L),c(z),f(L.animationManager),p(L.lookAtManager),x(P),i(new phe(L)),o(new mhe(L)),l(new ghe(L))},[]);const H=E=>{E==null&&(E=!S),b(E),d.traverse(U=>{U.isMesh&&U.setDebugMode&&U.setDebugMode(E)})};ye.useEffect(()=>{if(_!=null&&_.defaultAnimations){const E=_.defaultAnimations.map(U=>U.location);u.storeDefaultAnimationPaths(E,"")}},[_]);const I=E=>{E?d.add(A):d.remove(A)},v=E=>{w&&(tC.to(w.target,{x:E.targetX??0,y:E.targetY??0,z:E.targetZ??0,duration:1}),tC.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 k.jsx(or.Provider,{value:{manifest:_,setManifest:C,scene:d,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:a,showEnvironmentModels:I,debugMode:S,toggleDebugMode:H,animationManager:u,lookAtManager:h,camera:m,moveCamera:v,controls:w,sceneElements:A},children:n.children})},yhe={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},dt={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",SAVE:"SAVE",MINT:"MINT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},Ui=Y.createContext(),whe=n=>{const[e,t]=Y.useState(yhe.NORMAL),[r,i]=Y.useState(dt.LANDING),[s,o]=Y.useState(!1),[a,l]=Y.useState(!1);return k.jsx(Ui.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},xhe="modulepreload",_he=function(n){return"/CharacterStudio/"+n},q3={},bhe=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=_he(s),s in q3)return;q3[s]=!0;const o=s.endsWith(".css"),a=o?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const u=i[c];if(u.href===s&&(!o||u.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${a}`))return;const A=document.createElement("link");if(A.rel=o?"stylesheet":xhe,o||(A.as="script",A.crossOrigin=""),A.href=s,document.head.appendChild(A),o)return new Promise((c,u)=>{A.addEventListener("load",c),A.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 Gw(){return Gw=Object.assign||function(n){for(var e=1;e=0)&&(t[i]=n[i]);return t}function Ehe(n){ye.useEffect(n,[])}function Che(n,e){e===void 0&&(e={});var t=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,A=t.interrupt,c=A===void 0?!1:A,u=t.onload,f=Bhe(t,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),h=Y.useRef(null),p=Y.useRef(!1),d=Y.useState(null),g=d[0],m=d[1],y=Y.useState(null),w=y[0],x=y[1],_=function(){typeof u=="function"&&u.call(this),p.current&&m(this.duration()*1e3),x(this)};Ehe(function(){return bhe(()=>import("./howler-2ef9e2b7.js").then(D=>D.h),[]).then(function(D){if(!p.current){var $;h.current=($=D.Howl)!==null&&$!==void 0?$:D.default.Howl,p.current=!0,new h.current(Gw({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:_},f))}}),function(){p.current=!1}}),Y.useEffect(function(){h.current&&w&&x(new h.current(Gw({src:Array.isArray(n)?n:[n],volume:i,onload:_},f)))},[JSON.stringify(n)]),Y.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var C=Y.useCallback(function(D){typeof D>"u"&&(D={}),!(!w||!l&&!D.forceSoundEnabled)&&(c&&w.stop(),D.playbackRate&&w.rate(D.playbackRate),w.play(D.id))},[w,l,c]),S=Y.useCallback(function(D){w&&w.stop(D)},[w]),b=Y.useCallback(function(D){w&&w.pause(D)},[w]),M=[C,{sound:w,stop:S,pause:b,duration:g}];return M}const She=[{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}],Mhe="/CharacterStudio/assets/sounds-3322d50e.mp3",Xs=ye.createContext(),The=n=>{const e=i=>She.find(s=>i.test(s.name)),[t]=Che(Mhe,{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 k.jsx(Xs.Provider,{value:{playSound:r},children:n.children})};function Qs(n){"@babel/helpers - typeof";return Qs=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},Qs(n)}function Zs(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function Ihe(n,e){if(Qs(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(Qs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function D5(n){var e=Ihe(n,"string");return Qs(e)=="symbol"?e:e+""}function eP(n,e){for(var t=0;tn.length)&&(e=n.length);for(var t=0,r=new Array(e);t1&&arguments[1]!==void 0?arguments[1]:{};Zs(this,n),this.init(e,t)}return Js(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||Uhe,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 sP(n,e,t){var r=ET(n,e,Object),i=r.obj,s=r.k;i[s]=t}function Dhe(n,e,t,r){var i=ET(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 Vw(n,e){var t=ET(n,e),r=t.obj,i=t.k;if(r)return r[i]}function oP(n,e,t){var r=Vw(n,t);return r!==void 0?r:Vw(e,t)}function Q5(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]):Q5(n[r],e[r],t):n[r]=e[r]);return n}function Ju(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Ohe={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function Nhe(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return Ohe[e]}):n}var a_=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,khe=[" ",",","?","!",";"];function Qhe(n,e,t){e=e||"",t=t||"";var r=khe.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 aP(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 bv(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 H5(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 A=r.slice(s+o).join(t);return A?H5(l,A,t):void 0}i=i[r[s]]}return i}}var Ghe=function(n){o_(t,n);var e=Hhe(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};return Zs(this,t),i=e.call(this),a_&&HA.call(RA(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 Js(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,A=a.ignoreJSONStructure!==void 0?a.ignoreJSONStructure:this.options.ignoreJSONStructure,c=[i,s];o&&typeof o!="string"&&(c=c.concat(o)),o&&typeof o=="string"&&(c=c.concat(l?o.split(l):o)),i.indexOf(".")>-1&&(c=i.split("."));var u=Vw(this.data,c);return u||!A||typeof o!="string"?u:H5(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},A=this.options.keySeparator;A===void 0&&(A=".");var c=[i,s];o&&(c=c.concat(A?o.split(A):o)),i.indexOf(".")>-1&&(c=i.split("."),a=s,s=c[1]),this.addNamespaces(s),sP(this.data,c,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 A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},c=[i,s];i.indexOf(".")>-1&&(c=i.split("."),a=o,o=s,s=c[1]),this.addNamespaces(s);var u=Vw(this.data,c)||{};a?Q5(u,o,l):u=bv(bv({},u),o),sP(this.data,c,u),A.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"?bv(bv({},{}),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}(HA),z5={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 lP(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 ni(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 AP={},cP=function(n){o_(t,n);var e=Vhe(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Zs(this,t),i=e.call(this),a_&&HA.call(RA(i)),Phe(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,RA(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ra.create("translator"),i}return Js(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||[],A=o&&i.indexOf(o)>-1,c=!this.options.userDefinedKeySeparator&&!s.keySeparator&&!this.options.userDefinedNsSeparator&&!s.nsSeparator&&!Qhe(i,o,a);if(A&&!c){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(Qs(s)!=="object"&&this.options.overloadTranslationOptionHandler&&(s=this.options.overloadTranslationOptionHandler(arguments)),s||(s={}),i==null)return"";Array.isArray(i)||(i=[String(i)]);var l=s.returnDetails!==void 0?s.returnDetails:this.options.returnDetails,A=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,c=this.extractFromKey(i[i.length-1],s),u=c.key,f=c.namespaces,h=f[f.length-1],p=s.lng||this.language,d=s.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(p&&p.toLowerCase()==="cimode"){if(d){var g=s.nsSeparator||this.options.nsSeparator;return l?{res:"".concat(h).concat(g).concat(u),usedKey:u,exactUsedKey:u,usedLng:p,usedNS:h}:"".concat(h).concat(g).concat(u)}return l?{res:u,usedKey:u,exactUsedKey:u,usedLng:p,usedNS:h}:u}var m=this.resolve(i,s),y=m&&m.res,w=m&&m.usedKey||u,x=m&&m.exactUsedKey||u,_=Object.prototype.toString.apply(y),C=["[object Number]","[object Function]","[object RegExp]"],S=s.joinArrays!==void 0?s.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,M=typeof y!="string"&&typeof y!="boolean"&&typeof y!="number";if(b&&y&&M&&C.indexOf(_)<0&&!(typeof S=="string"&&_==="[object Array]")){if(!s.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");var D=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,y,ni(ni({},s),{},{ns:f})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(m.res=D,m):D}if(A){var $=_==="[object Array]",H=$?[]:{},I=$?x:w;for(var v in y)if(Object.prototype.hasOwnProperty.call(y,v)){var E="".concat(I).concat(A).concat(v);H[v]=this.translate(E,ni(ni({},s),{joinArrays:!1,ns:f})),H[v]===E&&(H[v]=y[v])}y=H}}else if(b&&typeof S=="string"&&_==="[object Array]")y=y.join(S),y&&(y=this.extendTranslation(y,i,s,o));else{var U=!1,P=!1,L=s.count!==void 0&&typeof s.count!="string",z=t.hasDefaultValue(s),K=L?this.pluralResolver.getSuffix(p,s.count,s):"",O=s["defaultValue".concat(K)]||s.defaultValue;!this.isValidLookup(y)&&z&&(U=!0,y=O),this.isValidLookup(y)||(P=!0,y=u);var B=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,W=B&&P?void 0:y,ee=z&&O!==y&&this.options.updateMissing;if(P||U||ee){if(this.logger.log(ee?"updateKey":"missingKey",p,h,u,ee?O:y),A){var F=this.resolve(u,ni(ni({},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 X=[],ue=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ue&&ue[0])for(var le=0;le1&&arguments[1]!==void 0?arguments[1]:{},a,l,A,c,u;return typeof i=="string"&&(i=[i]),i.forEach(function(f){if(!s.isValidLookup(a)){var h=s.extractFromKey(f,o),p=h.key;l=p;var d=h.namespaces;s.options.fallbackNS&&(d=d.concat(s.options.fallbackNS));var g=o.count!==void 0&&typeof o.count!="string",m=g&&!o.ordinal&&o.count===0&&s.pluralResolver.shouldUseIntlApi(),y=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);d.forEach(function(x){s.isValidLookup(a)||(u=x,!AP["".concat(w[0],"-").concat(x)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(AP["".concat(w[0],"-").concat(x)]=!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(_){if(!s.isValidLookup(a)){c=_;var C=[p];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(C,p,_,x,o);else{var S;g&&(S=s.pluralResolver.getSuffix(_,o.count,o));var b="".concat(s.options.pluralSeparator,"zero");if(g&&(C.push(p+S),m&&C.push(p+b)),y){var M="".concat(p).concat(s.options.contextSeparator).concat(o.context);C.push(M),g&&(C.push(M+S),m&&C.push(M+b))}}for(var D;D=C.pop();)s.isValidLookup(a)||(A=D,a=s.getResource(_,x,D,o))}}))})}}),{res:a,usedKey:l,exactUsedKey:A,usedLng:c,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}(HA);function pB(n){return n.charAt(0).toUpperCase()+n.slice(1)}var uP=function(){function n(e){Zs(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ra.create("languageUtils")}return Js(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]=pB(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]=pB(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=pB(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.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(A){A&&(i.isSupportedCode(A)?o.push(A):i.logger.warn("rejecting language code not found in supportedLngs: ".concat(A)))};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}(),Whe=[{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}],Khe={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}},$he=["v1","v2","v3"],fP={zero:0,one:1,two:2,few:3,many:4,other:5};function Yhe(){var n={};return Whe.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:Khe[e.fc]}})}),n}var Xhe=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Zs(this,n),this.languageUtils=e,this.options=t,this.logger=ra.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=Yhe()}return Js(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 fP[o]-fP[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!$he.includes(this.options.compatibilityJSON)}}]),n}();function hP(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 co(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};Zs(this,n),this.logger=ra.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return Js(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:Nhe,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Ju(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Ju(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?Ju(r.nestingPrefix):r.nestingPrefixEscaped||Ju("$t("),this.nestingSuffix=r.nestingSuffix?Ju(r.nestingSuffix):r.nestingSuffixEscaped||Ju(")"),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,A,c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(g){return g.replace(/\$/g,"$$$$")}var f=function(m){if(m.indexOf(o.formatSeparator)<0){var y=oP(r,c,m);return o.alwaysFormat?o.format(y,void 0,i,co(co(co({},s),r),{},{interpolationkey:m})):y}var w=m.split(o.formatSeparator),x=w.shift().trim(),_=w.join(o.formatSeparator).trim();return o.format(oP(r,c,x),_,i,co(co(co({},s),r),{},{interpolationkey:x}))};this.resetRegExp();var h=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,p=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables,d=[{regex:this.regexpUnescape,safeValue:function(m){return u(m)}},{regex:this.regexp,safeValue:function(m){return o.escapeValue?u(o.escape(m)):u(m)}}];return d.forEach(function(g){for(A=0;a=g.regex.exec(t);){var m=a[1].trim();if(l=f(m),l===void 0)if(typeof h=="function"){var y=h(t,a,s);l=typeof y=="string"?y:""}else if(s&&Object.prototype.hasOwnProperty.call(s,m))l="";else if(p){l=a[0];continue}else o.logger.warn("missed to pass in variable ".concat(m," for interpolating ").concat(t)),l="";else typeof l!="string"&&!o.useRawValueToEscape&&(l=iP(l));var w=g.safeValue(l);if(t=t.replace(a[0],w),p?(g.regex.lastIndex+=l.length,g.regex.lastIndex-=a[0].length):g.regex.lastIndex=0,A++,A>=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 A(h,p){var d=this.nestingOptionsSeparator;if(h.indexOf(d)<0)return h;var g=h.split(new RegExp("".concat(d,"[ ]*{"))),m="{".concat(g[1]);h=g[0],m=this.interpolate(m,l);var y=m.match(/'/g),w=m.match(/"/g);(y&&y.length%2===0&&!w||w.length%2!==0)&&(m=m.replace(/'/g,'"'));try{l=JSON.parse(m),p&&(l=co(co({},p),l))}catch(x){return this.logger.warn("failed parsing options string in nesting for key ".concat(h),x),"".concat(h).concat(d).concat(m)}return delete l.defaultValue,h}for(;o=this.nestingRegexp.exec(t);){var c=[];l=co({},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(),c=f,u=!0}if(a=r(A.call(this,o[1].trim(),l),l),a&&o[0]===t&&typeof a!="string")return a;typeof a!="string"&&(a=iP(a)),a||(this.logger.warn("missed to resolve ".concat(o[1]," for nesting ").concat(t)),a=""),u&&(a=c.reduce(function(h,p){return i.format(h,p,s.lng,co(co({},s),{},{interpolationkey:o[1].trim()}))},a.trim())),t=t.replace(o[0],a),this.regexp.lastIndex=0}return t}}]),n}();function dP(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 za(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=Fhe(a),A=l[0],c=l.slice(1),u=c.join(":").trim().replace(/^'+|'+$/g,"");t[A.trim()]||(t[A.trim()]=u),u==="false"&&(t[A.trim()]=!1),u==="true"&&(t[A.trim()]=!0),isNaN(u)||(t[A.trim()]=parseInt(u,10))}})}}return{formatName:e,formatOptions:t}}function qu(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 qhe=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Zs(this,n),this.logger=ra.create("formatter"),this.options=e,this.formats={number:qu(function(t,r){var i=new Intl.NumberFormat(t,za({},r));return function(s){return i.format(s)}}),currency:qu(function(t,r){var i=new Intl.NumberFormat(t,za(za({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:qu(function(t,r){var i=new Intl.DateTimeFormat(t,za({},r));return function(s){return i.format(s)}}),relativetime:qu(function(t,r){var i=new Intl.RelativeTimeFormat(t,za({},r));return function(s){return i.format(s,r.range||"day")}}),list:qu(function(t,r){var i=new Intl.ListFormat(t,za({},r));return function(s){return i.format(s)}})},this.init(e)}return Js(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()]=qu(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(A,c){var u=Jhe(c),f=u.formatName,h=u.formatOptions;if(s.formats[f]){var p=A;try{var d=o&&o.formatParams&&o.formatParams[o.interpolationkey]||{},g=d.locale||d.lng||o.locale||o.lng||i;p=s.formats[f](A,g,za(za(za({},h),o),d))}catch(m){s.logger.warn(m)}return p}else s.logger.warn("there was no format function for ".concat(f));return A},t);return l}}]),n}();function pP(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 mP(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 nde(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var rde=function(n){o_(t,n);var e=ede(t);function t(r,i,s){var o,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return Zs(this,t),o=e.call(this),a_&&HA.call(RA(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=ra.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 Js(t,[{key:"queueLoad",value:function(i,s,o,a){var l=this,A={},c={},u={},f={};return i.forEach(function(h){var p=!0;s.forEach(function(d){var g="".concat(h,"|").concat(d);!o.reload&&l.store.hasResourceBundle(h,d)?l.state[g]=2:l.state[g]<0||(l.state[g]===1?c[g]===void 0&&(c[g]=!0):(l.state[g]=1,p=!1,c[g]===void 0&&(c[g]=!0),A[g]===void 0&&(A[g]=!0),f[d]===void 0&&(f[d]=!0)))}),p||(u[h]=!0)}),(Object.keys(A).length||Object.keys(c).length)&&this.queue.push({pending:c,pendingCount:Object.keys(c).length,loaded:{},errors:[],callback:a}),{toLoad:Object.keys(A),pending:Object.keys(c),toLoadLanguages:Object.keys(u),toLoadNamespaces:Object.keys(f)}}},{key:"loaded",value:function(i,s,o){var a=i.split("|"),l=a[0],A=a[1];s&&this.emit("failedLoading",l,A,s),o&&this.store.addResourceBundle(l,A,o),this.state[i]=s?-1:2;var c={};this.queue.forEach(function(u){Dhe(u.loaded,[l],A),nde(u,i),s&&u.errors.push(s),u.pendingCount===0&&!u.done&&(Object.keys(u.loaded).forEach(function(f){c[f]||(c[f]={});var h=u.loaded[f];h.length&&h.forEach(function(p){c[f][p]===void 0&&(c[f][p]=!0)})}),u.done=!0,u.errors.length?u.callback(u.errors):u.callback())}),this.emit("loaded",c),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,A=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,c=arguments.length>5?arguments[5]:void 0;if(!i.length)return c(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:i,ns:s,fcName:o,tried:l,wait:A,callback:c});return}this.readingCalls++;var u=function(d,g){if(a.readingCalls--,a.waitingReads.length>0){var m=a.waitingReads.shift();a.read(m.lng,m.ns,m.fcName,m.tried,m.wait,m.callback)}if(d&&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 A=this.queueLoad(i,s,a,l);if(!A.toLoad.length)return A.pending.length||l(),null;A.toLoad.forEach(function(c){o.loadOne(c)})}},{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],A=a[1];this.read(l,A,"read",void 0,void 0,function(c,u){c&&s.logger.warn("".concat(o,"loading namespace ").concat(A," for language ").concat(l," failed"),c),!c&&u&&s.logger.log("".concat(o,"loaded namespace ").concat(A," for language ").concat(l),u),s.loaded(i,c,u)})}},{key:"saveMissing",value:function(i,s,o,a,l){var A=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},c=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=mP(mP({},A),{},{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(p){return c(null,p)}).catch(c):c(null,h)}catch(p){c(p)}else f(i,s,o,a,c,u)}!i||!i[0]||this.store.addResource(i[0],s,o,a)}}}]),t}(HA);function gP(){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(Qs(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),Qs(e[2])==="object"||Qs(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 vP(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 yP(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;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 Bv(){}function ode(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var jw=function(n){o_(t,n);var e=ide(t);function t(){var r,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},s=arguments.length>1?arguments[1]:void 0;if(Zs(this,t),r=e.call(this),a_&&HA.call(RA(r)),r.options=vP(i),r.services={},r.logger=ra,r.modules={external:[]},ode(RA(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),Cg(r,RA(r));setTimeout(function(){r.init(i,s)},0)}return r}return Js(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=gP();this.options=No(No(No({},a),this.options),vP(s)),this.options.compatibilityAPI!=="v1"&&(this.options.interpolation=No(No({},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(m){return m?typeof m=="function"?new m:m:null}if(!this.options.isClone){this.modules.logger?ra.init(l(this.modules.logger),this.options):ra.init(null,this.options);var A;this.modules.formatter?A=this.modules.formatter:typeof Intl<"u"&&(A=qhe);var c=new uP(this.options);this.store=new Ghe(this.options.resources,this.options);var u=this.services;u.logger=ra,u.resourceStore=this.store,u.languageUtils=c,u.pluralResolver=new Xhe(c,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),A&&(!this.options.interpolation.format||this.options.interpolation.format===a.interpolation.format)&&(u.formatter=l(A),u.formatter.init(u,this.options),this.options.interpolation.format=u.formatter.format.bind(u.formatter)),u.interpolator=new Zhe(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new rde(l(this.modules.backend),u.resourceStore,u,this.options),u.backendConnector.on("*",function(m){for(var y=arguments.length,w=new Array(y>1?y-1:0),x=1;x1?y-1:0),x=1;x0&&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(m){i[m]=function(){var y;return(y=i.store)[m].apply(y,arguments)}});var p=["addResource","addResources","addResourceBundle","removeResourceBundle"];p.forEach(function(m){i[m]=function(){var y;return(y=i.store)[m].apply(y,arguments),i}});var d=ap(),g=function(){var y=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),d.resolve(_),o(x,_)};if(i.languages&&i.options.compatibilityAPI!=="v1"&&!i.isInitialized)return y(null,i.t.bind(i));i.changeLanguage(i.options.lng,y)};return this.options.resources||!this.options.initImmediate?g():setTimeout(g,0),d}},{key:"loadResources",value:function(i){var s=this,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Bv,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 A=[],c=function(h){if(h){var p=s.services.languageUtils.toResolveHierarchy(h);p.forEach(function(d){A.indexOf(d)<0&&A.push(d)})}};if(l)c(l);else{var u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.forEach(function(f){return c(f)})}this.options.preload&&this.options.preload.forEach(function(f){return c(f)}),this.services.backendConnector.load(A,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=ap();return i||(i=this.languages),s||(s=this.options.ns),o||(o=Bv),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"&&z5.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=ap();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)},A=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)})},c=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(p){A(p,h)})};return!i&&this.services.languageDetector&&!this.services.languageDetector.async?c(this.services.languageDetector.detect()):!i&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(c):this.services.languageDetector.detect(c):c(i),a}},{key:"getFixedT",value:function(i,s,o){var a=this,l=function A(c,u){var f;if(Qs(u)!=="object"){for(var h=arguments.length,p=new Array(h>2?h-2:0),d=2;d1&&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=this.resolvedLanguage||this.languages[0],l=this.options?this.options.fallbackLng:!1,A=this.languages[this.languages.length-1];if(a.toLowerCase()==="cimode")return!0;var c=function(h,p){var d=s.services.backendConnector.state["".concat(h,"|").concat(p)];return d===-1||d===2};if(o.precheck){var u=o.precheck(this,c);if(u!==void 0)return u}return!!(this.hasResourceBundle(a,i)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||c(a,i)&&(!l||c(A,i)))}},{key:"loadNamespaces",value:function(i,s){var o=this,a=ap();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=ap();typeof i=="string"&&(i=[i]);var a=this.options.preload||[],l=i.filter(function(A){return a.indexOf(A)<0});return l.length?(this.options.preload=a.concat(l),this.loadResources(function(A){o.resolve(),s&&s(A)}),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 uP(gP());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]:Bv,a=No(No(No({},this.options),s),{isClone:!0}),l=new t(a);(s.debug!==void 0||s.prefix!==void 0)&&(l.logger=l.logger.clone(s));var A=["store","services","language"];return A.forEach(function(c){l[c]=i[c]}),l.services=No({},this.services),l.services.utils={hasLoadedNamespace:l.hasLoadedNamespace.bind(l)},l.translator=new cP(l.services,l.options),l.translator.on("*",function(c){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 jw(n,e)});var qr=jw.createInstance();qr.createInstance=jw.createInstance;qr.createInstance;qr.dir;qr.init;qr.loadResources;qr.reloadResources;qr.use;qr.changeLanguage;qr.getFixedT;qr.t;qr.exists;qr.setDefaultNamespace;qr.hasLoadedNamespace;qr.loadNamespaces;qr.loadLanguages;function ade(){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,A){var c=e.services.backendConnector.state["".concat(l,"|").concat(A)];return c===-1||c===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 Ade(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return JC("i18n.languages were undefined or empty",e.languages),!0;var r=e.options.ignoreJSONStructure!==void 0;return r?e.hasLoadedNamespace(n,{precheck:function(s,o){if(t.bindI18n&&t.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!o(s.isLanguageChangingTo,n))return!1}}):lde(n,e,t)}var cde=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,ude={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},fde=function(e){return ude[e]},hde=function(e){return e.replace(cde,fde)};function _P(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 bP(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};qC=bP(bP({},qC),n)}function pde(){return qC}var G5;function mde(n){G5=n}function gde(){return G5}var vde={type:"3rdParty",init:function(e){dde(e.options.react),mde(e)}},yde=ye.createContext(),wde=function(){function n(){Zs(this,n),this.usedNamespaces={}}return Js(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 xde(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,A=!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(c){A=!0,i=c}finally{try{if(!l&&t.return!=null&&(o=t.return(),Object(o)!==o))return}finally{if(A)throw i}}return a}}function _de(n,e){return O5(n)||xde(n,e)||N5(n,e)||k5()}function BP(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 mB(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=ye.useContext(yde)||{},i=r.i18n,s=r.defaultNS,o=t||i||gde();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new wde),!o){JC("You will need to pass in an i18next instance by using initReactI18next");var a=function(M,D){return typeof D=="string"?D:D&&Qs(D)==="object"&&typeof D.defaultValue=="string"?D.defaultValue:Array.isArray(M)?M[M.length-1]:M},l=[a,{},!1];return l.t=a,l.i18n={},l.ready=!1,l}o.options.react&&o.options.react.wait!==void 0&&JC("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var A=mB(mB(mB({},pde()),o.options.react),e),c=A.useSuspense,u=A.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(b){return Ade(b,o,A)});function p(){return o.getFixedT(null,A.nsMode==="fallback"?f:f[0],u)}var d=ye.useState(p),g=_de(d,2),m=g[0],y=g[1],w=f.join(),x=bde(w),_=ye.useRef(!0);ye.useEffect(function(){var b=A.bindI18n,M=A.bindI18nStore;_.current=!0,!h&&!c&&xP(o,f,function(){_.current&&y(p)}),h&&x&&x!==w&&_.current&&y(p);function D(){_.current&&y(p)}return b&&o&&o.on(b,D),M&&o&&o.store.on(M,D),function(){_.current=!1,b&&o&&b.split(" ").forEach(function($){return o.off($,D)}),M&&o&&M.split(" ").forEach(function($){return o.store.off($,D)})}},[o,w]);var C=ye.useRef(!0);ye.useEffect(function(){_.current&&!C.current&&y(p),C.current=!1},[o,u]);var S=[m,o,h];if(S.t=m,S.i18n=o,S.ready=h,h||!h&&!c)return S;throw new Promise(function(b){xP(o,f,function(){b()})})}var V5=[],Ede=V5.forEach,Cde=V5.slice;function Sde(n){return Ede.call(Cde.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var EP=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,Mde=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(!EP.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!EP.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},CP={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=Mde(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}},lp=null,SP=function(){if(lp!==null)return lp;try{lp=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{lp=!1}return lp},Rde={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&SP()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&SP()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},Ap=null,MP=function(){if(Ap!==null)return Ap;try{Ap=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{Ap=!1}return Ap},Fde={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&MP()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&MP()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},Ude={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},Lde={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}},Pde={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}},Dde={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 Ode(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var j5=function(){function n(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Zs(this,n),this.type="languageDetector",this.detectors={},this.init(e,t)}return Js(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,this.options=Sde(r,this.options||{},Ode()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(Tde),this.addDetector(Ide),this.addDetector(Rde),this.addDetector(Fde),this.addDetector(Ude),this.addDetector(Lde),this.addDetector(Pde),this.addDetector(Dde)}},{key:"addDetector",value:function(t){this.detectors[t.name]=t}},{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))}}),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}();j5.type="languageDetector";const Nde={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!"}}},kde={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 генерации голоса временно отключен на техническое обслуживание."}}},Qde={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暂时关闭进行维护!"}}},Hde={en:Nde,ru:kde,zh:Qde};qr.use(j5).use(vde).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:Hde});const Io=ye.createContext(),zde=n=>{const{t:e}=Bde();return k.jsx(Io.Provider,{value:{t:e},children:n.children})},Gde=` uniform vec3 cameraDir; uniform vec3 eye; @@ -4237,7 +4237,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 ); } -`,Gde=` +`,Vde=` uniform float switchItemDuration; uniform float switchItemTime; uniform vec3 cameraDir; @@ -4275,7 +4275,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor.a *= (switchItemDuration - switchItemTime); gl_FragColor *= aura; } -`,Vde=` +`,jde=` uniform vec4 cameraBillboardQuaternion; attribute vec2 scales; @@ -4306,7 +4306,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,jde=` +`,Wde=` varying vec2 vUv; varying float vOpacity; varying vec3 vWorldPosition; @@ -4329,7 +4329,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } gl_FragColor.a *= vOpacity; } -`,Wde=` +`,Kde=` attribute vec2 scales; attribute float opacity; attribute vec3 positions; @@ -4355,7 +4355,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,Kde=` +`,$de=` uniform float radius; varying vec2 vUv; @@ -4378,7 +4378,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; } -`,$de=` +`,Yde=` uniform vec4 cameraBillboardQuaternion; varying vec2 vUv; @@ -4399,7 +4399,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,Yde=` +`,Xde=` varying vec2 vUv; varying vec3 vWorldPosition; @@ -4409,7 +4409,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); } -`,Xde=` +`,Zde=` varying vec3 vWorldPosition; varying vec3 vSurfaceNormal; @@ -4422,7 +4422,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 ); } -`,Zde=` +`,Jde=` uniform vec3 cameraDir; uniform vec3 eye; @@ -4444,7 +4444,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; } -`,CT=(n,e,t)=>{const r=new $t;["position","normal","uv"].forEach(o=>{r.setAttribute(o,n.attributes[o])}),r.setIndex(n.index);const i=new Float32Array(t*3),s=new ww(i,3);r.setAttribute("positions",s);for(const o of e){const{name:a,itemSize:l}=o,A=new Float32Array(t*l);r.setAttribute(a,new ww(A,l))}return r},Jde=n=>{const r=new Gx(.45,.45,5,50,50,!0),i=new Cr({uniforms:{auraTexture:{value:null}},vertexShader:zde,fragmentShader:Gde,transparent:!0,blending:Kc});i.uniforms.cameraDir=n.cameraDir,i.uniforms.eye=n.eye,i.uniforms.switchItemTime=n.switchItemTime,i.uniforms.switchItemDuration=n.switchItemDuration;const s=new xn(r,i);return s.frustumCulled=!1,s.position.y=5*.46,s},qde=()=>{const e=[];e.push({name:"opacity",itemSize:1}),e.push({name:"scales",itemSize:2});const t=.3,r=new ou(t,t),i=CT(r,e,20),s=new Cr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:Vde,fragmentShader:jde,depthWrite:!1,blending:Kc}),o=new zx(i,s,20);return o.info={particleCount:20,velocity:[20]},o},epe=n=>{const t=[];t.push({name:"opacity",itemSize:1}),t.push({name:"scales",itemSize:2});const r=.43,i=new tT(r,32,32),s=CT(i,t,10),o=new Cr({uniforms:{radius:{value:r}},vertexShader:Wde,fragmentShader:Kde,depthWrite:!1,blending:Kc});o.uniforms.cameraDir=n.cameraDir,o.uniforms.eye=n.eye,o.uniforms.fadeInAvatarTime=n.fadeInAvatarTime;const a=new zx(s,o,10);return a.info={particleCount:10,velocity:[10],currentIndex:0},a},tpe=n=>{const t=new ou(1,1),r=new Cr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:$de,fragmentShader:Yde,depthWrite:!1,blending:Kc});return new xn(t,r)},npe=n=>{const t=[],s=new Gx(.645,.43,2.5,50,50,!0),o=CT(s,t,2),a=new Cr({uniforms:{opacity:{value:0}},vertexShader:Xde,fragmentShader:Zde,transparent:!0,blending:Kc});a.uniforms.cameraDir=n.cameraDir,a.uniforms.eye=n.eye;const l=new zx(o,a,2);return l.fadeIn=!1,l.frustumCulled=!1,l.position.y=2.5*.46,l},TP=100,rpe=0,jw=1.5,ipe=.1,vy=0,IP=1,RP=.05,eS=0,spe=1,ope=.015,yi={normal:0,switchItem:1,fadeOutAvatar:2,loadingAvatar:3,fadeInAvatar:4},ape=new lu,W5=ape.load("./textures/beam2.png");W5.wrapS=As;class lpe{constructor(e,t,r){this.scene=e,this.camera=t,this.globalUniforms=r,this.eye=new Z,this.cameraDir=new Z,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=Jde(this.globalUniforms),this.beamMesh.material.uniforms.auraTexture.value=W5,this.beamMesh.update=()=>this.updateBeam(),this.scene.add(this.beamMesh)}initPixel(){this.pixelMesh=qde(),this.pixelMesh.update=()=>this.updatePixel(),this.scene.add(this.pixelMesh)}initRing(){this.ringMesh=epe(this.globalUniforms),this.ringMesh.update=()=>this.updateRing(),this.scene.add(this.ringMesh)}initTeleport(){this.teleportMesh=tpe(this.globalUniforms),this.teleportMesh.update=()=>this.updateTeleport(),this.teleportMesh.visible=!1,this.scene.add(this.teleportMesh)}initSpotLight(){this.spotLight=npe(this.globalUniforms),this.spotLight.update=()=>this.updateSpotLight(),this.spotLight.visible=!1,this.scene.add(this.spotLight)}updateBeam(){this.beamMesh&&this.globalUniforms.transitionEffectType.value!==yi.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!==yi.fadeInAvatar&&(this.ringMesh.visible=!1)}}updateTeleport(){if(this.teleportMesh){if(this.globalUniforms.transitionEffectType.value===yi.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 K5=new lu,tS=K5.load("./textures/pixel9.png");tS.wrapS=tS.wrapT=As;const nS=K5.load("./textures/noise3.jpg");nS.wrapS=nS.wrapT=As;const Ut={switchItemDuration:{value:jw},switchItemTime:{value:jw},eye:{value:new Z},cameraDir:{value:new Z},fadeOutAvatarTime:{value:vy},fadeInAvatarTime:{value:eS},transitionEffectType:{value:yi.normal}},FP={pixelTexture:{value:tS},noiseTexture:{value:nS}};class Ape extends EventTarget{constructor(){super();L_(this,"setTransitionEffect",t=>{this.transitionEffectType=t});L_(this,"getTransitionEffect",t=>this.transitionEffectType===t);this.cameraDir=new Z,this.frameRate=1e3/30,this.initParticle=!1,this.transitionEffectType=null,this.transitionTime=TP,this.update()}setCustomShader(t){t.vertexShader&&(t.vertexShader=t.vertexShader.replace("varying vec3 vViewPosition;",` +`,CT=(n,e,t)=>{const r=new $t;["position","normal","uv"].forEach(o=>{r.setAttribute(o,n.attributes[o])}),r.setIndex(n.index);const i=new Float32Array(t*3),s=new xw(i,3);r.setAttribute("positions",s);for(const o of e){const{name:a,itemSize:l}=o,A=new Float32Array(t*l);r.setAttribute(a,new xw(A,l))}return r},qde=n=>{const r=new Vx(.45,.45,5,50,50,!0),i=new Sr({uniforms:{auraTexture:{value:null}},vertexShader:Gde,fragmentShader:Vde,transparent:!0,blending:$c});i.uniforms.cameraDir=n.cameraDir,i.uniforms.eye=n.eye,i.uniforms.switchItemTime=n.switchItemTime,i.uniforms.switchItemDuration=n.switchItemDuration;const s=new xn(r,i);return s.frustumCulled=!1,s.position.y=5*.46,s},epe=()=>{const e=[];e.push({name:"opacity",itemSize:1}),e.push({name:"scales",itemSize:2});const t=.3,r=new au(t,t),i=CT(r,e,20),s=new Sr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:jde,fragmentShader:Wde,depthWrite:!1,blending:$c}),o=new Gx(i,s,20);return o.info={particleCount:20,velocity:[20]},o},tpe=n=>{const t=[];t.push({name:"opacity",itemSize:1}),t.push({name:"scales",itemSize:2});const r=.43,i=new tT(r,32,32),s=CT(i,t,10),o=new Sr({uniforms:{radius:{value:r}},vertexShader:Kde,fragmentShader:$de,depthWrite:!1,blending:$c});o.uniforms.cameraDir=n.cameraDir,o.uniforms.eye=n.eye,o.uniforms.fadeInAvatarTime=n.fadeInAvatarTime;const a=new Gx(s,o,10);return a.info={particleCount:10,velocity:[10],currentIndex:0},a},npe=n=>{const t=new au(1,1),r=new Sr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:Yde,fragmentShader:Xde,depthWrite:!1,blending:$c});return new xn(t,r)},rpe=n=>{const t=[],s=new Vx(.645,.43,2.5,50,50,!0),o=CT(s,t,2),a=new Sr({uniforms:{opacity:{value:0}},vertexShader:Zde,fragmentShader:Jde,transparent:!0,blending:$c});a.uniforms.cameraDir=n.cameraDir,a.uniforms.eye=n.eye;const l=new Gx(o,a,2);return l.fadeIn=!1,l.frustumCulled=!1,l.position.y=2.5*.46,l},TP=100,ipe=0,Ww=1.5,spe=.1,yy=0,IP=1,RP=.05,eS=0,ope=1,ape=.015,yi={normal:0,switchItem:1,fadeOutAvatar:2,loadingAvatar:3,fadeInAvatar:4},lpe=new Au,W5=lpe.load("./textures/beam2.png");W5.wrapS=As;class Ape{constructor(e,t,r){this.scene=e,this.camera=t,this.globalUniforms=r,this.eye=new Z,this.cameraDir=new Z,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=qde(this.globalUniforms),this.beamMesh.material.uniforms.auraTexture.value=W5,this.beamMesh.update=()=>this.updateBeam(),this.scene.add(this.beamMesh)}initPixel(){this.pixelMesh=epe(),this.pixelMesh.update=()=>this.updatePixel(),this.scene.add(this.pixelMesh)}initRing(){this.ringMesh=tpe(this.globalUniforms),this.ringMesh.update=()=>this.updateRing(),this.scene.add(this.ringMesh)}initTeleport(){this.teleportMesh=npe(this.globalUniforms),this.teleportMesh.update=()=>this.updateTeleport(),this.teleportMesh.visible=!1,this.scene.add(this.teleportMesh)}initSpotLight(){this.spotLight=rpe(this.globalUniforms),this.spotLight.update=()=>this.updateSpotLight(),this.spotLight.visible=!1,this.scene.add(this.spotLight)}updateBeam(){this.beamMesh&&this.globalUniforms.transitionEffectType.value!==yi.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!==yi.fadeInAvatar&&(this.ringMesh.visible=!1)}}updateTeleport(){if(this.teleportMesh){if(this.globalUniforms.transitionEffectType.value===yi.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 K5=new Au,tS=K5.load("./textures/pixel9.png");tS.wrapS=tS.wrapT=As;const nS=K5.load("./textures/noise3.jpg");nS.wrapS=nS.wrapT=As;const Ut={switchItemDuration:{value:Ww},switchItemTime:{value:Ww},eye:{value:new Z},cameraDir:{value:new Z},fadeOutAvatarTime:{value:yy},fadeInAvatarTime:{value:eS},transitionEffectType:{value:yi.normal}},FP={pixelTexture:{value:tS},noiseTexture:{value:nS}};class cpe extends EventTarget{constructor(){super();ms(this,"setTransitionEffect",t=>{this.transitionEffectType=t});ms(this,"getTransitionEffect",t=>this.transitionEffectType===t);this.cameraDir=new Z,this.frameRate=1e3/30,this.initParticle=!1,this.transitionEffectType=null,this.transitionTime=TP,this.update()}setCustomShader(t){t.vertexShader&&(t.vertexShader=t.vertexShader.replace("varying vec3 vViewPosition;",` varying vec3 vViewPosition; varying vec3 vWorldPosition; varying vec3 vSurfaceNormal; @@ -4601,13 +4601,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } gl_FragColor = vec4( col, diffuseColor.a ); - `),t.uniforms.pixelTexture=FP.pixelTexture,t.uniforms.noiseTexture=FP.noiseTexture,t.uniforms.cameraDir=Ut.cameraDir,t.uniforms.eye=Ut.eye,t.uniforms.switchItemTime=Ut.switchItemTime,t.uniforms.switchItemDuration=Ut.switchItemDuration,t.uniforms.transitionEffectType=Ut.transitionEffectType,t.uniforms.fadeInAvatarTime=Ut.fadeInAvatarTime)}playFadeOutEffect(){Ut.transitionEffectType.value=yi.fadeOutAvatar,this.particleEffect.emitSpotLight(),this.particleEffect.emitPixel(),this.particleEffect.emitTeleport(),this.transitionTime=this.frameRate*((IP-vy)/RP),this.initialFadeOutTimer()}playFadeInEffect(){Ut.transitionEffectType.value=yi.fadeInAvatar,this.initialFadeInTimer()}playSwitchItemEffect(){Ut.switchItemTime.value=rpe,Ut.transitionEffectType.value=yi.switchItem,this.transitionTime=TP}setParticle(t,r){this.particleEffect=new lpe(t,r,Ut)}initialFadeOutTimer(){Ut.fadeOutAvatarTime.value=vy}initialFadeInTimer(){Ut.fadeInAvatarTime.value=eS}update(){setInterval(()=>{this.scene&&this.camera&&!this.initParticle&&(this.setParticle(this.scene,this.camera),this.initParticle=!0),this.initParticle&&this.particleEffect.update(),Ut.transitionEffectType.value===yi.switchItem?Ut.switchItemTime.valueIP&&(Ut.fadeOutAvatarTime.value=vy,Ut.transitionEffectType.value=yi.loadingAvatar)):Ut.transitionEffectType.value===yi.loadingAvatar||Ut.transitionEffectType.value===yi.fadeInAvatar&&(Ut.fadeInAvatarTime.value>.1&&Ut.fadeInAvatarTime.value<.5&&(this.particleEffect.emitRing(.5*(1-Ut.fadeInAvatarTime.value)),this.particleEffect.emitRespawnPixel()),Ut.fadeInAvatarTime.value>=.5&&this.particleEffect.removeSpotLight(),Ut.fadeInAvatarTime.value+=ope,Ut.fadeInAvatarTime.value>spe&&(Ut.fadeInAvatarTime.value=eS,Ut.transitionEffectType.value=yi.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(),Ut.cameraDir.value.copy(this.cameraDir),Ut.eye.value.copy(this.camera.position))},this.frameRate)}}const cpe="_container_1fjfz_1",upe="_messageWindow_1fjfz_11",fpe="_messageTitle_1fjfz_25",hpe="_buttonContainer_1fjfz_36",Bv={container:cpe,messageWindow:upe,messageTitle:fpe,buttonContainer:hpe};var $5={exports:{}};/*! + `),t.uniforms.pixelTexture=FP.pixelTexture,t.uniforms.noiseTexture=FP.noiseTexture,t.uniforms.cameraDir=Ut.cameraDir,t.uniforms.eye=Ut.eye,t.uniforms.switchItemTime=Ut.switchItemTime,t.uniforms.switchItemDuration=Ut.switchItemDuration,t.uniforms.transitionEffectType=Ut.transitionEffectType,t.uniforms.fadeInAvatarTime=Ut.fadeInAvatarTime)}playFadeOutEffect(){Ut.transitionEffectType.value=yi.fadeOutAvatar,this.particleEffect.emitSpotLight(),this.particleEffect.emitPixel(),this.particleEffect.emitTeleport(),this.transitionTime=this.frameRate*((IP-yy)/RP),this.initialFadeOutTimer()}playFadeInEffect(){Ut.transitionEffectType.value=yi.fadeInAvatar,this.initialFadeInTimer()}playSwitchItemEffect(){Ut.switchItemTime.value=ipe,Ut.transitionEffectType.value=yi.switchItem,this.transitionTime=TP}setParticle(t,r){this.particleEffect=new Ape(t,r,Ut)}initialFadeOutTimer(){Ut.fadeOutAvatarTime.value=yy}initialFadeInTimer(){Ut.fadeInAvatarTime.value=eS}update(){setInterval(()=>{this.scene&&this.camera&&!this.initParticle&&(this.setParticle(this.scene,this.camera),this.initParticle=!0),this.initParticle&&this.particleEffect.update(),Ut.transitionEffectType.value===yi.switchItem?Ut.switchItemTime.valueIP&&(Ut.fadeOutAvatarTime.value=yy,Ut.transitionEffectType.value=yi.loadingAvatar)):Ut.transitionEffectType.value===yi.loadingAvatar||Ut.transitionEffectType.value===yi.fadeInAvatar&&(Ut.fadeInAvatarTime.value>.1&&Ut.fadeInAvatarTime.value<.5&&(this.particleEffect.emitRing(.5*(1-Ut.fadeInAvatarTime.value)),this.particleEffect.emitRespawnPixel()),Ut.fadeInAvatarTime.value>=.5&&this.particleEffect.removeSpotLight(),Ut.fadeInAvatarTime.value+=ape,Ut.fadeInAvatarTime.value>ope&&(Ut.fadeInAvatarTime.value=eS,Ut.transitionEffectType.value=yi.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(),Ut.cameraDir.value.copy(this.cameraDir),Ut.eye.value.copy(this.camera.position))},this.frameRate)}}const upe="_container_1fjfz_1",fpe="_messageWindow_1fjfz_11",hpe="_messageTitle_1fjfz_25",dpe="_buttonContainer_1fjfz_36",Ev={container:upe,messageWindow:fpe,messageTitle:hpe,buttonContainer:dpe};var $5={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 r=[],i=0;it.name===n);return await fetch(e.file).then(t=>t.text()).then(t=>new DOMParser().parseFromString(t,"image/svg+xml").firstElementChild)}function _n(n){const{size:e,icon:t,className:r,onClick:i,theme:s,type:o,text:a,onMouseEnter:l,active:A,onSubmit:c,minWidth:u,disabled:f}=n,h=ye.useRef(null);return ye.useEffect(()=>{t&&Cpe(t).then(p=>{h.current&&(h.current.innerHTML="",p&&(p.classList.add(Un.icon),h.current.append(p)))})},[t]),o&&o==="login"?k.jsxs("div",{className:dh(r,Un.iconButtonWrap,s&&s==="dark"?Un.dark:Un.light,A&&Un.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:Un.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:Un.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),k.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:Un.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Un.iconWrap})]}):o&&o==="icon"?k.jsxs("div",{className:dh(r,Un.iconButtonWrap,s&&s==="dark"?Un.dark:Un.light,A&&Un.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{className:Un.buttonBackground,width:"69",height:"63",viewBox:"0 0 69 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[k.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:Un.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),k.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:Un.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Un.iconWrap})]}):k.jsx("button",{className:dh(r,Un.buttonWrap,s&&s==="dark"?Un.dark:Un.light),onClick:i,onMouseEnter:l,onSubmit:c,type:o,disabled:f,style:{minWidth:u?u+"px":""},children:k.jsxs("div",{className:Un.innerWrap,style:{fontSize:e},children:[t&&k.jsx("span",{ref:h,className:Un.buttonIconWrap,style:{height:e,width:e,opacity:f?"0.4":"1"}}),a&&a]})})}function Spe(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?k.jsx("div",{className:Bv.container,children:k.jsxs("div",{className:Bv.messageWindow,children:[k.jsx("div",{className:Bv.messageTitle,children:t}),k.jsxs("div",{className:Bv.buttonContainer,children:[e&&k.jsx(_n,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),k.jsx(_n,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):k.jsx("div",{})}const Mpe="_backgroundImg_1yy0g_1",Tpe="_darkBackground_1yy0g_16",Ipe="_logo_1yy0g_29",Ev={backgroundImg:Mpe,darkBackground:Tpe,logo:Ipe};function Rpe(){const{debugMode:n}=Y.useContext(or);return k.jsxs("div",{className:n?Ev.darkBackground:Ev.backgroundImg,children:[k.jsx("div",{className:Ev.backgroundBlur}),k.jsx("div",{className:Ev.Background})]})}const Fpe="_buttonContainer_19n2w_1",Upe="_buttonLeft_19n2w_10",Lpe="_buttonRight_19n2w_14",Ppe="_buttonCenter_19n2w_18",Dpe="_sideMenu_19n2w_33",Ope="_scrollContainer_19n2w_44",Npe="_scrollContainerOptions_19n2w_52",kpe="_bottomLine_19n2w_60",Qpe="_editorButton_19n2w_94",Hpe="_editorText_19n2w_102",zpe="_selectorContainerPos_19n2w_112",Gpe="_selectorButton_19n2w_129",Vpe="_selectorColorPickerUI_19n2w_138",jpe="_selectorColorPickerButton_19n2w_144",Wpe="_selectorColorPickerImg_19n2w_157",Kpe="_uploadContainer_19n2w_163",$pe="_uploadButton_19n2w_176",Ln={buttonContainer:Fpe,buttonLeft:Upe,buttonRight:Lpe,buttonCenter:Ppe,sideMenu:Dpe,scrollContainer:Ope,scrollContainerOptions:Npe,bottomLine:kpe,"editor-container":"_editor-container_19n2w_87",editorButton:Qpe,editorText:Hpe,selectorContainerPos:zpe,"selector-container":"_selector-container_19n2w_123",selectorButton:Gpe,selectorColorPickerUI:Vpe,selectorColorPickerButton:jpe,selectorColorPickerImg:Wpe,uploadContainer:Kpe,uploadButton:$pe},Ype="_dropArea_1a0z4_1",Xpe={dropArea:Ype};function Cg({onFilesDrop:n}){const[e,t]=ye.useState(!1),[r,i]=Y.useState(null);ye.useEffect(()=>{const o=l=>{l.preventDefault(),t(!1);const A=l.dataTransfer.files;n&&i(A)},a=l=>{l.preventDefault(),t(!0)};return window.addEventListener("drop",o),window.addEventListener("dragover",a),()=>{window.removeEventListener("drop",o),window.removeEventListener("dragover",a)}},[]),ye.useEffect(()=>{r&&n(r)},[r]);const s=()=>{t(!1)};return k.jsx("div",{onDragLeave:s,className:Xpe.dropArea,style:{display:e?"flex":"none"}})}const Zpe="_mainTitleWrap_4fb0s_1",Jpe="_mainTitle_4fb0s_1",qpe="_topLine_4fb0s_18",gB={mainTitleWrap:Zpe,mainTitle:Jpe,topLine:qpe};function wa({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&&k.jsxs("div",{className:gB.mainTitleWrap,style:i,children:[k.jsx("div",{className:gB.topLine}),k.jsx("div",{className:gB.mainTitle,children:n})]})}const eme="_ContainerPositionTop_v15ql_2",tme="_ContainerPosition_v15ql_2",nme="_Container_v15ql_2",rme="_topLine_v15ql_68",ime="_traitInfoTitle_v15ql_96",sme="_flexSelect_v15ql_105",ome="_flexButtons_v15ql_114",ame="_flexButtonsTop_v15ql_122",lme="_optionButtons_v15ql_131",Ame="_optionButtonsSmall_v15ql_143",Zn={ContainerPositionTop:eme,ContainerPosition:tme,Container:nme,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:rme,traitInfoTitle:ime,flexSelect:sme,flexButtons:ome,flexButtonsTop:ame,optionButtons:lme,optionButtonsSmall:Ame},cme="/CharacterStudio/assets/randomize-green-4388c12b.png",ume="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=",fme="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=",hme="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==",dme="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",pme="/CharacterStudio/assets/play-de4238c5.png",mme="/CharacterStudio/assets/reverse-e35421b8.png",gme="/CharacterStudio/assets/pause-b6381fd4.png",vme="/CharacterStudio/assets/fast-forward-0d3ffae5.png",yme="/CharacterStudio/assets/fast-backward-1f713448.png";function a_({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=ye.useContext(or),[a,l]=ye.useState(s.userActivated),[A,c]=Y.useState((o==null?void 0:o.getCurrentAnimationName())||"");ye.useEffect(()=>{n==null&&(n="T-Pose"),n!=""&&c(n)},[n]);const u=()=>{r()},f=m=>{m?o.play():o.pause(),o.setSpeed(1)},h=m=>{o.play(),o.setSpeed(m)},p=()=>{s.setActive(!a),o.enableMouseLook(!a),l(!a)},d=async()=>{console.log("play next"),await o.loadNextAnimation(),c(o.getCurrentAnimationName())},g=async()=>{console.log("play prev"),await o.loadPreviousAnimation(),c(o.getCurrentAnimationName())};return k.jsxs("div",{className:Zn.Container,children:[k.jsx("div",{className:Zn.ContainerPositionTop,children:k.jsxs("div",{className:Zn.flexButtonsTop,children:[k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(-2)},children:k.jsx("img",{src:yme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(-1)},children:k.jsx("img",{src:mme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{f(!1)},children:k.jsx("img",{src:gme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{f(!0)},children:k.jsx("img",{src:pme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(2)},children:k.jsx("img",{src:vme})})]})}),k.jsxs("div",{className:Zn.ContainerPosition,children:[k.jsx("div",{className:Zn.topLine}),k.jsxs("div",{className:Zn.flexSelect,children:[k.jsx("div",{className:`${Zn["arrow-button"]} ${Zn["left-button"]}`,onClick:g}),k.jsx("div",{className:Zn.traitInfoTitle,style:{marginBottom:"10px"},children:A}),k.jsx("div",{className:`${Zn["arrow-button"]} ${Zn["right-button"]}`,onClick:d})]}),k.jsxs("div",{className:Zn.flexButtons,children:[e&&k.jsx("div",{className:`${Zn.optionButtons}`,onClick:e,children:k.jsx("img",{src:cme})}),k.jsx("div",{className:`${Zn.optionButtons}`,onClick:p,children:k.jsx("img",{src:a?dme:hme})}),k.jsx("div",{className:`${Zn.optionButtons}`,onClick:u,children:k.jsx("img",{src:i?fme:ume})})]})]})]})}const wme="_tokenBoxWrap_q4pvo_1",xme="_mask_q4pvo_7",_me="_timer_q4pvo_31",bme="_level_q4pvo_42",Bme="_mythic_q4pvo_55",Eme="_epic_q4pvo_60",Cme="_rare_q4pvo_65",Sme="_uncommon_q4pvo_70",Mme="_common_q4pvo_75",Tme="_none_q4pvo_80",Ime="_value_q4pvo_85",Rme="_frame_q4pvo_95",Fme="_emptyIcon_q4pvo_111",Ume="_badge_q4pvo_123",Lme="_frameActive_q4pvo_131",Vl={tokenBoxWrap:wme,mask:xme,timer:_me,level:bme,mythic:Bme,epic:Eme,rare:Cme,uncommon:Sme,common:Mme,none:Tme,value:Ime,frame:Rme,emptyIcon:Fme,badge:Ume,frameActive:Lme,default:"_default_q4pvo_159"},Pme="/CharacterStudio/assets/magic-box-cd45f027.png",pA=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,A]=Y.useState(!1),c=()=>{A(!0)};return k.jsxs("div",{className:Vl.tokenBoxWrap,style:{width:e,height:e},onClick:r,children:[t&&k.jsx("div",{className:dh(Vl.frame,Vl.frameActive)}),k.jsx("div",{className:dh(Vl.frame,o&&Vl[o])}),k.jsx("img",{src:l?Pme:s,className:Vl.emptyIcon,style:a,onError:c}),i&&k.jsxs("div",{className:dh(Vl.level,o&&Vl[o]),children:["Lv.",i]})]})},Dme="_InformationContainerPos_72ckd_2",Ome="_scrollContainer_72ckd_15",Nme="_traitInfoTitle_72ckd_27",kme="_traitInfoText_72ckd_35",Qme="_flexSelect_72ckd_62",Hme="_checked_72ckd_119",zme="_checkmark_72ckd_123",Gme="_checkboxHolder_72ckd_136",No={InformationContainerPos:Dme,scrollContainer:Ome,traitInfoTitle:Nme,traitInfoText:kme,"input-box":"_input-box_72ckd_43",flexSelect:Qme,"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:Hme,checkmark:zme,checkboxHolder:Gme};function ST({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=Y.useContext(Ui),{characterManager:i}=ye.useContext(or),[s,o]=ye.useState(0),[a,l]=Y.useState({}),[A,c]=Y.useState([]),u=d=>{i.setManifest(d),i.loadInitialTraits().then(()=>{r(!1)})};ye.useEffect(()=>{t==!1&&(l(i.getAvatarSelection()),c(Object.keys(i.getAvatarSelection())))},[t]);const f=d=>{i.loadTraitsFromNFTObject(d).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 d=s+1;e?u(n[d]):f(n[d]),o(d)}},p=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 d=s-1;e?u(n[d]):f(n[d]),o(d)}};return(n==null?void 0:n.length)>0?k.jsxs("div",{className:No.InformationContainerPos,children:[k.jsx(wa,{title:"Trait Selection",width:180,right:20}),k.jsxs("div",{className:No.scrollContainer,children:[k.jsxs("div",{className:No.flexSelect,children:[(n==null?void 0:n.length)>1?k.jsx("div",{className:`${No["arrow-button"]} ${No["left-button"]}`,onClick:p}):k.jsx(k.Fragment,{}),(n[s].name||n[s].manifestName)&&k.jsx("div",{style:{textAlign:"center",flex:1},children:k.jsx("div",{className:No.traitInfoTitle,children:e?n[s].manifestName:n[s].name})}),(n==null?void 0:n.length)>1?k.jsx("div",{className:`${No["arrow-button"]} ${No["right-button"]}`,onClick:h}):k.jsx(k.Fragment,{})]}),(n[s].thumb||n[s].thumbnail)&&k.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(d=>k.jsx("div",{children:k.jsx("div",{className:No.traitInfoText,children:`${d.trait_type} : ${d.value}`})},`json:${d.trait_type}_${d.value}`)),e&&A.map(d=>k.jsx("div",{children:k.jsx("div",{className:No.traitInfoText,children:`${d} : ${a[d].id}`})},`val:${d}`))]})]}):k.jsx(k.Fragment,{})}const UP="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==",Vme="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=",jme="/CharacterStudio/assets/color-palette-71a7a2d4.png";var Rs={},Sg={},Wme=typeof ta=="object"&&ta&&ta.Object===Object&&ta,X5=Wme,Kme=X5,$me=typeof self=="object"&&self&&self.Object===Object&&self,Yme=Kme||$me||Function("return this")(),Ca=Yme,Xme=Ca,Zme=Xme.Symbol,Mg=Zme,LP=Mg,Z5=Object.prototype,Jme=Z5.hasOwnProperty,qme=Z5.toString,Ap=LP?LP.toStringTag:void 0;function ege(n){var e=Jme.call(n,Ap),t=n[Ap];try{n[Ap]=void 0;var r=!0}catch{}var i=qme.call(n);return r&&(e?n[Ap]=t:delete n[Ap]),i}var tge=ege,nge=Object.prototype,rge=nge.toString;function ige(n){return rge.call(n)}var sge=ige,PP=Mg,oge=tge,age=sge,lge="[object Null]",Age="[object Undefined]",DP=PP?PP.toStringTag:void 0;function cge(n){return n==null?n===void 0?Age:lge:DP&&DP in Object(n)?oge(n):age(n)}var Au=cge,uge=Array.isArray,Io=uge;function fge(n){return n!=null&&typeof n=="object"}var Sl=fge,hge=Au,dge=Io,pge=Sl,mge="[object String]";function gge(n){return typeof n=="string"||!dge(n)&&pge(n)&&hge(n)==mge}var vge=gge;function yge(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 wge=yge,xge=wge,_ge=xge(),bge=_ge;function Bge(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=Qge}var TT=Hge,zge=Au,Gge=TT,Vge=Sl,jge="[object Arguments]",Wge="[object Array]",Kge="[object Boolean]",$ge="[object Date]",Yge="[object Error]",Xge="[object Function]",Zge="[object Map]",Jge="[object Number]",qge="[object Object]",e0e="[object RegExp]",t0e="[object Set]",n0e="[object String]",r0e="[object WeakMap]",i0e="[object ArrayBuffer]",s0e="[object DataView]",o0e="[object Float32Array]",a0e="[object Float64Array]",l0e="[object Int8Array]",A0e="[object Int16Array]",c0e="[object Int32Array]",u0e="[object Uint8Array]",f0e="[object Uint8ClampedArray]",h0e="[object Uint16Array]",d0e="[object Uint32Array]",un={};un[o0e]=un[a0e]=un[l0e]=un[A0e]=un[c0e]=un[u0e]=un[f0e]=un[h0e]=un[d0e]=!0;un[jge]=un[Wge]=un[i0e]=un[Kge]=un[s0e]=un[$ge]=un[Yge]=un[Xge]=un[Zge]=un[Jge]=un[qge]=un[e0e]=un[t0e]=un[n0e]=un[r0e]=!1;function p0e(n){return Vge(n)&&Gge(n.length)&&!!un[zge(n)]}var m0e=p0e;function g0e(n){return function(e){return n(e)}}var IT=g0e,Kw={exports:{}};Kw.exports;(function(n,e){var t=X5,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})(Kw,Kw.exports);var RT=Kw.exports,v0e=m0e,y0e=IT,NP=RT,kP=NP&&NP.isTypedArray,w0e=kP?y0e(kP):v0e,t8=w0e,x0e=Ege,_0e=q5,b0e=Io,B0e=MT,E0e=e8,C0e=t8,S0e=Object.prototype,M0e=S0e.hasOwnProperty;function T0e(n,e){var t=b0e(n),r=!t&&_0e(n),i=!t&&!r&&B0e(n),s=!t&&!r&&!i&&C0e(n),o=t||r||i||s,a=o?x0e(n.length,String):[],l=a.length;for(var A in n)(e||M0e.call(n,A))&&!(o&&(A=="length"||i&&(A=="offset"||A=="parent")||s&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||E0e(A,l)))&&a.push(A);return a}var n8=T0e,I0e=Object.prototype;function R0e(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||I0e;return n===t}var FT=R0e;function F0e(n,e){return function(t){return n(e(t))}}var r8=F0e,U0e=r8,L0e=U0e(Object.keys,Object),P0e=L0e,D0e=FT,O0e=P0e,N0e=Object.prototype,k0e=N0e.hasOwnProperty;function Q0e(n){if(!D0e(n))return O0e(n);var e=[];for(var t in Object(n))k0e.call(n,t)&&t!="constructor"&&e.push(t);return e}var H0e=Q0e;function z0e(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var ld=z0e,G0e=Au,V0e=ld,j0e="[object AsyncFunction]",W0e="[object Function]",K0e="[object GeneratorFunction]",$0e="[object Proxy]";function Y0e(n){if(!V0e(n))return!1;var e=G0e(n);return e==W0e||e==K0e||e==j0e||e==$0e}var i8=Y0e,X0e=i8,Z0e=TT;function J0e(n){return n!=null&&Z0e(n.length)&&!X0e(n)}var l_=J0e,q0e=n8,eve=H0e,tve=l_;function nve(n){return tve(n)?q0e(n):eve(n)}var Tg=nve,rve=bge,ive=Tg;function sve(n,e){return n&&rve(n,e,ive)}var s8=sve;function ove(n){return n}var o8=ove,ave=o8;function lve(n){return typeof n=="function"?n:ave}var Ave=lve,cve=s8,uve=Ave;function fve(n,e){return n&&cve(n,uve(e))}var UT=fve,hve=r8,dve=hve(Object.getPrototypeOf,Object),LT=dve,pve=Au,mve=LT,gve=Sl,vve="[object Object]",yve=Function.prototype,wve=Object.prototype,a8=yve.toString,xve=wve.hasOwnProperty,_ve=a8.call(Object);function bve(n){if(!gve(n)||pve(n)!=vve)return!1;var e=mve(n);if(e===null)return!0;var t=xve.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&a8.call(t)==_ve}var Bve=bve;function Eve(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var Hve=Qve,zve=A_;function Gve(n,e){var t=this.__data__,r=zve(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var Vve=Gve,jve=Sve,Wve=Pve,Kve=Nve,$ve=Hve,Yve=Vve;function Ad(n){var e=-1,t=n==null?0:n.length;for(this.clear();++ea))return!1;var A=s.get(n),c=s.get(e);if(A&&c)return A==e&&c==n;var u=-1,f=!0,h=t&axe?new rxe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,Zbe.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,Ybe.default)(r)?(0,Kbe.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,jbe.default)(r)&&t.push(r)}),t};Sg.default=Jbe;var Ig={};function qbe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,ySe.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,gSe.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=wSe({},r[a],s[a])}),i}),r};Ig.default=xSe;var Rg={};Object.defineProperty(Rg,"__esModule",{value:!0});Rg.autoprefix=void 0;var _Se=UT,yD=BSe(_Se),bSe=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){RSe(i,r);function i(){var s,o,a,l;ISe(this,i);for(var A=arguments.length,c=Array(A),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){OSe(i,r);function i(){var s,o,a,l;DSe(this,i);for(var A=arguments.length,c=Array(A),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};jT.default=kSe;Object.defineProperty(Rs,"__esModule",{value:!0});Rs.ReactCSS=Rs.loop=Rs.handleActive=WT=Rs.handleHover=Rs.hover=void 0;var QSe=Sg,HSe=dd(QSe),zSe=Ig,GSe=dd(zSe),VSe=Rg,jSe=dd(VSe),WSe=Fg,F8=dd(WSe),KSe=Ug,$Se=dd(KSe),YSe=jT,XSe=dd(YSe);function dd(n){return n&&n.__esModule?n:{default:n}}Rs.hover=F8.default;var WT=Rs.handleHover=F8.default;Rs.handleActive=$Se.default;Rs.loop=XSe.default;var ZSe=Rs.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(c<0?h=0:c>o?h=1:h=Math.round(c*100/o)/100,i!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}return null},bB={},qSe=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},eMe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(bB[s])return bB[s];var o=qSe(e,t,r,i);return bB[s]=o,o},_D=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 _n(n){const{size:e,icon:t,className:r,onClick:i,theme:s,type:o,text:a,onMouseEnter:l,active:A,onSubmit:c,minWidth:u,disabled:f}=n,h=ye.useRef(null);return ye.useEffect(()=>{t&&Spe(t).then(p=>{h.current&&(h.current.innerHTML="",p&&(p.classList.add(Un.icon),h.current.append(p)))})},[t]),o&&o==="login"?k.jsxs("div",{className:ph(r,Un.iconButtonWrap,s&&s==="dark"?Un.dark:Un.light,A&&Un.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:Un.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:Un.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),k.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:Un.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Un.iconWrap})]}):o&&o==="icon"?k.jsxs("div",{className:ph(r,Un.iconButtonWrap,s&&s==="dark"?Un.dark:Un.light,A&&Un.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{className:Un.buttonBackground,width:"69",height:"63",viewBox:"0 0 69 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[k.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:Un.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),k.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:Un.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Un.iconWrap})]}):k.jsx("button",{className:ph(r,Un.buttonWrap,s&&s==="dark"?Un.dark:Un.light),onClick:i,onMouseEnter:l,onSubmit:c,type:o,disabled:f,style:{minWidth:u?u+"px":""},children:k.jsxs("div",{className:Un.innerWrap,style:{fontSize:e},children:[t&&k.jsx("span",{ref:h,className:Un.buttonIconWrap,style:{height:e,width:e,opacity:f?"0.4":"1"}}),a&&a]})})}function Mpe(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?k.jsx("div",{className:Ev.container,children:k.jsxs("div",{className:Ev.messageWindow,children:[k.jsx("div",{className:Ev.messageTitle,children:t}),k.jsxs("div",{className:Ev.buttonContainer,children:[e&&k.jsx(_n,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),k.jsx(_n,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):k.jsx("div",{})}const Tpe="_backgroundImg_1yy0g_1",Ipe="_darkBackground_1yy0g_16",Rpe="_logo_1yy0g_29",Cv={backgroundImg:Tpe,darkBackground:Ipe,logo:Rpe};function Fpe(){const{debugMode:n}=Y.useContext(or);return k.jsxs("div",{className:n?Cv.darkBackground:Cv.backgroundImg,children:[k.jsx("div",{className:Cv.backgroundBlur}),k.jsx("div",{className:Cv.Background})]})}const Upe="_buttonContainer_19n2w_1",Lpe="_buttonLeft_19n2w_10",Ppe="_buttonRight_19n2w_14",Dpe="_buttonCenter_19n2w_18",Ope="_sideMenu_19n2w_33",Npe="_scrollContainer_19n2w_44",kpe="_scrollContainerOptions_19n2w_52",Qpe="_bottomLine_19n2w_60",Hpe="_editorButton_19n2w_94",zpe="_editorText_19n2w_102",Gpe="_selectorContainerPos_19n2w_112",Vpe="_selectorButton_19n2w_129",jpe="_selectorColorPickerUI_19n2w_138",Wpe="_selectorColorPickerButton_19n2w_144",Kpe="_selectorColorPickerImg_19n2w_157",$pe="_uploadContainer_19n2w_163",Ype="_uploadButton_19n2w_176",Ln={buttonContainer:Upe,buttonLeft:Lpe,buttonRight:Ppe,buttonCenter:Dpe,sideMenu:Ope,scrollContainer:Npe,scrollContainerOptions:kpe,bottomLine:Qpe,"editor-container":"_editor-container_19n2w_87",editorButton:Hpe,editorText:zpe,selectorContainerPos:Gpe,"selector-container":"_selector-container_19n2w_123",selectorButton:Vpe,selectorColorPickerUI:jpe,selectorColorPickerButton:Wpe,selectorColorPickerImg:Kpe,uploadContainer:$pe,uploadButton:Ype},Xpe="_dropArea_1a0z4_1",Zpe={dropArea:Xpe};function Sg({onFilesDrop:n}){const[e,t]=ye.useState(!1),[r,i]=Y.useState(null);ye.useEffect(()=>{const o=l=>{l.preventDefault(),t(!1);const A=l.dataTransfer.files;n&&i(A)},a=l=>{l.preventDefault(),t(!0)};return window.addEventListener("drop",o),window.addEventListener("dragover",a),()=>{window.removeEventListener("drop",o),window.removeEventListener("dragover",a)}},[]),ye.useEffect(()=>{r&&n(r)},[r]);const s=()=>{t(!1)};return k.jsx("div",{onDragLeave:s,className:Zpe.dropArea,style:{display:e?"flex":"none"}})}const Jpe="_mainTitleWrap_4fb0s_1",qpe="_mainTitle_4fb0s_1",eme="_topLine_4fb0s_18",gB={mainTitleWrap:Jpe,mainTitle:qpe,topLine:eme};function xa({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&&k.jsxs("div",{className:gB.mainTitleWrap,style:i,children:[k.jsx("div",{className:gB.topLine}),k.jsx("div",{className:gB.mainTitle,children:n})]})}const tme="_ContainerPositionTop_v15ql_2",nme="_ContainerPosition_v15ql_2",rme="_Container_v15ql_2",ime="_topLine_v15ql_68",sme="_traitInfoTitle_v15ql_96",ome="_flexSelect_v15ql_105",ame="_flexButtons_v15ql_114",lme="_flexButtonsTop_v15ql_122",Ame="_optionButtons_v15ql_131",cme="_optionButtonsSmall_v15ql_143",Zn={ContainerPositionTop:tme,ContainerPosition:nme,Container:rme,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:ime,traitInfoTitle:sme,flexSelect:ome,flexButtons:ame,flexButtonsTop:lme,optionButtons:Ame,optionButtonsSmall:cme},ume="/CharacterStudio/assets/randomize-green-4388c12b.png",fme="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=",hme="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=",dme="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==",pme="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",mme="/CharacterStudio/assets/play-de4238c5.png",gme="/CharacterStudio/assets/reverse-e35421b8.png",vme="/CharacterStudio/assets/pause-b6381fd4.png",yme="/CharacterStudio/assets/fast-forward-0d3ffae5.png",wme="/CharacterStudio/assets/fast-backward-1f713448.png";function l_({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=ye.useContext(or),[a,l]=ye.useState(s.userActivated),[A,c]=Y.useState((o==null?void 0:o.getCurrentAnimationName())||"");ye.useEffect(()=>{n==null&&(n="T-Pose"),n!=""&&c(n)},[n]);const u=()=>{r()},f=m=>{m?o.play():o.pause(),o.setSpeed(1)},h=m=>{o.play(),o.setSpeed(m)},p=()=>{s.setActive(!a),o.enableMouseLook(!a),l(!a)},d=async()=>{console.log("play next"),await o.loadNextAnimation(),c(o.getCurrentAnimationName())},g=async()=>{console.log("play prev"),await o.loadPreviousAnimation(),c(o.getCurrentAnimationName())};return k.jsxs("div",{className:Zn.Container,children:[k.jsx("div",{className:Zn.ContainerPositionTop,children:k.jsxs("div",{className:Zn.flexButtonsTop,children:[k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(-2)},children:k.jsx("img",{src:wme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(-1)},children:k.jsx("img",{src:gme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{f(!1)},children:k.jsx("img",{src:vme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{f(!0)},children:k.jsx("img",{src:mme})}),k.jsx("div",{className:`${Zn.optionButtonsSmall}`,onClick:()=>{h(2)},children:k.jsx("img",{src:yme})})]})}),k.jsxs("div",{className:Zn.ContainerPosition,children:[k.jsx("div",{className:Zn.topLine}),k.jsxs("div",{className:Zn.flexSelect,children:[k.jsx("div",{className:`${Zn["arrow-button"]} ${Zn["left-button"]}`,onClick:g}),k.jsx("div",{className:Zn.traitInfoTitle,style:{marginBottom:"10px"},children:A}),k.jsx("div",{className:`${Zn["arrow-button"]} ${Zn["right-button"]}`,onClick:d})]}),k.jsxs("div",{className:Zn.flexButtons,children:[e&&k.jsx("div",{className:`${Zn.optionButtons}`,onClick:e,children:k.jsx("img",{src:ume})}),k.jsx("div",{className:`${Zn.optionButtons}`,onClick:p,children:k.jsx("img",{src:a?pme:dme})}),k.jsx("div",{className:`${Zn.optionButtons}`,onClick:u,children:k.jsx("img",{src:i?hme:fme})})]})]})]})}const xme="_tokenBoxWrap_q4pvo_1",_me="_mask_q4pvo_7",bme="_timer_q4pvo_31",Bme="_level_q4pvo_42",Eme="_mythic_q4pvo_55",Cme="_epic_q4pvo_60",Sme="_rare_q4pvo_65",Mme="_uncommon_q4pvo_70",Tme="_common_q4pvo_75",Ime="_none_q4pvo_80",Rme="_value_q4pvo_85",Fme="_frame_q4pvo_95",Ume="_emptyIcon_q4pvo_111",Lme="_badge_q4pvo_123",Pme="_frameActive_q4pvo_131",jl={tokenBoxWrap:xme,mask:_me,timer:bme,level:Bme,mythic:Eme,epic:Cme,rare:Sme,uncommon:Mme,common:Tme,none:Ime,value:Rme,frame:Fme,emptyIcon:Ume,badge:Lme,frameActive:Pme,default:"_default_q4pvo_159"},Dme="/CharacterStudio/assets/magic-box-cd45f027.png",mA=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,A]=Y.useState(!1),c=()=>{A(!0)};return k.jsxs("div",{className:jl.tokenBoxWrap,style:{width:e,height:e},onClick:r,children:[t&&k.jsx("div",{className:ph(jl.frame,jl.frameActive)}),k.jsx("div",{className:ph(jl.frame,o&&jl[o])}),k.jsx("img",{src:l?Dme:s,className:jl.emptyIcon,style:a,onError:c}),i&&k.jsxs("div",{className:ph(jl.level,o&&jl[o]),children:["Lv.",i]})]})},Ome="_InformationContainerPos_72ckd_2",Nme="_scrollContainer_72ckd_15",kme="_traitInfoTitle_72ckd_27",Qme="_traitInfoText_72ckd_35",Hme="_flexSelect_72ckd_62",zme="_checked_72ckd_119",Gme="_checkmark_72ckd_123",Vme="_checkboxHolder_72ckd_136",ko={InformationContainerPos:Ome,scrollContainer:Nme,traitInfoTitle:kme,traitInfoText:Qme,"input-box":"_input-box_72ckd_43",flexSelect:Hme,"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:zme,checkmark:Gme,checkboxHolder:Vme};function ST({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=Y.useContext(Ui),{characterManager:i}=ye.useContext(or),[s,o]=ye.useState(0),[a,l]=Y.useState({}),[A,c]=Y.useState([]),u=d=>{i.setManifest(d),i.loadInitialTraits().then(()=>{r(!1)})};ye.useEffect(()=>{t==!1&&(l(i.getAvatarSelection()),c(Object.keys(i.getAvatarSelection())))},[t]);const f=d=>{i.loadTraitsFromNFTObject(d).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 d=s+1;e?u(n[d]):f(n[d]),o(d)}},p=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 d=s-1;e?u(n[d]):f(n[d]),o(d)}};return(n==null?void 0:n.length)>0?k.jsxs("div",{className:ko.InformationContainerPos,children:[k.jsx(xa,{title:"Trait Selection",width:180,right:20}),k.jsxs("div",{className:ko.scrollContainer,children:[k.jsxs("div",{className:ko.flexSelect,children:[(n==null?void 0:n.length)>1?k.jsx("div",{className:`${ko["arrow-button"]} ${ko["left-button"]}`,onClick:p}):k.jsx(k.Fragment,{}),(n[s].name||n[s].manifestName)&&k.jsx("div",{style:{textAlign:"center",flex:1},children:k.jsx("div",{className:ko.traitInfoTitle,children:e?n[s].manifestName:n[s].name})}),(n==null?void 0:n.length)>1?k.jsx("div",{className:`${ko["arrow-button"]} ${ko["right-button"]}`,onClick:h}):k.jsx(k.Fragment,{})]}),(n[s].thumb||n[s].thumbnail)&&k.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(d=>k.jsx("div",{children:k.jsx("div",{className:ko.traitInfoText,children:`${d.trait_type} : ${d.value}`})},`json:${d.trait_type}_${d.value}`)),e&&A.map(d=>k.jsx("div",{children:k.jsx("div",{className:ko.traitInfoText,children:`${d} : ${a[d].id}`})},`val:${d}`))]})]}):k.jsx(k.Fragment,{})}const UP="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==",jme="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=",Wme="/CharacterStudio/assets/color-palette-71a7a2d4.png";var Fs={},Mg={},Kme=typeof na=="object"&&na&&na.Object===Object&&na,X5=Kme,$me=X5,Yme=typeof self=="object"&&self&&self.Object===Object&&self,Xme=$me||Yme||Function("return this")(),Sa=Xme,Zme=Sa,Jme=Zme.Symbol,Tg=Jme,LP=Tg,Z5=Object.prototype,qme=Z5.hasOwnProperty,ege=Z5.toString,cp=LP?LP.toStringTag:void 0;function tge(n){var e=qme.call(n,cp),t=n[cp];try{n[cp]=void 0;var r=!0}catch{}var i=ege.call(n);return r&&(e?n[cp]=t:delete n[cp]),i}var nge=tge,rge=Object.prototype,ige=rge.toString;function sge(n){return ige.call(n)}var oge=sge,PP=Tg,age=nge,lge=oge,Age="[object Null]",cge="[object Undefined]",DP=PP?PP.toStringTag:void 0;function uge(n){return n==null?n===void 0?cge:Age:DP&&DP in Object(n)?age(n):lge(n)}var cu=uge,fge=Array.isArray,Ro=fge;function hge(n){return n!=null&&typeof n=="object"}var Ml=hge,dge=cu,pge=Ro,mge=Ml,gge="[object String]";function vge(n){return typeof n=="string"||!pge(n)&&mge(n)&&dge(n)==gge}var yge=vge;function wge(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 xge=wge,_ge=xge,bge=_ge(),Bge=bge;function Ege(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=Hge}var TT=zge,Gge=cu,Vge=TT,jge=Ml,Wge="[object Arguments]",Kge="[object Array]",$ge="[object Boolean]",Yge="[object Date]",Xge="[object Error]",Zge="[object Function]",Jge="[object Map]",qge="[object Number]",e0e="[object Object]",t0e="[object RegExp]",n0e="[object Set]",r0e="[object String]",i0e="[object WeakMap]",s0e="[object ArrayBuffer]",o0e="[object DataView]",a0e="[object Float32Array]",l0e="[object Float64Array]",A0e="[object Int8Array]",c0e="[object Int16Array]",u0e="[object Int32Array]",f0e="[object Uint8Array]",h0e="[object Uint8ClampedArray]",d0e="[object Uint16Array]",p0e="[object Uint32Array]",un={};un[a0e]=un[l0e]=un[A0e]=un[c0e]=un[u0e]=un[f0e]=un[h0e]=un[d0e]=un[p0e]=!0;un[Wge]=un[Kge]=un[s0e]=un[$ge]=un[o0e]=un[Yge]=un[Xge]=un[Zge]=un[Jge]=un[qge]=un[e0e]=un[t0e]=un[n0e]=un[r0e]=un[i0e]=!1;function m0e(n){return jge(n)&&Vge(n.length)&&!!un[Gge(n)]}var g0e=m0e;function v0e(n){return function(e){return n(e)}}var IT=v0e,$w={exports:{}};$w.exports;(function(n,e){var t=X5,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})($w,$w.exports);var RT=$w.exports,y0e=g0e,w0e=IT,NP=RT,kP=NP&&NP.isTypedArray,x0e=kP?w0e(kP):y0e,t8=x0e,_0e=Cge,b0e=q5,B0e=Ro,E0e=MT,C0e=e8,S0e=t8,M0e=Object.prototype,T0e=M0e.hasOwnProperty;function I0e(n,e){var t=B0e(n),r=!t&&b0e(n),i=!t&&!r&&E0e(n),s=!t&&!r&&!i&&S0e(n),o=t||r||i||s,a=o?_0e(n.length,String):[],l=a.length;for(var A in n)(e||T0e.call(n,A))&&!(o&&(A=="length"||i&&(A=="offset"||A=="parent")||s&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||C0e(A,l)))&&a.push(A);return a}var n8=I0e,R0e=Object.prototype;function F0e(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||R0e;return n===t}var FT=F0e;function U0e(n,e){return function(t){return n(e(t))}}var r8=U0e,L0e=r8,P0e=L0e(Object.keys,Object),D0e=P0e,O0e=FT,N0e=D0e,k0e=Object.prototype,Q0e=k0e.hasOwnProperty;function H0e(n){if(!O0e(n))return N0e(n);var e=[];for(var t in Object(n))Q0e.call(n,t)&&t!="constructor"&&e.push(t);return e}var z0e=H0e;function G0e(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var Ad=G0e,V0e=cu,j0e=Ad,W0e="[object AsyncFunction]",K0e="[object Function]",$0e="[object GeneratorFunction]",Y0e="[object Proxy]";function X0e(n){if(!j0e(n))return!1;var e=V0e(n);return e==K0e||e==$0e||e==W0e||e==Y0e}var i8=X0e,Z0e=i8,J0e=TT;function q0e(n){return n!=null&&J0e(n.length)&&!Z0e(n)}var A_=q0e,eve=n8,tve=z0e,nve=A_;function rve(n){return nve(n)?eve(n):tve(n)}var Ig=rve,ive=Bge,sve=Ig;function ove(n,e){return n&&ive(n,e,sve)}var s8=ove;function ave(n){return n}var o8=ave,lve=o8;function Ave(n){return typeof n=="function"?n:lve}var cve=Ave,uve=s8,fve=cve;function hve(n,e){return n&&uve(n,fve(e))}var UT=hve,dve=r8,pve=dve(Object.getPrototypeOf,Object),LT=pve,mve=cu,gve=LT,vve=Ml,yve="[object Object]",wve=Function.prototype,xve=Object.prototype,a8=wve.toString,_ve=xve.hasOwnProperty,bve=a8.call(Object);function Bve(n){if(!vve(n)||mve(n)!=yve)return!1;var e=gve(n);if(e===null)return!0;var t=_ve.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&a8.call(t)==bve}var Eve=Bve;function Cve(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var zve=Hve,Gve=c_;function Vve(n,e){var t=this.__data__,r=Gve(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var jve=Vve,Wve=Mve,Kve=Dve,$ve=kve,Yve=zve,Xve=jve;function cd(n){var e=-1,t=n==null?0:n.length;for(this.clear();++ea))return!1;var A=s.get(n),c=s.get(e);if(A&&c)return A==e&&c==n;var u=-1,f=!0,h=t&lxe?new ixe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,Jbe.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,Xbe.default)(r)?(0,$be.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,Wbe.default)(r)&&t.push(r)}),t};Mg.default=qbe;var Rg={};function eBe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,wSe.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,vSe.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=xSe({},r[a],s[a])}),i}),r};Rg.default=_Se;var Fg={};Object.defineProperty(Fg,"__esModule",{value:!0});Fg.autoprefix=void 0;var bSe=UT,yD=ESe(bSe),BSe=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){FSe(i,r);function i(){var s,o,a,l;RSe(this,i);for(var A=arguments.length,c=Array(A),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){NSe(i,r);function i(){var s,o,a,l;OSe(this,i);for(var A=arguments.length,c=Array(A),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};jT.default=QSe;Object.defineProperty(Fs,"__esModule",{value:!0});Fs.ReactCSS=Fs.loop=Fs.handleActive=WT=Fs.handleHover=Fs.hover=void 0;var HSe=Mg,zSe=pd(HSe),GSe=Rg,VSe=pd(GSe),jSe=Fg,WSe=pd(jSe),KSe=Ug,F8=pd(KSe),$Se=Lg,YSe=pd($Se),XSe=jT,ZSe=pd(XSe);function pd(n){return n&&n.__esModule?n:{default:n}}Fs.hover=F8.default;var WT=Fs.handleHover=F8.default;Fs.handleActive=YSe.default;Fs.loop=ZSe.default;var JSe=Fs.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(c<0?h=0:c>o?h=1:h=Math.round(c*100/o)/100,i!==h)return{h:t.h,s:t.s,l:t.l,a:h,source:"rgb"}}return null},bB={},eMe=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},tMe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(bB[s])return bB[s];var o=eMe(e,t,r,i);return bB[s]=o,o},_D=Object.assign||function(n){for(var e=1;e-1},dMe=function(e){return Number(String(e).replace(/%/g,""))},pMe=1,Pt=function(n){AMe(e,n);function e(t){aMe(this,e);var r=lMe(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=dMe(i.target.value);if(!isNaN(s)&&hMe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===U8?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-"+pMe++,r}return sMe(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 oMe({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||cMe}},{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=ft({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 Y.createElement("div",{style:i.wrap},Y.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?Y.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(ye.PureComponent||ye.Component),mMe=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,A=a-(i.getBoundingClientRect().left+window.pageXOffset),c=l-(i.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var u=void 0;if(c<0)u=359;else if(c>o)u=0;else{var f=-(c*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(A<0)h=0;else if(A>s)h=359;else{var p=A*100/s;h=360*p/100}if(r.h!==h)return{h,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},gMe=function(){function n(e,t){for(var r=0;r-1},pMe=function(e){return Number(String(e).replace(/%/g,""))},mMe=1,Pt=function(n){cMe(e,n);function e(t){lMe(this,e);var r=AMe(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=pMe(i.target.value);if(!isNaN(s)&&dMe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===U8?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-"+mMe++,r}return oMe(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 aMe({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||uMe}},{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=ft({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 Y.createElement("div",{style:i.wrap},Y.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?Y.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(ye.PureComponent||ye.Component),gMe=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,A=a-(i.getBoundingClientRect().left+window.pageXOffset),c=l-(i.getBoundingClientRect().top+window.pageYOffset);if(t==="vertical"){var u=void 0;if(c<0)u=359;else if(c>o)u=0;else{var f=-(c*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(A<0)h=0;else if(A>s)h=359;else{var p=A*100/s;h=360*p/100}if(r.h!==h)return{h,s:r.s,l:r.l,a:r.a,source:"hsl"}}return null},vMe=function(){function n(e,t){for(var r=0;r-1}function RMe(n,e){var t=this.__data__,r=g_(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function Ml(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1&&n%1==0&&n<=ZTe}function gd(n){return n!=null&&ZT(n.length)&&!$T(n)}function JTe(n){return zA(n)&&gd(n)}function qTe(){return!1}var V8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,FD=V8&&typeof module=="object"&&module&&!module.nodeType&&module,e2e=FD&&FD.exports===V8,UD=e2e?Ro.Buffer:void 0,t2e=UD?UD.isBuffer:void 0,n2e=t2e||qTe;const qw=n2e;var r2e="[object Object]",i2e=Function.prototype,s2e=Object.prototype,j8=i2e.toString,o2e=s2e.hasOwnProperty,a2e=j8.call(Object);function l2e(n){if(!zA(n)||uu(n)!=r2e)return!1;var e=z8(n);if(e===null)return!0;var t=o2e.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&j8.call(t)==a2e}var A2e="[object Arguments]",c2e="[object Array]",u2e="[object Boolean]",f2e="[object Date]",h2e="[object Error]",d2e="[object Function]",p2e="[object Map]",m2e="[object Number]",g2e="[object Object]",v2e="[object RegExp]",y2e="[object Set]",w2e="[object String]",x2e="[object WeakMap]",_2e="[object ArrayBuffer]",b2e="[object DataView]",B2e="[object Float32Array]",E2e="[object Float64Array]",C2e="[object Int8Array]",S2e="[object Int16Array]",M2e="[object Int32Array]",T2e="[object Uint8Array]",I2e="[object Uint8ClampedArray]",R2e="[object Uint16Array]",F2e="[object Uint32Array]",fn={};fn[B2e]=fn[E2e]=fn[C2e]=fn[S2e]=fn[M2e]=fn[T2e]=fn[I2e]=fn[R2e]=fn[F2e]=!0;fn[A2e]=fn[c2e]=fn[_2e]=fn[u2e]=fn[b2e]=fn[f2e]=fn[h2e]=fn[d2e]=fn[p2e]=fn[m2e]=fn[g2e]=fn[v2e]=fn[y2e]=fn[w2e]=fn[x2e]=!1;function U2e(n){return zA(n)&&ZT(n.length)&&!!fn[uu(n)]}function L2e(n){return function(e){return n(e)}}var W8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,am=W8&&typeof module=="object"&&module&&!module.nodeType&&module,P2e=am&&am.exports===W8,EB=P2e&&O8.process,D2e=function(){try{var n=am&&am.require&&am.require("util").types;return n||EB&&EB.binding&&EB.binding("util")}catch{}}();const LD=D2e;var PD=LD&&LD.isTypedArray,O2e=PD?L2e(PD):U2e;const JT=O2e;function AS(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}var N2e=Object.prototype,k2e=N2e.hasOwnProperty;function Q2e(n,e,t){var r=n[e];(!(k2e.call(n,e)&&Lg(r,t))||t===void 0&&!(e in n))&&YT(n,e,t)}function H2e(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s-1&&n%1==0&&n0){if(++e>=iIe)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var lIe=aIe(rIe);const AIe=lIe;function cIe(n,e){return AIe(eIe(n,e,y_),n+"")}function uIe(n,e,t){if(!js(t))return!1;var r=typeof e;return(r=="number"?gd(t)&&qT(e,t.length):r=="string"&&e in t)?Lg(t[e],n):!1}function fIe(n){return cIe(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&&uIe(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r=e||S<0||u&&b>=s}function m(){var C=CB();if(g(C))return y(C);a=setTimeout(m,d(C))}function y(C){return a=void 0,f&&r?h(C):(r=i=void 0,o)}function w(){a!==void 0&&clearTimeout(a),A=0,r=l=i=a=void 0}function x(){return a===void 0?o:y(CB())}function _(){var C=CB(),S=g(C);if(r=arguments,i=this,l=C,S){if(a===void 0)return p(l);if(u)return clearTimeout(a),a=setTimeout(m,e),h(l)}return a===void 0&&(a=setTimeout(m,e)),o}return _.cancel=w,_.flush=x,_}var SIe="Expected a function";function MIe(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(SIe);return js(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),X8(n,e,{leading:r,maxWait:e,trailing:i})}var TIe=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,A=a-(r.getBoundingClientRect().left+window.pageXOffset),c=l-(r.getBoundingClientRect().top+window.pageYOffset);A<0?A=0:A>s&&(A=s),c<0?c=0:c>o&&(c=o);var u=A/s,f=1-c/o;return{h:t.h,s:u,v:f,a:t.a,source:"hsv"}},IIe=function(){function n(e,t){for(var r=0;r-1}function FMe(n,e){var t=this.__data__,r=v_(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function Tl(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1&&n%1==0&&n<=JTe}function vd(n){return n!=null&&ZT(n.length)&&!$T(n)}function qTe(n){return GA(n)&&vd(n)}function e2e(){return!1}var V8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,FD=V8&&typeof module=="object"&&module&&!module.nodeType&&module,t2e=FD&&FD.exports===V8,UD=t2e?Fo.Buffer:void 0,n2e=UD?UD.isBuffer:void 0,r2e=n2e||e2e;const ex=r2e;var i2e="[object Object]",s2e=Function.prototype,o2e=Object.prototype,j8=s2e.toString,a2e=o2e.hasOwnProperty,l2e=j8.call(Object);function A2e(n){if(!GA(n)||fu(n)!=i2e)return!1;var e=z8(n);if(e===null)return!0;var t=a2e.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&j8.call(t)==l2e}var c2e="[object Arguments]",u2e="[object Array]",f2e="[object Boolean]",h2e="[object Date]",d2e="[object Error]",p2e="[object Function]",m2e="[object Map]",g2e="[object Number]",v2e="[object Object]",y2e="[object RegExp]",w2e="[object Set]",x2e="[object String]",_2e="[object WeakMap]",b2e="[object ArrayBuffer]",B2e="[object DataView]",E2e="[object Float32Array]",C2e="[object Float64Array]",S2e="[object Int8Array]",M2e="[object Int16Array]",T2e="[object Int32Array]",I2e="[object Uint8Array]",R2e="[object Uint8ClampedArray]",F2e="[object Uint16Array]",U2e="[object Uint32Array]",fn={};fn[E2e]=fn[C2e]=fn[S2e]=fn[M2e]=fn[T2e]=fn[I2e]=fn[R2e]=fn[F2e]=fn[U2e]=!0;fn[c2e]=fn[u2e]=fn[b2e]=fn[f2e]=fn[B2e]=fn[h2e]=fn[d2e]=fn[p2e]=fn[m2e]=fn[g2e]=fn[v2e]=fn[y2e]=fn[w2e]=fn[x2e]=fn[_2e]=!1;function L2e(n){return GA(n)&&ZT(n.length)&&!!fn[fu(n)]}function P2e(n){return function(e){return n(e)}}var W8=typeof exports=="object"&&exports&&!exports.nodeType&&exports,lm=W8&&typeof module=="object"&&module&&!module.nodeType&&module,D2e=lm&&lm.exports===W8,EB=D2e&&O8.process,O2e=function(){try{var n=lm&&lm.require&&lm.require("util").types;return n||EB&&EB.binding&&EB.binding("util")}catch{}}();const LD=O2e;var PD=LD&&LD.isTypedArray,N2e=PD?P2e(PD):L2e;const JT=N2e;function AS(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}var k2e=Object.prototype,Q2e=k2e.hasOwnProperty;function H2e(n,e,t){var r=n[e];(!(Q2e.call(n,e)&&Pg(r,t))||t===void 0&&!(e in n))&&YT(n,e,t)}function z2e(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s-1&&n%1==0&&n0){if(++e>=sIe)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var AIe=lIe(iIe);const cIe=AIe;function uIe(n,e){return cIe(tIe(n,e,w_),n+"")}function fIe(n,e,t){if(!Ws(t))return!1;var r=typeof e;return(r=="number"?vd(t)&&qT(e,t.length):r=="string"&&e in t)?Pg(t[e],n):!1}function hIe(n){return uIe(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&&fIe(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r=e||S<0||u&&b>=s}function m(){var C=CB();if(g(C))return y(C);a=setTimeout(m,d(C))}function y(C){return a=void 0,f&&r?h(C):(r=i=void 0,o)}function w(){a!==void 0&&clearTimeout(a),A=0,r=l=i=a=void 0}function x(){return a===void 0?o:y(CB())}function _(){var C=CB(),S=g(C);if(r=arguments,i=this,l=C,S){if(a===void 0)return p(l);if(u)return clearTimeout(a),a=setTimeout(m,e),h(l)}return a===void 0&&(a=setTimeout(m,e)),o}return _.cancel=w,_.flush=x,_}var MIe="Expected a function";function TIe(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(MIe);return Ws(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),X8(n,e,{leading:r,maxWait:e,trailing:i})}var IIe=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,A=a-(r.getBoundingClientRect().left+window.pageXOffset),c=l-(r.getBoundingClientRect().top+window.pageYOffset);A<0?A=0:A>s&&(A=s),c<0?c=0:c>o&&(c=o);var u=A/s,f=1-c/o;return{h:t.h,s:u,v:f,a:t.a,source:"hsv"}},RIe=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 tt(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(tRe,arguments)},brighten:function(){return this._applyModification(nRe,arguments)},darken:function(){return this._applyModification(rRe,arguments)},desaturate:function(){return this._applyModification(JIe,arguments)},saturate:function(){return this._applyModification(qIe,arguments)},greyscale:function(){return this._applyModification(eRe,arguments)},spin:function(){return this._applyModification(iRe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(aRe,arguments)},complement:function(){return this._applyCombination(sRe,arguments)},monochromatic:function(){return this._applyCombination(lRe,arguments)},splitcomplement:function(){return this._applyCombination(oRe,arguments)},triad:function(){return this._applyCombination(GD,[3])},tetrad:function(){return this._applyCombination(GD,[4])}};tt.fromRatio=function(n,e){if(ex(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Dp(n[r]));n=t}return tt(n,e)};function KIe(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=hRe(n)),ex(n)=="object"&&(za(n.r)&&za(n.g)&&za(n.b)?(e=$Ie(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):za(n.h)&&za(n.s)&&za(n.v)?(r=Dp(n.s),i=Dp(n.v),e=XIe(n.h,r,i),o=!0,a="hsv"):za(n.h)&&za(n.s)&&za(n.l)&&(r=Dp(n.s),s=Dp(n.l),e=YIe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=J8(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 $Ie(n,e,t){return{r:gn(n,255)*255,g:gn(e,255)*255,b:gn(t,255)*255}}function kD(n,e,t){n=gn(n,255),e=gn(e,255),t=gn(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?A+(c-A)*6*u:u<1/2?c:u<2/3?A+(c-A)*(2/3-u)*6:A}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 QD(n,e,t){n=gn(n,255),e=gn(e,255),t=gn(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(tt(r));return s}function lRe(n,e){e=e||6;for(var t=tt(n).toHsv(),r=t.h,i=t.s,s=t.v,o=[],a=1/e;e--;)o.push(tt({h:r,s:i,v:s})),s=(s+a)%1;return o}tt.mix=function(n,e,t){t=t===0?0:t||50;var r=tt(n).toRgb(),i=tt(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 tt(o)};tt.readability=function(n,e){var t=tt(n),r=tt(e);return(Math.max(t.getLuminance(),r.getLuminance())+.05)/(Math.min(t.getLuminance(),r.getLuminance())+.05)};tt.isReadable=function(n,e,t){var r=tt.readability(n,e),i,s;switch(s=!1,i=dRe(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};tt.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 A=0;Ai&&(i=s,r=tt(e[A]));return tt.isReadable(n,r,{level:a,size:l})||!o?r:(t.includeFallbackColors=!1,tt.mostReadable(n,["#fff","#000"],t))};var cS=tt.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"},ARe=tt.hexNames=cRe(cS);function cRe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function J8(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function gn(n,e){uRe(n)&&(n="100%");var t=fRe(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 __(n){return Math.min(1,Math.max(0,n))}function Hi(n){return parseInt(n,16)}function uRe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function fRe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function xo(n){return n.length==1?"0"+n:""+n}function Dp(n){return n<=1&&(n=n*100+"%"),n}function q8(n){return Math.round(parseFloat(n)*255).toString(16)}function VD(n){return Hi(n)/255}var fo=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 za(n){return!!fo.CSS_UNIT.exec(n)}function hRe(n){n=n.replace(jIe,"").replace(WIe,"").toLowerCase();var e=!1;if(cS[n])n=cS[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=fo.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=fo.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=fo.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=fo.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=fo.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=fo.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=fo.hex8.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),a:VD(t[4]),format:e?"name":"hex8"}:(t=fo.hex6.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),format:e?"name":"hex"}:(t=fo.hex4.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),a:VD(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=fo.hex3.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function dRe(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 jD=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return VIe(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},Op=function(e,t){var r=e.hex?tt(e.hex):tt(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}},ZA=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&tt(e).isValid()},t2=function(e){if(!e)return"#fff";var t=Op(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"},SB=function(e,t){var r=e.replace("°","");return tt(t+" ("+r+")")._ok},up=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){_Re(i,r);function i(){var s,o,a,l;xRe(this,i);for(var A=arguments.length,c=Array(A),u=0;ua))return!1;var A=s.get(n),c=s.get(e);if(A&&c)return A==e&&c==n;var u=-1,f=!0,h=t&LRe?new tx: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 Mv=24,nUe=Az.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Mv:r,s=n.height,o=s===void 0?Mv:s,a=n.style,l=a===void 0?{}:a,A=tUe(n,["fill","width","height","style"]);return cO.default.createElement("svg",AO({viewBox:"0 0 "+Mv+" "+Mv,style:AO({fill:t,width:i,height:o},l)},A),cO.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"}))},rUe=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(lO(i.s)?r.props.hsl.s:i.s),l:Number(lO(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 rUe(e,[{key:"render",value:function(){var r=this,i=ft({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=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),Y.createElement("div",{style:i.alpha},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),Y.createElement("div",{style:i.alpha},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),Y.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,Y.createElement("div",{style:i.toggle},Y.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},Y.createElement(nUe,{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}(Y.Component);cz.defaultProps={view:"hex"};var uO=function(){var e=ft({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 Y.createElement("div",{style:e.picker})},aUe=function(){var e=ft({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return Y.createElement("div",{style:e.picker})},a2=function(e){var t=e.width,r=e.onChange,i=e.disableAlpha,s=e.rgb,o=e.hsl,a=e.hsv,l=e.hex,A=e.renderers,c=e.styles,u=c===void 0?{}:c,f=e.className,h=f===void 0?"":f,p=e.defaultView,d=ft(Li({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 Y.createElement("div",{style:d.picker,className:"chrome-picker "+h},Y.createElement("div",{style:d.saturation},Y.createElement(x_,{style:d.Saturation,hsl:o,hsv:a,pointer:aUe,onChange:r})),Y.createElement("div",{style:d.body},Y.createElement("div",{style:d.controls,className:"flexbox-fix"},Y.createElement("div",{style:d.color},Y.createElement("div",{style:d.swatch},Y.createElement("div",{style:d.active}),Y.createElement(pd,{renderers:A}))),Y.createElement("div",{style:d.toggles},Y.createElement("div",{style:d.hue},Y.createElement(md,{style:d.Hue,hsl:o,pointer:uO,onChange:r})),Y.createElement("div",{style:d.alpha},Y.createElement(KT,{style:d.Alpha,rgb:s,hsl:o,pointer:uO,renderers:A,onChange:r})))),Y.createElement(cz,{rgb:s,hsl:o,hex:l,view:p,onChange:r,disableAlpha:i})))};a2.propTypes={width:He.oneOfType([He.string,He.number]),disableAlpha:He.bool,styles:He.object,defaultView:He.oneOf(["hex","rgb","hsl"])};a2.defaultProps={width:225,disableAlpha:!1,styles:{}};const lUe=Pi(a2);var AUe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=ft({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:t2(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 Y.createElement(du,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},Y.createElement("div",{style:a.dot}))},cUe=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=ft({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,A){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},A):i({hex:l.hex,source:"hex"},A)};return Y.createElement("div",{style:s.fields,className:"flexbox-fix"},Y.createElement("div",{style:s.active}),Y.createElement(Pt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},l2=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,A=e.className,c=A===void 0?"":A,u=ft(Li({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),f=function(p,d){p.hex?ZA(p.hex)&&t({hex:p.hex,source:"hex"},d):t(p,d)};return Y.createElement(Pg,{style:u.Compact,styles:l},Y.createElement("div",{style:u.compact,className:"compact-picker "+c},Y.createElement("div",null,pu(i,function(h){return Y.createElement(AUe,{key:h,color:h,active:h.toLowerCase()===s,onClick:f,onSwatchHover:r})}),Y.createElement("div",{style:u.clear})),Y.createElement(cUe,{hex:s,rgb:o,onChange:f})))};l2.propTypes={colors:He.arrayOf(He.string),styles:He.object};l2.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:{}};Pi(l2);var uUe=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=ft({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return Y.createElement("div",{style:a.swatch},Y.createElement(du,{color:r,onClick:i,onHover:s,focusStyle:o}))};const fUe=WT(uUe);var A2=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,A=e.className,c=A===void 0?"":A,u=ft(Li({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(p,d){return i({hex:p,source:"hex"},d)};return Y.createElement("div",{style:u.card,className:"github-picker "+c},Y.createElement("div",{style:u.triangleShadow}),Y.createElement("div",{style:u.triangle}),pu(r,function(h){return Y.createElement(fUe,{color:h,key:h,onClick:f,onSwatchHover:s})}))};A2.propTypes={width:He.oneOfType([He.string,He.number]),colors:He.arrayOf(He.string),triangle:He.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:He.object};A2.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};Pi(A2);var hUe=function(e){var t=e.direction,r=ft({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 Y.createElement("div",{style:r.picker})},dUe=Object.assign||function(n){for(var e=1;e.5});return Y.createElement("div",{style:r.picker})},vUe=function(){var e=ft({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 Y.createElement("div",{style:e.pointer},Y.createElement("div",{style:e.left},Y.createElement("div",{style:e.leftInside})),Y.createElement("div",{style:e.right},Y.createElement("div",{style:e.rightInside})))},fO=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=ft({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 Y.createElement("div",{style:o.button,onClick:t},r||i)},yUe=function(e){var t=e.rgb,r=e.currentColor,i=ft({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 Y.createElement("div",null,Y.createElement("div",{style:i.label},"new"),Y.createElement("div",{style:i.swatches},Y.createElement("div",{style:i.new}),Y.createElement("div",{style:i.current})),Y.createElement("div",{style:i.label},"current"))},wUe=function(){function n(e,t){for(var r=0;r100&&(c.a=100),c.a/=100,t({h:i.h,s:i.s,l:i.l,a:c.a,source:"rgb"},u))};return Y.createElement("div",{style:a.fields,className:"flexbox-fix"},Y.createElement("div",{style:a.double},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.alpha},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},EUe=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Tv=24,FUe=fz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Tv:r,s=n.height,o=s===void 0?Tv:s,a=n.style,l=a===void 0?{}:a,A=RUe(n,["fill","width","height","style"]);return dO.default.createElement("svg",hO({viewBox:"0 0 "+Tv+" "+Tv,style:hO({fill:t,width:i,height:o},l)},A),dO.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},UUe=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,A=ft({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:t2(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 Y.createElement(du,{color:t,style:A.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},Y.createElement("div",{style:A.check},Y.createElement(FUe,null)))},LUe=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=ft({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return Y.createElement("div",{style:o.group},pu(i,function(a,l){return Y.createElement(UUe,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},d2=function(e){var t=e.width,r=e.height,i=e.onChange,s=e.onSwatchHover,o=e.colors,a=e.hex,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,f=ft(Li({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},A)),h=function(d,g){return i({hex:d,source:"hex"},g)};return Y.createElement("div",{style:f.picker,className:"swatches-picker "+u},Y.createElement(Pg,null,Y.createElement("div",{style:f.overflow},Y.createElement("div",{style:f.body},pu(o,function(p){return Y.createElement(LUe,{key:p.toString(),group:p,active:a,onClick:h,onSwatchHover:s})}),Y.createElement("div",{style:f.clear})))))};d2.propTypes={width:He.oneOfType([He.string,He.number]),height:He.oneOfType([He.string,He.number]),colors:He.arrayOf(He.arrayOf(He.string)),styles:He.object};d2.defaultProps={width:320,height:240,colors:[[sf[900],sf[700],sf[500],sf[300],sf[100]],[of[900],of[700],of[500],of[300],of[100]],[af[900],af[700],af[500],af[300],af[100]],[lf[900],lf[700],lf[500],lf[300],lf[100]],[Af[900],Af[700],Af[500],Af[300],Af[100]],[cf[900],cf[700],cf[500],cf[300],cf[100]],[uf[900],uf[700],uf[500],uf[300],uf[100]],[ff[900],ff[700],ff[500],ff[300],ff[100]],[hf[900],hf[700],hf[500],hf[300],hf[100]],["#194D33",Np[700],Np[500],Np[300],Np[100]],[df[900],df[700],df[500],df[300],df[100]],[pf[900],pf[700],pf[500],pf[300],pf[100]],[mf[900],mf[700],mf[500],mf[300],mf[100]],[gf[900],gf[700],gf[500],gf[300],gf[100]],[vf[900],vf[700],vf[500],vf[300],vf[100]],[yf[900],yf[700],yf[500],yf[300],yf[100]],[wf[900],wf[700],wf[500],wf[300],wf[100]],[xf[900],xf[700],xf[500],xf[300],xf[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Pi(d2);var p2=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.hex,s=e.colors,o=e.width,a=e.triangle,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,f=ft(Li({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"}}},A),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right"}),h=function(d,g){ZA(d)&&t({hex:d,source:"hex"},g)};return Y.createElement("div",{style:f.card,className:"twitter-picker "+u},Y.createElement("div",{style:f.triangleShadow}),Y.createElement("div",{style:f.triangle}),Y.createElement("div",{style:f.body},pu(s,function(p,d){return Y.createElement(du,{key:d,color:p,hex:p,style:f.swatch,onClick:h,onHover:r,focusStyle:{boxShadow:"0 0 4px "+p}})}),Y.createElement("div",{style:f.hash},"#"),Y.createElement(Pt,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:h}),Y.createElement("div",{style:f.clear})))};p2.propTypes={width:He.oneOfType([He.string,He.number]),triangle:He.oneOf(["hide","top-left","top-right"]),colors:He.arrayOf(He.string),styles:He.object};p2.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Pi(p2);var m2=function(e){var t=ft({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 Y.createElement("div",{style:t.picker})};m2.propTypes={hsl:He.shape({h:He.number,s:He.number,l:He.number,a:He.number})};m2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var g2=function(e){var t=ft({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 Y.createElement("div",{style:t.picker})};g2.propTypes={hsl:He.shape({h:He.number,s:He.number,l:He.number,a:He.number})};g2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var PUe=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(h,p){if(h.hex)ZA(h.hex)&&t({hex:h.hex,source:"hex"},p);else if(h.rgb){var d=h.rgb.split(",");SB(h.rgb,"rgb")&&t({r:d[0],g:d[1],b:d[2],a:1,source:"rgb"},p)}else if(h.hsv){var g=h.hsv.split(",");SB(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"},p))}else if(h.hsl){var m=h.hsl.split(",");SB(h.hsl,"hsl")&&(m[2]=m[2].replace("%",""),m[1]=m[1].replace("%",""),m[0]=m[0].replace("°",""),u[1]==1?u[1]=.01:u[2]==1&&(u[2]=.01),t({h:Number(m[0]),s:Number(m[1]),v:Number(m[2]),source:"hsl"},p))}},l=ft({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"}}}),A=r.r+", "+r.g+", "+r.b,c=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 Y.createElement("div",{style:l.wrap,className:"flexbox-fix"},Y.createElement("div",{style:l.fields},Y.createElement("div",{style:l.double},Y.createElement(Pt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),Y.createElement("div",{style:l.column},Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"rgb",value:A,onChange:a})),Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsl",value:c,onChange:a})))))},v2=function(e){var t=e.width,r=e.onChange,i=e.rgb,s=e.hsl,o=e.hsv,a=e.hex,l=e.header,A=e.styles,c=A===void 0?{}:A,u=e.className,f=u===void 0?"":u,h=ft(Li({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"}}},c));return Y.createElement("div",{style:h.picker,className:"google-picker "+f},Y.createElement("div",{style:h.head},l),Y.createElement("div",{style:h.swatch}),Y.createElement("div",{style:h.saturation},Y.createElement(x_,{hsl:s,hsv:o,pointer:m2,onChange:r})),Y.createElement("div",{style:h.body},Y.createElement("div",{style:h.controls,className:"flexbox-fix"},Y.createElement("div",{style:h.hue},Y.createElement(md,{style:h.Hue,hsl:s,radius:"4px",pointer:g2,onChange:r}))),Y.createElement(PUe,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};v2.propTypes={width:He.oneOfType([He.string,He.number]),styles:He.object,header:He.string};v2.defaultProps={width:652,styles:{},header:"Color picker"};Pi(v2);const DUe="_InformationContainerPos_1yd4c_2",OUe="_scrollContainer_1yd4c_15",TB={InformationContainerPos:DUe,scrollContainer:OUe,"options-container":"_options-container_1yd4c_24"},NUe="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=",kUe="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==",QUe="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==",HUe="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",zUe="_InformationContainerPos_1m76y_2",GUe="_scrollContainer_1m76y_15",VUe="_centerAlign_1m76y_25",jUe="_traitInfoTitle_1m76y_28",WUe="_dropdownFlex_1m76y_38",KUe="_checkboxFlex_1m76y_44",$Ue="_simpleFlex_1m76y_49",YUe="_traitInfoText_1m76y_55",XUe="_dropdownBase_1m76y_64",ZUe="_dropdownControl_1m76y_74",JUe="_dropdownControlSmall_1m76y_80",qUe="_flexSelect_1m76y_106",eLe="_checked_1m76y_163",tLe="_checkmark_1m76y_167",nLe="_checkboxHolder_1m76y_180",rLe="_actionButton_1m76y_189",iLe="_tabHolder_1m76y_209",sLe="_tabButton_1m76y_215",oLe="_tabButtonSelected_1m76y_235",Ve={InformationContainerPos:zUe,scrollContainer:GUe,centerAlign:VUe,traitInfoTitle:jUe,dropdownFlex:WUe,checkboxFlex:KUe,simpleFlex:$Ue,traitInfoText:YUe,dropdownBase:XUe,dropdownControl:ZUe,dropdownControlSmall:JUe,"input-box":"_input-box_1m76y_87",flexSelect:qUe,"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:eLe,checkmark:tLe,checkboxHolder:nLe,actionButton:rLe,tabHolder:iLe,tabButton:sLe,tabButtonSelected:oLe},aLe="_slider_1y6nx_1",lLe="_infoContainer_1y6nx_13",Iv={"slider-container":"_slider-container_1y6nx_1",slider:aLe,infoContainer:lLe,"input-box":"_input-box_1y6nx_18"};function $f({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Iv.infoContainer,children:[n,o&&k.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:Iv["input-box"],step:o})]}),k.jsx("div",{className:Iv["slider-container"],children:k.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:Iv.slider,step:s})})]})}function ALe({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=ye.useContext(or),[i,s]=ye.useState(0),[o,a]=ye.useState(0),[l,A]=ye.useState(0);ye.useEffect(()=>{var p,d,g;e!=null&&(A((p=e.data)==null?void 0:p.cullingLayer),s(((d=e.data)==null?void 0:d.cullingDistance[0])||0),a(((g=e.data)==null?void 0:g.cullingDistance[1])||0))},[e]);const c=p=>{s(p.target.value),e!=null&&e.data&&(e.data.cullingDistance[0]=p.target.value)},u=p=>{a(p.target.value),e!=null&&e.data&&(e.data.cullingDistance[1]=p.target.value)},f=p=>{e!=null&&e.data&&(A(p.target.value),e.data.cullingLayer=p.target.value)},h=()=>{r.updateCullHiddenMeshes()};return k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Trait Information",width:180,right:20}),k.jsx("div",{className:Ve.scrollContainer,children:n!=null?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Trait ID"}),k.jsx("div",{className:Ve.traitInfoText,children:n==null?void 0:n.id}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Trait Name"}),k.jsx("div",{className:Ve.traitInfoText,children:n==null?void 0:n.name}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Description"}),k.jsx("div",{className:Ve.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Culling Options"}),k.jsx("br",{}),k.jsxs("div",{className:Ve.traitInfoText,children:["Culling Layer",k.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:f,className:Ve["input-box"],step:1}),k.jsx("br",{}),k.jsx("br",{}),k.jsx($f,{title:"Out Distance",value:i,onChange:c,min:0,max:1,step:.001,stepBox:.01}),k.jsx("br",{}),k.jsx($f,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),k.jsx("div",{className:Ve.actionButton,onClick:h,children:k.jsx("div",{children:"Update Culling "})})]})]}):k.jsx(k.Fragment,{children:k.jsx("div",{className:Ve.traitInfoTitle,children:"No Trait Selected"})})})]})})}var hz={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=s(ye),t=r(Y5);function r(C){return C&&C.__esModule?C:{default:C}}function i(){if(typeof WeakMap!="function")return null;var C=new WeakMap;return i=function(){return C},C}function s(C){if(C&&C.__esModule)return C;if(C===null||o(C)!=="object"&&typeof C!="function")return{default:C};var S=i();if(S&&S.has(C))return S.get(C);var b={},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var D in C)if(Object.prototype.hasOwnProperty.call(C,D)){var $=M?Object.getOwnPropertyDescriptor(C,D):null;$&&($.get||$.set)?Object.defineProperty(b,D,$):b[D]=C[D]}return b.default=C,S&&S.set(C,b),b}function o(C){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(b){return typeof b}:o=function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},o(C)}function a(){return a=Object.assign||function(C){for(var S=1;S"u"?w:b.placeholder,value:""},isOpen:!1},M.dropdownRef=(0,e.createRef)(),M.mounted=!0,M.handleDocumentClick=M.handleDocumentClick.bind(g(M)),M.fireChangeEvent=M.fireChangeEvent.bind(g(M)),M}return h(S,[{key:"componentDidUpdate",value:function(M){if(this.props.value!==M.value)if(this.props.value){var D=this.parseValue(this.props.value,this.props.options);D!==this.state.selected&&this.setState({selected:D})}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(M){this.props.onFocus&&typeof this.props.onFocus=="function"&&this.props.onFocus(this.state.isOpen),!(M.type==="mousedown"&&M.button!==0)&&(M.stopPropagation(),M.preventDefault(),this.props.disabled||this.setState({isOpen:!this.state.isOpen}))}},{key:"parseValue",value:function(M,D){var $;if(typeof M=="string")for(var H=0,I=D.length;H"u"&&($=M.label||M);var H=M.label||M.value||M,I=$===this.state.selected.value||$===this.state.selected,v=(D={},c(D,"".concat(this.props.baseClassName,"-option"),!0),c(D,M.className,!!M.className),c(D,"is-selected",I),D),E=(0,t.default)(v),U=Object.keys(M.data||{}).reduce(function(P,L){return A({},P,c({},"data-".concat(L),M.data[L]))},{});return e.default.createElement("div",a({key:$,className:E,onMouseDown:this.setValue.bind(this,$,H),onClick:this.setValue.bind(this,$,H),role:"option","aria-selected":I?"true":"false"},U),H)}},{key:"buildMenu",value:function(){var M=this,D=this.props,$=D.options,H=D.baseClassName,I=$.map(function(v){if(v.type==="group"){var E=e.default.createElement("div",{className:"".concat(H,"-title")},v.name),U=v.items.map(function(P){return M.renderOption(P)});return e.default.createElement("div",{className:"".concat(H,"-group"),key:v.name,role:"listbox",tabIndex:"-1"},E,U)}else return M.renderOption(v)});return I.length?I:e.default.createElement("div",{className:"".concat(H,"-noresults")},"No options found")}},{key:"handleDocumentClick",value:function(M){this.mounted&&(this.dropdownRef.current.contains(M.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 M,D,$,H,I,v=this.props,E=v.baseClassName,U=v.controlClassName,P=v.placeholderClassName,L=v.menuClassName,z=v.arrowClassName,K=v.arrowClosed,O=v.arrowOpen,B=v.className,W=this.props.disabled?"Dropdown-disabled":"",ee=typeof this.state.selected=="string"?this.state.selected:this.state.selected.label,F=(0,t.default)((M={},c(M,"".concat(E,"-root"),!0),c(M,B,!!B),c(M,"is-open",this.state.isOpen),M)),X=(0,t.default)((D={},c(D,"".concat(E,"-control"),!0),c(D,U,!!U),c(D,W,!!W),D)),ue=(0,t.default)(($={},c($,"".concat(E,"-placeholder"),!0),c($,P,!!P),c($,"is-selected",this.isValueSelected()),$)),le=(0,t.default)((H={},c(H,"".concat(E,"-menu"),!0),c(H,L,!!L),H)),oe=(0,t.default)((I={},c(I,"".concat(E,"-arrow"),!0),c(I,z,!!z),I)),re=e.default.createElement("div",{className:ue},ee),pe=this.state.isOpen?e.default.createElement("div",{className:le,"aria-expanded":"true"},this.buildMenu()):null;return e.default.createElement("div",{ref:this.dropdownRef,className:F},e.default.createElement("div",{className:X,onMouseDown:this.handleMouseDown.bind(this),onTouchEnd:this.handleMouseDown.bind(this),"aria-haspopup":"listbox"},re,e.default.createElement("div",{className:"".concat(E,"-arrow-wrapper")},O&&K?this.state.isOpen?O:K:e.default.createElement("span",{className:oe}))),pe)}}]),S}(e.Component);x.defaultProps={baseClassName:"Dropdown"};var _=x;n.default=_})(hz);const Jl=bl(hz);function cLe({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=Y.useContext(or),[s,o]=ye.useState([]),[a,l]=ye.useState(null),A=u=>{(t==null?void 0:t.loras)!=null&&(l(t.loras[u.value]),console.log(t.loras[u.value]))},c=async()=>{const u=i.parent;u.remove(i),await r.createLoraData(a),u.add(i)};return ye.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]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Lora Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Lora Manifests"}),k.jsx(Jl,{className:Ve.dropdownControl,options:s,onChange:A,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&k.jsx("div",{className:Ve.actionButton,onClick:c,children:k.jsx("div",{children:" Create Lora Data "})})]})]})})}function uLe({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=Y.useContext(or),[s,o]=ye.useState([]),[a,l]=ye.useState(""),[A,c]=ye.useState(null),u=h=>{(t==null?void 0:t.sprites)!=null&&(l(t.sprites[h.value].description),c(t.sprites[h.value]))},f=async()=>{const h=i.parent;h.remove(i),await r.createSpriteAtlas(A),h.add(i)};return ye.useEffect(()=>{if((t==null?void 0:t.sprites)!=null){const h=t.sprites.map((p,d)=>({value:d,label:p.name,description:p.description,manifest:p.manifest}));o(h)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Sprite Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Sprite Manifests"}),k.jsx(Jl,{className:Ve.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:a||""}),A!=null&&k.jsx("div",{className:Ve.actionButton,onClick:f,children:k.jsx("div",{children:" Create Sprite Data "})})]})]})})}const pO=4096;function fLe({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=Y.useContext(or),[o,a]=ye.useState([]),[l,A]=ye.useState(""),[c,u]=ye.useState(""),[f,h]=ye.useState(""),[p,d]=ye.useState(!1),[g,m]=ye.useState(512),[y,w]=ye.useState(512),[x,_]=ye.useState(.1),[C,S]=ye.useState(.1),[b,M]=ye.useState("center"),[D,$]=ye.useState("center"),[H,I]=ye.useState("center"),[v,E]=ye.useState("head"),[U,P]=ye.useState("chest"),[L,z]=ye.useState(!0),[K,O]=ye.useState(!1),B=[{label:"center"},{label:"left"},{label:"right"}],W=[{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"}],X=Ae=>{(t==null?void 0:t.thumbnails)!=null&&(A(t.thumbnails[Ae.value].description),h(t.thumbnails[Ae.value].manifest),u(t.thumbnails[Ae.value].name))},ue=(Ae,q,J,ce)=>isNaN(Ae)?ce:Ae>J?J:Ae{const q=parseInt(Ae.target.value);m(ue(q,1,pO,512))},oe=Ae=>{const q=parseInt(Ae.target.value);w(ue(q,1,pO,512))},re=Ae=>{const q=parseFloat(Ae.target.value);_(ue(q,0,1,.1))},pe=Ae=>{const q=parseFloat(Ae.target.value);S(ue(q,0,1,.1))},_e=Ae=>{d(Ae)},Re=async()=>{const Ae=i.parent;Ae.remove(i),await r.createThumbnails(t.thumbnails[0]),Ae.add(i)},Q=(Ae=!0)=>({topFrameOffset:C,bottomFrameOffset:x,thumbnailsWidth:g,thumbnailsHeight:y,backgroundColor:[0,0,0,0],thumbnailsCollection:[{traitGroup:e,cameraPosition:D+"-"+H+"-"+b,topBoneName:v==="upperLeg"||v==="lowerLeg"||v==="foot"?"left"+v[0].toUpperCase()+v.slice(1):v,topBoneMaxVertex:L,bottomBoneName:U==="upperLeg"||U==="lowerLeg"||v==="foot"?"left"+U[0].toUpperCase()+U.slice(1):U,bottomBoneMaxVertex:K,saveOnlyIDs:Ae?null:n.id}]}),de=async(Ae=!1)=>{s.storeCurrentAvatar();const q=i.parent;q.remove(i),Ae?await r.createThumbnailsWithObjectData(Q(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(Q(!1),!1),q.add(i),s.loadStoredAvatar()};return ye.useEffect(()=>{if((t==null?void 0:t.thumbnails)!=null){const Ae=t.thumbnails.map((q,J)=>({value:J,label:q.name,description:q.description,manifest:q.manifest}));a(Ae)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(wa,{title:"Thumbnail Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsxs("div",{className:Ve.tabHolder,children:[k.jsx("div",{className:Ve.tabButton+(p?"":" "+Ve.tabButtonSelected),onClick:()=>{_e(!1)},children:k.jsxs("div",{children:[" ","Custom"," "]})}),k.jsx("div",{className:Ve.tabButton+(p?" "+Ve.tabButtonSelected:""),onClick:()=>{_e(!0)},children:k.jsxs("div",{children:[" ","Manifest"," "]})})]}),k.jsx("br",{}),p?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,children:"Thumbnail Manifests"}),k.jsx(Jl,{className:Ve.dropdownControl,options:o,value:c,onChange:X,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:l||""}),f!=""&&k.jsx("div",{className:Ve.actionButton,onClick:Re,children:k.jsx("div",{children:" Create Thumbnails "})})]}):k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Ve.traitInfoText,children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",k.jsx("input",{value:g,className:Ve["input-box"],step:1,onChange:Ae=>{m(Ae.target.value)},onBlur:le}),k.jsx("br",{}),"Height ",k.jsx("input",{value:y,className:Ve["input-box"],step:1,onChange:Ae=>{w(Ae.target.value)},onBlur:oe}),k.jsx("br",{}),"Top Spacing ",k.jsx("input",{value:x,className:Ve["input-box"],step:.1,onChange:Ae=>{_(Ae.target.value)},onBlur:re}),k.jsx("br",{}),"Bottom Spacing ",k.jsx("input",{value:C,className:Ve["input-box"],step:.1,onChange:Ae=>{S(Ae.target.value)},onBlur:pe}),k.jsx("br",{}),k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"X"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:B,onChange:Ae=>{$(Ae.label)},value:D})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Y"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:W,onChange:Ae=>{I(Ae.label)},value:H})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Z"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:ee,onChange:Ae=>{M(Ae.label)},value:b})]}),k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),k.jsxs("div",{className:Ve.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Top"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:F,onChange:Ae=>{E(Ae.label)},value:v})]}),k.jsxs("div",{className:Ve.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),k.jsx(Jl,{className:Ve.dropdownControlSmall,options:F,onChange:Ae=>{P(Ae.label)},value:U})]}),k.jsxs("div",{style:{textAlign:"left"},children:[k.jsxs("div",{className:Ve.checkboxFlex,style:{marginTop:"20px"},children:[k.jsx("input",{type:"checkbox",checked:L,onChange:Ae=>{z(Ae.target.checked)}}),k.jsx("div",{className:Ve.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${L?"uses Top":"uses Low"} Vertex`})]}),k.jsxs("div",{className:Ve.checkboxFlex,style:{marginTop:"10px"},children:[k.jsx("input",{type:"checkbox",checked:K,onChange:Ae=>{O(Ae.target.checked)}}),k.jsx("div",{className:Ve.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${K?"uses Top":"uses Low"} Vertex`})]})]}),e==""?k.jsx("div",{className:Ve.traitInfoText+" "+Ve.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{marginTop:"20px"},children:"Generate"}),k.jsx("div",{className:Ve.traitInfoText+" "+Ve.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),k.jsxs("div",{className:Ve.simpleFlex,style:{marginTop:"0px"},children:[k.jsx("div",{className:Ve.actionButton,style:{margin:"0px"},onClick:()=>{de(!1)},children:k.jsx("div",{children:" Current "})}),k.jsx("div",{className:Ve.actionButton,style:{margin:"0px"},onClick:()=>{de(!0)},children:k.jsx("div",{children:" All "})})]})]})]})]})]})})}function hLe({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=Y.useState(""),s=o=>{o!=r?i(o):i("")};return k.jsxs("div",{children:[r=="Information"&&k.jsx(ALe,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&k.jsx(cLe,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&k.jsx(uLe,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&k.jsx(fLe,{selectedTrait:n,traitGroupName:t}),k.jsxs("div",{className:TB.InformationContainerPos,children:[k.jsx(wa,{title:"Tools",width:90,right:0}),k.jsx("div",{className:TB.scrollContainer,children:k.jsxs("div",{className:TB.optionsContainer,children:[k.jsx("div",{onClick:()=>{s("Information")},children:k.jsx(pA,{size:56,icon:NUe,rarity:r=="Information"?"mythic":"none"})},"Information"),k.jsx("div",{onClick:()=>{s("LoraCreation")},children:k.jsx(pA,{size:56,icon:QUe,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),k.jsx("div",{onClick:()=>{s("SpriteCreation")},children:k.jsx(pA,{size:56,icon:kUe,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),k.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:k.jsx(pA,{size:56,icon:HUe,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation")]})})]})]})}function dLe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,loraDataGenerator:a,spriteAtlasGenerator:l,thumbnailsGenerator:A,sceneElements:c}=Y.useContext(or),{playSound:u}=Y.useContext(Ys),{isMute:f}=Y.useContext($s),{t:h}=ye.useContext(To),p=()=>{!f&&u("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(dt.CREATE),r(!1)},[d,g]=Y.useState(null),[m,y]=Y.useState(null),[w,x]=Y.useState(""),[_,C]=Y.useState(null),[S,b]=Y.useState(null),[M,D]=Y.useState(""),[$,H]=Y.useState(!1),[I,v]=Y.useState({background:"#ffffff"}),E=()=>{!f&&u("backNextButton"),e(dt.SAVE),r(!1)},U=()=>{t(!0),g(null),i.loadRandomTraits().then(()=>{console.log("success"),w!=""&&C(i.getCurrentTraitData(w)),t(!1)}).catch(oe=>{t(!1),console.error("Error loading random traits:",oe.message)})},P=oe=>{v({background:oe.hex})},L=oe=>{v({background:oe.hex}),i.setTraitColor(w,oe.hex)},z=async oe=>{const re=ul(oe.name),pe=URL.createObjectURL(oe);await s.loadAnimation(pe,!1,0,!0,"",re),D(s.getCurrentAnimationName())},K=oe=>{if(H(!1),w!=""){t(!0);const re=URL.createObjectURL(oe);i.loadCustomTexture(w,re).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},O=oe=>{if(H(!1),w!=""){t(!0);const re=URL.createObjectURL(oe);i.loadCustomTrait(w,re).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},B=oe=>{H(!1),t(!0),i.loadTrait(oe.traitGroup.trait,oe.id).then(()=>{t(!1),C(oe)})},W=oe=>{H(!1),i.removeTrait(oe),C(null)},ee=oe=>{H(!1),t(!0),i.loadRandomTrait(oe).then(()=>{t(!1),C(i.getCurrentTraitData(oe))})},F=oe=>{H(!1);const re=Array.from(oe),pe=[],_e=Re=>new Promise((Q,de)=>{var Ae;if(Re&&Re.name.toLowerCase().endsWith(".json")){const q=new FileReader,J=`${(Ae=i.manifestData)==null?void 0:Ae.getAssetsDirectory()}/anata/_thumbnails/t_${Re.name.split("_")[0]}.jpg`;console.log(J),q.onload=function(ce){try{const xe=JSON.parse(ce.target.result);xe.thumb=J,pe.push(xe),Q()}catch(xe){console.error("Error parsing the JSON file:",xe),de(xe)}},q.readAsText(Re)}});Promise.all(re.map(_e)).then(()=>{pe.length>0&&(g(pe),t(!0),i.loadTraitsFromNFTObject(pe[0]).then(()=>{t(!1)}))}).catch(Re=>{console.error("Error processing files:",Re)})},X=async oe=>{const re=oe[0];re&&re.name.toLowerCase().endsWith(".fbx")&&z(re),re&&(re.name.toLowerCase().endsWith(".png")||re.name.toLowerCase().endsWith(".jpg"))&&K(re),re&&re.name.toLowerCase().endsWith(".vrm")&&O(re),re&&re.name.toLowerCase().endsWith(".json")&&F(oe)},ue=oe=>{!f&&u("optionClick"),H(!1),w!==oe.trait?(y(i.getTraits(oe.trait)),x(oe.trait),C(i.getCurrentTraitData(oe.trait)),b(i.getCurrentTraitVRM(oe.trait)),o({targetY:oe.cameraTarget.height,distance:oe.cameraTarget.distance})):(y(null),x(""),C(null),o({targetY:.8,distance:3.2}))},le=()=>{H(!1);var oe=document.createElement("input");oe.type="file",oe.accept=".vrm",oe.onchange=re=>{var pe=re.target.files[0];if(pe.name.endsWith(".vrm")){const _e=URL.createObjectURL(pe);t(!0),i.loadCustomTrait(w,_e).then(()=>{t(!1)})}},oe.click()};return k.jsxs("div",{className:Ln.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:h("pageTitles.chooseAppearance")}),k.jsx(Cg,{onFilesDrop:X}),k.jsxs("div",{className:Ln.sideMenu,children:[k.jsx(wa,{title:"Appearance",left:20}),k.jsx("div",{className:Ln.bottomLine}),k.jsx("div",{className:Ln.scrollContainer,children:k.jsx("div",{className:Ln["editor-container"],children:i.getGroupTraits().map((oe,re)=>k.jsxs("div",{className:Ln.editorButton,onClick:()=>{ue(oe)},children:[k.jsx(pA,{size:56,icon:oe.fullIconSvg,rarity:w!==oe.trait?"none":"mythic"}),k.jsx("div",{className:Ln.editorText,children:oe.name})]},"options_"+re))})})]}),!!m&&k.jsxs("div",{className:Ln.selectorContainerPos,children:[k.jsx(wa,{title:w,width:130,left:20}),_&&k.jsx("div",{className:Ln.selectorColorPickerButton,onClick:()=>{H(!$)},children:k.jsx("img",{className:Ln.selectorColorPickerImg,src:jme})}),!!$&&k.jsx("div",{draggable:!1,className:Ln.selectorColorPickerUI,children:k.jsx(lUe,{draggable:!1,width:"200px",color:I.background,onChange:P,onChangeComplete:L})}),k.jsx("div",{className:Ln.bottomLine}),k.jsx("div",{className:Ln.scrollContainerOptions,children:k.jsxs("div",{className:Ln["selector-container"],children:[k.jsx("div",{className:`${Ln.selectorButton}`,onClick:()=>{ee(w)},children:k.jsx(pA,{size:56,icon:Vme,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(w)?k.jsx(k.Fragment,{}):k.jsx("div",{className:`${Ln.selectorButton}`,icon:UP,onClick:()=>{W(w)},children:k.jsx(pA,{size:56,icon:UP,rarity:_==null?"mythic":"none"})},"no-trait"),m.map(oe=>{let re=oe.id===(_==null?void 0:_.id);return k.jsx("div",{className:`${Ln.selectorButton}`,onClick:()=>{B(oe)},children:k.jsx(pA,{size:56,icon:oe.fullThumbnail,rarity:re?"mythic":"none"})},oe.id)})]})}),k.jsx("div",{className:Ln.uploadContainer,children:k.jsx("div",{className:Ln.uploadButton,onClick:le,children:k.jsx("div",{children:"Upload "})})})]}),k.jsx(ST,{jsonSelectionArray:d}),k.jsx(hLe,{selectedTrait:_,selectedVRM:S,traitGroupName:w}),k.jsx(a_,{loadedAnimationName:M,randomize:U}),k.jsxs("div",{className:Ln.buttonContainer,children:[k.jsx(_n,{theme:"light",text:h("callToAction.back"),size:14,className:Ln.buttonLeft,onClick:p}),i.canDownload()&&k.jsx(_n,{theme:"light",text:h("callToAction.next"),size:14,className:Ln.buttonRight,onClick:E})]})]})}const pLe="_InformationContainerPos_rgqwy_1",mLe="_traitInfoTitle_rgqwy_13",gLe="_traitInfoText_rgqwy_21",vLe="_flexSelect_rgqwy_30",yLe="_scrollContainer_rgqwy_65",wLe="_checked_rgqwy_90",xLe="_checkmark_rgqwy_94",_Le="_checkboxHolder_rgqwy_107",bLe="_buttonContainer_rgqwy_114",BLe="_buttonLeft_rgqwy_123",ELe="_buttonRight_rgqwy_127",CLe="_buttonCenter_rgqwy_131",ci={InformationContainerPos:pLe,traitInfoTitle:mLe,traitInfoText:gLe,flexSelect:vLe,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:yLe,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:wLe,checkmark:xLe,checkboxHolder:_Le,buttonContainer:bLe,buttonLeft:BLe,buttonRight:ELe,buttonCenter:CLe},SLe="_InformationContainerPos_11mqa_2",MLe="_scrollContainer_11mqa_16",TLe="_traitInfoTitle_11mqa_28",ILe="_traitInfoText_11mqa_38",RLe="_flexSelect_11mqa_66",FLe="_checked_11mqa_124",ULe="_checkmark_11mqa_128",LLe="_checkboxHolder_11mqa_141",Gn={InformationContainerPos:SLe,scrollContainer:MLe,traitInfoTitle:TLe,traitInfoText:ILe,"input-box":"_input-box_11mqa_47",flexSelect:RLe,"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:FLe,checkmark:ULe,checkboxHolder:LLe};function y2({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=Y.useContext(or),[a,l]=ye.useState(0),[A,c]=ye.useState(0),[u,f]=ye.useState(0),[h,p]=ye.useState(0),[d,g]=ye.useState(0),[m,y]=ye.useState(0),[w,x]=ye.useState(0),[_,C]=ye.useState(0),[S,b]=ye.useState(0),[M,D]=ye.useState(0);return ye.useEffect(()=>{if(n!=null){const $=zh(n,"Mesh"),H=zh(n,"SkinnedMesh");l($.length),c(H.length);const I=$.concat(H),{stdMats:v,stdCutoutpMats:E,stdTranspMats:U,mToonMats:P,mToonCutoutMats:L,mToonTranspMats:z}=Oue(I);f(v.length),p(U.length),g(E.length),y(P.length),x(z.length),C(L.length);const{triangles:K,bones:O}=o.getBoneTriangleCount();b(K),D(O)}},[n]),n!=null?k.jsx("div",{children:k.jsxs("div",{className:Gn.InformationContainerPos,children:[k.jsx(wa,{title:"Model Information",width:180,right:20}),k.jsxs("div",{className:Gn.scrollContainer,children:[k.jsxs("div",{className:Gn.flexSelect,children:[(t==null?void 0:t.length)>1?k.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["left-button"]}`,onClick:s}):k.jsx(k.Fragment,{}),e&&k.jsx("div",{style:{textAlign:"center"},children:k.jsx("div",{className:Gn.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?k.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["right-button"]}`,onClick:i}):k.jsx(k.Fragment,{})]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"Geometry info:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["Meshes: ",a]}),k.jsxs("div",{className:Gn.traitInfoText,children:["SkinnedMeshes: ",A]}),k.jsxs("div",{className:Gn.traitInfoText,children:["Triangles: ",S]}),k.jsxs("div",{className:Gn.traitInfoText,children:["Bones: ",M]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"Standard Material Count:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",u]}),k.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",d]}),k.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",h]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"MToon Material Count:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",m]}),k.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",_]}),k.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",w]})]})]})}):k.jsx(k.Fragment,{})}const PLe="_InformationContainerPos_b0msk_1",DLe="_traitInfoTitle_b0msk_13",OLe="_traitInfoText_b0msk_22",NLe="_flexSelect_b0msk_33",kLe="_scrollContainer_b0msk_68",QLe="_checked_b0msk_93",HLe="_checkmark_b0msk_97",zLe="_checkboxHolder_b0msk_110",lt={InformationContainerPos:PLe,traitInfoTitle:DLe,traitInfoText:OLe,flexSelect:NLe,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:kLe,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:QLe,checkmark:HLe,checkboxHolder:zLe};function B_({showDropToDownload:n,showCreateAtlas:e,mergeMenuTitle:t}){const[r,i]=ye.useState(Oe.mergeOptions_atlas_std_size||6),[s,o]=ye.useState(Oe.mergeOptions_atlas_std_transp_size||6),[a,l]=ye.useState(Oe.mergeOptions_atlas_mtoon_size||6),[A,c]=ye.useState(Oe.mergeOptions_atlas_mtoon_transp_size||6),[u,f]=ye.useState(Oe.mergeOptions_sel_option||0),[h,p]=ye.useState(Oe.mergeOptions_two_sided_mat||!1),[d]=ye.useState(["Merge to Standard","Merge to MToon","Keep Both"]),[g,m]=ye.useState(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm),[y,w]=ye.useState(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview),[x,_]=ye.useState(Oe.mergeOptions_drop_download||!1),[C,S]=ye.useState(Oe.merge_options_ktx_compression||!1),[b,M]=ye.useState(Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas),[D,$]=ye.useState(Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora),[H,I]=ye.useState(Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites),v=F=>{_(F.target.checked),Oe.mergeOptions_drop_download=F.target.checked},E=F=>{p(F.target.checked),Oe.mergeOptions_two_sided_mat=F.target.checked},U=F=>{S(F.target.checked),Oe.merge_options_ktx_compression=F.target.checked},P=F=>{M(F.target.checked),Oe.mergeOptions_create_atlas=F.target.checked},L=F=>{m(F.target.checked),Oe.mergeOptions_download_vrm=F.target.checked},z=F=>{w(F.target.checked),Oe.mergeOptions_download_vrm_preview=F.target.checked},K=F=>{$(F.target.checked),Oe.mergeOptions_download_lora=F.target.checked},O=F=>{I(F.target.checked),Oe.mergeOptions_download_sprites=F.target.checked},B=()=>{let F=u;u<=0?F=d.length-1:F-=1,f(F),Oe.mergeOptions_sel_option=F},W=()=>{let F=u;u>=d.length-1?F=0:F+=1,f(F),Oe.mergeOptions_sel_option=F},ee=async(F,X)=>{let ue=parseInt(F.target.value);ue>8?ue=8:ue<0&&(ue=0),(oe=>{switch(X){case"standard opaque":i(oe),Oe.mergeOptions_atlas_std_size=oe;break;case"standard transparent":o(oe),Oe.mergeOptions_atlas_std_transp_size=oe;break;case"mtoon opaque":l(oe),Oe.mergeOptions_atlas_mtoon_size=oe;break;case"mtoon transparent":c(oe),Oe.mergeOptions_atlas_mtoon_transp_size=oe;break}})(ue)};return k.jsxs("div",{className:lt.InformationContainerPos,children:[k.jsx(wa,{title:t,width:180,left:20}),k.jsxs("div",{className:lt.scrollContainer,children:[k.jsx("div",{className:lt.traitInfoTitle,children:"Download Options"}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:g,onChange:L}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:y,onChange:z}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM Preview"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:D,onChange:K}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Lora Data"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:H,onChange:O}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Sprites Data"]})})}),g&&k.jsxs(k.Fragment,{children:[e&&k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:b,onChange:P}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Create Atlas"]})})}),(e==!1||b)&&k.jsxs(k.Fragment,{children:[k.jsx("br",{}),k.jsx("div",{className:lt.traitInfoTitle,children:"Merge Atlas Type"}),k.jsx("br",{}),k.jsxs("div",{className:lt.flexSelect,children:[k.jsx("div",{className:`${lt["arrow-button"]} ${lt["left-button"]}`,onClick:B}),k.jsx("div",{className:lt.traitInfoText,style:{marginBottom:"0"},children:d[u]}),k.jsx("div",{className:`${lt["arrow-button"]} ${lt["right-button"]}`,onClick:W})]}),k.jsx("br",{}),k.jsx("br",{}),(u===0||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:lt.traitInfoTitle,children:"Standard Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Opaque: ",vn(r)+" x "+vn(r)]}),k.jsx($f,{value:r,onChange:F=>ee(F,"standard opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Transparent: ",vn(s)+" x "+vn(s)]}),k.jsx($f,{value:s,onChange:F=>ee(F,"standard transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),(u===1||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:lt.traitInfoTitle,children:"MToon Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Opaque: ",vn(a)+" x "+vn(a)]}),k.jsx($f,{value:a,onChange:F=>ee(F,"mtoon opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Transparent: ",vn(A)+" x "+vn(A)]}),k.jsx($f,{value:A,onChange:F=>ee(F,"mtoon transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),k.jsx("div",{className:lt.traitInfoTitle,children:"Options"}),k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:h,onChange:E}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Two Sided Material"]})}),n&&k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:x,onChange:v}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Drag Drop - Download"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:C,onChange:U}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}function GLe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=Y.useContext(or),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=Y.useState(""),{playSound:g}=Y.useContext(Ys),{isMute:m}=Y.useContext($s),[y,w]=Y.useState(null),x=()=>{!m&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(dt.LANDING)},_=()=>{const I=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:I===0||I==2,exportMtoonAtlas:I===1||I==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=(I,v=!1)=>{console.log(v),(async()=>{await s.loadTraitsFromNFTObject(y[I]),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await s.downloadVRM(y[I].name,_());const P=new ad,L=A.parent;L.remove(A);const z=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(z===!0){const O=r.loras.map(async B=>a.createLoraData(B,P));await Promise.all(O)}const K=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(K===!0){const O=r.sprites.map(async B=>l.createSpriteAtlas(B,P));await Promise.all(O)}(z===!0||K===!0)&&P.saveZip(y[I].name),L.add(A),I{t(!0),C(0,!0)},{t:b}=ye.useContext(To),M=async I=>{if(s.getCurrentCharacterModel()){const E=ul(I.name),U=URL.createObjectURL(I);await o.loadAnimation(U,!1,0,!0,"",E),d(o.getCurrentAnimationName()),URL.revokeObjectURL(U)}else console.warn("Please load a vrm model to test animations.")},D=async I=>{const v=URL.createObjectURL(I);await s.loadOptimizerCharacter(v),URL.revokeObjectURL(v);const E=ul(I.name);h(E),u(s.getCurrentCharacterModel())},$=I=>{const v=Array.from(I),E=[],U=P=>new Promise((L,z)=>{var K;if(P&&P.name.toLowerCase().endsWith(".json")){const O=new FileReader,B=`${(K=s.manifestData)==null?void 0:K.getAssetsDirectory()}/anata/_thumbnails/t_${P.name.split("_")[0]}.jpg`;O.onload=function(W){try{const ee=JSON.parse(W.target.result);ee.thumb=B,E.push(ee),L()}catch(ee){console.error("Error parsing the JSON file:",ee),z(ee)}},O.readAsText(P)}});Promise.all(v.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)})},H=async I=>{const v=I[0];console.log("anim"),v&&v.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),M(v)),v&&v.name.toLowerCase().endsWith(".vrm")&&D(v),v&&v.name.toLowerCase().endsWith(".json")&&$(I)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Batch Download"}),k.jsx(Cg,{onFilesDrop:H}),k.jsx(B_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(y2,{model:c}),k.jsx(ST,{jsonSelectionArray:y}),k.jsx(a_,{loadedAnimationName:p}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:b("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(y==null?void 0:y.length)==1&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:S}),(y==null?void 0:y.length)>1&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:S})]})]})}const Dg="abi/5.7.0",Dt=new ve(Dg),Jc={};let mO={calldata:!0,memory:!0,storage:!0},VLe={calldata:!0,memory:!0};function Rv(n,e){if(n==="bytes"||n==="string"){if(mO[e])return!0}else if(n==="address"){if(e==="payable")return!0}else if((n.indexOf("[")>=0||n==="tuple")&&VLe[e])return!0;return(mO[e]||e==="payable")&&Dt.throwArgumentError("invalid modifier","name",e),!1}function jLe(n,e){let t=n;function r(a){Dt.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!==Gt.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===Gt.full?", ":",")+")"):t+=this.type,e!==Gt.sighash&&(this.indexed===!0&&(t+=" indexed"),e===Gt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?_r.fromString(e,t):_r.fromObject(e)}static fromObject(e){return _r.isParamType(e)?e:new _r(Jc,{name:e.name||null,type:_f(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(_r.fromObject):null})}static fromString(e,t){function r(i){return _r.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(jLe(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function eg(n,e){return $Le(n).map(t=>_r.fromString(t,e))}class ol{constructor(e,t){e!==Jc&&Dt.throwError("use a static from method",ve.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),wy(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return ol.isFragment(e)?e:typeof e=="string"?ol.fromString(e):ol.fromObject(e)}static fromObject(e){if(ol.isFragment(e))return e;switch(e.type){case"function":return ea.fromObject(e);case"event":return el.fromObject(e);case"constructor":return qo.fromObject(e);case"error":return rA.fromObject(e);case"fallback":case"receive":return null}return Dt.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"?el.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?ea.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?qo.fromString(e.trim()):e.split(" ")[0]==="error"?rA.fromString(e.substring(5).trim()):Dt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class el extends ol{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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!==Gt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",e!==Gt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?el.fromString(e):el.fromObject(e)}static fromObject(e){if(el.isEventFragment(e))return e;e.type!=="event"&&Dt.throwArgumentError("invalid event object","value",e);const t={name:tg(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(_r.fromObject):[],type:"event"};return new el(Jc,t)}static fromString(e){let t=e.match(ng);t||Dt.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:Dt.warn("unknown modifier: "+i)}}),el.fromObject({name:t[1].trim(),anonymous:r,inputs:eg(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function dz(n,e){e.gas=null;let t=n.split("@");return t.length!==1?(t.length>2&&Dt.throwArgumentError("invalid human-readable ABI signature","value",n),t[1].match(/^[0-9]+$/)||Dt.throwArgumentError("invalid human-readable ABI signature gas","value",n),e.gas=Ge.from(t[1]),t[0]):n}function pz(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 mz(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&&Dt.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",n),e.payable=e.stateMutability==="payable",n.payable!=null&&!!n.payable!==e.payable&&Dt.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"&&Dt.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&&Dt.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"&&Dt.throwArgumentError("unable to determine stateMutability","value",n),e}class qo extends ol{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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===Gt.sighash&&Dt.throwError("cannot format a constructor for sighash",ve.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?qo.fromString(e):qo.fromObject(e)}static fromObject(e){if(qo.isConstructorFragment(e))return e;e.type!=="constructor"&&Dt.throwArgumentError("invalid constructor object","value",e);let t=mz(e);t.constant&&Dt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(_r.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new qo(Jc,r)}static fromString(e){let t={type:"constructor"};e=dz(e,t);let r=e.match(ng);return(!r||r[1].trim()!=="constructor")&&Dt.throwArgumentError("invalid constructor string","value",e),t.inputs=eg(r[2].trim(),!1),pz(r[3].trim(),t),qo.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class ea extends qo{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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!==Gt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",e!==Gt.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"?ea.fromString(e):ea.fromObject(e)}static fromObject(e){if(ea.isFunctionFragment(e))return e;e.type!=="function"&&Dt.throwArgumentError("invalid function object","value",e);let t=mz(e);const r={type:e.type,name:tg(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(_r.fromObject):[],outputs:e.outputs?e.outputs.map(_r.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new ea(Jc,r)}static fromString(e){let t={type:"function"};e=dz(e,t);let r=e.split(" returns ");r.length>2&&Dt.throwArgumentError("invalid function string","value",e);let i=r[0].match(ng);if(i||Dt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&tg(t.name),t.inputs=eg(i[2],!1),pz(i[3].trim(),t),r.length>1){let s=r[1].match(ng);(s[1].trim()!=""||s[3].trim()!="")&&Dt.throwArgumentError("unexpected tokens","value",e),t.outputs=eg(s[2],!1)}else t.outputs=[];return ea.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function gO(n){const e=n.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Dt.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",n),n}class rA extends ol{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Gt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",t.trim()}static from(e){return typeof e=="string"?rA.fromString(e):rA.fromObject(e)}static fromObject(e){if(rA.isErrorFragment(e))return e;e.type!=="error"&&Dt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:tg(e.name),inputs:e.inputs?e.inputs.map(_r.fromObject):[]};return gO(new rA(Jc,t))}static fromString(e){let t={type:"error"},r=e.match(ng);return r||Dt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&tg(t.name),t.inputs=eg(r[2],!1),gO(rA.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function _f(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const KLe=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tg(n){return(!n||!n.match(KLe))&&Dt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const ng=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function $Le(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&w2.throwError("value out-of-bounds",ve.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Zi([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 nx{constructor(e,t,r,i){Ue(this,"_data",at(e)),Ue(this,"wordSize",t||32),Ue(this,"_coerceFunc",r),Ue(this,"allowLoose",i),this._offset=0}get data(){return nt(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):nx.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:w2.throwError("data out-of-bounds",ve.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new nx(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 Ge.from(this.readBytes(this.wordSize))}}class XLe extends Il{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=Dr(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return Dr(kn(e.readValue().toHexString(),20))}}class ZLe extends Il{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 Yf=new ve(Dg);function gz(n,e,t){let r=null;if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(A=>{const c=A.localName;return c||Yf.throwError("cannot encode object for signature with missing names",ve.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]&&Yf.throwError("cannot encode object for signature with duplicate names",ve.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]=!0,t[c]})}else Yf.throwArgumentError("invalid tuple value","tuple",t);e.length!==r.length&&Yf.throwArgumentError("types/value length mismatch","tuple",t);let i=new pS(n.wordSize),s=new pS(n.wordSize),o=[];e.forEach((l,A)=>{let c=r[A];if(l.dynamic){let u=s.length;l.encode(s,c);let f=i.writeUpdatableValue();o.push(h=>{f(h+u)})}else l.encode(i,c)}),o.forEach(l=>{l(i.length)});let a=n.appendWriter(i);return a+=n.appendWriter(s),a}function vz(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(A){if(A.code===ve.errors.BUFFER_OVERRUN)throw A;o=A,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(a){if(a.code===ve.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 JLe extends Il{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&&Yf.throwError("insufficient data length",ve.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 gz(e,this.coders,t)}decode(e){return e.coerce(this.name,vz(e,this.coders))}}const Uv=new ve(Dg),s3e=new RegExp(/^bytes([0-9]*)$/),o3e=new RegExp(/^(u?int)([0-9]*)$/);class a3e{constructor(e){Ue(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new XLe(e.name);case"bool":return new qLe(e.name);case"string":return new i3e(e.name);case"bytes":return new e3e(e.name);case"array":return new JLe(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Fv((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new n3e(e.name)}let t=e.type.match(o3e);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&Uv.throwArgumentError("invalid "+t[1]+" bit length","param",e),new r3e(r/8,t[1]==="int",e.name)}if(t=e.type.match(s3e),t){let r=parseInt(t[1]);return(r===0||r>32)&&Uv.throwArgumentError("invalid bytes length","param",e),new t3e(r,e.name)}return Uv.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new nx(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new pS(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(_r.from(i)));return new Fv(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Uv.throwError("types/values length mismatch",ve.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(_r.from(o))),i=new Fv(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(_r.from(o)));return new Fv(i,"_").decode(this._getReader(at(t),r))}}const l3e=new a3e,bn=new ve(Dg);class A3e extends og{}class c3e extends og{}class u3e extends og{}class mS extends og{static isIndexed(e){return!!(e&&e._isIndexed)}}const f3e={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function vO(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class yO{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Ue(this,"fragments",t.map(r=>ol.from(r)).filter(r=>r!=null)),Ue(this,"_abiCoder",Ji(new.target,"getAbiCoder")()),Ue(this,"functions",{}),Ue(this,"errors",{}),Ue(this,"events",{}),Ue(this,"structs",{}),this.fragments.forEach(r=>{let i=null;switch(r.type){case"constructor":if(this.deploy){bn.warn("duplicate definition - constructor");return}Ue(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]){bn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Ue(this,"deploy",qo.from({payable:!1,type:"constructor"})),Ue(this,"_isInterface",!0)}format(e){e||(e=Gt.full),e===Gt.sighash&&bn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===Gt.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return l3e}static getAddress(e){return Dr(e)}static getSighash(e){return zr(bf(e.format()),0,4)}static getEventTopic(e){return bf(e.format())}getFunction(e){if(Et(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];bn.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?bn.throwArgumentError("no matching function","name",r):i.length>1&&bn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[ea.fromString(e).format()];return t||bn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(Et(e)){const r=e.toLowerCase();for(const i in this.events)if(r===this.getEventTopic(i))return this.events[i];bn.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?bn.throwArgumentError("no matching event","name",r):i.length>1&&bn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[el.fromString(e).format()];return t||bn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Et(e)){const r=Ji(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}bn.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?bn.throwArgumentError("no matching error","name",r):i.length>1&&bn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[ea.fromString(e).format()];return t||bn.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 Ji(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),Ji(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=at(t);return nt(r.slice(0,4))!==this.getSighash(e)&&bn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",nt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return typeof e=="string"&&(e=this.getError(e)),nt(Zi([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){typeof e=="string"&&(e=this.getFunction(e));const r=at(t);return nt(r.slice(0,4))!==this.getSighash(e)&&bn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",nt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return typeof e=="string"&&(e=this.getFunction(e)),nt(Zi([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){typeof e=="string"&&(e=this.getFunction(e));let r=at(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 A=nt(r.slice(0,4)),c=f3e[A];if(c)o=this._abiCoder.decode(c.inputs,r.slice(4)),a=c.name,l=c.signature,c.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(A);o=this._abiCoder.decode(u.inputs,r.slice(4)),a=u.name,l=u.format()}catch{}break}}return bn.throwError("call revert exception"+s,ve.errors.CALL_EXCEPTION,{method:e.format(),data:nt(t),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,t){return typeof e=="string"&&(e=this.getFunction(e)),nt(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){typeof e=="string"&&(e=this.getEvent(e)),t.length>e.inputs.length&&bn.throwError("too many arguments for "+e.format(),ve.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?bf(o):s.type==="bytes"?rr(nt(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=Ge.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),kn(nt(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&bn.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"?bn.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&&bn.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(bf(l));else if(o.type==="bytes")r.push(rr(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);(!Et(r[0],32)||r[0].toLowerCase()!==f)&&bn.throwError("fragment/topic mismatch",ve.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(_r.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,Zi(r)):null,l=this._abiCoder.decode(s,t,!0),A=[],c=0,u=0;e.inputs.forEach((f,h)=>{if(f.indexed)if(a==null)A[h]=new mS({_isIndexed:!0,hash:null});else if(o[h])A[h]=new mS({_isIndexed:!0,hash:a[u++]});else try{A[h]=a[u++]}catch(p){A[h]=p}else try{A[h]=l[c++]}catch(p){A[h]=p}if(f.name&&A[f.name]==null){const p=A[h];p instanceof Error?Object.defineProperty(A,f.name,{enumerable:!0,get:()=>{throw vO(`property ${JSON.stringify(f.name)}`,p)}}):A[f.name]=p}});for(let f=0;f{throw vO(`index ${f}`,h)}})}return Object.freeze(A)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new c3e({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:Ge.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new A3e({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=nt(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new u3e({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 h3e="contracts/5.7.0";var qc=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Wn=new ve(h3e);function rx(n,e){return qc(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&Wn.throwArgumentError("invalid address or ENS name","name",t);try{return Dr(t)}catch{}n||Wn.throwError("a provider or signer is needed to resolve ENS names",ve.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&Wn.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function xy(n,e,t){return qc(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>xy(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield rx(n,e):t.type==="tuple"?yield xy(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>xy(n,r,t.arrayChildren))):Promise.reject(Wn.makeError("invalid value for array",ve.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function E_(n,e,t){return qc(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=wn(t.pop())),Wn.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=qn({override:rx(n.signer,r.from),signer:n.signer.getAddress()}).then(A=>qc(this,void 0,void 0,function*(){return Dr(A.signer)!==A.override&&Wn.throwError("Contract with a Signer cannot override from",ve.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),A.override})):r.from=n.signer.getAddress():r.from&&(r.from=rx(n.provider,r.from));const i=yield qn({args:xy(n.signer||n.provider,t,e.inputs),address:n.resolvedAddress,overrides:qn(r)||{}}),s=n.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=Ge.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=Ge.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=Ge.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=Ge.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=Ge.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=tu(a.accessList)),o.gasLimit==null&&e.gas!=null){let A=21e3;const c=at(s);for(let u=0;ur[A]!=null);return l.length&&Wn.throwError(`cannot override ${l.map(A=>JSON.stringify(A)).join(",")}`,ve.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function d3e(n,e){return function(...t){return E_(n,e,t)}}function p3e(n,e){const t=n.signer||n.provider;return function(...r){return qc(this,void 0,void 0,function*(){t||Wn.throwError("estimate require a provider or signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield E_(n,e,r);return yield t.estimateGas(i)})}}function m3e(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=ts(s),a=null;try{a=n.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,A)=>n.interface.decodeEventLog(a.eventFragment,l,A),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 wz(n,e,t){const r=n.signer||n.provider;return function(...i){return qc(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=wn(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 E_(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===ve.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function g3e(n,e){return function(...t){return qc(this,void 0,void 0,function*(){n.signer||Wn.throwError("sending a transaction requires a signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield E_(n,e,t),i=yield n.signer.sendTransaction(r);return m3e(n,i),i})}}function wO(n,e,t){return e.constant?wz(n,e,t):g3e(n,e)}function xz(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 rg{constructor(e,t){Ue(this,"tag",e),Ue(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 v3e extends rg{constructor(){super("error",null)}}class xO extends rg{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&Wn.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(xz(s),s),Ue(this,"address",e),Ue(this,"interface",t),Ue(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=YLe(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class _O extends rg{constructor(e,t){super("*",{address:e}),Ue(this,"address",e),Ue(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 y3e{constructor(e,t,r){Ue(this,"interface",Ji(new.target,"getInterface")(t)),r==null?(Ue(this,"provider",null),Ue(this,"signer",null)):cg.isSigner(r)?(Ue(this,"provider",r.provider||null),Ue(this,"signer",r)):ag.isProvider(r)?(Ue(this,"provider",r),Ue(this,"signer",null)):Wn.throwArgumentError("invalid signer or provider","signerOrProvider",r),Ue(this,"callStatic",{}),Ue(this,"estimateGas",{}),Ue(this,"functions",{}),Ue(this,"populateTransaction",{}),Ue(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];Ue(this.filters,a,(...A)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,A)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?Ue(this.filters,a,this.filters[l[0]]):Wn.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Ue(this,"_runningEvents",{}),Ue(this,"_wrappedEmits",{}),e==null&&Wn.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Ue(this,"address",e),this.provider)Ue(this,"resolvedAddress",rx(this.provider,e));else try{Ue(this,"resolvedAddress",Promise.resolve(Dr(e)))}catch{Wn.throwError("provider is required to use ENS name as contract address",ve.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]){Wn.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&&Ue(this,o,wO(this,a,!0)),this.functions[o]==null&&Ue(this.functions,o,wO(this,a,!1)),this.callStatic[o]==null&&Ue(this.callStatic,o,wz(this,a,!0)),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,d3e(this,a)),this.estimateGas[o]==null&&Ue(this.estimateGas,o,p3e(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&&Ue(this,o,this[l])}catch{}this.functions[o]==null&&Ue(this.functions,o,this.functions[l]),this.callStatic[o]==null&&Ue(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&Ue(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return pN(e)}static getInterface(e){return yO.isInterface(e)?e:new yO(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"&&Wn.throwError("contract not deployed",ve.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||Wn.throwError("sending a transactions require a signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=wn(e||{});return["from","to"].forEach(function(r){t[r]!=null&&Wn.throwError("cannot override "+r,ve.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new OS(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&Ue(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return mS.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 v3e);if(e==="event")return this._normalizeRunningEvent(new rg("event",null));if(e==="*")return this._normalizeRunningEvent(new _O(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new xO(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 xO(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new rg(xz(t),t))}return this._normalizeRunningEvent(new _O(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=ts(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||Wn.throwError("events require a provider or a signer with a provider",ve.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=wn(i.filter);return typeof t=="string"&&Et(t,32)?(r!=null&&Wn.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 C_ extends y3e{}const w3e="0x543D43F390b7d681513045e8a85707438c463d80",ix={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"}]},bO={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 _z(n,e){return function(){return n.apply(e,arguments)}}const{toString:x3e}=Object.prototype,{getPrototypeOf:x2}=Object,S_=(n=>e=>{const t=x3e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Sa=n=>(n=n.toLowerCase(),e=>S_(e)===n),M_=n=>e=>typeof e===n,{isArray:vd}=Array,ig=M_("undefined");function _3e(n){return n!==null&&!ig(n)&&n.constructor!==null&&!ig(n.constructor)&&Qs(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const bz=Sa("ArrayBuffer");function b3e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&bz(n.buffer),e}const B3e=M_("string"),Qs=M_("function"),Bz=M_("number"),T_=n=>n!==null&&typeof n=="object",E3e=n=>n===!0||n===!1,_y=n=>{if(S_(n)!=="object")return!1;const e=x2(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},C3e=Sa("Date"),S3e=Sa("File"),M3e=Sa("Blob"),T3e=Sa("FileList"),I3e=n=>T_(n)&&Qs(n.pipe),R3e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Qs(n.append)&&((e=S_(n))==="formdata"||e==="object"&&Qs(n.toString)&&n.toString()==="[object FormData]"))},F3e=Sa("URLSearchParams"),U3e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Og(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),vd(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const Cz=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Sz=n=>!ig(n)&&n!==Cz;function gS(){const{caseless:n}=Sz(this)&&this||{},e={},t=(r,i)=>{const s=n&&Ez(e,i)||i;_y(e[s])&&_y(r)?e[s]=gS(e[s],r):_y(r)?e[s]=gS({},r):vd(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(Og(e,(i,s)=>{t&&Qs(i)?n[s]=_z(i,t):n[s]=i},{allOwnKeys:r}),n),P3e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),D3e=(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)},O3e=(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&&x2(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},N3e=(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},k3e=n=>{if(!n)return null;if(vd(n))return n;let e=n.length;if(!Bz(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},Q3e=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&x2(Uint8Array)),H3e=(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])}},z3e=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},G3e=Sa("HTMLFormElement"),V3e=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),BO=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),j3e=Sa("RegExp"),Mz=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};Og(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},W3e=n=>{Mz(n,(e,t)=>{if(Qs(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Qs(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+"'")})}})},K3e=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return vd(n)?r(n):r(String(n).split(e)),t},$3e=()=>{},Y3e=(n,e)=>(n=+n,Number.isFinite(n)?n:e),IB="abcdefghijklmnopqrstuvwxyz",EO="0123456789",Tz={DIGIT:EO,ALPHA:IB,ALPHA_DIGIT:IB+IB.toUpperCase()+EO},X3e=(n=16,e=Tz.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function Z3e(n){return!!(n&&Qs(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const J3e=n=>{const e=new Array(10),t=(r,i)=>{if(T_(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=vd(r)?[]:{};return Og(r,(o,a)=>{const l=t(o,i+1);!ig(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},q3e=Sa("AsyncFunction"),ePe=n=>n&&(T_(n)||Qs(n))&&Qs(n.then)&&Qs(n.catch),Ie={isArray:vd,isArrayBuffer:bz,isBuffer:_3e,isFormData:R3e,isArrayBufferView:b3e,isString:B3e,isNumber:Bz,isBoolean:E3e,isObject:T_,isPlainObject:_y,isUndefined:ig,isDate:C3e,isFile:S3e,isBlob:M3e,isRegExp:j3e,isFunction:Qs,isStream:I3e,isURLSearchParams:F3e,isTypedArray:Q3e,isFileList:T3e,forEach:Og,merge:gS,extend:L3e,trim:U3e,stripBOM:P3e,inherits:D3e,toFlatObject:O3e,kindOf:S_,kindOfTest:Sa,endsWith:N3e,toArray:k3e,forEachEntry:H3e,matchAll:z3e,isHTMLForm:G3e,hasOwnProperty:BO,hasOwnProp:BO,reduceDescriptors:Mz,freezeMethods:W3e,toObjectSet:K3e,toCamelCase:V3e,noop:$3e,toFiniteNumber:Y3e,findKey:Ez,global:Cz,isContextDefined:Sz,ALPHABET:Tz,generateString:X3e,isSpecCompliantForm:Z3e,toJSONObject:J3e,isAsyncFn:q3e,isThenable:ePe};function Nt(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)}Ie.inherits(Nt,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:Ie.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Iz=Nt.prototype,Rz={};["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=>{Rz[n]={value:n}});Object.defineProperties(Nt,Rz);Object.defineProperty(Iz,"isAxiosError",{value:!0});Nt.from=(n,e,t,r,i,s)=>{const o=Object.create(Iz);return Ie.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),Nt.call(o,n.message,e,t,r,i),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const tPe=null;function vS(n){return Ie.isPlainObject(n)||Ie.isArray(n)}function Fz(n){return Ie.endsWith(n,"[]")?n.slice(0,-2):n}function CO(n,e,t){return n?n.concat(e).map(function(i,s){return i=Fz(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function nPe(n){return Ie.isArray(n)&&!n.some(vS)}const rPe=Ie.toFlatObject(Ie,{},null,function(e){return/^is[A-Z]/.test(e)});function I_(n,e,t){if(!Ie.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Ie.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,g){return!Ie.isUndefined(g[d])});const r=t.metaTokens,i=t.visitor||c,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Ie.isSpecCompliantForm(e);if(!Ie.isFunction(i))throw new TypeError("visitor must be a function");function A(p){if(p===null)return"";if(Ie.isDate(p))return p.toISOString();if(!l&&Ie.isBlob(p))throw new Nt("Blob is not supported. Use a Buffer instead.");return Ie.isArrayBuffer(p)||Ie.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function c(p,d,g){let m=p;if(p&&!g&&typeof p=="object"){if(Ie.endsWith(d,"{}"))d=r?d:d.slice(0,-2),p=JSON.stringify(p);else if(Ie.isArray(p)&&nPe(p)||(Ie.isFileList(p)||Ie.endsWith(d,"[]"))&&(m=Ie.toArray(p)))return d=Fz(d),m.forEach(function(w,x){!(Ie.isUndefined(w)||w===null)&&e.append(o===!0?CO([d],x,s):o===null?d:d+"[]",A(w))}),!1}return vS(p)?!0:(e.append(CO(g,d,s),A(p)),!1)}const u=[],f=Object.assign(rPe,{defaultVisitor:c,convertValue:A,isVisitable:vS});function h(p,d){if(!Ie.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+d.join("."));u.push(p),Ie.forEach(p,function(m,y){(!(Ie.isUndefined(m)||m===null)&&i.call(e,m,Ie.isString(y)?y.trim():y,d,f))===!0&&h(m,d?d.concat(y):[y])}),u.pop()}}if(!Ie.isObject(n))throw new TypeError("data must be an object");return h(n),e}function SO(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function _2(n,e){this._pairs=[],n&&I_(n,this,e)}const Uz=_2.prototype;Uz.append=function(e,t){this._pairs.push([e,t])};Uz.toString=function(e){const t=e?function(r){return e.call(this,r,SO)}:SO;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function iPe(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Lz(n,e,t){if(!e)return n;const r=t&&t.encode||iPe,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Ie.isURLSearchParams(e)?e.toString():new _2(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class sPe{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){Ie.forEach(this.handlers,function(r){r!==null&&e(r)})}}const MO=sPe,Pz={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},oPe=typeof URLSearchParams<"u"?URLSearchParams:_2,aPe=typeof FormData<"u"?FormData:null,lPe=typeof Blob<"u"?Blob:null,APe={isBrowser:!0,classes:{URLSearchParams:oPe,FormData:aPe,Blob:lPe},protocols:["http","https","file","blob","url","data"]},Dz=typeof window<"u"&&typeof document<"u",cPe=(n=>Dz&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),uPe=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),fPe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Dz,hasStandardBrowserEnv:cPe,hasStandardBrowserWebWorkerEnv:uPe},Symbol.toStringTag,{value:"Module"})),ra={...fPe,...APe};function hPe(n,e){return I_(n,new ra.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return ra.isNode&&Ie.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function dPe(n){return Ie.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function pPe(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Ie.isArray(i)?i.length:o,l?(Ie.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Ie.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Ie.isArray(i[o])&&(i[o]=pPe(i[o])),!a)}if(Ie.isFormData(n)&&Ie.isFunction(n.entries)){const t={};return Ie.forEachEntry(n,(r,i)=>{e(dPe(r),i,t,0)}),t}return null}function mPe(n,e,t){if(Ie.isString(n))try{return(e||JSON.parse)(n),Ie.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const b2={transitional:Pz,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Ie.isObject(e);if(s&&Ie.isHTMLForm(e)&&(e=new FormData(e)),Ie.isFormData(e))return i?JSON.stringify(Oz(e)):e;if(Ie.isArrayBuffer(e)||Ie.isBuffer(e)||Ie.isStream(e)||Ie.isFile(e)||Ie.isBlob(e))return e;if(Ie.isArrayBufferView(e))return e.buffer;if(Ie.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 hPe(e,this.formSerializer).toString();if((a=Ie.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return I_(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),mPe(e)):e}],transformResponse:[function(e){const t=this.transitional||b2.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(e&&Ie.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"?Nt.from(a,Nt.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:ra.classes.FormData,Blob:ra.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ie.forEach(["delete","get","head","post","put","patch"],n=>{b2.headers[n]={}});const B2=b2,gPe=Ie.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"]),vPe=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]&&gPe[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},TO=Symbol("internals");function hp(n){return n&&String(n).trim().toLowerCase()}function by(n){return n===!1||n==null?n:Ie.isArray(n)?n.map(by):String(n)}function yPe(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 wPe=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function RB(n,e,t,r,i){if(Ie.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Ie.isString(e)){if(Ie.isString(r))return e.indexOf(r)!==-1;if(Ie.isRegExp(r))return r.test(e)}}function xPe(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function _Pe(n,e){const t=Ie.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 R_{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,A){const c=hp(l);if(!c)throw new Error("header name must be a non-empty string");const u=Ie.findKey(i,c);(!u||i[u]===void 0||A===!0||A===void 0&&i[u]!==!1)&&(i[u||l]=by(a))}const o=(a,l)=>Ie.forEach(a,(A,c)=>s(A,c,l));return Ie.isPlainObject(e)||e instanceof this.constructor?o(e,t):Ie.isString(e)&&(e=e.trim())&&!wPe(e)?o(vPe(e),t):e!=null&&s(t,e,r),this}get(e,t){if(e=hp(e),e){const r=Ie.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return yPe(i);if(Ie.isFunction(t))return t.call(this,i,r);if(Ie.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=hp(e),e){const r=Ie.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||RB(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=hp(o),o){const a=Ie.findKey(r,o);a&&(!t||RB(r,r[a],a,t))&&(delete r[a],i=!0)}}return Ie.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||RB(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Ie.forEach(this,(i,s)=>{const o=Ie.findKey(r,s);if(o){t[o]=by(i),delete t[s];return}const a=e?xPe(s):String(s).trim();a!==s&&delete t[s],t[a]=by(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ie.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Ie.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[TO]=this[TO]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=hp(o);r[a]||(_Pe(i,o),r[a]=!0)}return Ie.isArray(e)?e.forEach(s):s(e),this}}R_.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ie.reduceDescriptors(R_.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Ie.freezeMethods(R_);const fl=R_;function FB(n,e){const t=this||B2,r=e||t,i=fl.from(r.headers);let s=r.data;return Ie.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Nz(n){return!!(n&&n.__CANCEL__)}function Ng(n,e,t){Nt.call(this,n??"canceled",Nt.ERR_CANCELED,e,t),this.name="CanceledError"}Ie.inherits(Ng,Nt,{__CANCEL__:!0});function bPe(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new Nt("Request failed with status code "+t.status,[Nt.ERR_BAD_REQUEST,Nt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const BPe=ra.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Ie.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Ie.isString(r)&&o.push("path="+r),Ie.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 EPe(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function CPe(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function kz(n,e){return n&&!EPe(e)?CPe(n,e):e}const SPe=ra.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(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=Ie.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function MPe(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function TPe(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 A=Date.now(),c=r[s];o||(o=A),t[i]=l,r[i]=A;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),A-o{const s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-t,l=r(a),A=s<=o;t=s;const c={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&A?(o-s)/l:void 0,event:i};c[e?"download":"upload"]=!0,n(c)}}const IPe=typeof XMLHttpRequest<"u",RPe=IPe&&function(n){return new Promise(function(t,r){let i=n.data;const s=fl.from(n.headers).normalize();let{responseType:o,withXSRFToken:a}=n,l;function A(){n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let c;if(Ie.isFormData(i)){if(ra.hasStandardBrowserEnv||ra.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((c=s.getContentType())!==!1){const[d,...g]=c?c.split(";").map(m=>m.trim()).filter(Boolean):[];s.setContentType([d||"multipart/form-data",...g].join("; "))}}let u=new XMLHttpRequest;if(n.auth){const d=n.auth.username||"",g=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.set("Authorization","Basic "+btoa(d+":"+g))}const f=kz(n.baseURL,n.url);u.open(n.method.toUpperCase(),Lz(f,n.params,n.paramsSerializer),!0),u.timeout=n.timeout;function h(){if(!u)return;const d=fl.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),m={data:!o||o==="text"||o==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:d,config:n,request:u};bPe(function(w){t(w),A()},function(w){r(w),A()},m),u=null}if("onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(h)},u.onabort=function(){u&&(r(new Nt("Request aborted",Nt.ECONNABORTED,n,u)),u=null)},u.onerror=function(){r(new Nt("Network Error",Nt.ERR_NETWORK,n,u)),u=null},u.ontimeout=function(){let g=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const m=n.transitional||Pz;n.timeoutErrorMessage&&(g=n.timeoutErrorMessage),r(new Nt(g,m.clarifyTimeoutError?Nt.ETIMEDOUT:Nt.ECONNABORTED,n,u)),u=null},ra.hasStandardBrowserEnv&&(a&&Ie.isFunction(a)&&(a=a(n)),a||a!==!1&&SPe(f))){const d=n.xsrfHeaderName&&n.xsrfCookieName&&BPe.read(n.xsrfCookieName);d&&s.set(n.xsrfHeaderName,d)}i===void 0&&s.setContentType(null),"setRequestHeader"in u&&Ie.forEach(s.toJSON(),function(g,m){u.setRequestHeader(m,g)}),Ie.isUndefined(n.withCredentials)||(u.withCredentials=!!n.withCredentials),o&&o!=="json"&&(u.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&u.addEventListener("progress",IO(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",IO(n.onUploadProgress)),(n.cancelToken||n.signal)&&(l=d=>{u&&(r(!d||d.type?new Ng(null,n,u):d),u.abort(),u=null)},n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const p=MPe(f);if(p&&ra.protocols.indexOf(p)===-1){r(new Nt("Unsupported protocol "+p+":",Nt.ERR_BAD_REQUEST,n));return}u.send(i||null)})},yS={http:tPe,xhr:RPe};Ie.forEach(yS,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const RO=n=>`- ${n}`,FPe=n=>Ie.isFunction(n)||n===null||n===!1,Qz={getAdapter:n=>{n=Ie.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 : + `),Y.createElement("div",{style:c.white,className:"saturation-white"},Y.createElement("div",{style:c.black,className:"saturation-black"}),Y.createElement("div",{style:c.pointer},this.props.pointer?Y.createElement(this.props.pointer,this.props):Y.createElement("div",{style:c.circle}))))}}]),e}(ye.PureComponent||ye.Component);function PIe(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 tt(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(nRe,arguments)},brighten:function(){return this._applyModification(rRe,arguments)},darken:function(){return this._applyModification(iRe,arguments)},desaturate:function(){return this._applyModification(qIe,arguments)},saturate:function(){return this._applyModification(eRe,arguments)},greyscale:function(){return this._applyModification(tRe,arguments)},spin:function(){return this._applyModification(sRe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(lRe,arguments)},complement:function(){return this._applyCombination(oRe,arguments)},monochromatic:function(){return this._applyCombination(ARe,arguments)},splitcomplement:function(){return this._applyCombination(aRe,arguments)},triad:function(){return this._applyCombination(GD,[3])},tetrad:function(){return this._applyCombination(GD,[4])}};tt.fromRatio=function(n,e){if(tx(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Op(n[r]));n=t}return tt(n,e)};function $Ie(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=dRe(n)),tx(n)=="object"&&(Ga(n.r)&&Ga(n.g)&&Ga(n.b)?(e=YIe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):Ga(n.h)&&Ga(n.s)&&Ga(n.v)?(r=Op(n.s),i=Op(n.v),e=ZIe(n.h,r,i),o=!0,a="hsv"):Ga(n.h)&&Ga(n.s)&&Ga(n.l)&&(r=Op(n.s),s=Op(n.l),e=XIe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=J8(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 YIe(n,e,t){return{r:gn(n,255)*255,g:gn(e,255)*255,b:gn(t,255)*255}}function kD(n,e,t){n=gn(n,255),e=gn(e,255),t=gn(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?A+(c-A)*6*u:u<1/2?c:u<2/3?A+(c-A)*(2/3-u)*6:A}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 QD(n,e,t){n=gn(n,255),e=gn(e,255),t=gn(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(tt(r));return s}function ARe(n,e){e=e||6;for(var t=tt(n).toHsv(),r=t.h,i=t.s,s=t.v,o=[],a=1/e;e--;)o.push(tt({h:r,s:i,v:s})),s=(s+a)%1;return o}tt.mix=function(n,e,t){t=t===0?0:t||50;var r=tt(n).toRgb(),i=tt(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 tt(o)};tt.readability=function(n,e){var t=tt(n),r=tt(e);return(Math.max(t.getLuminance(),r.getLuminance())+.05)/(Math.min(t.getLuminance(),r.getLuminance())+.05)};tt.isReadable=function(n,e,t){var r=tt.readability(n,e),i,s;switch(s=!1,i=pRe(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};tt.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 A=0;Ai&&(i=s,r=tt(e[A]));return tt.isReadable(n,r,{level:a,size:l})||!o?r:(t.includeFallbackColors=!1,tt.mostReadable(n,["#fff","#000"],t))};var cS=tt.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"},cRe=tt.hexNames=uRe(cS);function uRe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function J8(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function gn(n,e){fRe(n)&&(n="100%");var t=hRe(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 b_(n){return Math.min(1,Math.max(0,n))}function Hi(n){return parseInt(n,16)}function fRe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function hRe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function _o(n){return n.length==1?"0"+n:""+n}function Op(n){return n<=1&&(n=n*100+"%"),n}function q8(n){return Math.round(parseFloat(n)*255).toString(16)}function VD(n){return Hi(n)/255}var ho=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 Ga(n){return!!ho.CSS_UNIT.exec(n)}function dRe(n){n=n.replace(WIe,"").replace(KIe,"").toLowerCase();var e=!1;if(cS[n])n=cS[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=ho.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=ho.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=ho.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=ho.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=ho.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=ho.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=ho.hex8.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),a:VD(t[4]),format:e?"name":"hex8"}:(t=ho.hex6.exec(n))?{r:Hi(t[1]),g:Hi(t[2]),b:Hi(t[3]),format:e?"name":"hex"}:(t=ho.hex4.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),a:VD(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=ho.hex3.exec(n))?{r:Hi(t[1]+""+t[1]),g:Hi(t[2]+""+t[2]),b:Hi(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function pRe(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 jD=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return jIe(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},Np=function(e,t){var r=e.hex?tt(e.hex):tt(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}},JA=function(e){if(e==="transparent")return!0;var t=String(e).charAt(0)==="#"?1:0;return e.length!==4+t&&e.length<7+t&&tt(e).isValid()},t2=function(e){if(!e)return"#fff";var t=Np(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"},SB=function(e,t){var r=e.replace("°","");return tt(t+" ("+r+")")._ok},fp=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){bRe(i,r);function i(){var s,o,a,l;_Re(this,i);for(var A=arguments.length,c=Array(A),u=0;ua))return!1;var A=s.get(n),c=s.get(e);if(A&&c)return A==e&&c==n;var u=-1,f=!0,h=t&PRe?new nx: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 Tv=24,rUe=Az.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Tv:r,s=n.height,o=s===void 0?Tv:s,a=n.style,l=a===void 0?{}:a,A=nUe(n,["fill","width","height","style"]);return cO.default.createElement("svg",AO({viewBox:"0 0 "+Tv+" "+Tv,style:AO({fill:t,width:i,height:o},l)},A),cO.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"}))},iUe=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(lO(i.s)?r.props.hsl.s:i.s),l:Number(lO(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 iUe(e,[{key:"render",value:function(){var r=this,i=ft({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=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),Y.createElement("div",{style:i.alpha},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"a",value:this.props.rgb.a,arrowOffset:.01,onChange:this.handleChange}))):this.state.view==="hsl"&&(s=Y.createElement("div",{style:i.fields,className:"flexbox-fix"},Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),Y.createElement("div",{style:i.field},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),Y.createElement("div",{style:i.alpha},Y.createElement(Pt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),Y.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,Y.createElement("div",{style:i.toggle},Y.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},Y.createElement(rUe,{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}(Y.Component);cz.defaultProps={view:"hex"};var uO=function(){var e=ft({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 Y.createElement("div",{style:e.picker})},lUe=function(){var e=ft({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return Y.createElement("div",{style:e.picker})},a2=function(e){var t=e.width,r=e.onChange,i=e.disableAlpha,s=e.rgb,o=e.hsl,a=e.hsv,l=e.hex,A=e.renderers,c=e.styles,u=c===void 0?{}:c,f=e.className,h=f===void 0?"":f,p=e.defaultView,d=ft(Li({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 Y.createElement("div",{style:d.picker,className:"chrome-picker "+h},Y.createElement("div",{style:d.saturation},Y.createElement(__,{style:d.Saturation,hsl:o,hsv:a,pointer:lUe,onChange:r})),Y.createElement("div",{style:d.body},Y.createElement("div",{style:d.controls,className:"flexbox-fix"},Y.createElement("div",{style:d.color},Y.createElement("div",{style:d.swatch},Y.createElement("div",{style:d.active}),Y.createElement(md,{renderers:A}))),Y.createElement("div",{style:d.toggles},Y.createElement("div",{style:d.hue},Y.createElement(gd,{style:d.Hue,hsl:o,pointer:uO,onChange:r})),Y.createElement("div",{style:d.alpha},Y.createElement(KT,{style:d.Alpha,rgb:s,hsl:o,pointer:uO,renderers:A,onChange:r})))),Y.createElement(cz,{rgb:s,hsl:o,hex:l,view:p,onChange:r,disableAlpha:i})))};a2.propTypes={width:He.oneOfType([He.string,He.number]),disableAlpha:He.bool,styles:He.object,defaultView:He.oneOf(["hex","rgb","hsl"])};a2.defaultProps={width:225,disableAlpha:!1,styles:{}};const AUe=Pi(a2);var cUe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=ft({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:t2(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 Y.createElement(pu,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},Y.createElement("div",{style:a.dot}))},uUe=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=ft({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,A){l.r||l.g||l.b?i({r:l.r||r.r,g:l.g||r.g,b:l.b||r.b,source:"rgb"},A):i({hex:l.hex,source:"hex"},A)};return Y.createElement("div",{style:s.fields,className:"flexbox-fix"},Y.createElement("div",{style:s.active}),Y.createElement(Pt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),Y.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},l2=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,A=e.className,c=A===void 0?"":A,u=ft(Li({default:{Compact:{background:"#f6f6f6",radius:"4px"},compact:{paddingTop:"5px",paddingLeft:"5px",boxSizing:"initial",width:"240px"},clear:{clear:"both"}}},l)),f=function(p,d){p.hex?JA(p.hex)&&t({hex:p.hex,source:"hex"},d):t(p,d)};return Y.createElement(Dg,{style:u.Compact,styles:l},Y.createElement("div",{style:u.compact,className:"compact-picker "+c},Y.createElement("div",null,mu(i,function(h){return Y.createElement(cUe,{key:h,color:h,active:h.toLowerCase()===s,onClick:f,onSwatchHover:r})}),Y.createElement("div",{style:u.clear})),Y.createElement(uUe,{hex:s,rgb:o,onChange:f})))};l2.propTypes={colors:He.arrayOf(He.string),styles:He.object};l2.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:{}};Pi(l2);var fUe=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=ft({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return Y.createElement("div",{style:a.swatch},Y.createElement(pu,{color:r,onClick:i,onHover:s,focusStyle:o}))};const hUe=WT(fUe);var A2=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,A=e.className,c=A===void 0?"":A,u=ft(Li({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(p,d){return i({hex:p,source:"hex"},d)};return Y.createElement("div",{style:u.card,className:"github-picker "+c},Y.createElement("div",{style:u.triangleShadow}),Y.createElement("div",{style:u.triangle}),mu(r,function(h){return Y.createElement(hUe,{color:h,key:h,onClick:f,onSwatchHover:s})}))};A2.propTypes={width:He.oneOfType([He.string,He.number]),colors:He.arrayOf(He.string),triangle:He.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:He.object};A2.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};Pi(A2);var dUe=function(e){var t=e.direction,r=ft({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 Y.createElement("div",{style:r.picker})},pUe=Object.assign||function(n){for(var e=1;e.5});return Y.createElement("div",{style:r.picker})},yUe=function(){var e=ft({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 Y.createElement("div",{style:e.pointer},Y.createElement("div",{style:e.left},Y.createElement("div",{style:e.leftInside})),Y.createElement("div",{style:e.right},Y.createElement("div",{style:e.rightInside})))},fO=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=ft({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 Y.createElement("div",{style:o.button,onClick:t},r||i)},wUe=function(e){var t=e.rgb,r=e.currentColor,i=ft({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 Y.createElement("div",null,Y.createElement("div",{style:i.label},"new"),Y.createElement("div",{style:i.swatches},Y.createElement("div",{style:i.new}),Y.createElement("div",{style:i.current})),Y.createElement("div",{style:i.label},"current"))},xUe=function(){function n(e,t){for(var r=0;r100&&(c.a=100),c.a/=100,t({h:i.h,s:i.s,l:i.l,a:c.a,source:"rgb"},u))};return Y.createElement("div",{style:a.fields,className:"flexbox-fix"},Y.createElement("div",{style:a.double},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.single},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),Y.createElement("div",{style:a.alpha},Y.createElement(Pt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},CUe=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var Iv=24,UUe=fz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?Iv:r,s=n.height,o=s===void 0?Iv:s,a=n.style,l=a===void 0?{}:a,A=FUe(n,["fill","width","height","style"]);return dO.default.createElement("svg",hO({viewBox:"0 0 "+Iv+" "+Iv,style:hO({fill:t,width:i,height:o},l)},A),dO.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},LUe=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,A=ft({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:t2(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 Y.createElement(pu,{color:t,style:A.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},Y.createElement("div",{style:A.check},Y.createElement(UUe,null)))},PUe=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=ft({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return Y.createElement("div",{style:o.group},mu(i,function(a,l){return Y.createElement(LUe,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},d2=function(e){var t=e.width,r=e.height,i=e.onChange,s=e.onSwatchHover,o=e.colors,a=e.hex,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,f=ft(Li({default:{picker:{width:t,height:r},overflow:{height:r,overflowY:"scroll"},body:{padding:"16px 0 6px 16px"},clear:{clear:"both"}}},A)),h=function(d,g){return i({hex:d,source:"hex"},g)};return Y.createElement("div",{style:f.picker,className:"swatches-picker "+u},Y.createElement(Dg,null,Y.createElement("div",{style:f.overflow},Y.createElement("div",{style:f.body},mu(o,function(p){return Y.createElement(PUe,{key:p.toString(),group:p,active:a,onClick:h,onSwatchHover:s})}),Y.createElement("div",{style:f.clear})))))};d2.propTypes={width:He.oneOfType([He.string,He.number]),height:He.oneOfType([He.string,He.number]),colors:He.arrayOf(He.arrayOf(He.string)),styles:He.object};d2.defaultProps={width:320,height:240,colors:[[of[900],of[700],of[500],of[300],of[100]],[af[900],af[700],af[500],af[300],af[100]],[lf[900],lf[700],lf[500],lf[300],lf[100]],[Af[900],Af[700],Af[500],Af[300],Af[100]],[cf[900],cf[700],cf[500],cf[300],cf[100]],[uf[900],uf[700],uf[500],uf[300],uf[100]],[ff[900],ff[700],ff[500],ff[300],ff[100]],[hf[900],hf[700],hf[500],hf[300],hf[100]],[df[900],df[700],df[500],df[300],df[100]],["#194D33",kp[700],kp[500],kp[300],kp[100]],[pf[900],pf[700],pf[500],pf[300],pf[100]],[mf[900],mf[700],mf[500],mf[300],mf[100]],[gf[900],gf[700],gf[500],gf[300],gf[100]],[vf[900],vf[700],vf[500],vf[300],vf[100]],[yf[900],yf[700],yf[500],yf[300],yf[100]],[wf[900],wf[700],wf[500],wf[300],wf[100]],[xf[900],xf[700],xf[500],xf[300],xf[100]],[_f[900],_f[700],_f[500],_f[300],_f[100]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Pi(d2);var p2=function(e){var t=e.onChange,r=e.onSwatchHover,i=e.hex,s=e.colors,o=e.width,a=e.triangle,l=e.styles,A=l===void 0?{}:l,c=e.className,u=c===void 0?"":c,f=ft(Li({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"}}},A),{"hide-triangle":a==="hide","top-left-triangle":a==="top-left","top-right-triangle":a==="top-right"}),h=function(d,g){JA(d)&&t({hex:d,source:"hex"},g)};return Y.createElement("div",{style:f.card,className:"twitter-picker "+u},Y.createElement("div",{style:f.triangleShadow}),Y.createElement("div",{style:f.triangle}),Y.createElement("div",{style:f.body},mu(s,function(p,d){return Y.createElement(pu,{key:d,color:p,hex:p,style:f.swatch,onClick:h,onHover:r,focusStyle:{boxShadow:"0 0 4px "+p}})}),Y.createElement("div",{style:f.hash},"#"),Y.createElement(Pt,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:h}),Y.createElement("div",{style:f.clear})))};p2.propTypes={width:He.oneOfType([He.string,He.number]),triangle:He.oneOf(["hide","top-left","top-right"]),colors:He.arrayOf(He.string),styles:He.object};p2.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Pi(p2);var m2=function(e){var t=ft({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 Y.createElement("div",{style:t.picker})};m2.propTypes={hsl:He.shape({h:He.number,s:He.number,l:He.number,a:He.number})};m2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var g2=function(e){var t=ft({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 Y.createElement("div",{style:t.picker})};g2.propTypes={hsl:He.shape({h:He.number,s:He.number,l:He.number,a:He.number})};g2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var DUe=function(e){var t=e.onChange,r=e.rgb,i=e.hsl,s=e.hex,o=e.hsv,a=function(h,p){if(h.hex)JA(h.hex)&&t({hex:h.hex,source:"hex"},p);else if(h.rgb){var d=h.rgb.split(",");SB(h.rgb,"rgb")&&t({r:d[0],g:d[1],b:d[2],a:1,source:"rgb"},p)}else if(h.hsv){var g=h.hsv.split(",");SB(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"},p))}else if(h.hsl){var m=h.hsl.split(",");SB(h.hsl,"hsl")&&(m[2]=m[2].replace("%",""),m[1]=m[1].replace("%",""),m[0]=m[0].replace("°",""),u[1]==1?u[1]=.01:u[2]==1&&(u[2]=.01),t({h:Number(m[0]),s:Number(m[1]),v:Number(m[2]),source:"hsl"},p))}},l=ft({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"}}}),A=r.r+", "+r.g+", "+r.b,c=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 Y.createElement("div",{style:l.wrap,className:"flexbox-fix"},Y.createElement("div",{style:l.fields},Y.createElement("div",{style:l.double},Y.createElement(Pt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),Y.createElement("div",{style:l.column},Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"rgb",value:A,onChange:a})),Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),Y.createElement("div",{style:l.single},Y.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsl",value:c,onChange:a})))))},v2=function(e){var t=e.width,r=e.onChange,i=e.rgb,s=e.hsl,o=e.hsv,a=e.hex,l=e.header,A=e.styles,c=A===void 0?{}:A,u=e.className,f=u===void 0?"":u,h=ft(Li({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"}}},c));return Y.createElement("div",{style:h.picker,className:"google-picker "+f},Y.createElement("div",{style:h.head},l),Y.createElement("div",{style:h.swatch}),Y.createElement("div",{style:h.saturation},Y.createElement(__,{hsl:s,hsv:o,pointer:m2,onChange:r})),Y.createElement("div",{style:h.body},Y.createElement("div",{style:h.controls,className:"flexbox-fix"},Y.createElement("div",{style:h.hue},Y.createElement(gd,{style:h.Hue,hsl:s,radius:"4px",pointer:g2,onChange:r}))),Y.createElement(DUe,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};v2.propTypes={width:He.oneOfType([He.string,He.number]),styles:He.object,header:He.string};v2.defaultProps={width:652,styles:{},header:"Color picker"};Pi(v2);const OUe="_InformationContainerPos_1yd4c_2",NUe="_scrollContainer_1yd4c_15",TB={InformationContainerPos:OUe,scrollContainer:NUe,"options-container":"_options-container_1yd4c_24"},kUe="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=",QUe="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==",HUe="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==",zUe="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",GUe="_InformationContainerPos_1m76y_2",VUe="_scrollContainer_1m76y_15",jUe="_centerAlign_1m76y_25",WUe="_traitInfoTitle_1m76y_28",KUe="_dropdownFlex_1m76y_38",$Ue="_checkboxFlex_1m76y_44",YUe="_simpleFlex_1m76y_49",XUe="_traitInfoText_1m76y_55",ZUe="_dropdownBase_1m76y_64",JUe="_dropdownControl_1m76y_74",qUe="_dropdownControlSmall_1m76y_80",eLe="_flexSelect_1m76y_106",tLe="_checked_1m76y_163",nLe="_checkmark_1m76y_167",rLe="_checkboxHolder_1m76y_180",iLe="_actionButton_1m76y_189",sLe="_tabHolder_1m76y_209",oLe="_tabButton_1m76y_215",aLe="_tabButtonSelected_1m76y_235",Ve={InformationContainerPos:GUe,scrollContainer:VUe,centerAlign:jUe,traitInfoTitle:WUe,dropdownFlex:KUe,checkboxFlex:$Ue,simpleFlex:YUe,traitInfoText:XUe,dropdownBase:ZUe,dropdownControl:JUe,dropdownControlSmall:qUe,"input-box":"_input-box_1m76y_87",flexSelect:eLe,"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:tLe,checkmark:nLe,checkboxHolder:rLe,actionButton:iLe,tabHolder:sLe,tabButton:oLe,tabButtonSelected:aLe},lLe="_slider_1y6nx_1",ALe="_infoContainer_1y6nx_13",Rv={"slider-container":"_slider-container_1y6nx_1",slider:lLe,infoContainer:ALe,"input-box":"_input-box_1y6nx_18"};function Yf({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Rv.infoContainer,children:[n,o&&k.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:Rv["input-box"],step:o})]}),k.jsx("div",{className:Rv["slider-container"],children:k.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:Rv.slider,step:s})})]})}function cLe({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=ye.useContext(or),[i,s]=ye.useState(0),[o,a]=ye.useState(0),[l,A]=ye.useState(0);ye.useEffect(()=>{var p,d,g;e!=null&&(A((p=e.data)==null?void 0:p.cullingLayer),s(((d=e.data)==null?void 0:d.cullingDistance[0])||0),a(((g=e.data)==null?void 0:g.cullingDistance[1])||0))},[e]);const c=p=>{s(p.target.value),e!=null&&e.data&&(e.data.cullingDistance[0]=p.target.value)},u=p=>{a(p.target.value),e!=null&&e.data&&(e.data.cullingDistance[1]=p.target.value)},f=p=>{e!=null&&e.data&&(A(p.target.value),e.data.cullingLayer=p.target.value)},h=()=>{r.updateCullHiddenMeshes()};return k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(xa,{title:"Trait Information",width:180,right:20}),k.jsx("div",{className:Ve.scrollContainer,children:n!=null?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Trait ID"}),k.jsx("div",{className:Ve.traitInfoText,children:n==null?void 0:n.id}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Trait Name"}),k.jsx("div",{className:Ve.traitInfoText,children:n==null?void 0:n.name}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Description"}),k.jsx("div",{className:Ve.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),k.jsx("div",{className:Ve.traitInfoTitle,children:"Culling Options"}),k.jsx("br",{}),k.jsxs("div",{className:Ve.traitInfoText,children:["Culling Layer",k.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:f,className:Ve["input-box"],step:1}),k.jsx("br",{}),k.jsx("br",{}),k.jsx(Yf,{title:"Out Distance",value:i,onChange:c,min:0,max:1,step:.001,stepBox:.01}),k.jsx("br",{}),k.jsx(Yf,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),k.jsx("div",{className:Ve.actionButton,onClick:h,children:k.jsx("div",{children:"Update Culling "})})]})]}):k.jsx(k.Fragment,{children:k.jsx("div",{className:Ve.traitInfoTitle,children:"No Trait Selected"})})})]})})}var hz={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=s(ye),t=r(Y5);function r(C){return C&&C.__esModule?C:{default:C}}function i(){if(typeof WeakMap!="function")return null;var C=new WeakMap;return i=function(){return C},C}function s(C){if(C&&C.__esModule)return C;if(C===null||o(C)!=="object"&&typeof C!="function")return{default:C};var S=i();if(S&&S.has(C))return S.get(C);var b={},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var D in C)if(Object.prototype.hasOwnProperty.call(C,D)){var $=M?Object.getOwnPropertyDescriptor(C,D):null;$&&($.get||$.set)?Object.defineProperty(b,D,$):b[D]=C[D]}return b.default=C,S&&S.set(C,b),b}function o(C){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?o=function(b){return typeof b}:o=function(b){return b&&typeof Symbol=="function"&&b.constructor===Symbol&&b!==Symbol.prototype?"symbol":typeof b},o(C)}function a(){return a=Object.assign||function(C){for(var S=1;S"u"?w:b.placeholder,value:""},isOpen:!1},M.dropdownRef=(0,e.createRef)(),M.mounted=!0,M.handleDocumentClick=M.handleDocumentClick.bind(g(M)),M.fireChangeEvent=M.fireChangeEvent.bind(g(M)),M}return h(S,[{key:"componentDidUpdate",value:function(M){if(this.props.value!==M.value)if(this.props.value){var D=this.parseValue(this.props.value,this.props.options);D!==this.state.selected&&this.setState({selected:D})}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(M){this.props.onFocus&&typeof this.props.onFocus=="function"&&this.props.onFocus(this.state.isOpen),!(M.type==="mousedown"&&M.button!==0)&&(M.stopPropagation(),M.preventDefault(),this.props.disabled||this.setState({isOpen:!this.state.isOpen}))}},{key:"parseValue",value:function(M,D){var $;if(typeof M=="string")for(var H=0,I=D.length;H"u"&&($=M.label||M);var H=M.label||M.value||M,I=$===this.state.selected.value||$===this.state.selected,v=(D={},c(D,"".concat(this.props.baseClassName,"-option"),!0),c(D,M.className,!!M.className),c(D,"is-selected",I),D),E=(0,t.default)(v),U=Object.keys(M.data||{}).reduce(function(P,L){return A({},P,c({},"data-".concat(L),M.data[L]))},{});return e.default.createElement("div",a({key:$,className:E,onMouseDown:this.setValue.bind(this,$,H),onClick:this.setValue.bind(this,$,H),role:"option","aria-selected":I?"true":"false"},U),H)}},{key:"buildMenu",value:function(){var M=this,D=this.props,$=D.options,H=D.baseClassName,I=$.map(function(v){if(v.type==="group"){var E=e.default.createElement("div",{className:"".concat(H,"-title")},v.name),U=v.items.map(function(P){return M.renderOption(P)});return e.default.createElement("div",{className:"".concat(H,"-group"),key:v.name,role:"listbox",tabIndex:"-1"},E,U)}else return M.renderOption(v)});return I.length?I:e.default.createElement("div",{className:"".concat(H,"-noresults")},"No options found")}},{key:"handleDocumentClick",value:function(M){this.mounted&&(this.dropdownRef.current.contains(M.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 M,D,$,H,I,v=this.props,E=v.baseClassName,U=v.controlClassName,P=v.placeholderClassName,L=v.menuClassName,z=v.arrowClassName,K=v.arrowClosed,O=v.arrowOpen,B=v.className,W=this.props.disabled?"Dropdown-disabled":"",ee=typeof this.state.selected=="string"?this.state.selected:this.state.selected.label,F=(0,t.default)((M={},c(M,"".concat(E,"-root"),!0),c(M,B,!!B),c(M,"is-open",this.state.isOpen),M)),X=(0,t.default)((D={},c(D,"".concat(E,"-control"),!0),c(D,U,!!U),c(D,W,!!W),D)),ue=(0,t.default)(($={},c($,"".concat(E,"-placeholder"),!0),c($,P,!!P),c($,"is-selected",this.isValueSelected()),$)),le=(0,t.default)((H={},c(H,"".concat(E,"-menu"),!0),c(H,L,!!L),H)),oe=(0,t.default)((I={},c(I,"".concat(E,"-arrow"),!0),c(I,z,!!z),I)),re=e.default.createElement("div",{className:ue},ee),pe=this.state.isOpen?e.default.createElement("div",{className:le,"aria-expanded":"true"},this.buildMenu()):null;return e.default.createElement("div",{ref:this.dropdownRef,className:F},e.default.createElement("div",{className:X,onMouseDown:this.handleMouseDown.bind(this),onTouchEnd:this.handleMouseDown.bind(this),"aria-haspopup":"listbox"},re,e.default.createElement("div",{className:"".concat(E,"-arrow-wrapper")},O&&K?this.state.isOpen?O:K:e.default.createElement("span",{className:oe}))),pe)}}]),S}(e.Component);x.defaultProps={baseClassName:"Dropdown"};var _=x;n.default=_})(hz);const ql=Bl(hz);function uLe({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=Y.useContext(or),[s,o]=ye.useState([]),[a,l]=ye.useState(null),A=u=>{(t==null?void 0:t.loras)!=null&&(l(t.loras[u.value]),console.log(t.loras[u.value]))},c=async()=>{const u=i.parent;u.remove(i),await r.createLoraData(a),u.add(i)};return ye.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]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(xa,{title:"Lora Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Lora Manifests"}),k.jsx(ql,{className:Ve.dropdownControl,options:s,onChange:A,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&k.jsx("div",{className:Ve.actionButton,onClick:c,children:k.jsx("div",{children:" Create Lora Data "})})]})]})})}function fLe({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=Y.useContext(or),[s,o]=ye.useState([]),[a,l]=ye.useState(""),[A,c]=ye.useState(null),u=h=>{(t==null?void 0:t.sprites)!=null&&(l(t.sprites[h.value].description),c(t.sprites[h.value]))},f=async()=>{const h=i.parent;h.remove(i),await r.createSpriteAtlas(A),h.add(i)};return ye.useEffect(()=>{if((t==null?void 0:t.sprites)!=null){const h=t.sprites.map((p,d)=>({value:d,label:p.name,description:p.description,manifest:p.manifest}));o(h)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(xa,{title:"Sprite Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsx("div",{className:Ve.traitInfoTitle,children:"Sprite Manifests"}),k.jsx(ql,{className:Ve.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:a||""}),A!=null&&k.jsx("div",{className:Ve.actionButton,onClick:f,children:k.jsx("div",{children:" Create Sprite Data "})})]})]})})}const pO=4096;function hLe({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=Y.useContext(or),[o,a]=ye.useState([]),[l,A]=ye.useState(""),[c,u]=ye.useState(""),[f,h]=ye.useState(""),[p,d]=ye.useState(!1),[g,m]=ye.useState(512),[y,w]=ye.useState(512),[x,_]=ye.useState(.1),[C,S]=ye.useState(.1),[b,M]=ye.useState("center"),[D,$]=ye.useState("center"),[H,I]=ye.useState("center"),[v,E]=ye.useState("head"),[U,P]=ye.useState("chest"),[L,z]=ye.useState(!0),[K,O]=ye.useState(!1),B=[{label:"center"},{label:"left"},{label:"right"}],W=[{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"}],X=Ae=>{(t==null?void 0:t.thumbnails)!=null&&(A(t.thumbnails[Ae.value].description),h(t.thumbnails[Ae.value].manifest),u(t.thumbnails[Ae.value].name))},ue=(Ae,q,J,ce)=>isNaN(Ae)?ce:Ae>J?J:Ae{const q=parseInt(Ae.target.value);m(ue(q,1,pO,512))},oe=Ae=>{const q=parseInt(Ae.target.value);w(ue(q,1,pO,512))},re=Ae=>{const q=parseFloat(Ae.target.value);_(ue(q,0,1,.1))},pe=Ae=>{const q=parseFloat(Ae.target.value);S(ue(q,0,1,.1))},_e=Ae=>{d(Ae)},Re=async()=>{const Ae=i.parent;Ae.remove(i),await r.createThumbnails(t.thumbnails[0]),Ae.add(i)},Q=(Ae=!0)=>({topFrameOffset:C,bottomFrameOffset:x,thumbnailsWidth:g,thumbnailsHeight:y,backgroundColor:[0,0,0,0],thumbnailsCollection:[{traitGroup:e,cameraPosition:D+"-"+H+"-"+b,topBoneName:v==="upperLeg"||v==="lowerLeg"||v==="foot"?"left"+v[0].toUpperCase()+v.slice(1):v,topBoneMaxVertex:L,bottomBoneName:U==="upperLeg"||U==="lowerLeg"||v==="foot"?"left"+U[0].toUpperCase()+U.slice(1):U,bottomBoneMaxVertex:K,saveOnlyIDs:Ae?null:n.id}]}),de=async(Ae=!1)=>{s.storeCurrentAvatar();const q=i.parent;q.remove(i),Ae?await r.createThumbnailsWithObjectData(Q(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(Q(!1),!1),q.add(i),s.loadStoredAvatar()};return ye.useEffect(()=>{if((t==null?void 0:t.thumbnails)!=null){const Ae=t.thumbnails.map((q,J)=>({value:J,label:q.name,description:q.description,manifest:q.manifest}));a(Ae)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:Ve.InformationContainerPos,children:[k.jsx(xa,{title:"Thumbnail Creation",width:180,right:20}),k.jsxs("div",{className:Ve.scrollContainer,children:[k.jsxs("div",{className:Ve.tabHolder,children:[k.jsx("div",{className:Ve.tabButton+(p?"":" "+Ve.tabButtonSelected),onClick:()=>{_e(!1)},children:k.jsxs("div",{children:[" ","Custom"," "]})}),k.jsx("div",{className:Ve.tabButton+(p?" "+Ve.tabButtonSelected:""),onClick:()=>{_e(!0)},children:k.jsxs("div",{children:[" ","Manifest"," "]})})]}),k.jsx("br",{}),p?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,children:"Thumbnail Manifests"}),k.jsx(ql,{className:Ve.dropdownControl,options:o,value:c,onChange:X,placeholder:"Select an option"}),";",k.jsx("div",{className:Ve.traitInfoText,children:l||""}),f!=""&&k.jsx("div",{className:Ve.actionButton,onClick:Re,children:k.jsx("div",{children:" Create Thumbnails "})})]}):k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Ve.traitInfoText,children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",k.jsx("input",{value:g,className:Ve["input-box"],step:1,onChange:Ae=>{m(Ae.target.value)},onBlur:le}),k.jsx("br",{}),"Height ",k.jsx("input",{value:y,className:Ve["input-box"],step:1,onChange:Ae=>{w(Ae.target.value)},onBlur:oe}),k.jsx("br",{}),"Top Spacing ",k.jsx("input",{value:x,className:Ve["input-box"],step:.1,onChange:Ae=>{_(Ae.target.value)},onBlur:re}),k.jsx("br",{}),"Bottom Spacing ",k.jsx("input",{value:C,className:Ve["input-box"],step:.1,onChange:Ae=>{S(Ae.target.value)},onBlur:pe}),k.jsx("br",{}),k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"X"}),k.jsx(ql,{className:Ve.dropdownControlSmall,options:B,onChange:Ae=>{$(Ae.label)},value:D})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Y"}),k.jsx(ql,{className:Ve.dropdownControlSmall,options:W,onChange:Ae=>{I(Ae.label)},value:H})]}),k.jsxs("div",{className:Ve.dropdownFlex,children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Z"}),k.jsx(ql,{className:Ve.dropdownControlSmall,options:ee,onChange:Ae=>{M(Ae.label)},value:b})]}),k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),k.jsxs("div",{className:Ve.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Top"}),k.jsx(ql,{className:Ve.dropdownControlSmall,options:F,onChange:Ae=>{E(Ae.label)},value:v})]}),k.jsxs("div",{className:Ve.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:Ve.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),k.jsx(ql,{className:Ve.dropdownControlSmall,options:F,onChange:Ae=>{P(Ae.label)},value:U})]}),k.jsxs("div",{style:{textAlign:"left"},children:[k.jsxs("div",{className:Ve.checkboxFlex,style:{marginTop:"20px"},children:[k.jsx("input",{type:"checkbox",checked:L,onChange:Ae=>{z(Ae.target.checked)}}),k.jsx("div",{className:Ve.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${L?"uses Top":"uses Low"} Vertex`})]}),k.jsxs("div",{className:Ve.checkboxFlex,style:{marginTop:"10px"},children:[k.jsx("input",{type:"checkbox",checked:K,onChange:Ae=>{O(Ae.target.checked)}}),k.jsx("div",{className:Ve.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${K?"uses Top":"uses Low"} Vertex`})]})]}),e==""?k.jsx("div",{className:Ve.traitInfoText+" "+Ve.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):k.jsxs(k.Fragment,{children:[k.jsx("div",{className:Ve.traitInfoTitle+" "+Ve.centerAlign,style:{marginTop:"20px"},children:"Generate"}),k.jsx("div",{className:Ve.traitInfoText+" "+Ve.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),k.jsxs("div",{className:Ve.simpleFlex,style:{marginTop:"0px"},children:[k.jsx("div",{className:Ve.actionButton,style:{margin:"0px"},onClick:()=>{de(!1)},children:k.jsx("div",{children:" Current "})}),k.jsx("div",{className:Ve.actionButton,style:{margin:"0px"},onClick:()=>{de(!0)},children:k.jsx("div",{children:" All "})})]})]})]})]})]})})}function dLe({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=Y.useState(""),s=o=>{o!=r?i(o):i("")};return k.jsxs("div",{children:[r=="Information"&&k.jsx(cLe,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&k.jsx(uLe,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&k.jsx(fLe,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&k.jsx(hLe,{selectedTrait:n,traitGroupName:t}),k.jsxs("div",{className:TB.InformationContainerPos,children:[k.jsx(xa,{title:"Tools",width:90,right:0}),k.jsx("div",{className:TB.scrollContainer,children:k.jsxs("div",{className:TB.optionsContainer,children:[k.jsx("div",{onClick:()=>{s("Information")},children:k.jsx(mA,{size:56,icon:kUe,rarity:r=="Information"?"mythic":"none"})},"Information"),k.jsx("div",{onClick:()=>{s("LoraCreation")},children:k.jsx(mA,{size:56,icon:HUe,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),k.jsx("div",{onClick:()=>{s("SpriteCreation")},children:k.jsx(mA,{size:56,icon:QUe,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),k.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:k.jsx(mA,{size:56,icon:zUe,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation")]})})]})]})}function pLe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,loraDataGenerator:a,spriteAtlasGenerator:l,thumbnailsGenerator:A,sceneElements:c}=Y.useContext(or),{playSound:u}=Y.useContext(Xs),{isMute:f}=Y.useContext(Ys),{t:h}=ye.useContext(Io),p=()=>{!f&&u("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(dt.CREATE),r(!1)},[d,g]=Y.useState(null),[m,y]=Y.useState(null),[w,x]=Y.useState(""),[_,C]=Y.useState(null),[S,b]=Y.useState(null),[M,D]=Y.useState(""),[$,H]=Y.useState(!1),[I,v]=Y.useState({background:"#ffffff"}),E=()=>{!f&&u("backNextButton"),e(dt.SAVE),r(!1)},U=()=>{t(!0),g(null),i.loadRandomTraits().then(()=>{console.log("success"),w!=""&&C(i.getCurrentTraitData(w)),t(!1)}).catch(oe=>{t(!1),console.error("Error loading random traits:",oe.message)})},P=oe=>{v({background:oe.hex})},L=oe=>{v({background:oe.hex}),i.setTraitColor(w,oe.hex)},z=async oe=>{const re=fl(oe.name),pe=URL.createObjectURL(oe);await s.loadAnimation(pe,!1,0,!0,"",re),D(s.getCurrentAnimationName())},K=oe=>{if(H(!1),w!=""){t(!0);const re=URL.createObjectURL(oe);i.loadCustomTexture(w,re).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},O=oe=>{if(H(!1),w!=""){t(!0);const re=URL.createObjectURL(oe);i.loadCustomTrait(w,re).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},B=oe=>{H(!1),t(!0),i.loadTrait(oe.traitGroup.trait,oe.id).then(()=>{t(!1),C(oe)})},W=oe=>{H(!1),i.removeTrait(oe),C(null)},ee=oe=>{H(!1),t(!0),i.loadRandomTrait(oe).then(()=>{t(!1),C(i.getCurrentTraitData(oe))})},F=oe=>{H(!1);const re=Array.from(oe),pe=[],_e=Re=>new Promise((Q,de)=>{var Ae;if(Re&&Re.name.toLowerCase().endsWith(".json")){const q=new FileReader,J=`${(Ae=i.manifestData)==null?void 0:Ae.getAssetsDirectory()}/anata/_thumbnails/t_${Re.name.split("_")[0]}.jpg`;console.log(J),q.onload=function(ce){try{const xe=JSON.parse(ce.target.result);xe.thumb=J,pe.push(xe),Q()}catch(xe){console.error("Error parsing the JSON file:",xe),de(xe)}},q.readAsText(Re)}});Promise.all(re.map(_e)).then(()=>{pe.length>0&&(g(pe),t(!0),i.loadTraitsFromNFTObject(pe[0]).then(()=>{t(!1)}))}).catch(Re=>{console.error("Error processing files:",Re)})},X=async oe=>{const re=oe[0];re&&re.name.toLowerCase().endsWith(".fbx")&&z(re),re&&(re.name.toLowerCase().endsWith(".png")||re.name.toLowerCase().endsWith(".jpg"))&&K(re),re&&re.name.toLowerCase().endsWith(".vrm")&&O(re),re&&re.name.toLowerCase().endsWith(".json")&&F(oe)},ue=oe=>{!f&&u("optionClick"),H(!1),w!==oe.trait?(y(i.getTraits(oe.trait)),x(oe.trait),C(i.getCurrentTraitData(oe.trait)),b(i.getCurrentTraitVRM(oe.trait)),o({targetY:oe.cameraTarget.height,distance:oe.cameraTarget.distance})):(y(null),x(""),C(null),o({targetY:.8,distance:3.2}))},le=()=>{H(!1);var oe=document.createElement("input");oe.type="file",oe.accept=".vrm",oe.onchange=re=>{var pe=re.target.files[0];if(pe.name.endsWith(".vrm")){const _e=URL.createObjectURL(pe);t(!0),i.loadCustomTrait(w,_e).then(()=>{t(!1)})}},oe.click()};return k.jsxs("div",{className:Ln.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:h("pageTitles.chooseAppearance")}),k.jsx(Sg,{onFilesDrop:X}),k.jsxs("div",{className:Ln.sideMenu,children:[k.jsx(xa,{title:"Appearance",left:20}),k.jsx("div",{className:Ln.bottomLine}),k.jsx("div",{className:Ln.scrollContainer,children:k.jsx("div",{className:Ln["editor-container"],children:i.getGroupTraits().map((oe,re)=>k.jsxs("div",{className:Ln.editorButton,onClick:()=>{ue(oe)},children:[k.jsx(mA,{size:56,icon:oe.fullIconSvg,rarity:w!==oe.trait?"none":"mythic"}),k.jsx("div",{className:Ln.editorText,children:oe.name})]},"options_"+re))})})]}),!!m&&k.jsxs("div",{className:Ln.selectorContainerPos,children:[k.jsx(xa,{title:w,width:130,left:20}),_&&k.jsx("div",{className:Ln.selectorColorPickerButton,onClick:()=>{H(!$)},children:k.jsx("img",{className:Ln.selectorColorPickerImg,src:Wme})}),!!$&&k.jsx("div",{draggable:!1,className:Ln.selectorColorPickerUI,children:k.jsx(AUe,{draggable:!1,width:"200px",color:I.background,onChange:P,onChangeComplete:L})}),k.jsx("div",{className:Ln.bottomLine}),k.jsx("div",{className:Ln.scrollContainerOptions,children:k.jsxs("div",{className:Ln["selector-container"],children:[k.jsx("div",{className:`${Ln.selectorButton}`,onClick:()=>{ee(w)},children:k.jsx(mA,{size:56,icon:jme,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(w)?k.jsx(k.Fragment,{}):k.jsx("div",{className:`${Ln.selectorButton}`,icon:UP,onClick:()=>{W(w)},children:k.jsx(mA,{size:56,icon:UP,rarity:_==null?"mythic":"none"})},"no-trait"),m.map(oe=>{let re=oe.id===(_==null?void 0:_.id);return k.jsx("div",{className:`${Ln.selectorButton}`,onClick:()=>{B(oe)},children:k.jsx(mA,{size:56,icon:oe.fullThumbnail,rarity:re?"mythic":"none"})},oe.id)})]})}),k.jsx("div",{className:Ln.uploadContainer,children:k.jsx("div",{className:Ln.uploadButton,onClick:le,children:k.jsx("div",{children:"Upload "})})})]}),k.jsx(ST,{jsonSelectionArray:d}),k.jsx(dLe,{selectedTrait:_,selectedVRM:S,traitGroupName:w}),k.jsx(l_,{loadedAnimationName:M,randomize:U}),k.jsxs("div",{className:Ln.buttonContainer,children:[k.jsx(_n,{theme:"light",text:h("callToAction.back"),size:14,className:Ln.buttonLeft,onClick:p}),i.canDownload()&&k.jsx(_n,{theme:"light",text:h("callToAction.next"),size:14,className:Ln.buttonRight,onClick:E})]})]})}const mLe="_InformationContainerPos_rgqwy_1",gLe="_traitInfoTitle_rgqwy_13",vLe="_traitInfoText_rgqwy_21",yLe="_flexSelect_rgqwy_30",wLe="_scrollContainer_rgqwy_65",xLe="_checked_rgqwy_90",_Le="_checkmark_rgqwy_94",bLe="_checkboxHolder_rgqwy_107",BLe="_buttonContainer_rgqwy_114",ELe="_buttonLeft_rgqwy_123",CLe="_buttonRight_rgqwy_127",SLe="_buttonCenter_rgqwy_131",ci={InformationContainerPos:mLe,traitInfoTitle:gLe,traitInfoText:vLe,flexSelect:yLe,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:wLe,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:xLe,checkmark:_Le,checkboxHolder:bLe,buttonContainer:BLe,buttonLeft:ELe,buttonRight:CLe,buttonCenter:SLe},MLe="_InformationContainerPos_11mqa_2",TLe="_scrollContainer_11mqa_16",ILe="_traitInfoTitle_11mqa_28",RLe="_traitInfoText_11mqa_38",FLe="_flexSelect_11mqa_66",ULe="_checked_11mqa_124",LLe="_checkmark_11mqa_128",PLe="_checkboxHolder_11mqa_141",Gn={InformationContainerPos:MLe,scrollContainer:TLe,traitInfoTitle:ILe,traitInfoText:RLe,"input-box":"_input-box_11mqa_47",flexSelect:FLe,"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:ULe,checkmark:LLe,checkboxHolder:PLe};function y2({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=Y.useContext(or),[a,l]=ye.useState(0),[A,c]=ye.useState(0),[u,f]=ye.useState(0),[h,p]=ye.useState(0),[d,g]=ye.useState(0),[m,y]=ye.useState(0),[w,x]=ye.useState(0),[_,C]=ye.useState(0),[S,b]=ye.useState(0),[M,D]=ye.useState(0);return ye.useEffect(()=>{if(n!=null){const $=Gh(n,"Mesh"),H=Gh(n,"SkinnedMesh");l($.length),c(H.length);const I=$.concat(H),{stdMats:v,stdCutoutpMats:E,stdTranspMats:U,mToonMats:P,mToonCutoutMats:L,mToonTranspMats:z}=Oue(I);f(v.length),p(U.length),g(E.length),y(P.length),x(z.length),C(L.length);const{triangles:K,bones:O}=o.getBoneTriangleCount();b(K),D(O)}},[n]),n!=null?k.jsx("div",{children:k.jsxs("div",{className:Gn.InformationContainerPos,children:[k.jsx(xa,{title:"Model Information",width:180,right:20}),k.jsxs("div",{className:Gn.scrollContainer,children:[k.jsxs("div",{className:Gn.flexSelect,children:[(t==null?void 0:t.length)>1?k.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["left-button"]}`,onClick:s}):k.jsx(k.Fragment,{}),e&&k.jsx("div",{style:{textAlign:"center"},children:k.jsx("div",{className:Gn.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?k.jsx("div",{className:`${Gn["arrow-button"]} ${Gn["right-button"]}`,onClick:i}):k.jsx(k.Fragment,{})]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"Geometry info:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["Meshes: ",a]}),k.jsxs("div",{className:Gn.traitInfoText,children:["SkinnedMeshes: ",A]}),k.jsxs("div",{className:Gn.traitInfoText,children:["Triangles: ",S]}),k.jsxs("div",{className:Gn.traitInfoText,children:["Bones: ",M]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"Standard Material Count:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",u]}),k.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",d]}),k.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",h]}),k.jsx("div",{className:Gn.traitInfoTitle,children:"MToon Material Count:"}),k.jsxs("div",{className:Gn.traitInfoText,children:["opaque: ",m]}),k.jsxs("div",{className:Gn.traitInfoText,children:["cutout: ",_]}),k.jsxs("div",{className:Gn.traitInfoText,children:["transparent: ",w]})]})]})}):k.jsx(k.Fragment,{})}const DLe="_InformationContainerPos_b0msk_1",OLe="_traitInfoTitle_b0msk_13",NLe="_traitInfoText_b0msk_22",kLe="_flexSelect_b0msk_33",QLe="_scrollContainer_b0msk_68",HLe="_checked_b0msk_93",zLe="_checkmark_b0msk_97",GLe="_checkboxHolder_b0msk_110",lt={InformationContainerPos:DLe,traitInfoTitle:OLe,traitInfoText:NLe,flexSelect:kLe,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:QLe,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:HLe,checkmark:zLe,checkboxHolder:GLe};function E_({showDropToDownload:n,showCreateAtlas:e,mergeMenuTitle:t}){const[r,i]=ye.useState(Oe.mergeOptions_atlas_std_size||6),[s,o]=ye.useState(Oe.mergeOptions_atlas_std_transp_size||6),[a,l]=ye.useState(Oe.mergeOptions_atlas_mtoon_size||6),[A,c]=ye.useState(Oe.mergeOptions_atlas_mtoon_transp_size||6),[u,f]=ye.useState(Oe.mergeOptions_sel_option||0),[h,p]=ye.useState(Oe.mergeOptions_two_sided_mat||!1),[d]=ye.useState(["Merge to Standard","Merge to MToon","Keep Both"]),[g,m]=ye.useState(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm),[y,w]=ye.useState(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview),[x,_]=ye.useState(Oe.mergeOptions_drop_download||!1),[C,S]=ye.useState(Oe.merge_options_ktx_compression||!1),[b,M]=ye.useState(Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas),[D,$]=ye.useState(Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora),[H,I]=ye.useState(Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites),v=F=>{_(F.target.checked),Oe.mergeOptions_drop_download=F.target.checked},E=F=>{p(F.target.checked),Oe.mergeOptions_two_sided_mat=F.target.checked},U=F=>{S(F.target.checked),Oe.merge_options_ktx_compression=F.target.checked},P=F=>{M(F.target.checked),Oe.mergeOptions_create_atlas=F.target.checked},L=F=>{m(F.target.checked),Oe.mergeOptions_download_vrm=F.target.checked},z=F=>{w(F.target.checked),Oe.mergeOptions_download_vrm_preview=F.target.checked},K=F=>{$(F.target.checked),Oe.mergeOptions_download_lora=F.target.checked},O=F=>{I(F.target.checked),Oe.mergeOptions_download_sprites=F.target.checked},B=()=>{let F=u;u<=0?F=d.length-1:F-=1,f(F),Oe.mergeOptions_sel_option=F},W=()=>{let F=u;u>=d.length-1?F=0:F+=1,f(F),Oe.mergeOptions_sel_option=F},ee=async(F,X)=>{let ue=parseInt(F.target.value);ue>8?ue=8:ue<0&&(ue=0),(oe=>{switch(X){case"standard opaque":i(oe),Oe.mergeOptions_atlas_std_size=oe;break;case"standard transparent":o(oe),Oe.mergeOptions_atlas_std_transp_size=oe;break;case"mtoon opaque":l(oe),Oe.mergeOptions_atlas_mtoon_size=oe;break;case"mtoon transparent":c(oe),Oe.mergeOptions_atlas_mtoon_transp_size=oe;break}})(ue)};return k.jsxs("div",{className:lt.InformationContainerPos,children:[k.jsx(xa,{title:t,width:180,left:20}),k.jsxs("div",{className:lt.scrollContainer,children:[k.jsx("div",{className:lt.traitInfoTitle,children:"Download Options"}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:g,onChange:L}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:y,onChange:z}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM Preview"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:D,onChange:K}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Lora Data"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:H,onChange:O}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Sprites Data"]})})}),g&&k.jsxs(k.Fragment,{children:[e&&k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:b,onChange:P}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Create Atlas"]})})}),(e==!1||b)&&k.jsxs(k.Fragment,{children:[k.jsx("br",{}),k.jsx("div",{className:lt.traitInfoTitle,children:"Merge Atlas Type"}),k.jsx("br",{}),k.jsxs("div",{className:lt.flexSelect,children:[k.jsx("div",{className:`${lt["arrow-button"]} ${lt["left-button"]}`,onClick:B}),k.jsx("div",{className:lt.traitInfoText,style:{marginBottom:"0"},children:d[u]}),k.jsx("div",{className:`${lt["arrow-button"]} ${lt["right-button"]}`,onClick:W})]}),k.jsx("br",{}),k.jsx("br",{}),(u===0||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:lt.traitInfoTitle,children:"Standard Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Opaque: ",vn(r)+" x "+vn(r)]}),k.jsx(Yf,{value:r,onChange:F=>ee(F,"standard opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Transparent: ",vn(s)+" x "+vn(s)]}),k.jsx(Yf,{value:s,onChange:F=>ee(F,"standard transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),(u===1||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:lt.traitInfoTitle,children:"MToon Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Opaque: ",vn(a)+" x "+vn(a)]}),k.jsx(Yf,{value:a,onChange:F=>ee(F,"mtoon opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:lt.traitInfoText,children:["Transparent: ",vn(A)+" x "+vn(A)]}),k.jsx(Yf,{value:A,onChange:F=>ee(F,"mtoon transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),k.jsx("div",{className:lt.traitInfoTitle,children:"Options"}),k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:h,onChange:E}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Two Sided Material"]})}),n&&k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:x,onChange:v}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Drag Drop - Download"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:lt.traitInfoText,children:k.jsxs("div",{className:lt.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:lt["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:C,onChange:U}),k.jsx("div",{className:lt["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}function VLe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=Y.useContext(or),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=Y.useState(""),{playSound:g}=Y.useContext(Xs),{isMute:m}=Y.useContext(Ys),[y,w]=Y.useState(null),x=()=>{!m&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(dt.LANDING)},_=()=>{const I=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:I===0||I==2,exportMtoonAtlas:I===1||I==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=(I,v=!1)=>{console.log(v),(async()=>{await s.loadTraitsFromNFTObject(y[I]),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await s.downloadVRM(y[I].name,_());const P=new ld,L=A.parent;L.remove(A);const z=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(z===!0){const O=r.loras.map(async B=>a.createLoraData(B,P));await Promise.all(O)}const K=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(K===!0){const O=r.sprites.map(async B=>l.createSpriteAtlas(B,P));await Promise.all(O)}(z===!0||K===!0)&&P.saveZip(y[I].name),L.add(A),I{t(!0),C(0,!0)},{t:b}=ye.useContext(Io),M=async I=>{if(s.getCurrentCharacterModel()){const E=fl(I.name),U=URL.createObjectURL(I);await o.loadAnimation(U,!1,0,!0,"",E),d(o.getCurrentAnimationName()),URL.revokeObjectURL(U)}else console.warn("Please load a vrm model to test animations.")},D=async I=>{const v=URL.createObjectURL(I);await s.loadOptimizerCharacter(v),URL.revokeObjectURL(v);const E=fl(I.name);h(E),u(s.getCurrentCharacterModel())},$=I=>{const v=Array.from(I),E=[],U=P=>new Promise((L,z)=>{var K;if(P&&P.name.toLowerCase().endsWith(".json")){const O=new FileReader,B=`${(K=s.manifestData)==null?void 0:K.getAssetsDirectory()}/anata/_thumbnails/t_${P.name.split("_")[0]}.jpg`;O.onload=function(W){try{const ee=JSON.parse(W.target.result);ee.thumb=B,E.push(ee),L()}catch(ee){console.error("Error parsing the JSON file:",ee),z(ee)}},O.readAsText(P)}});Promise.all(v.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)})},H=async I=>{const v=I[0];console.log("anim"),v&&v.name.toLowerCase().endsWith(".fbx")&&(console.log("anim2"),M(v)),v&&v.name.toLowerCase().endsWith(".vrm")&&D(v),v&&v.name.toLowerCase().endsWith(".json")&&$(I)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Batch Download"}),k.jsx(Sg,{onFilesDrop:H}),k.jsx(E_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(y2,{model:c}),k.jsx(ST,{jsonSelectionArray:y}),k.jsx(l_,{loadedAnimationName:p}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:b("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(y==null?void 0:y.length)==1&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:S}),(y==null?void 0:y.length)>1&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:S})]})]})}const Og="abi/5.7.0",Dt=new ve(Og),qc={};let mO={calldata:!0,memory:!0,storage:!0},jLe={calldata:!0,memory:!0};function Fv(n,e){if(n==="bytes"||n==="string"){if(mO[e])return!0}else if(n==="address"){if(e==="payable")return!0}else if((n.indexOf("[")>=0||n==="tuple")&&jLe[e])return!0;return(mO[e]||e==="payable")&&Dt.throwArgumentError("invalid modifier","name",e),!1}function WLe(n,e){let t=n;function r(a){Dt.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!==Gt.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===Gt.full?", ":",")+")"):t+=this.type,e!==Gt.sighash&&(this.indexed===!0&&(t+=" indexed"),e===Gt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?_r.fromString(e,t):_r.fromObject(e)}static fromObject(e){return _r.isParamType(e)?e:new _r(qc,{name:e.name||null,type:bf(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(_r.fromObject):null})}static fromString(e,t){function r(i){return _r.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(WLe(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function tg(n,e){return YLe(n).map(t=>_r.fromString(t,e))}class al{constructor(e,t){e!==qc&&Dt.throwError("use a static from method",ve.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),xy(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return al.isFragment(e)?e:typeof e=="string"?al.fromString(e):al.fromObject(e)}static fromObject(e){if(al.isFragment(e))return e;switch(e.type){case"function":return ta.fromObject(e);case"event":return tl.fromObject(e);case"constructor":return ea.fromObject(e);case"error":return iA.fromObject(e);case"fallback":case"receive":return null}return Dt.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"?tl.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?ta.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?ea.fromString(e.trim()):e.split(" ")[0]==="error"?iA.fromString(e.substring(5).trim()):Dt.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class tl extends al{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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!==Gt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",e!==Gt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?tl.fromString(e):tl.fromObject(e)}static fromObject(e){if(tl.isEventFragment(e))return e;e.type!=="event"&&Dt.throwArgumentError("invalid event object","value",e);const t={name:ng(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(_r.fromObject):[],type:"event"};return new tl(qc,t)}static fromString(e){let t=e.match(rg);t||Dt.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:Dt.warn("unknown modifier: "+i)}}),tl.fromObject({name:t[1].trim(),anonymous:r,inputs:tg(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function dz(n,e){e.gas=null;let t=n.split("@");return t.length!==1?(t.length>2&&Dt.throwArgumentError("invalid human-readable ABI signature","value",n),t[1].match(/^[0-9]+$/)||Dt.throwArgumentError("invalid human-readable ABI signature gas","value",n),e.gas=Ge.from(t[1]),t[0]):n}function pz(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 mz(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&&Dt.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",n),e.payable=e.stateMutability==="payable",n.payable!=null&&!!n.payable!==e.payable&&Dt.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"&&Dt.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&&Dt.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"&&Dt.throwArgumentError("unable to determine stateMutability","value",n),e}class ea extends al{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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===Gt.sighash&&Dt.throwError("cannot format a constructor for sighash",ve.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?ea.fromString(e):ea.fromObject(e)}static fromObject(e){if(ea.isConstructorFragment(e))return e;e.type!=="constructor"&&Dt.throwArgumentError("invalid constructor object","value",e);let t=mz(e);t.constant&&Dt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(_r.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new ea(qc,r)}static fromString(e){let t={type:"constructor"};e=dz(e,t);let r=e.match(rg);return(!r||r[1].trim()!=="constructor")&&Dt.throwArgumentError("invalid constructor string","value",e),t.inputs=tg(r[2].trim(),!1),pz(r[3].trim(),t),ea.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class ta extends ea{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.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!==Gt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",e!==Gt.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"?ta.fromString(e):ta.fromObject(e)}static fromObject(e){if(ta.isFunctionFragment(e))return e;e.type!=="function"&&Dt.throwArgumentError("invalid function object","value",e);let t=mz(e);const r={type:e.type,name:ng(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(_r.fromObject):[],outputs:e.outputs?e.outputs.map(_r.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new ta(qc,r)}static fromString(e){let t={type:"function"};e=dz(e,t);let r=e.split(" returns ");r.length>2&&Dt.throwArgumentError("invalid function string","value",e);let i=r[0].match(rg);if(i||Dt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&ng(t.name),t.inputs=tg(i[2],!1),pz(i[3].trim(),t),r.length>1){let s=r[1].match(rg);(s[1].trim()!=""||s[3].trim()!="")&&Dt.throwArgumentError("unexpected tokens","value",e),t.outputs=tg(s[2],!1)}else t.outputs=[];return ta.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function gO(n){const e=n.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Dt.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",n),n}class iA extends al{format(e){if(e||(e=Gt.sighash),Gt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Gt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Gt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Gt.full?", ":",")+") ",t.trim()}static from(e){return typeof e=="string"?iA.fromString(e):iA.fromObject(e)}static fromObject(e){if(iA.isErrorFragment(e))return e;e.type!=="error"&&Dt.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:ng(e.name),inputs:e.inputs?e.inputs.map(_r.fromObject):[]};return gO(new iA(qc,t))}static fromString(e){let t={type:"error"},r=e.match(rg);return r||Dt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&ng(t.name),t.inputs=tg(r[2],!1),gO(iA.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function bf(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const $Le=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function ng(n){return(!n||!n.match($Le))&&Dt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const rg=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function YLe(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&w2.throwError("value out-of-bounds",ve.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=Zi([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 rx{constructor(e,t,r,i){Ue(this,"_data",at(e)),Ue(this,"wordSize",t||32),Ue(this,"_coerceFunc",r),Ue(this,"allowLoose",i),this._offset=0}get data(){return nt(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):rx.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:w2.throwError("data out-of-bounds",ve.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new rx(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 Ge.from(this.readBytes(this.wordSize))}}class ZLe extends Rl{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=Dr(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return Dr(kn(e.readValue().toHexString(),20))}}class JLe extends Rl{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 Xf=new ve(Og);function gz(n,e,t){let r=null;if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(A=>{const c=A.localName;return c||Xf.throwError("cannot encode object for signature with missing names",ve.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]&&Xf.throwError("cannot encode object for signature with duplicate names",ve.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]=!0,t[c]})}else Xf.throwArgumentError("invalid tuple value","tuple",t);e.length!==r.length&&Xf.throwArgumentError("types/value length mismatch","tuple",t);let i=new pS(n.wordSize),s=new pS(n.wordSize),o=[];e.forEach((l,A)=>{let c=r[A];if(l.dynamic){let u=s.length;l.encode(s,c);let f=i.writeUpdatableValue();o.push(h=>{f(h+u)})}else l.encode(i,c)}),o.forEach(l=>{l(i.length)});let a=n.appendWriter(i);return a+=n.appendWriter(s),a}function vz(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(A){if(A.code===ve.errors.BUFFER_OVERRUN)throw A;o=A,o.baseType=s.name,o.name=s.localName,o.type=s.type}}else try{o=s.decode(n)}catch(a){if(a.code===ve.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 qLe extends Rl{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&&Xf.throwError("insufficient data length",ve.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 gz(e,this.coders,t)}decode(e){return e.coerce(this.name,vz(e,this.coders))}}const Lv=new ve(Og),o3e=new RegExp(/^bytes([0-9]*)$/),a3e=new RegExp(/^(u?int)([0-9]*)$/);class l3e{constructor(e){Ue(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new ZLe(e.name);case"bool":return new e3e(e.name);case"string":return new s3e(e.name);case"bytes":return new t3e(e.name);case"array":return new qLe(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Uv((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new r3e(e.name)}let t=e.type.match(a3e);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&Lv.throwArgumentError("invalid "+t[1]+" bit length","param",e),new i3e(r/8,t[1]==="int",e.name)}if(t=e.type.match(o3e),t){let r=parseInt(t[1]);return(r===0||r>32)&&Lv.throwArgumentError("invalid bytes length","param",e),new n3e(r,e.name)}return Lv.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new rx(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new pS(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(_r.from(i)));return new Uv(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Lv.throwError("types/values length mismatch",ve.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(_r.from(o))),i=new Uv(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(_r.from(o)));return new Uv(i,"_").decode(this._getReader(at(t),r))}}const A3e=new l3e,bn=new ve(Og);class c3e extends ag{}class u3e extends ag{}class f3e extends ag{}class mS extends ag{static isIndexed(e){return!!(e&&e._isIndexed)}}const h3e={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function vO(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class yO{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Ue(this,"fragments",t.map(r=>al.from(r)).filter(r=>r!=null)),Ue(this,"_abiCoder",Ji(new.target,"getAbiCoder")()),Ue(this,"functions",{}),Ue(this,"errors",{}),Ue(this,"events",{}),Ue(this,"structs",{}),this.fragments.forEach(r=>{let i=null;switch(r.type){case"constructor":if(this.deploy){bn.warn("duplicate definition - constructor");return}Ue(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]){bn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Ue(this,"deploy",ea.from({payable:!1,type:"constructor"})),Ue(this,"_isInterface",!0)}format(e){e||(e=Gt.full),e===Gt.sighash&&bn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===Gt.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return A3e}static getAddress(e){return Dr(e)}static getSighash(e){return zr(Bf(e.format()),0,4)}static getEventTopic(e){return Bf(e.format())}getFunction(e){if(Et(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];bn.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?bn.throwArgumentError("no matching function","name",r):i.length>1&&bn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[ta.fromString(e).format()];return t||bn.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(Et(e)){const r=e.toLowerCase();for(const i in this.events)if(r===this.getEventTopic(i))return this.events[i];bn.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?bn.throwArgumentError("no matching event","name",r):i.length>1&&bn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[tl.fromString(e).format()];return t||bn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Et(e)){const r=Ji(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}bn.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?bn.throwArgumentError("no matching error","name",r):i.length>1&&bn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[ta.fromString(e).format()];return t||bn.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 Ji(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),Ji(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=at(t);return nt(r.slice(0,4))!==this.getSighash(e)&&bn.throwArgumentError(`data signature does not match error ${e.name}.`,"data",nt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeErrorResult(e,t){return typeof e=="string"&&(e=this.getError(e)),nt(Zi([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){typeof e=="string"&&(e=this.getFunction(e));const r=at(t);return nt(r.slice(0,4))!==this.getSighash(e)&&bn.throwArgumentError(`data signature does not match function ${e.name}.`,"data",nt(r)),this._decodeParams(e.inputs,r.slice(4))}encodeFunctionData(e,t){return typeof e=="string"&&(e=this.getFunction(e)),nt(Zi([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){typeof e=="string"&&(e=this.getFunction(e));let r=at(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 A=nt(r.slice(0,4)),c=h3e[A];if(c)o=this._abiCoder.decode(c.inputs,r.slice(4)),a=c.name,l=c.signature,c.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(A);o=this._abiCoder.decode(u.inputs,r.slice(4)),a=u.name,l=u.format()}catch{}break}}return bn.throwError("call revert exception"+s,ve.errors.CALL_EXCEPTION,{method:e.format(),data:nt(t),errorArgs:o,errorName:a,errorSignature:l,reason:i})}encodeFunctionResult(e,t){return typeof e=="string"&&(e=this.getFunction(e)),nt(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){typeof e=="string"&&(e=this.getEvent(e)),t.length>e.inputs.length&&bn.throwError("too many arguments for "+e.format(),ve.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?Bf(o):s.type==="bytes"?rr(nt(o)):(s.type==="bool"&&typeof o=="boolean"&&(o=o?"0x01":"0x00"),s.type.match(/^u?int/)&&(o=Ge.from(o).toHexString()),s.type==="address"&&this._abiCoder.encode(["address"],[o]),kn(nt(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&bn.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"?bn.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&&bn.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(Bf(l));else if(o.type==="bytes")r.push(rr(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);(!Et(r[0],32)||r[0].toLowerCase()!==f)&&bn.throwError("fragment/topic mismatch",ve.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(_r.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,Zi(r)):null,l=this._abiCoder.decode(s,t,!0),A=[],c=0,u=0;e.inputs.forEach((f,h)=>{if(f.indexed)if(a==null)A[h]=new mS({_isIndexed:!0,hash:null});else if(o[h])A[h]=new mS({_isIndexed:!0,hash:a[u++]});else try{A[h]=a[u++]}catch(p){A[h]=p}else try{A[h]=l[c++]}catch(p){A[h]=p}if(f.name&&A[f.name]==null){const p=A[h];p instanceof Error?Object.defineProperty(A,f.name,{enumerable:!0,get:()=>{throw vO(`property ${JSON.stringify(f.name)}`,p)}}):A[f.name]=p}});for(let f=0;f{throw vO(`index ${f}`,h)}})}return Object.freeze(A)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new u3e({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:Ge.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new c3e({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=nt(e);let r=this.getError(t.substring(0,10).toLowerCase());return r?new f3e({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 d3e="contracts/5.7.0";var eu=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(c){try{A(r.next(c))}catch(u){o(u)}}function l(c){try{A(r.throw(c))}catch(u){o(u)}}function A(c){c.done?s(c.value):i(c.value).then(a,l)}A((r=r.apply(n,e||[])).next())})};const Wn=new ve(d3e);function ix(n,e){return eu(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&Wn.throwArgumentError("invalid address or ENS name","name",t);try{return Dr(t)}catch{}n||Wn.throwError("a provider or signer is needed to resolve ENS names",ve.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&Wn.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function _y(n,e,t){return eu(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>_y(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield ix(n,e):t.type==="tuple"?yield _y(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>_y(n,r,t.arrayChildren))):Promise.reject(Wn.makeError("invalid value for array",ve.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function C_(n,e,t){return eu(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=wn(t.pop())),Wn.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=qn({override:ix(n.signer,r.from),signer:n.signer.getAddress()}).then(A=>eu(this,void 0,void 0,function*(){return Dr(A.signer)!==A.override&&Wn.throwError("Contract with a Signer cannot override from",ve.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),A.override})):r.from=n.signer.getAddress():r.from&&(r.from=ix(n.provider,r.from));const i=yield qn({args:_y(n.signer||n.provider,t,e.inputs),address:n.resolvedAddress,overrides:qn(r)||{}}),s=n.interface.encodeFunctionData(e,i.args),o={data:s,to:i.address},a=i.overrides;if(a.nonce!=null&&(o.nonce=Ge.from(a.nonce).toNumber()),a.gasLimit!=null&&(o.gasLimit=Ge.from(a.gasLimit)),a.gasPrice!=null&&(o.gasPrice=Ge.from(a.gasPrice)),a.maxFeePerGas!=null&&(o.maxFeePerGas=Ge.from(a.maxFeePerGas)),a.maxPriorityFeePerGas!=null&&(o.maxPriorityFeePerGas=Ge.from(a.maxPriorityFeePerGas)),a.from!=null&&(o.from=a.from),a.type!=null&&(o.type=a.type),a.accessList!=null&&(o.accessList=nu(a.accessList)),o.gasLimit==null&&e.gas!=null){let A=21e3;const c=at(s);for(let u=0;ur[A]!=null);return l.length&&Wn.throwError(`cannot override ${l.map(A=>JSON.stringify(A)).join(",")}`,ve.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function p3e(n,e){return function(...t){return C_(n,e,t)}}function m3e(n,e){const t=n.signer||n.provider;return function(...r){return eu(this,void 0,void 0,function*(){t||Wn.throwError("estimate require a provider or signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield C_(n,e,r);return yield t.estimateGas(i)})}}function g3e(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=ts(s),a=null;try{a=n.interface.parseLog(s)}catch{}return a&&(o.args=a.args,o.decode=(l,A)=>n.interface.decodeEventLog(a.eventFragment,l,A),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 wz(n,e,t){const r=n.signer||n.provider;return function(...i){return eu(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=wn(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 C_(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===ve.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function v3e(n,e){return function(...t){return eu(this,void 0,void 0,function*(){n.signer||Wn.throwError("sending a transaction requires a signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield C_(n,e,t),i=yield n.signer.sendTransaction(r);return g3e(n,i),i})}}function wO(n,e,t){return e.constant?wz(n,e,t):v3e(n,e)}function xz(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 ig{constructor(e,t){Ue(this,"tag",e),Ue(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 y3e extends ig{constructor(){super("error",null)}}class xO extends ig{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&Wn.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super(xz(s),s),Ue(this,"address",e),Ue(this,"interface",t),Ue(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=XLe(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class _O extends ig{constructor(e,t){super("*",{address:e}),Ue(this,"address",e),Ue(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 w3e{constructor(e,t,r){Ue(this,"interface",Ji(new.target,"getInterface")(t)),r==null?(Ue(this,"provider",null),Ue(this,"signer",null)):ug.isSigner(r)?(Ue(this,"provider",r.provider||null),Ue(this,"signer",r)):lg.isProvider(r)?(Ue(this,"provider",r),Ue(this,"signer",null)):Wn.throwArgumentError("invalid signer or provider","signerOrProvider",r),Ue(this,"callStatic",{}),Ue(this,"estimateGas",{}),Ue(this,"functions",{}),Ue(this,"populateTransaction",{}),Ue(this,"filters",{});{const o={};Object.keys(this.interface.events).forEach(a=>{const l=this.interface.events[a];Ue(this.filters,a,(...A)=>({address:this.address,topics:this.interface.encodeFilterTopics(l,A)})),o[l.name]||(o[l.name]=[]),o[l.name].push(a)}),Object.keys(o).forEach(a=>{const l=o[a];l.length===1?Ue(this.filters,a,this.filters[l[0]]):Wn.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Ue(this,"_runningEvents",{}),Ue(this,"_wrappedEmits",{}),e==null&&Wn.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Ue(this,"address",e),this.provider)Ue(this,"resolvedAddress",ix(this.provider,e));else try{Ue(this,"resolvedAddress",Promise.resolve(Dr(e)))}catch{Wn.throwError("provider is required to use ENS name as contract address",ve.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]){Wn.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&&Ue(this,o,wO(this,a,!0)),this.functions[o]==null&&Ue(this.functions,o,wO(this,a,!1)),this.callStatic[o]==null&&Ue(this.callStatic,o,wz(this,a,!0)),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,p3e(this,a)),this.estimateGas[o]==null&&Ue(this.estimateGas,o,m3e(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&&Ue(this,o,this[l])}catch{}this.functions[o]==null&&Ue(this.functions,o,this.functions[l]),this.callStatic[o]==null&&Ue(this.callStatic,o,this.callStatic[l]),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,this.populateTransaction[l]),this.estimateGas[o]==null&&Ue(this.estimateGas,o,this.estimateGas[l])})}static getContractAddress(e){return pN(e)}static getInterface(e){return yO.isInterface(e)?e:new yO(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"&&Wn.throwError("contract not deployed",ve.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||Wn.throwError("sending a transactions require a signer",ve.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=wn(e||{});return["from","to"].forEach(function(r){t[r]!=null&&Wn.throwError("cannot override "+r,ve.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new OS(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&Ue(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return mS.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 y3e);if(e==="event")return this._normalizeRunningEvent(new ig("event",null));if(e==="*")return this._normalizeRunningEvent(new _O(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new xO(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 xO(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new ig(xz(t),t))}return this._normalizeRunningEvent(new _O(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=ts(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||Wn.throwError("events require a provider or a signer with a provider",ve.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=wn(i.filter);return typeof t=="string"&&Et(t,32)?(r!=null&&Wn.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 S_ extends w3e{}const x3e="0x543D43F390b7d681513045e8a85707438c463d80",sx={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"}]},bO={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 _z(n,e){return function(){return n.apply(e,arguments)}}const{toString:_3e}=Object.prototype,{getPrototypeOf:x2}=Object,M_=(n=>e=>{const t=_3e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ma=n=>(n=n.toLowerCase(),e=>M_(e)===n),T_=n=>e=>typeof e===n,{isArray:yd}=Array,sg=T_("undefined");function b3e(n){return n!==null&&!sg(n)&&n.constructor!==null&&!sg(n.constructor)&&Hs(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const bz=Ma("ArrayBuffer");function B3e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&bz(n.buffer),e}const E3e=T_("string"),Hs=T_("function"),Bz=T_("number"),I_=n=>n!==null&&typeof n=="object",C3e=n=>n===!0||n===!1,by=n=>{if(M_(n)!=="object")return!1;const e=x2(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},S3e=Ma("Date"),M3e=Ma("File"),T3e=Ma("Blob"),I3e=Ma("FileList"),R3e=n=>I_(n)&&Hs(n.pipe),F3e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||Hs(n.append)&&((e=M_(n))==="formdata"||e==="object"&&Hs(n.toString)&&n.toString()==="[object FormData]"))},U3e=Ma("URLSearchParams"),L3e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ng(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),yd(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const Cz=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),Sz=n=>!sg(n)&&n!==Cz;function gS(){const{caseless:n}=Sz(this)&&this||{},e={},t=(r,i)=>{const s=n&&Ez(e,i)||i;by(e[s])&&by(r)?e[s]=gS(e[s],r):by(r)?e[s]=gS({},r):yd(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(Ng(e,(i,s)=>{t&&Hs(i)?n[s]=_z(i,t):n[s]=i},{allOwnKeys:r}),n),D3e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),O3e=(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)},N3e=(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&&x2(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},k3e=(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},Q3e=n=>{if(!n)return null;if(yd(n))return n;let e=n.length;if(!Bz(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},H3e=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&x2(Uint8Array)),z3e=(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])}},G3e=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},V3e=Ma("HTMLFormElement"),j3e=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),BO=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),W3e=Ma("RegExp"),Mz=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};Ng(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},K3e=n=>{Mz(n,(e,t)=>{if(Hs(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(Hs(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+"'")})}})},$3e=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return yd(n)?r(n):r(String(n).split(e)),t},Y3e=()=>{},X3e=(n,e)=>(n=+n,Number.isFinite(n)?n:e),IB="abcdefghijklmnopqrstuvwxyz",EO="0123456789",Tz={DIGIT:EO,ALPHA:IB,ALPHA_DIGIT:IB+IB.toUpperCase()+EO},Z3e=(n=16,e=Tz.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function J3e(n){return!!(n&&Hs(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const q3e=n=>{const e=new Array(10),t=(r,i)=>{if(I_(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=yd(r)?[]:{};return Ng(r,(o,a)=>{const l=t(o,i+1);!sg(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},ePe=Ma("AsyncFunction"),tPe=n=>n&&(I_(n)||Hs(n))&&Hs(n.then)&&Hs(n.catch),Ie={isArray:yd,isArrayBuffer:bz,isBuffer:b3e,isFormData:F3e,isArrayBufferView:B3e,isString:E3e,isNumber:Bz,isBoolean:C3e,isObject:I_,isPlainObject:by,isUndefined:sg,isDate:S3e,isFile:M3e,isBlob:T3e,isRegExp:W3e,isFunction:Hs,isStream:R3e,isURLSearchParams:U3e,isTypedArray:H3e,isFileList:I3e,forEach:Ng,merge:gS,extend:P3e,trim:L3e,stripBOM:D3e,inherits:O3e,toFlatObject:N3e,kindOf:M_,kindOfTest:Ma,endsWith:k3e,toArray:Q3e,forEachEntry:z3e,matchAll:G3e,isHTMLForm:V3e,hasOwnProperty:BO,hasOwnProp:BO,reduceDescriptors:Mz,freezeMethods:K3e,toObjectSet:$3e,toCamelCase:j3e,noop:Y3e,toFiniteNumber:X3e,findKey:Ez,global:Cz,isContextDefined:Sz,ALPHABET:Tz,generateString:Z3e,isSpecCompliantForm:J3e,toJSONObject:q3e,isAsyncFn:ePe,isThenable:tPe};function Nt(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)}Ie.inherits(Nt,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:Ie.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Iz=Nt.prototype,Rz={};["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=>{Rz[n]={value:n}});Object.defineProperties(Nt,Rz);Object.defineProperty(Iz,"isAxiosError",{value:!0});Nt.from=(n,e,t,r,i,s)=>{const o=Object.create(Iz);return Ie.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),Nt.call(o,n.message,e,t,r,i),o.cause=n,o.name=n.name,s&&Object.assign(o,s),o};const nPe=null;function vS(n){return Ie.isPlainObject(n)||Ie.isArray(n)}function Fz(n){return Ie.endsWith(n,"[]")?n.slice(0,-2):n}function CO(n,e,t){return n?n.concat(e).map(function(i,s){return i=Fz(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function rPe(n){return Ie.isArray(n)&&!n.some(vS)}const iPe=Ie.toFlatObject(Ie,{},null,function(e){return/^is[A-Z]/.test(e)});function R_(n,e,t){if(!Ie.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Ie.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,g){return!Ie.isUndefined(g[d])});const r=t.metaTokens,i=t.visitor||c,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Ie.isSpecCompliantForm(e);if(!Ie.isFunction(i))throw new TypeError("visitor must be a function");function A(p){if(p===null)return"";if(Ie.isDate(p))return p.toISOString();if(!l&&Ie.isBlob(p))throw new Nt("Blob is not supported. Use a Buffer instead.");return Ie.isArrayBuffer(p)||Ie.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function c(p,d,g){let m=p;if(p&&!g&&typeof p=="object"){if(Ie.endsWith(d,"{}"))d=r?d:d.slice(0,-2),p=JSON.stringify(p);else if(Ie.isArray(p)&&rPe(p)||(Ie.isFileList(p)||Ie.endsWith(d,"[]"))&&(m=Ie.toArray(p)))return d=Fz(d),m.forEach(function(w,x){!(Ie.isUndefined(w)||w===null)&&e.append(o===!0?CO([d],x,s):o===null?d:d+"[]",A(w))}),!1}return vS(p)?!0:(e.append(CO(g,d,s),A(p)),!1)}const u=[],f=Object.assign(iPe,{defaultVisitor:c,convertValue:A,isVisitable:vS});function h(p,d){if(!Ie.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+d.join("."));u.push(p),Ie.forEach(p,function(m,y){(!(Ie.isUndefined(m)||m===null)&&i.call(e,m,Ie.isString(y)?y.trim():y,d,f))===!0&&h(m,d?d.concat(y):[y])}),u.pop()}}if(!Ie.isObject(n))throw new TypeError("data must be an object");return h(n),e}function SO(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function _2(n,e){this._pairs=[],n&&R_(n,this,e)}const Uz=_2.prototype;Uz.append=function(e,t){this._pairs.push([e,t])};Uz.toString=function(e){const t=e?function(r){return e.call(this,r,SO)}:SO;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function sPe(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Lz(n,e,t){if(!e)return n;const r=t&&t.encode||sPe,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Ie.isURLSearchParams(e)?e.toString():new _2(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class oPe{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){Ie.forEach(this.handlers,function(r){r!==null&&e(r)})}}const MO=oPe,Pz={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},aPe=typeof URLSearchParams<"u"?URLSearchParams:_2,lPe=typeof FormData<"u"?FormData:null,APe=typeof Blob<"u"?Blob:null,cPe={isBrowser:!0,classes:{URLSearchParams:aPe,FormData:lPe,Blob:APe},protocols:["http","https","file","blob","url","data"]},Dz=typeof window<"u"&&typeof document<"u",uPe=(n=>Dz&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),fPe=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),hPe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Dz,hasStandardBrowserEnv:uPe,hasStandardBrowserWebWorkerEnv:fPe},Symbol.toStringTag,{value:"Module"})),ia={...hPe,...cPe};function dPe(n,e){return R_(n,new ia.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return ia.isNode&&Ie.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function pPe(n){return Ie.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function mPe(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Ie.isArray(i)?i.length:o,l?(Ie.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Ie.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Ie.isArray(i[o])&&(i[o]=mPe(i[o])),!a)}if(Ie.isFormData(n)&&Ie.isFunction(n.entries)){const t={};return Ie.forEachEntry(n,(r,i)=>{e(pPe(r),i,t,0)}),t}return null}function gPe(n,e,t){if(Ie.isString(n))try{return(e||JSON.parse)(n),Ie.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const b2={transitional:Pz,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Ie.isObject(e);if(s&&Ie.isHTMLForm(e)&&(e=new FormData(e)),Ie.isFormData(e))return i?JSON.stringify(Oz(e)):e;if(Ie.isArrayBuffer(e)||Ie.isBuffer(e)||Ie.isStream(e)||Ie.isFile(e)||Ie.isBlob(e))return e;if(Ie.isArrayBufferView(e))return e.buffer;if(Ie.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 dPe(e,this.formSerializer).toString();if((a=Ie.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return R_(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),gPe(e)):e}],transformResponse:[function(e){const t=this.transitional||b2.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(e&&Ie.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"?Nt.from(a,Nt.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:ia.classes.FormData,Blob:ia.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Ie.forEach(["delete","get","head","post","put","patch"],n=>{b2.headers[n]={}});const B2=b2,vPe=Ie.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"]),yPe=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]&&vPe[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},TO=Symbol("internals");function dp(n){return n&&String(n).trim().toLowerCase()}function By(n){return n===!1||n==null?n:Ie.isArray(n)?n.map(By):String(n)}function wPe(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 xPe=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function RB(n,e,t,r,i){if(Ie.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Ie.isString(e)){if(Ie.isString(r))return e.indexOf(r)!==-1;if(Ie.isRegExp(r))return r.test(e)}}function _Pe(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function bPe(n,e){const t=Ie.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 F_{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,A){const c=dp(l);if(!c)throw new Error("header name must be a non-empty string");const u=Ie.findKey(i,c);(!u||i[u]===void 0||A===!0||A===void 0&&i[u]!==!1)&&(i[u||l]=By(a))}const o=(a,l)=>Ie.forEach(a,(A,c)=>s(A,c,l));return Ie.isPlainObject(e)||e instanceof this.constructor?o(e,t):Ie.isString(e)&&(e=e.trim())&&!xPe(e)?o(yPe(e),t):e!=null&&s(t,e,r),this}get(e,t){if(e=dp(e),e){const r=Ie.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return wPe(i);if(Ie.isFunction(t))return t.call(this,i,r);if(Ie.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=dp(e),e){const r=Ie.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||RB(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=dp(o),o){const a=Ie.findKey(r,o);a&&(!t||RB(r,r[a],a,t))&&(delete r[a],i=!0)}}return Ie.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||RB(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Ie.forEach(this,(i,s)=>{const o=Ie.findKey(r,s);if(o){t[o]=By(i),delete t[s];return}const a=e?_Pe(s):String(s).trim();a!==s&&delete t[s],t[a]=By(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Ie.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Ie.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[TO]=this[TO]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=dp(o);r[a]||(bPe(i,o),r[a]=!0)}return Ie.isArray(e)?e.forEach(s):s(e),this}}F_.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Ie.reduceDescriptors(F_.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Ie.freezeMethods(F_);const hl=F_;function FB(n,e){const t=this||B2,r=e||t,i=hl.from(r.headers);let s=r.data;return Ie.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function Nz(n){return!!(n&&n.__CANCEL__)}function kg(n,e,t){Nt.call(this,n??"canceled",Nt.ERR_CANCELED,e,t),this.name="CanceledError"}Ie.inherits(kg,Nt,{__CANCEL__:!0});function BPe(n,e,t){const r=t.config.validateStatus;!t.status||!r||r(t.status)?n(t):e(new Nt("Request failed with status code "+t.status,[Nt.ERR_BAD_REQUEST,Nt.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}const EPe=ia.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Ie.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Ie.isString(r)&&o.push("path="+r),Ie.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 CPe(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function SPe(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function kz(n,e){return n&&!CPe(e)?SPe(n,e):e}const MPe=ia.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(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=Ie.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function TPe(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function IPe(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 A=Date.now(),c=r[s];o||(o=A),t[i]=l,r[i]=A;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),A-o{const s=i.loaded,o=i.lengthComputable?i.total:void 0,a=s-t,l=r(a),A=s<=o;t=s;const c={loaded:s,total:o,progress:o?s/o:void 0,bytes:a,rate:l||void 0,estimated:l&&o&&A?(o-s)/l:void 0,event:i};c[e?"download":"upload"]=!0,n(c)}}const RPe=typeof XMLHttpRequest<"u",FPe=RPe&&function(n){return new Promise(function(t,r){let i=n.data;const s=hl.from(n.headers).normalize();let{responseType:o,withXSRFToken:a}=n,l;function A(){n.cancelToken&&n.cancelToken.unsubscribe(l),n.signal&&n.signal.removeEventListener("abort",l)}let c;if(Ie.isFormData(i)){if(ia.hasStandardBrowserEnv||ia.hasStandardBrowserWebWorkerEnv)s.setContentType(!1);else if((c=s.getContentType())!==!1){const[d,...g]=c?c.split(";").map(m=>m.trim()).filter(Boolean):[];s.setContentType([d||"multipart/form-data",...g].join("; "))}}let u=new XMLHttpRequest;if(n.auth){const d=n.auth.username||"",g=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";s.set("Authorization","Basic "+btoa(d+":"+g))}const f=kz(n.baseURL,n.url);u.open(n.method.toUpperCase(),Lz(f,n.params,n.paramsSerializer),!0),u.timeout=n.timeout;function h(){if(!u)return;const d=hl.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders()),m={data:!o||o==="text"||o==="json"?u.responseText:u.response,status:u.status,statusText:u.statusText,headers:d,config:n,request:u};BPe(function(w){t(w),A()},function(w){r(w),A()},m),u=null}if("onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){!u||u.readyState!==4||u.status===0&&!(u.responseURL&&u.responseURL.indexOf("file:")===0)||setTimeout(h)},u.onabort=function(){u&&(r(new Nt("Request aborted",Nt.ECONNABORTED,n,u)),u=null)},u.onerror=function(){r(new Nt("Network Error",Nt.ERR_NETWORK,n,u)),u=null},u.ontimeout=function(){let g=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const m=n.transitional||Pz;n.timeoutErrorMessage&&(g=n.timeoutErrorMessage),r(new Nt(g,m.clarifyTimeoutError?Nt.ETIMEDOUT:Nt.ECONNABORTED,n,u)),u=null},ia.hasStandardBrowserEnv&&(a&&Ie.isFunction(a)&&(a=a(n)),a||a!==!1&&MPe(f))){const d=n.xsrfHeaderName&&n.xsrfCookieName&&EPe.read(n.xsrfCookieName);d&&s.set(n.xsrfHeaderName,d)}i===void 0&&s.setContentType(null),"setRequestHeader"in u&&Ie.forEach(s.toJSON(),function(g,m){u.setRequestHeader(m,g)}),Ie.isUndefined(n.withCredentials)||(u.withCredentials=!!n.withCredentials),o&&o!=="json"&&(u.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&u.addEventListener("progress",IO(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",IO(n.onUploadProgress)),(n.cancelToken||n.signal)&&(l=d=>{u&&(r(!d||d.type?new kg(null,n,u):d),u.abort(),u=null)},n.cancelToken&&n.cancelToken.subscribe(l),n.signal&&(n.signal.aborted?l():n.signal.addEventListener("abort",l)));const p=TPe(f);if(p&&ia.protocols.indexOf(p)===-1){r(new Nt("Unsupported protocol "+p+":",Nt.ERR_BAD_REQUEST,n));return}u.send(i||null)})},yS={http:nPe,xhr:FPe};Ie.forEach(yS,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const RO=n=>`- ${n}`,UPe=n=>Ie.isFunction(n)||n===null||n===!1,Qz={getAdapter:n=>{n=Ie.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(RO).join(` -`):" "+RO(s[0]):"as no adapter specified";throw new Nt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:yS};function UB(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Ng(null,n)}function FO(n){return UB(n),n.headers=fl.from(n.headers),n.data=FB.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Qz.getAdapter(n.adapter||B2.adapter)(n).then(function(r){return UB(n),r.data=FB.call(n,n.transformResponse,r),r.headers=fl.from(r.headers),r},function(r){return Nz(r)||(UB(n),r&&r.response&&(r.response.data=FB.call(n,n.transformResponse,r.response),r.response.headers=fl.from(r.response.headers))),Promise.reject(r)})}const UO=n=>n instanceof fl?{...n}:n;function Gh(n,e){e=e||{};const t={};function r(A,c,u){return Ie.isPlainObject(A)&&Ie.isPlainObject(c)?Ie.merge.call({caseless:u},A,c):Ie.isPlainObject(c)?Ie.merge({},c):Ie.isArray(c)?c.slice():c}function i(A,c,u){if(Ie.isUndefined(c)){if(!Ie.isUndefined(A))return r(void 0,A,u)}else return r(A,c,u)}function s(A,c){if(!Ie.isUndefined(c))return r(void 0,c)}function o(A,c){if(Ie.isUndefined(c)){if(!Ie.isUndefined(A))return r(void 0,A)}else return r(void 0,c)}function a(A,c,u){if(u in e)return r(A,c);if(u in n)return r(void 0,A)}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:(A,c)=>i(UO(A),UO(c),!0)};return Ie.forEach(Object.keys(Object.assign({},n,e)),function(c){const u=l[c]||i,f=u(n[c],e[c],c);Ie.isUndefined(f)&&u!==a||(t[c]=f)}),t}const Hz="1.6.8",E2={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{E2[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const LO={};E2.transitional=function(e,t,r){function i(s,o){return"[Axios v"+Hz+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new Nt(i(o," has been removed"+(t?" in "+t:"")),Nt.ERR_DEPRECATED);return t&&!LO[o]&&(LO[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 UPe(n,e,t){if(typeof n!="object")throw new Nt("options must be an object",Nt.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 Nt("option "+s+" must be "+l,Nt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Nt("Unknown option "+s,Nt.ERR_BAD_OPTION)}}const wS={assertOptions:UPe,validators:E2},jl=wS.validators;class sx{constructor(e){this.defaults=e,this.interceptors={request:new MO,response:new MO}}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/,""):"";r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+s):r.stack=s}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Gh(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&wS.assertOptions(r,{silentJSONParsing:jl.transitional(jl.boolean),forcedJSONParsing:jl.transitional(jl.boolean),clarifyTimeoutError:jl.transitional(jl.boolean)},!1),i!=null&&(Ie.isFunction(i)?t.paramsSerializer={serialize:i}:wS.assertOptions(i,{encode:jl.function,serialize:jl.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Ie.merge(s.common,s[t.method]);s&&Ie.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),t.headers=fl.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(t)===!1||(l=l&&d.synchronous,a.unshift(d.fulfilled,d.rejected))});const A=[];this.interceptors.response.forEach(function(d){A.push(d.fulfilled,d.rejected)});let c,u=0,f;if(!l){const p=[FO.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,A),f=p.length,c=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 Ng(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)}static source(){let e;return{token:new C2(function(i){e=i}),cancel:e}}}const LPe=C2;function PPe(n){return function(t){return n.apply(null,t)}}function DPe(n){return Ie.isObject(n)&&n.isAxiosError===!0}const xS={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(xS).forEach(([n,e])=>{xS[e]=n});const OPe=xS;function zz(n){const e=new By(n),t=_z(By.prototype.request,e);return Ie.extend(t,By.prototype,e,{allOwnKeys:!0}),Ie.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return zz(Gh(n,i))},t}const sr=zz(B2);sr.Axios=By;sr.CanceledError=Ng;sr.CancelToken=LPe;sr.isCancel=Nz;sr.VERSION=Hz;sr.toFormData=I_;sr.AxiosError=Nt;sr.Cancel=sr.CanceledError;sr.all=function(e){return Promise.all(e)};sr.spread=PPe;sr.isAxiosError=DPe;sr.mergeConfig=Gh;sr.AxiosHeaders=fl;sr.formToJSON=n=>Oz(Ie.isHTMLForm(n)?new FormData(n):n);sr.getAdapter=Qz.getAdapter;sr.HttpStatusCode=OPe;sr.default=sr;const NPe=sr,kPe={}.VITE_OPENSEA_KEY,QPe={}.VITE_PINATA_API_KEY,HPe={}.VITE_PINATA_API_SECRET,LB="0x89";let Lv;async function zPe(){if(Lv!=null)return Lv;const n=new ZN("https://polygon-rpc.com/"),t=await new C_(ix.address,ix.abi,n).tokenPrice();return Lv=Ge.from(t).mul(1),Lv}function GPe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":kPe}};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 S2(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(LB,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:LB}]});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:LB}]});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 PB(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 NPe.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:QPe,pinata_secret_api_key:HPe}})).data}const VPe=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 jPe(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 S2();if(s=="")return"Please Connect Wallet";if(!i||await WPe(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let y=0;y<10;y++)try{return await PB(e,a).catch(x=>{console.error(y,"---",x)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const A=await Hfe(t,n,4096);let c;if(A){let y="AvatarGlb_"+Date.now()+".glb";c=await(async()=>{for(let w=0;w<10;w++)try{return await PB(A,y).catch(_=>(console.error(w,"---",_),"Couldn't save glb to pinata"))}catch(x){return console.warn(x),"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://${c.IpfsHash}`,attributes:VPe(n)},f=JSON.stringify(u),p=`ipfs://${(await PB(new Blob([f]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let d=await zPe();const g=new kS(window.ethereum).getSigner(),m=new C_(ix.address,ix.abi,g);try{const y={value:d,from:s};if((await(await m.mintToken(1,p,y)).wait()).transactionHash)return console.log("Mint success!"),"Mint success!"}catch{return"Public Mint failed."}}}const WPe=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=U9("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new C_(bO.address,bO.abi,t).beneficiaryBalanceOf(e,w3e,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 KPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=Y.useContext(or),[c,u]=ye.useState(null),[f,h]=ye.useState(""),{playSound:p}=Y.useContext(Ys),{isMute:d}=Y.useContext($s);Y.useState(null);const[g,m]=Y.useState(null),[y,w]=Y.useState(""),x=()=>{!d&&p("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(dt.LANDING)},_=()=>{const v=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:v===0||v==2,exportMtoonAtlas:v===1||v==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=v=>{const E=g[v].manifestName;(async()=>{(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview)&&i.savePortraitScreenshot(E,512,1024,1.5,-.1),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await i.downloadVRM(E,_());const z=new ad,K=A.parent;K.remove(A);const O=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(O===!0){const W=r.loras.map(async ee=>a.createLoraData(ee,z));await Promise.all(W)}const B=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(B===!0){const W=r.sprites.map(async ee=>l.createSpriteAtlas(ee,z));await Promise.all(W)}(O===!0||B===!0)&&z.saveZip(g[v].manifestName),K.add(A),v{v==0?(console.log(r.loras[0]),C(v)):(await i.setManifest(g[v]),t(!0),i.loadInitialTraits().then(async()=>{await(U=>new Promise(P=>setTimeout(P,U)))(1),C(v)}))},b=()=>{t(!0),S(0)},{t:M}=ye.useContext(To),D=async v=>{if(i.getCurrentCharacterModel()){const U=ul(v.name),P=URL.createObjectURL(v);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.")},$=async v=>{const E=URL.createObjectURL(v);await i.loadOptimizerCharacter(E),URL.revokeObjectURL(E);const U=ul(v.name);h(U),u(i.getCurrentCharacterModel())},H=v=>{const E=Array.from(v),U=[],P=L=>new Promise((z,K)=>{if(L&&L.name.toLowerCase().endsWith(".json")){const O=new FileReader,B=L.name.replace(/\.[^/.]+$/,"");O.onload=function(W){try{const ee=JSON.parse(W.target.result),F=ee.thumbnail;ee.manifestName=B,U.push(ee),z()}catch(ee){console.error("Error parsing the JSON file:",ee),K(ee)}},O.readAsText(L)}});Promise.all(E.map(P)).then(()=>{U.length>0&&(m(U),i.setManifest(U[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(L=>{console.error("Error processing files:",L)})},I=async v=>{const E=v[0];E&&E.name.toLowerCase().endsWith(".fbx")&&D(E),E&&E.name.toLowerCase().endsWith(".vrm")&&$(E),E&&E.name.toLowerCase().endsWith(".json")&&H(v)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),k.jsx(Cg,{onFilesDrop:I}),k.jsx(B_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(y2,{model:c}),k.jsx(ST,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&k.jsx(a_,{loadedAnimationName:y}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:M("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(g==null?void 0:g.length)==1&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:b}),(g==null?void 0:g.length)>1&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:b})]})]})}const $Pe="_classdisabled_hpzv8_1",YPe="_container_hpzv8_6",XPe="_classContainer_hpzv8_14",ZPe="_icon_hpzv8_39",JPe="_name_hpzv8_70",qPe="_description_hpzv8_79",eDe="_classFrame_hpzv8_84",tDe="_frameContainer_hpzv8_104",nDe="_frame_hpzv8_104",rDe="_image_hpzv8_114",iDe="_lockedContainer_hpzv8_120",sDe="_locked_hpzv8_120",oDe="_buttonContainer_hpzv8_134",aDe="_buttonLeft_hpzv8_143",lDe="_buttonRight_hpzv8_147",ADe="_buttonCenter_hpzv8_151",cDe="_topLine_hpzv8_165",uDe="_bottomLine_hpzv8_191",ot={classdisabled:$Pe,container:YPe,classContainer:XPe,class:"_class_hpzv8_1",icon:ZPe,name:JPe,description:qPe,classFrame:eDe,frameContainer:tDe,frame:nDe,image:rDe,lockedContainer:iDe,locked:sDe,buttonContainer:oDe,buttonLeft:aDe,buttonRight:lDe,buttonCenter:ADe,topLine:cDe,bottomLine:uDe};function fDe(){const{t:n}=ye.useContext(To),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Ys),{isMute:s}=Y.useContext($s),{manifest:o,characterManager:a}=Y.useContext(or),[l,A]=ye.useState([]);ye.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const p=o.characters.map(d=>({name:d.name,image:d.portrait,description:d.description,manifest:d.manifest,icon:d.icon,format:d.format,disabled:!1}));A(p)}},[o]);const c=()=>{e(dt.LANDING),!s&&i("backNextButton")},u=async p=>{t(!0),a.loadManifest(o.characters[p].manifest).then(()=>{e(dt.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{e(dt.BATCHMANIFEST)},h=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsxs("div",{className:ot.classContainer,children:[l.map((p,d)=>k.jsxs("div",{className:p.disabled?ot.classdisabled:ot.class,onClick:p.disabled?null:()=>u(d),onMouseOver:p.disabled?null:()=>h(),children:[k.jsxs("div",{className:ot.classFrame,style:{backgroundImage:`url(${p.image})`},children:[k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})}),k.jsx("div",{className:ot.lockedContainer,children:p.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ot.locked})})]}),k.jsx("div",{className:ot.name,children:p.name}),k.jsx("div",{className:ot.description,children:p.description})]},d)),k.jsxs("div",{className:ot.class,onClick:()=>f(),onMouseOver:()=>h(),children:[k.jsx("div",{className:ot.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})})}),k.jsx("div",{className:ot.name,children:"Manifest"}),k.jsx("div",{className:ot.description,children:"Load by manifest"})]},"manifest-load")]}),k.jsx("div",{className:ot.bottomLine}),k.jsx("div",{className:ot.buttonContainer,children:k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}function hDe(){const{t:n}=ye.useContext(To),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Ys),{isMute:s}=Y.useContext($s),{manifest:o,characterManager:a}=Y.useContext(or),[l,A]=ye.useState([]);ye.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const h=o.characters.map(p=>({name:p.name,image:p.portrait,description:p.description,manifest:p.manifest,icon:p.icon,format:p.format,disabled:!1}));A(h)}},[o]);const c=()=>{e(dt.LANDING),!s&&i("backNextButton")},u=async h=>{t(!0),a.loadManifest(o.characters[h].manifest).then(()=>{e(dt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsx("div",{className:ot.classContainer,children:l.map((h,p)=>k.jsxs("div",{className:h.disabled?ot.classdisabled:ot.class,onClick:h.disabled?null:()=>u(p),onMouseOver:h.disabled?null:()=>f(),children:[k.jsxs("div",{className:ot.classFrame,style:{backgroundImage:`url(${h.image})`},children:[k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})}),k.jsx("div",{className:ot.lockedContainer,children:h.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ot.locked})})]}),k.jsx("div",{className:ot.name,children:h.name}),k.jsx("div",{className:ot.description,children:h.description})]},p))}),k.jsx("div",{className:ot.bottomLine}),k.jsx("div",{className:ot.buttonContainer,children:k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}const dDe="_buttonContainer_1ueuk_1",pDe="_button_1ueuk_1",qu={buttonContainer:dDe,button:pDe},PO={}.VITE_OPENSEA_KEY;function mDe(){const{setViewMode:n}=Y.useContext(Ui),{playSound:e}=Y.useContext(Ys),{isMute:t}=Y.useContext($s),{characterManager:r}=Y.useContext(or),i=()=>{n(dt.CREATE),!t&&e("backNextButton")},s=()=>{n(dt.CLAIM),!t&&e("backNextButton")},o=()=>{n(dt.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await S2()!=""&&n(dt.WALLET),!t&&e("backNextButton")};return k.jsx("div",{className:qu.container,children:k.jsxs("div",{className:qu.buttonContainer,children:[k.jsx("button",{className:qu.button,onClick:i,children:k.jsx("img",{src:"./assets/media/btn_create_character.png"})}),k.jsx("button",{className:qu.button,onClick:s,children:k.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),k.jsx("button",{className:qu.button,onClick:o,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),PO&&PO!=""&&k.jsx("button",{className:qu.button,onClick:a,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const uc={};var M2={exports:{}},ph=typeof Reflect=="object"?Reflect:null,DO=ph&&typeof ph.apply=="function"?ph.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},Ey;ph&&typeof ph.ownKeys=="function"?Ey=ph.ownKeys:Object.getOwnPropertySymbols?Ey=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Ey=function(e){return Object.getOwnPropertyNames(e)};function gDe(n){console&&console.warn&&console.warn(n)}var Gz=Number.isNaN||function(e){return e!==e};function en(){en.init.call(this)}M2.exports=en;M2.exports.once=xDe;en.EventEmitter=en;en.prototype._events=void 0;en.prototype._eventsCount=0;en.prototype._maxListeners=void 0;var OO=10;function F_(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(en,"defaultMaxListeners",{enumerable:!0,get:function(){return OO},set:function(n){if(typeof n!="number"||n<0||Gz(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");OO=n}});en.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};en.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Gz(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 Vz(n){return n._maxListeners===void 0?en.defaultMaxListeners:n._maxListeners}en.prototype.getMaxListeners=function(){return Vz(this)};en.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")DO(l,this,t);else for(var A=l.length,c=Yz(l,A),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,gDe(a)}return n}en.prototype.addListener=function(e,t){return jz(this,e,t,!1)};en.prototype.on=en.prototype.addListener;en.prototype.prependListener=function(e,t){return jz(this,e,t,!0)};function vDe(){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 Wz(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=vDe.bind(r);return i.listener=t,r.wrapFn=i,i}en.prototype.once=function(e,t){return F_(t),this.on(e,Wz(this,e,t)),this};en.prototype.prependOnceListener=function(e,t){return F_(t),this.prependListener(e,Wz(this,e,t)),this};en.prototype.removeListener=function(e,t){var r,i,s,o,a;if(F_(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():yDe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};en.prototype.off=en.prototype.removeListener;en.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 Kz(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?wDe(i):Yz(i,i.length)}en.prototype.listeners=function(e){return Kz(this,e,!0)};en.prototype.rawListeners=function(e){return Kz(this,e,!1)};en.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):$z.call(n,e)};en.prototype.listenerCount=$z;function $z(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}en.prototype.eventNames=function(){return this._eventsCount>0?Ey(this._events):[]};function Yz(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 Cy(n,e,t){return CDe()?Cy=Reflect.construct:Cy=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&ox(A,o.prototype),A},Cy.apply(null,arguments)}function SDe(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function ax(n){var e=typeof Map=="function"?new Map:void 0;return ax=function(r){if(r===null||!SDe(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 Cy(r,arguments,bS(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ox(i,r)},ax(n)}function Pv(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 ef(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function ko(n){return n.hasOwnProperty("result")?n.result:n}var DB=function(n){T2(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}(ax(Error)),MDe=function(n){T2(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}(ax(Error)),TDe=function(n){T2(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind(Pv(i)),i.handleChainChanged=i.handleChainChanged.bind(Pv(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind(Pv(i)),i.handleClose=i.handleClose.bind(Pv(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(c){if(s)return c;function u(){return _S({provider:window.ethereum},a?{account:a}:{})}var f=function(){if(!a)return Promise.resolve(window.ethereum.enable().then(function(h){return h&&ko(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 DB;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=ef(function(){return Promise.resolve(window.ethereum.send("eth_requestAccounts").then(function(A){return ko(A)[0]})).then(function(A){a=A})},function(A){if(A.code===4001)throw new MDe});return Promise.resolve(l&&l.then?l.then(i):i(l))}catch(A){return Promise.reject(A)}},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=ko(window.ethereum.send({method:"net_version"}))}catch{}return s||(window.ethereum.isDapper?s=ko(window.ethereum.cachedResults.net_version):s=window.ethereum.chainId||window.ethereum.netVersion||window.ethereum.networkVersion||window.ethereum._chainId),s}var A=function(){if(!s){var c=ef(function(){return Promise.resolve(window.ethereum.send("net_version").then(ko)).then(function(u){s=u})},function(){});if(c&&c.then)return c.then(function(){})}}();return A&&A.then?A.then(l):l(A)};if(!window.ethereum)throw new DB;var s,o=ef(function(){return Promise.resolve(window.ethereum.send("eth_chainId").then(ko)).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=ko(window.ethereum.send({method:"eth_accounts"}))[0]),s}var A=function(){if(!s){var c=ef(function(){return Promise.resolve(window.ethereum.enable().then(function(u){return ko(u)[0]})).then(function(u){s=u})},function(){});if(c&&c.then)return c.then(function(){})}}();return A&&A.then?A.then(l):l(A)};if(!window.ethereum)throw new DB;var s,o=ef(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(a){return ko(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(ef(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(i){return ko(i).length>0}))},function(){return!1})):Promise.resolve(!1)}catch(i){return Promise.reject(i)}},e}(EDe);function IDe(){const{account:n,library:e,activate:t}=z9(),[r,i]=ye.useState([]),{setViewMode:s}=Y.useContext(Ui),{playSound:o}=Y.useContext(Ys),{isMute:a}=Y.useContext($s),l=new TDe({supportedChainIds:[137,1,3,4,5,42,97]});ye.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)"],p=new C_(f,h,e);p.balanceOf(n).then(d=>{const g=[];for(let m=0;m{const y=m.map(w=>p.tokenURI(w));Promise.all(y).then(w=>{i(w)})})})}},[n,e]);const A=()=>{t(l)},c=f=>{!a&&o("backNextButton"),s(dt.APPEARANCE)},u=()=>{s(dt.LANDING),!a&&o("backNextButton")};return k.jsxs("div",{className:uc.container,children:[!n&&k.jsxs("div",{className:uc.message,children:["Please connect your wallet to load your characters",k.jsx("button",{className:uc.button,onClick:()=>A(),children:"Connect"})]}),k.jsxs("div",{className:uc.characterContainer,children:[k.jsx("div",{className:uc.title,children:"Load Character"}),r.map((f,h)=>k.jsx("div",{className:uc.character,onClick:()=>{c()},children:JSON.stringify(f)},h))]}),k.jsx("button",{className:uc.button,onClick:()=>u(),children:"Back"})]})}const RDe="_container_q73cc_1",FDe="_mintContainer_q73cc_6",UDe="_mainTitleWrap_q73cc_33",LDe="_mainTitle_q73cc_33",PDe="_mintButtonContainer_q73cc_49",DDe="_mintButton_q73cc_49",ODe="_genesisText_q73cc_60",NDe="_required_q73cc_64",kDe="_divider_q73cc_68",QDe="_bottomContainer_q73cc_75",HDe="_mintInfo_q73cc_85",zDe="_topLine_q73cc_91",GDe="_bottomLine_q73cc_104",gi={container:RDe,mintContainer:FDe,mainTitleWrap:UDe,mainTitle:LDe,mintButtonContainer:PDe,mintButton:DDe,genesisText:ODe,required:NDe,divider:kDe,bottomContainer:QDe,mintInfo:HDe,topLine:zDe,bottomLine:GDe};function VDe(){const{model:n,avatar:e}=Y.useContext(or),{setViewMode:t}=Y.useContext(Ui),{playSound:r}=Y.useContext(Ys),{isMute:i}=Y.useContext($s),[s,o]=Y.useState(""),[a,l]=Y.useState(!1),A=()=>{t(dt.SAVE),!i&&r("backNextButton")};function c(){return k.jsxs("div",{className:gi.mainTitleWrap,children:[k.jsx("div",{className:gi.topLine}),k.jsx("div",{className:gi.mainTitle,children:"Mint"})]})}async function u(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const p=await jPe(e,null,n,{name:"XXXRestore"}.name);o(p),l(!1),console.log(p)}return k.jsxs("div",{className:gi.container,children:[k.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),k.jsxs("div",{className:gi.mintContainer,children:[k.jsx(c,{}),k.jsxs("div",{className:gi.mintButtonContainer,children:[k.jsx(_n,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:gi.mintButton,disabled:a,onClick:u,minWidth:220}),k.jsx("div",{className:gi.divider}),k.jsx(_n,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:gi.mintButton,disabled:!0,minWidth:220}),k.jsxs("span",{className:gi.genesisText,children:["(",k.jsx("span",{className:gi.required,children:"Coming Soon!"}),")"]})]}),k.jsxs("span",{className:gi.mintInfo,children:[s," "]})]}),k.jsx("div",{className:gi.bottomContainer,children:k.jsx(_n,{theme:"light",text:"Back",size:14,className:gi.buttonLeft,onClick:A})})]})}function jDe(){const{isLoading:n,setViewMode:e}=Y.useContext(Ui),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=Y.useContext(or),{playSound:l}=Y.useContext(Ys),{isMute:A}=Y.useContext($s),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=ye.useState([]),[g,m]=ye.useState(0),[y,w]=Y.useState("T-Pose"),x=()=>{!A&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(dt.LANDING)},_=()=>{const E=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:E===0||E==2,exportMtoonAtlas:E===1||E==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=async()=>{for(let E=0;E{typeof E!="string"&&(E=f),await(async()=>{var W;(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview)&&r.savePortraitScreenshot(E+"_portrait",512,1024,1.5,-.1),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await r.downloadVRM(E+"_merged",_());const z=new ad,K=s.parent;K.remove(s),(W=r.getCurrentOptimizerCharacterModel().data)==null||W.isVRM0;const O=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(O===!0){const ee=t.loras.map(async F=>o.createLoraData(F,z));await Promise.all(ee)}const B=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(B===!0){const ee=t.sprites.map(async F=>a.createSpriteAtlas(F,z));await Promise.all(ee)}(O===!0||B===!0)&&z.saveZip(E),K.add(s)})()},{t:b}=ye.useContext(To),M=async E=>{if(r.getCurrentOptimizerCharacterModel()){const P=ul(E.name),L=URL.createObjectURL(E);await i.loadAnimation(L,!1,0,!0,"",P),w(i.getCurrentAnimationName()),URL.revokeObjectURL(L)}else console.warn("Please load a vrm model to test animations.")},D=()=>{if(g===0)H(p[p.length-1]),m(p.length-1);else{const E=g-1;H(p[E]),m(E)}},$=()=>{if(g>=p.length-1)H(p[0]),m(0);else{const E=g+1;H(p[E]),m(E)}},H=async E=>{const U=URL.createObjectURL(E);await r.loadOptimizerCharacter(U),URL.revokeObjectURL(U);const P=ul(E.name);h(P),u({...r.getCurrentCharacterModel()})},I=async E=>{H(E[0]);const U=[];for(let P=0;P{const U=E[0];U&&U.name.toLowerCase().endsWith(".fbx")&&M(U),U&&U.name.toLowerCase().endsWith(".vrm")&&I(E)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),k.jsx(Cg,{onFilesDrop:v}),k.jsx(B_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),k.jsx(y2,{model:c,name:f,files:p,index:g,nextVrm:$,previousVrm:D}),k.jsx(a_,{loadedAnimationName:y}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:b("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(p==null?void 0:p.length)>1!=""&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:C}),c!=""&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:S})]})]})}const WDe="_buttonContainer_1fd4o_1",KDe="_buttonLeft_1fd4o_10",$De="_buttonRight_1fd4o_14",YDe="_buttonCenter_1fd4o_18",Dv={buttonContainer:WDe,buttonLeft:KDe,buttonRight:$De,buttonCenter:YDe},XDe="_button_13dfi_1",NO={button:XDe},ZDe="Anon",JDe=()=>{ye.useContext(To);const[n]=Y.useState(localStorage.getItem("name")||ZDe),{model:e,characterManager:t}=ye.useContext(or),r=()=>{const o=Oe.mergeOptions_sel_option||0;return{createTextureAtlas:Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),ktxCompression:Oe.merge_options_ktx_compression,exportStdAtlas:o===0||o==2,exportMtoonAtlas:o===1||o==2,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},i=()=>{const o=r();t.downloadVRM(n,o)},s=()=>{const o=r();t.downloadGLB(n,o)};return k.jsxs(Y.Fragment,{children:[k.jsx(_n,{theme:"light",text:"GLB",icon:"download",size:14,className:NO.button,onClick:()=>{s()}}),k.jsx(_n,{theme:"light",text:"VRM",icon:"download",size:14,className:NO.button,onClick:i})]})};function qDe(){const{t:n}=ye.useContext(To),{playSound:e}=Y.useContext(Ys),{isMute:t}=Y.useContext($s),{setViewMode:r}=Y.useContext(Ui),i=()=>{r(dt.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(dt.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return k.jsxs("div",{className:Dv.container,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),k.jsxs("div",{className:Dv.buttonContainer,children:[k.jsx(Cg,{onFilesDrop:o}),k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:Dv.buttonLeft,onClick:i}),k.jsx(B_,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),k.jsx(JDe,{}),k.jsx(_n,{theme:"light",text:"mint",size:14,className:Dv.buttonRight,onClick:s})]})]})}function eOe(){const{t:n}=ye.useContext(To),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Ys),{isMute:s}=Y.useContext($s),{manifest:o,characterManager:a}=Y.useContext(or);ye.useState([]);const[l,A]=ye.useState([]);ye.useEffect(()=>{c()},[]);const c=async()=>{const d=await S2();GPe(d,"the-anata-nft").then(g=>{A(g.nfts),console.log(g.nfts)})},u=()=>{e(dt.LANDING),!s&&i("backNextButton")},f=async d=>{t(!0),a.loadManifest(o[d].manifest).then(()=>{e(dt.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)})})},p=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsx("div",{className:ot.classContainer,children:l.map((d,g)=>k.jsxs("div",{className:ot.class,onClick:()=>f(g),onMouseOver:()=>p(),children:[k.jsx("div",{className:ot.classFrame,style:{backgroundImage:`url(${d.image_url})`},children:k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})})}),k.jsx("div",{className:ot.name,children:d.name})]},g))}),k.jsx("div",{className:ot.bottomLine}),k.jsxs("div",{className:ot.buttonContainer,children:[k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:u}),k.jsx(_n,{theme:"light",text:"test",size:14,className:ot.buttonLeft,onClick:h})]})]})}const tOe=".//manifest.json",nOe=6,rOe=new Z(0,.8,0);new Z(-2.2367993753934425,1.1512971720174363,2.2612065299409223);async function iOe(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 sOe(){const n=await iOe(tOe),e=new Ape;return{initialManifest:n,effectManager:e}}const oOe=()=>{let n,e;const r=sOe().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}}},aOe=oOe();function lOe(){const{initialManifest:n,effectManager:e}=aOe.read(),[t,r]=ye.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:A,showEnvironmentModels:c}=ye.useContext(or),{viewMode:u}=ye.useContext(Ui);e.camera=i,e.scene=o;const f=()=>{e.camera&&(a({targetX:0,targetY:rOe.y,targetZ:0,distance:nOe}),s&&([dt.APPEARANCE,dt.SAVE,dt.OPTIMIZER,dt.BATCHDOWNLOAD,dt.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1))},[h,p]=ye.useState(!1),[d,g]=ye.useState(""),[m,y]=ye.useState([]),w=(C,S)=>{g(C),p(!0),y([S])},x={[dt.LANDING]:k.jsx(mDe,{}),[dt.APPEARANCE]:k.jsx(dLe,{confirmDialog:w}),[dt.OPTIMIZER]:k.jsx(jDe,{}),[dt.CREATE]:k.jsx(hDe,{}),[dt.WALLET]:k.jsx(eOe,{}),[dt.CLAIM]:k.jsx(fDe,{}),[dt.BATCHMANIFEST]:k.jsx(KPe,{}),[dt.BATCHDOWNLOAD]:k.jsx(GLe,{}),[dt.LOAD]:k.jsx(IDe,{}),[dt.MINT]:k.jsx(VDe,{}),[dt.SAVE]:k.jsx(qDe,{})};let _=0;return ye.useEffect(()=>{const C=S=>{const b=new Date().getTime(),M=b-_;M<300&&M>10&&S.target.id=="editor-scene"&&r(!t),_=b};return window.addEventListener("touchend",C),window.addEventListener("click",C),()=>{window.removeEventListener("touchend",C),window.removeEventListener("click",C)}},[t]),ye.useEffect(()=>{if(A!=null)return f(),A.enabled=!0,[dt.LANDING,dt.CREATE,dt.CLAIM,dt.LOAD,dt.CLAIM,dt.CLAIM].includes(u)?c(!1):c(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[u,A]),ye.useEffect(()=>{l(n)},[n]),ye.useContext(To),k.jsxs(ye.Fragment,{children:[k.jsx("div",{className:"generalTitle",children:"Character Studio"}),k.jsx(Spe,{confirmDialogText:d,confirmDialogCallback:m,confirmDialogWindow:h,setConfirmDialogWindow:p}),k.jsx(Rpe,{}),x[u]]})}const AOe=n=>{const e=new kS(n);return e.pollingInterval=12e3,e};KB.createRoot(document.getElementById("root")).render(k.jsx(Y.StrictMode,{children:k.jsx(Q9,{getLibrary:AOe,children:k.jsx(XK,{children:k.jsx(Hde,{children:k.jsx($K,{children:k.jsx(yhe,{children:k.jsx(ghe,{children:k.jsx(Mhe,{children:k.jsx(ye.Suspense,{children:k.jsx(lOe,{})})})})})})})})})}));export{ta as c,bl as g}; +`):" "+RO(s[0]):"as no adapter specified";throw new Nt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return r},adapters:yS};function UB(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new kg(null,n)}function FO(n){return UB(n),n.headers=hl.from(n.headers),n.data=FB.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),Qz.getAdapter(n.adapter||B2.adapter)(n).then(function(r){return UB(n),r.data=FB.call(n,n.transformResponse,r),r.headers=hl.from(r.headers),r},function(r){return Nz(r)||(UB(n),r&&r.response&&(r.response.data=FB.call(n,n.transformResponse,r.response),r.response.headers=hl.from(r.response.headers))),Promise.reject(r)})}const UO=n=>n instanceof hl?{...n}:n;function Vh(n,e){e=e||{};const t={};function r(A,c,u){return Ie.isPlainObject(A)&&Ie.isPlainObject(c)?Ie.merge.call({caseless:u},A,c):Ie.isPlainObject(c)?Ie.merge({},c):Ie.isArray(c)?c.slice():c}function i(A,c,u){if(Ie.isUndefined(c)){if(!Ie.isUndefined(A))return r(void 0,A,u)}else return r(A,c,u)}function s(A,c){if(!Ie.isUndefined(c))return r(void 0,c)}function o(A,c){if(Ie.isUndefined(c)){if(!Ie.isUndefined(A))return r(void 0,A)}else return r(void 0,c)}function a(A,c,u){if(u in e)return r(A,c);if(u in n)return r(void 0,A)}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:(A,c)=>i(UO(A),UO(c),!0)};return Ie.forEach(Object.keys(Object.assign({},n,e)),function(c){const u=l[c]||i,f=u(n[c],e[c],c);Ie.isUndefined(f)&&u!==a||(t[c]=f)}),t}const Hz="1.6.8",E2={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{E2[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const LO={};E2.transitional=function(e,t,r){function i(s,o){return"[Axios v"+Hz+"] Transitional option '"+s+"'"+o+(r?". "+r:"")}return(s,o,a)=>{if(e===!1)throw new Nt(i(o," has been removed"+(t?" in "+t:"")),Nt.ERR_DEPRECATED);return t&&!LO[o]&&(LO[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 LPe(n,e,t){if(typeof n!="object")throw new Nt("options must be an object",Nt.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 Nt("option "+s+" must be "+l,Nt.ERR_BAD_OPTION_VALUE);continue}if(t!==!0)throw new Nt("Unknown option "+s,Nt.ERR_BAD_OPTION)}}const wS={assertOptions:LPe,validators:E2},Wl=wS.validators;class ox{constructor(e){this.defaults=e,this.interceptors={request:new MO,response:new MO}}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/,""):"";r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+s):r.stack=s}throw r}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Vh(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&wS.assertOptions(r,{silentJSONParsing:Wl.transitional(Wl.boolean),forcedJSONParsing:Wl.transitional(Wl.boolean),clarifyTimeoutError:Wl.transitional(Wl.boolean)},!1),i!=null&&(Ie.isFunction(i)?t.paramsSerializer={serialize:i}:wS.assertOptions(i,{encode:Wl.function,serialize:Wl.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Ie.merge(s.common,s[t.method]);s&&Ie.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),t.headers=hl.concat(o,s);const a=[];let l=!0;this.interceptors.request.forEach(function(d){typeof d.runWhen=="function"&&d.runWhen(t)===!1||(l=l&&d.synchronous,a.unshift(d.fulfilled,d.rejected))});const A=[];this.interceptors.response.forEach(function(d){A.push(d.fulfilled,d.rejected)});let c,u=0,f;if(!l){const p=[FO.bind(this),void 0];for(p.unshift.apply(p,a),p.push.apply(p,A),f=p.length,c=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 kg(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)}static source(){let e;return{token:new C2(function(i){e=i}),cancel:e}}}const PPe=C2;function DPe(n){return function(t){return n.apply(null,t)}}function OPe(n){return Ie.isObject(n)&&n.isAxiosError===!0}const xS={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(xS).forEach(([n,e])=>{xS[e]=n});const NPe=xS;function zz(n){const e=new Ey(n),t=_z(Ey.prototype.request,e);return Ie.extend(t,Ey.prototype,e,{allOwnKeys:!0}),Ie.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return zz(Vh(n,i))},t}const sr=zz(B2);sr.Axios=Ey;sr.CanceledError=kg;sr.CancelToken=PPe;sr.isCancel=Nz;sr.VERSION=Hz;sr.toFormData=R_;sr.AxiosError=Nt;sr.Cancel=sr.CanceledError;sr.all=function(e){return Promise.all(e)};sr.spread=DPe;sr.isAxiosError=OPe;sr.mergeConfig=Vh;sr.AxiosHeaders=hl;sr.formToJSON=n=>Oz(Ie.isHTMLForm(n)?new FormData(n):n);sr.getAdapter=Qz.getAdapter;sr.HttpStatusCode=NPe;sr.default=sr;const kPe=sr,QPe={}.VITE_OPENSEA_KEY,HPe={}.VITE_PINATA_API_KEY,zPe={}.VITE_PINATA_API_SECRET,LB="0x89";let Pv;async function GPe(){if(Pv!=null)return Pv;const n=new ZN("https://polygon-rpc.com/"),t=await new S_(sx.address,sx.abi,n).tokenPrice();return Pv=Ge.from(t).mul(1),Pv}function VPe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":QPe}};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 S2(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(LB,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:LB}]});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:LB}]});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 PB(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 kPe.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:HPe,pinata_secret_api_key:zPe}})).data}const jPe=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 WPe(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 S2();if(s=="")return"Please Connect Wallet";if(!i||await KPe(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let y=0;y<10;y++)try{return await PB(e,a).catch(x=>{console.error(y,"---",x)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const A=await zfe(t,n,4096);let c;if(A){let y="AvatarGlb_"+Date.now()+".glb";c=await(async()=>{for(let w=0;w<10;w++)try{return await PB(A,y).catch(_=>(console.error(w,"---",_),"Couldn't save glb to pinata"))}catch(x){return console.warn(x),"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://${c.IpfsHash}`,attributes:jPe(n)},f=JSON.stringify(u),p=`ipfs://${(await PB(new Blob([f]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let d=await GPe();const g=new kS(window.ethereum).getSigner(),m=new S_(sx.address,sx.abi,g);try{const y={value:d,from:s};if((await(await m.mintToken(1,p,y)).wait()).transactionHash)return console.log("Mint success!"),"Mint success!"}catch{return"Public Mint failed."}}}const KPe=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=U9("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new S_(bO.address,bO.abi,t).beneficiaryBalanceOf(e,x3e,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 $Pe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=Y.useContext(Ui),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=Y.useContext(or),[c,u]=ye.useState(null),[f,h]=ye.useState(""),{playSound:p}=Y.useContext(Xs),{isMute:d}=Y.useContext(Ys);Y.useState(null);const[g,m]=Y.useState(null),[y,w]=Y.useState(""),x=()=>{!d&&p("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(dt.LANDING)},_=()=>{const v=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:v===0||v==2,exportMtoonAtlas:v===1||v==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=v=>{const E=g[v].manifestName;(async()=>{(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview)&&i.savePortraitScreenshot(E,512,1024,1.5,-.1),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await i.downloadVRM(E,_());const z=new ld,K=A.parent;K.remove(A);const O=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(O===!0){const W=r.loras.map(async ee=>a.createLoraData(ee,z));await Promise.all(W)}const B=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(B===!0){const W=r.sprites.map(async ee=>l.createSpriteAtlas(ee,z));await Promise.all(W)}(O===!0||B===!0)&&z.saveZip(g[v].manifestName),K.add(A),v{v==0?(console.log(r.loras[0]),C(v)):(await i.setManifest(g[v]),t(!0),i.loadInitialTraits().then(async()=>{await(U=>new Promise(P=>setTimeout(P,U)))(1),C(v)}))},b=()=>{t(!0),S(0)},{t:M}=ye.useContext(Io),D=async v=>{if(i.getCurrentCharacterModel()){const U=fl(v.name),P=URL.createObjectURL(v);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.")},$=async v=>{const E=URL.createObjectURL(v);await i.loadOptimizerCharacter(E),URL.revokeObjectURL(E);const U=fl(v.name);h(U),u(i.getCurrentCharacterModel())},H=v=>{const E=Array.from(v),U=[],P=L=>new Promise((z,K)=>{if(L&&L.name.toLowerCase().endsWith(".json")){const O=new FileReader,B=L.name.replace(/\.[^/.]+$/,"");O.onload=function(W){try{const ee=JSON.parse(W.target.result),F=ee.thumbnail;ee.manifestName=B,U.push(ee),z()}catch(ee){console.error("Error parsing the JSON file:",ee),K(ee)}},O.readAsText(L)}});Promise.all(E.map(P)).then(()=>{U.length>0&&(m(U),i.setManifest(U[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(L=>{console.error("Error processing files:",L)})},I=async v=>{const E=v[0];E&&E.name.toLowerCase().endsWith(".fbx")&&D(E),E&&E.name.toLowerCase().endsWith(".vrm")&&$(E),E&&E.name.toLowerCase().endsWith(".json")&&H(v)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),k.jsx(Sg,{onFilesDrop:I}),k.jsx(E_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(y2,{model:c}),k.jsx(ST,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&k.jsx(l_,{loadedAnimationName:y}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:M("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(g==null?void 0:g.length)==1&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:b}),(g==null?void 0:g.length)>1&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:b})]})]})}const YPe="_classdisabled_hpzv8_1",XPe="_container_hpzv8_6",ZPe="_classContainer_hpzv8_14",JPe="_icon_hpzv8_39",qPe="_name_hpzv8_70",eDe="_description_hpzv8_79",tDe="_classFrame_hpzv8_84",nDe="_frameContainer_hpzv8_104",rDe="_frame_hpzv8_104",iDe="_image_hpzv8_114",sDe="_lockedContainer_hpzv8_120",oDe="_locked_hpzv8_120",aDe="_buttonContainer_hpzv8_134",lDe="_buttonLeft_hpzv8_143",ADe="_buttonRight_hpzv8_147",cDe="_buttonCenter_hpzv8_151",uDe="_topLine_hpzv8_165",fDe="_bottomLine_hpzv8_191",ot={classdisabled:YPe,container:XPe,classContainer:ZPe,class:"_class_hpzv8_1",icon:JPe,name:qPe,description:eDe,classFrame:tDe,frameContainer:nDe,frame:rDe,image:iDe,lockedContainer:sDe,locked:oDe,buttonContainer:aDe,buttonLeft:lDe,buttonRight:ADe,buttonCenter:cDe,topLine:uDe,bottomLine:fDe};function hDe(){const{t:n}=ye.useContext(Io),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Xs),{isMute:s}=Y.useContext(Ys),{manifest:o,characterManager:a}=Y.useContext(or),[l,A]=ye.useState([]);ye.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const p=o.characters.map(d=>({name:d.name,image:d.portrait,description:d.description,manifest:d.manifest,icon:d.icon,format:d.format,disabled:!1}));A(p)}},[o]);const c=()=>{e(dt.LANDING),!s&&i("backNextButton")},u=async p=>{t(!0),a.loadManifest(o.characters[p].manifest).then(()=>{e(dt.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{e(dt.BATCHMANIFEST)},h=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsxs("div",{className:ot.classContainer,children:[l.map((p,d)=>k.jsxs("div",{className:p.disabled?ot.classdisabled:ot.class,onClick:p.disabled?null:()=>u(d),onMouseOver:p.disabled?null:()=>h(),children:[k.jsxs("div",{className:ot.classFrame,style:{backgroundImage:`url(${p.image})`},children:[k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})}),k.jsx("div",{className:ot.lockedContainer,children:p.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ot.locked})})]}),k.jsx("div",{className:ot.name,children:p.name}),k.jsx("div",{className:ot.description,children:p.description})]},d)),k.jsxs("div",{className:ot.class,onClick:()=>f(),onMouseOver:()=>h(),children:[k.jsx("div",{className:ot.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})})}),k.jsx("div",{className:ot.name,children:"Manifest"}),k.jsx("div",{className:ot.description,children:"Load by manifest"})]},"manifest-load")]}),k.jsx("div",{className:ot.bottomLine}),k.jsx("div",{className:ot.buttonContainer,children:k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}function dDe(){const{t:n}=ye.useContext(Io),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Xs),{isMute:s}=Y.useContext(Ys),{manifest:o,characterManager:a}=Y.useContext(or),[l,A]=ye.useState([]);ye.useEffect(()=>{if((o==null?void 0:o.characters)!=null){const h=o.characters.map(p=>({name:p.name,image:p.portrait,description:p.description,manifest:p.manifest,icon:p.icon,format:p.format,disabled:!1}));A(h)}},[o]);const c=()=>{e(dt.LANDING),!s&&i("backNextButton")},u=async h=>{t(!0),a.loadManifest(o.characters[h].manifest).then(()=>{e(dt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsx("div",{className:ot.classContainer,children:l.map((h,p)=>k.jsxs("div",{className:h.disabled?ot.classdisabled:ot.class,onClick:h.disabled?null:()=>u(p),onMouseOver:h.disabled?null:()=>f(),children:[k.jsxs("div",{className:ot.classFrame,style:{backgroundImage:`url(${h.image})`},children:[k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})}),k.jsx("div",{className:ot.lockedContainer,children:h.disabled&&k.jsx("img",{src:"./assets/icons/locked.svg",className:ot.locked})})]}),k.jsx("div",{className:ot.name,children:h.name}),k.jsx("div",{className:ot.description,children:h.description})]},p))}),k.jsx("div",{className:ot.bottomLine}),k.jsx("div",{className:ot.buttonContainer,children:k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}const pDe="_buttonContainer_1ueuk_1",mDe="_button_1ueuk_1",ef={buttonContainer:pDe,button:mDe},PO={}.VITE_OPENSEA_KEY;function gDe(){const{setViewMode:n}=Y.useContext(Ui),{playSound:e}=Y.useContext(Xs),{isMute:t}=Y.useContext(Ys),{characterManager:r}=Y.useContext(or),i=()=>{n(dt.CREATE),!t&&e("backNextButton")},s=()=>{n(dt.CLAIM),!t&&e("backNextButton")},o=()=>{n(dt.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await S2()!=""&&n(dt.WALLET),!t&&e("backNextButton")};return k.jsx("div",{className:ef.container,children:k.jsxs("div",{className:ef.buttonContainer,children:[k.jsx("button",{className:ef.button,onClick:i,children:k.jsx("img",{src:"./assets/media/btn_create_character.png"})}),k.jsx("button",{className:ef.button,onClick:s,children:k.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),k.jsx("button",{className:ef.button,onClick:o,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),PO&&PO!=""&&k.jsx("button",{className:ef.button,onClick:a,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const fc={};var M2={exports:{}},mh=typeof Reflect=="object"?Reflect:null,DO=mh&&typeof mh.apply=="function"?mh.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},Cy;mh&&typeof mh.ownKeys=="function"?Cy=mh.ownKeys:Object.getOwnPropertySymbols?Cy=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Cy=function(e){return Object.getOwnPropertyNames(e)};function vDe(n){console&&console.warn&&console.warn(n)}var Gz=Number.isNaN||function(e){return e!==e};function en(){en.init.call(this)}M2.exports=en;M2.exports.once=_De;en.EventEmitter=en;en.prototype._events=void 0;en.prototype._eventsCount=0;en.prototype._maxListeners=void 0;var OO=10;function U_(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(en,"defaultMaxListeners",{enumerable:!0,get:function(){return OO},set:function(n){if(typeof n!="number"||n<0||Gz(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");OO=n}});en.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};en.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Gz(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 Vz(n){return n._maxListeners===void 0?en.defaultMaxListeners:n._maxListeners}en.prototype.getMaxListeners=function(){return Vz(this)};en.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")DO(l,this,t);else for(var A=l.length,c=Yz(l,A),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,vDe(a)}return n}en.prototype.addListener=function(e,t){return jz(this,e,t,!1)};en.prototype.on=en.prototype.addListener;en.prototype.prependListener=function(e,t){return jz(this,e,t,!0)};function yDe(){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 Wz(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=yDe.bind(r);return i.listener=t,r.wrapFn=i,i}en.prototype.once=function(e,t){return U_(t),this.on(e,Wz(this,e,t)),this};en.prototype.prependOnceListener=function(e,t){return U_(t),this.prependListener(e,Wz(this,e,t)),this};en.prototype.removeListener=function(e,t){var r,i,s,o,a;if(U_(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():wDe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};en.prototype.off=en.prototype.removeListener;en.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 Kz(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?xDe(i):Yz(i,i.length)}en.prototype.listeners=function(e){return Kz(this,e,!0)};en.prototype.rawListeners=function(e){return Kz(this,e,!1)};en.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):$z.call(n,e)};en.prototype.listenerCount=$z;function $z(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}en.prototype.eventNames=function(){return this._eventsCount>0?Cy(this._events):[]};function Yz(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 Sy(n,e,t){return SDe()?Sy=Reflect.construct:Sy=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&ax(A,o.prototype),A},Sy.apply(null,arguments)}function MDe(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function lx(n){var e=typeof Map=="function"?new Map:void 0;return lx=function(r){if(r===null||!MDe(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 Sy(r,arguments,bS(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ax(i,r)},lx(n)}function Dv(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 tf(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function Qo(n){return n.hasOwnProperty("result")?n.result:n}var DB=function(n){T2(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}(lx(Error)),TDe=function(n){T2(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}(lx(Error)),IDe=function(n){T2(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind(Dv(i)),i.handleChainChanged=i.handleChainChanged.bind(Dv(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind(Dv(i)),i.handleClose=i.handleClose.bind(Dv(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(c){if(s)return c;function u(){return _S({provider:window.ethereum},a?{account:a}:{})}var f=function(){if(!a)return Promise.resolve(window.ethereum.enable().then(function(h){return h&&Qo(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 DB;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=tf(function(){return Promise.resolve(window.ethereum.send("eth_requestAccounts").then(function(A){return Qo(A)[0]})).then(function(A){a=A})},function(A){if(A.code===4001)throw new TDe});return Promise.resolve(l&&l.then?l.then(i):i(l))}catch(A){return Promise.reject(A)}},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=Qo(window.ethereum.send({method:"net_version"}))}catch{}return s||(window.ethereum.isDapper?s=Qo(window.ethereum.cachedResults.net_version):s=window.ethereum.chainId||window.ethereum.netVersion||window.ethereum.networkVersion||window.ethereum._chainId),s}var A=function(){if(!s){var c=tf(function(){return Promise.resolve(window.ethereum.send("net_version").then(Qo)).then(function(u){s=u})},function(){});if(c&&c.then)return c.then(function(){})}}();return A&&A.then?A.then(l):l(A)};if(!window.ethereum)throw new DB;var s,o=tf(function(){return Promise.resolve(window.ethereum.send("eth_chainId").then(Qo)).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=Qo(window.ethereum.send({method:"eth_accounts"}))[0]),s}var A=function(){if(!s){var c=tf(function(){return Promise.resolve(window.ethereum.enable().then(function(u){return Qo(u)[0]})).then(function(u){s=u})},function(){});if(c&&c.then)return c.then(function(){})}}();return A&&A.then?A.then(l):l(A)};if(!window.ethereum)throw new DB;var s,o=tf(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(a){return Qo(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(tf(function(){return Promise.resolve(window.ethereum.send("eth_accounts").then(function(i){return Qo(i).length>0}))},function(){return!1})):Promise.resolve(!1)}catch(i){return Promise.reject(i)}},e}(CDe);function RDe(){const{account:n,library:e,activate:t}=z9(),[r,i]=ye.useState([]),{setViewMode:s}=Y.useContext(Ui),{playSound:o}=Y.useContext(Xs),{isMute:a}=Y.useContext(Ys),l=new IDe({supportedChainIds:[137,1,3,4,5,42,97]});ye.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)"],p=new S_(f,h,e);p.balanceOf(n).then(d=>{const g=[];for(let m=0;m{const y=m.map(w=>p.tokenURI(w));Promise.all(y).then(w=>{i(w)})})})}},[n,e]);const A=()=>{t(l)},c=f=>{!a&&o("backNextButton"),s(dt.APPEARANCE)},u=()=>{s(dt.LANDING),!a&&o("backNextButton")};return k.jsxs("div",{className:fc.container,children:[!n&&k.jsxs("div",{className:fc.message,children:["Please connect your wallet to load your characters",k.jsx("button",{className:fc.button,onClick:()=>A(),children:"Connect"})]}),k.jsxs("div",{className:fc.characterContainer,children:[k.jsx("div",{className:fc.title,children:"Load Character"}),r.map((f,h)=>k.jsx("div",{className:fc.character,onClick:()=>{c()},children:JSON.stringify(f)},h))]}),k.jsx("button",{className:fc.button,onClick:()=>u(),children:"Back"})]})}const FDe="_container_q73cc_1",UDe="_mintContainer_q73cc_6",LDe="_mainTitleWrap_q73cc_33",PDe="_mainTitle_q73cc_33",DDe="_mintButtonContainer_q73cc_49",ODe="_mintButton_q73cc_49",NDe="_genesisText_q73cc_60",kDe="_required_q73cc_64",QDe="_divider_q73cc_68",HDe="_bottomContainer_q73cc_75",zDe="_mintInfo_q73cc_85",GDe="_topLine_q73cc_91",VDe="_bottomLine_q73cc_104",gi={container:FDe,mintContainer:UDe,mainTitleWrap:LDe,mainTitle:PDe,mintButtonContainer:DDe,mintButton:ODe,genesisText:NDe,required:kDe,divider:QDe,bottomContainer:HDe,mintInfo:zDe,topLine:GDe,bottomLine:VDe};function jDe(){const{model:n,avatar:e}=Y.useContext(or),{setViewMode:t}=Y.useContext(Ui),{playSound:r}=Y.useContext(Xs),{isMute:i}=Y.useContext(Ys),[s,o]=Y.useState(""),[a,l]=Y.useState(!1),A=()=>{t(dt.SAVE),!i&&r("backNextButton")};function c(){return k.jsxs("div",{className:gi.mainTitleWrap,children:[k.jsx("div",{className:gi.topLine}),k.jsx("div",{className:gi.mainTitle,children:"Mint"})]})}async function u(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const p=await WPe(e,null,n,{name:"XXXRestore"}.name);o(p),l(!1),console.log(p)}return k.jsxs("div",{className:gi.container,children:[k.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),k.jsxs("div",{className:gi.mintContainer,children:[k.jsx(c,{}),k.jsxs("div",{className:gi.mintButtonContainer,children:[k.jsx(_n,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:gi.mintButton,disabled:a,onClick:u,minWidth:220}),k.jsx("div",{className:gi.divider}),k.jsx(_n,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:gi.mintButton,disabled:!0,minWidth:220}),k.jsxs("span",{className:gi.genesisText,children:["(",k.jsx("span",{className:gi.required,children:"Coming Soon!"}),")"]})]}),k.jsxs("span",{className:gi.mintInfo,children:[s," "]})]}),k.jsx("div",{className:gi.bottomContainer,children:k.jsx(_n,{theme:"light",text:"Back",size:14,className:gi.buttonLeft,onClick:A})})]})}function WDe(){const{isLoading:n,setViewMode:e}=Y.useContext(Ui),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=Y.useContext(or),{playSound:l}=Y.useContext(Xs),{isMute:A}=Y.useContext(Ys),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=ye.useState([]),[g,m]=ye.useState(0),[y,w]=Y.useState("T-Pose"),x=()=>{!A&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(dt.LANDING)},_=()=>{const E=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:E===0||E==2,exportMtoonAtlas:E===1||E==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=async()=>{for(let E=0;E{typeof E!="string"&&(E=f),await(async()=>{var W;(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview)&&r.savePortraitScreenshot(E+"_portrait",512,1024,1.5,-.1),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await r.downloadVRM(E+"_merged",_());const z=new ld,K=s.parent;K.remove(s),(W=r.getCurrentOptimizerCharacterModel().data)==null||W.isVRM0;const O=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(O===!0){const ee=t.loras.map(async F=>o.createLoraData(F,z));await Promise.all(ee)}const B=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(B===!0){const ee=t.sprites.map(async F=>a.createSpriteAtlas(F,z));await Promise.all(ee)}(O===!0||B===!0)&&z.saveZip(E),K.add(s)})()},{t:b}=ye.useContext(Io),M=async E=>{if(r.getCurrentOptimizerCharacterModel()){const P=fl(E.name),L=URL.createObjectURL(E);await i.loadAnimation(L,!1,0,!0,"",P),w(i.getCurrentAnimationName()),URL.revokeObjectURL(L)}else console.warn("Please load a vrm model to test animations.")},D=()=>{if(g===0)H(p[p.length-1]),m(p.length-1);else{const E=g-1;H(p[E]),m(E)}},$=()=>{if(g>=p.length-1)H(p[0]),m(0);else{const E=g+1;H(p[E]),m(E)}},H=async E=>{const U=URL.createObjectURL(E);await r.loadOptimizerCharacter(U),URL.revokeObjectURL(U);const P=fl(E.name);h(P),u({...r.getCurrentCharacterModel()})},I=async E=>{H(E[0]);const U=[];for(let P=0;P{const U=E[0];U&&U.name.toLowerCase().endsWith(".fbx")&&M(U),U&&U.name.toLowerCase().endsWith(".vrm")&&I(E)};return k.jsxs("div",{className:ci.container,children:[k.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:k.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),k.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),k.jsx(Sg,{onFilesDrop:v}),k.jsx(E_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),k.jsx(y2,{model:c,name:f,files:p,index:g,nextVrm:$,previousVrm:D}),k.jsx(l_,{loadedAnimationName:y}),k.jsxs("div",{className:ci.buttonContainer,children:[k.jsx(_n,{theme:"light",text:b("callToAction.back"),size:14,className:ci.buttonLeft,onClick:x}),(p==null?void 0:p.length)>1!=""&&k.jsx(_n,{theme:"light",text:"Download All",size:14,className:ci.buttonRight,onClick:C}),c!=""&&k.jsx(_n,{theme:"light",text:"Download",size:14,className:ci.buttonRight,onClick:S})]})]})}const KDe="_buttonContainer_1fd4o_1",$De="_buttonLeft_1fd4o_10",YDe="_buttonRight_1fd4o_14",XDe="_buttonCenter_1fd4o_18",Ov={buttonContainer:KDe,buttonLeft:$De,buttonRight:YDe,buttonCenter:XDe},ZDe="_button_13dfi_1",NO={button:ZDe},JDe="Anon",qDe=()=>{ye.useContext(Io);const[n]=Y.useState(localStorage.getItem("name")||JDe),{model:e,characterManager:t}=ye.useContext(or),r=()=>{const o=Oe.mergeOptions_sel_option||0;return{createTextureAtlas:Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas,mToonAtlasSize:vn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:vn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:vn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:vn(Oe.mergeOptions_atlas_std_transp_size||6),ktxCompression:Oe.merge_options_ktx_compression,exportStdAtlas:o===0||o==2,exportMtoonAtlas:o===1||o==2,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},i=()=>{const o=r();t.downloadVRM(n,o)},s=()=>{const o=r();t.downloadGLB(n,o)};return k.jsxs(Y.Fragment,{children:[k.jsx(_n,{theme:"light",text:"GLB",icon:"download",size:14,className:NO.button,onClick:()=>{s()}}),k.jsx(_n,{theme:"light",text:"VRM",icon:"download",size:14,className:NO.button,onClick:i})]})};function eOe(){const{t:n}=ye.useContext(Io),{playSound:e}=Y.useContext(Xs),{isMute:t}=Y.useContext(Ys),{setViewMode:r}=Y.useContext(Ui),i=()=>{r(dt.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(dt.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return k.jsxs("div",{className:Ov.container,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),k.jsxs("div",{className:Ov.buttonContainer,children:[k.jsx(Sg,{onFilesDrop:o}),k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:Ov.buttonLeft,onClick:i}),k.jsx(E_,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),k.jsx(qDe,{}),k.jsx(_n,{theme:"light",text:"mint",size:14,className:Ov.buttonRight,onClick:s})]})]})}function tOe(){const{t:n}=ye.useContext(Io),{setViewMode:e,setIsLoading:t,isLoading:r}=Y.useContext(Ui),{playSound:i}=Y.useContext(Xs),{isMute:s}=Y.useContext(Ys),{manifest:o,characterManager:a}=Y.useContext(or);ye.useState([]);const[l,A]=ye.useState([]);ye.useEffect(()=>{c()},[]);const c=async()=>{const d=await S2();VPe(d,"the-anata-nft").then(g=>{A(g.nfts),console.log(g.nfts)})},u=()=>{e(dt.LANDING),!s&&i("backNextButton")},f=async d=>{t(!0),a.loadManifest(o[d].manifest).then(()=>{e(dt.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)})})},p=()=>{!s&&i("classMouseOver")};return k.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),k.jsx("div",{className:ot.vrmOptimizerButton}),k.jsx("div",{className:ot.topLine}),k.jsx("div",{className:ot.classContainer,children:l.map((d,g)=>k.jsxs("div",{className:ot.class,onClick:()=>f(g),onMouseOver:()=>p(),children:[k.jsx("div",{className:ot.classFrame,style:{backgroundImage:`url(${d.image_url})`},children:k.jsx("div",{className:ot.frameContainer,children:k.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})})}),k.jsx("div",{className:ot.name,children:d.name})]},g))}),k.jsx("div",{className:ot.bottomLine}),k.jsxs("div",{className:ot.buttonContainer,children:[k.jsx(_n,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:u}),k.jsx(_n,{theme:"light",text:"test",size:14,className:ot.buttonLeft,onClick:h})]})]})}const nOe=".//manifest.json",rOe=6,iOe=new Z(0,.8,0);new Z(-2.2367993753934425,1.1512971720174363,2.2612065299409223);async function sOe(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 oOe(){const n=await sOe(nOe),e=new cpe;return{initialManifest:n,effectManager:e}}const aOe=()=>{let n,e;const r=oOe().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}}},lOe=aOe();function AOe(){const{initialManifest:n,effectManager:e}=lOe.read(),[t,r]=ye.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:A,showEnvironmentModels:c}=ye.useContext(or),{viewMode:u}=ye.useContext(Ui);e.camera=i,e.scene=o;const f=()=>{e.camera&&(a({targetX:0,targetY:iOe.y,targetZ:0,distance:rOe}),s&&([dt.APPEARANCE,dt.SAVE,dt.OPTIMIZER,dt.BATCHDOWNLOAD,dt.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1))},[h,p]=ye.useState(!1),[d,g]=ye.useState(""),[m,y]=ye.useState([]),w=(C,S)=>{g(C),p(!0),y([S])},x={[dt.LANDING]:k.jsx(gDe,{}),[dt.APPEARANCE]:k.jsx(pLe,{confirmDialog:w}),[dt.OPTIMIZER]:k.jsx(WDe,{}),[dt.CREATE]:k.jsx(dDe,{}),[dt.WALLET]:k.jsx(tOe,{}),[dt.CLAIM]:k.jsx(hDe,{}),[dt.BATCHMANIFEST]:k.jsx($Pe,{}),[dt.BATCHDOWNLOAD]:k.jsx(VLe,{}),[dt.LOAD]:k.jsx(RDe,{}),[dt.MINT]:k.jsx(jDe,{}),[dt.SAVE]:k.jsx(eOe,{})};let _=0;return ye.useEffect(()=>{const C=S=>{const b=new Date().getTime(),M=b-_;M<300&&M>10&&S.target.id=="editor-scene"&&r(!t),_=b};return window.addEventListener("touchend",C),window.addEventListener("click",C),()=>{window.removeEventListener("touchend",C),window.removeEventListener("click",C)}},[t]),ye.useEffect(()=>{if(A!=null)return f(),A.enabled=!0,[dt.LANDING,dt.CREATE,dt.CLAIM,dt.LOAD,dt.CLAIM,dt.CLAIM].includes(u)?c(!1):c(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[u,A]),ye.useEffect(()=>{l(n)},[n]),ye.useContext(Io),k.jsxs(ye.Fragment,{children:[k.jsx("div",{className:"generalTitle",children:"Character Studio"}),k.jsx(Mpe,{confirmDialogText:d,confirmDialogCallback:m,confirmDialogWindow:h,setConfirmDialogWindow:p}),k.jsx(Fpe,{}),x[u]]})}const cOe=n=>{const e=new kS(n);return e.pollingInterval=12e3,e};KB.createRoot(document.getElementById("root")).render(k.jsx(Y.StrictMode,{children:k.jsx(Q9,{getLibrary:cOe,children:k.jsx(XK,{children:k.jsx(zde,{children:k.jsx($K,{children:k.jsx(whe,{children:k.jsx(vhe,{children:k.jsx(The,{children:k.jsx(ye.Suspense,{children:k.jsx(AOe,{})})})})})})})})})}));export{na as c,Bl as g}; diff --git a/index.html b/index.html index 4d37aa1b..f446ccd8 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Character Studio - +