From cfe63621546d46e88bf7bc4a95948109e45fad0a Mon Sep 17 00:00:00 2001 From: memelotsqui Date: Wed, 23 Oct 2024 19:59:00 +0000 Subject: [PATCH] deploy: 8df3039914ef22b8321d523cb377df5ba329b96b --- ...{howler-aa6636c7.js => howler-86289e89.js} | 2 +- .../{index-ab60ebd3.js => index-ee8e0381.js} | 426 +++++++++--------- index.html | 2 +- 3 files changed, 215 insertions(+), 215 deletions(-) rename assets/{howler-aa6636c7.js => howler-86289e89.js} (99%) rename assets/{index-ab60ebd3.js => index-ee8e0381.js} (65%) diff --git a/assets/howler-aa6636c7.js b/assets/howler-86289e89.js similarity index 99% rename from assets/howler-aa6636c7.js rename to assets/howler-86289e89.js index 2ed184ba..9513ab7d 100644 --- a/assets/howler-aa6636c7.js +++ b/assets/howler-86289e89.js @@ -1,4 +1,4 @@ -import{g as L,c as S}from"./index-ab60ebd3.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-ee8e0381.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-ab60ebd3.js b/assets/index-ee8e0381.js similarity index 65% rename from assets/index-ab60ebd3.js rename to assets/index-ee8e0381.js index de7af0fe..2fa19311 100644 --- a/assets/index-ab60ebd3.js +++ b/assets/index-ee8e0381.js @@ -1,4 +1,4 @@ -var CG=Object.defineProperty;var MG=(n,e,t)=>e in n?CG(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var kt=(n,e,t)=>(MG(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 qo=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 SG(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 XO={exports:{}},tx={},$O={exports:{}},Rt={};/** +var MG=Object.defineProperty;var SG=(n,e,t)=>e in n?MG(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var kt=(n,e,t)=>(SG(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 qo=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 TG(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 $O={exports:{}},nx={},ZO={exports:{}},Rt={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var CG=Object.defineProperty;var MG=(n,e,t)=>e in n?CG(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 tg=Symbol.for("react.element"),TG=Symbol.for("react.portal"),IG=Symbol.for("react.fragment"),RG=Symbol.for("react.strict_mode"),FG=Symbol.for("react.profiler"),UG=Symbol.for("react.provider"),LG=Symbol.for("react.context"),PG=Symbol.for("react.forward_ref"),DG=Symbol.for("react.suspense"),OG=Symbol.for("react.memo"),NG=Symbol.for("react.lazy"),S2=Symbol.iterator;function kG(n){return n===null||typeof n!="object"?null:(n=S2&&n[S2]||n["@@iterator"],typeof n=="function"?n:null)}var ZO={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},JO=Object.assign,qO={};function zh(n,e,t){this.props=n,this.context=e,this.refs=qO,this.updater=t||ZO}zh.prototype.isReactComponent={};zh.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")};zh.prototype.forceUpdate=function(n){this.updater.enqueueForceUpdate(this,n,"forceUpdate")};function eN(){}eN.prototype=zh.prototype;function yM(n,e,t){this.props=n,this.context=e,this.refs=qO,this.updater=t||ZO}var wM=yM.prototype=new eN;wM.constructor=yM;JO(wM,zh.prototype);wM.isPureReactComponent=!0;var T2=Array.isArray,tN=Object.prototype.hasOwnProperty,xM={current:null},nN={key:!0,ref:!0,__self:!0,__source:!0};function rN(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)tN.call(e,r)&&!nN.hasOwnProperty(r)&&(i[r]=e[r]);var a=arguments.length-2;if(a===1)i.children=t;else if(1e in n?CG(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 VG=ye,jG=Symbol.for("react.element"),WG=Symbol.for("react.fragment"),KG=Object.prototype.hasOwnProperty,YG=VG.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,XG={key:!0,ref:!0,__self:!0,__source:!0};function iN(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)KG.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:jG,type:n,key:s,ref:o,props:i,_owner:YG.current}}tx.Fragment=WG;tx.jsx=iN;tx.jsxs=iN;XO.exports=tx;var N=XO.exports,bM={exports:{}};const $G={},ZG=Object.freeze(Object.defineProperty({__proto__:null,default:$G},Symbol.toStringTag,{value:"Module"})),JG=SG(ZG);bM.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 B=function(){};B.prototype=v.prototype,I.prototype=new B,I.prototype.constructor=I}function s(I,v,B){if(s.isBN(I))return I;this.negative=0,this.words=null,this.length=0,this.red=null,I!==null&&((v==="le"||v==="be")&&(B=v,v=10),this._init(I||0,v||10,B||"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=JG.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,B){return v.cmp(B)>0?v:B},s.min=function(v,B){return v.cmp(B)<0?v:B},s.prototype._init=function(v,B,F){if(typeof v=="number")return this._initNumber(v,B,F);if(typeof v=="object")return this._initArray(v,B,F);B==="hex"&&(B=16),r(B===(B|0)&&B>=2&&B<=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[O]|=z<>>26-K&67108863,K+=24,K>=26&&(K-=26,O++);else if(F==="le")for(P=0,O=0;P>>26-K&67108863,K+=24,K>=26&&(K-=26,O++);return this._strip()};function a(I,v){var B=I.charCodeAt(v);if(B>=48&&B<=57)return B-48;if(B>=65&&B<=70)return B-55;if(B>=97&&B<=102)return B-87;r(!1,"Invalid character in "+I)}function l(I,v,B){var F=a(I,B);return B-1>=v&&(F|=a(I,B-1)<<4),F}s.prototype._parseHex=function(v,B,F){this.length=Math.ceil((v.length-B)/6),this.words=new Array(this.length);for(var P=0;P=B;P-=2)K=l(v,B,P)<=18?(O-=18,z+=1,this.words[z]|=K>>>26):O+=8;else{var Q=v.length-B;for(P=Q%2===0?B+1:B;P=18?(O-=18,z+=1,this.words[z]|=K>>>26):O+=8}this._strip()};function A(I,v,B,F){for(var P=0,O=0,z=Math.min(I.length,B),K=v;K=49?O=Q-49+10:Q>=17?O=Q-17+10:O=Q,r(Q>=0&&O1&&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,B){v=v||10,B=B|0||1;var F;if(v===16||v==="hex"){F="";for(var P=0,O=0,z=0;z>>24-P&16777215,P+=2,P>=26&&(P-=26,z--),O!==0||z!==this.length-1?F=f[6-Q.length]+Q+F:F=Q+F}for(O!==0&&(F=O.toString(16)+F);F.length%B!==0;)F="0"+F;return this.negative!==0&&(F="-"+F),F}if(v===(v|0)&&v>=2&&v<=36){var E=h[v],G=p[v];F="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var U=ee.modrn(G).toString(v);ee=ee.idivn(G),ee.isZero()?F=U+F:F=f[E-U.length]+U+F}for(this.isZero()&&(F="0"+F);F.length%B!==0;)F="0"+F;return this.negative!==0&&(F="-"+F),F}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,B){return this.toArrayLike(o,v,B)}),s.prototype.toArray=function(v,B){return this.toArrayLike(Array,v,B)};var d=function(v,B){return v.allocUnsafe?v.allocUnsafe(B):new v(B)};s.prototype.toArrayLike=function(v,B,F){this._strip();var P=this.byteLength(),O=F||Math.max(1,P);r(P<=O,"byte array longer than desired length"),r(O>0,"Requested array length <= 0");var z=d(v,O),K=B==="le"?"LE":"BE";return this["_toArrayLike"+K](z,P),z},s.prototype._toArrayLikeLE=function(v,B){for(var F=0,P=0,O=0,z=0;O>8&255),F>16&255),z===6?(F>24&255),P=0,z=0):(P=K>>>24,z+=2)}if(F=0&&(v[F--]=K>>8&255),F>=0&&(v[F--]=K>>16&255),z===6?(F>=0&&(v[F--]=K>>24&255),P=0,z=0):(P=K>>>24,z+=2)}if(F>=0)for(v[F--]=P;F>=0;)v[F--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var B=v,F=0;return B>=4096&&(F+=13,B>>>=13),B>=64&&(F+=7,B>>>=7),B>=8&&(F+=4,B>>>=4),B>=2&&(F+=2,B>>>=2),F+B},s.prototype._zeroBits=function(v){if(v===0)return 26;var B=v,F=0;return B&8191||(F+=13,B>>>=13),B&127||(F+=7,B>>>=7),B&15||(F+=4,B>>>=4),B&3||(F+=2,B>>>=2),B&1||F++,F},s.prototype.bitLength=function(){var v=this.words[this.length-1],B=this._countBits(v);return(this.length-1)*26+B};function g(I){for(var v=new Array(I.bitLength()),B=0;B>>P&1}return v}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var v=0,B=0;Bv.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 B;this.length>v.length?B=v:B=this;for(var F=0;Fv.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 B,F;this.length>v.length?(B=this,F=v):(B=v,F=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 B=Math.ceil(v/26)|0,F=v%26;this._expand(B),F>0&&B--;for(var P=0;P0&&(this.words[P]=~this.words[P]&67108863>>26-F),this._strip()},s.prototype.notn=function(v){return this.clone().inotn(v)},s.prototype.setn=function(v,B){r(typeof v=="number"&&v>=0);var F=v/26|0,P=v%26;return this._expand(F+1),B?this.words[F]=this.words[F]|1<v.length?(F=this,P=v):(F=v,P=this);for(var O=0,z=0;z>>26;for(;O!==0&&z>>26;if(this.length=F.length,O!==0)this.words[this.length]=O,this.length++;else if(F!==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 B=this.iadd(v);return v.negative=1,B._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(v),this.negative=1,this._normSign();var F=this.cmp(v);if(F===0)return this.negative=0,this.length=1,this.words[0]=0,this;var P,O;F>0?(P=this,O=v):(P=v,O=this);for(var z=0,K=0;K>26,this.words[K]=B&67108863;for(;z!==0&&K>26,this.words[K]=B&67108863;if(z===0&&K>>26,ee=Q&67108863,U=Math.min(E,v.length-1),X=Math.max(0,E-I.length+1);X<=U;X++){var ae=E-X|0;P=I.words[ae]|0,O=v.words[X]|0,z=P*O+ee,G+=z/67108864|0,ee=z&67108863}B.words[E]=ee|0,Q=G|0}return Q!==0?B.words[E]=Q|0:B.length--,B._strip()}var y=function(v,B,F){var P=v.words,O=B.words,z=F.words,K=0,Q,E,G,ee=P[0]|0,U=ee&8191,X=ee>>>13,ae=P[1]|0,oe=ae&8191,de=ae>>>13,se=P[2]|0,pe=se&8191,_e=se>>>13,xe=P[3]|0,L=xe&8191,ue=xe>>>13,Ae=P[4]|0,q=Ae&8191,J=Ae>>>13,ce=P[5]|0,be=ce&8191,Be=ce>>>13,k=P[6]|0,W=k&8191,re=k>>>13,he=P[7]|0,me=he&8191,V=he>>>13,R=P[8]|0,S=R&8191,j=R>>>13,te=P[9]|0,le=te&8191,ie=te>>>13,Ie=O[0]|0,Te=Ie&8191,Le=Ie>>>13,He=O[1]|0,De=He&8191,fe=He>>>13,Me=O[2]|0,Se=Me&8191,Fe=Me>>>13,Ve=O[3]|0,Je=Ve&8191,ft=Ve>>>13,an=O[4]|0,Ct=an&8191,it=an>>>13,lr=O[5]|0,yt=lr&8191,jt=lr>>>13,Zs=O[6]|0,Zt=Zs&8191,Jt=Zs>>>13,ne=O[7]|0,ve=ne&8191,Ee=ne>>>13,we=O[8]|0,Ce=we&8191,ze=we>>>13,st=O[9]|0,Xe=st&8191,$e=st>>>13;F.negative=v.negative^B.negative,F.length=19,Q=Math.imul(U,Te),E=Math.imul(U,Le),E=E+Math.imul(X,Te)|0,G=Math.imul(X,Le);var gt=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(gt>>>26)|0,gt&=67108863,Q=Math.imul(oe,Te),E=Math.imul(oe,Le),E=E+Math.imul(de,Te)|0,G=Math.imul(de,Le),Q=Q+Math.imul(U,De)|0,E=E+Math.imul(U,fe)|0,E=E+Math.imul(X,De)|0,G=G+Math.imul(X,fe)|0;var dt=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(dt>>>26)|0,dt&=67108863,Q=Math.imul(pe,Te),E=Math.imul(pe,Le),E=E+Math.imul(_e,Te)|0,G=Math.imul(_e,Le),Q=Q+Math.imul(oe,De)|0,E=E+Math.imul(oe,fe)|0,E=E+Math.imul(de,De)|0,G=G+Math.imul(de,fe)|0,Q=Q+Math.imul(U,Se)|0,E=E+Math.imul(U,Fe)|0,E=E+Math.imul(X,Se)|0,G=G+Math.imul(X,Fe)|0;var ct=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(ct>>>26)|0,ct&=67108863,Q=Math.imul(L,Te),E=Math.imul(L,Le),E=E+Math.imul(ue,Te)|0,G=Math.imul(ue,Le),Q=Q+Math.imul(pe,De)|0,E=E+Math.imul(pe,fe)|0,E=E+Math.imul(_e,De)|0,G=G+Math.imul(_e,fe)|0,Q=Q+Math.imul(oe,Se)|0,E=E+Math.imul(oe,Fe)|0,E=E+Math.imul(de,Se)|0,G=G+Math.imul(de,Fe)|0,Q=Q+Math.imul(U,Je)|0,E=E+Math.imul(U,ft)|0,E=E+Math.imul(X,Je)|0,G=G+Math.imul(X,ft)|0;var Wt=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,Q=Math.imul(q,Te),E=Math.imul(q,Le),E=E+Math.imul(J,Te)|0,G=Math.imul(J,Le),Q=Q+Math.imul(L,De)|0,E=E+Math.imul(L,fe)|0,E=E+Math.imul(ue,De)|0,G=G+Math.imul(ue,fe)|0,Q=Q+Math.imul(pe,Se)|0,E=E+Math.imul(pe,Fe)|0,E=E+Math.imul(_e,Se)|0,G=G+Math.imul(_e,Fe)|0,Q=Q+Math.imul(oe,Je)|0,E=E+Math.imul(oe,ft)|0,E=E+Math.imul(de,Je)|0,G=G+Math.imul(de,ft)|0,Q=Q+Math.imul(U,Ct)|0,E=E+Math.imul(U,it)|0,E=E+Math.imul(X,Ct)|0,G=G+Math.imul(X,it)|0;var vn=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(vn>>>26)|0,vn&=67108863,Q=Math.imul(be,Te),E=Math.imul(be,Le),E=E+Math.imul(Be,Te)|0,G=Math.imul(Be,Le),Q=Q+Math.imul(q,De)|0,E=E+Math.imul(q,fe)|0,E=E+Math.imul(J,De)|0,G=G+Math.imul(J,fe)|0,Q=Q+Math.imul(L,Se)|0,E=E+Math.imul(L,Fe)|0,E=E+Math.imul(ue,Se)|0,G=G+Math.imul(ue,Fe)|0,Q=Q+Math.imul(pe,Je)|0,E=E+Math.imul(pe,ft)|0,E=E+Math.imul(_e,Je)|0,G=G+Math.imul(_e,ft)|0,Q=Q+Math.imul(oe,Ct)|0,E=E+Math.imul(oe,it)|0,E=E+Math.imul(de,Ct)|0,G=G+Math.imul(de,it)|0,Q=Q+Math.imul(U,yt)|0,E=E+Math.imul(U,jt)|0,E=E+Math.imul(X,yt)|0,G=G+Math.imul(X,jt)|0;var Hr=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,Q=Math.imul(W,Te),E=Math.imul(W,Le),E=E+Math.imul(re,Te)|0,G=Math.imul(re,Le),Q=Q+Math.imul(be,De)|0,E=E+Math.imul(be,fe)|0,E=E+Math.imul(Be,De)|0,G=G+Math.imul(Be,fe)|0,Q=Q+Math.imul(q,Se)|0,E=E+Math.imul(q,Fe)|0,E=E+Math.imul(J,Se)|0,G=G+Math.imul(J,Fe)|0,Q=Q+Math.imul(L,Je)|0,E=E+Math.imul(L,ft)|0,E=E+Math.imul(ue,Je)|0,G=G+Math.imul(ue,ft)|0,Q=Q+Math.imul(pe,Ct)|0,E=E+Math.imul(pe,it)|0,E=E+Math.imul(_e,Ct)|0,G=G+Math.imul(_e,it)|0,Q=Q+Math.imul(oe,yt)|0,E=E+Math.imul(oe,jt)|0,E=E+Math.imul(de,yt)|0,G=G+Math.imul(de,jt)|0,Q=Q+Math.imul(U,Zt)|0,E=E+Math.imul(U,Jt)|0,E=E+Math.imul(X,Zt)|0,G=G+Math.imul(X,Jt)|0;var ki=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(ki>>>26)|0,ki&=67108863,Q=Math.imul(me,Te),E=Math.imul(me,Le),E=E+Math.imul(V,Te)|0,G=Math.imul(V,Le),Q=Q+Math.imul(W,De)|0,E=E+Math.imul(W,fe)|0,E=E+Math.imul(re,De)|0,G=G+Math.imul(re,fe)|0,Q=Q+Math.imul(be,Se)|0,E=E+Math.imul(be,Fe)|0,E=E+Math.imul(Be,Se)|0,G=G+Math.imul(Be,Fe)|0,Q=Q+Math.imul(q,Je)|0,E=E+Math.imul(q,ft)|0,E=E+Math.imul(J,Je)|0,G=G+Math.imul(J,ft)|0,Q=Q+Math.imul(L,Ct)|0,E=E+Math.imul(L,it)|0,E=E+Math.imul(ue,Ct)|0,G=G+Math.imul(ue,it)|0,Q=Q+Math.imul(pe,yt)|0,E=E+Math.imul(pe,jt)|0,E=E+Math.imul(_e,yt)|0,G=G+Math.imul(_e,jt)|0,Q=Q+Math.imul(oe,Zt)|0,E=E+Math.imul(oe,Jt)|0,E=E+Math.imul(de,Zt)|0,G=G+Math.imul(de,Jt)|0,Q=Q+Math.imul(U,ve)|0,E=E+Math.imul(U,Ee)|0,E=E+Math.imul(X,ve)|0,G=G+Math.imul(X,Ee)|0;var yn=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(yn>>>26)|0,yn&=67108863,Q=Math.imul(S,Te),E=Math.imul(S,Le),E=E+Math.imul(j,Te)|0,G=Math.imul(j,Le),Q=Q+Math.imul(me,De)|0,E=E+Math.imul(me,fe)|0,E=E+Math.imul(V,De)|0,G=G+Math.imul(V,fe)|0,Q=Q+Math.imul(W,Se)|0,E=E+Math.imul(W,Fe)|0,E=E+Math.imul(re,Se)|0,G=G+Math.imul(re,Fe)|0,Q=Q+Math.imul(be,Je)|0,E=E+Math.imul(be,ft)|0,E=E+Math.imul(Be,Je)|0,G=G+Math.imul(Be,ft)|0,Q=Q+Math.imul(q,Ct)|0,E=E+Math.imul(q,it)|0,E=E+Math.imul(J,Ct)|0,G=G+Math.imul(J,it)|0,Q=Q+Math.imul(L,yt)|0,E=E+Math.imul(L,jt)|0,E=E+Math.imul(ue,yt)|0,G=G+Math.imul(ue,jt)|0,Q=Q+Math.imul(pe,Zt)|0,E=E+Math.imul(pe,Jt)|0,E=E+Math.imul(_e,Zt)|0,G=G+Math.imul(_e,Jt)|0,Q=Q+Math.imul(oe,ve)|0,E=E+Math.imul(oe,Ee)|0,E=E+Math.imul(de,ve)|0,G=G+Math.imul(de,Ee)|0,Q=Q+Math.imul(U,Ce)|0,E=E+Math.imul(U,ze)|0,E=E+Math.imul(X,Ce)|0,G=G+Math.imul(X,ze)|0;var bt=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(bt>>>26)|0,bt&=67108863,Q=Math.imul(le,Te),E=Math.imul(le,Le),E=E+Math.imul(ie,Te)|0,G=Math.imul(ie,Le),Q=Q+Math.imul(S,De)|0,E=E+Math.imul(S,fe)|0,E=E+Math.imul(j,De)|0,G=G+Math.imul(j,fe)|0,Q=Q+Math.imul(me,Se)|0,E=E+Math.imul(me,Fe)|0,E=E+Math.imul(V,Se)|0,G=G+Math.imul(V,Fe)|0,Q=Q+Math.imul(W,Je)|0,E=E+Math.imul(W,ft)|0,E=E+Math.imul(re,Je)|0,G=G+Math.imul(re,ft)|0,Q=Q+Math.imul(be,Ct)|0,E=E+Math.imul(be,it)|0,E=E+Math.imul(Be,Ct)|0,G=G+Math.imul(Be,it)|0,Q=Q+Math.imul(q,yt)|0,E=E+Math.imul(q,jt)|0,E=E+Math.imul(J,yt)|0,G=G+Math.imul(J,jt)|0,Q=Q+Math.imul(L,Zt)|0,E=E+Math.imul(L,Jt)|0,E=E+Math.imul(ue,Zt)|0,G=G+Math.imul(ue,Jt)|0,Q=Q+Math.imul(pe,ve)|0,E=E+Math.imul(pe,Ee)|0,E=E+Math.imul(_e,ve)|0,G=G+Math.imul(_e,Ee)|0,Q=Q+Math.imul(oe,Ce)|0,E=E+Math.imul(oe,ze)|0,E=E+Math.imul(de,Ce)|0,G=G+Math.imul(de,ze)|0,Q=Q+Math.imul(U,Xe)|0,E=E+Math.imul(U,$e)|0,E=E+Math.imul(X,Xe)|0,G=G+Math.imul(X,$e)|0;var $A=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+($A>>>26)|0,$A&=67108863,Q=Math.imul(le,De),E=Math.imul(le,fe),E=E+Math.imul(ie,De)|0,G=Math.imul(ie,fe),Q=Q+Math.imul(S,Se)|0,E=E+Math.imul(S,Fe)|0,E=E+Math.imul(j,Se)|0,G=G+Math.imul(j,Fe)|0,Q=Q+Math.imul(me,Je)|0,E=E+Math.imul(me,ft)|0,E=E+Math.imul(V,Je)|0,G=G+Math.imul(V,ft)|0,Q=Q+Math.imul(W,Ct)|0,E=E+Math.imul(W,it)|0,E=E+Math.imul(re,Ct)|0,G=G+Math.imul(re,it)|0,Q=Q+Math.imul(be,yt)|0,E=E+Math.imul(be,jt)|0,E=E+Math.imul(Be,yt)|0,G=G+Math.imul(Be,jt)|0,Q=Q+Math.imul(q,Zt)|0,E=E+Math.imul(q,Jt)|0,E=E+Math.imul(J,Zt)|0,G=G+Math.imul(J,Jt)|0,Q=Q+Math.imul(L,ve)|0,E=E+Math.imul(L,Ee)|0,E=E+Math.imul(ue,ve)|0,G=G+Math.imul(ue,Ee)|0,Q=Q+Math.imul(pe,Ce)|0,E=E+Math.imul(pe,ze)|0,E=E+Math.imul(_e,Ce)|0,G=G+Math.imul(_e,ze)|0,Q=Q+Math.imul(oe,Xe)|0,E=E+Math.imul(oe,$e)|0,E=E+Math.imul(de,Xe)|0,G=G+Math.imul(de,$e)|0;var Ln=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,Q=Math.imul(le,Se),E=Math.imul(le,Fe),E=E+Math.imul(ie,Se)|0,G=Math.imul(ie,Fe),Q=Q+Math.imul(S,Je)|0,E=E+Math.imul(S,ft)|0,E=E+Math.imul(j,Je)|0,G=G+Math.imul(j,ft)|0,Q=Q+Math.imul(me,Ct)|0,E=E+Math.imul(me,it)|0,E=E+Math.imul(V,Ct)|0,G=G+Math.imul(V,it)|0,Q=Q+Math.imul(W,yt)|0,E=E+Math.imul(W,jt)|0,E=E+Math.imul(re,yt)|0,G=G+Math.imul(re,jt)|0,Q=Q+Math.imul(be,Zt)|0,E=E+Math.imul(be,Jt)|0,E=E+Math.imul(Be,Zt)|0,G=G+Math.imul(Be,Jt)|0,Q=Q+Math.imul(q,ve)|0,E=E+Math.imul(q,Ee)|0,E=E+Math.imul(J,ve)|0,G=G+Math.imul(J,Ee)|0,Q=Q+Math.imul(L,Ce)|0,E=E+Math.imul(L,ze)|0,E=E+Math.imul(ue,Ce)|0,G=G+Math.imul(ue,ze)|0,Q=Q+Math.imul(pe,Xe)|0,E=E+Math.imul(pe,$e)|0,E=E+Math.imul(_e,Xe)|0,G=G+Math.imul(_e,$e)|0;var Js=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(Js>>>26)|0,Js&=67108863,Q=Math.imul(le,Je),E=Math.imul(le,ft),E=E+Math.imul(ie,Je)|0,G=Math.imul(ie,ft),Q=Q+Math.imul(S,Ct)|0,E=E+Math.imul(S,it)|0,E=E+Math.imul(j,Ct)|0,G=G+Math.imul(j,it)|0,Q=Q+Math.imul(me,yt)|0,E=E+Math.imul(me,jt)|0,E=E+Math.imul(V,yt)|0,G=G+Math.imul(V,jt)|0,Q=Q+Math.imul(W,Zt)|0,E=E+Math.imul(W,Jt)|0,E=E+Math.imul(re,Zt)|0,G=G+Math.imul(re,Jt)|0,Q=Q+Math.imul(be,ve)|0,E=E+Math.imul(be,Ee)|0,E=E+Math.imul(Be,ve)|0,G=G+Math.imul(Be,Ee)|0,Q=Q+Math.imul(q,Ce)|0,E=E+Math.imul(q,ze)|0,E=E+Math.imul(J,Ce)|0,G=G+Math.imul(J,ze)|0,Q=Q+Math.imul(L,Xe)|0,E=E+Math.imul(L,$e)|0,E=E+Math.imul(ue,Xe)|0,G=G+Math.imul(ue,$e)|0;var du=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(du>>>26)|0,du&=67108863,Q=Math.imul(le,Ct),E=Math.imul(le,it),E=E+Math.imul(ie,Ct)|0,G=Math.imul(ie,it),Q=Q+Math.imul(S,yt)|0,E=E+Math.imul(S,jt)|0,E=E+Math.imul(j,yt)|0,G=G+Math.imul(j,jt)|0,Q=Q+Math.imul(me,Zt)|0,E=E+Math.imul(me,Jt)|0,E=E+Math.imul(V,Zt)|0,G=G+Math.imul(V,Jt)|0,Q=Q+Math.imul(W,ve)|0,E=E+Math.imul(W,Ee)|0,E=E+Math.imul(re,ve)|0,G=G+Math.imul(re,Ee)|0,Q=Q+Math.imul(be,Ce)|0,E=E+Math.imul(be,ze)|0,E=E+Math.imul(Be,Ce)|0,G=G+Math.imul(Be,ze)|0,Q=Q+Math.imul(q,Xe)|0,E=E+Math.imul(q,$e)|0,E=E+Math.imul(J,Xe)|0,G=G+Math.imul(J,$e)|0;var Ca=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(Ca>>>26)|0,Ca&=67108863,Q=Math.imul(le,yt),E=Math.imul(le,jt),E=E+Math.imul(ie,yt)|0,G=Math.imul(ie,jt),Q=Q+Math.imul(S,Zt)|0,E=E+Math.imul(S,Jt)|0,E=E+Math.imul(j,Zt)|0,G=G+Math.imul(j,Jt)|0,Q=Q+Math.imul(me,ve)|0,E=E+Math.imul(me,Ee)|0,E=E+Math.imul(V,ve)|0,G=G+Math.imul(V,Ee)|0,Q=Q+Math.imul(W,Ce)|0,E=E+Math.imul(W,ze)|0,E=E+Math.imul(re,Ce)|0,G=G+Math.imul(re,ze)|0,Q=Q+Math.imul(be,Xe)|0,E=E+Math.imul(be,$e)|0,E=E+Math.imul(Be,Xe)|0,G=G+Math.imul(Be,$e)|0;var ZA=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(ZA>>>26)|0,ZA&=67108863,Q=Math.imul(le,Zt),E=Math.imul(le,Jt),E=E+Math.imul(ie,Zt)|0,G=Math.imul(ie,Jt),Q=Q+Math.imul(S,ve)|0,E=E+Math.imul(S,Ee)|0,E=E+Math.imul(j,ve)|0,G=G+Math.imul(j,Ee)|0,Q=Q+Math.imul(me,Ce)|0,E=E+Math.imul(me,ze)|0,E=E+Math.imul(V,Ce)|0,G=G+Math.imul(V,ze)|0,Q=Q+Math.imul(W,Xe)|0,E=E+Math.imul(W,$e)|0,E=E+Math.imul(re,Xe)|0,G=G+Math.imul(re,$e)|0;var Ar=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(Ar>>>26)|0,Ar&=67108863,Q=Math.imul(le,ve),E=Math.imul(le,Ee),E=E+Math.imul(ie,ve)|0,G=Math.imul(ie,Ee),Q=Q+Math.imul(S,Ce)|0,E=E+Math.imul(S,ze)|0,E=E+Math.imul(j,Ce)|0,G=G+Math.imul(j,ze)|0,Q=Q+Math.imul(me,Xe)|0,E=E+Math.imul(me,$e)|0,E=E+Math.imul(V,Xe)|0,G=G+Math.imul(V,$e)|0;var qs=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(qs>>>26)|0,qs&=67108863,Q=Math.imul(le,Ce),E=Math.imul(le,ze),E=E+Math.imul(ie,Ce)|0,G=Math.imul(ie,ze),Q=Q+Math.imul(S,Xe)|0,E=E+Math.imul(S,$e)|0,E=E+Math.imul(j,Xe)|0,G=G+Math.imul(j,$e)|0;var JA=(K+Q|0)+((E&8191)<<13)|0;K=(G+(E>>>13)|0)+(JA>>>26)|0,JA&=67108863,Q=Math.imul(le,Xe),E=Math.imul(le,$e),E=E+Math.imul(ie,Xe)|0,G=Math.imul(ie,$e);var Tr=(K+Q|0)+((E&8191)<<13)|0;return K=(G+(E>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,z[0]=gt,z[1]=dt,z[2]=ct,z[3]=Wt,z[4]=vn,z[5]=Hr,z[6]=ki,z[7]=yn,z[8]=bt,z[9]=$A,z[10]=Ln,z[11]=Js,z[12]=du,z[13]=Ca,z[14]=ZA,z[15]=Ar,z[16]=qs,z[17]=JA,z[18]=Tr,K!==0&&(z[19]=K,F.length++),F};Math.imul||(y=m);function w(I,v,B){B.negative=v.negative^I.negative,B.length=I.length+v.length;for(var F=0,P=0,O=0;O>>26)|0,P+=z>>>26,z&=67108863}B.words[O]=K,F=z,z=P}return F!==0?B.words[O]=F:B.length--,B._strip()}function x(I,v,B){return w(I,v,B)}s.prototype.mulTo=function(v,B){var F,P=this.length+v.length;return this.length===10&&v.length===10?F=y(this,v,B):P<63?F=m(this,v,B):P<1024?F=w(this,v,B):F=x(this,v,B),F},s.prototype.mul=function(v){var B=new s(null);return B.words=new Array(this.length+v.length),this.mulTo(v,B)},s.prototype.mulf=function(v){var B=new s(null);return B.words=new Array(this.length+v.length),x(this,v,B)},s.prototype.imul=function(v){return this.clone().mulTo(v,this)},s.prototype.imuln=function(v){var B=v<0;B&&(v=-v),r(typeof v=="number"),r(v<67108864);for(var F=0,P=0;P>=26,F+=O/67108864|0,F+=z>>>26,this.words[P]=z&67108863}return F!==0&&(this.words[P]=F,this.length++),B?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 B=g(v);if(B.length===0)return new s(1);for(var F=this,P=0;P=0);var B=v%26,F=(v-B)/26,P=67108863>>>26-B<<26-B,O;if(B!==0){var z=0;for(O=0;O>>26-B}z&&(this.words[O]=z,this.length++)}if(F!==0){for(O=this.length-1;O>=0;O--)this.words[O+F]=this.words[O];for(O=0;O=0);var P;B?P=(B-B%26)/26:P=0;var O=v%26,z=Math.min((v-O)/26,this.length),K=67108863^67108863>>>O<z)for(this.length-=z,E=0;E=0&&(G!==0||E>=P);E--){var ee=this.words[E]|0;this.words[E]=G<<26-O|ee>>>O,G=ee&K}return Q&&G!==0&&(Q.words[Q.length++]=G),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,B,F){return r(this.negative===0),this.iushrn(v,B,F)},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 B=v%26,F=(v-B)/26,P=1<=0);var B=v%26,F=(v-B)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=F)return this;if(B!==0&&F++,this.length=Math.min(F,this.length),B!==0){var P=67108863^67108863>>>B<=67108864;B++)this.words[B]-=67108864,B===this.length-1?this.words[B+1]=1:this.words[B+1]++;return this.length=Math.max(this.length,B+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 B=0;B>26)-(Q/67108864|0),this.words[O+F]=z&67108863}for(;O>26,this.words[O+F]=z&67108863;if(K===0)return this._strip();for(r(K===-1),K=0,O=0;O>26,this.words[O]=z&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,B){var F=this.length-v.length,P=this.clone(),O=v,z=O.words[O.length-1]|0,K=this._countBits(z);F=26-K,F!==0&&(O=O.ushln(F),P.iushln(F),z=O.words[O.length-1]|0);var Q=P.length-O.length,E;if(B!=="mod"){E=new s(null),E.length=Q+1,E.words=new Array(E.length);for(var G=0;G=0;U--){var X=(P.words[O.length+U]|0)*67108864+(P.words[O.length+U-1]|0);for(X=Math.min(X/z|0,67108863),P._ishlnsubmul(O,X,U);P.negative!==0;)X--,P.negative=0,P._ishlnsubmul(O,1,U),P.isZero()||(P.negative^=1);E&&(E.words[U]=X)}return E&&E._strip(),P._strip(),B!=="div"&&F!==0&&P.iushrn(F),{div:E||null,mod:P}},s.prototype.divmod=function(v,B,F){if(r(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var P,O,z;return this.negative!==0&&v.negative===0?(z=this.neg().divmod(v,B),B!=="mod"&&(P=z.div.neg()),B!=="div"&&(O=z.mod.neg(),F&&O.negative!==0&&O.iadd(v)),{div:P,mod:O}):this.negative===0&&v.negative!==0?(z=this.divmod(v.neg(),B),B!=="mod"&&(P=z.div.neg()),{div:P,mod:z.mod}):this.negative&v.negative?(z=this.neg().divmod(v.neg(),B),B!=="div"&&(O=z.mod.neg(),F&&O.negative!==0&&O.isub(v)),{div:z.div,mod:O}):v.length>this.length||this.cmp(v)<0?{div:new s(0),mod:this}:v.length===1?B==="div"?{div:this.divn(v.words[0]),mod:null}:B==="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,B)},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 B=this.divmod(v);if(B.mod.isZero())return B.div;var F=B.div.negative!==0?B.mod.isub(v):B.mod,P=v.ushrn(1),O=v.andln(1),z=F.cmp(P);return z<0||O===1&&z===0?B.div:B.div.negative!==0?B.div.isubn(1):B.div.iaddn(1)},s.prototype.modrn=function(v){var B=v<0;B&&(v=-v),r(v<=67108863);for(var F=(1<<26)%v,P=0,O=this.length-1;O>=0;O--)P=(F*P+(this.words[O]|0))%v;return B?-P:P},s.prototype.modn=function(v){return this.modrn(v)},s.prototype.idivn=function(v){var B=v<0;B&&(v=-v),r(v<=67108863);for(var F=0,P=this.length-1;P>=0;P--){var O=(this.words[P]|0)+F*67108864;this.words[P]=O/v|0,F=O%v}return this._strip(),B?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 B=this,F=v.clone();B.negative!==0?B=B.umod(v):B=B.clone();for(var P=new s(1),O=new s(0),z=new s(0),K=new s(1),Q=0;B.isEven()&&F.isEven();)B.iushrn(1),F.iushrn(1),++Q;for(var E=F.clone(),G=B.clone();!B.isZero();){for(var ee=0,U=1;!(B.words[0]&U)&&ee<26;++ee,U<<=1);if(ee>0)for(B.iushrn(ee);ee-- >0;)(P.isOdd()||O.isOdd())&&(P.iadd(E),O.isub(G)),P.iushrn(1),O.iushrn(1);for(var X=0,ae=1;!(F.words[0]&ae)&&X<26;++X,ae<<=1);if(X>0)for(F.iushrn(X);X-- >0;)(z.isOdd()||K.isOdd())&&(z.iadd(E),K.isub(G)),z.iushrn(1),K.iushrn(1);B.cmp(F)>=0?(B.isub(F),P.isub(z),O.isub(K)):(F.isub(B),z.isub(P),K.isub(O))}return{a:z,b:K,gcd:F.iushln(Q)}},s.prototype._invmp=function(v){r(v.negative===0),r(!v.isZero());var B=this,F=v.clone();B.negative!==0?B=B.umod(v):B=B.clone();for(var P=new s(1),O=new s(0),z=F.clone();B.cmpn(1)>0&&F.cmpn(1)>0;){for(var K=0,Q=1;!(B.words[0]&Q)&&K<26;++K,Q<<=1);if(K>0)for(B.iushrn(K);K-- >0;)P.isOdd()&&P.iadd(z),P.iushrn(1);for(var E=0,G=1;!(F.words[0]&G)&&E<26;++E,G<<=1);if(E>0)for(F.iushrn(E);E-- >0;)O.isOdd()&&O.iadd(z),O.iushrn(1);B.cmp(F)>=0?(B.isub(F),P.isub(O)):(F.isub(B),O.isub(P))}var ee;return B.cmpn(1)===0?ee=P:ee=O,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 B=this.clone(),F=v.clone();B.negative=0,F.negative=0;for(var P=0;B.isEven()&&F.isEven();P++)B.iushrn(1),F.iushrn(1);do{for(;B.isEven();)B.iushrn(1);for(;F.isEven();)F.iushrn(1);var O=B.cmp(F);if(O<0){var z=B;B=F,F=z}else if(O===0||F.cmpn(1)===0)break;B.isub(F)}while(!0);return F.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 B=v%26,F=(v-B)/26,P=1<>>26,K&=67108863,this.words[z]=K}return O!==0&&(this.words[z]=O,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(v){var B=v<0;if(this.negative!==0&&!B)return-1;if(this.negative===0&&B)return 1;this._strip();var F;if(this.length>1)F=1;else{B&&(v=-v),r(v<=67108863,"Number is too big");var P=this.words[0]|0;F=P===v?0:Pv.length)return 1;if(this.length=0;F--){var P=this.words[F]|0,O=v.words[F]|0;if(P!==O){PO&&(B=1);break}}return B},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 Y(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 B=v,F;do this.split(B,this.tmp),B=this.imulK(B),B=B.iadd(this.tmp),F=B.bitLength();while(F>this.n);var P=F0?B.isub(this.p):B.strip!==void 0?B.strip():B._strip(),B},C.prototype.split=function(v,B){v.iushrn(this.n,0,B)},C.prototype.imulK=function(v){return v.imul(this.k)};function T(){C.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,C),T.prototype.split=function(v,B){for(var F=4194303,P=Math.min(v.length,9),O=0;O>>22,z=K}z>>>=22,v.words[O-10]=z,z===0&&v.length>10?v.length-=10:v.length-=9},T.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var B=0,F=0;F>>=26,v.words[F]=O,B=P}return B!==0&&(v.words[v.length++]=B),v},s._prime=function(v){if(_[v])return _[v];var B;if(v==="k256")B=new T;else if(v==="p224")B=new b;else if(v==="p192")B=new M;else if(v==="p25519")B=new D;else throw new Error("Unknown prime "+v);return _[v]=B,B};function Y(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}Y.prototype._verify1=function(v){r(v.negative===0,"red works only with positives"),r(v.red,"red works only with red numbers")},Y.prototype._verify2=function(v,B){r((v.negative|B.negative)===0,"red works only with positives"),r(v.red&&v.red===B.red,"red works only with red numbers")},Y.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(c(v,v.umod(this.m)._forceRed(this)),v)},Y.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},Y.prototype.add=function(v,B){this._verify2(v,B);var F=v.add(B);return F.cmp(this.m)>=0&&F.isub(this.m),F._forceRed(this)},Y.prototype.iadd=function(v,B){this._verify2(v,B);var F=v.iadd(B);return F.cmp(this.m)>=0&&F.isub(this.m),F},Y.prototype.sub=function(v,B){this._verify2(v,B);var F=v.sub(B);return F.cmpn(0)<0&&F.iadd(this.m),F._forceRed(this)},Y.prototype.isub=function(v,B){this._verify2(v,B);var F=v.isub(B);return F.cmpn(0)<0&&F.iadd(this.m),F},Y.prototype.shl=function(v,B){return this._verify1(v),this.imod(v.ushln(B))},Y.prototype.imul=function(v,B){return this._verify2(v,B),this.imod(v.imul(B))},Y.prototype.mul=function(v,B){return this._verify2(v,B),this.imod(v.mul(B))},Y.prototype.isqr=function(v){return this.imul(v,v.clone())},Y.prototype.sqr=function(v){return this.mul(v,v)},Y.prototype.sqrt=function(v){if(v.isZero())return v.clone();var B=this.m.andln(3);if(r(B%2===1),B===3){var F=this.m.add(new s(1)).iushrn(2);return this.pow(v,F)}for(var P=this.m.subn(1),O=0;!P.isZero()&&P.andln(1)===0;)O++,P.iushrn(1);r(!P.isZero());var z=new s(1).toRed(this),K=z.redNeg(),Q=this.m.subn(1).iushrn(1),E=this.m.bitLength();for(E=new s(2*E*E).toRed(this);this.pow(E,Q).cmp(K)!==0;)E.redIAdd(K);for(var G=this.pow(E,P),ee=this.pow(v,P.addn(1).iushrn(1)),U=this.pow(v,P),X=O;U.cmp(z)!==0;){for(var ae=U,oe=0;ae.cmp(z)!==0;oe++)ae=ae.redSqr();r(oe=0;O--){for(var G=B.words[O],ee=E-1;ee>=0;ee--){var U=G>>ee&1;if(z!==P[0]&&(z=this.sqr(z)),U===0&&K===0){Q=0;continue}K<<=1,K|=U,Q++,!(Q!==F&&(O!==0||ee!==0))&&(z=this.mul(z,P[K]),Q=0,K=0)}E=26}return z},Y.prototype.convertTo=function(v){var B=v.umod(this.m);return B===v?B.clone():B},Y.prototype.convertFrom=function(v){var B=v.clone();return B.red=null,B},s.mont=function(v){return new H(v)};function H(I){Y.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,Y),H.prototype.convertTo=function(v){return this.imod(v.ushln(this.shift))},H.prototype.convertFrom=function(v){var B=this.imod(v.mul(this.rinv));return B.red=null,B},H.prototype.imul=function(v,B){if(v.isZero()||B.isZero())return v.words[0]=0,v.length=1,v;var F=v.imul(B),P=F.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=F.isub(P).iushrn(this.shift),z=O;return O.cmp(this.m)>=0?z=O.isub(this.m):O.cmpn(0)<0&&(z=O.iadd(this.m)),z._forceRed(this)},H.prototype.mul=function(v,B){if(v.isZero()||B.isZero())return new s(0)._forceRed(this);var F=v.mul(B),P=F.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=F.isub(P).iushrn(this.shift),z=O;return O.cmp(this.m)>=0?z=O.isub(this.m):O.cmpn(0)<0&&(z=O.iadd(this.m)),z._forceRed(this)},H.prototype.invm=function(v){var B=this.imod(v._invmp(this.m).mul(this.r2));return B._forceRed(this)}})(n,qo)})(bM);var qG=bM.exports;const vt=bl(qG),eV="logger/5.7.0";let R2=!1,F2=!1;const Uv={debug:1,default:2,info:2,warning:3,error:4,off:5};let U2=Uv.default,M_=null;function tV(){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 L2=tV();var TB;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(TB||(TB={}));var fo;(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"})(fo||(fo={}));const P2="0123456789abcdef";let ge=class ur{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();Uv[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(U2>Uv[r])&&console.log.apply(console,t)}debug(...e){this._log(ur.levels.DEBUG,e)}info(...e){this._log(ur.levels.INFO,e)}warn(...e){this._log(ur.levels.WARNING,e)}makeError(e,t,r){if(F2)return this.makeError("censored error",t,{});t||(t=ur.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+=P2[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 fo.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 fo.CALL_EXCEPTION:case fo.INSUFFICIENT_FUNDS:case fo.MISSING_NEW:case fo.NONCE_EXPIRED:case fo.REPLACEMENT_UNDERPRICED:case fo.TRANSACTION_REPLACED:case fo.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,ur.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){L2&&this.throwError("platform missing String.prototype.normalize",ur.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:L2})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,ur.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,ur.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,ur.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",ur.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",ur.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",ur.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return M_||(M_=new ur(eV)),M_}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",ur.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),R2){if(!e)return;this.globalLogger().throwError("error censorship permanent",ur.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}F2=!!e,R2=!!t}static setLogLevel(e){const t=Uv[e.toLowerCase()];if(t==null){ur.globalLogger().warn("invalid log level - "+e);return}U2=t}static from(e){return new ur(e)}};ge.errors=fo;ge.levels=TB;const nV="bytes/5.7.0",Dn=new ge(nV);function sN(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 BM(n){return Et(n)&&!(n.length%2)||nx(n)}function D2(n){return typeof n=="number"&&n==n&&n%1===0}function nx(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!D2(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"){Dn.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),sN(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":Dn.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 dh(n){let e=at(n);if(e.length===0)return e;let t=0;for(;te&&Dn.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 S_="0123456789abcdef";function nt(n,e){if(e||(e={}),typeof n=="number"){Dn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=S_[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),sN(n))return n.toHexString();if(Et(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Dn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(nx(n)){let t="0x";for(let r=0;r>4]+S_[i&15]}return t}return Dn.throwArgumentError("invalid hexlify value","value",n)}function Pc(n){if(typeof n!="string")n=nt(n);else if(!Et(n)||n.length%2)return null;return(n.length-2)/2}function jr(n,e,t){return typeof n!="string"?n=nt(n):(!Et(n)||n.length%2)&&Dn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function Bi(n){let e="0x";return n.forEach(t=>{e+=nt(t).substring(2)}),e}function rx(n){const e=iV(nt(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function iV(n){typeof n!="string"&&(n=nt(n)),Et(n)||Dn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Dn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function ix(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(BM(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]):Dn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Dn.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=rV(at(e._vs),32);e._vs=nt(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Dn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=nt(i);e.s==null?e.s=o:e.s!==o&&Dn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Dn.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&&Dn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!Et(e.r)?Dn.throwArgumentError("signature missing or invalid r","signature",n):e.r=Qn(e.r,32),e.s==null||!Et(e.s)?Dn.throwArgumentError("signature missing or invalid s","signature",n):e.s=Qn(e.s,32);const t=at(e.s);t[0]>=128&&Dn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=nt(t);e._vs&&(Et(e._vs)||Dn.throwArgumentError("signature invalid _vs","signature",n),e._vs=Qn(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Dn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const sV="bignumber/5.7.0";var xy=vt.BN;const Ga=new ge(sV),T_={},O2=9007199254740991;let N2=!1;class Ge{constructor(e,t){e!==T_&&Ga.throwError("cannot call constructor directly; use BigNumber.from",ge.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return vi(St(this).fromTwos(e))}toTwos(e){return vi(St(this).toTwos(e))}abs(){return this._hex[0]==="-"?Ge.from(this._hex.substring(1)):this}add(e){return vi(St(this).add(St(e)))}sub(e){return vi(St(this).sub(St(e)))}div(e){return Ge.from(e).isZero()&&ms("division-by-zero","div"),vi(St(this).div(St(e)))}mul(e){return vi(St(this).mul(St(e)))}mod(e){const t=St(e);return t.isNeg()&&ms("division-by-zero","mod"),vi(St(this).umod(t))}pow(e){const t=St(e);return t.isNeg()&&ms("negative-power","pow"),vi(St(this).pow(t))}and(e){const t=St(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","and"),vi(St(this).and(t))}or(e){const t=St(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","or"),vi(St(this).or(t))}xor(e){const t=St(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","xor"),vi(St(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&ms("negative-width","mask"),vi(St(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ms("negative-width","shl"),vi(St(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ms("negative-width","shr"),vi(St(this).shrn(e))}eq(e){return St(this).eq(St(e))}lt(e){return St(this).lt(St(e))}lte(e){return St(this).lte(St(e))}gt(e){return St(this).gt(St(e))}gte(e){return St(this).gte(St(e))}isNegative(){return this._hex[0]==="-"}isZero(){return St(this).isZero()}toNumber(){try{return St(this).toNumber()}catch{ms("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ga.throwError("this platform does not support BigInt",ge.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?N2||(N2=!0,Ga.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ga.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ge.errors.UNEXPECTED_ARGUMENT,{}):Ga.throwError("BigNumber.toString does not accept parameters",ge.errors.UNEXPECTED_ARGUMENT,{})),St(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(T_,am(e)):e.match(/^-?[0-9]+$/)?new Ge(T_,am(new xy(e))):Ga.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&ms("underflow","BigNumber.from",e),(e>=O2||e<=-O2)&&ms("overflow","BigNumber.from",e),Ge.from(String(e));const t=e;if(typeof t=="bigint")return Ge.from(t.toString());if(nx(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 Ga.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]==="-"&&Ga.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 vi(n){return Ge.from(am(n))}function St(n){const e=Ge.from(n).toHexString();return e[0]==="-"?new xy("-"+e.substring(3),16):new xy(e.substring(2),16)}function ms(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),Ga.throwError(n,ge.errors.NUMERIC_FAULT,r)}function oV(n){return new xy(n,36).toString(16)}const aV="properties/5.7.0";var lV=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 _y=new ge(aV);function Ue(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function es(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 tr(n){return lV(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 AV(n,e){(!n||typeof n!="object")&&_y.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||_y.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function En(n){const e={};for(const t in n)e[t]=n[t];return e}const cV={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function oN(n){if(n==null||cV[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;trs(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Ue(e,t,rs(r))}return e}return _y.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function rs(n){return uV(n)}class ng{constructor(e){for(const t in e)this[t]=rs(e[t])}}const fV="abstract-provider/5.7.0";var hV=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 dV=new ge(fV);class pV extends ng{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class rg{constructor(){dV.checkAbstract(new.target,rg),Ue(this,"_isProvider",!0)}getFeeData(){return hV(this,void 0,void 0,function*(){const{block:e,gasPrice:t}=yield tr({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 mV="networks/5.7.1",k2=new ge(mV);function gV(n){return n&&typeof n.renetwork=="function"}function Ka(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 Ka(t)},e}function by(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return by(n,r)},t}const Q2={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Ka("homestead")},H2={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Ka("ropsten")},z2={chainId:63,name:"classicMordor",_defaultProvider:by("https://www.ethercluster.com/mordor","classicMordor")},Dg={unspecified:{chainId:0,name:"unspecified"},homestead:Q2,mainnet:Q2,morden:{chainId:2,name:"morden"},ropsten:H2,testnet:H2,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Ka("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Ka("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Ka("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Ka("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:by("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:z2,classicTestnet:z2,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:by("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Ka("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Ka("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 aN(n){if(n==null)return null;if(typeof n=="number"){for(const r in Dg){const i=Dg[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=Dg[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=Dg[n.name];if(!e)return typeof n.chainId!="number"&&k2.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&k2.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(gV(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 lN(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,L){if(typeof v=="number")return this._initNumber(v,E,L);if(typeof v=="object")return this._initArray(v,E,L);E==="hex"&&(E=16),r(E===(E|0)&&E>=2&&E<=36),v=v.toString().replace(/\s+/g,"");var U=0;v[0]==="-"&&(U++,this.negative=1),U=0;U-=3)z=v[U]|v[U-1]<<8|v[U-2]<<16,this.words[P]|=z<>>26-W&67108863,W+=24,W>=26&&(W-=26,P++);else if(L==="le")for(U=0,P=0;U>>26-W&67108863,W+=24,W>=26&&(W-=26,P++);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 L=a(I,E);return E-1>=v&&(L|=a(I,E-1)<<4),L}s.prototype._parseHex=function(v,E,L){this.length=Math.ceil((v.length-E)/6),this.words=new Array(this.length);for(var U=0;U=E;U-=2)W=l(v,E,U)<=18?(P-=18,z+=1,this.words[z]|=W>>>26):P+=8;else{var N=v.length-E;for(U=N%2===0?E+1:E;U=18?(P-=18,z+=1,this.words[z]|=W>>>26):P+=8}this._strip()};function A(I,v,E,L){for(var U=0,P=0,z=Math.min(I.length,E),W=v;W=49?P=N-49+10:N>=17?P=N-17+10:P=N,r(N>=0&&P1&&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 L;if(v===16||v==="hex"){L="";for(var U=0,P=0,z=0;z>>24-U&16777215,U+=2,U>=26&&(U-=26,z--),P!==0||z!==this.length-1?L=f[6-N.length]+N+L:L=N+L}for(P!==0&&(L=P.toString(16)+L);L.length%E!==0;)L="0"+L;return this.negative!==0&&(L="-"+L),L}if(v===(v|0)&&v>=2&&v<=36){var C=h[v],j=p[v];L="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var F=ee.modrn(j).toString(v);ee=ee.idivn(j),ee.isZero()?L=F+L:L=f[C-F.length]+F+L}for(this.isZero()&&(L="0"+L);L.length%E!==0;)L="0"+L;return this.negative!==0&&(L="-"+L),L}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,L){this._strip();var U=this.byteLength(),P=L||Math.max(1,U);r(U<=P,"byte array longer than desired length"),r(P>0,"Requested array length <= 0");var z=d(v,P),W=E==="le"?"LE":"BE";return this["_toArrayLike"+W](z,U),z},s.prototype._toArrayLikeLE=function(v,E){for(var L=0,U=0,P=0,z=0;P>8&255),L>16&255),z===6?(L>24&255),U=0,z=0):(U=W>>>24,z+=2)}if(L=0&&(v[L--]=W>>8&255),L>=0&&(v[L--]=W>>16&255),z===6?(L>=0&&(v[L--]=W>>24&255),U=0,z=0):(U=W>>>24,z+=2)}if(L>=0)for(v[L--]=U;L>=0;)v[L--]=0},Math.clz32?s.prototype._countBits=function(v){return 32-Math.clz32(v)}:s.prototype._countBits=function(v){var E=v,L=0;return E>=4096&&(L+=13,E>>>=13),E>=64&&(L+=7,E>>>=7),E>=8&&(L+=4,E>>>=4),E>=2&&(L+=2,E>>>=2),L+E},s.prototype._zeroBits=function(v){if(v===0)return 26;var E=v,L=0;return E&8191||(L+=13,E>>>=13),E&127||(L+=7,E>>>=7),E&15||(L+=4,E>>>=4),E&3||(L+=2,E>>>=2),E&1||L++,L},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>>U&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 L=0;Lv.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,L;this.length>v.length?(E=this,L=v):(E=v,L=this);for(var U=0;Uv.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,L=v%26;this._expand(E),L>0&&E--;for(var U=0;U0&&(this.words[U]=~this.words[U]&67108863>>26-L),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 L=v/26|0,U=v%26;return this._expand(L+1),E?this.words[L]=this.words[L]|1<v.length?(L=this,U=v):(L=v,U=this);for(var P=0,z=0;z>>26;for(;P!==0&&z>>26;if(this.length=L.length,P!==0)this.words[this.length]=P,this.length++;else if(L!==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 L=this.cmp(v);if(L===0)return this.negative=0,this.length=1,this.words[0]=0,this;var U,P;L>0?(U=this,P=v):(U=v,P=this);for(var z=0,W=0;W>26,this.words[W]=E&67108863;for(;z!==0&&W>26,this.words[W]=E&67108863;if(z===0&&W>>26,ee=N&67108863,F=Math.min(C,v.length-1),X=Math.max(0,C-I.length+1);X<=F;X++){var ue=C-X|0;U=I.words[ue]|0,P=v.words[X]|0,z=U*P+ee,j+=z/67108864|0,ee=z&67108863}E.words[C]=ee|0,N=j|0}return N!==0?E.words[C]=N|0:E.length--,E._strip()}var y=function(v,E,L){var U=v.words,P=E.words,z=L.words,W=0,N,C,j,ee=U[0]|0,F=ee&8191,X=ee>>>13,ue=U[1]|0,re=ue&8191,fe=ue>>>13,oe=U[2]|0,pe=oe&8191,xe=oe>>>13,_e=U[3]|0,D=_e&8191,Ae=_e>>>13,le=U[4]|0,q=le&8191,J=le>>>13,ce=U[5]|0,be=ce&8191,Be=ce>>>13,Q=U[6]|0,K=Q&8191,ie=Q>>>13,de=U[7]|0,me=de&8191,G=de>>>13,R=U[8]|0,S=R&8191,V=R>>>13,te=U[9]|0,ae=te&8191,se=te>>>13,Ie=P[0]|0,Te=Ie&8191,Le=Ie>>>13,He=P[1]|0,De=He&8191,he=He>>>13,Me=P[2]|0,Se=Me&8191,Fe=Me>>>13,Ve=P[3]|0,Je=Ve&8191,ft=Ve>>>13,an=P[4]|0,Ct=an&8191,it=an>>>13,lr=P[5]|0,yt=lr&8191,jt=lr>>>13,Zs=P[6]|0,Zt=Zs&8191,Jt=Zs>>>13,ne=P[7]|0,ve=ne&8191,Ee=ne>>>13,we=P[8]|0,Ce=we&8191,ze=we>>>13,st=P[9]|0,Xe=st&8191,$e=st>>>13;L.negative=v.negative^E.negative,L.length=19,N=Math.imul(F,Te),C=Math.imul(F,Le),C=C+Math.imul(X,Te)|0,j=Math.imul(X,Le);var gt=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(gt>>>26)|0,gt&=67108863,N=Math.imul(re,Te),C=Math.imul(re,Le),C=C+Math.imul(fe,Te)|0,j=Math.imul(fe,Le),N=N+Math.imul(F,De)|0,C=C+Math.imul(F,he)|0,C=C+Math.imul(X,De)|0,j=j+Math.imul(X,he)|0;var dt=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(dt>>>26)|0,dt&=67108863,N=Math.imul(pe,Te),C=Math.imul(pe,Le),C=C+Math.imul(xe,Te)|0,j=Math.imul(xe,Le),N=N+Math.imul(re,De)|0,C=C+Math.imul(re,he)|0,C=C+Math.imul(fe,De)|0,j=j+Math.imul(fe,he)|0,N=N+Math.imul(F,Se)|0,C=C+Math.imul(F,Fe)|0,C=C+Math.imul(X,Se)|0,j=j+Math.imul(X,Fe)|0;var ct=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(ct>>>26)|0,ct&=67108863,N=Math.imul(D,Te),C=Math.imul(D,Le),C=C+Math.imul(Ae,Te)|0,j=Math.imul(Ae,Le),N=N+Math.imul(pe,De)|0,C=C+Math.imul(pe,he)|0,C=C+Math.imul(xe,De)|0,j=j+Math.imul(xe,he)|0,N=N+Math.imul(re,Se)|0,C=C+Math.imul(re,Fe)|0,C=C+Math.imul(fe,Se)|0,j=j+Math.imul(fe,Fe)|0,N=N+Math.imul(F,Je)|0,C=C+Math.imul(F,ft)|0,C=C+Math.imul(X,Je)|0,j=j+Math.imul(X,ft)|0;var Wt=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,N=Math.imul(q,Te),C=Math.imul(q,Le),C=C+Math.imul(J,Te)|0,j=Math.imul(J,Le),N=N+Math.imul(D,De)|0,C=C+Math.imul(D,he)|0,C=C+Math.imul(Ae,De)|0,j=j+Math.imul(Ae,he)|0,N=N+Math.imul(pe,Se)|0,C=C+Math.imul(pe,Fe)|0,C=C+Math.imul(xe,Se)|0,j=j+Math.imul(xe,Fe)|0,N=N+Math.imul(re,Je)|0,C=C+Math.imul(re,ft)|0,C=C+Math.imul(fe,Je)|0,j=j+Math.imul(fe,ft)|0,N=N+Math.imul(F,Ct)|0,C=C+Math.imul(F,it)|0,C=C+Math.imul(X,Ct)|0,j=j+Math.imul(X,it)|0;var vn=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(vn>>>26)|0,vn&=67108863,N=Math.imul(be,Te),C=Math.imul(be,Le),C=C+Math.imul(Be,Te)|0,j=Math.imul(Be,Le),N=N+Math.imul(q,De)|0,C=C+Math.imul(q,he)|0,C=C+Math.imul(J,De)|0,j=j+Math.imul(J,he)|0,N=N+Math.imul(D,Se)|0,C=C+Math.imul(D,Fe)|0,C=C+Math.imul(Ae,Se)|0,j=j+Math.imul(Ae,Fe)|0,N=N+Math.imul(pe,Je)|0,C=C+Math.imul(pe,ft)|0,C=C+Math.imul(xe,Je)|0,j=j+Math.imul(xe,ft)|0,N=N+Math.imul(re,Ct)|0,C=C+Math.imul(re,it)|0,C=C+Math.imul(fe,Ct)|0,j=j+Math.imul(fe,it)|0,N=N+Math.imul(F,yt)|0,C=C+Math.imul(F,jt)|0,C=C+Math.imul(X,yt)|0,j=j+Math.imul(X,jt)|0;var Hr=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(Hr>>>26)|0,Hr&=67108863,N=Math.imul(K,Te),C=Math.imul(K,Le),C=C+Math.imul(ie,Te)|0,j=Math.imul(ie,Le),N=N+Math.imul(be,De)|0,C=C+Math.imul(be,he)|0,C=C+Math.imul(Be,De)|0,j=j+Math.imul(Be,he)|0,N=N+Math.imul(q,Se)|0,C=C+Math.imul(q,Fe)|0,C=C+Math.imul(J,Se)|0,j=j+Math.imul(J,Fe)|0,N=N+Math.imul(D,Je)|0,C=C+Math.imul(D,ft)|0,C=C+Math.imul(Ae,Je)|0,j=j+Math.imul(Ae,ft)|0,N=N+Math.imul(pe,Ct)|0,C=C+Math.imul(pe,it)|0,C=C+Math.imul(xe,Ct)|0,j=j+Math.imul(xe,it)|0,N=N+Math.imul(re,yt)|0,C=C+Math.imul(re,jt)|0,C=C+Math.imul(fe,yt)|0,j=j+Math.imul(fe,jt)|0,N=N+Math.imul(F,Zt)|0,C=C+Math.imul(F,Jt)|0,C=C+Math.imul(X,Zt)|0,j=j+Math.imul(X,Jt)|0;var ki=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(ki>>>26)|0,ki&=67108863,N=Math.imul(me,Te),C=Math.imul(me,Le),C=C+Math.imul(G,Te)|0,j=Math.imul(G,Le),N=N+Math.imul(K,De)|0,C=C+Math.imul(K,he)|0,C=C+Math.imul(ie,De)|0,j=j+Math.imul(ie,he)|0,N=N+Math.imul(be,Se)|0,C=C+Math.imul(be,Fe)|0,C=C+Math.imul(Be,Se)|0,j=j+Math.imul(Be,Fe)|0,N=N+Math.imul(q,Je)|0,C=C+Math.imul(q,ft)|0,C=C+Math.imul(J,Je)|0,j=j+Math.imul(J,ft)|0,N=N+Math.imul(D,Ct)|0,C=C+Math.imul(D,it)|0,C=C+Math.imul(Ae,Ct)|0,j=j+Math.imul(Ae,it)|0,N=N+Math.imul(pe,yt)|0,C=C+Math.imul(pe,jt)|0,C=C+Math.imul(xe,yt)|0,j=j+Math.imul(xe,jt)|0,N=N+Math.imul(re,Zt)|0,C=C+Math.imul(re,Jt)|0,C=C+Math.imul(fe,Zt)|0,j=j+Math.imul(fe,Jt)|0,N=N+Math.imul(F,ve)|0,C=C+Math.imul(F,Ee)|0,C=C+Math.imul(X,ve)|0,j=j+Math.imul(X,Ee)|0;var yn=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(yn>>>26)|0,yn&=67108863,N=Math.imul(S,Te),C=Math.imul(S,Le),C=C+Math.imul(V,Te)|0,j=Math.imul(V,Le),N=N+Math.imul(me,De)|0,C=C+Math.imul(me,he)|0,C=C+Math.imul(G,De)|0,j=j+Math.imul(G,he)|0,N=N+Math.imul(K,Se)|0,C=C+Math.imul(K,Fe)|0,C=C+Math.imul(ie,Se)|0,j=j+Math.imul(ie,Fe)|0,N=N+Math.imul(be,Je)|0,C=C+Math.imul(be,ft)|0,C=C+Math.imul(Be,Je)|0,j=j+Math.imul(Be,ft)|0,N=N+Math.imul(q,Ct)|0,C=C+Math.imul(q,it)|0,C=C+Math.imul(J,Ct)|0,j=j+Math.imul(J,it)|0,N=N+Math.imul(D,yt)|0,C=C+Math.imul(D,jt)|0,C=C+Math.imul(Ae,yt)|0,j=j+Math.imul(Ae,jt)|0,N=N+Math.imul(pe,Zt)|0,C=C+Math.imul(pe,Jt)|0,C=C+Math.imul(xe,Zt)|0,j=j+Math.imul(xe,Jt)|0,N=N+Math.imul(re,ve)|0,C=C+Math.imul(re,Ee)|0,C=C+Math.imul(fe,ve)|0,j=j+Math.imul(fe,Ee)|0,N=N+Math.imul(F,Ce)|0,C=C+Math.imul(F,ze)|0,C=C+Math.imul(X,Ce)|0,j=j+Math.imul(X,ze)|0;var bt=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(bt>>>26)|0,bt&=67108863,N=Math.imul(ae,Te),C=Math.imul(ae,Le),C=C+Math.imul(se,Te)|0,j=Math.imul(se,Le),N=N+Math.imul(S,De)|0,C=C+Math.imul(S,he)|0,C=C+Math.imul(V,De)|0,j=j+Math.imul(V,he)|0,N=N+Math.imul(me,Se)|0,C=C+Math.imul(me,Fe)|0,C=C+Math.imul(G,Se)|0,j=j+Math.imul(G,Fe)|0,N=N+Math.imul(K,Je)|0,C=C+Math.imul(K,ft)|0,C=C+Math.imul(ie,Je)|0,j=j+Math.imul(ie,ft)|0,N=N+Math.imul(be,Ct)|0,C=C+Math.imul(be,it)|0,C=C+Math.imul(Be,Ct)|0,j=j+Math.imul(Be,it)|0,N=N+Math.imul(q,yt)|0,C=C+Math.imul(q,jt)|0,C=C+Math.imul(J,yt)|0,j=j+Math.imul(J,jt)|0,N=N+Math.imul(D,Zt)|0,C=C+Math.imul(D,Jt)|0,C=C+Math.imul(Ae,Zt)|0,j=j+Math.imul(Ae,Jt)|0,N=N+Math.imul(pe,ve)|0,C=C+Math.imul(pe,Ee)|0,C=C+Math.imul(xe,ve)|0,j=j+Math.imul(xe,Ee)|0,N=N+Math.imul(re,Ce)|0,C=C+Math.imul(re,ze)|0,C=C+Math.imul(fe,Ce)|0,j=j+Math.imul(fe,ze)|0,N=N+Math.imul(F,Xe)|0,C=C+Math.imul(F,$e)|0,C=C+Math.imul(X,Xe)|0,j=j+Math.imul(X,$e)|0;var $A=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+($A>>>26)|0,$A&=67108863,N=Math.imul(ae,De),C=Math.imul(ae,he),C=C+Math.imul(se,De)|0,j=Math.imul(se,he),N=N+Math.imul(S,Se)|0,C=C+Math.imul(S,Fe)|0,C=C+Math.imul(V,Se)|0,j=j+Math.imul(V,Fe)|0,N=N+Math.imul(me,Je)|0,C=C+Math.imul(me,ft)|0,C=C+Math.imul(G,Je)|0,j=j+Math.imul(G,ft)|0,N=N+Math.imul(K,Ct)|0,C=C+Math.imul(K,it)|0,C=C+Math.imul(ie,Ct)|0,j=j+Math.imul(ie,it)|0,N=N+Math.imul(be,yt)|0,C=C+Math.imul(be,jt)|0,C=C+Math.imul(Be,yt)|0,j=j+Math.imul(Be,jt)|0,N=N+Math.imul(q,Zt)|0,C=C+Math.imul(q,Jt)|0,C=C+Math.imul(J,Zt)|0,j=j+Math.imul(J,Jt)|0,N=N+Math.imul(D,ve)|0,C=C+Math.imul(D,Ee)|0,C=C+Math.imul(Ae,ve)|0,j=j+Math.imul(Ae,Ee)|0,N=N+Math.imul(pe,Ce)|0,C=C+Math.imul(pe,ze)|0,C=C+Math.imul(xe,Ce)|0,j=j+Math.imul(xe,ze)|0,N=N+Math.imul(re,Xe)|0,C=C+Math.imul(re,$e)|0,C=C+Math.imul(fe,Xe)|0,j=j+Math.imul(fe,$e)|0;var Ln=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,N=Math.imul(ae,Se),C=Math.imul(ae,Fe),C=C+Math.imul(se,Se)|0,j=Math.imul(se,Fe),N=N+Math.imul(S,Je)|0,C=C+Math.imul(S,ft)|0,C=C+Math.imul(V,Je)|0,j=j+Math.imul(V,ft)|0,N=N+Math.imul(me,Ct)|0,C=C+Math.imul(me,it)|0,C=C+Math.imul(G,Ct)|0,j=j+Math.imul(G,it)|0,N=N+Math.imul(K,yt)|0,C=C+Math.imul(K,jt)|0,C=C+Math.imul(ie,yt)|0,j=j+Math.imul(ie,jt)|0,N=N+Math.imul(be,Zt)|0,C=C+Math.imul(be,Jt)|0,C=C+Math.imul(Be,Zt)|0,j=j+Math.imul(Be,Jt)|0,N=N+Math.imul(q,ve)|0,C=C+Math.imul(q,Ee)|0,C=C+Math.imul(J,ve)|0,j=j+Math.imul(J,Ee)|0,N=N+Math.imul(D,Ce)|0,C=C+Math.imul(D,ze)|0,C=C+Math.imul(Ae,Ce)|0,j=j+Math.imul(Ae,ze)|0,N=N+Math.imul(pe,Xe)|0,C=C+Math.imul(pe,$e)|0,C=C+Math.imul(xe,Xe)|0,j=j+Math.imul(xe,$e)|0;var Js=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(Js>>>26)|0,Js&=67108863,N=Math.imul(ae,Je),C=Math.imul(ae,ft),C=C+Math.imul(se,Je)|0,j=Math.imul(se,ft),N=N+Math.imul(S,Ct)|0,C=C+Math.imul(S,it)|0,C=C+Math.imul(V,Ct)|0,j=j+Math.imul(V,it)|0,N=N+Math.imul(me,yt)|0,C=C+Math.imul(me,jt)|0,C=C+Math.imul(G,yt)|0,j=j+Math.imul(G,jt)|0,N=N+Math.imul(K,Zt)|0,C=C+Math.imul(K,Jt)|0,C=C+Math.imul(ie,Zt)|0,j=j+Math.imul(ie,Jt)|0,N=N+Math.imul(be,ve)|0,C=C+Math.imul(be,Ee)|0,C=C+Math.imul(Be,ve)|0,j=j+Math.imul(Be,Ee)|0,N=N+Math.imul(q,Ce)|0,C=C+Math.imul(q,ze)|0,C=C+Math.imul(J,Ce)|0,j=j+Math.imul(J,ze)|0,N=N+Math.imul(D,Xe)|0,C=C+Math.imul(D,$e)|0,C=C+Math.imul(Ae,Xe)|0,j=j+Math.imul(Ae,$e)|0;var du=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(du>>>26)|0,du&=67108863,N=Math.imul(ae,Ct),C=Math.imul(ae,it),C=C+Math.imul(se,Ct)|0,j=Math.imul(se,it),N=N+Math.imul(S,yt)|0,C=C+Math.imul(S,jt)|0,C=C+Math.imul(V,yt)|0,j=j+Math.imul(V,jt)|0,N=N+Math.imul(me,Zt)|0,C=C+Math.imul(me,Jt)|0,C=C+Math.imul(G,Zt)|0,j=j+Math.imul(G,Jt)|0,N=N+Math.imul(K,ve)|0,C=C+Math.imul(K,Ee)|0,C=C+Math.imul(ie,ve)|0,j=j+Math.imul(ie,Ee)|0,N=N+Math.imul(be,Ce)|0,C=C+Math.imul(be,ze)|0,C=C+Math.imul(Be,Ce)|0,j=j+Math.imul(Be,ze)|0,N=N+Math.imul(q,Xe)|0,C=C+Math.imul(q,$e)|0,C=C+Math.imul(J,Xe)|0,j=j+Math.imul(J,$e)|0;var Ca=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(Ca>>>26)|0,Ca&=67108863,N=Math.imul(ae,yt),C=Math.imul(ae,jt),C=C+Math.imul(se,yt)|0,j=Math.imul(se,jt),N=N+Math.imul(S,Zt)|0,C=C+Math.imul(S,Jt)|0,C=C+Math.imul(V,Zt)|0,j=j+Math.imul(V,Jt)|0,N=N+Math.imul(me,ve)|0,C=C+Math.imul(me,Ee)|0,C=C+Math.imul(G,ve)|0,j=j+Math.imul(G,Ee)|0,N=N+Math.imul(K,Ce)|0,C=C+Math.imul(K,ze)|0,C=C+Math.imul(ie,Ce)|0,j=j+Math.imul(ie,ze)|0,N=N+Math.imul(be,Xe)|0,C=C+Math.imul(be,$e)|0,C=C+Math.imul(Be,Xe)|0,j=j+Math.imul(Be,$e)|0;var ZA=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(ZA>>>26)|0,ZA&=67108863,N=Math.imul(ae,Zt),C=Math.imul(ae,Jt),C=C+Math.imul(se,Zt)|0,j=Math.imul(se,Jt),N=N+Math.imul(S,ve)|0,C=C+Math.imul(S,Ee)|0,C=C+Math.imul(V,ve)|0,j=j+Math.imul(V,Ee)|0,N=N+Math.imul(me,Ce)|0,C=C+Math.imul(me,ze)|0,C=C+Math.imul(G,Ce)|0,j=j+Math.imul(G,ze)|0,N=N+Math.imul(K,Xe)|0,C=C+Math.imul(K,$e)|0,C=C+Math.imul(ie,Xe)|0,j=j+Math.imul(ie,$e)|0;var Ar=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(Ar>>>26)|0,Ar&=67108863,N=Math.imul(ae,ve),C=Math.imul(ae,Ee),C=C+Math.imul(se,ve)|0,j=Math.imul(se,Ee),N=N+Math.imul(S,Ce)|0,C=C+Math.imul(S,ze)|0,C=C+Math.imul(V,Ce)|0,j=j+Math.imul(V,ze)|0,N=N+Math.imul(me,Xe)|0,C=C+Math.imul(me,$e)|0,C=C+Math.imul(G,Xe)|0,j=j+Math.imul(G,$e)|0;var qs=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(qs>>>26)|0,qs&=67108863,N=Math.imul(ae,Ce),C=Math.imul(ae,ze),C=C+Math.imul(se,Ce)|0,j=Math.imul(se,ze),N=N+Math.imul(S,Xe)|0,C=C+Math.imul(S,$e)|0,C=C+Math.imul(V,Xe)|0,j=j+Math.imul(V,$e)|0;var JA=(W+N|0)+((C&8191)<<13)|0;W=(j+(C>>>13)|0)+(JA>>>26)|0,JA&=67108863,N=Math.imul(ae,Xe),C=Math.imul(ae,$e),C=C+Math.imul(se,Xe)|0,j=Math.imul(se,$e);var Tr=(W+N|0)+((C&8191)<<13)|0;return W=(j+(C>>>13)|0)+(Tr>>>26)|0,Tr&=67108863,z[0]=gt,z[1]=dt,z[2]=ct,z[3]=Wt,z[4]=vn,z[5]=Hr,z[6]=ki,z[7]=yn,z[8]=bt,z[9]=$A,z[10]=Ln,z[11]=Js,z[12]=du,z[13]=Ca,z[14]=ZA,z[15]=Ar,z[16]=qs,z[17]=JA,z[18]=Tr,W!==0&&(z[19]=W,L.length++),L};Math.imul||(y=m);function w(I,v,E){E.negative=v.negative^I.negative,E.length=I.length+v.length;for(var L=0,U=0,P=0;P>>26)|0,U+=z>>>26,z&=67108863}E.words[P]=W,L=z,z=U}return L!==0?E.words[P]=L:E.length--,E._strip()}function x(I,v,E){return w(I,v,E)}s.prototype.mulTo=function(v,E){var L,U=this.length+v.length;return this.length===10&&v.length===10?L=y(this,v,E):U<63?L=m(this,v,E):U<1024?L=w(this,v,E):L=x(this,v,E),L},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 L=0,U=0;U>=26,L+=P/67108864|0,L+=z>>>26,this.words[U]=z&67108863}return L!==0&&(this.words[U]=L,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 L=this,U=0;U=0);var E=v%26,L=(v-E)/26,U=67108863>>>26-E<<26-E,P;if(E!==0){var z=0;for(P=0;P>>26-E}z&&(this.words[P]=z,this.length++)}if(L!==0){for(P=this.length-1;P>=0;P--)this.words[P+L]=this.words[P];for(P=0;P=0);var U;E?U=(E-E%26)/26:U=0;var P=v%26,z=Math.min((v-P)/26,this.length),W=67108863^67108863>>>P<z)for(this.length-=z,C=0;C=0&&(j!==0||C>=U);C--){var ee=this.words[C]|0;this.words[C]=j<<26-P|ee>>>P,j=ee&W}return N&&j!==0&&(N.words[N.length++]=j),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(v,E,L){return r(this.negative===0),this.iushrn(v,E,L)},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,L=(v-E)/26,U=1<=0);var E=v%26,L=(v-E)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=L)return this;if(E!==0&&L++,this.length=Math.min(L,this.length),E!==0){var U=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)-(N/67108864|0),this.words[P+L]=z&67108863}for(;P>26,this.words[P+L]=z&67108863;if(W===0)return this._strip();for(r(W===-1),W=0,P=0;P>26,this.words[P]=z&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(v,E){var L=this.length-v.length,U=this.clone(),P=v,z=P.words[P.length-1]|0,W=this._countBits(z);L=26-W,L!==0&&(P=P.ushln(L),U.iushln(L),z=P.words[P.length-1]|0);var N=U.length-P.length,C;if(E!=="mod"){C=new s(null),C.length=N+1,C.words=new Array(C.length);for(var j=0;j=0;F--){var X=(U.words[P.length+F]|0)*67108864+(U.words[P.length+F-1]|0);for(X=Math.min(X/z|0,67108863),U._ishlnsubmul(P,X,F);U.negative!==0;)X--,U.negative=0,U._ishlnsubmul(P,1,F),U.isZero()||(U.negative^=1);C&&(C.words[F]=X)}return C&&C._strip(),U._strip(),E!=="div"&&L!==0&&U.iushrn(L),{div:C||null,mod:U}},s.prototype.divmod=function(v,E,L){if(r(!v.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var U,P,z;return this.negative!==0&&v.negative===0?(z=this.neg().divmod(v,E),E!=="mod"&&(U=z.div.neg()),E!=="div"&&(P=z.mod.neg(),L&&P.negative!==0&&P.iadd(v)),{div:U,mod:P}):this.negative===0&&v.negative!==0?(z=this.divmod(v.neg(),E),E!=="mod"&&(U=z.div.neg()),{div:U,mod:z.mod}):this.negative&v.negative?(z=this.neg().divmod(v.neg(),E),E!=="div"&&(P=z.mod.neg(),L&&P.negative!==0&&P.isub(v)),{div:z.div,mod:P}):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 L=E.div.negative!==0?E.mod.isub(v):E.mod,U=v.ushrn(1),P=v.andln(1),z=L.cmp(U);return z<0||P===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 L=(1<<26)%v,U=0,P=this.length-1;P>=0;P--)U=(L*U+(this.words[P]|0))%v;return E?-U:U},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 L=0,U=this.length-1;U>=0;U--){var P=(this.words[U]|0)+L*67108864;this.words[U]=P/v|0,L=P%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,L=v.clone();E.negative!==0?E=E.umod(v):E=E.clone();for(var U=new s(1),P=new s(0),z=new s(0),W=new s(1),N=0;E.isEven()&&L.isEven();)E.iushrn(1),L.iushrn(1),++N;for(var C=L.clone(),j=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;)(U.isOdd()||P.isOdd())&&(U.iadd(C),P.isub(j)),U.iushrn(1),P.iushrn(1);for(var X=0,ue=1;!(L.words[0]&ue)&&X<26;++X,ue<<=1);if(X>0)for(L.iushrn(X);X-- >0;)(z.isOdd()||W.isOdd())&&(z.iadd(C),W.isub(j)),z.iushrn(1),W.iushrn(1);E.cmp(L)>=0?(E.isub(L),U.isub(z),P.isub(W)):(L.isub(E),z.isub(U),W.isub(P))}return{a:z,b:W,gcd:L.iushln(N)}},s.prototype._invmp=function(v){r(v.negative===0),r(!v.isZero());var E=this,L=v.clone();E.negative!==0?E=E.umod(v):E=E.clone();for(var U=new s(1),P=new s(0),z=L.clone();E.cmpn(1)>0&&L.cmpn(1)>0;){for(var W=0,N=1;!(E.words[0]&N)&&W<26;++W,N<<=1);if(W>0)for(E.iushrn(W);W-- >0;)U.isOdd()&&U.iadd(z),U.iushrn(1);for(var C=0,j=1;!(L.words[0]&j)&&C<26;++C,j<<=1);if(C>0)for(L.iushrn(C);C-- >0;)P.isOdd()&&P.iadd(z),P.iushrn(1);E.cmp(L)>=0?(E.isub(L),U.isub(P)):(L.isub(E),P.isub(U))}var ee;return E.cmpn(1)===0?ee=U:ee=P,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(),L=v.clone();E.negative=0,L.negative=0;for(var U=0;E.isEven()&&L.isEven();U++)E.iushrn(1),L.iushrn(1);do{for(;E.isEven();)E.iushrn(1);for(;L.isEven();)L.iushrn(1);var P=E.cmp(L);if(P<0){var z=E;E=L,L=z}else if(P===0||L.cmpn(1)===0)break;E.isub(L)}while(!0);return L.iushln(U)},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,L=(v-E)/26,U=1<>>26,W&=67108863,this.words[z]=W}return P!==0&&(this.words[z]=P,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 L;if(this.length>1)L=1;else{E&&(v=-v),r(v<=67108863,"Number is too big");var U=this.words[0]|0;L=U===v?0:Uv.length)return 1;if(this.length=0;L--){var U=this.words[L]|0,P=v.words[L]|0;if(U!==P){UP&&(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 Y(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 B(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()}B.prototype._tmp=function(){var v=new s(null);return v.words=new Array(Math.ceil(this.n/13)),v},B.prototype.ireduce=function(v){var E=v,L;do this.split(E,this.tmp),E=this.imulK(E),E=E.iadd(this.tmp),L=E.bitLength();while(L>this.n);var U=L0?E.isub(this.p):E.strip!==void 0?E.strip():E._strip(),E},B.prototype.split=function(v,E){v.iushrn(this.n,0,E)},B.prototype.imulK=function(v){return v.imul(this.k)};function T(){B.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(T,B),T.prototype.split=function(v,E){for(var L=4194303,U=Math.min(v.length,9),P=0;P>>22,z=W}z>>>=22,v.words[P-10]=z,z===0&&v.length>10?v.length-=10:v.length-=9},T.prototype.imulK=function(v){v.words[v.length]=0,v.words[v.length+1]=0,v.length+=2;for(var E=0,L=0;L>>=26,v.words[L]=P,E=U}return E!==0&&(v.words[v.length++]=E),v},s._prime=function(v){if(_[v])return _[v];var E;if(v==="k256")E=new T;else if(v==="p224")E=new b;else if(v==="p192")E=new M;else if(v==="p25519")E=new O;else throw new Error("Unknown prime "+v);return _[v]=E,E};function Y(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}Y.prototype._verify1=function(v){r(v.negative===0,"red works only with positives"),r(v.red,"red works only with red numbers")},Y.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")},Y.prototype.imod=function(v){return this.prime?this.prime.ireduce(v)._forceRed(this):(c(v,v.umod(this.m)._forceRed(this)),v)},Y.prototype.neg=function(v){return v.isZero()?v.clone():this.m.sub(v)._forceRed(this)},Y.prototype.add=function(v,E){this._verify2(v,E);var L=v.add(E);return L.cmp(this.m)>=0&&L.isub(this.m),L._forceRed(this)},Y.prototype.iadd=function(v,E){this._verify2(v,E);var L=v.iadd(E);return L.cmp(this.m)>=0&&L.isub(this.m),L},Y.prototype.sub=function(v,E){this._verify2(v,E);var L=v.sub(E);return L.cmpn(0)<0&&L.iadd(this.m),L._forceRed(this)},Y.prototype.isub=function(v,E){this._verify2(v,E);var L=v.isub(E);return L.cmpn(0)<0&&L.iadd(this.m),L},Y.prototype.shl=function(v,E){return this._verify1(v),this.imod(v.ushln(E))},Y.prototype.imul=function(v,E){return this._verify2(v,E),this.imod(v.imul(E))},Y.prototype.mul=function(v,E){return this._verify2(v,E),this.imod(v.mul(E))},Y.prototype.isqr=function(v){return this.imul(v,v.clone())},Y.prototype.sqr=function(v){return this.mul(v,v)},Y.prototype.sqrt=function(v){if(v.isZero())return v.clone();var E=this.m.andln(3);if(r(E%2===1),E===3){var L=this.m.add(new s(1)).iushrn(2);return this.pow(v,L)}for(var U=this.m.subn(1),P=0;!U.isZero()&&U.andln(1)===0;)P++,U.iushrn(1);r(!U.isZero());var z=new s(1).toRed(this),W=z.redNeg(),N=this.m.subn(1).iushrn(1),C=this.m.bitLength();for(C=new s(2*C*C).toRed(this);this.pow(C,N).cmp(W)!==0;)C.redIAdd(W);for(var j=this.pow(C,U),ee=this.pow(v,U.addn(1).iushrn(1)),F=this.pow(v,U),X=P;F.cmp(z)!==0;){for(var ue=F,re=0;ue.cmp(z)!==0;re++)ue=ue.redSqr();r(re=0;P--){for(var j=E.words[P],ee=C-1;ee>=0;ee--){var F=j>>ee&1;if(z!==U[0]&&(z=this.sqr(z)),F===0&&W===0){N=0;continue}W<<=1,W|=F,N++,!(N!==L&&(P!==0||ee!==0))&&(z=this.mul(z,U[W]),N=0,W=0)}C=26}return z},Y.prototype.convertTo=function(v){var E=v.umod(this.m);return E===v?E.clone():E},Y.prototype.convertFrom=function(v){var E=v.clone();return E.red=null,E},s.mont=function(v){return new H(v)};function H(I){Y.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,Y),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 L=v.imul(E),U=L.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),P=L.isub(U).iushrn(this.shift),z=P;return P.cmp(this.m)>=0?z=P.isub(this.m):P.cmpn(0)<0&&(z=P.iadd(this.m)),z._forceRed(this)},H.prototype.mul=function(v,E){if(v.isZero()||E.isZero())return new s(0)._forceRed(this);var L=v.mul(E),U=L.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),P=L.isub(U).iushrn(this.shift),z=P;return P.cmp(this.m)>=0?z=P.isub(this.m):P.cmpn(0)<0&&(z=P.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,qo)})(BM);var eV=BM.exports;const vt=bl(eV),tV="logger/5.7.0";let F2=!1,U2=!1;const Uv={debug:1,default:2,info:2,warning:3,error:4,off:5};let L2=Uv.default,S_=null;function nV(){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 P2=nV();var IB;(function(n){n.DEBUG="DEBUG",n.INFO="INFO",n.WARNING="WARNING",n.ERROR="ERROR",n.OFF="OFF"})(IB||(IB={}));var fo;(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"})(fo||(fo={}));const D2="0123456789abcdef";let ge=class ur{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const r=e.toLowerCase();Uv[r]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(L2>Uv[r])&&console.log.apply(console,t)}debug(...e){this._log(ur.levels.DEBUG,e)}info(...e){this._log(ur.levels.INFO,e)}warn(...e){this._log(ur.levels.WARNING,e)}makeError(e,t,r){if(U2)return this.makeError("censored error",t,{});t||(t=ur.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+=D2[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 fo.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 fo.CALL_EXCEPTION:case fo.INSUFFICIENT_FUNDS:case fo.MISSING_NEW:case fo.NONCE_EXPIRED:case fo.REPLACEMENT_UNDERPRICED:case fo.TRANSACTION_REPLACED:case fo.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,ur.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){P2&&this.throwError("platform missing String.prototype.normalize",ur.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:P2})}checkSafeUint53(e,t){typeof e=="number"&&(t==null&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,ur.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,ur.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,ur.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){(e===Object||e==null)&&this.throwError("missing new",ur.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",ur.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",ur.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return S_||(S_=new ur(tV)),S_}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",ur.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),F2){if(!e)return;this.globalLogger().throwError("error censorship permanent",ur.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}U2=!!e,F2=!!t}static setLogLevel(e){const t=Uv[e.toLowerCase()];if(t==null){ur.globalLogger().warn("invalid log level - "+e);return}L2=t}static from(e){return new ur(e)}};ge.errors=fo;ge.levels=IB;const rV="bytes/5.7.0",Dn=new ge(rV);function oN(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 EM(n){return Et(n)&&!(n.length%2)||rx(n)}function O2(n){return typeof n=="number"&&n==n&&n%1===0}function rx(n){if(n==null)return!1;if(n.constructor===Uint8Array)return!0;if(typeof n=="string"||!O2(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"){Dn.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),oN(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":Dn.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 dh(n){let e=at(n);if(e.length===0)return e;let t=0;for(;te&&Dn.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 T_="0123456789abcdef";function nt(n,e){if(e||(e={}),typeof n=="number"){Dn.checkSafeUint53(n,"invalid hexlify value");let t="";for(;n;)t=T_[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),oN(n))return n.toHexString();if(Et(n))return n.length%2&&(e.hexPad==="left"?n="0x0"+n.substring(2):e.hexPad==="right"?n+="0":Dn.throwArgumentError("hex data is odd-length","value",n)),n.toLowerCase();if(rx(n)){let t="0x";for(let r=0;r>4]+T_[i&15]}return t}return Dn.throwArgumentError("invalid hexlify value","value",n)}function Pc(n){if(typeof n!="string")n=nt(n);else if(!Et(n)||n.length%2)return null;return(n.length-2)/2}function jr(n,e,t){return typeof n!="string"?n=nt(n):(!Et(n)||n.length%2)&&Dn.throwArgumentError("invalid hexData","value",n),e=2+2*e,t!=null?"0x"+n.substring(e,2+2*t):"0x"+n.substring(e)}function Bi(n){let e="0x";return n.forEach(t=>{e+=nt(t).substring(2)}),e}function ix(n){const e=sV(nt(n,{hexPad:"left"}));return e==="0x"?"0x0":e}function sV(n){typeof n!="string"&&(n=nt(n)),Et(n)||Dn.throwArgumentError("invalid hex string","value",n),n=n.substring(2);let e=0;for(;e2*e+2&&Dn.throwArgumentError("value out of range","value",arguments[1]);n.length<2*e+2;)n="0x0"+n.substring(2);return n}function sx(n){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(EM(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]):Dn.throwArgumentError("invalid signature string","signature",n),e.v<27&&(e.v===0||e.v===1?e.v+=27:Dn.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=iV(at(e._vs),32);e._vs=nt(i);const s=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=s:e.recoveryParam!==s&&Dn.throwArgumentError("signature recoveryParam mismatch _vs","signature",n),i[0]&=127;const o=nt(i);e.s==null?e.s=o:e.s!==o&&Dn.throwArgumentError("signature v mismatch _vs","signature",n)}if(e.recoveryParam==null)e.v==null?Dn.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&&Dn.throwArgumentError("signature recoveryParam mismatch v","signature",n)}e.r==null||!Et(e.r)?Dn.throwArgumentError("signature missing or invalid r","signature",n):e.r=Qn(e.r,32),e.s==null||!Et(e.s)?Dn.throwArgumentError("signature missing or invalid s","signature",n):e.s=Qn(e.s,32);const t=at(e.s);t[0]>=128&&Dn.throwArgumentError("signature s out of range","signature",n),e.recoveryParam&&(t[0]|=128);const r=nt(t);e._vs&&(Et(e._vs)||Dn.throwArgumentError("signature invalid _vs","signature",n),e._vs=Qn(e._vs,32)),e._vs==null?e._vs=r:e._vs!==r&&Dn.throwArgumentError("signature _vs mismatch v and s","signature",n)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const oV="bignumber/5.7.0";var xy=vt.BN;const Ga=new ge(oV),I_={},N2=9007199254740991;let k2=!1;class Ge{constructor(e,t){e!==I_&&Ga.throwError("cannot call constructor directly; use BigNumber.from",ge.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return vi(St(this).fromTwos(e))}toTwos(e){return vi(St(this).toTwos(e))}abs(){return this._hex[0]==="-"?Ge.from(this._hex.substring(1)):this}add(e){return vi(St(this).add(St(e)))}sub(e){return vi(St(this).sub(St(e)))}div(e){return Ge.from(e).isZero()&&ms("division-by-zero","div"),vi(St(this).div(St(e)))}mul(e){return vi(St(this).mul(St(e)))}mod(e){const t=St(e);return t.isNeg()&&ms("division-by-zero","mod"),vi(St(this).umod(t))}pow(e){const t=St(e);return t.isNeg()&&ms("negative-power","pow"),vi(St(this).pow(t))}and(e){const t=St(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","and"),vi(St(this).and(t))}or(e){const t=St(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","or"),vi(St(this).or(t))}xor(e){const t=St(e);return(this.isNegative()||t.isNeg())&&ms("unbound-bitwise-result","xor"),vi(St(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&ms("negative-width","mask"),vi(St(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&ms("negative-width","shl"),vi(St(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&ms("negative-width","shr"),vi(St(this).shrn(e))}eq(e){return St(this).eq(St(e))}lt(e){return St(this).lt(St(e))}lte(e){return St(this).lte(St(e))}gt(e){return St(this).gt(St(e))}gte(e){return St(this).gte(St(e))}isNegative(){return this._hex[0]==="-"}isZero(){return St(this).isZero()}toNumber(){try{return St(this).toNumber()}catch{ms("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ga.throwError("this platform does not support BigInt",ge.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?k2||(k2=!0,Ga.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ga.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",ge.errors.UNEXPECTED_ARGUMENT,{}):Ga.throwError("BigNumber.toString does not accept parameters",ge.errors.UNEXPECTED_ARGUMENT,{})),St(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(I_,am(e)):e.match(/^-?[0-9]+$/)?new Ge(I_,am(new xy(e))):Ga.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&ms("underflow","BigNumber.from",e),(e>=N2||e<=-N2)&&ms("overflow","BigNumber.from",e),Ge.from(String(e));const t=e;if(typeof t=="bigint")return Ge.from(t.toString());if(rx(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 Ga.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]==="-"&&Ga.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 vi(n){return Ge.from(am(n))}function St(n){const e=Ge.from(n).toHexString();return e[0]==="-"?new xy("-"+e.substring(3),16):new xy(e.substring(2),16)}function ms(n,e,t){const r={fault:n,operation:e};return t!=null&&(r.value=t),Ga.throwError(n,ge.errors.NUMERIC_FAULT,r)}function aV(n){return new xy(n,36).toString(16)}const lV="properties/5.7.0";var AV=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 _y=new ge(lV);function Ue(n,e,t){Object.defineProperty(n,e,{enumerable:!0,value:t,writable:!1})}function es(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 tr(n){return AV(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 cV(n,e){(!n||typeof n!="object")&&_y.throwArgumentError("invalid object","object",n),Object.keys(n).forEach(t=>{e[t]||_y.throwArgumentError("invalid object key - "+t,"transaction:"+t,n)})}function En(n){const e={};for(const t in n)e[t]=n[t];return e}const uV={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function aN(n){if(n==null||uV[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;trs(e)));if(typeof n=="object"){const e={};for(const t in n){const r=n[t];r!==void 0&&Ue(e,t,rs(r))}return e}return _y.throwArgumentError(`Cannot deepCopy ${typeof n}`,"object",n)}function rs(n){return fV(n)}class ng{constructor(e){for(const t in e)this[t]=rs(e[t])}}const hV="abstract-provider/5.7.0";var dV=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 pV=new ge(hV);class mV extends ng{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class rg{constructor(){pV.checkAbstract(new.target,rg),Ue(this,"_isProvider",!0)}getFeeData(){return dV(this,void 0,void 0,function*(){const{block:e,gasPrice:t}=yield tr({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 gV="networks/5.7.1",Q2=new ge(gV);function vV(n){return n&&typeof n.renetwork=="function"}function Ka(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 Ka(t)},e}function by(n,e){const t=function(r,i){return r.JsonRpcProvider?new r.JsonRpcProvider(n,e):null};return t.renetwork=function(r){return by(n,r)},t}const H2={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:Ka("homestead")},z2={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:Ka("ropsten")},G2={chainId:63,name:"classicMordor",_defaultProvider:by("https://www.ethercluster.com/mordor","classicMordor")},Dg={unspecified:{chainId:0,name:"unspecified"},homestead:H2,mainnet:H2,morden:{chainId:2,name:"morden"},ropsten:z2,testnet:z2,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:Ka("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:Ka("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:Ka("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:Ka("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:by("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:G2,classicTestnet:G2,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:by("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:Ka("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:Ka("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 lN(n){if(n==null)return null;if(typeof n=="number"){for(const r in Dg){const i=Dg[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=Dg[n];return r==null?null:{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress,_defaultProvider:r._defaultProvider||null}}const e=Dg[n.name];if(!e)return typeof n.chainId!="number"&&Q2.throwArgumentError("invalid network chainId","network",n),n;n.chainId!==0&&n.chainId!==e.chainId&&Q2.throwArgumentError("network chainId mismatch","network",n);let t=n._defaultProvider||null;return t==null&&e._defaultProvider&&(vV(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 AN(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=ae>>5,this.extraBytes=(ae&31)>>3;for(var oe=0;oe<50;++oe)this.s[oe]=0}E.prototype.update=function(U){if(this.finalized)throw new Error(t);var X,ae=typeof U;if(ae!=="string"){if(ae==="object"){if(U===null)throw new Error(e);if(l&&U.constructor===ArrayBuffer)U=new Uint8Array(U);else if(!Array.isArray(U)&&(!l||!ArrayBuffer.isView(U)))throw new Error(e)}else throw new Error(e);X=!0}for(var oe=this.blocks,de=this.byteCount,se=U.length,pe=this.blockCount,_e=0,xe=this.s,L,ue;_e>2]|=U[_e]<>2]|=ue<>2]|=(192|ue>>6)<>2]|=(128|ue&63)<=57344?(oe[L>>2]|=(224|ue>>12)<>2]|=(128|ue>>6&63)<>2]|=(128|ue&63)<>2]|=(240|ue>>18)<>2]|=(128|ue>>12&63)<>2]|=(128|ue>>6&63)<>2]|=(128|ue&63)<=de){for(this.start=L-de,this.block=oe[pe],L=0;L>8,ae=U&255;ae>0;)de.unshift(ae),U=U>>8,ae=U&255,++oe;return X?de.push(oe):de.unshift(oe),this.update(de),de.length},E.prototype.encodeString=function(U){var X,ae=typeof U;if(ae!=="string"){if(ae==="object"){if(U===null)throw new Error(e);if(l&&U.constructor===ArrayBuffer)U=new Uint8Array(U);else if(!Array.isArray(U)&&(!l||!ArrayBuffer.isView(U)))throw new Error(e)}else throw new Error(e);X=!0}var oe=0,de=U.length;if(X)oe=de;else for(var se=0;se=57344?oe+=3:(pe=65536+((pe&1023)<<10|U.charCodeAt(++se)&1023),oe+=4)}return oe+=this.encode(oe*8),this.update(U),oe},E.prototype.bytepad=function(U,X){for(var ae=this.encode(X),oe=0;oe>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(U[0]=U[ae],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];se%U===0&&(ee(X),de=0)}return oe&&(_e=X[de],pe+=A[_e>>4&15]+A[_e&15],oe>1&&(pe+=A[_e>>12&15]+A[_e>>8&15]),oe>2&&(pe+=A[_e>>20&15]+A[_e>>16&15])),pe},E.prototype.arrayBuffer=function(){this.finalize();var U=this.blockCount,X=this.s,ae=this.outputBlocks,oe=this.extraBytes,de=0,se=0,pe=this.outputBits>>3,_e;oe?_e=new ArrayBuffer(ae+1<<2):_e=new ArrayBuffer(pe);for(var xe=new Uint32Array(_e);se>8&255,pe[_e+2]=xe>>16&255,pe[_e+3]=xe>>24&255;se%U===0&&ee(X)}return oe&&(_e=se<<2,xe=X[de],pe[_e]=xe&255,oe>1&&(pe[_e+1]=xe>>8&255),oe>2&&(pe[_e+2]=xe>>16&255)),pe};function G(U,X,ae){E.call(this,U,X,ae)}G.prototype=new E,G.prototype.finalize=function(){return this.encode(this.outputBits,!0),E.prototype.finalize.call(this)};var ee=function(U){var X,ae,oe,de,se,pe,_e,xe,L,ue,Ae,q,J,ce,be,Be,k,W,re,he,me,V,R,S,j,te,le,ie,Ie,Te,Le,He,De,fe,Me,Se,Fe,Ve,Je,ft,an,Ct,it,lr,yt,jt,Zs,Zt,Jt,ne,ve,Ee,we,Ce,ze,st,Xe,$e,gt,dt,ct,Wt,vn;for(oe=0;oe<48;oe+=2)de=U[0]^U[10]^U[20]^U[30]^U[40],se=U[1]^U[11]^U[21]^U[31]^U[41],pe=U[2]^U[12]^U[22]^U[32]^U[42],_e=U[3]^U[13]^U[23]^U[33]^U[43],xe=U[4]^U[14]^U[24]^U[34]^U[44],L=U[5]^U[15]^U[25]^U[35]^U[45],ue=U[6]^U[16]^U[26]^U[36]^U[46],Ae=U[7]^U[17]^U[27]^U[37]^U[47],q=U[8]^U[18]^U[28]^U[38]^U[48],J=U[9]^U[19]^U[29]^U[39]^U[49],X=q^(pe<<1|_e>>>31),ae=J^(_e<<1|pe>>>31),U[0]^=X,U[1]^=ae,U[10]^=X,U[11]^=ae,U[20]^=X,U[21]^=ae,U[30]^=X,U[31]^=ae,U[40]^=X,U[41]^=ae,X=de^(xe<<1|L>>>31),ae=se^(L<<1|xe>>>31),U[2]^=X,U[3]^=ae,U[12]^=X,U[13]^=ae,U[22]^=X,U[23]^=ae,U[32]^=X,U[33]^=ae,U[42]^=X,U[43]^=ae,X=pe^(ue<<1|Ae>>>31),ae=_e^(Ae<<1|ue>>>31),U[4]^=X,U[5]^=ae,U[14]^=X,U[15]^=ae,U[24]^=X,U[25]^=ae,U[34]^=X,U[35]^=ae,U[44]^=X,U[45]^=ae,X=xe^(q<<1|J>>>31),ae=L^(J<<1|q>>>31),U[6]^=X,U[7]^=ae,U[16]^=X,U[17]^=ae,U[26]^=X,U[27]^=ae,U[36]^=X,U[37]^=ae,U[46]^=X,U[47]^=ae,X=ue^(de<<1|se>>>31),ae=Ae^(se<<1|de>>>31),U[8]^=X,U[9]^=ae,U[18]^=X,U[19]^=ae,U[28]^=X,U[29]^=ae,U[38]^=X,U[39]^=ae,U[48]^=X,U[49]^=ae,ce=U[0],be=U[1],jt=U[11]<<4|U[10]>>>28,Zs=U[10]<<4|U[11]>>>28,ie=U[20]<<3|U[21]>>>29,Ie=U[21]<<3|U[20]>>>29,dt=U[31]<<9|U[30]>>>23,ct=U[30]<<9|U[31]>>>23,Ct=U[40]<<18|U[41]>>>14,it=U[41]<<18|U[40]>>>14,fe=U[2]<<1|U[3]>>>31,Me=U[3]<<1|U[2]>>>31,Be=U[13]<<12|U[12]>>>20,k=U[12]<<12|U[13]>>>20,Zt=U[22]<<10|U[23]>>>22,Jt=U[23]<<10|U[22]>>>22,Te=U[33]<<13|U[32]>>>19,Le=U[32]<<13|U[33]>>>19,Wt=U[42]<<2|U[43]>>>30,vn=U[43]<<2|U[42]>>>30,Ce=U[5]<<30|U[4]>>>2,ze=U[4]<<30|U[5]>>>2,Se=U[14]<<6|U[15]>>>26,Fe=U[15]<<6|U[14]>>>26,W=U[25]<<11|U[24]>>>21,re=U[24]<<11|U[25]>>>21,ne=U[34]<<15|U[35]>>>17,ve=U[35]<<15|U[34]>>>17,He=U[45]<<29|U[44]>>>3,De=U[44]<<29|U[45]>>>3,S=U[6]<<28|U[7]>>>4,j=U[7]<<28|U[6]>>>4,st=U[17]<<23|U[16]>>>9,Xe=U[16]<<23|U[17]>>>9,Ve=U[26]<<25|U[27]>>>7,Je=U[27]<<25|U[26]>>>7,he=U[36]<<21|U[37]>>>11,me=U[37]<<21|U[36]>>>11,Ee=U[47]<<24|U[46]>>>8,we=U[46]<<24|U[47]>>>8,lr=U[8]<<27|U[9]>>>5,yt=U[9]<<27|U[8]>>>5,te=U[18]<<20|U[19]>>>12,le=U[19]<<20|U[18]>>>12,$e=U[29]<<7|U[28]>>>25,gt=U[28]<<7|U[29]>>>25,ft=U[38]<<8|U[39]>>>24,an=U[39]<<8|U[38]>>>24,V=U[48]<<14|U[49]>>>18,R=U[49]<<14|U[48]>>>18,U[0]=ce^~Be&W,U[1]=be^~k&re,U[10]=S^~te&ie,U[11]=j^~le&Ie,U[20]=fe^~Se&Ve,U[21]=Me^~Fe&Je,U[30]=lr^~jt&Zt,U[31]=yt^~Zs&Jt,U[40]=Ce^~st&$e,U[41]=ze^~Xe>,U[2]=Be^~W&he,U[3]=k^~re&me,U[12]=te^~ie&Te,U[13]=le^~Ie&Le,U[22]=Se^~Ve&ft,U[23]=Fe^~Je&an,U[32]=jt^~Zt&ne,U[33]=Zs^~Jt&ve,U[42]=st^~$e&dt,U[43]=Xe^~gt&ct,U[4]=W^~he&V,U[5]=re^~me&R,U[14]=ie^~Te&He,U[15]=Ie^~Le&De,U[24]=Ve^~ft&Ct,U[25]=Je^~an&it,U[34]=Zt^~ne&Ee,U[35]=Jt^~ve&we,U[44]=$e^~dt&Wt,U[45]=gt^~ct&vn,U[6]=he^~V&ce,U[7]=me^~R&be,U[16]=Te^~He&S,U[17]=Le^~De&j,U[26]=ft^~Ct&fe,U[27]=an^~it&Me,U[36]=ne^~Ee&lr,U[37]=ve^~we&yt,U[46]=dt^~Wt&Ce,U[47]=ct^~vn&ze,U[8]=V^~ce&Be,U[9]=R^~be&k,U[18]=He^~S&te,U[19]=De^~j&le,U[28]=Ct^~fe&Se,U[29]=it^~Me&Fe,U[38]=Ee^~lr&jt,U[39]=we^~yt&Zs,U[48]=Wt^~Ce&st,U[49]=vn^~ze&Xe,U[0]^=d[oe],U[1]^=d[oe+1]};if(a)n.exports=v;else for(F=0;F>6===2;o++)s++;return s}return n===Yi.OVERRUN?t.length-e-1:0}function MV(n,e,t,r,i){return n===Yi.OVERLONG?(r.push(i),0):(r.push(65533),dN(n,e,t))}const SV=Object.freeze({error:CV,ignore:dN,replace:MV});function pN(n,e){e==null&&(e=SV.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(Yi.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(Yi.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(Yi.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(Yi.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(Yi.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(Yi.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function Aa(n,e=lm.current){e!=lm.current&&(hN.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 ig(n,e){return TV(pN(n,e))}function IV(n,e=lm.current){return pN(Aa(n,e))}function _f(n){return sr(Aa(n))}const mN="hash/5.7.0";function gN(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+T>>>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 UV(n){let e=0;return()=>n[e++]}function LV(n){return UV(FV(n))}function PV(n){return n&1?~n>>1:n>>1}function DV(n,e){let t=Array(n);for(let r=0;re[o]):t}function NV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(QV(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(HV(t,n))}return RV(gN(e))}function kV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function vN(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function QV(n,e){let t=1+e(),r=e(),i=kV(e),s=vN(i.length,1+n,e);return gN(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 vN(t,1+n,e).map(i=>[i[0],i.slice(1)])}function zV(n){let e=By(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let A=By(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 GV(){return LV(lN("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 sx=GV(),VV=new Set(By(sx)),jV=new Set(By(sx)),WV=NV(sx),KV=zV(sx),V2=45,j2=95;function yN(n){return IV(n)}function YV(n){return n.filter(e=>e!=65039)}function wN(n){for(let e of n.split(".")){let t=yN(e);try{for(let r=t.lastIndexOf(j2)-1;r>=0;r--)if(t[r]!==j2)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===V2&&t[3]===V2)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function XV(n){return wN($V(n,YV))}function $V(n,e){let t=yN(n).reverse(),r=[];for(;t.length;){let i=JV(t);if(i){r.push(...e(i));continue}let s=t.pop();if(VV.has(s)){r.push(s);continue}if(jV.has(s))continue;let o=WV[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return wN(ZV(String.fromCodePoint(...r)))}function ZV(n){return n.normalize("NFC")}function JV(n,e){var t;let r=KV,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 qV=new ge(mN),xN=new Uint8Array(32);xN.fill(0);function W2(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function _N(n){const e=Aa(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(W2(e.slice(r))),t}function Lv(n){typeof n!="string"&&qV.throwArgumentError("invalid ENS name; not a string","name",n);let e=xN;const t=_N(n);for(;t.length;)e=sr(qi([e,sr(t.pop())]));return nt(e)}function ej(n){return nt(qi(_N(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 tj="rlp/5.7.0",Go=new ge(tj);function K2(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function Y2(n,e,t){let r=0;for(let i=0;ie+1+r&&Go.throwError("child data too short",ge.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function BN(n,e){if(n.length===0&&Go.throwError("data too short",ge.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&Go.throwError("data short segment too short",ge.errors.BUFFER_OVERRUN,{});const r=Y2(n,e+1,t);return e+1+t+r>n.length&&Go.throwError("data long segment too short",ge.errors.BUFFER_OVERRUN,{}),X2(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",ge.errors.BUFFER_OVERRUN,{}),X2(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",ge.errors.BUFFER_OVERRUN,{});const r=Y2(n,e+1,t);e+1+t+r>n.length&&Go.throwError("data array too short",ge.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",ge.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 EM(n){const e=at(n),t=BN(e,0);return t.consumed!==e.length&&Go.throwArgumentError("invalid rlp data","data",n),t.result}const nj="address/5.7.0",bf=new ge(nj);function $2(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(sr(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 rj=9007199254740991;function ij(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const CM={};for(let n=0;n<10;n++)CM[String(n)]=String(n);for(let n=0;n<26;n++)CM[String.fromCharCode(65+n)]=String(10+n);const Z2=Math.floor(ij(rj));function sj(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>CM[r]).join("");for(;e.length>=Z2;){let r=e.substring(0,Z2);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 Nr(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=$2(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)!==sj(n)&&bf.throwArgumentError("bad icap checksum","address",n),e=oV(n.substring(4));e.length<40;)e="0"+e;e=$2("0x"+e)}else bf.throwArgumentError("invalid address","address",n);return e}function EN(n){let e=null;try{e=Nr(n.from)}catch{bf.throwArgumentError("missing from address","transaction",n)}const t=dh(at(Ge.from(n.nonce).toHexString()));return Nr(jr(sr(ox([e,t])),12))}var oj=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 Sn=new ge(mN),CN=new Uint8Array(32);CN.fill(0);const aj=Ge.from(-1),MN=Ge.from(0),SN=Ge.from(1),lj=Ge.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function Aj(n){const e=at(n),t=e.length%32;return t?Bi([e,CN.slice(t)]):nt(e)}const cj=Qn(SN.toHexString(),32),uj=Qn(MN.toHexString(),32),J2={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},I_=["name","version","chainId","verifyingContract","salt"];function q2(n){return function(e){return typeof e!="string"&&Sn.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const fj={name:q2("name"),version:q2("version"),chainId:function(n){try{return Ge.from(n).toString()}catch{}return Sn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return Nr(n).toLowerCase()}catch{}return Sn.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 Sn.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function R_(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))&&Sn.throwArgumentError("invalid numeric width","type",n);const i=lj.mask(t?r-1:r),s=t?i.add(SN).mul(aj):MN;return function(o){const a=Ge.from(o);return(a.lt(s)||a.gt(i))&&Sn.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),Qn(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))&&Sn.throwArgumentError("invalid bytes width","type",n),function(r){return at(r).length!==t&&Sn.throwArgumentError(`invalid length for ${n}`,"value",r),Aj(r)}}}switch(n){case"address":return function(e){return Qn(Nr(e),32)};case"bool":return function(e){return e?cj:uj};case"bytes":return function(e){return sr(e)};case"string":return function(e){return _f(e)}}return null}function eI(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class ji{constructor(e){Ue(this,"types",Object.freeze(rs(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]&&Sn.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&&Sn.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!R_(c)&&(r[c]||Sn.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?Sn.throwArgumentError("missing primary type","types",e):s.length>1&&Sn.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]&&Sn.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]=eI(a,e[a])+l.map(A=>eI(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=R_(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&&Sn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(sr)),sr(Bi(l))}}const r=this.types[e];if(r){const i=_f(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const A=this.getEncoder(l)(s[a]);return this._types[l]?sr(A):A});return o.unshift(i),Bi(o)}}return Sn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Sn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return sr(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(R_(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&&Sn.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),{}):Sn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new ji(e)}static getPrimaryType(e){return ji.from(e).primaryType}static hashStruct(e,t,r){return ji.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=J2[r];i||Sn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>I_.indexOf(r.name)-I_.indexOf(i.name)),ji.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return Bi(["0x1901",ji.hashDomain(e),ji.from(t).hash(r)])}static hash(e,t,r){return sr(ji.encode(e,t,r))}static resolveNames(e,t,r,i){return oj(this,void 0,void 0,function*(){e=En(e);const s={};e.verifyingContract&&!Et(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=ji.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){ji.hashDomain(e);const i={},s=[];I_.forEach(l=>{const A=e[l];A!=null&&(i[l]=fj[l](A),s.push({name:l,type:J2[l]}))});const o=ji.from(t),a=En(t);return a.EIP712Domain?Sn.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"&&Sn.throwArgumentError("invalid string","value",A),A}return Sn.throwArgumentError("unsupported type","type",l)})}}}var TN={},Ft={},sg=IN;function IN(n,e){if(!n)throw new Error(e||"Assertion failed")}IN.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var RB={exports:{}};typeof Object.create=="function"?RB.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:RB.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 hj=RB.exports,dj=sg,pj=hj;Ft.inherits=pj;function mj(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function gj(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):mj(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=RN;function yj(n,e){for(var t="",r=0;r>>0}return s}Ft.join32=wj;function xj(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=xj;function _j(n,e){return n>>>e|n<<32-e}Ft.rotr32=_j;function bj(n,e){return n<>>32-e}Ft.rotl32=bj;function Bj(n,e){return n+e>>>0}Ft.sum32=Bj;function Ej(n,e,t){return n+e+t>>>0}Ft.sum32_3=Ej;function Cj(n,e,t,r){return n+e+t+r>>>0}Ft.sum32_4=Cj;function Mj(n,e,t,r,i){return n+e+t+r+i>>>0}Ft.sum32_5=Mj;function Sj(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=Sj;function Tj(n,e,t,r){var i=e+r>>>0,s=(i>>0}Ft.sum64_hi=Tj;function Ij(n,e,t,r){var i=e+r;return i>>>0}Ft.sum64_lo=Ij;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 Fj(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}Ft.sum64_4_lo=Fj;function Uj(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=Uj;function Lj(n,e,t,r,i,s,o,a,l,A){var c=e+r+s+a+A;return c>>>0}Ft.sum64_5_lo=Lj;function Pj(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}Ft.rotr64_hi=Pj;function Dj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.rotr64_lo=Dj;function Oj(n,e,t){return n>>>t}Ft.shr64_hi=Oj;function Nj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.shr64_lo=Nj;var Gh={},tI=Ft,kj=sg;function ax(){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}Gh.BlockHash=ax;ax.prototype.update=function(e,t){if(e=tI.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=tI.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}ya.g0_256=Vj;function jj(n){return na(n,17)^na(n,19)^n>>>10}ya.g1_256=jj;var ph=Ft,Wj=Gh,Kj=ya,F_=ph.rotl32,gd=ph.sum32,Yj=ph.sum32_5,Xj=Kj.ft_1,ON=Wj.BlockHash,$j=[1518500249,1859775393,2400959708,3395469782];function ca(){if(!(this instanceof ca))return new ca;ON.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ph.inherits(ca,ON);var Zj=ca;ca.blockSize=512;ca.outSize=160;ca.hmacStrength=80;ca.padLength=64;ca.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()),NW(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 GW=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 lo=new ge(QW);function oI(n){return new Promise(e=>{setTimeout(e,n)})}function Fl(n,e){if(n==null)return null;if(typeof n=="string")return n;if(BM(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return ig(n)}catch{}return nt(n)}return n}function VW(n){return Aa(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function jW(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;lo.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;lo.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)&&lo.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&&lo.throwError("basic authentication requires a secure https url",ge.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const m=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+AN(Aa(m))}}n.skipFetchSetup!=null&&(A.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(A.fetchOptions=En(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]?lN(h[3]):VW(h[3])};let y=m.body;return t&&(y=t(m.body,m)),Promise.resolve(y)}catch(m){lo.throwError("processing response error",ge.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,_(lo.makeError("timeout",ge.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 GW(this,void 0,void 0,function*(){for(let m=0;m=300)&&(d.cancel(),lo.throwError("bad response",ge.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(ig(s))}catch(l){lo.throwError("invalid JSON",ge.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=Aa(e);const s=typeof n=="string"?{url:n}:En(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=En(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return jW(n,i,r)}function Bf(n,e){return e||(e={}),e=En(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 Ey="qpzry9x8gf2tvdw0s3jn54khce6mua7l",LB={};for(var Ng=0;Ng>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 YN(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=$f(e)^r>>5}for(e=$f(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=YN(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=$f(r)^o,i+=Ey.charAt(o)}for(s=0;s<6;++s)r=$f(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=Ey.charAt(a)}return i}function XN(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=YN(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 KW(){var n=XN.apply(null,arguments);if(typeof n=="object")return n}function YW(n){var e=XN.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function Ax(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}),Cy=fs.getNAF,t9=fs.getJSF,My=fs.assert;function HA(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 Jc=HA;HA.prototype.point=function(){throw new Error("Not implemented")};HA.prototype.validate=function(){throw new Error("Not implemented")};HA.prototype._fixedNafMul=function(e,t){My(e.precomputed);var r=e._getDoubles(),i=Cy(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];My(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};HA.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]=Cy(r[p],o[p],this._bitLength),l[d]=Cy(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=t9(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 T=0;c>=0;){var b=!0;for(u=0;u=0&&T++,_=_.dblp(T),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};js.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}]};Ws.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}};Ws.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)};Ws.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};Ws.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 Qr(n,e,t,r){Jc.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}SM(Qr,Jc.BasePoint);Ws.prototype.jpoint=function(e,t,r){return new Qr(this,e,t,r)};Qr.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)};Qr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Qr.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)};Qr.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)};Qr.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}};Qr.prototype.inspect=function(){return this.isInfinity()?"":""};Qr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Pv=Wh(function(n,e){var t=e;t.base=Jc,t.short=r9,t.mont=null,t.edwards=null}),Dv=Wh(function(n,e){var t=e,r=fs.assert;function i(a){a.type==="short"?this.curve=new Pv.short(a):a.type==="edwards"?this.curve=new Pv.edwards(a):this.curve=new Pv.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 IA(n){if(!(this instanceof IA))return new IA(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=yo.toArray(n.entropy,n.entropyEnc||"hex"),t=yo.toArray(n.nonce,n.nonceEnc||"hex"),r=yo.toArray(n.pers,n.persEnc||"hex");MM(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var ZN=IA;IA.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};IA.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=yo.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var i9=fs.assert;function cx(n,e){if(n instanceof cx)return n;this._importDER(n,e)||(i9(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 ux=cx;function s9(){this.place=0}function D_(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 lI(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)}cx.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=lI(t),r=lI(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];O_(i,t.length),i=i.concat(t),i.push(2),O_(i,r.length);var s=i.concat(r),o=[48];return O_(o,s.length),o=o.concat(s),fs.encode(o,e)};var o9=function(){throw new Error("unsupported")},JN=fs.assert;function Qs(n){if(!(this instanceof Qs))return new Qs(n);typeof n=="string"&&(JN(Object.prototype.hasOwnProperty.call(Dv,n),"Unknown curve "+n),n=Dv[n]),n instanceof Dv.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 a9=Qs;Qs.prototype.keyPair=function(e){return new TM(this,e)};Qs.prototype.keyFromPrivate=function(e,t){return TM.fromPrivate(this,e,t)};Qs.prototype.keyFromPublic=function(e,t){return TM.fromPublic(this,e,t)};Qs.prototype.genKeyPair=function(e){e||(e={});for(var t=new ZN({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||o9(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)}};Qs.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};Qs.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 ZN({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 ux({r:p,s:d,recoveryParam:g})}}}}}};Qs.prototype.verify=function(e,t,r,i){e=this._truncateToN(new vt(e,16)),r=this.keyFromPublic(r,i),t=new ux(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)};Qs.prototype.recoverPubKey=function(n,e,t,r){JN((3&t)===t,"The recovery param is more than two bits"),e=new ux(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)};Qs.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new ux(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 l9=Wh(function(n,e){var t=e;t.version="6.5.4",t.utils=fs,t.rand=function(){throw new Error("unsupported")},t.curve=Pv,t.curves=Dv,t.ec=a9,t.eddsa=null}),A9=l9.ec;const c9="signing-key/5.7.0",DB=new ge(c9);let N_=null;function Vo(){return N_||(N_=new A9("secp256k1")),N_}class u9{constructor(e){Ue(this,"curve","secp256k1"),Ue(this,"privateKey",nt(e)),Pc(this.privateKey)!==32&&DB.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Vo().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=Vo().keyFromPublic(at(this.publicKey)),r=Vo().keyFromPublic(at(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=Vo().keyFromPrivate(at(this.privateKey)),r=at(e);r.length!==32&&DB.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return ix({recoveryParam:i.recoveryParam,r:Qn("0x"+i.r.toString(16),32),s:Qn("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=Vo().keyFromPrivate(at(this.privateKey)),r=Vo().keyFromPublic(at(qN(e)));return Qn("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function f9(n,e){const t=ix(e),r={r:at(t.r),s:at(t.s)};return"0x"+Vo().recoverPubKey(at(n),r,t.recoveryParam).encode("hex",!1)}function qN(n,e){const t=at(n);if(t.length===32){const r=new u9(t);return e?"0x"+Vo().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?nt(t):"0x"+Vo().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Vo().keyFromPublic(t).getPublic(!0,"hex"):nt(t)}return DB.throwArgumentError("invalid public or private key","key","[REDACTED]")}const h9="transactions/5.7.0",Bl=new ge(h9);var AI;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(AI||(AI={}));function IM(n){return n==="0x"?null:Nr(n)}function Kr(n){return n==="0x"?uN:Ge.from(n)}function d9(n){const e=qN(n);return Nr(jr(sr(jr(e,1)),12))}function ek(n,e){return d9(f9(at(n),e))}function Xi(n,e){const t=dh(Ge.from(n).toHexString());return t.length>32&&Bl.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function k_(n,e){return{address:Nr(n),storageKeys:(e||[]).map((t,r)=>(Pc(t)!==32&&Bl.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function qc(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),k_(t[0],t[1])):k_(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return k_(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function tk(n){return qc(n).map(e=>[e.address,e.storageKeys])}function p9(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=[Xi(n.chainId||0,"chainId"),Xi(n.nonce||0,"nonce"),Xi(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Xi(n.maxFeePerGas||0,"maxFeePerGas"),Xi(n.gasLimit||0,"gasLimit"),n.to!=null?Nr(n.to):"0x",Xi(n.value||0,"value"),n.data||"0x",tk(n.accessList||[])];if(e){const r=ix(e);t.push(Xi(r.recoveryParam,"recoveryParam")),t.push(dh(r.r)),t.push(dh(r.s))}return Bi(["0x02",ox(t)])}function m9(n,e){const t=[Xi(n.chainId||0,"chainId"),Xi(n.nonce||0,"nonce"),Xi(n.gasPrice||0,"gasPrice"),Xi(n.gasLimit||0,"gasLimit"),n.to!=null?Nr(n.to):"0x",Xi(n.value||0,"value"),n.data||"0x",tk(n.accessList||[])];if(e){const r=ix(e);t.push(Xi(r.recoveryParam,"recoveryParam")),t.push(dh(r.r)),t.push(dh(r.s))}return Bi(["0x01",ox(t)])}function nk(n,e,t){try{const r=Kr(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=Qn(e[1],32),n.s=Qn(e[2],32);try{const r=sr(t(n));n.from=ek(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function g9(n){const e=EM(n.slice(1));e.length!==9&&e.length!==12&&Bl.throwArgumentError("invalid component count for transaction type: 2","payload",nt(n));const t=Kr(e[2]),r=Kr(e[3]),i={type:2,chainId:Kr(e[0]).toNumber(),nonce:Kr(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:Kr(e[4]),to:IM(e[5]),value:Kr(e[6]),data:e[7],accessList:qc(e[8])};return e.length===9||(i.hash=sr(n),nk(i,e.slice(9),p9)),i}function v9(n){const e=EM(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:Kr(e[0]).toNumber(),nonce:Kr(e[1]).toNumber(),gasPrice:Kr(e[2]),gasLimit:Kr(e[3]),to:IM(e[4]),value:Kr(e[5]),data:e[6],accessList:qc(e[7])};return e.length===8||(t.hash=sr(n),nk(t,e.slice(8),m9)),t}function y9(n){const e=EM(n);e.length!==9&&e.length!==6&&Bl.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:Kr(e[0]).toNumber(),gasPrice:Kr(e[1]),gasLimit:Kr(e[2]),to:IM(e[3]),value:Kr(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=Qn(e[7],32),t.s=Qn(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=sr(ox(i));try{t.from=ek(s,{r:nt(t.r),s:nt(t.s),recoveryParam:r})}catch{}t.hash=sr(n)}return t.type=null,t}function w9(n){const e=at(n);if(e[0]>127)return y9(e);switch(e[0]){case 1:return v9(e);case 2:return g9(e)}return Bl.throwError(`unsupported transaction type: ${e[0]}`,ge.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const yd=new ge(ti);let cI=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=En(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 qc(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():yd.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 Nr(e)}callAddress(e){if(!Et(e,32))return null;const t=Nr(jr(e,12));return t===vV?null:t}contractAddress(e){return EN(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 rx(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return Pc(r)!==32?yd.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 Qn(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 w9(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&&yd.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):yd.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&yd.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 x9(n){return n&&typeof n.isCommunityResource=="function"}function uI(n){return x9(n)&&n.isCommunityResource()}let fI=!1;function fx(){fI||(fI=!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 pt=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 ge(ti),_9=10;function hI(n){return n==null?"null":(Pc(n)!==32&&Bt.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function dI(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[hI(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return hI(e)}).join("&")}function b9(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 pu(n){if(typeof n=="string"){if(n=n.toLowerCase(),Pc(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+dI(n);if(pV.isForkEvent(n))throw Bt.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+dI(n.topics||[])}throw new Error("invalid event - "+n)}function wd(){return new Date().getTime()}function pI(n){return new Promise(e=>{setTimeout(e,n)})}const B9=["block","network","pending","poll"];let E9=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=b9(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||B9.indexOf(this.tag)>=0}};const C9={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 Q_(n){return Qn(Ge.from(n).toHexString(),32)}function mI(n){return IB.encode(qi([n,jr(sI(sI(n)),0,4)]))}const rk=new RegExp("^(ipfs)://(.*)$","i"),gI=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),rk,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Ov(n,e){try{return ig(Am(n,e))}catch{}return null}function Am(n,e){if(n==="0x")return null;const t=Ge.from(jr(n,e,e+32)).toNumber(),r=Ge.from(jr(n,t,t+32)).toNumber();return jr(n,t+32,t+32+r)}function H_(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 vI(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 M9(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function ik(n){const e=[];let t=0;for(let r=0;rGe.from(e).eq(1)).catch(e=>{if(e.code===ge.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return pt(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:Bi([e,Lv(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=Bi(["0x9061b923",ik([ej(this.name),r.data])]));try{let s=yield this.provider.call(r);return at(s).length%32===4&&Bt.throwError("resolver threw error",ge.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=Am(s,0)),s}catch(s){if(s.code===ge.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return pt(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?Am(r,0):null})}_getAddress(e,t){const r=C9[String(e)];if(r==null&&Bt.throwError(`unsupported coin type: ${e}`,ge.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 mI(qi([[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 mI(qi([[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=aI.toWords(i.slice(2));return a.unshift(o),aI.encode(r.prefix,a)}}return null}getAddress(e){return pt(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===_V?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===ge.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",Q_(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&Bt.throwError("invalid or unsupported coin data",ge.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return pt(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",ge.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return pt(this,void 0,void 0,function*(){let t=Aa(e);t=qi([Q_(64),Q_(t.length),t]),t.length%32!==0&&(t=qi([t,Qn("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",nt(t));return r==null||r==="0x"?null:ig(r)})}}let z_=null,S9=1;class RM extends rg{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=es(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 pt(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",ge.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 Bf(()=>this._ready().then(e=>e,e=>{if(!(e.code===ge.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return z_==null&&(z_=new cI),z_}static getNetwork(e){return aN(e??"homestead")}ccipReadFetch(e,t,r){return pt(this,void 0,void 0,function*(){if(this.disableCcipRead||r.length===0)return null;const i=e.to.toLowerCase(),s=t.toLowerCase(),o=[];for(let a=0;a=0?null:JSON.stringify({data:s,sender:i}),u=yield lx({url: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}`,ge.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(", ")}`,ge.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return pt(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(wd()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=wd(),r=tr({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=wd();return i=Ge.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return pt(this,void 0,void 0,function*(){const e=S9++,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",ge.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 pt(this,void 0,void 0,function*(){return Bt.throwError("provider does not support network detection",ge.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return pt(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 pI(0),this._network;const r=Bt.makeError("underlying network changed",ge.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=wd();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 pt(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return pt(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=>pt(this,void 0,void 0,function*(){A||(yield pI(1e3),this.getTransactionCount(i.from).then(g=>pt(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",ge.errors.TIMEOUT,{timeout:r}))},r);f.unref&&f.unref(),l.push(()=>{clearTimeout(f)})}})})}getBlockNumber(){return pt(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return pt(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",ge.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return pt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield tr({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",ge.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return pt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield tr({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",ge.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return pt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield tr({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",ge.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return pt(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield tr({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then(o=>rx(o))}),s=yield this.perform("getStorageAt",i);try{return nt(s)}catch(o){return Bt.throwError("bad result from backend",ge.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&Pc(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.",ge.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>pt(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",ge.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return pt(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 pt(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 tr(r))})}_getFilter(e){return pt(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 tr(t))})}_call(e,t,r){return pt(this,void 0,void 0,function*(){r>=_9&&Bt.throwError("CCIP read exceeded maximum redirections",ge.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"&&Pc(s)%32===4)try{const o=jr(s,4),a=jr(o,0,32);Ge.from(a).eq(i)||Bt.throwError("CCIP Read sender did not match",ge.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],A=Ge.from(jr(o,32,64)).toNumber(),c=Ge.from(jr(o,A,A+32)).toNumber(),u=jr(o,A+32);for(let m=0;mpt(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 pt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Bf(()=>pt(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 pt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Bf(()=>pt(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 pt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield tr({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach(i=>{i.removed==null&&(i.removed=!1)}),cI.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return pt(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return pt(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 pt(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 yI(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return pt(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Bt.throwError("network does not support ENS",ge.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Lv(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return pt(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 pt(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=Ov(yield this.call({to:r,data:"0x691f3431"+Lv(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return pt(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 yI(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==ge.errors.CALL_EXCEPTION)throw a}try{const a=Ov(yield this.call({to:o,data:"0x691f3431"+Lv(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==ge.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",ge.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 E9(pu(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=pu(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=pu(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=pu(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=pu(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=pu(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 to=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 ge(T9),I9=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],R9=[ge.errors.INSUFFICIENT_FUNDS,ge.errors.NONCE_EXPIRED,ge.errors.REPLACEMENT_UNDERPRICED];class og{constructor(){ys.checkAbstract(new.target,og),Ue(this,"_isSigner",!0)}getBalance(e){return to(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return to(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return to(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const t=yield tr(this.checkTransaction(e));return yield this.provider.estimateGas(t)})}call(e,t){return to(this,void 0,void 0,function*(){this._checkProvider("call");const r=yield tr(this.checkTransaction(e));return yield this.provider.call(r,t)})}sendTransaction(e){return to(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 to(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return to(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return to(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return to(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const r in e)I9.indexOf(r)===-1&&ys.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=En(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 to(this,void 0,void 0,function*(){const t=yield tr(this.checkTransaction(e));t.to!=null&&(t.to=Promise.resolve(t.to).then(i=>to(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",ge.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):ys.throwError("failed to get consistent fee data",ge.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",ge.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 tr(t)})}_checkProvider(e){this.provider||ys.throwError("missing provider",ge.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class FM extends og{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,ge.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 FM(this.address,e)}}var Va=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 nr=new ge(ti),F9=["call","estimateGas"];function Np(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=Np(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return Np(JSON.parse(n),e)}catch{}return null}function sk(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=Np(e,!0);if(s)return s.data;nr.throwError("missing revert data in call exception; Transaction reverted without a reason string",ge.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=Np(e.body,!1);s==null&&(s=Np(e,!1)),s&&nr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ge.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===ge.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)&&nr.throwError("insufficient funds for intrinsic transaction cost",ge.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&nr.throwError("nonce has already been used",ge.errors.NONCE_EXPIRED,{error:e,method:n,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&nr.throwError("replacement fee too low",ge.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&nr.throwError("legacy pre-eip-155 transactions not supported",ge.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),F9.indexOf(n)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&nr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ge.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function wI(n){return new Promise(function(e){setTimeout(e,n)})}function U9(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 xd(n){return n&&n.toLowerCase()}const OB={};class ok extends og{constructor(e,t,r){if(super(),e!==OB)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)):nr.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return nr.throwError("cannot alter JSON-RPC Signer connection",ge.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new L9(OB,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&&nr.throwError("unknown account #"+this._index,ge.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=En(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=En(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>Va(this,void 0,void 0,function*(){if(r==null)return null;const i=yield this.provider.resolveName(r);return i==null&&nr.throwArgumentError("provided ENS name resolves to null","tx.to",r),i}))),tr({tx:tr(e),sender:t}).then(({tx:r,sender:i})=>{r.from!=null?r.from.toLowerCase()!==i&&nr.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)&&nr.throwError("user rejected transaction",ge.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),sk("sendTransaction",o,s)))})}signTransaction(e){return nr.throwError("signing transactions is unsupported",ge.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Va(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 Bf(()=>Va(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 Va(this,void 0,void 0,function*(){const t=typeof e=="string"?Aa(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)&&nr.throwError("user rejected signing",ge.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return Va(this,void 0,void 0,function*(){const t=typeof e=="string"?Aa(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)&&nr.throwError("user rejected signing",ge.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return Va(this,void 0,void 0,function*(){const i=yield ji.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(ji.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&nr.throwError("user rejected signing",ge.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return Va(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class L9 extends ok{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 P9={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class cm extends RM{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=es(this.constructor,"defaultUrl")()),typeof e=="string"?Ue(this,"connection",Object.freeze({url:e})):Ue(this,"connection",Object.freeze(En(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 Va(this,void 0,void 0,function*(){yield wI(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=es(this.constructor,"getNetwork");try{return t(Ge.from(e).toNumber())}catch(r){return nr.throwError("could not detect network",ge.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return nr.throwError("could not detect network",ge.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new ok(OB,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:rs(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=lx(this.connection,JSON.stringify(r),U9).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",[xd(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[xd(t.address),t.blockTag]];case"getCode":return["eth_getCode",[xd(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[xd(t.address),Qn(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",[es(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[es(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=xd(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Va(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=En(t),t.transaction=En(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&nr.throwError(e+" not implemented",ge.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return sk(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 wI(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=En(P9);if(t)for(const s in t)t[s]&&(r[s]=!0);AV(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=rx(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=qc(e.accessList)),i}}let kp=null;try{if(kp=WebSocket,kp==null)throw new Error("inject please")}catch{const e=new ge(ti);kp=function(){e.throwError("WebSockets not supported in this environment",ge.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var G_=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 kg=new ge(ti);let D9=1;class UM extends cm{constructor(e,t){t==="any"&&kg.throwError("WebSocketProvider does not support 'any' network yet",ge.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 kp(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){kg.throwError("cannot reset events block on WebSocketProvider",ge.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){kg.throwError("cannot set polling interval on WebSocketProvider",ge.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return G_(this,void 0,void 0,function*(){return null})}set polling(e){e&&kg.throwError("cannot set polling on WebSocketProvider",ge.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=D9++;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 G_(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 G_(this,void 0,void 0,function*(){this.websocket.readyState===kp.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var O9=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 fp=new ge(ti);class ak extends cm{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return O9(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||fp.throwError("no network detected",ge.errors.UNKNOWN_ERROR,{}),this._network==null&&(Ue(this,"_network",t),this.emit("network",t,null))),t})}}class zA extends ak{constructor(e,t){fp.checkAbstract(new.target,zA),e=es(new.target,"getNetwork")(e),t=es(new.target,"getApiKey")(t);const r=es(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(){fp.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return fp.throwError("API provider does not support signing",ge.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return fp.throwError("not implemented; sub-classes must override getUrl",ge.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const xI=new ge(ti),Nv="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class N9 extends UM{constructor(e,t){const r=new lk(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===Nv}}class lk extends zA{static getWebSocketProvider(e,t){return new N9(e,t)}static getApiKey(e){return e==null?Nv:(e&&typeof e!="string"&&xI.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:xI.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===Nv&&fx(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Nv}}const k9=new ge(ti),Qg="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function Q9(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 k9.throwArgumentError("unsupported network","name",n)}class H9 extends zA{isCommunityResource(){return this.apiKey===Qg}static getApiKey(e){return e??Qg}static getUrl(e,t){t==null&&(t=Qg);const r={allowGzip:!0,url:"https://"+Q9(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===Qg&&fx(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var z9=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 _I=new ge(ti);class G9 extends zA{static getApiKey(e){return e!=null&&_I.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:_I.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return z9(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 Hg=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 ge(ti);function bI(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=rx(nt(r)):t==="accessList"?r="["+qc(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=nt(r),e[t]=r)}return e}function V9(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 BI(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 EI(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function V_(n,e,t){if(n==="call"&&e.code===ge.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",ge.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===ge.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",ge.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",ge.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&ql.throwError("replacement fee too low",ge.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",ge.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class j9 extends RM{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 Hg(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"?BI:V9;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(c,u)=>(this.isCommunityResource()&&fx(),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 lx(a,l,o||BI);return this.emit("debug",{action:"response",request:i,response:rs(A),provider:this}),A})}detectNetwork(){return Hg(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return Hg(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=>V_("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=bI(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return V_("call",s,t.transaction)}}case"estimateGas":{const i=bI(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return V_("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=EI(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=EI(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",ge.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",ge.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 W9(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 Sy=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 mc=new ge(ti);function zg(){return new Date().getTime()}function CI(n){let e=null;for(let t=0;te?null:(r+i)/2}function Ef(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=>Ef(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=Ef(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let K9=1;function SI(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 Y9=[ge.errors.CALL_EXCEPTION,ge.errors.INSUFFICIENT_FUNDS,ge.errors.NONCE_EXPIRED,ge.errors.REPLACEMENT_UNDERPRICED,ge.errors.UNPREDICTABLE_GAS_LIMIT],X9=["address","args","errorArgs","errorSignature","method","transaction"];function Gg(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 Z9(n,e,t){let r=Ef;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=MI(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 MI(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=En(i),i.confirmations=-1,Ef(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=En(i),i.transactions=i.transactions.map(s=>(s=En(s),s.confirmations=-1,s)),Ef(i))}:r=function(i){return i==null?null:Ef(i)};break;default:throw new Error("unknown method: "+e)}return $9(r,n.quorum)}function _d(n,e){return Sy(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:Bf(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function J9(n,e,t,r){return Sy(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 _d(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&Et(r.blockTag)&&(i=yield _d(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&Et(r.blockTag)&&(i=yield _d(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&Et(r.blockTag)&&(i=yield _d(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 _d(n,e)),i.getLogs(s)}}return mc.throwError("unknown method error",ge.errors.UNKNOWN_ERROR,{method:t,params:r})})}class q9 extends RM{constructor(e,t){e.length===0&&mc.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(rg.isProvider(o)){const c=uI(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:c,priority:1})}const l=En(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=uI(o)?2e3:750),l.weight==null&&(l.weight=1);const A=l.weight;return(A%1||A>512||A<1)&&mc.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&&mc.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=CI(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 Sy(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return CI(e)})}perform(e,t){return Sy(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=zg();let A=i.filter(h=>h.runner&&l-h.starth+p.weight,0);for(;A{h.staller=null}),h.runner=J9(h,s,e,t).then(d=>{h.done=!0,h.result=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Gg(h,zg()),request:{method:e,params:rs(t)},provider:this})},d=>{h.done=!0,h.error=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Gg(h,zg()),request:{method:e,params:rs(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Gg(h,null),request:{method:e,params:rs(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 SI(100).getPromise()),a=!1}const f=i.reduce((h,p)=>{if(!p.done||p.error==null)return h;const d=p.error.code;return Y9.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])}),mc.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}),mc.throwError("failed to meet quorum",ge.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>Gg(l)),provider:this})})}}const e7=null,kv=new ge(ti),hp="84842078b09946638c03157f83405213";class t7 extends UM{constructor(e,t){const r=new Ak(e,t),i=r.connection;i.password&&kv.throwError("INFURA WebSocket project secrets unsupported",ge.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===hp}}class Ak extends zA{static getWebSocketProvider(e,t){return new t7(e,t)}static getApiKey(e){const t={apiKey:hp,projectId:hp,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(kv.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),kv.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:kv.throwError("unsupported network",ge.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===hp&&fx(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===hp}}const j_=new ge(ti),n7="ETHERS_JS_SHARED";class r7 extends zA{static getApiKey(e){return e&&typeof e!="string"&&j_.throwArgumentError("invalid apiKey","apiKey",e),e||n7}static getUrl(e,t){j_.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:j_.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const TI=new ge(ti),II="62e1ad51b37b8e00394bda3b";class i7 extends zA{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=II:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:TI.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:TI.throwError("unsupported network",ge.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===II}}const RI=new ge(ti);let s7=1;function FI(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:s7++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:rs(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 o7(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:rs(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 LM extends cm{constructor(e,t){e==null&&RI.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=o7(e)):e.sendAsync?i=FI(e,e.sendAsync.bind(e)):e.send?i=FI(e,e.send.bind(e)):RI.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 UI=new ge(ti);function a7(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 cm(n);case"ws":case"wss":return new UM(n);default:UI.throwArgumentError("unsupported URL scheme","network",n)}}const t=aN(n);return(!t||!t._defaultProvider)&&UI.throwError("unsupported getDefaultProvider network",ge.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:q9,AlchemyProvider:lk,AnkrProvider:H9,CloudflareProvider:G9,EtherscanProvider:j9,InfuraProvider:Ak,JsonRpcProvider:cm,NodesmithProvider:r7,PocketProvider:i7,Web3Provider:LM,IpcProvider:e7},e)}var l7=!0,W_="Invariant failed";function qa(n,e){if(!n){if(l7)throw new Error(W_);var t=typeof e=="function"?e():e,r=t?"".concat(W_,": ").concat(t):W_;throw new Error(r)}}var go;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(go||(go={}));function um(){return um=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 Qv(n,e,t){return A7()?Qv=Reflect.construct:Qv=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&fm(A,o.prototype),A},Qv.apply(null,arguments)}function c7(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Ty(n){var e=typeof Map=="function"?new Map:void 0;return Ty=function(r){if(r===null||!c7(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 Qv(r,arguments,NB(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),fm(i,r)},Ty(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function LI(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function uk(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)&&qa(!1),e}else return Number.isInteger(n)||qa(!1),n}function fk(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||qa(!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(sr(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&&qa(!1),a}var PI=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=uk(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(c))throw new hk(c,e.supportedChainIds);var u=A===null?A:fk(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)}},Vg=function(n){ck(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(Ty(Error)),hk=function(n){ck(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}(Ty(Error)),xr;(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"})(xr||(xr={}));function u7(n,e){var t=e.type,r=e.payload;switch(t){case xr.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 xr.UPDATE:{var A=r.provider,c=r.chainId,u=r.account;return um({},n,A===void 0?{}:{provider:A},c===void 0?{}:{chainId:c},u===void 0?{}:{account:u})}case xr.UPDATE_FROM_ERROR:{var f=r.provider,h=r.chainId,p=r.account;return um({},n,f===void 0?{}:{provider:f},h===void 0?{}:{chainId:h},p===void 0?{}:{account:p},{error:void 0})}case xr.ERROR:{var d=r.error,g=n.connector,m=n.onError;return{connector:g,error:d,onError:m}}case xr.ERROR_FROM_ACTIVATION:{var y=r.connector,w=r.error;return{connector:y,error:w}}case xr.DEACTIVATE_CONNECTOR:return{}}}function f7(){var n=ye.useReducer(u7,{}),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(LI(function(){return Promise.resolve(g.activate().then(function(_){return x=!0,_})).then(function(_){return Promise.resolve(PI(g,_)).then(function(C){if(A.current>w)throw new Vg;t({type:xr.ACTIVATE_CONNECTOR,payload:um({connector:g},C,{onError:m})})})})},function(_){if(_ instanceof Vg)x&&g.deactivate();else{if(y)throw x&&g.deactivate(),_;m?(x&&g.deactivate(),m(_)):t({type:xr.ERROR_FROM_ACTIVATION,payload:{connector:g,error:_}})}}))}catch(_){return Promise.reject(_)}},[]),u=ye.useCallback(function(g){t({type:xr.ERROR,payload:{error:g}})},[]),f=ye.useCallback(function(){t({type:xr.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 LI(function(){return Promise.resolve(PI(r,g)).then(function(_){if(A.current>m)throw new Vg;t({type:xr.UPDATE_FROM_ERROR,payload:_})})},function(_){_ instanceof Vg||(a?a(_):t({type:xr.ERROR,payload:{error:_}}))});var y=g.chainId===void 0?void 0:uk(g.chainId);if(y!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(y)){var w=new hk(y,r.supportedChainIds);a?a(w):t({type:xr.ERROR,payload:{error:w}})}else{var x=typeof g.account=="string"?fk(g.account):g.account;t({type:xr.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:xr.ERROR,payload:{error:g}})},[a]),d=ye.useCallback(function(){t({type:xr.DEACTIVATE_CONNECTOR})},[]);return ye.useEffect(function(){return function(){r&&r.deactivate()}},[r]),ye.useEffect(function(){return r&&r.on(go.Update,h).on(go.Error,p).on(go.Deactivate,d),function(){r&&r.off(go.Update,h).off(go.Error,p).off(go.Deactivate,d)}},[r,h,p,d]),{connector:r,provider:i,chainId:s,account:o,activate:c,setError:u,deactivate:f,error:l}}var dk="primary",Cf={};function h7(n){Cf[n]&&qa(!1),Cf[n]=ye.createContext({activate:function(){try{return qa(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){qa(!1)},deactivate:function(){qa(!1)},active:!1}),Cf[n].displayName="Web3ReactContext - "+n;var e=Cf[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=f7(),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 $.createElement(e,{value:m},s)}}var d7=h7(dk);function p7(n){return n===void 0&&(n=dk),Object.keys(Cf).includes(n)||qa(!1),Cf[n]}function m7(n){return ye.useContext(p7(n))}var kB={},pk={exports:{}},hs={},mk={exports:{}},gk={};/** + */(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=qo: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(re){return new C(F,X,F).update(re)[ue]()}},_=function(F,X,ue){return function(re,fe){return new C(F,X,fe).update(re)[ue]()}},B=function(F,X,ue){return function(re,fe,oe,pe){return v["cshake"+F].update(re,fe,oe,pe)[ue]()}},T=function(F,X,ue){return function(re,fe,oe,pe){return v["kmac"+F].update(re,fe,oe,pe)[ue]()}},b=function(F,X,ue,re){for(var fe=0;fe>5,this.byteCount=this.blockCount<<2,this.outputBlocks=ue>>5,this.extraBytes=(ue&31)>>3;for(var re=0;re<50;++re)this.s[re]=0}C.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 re=this.blocks,fe=this.byteCount,oe=F.length,pe=this.blockCount,xe=0,_e=this.s,D,Ae;xe>2]|=F[xe]<>2]|=Ae<>2]|=(192|Ae>>6)<>2]|=(128|Ae&63)<=57344?(re[D>>2]|=(224|Ae>>12)<>2]|=(128|Ae>>6&63)<>2]|=(128|Ae&63)<>2]|=(240|Ae>>18)<>2]|=(128|Ae>>12&63)<>2]|=(128|Ae>>6&63)<>2]|=(128|Ae&63)<=fe){for(this.start=D-fe,this.block=re[pe],D=0;D>8,ue=F&255;ue>0;)fe.unshift(ue),F=F>>8,ue=F&255,++re;return X?fe.push(re):fe.unshift(re),this.update(fe),fe.length},C.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 re=0,fe=F.length;if(X)re=fe;else for(var oe=0;oe=57344?re+=3:(pe=65536+((pe&1023)<<10|F.charCodeAt(++oe)&1023),re+=4)}return re+=this.encode(re*8),this.update(F),re},C.prototype.bytepad=function(F,X){for(var ue=this.encode(X),re=0;re>2]|=this.padding[X&3],this.lastByteIndex===this.byteCount)for(F[0]=F[ue],X=1;X>4&15]+A[xe&15]+A[xe>>12&15]+A[xe>>8&15]+A[xe>>20&15]+A[xe>>16&15]+A[xe>>28&15]+A[xe>>24&15];oe%F===0&&(ee(X),fe=0)}return re&&(xe=X[fe],pe+=A[xe>>4&15]+A[xe&15],re>1&&(pe+=A[xe>>12&15]+A[xe>>8&15]),re>2&&(pe+=A[xe>>20&15]+A[xe>>16&15])),pe},C.prototype.arrayBuffer=function(){this.finalize();var F=this.blockCount,X=this.s,ue=this.outputBlocks,re=this.extraBytes,fe=0,oe=0,pe=this.outputBits>>3,xe;re?xe=new ArrayBuffer(ue+1<<2):xe=new ArrayBuffer(pe);for(var _e=new Uint32Array(xe);oe>8&255,pe[xe+2]=_e>>16&255,pe[xe+3]=_e>>24&255;oe%F===0&&ee(X)}return re&&(xe=oe<<2,_e=X[fe],pe[xe]=_e&255,re>1&&(pe[xe+1]=_e>>8&255),re>2&&(pe[xe+2]=_e>>16&255)),pe};function j(F,X,ue){C.call(this,F,X,ue)}j.prototype=new C,j.prototype.finalize=function(){return this.encode(this.outputBits,!0),C.prototype.finalize.call(this)};var ee=function(F){var X,ue,re,fe,oe,pe,xe,_e,D,Ae,le,q,J,ce,be,Be,Q,K,ie,de,me,G,R,S,V,te,ae,se,Ie,Te,Le,He,De,he,Me,Se,Fe,Ve,Je,ft,an,Ct,it,lr,yt,jt,Zs,Zt,Jt,ne,ve,Ee,we,Ce,ze,st,Xe,$e,gt,dt,ct,Wt,vn;for(re=0;re<48;re+=2)fe=F[0]^F[10]^F[20]^F[30]^F[40],oe=F[1]^F[11]^F[21]^F[31]^F[41],pe=F[2]^F[12]^F[22]^F[32]^F[42],xe=F[3]^F[13]^F[23]^F[33]^F[43],_e=F[4]^F[14]^F[24]^F[34]^F[44],D=F[5]^F[15]^F[25]^F[35]^F[45],Ae=F[6]^F[16]^F[26]^F[36]^F[46],le=F[7]^F[17]^F[27]^F[37]^F[47],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|xe>>>31),ue=J^(xe<<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=fe^(_e<<1|D>>>31),ue=oe^(D<<1|_e>>>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^(Ae<<1|le>>>31),ue=xe^(le<<1|Ae>>>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=_e^(q<<1|J>>>31),ue=D^(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=Ae^(fe<<1|oe>>>31),ue=le^(oe<<1|fe>>>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],be=F[1],jt=F[11]<<4|F[10]>>>28,Zs=F[10]<<4|F[11]>>>28,se=F[20]<<3|F[21]>>>29,Ie=F[21]<<3|F[20]>>>29,dt=F[31]<<9|F[30]>>>23,ct=F[30]<<9|F[31]>>>23,Ct=F[40]<<18|F[41]>>>14,it=F[41]<<18|F[40]>>>14,he=F[2]<<1|F[3]>>>31,Me=F[3]<<1|F[2]>>>31,Be=F[13]<<12|F[12]>>>20,Q=F[12]<<12|F[13]>>>20,Zt=F[22]<<10|F[23]>>>22,Jt=F[23]<<10|F[22]>>>22,Te=F[33]<<13|F[32]>>>19,Le=F[32]<<13|F[33]>>>19,Wt=F[42]<<2|F[43]>>>30,vn=F[43]<<2|F[42]>>>30,Ce=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,K=F[25]<<11|F[24]>>>21,ie=F[24]<<11|F[25]>>>21,ne=F[34]<<15|F[35]>>>17,ve=F[35]<<15|F[34]>>>17,He=F[45]<<29|F[44]>>>3,De=F[44]<<29|F[45]>>>3,S=F[6]<<28|F[7]>>>4,V=F[7]<<28|F[6]>>>4,st=F[17]<<23|F[16]>>>9,Xe=F[16]<<23|F[17]>>>9,Ve=F[26]<<25|F[27]>>>7,Je=F[27]<<25|F[26]>>>7,de=F[36]<<21|F[37]>>>11,me=F[37]<<21|F[36]>>>11,Ee=F[47]<<24|F[46]>>>8,we=F[46]<<24|F[47]>>>8,lr=F[8]<<27|F[9]>>>5,yt=F[9]<<27|F[8]>>>5,te=F[18]<<20|F[19]>>>12,ae=F[19]<<20|F[18]>>>12,$e=F[29]<<7|F[28]>>>25,gt=F[28]<<7|F[29]>>>25,ft=F[38]<<8|F[39]>>>24,an=F[39]<<8|F[38]>>>24,G=F[48]<<14|F[49]>>>18,R=F[49]<<14|F[48]>>>18,F[0]=ce^~Be&K,F[1]=be^~Q&ie,F[10]=S^~te&se,F[11]=V^~ae&Ie,F[20]=he^~Se&Ve,F[21]=Me^~Fe&Je,F[30]=lr^~jt&Zt,F[31]=yt^~Zs&Jt,F[40]=Ce^~st&$e,F[41]=ze^~Xe>,F[2]=Be^~K&de,F[3]=Q^~ie&me,F[12]=te^~se&Te,F[13]=ae^~Ie&Le,F[22]=Se^~Ve&ft,F[23]=Fe^~Je&an,F[32]=jt^~Zt&ne,F[33]=Zs^~Jt&ve,F[42]=st^~$e&dt,F[43]=Xe^~gt&ct,F[4]=K^~de&G,F[5]=ie^~me&R,F[14]=se^~Te&He,F[15]=Ie^~Le&De,F[24]=Ve^~ft&Ct,F[25]=Je^~an&it,F[34]=Zt^~ne&Ee,F[35]=Jt^~ve&we,F[44]=$e^~dt&Wt,F[45]=gt^~ct&vn,F[6]=de^~G&ce,F[7]=me^~R&be,F[16]=Te^~He&S,F[17]=Le^~De&V,F[26]=ft^~Ct&he,F[27]=an^~it&Me,F[36]=ne^~Ee&lr,F[37]=ve^~we&yt,F[46]=dt^~Wt&Ce,F[47]=ct^~vn&ze,F[8]=G^~ce&Be,F[9]=R^~be&Q,F[18]=He^~S&te,F[19]=De^~V&ae,F[28]=Ct^~he&Se,F[29]=it^~Me&Fe,F[38]=Ee^~lr&jt,F[39]=we^~yt&Zs,F[48]=Wt^~Ce&st,F[49]=vn^~ze&Xe,F[0]^=d[re],F[1]^=d[re+1]};if(a)n.exports=v;else for(L=0;L>6===2;o++)s++;return s}return n===Yi.OVERRUN?t.length-e-1:0}function SV(n,e,t,r,i){return n===Yi.OVERLONG?(r.push(i),0):(r.push(65533),pN(n,e,t))}const TV=Object.freeze({error:MV,ignore:pN,replace:SV});function mN(n,e){e==null&&(e=TV.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(Yi.UNEXPECTED_CONTINUE,r-1,n,t):r+=e(Yi.BAD_PREFIX,r-1,n,t);continue}if(r-1+s>=n.length){r+=e(Yi.OVERRUN,r-1,n,t);continue}let a=i&(1<<8-s-1)-1;for(let l=0;l1114111){r+=e(Yi.OUT_OF_RANGE,r-1-s,n,t,a);continue}if(a>=55296&&a<=57343){r+=e(Yi.UTF16_SURROGATE,r-1-s,n,t,a);continue}if(a<=o){r+=e(Yi.OVERLONG,r-1-s,n,t,a);continue}t.push(a)}}return t}function Aa(n,e=lm.current){e!=lm.current&&(dN.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 IV(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function ig(n,e){return IV(mN(n,e))}function RV(n,e=lm.current){return mN(Aa(n,e))}function _f(n){return sr(Aa(n))}const gN="hash/5.7.0";function vN(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 FV(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 O=B+T>>>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 LV(n){let e=0;return()=>n[e++]}function PV(n){return LV(UV(n))}function DV(n){return n&1?~n>>1:n>>1}function OV(n,e){let t=Array(n);for(let r=0;re[o]):t}function kV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(HV(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(zV(t,n))}return FV(vN(e))}function QV(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(t)}return e}function yN(n,e,t){let r=Array(n).fill(void 0).map(()=>[]);for(let i=0;ir[o].push(s));return r}function HV(n,e){let t=1+e(),r=e(),i=QV(e),s=yN(i.length,1+n,e);return vN(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 zV(n,e){let t=1+e();return yN(t,1+n,e).map(i=>[i[0],i.slice(1)])}function GV(n){let e=By(n).sort((r,i)=>r-i);return t();function t(){let r=[];for(;;){let A=By(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 VV(){return PV(AN("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 ox=VV(),jV=new Set(By(ox)),WV=new Set(By(ox)),KV=kV(ox),YV=GV(ox),j2=45,W2=95;function wN(n){return RV(n)}function XV(n){return n.filter(e=>e!=65039)}function xN(n){for(let e of n.split(".")){let t=wN(e);try{for(let r=t.lastIndexOf(W2)-1;r>=0;r--)if(t[r]!==W2)throw new Error("underscore only allowed at start");if(t.length>=4&&t.every(r=>r<128)&&t[2]===j2&&t[3]===j2)throw new Error("invalid label extension")}catch(r){throw new Error(`Invalid label "${e}": ${r.message}`)}}return n}function $V(n){return xN(ZV(n,XV))}function ZV(n,e){let t=wN(n).reverse(),r=[];for(;t.length;){let i=qV(t);if(i){r.push(...e(i));continue}let s=t.pop();if(jV.has(s)){r.push(s);continue}if(WV.has(s))continue;let o=KV[s];if(o){r.push(...o);continue}throw new Error(`Disallowed codepoint: 0x${s.toString(16).toUpperCase()}`)}return xN(JV(String.fromCodePoint(...r)))}function JV(n){return n.normalize("NFC")}function qV(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 ej=new ge(gN),_N=new Uint8Array(32);_N.fill(0);function K2(n){if(n.length===0)throw new Error("invalid ENS name; empty component");return n}function bN(n){const e=Aa($V(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(K2(e.slice(r))),t}function Lv(n){typeof n!="string"&&ej.throwArgumentError("invalid ENS name; not a string","name",n);let e=_N;const t=bN(n);for(;t.length;)e=sr(qi([e,sr(t.pop())]));return nt(e)}function tj(n){return nt(qi(bN(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 nj="rlp/5.7.0",Go=new ge(nj);function Y2(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function X2(n,e,t){let r=0;for(let i=0;ie+1+r&&Go.throwError("child data too short",ge.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function EN(n,e){if(n.length===0&&Go.throwError("data too short",ge.errors.BUFFER_OVERRUN,{}),n[e]>=248){const t=n[e]-247;e+1+t>n.length&&Go.throwError("data short segment too short",ge.errors.BUFFER_OVERRUN,{});const r=X2(n,e+1,t);return e+1+t+r>n.length&&Go.throwError("data long segment too short",ge.errors.BUFFER_OVERRUN,{}),$2(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",ge.errors.BUFFER_OVERRUN,{}),$2(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",ge.errors.BUFFER_OVERRUN,{});const r=X2(n,e+1,t);e+1+t+r>n.length&&Go.throwError("data array too short",ge.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",ge.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 CM(n){const e=at(n),t=EN(e,0);return t.consumed!==e.length&&Go.throwArgumentError("invalid rlp data","data",n),t.result}const rj="address/5.7.0",bf=new ge(rj);function Z2(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(sr(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 ij=9007199254740991;function sj(n){return Math.log10?Math.log10(n):Math.log(n)/Math.LN10}const MM={};for(let n=0;n<10;n++)MM[String(n)]=String(n);for(let n=0;n<26;n++)MM[String.fromCharCode(65+n)]=String(10+n);const J2=Math.floor(sj(ij));function oj(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>MM[r]).join("");for(;e.length>=J2;){let r=e.substring(0,J2);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 Nr(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=Z2(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)!==oj(n)&&bf.throwArgumentError("bad icap checksum","address",n),e=aV(n.substring(4));e.length<40;)e="0"+e;e=Z2("0x"+e)}else bf.throwArgumentError("invalid address","address",n);return e}function CN(n){let e=null;try{e=Nr(n.from)}catch{bf.throwArgumentError("missing from address","transaction",n)}const t=dh(at(Ge.from(n.nonce).toHexString()));return Nr(jr(sr(ax([e,t])),12))}var aj=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 Sn=new ge(gN),MN=new Uint8Array(32);MN.fill(0);const lj=Ge.from(-1),SN=Ge.from(0),TN=Ge.from(1),Aj=Ge.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function cj(n){const e=at(n),t=e.length%32;return t?Bi([e,MN.slice(t)]):nt(e)}const uj=Qn(TN.toHexString(),32),fj=Qn(SN.toHexString(),32),q2={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},R_=["name","version","chainId","verifyingContract","salt"];function eI(n){return function(e){return typeof e!="string"&&Sn.throwArgumentError(`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const hj={name:eI("name"),version:eI("version"),chainId:function(n){try{return Ge.from(n).toString()}catch{}return Sn.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",n)},verifyingContract:function(n){try{return Nr(n).toLowerCase()}catch{}return Sn.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 Sn.throwArgumentError('invalid domain value "salt"',"domain.salt",n)}};function F_(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))&&Sn.throwArgumentError("invalid numeric width","type",n);const i=Aj.mask(t?r-1:r),s=t?i.add(TN).mul(lj):SN;return function(o){const a=Ge.from(o);return(a.lt(s)||a.gt(i))&&Sn.throwArgumentError(`value out-of-bounds for ${n}`,"value",o),Qn(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))&&Sn.throwArgumentError("invalid bytes width","type",n),function(r){return at(r).length!==t&&Sn.throwArgumentError(`invalid length for ${n}`,"value",r),cj(r)}}}switch(n){case"address":return function(e){return Qn(Nr(e),32)};case"bool":return function(e){return e?uj:fj};case"bytes":return function(e){return sr(e)};case"string":return function(e){return _f(e)}}return null}function tI(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}class ji{constructor(e){Ue(this,"types",Object.freeze(rs(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]&&Sn.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&&Sn.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!F_(c)&&(r[c]||Sn.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?Sn.throwArgumentError("missing primary type","types",e):s.length>1&&Sn.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]&&Sn.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]=tI(a,e[a])+l.map(A=>tI(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=F_(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&&Sn.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",a);let l=a.map(s);return this._types[i]&&(l=l.map(sr)),sr(Bi(l))}}const r=this.types[e];if(r){const i=_f(this._types[e]);return s=>{const o=r.map(({name:a,type:l})=>{const A=this.getEncoder(l)(s[a]);return this._types[l]?sr(A):A});return o.unshift(i),Bi(o)}}return Sn.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||Sn.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return sr(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(F_(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&&Sn.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),{}):Sn.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new ji(e)}static getPrimaryType(e){return ji.from(e).primaryType}static hashStruct(e,t,r){return ji.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){const i=q2[r];i||Sn.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:i})}return t.sort((r,i)=>R_.indexOf(r.name)-R_.indexOf(i.name)),ji.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return Bi(["0x1901",ji.hashDomain(e),ji.from(t).hash(r)])}static hash(e,t,r){return sr(ji.encode(e,t,r))}static resolveNames(e,t,r,i){return aj(this,void 0,void 0,function*(){e=En(e);const s={};e.verifyingContract&&!Et(e.verifyingContract,20)&&(s[e.verifyingContract]="0x");const o=ji.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){ji.hashDomain(e);const i={},s=[];R_.forEach(l=>{const A=e[l];A!=null&&(i[l]=hj[l](A),s.push({name:l,type:q2[l]}))});const o=ji.from(t),a=En(t);return a.EIP712Domain?Sn.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"&&Sn.throwArgumentError("invalid string","value",A),A}return Sn.throwArgumentError("unsupported type","type",l)})}}}var IN={},Ft={},sg=RN;function RN(n,e){if(!n)throw new Error(e||"Assertion failed")}RN.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var FB={exports:{}};typeof Object.create=="function"?FB.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:FB.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 dj=FB.exports,pj=sg,mj=dj;Ft.inherits=mj;function gj(n,e){return(n.charCodeAt(e)&64512)!==55296||e<0||e+1>=n.length?!1:(n.charCodeAt(e+1)&64512)===56320}function vj(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):gj(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=FN;function wj(n,e){for(var t="",r=0;r>>0}return s}Ft.join32=xj;function _j(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=_j;function bj(n,e){return n>>>e|n<<32-e}Ft.rotr32=bj;function Bj(n,e){return n<>>32-e}Ft.rotl32=Bj;function Ej(n,e){return n+e>>>0}Ft.sum32=Ej;function Cj(n,e,t){return n+e+t>>>0}Ft.sum32_3=Cj;function Mj(n,e,t,r){return n+e+t+r>>>0}Ft.sum32_4=Mj;function Sj(n,e,t,r,i){return n+e+t+r+i>>>0}Ft.sum32_5=Sj;function Tj(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=Tj;function Ij(n,e,t,r){var i=e+r>>>0,s=(i>>0}Ft.sum64_hi=Ij;function Rj(n,e,t,r){var i=e+r;return i>>>0}Ft.sum64_lo=Rj;function Fj(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=Fj;function Uj(n,e,t,r,i,s,o,a){var l=e+r+s+a;return l>>>0}Ft.sum64_4_lo=Uj;function Lj(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=Lj;function Pj(n,e,t,r,i,s,o,a,l,A){var c=e+r+s+a+A;return c>>>0}Ft.sum64_5_lo=Pj;function Dj(n,e,t){var r=e<<32-t|n>>>t;return r>>>0}Ft.rotr64_hi=Dj;function Oj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.rotr64_lo=Oj;function Nj(n,e,t){return n>>>t}Ft.shr64_hi=Nj;function kj(n,e,t){var r=n<<32-t|e>>>t;return r>>>0}Ft.shr64_lo=kj;var Gh={},nI=Ft,Qj=sg;function lx(){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}Gh.BlockHash=lx;lx.prototype.update=function(e,t){if(e=nI.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=nI.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}ya.g0_256=jj;function Wj(n){return na(n,17)^na(n,19)^n>>>10}ya.g1_256=Wj;var ph=Ft,Kj=Gh,Yj=ya,U_=ph.rotl32,gd=ph.sum32,Xj=ph.sum32_5,$j=Yj.ft_1,NN=Kj.BlockHash,Zj=[1518500249,1859775393,2400959708,3395469782];function ca(){if(!(this instanceof ca))return new ca;NN.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}ph.inherits(ca,NN);var Jj=ca;ca.blockSize=512;ca.outSize=160;ca.hmacStrength=80;ca.padLength=64;ca.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()),kW(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 VW=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 lo=new ge(HW);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(EM(n)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return ig(n)}catch{}return nt(n)}return n}function jW(n){return Aa(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function WW(n,e,t){const r=typeof n=="object"&&n.throttleLimit!=null?n.throttleLimit:12;lo.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;lo.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)&&lo.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&&lo.throwError("basic authentication requires a secure https url",ge.errors.INVALID_ARGUMENT,{argument:"url",url:l,user:n.user,password:"[REDACTED]"});const m=n.user+":"+n.password;a.authorization={key:"Authorization",value:"Basic "+cN(Aa(m))}}n.skipFetchSetup!=null&&(A.skipFetchSetup=!!n.skipFetchSetup),n.fetchOptions!=null&&(A.fetchOptions=En(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]?AN(h[3]):jW(h[3])};let y=m.body;return t&&(y=t(m.body,m)),Promise.resolve(y)}catch(m){lo.throwError("processing response error",ge.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,_(lo.makeError("timeout",ge.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 VW(this,void 0,void 0,function*(){for(let m=0;m=300)&&(d.cancel(),lo.throwError("bad response",ge.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(ig(s))}catch(l){lo.throwError("invalid JSON",ge.errors.SERVER_ERROR,{body:s,error:l})}return t&&(a=t(a,o)),a},i=null;if(e!=null){i=Aa(e);const s=typeof n=="string"?{url:n}:En(n);s.headers?Object.keys(s.headers).filter(a=>a.toLowerCase()==="content-type").length!==0||(s.headers=En(s.headers),s.headers["content-type"]="application/json"):s.headers={"content-type":"application/json"},n=s}return WW(n,i,r)}function Bf(n,e){return e||(e={}),e=En(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 Ey="qpzry9x8gf2tvdw0s3jn54khce6mua7l",PB={};for(var Ng=0;Ng>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 XN(n){for(var e=1,t=0;t126)return"Invalid prefix ("+n+")";e=$f(e)^r>>5}for(e=$f(e),t=0;tt)throw new TypeError("Exceeds length limit");n=n.toLowerCase();var r=XN(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=$f(r)^o,i+=Ey.charAt(o)}for(s=0;s<6;++s)r=$f(r);for(r^=1,s=0;s<6;++s){var a=r>>(5-s)*5&31;i+=Ey.charAt(a)}return i}function $N(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=XN(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=$N.apply(null,arguments);if(typeof n=="object")return n}function XW(n){var e=$N.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function cx(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}),Cy=fs.getNAF,n9=fs.getJSF,My=fs.assert;function HA(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 Jc=HA;HA.prototype.point=function(){throw new Error("Not implemented")};HA.prototype.validate=function(){throw new Error("Not implemented")};HA.prototype._fixedNafMul=function(e,t){My(e.precomputed);var r=e._getDoubles(),i=Cy(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];My(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};HA.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]=Cy(r[p],o[p],this._bitLength),l[d]=Cy(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=n9(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 T=0;c>=0;){var b=!0;for(u=0;u=0&&T++,_=_.dblp(T),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};js.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}]};Ws.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}};Ws.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)};Ws.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};Ws.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 Qr(n,e,t,r){Jc.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}TM(Qr,Jc.BasePoint);Ws.prototype.jpoint=function(e,t,r){return new Qr(this,e,t,r)};Qr.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)};Qr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Qr.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)};Qr.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)};Qr.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}};Qr.prototype.inspect=function(){return this.isInfinity()?"":""};Qr.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Pv=Wh(function(n,e){var t=e;t.base=Jc,t.short=i9,t.mont=null,t.edwards=null}),Dv=Wh(function(n,e){var t=e,r=fs.assert;function i(a){a.type==="short"?this.curve=new Pv.short(a):a.type==="edwards"?this.curve=new Pv.edwards(a):this.curve=new Pv.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 IA(n){if(!(this instanceof IA))return new IA(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=yo.toArray(n.entropy,n.entropyEnc||"hex"),t=yo.toArray(n.nonce,n.nonceEnc||"hex"),r=yo.toArray(n.pers,n.persEnc||"hex");SM(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,t,r)}var JN=IA;IA.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};IA.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=yo.toArray(r,i||"hex"),this._update(r));for(var s=[];s.length"};var s9=fs.assert;function ux(n,e){if(n instanceof ux)return n;this._importDER(n,e)||(s9(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 fx=ux;function o9(){this.place=0}function O_(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 AI(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)}ux.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=AI(t),r=AI(r);!r[0]&&!(r[1]&128);)r=r.slice(1);var i=[2];N_(i,t.length),i=i.concat(t),i.push(2),N_(i,r.length);var s=i.concat(r),o=[48];return N_(o,s.length),o=o.concat(s),fs.encode(o,e)};var a9=function(){throw new Error("unsupported")},qN=fs.assert;function Qs(n){if(!(this instanceof Qs))return new Qs(n);typeof n=="string"&&(qN(Object.prototype.hasOwnProperty.call(Dv,n),"Unknown curve "+n),n=Dv[n]),n instanceof Dv.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 l9=Qs;Qs.prototype.keyPair=function(e){return new IM(this,e)};Qs.prototype.keyFromPrivate=function(e,t){return IM.fromPrivate(this,e,t)};Qs.prototype.keyFromPublic=function(e,t){return IM.fromPublic(this,e,t)};Qs.prototype.genKeyPair=function(e){e||(e={});for(var t=new JN({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||a9(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)}};Qs.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};Qs.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 JN({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 fx({r:p,s:d,recoveryParam:g})}}}}}};Qs.prototype.verify=function(e,t,r,i){e=this._truncateToN(new vt(e,16)),r=this.keyFromPublic(r,i),t=new fx(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)};Qs.prototype.recoverPubKey=function(n,e,t,r){qN((3&t)===t,"The recovery param is more than two bits"),e=new fx(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)};Qs.prototype.getKeyRecoveryParam=function(n,e,t,r){if(e=new fx(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 A9=Wh(function(n,e){var t=e;t.version="6.5.4",t.utils=fs,t.rand=function(){throw new Error("unsupported")},t.curve=Pv,t.curves=Dv,t.ec=l9,t.eddsa=null}),c9=A9.ec;const u9="signing-key/5.7.0",OB=new ge(u9);let k_=null;function Vo(){return k_||(k_=new c9("secp256k1")),k_}class f9{constructor(e){Ue(this,"curve","secp256k1"),Ue(this,"privateKey",nt(e)),Pc(this.privateKey)!==32&&OB.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=Vo().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=Vo().keyFromPublic(at(this.publicKey)),r=Vo().keyFromPublic(at(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){const t=Vo().keyFromPrivate(at(this.privateKey)),r=at(e);r.length!==32&&OB.throwArgumentError("bad digest length","digest",e);const i=t.sign(r,{canonical:!0});return sx({recoveryParam:i.recoveryParam,r:Qn("0x"+i.r.toString(16),32),s:Qn("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const t=Vo().keyFromPrivate(at(this.privateKey)),r=Vo().keyFromPublic(at(ek(e)));return Qn("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function h9(n,e){const t=sx(e),r={r:at(t.r),s:at(t.s)};return"0x"+Vo().recoverPubKey(at(n),r,t.recoveryParam).encode("hex",!1)}function ek(n,e){const t=at(n);if(t.length===32){const r=new f9(t);return e?"0x"+Vo().keyFromPrivate(t).getPublic(!0,"hex"):r.publicKey}else{if(t.length===33)return e?nt(t):"0x"+Vo().keyFromPublic(t).getPublic(!1,"hex");if(t.length===65)return e?"0x"+Vo().keyFromPublic(t).getPublic(!0,"hex"):nt(t)}return OB.throwArgumentError("invalid public or private key","key","[REDACTED]")}const d9="transactions/5.7.0",Bl=new ge(d9);var cI;(function(n){n[n.legacy=0]="legacy",n[n.eip2930=1]="eip2930",n[n.eip1559=2]="eip1559"})(cI||(cI={}));function RM(n){return n==="0x"?null:Nr(n)}function Kr(n){return n==="0x"?fN:Ge.from(n)}function p9(n){const e=ek(n);return Nr(jr(sr(jr(e,1)),12))}function tk(n,e){return p9(h9(at(n),e))}function Xi(n,e){const t=dh(Ge.from(n).toHexString());return t.length>32&&Bl.throwArgumentError("invalid length for "+e,"transaction:"+e,n),t}function Q_(n,e){return{address:Nr(n),storageKeys:(e||[]).map((t,r)=>(Pc(t)!==32&&Bl.throwArgumentError("invalid access list storageKey",`accessList[${n}:${r}]`,t),t.toLowerCase()))}}function qc(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),Q_(t[0],t[1])):Q_(t.address,t.storageKeys));const e=Object.keys(n).map(t=>{const r=n[t].reduce((i,s)=>(i[s]=!0,i),{});return Q_(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function nk(n){return qc(n).map(e=>[e.address,e.storageKeys])}function m9(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=[Xi(n.chainId||0,"chainId"),Xi(n.nonce||0,"nonce"),Xi(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Xi(n.maxFeePerGas||0,"maxFeePerGas"),Xi(n.gasLimit||0,"gasLimit"),n.to!=null?Nr(n.to):"0x",Xi(n.value||0,"value"),n.data||"0x",nk(n.accessList||[])];if(e){const r=sx(e);t.push(Xi(r.recoveryParam,"recoveryParam")),t.push(dh(r.r)),t.push(dh(r.s))}return Bi(["0x02",ax(t)])}function g9(n,e){const t=[Xi(n.chainId||0,"chainId"),Xi(n.nonce||0,"nonce"),Xi(n.gasPrice||0,"gasPrice"),Xi(n.gasLimit||0,"gasLimit"),n.to!=null?Nr(n.to):"0x",Xi(n.value||0,"value"),n.data||"0x",nk(n.accessList||[])];if(e){const r=sx(e);t.push(Xi(r.recoveryParam,"recoveryParam")),t.push(dh(r.r)),t.push(dh(r.s))}return Bi(["0x01",ax(t)])}function rk(n,e,t){try{const r=Kr(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=Qn(e[1],32),n.s=Qn(e[2],32);try{const r=sr(t(n));n.from=tk(r,{r:n.r,s:n.s,recoveryParam:n.v})}catch{}}function v9(n){const e=CM(n.slice(1));e.length!==9&&e.length!==12&&Bl.throwArgumentError("invalid component count for transaction type: 2","payload",nt(n));const t=Kr(e[2]),r=Kr(e[3]),i={type:2,chainId:Kr(e[0]).toNumber(),nonce:Kr(e[1]).toNumber(),maxPriorityFeePerGas:t,maxFeePerGas:r,gasPrice:null,gasLimit:Kr(e[4]),to:RM(e[5]),value:Kr(e[6]),data:e[7],accessList:qc(e[8])};return e.length===9||(i.hash=sr(n),rk(i,e.slice(9),m9)),i}function y9(n){const e=CM(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:Kr(e[0]).toNumber(),nonce:Kr(e[1]).toNumber(),gasPrice:Kr(e[2]),gasLimit:Kr(e[3]),to:RM(e[4]),value:Kr(e[5]),data:e[6],accessList:qc(e[7])};return e.length===8||(t.hash=sr(n),rk(t,e.slice(8),g9)),t}function w9(n){const e=CM(n);e.length!==9&&e.length!==6&&Bl.throwArgumentError("invalid raw transaction","rawTransaction",n);const t={nonce:Kr(e[0]).toNumber(),gasPrice:Kr(e[1]),gasLimit:Kr(e[2]),to:RM(e[3]),value:Kr(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=Qn(e[7],32),t.s=Qn(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=sr(ax(i));try{t.from=tk(s,{r:nt(t.r),s:nt(t.s),recoveryParam:r})}catch{}t.hash=sr(n)}return t.type=null,t}function x9(n){const e=at(n);if(e[0]>127)return w9(e);switch(e[0]){case 1:return y9(e);case 2:return v9(e)}return Bl.throwError(`unsupported transaction type: ${e[0]}`,ge.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const yd=new ge(ti);let uI=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=En(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 qc(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():yd.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 Nr(e)}callAddress(e){if(!Et(e,32))return null;const t=Nr(jr(e,12));return t===yV?null:t}contractAddress(e){return CN(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 ix(e);throw new Error("invalid blockTag")}hash(e,t){const r=this.hex(e,t);return Pc(r)!==32?yd.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 Qn(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 x9(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&&yd.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=r,delete t.root):yd.throwArgumentError("invalid alt-root-status","value.root",t.root)}else t.root.length!==66&&yd.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 _9(n){return n&&typeof n.isCommunityResource=="function"}function fI(n){return _9(n)&&n.isCommunityResource()}let hI=!1;function hx(){hI||(hI=!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 pt=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 ge(ti),b9=10;function dI(n){return n==null?"null":(Pc(n)!==32&&Bt.throwArgumentError("invalid topic","topic",n),n.toLowerCase())}function pI(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[dI(i)]=!0});const r=Object.keys(t);return r.sort(),r.join("|")}else return dI(e)}).join("&")}function B9(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 pu(n){if(typeof n=="string"){if(n=n.toLowerCase(),Pc(n)===32)return"tx:"+n;if(n.indexOf(":")===-1)return n}else{if(Array.isArray(n))return"filter:*:"+pI(n);if(mV.isForkEvent(n))throw Bt.warn("not implemented"),new Error("not implemented");if(n&&typeof n=="object")return"filter:"+(n.address||"*")+":"+pI(n.topics||[])}throw new Error("invalid event - "+n)}function wd(){return new Date().getTime()}function mI(n){return new Promise(e=>{setTimeout(e,n)})}const E9=["block","network","pending","poll"];let C9=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=B9(e[2]),i={};return r.length>0&&(i.topics=r),t&&t!=="*"&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||E9.indexOf(this.tag)>=0}};const M9={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 H_(n){return Qn(Ge.from(n).toHexString(),32)}function gI(n){return RB.encode(qi([n,jr(oI(oI(n)),0,4)]))}const ik=new RegExp("^(ipfs)://(.*)$","i"),vI=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),ik,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function Ov(n,e){try{return ig(Am(n,e))}catch{}return null}function Am(n,e){if(n==="0x")return null;const t=Ge.from(jr(n,e,e+32)).toNumber(),r=Ge.from(jr(n,t,t+32)).toNumber();return jr(n,t+32,t+32+r)}function z_(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 yI(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 S9(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}function sk(n){const e=[];let t=0;for(let r=0;rGe.from(e).eq(1)).catch(e=>{if(e.code===ge.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,t){return pt(this,void 0,void 0,function*(){const r={to:this.address,ccipReadEnabled:!0,data:Bi([e,Lv(this.name),t||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,r.data=Bi(["0x9061b923",sk([tj(this.name),r.data])]));try{let s=yield this.provider.call(r);return at(s).length%32===4&&Bt.throwError("resolver threw error",ge.errors.CALL_EXCEPTION,{transaction:r,data:s}),i&&(s=Am(s,0)),s}catch(s){if(s.code===ge.errors.CALL_EXCEPTION)return null;throw s}})}_fetchBytes(e,t){return pt(this,void 0,void 0,function*(){const r=yield this._fetch(e,t);return r!=null?Am(r,0):null})}_getAddress(e,t){const r=M9[String(e)];if(r==null&&Bt.throwError(`unsupported coin type: ${e}`,ge.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 gI(qi([[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 gI(qi([[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=lI.toWords(i.slice(2));return a.unshift(o),lI.encode(r.prefix,a)}}return null}getAddress(e){return pt(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===bV?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===ge.errors.CALL_EXCEPTION)return null;throw i}const t=yield this._fetchBytes("0xf1cb7e06",H_(e));if(t==null||t==="0x")return null;const r=this._getAddress(e,t);return r==null&&Bt.throwError("invalid or unsupported coin data",ge.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),r})}getAvatar(){return pt(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",ge.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return pt(this,void 0,void 0,function*(){let t=Aa(e);t=qi([H_(64),H_(t.length),t]),t.length%32!==0&&(t=qi([t,Qn("0x",32-e.length%32)]));const r=yield this._fetchBytes("0x59d1d43c",nt(t));return r==null||r==="0x"?null:ig(r)})}}let G_=null,T9=1;class FM extends rg{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=es(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 pt(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",ge.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 Bf(()=>this._ready().then(e=>e,e=>{if(!(e.code===ge.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return G_==null&&(G_=new uI),G_}static getNetwork(e){return lN(e??"homestead")}ccipReadFetch(e,t,r){return pt(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 Ax({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}`,ge.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(", ")}`,ge.errors.SERVER_ERROR,{urls:r,errorMessages:o})})}_getInternalBlockNumber(e){return pt(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(wd()-s.respTime<=e)return s.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const t=wd(),r=tr({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=wd();return i=Ge.from(i).toNumber(),i{this._internalBlockNumber===r&&(this._internalBlockNumber=null)}),(yield r).blockNumber})}poll(){return pt(this,void 0,void 0,function*(){const e=T9++,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",ge.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 pt(this,void 0,void 0,function*(){return Bt.throwError("provider does not support network detection",ge.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return pt(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 mI(0),this._network;const r=Bt.makeError("underlying network changed",ge.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=wd();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 pt(this,void 0,void 0,function*(){return this._waitForTransaction(e,t??1,r||0,null)})}_waitForTransaction(e,t,r,i){return pt(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=>pt(this,void 0,void 0,function*(){A||(yield mI(1e3),this.getTransactionCount(i.from).then(g=>pt(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",ge.errors.TIMEOUT,{timeout:r}))},r);f.unref&&f.unref(),l.push(()=>{clearTimeout(f)})}})})}getBlockNumber(){return pt(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return pt(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",ge.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}})}getBalance(e,t){return pt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield tr({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",ge.errors.SERVER_ERROR,{method:"getBalance",params:r,result:i,error:s})}})}getTransactionCount(e,t){return pt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield tr({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",ge.errors.SERVER_ERROR,{method:"getTransactionCount",params:r,result:i,error:s})}})}getCode(e,t){return pt(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield tr({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",ge.errors.SERVER_ERROR,{method:"getCode",params:r,result:i,error:s})}})}getStorageAt(e,t,r){return pt(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield tr({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then(o=>ix(o))}),s=yield this.perform("getStorageAt",i);try{return nt(s)}catch(o){return Bt.throwError("bad result from backend",ge.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:s,error:o})}})}_wrapTransaction(e,t,r){if(t!=null&&Pc(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.",ge.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=(s,o)=>pt(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",ge.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:l}),l)}),i}sendTransaction(e){return pt(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 pt(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 tr(r))})}_getFilter(e){return pt(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 tr(t))})}_call(e,t,r){return pt(this,void 0,void 0,function*(){r>=b9&&Bt.throwError("CCIP read exceeded maximum redirections",ge.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"&&Pc(s)%32===4)try{const o=jr(s,4),a=jr(o,0,32);Ge.from(a).eq(i)||Bt.throwError("CCIP Read sender did not match",ge.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:s});const l=[],A=Ge.from(jr(o,32,64)).toNumber(),c=Ge.from(jr(o,A,A+32)).toNumber(),u=jr(o,A+32);for(let m=0;mpt(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 pt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Bf(()=>pt(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 pt(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return Bf(()=>pt(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 pt(this,void 0,void 0,function*(){yield this.getNetwork();const t=yield tr({filter:this._getFilter(e)}),r=yield this.perform("getLogs",t);return r.forEach(i=>{i.removed==null&&(i.removed=!1)}),uI.arrayOf(this.formatter.filterLog.bind(this.formatter))(r)})}getEtherPrice(){return pt(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return pt(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 pt(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 wI(this,r,e);return t!==e&&!(yield i.supportsWildcard())?null:i}t=t.split(".").slice(1).join(".")}})}_getResolver(e,t){return pt(this,void 0,void 0,function*(){t==null&&(t="ENS");const r=yield this.getNetwork();r.ensAddress||Bt.throwError("network does not support ENS",ge.errors.UNSUPPORTED_OPERATION,{operation:t,network:r.name});try{const i=yield this.call({to:r.ensAddress,data:"0x0178b8bf"+Lv(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return pt(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 pt(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=Ov(yield this.call({to:r,data:"0x691f3431"+Lv(t).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return pt(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 wI(this,o,s);try{const a=yield t.getAvatar();if(a)return a.url}catch(a){if(a.code!==ge.errors.CALL_EXCEPTION)throw a}try{const a=Ov(yield this.call({to:o,data:"0x691f3431"+Lv(s).substring(2)}),0);t=yield this.getResolver(a)}catch(a){if(a.code!==ge.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",ge.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 C9(pu(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=pu(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=pu(e);return this._events.filter(r=>r.tag===t).length}listeners(e){if(e==null)return this._events.map(r=>r.listener);let t=pu(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=pu(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=pu(e);this._events=this._events.filter(i=>i.tag!==r?!0:(t.push(i),!1))}return t.forEach(r=>{this._stopEvent(r)}),this}}const I9="abstract-signer/5.7.0";var to=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 ge(I9),R9=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],F9=[ge.errors.INSUFFICIENT_FUNDS,ge.errors.NONCE_EXPIRED,ge.errors.REPLACEMENT_UNDERPRICED];class og{constructor(){ys.checkAbstract(new.target,og),Ue(this,"_isSigner",!0)}getBalance(e){return to(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return to(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return to(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const t=yield tr(this.checkTransaction(e));return yield this.provider.estimateGas(t)})}call(e,t){return to(this,void 0,void 0,function*(){this._checkProvider("call");const r=yield tr(this.checkTransaction(e));return yield this.provider.call(r,t)})}sendTransaction(e){return to(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 to(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return to(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return to(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return to(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const r in e)R9.indexOf(r)===-1&&ys.throwArgumentError("invalid transaction key: "+r,"transaction",e);const t=En(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 to(this,void 0,void 0,function*(){const t=yield tr(this.checkTransaction(e));t.to!=null&&(t.to=Promise.resolve(t.to).then(i=>to(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",ge.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),t.gasPrice==null&&(t.gasPrice=i.gasPrice),t.type=0):ys.throwError("failed to get consistent fee data",ge.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(F9.indexOf(i.code)>=0)throw i;return ys.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ge.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 tr(t)})}_checkProvider(e){this.provider||ys.throwError("missing provider",ge.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class UM extends og{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,ge.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 UM(this.address,e)}}var Va=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 nr=new ge(ti),U9=["call","estimateGas"];function Np(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=Np(n[t],e);if(r)return r}return null}if(typeof n=="string")try{return Np(JSON.parse(n),e)}catch{}return null}function ok(n,e,t){const r=t.transaction||t.signedTransaction;if(n==="call"){const s=Np(e,!0);if(s)return s.data;nr.throwError("missing revert data in call exception; Transaction reverted without a reason string",ge.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:e})}if(n==="estimateGas"){let s=Np(e.body,!1);s==null&&(s=Np(e,!1)),s&&nr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ge.errors.UNPREDICTABLE_GAS_LIMIT,{reason:s.message,method:n,transaction:r,error:e})}let i=e.message;throw e.code===ge.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)&&nr.throwError("insufficient funds for intrinsic transaction cost",ge.errors.INSUFFICIENT_FUNDS,{error:e,method:n,transaction:r}),i.match(/nonce (is )?too low/i)&&nr.throwError("nonce has already been used",ge.errors.NONCE_EXPIRED,{error:e,method:n,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&nr.throwError("replacement fee too low",ge.errors.REPLACEMENT_UNDERPRICED,{error:e,method:n,transaction:r}),i.match(/only replay-protected/i)&&nr.throwError("legacy pre-eip-155 transactions not supported",ge.errors.UNSUPPORTED_OPERATION,{error:e,method:n,transaction:r}),U9.indexOf(n)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&nr.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",ge.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:r}),e}function xI(n){return new Promise(function(e){setTimeout(e,n)})}function L9(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 xd(n){return n&&n.toLowerCase()}const NB={};class ak extends og{constructor(e,t,r){if(super(),e!==NB)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)):nr.throwArgumentError("invalid address or index","addressOrIndex",r)}connect(e){return nr.throwError("cannot alter JSON-RPC Signer connection",ge.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new P9(NB,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&&nr.throwError("unknown account #"+this._index,ge.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=En(e);const t=this.getAddress().then(r=>(r&&(r=r.toLowerCase()),r));if(e.gasLimit==null){const r=En(e);r.from=t,e.gasLimit=this.provider.estimateGas(r)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(r=>Va(this,void 0,void 0,function*(){if(r==null)return null;const i=yield this.provider.resolveName(r);return i==null&&nr.throwArgumentError("provided ENS name resolves to null","tx.to",r),i}))),tr({tx:tr(e),sender:t}).then(({tx:r,sender:i})=>{r.from!=null?r.from.toLowerCase()!==i&&nr.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)&&nr.throwError("user rejected transaction",ge.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:r}),ok("sendTransaction",o,s)))})}signTransaction(e){return nr.throwError("signing transactions is unsupported",ge.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return Va(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 Bf(()=>Va(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 Va(this,void 0,void 0,function*(){const t=typeof e=="string"?Aa(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)&&nr.throwError("user rejected signing",ge.errors.ACTION_REJECTED,{action:"signMessage",from:r,messageData:e}),i}})}_legacySignMessage(e){return Va(this,void 0,void 0,function*(){const t=typeof e=="string"?Aa(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)&&nr.throwError("user rejected signing",ge.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:r,messageData:e}),i}})}_signTypedData(e,t,r){return Va(this,void 0,void 0,function*(){const i=yield ji.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(ji.getPayload(i.domain,t,i.value))])}catch(o){throw typeof o.message=="string"&&o.message.match(/user denied/i)&&nr.throwError("user rejected signing",ge.errors.ACTION_REJECTED,{action:"_signTypedData",from:s,messageData:{domain:i.domain,types:t,value:i.value}}),o}})}unlock(e){return Va(this,void 0,void 0,function*(){const t=this.provider,r=yield this.getAddress();return t.send("personal_unlockAccount",[r.toLowerCase(),e,null])})}}class P9 extends ak{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 D9={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class cm extends FM{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=es(this.constructor,"defaultUrl")()),typeof e=="string"?Ue(this,"connection",Object.freeze({url:e})):Ue(this,"connection",Object.freeze(En(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 Va(this,void 0,void 0,function*(){yield xI(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=es(this.constructor,"getNetwork");try{return t(Ge.from(e).toNumber())}catch(r){return nr.throwError("could not detect network",ge.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:r})}}return nr.throwError("could not detect network",ge.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new ak(NB,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:rs(r),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const s=Ax(this.connection,JSON.stringify(r),L9).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",[xd(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[xd(t.address),t.blockTag]];case"getCode":return["eth_getCode",[xd(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[xd(t.address),Qn(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",[es(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[es(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&t.filter.address!=null&&(t.filter.address=xd(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return Va(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=En(t),t.transaction=En(i),delete t.transaction.type)}}const r=this.prepareRequest(e,t);r==null&&nr.throwError(e+" not implemented",ge.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(r[0],r[1])}catch(i){return ok(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 xI(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=En(D9);if(t)for(const s in t)t[s]&&(r[s]=!0);cV(e,r);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(s){if(e[s]==null)return;const o=ix(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=qc(e.accessList)),i}}let kp=null;try{if(kp=WebSocket,kp==null)throw new Error("inject please")}catch{const e=new ge(ti);kp=function(){e.throwError("WebSockets not supported in this environment",ge.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var V_=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 kg=new ge(ti);let O9=1;class LM extends cm{constructor(e,t){t==="any"&&kg.throwError("WebSocketProvider does not support 'any' network yet",ge.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 kp(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){kg.throwError("cannot reset events block on WebSocketProvider",ge.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){kg.throwError("cannot set polling interval on WebSocketProvider",ge.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return V_(this,void 0,void 0,function*(){return null})}set polling(e){e&&kg.throwError("cannot set polling on WebSocketProvider",ge.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,t){const r=O9++;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 V_(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 V_(this,void 0,void 0,function*(){this.websocket.readyState===kp.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var N9=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 fp=new ge(ti);class lk extends cm{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return N9(this,void 0,void 0,function*(){let t=this.network;return t==null&&(t=yield e.detectNetwork.call(this),t||fp.throwError("no network detected",ge.errors.UNKNOWN_ERROR,{}),this._network==null&&(Ue(this,"_network",t),this.emit("network",t,null))),t})}}class zA extends lk{constructor(e,t){fp.checkAbstract(new.target,zA),e=es(new.target,"getNetwork")(e),t=es(new.target,"getApiKey")(t);const r=es(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(){fp.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return fp.throwError("API provider does not support signing",ge.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,t){return fp.throwError("not implemented; sub-classes must override getUrl",ge.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const _I=new ge(ti),Nv="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class k9 extends LM{constructor(e,t){const r=new Ak(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===Nv}}class Ak extends zA{static getWebSocketProvider(e,t){return new k9(e,t)}static getApiKey(e){return e==null?Nv:(e&&typeof e!="string"&&_I.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:_I.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+r+t,throttleCallback:(i,s)=>(t===Nv&&hx(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Nv}}const Q9=new ge(ti),Qg="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function H9(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 Q9.throwArgumentError("unsupported network","name",n)}class z9 extends zA{isCommunityResource(){return this.apiKey===Qg}static getApiKey(e){return e??Qg}static getUrl(e,t){t==null&&(t=Qg);const r={allowGzip:!0,url:"https://"+H9(e.name)+t,throttleCallback:(i,s)=>(t.apiKey===Qg&&hx(),Promise.resolve(!0))};return t.projectSecret!=null&&(r.user="",r.password=t.projectSecret),r}}var G9=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 bI=new ge(ti);class V9 extends zA{static getApiKey(e){return e!=null&&bI.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:bI.throwArgumentError("unsupported network","network",arguments[0])}return r}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return G9(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 Hg=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 ge(ti);function BI(n){const e={};for(let t in n){if(n[t]==null)continue;let r=n[t];t==="type"&&r===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[t]?r=ix(nt(r)):t==="accessList"?r="["+qc(r).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":r=nt(r),e[t]=r)}return e}function j9(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 EI(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 CI(n){if(n==="pending")throw new Error("pending not supported");return n==="latest"?n:parseInt(n.substring(2),16)}function j_(n,e,t){if(n==="call"&&e.code===ge.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",ge.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let r=e.message;throw e.code===ge.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",ge.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",ge.errors.NONCE_EXPIRED,{error:e,method:n,transaction:t}),r.match(/another transaction with same nonce/)&&ql.throwError("replacement fee too low",ge.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",ge.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:n,transaction:t}),e}class W9 extends FM{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 Hg(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"?EI:j9;this.emit("debug",{action:"request",request:i,provider:this});const a={url:i,throttleSlotInterval:1e3,throttleCallback:(c,u)=>(this.isCommunityResource()&&hx(),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 Ax(a,l,o||EI);return this.emit("debug",{action:"response",request:i,response:rs(A),provider:this}),A})}detectNetwork(){return Hg(this,void 0,void 0,function*(){return this.network})}perform(e,t){const r=Object.create(null,{perform:{get:()=>super.perform}});return Hg(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=>j_("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=BI(t.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(s){return j_("call",s,t.transaction)}}case"estimateGas":{const i=BI(t.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(s){return j_("estimateGas",s,t.transaction)}}case"getLogs":{const i={action:"getLogs"};if(t.filter.fromBlock&&(i.fromBlock=CI(t.filter.fromBlock)),t.filter.toBlock&&(i.toBlock=CI(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",ge.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",ge.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 K9(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 Sy=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 mc=new ge(ti);function zg(){return new Date().getTime()}function MI(n){let e=null;for(let t=0;te?null:(r+i)/2}function Ef(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=>Ef(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=Ef(r),JSON.stringify(t)+":"+r}).join(",")+"}"}throw new Error("unknown value type: "+typeof n)}let Y9=1;function TI(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 X9=[ge.errors.CALL_EXCEPTION,ge.errors.INSUFFICIENT_FUNDS,ge.errors.NONCE_EXPIRED,ge.errors.REPLACEMENT_UNDERPRICED,ge.errors.UNPREDICTABLE_GAS_LIMIT],$9=["address","args","errorArgs","errorSignature","method","transaction"];function Gg(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 Z9(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 J9(n,e,t){let r=Ef;switch(e){case"getBlockNumber":return function(i){const s=i.map(a=>a.result);let o=SI(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 SI(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=En(i),i.confirmations=-1,Ef(i))};break;case"getBlock":t.includeTransactions?r=function(i){return i==null?null:(i=En(i),i.transactions=i.transactions.map(s=>(s=En(s),s.confirmations=-1,s)),Ef(i))}:r=function(i){return i==null?null:Ef(i)};break;default:throw new Error("unknown method: "+e)}return Z9(r,n.quorum)}function _d(n,e){return Sy(this,void 0,void 0,function*(){const t=n.provider;return t.blockNumber!=null&&t.blockNumber>=e||e===-1?t:Bf(()=>new Promise((r,i)=>{setTimeout(function(){return t.blockNumber>=e?r(t):n.cancelled?r(null):r(void 0)},0)}),{oncePoll:t})})}function q9(n,e,t,r){return Sy(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 _d(n,e)),i[t](r.address,r.blockTag||"latest");case"getStorageAt":return r.blockTag&&Et(r.blockTag)&&(i=yield _d(n,e)),i.getStorageAt(r.address,r.position,r.blockTag||"latest");case"getBlock":return r.blockTag&&Et(r.blockTag)&&(i=yield _d(n,e)),i[r.includeTransactions?"getBlockWithTransactions":"getBlock"](r.blockTag||r.blockHash);case"call":case"estimateGas":return r.blockTag&&Et(r.blockTag)&&(i=yield _d(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 _d(n,e)),i.getLogs(s)}}return mc.throwError("unknown method error",ge.errors.UNKNOWN_ERROR,{method:t,params:r})})}class e7 extends FM{constructor(e,t){e.length===0&&mc.throwArgumentError("missing providers","providers",e);const r=e.map((o,a)=>{if(rg.isProvider(o)){const c=fI(o)?2e3:750;return Object.freeze({provider:o,weight:1,stallTimeout:c,priority:1})}const l=En(o);l.priority==null&&(l.priority=1),l.stallTimeout==null&&(l.stallTimeout=fI(o)?2e3:750),l.weight==null&&(l.weight=1);const A=l.weight;return(A%1||A>512||A<1)&&mc.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&&mc.throwArgumentError("quorum will always fail; larger than total weight","quorum",t);let s=MI(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 Sy(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(t=>t.provider.getNetwork()));return MI(e)})}perform(e,t){return Sy(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=zg();let A=i.filter(h=>h.runner&&l-h.starth+p.weight,0);for(;A{h.staller=null}),h.runner=q9(h,s,e,t).then(d=>{h.done=!0,h.result=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Gg(h,zg()),request:{method:e,params:rs(t)},provider:this})},d=>{h.done=!0,h.error=d,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Gg(h,zg()),request:{method:e,params:rs(t)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Gg(h,null),request:{method:e,params:rs(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 TI(100).getPromise()),a=!1}const f=i.reduce((h,p)=>{if(!p.done||p.error==null)return h;const d=p.error.code;return X9.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={};$9.forEach(m=>{d[m]!=null&&(g[m]=d[m])}),mc.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}),mc.throwError("failed to meet quorum",ge.errors.SERVER_ERROR,{method:e,params:t,results:i.map(l=>Gg(l)),provider:this})})}}const t7=null,kv=new ge(ti),hp="84842078b09946638c03157f83405213";class n7 extends LM{constructor(e,t){const r=new ck(e,t),i=r.connection;i.password&&kv.throwError("INFURA WebSocket project secrets unsupported",ge.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===hp}}class ck extends zA{static getWebSocketProvider(e,t){return new n7(e,t)}static getApiKey(e){const t={apiKey:hp,projectId:hp,projectSecret:null};return e==null||(typeof e=="string"?t.projectId=e:e.projectSecret!=null?(kv.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),kv.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:kv.throwError("unsupported network",ge.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+r+"/v3/"+t.projectId,throttleCallback:(s,o)=>(t.projectId===hp&&hx(),Promise.resolve(!0))};return t.projectSecret!=null&&(i.user="",i.password=t.projectSecret),i}isCommunityResource(){return this.projectId===hp}}const W_=new ge(ti),r7="ETHERS_JS_SHARED";class i7 extends zA{static getApiKey(e){return e&&typeof e!="string"&&W_.throwArgumentError("invalid apiKey","apiKey",e),e||r7}static getUrl(e,t){W_.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:W_.throwArgumentError("unsupported network","network",arguments[0])}return r+"?apiKey="+t}}const II=new ge(ti),RI="62e1ad51b37b8e00394bda3b";class s7 extends zA{static getApiKey(e){const t={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?t.applicationId=RI:typeof e=="string"?t.applicationId=e:e.applicationSecretKey!=null?(t.applicationId=e.applicationId,t.applicationSecretKey=e.applicationSecretKey):e.applicationId?t.applicationId=e.applicationId:II.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:II.throwError("unsupported network",ge.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===RI}}const FI=new ge(ti);let o7=1;function UI(n,e){const t="Web3LegacyFetcher";return function(r,i){const s={method:r,params:i,id:o7++,jsonrpc:"2.0"};return new Promise((o,a)=>{this.emit("debug",{action:"request",fetcher:t,request:rs(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 a7(n){return function(e,t){t==null&&(t=[]);const r={method:e,params:t};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:rs(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 PM extends cm{constructor(e,t){e==null&&FI.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=a7(e)):e.sendAsync?i=UI(e,e.sendAsync.bind(e)):e.send?i=UI(e,e.send.bind(e)):FI.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 LI=new ge(ti);function l7(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 cm(n);case"ws":case"wss":return new LM(n);default:LI.throwArgumentError("unsupported URL scheme","network",n)}}const t=lN(n);return(!t||!t._defaultProvider)&&LI.throwError("unsupported getDefaultProvider network",ge.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:n}),t._defaultProvider({FallbackProvider:e7,AlchemyProvider:Ak,AnkrProvider:z9,CloudflareProvider:V9,EtherscanProvider:W9,InfuraProvider:ck,JsonRpcProvider:cm,NodesmithProvider:i7,PocketProvider:s7,Web3Provider:PM,IpcProvider:t7},e)}var A7=!0,K_="Invariant failed";function qa(n,e){if(!n){if(A7)throw new Error(K_);var t=typeof e=="function"?e():e,r=t?"".concat(K_,": ").concat(t):K_;throw new Error(r)}}var go;(function(n){n.Update="Web3ReactUpdate",n.Error="Web3ReactError",n.Deactivate="Web3ReactDeactivate"})(go||(go={}));function um(){return um=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 Qv(n,e,t){return c7()?Qv=Reflect.construct:Qv=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&fm(A,o.prototype),A},Qv.apply(null,arguments)}function u7(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function Ty(n){var e=typeof Map=="function"?new Map:void 0;return Ty=function(r){if(r===null||!u7(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 Qv(r,arguments,kB(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),fm(i,r)},Ty(n)}typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function PI(n,e){try{var t=n()}catch(r){return e(r)}return t&&t.then?t.then(void 0,e):t}function fk(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)&&qa(!1),e}else return Number.isInteger(n)||qa(!1),n}function hk(n){typeof n=="string"&&n.match(/^(0x)?[0-9a-fA-F]{40}$/)||qa(!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(sr(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&&qa(!1),a}var DI=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=fk(l);if(e.supportedChainIds&&!e.supportedChainIds.includes(c))throw new dk(c,e.supportedChainIds);var u=A===null?A:hk(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)}},Vg=function(n){uk(e,n);function e(){var t;return t=n.call(this)||this,t.name=t.constructor.name,t}return e}(Ty(Error)),dk=function(n){uk(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}(Ty(Error)),_r;(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"})(_r||(_r={}));function f7(n,e){var t=e.type,r=e.payload;switch(t){case _r.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 _r.UPDATE:{var A=r.provider,c=r.chainId,u=r.account;return um({},n,A===void 0?{}:{provider:A},c===void 0?{}:{chainId:c},u===void 0?{}:{account:u})}case _r.UPDATE_FROM_ERROR:{var f=r.provider,h=r.chainId,p=r.account;return um({},n,f===void 0?{}:{provider:f},h===void 0?{}:{chainId:h},p===void 0?{}:{account:p},{error:void 0})}case _r.ERROR:{var d=r.error,g=n.connector,m=n.onError;return{connector:g,error:d,onError:m}}case _r.ERROR_FROM_ACTIVATION:{var y=r.connector,w=r.error;return{connector:y,error:w}}case _r.DEACTIVATE_CONNECTOR:return{}}}function h7(){var n=ye.useReducer(f7,{}),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(PI(function(){return Promise.resolve(g.activate().then(function(_){return x=!0,_})).then(function(_){return Promise.resolve(DI(g,_)).then(function(B){if(A.current>w)throw new Vg;t({type:_r.ACTIVATE_CONNECTOR,payload:um({connector:g},B,{onError:m})})})})},function(_){if(_ instanceof Vg)x&&g.deactivate();else{if(y)throw x&&g.deactivate(),_;m?(x&&g.deactivate(),m(_)):t({type:_r.ERROR_FROM_ACTIVATION,payload:{connector:g,error:_}})}}))}catch(_){return Promise.reject(_)}},[]),u=ye.useCallback(function(g){t({type:_r.ERROR,payload:{error:g}})},[]),f=ye.useCallback(function(){t({type:_r.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 PI(function(){return Promise.resolve(DI(r,g)).then(function(_){if(A.current>m)throw new Vg;t({type:_r.UPDATE_FROM_ERROR,payload:_})})},function(_){_ instanceof Vg||(a?a(_):t({type:_r.ERROR,payload:{error:_}}))});var y=g.chainId===void 0?void 0:fk(g.chainId);if(y!==void 0&&r.supportedChainIds&&!r.supportedChainIds.includes(y)){var w=new dk(y,r.supportedChainIds);a?a(w):t({type:_r.ERROR,payload:{error:w}})}else{var x=typeof g.account=="string"?hk(g.account):g.account;t({type:_r.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:_r.ERROR,payload:{error:g}})},[a]),d=ye.useCallback(function(){t({type:_r.DEACTIVATE_CONNECTOR})},[]);return ye.useEffect(function(){return function(){r&&r.deactivate()}},[r]),ye.useEffect(function(){return r&&r.on(go.Update,h).on(go.Error,p).on(go.Deactivate,d),function(){r&&r.off(go.Update,h).off(go.Error,p).off(go.Deactivate,d)}},[r,h,p,d]),{connector:r,provider:i,chainId:s,account:o,activate:c,setError:u,deactivate:f,error:l}}var pk="primary",Cf={};function d7(n){Cf[n]&&qa(!1),Cf[n]=ye.createContext({activate:function(){try{return qa(!1),Promise.resolve()}catch(t){return Promise.reject(t)}},setError:function(){qa(!1)},deactivate:function(){qa(!1)},active:!1}),Cf[n].displayName="Web3ReactContext - "+n;var e=Cf[n].Provider;return function(r){var i=r.getLibrary,s=r.children,o=h7(),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 $.createElement(e,{value:m},s)}}var p7=d7(pk);function m7(n){return n===void 0&&(n=pk),Object.keys(Cf).includes(n)||qa(!1),Cf[n]}function g7(n){return ye.useContext(m7(n))}var QB={},mk={exports:{}},hs={},gk={exports:{}},vk={};/** * @license React * scheduler.production.min.js * @@ -29,7 +29,7 @@ var CG=Object.defineProperty;var MG=(n,e,t)=>e in n?CG(n,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(n){function e(O,z){var K=O.length;O.push(z);e:for(;0>>1,E=O[Q];if(0>>1;Qi(U,K))Xi(ae,U)?(O[Q]=ae,O[X]=K,Q=X):(O[Q]=U,O[ee]=K,Q=ee);else if(Xi(ae,K))O[Q]=ae,O[X]=K,Q=X;else break e}}return z}function i(O,z){var K=O.sortIndex-z.sortIndex;return K!==0?K:O.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],A=[],c=1,u=null,f=3,h=!1,p=!1,d=!1,g=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(O){for(var z=t(A);z!==null;){if(z.callback===null)r(A);else if(z.startTime<=O)r(A),z.sortIndex=z.expirationTime,e(l,z);else break;z=t(A)}}function x(O){if(d=!1,w(O),!p)if(t(l)!==null)p=!0,F(_);else{var z=t(A);z!==null&&P(x,z.startTime-O)}}function _(O,z){p=!1,d&&(d=!1,m(b),b=-1),h=!0;var K=f;try{for(w(z),u=t(l);u!==null&&(!(u.expirationTime>z)||O&&!Y());){var Q=u.callback;if(typeof Q=="function"){u.callback=null,f=u.priorityLevel;var E=Q(u.expirationTime<=z);z=n.unstable_now(),typeof E=="function"?u.callback=E:u===t(l)&&r(l),w(z)}else r(l);u=t(l)}if(u!==null)var G=!0;else{var ee=t(A);ee!==null&&P(x,ee.startTime-z),G=!1}return G}finally{u=null,f=K,h=!1}}var C=!1,T=null,b=-1,M=5,D=-1;function Y(){return!(n.unstable_now()-DO||125Q?(O.sortIndex=K,e(A,O),t(l)===null&&O===t(A)&&(d?(m(b),b=-1):d=!0,P(x,K-Q))):(O.sortIndex=E,e(l,O),p||h||(p=!0,F(_))),O},n.unstable_shouldYield=Y,n.unstable_wrapCallback=function(O){var z=f;return function(){var K=f;f=z;try{return O.apply(this,arguments)}finally{f=K}}}})(gk);mk.exports=gk;var g7=mk.exports;/** + */(function(n){function e(P,z){var W=P.length;P.push(z);e:for(;0>>1,C=P[N];if(0>>1;Ni(F,W))Xi(ue,F)?(P[N]=ue,P[X]=W,N=X):(P[N]=F,P[ee]=W,N=ee);else if(Xi(ue,W))P[N]=ue,P[X]=W,N=X;else break e}}return z}function i(P,z){var W=P.sortIndex-z.sortIndex;return W!==0?W:P.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;n.unstable_now=function(){return s.now()}}else{var o=Date,a=o.now();n.unstable_now=function(){return o.now()-a}}var l=[],A=[],c=1,u=null,f=3,h=!1,p=!1,d=!1,g=typeof setTimeout=="function"?setTimeout:null,m=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(P){for(var z=t(A);z!==null;){if(z.callback===null)r(A);else if(z.startTime<=P)r(A),z.sortIndex=z.expirationTime,e(l,z);else break;z=t(A)}}function x(P){if(d=!1,w(P),!p)if(t(l)!==null)p=!0,L(_);else{var z=t(A);z!==null&&U(x,z.startTime-P)}}function _(P,z){p=!1,d&&(d=!1,m(b),b=-1),h=!0;var W=f;try{for(w(z),u=t(l);u!==null&&(!(u.expirationTime>z)||P&&!Y());){var N=u.callback;if(typeof N=="function"){u.callback=null,f=u.priorityLevel;var C=N(u.expirationTime<=z);z=n.unstable_now(),typeof C=="function"?u.callback=C:u===t(l)&&r(l),w(z)}else r(l);u=t(l)}if(u!==null)var j=!0;else{var ee=t(A);ee!==null&&U(x,ee.startTime-z),j=!1}return j}finally{u=null,f=W,h=!1}}var B=!1,T=null,b=-1,M=5,O=-1;function Y(){return!(n.unstable_now()-OP||125N?(P.sortIndex=W,e(A,P),t(l)===null&&P===t(A)&&(d?(m(b),b=-1):d=!0,U(x,W-N))):(P.sortIndex=C,e(l,P),p||h||(p=!0,L(_))),P},n.unstable_shouldYield=Y,n.unstable_wrapCallback=function(P){var z=f;return function(){var W=f;f=z;try{return P.apply(this,arguments)}finally{f=W}}}})(vk);gk.exports=vk;var v7=gk.exports;/** * @license React * react-dom.production.min.js * @@ -37,14 +37,14 @@ var CG=Object.defineProperty;var MG=(n,e,t)=>e in n?CG(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 vk=ye,os=g7;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"),QB=Object.prototype.hasOwnProperty,v7=/^[: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]*$/,DI={},OI={};function y7(n){return QB.call(OI,n)?!0:QB.call(DI,n)?!1:v7.test(n)?OI[n]=!0:(DI[n]=!0,!1)}function w7(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 x7(n,e,t,r){if(e===null||typeof e>"u"||w7(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 gi(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 kr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){kr[n]=new gi(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];kr[e]=new gi(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){kr[n]=new gi(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){kr[n]=new gi(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){kr[n]=new gi(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){kr[n]=new gi(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){kr[n]=new gi(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){kr[n]=new gi(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){kr[n]=new gi(n,5,!1,n.toLowerCase(),null,!1,!1)});var PM=/[\-:]([a-z])/g;function DM(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(PM,DM);kr[e]=new gi(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(PM,DM);kr[e]=new gi(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(PM,DM);kr[e]=new gi(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){kr[n]=new gi(n,1,!1,n.toLowerCase(),null,!1,!1)});kr.xlinkHref=new gi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){kr[n]=new gi(n,1,!1,n.toLowerCase(),null,!0,!0)});function OM(n,e,t,r){var i=kr.hasOwnProperty(e)?kr[e]:null;(i!==null?i.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),HB=Object.prototype.hasOwnProperty,y7=/^[: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]*$/,OI={},NI={};function w7(n){return HB.call(NI,n)?!0:HB.call(OI,n)?!1:y7.test(n)?NI[n]=!0:(OI[n]=!0,!1)}function x7(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 _7(n,e,t,r){if(e===null||typeof e>"u"||x7(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 gi(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 kr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(n){kr[n]=new gi(n,0,!1,n,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(n){var e=n[0];kr[e]=new gi(e,1,!1,n[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(n){kr[n]=new gi(n,2,!1,n.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(n){kr[n]=new gi(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){kr[n]=new gi(n,3,!1,n.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(n){kr[n]=new gi(n,3,!0,n,null,!1,!1)});["capture","download"].forEach(function(n){kr[n]=new gi(n,4,!1,n,null,!1,!1)});["cols","rows","size","span"].forEach(function(n){kr[n]=new gi(n,6,!1,n,null,!1,!1)});["rowSpan","start"].forEach(function(n){kr[n]=new gi(n,5,!1,n.toLowerCase(),null,!1,!1)});var DM=/[\-:]([a-z])/g;function OM(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(DM,OM);kr[e]=new gi(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(DM,OM);kr[e]=new gi(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(DM,OM);kr[e]=new gi(e,1,!1,n,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(n){kr[n]=new gi(n,1,!1,n.toLowerCase(),null,!1,!1)});kr.xlinkHref=new gi("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(n){kr[n]=new gi(n,1,!1,n.toLowerCase(),null,!0,!0)});function NM(n,e,t,r){var i=kr.hasOwnProperty(e)?kr[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{Y_=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?dp(n):""}function _7(n){switch(n.tag){case 5:return dp(n.type);case 16:return dp("Lazy");case 13:return dp("Suspense");case 19:return dp("SuspenseList");case 0:case 2:case 15:return n=X_(n.type,!1),n;case 11:return n=X_(n.type.render,!1),n;case 1:return n=X_(n.type,!0),n;default:return""}}function VB(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 Sf:return"Fragment";case Mf:return"Portal";case HB:return"Profiler";case NM:return"StrictMode";case zB:return"Suspense";case GB:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case xk:return(n.displayName||"Context")+".Consumer";case wk:return(n._context.displayName||"Context")+".Provider";case kM:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case QM:return e=n.displayName||null,e!==null?e:VB(n.type)||"Memo";case Yl:e=n._payload,n=n._init;try{return VB(n(e))}catch{}}return null}function b7(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 VB(e);case 8:return e===NM?"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 RA(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function bk(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function B7(n){var e=bk(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 Wg(n){n._valueTracker||(n._valueTracker=B7(n))}function Bk(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=bk(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function Iy(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 jB(n,e){var t=e.checked;return Un({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function kI(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=RA(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 Ek(n,e){e=e.checked,e!=null&&OM(n,"checked",e,!1)}function WB(n,e){Ek(n,e);var t=RA(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")?KB(n,e.type,t):e.hasOwnProperty("defaultValue")&&KB(n,e.type,RA(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function QI(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 KB(n,e,t){(e!=="number"||Iy(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var pp=Array.isArray;function Zf(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Kg.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function dm(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Qp={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},E7=["Webkit","ms","Moz","O"];Object.keys(Qp).forEach(function(n){E7.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Qp[e]=Qp[n]})});function Tk(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Qp.hasOwnProperty(n)&&Qp[n]?(""+e).trim():e+"px"}function Ik(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=Tk(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var C7=Un({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 $B(n,e){if(e){if(C7[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 ZB(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 JB=null;function HM(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var qB=null,Jf=null,qf=null;function GI(n){if(n=Ag(n)){if(typeof qB!="function")throw Error(Pe(280));var e=n.stateNode;e&&(e=gx(e),qB(n.stateNode,n.type,e))}}function Rk(n){Jf?qf?qf.push(n):qf=[n]:Jf=n}function Fk(){if(Jf){var n=Jf,e=qf;if(qf=Jf=null,GI(n),e)for(n=0;n>>=0,n===0?32:31-(O7(n)/N7|0)|0}var Yg=64,Xg=4194304;function mp(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 Ly(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=mp(a):(s&=o,s!==0&&(r=mp(s)))}else o=t&~i,o!==0?r=mp(o):s!==0&&(r=mp(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 ag(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-xo(e),n[e]=t}function z7(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=zp),JI=String.fromCharCode(32),qI=!1;function Jk(n,e){switch(n){case"keyup":return mK.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qk(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Tf=!1;function vK(n,e){switch(n){case"compositionend":return qk(e);case"keypress":return e.which!==32?null:(qI=!0,JI);case"textInput":return n=e.data,n===JI&&qI?null:n;default:return null}}function yK(n,e){if(Tf)return n==="compositionend"||!XM&&Jk(n,e)?(n=$k(),zv=WM=iA=null,Tf=!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=rR(t)}}function r4(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?r4(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function i4(){for(var n=window,e=Iy();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Iy(n.document)}return e}function $M(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 SK(n){var e=i4(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&r4(t.ownerDocument.documentElement,t)){if(r!==null&&$M(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=iR(t,s);var o=iR(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,If=null,sE=null,Vp=null,oE=!1;function sR(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;oE||If==null||If!==Iy(r)||(r=If,"selectionStart"in r&&$M(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}),Vp&&wm(Vp,r)||(Vp=r,r=Oy(sE,"onSelect"),0Uf||(n.current=fE[Uf],fE[Uf]=null,Uf--)}function un(n,e){Uf++,fE[Uf]=n.current,n.current=e}var FA={},ei=VA(FA),Si=VA(!1),Oc=FA;function yh(n,e){var t=n.type.contextTypes;if(!t)return FA;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 Ti(n){return n=n.childContextTypes,n!=null}function ky(){mn(Si),mn(ei)}function fR(n,e,t){if(ei.current!==FA)throw Error(Pe(168));un(ei,e),un(Si,t)}function h4(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,b7(n)||"Unknown",i));return Un({},t,r)}function Qy(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||FA,Oc=ei.current,un(ei,n),un(Si,Si.current),!0}function hR(n,e,t){var r=n.stateNode;if(!r)throw Error(Pe(169));t?(n=h4(n,e,Oc),r.__reactInternalMemoizedMergedChildContext=n,mn(Si),mn(ei),un(ei,n)):mn(Si),un(Si,t)}var Ya=null,vx=!1,A1=!1;function d4(n){Ya===null?Ya=[n]:Ya.push(n)}function QK(n){vx=!0,d4(n)}function jA(){if(!A1&&Ya!==null){A1=!0;var n=0,e=qt;try{var t=Ya;for(qt=1;n>=o,i-=o,el=1<<32-xo(e)+i|t<b?(M=T,T=null):M=T.sibling;var D=f(m,T,w[b],x);if(D===null){T===null&&(T=M);break}n&&T&&D.alternate===null&&e(m,T),y=s(D,y,b),C===null?_=D:C.sibling=D,C=D,T=M}if(b===w.length)return t(m,T),Bn&&cc(m,b),_;if(T===null){for(;bb?(M=T,T=null):M=T.sibling;var Y=f(m,T,D.value,x);if(Y===null){T===null&&(T=M);break}n&&T&&Y.alternate===null&&e(m,T),y=s(Y,y,b),C===null?_=Y:C.sibling=Y,C=Y,T=M}if(D.done)return t(m,T),Bn&&cc(m,b),_;if(T===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 Bn&&cc(m,b),_}for(T=r(m,T);!D.done;b++,D=w.next())D=h(T,m,b,D.value,x),D!==null&&(n&&D.alternate!==null&&T.delete(D.key===null?b:D.key),y=s(D,y,b),C===null?_=D:C.sibling=D,C=D);return n&&T.forEach(function(H){return e(m,H)}),Bn&&cc(m,b),_}function g(m,y,w,x){if(typeof w=="object"&&w!==null&&w.type===Sf&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case jg:e:{for(var _=w.key,C=y;C!==null;){if(C.key===_){if(_=w.type,_===Sf){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&&wR(_)===C.type){t(m,C.sibling),y=i(C,w.props),y.ref=Sd(m,C,w),y.return=m,m=y;break e}t(m,C);break}else e(m,C);C=C.sibling}w.type===Sf?(y=Mc(w.props.children,m.mode,x,w.key),y.return=m,m=y):(x=$v(w.type,w.key,w.props,null,m.mode,x),x.ref=Sd(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=g1(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(pp(w))return p(m,y,w,x);if(bd(w))return d(m,y,w,x);n0(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=m1(w,m.mode,x),y.return=m,m=y),o(m)):t(m,y)}return g}var xh=_4(!0),b4=_4(!1),cg={},oa=VA(cg),Bm=VA(cg),Em=VA(cg);function xc(n){if(n===cg)throw Error(Pe(174));return n}function sS(n,e){switch(un(Em,e),un(Bm,n),un(oa,cg),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:XB(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=XB(e,n)}mn(oa),un(oa,e)}function _h(){mn(oa),mn(Bm),mn(Em)}function B4(n){xc(Em.current);var e=xc(oa.current),t=XB(e,n.type);e!==t&&(un(Bm,n),un(oa,t))}function oS(n){Bm.current===n&&(mn(oa),mn(Bm))}var Tn=VA(0);function Wy(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 c1=[];function aS(){for(var n=0;nt?t:4,n(!0);var r=u1.transition;u1.transition={};try{n(!1),e()}finally{qt=t,u1.transition=r}}function Q4(){return zs().memoizedState}function VK(n,e,t){var r=xA(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},H4(n))z4(e,t);else if(t=v4(n,e,t,r),t!==null){var i=pi();_o(t,n,r,i),G4(t,e,r)}}function jK(n,e,t){var r=xA(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(H4(n))z4(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,Co(a,o)){var l=e.interleaved;l===null?(i.next=i,rS(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=v4(n,e,i,r),t!==null&&(i=pi(),_o(t,n,r,i),G4(t,e,r))}}function H4(n){var e=n.alternate;return n===Fn||e!==null&&e===Fn}function z4(n,e){jp=Ky=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function G4(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,GM(n,t)}}var Yy={readContext:Hs,useCallback:zr,useContext:zr,useEffect:zr,useImperativeHandle:zr,useInsertionEffect:zr,useLayoutEffect:zr,useMemo:zr,useReducer:zr,useRef:zr,useState:zr,useDebugValue:zr,useDeferredValue:zr,useTransition:zr,useMutableSource:zr,useSyncExternalStore:zr,useId:zr,unstable_isNewReconciler:!1},WK={readContext:Hs,useCallback:function(n,e){return Ho().memoizedState=[n,e===void 0?null:e],n},useContext:Hs,useEffect:_R,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Wv(4194308,4,P4.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Wv(4194308,4,n,e)},useInsertionEffect:function(n,e){return Wv(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=VK.bind(null,Fn,n),[r.memoizedState,n]},useRef:function(n){var e=Ho();return n={current:n},e.memoizedState=n},useState:xR,useDebugValue:fS,useDeferredValue:function(n){return Ho().memoizedState=n},useTransition:function(){var n=xR(!1),e=n[0];return n=GK.bind(null,n[1]),Ho().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Fn,i=Ho();if(Bn){if(t===void 0)throw Error(Pe(407));t=t()}else{if(t=e(),Er===null)throw Error(Pe(349));kc&30||M4(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,_R(T4.bind(null,r,s,n),[n]),r.flags|=2048,Sm(9,S4.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=Ho(),e=Er.identifierPrefix;if(Bn){var t=tl,r=el;t=(r&~(1<<32-xo(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Cm++,0")&&(l=l.replace("",n.displayName)),l}while(1<=o&&0<=a);break}}}finally{X_=!1,Error.prepareStackTrace=t}return(n=n?n.displayName||n.name:"")?dp(n):""}function b7(n){switch(n.tag){case 5:return dp(n.type);case 16:return dp("Lazy");case 13:return dp("Suspense");case 19:return dp("SuspenseList");case 0:case 2:case 15:return n=$_(n.type,!1),n;case 11:return n=$_(n.type.render,!1),n;case 1:return n=$_(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 Sf:return"Fragment";case Mf:return"Portal";case zB:return"Profiler";case kM:return"StrictMode";case GB:return"Suspense";case VB:return"SuspenseList"}if(typeof n=="object")switch(n.$$typeof){case _k:return(n.displayName||"Context")+".Consumer";case xk:return(n._context.displayName||"Context")+".Provider";case QM:var e=n.render;return n=n.displayName,n||(n=e.displayName||e.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case HM: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 B7(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===kM?"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 RA(n){switch(typeof n){case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function Bk(n){var e=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function E7(n){var e=Bk(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 Wg(n){n._valueTracker||(n._valueTracker=E7(n))}function Ek(n){if(!n)return!1;var e=n._valueTracker;if(!e)return!0;var t=e.getValue(),r="";return n&&(r=Bk(n)?n.checked?"true":"false":n.value),n=r,n!==t?(e.setValue(n),!0):!1}function Iy(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 WB(n,e){var t=e.checked;return Un({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:t??n._wrapperState.initialChecked})}function QI(n,e){var t=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;t=RA(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 Ck(n,e){e=e.checked,e!=null&&NM(n,"checked",e,!1)}function KB(n,e){Ck(n,e);var t=RA(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")?YB(n,e.type,t):e.hasOwnProperty("defaultValue")&&YB(n,e.type,RA(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(n.defaultChecked=!!e.defaultChecked)}function HI(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 YB(n,e,t){(e!=="number"||Iy(n.ownerDocument)!==n)&&(t==null?n.defaultValue=""+n._wrapperState.initialValue:n.defaultValue!==""+t&&(n.defaultValue=""+t))}var pp=Array.isArray;function Zf(n,e,t,r){if(n=n.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Kg.firstChild;n.firstChild;)n.removeChild(n.firstChild);for(;e.firstChild;)n.appendChild(e.firstChild)}});function dm(n,e){if(e){var t=n.firstChild;if(t&&t===n.lastChild&&t.nodeType===3){t.nodeValue=e;return}}n.textContent=e}var Qp={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},C7=["Webkit","ms","Moz","O"];Object.keys(Qp).forEach(function(n){C7.forEach(function(e){e=e+n.charAt(0).toUpperCase()+n.substring(1),Qp[e]=Qp[n]})});function Ik(n,e,t){return e==null||typeof e=="boolean"||e===""?"":t||typeof e!="number"||e===0||Qp.hasOwnProperty(n)&&Qp[n]?(""+e).trim():e+"px"}function Rk(n,e){n=n.style;for(var t in e)if(e.hasOwnProperty(t)){var r=t.indexOf("--")===0,i=Ik(t,e[t],r);t==="float"&&(t="cssFloat"),r?n.setProperty(t,i):n[t]=i}}var M7=Un({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 ZB(n,e){if(e){if(M7[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 JB(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 qB=null;function zM(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var eE=null,Jf=null,qf=null;function VI(n){if(n=Ag(n)){if(typeof eE!="function")throw Error(Pe(280));var e=n.stateNode;e&&(e=vx(e),eE(n.stateNode,n.type,e))}}function Fk(n){Jf?qf?qf.push(n):qf=[n]:Jf=n}function Uk(){if(Jf){var n=Jf,e=qf;if(qf=Jf=null,VI(n),e)for(n=0;n>>=0,n===0?32:31-(N7(n)/k7|0)|0}var Yg=64,Xg=4194304;function mp(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 Ly(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=mp(a):(s&=o,s!==0&&(r=mp(s)))}else o=t&~i,o!==0?r=mp(o):s!==0&&(r=mp(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 ag(n,e,t){n.pendingLanes|=e,e!==536870912&&(n.suspendedLanes=0,n.pingedLanes=0),n=n.eventTimes,e=31-xo(e),n[e]=t}function G7(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=zp),qI=String.fromCharCode(32),eR=!1;function qk(n,e){switch(n){case"keyup":return gK.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function e4(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Tf=!1;function yK(n,e){switch(n){case"compositionend":return e4(e);case"keypress":return e.which!==32?null:(eR=!0,qI);case"textInput":return n=e.data,n===qI&&eR?null:n;default:return null}}function wK(n,e){if(Tf)return n==="compositionend"||!$M&&qk(n,e)?(n=Zk(),zv=KM=iA=null,Tf=!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=iR(t)}}function i4(n,e){return n&&e?n===e?!0:n&&n.nodeType===3?!1:e&&e.nodeType===3?i4(n,e.parentNode):"contains"in n?n.contains(e):n.compareDocumentPosition?!!(n.compareDocumentPosition(e)&16):!1:!1}function s4(){for(var n=window,e=Iy();e instanceof n.HTMLIFrameElement;){try{var t=typeof e.contentWindow.location.href=="string"}catch{t=!1}if(t)n=e.contentWindow;else break;e=Iy(n.document)}return e}function ZM(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 TK(n){var e=s4(),t=n.focusedElem,r=n.selectionRange;if(e!==t&&t&&t.ownerDocument&&i4(t.ownerDocument.documentElement,t)){if(r!==null&&ZM(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=sR(t,s);var o=sR(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,If=null,oE=null,Vp=null,aE=!1;function oR(n,e,t){var r=t.window===t?t.document:t.nodeType===9?t:t.ownerDocument;aE||If==null||If!==Iy(r)||(r=If,"selectionStart"in r&&ZM(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}),Vp&&wm(Vp,r)||(Vp=r,r=Oy(oE,"onSelect"),0Uf||(n.current=hE[Uf],hE[Uf]=null,Uf--)}function un(n,e){Uf++,hE[Uf]=n.current,n.current=e}var FA={},ei=VA(FA),Si=VA(!1),Oc=FA;function yh(n,e){var t=n.type.contextTypes;if(!t)return FA;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 Ti(n){return n=n.childContextTypes,n!=null}function ky(){mn(Si),mn(ei)}function hR(n,e,t){if(ei.current!==FA)throw Error(Pe(168));un(ei,e),un(Si,t)}function d4(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,B7(n)||"Unknown",i));return Un({},t,r)}function Qy(n){return n=(n=n.stateNode)&&n.__reactInternalMemoizedMergedChildContext||FA,Oc=ei.current,un(ei,n),un(Si,Si.current),!0}function dR(n,e,t){var r=n.stateNode;if(!r)throw Error(Pe(169));t?(n=d4(n,e,Oc),r.__reactInternalMemoizedMergedChildContext=n,mn(Si),mn(ei),un(ei,n)):mn(Si),un(Si,t)}var Ya=null,yx=!1,c1=!1;function p4(n){Ya===null?Ya=[n]:Ya.push(n)}function HK(n){yx=!0,p4(n)}function jA(){if(!c1&&Ya!==null){c1=!0;var n=0,e=qt;try{var t=Ya;for(qt=1;n>=o,i-=o,el=1<<32-xo(e)+i|t<b?(M=T,T=null):M=T.sibling;var O=f(m,T,w[b],x);if(O===null){T===null&&(T=M);break}n&&T&&O.alternate===null&&e(m,T),y=s(O,y,b),B===null?_=O:B.sibling=O,B=O,T=M}if(b===w.length)return t(m,T),Bn&&cc(m,b),_;if(T===null){for(;bb?(M=T,T=null):M=T.sibling;var Y=f(m,T,O.value,x);if(Y===null){T===null&&(T=M);break}n&&T&&Y.alternate===null&&e(m,T),y=s(Y,y,b),B===null?_=Y:B.sibling=Y,B=Y,T=M}if(O.done)return t(m,T),Bn&&cc(m,b),_;if(T===null){for(;!O.done;b++,O=w.next())O=u(m,O.value,x),O!==null&&(y=s(O,y,b),B===null?_=O:B.sibling=O,B=O);return Bn&&cc(m,b),_}for(T=r(m,T);!O.done;b++,O=w.next())O=h(T,m,b,O.value,x),O!==null&&(n&&O.alternate!==null&&T.delete(O.key===null?b:O.key),y=s(O,y,b),B===null?_=O:B.sibling=O,B=O);return n&&T.forEach(function(H){return e(m,H)}),Bn&&cc(m,b),_}function g(m,y,w,x){if(typeof w=="object"&&w!==null&&w.type===Sf&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case jg:e:{for(var _=w.key,B=y;B!==null;){if(B.key===_){if(_=w.type,_===Sf){if(B.tag===7){t(m,B.sibling),y=i(B,w.props.children),y.return=m,m=y;break e}}else if(B.elementType===_||typeof _=="object"&&_!==null&&_.$$typeof===Yl&&xR(_)===B.type){t(m,B.sibling),y=i(B,w.props),y.ref=Sd(m,B,w),y.return=m,m=y;break e}t(m,B);break}else e(m,B);B=B.sibling}w.type===Sf?(y=Mc(w.props.children,m.mode,x,w.key),y.return=m,m=y):(x=$v(w.type,w.key,w.props,null,m.mode,x),x.ref=Sd(m,y,w),x.return=m,m=x)}return o(m);case Mf:e:{for(B=w.key;y!==null;){if(y.key===B)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=v1(w,m.mode,x),y.return=m,m=y}return o(m);case Yl:return B=w._init,g(m,y,B(w._payload),x)}if(pp(w))return p(m,y,w,x);if(bd(w))return d(m,y,w,x);n0(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=g1(w,m.mode,x),y.return=m,m=y),o(m)):t(m,y)}return g}var xh=b4(!0),B4=b4(!1),cg={},oa=VA(cg),Bm=VA(cg),Em=VA(cg);function xc(n){if(n===cg)throw Error(Pe(174));return n}function oS(n,e){switch(un(Em,e),un(Bm,n),un(oa,cg),n=e.nodeType,n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:$B(null,"");break;default:n=n===8?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=$B(e,n)}mn(oa),un(oa,e)}function _h(){mn(oa),mn(Bm),mn(Em)}function E4(n){xc(Em.current);var e=xc(oa.current),t=$B(e,n.type);e!==t&&(un(Bm,n),un(oa,t))}function aS(n){Bm.current===n&&(mn(oa),mn(Bm))}var Tn=VA(0);function Wy(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 u1=[];function lS(){for(var n=0;nt?t:4,n(!0);var r=f1.transition;f1.transition={};try{n(!1),e()}finally{qt=t,f1.transition=r}}function H4(){return zs().memoizedState}function jK(n,e,t){var r=xA(n);if(t={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null},z4(n))G4(e,t);else if(t=y4(n,e,t,r),t!==null){var i=pi();_o(t,n,r,i),V4(t,e,r)}}function WK(n,e,t){var r=xA(n),i={lane:r,action:t,hasEagerState:!1,eagerState:null,next:null};if(z4(n))G4(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,Co(a,o)){var l=e.interleaved;l===null?(i.next=i,iS(e)):(i.next=l.next,l.next=i),e.interleaved=i;return}}catch{}finally{}t=y4(n,e,i,r),t!==null&&(i=pi(),_o(t,n,r,i),V4(t,e,r))}}function z4(n){var e=n.alternate;return n===Fn||e!==null&&e===Fn}function G4(n,e){jp=Ky=!0;var t=n.pending;t===null?e.next=e:(e.next=t.next,t.next=e),n.pending=e}function V4(n,e,t){if(t&4194240){var r=e.lanes;r&=n.pendingLanes,t|=r,e.lanes=t,VM(n,t)}}var Yy={readContext:Hs,useCallback:zr,useContext:zr,useEffect:zr,useImperativeHandle:zr,useInsertionEffect:zr,useLayoutEffect:zr,useMemo:zr,useReducer:zr,useRef:zr,useState:zr,useDebugValue:zr,useDeferredValue:zr,useTransition:zr,useMutableSource:zr,useSyncExternalStore:zr,useId:zr,unstable_isNewReconciler:!1},KK={readContext:Hs,useCallback:function(n,e){return Ho().memoizedState=[n,e===void 0?null:e],n},useContext:Hs,useEffect:bR,useImperativeHandle:function(n,e,t){return t=t!=null?t.concat([n]):null,Wv(4194308,4,D4.bind(null,e,n),t)},useLayoutEffect:function(n,e){return Wv(4194308,4,n,e)},useInsertionEffect:function(n,e){return Wv(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=jK.bind(null,Fn,n),[r.memoizedState,n]},useRef:function(n){var e=Ho();return n={current:n},e.memoizedState=n},useState:_R,useDebugValue:hS,useDeferredValue:function(n){return Ho().memoizedState=n},useTransition:function(){var n=_R(!1),e=n[0];return n=VK.bind(null,n[1]),Ho().memoizedState=n,[e,n]},useMutableSource:function(){},useSyncExternalStore:function(n,e,t){var r=Fn,i=Ho();if(Bn){if(t===void 0)throw Error(Pe(407));t=t()}else{if(t=e(),Cr===null)throw Error(Pe(349));kc&30||S4(r,e,t)}i.memoizedState=t;var s={value:t,getSnapshot:e};return i.queue=s,bR(I4.bind(null,r,s,n),[n]),r.flags|=2048,Sm(9,T4.bind(null,r,s,t,e),void 0,null),t},useId:function(){var n=Ho(),e=Cr.identifierPrefix;if(Bn){var t=tl,r=el;t=(r&~(1<<32-xo(r)-1)).toString(32)+t,e=":"+e+"R"+t,t=Cm++,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[Ko]=e,n[bm]=r,J4(n,e,!1,!1),e.stateNode=n;e:{switch(o=ZB(t,r),t){case"dialog":fn("cancel",n),fn("close",n),i=r;break;case"iframe":case"object":case"embed":fn("load",n),i=r;break;case"video":case"audio":for(i=0;iBh&&(e.flags|=128,r=!0,Td(s,!1),e.lanes=4194304)}else{if(!r)if(n=Wy(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Td(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Bn)return Gr(e),null}else 2*$n()-s.renderingStartTime>Bh&&t!==1073741824&&(e.flags|=128,r=!0,Td(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=$n(),e.sibling=null,t=Tn.current,un(Tn,r?t&1|2:t&1),e):(Gr(e),null);case 22:case 23:return vS(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Ki&1073741824&&(Gr(e),e.subtreeFlags&6&&(e.flags|=8192)):Gr(e),null;case 24:return null;case 25:return null}throw Error(Pe(156,e.tag))}function eY(n,e){switch(JM(e),e.tag){case 1:return Ti(e.type)&&ky(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return _h(),mn(Si),mn(ei),aS(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return oS(e),null;case 13:if(mn(Tn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Pe(340));wh()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return mn(Tn),null;case 4:return _h(),null;case 10:return nS(e.type._context),null;case 22:case 23:return vS(),null;case 24:return null;default:return null}}var i0=!1,Yr=!1,tY=typeof WeakSet=="function"?WeakSet:Set,Ze=null;function Of(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Nn(n,e,r)}else t.current=null}function BE(n,e,t){try{t()}catch(r){Nn(n,e,r)}}var RR=!1;function nY(n,e){if(aE=Py,n=i4(),$M(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(lE={focusedElem:n,selectionRange:t},Py=!1,Ze=e;Ze!==null;)if(e=Ze,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Ze=n;else for(;Ze!==null;){e=Ze;try{var 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:ho(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){Nn(e,e.return,x)}if(n=e.sibling,n!==null){n.return=e.return,Ze=n;break}Ze=e.return}return p=RR,RR=!1,p}function Wp(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&&BE(e,t,s)}i=i.next}while(i!==r)}}function xx(n,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var t=e=e.next;do{if((t.tag&n)===n){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}}function EE(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 tQ(n){var e=n.alternate;e!==null&&(n.alternate=null,tQ(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Ko],delete e[bm],delete e[uE],delete e[NK],delete e[kK])),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 nQ(n){return n.tag===5||n.tag===3||n.tag===4}function FR(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||nQ(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 CE(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=Ny));else if(r!==4&&(n=n.child,n!==null))for(CE(n,e,t),n=n.sibling;n!==null;)CE(n,e,t),n=n.sibling}function ME(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(ME(n,e,t),n=n.sibling;n!==null;)ME(n,e,t),n=n.sibling}var Rr=null,po=!1;function Ul(n,e,t){for(t=t.child;t!==null;)rQ(n,e,t),t=t.sibling}function rQ(n,e,t){if(sa&&typeof sa.onCommitFiberUnmount=="function")try{sa.onCommitFiberUnmount(hx,t)}catch{}switch(t.tag){case 5:Yr||Of(t,e);case 6:var r=Rr,i=po;Rr=null,Ul(n,e,t),Rr=r,po=i,Rr!==null&&(po?(n=Rr,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Rr.removeChild(t.stateNode));break;case 18:Rr!==null&&(po?(n=Rr,t=t.stateNode,n.nodeType===8?l1(n.parentNode,t):n.nodeType===1&&l1(n,t),vm(n)):l1(Rr,t.stateNode));break;case 4:r=Rr,i=po,Rr=t.stateNode.containerInfo,po=!0,Ul(n,e,t),Rr=r,po=i;break;case 0:case 11:case 14:case 15:if(!Yr&&(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)&&BE(t,e,o),i=i.next}while(i!==r)}Ul(n,e,t);break;case 1:if(!Yr&&(Of(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){Nn(t,e,a)}Ul(n,e,t);break;case 21:Ul(n,e,t);break;case 22:t.mode&1?(Yr=(r=Yr)||t.memoizedState!==null,Ul(n,e,t),Yr=r):Ul(n,e,t);break;default:Ul(n,e,t)}}function UR(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new tY),e.forEach(function(r){var i=uY.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function no(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=$n()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*iY(r/1960))-r,10n?16:n,sA===null)var r=!1;else{if(n=sA,sA=null,Zy=0,zt&6)throw Error(Pe(331));var i=zt;for(zt|=4,Ze=n.current;Ze!==null;){var s=Ze,o=s.child;if(Ze.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l$n()-mS?Cc(n,0):pS|=t),Ii(n,e)}function uQ(n,e){e===0&&(n.mode&1?(e=Xg,Xg<<=1,!(Xg&130023424)&&(Xg=4194304)):e=1);var t=pi();n=ml(n,e),n!==null&&(ag(n,e,t),Ii(n,t))}function cY(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),uQ(n,t)}function uY(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),uQ(n,t)}var fQ;fQ=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Si.current)Ci=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Ci=!1,JK(n,e,t);Ci=!!(n.flags&131072)}else Ci=!1,Bn&&e.flags&1048576&&p4(e,zy,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Kv(n,e),n=e.pendingProps;var i=yh(e,ei.current);th(e,t),i=AS(null,e,r,n,i,t);var s=cS();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,Ti(r)?(s=!0,Qy(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,iS(e),i.updater=yx,e.stateNode=i,i._reactInternals=e,gE(e,r,n,t),e=wE(null,e,r,!0,s,t)):(e.tag=0,Bn&&s&&ZM(e),ai(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(Kv(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=hY(r),n=ho(r,n),i){case 0:e=yE(null,e,r,n,t);break e;case 1:e=SR(null,e,r,n,t);break e;case 11:e=CR(null,e,r,n,t);break e;case 14:e=MR(null,e,r,ho(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:ho(r,i),yE(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ho(r,i),SR(n,e,r,i,t);case 3:e:{if(X4(e),n===null)throw Error(Pe(387));r=e.pendingProps,s=e.memoizedState,i=s.element,y4(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=bh(Error(Pe(423)),e),e=TR(n,e,r,t,i);break e}else if(r!==i){i=bh(Error(Pe(424)),e),e=TR(n,e,r,t,i);break e}else for(ts=vA(e.stateNode.containerInfo.firstChild),is=e,Bn=!0,vo=null,t=b4(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(wh(),r===i){e=gl(n,e,t);break e}ai(n,e,r,t)}e=e.child}return e;case 5:return B4(e),n===null&&dE(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,AE(r,i)?o=null:s!==null&&AE(r,s)&&(e.flags|=32),Y4(n,e),ai(n,e,o,t),e.child;case 6:return n===null&&dE(e),null;case 13:return $4(n,e,t);case 4:return sS(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=xh(e,null,r,t):ai(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ho(r,i),CR(n,e,r,i,t);case 7:return ai(n,e,e.pendingProps,t),e.child;case 8:return ai(n,e,e.pendingProps.children,t),e.child;case 12:return ai(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,un(Gy,r._currentValue),r._currentValue=o,s!==null)if(Co(s.value,o)){if(s.children===i.children&&!Si.current){e=gl(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=ol(-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),pE(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),pE(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}ai(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,th(e,t),i=Hs(i),r=r(i),e.flags|=1,ai(n,e,r,t),e.child;case 14:return r=e.type,i=ho(r,e.pendingProps),i=ho(r.type,i),MR(n,e,r,i,t);case 15:return W4(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ho(r,i),Kv(n,e),e.tag=1,Ti(r)?(n=!0,Qy(e)):n=!1,th(e,t),x4(e,r,i),gE(e,r,i,t),wE(null,e,r,!0,n,t);case 19:return Z4(n,e,t);case 22:return K4(n,e,t)}throw Error(Pe(156,e.tag))};function hQ(n,e){return kk(n,e)}function fY(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 Rs(n,e,t,r){return new fY(n,e,t,r)}function wS(n){return n=n.prototype,!(!n||!n.isReactComponent)}function hY(n){if(typeof n=="function")return wS(n)?1:0;if(n!=null){if(n=n.$$typeof,n===kM)return 11;if(n===QM)return 14}return 2}function _A(n,e){var t=n.alternate;return t===null?(t=Rs(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 $v(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")wS(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Sf:return Mc(t.children,i,s,e);case NM:o=8,i|=8;break;case HB:return n=Rs(12,t,e,i|2),n.elementType=HB,n.lanes=s,n;case zB:return n=Rs(13,t,e,i),n.elementType=zB,n.lanes=s,n;case GB:return n=Rs(19,t,e,i),n.elementType=GB,n.lanes=s,n;case _k:return bx(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case wk:o=10;break e;case xk:o=9;break e;case kM:o=11;break e;case QM:o=14;break e;case Yl:o=16,r=null;break e}throw Error(Pe(130,n==null?n:typeof n,""))}return e=Rs(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function Mc(n,e,t,r){return n=Rs(7,n,r,e),n.lanes=t,n}function bx(n,e,t,r){return n=Rs(22,n,r,e),n.elementType=_k,n.lanes=t,n.stateNode={isHidden:!1},n}function m1(n,e,t){return n=Rs(6,n,null,e),n.lanes=t,n}function g1(n,e,t){return e=Rs(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function dY(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=Z_(0),this.expirationTimes=Z_(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Z_(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function xS(n,e,t,r,i,s,o,a,l){return n=new dY(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Rs(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},iS(s),n}function pY(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(gQ)}catch(n){console.error(n)}}gQ(),pk.exports=hs;var wY=pk.exports,HR=wY;kB.createRoot=HR.createRoot,kB.hydrateRoot=HR.hydrateRoot;const xY="/assets/cc_bgm_balanced-f542698c.wav",Ks=ye.createContext(),_Y=({children:n})=>{const[e,t]=ye.useState(!1),r=$.useRef(null),i=()=>{t(!1);const o=r.current;o.src=xY,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 N.jsxs(Ks.Provider,{value:{isMute:e,setMute:t,enableAudio:i,disableAudio:s},children:[N.jsx("audio",{ref:r}),n]})},bY=ye.createContext(),BY=n=>{const[e,t]=ye.useState(null),[r,i]=ye.useState(null),[s,o]=ye.useState(!1),[a,l]=ye.useState([]);return N.jsx(bY.Provider,{value:{walletAddress:e,setWalletAddress:t,ensName:r,setEnsName:i,connected:s,setConnected:o,OTTokens:a,setOTTokens:l},children:n.children})};function Wa(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function vQ(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 p1(n,e,t){return{value:n,source:null,stack:t??null,digest:e??null}}function yE(n,e){try{console.error(e.value)}catch(t){setTimeout(function(){throw t})}}var $K=typeof WeakMap=="function"?WeakMap:Map;function j4(n,e,t){t=ol(-1,t),t.tag=3,t.payload={element:null};var r=e.value;return t.callback=function(){$y||($y=!0,TE=r),yE(n,e)},t}function W4(n,e,t){t=ol(-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(){yE(n,e)}}var s=n.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){yE(n,e),typeof r!="function"&&(wA===null?wA=new Set([this]):wA.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),t}function BR(n,e,t){var r=n.pingCache;if(r===null){r=n.pingCache=new $K;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=cY.bind(null,n,e,t),e.then(n,n))}function ER(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 CR(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=ol(-1,1),e.tag=2,yA(t,e,1))),t.lanes|=1),n)}var ZK=El.ReactCurrentOwner,Ci=!1;function ai(n,e,t,r){e.child=n===null?B4(e,null,t,r):xh(e,n.child,t,r)}function MR(n,e,t,r,i){t=t.render;var s=e.ref;return th(e,i),r=cS(n,e,t,r,s,i),t=uS(),n!==null&&!Ci?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,gl(n,e,i)):(Bn&&t&&JM(e),e.flags|=1,ai(n,e,r,i),e.child)}function SR(n,e,t,r,i){if(n===null){var s=t.type;return typeof s=="function"&&!xS(s)&&s.defaultProps===void 0&&t.compare===null&&t.defaultProps===void 0?(e.tag=15,e.type=s,K4(n,e,s,r,i)):(n=$v(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:wm,t(o,r)&&n.ref===e.ref)return gl(n,e,i)}return e.flags|=1,n=_A(s,r),n.ref=e.ref,n.return=e,e.child=n}function K4(n,e,t,r,i){if(n!==null){var s=n.memoizedProps;if(wm(s,r)&&n.ref===e.ref)if(Ci=!1,e.pendingProps=r=s,(n.lanes&i)!==0)n.flags&131072&&(Ci=!0);else return e.lanes=n.lanes,gl(n,e,i)}return wE(n,e,t,r,i)}function Y4(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},un(Nf,Ki),Ki|=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,un(Nf,Ki),Ki|=n,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:t,un(Nf,Ki),Ki|=r}else s!==null?(r=s.baseLanes|t,e.memoizedState=null):r=t,un(Nf,Ki),Ki|=r;return ai(n,e,i,t),e.child}function X4(n,e){var t=e.ref;(n===null&&t!==null||n!==null&&n.ref!==t)&&(e.flags|=512,e.flags|=2097152)}function wE(n,e,t,r,i){var s=Ti(t)?Oc:ei.current;return s=yh(e,s),th(e,i),t=cS(n,e,t,r,s,i),r=uS(),n!==null&&!Ci?(e.updateQueue=n.updateQueue,e.flags&=-2053,n.lanes&=~i,gl(n,e,i)):(Bn&&r&&JM(e),e.flags|=1,ai(n,e,t,i),e.child)}function TR(n,e,t,r,i){if(Ti(t)){var s=!0;Qy(e)}else s=!1;if(th(e,i),e.stateNode===null)Kv(n,e),_4(e,t,r),vE(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=Hs(A):(A=Ti(t)?Oc:ei.current,A=yh(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)&&wR(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||Si.current||Xl?(typeof c=="function"&&(gE(e,t,c,r),l=e.memoizedState),(a=Xl||yR(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,w4(n,e),a=e.memoizedProps,A=e.type===e.elementType?a:ho(e.type,a),o.props=A,u=e.pendingProps,f=o.context,l=t.contextType,typeof l=="object"&&l!==null?l=Hs(l):(l=Ti(t)?Oc:ei.current,l=yh(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)&&wR(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||Si.current||Xl?(typeof h=="function"&&(gE(e,t,h,r),p=e.memoizedState),(A=Xl||yR(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 xE(n,e,t,r,s,i)}function xE(n,e,t,r,i,s){X4(n,e);var o=(e.flags&128)!==0;if(!r&&!o)return i&&dR(e,t,!1),gl(n,e,s);r=e.stateNode,ZK.current=e;var a=o&&typeof t.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,n!==null&&o?(e.child=xh(e,n.child,null,s),e.child=xh(e,null,a,s)):ai(n,e,a,s),e.memoizedState=r.state,i&&dR(e,t,!0),e.child}function $4(n){var e=n.stateNode;e.pendingContext?hR(n,e.pendingContext,e.pendingContext!==e.context):e.context&&hR(n,e.context,!1),oS(n,e.containerInfo)}function IR(n,e,t,r,i){return wh(),eS(i),e.flags|=256,ai(n,e,t,r),e.child}var _E={dehydrated:null,treeContext:null,retryLane:0};function bE(n){return{baseLanes:n,cachePool:null,transitions:null}}function Z4(n,e,t){var r=e.pendingProps,i=Tn.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),un(Tn,i&1),n===null)return pE(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=Bx(o,r,0,null),n=Mc(n,r,t,null),s.return=e,n.return=e,s.sibling=n,e.child=s,e.child.memoizedState=bE(t),e.memoizedState=_E,n):dS(e,o));if(i=n.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return JK(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=_A(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=_A(a,s):(s=Mc(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?bE(t):{baseLanes:o.baseLanes|t,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=n.childLanes&~t,e.memoizedState=_E,r}return s=n.child,n=s.sibling,r=_A(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 dS(n,e){return e=Bx({mode:"visible",children:e},n.mode,0,null),e.return=n,n.child=e}function r0(n,e,t,r){return r!==null&&eS(r),xh(e,n.child,null,t),n=dS(e,e.pendingProps.children),n.flags|=2,e.memoizedState=null,n}function JK(n,e,t,r,i,s,o){if(t)return e.flags&256?(e.flags&=-257,r=p1(Error(Pe(422))),r0(n,e,o,r)):e.memoizedState!==null?(e.child=n.child,e.flags|=128,null):(s=r.fallback,i=e.mode,r=Bx({mode:"visible",children:r.children},i,0,null),s=Mc(s,i,o,null),s.flags|=2,r.return=e,s.return=e,r.sibling=s,e.child=r,e.mode&1&&xh(e,n.child,null,o),e.child.memoizedState=bE(o),e.memoizedState=_E,s);if(!(e.mode&1))return r0(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=p1(s,r,void 0),r0(n,e,o,r)}if(a=(o&n.childLanes)!==0,Ci||a){if(r=Cr,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,ml(n,i),_o(r,n,i,-1))}return wS(),r=p1(Error(Pe(421))),r0(n,e,o,r)}return i.data==="$?"?(e.flags|=128,e.child=n.child,e=uY.bind(null,n),i._reactRetry=e,null):(n=s.treeContext,ts=vA(i.nextSibling),is=e,Bn=!0,vo=null,n!==null&&(Cs[Ms++]=el,Cs[Ms++]=tl,Cs[Ms++]=Nc,el=n.id,tl=n.overflow,Nc=e),e=dS(e,r.children),e.flags|=4096,e)}function RR(n,e,t){n.lanes|=e;var r=n.alternate;r!==null&&(r.lanes|=e),mE(n.return,e,t)}function m1(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 J4(n,e,t){var r=e.pendingProps,i=r.revealOrder,s=r.tail;if(ai(n,e,r.children,t),r=Tn.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&&RR(n,t,e);else if(n.tag===19)RR(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(un(Tn,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&&Wy(n)===null&&(i=t),t=t.sibling;t=i,t===null?(i=e.child,e.child=null):(i=t.sibling,t.sibling=null),m1(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&&Wy(n)===null){e.child=i;break}n=i.sibling,i.sibling=t,t=i,i=n}m1(e,!0,t,null,s);break;case"together":m1(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Kv(n,e){!(e.mode&1)&&n!==null&&(n.alternate=null,e.alternate=null,e.flags|=2)}function gl(n,e,t){if(n!==null&&(e.dependencies=n.dependencies),Qc|=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=_A(n,n.pendingProps),e.child=t,t.return=e;n.sibling!==null;)n=n.sibling,t=t.sibling=_A(n,n.pendingProps),t.return=e;t.sibling=null}return e.child}function qK(n,e,t){switch(e.tag){case 3:$4(e),wh();break;case 5:E4(e);break;case 1:Ti(e.type)&&Qy(e);break;case 4:oS(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,i=e.memoizedProps.value;un(Gy,r._currentValue),r._currentValue=i;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(un(Tn,Tn.current&1),e.flags|=128,null):t&e.child.childLanes?Z4(n,e,t):(un(Tn,Tn.current&1),n=gl(n,e,t),n!==null?n.sibling:null);un(Tn,Tn.current&1);break;case 19:if(r=(t&e.childLanes)!==0,n.flags&128){if(r)return J4(n,e,t);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),un(Tn,Tn.current),r)break;return null;case 22:case 23:return e.lanes=0,Y4(n,e,t)}return gl(n,e,t)}var q4,BE,eQ,tQ;q4=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}};BE=function(){};eQ=function(n,e,t,r){var i=n.memoizedProps;if(i!==r){n=e.stateNode,xc(oa.current);var s=null;switch(t){case"input":i=WB(n,i),r=WB(n,r),s=[];break;case"select":i=Un({},i,{value:void 0}),r=Un({},r,{value:void 0}),s=[];break;case"textarea":i=XB(n,i),r=XB(n,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(n.onclick=Ny)}ZB(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"&&(hm.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"&&(hm.hasOwnProperty(A)?(l!=null&&A==="onScroll"&&fn("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)}};tQ=function(n,e,t,r){t!==r&&(e.flags|=4)};function Td(n,e){if(!Bn)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 Gr(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 eY(n,e,t){var r=e.pendingProps;switch(qM(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gr(e),null;case 1:return Ti(e.type)&&ky(),Gr(e),null;case 3:return r=e.stateNode,_h(),mn(Si),mn(ei),lS(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(n===null||n.child===null)&&(t0(e)?e.flags|=4:n===null||n.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,vo!==null&&(FE(vo),vo=null))),BE(n,e),Gr(e),null;case 5:aS(e);var i=xc(Em.current);if(t=e.type,n!==null&&e.stateNode!=null)eQ(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 Gr(e),null}if(n=xc(oa.current),t0(e)){r=e.stateNode,t=e.type;var s=e.memoizedProps;switch(r[Ko]=e,r[bm]=s,n=(e.mode&1)!==0,t){case"dialog":fn("cancel",r),fn("close",r);break;case"iframe":case"object":case"embed":fn("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[Ko]=e,n[bm]=r,q4(n,e,!1,!1),e.stateNode=n;e:{switch(o=JB(t,r),t){case"dialog":fn("cancel",n),fn("close",n),i=r;break;case"iframe":case"object":case"embed":fn("load",n),i=r;break;case"video":case"audio":for(i=0;iBh&&(e.flags|=128,r=!0,Td(s,!1),e.lanes=4194304)}else{if(!r)if(n=Wy(o),n!==null){if(e.flags|=128,r=!0,t=n.updateQueue,t!==null&&(e.updateQueue=t,e.flags|=4),Td(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!Bn)return Gr(e),null}else 2*$n()-s.renderingStartTime>Bh&&t!==1073741824&&(e.flags|=128,r=!0,Td(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=$n(),e.sibling=null,t=Tn.current,un(Tn,r?t&1|2:t&1),e):(Gr(e),null);case 22:case 23:return yS(),r=e.memoizedState!==null,n!==null&&n.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Ki&1073741824&&(Gr(e),e.subtreeFlags&6&&(e.flags|=8192)):Gr(e),null;case 24:return null;case 25:return null}throw Error(Pe(156,e.tag))}function tY(n,e){switch(qM(e),e.tag){case 1:return Ti(e.type)&&ky(),n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 3:return _h(),mn(Si),mn(ei),lS(),n=e.flags,n&65536&&!(n&128)?(e.flags=n&-65537|128,e):null;case 5:return aS(e),null;case 13:if(mn(Tn),n=e.memoizedState,n!==null&&n.dehydrated!==null){if(e.alternate===null)throw Error(Pe(340));wh()}return n=e.flags,n&65536?(e.flags=n&-65537|128,e):null;case 19:return mn(Tn),null;case 4:return _h(),null;case 10:return rS(e.type._context),null;case 22:case 23:return yS(),null;case 24:return null;default:return null}}var i0=!1,Yr=!1,nY=typeof WeakSet=="function"?WeakSet:Set,Ze=null;function Of(n,e){var t=n.ref;if(t!==null)if(typeof t=="function")try{t(null)}catch(r){Nn(n,e,r)}else t.current=null}function EE(n,e,t){try{t()}catch(r){Nn(n,e,r)}}var FR=!1;function rY(n,e){if(lE=Py,n=s4(),ZM(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(AE={focusedElem:n,selectionRange:t},Py=!1,Ze=e;Ze!==null;)if(e=Ze,n=e.child,(e.subtreeFlags&1028)!==0&&n!==null)n.return=e,Ze=n;else for(;Ze!==null;){e=Ze;try{var 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:ho(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){Nn(e,e.return,x)}if(n=e.sibling,n!==null){n.return=e.return,Ze=n;break}Ze=e.return}return p=FR,FR=!1,p}function Wp(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&&EE(e,t,s)}i=i.next}while(i!==r)}}function _x(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 CE(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 nQ(n){var e=n.alternate;e!==null&&(n.alternate=null,nQ(e)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(e=n.stateNode,e!==null&&(delete e[Ko],delete e[bm],delete e[fE],delete e[kK],delete e[QK])),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 rQ(n){return n.tag===5||n.tag===3||n.tag===4}function UR(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||rQ(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 ME(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=Ny));else if(r!==4&&(n=n.child,n!==null))for(ME(n,e,t),n=n.sibling;n!==null;)ME(n,e,t),n=n.sibling}function SE(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(SE(n,e,t),n=n.sibling;n!==null;)SE(n,e,t),n=n.sibling}var Rr=null,po=!1;function Ul(n,e,t){for(t=t.child;t!==null;)iQ(n,e,t),t=t.sibling}function iQ(n,e,t){if(sa&&typeof sa.onCommitFiberUnmount=="function")try{sa.onCommitFiberUnmount(dx,t)}catch{}switch(t.tag){case 5:Yr||Of(t,e);case 6:var r=Rr,i=po;Rr=null,Ul(n,e,t),Rr=r,po=i,Rr!==null&&(po?(n=Rr,t=t.stateNode,n.nodeType===8?n.parentNode.removeChild(t):n.removeChild(t)):Rr.removeChild(t.stateNode));break;case 18:Rr!==null&&(po?(n=Rr,t=t.stateNode,n.nodeType===8?A1(n.parentNode,t):n.nodeType===1&&A1(n,t),vm(n)):A1(Rr,t.stateNode));break;case 4:r=Rr,i=po,Rr=t.stateNode.containerInfo,po=!0,Ul(n,e,t),Rr=r,po=i;break;case 0:case 11:case 14:case 15:if(!Yr&&(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)&&EE(t,e,o),i=i.next}while(i!==r)}Ul(n,e,t);break;case 1:if(!Yr&&(Of(t,e),r=t.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=t.memoizedProps,r.state=t.memoizedState,r.componentWillUnmount()}catch(a){Nn(t,e,a)}Ul(n,e,t);break;case 21:Ul(n,e,t);break;case 22:t.mode&1?(Yr=(r=Yr)||t.memoizedState!==null,Ul(n,e,t),Yr=r):Ul(n,e,t);break;default:Ul(n,e,t)}}function LR(n){var e=n.updateQueue;if(e!==null){n.updateQueue=null;var t=n.stateNode;t===null&&(t=n.stateNode=new nY),e.forEach(function(r){var i=fY.bind(null,n,r);t.has(r)||(t.add(r),r.then(i,i))})}}function no(n,e){var t=e.deletions;if(t!==null)for(var r=0;ri&&(i=o),r&=~s}if(r=i,r=$n()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*sY(r/1960))-r,10n?16:n,sA===null)var r=!1;else{if(n=sA,sA=null,Zy=0,zt&6)throw Error(Pe(331));var i=zt;for(zt|=4,Ze=n.current;Ze!==null;){var s=Ze,o=s.child;if(Ze.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l$n()-gS?Cc(n,0):mS|=t),Ii(n,e)}function fQ(n,e){e===0&&(n.mode&1?(e=Xg,Xg<<=1,!(Xg&130023424)&&(Xg=4194304)):e=1);var t=pi();n=ml(n,e),n!==null&&(ag(n,e,t),Ii(n,t))}function uY(n){var e=n.memoizedState,t=0;e!==null&&(t=e.retryLane),fQ(n,t)}function fY(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),fQ(n,t)}var hQ;hQ=function(n,e,t){if(n!==null)if(n.memoizedProps!==e.pendingProps||Si.current)Ci=!0;else{if(!(n.lanes&t)&&!(e.flags&128))return Ci=!1,qK(n,e,t);Ci=!!(n.flags&131072)}else Ci=!1,Bn&&e.flags&1048576&&m4(e,zy,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Kv(n,e),n=e.pendingProps;var i=yh(e,ei.current);th(e,t),i=cS(null,e,r,n,i,t);var s=uS();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,Ti(r)?(s=!0,Qy(e)):s=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,sS(e),i.updater=wx,e.stateNode=i,i._reactInternals=e,vE(e,r,n,t),e=xE(null,e,r,!0,s,t)):(e.tag=0,Bn&&s&&JM(e),ai(null,e,i,t),e=e.child),e;case 16:r=e.elementType;e:{switch(Kv(n,e),n=e.pendingProps,i=r._init,r=i(r._payload),e.type=r,i=e.tag=dY(r),n=ho(r,n),i){case 0:e=wE(null,e,r,n,t);break e;case 1:e=TR(null,e,r,n,t);break e;case 11:e=MR(null,e,r,n,t);break e;case 14:e=SR(null,e,r,ho(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:ho(r,i),wE(n,e,r,i,t);case 1:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ho(r,i),TR(n,e,r,i,t);case 3:e:{if($4(e),n===null)throw Error(Pe(387));r=e.pendingProps,s=e.memoizedState,i=s.element,w4(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=bh(Error(Pe(423)),e),e=IR(n,e,r,t,i);break e}else if(r!==i){i=bh(Error(Pe(424)),e),e=IR(n,e,r,t,i);break e}else for(ts=vA(e.stateNode.containerInfo.firstChild),is=e,Bn=!0,vo=null,t=B4(e,null,r,t),e.child=t;t;)t.flags=t.flags&-3|4096,t=t.sibling;else{if(wh(),r===i){e=gl(n,e,t);break e}ai(n,e,r,t)}e=e.child}return e;case 5:return E4(e),n===null&&pE(e),r=e.type,i=e.pendingProps,s=n!==null?n.memoizedProps:null,o=i.children,cE(r,i)?o=null:s!==null&&cE(r,s)&&(e.flags|=32),X4(n,e),ai(n,e,o,t),e.child;case 6:return n===null&&pE(e),null;case 13:return Z4(n,e,t);case 4:return oS(e,e.stateNode.containerInfo),r=e.pendingProps,n===null?e.child=xh(e,null,r,t):ai(n,e,r,t),e.child;case 11:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ho(r,i),MR(n,e,r,i,t);case 7:return ai(n,e,e.pendingProps,t),e.child;case 8:return ai(n,e,e.pendingProps.children,t),e.child;case 12:return ai(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,un(Gy,r._currentValue),r._currentValue=o,s!==null)if(Co(s.value,o)){if(s.children===i.children&&!Si.current){e=gl(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=ol(-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),mE(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),mE(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}ai(n,e,i.children,t),e=e.child}return e;case 9:return i=e.type,r=e.pendingProps.children,th(e,t),i=Hs(i),r=r(i),e.flags|=1,ai(n,e,r,t),e.child;case 14:return r=e.type,i=ho(r,e.pendingProps),i=ho(r.type,i),SR(n,e,r,i,t);case 15:return K4(n,e,e.type,e.pendingProps,t);case 17:return r=e.type,i=e.pendingProps,i=e.elementType===r?i:ho(r,i),Kv(n,e),e.tag=1,Ti(r)?(n=!0,Qy(e)):n=!1,th(e,t),_4(e,r,i),vE(e,r,i,t),xE(null,e,r,!0,n,t);case 19:return J4(n,e,t);case 22:return Y4(n,e,t)}throw Error(Pe(156,e.tag))};function dQ(n,e){return Qk(n,e)}function hY(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 Rs(n,e,t,r){return new hY(n,e,t,r)}function xS(n){return n=n.prototype,!(!n||!n.isReactComponent)}function dY(n){if(typeof n=="function")return xS(n)?1:0;if(n!=null){if(n=n.$$typeof,n===QM)return 11;if(n===HM)return 14}return 2}function _A(n,e){var t=n.alternate;return t===null?(t=Rs(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 $v(n,e,t,r,i,s){var o=2;if(r=n,typeof n=="function")xS(n)&&(o=1);else if(typeof n=="string")o=5;else e:switch(n){case Sf:return Mc(t.children,i,s,e);case kM:o=8,i|=8;break;case zB:return n=Rs(12,t,e,i|2),n.elementType=zB,n.lanes=s,n;case GB:return n=Rs(13,t,e,i),n.elementType=GB,n.lanes=s,n;case VB:return n=Rs(19,t,e,i),n.elementType=VB,n.lanes=s,n;case bk:return Bx(t,i,s,e);default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case xk:o=10;break e;case _k:o=9;break e;case QM:o=11;break e;case HM:o=14;break e;case Yl:o=16,r=null;break e}throw Error(Pe(130,n==null?n:typeof n,""))}return e=Rs(o,t,e,i),e.elementType=n,e.type=r,e.lanes=s,e}function Mc(n,e,t,r){return n=Rs(7,n,r,e),n.lanes=t,n}function Bx(n,e,t,r){return n=Rs(22,n,r,e),n.elementType=bk,n.lanes=t,n.stateNode={isHidden:!1},n}function g1(n,e,t){return n=Rs(6,n,null,e),n.lanes=t,n}function v1(n,e,t){return e=Rs(4,n.children!==null?n.children:[],n.key,e),e.lanes=t,e.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},e}function pY(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=J_(0),this.expirationTimes=J_(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=J_(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function _S(n,e,t,r,i,s,o,a,l){return n=new pY(n,e,t,a,l),e===1?(e=1,s===!0&&(e|=8)):e=0,s=Rs(3,null,null,e),n.current=s,s.stateNode=n,s.memoizedState={element:r,isDehydrated:t,cache:null,transitions:null,pendingSuspenseBoundaries:null},sS(s),n}function mY(n,e,t){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vQ)}catch(n){console.error(n)}}vQ(),mk.exports=hs;var xY=mk.exports,zR=xY;QB.createRoot=zR.createRoot,QB.hydrateRoot=zR.hydrateRoot;const _Y="/assets/cc_bgm_balanced-f542698c.wav",Ks=ye.createContext(),bY=({children:n})=>{const[e,t]=ye.useState(!1),r=$.useRef(null),i=()=>{t(!1);const o=r.current;o.src=_Y,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(Ks.Provider,{value:{isMute:e,setMute:t,enableAudio:i,disableAudio:s},children:[k.jsx("audio",{ref:r}),n]})},BY=ye.createContext(),EY=n=>{const[e,t]=ye.useState(null),[r,i]=ye.useState(null),[s,o]=ye.useState(!1),[a,l]=ye.useState([]);return k.jsx(BY.Provider,{value:{walletAddress:e,setWalletAddress:t,ensName:r,setEnsName:i,connected:s,setConnected:o,OTTokens:a,setOTTokens:l},children:n.children})};function Wa(n){if(n===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return n}function yQ(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 ss={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Eh={duration:.5,overwrite:!1,delay:0},ES,Zr,rr,Fs=1e8,on=1/Fs,FE=Math.PI*2,EY=FE/4,CY=0,yQ=Math.sqrt,MY=Math.cos,SY=Math.sin,Cr=function(e){return typeof e=="string"},kn=function(e){return typeof e=="function"},vl=function(e){return typeof e=="number"},CS=function(e){return typeof e>"u"},ha=function(e){return typeof e=="object"},Ri=function(e){return e!==!1},wQ=function(){return typeof window<"u"},a0=function(e){return kn(e)||Cr(e)},xQ=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Jr=Array.isArray,UE=/(?:-?\.?\d|\.)+/gi,_Q=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,kf=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,v1=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,bQ=/[+-]=-?[.\d]+/,BQ=/[^,'"\[\]\s]+/gi,TY=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,In,_s,LE,MS,as={},ew={},EQ,CQ=function(e){return(ew=zc(e,as))&&ls},SS=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},tw=function(e,t){return!t&&console.warn(e)},MQ=function(e,t){return e&&(as[e]=t)&&ew&&(ew[e]=t)||as},Im=function(){return 0},IY={suppressEvents:!0,isStart:!0,kill:!1},Zv={suppressEvents:!0,kill:!1},RY={suppressEvents:!0},TS={},bA=[],PE={},SQ,$i={},y1={},zR=30,Jv=[],IS="",RS=function(e){var t=e[0],r,i;if(ha(t)||kn(t)||(e=[e]),!(r=(t._gsap||{}).harness)){for(i=Jv.length;i--&&!Jv[i].targetTest(t););r=Jv[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new $Q(e[i],r)))||e.splice(i,1);return e},Sc=function(e){return e._gsap||RS(Us(e))[0]._gsap},TQ=function(e,t,r){return(r=e[t])&&kn(r)?e[t]():CS(r)&&e.getAttribute&&e.getAttribute(t)||r},Fi=function(e,t){return(e=e.split(",")).forEach(t)||e},Yn=function(e){return Math.round(e*1e5)/1e5||0},Fr=function(e){return Math.round(e*1e7)/1e7||0},rh=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},FY=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},Sx=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},UA=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove(e),e._act=0},Tc=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},PY=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},DE=function(e,t,r,i){return e._startAt&&(Zr?e._startAt.revert(Zv):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},DY=function n(e){return!e||e._ts&&n(e.parent)},VR=function(e){return e._repeat?Ch(e._tTime,e=e.duration()+e._rDelay)*e:0},Ch=function(e,t){var r=Math.floor(e/=t);return e&&r===e?r-1:r},iw=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},Tx=function(e){return e._end=Fr(e._start+(e._tDur/Math.abs(e._ts||e._rts||on)||0))},Ix=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)),Tx(e),r._dirty||Tc(r,e)),e},LQ=function(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=iw(e.rawTime(),t),(!t._dur||ug(0,t.totalDuration(),r)-t._tTime>on)&&t.render(r,!0)),Tc(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&r.totalTime(r._tTime),r=r._dp;e._zTime=-on}},Yo=function(e,t,r,i){return t.parent&&UA(t),t._start=Fr((vl(r)?r:r||e!==In?xs(e,r,t):e._time)+t._delay),t._end=Fr(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),UQ(e,t,"_first","_last",e._sort?"_start":0),OE(t)||(e._recent=t),i||LQ(e,t),e._ts<0&&Ix(e,e._tTime),e},PQ=function(e,t){return(as.ScrollTrigger||SS("scrollTrigger",t))&&as.ScrollTrigger.create(t,e)},DQ=function(e,t,r,i,s){if(US(e,t,s),!e._initted)return 1;if(!r&&e._pt&&!Zr&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&SQ!==Zi.frame)return bA.push(e),e._lazy=[s,i],1},OY=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},OE=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},NY=function(e,t,r,i){var s=e.ratio,o=t<0||!t&&(!e._start&&OY(e)&&!(!e._initted&&OE(e))||(e._ts<0||e._dp._ts<0)&&!OE(e))?0:1,a=e._rDelay,l=0,A,c,u;if(a&&e._repeat&&(l=ug(0,e._tDur,t),c=Ch(l,a),e._yoyo&&c&1&&(o=1-o),c!==Ch(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||Zr||i||e._zTime===on||!t&&e._zTime){if(!e._initted&&DQ(e,t,i,r,l))return;for(u=e._zTime,e._zTime=t||(r?on: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&&DE(e,t,r,!0),e._onUpdate&&!r&&Ls(e,"onUpdate"),l&&e._repeat&&!r&&e.parent&&Ls(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&UA(e,1),!r&&!Zr&&(Ls(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},kY=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&&Ix(e,e._tTime=e._tDur*a),e.parent&&Tx(e),r||Tc(e.parent,e),e},jR=function(e){return e instanceof Ei?Tc(e):Mh(e,e._dur)},QY={_start:0,endTime:Im,totalDuration:Im},xs=function n(e,t,r){var i=e.labels,s=e._recent||QY,o=e.duration()>=Fs?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*(Jr(r)?r[0]:r).totalDuration()),a>1?n(e,t.substr(0,a-1),r)+l:o+l)):t==null?o:+t},$p=function(e,t,r){var i=vl(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=Ri(l.vars.inherit)&&l.parent;o.immediateRender=Ri(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new hr(t[0],o,t[s+1])},WA=function(e,t){return e||e===0?t(e):t},ug=function(e,t,r){return rt?t:r},Xr=function(e,t){return!Cr(e)||!(t=TY.exec(e))?"":t[1]},HY=function(e,t,r){return WA(r,function(i){return ug(e,t,i)})},NE=[].slice,OQ=function(e,t){return e&&ha(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&ha(e[0]))&&!e.nodeType&&e!==_s},zY=function(e,t,r){return r===void 0&&(r=[]),e.forEach(function(i){var s;return Cr(i)&&!t||OQ(i,1)?(s=r).push.apply(s,Us(i)):r.push(i)})||r},Us=function(e,t,r){return rr&&!t&&rr.selector?rr.selector(e):Cr(e)&&!r&&(LE||!Sh())?NE.call((t||MS).querySelectorAll(e),0):Jr(e)?zY(e,r):OQ(e)?NE.call(e,0):e?[e]:[]},kE=function(e){return e=Us(e)[0]||tw("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Us(t,r.querySelectorAll?r:r===e?tw("Invalid scope")||MS.createElement("div"):e)}},NQ=function(e){return e.sort(function(){return .5-Math.random()})},kQ=function(e){if(kn(e))return e;var t=ha(e)?e:{each:e},r=Ic(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,T,b,M;if(!g){if(M=t.grid==="auto"?0:(t.grid||[1,Fs])[1],!M){for(T=-Fs;T<(T=p[M++].getBoundingClientRect().left)&&MT&&(T=_),_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=Xr(t.amount||t.each)||0,r=r&&d<0?KQ(r):r}return d=(g[f]-g.min)/g.max||0,Fr(g.b+(r?r(d):d)*g.v)+g.u}},QE=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+(vl(r)?0:Xr(r))}},QQ=function(e,t){var r=Jr(e),i,s;return!r&&ha(e)&&(i=r=e.radius||Fs,e.values?(e=Us(e.values),(s=!vl(e[0]))&&(i*=i)):e=QE(e.increment)),WA(t,r?kn(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=Fs,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)})},Rm=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?BQ:UE),r+=e.substr(t,i-t)+HQ(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return r+e.substr(t,e.length-t)},GQ=function(e,t,r,i,s){var o=t-e,a=i-r;return WA(s,function(l){return r+((l-e)/o*a||0)})},YY=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(Jr(e)&&!Jr(t)){for(c=[],u=e.length,f=u-2,A=1;A(a=Math.abs(a))&&(l=o,s=a);return l},Ls=function(e,t,r){var i=e.vars,s=i[t],o=rr,a=e._ctx,l,A,c;if(s)return l=i[t+"Params"],A=i.callbackScope||e,r&&bA.length&&nw(),a&&(rr=a),c=l?s.apply(A,l):s.call(A),rr=o,c},vp=function(e){return UA(e),e.scrollTrigger&&e.scrollTrigger.kill(!!Zr),e.progress()<1&&Ls(e,"onInterrupt"),e},Qf,XY=function(e){e=!e.name&&e.default||e;var t=e.name,r=kn(e),i=t&&!r&&e.init?function(){this._props=[]}:e,s={init:Im,render:DS,add:FS,kill:uX,modifier:cX,rawVars:0},o={targetTest:0,get:0,getSetter:PS,aliases:{},register:0};if(Sh(),e!==i){if($i[t])return;Gs(i,Gs(rw(e,s),o)),zc(i.prototype,zc(s,rw(e,o))),$i[i.prop=t]=i,e.targetTest&&(Jv.push(i),TS[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}MQ(t,i),e.register&&e.register(ls,i,Ui)},rn=255,yp={aqua:[0,rn,rn],lime:[0,rn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,rn],navy:[0,0,128],white:[rn,rn,rn],olive:[128,128,0],yellow:[rn,rn,0],orange:[rn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[rn,0,0],pink:[rn,192,203],cyan:[0,rn,rn],transparent:[rn,rn,rn,0]},w1=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)*rn+.5|0},VQ=function(e,t,r){var i=e?vl(e)?[e>>16,e>>8&rn,e&rn]:0:yp.black,s,o,a,l,A,c,u,f,h,p;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),yp[e])i=yp[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&rn,i&rn,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&rn,e&rn]}else if(e.substr(0,3)==="hsl"){if(i=p=e.match(UE),!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]=w1(l+1/3,s,o),i[1]=w1(l,s,o),i[2]=w1(l-1/3,s,o);else if(~e.indexOf("="))return i=e.match(_Q),r&&i.length<4&&(i[3]=1),i}else i=e.match(UE)||yp.transparent;i=i.map(Number)}return t&&!p&&(s=i[0]/rn,o=i[1]/rn,a=i[2]/rn,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}(),Sh=function(){return!Fm&&Zi.wake()},Ot={},ZY=/^[\d.\-M][\d.\-,\s]/,JY=/["']/g,qY=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("{")?[qY(t[1])]:eX(e).split(",").map(RQ)):Ot._CE&&ZY.test(e)?Ot._CE("",e):r},KQ=function(e){return function(t){return 1-e(1-t)}},YQ=function n(e,t){for(var r=e._first,i;r;)r instanceof Ei?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},Ic=function(e,t){return e&&(kn(e)?e:Ot[e]||tX(e))||t},nu=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 Fi(e,function(a){Ot[a]=as[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},XQ=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},x1=function n(e,t,r){var i=t>=1?t:1,s=(r||(e?.3:.45))/(t<1?t:1),o=s/FE*(Math.asin(1/i)||0),a=function(c){return c===1?1:i*Math.pow(2,-10*c)*SY((c-o)*s)+1},l=e==="out"?a:e==="in"?function(A){return 1-a(1-A)}:XQ(a);return s=FE/s,l.config=function(A,c){return n(e,A,c)},l},_1=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)}:XQ(r);return i.config=function(s){return n(e,s)},i};Fi("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;nu(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;nu("Elastic",x1("in"),x1("out"),x1());(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,Mh(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(r,i){if(Sh(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(Ix(this,r),!s._dp||s.parent||LQ(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)===on||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),IQ(this,r,i)),this},e.time=function(r,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+VR(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)+VR(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?Ch(this._tTime,s)+1:1},e.timeScale=function(r){if(!arguments.length)return this._rts===-on?0:this._rts;if(this._rts===r)return this;var i=this.parent&&this._ts?iw(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-on?0:this._rts,this.totalTime(ug(-this._delay,this._tDur,i),!0),Tx(this),PY(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):(Sh(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==on&&(this._tTime-=on)))),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+(Ri(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?iw(i.rawTime(r),this):this._tTime:this._tTime},e.revert=function(r){r===void 0&&(r=RY);var i=Zr;return Zr=r,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),Zr=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,jR(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(r){if(arguments.length){var i=this._time;return this._rDelay=r,jR(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),Ri(i))},e.restart=function(r,i){return this.play().totalTime(r?-this._delay:0,Ri(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?-on:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-on,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=kn(r)?r:FQ,a=function(){var A=i.then;i.then=null,kn(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(){vp(this)},n}();Gs(Th.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:-on,_prom:0,_ps:!1,_rts:1});var Ei=function(n){vQ(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=Ri(r.sortChildren),In&&Yo(r.parent||In,Wa(s),i),r.reversed&&s.reverse(),r.paused&&s.paused(!0),r.scrollTrigger&&PQ(Wa(s),r.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,o){return $p(0,arguments,this),this},t.from=function(i,s,o){return $p(1,arguments,this),this},t.fromTo=function(i,s,o,a){return $p(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 hr(i,s,xs(this,o),1),this},t.call=function(i,s,o){return Yo(this,hr.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 hr(i,o,xs(this,l)),this},t.staggerFrom=function(i,s,o,a,l,A,c){return o.runBackwards=1,Xp(o).immediateRender=Ri(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=Ri(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,T;if(this!==In&&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)),_=Ch(this._tTime,g),!a&&this._tTime&&_!==d&&(_=d),C&&d&1&&(f=A-f,T=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||(T?0:Fr(d*g)),s,!A)._lock=0,this._tTime=c,!s&&this.parent&&Ls(this,"onRepeat"),this.vars.repeatRefresh&&!T&&(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&&!T&&this.invalidate()),this._lock=0,!this._ts&&!m)return this;YQ(this,T)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(y=kY(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&&(Ls(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=-on);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||Zr&&(h._initted||h._startAt)),f!==this._time||!this._ts&&!m){y=0,p&&(c+=this._zTime=D?-on:on);break}}h=p}}if(y&&!s&&(this.pause(),y.render(f>=a?0:-on)._zTime=f>=a?1:-1,this._ts))return this._start=x,Tx(this),this.render(i,s,o);this._onUpdate&&!s&&Ls(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)&&UA(this,1),!s&&!(i<0&&!a)&&(c||a||!l)&&(Ls(this,c===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c0)&&this._prom())))}return this},t.add=function(i,s){var o=this;if(vl(s)||(s=xs(this,s,i)),!(i instanceof Th)){if(Jr(i))return i.forEach(function(a){return o.add(a,s)}),this;if(Cr(i))return this.addLabel(i,s);if(kn(i))i=hr.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=-Fs);for(var l=[],A=this._first;A;)A._start>=a&&(A instanceof hr?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):kn(i)?this.killTweensOf(i):(Sx(this,i),i===this._recent&&(this._recent=this._last),Tc(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Fr(Zi.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=hr.delayedCall(0,s||Im,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"&&UA(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=Us(i),l=this._first,A=vl(s),c;l;)l instanceof hr?FY(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=hr.to(o,Gs({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())||on,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&&Mh(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,Gs({startAt:{time:xs(this,i)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),WR(this,xs(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),WR(this,xs(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+on)},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 Tc(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={}),Tc(this)},t.totalDuration=function(i){var s=0,o=this,a=o._last,l=Fs,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;Mh(o,o===In&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(i){if(In._ts&&(IQ(In,iw(i,In)),SQ=Zi.frame),Zi.frame>=zR){zR+=ss.autoSleep||120;var s=In._first;if((!s||!s._ts)&&ss.autoSleep&&Zi._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Zi.sleep()}}},e}(Th);Gs(Ei.prototype,{_lock:0,_hasPause:0,_forcing:0});var nX=function(e,t,r,i,s,o,a){var l=new Ui(this._pt,e,t,0,1,nH,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=Rm(i)),o&&(y=[r,i],o(y,e,t),r=y[0],i=y[1]),f=r.match(v1)||[];u=v1.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)==="="?rh(g,p)-g:parseFloat(p)-g,m:h&&h<4?Math.round:0},A=v1.lastIndex);return l.c=A")}),x.duration();else{C={};for(b in p)b==="ease"||b==="easeEach"||oX(b,p[b],C,p.easeEach);for(b in C)for(I=C[b].sort(function(F,P){return F.t-P.t}),H=0,_=0;_l-on&&!c?l:iA&&(f=A)),m=this._yoyo&&p&1,m&&(x=this._yEase,f=A-f),g=Ch(this._tTime,d),f===a&&!o&&this._initted)return this._tTime=u,this;p!==g&&(w&&this._yEase&&YQ(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(DQ(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&&(Ls(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?-on:w._dur*w._ease(f/this._dur),s,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(c&&DE(this,i,s,o),Ls(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!s&&this.parent&&Ls(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&DE(this,i,!0,!0),(i||!A)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&UA(this,1),!s&&!(c&&!a)&&(u||a||m)&&(Ls(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){Fm||Zi.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),A;return this._initted||US(this,l),A=this._ease(l/this._dur),iX(this,i,s,o,a,A,l)?this.resetTo(i,s,o,a):(Ix(this,0),this.parent||UQ(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?vp(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,oA&&oA.vars.overwrite!==!0)._first||vp(this),this.parent&&o!==this.timeline.totalDuration()&&Mh(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=i?Us(i):a,A=this._ptLookup,c=this._pt,u,f,h,p,d,g,m;if((!s||s==="all")&&LY(a,l))return s==="all"&&(this._pt=0),vp(this);for(u=this._op=this._op||[],s!=="all"&&(Cr(s)&&(d={},Fi(s,function(y){return d[y]=1}),s=d),s=sX(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)&&Sx(this,g,"_pt"),delete f[d]),h!=="all"&&(h[d]=1)}return this._initted&&!this._pt&&c&&vp(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return $p(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 $p(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 In.killTweensOf(i,s,o)},e}(Th);Gs(hr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});Fi("staggerTo,staggerFrom,staggerFromTo",function(n){hr[n]=function(){var e=new Ei,t=NE.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var LS=function(e,t,r){return e[t]=r},eH=function(e,t,r){return e[t](r)},aX=function(e,t,r,i){return e[t](i.fp,r)},lX=function(e,t,r){return e.setAttribute(t,r)},PS=function(e,t){return kn(e[t])?eH:CS(e[t])&&e.setAttribute?lX:LS},tH=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},AX=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},nH=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)},DS=function(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next},cX=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},uX=function(e){for(var t=this._pt,r,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?Sx(this,t,"_pt"):t.dep||(r=1),t=i;return!r},fX=function(e,t,r,i){i.mSet(e,t,i.m.call(i.tween,r,i.mt),i)},rH=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},Ui=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||tH,this.d=l||this,this.set=A||LS,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=fX,this.m=r,this.mt=s,this.tween=i},n}();Fi(IS+"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 TS[n]=1});as.TweenMax=as.TweenLite=hr;as.TimelineLite=as.TimelineMax=Ei;In=new Ei({sortChildren:!1,defaults:Eh,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});ss.stringFilter=WQ;var Ih=[],qv={},hX=[],YR=0,b1=function(e){return(qv[e]||hX).map(function(t){return t()})},zE=function(){var e=Date.now(),t=[];e-YR>2&&(b1("matchMediaInit"),Ih.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))}),b1("matchMediaRevert"),t.forEach(function(r){return r.onMatch(r)}),YR=e,b1("matchMedia"))},iH=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){kn(r)&&(s=i,i=r,r=kn);var o=this,a=function(){var A=rr,c=o.selector,u;return A&&A!==o&&A.data.push(o),s&&(o.selector=kE(s)),rr=o,u=i.apply(o,arguments),kn(u)&&o._r.push(u),rr=A,o.selector=c,o.isReverted=!1,u};return o.last=a,r===kn?a(o):r?o[r]=a:a},e.ignore=function(r){var i=rr;rr=null,r(this),rr=i},e.getTweens=function(){var r=[];return this.data.forEach(function(i){return i instanceof n?r.push.apply(r,i.getTweens()):i instanceof hr&&!(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 Th)&&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=Ih.indexOf(this);~a&&Ih.splice(a,1)}},e.revert=function(r){this.kill(r||{})},n}(),dX=function(){function n(t){this.contexts=[],this.scope=t}var e=n.prototype;return e.add=function(r,i,s){ha(r)||(r={matches:r});var o=new iH(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&&(Ih.indexOf(o)<0&&Ih.push(o),(a[A]=l.matches)&&(c=1),l.addListener?l.addListener(zE):l.addEventListener("change",zE)));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}(),sw={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r1){var i=e.map(function(c){return ls.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=Sc(e),l=a.harness&&(a.harness.aliases||{})[t]||t,A=o?function(c){var u=new o;Qf._pt=0,u.init(e,r?c+r:c,Qf,0,[e]),u.render(1,u),Qf._pt&&DS(1,Qf)}: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=ls.to(e,zc((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 In.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=Ic(e.ease,Eh.ease)),GR(Eh,e||{})},config:function(e){return GR(ss,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]&&!as[a]&&tw(t+" effect requires "+a+" plugin.")}),y1[t]=function(a,l,A){return r(Us(a),Gs(l||{},s),A)},o&&(Ei.prototype[t]=function(a,l,A){return this.add(y1[t](a,ha(l)?l:(A=l)&&{},this),A)})},registerEase:function(e,t){Ot[e]=Ic(t)},parseEase:function(e,t){return arguments.length?Ic(e,t):Ot},getById:function(e){return In.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var r=new Ei(e),i,s;for(r.smoothChildTiming=Ri(e.smoothChildTiming),In.remove(r),r._dp=0,r._time=r._tTime=In._time,i=In._first;i;)s=i._next,(t||!(!i._dur&&i instanceof hr&&i.vars.onComplete===i._targets[0]))&&Yo(r,i,i._start-i._delay),i=s;return Yo(In,r,0),r},context:function(e,t){return e?new iH(e,t):rr},matchMedia:function(e){return new dX(e)},matchMediaRefresh:function(){return Ih.forEach(function(e){var t=e.conditions,r,i;for(i in t)t[i]&&(t[i]=!1,r=1);r&&e.revert()})||zE()},addEventListener:function(e,t){var r=qv[e]||(qv[e]=[]);~r.indexOf(t)||r.push(t)},removeEventListener:function(e,t){var r=qv[e],i=r&&r.indexOf(t);i>=0&&r.splice(i,1)},utils:{wrap:WY,wrapYoyo:KY,distribute:kQ,random:HQ,snap:QQ,normalize:jY,getUnit:Xr,clamp:HY,splitColor:VQ,toArray:Us,selector:kE,mapRange:GQ,pipe:GY,unitize:VY,interpolate:YY,shuffle:NQ},install:CQ,effects:y1,ticker:Zi,updateRoot:Ei.updateRoot,plugins:$i,globalTimeline:In,core:{PropTween:Ui,globals:MQ,Tween:hr,Timeline:Ei,Animation:Th,getCache:Sc,_removeLinkedListItem:Sx,reverting:function(){return Zr},context:function(e){return e&&rr&&(rr.data.push(e),e._ctx=rr),rr},suppressOverwrites:function(e){return ES=e}}};Fi("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return sw[n]=hr[n]});Zi.add(Ei.updateRoot);Qf=sw.to({},{duration:0});var pX=function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r},mX=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=pX(o,i)),o&&o.modifier&&o.modifier(t[i],e,r[s],i))},B1=function(e,t){return{name:e,rawVars:1,init:function(i,s,o){o._onInit=function(a){var l,A;if(Cr(s)&&(l={},Fi(s,function(c){return l[c]=1}),s=l),t){l={};for(A in s)l[A]=t(s[A]);s=l}mX(a,s)}}}},ls=sw.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;)Zr?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)}},B1("roundProps",QE),B1("modifiers"),B1("snap",QQ))||sw;hr.version=Ei.version=ls.version="3.11.4";EQ=1;wQ()&&Sh();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 ss={autoSleep:120,force3D:"auto",nullTargetWarn:1,units:{lineHeight:""}},Eh={duration:.5,overwrite:!1,delay:0},CS,Zr,rr,Fs=1e8,on=1/Fs,UE=Math.PI*2,CY=UE/4,MY=0,wQ=Math.sqrt,SY=Math.cos,TY=Math.sin,Mr=function(e){return typeof e=="string"},kn=function(e){return typeof e=="function"},vl=function(e){return typeof e=="number"},MS=function(e){return typeof e>"u"},ha=function(e){return typeof e=="object"},Ri=function(e){return e!==!1},xQ=function(){return typeof window<"u"},a0=function(e){return kn(e)||Mr(e)},_Q=typeof ArrayBuffer=="function"&&ArrayBuffer.isView||function(){},Jr=Array.isArray,LE=/(?:-?\.?\d|\.)+/gi,bQ=/[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g,kf=/[-+=.]*\d+[.e-]*\d*[a-z%]*/g,y1=/[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi,BQ=/[+-]=-?[.\d]+/,EQ=/[^,'"\[\]\s]+/gi,IY=/^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i,In,_s,PE,SS,as={},ew={},CQ,MQ=function(e){return(ew=zc(e,as))&&ls},TS=function(e,t){return console.warn("Invalid property",e,"set to",t,"Missing plugin? gsap.registerPlugin()")},tw=function(e,t){return!t&&console.warn(e)},SQ=function(e,t){return e&&(as[e]=t)&&ew&&(ew[e]=t)||as},Im=function(){return 0},RY={suppressEvents:!0,isStart:!0,kill:!1},Zv={suppressEvents:!0,kill:!1},FY={suppressEvents:!0},IS={},bA=[],DE={},TQ,$i={},w1={},GR=30,Jv=[],RS="",FS=function(e){var t=e[0],r,i;if(ha(t)||kn(t)||(e=[e]),!(r=(t._gsap||{}).harness)){for(i=Jv.length;i--&&!Jv[i].targetTest(t););r=Jv[i]}for(i=e.length;i--;)e[i]&&(e[i]._gsap||(e[i]._gsap=new ZQ(e[i],r)))||e.splice(i,1);return e},Sc=function(e){return e._gsap||FS(Us(e))[0]._gsap},IQ=function(e,t,r){return(r=e[t])&&kn(r)?e[t]():MS(r)&&e.getAttribute&&e.getAttribute(t)||r},Fi=function(e,t){return(e=e.split(",")).forEach(t)||e},Yn=function(e){return Math.round(e*1e5)/1e5||0},Fr=function(e){return Math.round(e*1e7)/1e7||0},rh=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},UY=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},Tx=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},UA=function(e,t){e.parent&&(!t||e.parent.autoRemoveChildren)&&e.parent.remove(e),e._act=0},Tc=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},DY=function(e){for(var t=e.parent;t&&t.parent;)t._dirty=1,t.totalDuration(),t=t.parent;return e},OE=function(e,t,r,i){return e._startAt&&(Zr?e._startAt.revert(Zv):e.vars.immediateRender&&!e.vars.autoRevert||e._startAt.render(t,!0,i))},OY=function n(e){return!e||e._ts&&n(e.parent)},jR=function(e){return e._repeat?Ch(e._tTime,e=e.duration()+e._rDelay)*e:0},Ch=function(e,t){var r=Math.floor(e/=t);return e&&r===e?r-1:r},iw=function(e,t){return(e-t._start)*t._ts+(t._ts>=0?0:t._dirty?t.totalDuration():t._tDur)},Ix=function(e){return e._end=Fr(e._start+(e._tDur/Math.abs(e._ts||e._rts||on)||0))},Rx=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)),Ix(e),r._dirty||Tc(r,e)),e},PQ=function(e,t){var r;if((t._time||t._initted&&!t._dur)&&(r=iw(e.rawTime(),t),(!t._dur||ug(0,t.totalDuration(),r)-t._tTime>on)&&t.render(r,!0)),Tc(e,t)._dp&&e._initted&&e._time>=e._dur&&e._ts){if(e._dur=0&&r.totalTime(r._tTime),r=r._dp;e._zTime=-on}},Yo=function(e,t,r,i){return t.parent&&UA(t),t._start=Fr((vl(r)?r:r||e!==In?xs(e,r,t):e._time)+t._delay),t._end=Fr(t._start+(t.totalDuration()/Math.abs(t.timeScale())||0)),LQ(e,t,"_first","_last",e._sort?"_start":0),NE(t)||(e._recent=t),i||PQ(e,t),e._ts<0&&Rx(e,e._tTime),e},DQ=function(e,t){return(as.ScrollTrigger||TS("scrollTrigger",t))&&as.ScrollTrigger.create(t,e)},OQ=function(e,t,r,i,s){if(LS(e,t,s),!e._initted)return 1;if(!r&&e._pt&&!Zr&&(e._dur&&e.vars.lazy!==!1||!e._dur&&e.vars.lazy)&&TQ!==Zi.frame)return bA.push(e),e._lazy=[s,i],1},NY=function n(e){var t=e.parent;return t&&t._ts&&t._initted&&!t._lock&&(t.rawTime()<0||n(t))},NE=function(e){var t=e.data;return t==="isFromStart"||t==="isStart"},kY=function(e,t,r,i){var s=e.ratio,o=t<0||!t&&(!e._start&&NY(e)&&!(!e._initted&&NE(e))||(e._ts<0||e._dp._ts<0)&&!NE(e))?0:1,a=e._rDelay,l=0,A,c,u;if(a&&e._repeat&&(l=ug(0,e._tDur,t),c=Ch(l,a),e._yoyo&&c&1&&(o=1-o),c!==Ch(e._tTime,a)&&(s=1-o,e.vars.repeatRefresh&&e._initted&&e.invalidate())),o!==s||Zr||i||e._zTime===on||!t&&e._zTime){if(!e._initted&&OQ(e,t,i,r,l))return;for(u=e._zTime,e._zTime=t||(r?on: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&&OE(e,t,r,!0),e._onUpdate&&!r&&Ls(e,"onUpdate"),l&&e._repeat&&!r&&e.parent&&Ls(e,"onRepeat"),(t>=e._tDur||t<0)&&e.ratio===o&&(o&&UA(e,1),!r&&!Zr&&(Ls(e,o?"onComplete":"onReverseComplete",!0),e._prom&&e._prom()))}else e._zTime||(e._zTime=t)},QY=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&&Rx(e,e._tTime=e._tDur*a),e.parent&&Ix(e),r||Tc(e.parent,e),e},WR=function(e){return e instanceof Ei?Tc(e):Mh(e,e._dur)},HY={_start:0,endTime:Im,totalDuration:Im},xs=function n(e,t,r){var i=e.labels,s=e._recent||HY,o=e.duration()>=Fs?s.endTime(!1):e._dur,a,l,A;return Mr(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*(Jr(r)?r[0]:r).totalDuration()),a>1?n(e,t.substr(0,a-1),r)+l:o+l)):t==null?o:+t},$p=function(e,t,r){var i=vl(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=Ri(l.vars.inherit)&&l.parent;o.immediateRender=Ri(a.immediateRender),e<2?o.runBackwards=1:o.startAt=t[s-1]}return new hr(t[0],o,t[s+1])},WA=function(e,t){return e||e===0?t(e):t},ug=function(e,t,r){return rt?t:r},Xr=function(e,t){return!Mr(e)||!(t=IY.exec(e))?"":t[1]},zY=function(e,t,r){return WA(r,function(i){return ug(e,t,i)})},kE=[].slice,NQ=function(e,t){return e&&ha(e)&&"length"in e&&(!t&&!e.length||e.length-1 in e&&ha(e[0]))&&!e.nodeType&&e!==_s},GY=function(e,t,r){return r===void 0&&(r=[]),e.forEach(function(i){var s;return Mr(i)&&!t||NQ(i,1)?(s=r).push.apply(s,Us(i)):r.push(i)})||r},Us=function(e,t,r){return rr&&!t&&rr.selector?rr.selector(e):Mr(e)&&!r&&(PE||!Sh())?kE.call((t||SS).querySelectorAll(e),0):Jr(e)?GY(e,r):NQ(e)?kE.call(e,0):e?[e]:[]},QE=function(e){return e=Us(e)[0]||tw("Invalid scope")||{},function(t){var r=e.current||e.nativeElement||e;return Us(t,r.querySelectorAll?r:r===e?tw("Invalid scope")||SS.createElement("div"):e)}},kQ=function(e){return e.sort(function(){return .5-Math.random()})},QQ=function(e){if(kn(e))return e;var t=ha(e)?e:{each:e},r=Ic(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 Mr(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,_,B,T,b,M;if(!g){if(M=t.grid==="auto"?0:(t.grid||[1,Fs])[1],!M){for(T=-Fs;T<(T=p[M++].getBoundingClientRect().left)&&MT&&(T=_),_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=Xr(t.amount||t.each)||0,r=r&&d<0?YQ(r):r}return d=(g[f]-g.min)/g.max||0,Fr(g.b+(r?r(d):d)*g.v)+g.u}},HE=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+(vl(r)?0:Xr(r))}},HQ=function(e,t){var r=Jr(e),i,s;return!r&&ha(e)&&(i=r=e.radius||Fs,e.values?(e=Us(e.values),(s=!vl(e[0]))&&(i*=i)):e=HE(e.increment)),WA(t,r?kn(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=Fs,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)})},Rm=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?EQ:LE),r+=e.substr(t,i-t)+zQ(a?s:+s[0],a?0:+s[1],+s[2]||1e-5),t=o+1;return r+e.substr(t,e.length-t)},VQ=function(e,t,r,i,s){var o=t-e,a=i-r;return WA(s,function(l){return r+((l-e)/o*a||0)})},XY=function n(e,t,r,i){var s=isNaN(e+t)?0:function(h){return(1-h)*e+h*t};if(!s){var o=Mr(e),a={},l,A,c,u,f;if(r===!0&&(i=1)&&(r=null),o)e={p:e},t={p:t};else if(Jr(e)&&!Jr(t)){for(c=[],u=e.length,f=u-2,A=1;A(a=Math.abs(a))&&(l=o,s=a);return l},Ls=function(e,t,r){var i=e.vars,s=i[t],o=rr,a=e._ctx,l,A,c;if(s)return l=i[t+"Params"],A=i.callbackScope||e,r&&bA.length&&nw(),a&&(rr=a),c=l?s.apply(A,l):s.call(A),rr=o,c},vp=function(e){return UA(e),e.scrollTrigger&&e.scrollTrigger.kill(!!Zr),e.progress()<1&&Ls(e,"onInterrupt"),e},Qf,$Y=function(e){e=!e.name&&e.default||e;var t=e.name,r=kn(e),i=t&&!r&&e.init?function(){this._props=[]}:e,s={init:Im,render:OS,add:US,kill:fX,modifier:uX,rawVars:0},o={targetTest:0,get:0,getSetter:DS,aliases:{},register:0};if(Sh(),e!==i){if($i[t])return;Gs(i,Gs(rw(e,s),o)),zc(i.prototype,zc(s,rw(e,o))),$i[i.prop=t]=i,e.targetTest&&(Jv.push(i),IS[t]=1),t=(t==="css"?"CSS":t.charAt(0).toUpperCase()+t.substr(1))+"Plugin"}SQ(t,i),e.register&&e.register(ls,i,Ui)},rn=255,yp={aqua:[0,rn,rn],lime:[0,rn,0],silver:[192,192,192],black:[0,0,0],maroon:[128,0,0],teal:[0,128,128],blue:[0,0,rn],navy:[0,0,128],white:[rn,rn,rn],olive:[128,128,0],yellow:[rn,rn,0],orange:[rn,165,0],gray:[128,128,128],purple:[128,0,128],green:[0,128,0],red:[rn,0,0],pink:[rn,192,203],cyan:[0,rn,rn],transparent:[rn,rn,rn,0]},x1=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)*rn+.5|0},jQ=function(e,t,r){var i=e?vl(e)?[e>>16,e>>8&rn,e&rn]:0:yp.black,s,o,a,l,A,c,u,f,h,p;if(!i){if(e.substr(-1)===","&&(e=e.substr(0,e.length-1)),yp[e])i=yp[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&rn,i&rn,parseInt(e.substr(7),16)/255];e=parseInt(e.substr(1),16),i=[e>>16,e>>8&rn,e&rn]}else if(e.substr(0,3)==="hsl"){if(i=p=e.match(LE),!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]=x1(l+1/3,s,o),i[1]=x1(l,s,o),i[2]=x1(l-1/3,s,o);else if(~e.indexOf("="))return i=e.match(bQ),r&&i.length<4&&(i[3]=1),i}else i=e.match(LE)||yp.transparent;i=i.map(Number)}return t&&!p&&(s=i[0]/rn,o=i[1]/rn,a=i[2]/rn,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)&&(B=++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}(),Sh=function(){return!Fm&&Zi.wake()},Ot={},JY=/^[\d.\-M][\d.\-,\s]/,qY=/["']/g,eX=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("{")?[eX(t[1])]:tX(e).split(",").map(FQ)):Ot._CE&&JY.test(e)?Ot._CE("",e):r},YQ=function(e){return function(t){return 1-e(1-t)}},XQ=function n(e,t){for(var r=e._first,i;r;)r instanceof Ei?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},Ic=function(e,t){return e&&(kn(e)?e:Ot[e]||nX(e))||t},nu=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 Fi(e,function(a){Ot[a]=as[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},$Q=function(e){return function(t){return t<.5?(1-e(1-t*2))/2:.5+e((t-.5)*2)/2}},_1=function n(e,t,r){var i=t>=1?t:1,s=(r||(e?.3:.45))/(t<1?t:1),o=s/UE*(Math.asin(1/i)||0),a=function(c){return c===1?1:i*Math.pow(2,-10*c)*TY((c-o)*s)+1},l=e==="out"?a:e==="in"?function(A){return 1-a(1-A)}:$Q(a);return s=UE/s,l.config=function(A,c){return n(e,A,c)},l},b1=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)}:$Q(r);return i.config=function(s){return n(e,s)},i};Fi("Linear,Quad,Cubic,Quart,Quint,Strong",function(n,e){var t=e<5?e+1:e;nu(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;nu("Elastic",_1("in"),_1("out"),_1());(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,Mh(this,this._repeat<0?r:(r-this._repeat*this._rDelay)/(this._repeat+1))):this._tDur},e.totalTime=function(r,i){if(Sh(),!arguments.length)return this._tTime;var s=this._dp;if(s&&s.smoothChildTiming&&this._ts){for(Rx(this,r),!s._dp||s.parent||PQ(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)===on||!r&&!this._initted&&(this.add||this._ptLookup))&&(this._ts||(this._pTime=r),RQ(this,r,i)),this},e.time=function(r,i){return arguments.length?this.totalTime(Math.min(this.totalDuration(),r+jR(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)+jR(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?Ch(this._tTime,s)+1:1},e.timeScale=function(r){if(!arguments.length)return this._rts===-on?0:this._rts;if(this._rts===r)return this;var i=this.parent&&this._ts?iw(this.parent._time,this):this._tTime;return this._rts=+r||0,this._ts=this._ps||r===-on?0:this._rts,this.totalTime(ug(-this._delay,this._tDur,i),!0),Ix(this),DY(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):(Sh(),this._ts=this._rts,this.totalTime(this.parent&&!this.parent.smoothChildTiming?this.rawTime():this._tTime||this._pTime,this.progress()===1&&Math.abs(this._zTime)!==on&&(this._tTime-=on)))),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+(Ri(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?iw(i.rawTime(r),this):this._tTime:this._tTime},e.revert=function(r){r===void 0&&(r=FY);var i=Zr;return Zr=r,(this._initted||this._startAt)&&(this.timeline&&this.timeline.revert(r),this.totalTime(-.01,r.suppressEvents)),this.data!=="nested"&&r.kill!==!1&&this.kill(),Zr=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,WR(this)):this._repeat===-2?1/0:this._repeat},e.repeatDelay=function(r){if(arguments.length){var i=this._time;return this._rDelay=r,WR(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),Ri(i))},e.restart=function(r,i){return this.play().totalTime(r?-this._delay:0,Ri(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?-on:0)),this):this._rts<0},e.invalidate=function(){return this._initted=this._act=0,this._zTime=-on,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=kn(r)?r:UQ,a=function(){var A=i.then;i.then=null,kn(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(){vp(this)},n}();Gs(Th.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:-on,_prom:0,_ps:!1,_rts:1});var Ei=function(n){yQ(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=Ri(r.sortChildren),In&&Yo(r.parent||In,Wa(s),i),r.reversed&&s.reverse(),r.paused&&s.paused(!0),r.scrollTrigger&&DQ(Wa(s),r.scrollTrigger),s}var t=e.prototype;return t.to=function(i,s,o){return $p(0,arguments,this),this},t.from=function(i,s,o){return $p(1,arguments,this),this},t.fromTo=function(i,s,o,a){return $p(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 hr(i,s,xs(this,o),1),this},t.call=function(i,s,o){return Yo(this,hr.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 hr(i,o,xs(this,l)),this},t.staggerFrom=function(i,s,o,a,l,A,c){return o.runBackwards=1,Xp(o).immediateRender=Ri(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=Ri(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,_,B,T;if(this!==In&&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(B=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)),_=Ch(this._tTime,g),!a&&this._tTime&&_!==d&&(_=d),B&&d&1&&(f=A-f,T=1),d!==_&&!this._lock){var b=B&&_&1,M=b===(B&&d&1);if(d<_&&(b=!b),a=b?0:A,this._lock=1,this.render(a||(T?0:Fr(d*g)),s,!A)._lock=0,this._tTime=c,!s&&this.parent&&Ls(this,"onRepeat"),this.vars.repeatRefresh&&!T&&(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&&!T&&this.invalidate()),this._lock=0,!this._ts&&!m)return this;XQ(this,T)}}if(this._hasPause&&!this._forcing&&this._lock<2&&(y=QY(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&&(Ls(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=-on);break}}h=p}else{h=this._last;for(var O=i<0?i:f;h;){if(p=h._prev,(h._act||O<=h._end)&&h._ts&&y!==h){if(h.parent!==this)return this.render(i,s,o);if(h.render(h._ts>0?(O-h._start)*h._ts:(h._dirty?h.totalDuration():h._tDur)+(O-h._start)*h._ts,s,o||Zr&&(h._initted||h._startAt)),f!==this._time||!this._ts&&!m){y=0,p&&(c+=this._zTime=O?-on:on);break}}h=p}}if(y&&!s&&(this.pause(),y.render(f>=a?0:-on)._zTime=f>=a?1:-1,this._ts))return this._start=x,Ix(this),this.render(i,s,o);this._onUpdate&&!s&&Ls(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)&&UA(this,1),!s&&!(i<0&&!a)&&(c||a||!l)&&(Ls(this,c===l&&i>=0?"onComplete":"onReverseComplete",!0),this._prom&&!(c0)&&this._prom())))}return this},t.add=function(i,s){var o=this;if(vl(s)||(s=xs(this,s,i)),!(i instanceof Th)){if(Jr(i))return i.forEach(function(a){return o.add(a,s)}),this;if(Mr(i))return this.addLabel(i,s);if(kn(i))i=hr.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=-Fs);for(var l=[],A=this._first;A;)A._start>=a&&(A instanceof hr?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 Mr(i)?this.removeLabel(i):kn(i)?this.killTweensOf(i):(Tx(this,i),i===this._recent&&(this._recent=this._last),Tc(this))},t.totalTime=function(i,s){return arguments.length?(this._forcing=1,!this._dp&&this._ts&&(this._start=Fr(Zi.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=hr.delayedCall(0,s||Im,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"&&UA(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=Us(i),l=this._first,A=vl(s),c;l;)l instanceof hr?UY(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=hr.to(o,Gs({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())||on,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&&Mh(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,Gs({startAt:{time:xs(this,i)}},o))},t.recent=function(){return this._recent},t.nextLabel=function(i){return i===void 0&&(i=this._time),KR(this,xs(this,i))},t.previousLabel=function(i){return i===void 0&&(i=this._time),KR(this,xs(this,i),1)},t.currentLabel=function(i){return arguments.length?this.seek(i,!0):this.previousLabel(this._time+on)},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 Tc(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={}),Tc(this)},t.totalDuration=function(i){var s=0,o=this,a=o._last,l=Fs,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;Mh(o,o===In&&o._time>s?o._time:s,1,1),o._dirty=0}return o._tDur},e.updateRoot=function(i){if(In._ts&&(RQ(In,iw(i,In)),TQ=Zi.frame),Zi.frame>=GR){GR+=ss.autoSleep||120;var s=In._first;if((!s||!s._ts)&&ss.autoSleep&&Zi._listeners.length<2){for(;s&&!s._ts;)s=s._next;s||Zi.sleep()}}},e}(Th);Gs(Ei.prototype,{_lock:0,_hasPause:0,_forcing:0});var rX=function(e,t,r,i,s,o,a){var l=new Ui(this._pt,e,t,0,1,rH,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=Rm(i)),o&&(y=[r,i],o(y,e,t),r=y[0],i=y[1]),f=r.match(y1)||[];u=y1.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)==="="?rh(g,p)-g:parseFloat(p)-g,m:h&&h<4?Math.round:0},A=y1.lastIndex);return l.c=A")}),x.duration();else{B={};for(b in p)b==="ease"||b==="easeEach"||aX(b,p[b],B,p.easeEach);for(b in B)for(I=B[b].sort(function(L,U){return L.t-U.t}),H=0,_=0;_l-on&&!c?l:iA&&(f=A)),m=this._yoyo&&p&1,m&&(x=this._yEase,f=A-f),g=Ch(this._tTime,d),f===a&&!o&&this._initted)return this._tTime=u,this;p!==g&&(w&&this._yEase&&XQ(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(OQ(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&&(Ls(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?-on:w._dur*w._ease(f/this._dur),s,o)||this._startAt&&(this._zTime=i),this._onUpdate&&!s&&(c&&OE(this,i,s,o),Ls(this,"onUpdate")),this._repeat&&p!==g&&this.vars.onRepeat&&!s&&this.parent&&Ls(this,"onRepeat"),(u===this._tDur||!u)&&this._tTime===u&&(c&&!this._onUpdate&&OE(this,i,!0,!0),(i||!A)&&(u===this._tDur&&this._ts>0||!u&&this._ts<0)&&UA(this,1),!s&&!(c&&!a)&&(u||a||m)&&(Ls(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){Fm||Zi.wake(),this._ts||this.play();var l=Math.min(this._dur,(this._dp._time-this._start)*this._ts),A;return this._initted||LS(this,l),A=this._ease(l/this._dur),sX(this,i,s,o,a,A,l)?this.resetTo(i,s,o,a):(Rx(this,0),this.parent||LQ(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?vp(this):this;if(this.timeline){var o=this.timeline.totalDuration();return this.timeline.killTweensOf(i,s,oA&&oA.vars.overwrite!==!0)._first||vp(this),this.parent&&o!==this.timeline.totalDuration()&&Mh(this,this._dur*this.timeline._tDur/o,0,1),this}var a=this._targets,l=i?Us(i):a,A=this._ptLookup,c=this._pt,u,f,h,p,d,g,m;if((!s||s==="all")&&PY(a,l))return s==="all"&&(this._pt=0),vp(this);for(u=this._op=this._op||[],s!=="all"&&(Mr(s)&&(d={},Fi(s,function(y){return d[y]=1}),s=d),s=oX(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)&&Tx(this,g,"_pt"),delete f[d]),h!=="all"&&(h[d]=1)}return this._initted&&!this._pt&&c&&vp(this),this},e.to=function(i,s){return new e(i,s,arguments[2])},e.from=function(i,s){return $p(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 $p(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 In.killTweensOf(i,s,o)},e}(Th);Gs(hr.prototype,{_targets:[],_lazy:0,_startAt:0,_op:0,_onInit:0});Fi("staggerTo,staggerFrom,staggerFromTo",function(n){hr[n]=function(){var e=new Ei,t=kE.call(arguments,0);return t.splice(n==="staggerFromTo"?5:4,0,0),e[n].apply(e,t)}});var PS=function(e,t,r){return e[t]=r},tH=function(e,t,r){return e[t](r)},lX=function(e,t,r,i){return e[t](i.fp,r)},AX=function(e,t,r){return e.setAttribute(t,r)},DS=function(e,t){return kn(e[t])?tH:MS(e[t])&&e.setAttribute?AX:PS},nH=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e6)/1e6,t)},cX=function(e,t){return t.set(t.t,t.p,!!(t.s+t.c*e),t)},rH=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)},OS=function(e,t){for(var r=t._pt;r;)r.r(e,r.d),r=r._next},uX=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},fX=function(e){for(var t=this._pt,r,i;t;)i=t._next,t.p===e&&!t.op||t.op===e?Tx(this,t,"_pt"):t.dep||(r=1),t=i;return!r},hX=function(e,t,r,i){i.mSet(e,t,i.m.call(i.tween,r,i.mt),i)},iH=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},Ui=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||nH,this.d=l||this,this.set=A||PS,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=hX,this.m=r,this.mt=s,this.tween=i},n}();Fi(RS+"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 IS[n]=1});as.TweenMax=as.TweenLite=hr;as.TimelineLite=as.TimelineMax=Ei;In=new Ei({sortChildren:!1,defaults:Eh,autoRemoveChildren:!0,id:"root",smoothChildTiming:!0});ss.stringFilter=KQ;var Ih=[],qv={},dX=[],XR=0,B1=function(e){return(qv[e]||dX).map(function(t){return t()})},GE=function(){var e=Date.now(),t=[];e-XR>2&&(B1("matchMediaInit"),Ih.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))}),B1("matchMediaRevert"),t.forEach(function(r){return r.onMatch(r)}),XR=e,B1("matchMedia"))},sH=function(){function n(t,r){this.selector=r&&QE(r),this.data=[],this._r=[],this.isReverted=!1,t&&this.add(t)}var e=n.prototype;return e.add=function(r,i,s){kn(r)&&(s=i,i=r,r=kn);var o=this,a=function(){var A=rr,c=o.selector,u;return A&&A!==o&&A.data.push(o),s&&(o.selector=QE(s)),rr=o,u=i.apply(o,arguments),kn(u)&&o._r.push(u),rr=A,o.selector=c,o.isReverted=!1,u};return o.last=a,r===kn?a(o):r?o[r]=a:a},e.ignore=function(r){var i=rr;rr=null,r(this),rr=i},e.getTweens=function(){var r=[];return this.data.forEach(function(i){return i instanceof n?r.push.apply(r,i.getTweens()):i instanceof hr&&!(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 Th)&&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=Ih.indexOf(this);~a&&Ih.splice(a,1)}},e.revert=function(r){this.kill(r||{})},n}(),pX=function(){function n(t){this.contexts=[],this.scope=t}var e=n.prototype;return e.add=function(r,i,s){ha(r)||(r={matches:r});var o=new sH(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&&(Ih.indexOf(o)<0&&Ih.push(o),(a[A]=l.matches)&&(c=1),l.addListener?l.addListener(GE):l.addEventListener("change",GE)));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}(),sw={registerPlugin:function(){for(var e=arguments.length,t=new Array(e),r=0;r1){var i=e.map(function(c){return ls.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=Sc(e),l=a.harness&&(a.harness.aliases||{})[t]||t,A=o?function(c){var u=new o;Qf._pt=0,u.init(e,r?c+r:c,Qf,0,[e]),u.render(1,u),Qf._pt&&OS(1,Qf)}: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=ls.to(e,zc((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 In.getTweensOf(e,!0).length>0},defaults:function(e){return e&&e.ease&&(e.ease=Ic(e.ease,Eh.ease)),VR(Eh,e||{})},config:function(e){return VR(ss,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]&&!as[a]&&tw(t+" effect requires "+a+" plugin.")}),w1[t]=function(a,l,A){return r(Us(a),Gs(l||{},s),A)},o&&(Ei.prototype[t]=function(a,l,A){return this.add(w1[t](a,ha(l)?l:(A=l)&&{},this),A)})},registerEase:function(e,t){Ot[e]=Ic(t)},parseEase:function(e,t){return arguments.length?Ic(e,t):Ot},getById:function(e){return In.getById(e)},exportRoot:function(e,t){e===void 0&&(e={});var r=new Ei(e),i,s;for(r.smoothChildTiming=Ri(e.smoothChildTiming),In.remove(r),r._dp=0,r._time=r._tTime=In._time,i=In._first;i;)s=i._next,(t||!(!i._dur&&i instanceof hr&&i.vars.onComplete===i._targets[0]))&&Yo(r,i,i._start-i._delay),i=s;return Yo(In,r,0),r},context:function(e,t){return e?new sH(e,t):rr},matchMedia:function(e){return new pX(e)},matchMediaRefresh:function(){return Ih.forEach(function(e){var t=e.conditions,r,i;for(i in t)t[i]&&(t[i]=!1,r=1);r&&e.revert()})||GE()},addEventListener:function(e,t){var r=qv[e]||(qv[e]=[]);~r.indexOf(t)||r.push(t)},removeEventListener:function(e,t){var r=qv[e],i=r&&r.indexOf(t);i>=0&&r.splice(i,1)},utils:{wrap:KY,wrapYoyo:YY,distribute:QQ,random:zQ,snap:HQ,normalize:WY,getUnit:Xr,clamp:zY,splitColor:jQ,toArray:Us,selector:QE,mapRange:VQ,pipe:VY,unitize:jY,interpolate:XY,shuffle:kQ},install:MQ,effects:w1,ticker:Zi,updateRoot:Ei.updateRoot,plugins:$i,globalTimeline:In,core:{PropTween:Ui,globals:SQ,Tween:hr,Timeline:Ei,Animation:Th,getCache:Sc,_removeLinkedListItem:Tx,reverting:function(){return Zr},context:function(e){return e&&rr&&(rr.data.push(e),e._ctx=rr),rr},suppressOverwrites:function(e){return CS=e}}};Fi("to,from,fromTo,delayedCall,set,killTweensOf",function(n){return sw[n]=hr[n]});Zi.add(Ei.updateRoot);Qf=sw.to({},{duration:0});var mX=function(e,t){for(var r=e._pt;r&&r.p!==t&&r.op!==t&&r.fp!==t;)r=r._next;return r},gX=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=mX(o,i)),o&&o.modifier&&o.modifier(t[i],e,r[s],i))},E1=function(e,t){return{name:e,rawVars:1,init:function(i,s,o){o._onInit=function(a){var l,A;if(Mr(s)&&(l={},Fi(s,function(c){return l[c]=1}),s=l),t){l={};for(A in s)l[A]=t(s[A]);s=l}gX(a,s)}}}},ls=sw.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;)Zr?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)}},E1("roundProps",HE),E1("modifiers"),E1("snap",HQ))||sw;hr.version=Ei.version=ls.version="3.11.4";CQ=1;xQ()&&Sh();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 XR,aA,ih,OS,_c,$R,NS,gX=function(){return typeof window<"u"},yl={},fc=180/Math.PI,sh=Math.PI/180,gu=Math.atan2,ZR=1e8,kS=/([A-Z])/g,vX=/(left|right|width|margin|padding|x)/i,yX=/[\s,\(]\S/,nl={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},GE=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},wX=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)},xX=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)},_X=function(e,t){var r=t.s+t.c*e;t.set(t.t,t.p,~~(r+(r<0?-.5:.5))+t.u,t)},sH=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},oH=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},bX=function(e,t,r){return e.style[t]=r},BX=function(e,t,r){return e.style.setProperty(t,r)},EX=function(e,t,r){return e._gsap[t]=r},CX=function(e,t,r){return e._gsap.scaleX=e._gsap.scaleY=r},MX=function(e,t,r,i,s){var o=e._gsap;o.scaleX=o.scaleY=r,o.renderTransform(s,o)},SX=function(e,t,r,i,s){var o=e._gsap;o[t]=r,o.renderTransform(s,o)},Rn="transform",bo=Rn+"Origin",TX=function(e,t){var r=this,i=this.target,s=i.style;if(e in yl){if(this.tfm=this.tfm||{},e!=="transform"&&(e=nl[e]||e,~e.indexOf(",")?e.split(",").forEach(function(o){return r.tfm[o]=Xa(i,o)}):this.tfm[e]=i._gsap.x?i._gsap[e]:Xa(i,e)),this.props.indexOf(Rn)>=0)return;i._gsap.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(bo,t,"")),e=Rn}(s||t)&&this.props.push(e,t,s[e])},aH=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},IX=function(){var e=this.props,t=this.target,r=t.style,i=t._gsap,s,o;for(s=0;s=0?JR[o]:"")+e},jE=function(){gX()&&window.document&&(XR=window,aA=XR.document,ih=aA.documentElement,_c=VE("div")||{style:{}},VE("div"),Rn=Rh(Rn),bo=Rn+"Origin",_c.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",AH=!!Rh("perspective"),NS=ls.core.reverting,OS=1)},E1=function n(e){var t=VE("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(ih.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)),ih.removeChild(t),this.style.cssText=s,o},qR=function(e,t){for(var r=t.length;r--;)if(e.hasAttribute(t[r]))return e.getAttribute(t[r])},cH=function(e){var t;try{t=e.getBBox()}catch{t=E1.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===E1||(t=E1.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+qR(e,["x","cx","x1"])||0,y:+qR(e,["y","cy","y1"])||0,width:0,height:0}:t},uH=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&cH(e))},Um=function(e,t){if(t){var r=e.style;t in yl&&t!==bo&&(t=Rn),r.removeProperty?((t.substr(0,2)==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),r.removeProperty(t.replace(kS,"-$1").toLowerCase())):r.removeAttribute(t)}},lA=function(e,t,r,i,s,o){var a=new Ui(e._pt,t,r,0,1,o?oH:sH);return e._pt=a,a.b=i,a.e=s,e._props.push(r),a},eF={deg:1,rad:1,turn:1},RX={grid:1,flex:1},LA=function n(e,t,r,i){var s=parseFloat(r)||0,o=(r+"").trim().substr((s+"").length)||"px",a=_c.style,l=vX.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||eF[i]||eF[o]?s:(o!=="px"&&!f&&(s=n(e,t,r,"px")),m=e.getCTM&&uH(e),(h||o==="%")&&(yl[t]||~t.indexOf("adius"))?(p=m?e.getBBox()[l?"width":"height"]:e[c],Yn(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===Zi.time&&!g.uncache?Yn(s/g.width*u):((h||o==="%")&&!RX[aa(d,"display")]&&(a.position=aa(e,"position")),d===e&&(a.position="static"),d.appendChild(_c),p=_c[c],d.removeChild(_c),a.position="absolute",l&&h&&(g=Sc(d),g.time=Zi.time,g.width=d[c]),Yn(f?p*s/u:p&&s?u/p*s:0))))},Xa=function(e,t,r,i){var s;return OS||jE(),t in nl&&t!=="transform"&&(t=nl[t],~t.indexOf(",")&&(t=t.split(",")[0])),yl[t]&&t!=="transform"?(s=Pm(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:aw(aa(e,bo))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=ow[t]&&ow[t](e,t,r)||aa(e,t)||TQ(e,t)||(t==="opacity"?1:0))),r&&!~(s+"").trim().indexOf(" ")?LA(e,t,s,r)+r:s},FX=function(e,t,r,i){if(!r||r==="none"){var s=Rh(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 Ui(this._pt,e.style,t,0,1,nH),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],WQ(c),r=c[0],i=c[1],f=r.match(kf)||[],_=i.match(kf)||[],_.length){for(;u=kf.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=rh(h,g)+x),m=parseFloat(g),w=g.substr((m+"").length),l=kf.lastIndex-w.length,w||(w=w||ss.units[t]||x,l===i.length&&(i+=w,a.e+=w)),x!==w&&(h=LA(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],yl[a]&&(l=1,a=a==="transformOrigin"?bo:Rn),Um(r,a);l&&(Um(r,Rn),o&&(o.svg&&r.removeAttribute("transform"),Pm(r,1),o.uncache=1,aH(i)))}},ow={clearProps:function(e,t,r,i,s){if(s.data!=="isFromStart"){var o=e._pt=new Ui(e._pt,t,r,0,0,LX);return o.u=i,o.pr=-10,o.tween=s,e._props.push(r),1}}},Lm=[1,0,0,1,0,0],fH={},hH=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},nF=function(e){var t=aa(e,Rn);return hH(t)?Lm:t.substr(7).match(_Q).map(Yn)},QS=function(e,t){var r=e._gsap||Sc(e),i=e.style,s=nF(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"?Lm:s):(s===Lm&&!e.offsetParent&&e!==ih&&!r.svg&&(l=i.display,i.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(A=1,a=e.nextElementSibling,ih.appendChild(e)),s=nF(e),l?i.display=l:Um(e,"display"),A&&(a?o.insertBefore(e,a):o?o.appendChild(e):ih.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},WE=function(e,t,r,i,s,o){var a=e._gsap,l=s||QS(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,T,b,M;r?l!==Lm&&(T=h*g-p*d)&&(b=x*(g/T)+_*(-d/T)+(d*y-g*m)/T,M=x*(-p/T)+_*(h/T)-(h*y-p*m)/T,x=b,_=M):(C=cH(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+" "+_)},Pm=function(e,t){var r=e._gsap||new $Q(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,T,b,M,D,Y,H,I,v,B,F,P,O,z,K,Q,E,G,ee,U;return c=u=f=d=g=m=y=w=x=0,h=p=1,r.svg=!!(e.getCTM&&uH(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Rn]=(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[Rn]!=="none"?l[Rn]:"")),i.scale=i.rotate=i.translate="none"),T=QS(e,r.svg),r.svg&&(r.uncache?(O=e.getBBox(),A=r.xOrigin-O.x+"px "+(r.yOrigin-O.y)+"px",P=""):P=!t&&e.getAttribute("data-svg-origin"),WE(e,P||A,!!P||r.originIsAbsolute,r.smooth!==!1,T)),_=r.xOrigin||0,C=r.yOrigin||0,T!==Lm&&(Y=T[0],H=T[1],I=T[2],v=T[3],c=B=T[4],u=F=T[5],T.length===6?(h=Math.sqrt(Y*Y+H*H),p=Math.sqrt(v*v+I*I),d=Y||H?gu(H,Y)*fc:0,y=I||v?gu(I,v)*fc+d:0,y&&(p*=Math.abs(Math.cos(y*sh))),r.svg&&(c-=_-(_*Y+C*I),u-=C-(_*H+C*v))):(U=T[6],G=T[7],K=T[8],Q=T[9],E=T[10],ee=T[11],c=T[12],u=T[13],f=T[14],b=gu(U,E),g=b*fc,b&&(M=Math.cos(-b),D=Math.sin(-b),P=B*M+K*D,O=F*M+Q*D,z=U*M+E*D,K=B*-D+K*M,Q=F*-D+Q*M,E=U*-D+E*M,ee=G*-D+ee*M,B=P,F=O,U=z),b=gu(-I,E),m=b*fc,b&&(M=Math.cos(-b),D=Math.sin(-b),P=Y*M-K*D,O=H*M-Q*D,z=I*M-E*D,ee=v*D+ee*M,Y=P,H=O,I=z),b=gu(H,Y),d=b*fc,b&&(M=Math.cos(b),D=Math.sin(b),P=Y*M+H*D,O=B*M+F*D,H=H*M-Y*D,F=F*M-B*D,Y=P,B=O),g&&Math.abs(g)+Math.abs(d)>359.9&&(g=d=0,m=180-m),h=Yn(Math.sqrt(Y*Y+H*H+I*I)),p=Yn(Math.sqrt(F*F+U*U)),b=gu(B,F),y=Math.abs(b)>2e-4?b*fc:0,x=ee?1/(ee<0?-ee:ee):0),r.svg&&(P=e.getAttribute("transform"),r.forceCSS=e.setAttribute("transform","")||!hH(aa(e,Rn)),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=Yn(h),r.scaleY=Yn(p),r.rotation=Yn(d)+a,r.rotationX=Yn(g)+a,r.rotationY=Yn(m)+a,r.skewX=y+a,r.skewY=w+a,r.transformPerspective=x+o,(r.zOrigin=parseFloat(A.split(" ")[2])||0)&&(i[bo]=aw(A)),r.xOffset=r.yOffset=0,r.force3D=ss.force3D,r.renderTransform=r.svg?DX:AH?dH:PX,r.uncache=0,r},aw=function(e){return(e=e.split(" "))[0]+" "+e[1]},C1=function(e,t,r){var i=Xr(t);return Yn(parseFloat(t)+parseFloat(LA(e,"x",r+"px",i)))+i},PX=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,dH(e,t)},qA="0deg",Rd="0px",ec=") ",dH=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!==qA||c!==qA)){var C=parseFloat(c)*sh,T=Math.sin(C),b=Math.cos(C),M;C=parseFloat(u)*sh,M=Math.cos(C),o=C1(y,o,T*M*-w),a=C1(y,a,-Math.sin(C)*-w),l=C1(y,l,b*M*-w+w)}g!==Rd&&(x+="perspective("+g+ec),(i||s)&&(x+="translate("+i+"%, "+s+"%) "),(_||o!==Rd||a!==Rd||l!==Rd)&&(x+=l!==Rd||_?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+ec),A!==qA&&(x+="rotate("+A+ec),c!==qA&&(x+="rotateY("+c+ec),u!==qA&&(x+="rotateX("+u+ec),(f!==qA||h!==qA)&&(x+="skew("+f+", "+h+ec),(p!==1||d!==1)&&(x+="scale("+p+", "+d+ec),y.style[Rn]=x||"translate(0, 0)"},DX=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,T,b,M;l=parseFloat(l),A=parseFloat(A),c=parseFloat(c),c&&(c=parseFloat(c),A+=c,l+=c),l||A?(l*=sh,A*=sh,_=Math.cos(l)*u,C=Math.sin(l)*u,T=Math.sin(l-A)*-f,b=Math.cos(l-A)*f,A&&(c*=sh,M=Math.tan(A-c),M=Math.sqrt(1+M*M),T*=M,b*=M,c&&(M=Math.tan(c),M=Math.sqrt(1+M*M),_*=M,C*=M)),_=Yn(_),C=Yn(C),T=Yn(T),b=Yn(b)):(_=u,b=f,C=T=0),(w&&!~(o+"").indexOf("px")||x&&!~(a+"").indexOf("px"))&&(w=LA(h,"x",o,"px"),x=LA(h,"y",a,"px")),(p||d||g||m)&&(w=Yn(w+p-(p*_+d*T)+g),x=Yn(x+d-(p*C+d*b)+m)),(i||s)&&(M=h.getBBox(),w=Yn(w+i/100*M.width),x=Yn(x+s/100*M.height)),M="matrix("+_+","+C+","+T+","+b+","+w+","+x+")",h.setAttribute("transform",M),y&&(h.style[Rn]=M)},OX=function(e,t,r,i,s){var o=360,a=Cr(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?fc: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*ZR)%o-~~(A/o)*o:u==="ccw"&&A>0&&(A=(A-o*ZR)%o-~~(A/o)*o)),e._pt=f=new Ui(e._pt,t,r,i,A,wX),f.e=c,f.u="deg",e._props.push(r),f},rF=function(e,t){for(var r in t)e[r]=t[r];return e},NX=function(e,t,r){var i=rF({},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[Rn]=t,a=Pm(r,1),Um(r,Rn),r.setAttribute("transform",A)):(A=getComputedStyle(r)[Rn],o[Rn]=t,a=Pm(r,1),o[Rn]=A);for(l in yl)A=i[l],c=a[l],A!==c&&s.indexOf(l)<0&&(h=Xr(A),p=Xr(c),u=h!==p?LA(r,l,A,p):parseFloat(A),f=parseFloat(c),e._pt=new Ui(e._pt,a,l,u,f-u,GE),e._pt.u=p||0,e._props.push(l));rF(a,i)};Fi("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});ow[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 Xa(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 pH={name:"css",register:jE,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,T,b;OS||jE(),this.styles=this.styles||lH(e),b=this.styles.props,this.tween=r;for(d in t)if(d!=="autoRound"&&(c=t[d],!($i[d]&&ZQ(d,t,r,i,e,s)))){if(h=typeof c,p=ow[d],h==="function"&&(c=c.call(r,i,e,s),h=typeof c),h==="string"&&~c.indexOf("random(")&&(c=Rm(c)),p)p(this,e,d,c,r)&&(T=1);else if(d.substr(0,2)==="--")A=(getComputedStyle(e).getPropertyValue(d)+"").trim(),c+="",BA.lastIndex=0,BA.test(A)||(g=Xr(A),m=Xr(c)),m?g!==m&&(A=LA(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=Rm(A)),Xr(A+"")||(A+=ss.units[d]||Xr(Xa(e,d))||""),(A+"").charAt(1)==="="&&(A=Xa(e,d))):A=Xa(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 nl&&(d==="autoAlpha"&&(f===1&&Xa(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=nl[d],~d.indexOf(",")&&(d=d.split(",")[0]))),w=d in yl,w){if(this.styles.save(d),x||(_=e._gsap,_.renderTransform&&!t.parseTransform||Pm(e,t.parseTransform),C=t.smoothOrigin!==!1&&_.smooth,x=this._pt=new Ui(this._pt,a,Rn,0,1,_.renderTransform,_,0,-1),x.dep=1),d==="scale")this._pt=new Ui(this._pt,_,"scaleY",_.scaleY,(y?rh(_.scaleY,y+u):u)-_.scaleY||0,GE),this._pt.u=0,o.push("scaleY",d),d+="X";else if(d==="transformOrigin"){b.push(bo,0,a[bo]),c=UX(c),_.svg?WE(e,c,0,C,0,this):(m=parseFloat(c.split(" ")[2])||0,m!==_.zOrigin&&lA(this,_,"zOrigin",_.zOrigin,m),lA(this,a,d,aw(A),aw(c)));continue}else if(d==="svgOrigin"){WE(e,c,1,C,0,this);continue}else if(d in fH){OX(this,_,d,f,y?rh(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"){NX(this,c,e);continue}}else d in a||(d=Rh(d)||d);if(w||(u||u===0)&&(f||f===0)&&!yX.test(c)&&d in a)g=(A+"").substr((f+"").length),u||(u=0),m=Xr(c)||(d in ss.units?ss.units[d]:g),g!==m&&(f=LA(e,d,A,m)),this._pt=new Ui(this._pt,w?_:a,d,f,(y?rh(f,y+u):u)-f,!w&&(m==="px"||d==="zIndex")&&t.autoRound!==!1?_X:GE),this._pt.u=m||0,g!==m&&m!=="%"&&(this._pt.b=A,this._pt.r=xX);else if(d in a)FX.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"){SS(d,c);continue}w||(d in a?b.push(d,0,a[d]):b.push(d,1,A||e[d])),o.push(d)}}T&&rH(this)},render:function(e,t){if(t.tween._time||!NS())for(var r=t._pt;r;)r.r(e,r.d),r=r._next;else t.styles.revert()},get:Xa,aliases:nl,getSetter:function(e,t,r){var i=nl[t];return i&&i.indexOf(",")<0&&(t=i),t in yl&&t!==bo&&(e._gsap.x||Xa(e,"x"))?r&&$R===r?t==="scale"?CX:EX:($R=r||{})&&(t==="scale"?MX:SX):e.style&&!CS(e.style[t])?bX:~t.indexOf("-")?BX:PS(e,t)},core:{_removeProperty:Um,_getMatrix:QS}};ls.utils.checkPrefix=Rh;ls.core.getStyleSaver=lH;(function(n,e,t,r){var i=Fi(n+","+e+","+t,function(s){yl[s]=1});Fi(e,function(s){ss.units[s]="deg",fH[s]=1}),nl[i[13]]=n+","+e,Fi(r,function(s){var o=s.split(":");nl[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");Fi("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){ss.units[n]="px"});ls.registerPlugin(pH);var KE=ls.registerPlugin(pH)||ls;KE.core.Tween;function Xh(){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})}Xh.prototype.key=function(n){return Object.keys(this)[n]};Xh.prototype.getItem=function(n){try{return JSON.parse(this[n])}catch{}return this[n]};Xh.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};Xh.prototype.removeItem=function(n){delete this[n]};Xh.prototype.clear=function(){Object.keys(this).forEach(n=>delete this[n])};let kX=new Xh;const QX=n=>({get(e,t){return n.getItem(String(t))},set(e,t,r){return n.setItem(String(t),r),!0}}),HX=(n=kX)=>new Proxy({},QX(n)),Oe=HX();/** +*/var $R,aA,ih,NS,_c,ZR,kS,vX=function(){return typeof window<"u"},yl={},fc=180/Math.PI,sh=Math.PI/180,gu=Math.atan2,JR=1e8,QS=/([A-Z])/g,yX=/(left|right|width|margin|padding|x)/i,wX=/[\s,\(]\S/,nl={autoAlpha:"opacity,visibility",scale:"scaleX,scaleY",alpha:"opacity"},VE=function(e,t){return t.set(t.t,t.p,Math.round((t.s+t.c*e)*1e4)/1e4+t.u,t)},xX=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)},_X=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)},bX=function(e,t){var r=t.s+t.c*e;t.set(t.t,t.p,~~(r+(r<0?-.5:.5))+t.u,t)},oH=function(e,t){return t.set(t.t,t.p,e?t.e:t.b,t)},aH=function(e,t){return t.set(t.t,t.p,e!==1?t.b:t.e,t)},BX=function(e,t,r){return e.style[t]=r},EX=function(e,t,r){return e.style.setProperty(t,r)},CX=function(e,t,r){return e._gsap[t]=r},MX=function(e,t,r){return e._gsap.scaleX=e._gsap.scaleY=r},SX=function(e,t,r,i,s){var o=e._gsap;o.scaleX=o.scaleY=r,o.renderTransform(s,o)},TX=function(e,t,r,i,s){var o=e._gsap;o[t]=r,o.renderTransform(s,o)},Rn="transform",bo=Rn+"Origin",IX=function(e,t){var r=this,i=this.target,s=i.style;if(e in yl){if(this.tfm=this.tfm||{},e!=="transform"&&(e=nl[e]||e,~e.indexOf(",")?e.split(",").forEach(function(o){return r.tfm[o]=Xa(i,o)}):this.tfm[e]=i._gsap.x?i._gsap[e]:Xa(i,e)),this.props.indexOf(Rn)>=0)return;i._gsap.svg&&(this.svgo=i.getAttribute("data-svg-origin"),this.props.push(bo,t,"")),e=Rn}(s||t)&&this.props.push(e,t,s[e])},lH=function(e){e.translate&&(e.removeProperty("translate"),e.removeProperty("scale"),e.removeProperty("rotate"))},RX=function(){var e=this.props,t=this.target,r=t.style,i=t._gsap,s,o;for(s=0;s=0?qR[o]:"")+e},WE=function(){vX()&&window.document&&($R=window,aA=$R.document,ih=aA.documentElement,_c=jE("div")||{style:{}},jE("div"),Rn=Rh(Rn),bo=Rn+"Origin",_c.style.cssText="border-width:0;line-height:0;position:absolute;padding:0",cH=!!Rh("perspective"),kS=ls.core.reverting,NS=1)},C1=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(ih.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)),ih.removeChild(t),this.style.cssText=s,o},eF=function(e,t){for(var r=t.length;r--;)if(e.hasAttribute(t[r]))return e.getAttribute(t[r])},uH=function(e){var t;try{t=e.getBBox()}catch{t=C1.call(e,!0)}return t&&(t.width||t.height)||e.getBBox===C1||(t=C1.call(e,!0)),t&&!t.width&&!t.x&&!t.y?{x:+eF(e,["x","cx","x1"])||0,y:+eF(e,["y","cy","y1"])||0,width:0,height:0}:t},fH=function(e){return!!(e.getCTM&&(!e.parentNode||e.ownerSVGElement)&&uH(e))},Um=function(e,t){if(t){var r=e.style;t in yl&&t!==bo&&(t=Rn),r.removeProperty?((t.substr(0,2)==="ms"||t.substr(0,6)==="webkit")&&(t="-"+t),r.removeProperty(t.replace(QS,"-$1").toLowerCase())):r.removeAttribute(t)}},lA=function(e,t,r,i,s,o){var a=new Ui(e._pt,t,r,0,1,o?aH:oH);return e._pt=a,a.b=i,a.e=s,e._props.push(r),a},tF={deg:1,rad:1,turn:1},FX={grid:1,flex:1},LA=function n(e,t,r,i){var s=parseFloat(r)||0,o=(r+"").trim().substr((s+"").length)||"px",a=_c.style,l=yX.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||tF[i]||tF[o]?s:(o!=="px"&&!f&&(s=n(e,t,r,"px")),m=e.getCTM&&fH(e),(h||o==="%")&&(yl[t]||~t.indexOf("adius"))?(p=m?e.getBBox()[l?"width":"height"]:e[c],Yn(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===Zi.time&&!g.uncache?Yn(s/g.width*u):((h||o==="%")&&!FX[aa(d,"display")]&&(a.position=aa(e,"position")),d===e&&(a.position="static"),d.appendChild(_c),p=_c[c],d.removeChild(_c),a.position="absolute",l&&h&&(g=Sc(d),g.time=Zi.time,g.width=d[c]),Yn(f?p*s/u:p&&s?u/p*s:0))))},Xa=function(e,t,r,i){var s;return NS||WE(),t in nl&&t!=="transform"&&(t=nl[t],~t.indexOf(",")&&(t=t.split(",")[0])),yl[t]&&t!=="transform"?(s=Pm(e,i),s=t!=="transformOrigin"?s[t]:s.svg?s.origin:aw(aa(e,bo))+" "+s.zOrigin+"px"):(s=e.style[t],(!s||s==="auto"||i||~(s+"").indexOf("calc("))&&(s=ow[t]&&ow[t](e,t,r)||aa(e,t)||IQ(e,t)||(t==="opacity"?1:0))),r&&!~(s+"").trim().indexOf(" ")?LA(e,t,s,r)+r:s},UX=function(e,t,r,i){if(!r||r==="none"){var s=Rh(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 Ui(this._pt,e.style,t,0,1,rH),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],KQ(c),r=c[0],i=c[1],f=r.match(kf)||[],_=i.match(kf)||[],_.length){for(;u=kf.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=rh(h,g)+x),m=parseFloat(g),w=g.substr((m+"").length),l=kf.lastIndex-w.length,w||(w=w||ss.units[t]||x,l===i.length&&(i+=w,a.e+=w)),x!==w&&(h=LA(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],yl[a]&&(l=1,a=a==="transformOrigin"?bo:Rn),Um(r,a);l&&(Um(r,Rn),o&&(o.svg&&r.removeAttribute("transform"),Pm(r,1),o.uncache=1,lH(i)))}},ow={clearProps:function(e,t,r,i,s){if(s.data!=="isFromStart"){var o=e._pt=new Ui(e._pt,t,r,0,0,PX);return o.u=i,o.pr=-10,o.tween=s,e._props.push(r),1}}},Lm=[1,0,0,1,0,0],hH={},dH=function(e){return e==="matrix(1, 0, 0, 1, 0, 0)"||e==="none"||!e},rF=function(e){var t=aa(e,Rn);return dH(t)?Lm:t.substr(7).match(bQ).map(Yn)},HS=function(e,t){var r=e._gsap||Sc(e),i=e.style,s=rF(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"?Lm:s):(s===Lm&&!e.offsetParent&&e!==ih&&!r.svg&&(l=i.display,i.display="block",o=e.parentNode,(!o||!e.offsetParent)&&(A=1,a=e.nextElementSibling,ih.appendChild(e)),s=rF(e),l?i.display=l:Um(e,"display"),A&&(a?o.insertBefore(e,a):o?o.appendChild(e):ih.removeChild(e))),t&&s.length>6?[s[0],s[1],s[4],s[5],s[12],s[13]]:s)},KE=function(e,t,r,i,s,o){var a=e._gsap,l=s||HS(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,B,T,b,M;r?l!==Lm&&(T=h*g-p*d)&&(b=x*(g/T)+_*(-d/T)+(d*y-g*m)/T,M=x*(-p/T)+_*(h/T)-(h*y-p*m)/T,x=b,_=M):(B=uH(e),x=B.x+(~w[0].indexOf("%")?x/100*B.width:x),_=B.y+(~(w[1]||w[0]).indexOf("%")?_/100*B.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+" "+_)},Pm=function(e,t){var r=e._gsap||new ZQ(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,_,B,T,b,M,O,Y,H,I,v,E,L,U,P,z,W,N,C,j,ee,F;return c=u=f=d=g=m=y=w=x=0,h=p=1,r.svg=!!(e.getCTM&&fH(e)),l.translate&&((l.translate!=="none"||l.scale!=="none"||l.rotate!=="none")&&(i[Rn]=(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[Rn]!=="none"?l[Rn]:"")),i.scale=i.rotate=i.translate="none"),T=HS(e,r.svg),r.svg&&(r.uncache?(P=e.getBBox(),A=r.xOrigin-P.x+"px "+(r.yOrigin-P.y)+"px",U=""):U=!t&&e.getAttribute("data-svg-origin"),KE(e,U||A,!!U||r.originIsAbsolute,r.smooth!==!1,T)),_=r.xOrigin||0,B=r.yOrigin||0,T!==Lm&&(Y=T[0],H=T[1],I=T[2],v=T[3],c=E=T[4],u=L=T[5],T.length===6?(h=Math.sqrt(Y*Y+H*H),p=Math.sqrt(v*v+I*I),d=Y||H?gu(H,Y)*fc:0,y=I||v?gu(I,v)*fc+d:0,y&&(p*=Math.abs(Math.cos(y*sh))),r.svg&&(c-=_-(_*Y+B*I),u-=B-(_*H+B*v))):(F=T[6],j=T[7],W=T[8],N=T[9],C=T[10],ee=T[11],c=T[12],u=T[13],f=T[14],b=gu(F,C),g=b*fc,b&&(M=Math.cos(-b),O=Math.sin(-b),U=E*M+W*O,P=L*M+N*O,z=F*M+C*O,W=E*-O+W*M,N=L*-O+N*M,C=F*-O+C*M,ee=j*-O+ee*M,E=U,L=P,F=z),b=gu(-I,C),m=b*fc,b&&(M=Math.cos(-b),O=Math.sin(-b),U=Y*M-W*O,P=H*M-N*O,z=I*M-C*O,ee=v*O+ee*M,Y=U,H=P,I=z),b=gu(H,Y),d=b*fc,b&&(M=Math.cos(b),O=Math.sin(b),U=Y*M+H*O,P=E*M+L*O,H=H*M-Y*O,L=L*M-E*O,Y=U,E=P),g&&Math.abs(g)+Math.abs(d)>359.9&&(g=d=0,m=180-m),h=Yn(Math.sqrt(Y*Y+H*H+I*I)),p=Yn(Math.sqrt(L*L+F*F)),b=gu(E,L),y=Math.abs(b)>2e-4?b*fc:0,x=ee?1/(ee<0?-ee:ee):0),r.svg&&(U=e.getAttribute("transform"),r.forceCSS=e.setAttribute("transform","")||!dH(aa(e,Rn)),U&&e.setAttribute("transform",U))),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=Yn(h),r.scaleY=Yn(p),r.rotation=Yn(d)+a,r.rotationX=Yn(g)+a,r.rotationY=Yn(m)+a,r.skewX=y+a,r.skewY=w+a,r.transformPerspective=x+o,(r.zOrigin=parseFloat(A.split(" ")[2])||0)&&(i[bo]=aw(A)),r.xOffset=r.yOffset=0,r.force3D=ss.force3D,r.renderTransform=r.svg?OX:cH?pH:DX,r.uncache=0,r},aw=function(e){return(e=e.split(" "))[0]+" "+e[1]},M1=function(e,t,r){var i=Xr(t);return Yn(parseFloat(t)+parseFloat(LA(e,"x",r+"px",i)))+i},DX=function(e,t){t.z="0px",t.rotationY=t.rotationX="0deg",t.force3D=0,pH(e,t)},qA="0deg",Rd="0px",ec=") ",pH=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!==qA||c!==qA)){var B=parseFloat(c)*sh,T=Math.sin(B),b=Math.cos(B),M;B=parseFloat(u)*sh,M=Math.cos(B),o=M1(y,o,T*M*-w),a=M1(y,a,-Math.sin(B)*-w),l=M1(y,l,b*M*-w+w)}g!==Rd&&(x+="perspective("+g+ec),(i||s)&&(x+="translate("+i+"%, "+s+"%) "),(_||o!==Rd||a!==Rd||l!==Rd)&&(x+=l!==Rd||_?"translate3d("+o+", "+a+", "+l+") ":"translate("+o+", "+a+ec),A!==qA&&(x+="rotate("+A+ec),c!==qA&&(x+="rotateY("+c+ec),u!==qA&&(x+="rotateX("+u+ec),(f!==qA||h!==qA)&&(x+="skew("+f+", "+h+ec),(p!==1||d!==1)&&(x+="scale("+p+", "+d+ec),y.style[Rn]=x||"translate(0, 0)"},OX=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),_,B,T,b,M;l=parseFloat(l),A=parseFloat(A),c=parseFloat(c),c&&(c=parseFloat(c),A+=c,l+=c),l||A?(l*=sh,A*=sh,_=Math.cos(l)*u,B=Math.sin(l)*u,T=Math.sin(l-A)*-f,b=Math.cos(l-A)*f,A&&(c*=sh,M=Math.tan(A-c),M=Math.sqrt(1+M*M),T*=M,b*=M,c&&(M=Math.tan(c),M=Math.sqrt(1+M*M),_*=M,B*=M)),_=Yn(_),B=Yn(B),T=Yn(T),b=Yn(b)):(_=u,b=f,B=T=0),(w&&!~(o+"").indexOf("px")||x&&!~(a+"").indexOf("px"))&&(w=LA(h,"x",o,"px"),x=LA(h,"y",a,"px")),(p||d||g||m)&&(w=Yn(w+p-(p*_+d*T)+g),x=Yn(x+d-(p*B+d*b)+m)),(i||s)&&(M=h.getBBox(),w=Yn(w+i/100*M.width),x=Yn(x+s/100*M.height)),M="matrix("+_+","+B+","+T+","+b+","+w+","+x+")",h.setAttribute("transform",M),y&&(h.style[Rn]=M)},NX=function(e,t,r,i,s){var o=360,a=Mr(s),l=parseFloat(s)*(a&&~s.indexOf("rad")?fc: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*JR)%o-~~(A/o)*o:u==="ccw"&&A>0&&(A=(A-o*JR)%o-~~(A/o)*o)),e._pt=f=new Ui(e._pt,t,r,i,A,xX),f.e=c,f.u="deg",e._props.push(r),f},iF=function(e,t){for(var r in t)e[r]=t[r];return e},kX=function(e,t,r){var i=iF({},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[Rn]=t,a=Pm(r,1),Um(r,Rn),r.setAttribute("transform",A)):(A=getComputedStyle(r)[Rn],o[Rn]=t,a=Pm(r,1),o[Rn]=A);for(l in yl)A=i[l],c=a[l],A!==c&&s.indexOf(l)<0&&(h=Xr(A),p=Xr(c),u=h!==p?LA(r,l,A,p):parseFloat(A),f=parseFloat(c),e._pt=new Ui(e._pt,a,l,u,f-u,VE),e._pt.u=p||0,e._props.push(l));iF(a,i)};Fi("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});ow[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 Xa(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 mH={name:"css",register:WE,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,_,B,T,b;NS||WE(),this.styles=this.styles||AH(e),b=this.styles.props,this.tween=r;for(d in t)if(d!=="autoRound"&&(c=t[d],!($i[d]&&JQ(d,t,r,i,e,s)))){if(h=typeof c,p=ow[d],h==="function"&&(c=c.call(r,i,e,s),h=typeof c),h==="string"&&~c.indexOf("random(")&&(c=Rm(c)),p)p(this,e,d,c,r)&&(T=1);else if(d.substr(0,2)==="--")A=(getComputedStyle(e).getPropertyValue(d)+"").trim(),c+="",BA.lastIndex=0,BA.test(A)||(g=Xr(A),m=Xr(c)),m?g!==m&&(A=LA(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],Mr(A)&&~A.indexOf("random(")&&(A=Rm(A)),Xr(A+"")||(A+=ss.units[d]||Xr(Xa(e,d))||""),(A+"").charAt(1)==="="&&(A=Xa(e,d))):A=Xa(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 nl&&(d==="autoAlpha"&&(f===1&&Xa(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=nl[d],~d.indexOf(",")&&(d=d.split(",")[0]))),w=d in yl,w){if(this.styles.save(d),x||(_=e._gsap,_.renderTransform&&!t.parseTransform||Pm(e,t.parseTransform),B=t.smoothOrigin!==!1&&_.smooth,x=this._pt=new Ui(this._pt,a,Rn,0,1,_.renderTransform,_,0,-1),x.dep=1),d==="scale")this._pt=new Ui(this._pt,_,"scaleY",_.scaleY,(y?rh(_.scaleY,y+u):u)-_.scaleY||0,VE),this._pt.u=0,o.push("scaleY",d),d+="X";else if(d==="transformOrigin"){b.push(bo,0,a[bo]),c=LX(c),_.svg?KE(e,c,0,B,0,this):(m=parseFloat(c.split(" ")[2])||0,m!==_.zOrigin&&lA(this,_,"zOrigin",_.zOrigin,m),lA(this,a,d,aw(A),aw(c)));continue}else if(d==="svgOrigin"){KE(e,c,1,B,0,this);continue}else if(d in hH){NX(this,_,d,f,y?rh(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"){kX(this,c,e);continue}}else d in a||(d=Rh(d)||d);if(w||(u||u===0)&&(f||f===0)&&!wX.test(c)&&d in a)g=(A+"").substr((f+"").length),u||(u=0),m=Xr(c)||(d in ss.units?ss.units[d]:g),g!==m&&(f=LA(e,d,A,m)),this._pt=new Ui(this._pt,w?_:a,d,f,(y?rh(f,y+u):u)-f,!w&&(m==="px"||d==="zIndex")&&t.autoRound!==!1?bX:VE),this._pt.u=m||0,g!==m&&m!=="%"&&(this._pt.b=A,this._pt.r=_X);else if(d in a)UX.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"){TS(d,c);continue}w||(d in a?b.push(d,0,a[d]):b.push(d,1,A||e[d])),o.push(d)}}T&&iH(this)},render:function(e,t){if(t.tween._time||!kS())for(var r=t._pt;r;)r.r(e,r.d),r=r._next;else t.styles.revert()},get:Xa,aliases:nl,getSetter:function(e,t,r){var i=nl[t];return i&&i.indexOf(",")<0&&(t=i),t in yl&&t!==bo&&(e._gsap.x||Xa(e,"x"))?r&&ZR===r?t==="scale"?MX:CX:(ZR=r||{})&&(t==="scale"?SX:TX):e.style&&!MS(e.style[t])?BX:~t.indexOf("-")?EX:DS(e,t)},core:{_removeProperty:Um,_getMatrix:HS}};ls.utils.checkPrefix=Rh;ls.core.getStyleSaver=AH;(function(n,e,t,r){var i=Fi(n+","+e+","+t,function(s){yl[s]=1});Fi(e,function(s){ss.units[s]="deg",hH[s]=1}),nl[i[13]]=n+","+e,Fi(r,function(s){var o=s.split(":");nl[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");Fi("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective",function(n){ss.units[n]="px"});ls.registerPlugin(mH);var YE=ls.registerPlugin(mH)||ls;YE.core.Tween;function Xh(){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})}Xh.prototype.key=function(n){return Object.keys(this)[n]};Xh.prototype.getItem=function(n){try{return JSON.parse(this[n])}catch{}return this[n]};Xh.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};Xh.prototype.removeItem=function(n){delete this[n]};Xh.prototype.clear=function(){Object.keys(this).forEach(n=>delete this[n])};let QX=new Xh;const HX=n=>({get(e,t){return n.getItem(String(t))},set(e,t,r){return n.setItem(String(t),r),!0}}),zX=(n=QX)=>new Proxy({},HX(n)),Oe=zX();/** * @license * Copyright 2010-2023 Three.js Authors * SPDX-License-Identifier: MIT - */const Gc="149",vu={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},yu={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},zX=0,iF=1,GX=2,mH=1,VX=2,wp=3,As=0,qr=1,hi=2,EA=0,oh=1,Vc=2,sF=3,oF=4,jX=5,Ju=100,WX=101,KX=102,aF=103,lF=104,YX=200,XX=201,$X=202,ZX=203,gH=204,vH=205,JX=206,qX=207,e$=208,t$=209,n$=210,r$=0,i$=1,s$=2,YE=3,o$=4,a$=5,l$=6,A$=7,Rx=0,c$=1,u$=2,al=0,f$=1,h$=2,d$=3,p$=4,m$=5,yH=300,Fh=301,Uh=302,lw=303,XE=304,Fx=306,cs=1e3,ui=1001,Dm=1002,Xn=1003,Aw=1004,Jp=1005,li=1006,HS=1007,PA=1008,jc=1009,g$=1010,v$=1011,wH=1012,y$=1013,bc=1014,AA=1015,Om=1016,w$=1017,x$=1018,ah=1020,_$=1021,Lr=1023,b$=1024,B$=1025,Rc=1026,Lh=1027,E$=1028,C$=1029,M$=1030,S$=1031,T$=1033,M1=33776,S1=33777,T1=33778,I1=33779,AF=35840,cF=35841,uF=35842,fF=35843,I$=36196,hF=37492,dF=37496,pF=37808,mF=37809,gF=37810,vF=37811,yF=37812,wF=37813,xF=37814,_F=37815,bF=37816,BF=37817,EF=37818,CF=37819,MF=37820,SF=37821,R1=36492,R$=36283,TF=36284,IF=36285,RF=36286,F$=2200,U$=2201,L$=2202,Ph=2300,Wc=2301,F1=2302,Hf=2400,zf=2401,cw=2402,zS=2500,P$=2501,D$=0,xH=1,$E=2,wl=3e3,wt=3001,O$=3200,N$=3201,$h=0,k$=1,FF="",mo="srgb",Nm="srgb-linear",U1=7680,Q$=519,ZE=35044,H$=35048,UF="300 es",JE=1035;class KA{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]+Vr[n>>16&255]+Vr[n>>24&255]+"-"+Vr[e&255]+Vr[e>>8&255]+"-"+Vr[e>>16&15|64]+Vr[e>>24&255]+"-"+Vr[t&63|128]+Vr[t>>8&255]+"-"+Vr[t>>16&255]+Vr[t>>24&255]+Vr[r&255]+Vr[r>>8&255]+Vr[r>>16&255]+Vr[r>>24&255]).toLowerCase()}function dr(n,e,t){return Math.max(e,Math.min(t,n))}function GS(n,e){return(n%e+e)%e}function z$(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function G$(n,e,t){return n!==e?(t-n)/(e-n):0}function em(n,e,t){return(1-t)*n+t*e}function V$(n,e,t,r){return em(n,e,1-Math.exp(-t*r))}function j$(n,e=1){return e-Math.abs(GS(n,e*2)-e)}function W$(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function K$(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function Y$(n,e){return n+Math.floor(Math.random()*(e-n+1))}function X$(n,e){return n+Math.random()*(e-n)}function $$(n){return n*(.5-Math.random())}function Z$(n){n!==void 0&&(LF=n);let e=LF+=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 J$(n){return n*qp}function q$(n){return n*km}function qE(n){return(n&n-1)===0&&n!==0}function _H(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function uw(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function eZ(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 rl(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 sn(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:qp,RAD2DEG:km,ceilPowerOfTwo:_H,clamp:dr,damp:V$,degToRad:J$,denormalize:rl,euclideanModulo:GS,floorPowerOfTwo:uw,generateUUID:Bo,inverseLerp:G$,isPowerOfTwo:qE,lerp:em,mapLinear:z$,normalize:sn,pingpong:j$,radToDeg:q$,randFloat:X$,randFloatSpread:$$,randInt:Y$,seededRandom:Z$,setQuaternionFromProperEuler:eZ,smootherstep:K$,smoothstep:W$});class Ye{constructor(e=0,t=0){Ye.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 xn{constructor(){xn.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],T=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*T,s[1]=A*d+c*y+u*_,s[4]=A*g+c*w+u*C,s[7]=A*m+c*x+u*T,s[2]=f*d+h*y+p*_,s[5]=f*g+h*w+p*C,s[8]=f*m+h*x+p*T,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(L1.makeScale(e,t)),this}rotate(e){return this.premultiply(L1.makeRotation(-e)),this}translate(e,t){return this.premultiply(L1.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 L1=new xn;function bH(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Qm(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Fc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function ey(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const P1={[mo]:{[Nm]:Fc},[Nm]:{[mo]:ey}},ri={legacyMode:!0,get workingColorSpace(){return Nm},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(P1[e]&&P1[e][t]!==void 0){const r=P1[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)}},BH={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},cr={r:0,g:0,b:0},ro={h:0,s:0,l:0},l0={h:0,s:0,l:0};function D1(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 A0(n,e){return e.r=n.r,e.g=n.g,e.b=n.b,e}class ke{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=mo){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ri.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=ri.workingColorSpace){return this.r=e,this.g=t,this.b=r,ri.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=ri.workingColorSpace){if(e=GS(e,1),t=dr(t,0,1),r=dr(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=D1(o,s,e+1/3),this.g=D1(o,s,e),this.b=D1(o,s,e-1/3)}return ri.toWorkingColorSpace(this,i),this}setStyle(e,t=mo){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,ri.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,ri.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,ri.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,ri.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=mo){const r=BH[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=Fc(e.r),this.g=Fc(e.g),this.b=Fc(e.b),this}copyLinearToSRGB(e){return this.r=ey(e.r),this.g=ey(e.g),this.b=ey(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=mo){return ri.fromWorkingColorSpace(A0(this,cr),e),dr(cr.r*255,0,255)<<16^dr(cr.g*255,0,255)<<8^dr(cr.b*255,0,255)<<0}getHexString(e=mo){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ri.workingColorSpace){ri.fromWorkingColorSpace(A0(this,cr),t);const r=cr.r,i=cr.g,s=cr.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{wu===void 0&&(wu=Qm("canvas")),wu.width=e.width,wu.height=e.height;const r=wu.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=wu}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=Qm("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!==yH)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case cs:e.x=e.x-Math.floor(e.x);break;case ui:e.x=e.x<0?0:1;break;case Dm: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 cs:e.y=e.y-Math.floor(e.y);break;case ui:e.y=e.y<0?0:1;break;case Dm: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)}}Hn.DEFAULT_IMAGE=null;Hn.DEFAULT_MAPPING=yH;Hn.DEFAULT_ANISOTROPY=1;class Ht{constructor(e=0,t=0,r=0,i=1){Ht.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,T=(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=T/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=T/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 da extends KA{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ht(0,0,e,t),this.scissorTest=!1,this.viewport=new Ht(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new Hn(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:li,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 VS(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 CH extends Hn{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=Xn,this.minFilter=Xn,this.wrapR=ui,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class nZ extends Hn{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=Xn,this.minFilter=Xn,this.wrapR=ui,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(dr(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,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(PF.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(PF.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 N1.copy(this).projectOnVector(e),this.sub(N1)}reflect(e){return this.sub(N1.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){const t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;const r=this.dot(e)/t;return Math.acos(dr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}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 N1=new Z,PF=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,tc),tc.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(Fd),c0.subVectors(this.max,Fd),xu.subVectors(e.a,Fd),_u.subVectors(e.b,Fd),bu.subVectors(e.c,Fd),Ll.subVectors(_u,xu),Pl.subVectors(bu,_u),nc.subVectors(xu,bu);let t=[0,-Ll.z,Ll.y,0,-Pl.z,Pl.y,0,-nc.z,nc.y,Ll.z,0,-Ll.x,Pl.z,0,-Pl.x,nc.z,0,-nc.x,-Ll.y,Ll.x,0,-Pl.y,Pl.x,0,-nc.y,nc.x,0];return!Q1(t,xu,_u,bu,c0)||(t=[1,0,0,0,1,0,0,0,1],!Q1(t,xu,_u,bu,c0))?!1:(u0.crossVectors(Ll,Pl),t=[u0.x,u0.y,u0.z],Q1(t,xu,_u,bu,c0))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return tc.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(tc).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:(Ma[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ma[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ma[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ma[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ma[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ma[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ma[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ma[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ma),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 Ma=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],tc=new Z,k1=new ps,xu=new Z,_u=new Z,bu=new Z,Ll=new Z,Pl=new Z,nc=new Z,Fd=new Z,c0=new Z,u0=new Z,rc=new Z;function Q1(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){rc.fromArray(n,s);const a=i.x*Math.abs(rc.x)+i.y*Math.abs(rc.y)+i.z*Math.abs(rc.z),l=e.dot(rc),A=t.dot(rc),c=r.dot(rc);if(Math.max(-Math.max(l,A,c),Math.min(l,A,c))>a)return!1}return!0}const rZ=new ps,Ud=new Z,H1=new Z;class ru{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):rZ.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;Ud.subVectors(e,this.center);const t=Ud.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Ud,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):(H1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ud.copy(e.center).add(H1)),this.expandByPoint(Ud.copy(e.center).sub(H1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Sa=new Z,z1=new Z,f0=new Z,Dl=new Z,G1=new Z,h0=new Z,V1=new Z;class fg{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,Sa)),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=Sa.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Sa.copy(this.direction).multiplyScalar(t).add(this.origin),Sa.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){z1.copy(e).add(t).multiplyScalar(.5),f0.copy(t).sub(e).normalize(),Dl.copy(this.origin).sub(z1);const s=e.distanceTo(t)*.5,o=-this.direction.dot(f0),a=Dl.dot(this.direction),l=-Dl.dot(f0),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(f0).multiplyScalar(f).add(z1),h}intersectSphere(e,t){Sa.subVectors(e.center,this.origin);const r=Sa.dot(this.direction),i=Sa.dot(Sa)-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,Sa)!==null}intersectTriangle(e,t,r,i,s){G1.subVectors(t,e),h0.subVectors(r,e),V1.crossVectors(G1,h0);let o=this.direction.dot(V1),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(h0.crossVectors(Dl,h0));if(l<0)return null;const A=a*this.direction.dot(G1.cross(Dl));if(A<0||l+A>o)return null;const c=-a*Dl.dot(V1);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 We{constructor(){We.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 We().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/Bu.setFromMatrixColumn(e,0).length(),s=1/Bu.setFromMatrixColumn(e,1).length(),o=1/Bu.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(iZ,e,sZ)}lookAt(e,t,r){const i=this.elements;return Qi.subVectors(e,t),Qi.lengthSq()===0&&(Qi.z=1),Qi.normalize(),Ol.crossVectors(r,Qi),Ol.lengthSq()===0&&(Math.abs(r.z)===1?Qi.x+=1e-4:Qi.z+=1e-4,Qi.normalize(),Ol.crossVectors(r,Qi)),Ol.normalize(),d0.crossVectors(Qi,Ol),i[0]=Ol.x,i[4]=d0.x,i[8]=Qi.x,i[1]=Ol.y,i[5]=d0.y,i[9]=Qi.y,i[2]=Ol.z,i[6]=d0.z,i[10]=Qi.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],T=i[4],b=i[8],M=i[12],D=i[1],Y=i[5],H=i[9],I=i[13],v=i[2],B=i[6],F=i[10],P=i[14],O=i[3],z=i[7],K=i[11],Q=i[15];return s[0]=o*C+a*D+l*v+A*O,s[4]=o*T+a*Y+l*B+A*z,s[8]=o*b+a*H+l*F+A*K,s[12]=o*M+a*I+l*P+A*Q,s[1]=c*C+u*D+f*v+h*O,s[5]=c*T+u*Y+f*B+h*z,s[9]=c*b+u*H+f*F+h*K,s[13]=c*M+u*I+f*P+h*Q,s[2]=p*C+d*D+g*v+m*O,s[6]=p*T+d*Y+g*B+m*z,s[10]=p*b+d*H+g*F+m*K,s[14]=p*M+d*I+g*P+m*Q,s[3]=y*C+w*D+x*v+_*O,s[7]=y*T+w*Y+x*B+_*z,s[11]=y*b+w*H+x*F+_*K,s[15]=y*M+w*I+x*P+_*Q,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 T=1/C;return e[0]=y*T,e[1]=(d*f*s-u*g*s-d*i*h+r*g*h+u*i*m-r*f*m)*T,e[2]=(a*g*s-d*l*s+d*i*A-r*g*A-a*i*m+r*l*m)*T,e[3]=(u*l*s-a*f*s-u*i*A+r*f*A+a*i*h-r*l*h)*T,e[4]=w*T,e[5]=(c*g*s-p*f*s+p*i*h-t*g*h-c*i*m+t*f*m)*T,e[6]=(p*l*s-o*g*s-p*i*A+t*g*A+o*i*m-t*l*m)*T,e[7]=(o*f*s-c*l*s+c*i*A-t*f*A-o*i*h+t*l*h)*T,e[8]=x*T,e[9]=(p*u*s-c*d*s-p*r*h+t*d*h+c*r*m-t*u*m)*T,e[10]=(o*d*s-p*a*s+p*r*A-t*d*A-o*r*m+t*a*m)*T,e[11]=(c*a*s-o*u*s-c*r*A+t*u*A+o*r*h-t*a*h)*T,e[12]=_*T,e[13]=(c*d*i-p*u*i+p*r*f-t*d*f-c*r*g+t*u*g)*T,e[14]=(p*a*i-o*d*i-p*r*l+t*d*l+o*r*g-t*a*g)*T,e[15]=(o*u*i-c*a*i+c*r*l-t*u*l-o*r*f+t*a*f)*T,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,T=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)*T,i[9]=(g-y)*T,i[10]=(1-(f+d))*T,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=Bu.set(i[0],i[1],i[2]).length();const o=Bu.set(i[4],i[5],i[6]).length(),a=Bu.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],io.copy(this);const A=1/s,c=1/o,u=1/a;return io.elements[0]*=A,io.elements[1]*=A,io.elements[2]*=A,io.elements[4]*=c,io.elements[5]*=c,io.elements[6]*=c,io.elements[8]*=u,io.elements[9]*=u,io.elements[10]*=u,t.setFromRotationMatrix(io),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 Bu=new Z,io=new We,iZ=new Z(0,0,0),sZ=new Z(1,1,1),Ol=new Z,d0=new Z,Qi=new Z,DF=new We,OF=new rt;class di{constructor(e=0,t=0,r=0,i=di.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(dr(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(-dr(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(dr(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(-dr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,h),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,A));break;case"YZX":this._z=Math.asin(dr(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(-dr(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 DF.makeRotationFromQuaternion(e),this.setFromRotationMatrix(DF,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return OF.setFromEuler(this),this.setFromQuaternion(OF,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}}di.DEFAULT_ORDER="XYZ";class jS{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(Ld,e,aZ),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ld,lZ,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){so.subVectors(i,t),Ia.subVectors(r,t),j1.subVectors(e,t);const o=so.dot(so),a=so.dot(Ia),l=so.dot(j1),A=Ia.dot(Ia),c=Ia.dot(j1),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,Ra),Ra.x>=0&&Ra.y>=0&&Ra.x+Ra.y<=1}static getUV(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,Ra),l.set(0,0),l.addScaledVector(s,Ra.x),l.addScaledVector(o,Ra.y),l.addScaledVector(a,Ra.z),l}static isFrontFacing(e,t,r,i){return so.subVectors(r,t),Ia.subVectors(e,t),so.cross(Ia).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 so.subVectors(this.c,this.b),Ia.subVectors(this.a,this.b),so.cross(Ia).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ji.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ji.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,s){return Ji.getUV(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Ji.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ji.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;Cu.subVectors(i,r),Mu.subVectors(s,r),W1.subVectors(e,r);const l=Cu.dot(W1),A=Mu.dot(W1);if(l<=0&&A<=0)return t.copy(r);K1.subVectors(e,i);const c=Cu.dot(K1),u=Mu.dot(K1);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(Cu,o);Y1.subVectors(e,s);const h=Cu.dot(Y1),p=Mu.dot(Y1);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(Mu,a);const g=c*p-h*u;if(g<=0&&u-c>=0&&h-p>=0)return GF.subVectors(s,i),a=(u-c)/(u-c+(h-p)),t.copy(i).addScaledVector(GF,a);const m=1/(g+d+f);return o=d*m,a=f*m,t.copy(r).addScaledVector(Cu,o).addScaledVector(Mu,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let cZ=0,Li=class extends KA{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:cZ++}),this.uuid=Bo(),this.name="",this.type="Material",this.blending=oh,this.side=As,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=gH,this.blendDst=vH,this.blendEquation=Ju,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=YE,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=Q$,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=U1,this.stencilZFail=U1,this.stencilZPass=U1,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!==oh&&(r.blending=this.blending),this.side!==As&&(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 Mi extends Li{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ke(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=Rx,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 Jn=new Z,m0=new Ye;class lt{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=ZE,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:x0.clone(),object:n}}function _0(n,e,t,r,i,s,o,a,l){n.getVertexPosition(o,Dd),n.getVertexPosition(a,Od),n.getVertexPosition(l,Nd);const A=fZ(n,e,t,r,Dd,Od,Nd,J1);if(A){i&&(v0.fromBufferAttribute(i,o),y0.fromBufferAttribute(i,a),w0.fromBufferAttribute(i,l),A.uv=Ji.getUV(J1,Dd,Od,Nd,v0,y0,w0,new Ye)),s&&(v0.fromBufferAttribute(s,o),y0.fromBufferAttribute(s,a),w0.fromBufferAttribute(s,l),A.uv2=Ji.getUV(J1,Dd,Od,Nd,v0,y0,w0,new Ye));const c={a:o,b:a,c:l,normal:new Z,materialIndex:0};Ji.getNormal(Dd,Od,Nd,c.normal),A.face=c}return A}class hg extends Kt{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,T,b,M){const D=x/T,Y=_/b,H=x/2,I=_/2,v=C/2,B=T+1,F=b+1;let P=0,O=0;const z=new Z;for(let K=0;K0?1:-1,c.push(z.x,z.y,z.z),u.push(E/T),u.push(1-K/b),P+=1}}for(let K=0;K>8&255]+Vr[n>>16&255]+Vr[n>>24&255]+"-"+Vr[e&255]+Vr[e>>8&255]+"-"+Vr[e>>16&15|64]+Vr[e>>24&255]+"-"+Vr[t&63|128]+Vr[t>>8&255]+"-"+Vr[t>>16&255]+Vr[t>>24&255]+Vr[r&255]+Vr[r>>8&255]+Vr[r>>16&255]+Vr[r>>24&255]).toLowerCase()}function dr(n,e,t){return Math.max(e,Math.min(t,n))}function VS(n,e){return(n%e+e)%e}function G$(n,e,t,r,i){return r+(n-e)*(i-r)/(t-e)}function V$(n,e,t){return n!==e?(t-n)/(e-n):0}function em(n,e,t){return(1-t)*n+t*e}function j$(n,e,t,r){return em(n,e,1-Math.exp(-t*r))}function W$(n,e=1){return e-Math.abs(VS(n,e*2)-e)}function K$(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*(3-2*n))}function Y$(n,e,t){return n<=e?0:n>=t?1:(n=(n-e)/(t-e),n*n*n*(n*(n*6-15)+10))}function X$(n,e){return n+Math.floor(Math.random()*(e-n+1))}function $$(n,e){return n+Math.random()*(e-n)}function Z$(n){return n*(.5-Math.random())}function J$(n){n!==void 0&&(PF=n);let e=PF+=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 q$(n){return n*qp}function eZ(n){return n*km}function eC(n){return(n&n-1)===0&&n!==0}function bH(n){return Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}function uw(n){return Math.pow(2,Math.floor(Math.log(n)/Math.LN2))}function tZ(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 rl(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 sn(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:qp,RAD2DEG:km,ceilPowerOfTwo:bH,clamp:dr,damp:j$,degToRad:q$,denormalize:rl,euclideanModulo:VS,floorPowerOfTwo:uw,generateUUID:Bo,inverseLerp:V$,isPowerOfTwo:eC,lerp:em,mapLinear:G$,normalize:sn,pingpong:W$,radToDeg:eZ,randFloat:$$,randFloatSpread:Z$,randInt:X$,seededRandom:J$,setQuaternionFromProperEuler:tZ,smootherstep:Y$,smoothstep:K$});class Ke{constructor(e=0,t=0){Ke.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 xn{constructor(){xn.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],B=i[5],T=i[8];return s[0]=o*d+a*y+l*_,s[3]=o*g+a*w+l*B,s[6]=o*m+a*x+l*T,s[1]=A*d+c*y+u*_,s[4]=A*g+c*w+u*B,s[7]=A*m+c*x+u*T,s[2]=f*d+h*y+p*_,s[5]=f*g+h*w+p*B,s[8]=f*m+h*x+p*T,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(P1.makeScale(e,t)),this}rotate(e){return this.premultiply(P1.makeRotation(-e)),this}translate(e,t){return this.premultiply(P1.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 P1=new xn;function BH(n){for(let e=n.length-1;e>=0;--e)if(n[e]>=65535)return!0;return!1}function Qm(n){return document.createElementNS("http://www.w3.org/1999/xhtml",n)}function Fc(n){return n<.04045?n*.0773993808:Math.pow(n*.9478672986+.0521327014,2.4)}function ey(n){return n<.0031308?n*12.92:1.055*Math.pow(n,.41666)-.055}const D1={[mo]:{[Nm]:Fc},[Nm]:{[mo]:ey}},ri={legacyMode:!0,get workingColorSpace(){return Nm},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(D1[e]&&D1[e][t]!==void 0){const r=D1[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)}},EH={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},cr={r:0,g:0,b:0},ro={h:0,s:0,l:0},l0={h:0,s:0,l:0};function O1(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 A0(n,e){return e.r=n.r,e.g=n.g,e.b=n.b,e}class ke{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=mo){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ri.toWorkingColorSpace(this,t),this}setRGB(e,t,r,i=ri.workingColorSpace){return this.r=e,this.g=t,this.b=r,ri.toWorkingColorSpace(this,i),this}setHSL(e,t,r,i=ri.workingColorSpace){if(e=VS(e,1),t=dr(t,0,1),r=dr(r,0,1),t===0)this.r=this.g=this.b=r;else{const s=r<=.5?r*(1+t):r+t-r*t,o=2*r-s;this.r=O1(o,s,e+1/3),this.g=O1(o,s,e),this.b=O1(o,s,e-1/3)}return ri.toWorkingColorSpace(this,i),this}setStyle(e,t=mo){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,ri.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,ri.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,ri.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,ri.toWorkingColorSpace(this,t),this}return e&&e.length>0?this.setColorName(e,t):this}setColorName(e,t=mo){const r=EH[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=Fc(e.r),this.g=Fc(e.g),this.b=Fc(e.b),this}copyLinearToSRGB(e){return this.r=ey(e.r),this.g=ey(e.g),this.b=ey(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=mo){return ri.fromWorkingColorSpace(A0(this,cr),e),dr(cr.r*255,0,255)<<16^dr(cr.g*255,0,255)<<8^dr(cr.b*255,0,255)<<0}getHexString(e=mo){return("000000"+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ri.workingColorSpace){ri.fromWorkingColorSpace(A0(this,cr),t);const r=cr.r,i=cr.g,s=cr.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{wu===void 0&&(wu=Qm("canvas")),wu.width=e.width,wu.height=e.height;const r=wu.getContext("2d");e instanceof ImageData?r.putImageData(e,0,0):r.drawImage(e,0,0,e.width,e.height),t=wu}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=Qm("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!==wH)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case cs:e.x=e.x-Math.floor(e.x);break;case ui:e.x=e.x<0?0:1;break;case Dm: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 cs:e.y=e.y-Math.floor(e.y);break;case ui:e.y=e.y<0?0:1;break;case Dm: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)}}Hn.DEFAULT_IMAGE=null;Hn.DEFAULT_MAPPING=wH;Hn.DEFAULT_ANISOTROPY=1;class Ht{constructor(e=0,t=0,r=0,i=1){Ht.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,B=(c+f)/4,T=(u+d)/4,b=(p+g)/4;return w>x&&w>_?w<.01?(r=0,i=.707106781,s=.707106781):(r=Math.sqrt(w),i=B/r,s=T/r):x>_?x<.01?(r=.707106781,i=0,s=.707106781):(i=Math.sqrt(x),r=B/i,s=b/i):_<.01?(r=.707106781,i=.707106781,s=0):(s=Math.sqrt(_),r=T/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 da extends KA{constructor(e=1,t=1,r={}){super(),this.isWebGLRenderTarget=!0,this.width=e,this.height=t,this.depth=1,this.scissor=new Ht(0,0,e,t),this.scissorTest=!1,this.viewport=new Ht(0,0,e,t);const i={width:e,height:t,depth:1};this.texture=new Hn(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:li,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 jS(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 Hn{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=Xn,this.minFilter=Xn,this.wrapR=ui,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class rZ extends Hn{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=Xn,this.minFilter=Xn,this.wrapR=ui,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),B=Math.atan2(_,m*y);g=Math.sin(g*B)/_,a=Math.sin(a*B)/_}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(dr(this.dot(e),-1,1)))}rotateTowards(e,t){const r=this.angleTo(e);if(r===0)return this;const i=Math.min(1,t/r);return this.slerp(e,i),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x=this._x*e,this._y=this._y*e,this._z=this._z*e,this._w=this._w*e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){const r=e._x,i=e._y,s=e._z,o=e._w,a=t._x,l=t._y,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(DF.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(DF.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(dr(r,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){const t=this.x-e.x,r=this.y-e.y,i=this.z-e.z;return t*t+r*r+i*i}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,r){const i=Math.sin(t)*e;return this.x=i*Math.sin(r),this.y=Math.cos(t)*e,this.z=i*Math.cos(r),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,r){return this.x=e*Math.sin(t),this.y=r,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){const t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){const t=this.setFromMatrixColumn(e,0).length(),r=this.setFromMatrixColumn(e,1).length(),i=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=r,this.z=i,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}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,DF=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,tc),tc.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(Fd),c0.subVectors(this.max,Fd),xu.subVectors(e.a,Fd),_u.subVectors(e.b,Fd),bu.subVectors(e.c,Fd),Ll.subVectors(_u,xu),Pl.subVectors(bu,_u),nc.subVectors(xu,bu);let t=[0,-Ll.z,Ll.y,0,-Pl.z,Pl.y,0,-nc.z,nc.y,Ll.z,0,-Ll.x,Pl.z,0,-Pl.x,nc.z,0,-nc.x,-Ll.y,Ll.x,0,-Pl.y,Pl.x,0,-nc.y,nc.x,0];return!H1(t,xu,_u,bu,c0)||(t=[1,0,0,0,1,0,0,0,1],!H1(t,xu,_u,bu,c0))?!1:(u0.crossVectors(Ll,Pl),t=[u0.x,u0.y,u0.z],H1(t,xu,_u,bu,c0))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return tc.copy(e).clamp(this.min,this.max).sub(e).length()}getBoundingSphere(e){return this.getCenter(e.center),e.radius=this.getSize(tc).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:(Ma[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Ma[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Ma[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Ma[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Ma[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Ma[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Ma[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Ma[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Ma),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 Ma=[new Z,new Z,new Z,new Z,new Z,new Z,new Z,new Z],tc=new Z,Q1=new ps,xu=new Z,_u=new Z,bu=new Z,Ll=new Z,Pl=new Z,nc=new Z,Fd=new Z,c0=new Z,u0=new Z,rc=new Z;function H1(n,e,t,r,i){for(let s=0,o=n.length-3;s<=o;s+=3){rc.fromArray(n,s);const a=i.x*Math.abs(rc.x)+i.y*Math.abs(rc.y)+i.z*Math.abs(rc.z),l=e.dot(rc),A=t.dot(rc),c=r.dot(rc);if(Math.max(-Math.max(l,A,c),Math.min(l,A,c))>a)return!1}return!0}const iZ=new ps,Ud=new Z,z1=new Z;class ru{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):iZ.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;Ud.subVectors(e,this.center);const t=Ud.lengthSq();if(t>this.radius*this.radius){const r=Math.sqrt(t),i=(r-this.radius)*.5;this.center.addScaledVector(Ud,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):(z1.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Ud.copy(e.center).add(z1)),this.expandByPoint(Ud.copy(e.center).sub(z1))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}}const Sa=new Z,G1=new Z,f0=new Z,Dl=new Z,V1=new Z,h0=new Z,j1=new Z;class fg{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,Sa)),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=Sa.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Sa.copy(this.direction).multiplyScalar(t).add(this.origin),Sa.distanceToSquared(e))}distanceSqToSegment(e,t,r,i){G1.copy(e).add(t).multiplyScalar(.5),f0.copy(t).sub(e).normalize(),Dl.copy(this.origin).sub(G1);const s=e.distanceTo(t)*.5,o=-this.direction.dot(f0),a=Dl.dot(this.direction),l=-Dl.dot(f0),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(f0).multiplyScalar(f).add(G1),h}intersectSphere(e,t){Sa.subVectors(e.center,this.origin);const r=Sa.dot(this.direction),i=Sa.dot(Sa)-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,Sa)!==null}intersectTriangle(e,t,r,i,s){V1.subVectors(t,e),h0.subVectors(r,e),j1.crossVectors(V1,h0);let o=this.direction.dot(j1),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(h0.crossVectors(Dl,h0));if(l<0)return null;const A=a*this.direction.dot(V1.cross(Dl));if(A<0||l+A>o)return null;const c=-a*Dl.dot(j1);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 We{constructor(){We.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 We().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/Bu.setFromMatrixColumn(e,0).length(),s=1/Bu.setFromMatrixColumn(e,1).length(),o=1/Bu.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(sZ,e,oZ)}lookAt(e,t,r){const i=this.elements;return Qi.subVectors(e,t),Qi.lengthSq()===0&&(Qi.z=1),Qi.normalize(),Ol.crossVectors(r,Qi),Ol.lengthSq()===0&&(Math.abs(r.z)===1?Qi.x+=1e-4:Qi.z+=1e-4,Qi.normalize(),Ol.crossVectors(r,Qi)),Ol.normalize(),d0.crossVectors(Qi,Ol),i[0]=Ol.x,i[4]=d0.x,i[8]=Qi.x,i[1]=Ol.y,i[5]=d0.y,i[9]=Qi.y,i[2]=Ol.z,i[6]=d0.z,i[10]=Qi.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],B=i[0],T=i[4],b=i[8],M=i[12],O=i[1],Y=i[5],H=i[9],I=i[13],v=i[2],E=i[6],L=i[10],U=i[14],P=i[3],z=i[7],W=i[11],N=i[15];return s[0]=o*B+a*O+l*v+A*P,s[4]=o*T+a*Y+l*E+A*z,s[8]=o*b+a*H+l*L+A*W,s[12]=o*M+a*I+l*U+A*N,s[1]=c*B+u*O+f*v+h*P,s[5]=c*T+u*Y+f*E+h*z,s[9]=c*b+u*H+f*L+h*W,s[13]=c*M+u*I+f*U+h*N,s[2]=p*B+d*O+g*v+m*P,s[6]=p*T+d*Y+g*E+m*z,s[10]=p*b+d*H+g*L+m*W,s[14]=p*M+d*I+g*U+m*N,s[3]=y*B+w*O+x*v+_*P,s[7]=y*T+w*Y+x*E+_*z,s[11]=y*b+w*H+x*L+_*W,s[15]=y*M+w*I+x*U+_*N,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,B=t*y+r*w+i*x+s*_;if(B===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const T=1/B;return e[0]=y*T,e[1]=(d*f*s-u*g*s-d*i*h+r*g*h+u*i*m-r*f*m)*T,e[2]=(a*g*s-d*l*s+d*i*A-r*g*A-a*i*m+r*l*m)*T,e[3]=(u*l*s-a*f*s-u*i*A+r*f*A+a*i*h-r*l*h)*T,e[4]=w*T,e[5]=(c*g*s-p*f*s+p*i*h-t*g*h-c*i*m+t*f*m)*T,e[6]=(p*l*s-o*g*s-p*i*A+t*g*A+o*i*m-t*l*m)*T,e[7]=(o*f*s-c*l*s+c*i*A-t*f*A-o*i*h+t*l*h)*T,e[8]=x*T,e[9]=(p*u*s-c*d*s-p*r*h+t*d*h+c*r*m-t*u*m)*T,e[10]=(o*d*s-p*a*s+p*r*A-t*d*A-o*r*m+t*a*m)*T,e[11]=(c*a*s-o*u*s-c*r*A+t*u*A+o*r*h-t*a*h)*T,e[12]=_*T,e[13]=(c*d*i-p*u*i+p*r*f-t*d*f-c*r*g+t*u*g)*T,e[14]=(p*a*i-o*d*i-p*r*l+t*d*l+o*r*g-t*a*g)*T,e[15]=(o*u*i-c*a*i+c*r*l-t*u*l-o*r*f+t*a*f)*T,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,B=r.y,T=r.z;return i[0]=(1-(d+m))*_,i[1]=(h+x)*_,i[2]=(p-w)*_,i[3]=0,i[4]=(h-x)*B,i[5]=(1-(f+m))*B,i[6]=(g+y)*B,i[7]=0,i[8]=(p+w)*T,i[9]=(g-y)*T,i[10]=(1-(f+d))*T,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=Bu.set(i[0],i[1],i[2]).length();const o=Bu.set(i[4],i[5],i[6]).length(),a=Bu.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],io.copy(this);const A=1/s,c=1/o,u=1/a;return io.elements[0]*=A,io.elements[1]*=A,io.elements[2]*=A,io.elements[4]*=c,io.elements[5]*=c,io.elements[6]*=c,io.elements[8]*=u,io.elements[9]*=u,io.elements[10]*=u,t.setFromRotationMatrix(io),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 Bu=new Z,io=new We,sZ=new Z(0,0,0),oZ=new Z(1,1,1),Ol=new Z,d0=new Z,Qi=new Z,OF=new We,NF=new rt;class di{constructor(e=0,t=0,r=0,i=di.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(dr(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(-dr(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(dr(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(-dr(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(f,h),this._z=Math.atan2(l,s)):(this._x=0,this._z=Math.atan2(-o,A));break;case"YZX":this._z=Math.asin(dr(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(-dr(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 OF.makeRotationFromQuaternion(e),this.setFromRotationMatrix(OF,t,r)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return NF.setFromEuler(this),this.setFromQuaternion(NF,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}}di.DEFAULT_ORDER="XYZ";class WS{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(Ld,e,lZ),e}getWorldScale(e){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(Ld,AZ,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){so.subVectors(i,t),Ia.subVectors(r,t),W1.subVectors(e,t);const o=so.dot(so),a=so.dot(Ia),l=so.dot(W1),A=Ia.dot(Ia),c=Ia.dot(W1),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,Ra),Ra.x>=0&&Ra.y>=0&&Ra.x+Ra.y<=1}static getUV(e,t,r,i,s,o,a,l){return this.getBarycoord(e,t,r,i,Ra),l.set(0,0),l.addScaledVector(s,Ra.x),l.addScaledVector(o,Ra.y),l.addScaledVector(a,Ra.z),l}static isFrontFacing(e,t,r,i){return so.subVectors(r,t),Ia.subVectors(e,t),so.cross(Ia).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 so.subVectors(this.c,this.b),Ia.subVectors(this.a,this.b),so.cross(Ia).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(e){return Ji.getNormal(this.a,this.b,this.c,e)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(e,t){return Ji.getBarycoord(e,this.a,this.b,this.c,t)}getUV(e,t,r,i,s){return Ji.getUV(e,this.a,this.b,this.c,t,r,i,s)}containsPoint(e){return Ji.containsPoint(e,this.a,this.b,this.c)}isFrontFacing(e){return Ji.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;Cu.subVectors(i,r),Mu.subVectors(s,r),K1.subVectors(e,r);const l=Cu.dot(K1),A=Mu.dot(K1);if(l<=0&&A<=0)return t.copy(r);Y1.subVectors(e,i);const c=Cu.dot(Y1),u=Mu.dot(Y1);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(Cu,o);X1.subVectors(e,s);const h=Cu.dot(X1),p=Mu.dot(X1);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(Mu,a);const g=c*p-h*u;if(g<=0&&u-c>=0&&h-p>=0)return VF.subVectors(s,i),a=(u-c)/(u-c+(h-p)),t.copy(i).addScaledVector(VF,a);const m=1/(g+d+f);return o=d*m,a=f*m,t.copy(r).addScaledVector(Cu,o).addScaledVector(Mu,a)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}}let uZ=0,Li=class extends KA{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:uZ++}),this.uuid=Bo(),this.name="",this.type="Material",this.blending=oh,this.side=As,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.blendSrc=vH,this.blendDst=yH,this.blendEquation=Ju,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.depthFunc=XE,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=H$,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=L1,this.stencilZFail=L1,this.stencilZPass=L1,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!==oh&&(r.blending=this.blending),this.side!==As&&(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 Mi extends Li{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new ke(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=Fx,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 Jn=new Z,m0=new Ke;class lt{constructor(e,t,r=!1){if(Array.isArray(e))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,this.name="",this.array=e,this.itemSize=t,this.count=e!==void 0?e.length/t:0,this.normalized=r,this.usage=JE,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:x0.clone(),object:n}}function _0(n,e,t,r,i,s,o,a,l){n.getVertexPosition(o,Dd),n.getVertexPosition(a,Od),n.getVertexPosition(l,Nd);const A=hZ(n,e,t,r,Dd,Od,Nd,q1);if(A){i&&(v0.fromBufferAttribute(i,o),y0.fromBufferAttribute(i,a),w0.fromBufferAttribute(i,l),A.uv=Ji.getUV(q1,Dd,Od,Nd,v0,y0,w0,new Ke)),s&&(v0.fromBufferAttribute(s,o),y0.fromBufferAttribute(s,a),w0.fromBufferAttribute(s,l),A.uv2=Ji.getUV(q1,Dd,Od,Nd,v0,y0,w0,new Ke));const c={a:o,b:a,c:l,normal:new Z,materialIndex:0};Ji.getNormal(Dd,Od,Nd,c.normal),A.face=c}return A}class hg extends Kt{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,_,B,T,b,M){const O=x/T,Y=_/b,H=x/2,I=_/2,v=B/2,E=T+1,L=b+1;let U=0,P=0;const z=new Z;for(let W=0;W0?1:-1,c.push(z.x,z.y,z.z),u.push(C/T),u.push(1-W/b),U+=1}}for(let W=0;W0&&(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 TH extends It{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new We,this.projectionMatrix=new We,this.projectionMatrixInverse=new We}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 TH{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=km*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(qp*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return km*2*Math.atan(Math.tan(qp*.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(qp*.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 Iu=-90,Ru=1;class mZ extends It{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r;const i=new Br(Iu,Ru,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);const s=new Br(Iu,Ru,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const o=new Br(Iu,Ru,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new Br(Iu,Ru,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const l=new Br(Iu,Ru,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const A=new Br(Iu,Ru,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 IH extends Hn{constructor(e,t,r,i,s,o,a,l,A,c){e=e!==void 0?e:[],t=t!==void 0?t:Fh,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 gZ extends da{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 IH(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:li}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 gr extends Li{constructor(e){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=pZ,this.fragmentShader=mZ,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=Dh(e.uniforms),this.uniformsGroups=dZ(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 IH extends It{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new We,this.projectionMatrix=new We,this.projectionMatrixInverse=new We}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 Er extends IH{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=km*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){const e=Math.tan(qp*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return km*2*Math.atan(Math.tan(qp*.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(qp*.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 Iu=-90,Ru=1;class gZ extends It{constructor(e,t,r){super(),this.type="CubeCamera",this.renderTarget=r;const i=new Er(Iu,Ru,e,t);i.layers=this.layers,i.up.set(0,1,0),i.lookAt(1,0,0),this.add(i);const s=new Er(Iu,Ru,e,t);s.layers=this.layers,s.up.set(0,1,0),s.lookAt(-1,0,0),this.add(s);const o=new Er(Iu,Ru,e,t);o.layers=this.layers,o.up.set(0,0,-1),o.lookAt(0,1,0),this.add(o);const a=new Er(Iu,Ru,e,t);a.layers=this.layers,a.up.set(0,0,1),a.lookAt(0,-1,0),this.add(a);const l=new Er(Iu,Ru,e,t);l.layers=this.layers,l.up.set(0,1,0),l.lookAt(0,0,1),this.add(l);const A=new Er(Iu,Ru,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 RH extends Hn{constructor(e,t,r,i,s,o,a,l,A,c){e=e!==void 0?e:[],t=t!==void 0?t:Fh,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 vZ extends da{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 RH(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:li}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,28 +103,28 @@ Error generating stack: `+s.message+` gl_FragColor = texture2D( tEquirect, sampleUV ); } - `},i=new hg(5,5,5),s=new Mr({name:"CubemapFromEquirect",uniforms:Dh(r.uniforms),vertexShader:r.vertexShader,fragmentShader:r.fragmentShader,side:qr,blending:EA});s.uniforms.tEquirect.value=t;const o=new Cn(i,s),a=t.minFilter;return t.minFilter===PA&&(t.minFilter=li),new mZ(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 q1=new Z,vZ=new Z,yZ=new xn;class $a{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=q1.subVectors(r,t).cross(vZ.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(q1),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||yZ.getNormalMatrix(e),i=this.coplanarPoint(q1).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 Fu=new ru,b0=new Z;class KS{constructor(e=new $a,t=new $a,r=new $a,i=new $a,s=new $a,o=new $a){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(),Fu.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Fu)}intersectsSprite(e){return Fu.center.set(0,0,0),Fu.radius=.7071067811865476,Fu.applyMatrix4(e.matrixWorld),this.intersectsSphere(Fu)}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,b0.y=i.normal.y>0?e.max.y:e.min.y,b0.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(b0)<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 RH(){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 wZ(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||wZ.getNormalMatrix(e),i=this.coplanarPoint(eb).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 Fu=new ru,b0=new Z;class YS{constructor(e=new $a,t=new $a,r=new $a,i=new $a,s=new $a,o=new $a){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(),Fu.copy(t.boundingSphere).applyMatrix4(e.matrixWorld),this.intersectsSphere(Fu)}intersectsSprite(e){return Fu.center.set(0,0,0),Fu.radius=.7071067811865476,Fu.applyMatrix4(e.matrixWorld),this.intersectsSphere(Fu)}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,b0.y=i.normal.y>0?e.max.y:e.min.y,b0.z=i.normal.z>0?e.max.z:e.min.z,i.distanceToPoint(b0)<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 FH(){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 xZ(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 0 +#endif`,UZ=`#if NUM_CLIPPING_PLANES > 0 vec4 plane; #pragma unroll_loop_start for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { @@ -364,26 +364,26 @@ vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 no #pragma unroll_loop_end if ( clipped ) discard; #endif -#endif`,UZ=`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,LZ=`#if NUM_CLIPPING_PLANES > 0 varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; #endif`,PZ=`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,DZ=`#if NUM_CLIPPING_PLANES > 0 vClipPosition = - mvPosition.xyz; -#endif`,DZ=`#if defined( USE_COLOR_ALPHA ) +#endif`,OZ=`#if defined( USE_COLOR_ALPHA ) diffuseColor *= vColor; #elif defined( USE_COLOR ) diffuseColor.rgb *= vColor; -#endif`,OZ=`#if defined( USE_COLOR_ALPHA ) +#endif`,NZ=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) varying vec3 vColor; -#endif`,NZ=`#if defined( USE_COLOR_ALPHA ) +#endif`,kZ=`#if defined( USE_COLOR_ALPHA ) varying vec4 vColor; #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) varying vec3 vColor; -#endif`,kZ=`#if defined( USE_COLOR_ALPHA ) +#endif`,QZ=`#if defined( USE_COLOR_ALPHA ) vColor = vec4( 1.0 ); #elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) vColor = vec3( 1.0 ); @@ -393,7 +393,7 @@ vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 no #endif #ifdef USE_INSTANCING_COLOR vColor.xyz *= instanceColor.xyz; -#endif`,QZ=`#define PI 3.141592653589793 +#endif`,HZ=`#define PI 3.141592653589793 #define PI2 6.283185307179586 #define PI_HALF 1.5707963267948966 #define RECIPROCAL_PI 0.3183098861837907 @@ -465,7 +465,7 @@ vec2 equirectUv( in vec3 dir ) { float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; return vec2( u, v ); -}`,HZ=`#ifdef ENVMAP_TYPE_CUBE_UV +}`,zZ=`#ifdef ENVMAP_TYPE_CUBE_UV #define cubeUV_minMipLevel 4.0 #define cubeUV_minTileSize 16.0 float getFace( vec3 direction ) { @@ -563,7 +563,7 @@ vec2 equirectUv( in vec3 dir ) { return vec4( mix( color0, color1, mipF ), 1.0 ); } } -#endif`,zZ=`vec3 transformedNormal = objectNormal; +#endif`,GZ=`vec3 transformedNormal = objectNormal; #ifdef USE_INSTANCING mat3 m = mat3( instanceMatrix ); transformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) ); @@ -578,23 +578,23 @@ transformedNormal = normalMatrix * transformedNormal; #ifdef FLIP_SIDED transformedTangent = - transformedTangent; #endif -#endif`,GZ=`#ifdef USE_DISPLACEMENTMAP +#endif`,VZ=`#ifdef USE_DISPLACEMENTMAP uniform sampler2D displacementMap; uniform float displacementScale; uniform float displacementBias; -#endif`,VZ=`#ifdef USE_DISPLACEMENTMAP +#endif`,jZ=`#ifdef USE_DISPLACEMENTMAP transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vUv ).x * displacementScale + displacementBias ); -#endif`,jZ=`#ifdef USE_EMISSIVEMAP +#endif`,WZ=`#ifdef USE_EMISSIVEMAP vec4 emissiveColor = texture2D( emissiveMap, vUv ); totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,WZ=`#ifdef USE_EMISSIVEMAP +#endif`,KZ=`#ifdef USE_EMISSIVEMAP uniform sampler2D emissiveMap; -#endif`,KZ="gl_FragColor = linearToOutputTexel( gl_FragColor );",YZ=`vec4 LinearToLinear( in vec4 value ) { +#endif`,YZ="gl_FragColor = linearToOutputTexel( gl_FragColor );",XZ=`vec4 LinearToLinear( in vec4 value ) { return value; } vec4 LinearTosRGB( in vec4 value ) { return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`,XZ=`#ifdef USE_ENVMAP +}`,$Z=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vec3 cameraToFrag; if ( isOrthographic ) { @@ -623,7 +623,7 @@ vec4 LinearTosRGB( in vec4 value ) { #elif defined( ENVMAP_BLENDING_ADD ) outgoingLight += envColor.xyz * specularStrength * reflectivity; #endif -#endif`,$Z=`#ifdef USE_ENVMAP +#endif`,ZZ=`#ifdef USE_ENVMAP uniform float envMapIntensity; uniform float flipEnvMap; #ifdef ENVMAP_TYPE_CUBE @@ -632,7 +632,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform sampler2D envMap; #endif -#endif`,ZZ=`#ifdef USE_ENVMAP +#endif`,JZ=`#ifdef USE_ENVMAP uniform float reflectivity; #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS @@ -643,7 +643,7 @@ vec4 LinearTosRGB( in vec4 value ) { #else varying vec3 vReflect; #endif -#endif`,JZ=`#ifdef USE_ENVMAP +#endif`,qZ=`#ifdef USE_ENVMAP #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) #define ENV_WORLDPOS #endif @@ -654,7 +654,7 @@ vec4 LinearTosRGB( in vec4 value ) { varying vec3 vReflect; uniform float refractionRatio; #endif -#endif`,qZ=`#ifdef USE_ENVMAP +#endif`,eJ=`#ifdef USE_ENVMAP #ifdef ENV_WORLDPOS vWorldPosition = worldPosition.xyz; #else @@ -671,18 +671,18 @@ vec4 LinearTosRGB( in vec4 value ) { vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); #endif #endif -#endif`,eJ=`#ifdef USE_FOG - vFogDepth = - mvPosition.z; #endif`,tJ=`#ifdef USE_FOG - varying float vFogDepth; + vFogDepth = - mvPosition.z; #endif`,nJ=`#ifdef USE_FOG + varying float vFogDepth; +#endif`,rJ=`#ifdef USE_FOG #ifdef FOG_EXP2 float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); #else float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); #endif gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,rJ=`#ifdef USE_FOG +#endif`,iJ=`#ifdef USE_FOG uniform vec3 fogColor; varying float vFogDepth; #ifdef FOG_EXP2 @@ -691,7 +691,7 @@ vec4 LinearTosRGB( in vec4 value ) { uniform float fogNear; uniform float fogFar; #endif -#endif`,iJ=`#ifdef USE_GRADIENTMAP +#endif`,sJ=`#ifdef USE_GRADIENTMAP uniform sampler2D gradientMap; #endif vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { @@ -703,16 +703,16 @@ vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { vec2 fw = fwidth( coord ) * 0.5; return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); #endif -}`,sJ=`#ifdef USE_LIGHTMAP +}`,oJ=`#ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vUv2 ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; reflectedLight.indirectDiffuse += lightMapIrradiance; -#endif`,oJ=`#ifdef USE_LIGHTMAP +#endif`,aJ=`#ifdef USE_LIGHTMAP uniform sampler2D lightMap; uniform float lightMapIntensity; -#endif`,aJ=`LambertMaterial material; +#endif`,lJ=`LambertMaterial material; material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,lJ=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,AJ=`varying vec3 vViewPosition; struct LambertMaterial { vec3 diffuseColor; float specularStrength; @@ -726,7 +726,7 @@ void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricCon reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,AJ=`uniform bool receiveShadow; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,cJ=`uniform bool receiveShadow; uniform vec3 ambientLightColor; uniform vec3 lightProbe[ 9 ]; vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { @@ -847,7 +847,7 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); return irradiance; } -#endif`,cJ=`#if defined( USE_ENVMAP ) +#endif`,uJ=`#if defined( USE_ENVMAP ) vec3 getIBLIrradiance( const in vec3 normal ) { #if defined( ENVMAP_TYPE_CUBE_UV ) vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); @@ -868,8 +868,8 @@ float getSpotAttenuation( const in float coneCosine, const in float penumbraCosi return vec3( 0.0 ); #endif } -#endif`,uJ=`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,fJ=`varying vec3 vViewPosition; +#endif`,fJ=`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,hJ=`varying vec3 vViewPosition; struct ToonMaterial { vec3 diffuseColor; }; @@ -881,11 +881,11 @@ void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContex reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,hJ=`BlinnPhongMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,dJ=`BlinnPhongMaterial material; material.diffuseColor = diffuseColor.rgb; material.specularColor = specular; material.specularShininess = shininess; -material.specularStrength = specularStrength;`,dJ=`varying vec3 vViewPosition; +material.specularStrength = specularStrength;`,pJ=`varying vec3 vViewPosition; struct BlinnPhongMaterial { vec3 diffuseColor; vec3 specularColor; @@ -902,7 +902,7 @@ void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in Geometric reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); } #define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,pJ=`PhysicalMaterial material; +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,mJ=`PhysicalMaterial material; material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) ); float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); @@ -966,7 +966,7 @@ material.roughness = min( material.roughness, 1.0 ); #ifdef USE_SHEENROUGHNESSMAP material.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a; #endif -#endif`,mJ=`struct PhysicalMaterial { +#endif`,gJ=`struct PhysicalMaterial { vec3 diffuseColor; float roughness; vec3 specularColor; @@ -1115,7 +1115,7 @@ void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradia #define RE_IndirectSpecular RE_IndirectSpecular_Physical float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,gJ=` +}`,vJ=` GeometricContext geometry; geometry.position = - vViewPosition; geometry.normal = normal; @@ -1228,7 +1228,7 @@ IncidentLight directLight; #if defined( RE_IndirectSpecular ) vec3 radiance = vec3( 0.0 ); vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,vJ=`#if defined( RE_IndirectDiffuse ) +#endif`,yJ=`#if defined( RE_IndirectDiffuse ) #ifdef USE_LIGHTMAP vec4 lightMapTexel = texture2D( lightMap, vUv2 ); vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; @@ -1243,25 +1243,25 @@ IncidentLight directLight; #ifdef USE_CLEARCOAT clearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness ); #endif -#endif`,yJ=`#if defined( RE_IndirectDiffuse ) +#endif`,wJ=`#if defined( RE_IndirectDiffuse ) RE_IndirectDiffuse( irradiance, geometry, material, reflectedLight ); #endif #if defined( RE_IndirectSpecular ) RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight ); -#endif`,wJ=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) - gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; #endif`,xJ=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) + gl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,_J=`#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT ) uniform float logDepthBufFC; varying float vFragDepth; varying float vIsPerspective; -#endif`,_J=`#ifdef USE_LOGDEPTHBUF +#endif`,bJ=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT varying float vFragDepth; varying float vIsPerspective; #else uniform float logDepthBufFC; #endif -#endif`,bJ=`#ifdef USE_LOGDEPTHBUF +#endif`,BJ=`#ifdef USE_LOGDEPTHBUF #ifdef USE_LOGDEPTHBUF_EXT vFragDepth = 1.0 + gl_Position.w; vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); @@ -1271,15 +1271,15 @@ IncidentLight directLight; gl_Position.z *= gl_Position.w; } #endif -#endif`,BJ=`#ifdef USE_MAP +#endif`,EJ=`#ifdef USE_MAP vec4 sampledDiffuseColor = texture2D( map, vUv ); #ifdef DECODE_VIDEO_TEXTURE sampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w ); #endif diffuseColor *= sampledDiffuseColor; -#endif`,EJ=`#ifdef USE_MAP +#endif`,CJ=`#ifdef USE_MAP uniform sampler2D map; -#endif`,CJ=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,MJ=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; #endif #ifdef USE_MAP @@ -1287,7 +1287,7 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,MJ=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) +#endif`,SJ=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) uniform mat3 uvTransform; #endif #ifdef USE_MAP @@ -1295,13 +1295,13 @@ IncidentLight directLight; #endif #ifdef USE_ALPHAMAP uniform sampler2D alphaMap; -#endif`,SJ=`float metalnessFactor = metalness; +#endif`,TJ=`float metalnessFactor = metalness; #ifdef USE_METALNESSMAP vec4 texelMetalness = texture2D( metalnessMap, vUv ); metalnessFactor *= texelMetalness.b; -#endif`,TJ=`#ifdef USE_METALNESSMAP +#endif`,IJ=`#ifdef USE_METALNESSMAP uniform sampler2D metalnessMap; -#endif`,IJ=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) +#endif`,RJ=`#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE ) vColor *= morphTargetBaseInfluence; for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { #if defined( USE_COLOR_ALPHA ) @@ -1310,7 +1310,7 @@ IncidentLight directLight; if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; #endif } -#endif`,RJ=`#ifdef USE_MORPHNORMALS +#endif`,FJ=`#ifdef USE_MORPHNORMALS objectNormal *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1322,7 +1322,7 @@ IncidentLight directLight; objectNormal += morphNormal2 * morphTargetInfluences[ 2 ]; objectNormal += morphNormal3 * morphTargetInfluences[ 3 ]; #endif -#endif`,FJ=`#ifdef USE_MORPHTARGETS +#endif`,UJ=`#ifdef USE_MORPHTARGETS uniform float morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; @@ -1342,7 +1342,7 @@ IncidentLight directLight; uniform float morphTargetInfluences[ 4 ]; #endif #endif -#endif`,UJ=`#ifdef USE_MORPHTARGETS +#endif`,LJ=`#ifdef USE_MORPHTARGETS transformed *= morphTargetBaseInfluence; #ifdef MORPHTARGETS_TEXTURE for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { @@ -1360,7 +1360,7 @@ IncidentLight directLight; transformed += morphTarget7 * morphTargetInfluences[ 7 ]; #endif #endif -#endif`,LJ=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#endif`,PJ=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; #ifdef FLAT_SHADED vec3 fdx = dFdx( vViewPosition ); vec3 fdy = dFdy( vViewPosition ); @@ -1382,7 +1382,7 @@ IncidentLight directLight; #endif #endif #endif -vec3 geometryNormal = normal;`,PJ=`#ifdef OBJECTSPACE_NORMALMAP +vec3 geometryNormal = normal;`,DJ=`#ifdef OBJECTSPACE_NORMALMAP normal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0; #ifdef FLIP_SIDED normal = - normal; @@ -1401,25 +1401,25 @@ vec3 geometryNormal = normal;`,PJ=`#ifdef OBJECTSPACE_NORMALMAP #endif #elif defined( USE_BUMPMAP ) normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,DJ=`#ifndef FLAT_SHADED +#endif`,OJ=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,OJ=`#ifndef FLAT_SHADED +#endif`,NJ=`#ifndef FLAT_SHADED varying vec3 vNormal; #ifdef USE_TANGENT varying vec3 vTangent; varying vec3 vBitangent; #endif -#endif`,NJ=`#ifndef FLAT_SHADED +#endif`,kJ=`#ifndef FLAT_SHADED vNormal = normalize( transformedNormal ); #ifdef USE_TANGENT vTangent = normalize( transformedTangent ); vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); #endif -#endif`,kJ=`#ifdef USE_NORMALMAP +#endif`,QJ=`#ifdef USE_NORMALMAP uniform sampler2D normalMap; uniform vec2 normalScale; #endif @@ -1441,9 +1441,9 @@ vec3 geometryNormal = normal;`,PJ=`#ifdef OBJECTSPACE_NORMALMAP float scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det ); return normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z ); } -#endif`,QJ=`#ifdef USE_CLEARCOAT +#endif`,HJ=`#ifdef USE_CLEARCOAT vec3 clearcoatNormal = geometryNormal; -#endif`,HJ=`#ifdef USE_CLEARCOAT_NORMALMAP +#endif`,zJ=`#ifdef USE_CLEARCOAT_NORMALMAP vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vUv ).xyz * 2.0 - 1.0; clearcoatMapN.xy *= clearcoatNormalScale; #ifdef USE_TANGENT @@ -1451,7 +1451,7 @@ vec3 geometryNormal = normal;`,PJ=`#ifdef OBJECTSPACE_NORMALMAP #else clearcoatNormal = perturbNormal2Arb( - vViewPosition, clearcoatNormal, clearcoatMapN, faceDirection ); #endif -#endif`,zJ=`#ifdef USE_CLEARCOATMAP +#endif`,GJ=`#ifdef USE_CLEARCOATMAP uniform sampler2D clearcoatMap; #endif #ifdef USE_CLEARCOAT_ROUGHNESSMAP @@ -1460,18 +1460,18 @@ vec3 geometryNormal = normal;`,PJ=`#ifdef OBJECTSPACE_NORMALMAP #ifdef USE_CLEARCOAT_NORMALMAP uniform sampler2D clearcoatNormalMap; uniform vec2 clearcoatNormalScale; -#endif`,GJ=`#ifdef USE_IRIDESCENCEMAP +#endif`,VJ=`#ifdef USE_IRIDESCENCEMAP uniform sampler2D iridescenceMap; #endif #ifdef USE_IRIDESCENCE_THICKNESSMAP uniform sampler2D iridescenceThicknessMap; -#endif`,VJ=`#ifdef OPAQUE +#endif`,jJ=`#ifdef OPAQUE diffuseColor.a = 1.0; #endif #ifdef USE_TRANSMISSION diffuseColor.a *= material.transmissionAlpha + 0.1; #endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,jJ=`vec3 packNormalToRGB( const in vec3 normal ) { +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,WJ=`vec3 packNormalToRGB( const in vec3 normal ) { return normalize( normal ) * 0.5 + 0.5; } vec3 unpackRGBToNormal( const in vec3 rgb ) { @@ -1512,29 +1512,29 @@ float viewZToPerspectiveDepth( const in float viewZ, const in float near, const } float perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) { return ( near * far ) / ( ( far - near ) * invClipZ - far ); -}`,WJ=`#ifdef PREMULTIPLIED_ALPHA +}`,KJ=`#ifdef PREMULTIPLIED_ALPHA gl_FragColor.rgb *= gl_FragColor.a; -#endif`,KJ=`vec4 mvPosition = vec4( transformed, 1.0 ); +#endif`,YJ=`vec4 mvPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING mvPosition = instanceMatrix * mvPosition; #endif mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,YJ=`#ifdef DITHERING +gl_Position = projectionMatrix * mvPosition;`,XJ=`#ifdef DITHERING gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,XJ=`#ifdef DITHERING +#endif`,$J=`#ifdef DITHERING vec3 dithering( vec3 color ) { float grid_position = rand( gl_FragCoord.xy ); vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); return color + dither_shift_RGB; } -#endif`,$J=`float roughnessFactor = roughness; +#endif`,ZJ=`float roughnessFactor = roughness; #ifdef USE_ROUGHNESSMAP vec4 texelRoughness = texture2D( roughnessMap, vUv ); roughnessFactor *= texelRoughness.g; -#endif`,ZJ=`#ifdef USE_ROUGHNESSMAP +#endif`,JJ=`#ifdef USE_ROUGHNESSMAP uniform sampler2D roughnessMap; -#endif`,JJ=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,qJ=`#if NUM_SPOT_LIGHT_COORDS > 0 varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif #if NUM_SPOT_LIGHT_MAPS > 0 @@ -1711,7 +1711,7 @@ gl_Position = projectionMatrix * mvPosition;`,YJ=`#ifdef DITHERING return texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); #endif } -#endif`,qJ=`#if NUM_SPOT_LIGHT_COORDS > 0 +#endif`,eq=`#if NUM_SPOT_LIGHT_COORDS > 0 uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; #endif @@ -1749,7 +1749,7 @@ gl_Position = projectionMatrix * mvPosition;`,YJ=`#ifdef DITHERING }; uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; #endif -#endif`,eq=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) +#endif`,tq=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); vec4 shadowWorldPosition; #endif @@ -1781,7 +1781,7 @@ gl_Position = projectionMatrix * mvPosition;`,YJ=`#ifdef DITHERING vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; } #pragma unroll_loop_end -#endif`,tq=`float getShadowMask() { +#endif`,nq=`float getShadowMask() { float shadow = 1.0; #ifdef USE_SHADOWMAP #if NUM_DIR_LIGHT_SHADOWS > 0 @@ -1813,12 +1813,12 @@ gl_Position = projectionMatrix * mvPosition;`,YJ=`#ifdef DITHERING #endif #endif return shadow; -}`,nq=`#ifdef USE_SKINNING +}`,rq=`#ifdef USE_SKINNING mat4 boneMatX = getBoneMatrix( skinIndex.x ); mat4 boneMatY = getBoneMatrix( skinIndex.y ); mat4 boneMatZ = getBoneMatrix( skinIndex.z ); mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,rq=`#ifdef USE_SKINNING +#endif`,iq=`#ifdef USE_SKINNING uniform mat4 bindMatrix; uniform mat4 bindMatrixInverse; uniform highp sampler2D boneTexture; @@ -1837,7 +1837,7 @@ gl_Position = projectionMatrix * mvPosition;`,YJ=`#ifdef DITHERING mat4 bone = mat4( v1, v2, v3, v4 ); return bone; } -#endif`,iq=`#ifdef USE_SKINNING +#endif`,sq=`#ifdef USE_SKINNING vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); vec4 skinned = vec4( 0.0 ); skinned += boneMatX * skinVertex * skinWeight.x; @@ -1845,7 +1845,7 @@ gl_Position = projectionMatrix * mvPosition;`,YJ=`#ifdef DITHERING skinned += boneMatZ * skinVertex * skinWeight.z; skinned += boneMatW * skinVertex * skinWeight.w; transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,sq=`#ifdef USE_SKINNING +#endif`,oq=`#ifdef USE_SKINNING mat4 skinMatrix = mat4( 0.0 ); skinMatrix += skinWeight.x * boneMatX; skinMatrix += skinWeight.y * boneMatY; @@ -1856,17 +1856,17 @@ gl_Position = projectionMatrix * mvPosition;`,YJ=`#ifdef DITHERING #ifdef USE_TANGENT objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; #endif -#endif`,oq=`float specularStrength; +#endif`,aq=`float specularStrength; #ifdef USE_SPECULARMAP vec4 texelSpecular = texture2D( specularMap, vUv ); specularStrength = texelSpecular.r; #else specularStrength = 1.0; -#endif`,aq=`#ifdef USE_SPECULARMAP +#endif`,lq=`#ifdef USE_SPECULARMAP uniform sampler2D specularMap; -#endif`,lq=`#if defined( TONE_MAPPING ) +#endif`,Aq=`#if defined( TONE_MAPPING ) gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,Aq=`#ifndef saturate +#endif`,cq=`#ifndef saturate #define saturate( a ) clamp( a, 0.0, 1.0 ) #endif uniform float toneMappingExposure; @@ -1902,7 +1902,7 @@ vec3 ACESFilmicToneMapping( vec3 color ) { color = ACESOutputMat * color; return saturate( color ); } -vec3 CustomToneMapping( vec3 color ) { return color; }`,cq=`#ifdef USE_TRANSMISSION +vec3 CustomToneMapping( vec3 color ) { return color; }`,uq=`#ifdef USE_TRANSMISSION material.transmission = transmission; material.transmissionAlpha = 1.0; material.thickness = thickness; @@ -1923,7 +1923,7 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,cq=`#ifdef USE_TRANSMISS material.attenuationColor, material.attenuationDistance ); material.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission ); totalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission ); -#endif`,uq=`#ifdef USE_TRANSMISSION +#endif`,fq=`#ifdef USE_TRANSMISSION uniform float transmission; uniform float thickness; uniform float attenuationDistance; @@ -1981,37 +1981,37 @@ vec3 CustomToneMapping( vec3 color ) { return color; }`,cq=`#ifdef USE_TRANSMISS vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); return vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a ); } -#endif`,fq=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) +#endif`,hq=`#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) ) varying vec2 vUv; -#endif`,hq=`#ifdef USE_UV +#endif`,dq=`#ifdef USE_UV #ifdef UVS_VERTEX_ONLY vec2 vUv; #else varying vec2 vUv; #endif uniform mat3 uvTransform; -#endif`,dq=`#ifdef USE_UV +#endif`,pq=`#ifdef USE_UV vUv = ( uvTransform * vec3( uv, 1 ) ).xy; -#endif`,pq=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) - varying vec2 vUv2; #endif`,mq=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) + varying vec2 vUv2; +#endif`,gq=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) attribute vec2 uv2; varying vec2 vUv2; uniform mat3 uv2Transform; -#endif`,gq=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) +#endif`,vq=`#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP ) vUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy; -#endif`,vq=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 +#endif`,yq=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 vec4 worldPosition = vec4( transformed, 1.0 ); #ifdef USE_INSTANCING worldPosition = instanceMatrix * worldPosition; #endif worldPosition = modelMatrix * worldPosition; -#endif`;const yq=`varying vec2 vUv; +#endif`;const wq=`varying vec2 vUv; uniform mat3 uvTransform; void main() { vUv = ( uvTransform * vec3( uv, 1 ) ).xy; gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,wq=`uniform sampler2D t2D; +}`,xq=`uniform sampler2D t2D; uniform float backgroundIntensity; varying vec2 vUv; void main() { @@ -2023,14 +2023,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,xq=`varying vec3 vWorldDirection; +}`,_q=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,_q=`#ifdef ENVMAP_TYPE_CUBE +}`,bq=`#ifdef ENVMAP_TYPE_CUBE uniform samplerCube envMap; #elif defined( ENVMAP_TYPE_CUBE_UV ) uniform sampler2D envMap; @@ -2052,14 +2052,14 @@ void main() { gl_FragColor = texColor; #include #include -}`,bq=`varying vec3 vWorldDirection; +}`,Bq=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include gl_Position.z = gl_Position.w; -}`,Bq=`uniform samplerCube tCube; +}`,Eq=`uniform samplerCube tCube; uniform float tFlip; uniform float opacity; varying vec3 vWorldDirection; @@ -2069,7 +2069,7 @@ void main() { gl_FragColor.a *= opacity; #include #include -}`,Eq=`#include +}`,Cq=`#include #include #include #include @@ -2093,7 +2093,7 @@ void main() { #include #include vHighPrecisionZW = gl_Position.zw; -}`,Cq=`#if DEPTH_PACKING == 3200 +}`,Mq=`#if DEPTH_PACKING == 3200 uniform float opacity; #endif #include @@ -2121,7 +2121,7 @@ void main() { #elif DEPTH_PACKING == 3201 gl_FragColor = packDepthToRGBA( fragCoordZ ); #endif -}`,Mq=`#define DISTANCE +}`,Sq=`#define DISTANCE varying vec3 vWorldPosition; #include #include @@ -2145,7 +2145,7 @@ void main() { #include #include vWorldPosition = worldPosition.xyz; -}`,Sq=`#define DISTANCE +}`,Tq=`#define DISTANCE uniform vec3 referencePosition; uniform float nearDistance; uniform float farDistance; @@ -2167,13 +2167,13 @@ void main () { dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); dist = saturate( dist ); gl_FragColor = packDepthToRGBA( dist ); -}`,Tq=`varying vec3 vWorldDirection; +}`,Iq=`varying vec3 vWorldDirection; #include void main() { vWorldDirection = transformDirection( position, modelMatrix ); #include #include -}`,Iq=`uniform sampler2D tEquirect; +}`,Rq=`uniform sampler2D tEquirect; varying vec3 vWorldDirection; #include void main() { @@ -2182,7 +2182,7 @@ void main() { gl_FragColor = texture2D( tEquirect, sampleUV ); #include #include -}`,Rq=`uniform float scale; +}`,Fq=`uniform float scale; attribute float lineDistance; varying float vLineDistance; #include @@ -2201,7 +2201,7 @@ void main() { #include #include #include -}`,Fq=`uniform vec3 diffuse; +}`,Uq=`uniform vec3 diffuse; uniform float opacity; uniform float dashSize; uniform float totalSize; @@ -2226,7 +2226,7 @@ void main() { #include #include #include -}`,Uq=`#include +}`,Lq=`#include #include #include #include @@ -2257,7 +2257,7 @@ void main() { #include #include #include -}`,Lq=`uniform vec3 diffuse; +}`,Pq=`uniform vec3 diffuse; uniform float opacity; #ifndef FLAT_SHADED varying vec3 vNormal; @@ -2304,7 +2304,7 @@ void main() { #include #include #include -}`,Pq=`#define LAMBERT +}`,Dq=`#define LAMBERT varying vec3 vViewPosition; #include #include @@ -2342,7 +2342,7 @@ void main() { #include #include #include -}`,Dq=`#define LAMBERT +}`,Oq=`#define LAMBERT uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -2398,7 +2398,7 @@ void main() { #include #include #include -}`,Oq=`#define MATCAP +}`,Nq=`#define MATCAP varying vec3 vViewPosition; #include #include @@ -2429,7 +2429,7 @@ void main() { #include #include vViewPosition = - mvPosition.xyz; -}`,Nq=`#define MATCAP +}`,kq=`#define MATCAP uniform vec3 diffuse; uniform float opacity; uniform sampler2D matcap; @@ -2473,7 +2473,7 @@ void main() { #include #include #include -}`,kq=`#define NORMAL +}`,Qq=`#define NORMAL #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) varying vec3 vViewPosition; #endif @@ -2503,7 +2503,7 @@ void main() { #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) vViewPosition = - mvPosition.xyz; #endif -}`,Qq=`#define NORMAL +}`,Hq=`#define NORMAL uniform float opacity; #if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP ) varying vec3 vViewPosition; @@ -2524,7 +2524,7 @@ void main() { #ifdef OPAQUE gl_FragColor.a = 1.0; #endif -}`,Hq=`#define PHONG +}`,zq=`#define PHONG varying vec3 vViewPosition; #include #include @@ -2562,7 +2562,7 @@ void main() { #include #include #include -}`,zq=`#define PHONG +}`,Gq=`#define PHONG uniform vec3 diffuse; uniform vec3 emissive; uniform vec3 specular; @@ -2620,7 +2620,7 @@ void main() { #include #include #include -}`,Gq=`#define STANDARD +}`,Vq=`#define STANDARD varying vec3 vViewPosition; #ifdef USE_TRANSMISSION varying vec3 vWorldPosition; @@ -2662,7 +2662,7 @@ void main() { #ifdef USE_TRANSMISSION vWorldPosition = worldPosition.xyz; #endif -}`,Vq=`#define STANDARD +}`,jq=`#define STANDARD #ifdef PHYSICAL #define IOR #define SPECULAR @@ -2778,7 +2778,7 @@ void main() { #include #include #include -}`,jq=`#define TOON +}`,Wq=`#define TOON varying vec3 vViewPosition; #include #include @@ -2814,7 +2814,7 @@ void main() { #include #include #include -}`,Wq=`#define TOON +}`,Kq=`#define TOON uniform vec3 diffuse; uniform vec3 emissive; uniform float opacity; @@ -2866,7 +2866,7 @@ void main() { #include #include #include -}`,Kq=`uniform float size; +}`,Yq=`uniform float size; uniform float scale; #include #include @@ -2889,7 +2889,7 @@ void main() { #include #include #include -}`,Yq=`uniform vec3 diffuse; +}`,Xq=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -2912,7 +2912,7 @@ void main() { #include #include #include -}`,Xq=`#include +}`,$q=`#include #include #include #include @@ -2930,7 +2930,7 @@ void main() { #include #include #include -}`,$q=`uniform vec3 color; +}`,Zq=`uniform vec3 color; uniform float opacity; #include #include @@ -2944,7 +2944,7 @@ void main() { #include #include #include -}`,Zq=`uniform float rotation; +}`,Jq=`uniform float rotation; uniform vec2 center; #include #include @@ -2970,7 +2970,7 @@ void main() { #include #include #include -}`,Jq=`uniform vec3 diffuse; +}`,qq=`uniform vec3 diffuse; uniform float opacity; #include #include @@ -2993,7 +2993,7 @@ void main() { #include #include #include -}`,xt={alphamap_fragment:xZ,alphamap_pars_fragment:_Z,alphatest_fragment:bZ,alphatest_pars_fragment:BZ,aomap_fragment:EZ,aomap_pars_fragment:CZ,begin_vertex:MZ,beginnormal_vertex:SZ,bsdfs:TZ,iridescence_fragment:IZ,bumpmap_pars_fragment:RZ,clipping_planes_fragment:FZ,clipping_planes_pars_fragment:UZ,clipping_planes_pars_vertex:LZ,clipping_planes_vertex:PZ,color_fragment:DZ,color_pars_fragment:OZ,color_pars_vertex:NZ,color_vertex:kZ,common:QZ,cube_uv_reflection_fragment:HZ,defaultnormal_vertex:zZ,displacementmap_pars_vertex:GZ,displacementmap_vertex:VZ,emissivemap_fragment:jZ,emissivemap_pars_fragment:WZ,encodings_fragment:KZ,encodings_pars_fragment:YZ,envmap_fragment:XZ,envmap_common_pars_fragment:$Z,envmap_pars_fragment:ZZ,envmap_pars_vertex:JZ,envmap_physical_pars_fragment:cJ,envmap_vertex:qZ,fog_vertex:eJ,fog_pars_vertex:tJ,fog_fragment:nJ,fog_pars_fragment:rJ,gradientmap_pars_fragment:iJ,lightmap_fragment:sJ,lightmap_pars_fragment:oJ,lights_lambert_fragment:aJ,lights_lambert_pars_fragment:lJ,lights_pars_begin:AJ,lights_toon_fragment:uJ,lights_toon_pars_fragment:fJ,lights_phong_fragment:hJ,lights_phong_pars_fragment:dJ,lights_physical_fragment:pJ,lights_physical_pars_fragment:mJ,lights_fragment_begin:gJ,lights_fragment_maps:vJ,lights_fragment_end:yJ,logdepthbuf_fragment:wJ,logdepthbuf_pars_fragment:xJ,logdepthbuf_pars_vertex:_J,logdepthbuf_vertex:bJ,map_fragment:BJ,map_pars_fragment:EJ,map_particle_fragment:CJ,map_particle_pars_fragment:MJ,metalnessmap_fragment:SJ,metalnessmap_pars_fragment:TJ,morphcolor_vertex:IJ,morphnormal_vertex:RJ,morphtarget_pars_vertex:FJ,morphtarget_vertex:UJ,normal_fragment_begin:LJ,normal_fragment_maps:PJ,normal_pars_fragment:DJ,normal_pars_vertex:OJ,normal_vertex:NJ,normalmap_pars_fragment:kJ,clearcoat_normal_fragment_begin:QJ,clearcoat_normal_fragment_maps:HJ,clearcoat_pars_fragment:zJ,iridescence_pars_fragment:GJ,output_fragment:VJ,packing:jJ,premultiplied_alpha_fragment:WJ,project_vertex:KJ,dithering_fragment:YJ,dithering_pars_fragment:XJ,roughnessmap_fragment:$J,roughnessmap_pars_fragment:ZJ,shadowmap_pars_fragment:JJ,shadowmap_pars_vertex:qJ,shadowmap_vertex:eq,shadowmask_pars_fragment:tq,skinbase_vertex:nq,skinning_pars_vertex:rq,skinning_vertex:iq,skinnormal_vertex:sq,specularmap_fragment:oq,specularmap_pars_fragment:aq,tonemapping_fragment:lq,tonemapping_pars_fragment:Aq,transmission_fragment:cq,transmission_pars_fragment:uq,uv_pars_fragment:fq,uv_pars_vertex:hq,uv_vertex:dq,uv2_pars_fragment:pq,uv2_pars_vertex:mq,uv2_vertex:gq,worldpos_vertex:vq,background_vert:yq,background_frag:wq,backgroundCube_vert:xq,backgroundCube_frag:_q,cube_vert:bq,cube_frag:Bq,depth_vert:Eq,depth_frag:Cq,distanceRGBA_vert:Mq,distanceRGBA_frag:Sq,equirect_vert:Tq,equirect_frag:Iq,linedashed_vert:Rq,linedashed_frag:Fq,meshbasic_vert:Uq,meshbasic_frag:Lq,meshlambert_vert:Pq,meshlambert_frag:Dq,meshmatcap_vert:Oq,meshmatcap_frag:Nq,meshnormal_vert:kq,meshnormal_frag:Qq,meshphong_vert:Hq,meshphong_frag:zq,meshphysical_vert:Gq,meshphysical_frag:Vq,meshtoon_vert:jq,meshtoon_frag:Wq,points_vert:Kq,points_frag:Yq,shadow_vert:Xq,shadow_frag:$q,sprite_vert:Zq,sprite_frag:Jq},Ne={common:{diffuse:{value:new ke(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new xn},uv2Transform:{value:new xn},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 Ye(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 ke(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 ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new xn}},sprite:{diffuse:{value:new ke(16777215)},opacity:{value:1},center:{value:new Ye(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new xn}}},jo={basic:{uniforms:oi([Ne.common,Ne.specularmap,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.fog]),vertexShader:xt.meshbasic_vert,fragmentShader:xt.meshbasic_frag},lambert:{uniforms:oi([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 ke(0)}}]),vertexShader:xt.meshlambert_vert,fragmentShader:xt.meshlambert_frag},phong:{uniforms:oi([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 ke(0)},specular:{value:new ke(1118481)},shininess:{value:30}}]),vertexShader:xt.meshphong_vert,fragmentShader:xt.meshphong_frag},standard:{uniforms:oi([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 ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag},toon:{uniforms:oi([Ne.common,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.gradientmap,Ne.fog,Ne.lights,{emissive:{value:new ke(0)}}]),vertexShader:xt.meshtoon_vert,fragmentShader:xt.meshtoon_frag},matcap:{uniforms:oi([Ne.common,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.fog,{matcap:{value:null}}]),vertexShader:xt.meshmatcap_vert,fragmentShader:xt.meshmatcap_frag},points:{uniforms:oi([Ne.points,Ne.fog]),vertexShader:xt.points_vert,fragmentShader:xt.points_frag},dashed:{uniforms:oi([Ne.common,Ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xt.linedashed_vert,fragmentShader:xt.linedashed_frag},depth:{uniforms:oi([Ne.common,Ne.displacementmap]),vertexShader:xt.depth_vert,fragmentShader:xt.depth_frag},normal:{uniforms:oi([Ne.common,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,{opacity:{value:1}}]),vertexShader:xt.meshnormal_vert,fragmentShader:xt.meshnormal_frag},sprite:{uniforms:oi([Ne.sprite,Ne.fog]),vertexShader:xt.sprite_vert,fragmentShader:xt.sprite_frag},background:{uniforms:{uvTransform:{value:new xn},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:oi([Ne.common,Ne.displacementmap,{referencePosition:{value:new Z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:xt.distanceRGBA_vert,fragmentShader:xt.distanceRGBA_frag},shadow:{uniforms:oi([Ne.lights,Ne.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:xt.shadow_vert,fragmentShader:xt.shadow_frag}};jo.physical={uniforms:oi([jo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ye(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 ke(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ye},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new ke(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new ke(1,1,1)},specularColorMap:{value:null}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag};const B0={r:0,b:0,g:0};function qq(n,e,t,r,i,s,o){const a=new ke(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===Fx)?(c===void 0&&(c=new Cn(new hg(1,1,1),new Mr({name:"BackgroundCubeMaterial",uniforms:Dh(jo.backgroundCube.uniforms),vertexShader:jo.backgroundCube.vertexShader,fragmentShader:jo.backgroundCube.fragmentShader,side:qr,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(C,T,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!==wt,(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 Cn(new iu(2,2),new Mr({name:"BackgroundMaterial",uniforms:Dh(jo.background.uniforms),vertexShader:jo.background.vertexShader,fragmentShader:jo.background.fragmentShader,side:As,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!==wt,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(B0,SH(n)),r.buffers.color.setClear(B0.r,B0.g,B0.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 eee(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,B,F,P,O){let z=!1;if(o){const K=d(P,F,B);A!==K&&(A=K,h(A.object)),z=m(v,P,F,O),z&&y(v,P,F,O)}else{const K=B.wireframe===!0;(A.geometry!==P.id||A.program!==F.id||A.wireframe!==K)&&(A.geometry=P.id,A.program=F.id,A.wireframe=K,z=!0)}O!==null&&t.update(O,34963),(z||c)&&(c=!1,b(v,B,F,P),O!==null&&n.bindBuffer(34963,t.get(O).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,B,F){const P=F.wireframe===!0;let O=a[v.id];O===void 0&&(O={},a[v.id]=O);let z=O[B.id];z===void 0&&(z={},O[B.id]=z);let K=z[P];return K===void 0&&(K=g(f()),z[P]=K),K}function g(v){const B=[],F=[],P=[];for(let O=0;O=0){const ee=O[E];let U=z[E];if(U===void 0&&(E==="instanceMatrix"&&v.instanceMatrix&&(U=v.instanceMatrix),E==="instanceColor"&&v.instanceColor&&(U=v.instanceColor)),ee===void 0||ee.attribute!==U||U&&ee.data!==U.data)return!0;K++}return A.attributesNum!==K||A.index!==P}function y(v,B,F,P){const O={},z=B.attributes;let K=0;const Q=F.getAttributes();for(const E in Q)if(Q[E].location>=0){let ee=z[E];ee===void 0&&(E==="instanceMatrix"&&v.instanceMatrix&&(ee=v.instanceMatrix),E==="instanceColor"&&v.instanceColor&&(ee=v.instanceColor));const U={};U.attribute=ee,ee&&ee.data&&(U.data=ee.data),O[E]=U,K++}A.attributes=O,A.attributesNum=K,A.index=P}function w(){const v=A.newAttributes;for(let B=0,F=v.length;B=0){let G=O[Q];if(G===void 0&&(Q==="instanceMatrix"&&v.instanceMatrix&&(G=v.instanceMatrix),Q==="instanceColor"&&v.instanceColor&&(G=v.instanceColor)),G!==void 0){const ee=G.normalized,U=G.itemSize,X=t.get(G);if(X===void 0)continue;const ae=X.buffer,oe=X.type,de=X.bytesPerElement;if(G.isInterleavedBufferAttribute){const se=G.data,pe=se.stride,_e=G.offset;if(se.isInstancedInterleavedBuffer){for(let xe=0;xe0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";T="mediump"}return T==="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 ree(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new $a,a=new xn,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 gZ(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 Zh extends TH{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 Gf=4,jF=[.125,.215,.35,.446,.526,.582],gc=20,eb=new Zh,WF=new ke;let tb=null;const hc=(1+Math.sqrt(5))/2,Uu=1/hc,KF=[new Z(1,1,1),new Z(-1,1,1),new Z(1,1,-1),new Z(-1,1,-1),new Z(0,hc,Uu),new Z(0,hc,-Uu),new Z(Uu,0,hc),new Z(-Uu,0,hc),new Z(hc,Uu,0),new Z(-hc,Uu,0)];class YF{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){tb=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=ZF(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=$F(),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===Fh||e.mapping===Uh;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=ZF()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=$F());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new Cn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;E0(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,eb)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;igc&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${gc}`);const m=[];let y=0;for(let T=0;Tw-Gf?i-w+Gf:0),C=4*(this._cubeSize-x);E0(t,_,C,3*x,2*x),l.setRenderTarget(t),l.render(u,eb)}}function see(n){const e=[],t=[],r=[];let i=n;const s=n-Gf+1+jF.length;for(let o=0;on-Gf?l=jF[o-n+Gf-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=[T,b,0,T+2/3,b,0,T+2/3,b+1,0,T,b,0,T+2/3,b+1,0,T,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 Kt;_.setAttribute("position",new lt(y,d)),_.setAttribute("uv",new lt(w,g)),_.setAttribute("faceIndex",new lt(x,m)),e.push(_),i>Gf&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function XF(n,e,t){const r=new da(n,e,t);return r.texture.mapping=Fx,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function E0(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function oee(n,e,t){const r=new Float32Array(gc),i=new Z(0,1,0);return new Mr({name:"SphericalGaussianBlur",defines:{n:gc,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:YS(),fragmentShader:` +}`,xt={alphamap_fragment:_Z,alphamap_pars_fragment:bZ,alphatest_fragment:BZ,alphatest_pars_fragment:EZ,aomap_fragment:CZ,aomap_pars_fragment:MZ,begin_vertex:SZ,beginnormal_vertex:TZ,bsdfs:IZ,iridescence_fragment:RZ,bumpmap_pars_fragment:FZ,clipping_planes_fragment:UZ,clipping_planes_pars_fragment:LZ,clipping_planes_pars_vertex:PZ,clipping_planes_vertex:DZ,color_fragment:OZ,color_pars_fragment:NZ,color_pars_vertex:kZ,color_vertex:QZ,common:HZ,cube_uv_reflection_fragment:zZ,defaultnormal_vertex:GZ,displacementmap_pars_vertex:VZ,displacementmap_vertex:jZ,emissivemap_fragment:WZ,emissivemap_pars_fragment:KZ,encodings_fragment:YZ,encodings_pars_fragment:XZ,envmap_fragment:$Z,envmap_common_pars_fragment:ZZ,envmap_pars_fragment:JZ,envmap_pars_vertex:qZ,envmap_physical_pars_fragment:uJ,envmap_vertex:eJ,fog_vertex:tJ,fog_pars_vertex:nJ,fog_fragment:rJ,fog_pars_fragment:iJ,gradientmap_pars_fragment:sJ,lightmap_fragment:oJ,lightmap_pars_fragment:aJ,lights_lambert_fragment:lJ,lights_lambert_pars_fragment:AJ,lights_pars_begin:cJ,lights_toon_fragment:fJ,lights_toon_pars_fragment:hJ,lights_phong_fragment:dJ,lights_phong_pars_fragment:pJ,lights_physical_fragment:mJ,lights_physical_pars_fragment:gJ,lights_fragment_begin:vJ,lights_fragment_maps:yJ,lights_fragment_end:wJ,logdepthbuf_fragment:xJ,logdepthbuf_pars_fragment:_J,logdepthbuf_pars_vertex:bJ,logdepthbuf_vertex:BJ,map_fragment:EJ,map_pars_fragment:CJ,map_particle_fragment:MJ,map_particle_pars_fragment:SJ,metalnessmap_fragment:TJ,metalnessmap_pars_fragment:IJ,morphcolor_vertex:RJ,morphnormal_vertex:FJ,morphtarget_pars_vertex:UJ,morphtarget_vertex:LJ,normal_fragment_begin:PJ,normal_fragment_maps:DJ,normal_pars_fragment:OJ,normal_pars_vertex:NJ,normal_vertex:kJ,normalmap_pars_fragment:QJ,clearcoat_normal_fragment_begin:HJ,clearcoat_normal_fragment_maps:zJ,clearcoat_pars_fragment:GJ,iridescence_pars_fragment:VJ,output_fragment:jJ,packing:WJ,premultiplied_alpha_fragment:KJ,project_vertex:YJ,dithering_fragment:XJ,dithering_pars_fragment:$J,roughnessmap_fragment:ZJ,roughnessmap_pars_fragment:JJ,shadowmap_pars_fragment:qJ,shadowmap_pars_vertex:eq,shadowmap_vertex:tq,shadowmask_pars_fragment:nq,skinbase_vertex:rq,skinning_pars_vertex:iq,skinning_vertex:sq,skinnormal_vertex:oq,specularmap_fragment:aq,specularmap_pars_fragment:lq,tonemapping_fragment:Aq,tonemapping_pars_fragment:cq,transmission_fragment:uq,transmission_pars_fragment:fq,uv_pars_fragment:hq,uv_pars_vertex:dq,uv_vertex:pq,uv2_pars_fragment:mq,uv2_pars_vertex:gq,uv2_vertex:vq,worldpos_vertex:yq,background_vert:wq,background_frag:xq,backgroundCube_vert:_q,backgroundCube_frag:bq,cube_vert:Bq,cube_frag:Eq,depth_vert:Cq,depth_frag:Mq,distanceRGBA_vert:Sq,distanceRGBA_frag:Tq,equirect_vert:Iq,equirect_frag:Rq,linedashed_vert:Fq,linedashed_frag:Uq,meshbasic_vert:Lq,meshbasic_frag:Pq,meshlambert_vert:Dq,meshlambert_frag:Oq,meshmatcap_vert:Nq,meshmatcap_frag:kq,meshnormal_vert:Qq,meshnormal_frag:Hq,meshphong_vert:zq,meshphong_frag:Gq,meshphysical_vert:Vq,meshphysical_frag:jq,meshtoon_vert:Wq,meshtoon_frag:Kq,points_vert:Yq,points_frag:Xq,shadow_vert:$q,shadow_frag:Zq,sprite_vert:Jq,sprite_frag:qq},Ne={common:{diffuse:{value:new ke(16777215)},opacity:{value:1},map:{value:null},uvTransform:{value:new xn},uv2Transform:{value:new xn},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 Ke(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 ke(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 ke(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new xn}},sprite:{diffuse:{value:new ke(16777215)},opacity:{value:1},center:{value:new Ke(.5,.5)},rotation:{value:0},map:{value:null},alphaMap:{value:null},alphaTest:{value:0},uvTransform:{value:new xn}}},jo={basic:{uniforms:oi([Ne.common,Ne.specularmap,Ne.envmap,Ne.aomap,Ne.lightmap,Ne.fog]),vertexShader:xt.meshbasic_vert,fragmentShader:xt.meshbasic_frag},lambert:{uniforms:oi([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 ke(0)}}]),vertexShader:xt.meshlambert_vert,fragmentShader:xt.meshlambert_frag},phong:{uniforms:oi([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 ke(0)},specular:{value:new ke(1118481)},shininess:{value:30}}]),vertexShader:xt.meshphong_vert,fragmentShader:xt.meshphong_frag},standard:{uniforms:oi([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 ke(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag},toon:{uniforms:oi([Ne.common,Ne.aomap,Ne.lightmap,Ne.emissivemap,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.gradientmap,Ne.fog,Ne.lights,{emissive:{value:new ke(0)}}]),vertexShader:xt.meshtoon_vert,fragmentShader:xt.meshtoon_frag},matcap:{uniforms:oi([Ne.common,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,Ne.fog,{matcap:{value:null}}]),vertexShader:xt.meshmatcap_vert,fragmentShader:xt.meshmatcap_frag},points:{uniforms:oi([Ne.points,Ne.fog]),vertexShader:xt.points_vert,fragmentShader:xt.points_frag},dashed:{uniforms:oi([Ne.common,Ne.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:xt.linedashed_vert,fragmentShader:xt.linedashed_frag},depth:{uniforms:oi([Ne.common,Ne.displacementmap]),vertexShader:xt.depth_vert,fragmentShader:xt.depth_frag},normal:{uniforms:oi([Ne.common,Ne.bumpmap,Ne.normalmap,Ne.displacementmap,{opacity:{value:1}}]),vertexShader:xt.meshnormal_vert,fragmentShader:xt.meshnormal_frag},sprite:{uniforms:oi([Ne.sprite,Ne.fog]),vertexShader:xt.sprite_vert,fragmentShader:xt.sprite_frag},background:{uniforms:{uvTransform:{value:new xn},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:oi([Ne.common,Ne.displacementmap,{referencePosition:{value:new Z},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:xt.distanceRGBA_vert,fragmentShader:xt.distanceRGBA_frag},shadow:{uniforms:oi([Ne.lights,Ne.fog,{color:{value:new ke(0)},opacity:{value:1}}]),vertexShader:xt.shadow_vert,fragmentShader:xt.shadow_frag}};jo.physical={uniforms:oi([jo.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatNormalScale:{value:new Ke(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 ke(0)},sheenColorMap:{value:null},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},transmission:{value:0},transmissionMap:{value:null},transmissionSamplerSize:{value:new Ke},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},attenuationDistance:{value:0},attenuationColor:{value:new ke(0)},specularIntensity:{value:1},specularIntensityMap:{value:null},specularColor:{value:new ke(1,1,1)},specularColorMap:{value:null}}]),vertexShader:xt.meshphysical_vert,fragmentShader:xt.meshphysical_frag};const B0={r:0,b:0,g:0};function eee(n,e,t,r,i,s,o){const a=new ke(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===Ux)?(c===void 0&&(c=new Cn(new hg(1,1,1),new gr({name:"BackgroundCubeMaterial",uniforms:Dh(jo.backgroundCube.uniforms),vertexShader:jo.backgroundCube.vertexShader,fragmentShader:jo.backgroundCube.fragmentShader,side:qr,depthTest:!1,depthWrite:!1,fog:!1})),c.geometry.deleteAttribute("normal"),c.geometry.deleteAttribute("uv"),c.onBeforeRender=function(B,T,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!==wt,(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 Cn(new iu(2,2),new gr({name:"BackgroundMaterial",uniforms:Dh(jo.background.uniforms),vertexShader:jo.background.vertexShader,fragmentShader:jo.background.fragmentShader,side:As,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!==wt,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(B0,TH(n)),r.buffers.color.setClear(B0.r,B0.g,B0.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 tee(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,L,U,P){let z=!1;if(o){const W=d(U,L,E);A!==W&&(A=W,h(A.object)),z=m(v,U,L,P),z&&y(v,U,L,P)}else{const W=E.wireframe===!0;(A.geometry!==U.id||A.program!==L.id||A.wireframe!==W)&&(A.geometry=U.id,A.program=L.id,A.wireframe=W,z=!0)}P!==null&&t.update(P,34963),(z||c)&&(c=!1,b(v,E,L,U),P!==null&&n.bindBuffer(34963,t.get(P).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,L){const U=L.wireframe===!0;let P=a[v.id];P===void 0&&(P={},a[v.id]=P);let z=P[E.id];z===void 0&&(z={},P[E.id]=z);let W=z[U];return W===void 0&&(W=g(f()),z[U]=W),W}function g(v){const E=[],L=[],U=[];for(let P=0;P=0){const ee=P[C];let F=z[C];if(F===void 0&&(C==="instanceMatrix"&&v.instanceMatrix&&(F=v.instanceMatrix),C==="instanceColor"&&v.instanceColor&&(F=v.instanceColor)),ee===void 0||ee.attribute!==F||F&&ee.data!==F.data)return!0;W++}return A.attributesNum!==W||A.index!==U}function y(v,E,L,U){const P={},z=E.attributes;let W=0;const N=L.getAttributes();for(const C in N)if(N[C].location>=0){let ee=z[C];ee===void 0&&(C==="instanceMatrix"&&v.instanceMatrix&&(ee=v.instanceMatrix),C==="instanceColor"&&v.instanceColor&&(ee=v.instanceColor));const F={};F.attribute=ee,ee&&ee.data&&(F.data=ee.data),P[C]=F,W++}A.attributes=P,A.attributesNum=W,A.index=U}function w(){const v=A.newAttributes;for(let E=0,L=v.length;E=0){let j=P[N];if(j===void 0&&(N==="instanceMatrix"&&v.instanceMatrix&&(j=v.instanceMatrix),N==="instanceColor"&&v.instanceColor&&(j=v.instanceColor)),j!==void 0){const ee=j.normalized,F=j.itemSize,X=t.get(j);if(X===void 0)continue;const ue=X.buffer,re=X.type,fe=X.bytesPerElement;if(j.isInterleavedBufferAttribute){const oe=j.data,pe=oe.stride,xe=j.offset;if(oe.isInstancedInterleavedBuffer){for(let _e=0;_e0&&n.getShaderPrecisionFormat(35632,36338).precision>0)return"highp";T="mediump"}return T==="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,B=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:B}}function iee(n){const e=this;let t=null,r=0,i=!1,s=!1;const o=new $a,a=new xn,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 vZ(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 Zh extends IH{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 Gf=4,WF=[.125,.215,.35,.446,.526,.582],gc=20,tb=new Zh,KF=new ke;let nb=null;const hc=(1+Math.sqrt(5))/2,Uu=1/hc,YF=[new Z(1,1,1),new Z(-1,1,1),new Z(1,1,-1),new Z(-1,1,-1),new Z(0,hc,Uu),new Z(0,hc,-Uu),new Z(Uu,0,hc),new Z(-Uu,0,hc),new Z(hc,Uu,0),new Z(-hc,Uu,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){nb=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=JF(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=ZF(),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===Fh||e.mapping===Uh;i?(this._cubemapMaterial===null&&(this._cubemapMaterial=JF()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=ZF());const s=i?this._cubemapMaterial:this._equirectMaterial,o=new Cn(this._lodPlanes[0],s),a=s.uniforms;a.envMap.value=e;const l=this._cubeSize;E0(t,0,0,3*l,2*l),r.setRenderTarget(t),r.render(o,tb)}_applyPMREM(e){const t=this._renderer,r=t.autoClear;t.autoClear=!1;for(let i=1;igc&&console.warn(`sigmaRadians, ${s}, is too large and will clip, as it requested ${g} samples when the maximum is set to ${gc}`);const m=[];let y=0;for(let T=0;Tw-Gf?i-w+Gf:0),B=4*(this._cubeSize-x);E0(t,_,B,3*x,2*x),l.setRenderTarget(t),l.render(u,tb)}}function oee(n){const e=[],t=[],r=[];let i=n;const s=n-Gf+1+WF.length;for(let o=0;on-Gf?l=WF[o-n+Gf-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 B=0;B2?0:-1,M=[T,b,0,T+2/3,b,0,T+2/3,b+1,0,T,b,0,T+2/3,b+1,0,T,b+1,0];y.set(M,d*p*B),w.set(f,g*p*B);const O=[B,B,B,B,B,B];x.set(O,m*p*B)}const _=new Kt;_.setAttribute("position",new lt(y,d)),_.setAttribute("uv",new lt(w,g)),_.setAttribute("faceIndex",new lt(x,m)),e.push(_),i>Gf&&i--}return{lodPlanes:e,sizeLods:t,sigmas:r}}function $F(n,e,t){const r=new da(n,e,t);return r.texture.mapping=Ux,r.texture.name="PMREM.cubeUv",r.scissorTest=!0,r}function E0(n,e,t,r,i){n.viewport.set(e,t,r,i),n.scissor.set(e,t,r,i)}function aee(n,e,t){const r=new Float32Array(gc),i=new Z(0,1,0);return new gr({name:"SphericalGaussianBlur",defines:{n:gc,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:XS(),fragmentShader:` precision mediump float; precision mediump int; @@ -3053,7 +3053,7 @@ void main() { } } - `,blending:EA,depthTest:!1,depthWrite:!1})}function $F(){return new Mr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:YS(),fragmentShader:` + `,blending:EA,depthTest:!1,depthWrite:!1})}function ZF(){return new gr({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:XS(),fragmentShader:` precision mediump float; precision mediump int; @@ -3072,7 +3072,7 @@ void main() { gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); } - `,blending:EA,depthTest:!1,depthWrite:!1})}function ZF(){return new Mr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:YS(),fragmentShader:` + `,blending:EA,depthTest:!1,depthWrite:!1})}function JF(){return new gr({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:XS(),fragmentShader:` precision mediump float; precision mediump int; @@ -3088,7 +3088,7 @@ void main() { gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); } - `,blending:EA,depthTest:!1,depthWrite:!1})}function YS(){return` + `,blending:EA,depthTest:!1,depthWrite:!1})}function XS(){return` precision mediump float; precision mediump int; @@ -3143,39 +3143,39 @@ void main() { gl_Position = vec4( position, 1.0 ); } - `}function aee(n){let e=new WeakMap,t=null;function r(a){if(a&&a.isTexture){const l=a.mapping,A=l===lw||l===XE,c=l===Fh||l===Uh;if(A||c)if(a.isRenderTargetTexture&&a.needsPMREMUpdate===!0){a.needsPMREMUpdate=!1;let u=e.get(a);return t===null&&(t=new YF(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 YF(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&&(Y=Math.ceil(D/e.maxTextureSize),D=e.maxTextureSize);const H=new Float32Array(D*Y*4*d),I=new CH(H,D,Y,d);I.type=AA,I.needsUpdate=!0;const v=M*4;for(let F=0;F0)return n;const i=e*t;let s=JF[i];if(s===void 0&&(s=new Float32Array(i),JF[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 gr(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&&(Y=Math.ceil(O/e.maxTextureSize),O=e.maxTextureSize);const H=new Float32Array(O*Y*4*d),I=new MH(H,O,Y,d);I.type=AA,I.needsUpdate=!0;const v=M*4;for(let L=0;L0)return n;const i=e*t;let s=qF[i];if(s===void 0&&(s=new Float32Array(i),qF[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 vr(n,e){if(n.length!==e.length)return!1;for(let t=0,r=n.length;t":" "} ${a}: ${t[o]}`)}return r.join(` -`)}function lte(n){switch(n){case wl:return["Linear","( value )"];case wt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function sU(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()+` +`)}function Ate(n){switch(n){case wl:return["Linear","( value )"];case wt:return["sRGB","( value )"];default:return console.warn("THREE.WebGLProgram: Unsupported encoding:",n),["Linear","( value )"]}}function oU(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+` -`+ate(n.getShaderSource(e),o)}else return i}function Ate(n,e){const t=lte(e);return"vec4 "+n+"( vec4 value ) { return LinearTo"+t[0]+t[1]+"; }"}function cte(n,e){let t;switch(e){case f$:t="Linear";break;case h$:t="Reinhard";break;case d$:t="OptimizedCineon";break;case p$:t="ACESFilmic";break;case m$:t="Custom";break;default:console.warn("THREE.WebGLProgram: Unsupported toneMapping:",e),t="Linear"}return"vec3 "+n+"( vec3 color ) { return "+t+"ToneMapping( color ); }"}function ute(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(xp).join(` -`)}function fte(n){const e=[];for(const t in n){const r=n[t];r!==!1&&e.push("#define "+t+" "+r)}return e.join(` -`)}function hte(n,e){const t={},r=n.getProgramParameter(e,35721);for(let i=0;i/gm;function eC(n){return n.replace(dte,pte)}function pte(n,e){const t=xt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return eC(t)}const mte=/#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 lU(n){return n.replace(mte,gte)}function gte(n,e,t,r){let i="";for(let s=parseInt(e);s/gm;function tC(n){return n.replace(pte,mte)}function mte(n,e){const t=xt[e];if(t===void 0)throw new Error("Can not resolve #include <"+e+">");return tC(t)}const gte=/#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 AU(n){return n.replace(gte,vte)}function vte(n,e,t,r){let i="";for(let s=parseInt(e);s0&&(g+=` `),m=[h,p].filter(xp).join(` `),m.length>0&&(m+=` -`)):(g=[AU(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",` +`)):(g=[cU(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(xp).join(` -`),m=[h,AU(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?cte("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",xt.encodings_pars_fragment,Ate("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` +`),m=[h,cU(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?ute("toneMapping",t.toneMapping):"",t.dithering?"#define DITHERING":"",t.opaque?"#define OPAQUE":"",xt.encodings_pars_fragment,cte("linearToOutputTexel",t.outputEncoding),t.useDepthPacking?"#define DEPTH_PACKING "+t.depthPacking:"",` `].filter(xp).join(` -`)),o=eC(o),o=oU(o,t),o=aU(o,t),a=eC(a),a=oU(a,t),a=aU(a,t),o=lU(o),a=lU(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es +`)),o=tC(o),o=aU(o,t),o=lU(o,t),a=tC(a),a=aU(a,t),a=lU(a,t),o=AU(o),a=AU(a),t.isWebGL2&&t.isRawShaderMaterial!==!0&&(y=`#version 300 es `,g=["precision mediump sampler2DArray;","#define attribute in","#define varying out","#define texture2D texture"].join(` `)+` -`+g,m=["#define varying in",t.glslVersion===UF?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===UF?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` +`+g,m=["#define varying in",t.glslVersion===LF?"":"layout(location = 0) out highp vec4 pc_fragColor;",t.glslVersion===LF?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(` `)+` -`+m);const w=y+g+o,x=y+m+a,_=iU(i,35633,w),C=iU(i,35632,x);if(i.attachShader(d,_),i.attachShader(d,C),t.index0AttributeName!==void 0?i.bindAttribLocation(d,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(d,0,"position"),i.linkProgram(d),n.debug.checkShaderErrors){const M=i.getProgramInfoLog(d).trim(),D=i.getShaderInfoLog(_).trim(),Y=i.getShaderInfoLog(C).trim();let H=!0,I=!0;if(i.getProgramParameter(d,35714)===!1){H=!1;const v=sU(i,_,"vertex"),B=sU(i,C,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(d,35715)+` +`+m);const w=y+g+o,x=y+m+a,_=sU(i,35633,w),B=sU(i,35632,x);if(i.attachShader(d,_),i.attachShader(d,B),t.index0AttributeName!==void 0?i.bindAttribLocation(d,0,t.index0AttributeName):t.morphTargets===!0&&i.bindAttribLocation(d,0,"position"),i.linkProgram(d),n.debug.checkShaderErrors){const M=i.getProgramInfoLog(d).trim(),O=i.getShaderInfoLog(_).trim(),Y=i.getShaderInfoLog(B).trim();let H=!0,I=!0;if(i.getProgramParameter(d,35714)===!1){H=!1;const v=oU(i,_,"vertex"),E=oU(i,B,"fragment");console.error("THREE.WebGLProgram: Shader Error "+i.getError()+" - VALIDATE_STATUS "+i.getProgramParameter(d,35715)+` Program Info Log: `+M+` `+v+` -`+B)}else M!==""?console.warn("THREE.WebGLProgram: Program Info Log:",M):(D===""||Y==="")&&(I=!1);I&&(this.diagnostics={runnable:H,programLog:M,vertexShader:{log:D,prefix:g},fragmentShader:{log:Y,prefix:m}})}i.deleteShader(_),i.deleteShader(C);let T;this.getUniforms=function(){return T===void 0&&(T=new ty(i,d)),T};let b;return this.getAttributes=function(){return b===void 0&&(b=hte(i,d)),b},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(d),this.program=void 0},this.name=t.shaderName,this.id=ote++,this.cacheKey=e,this.usedTimes=1,this.program=d,this.vertexShader=_,this.fragmentShader=C,this}let Bte=0;class Ete{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 Cte(e),t.set(e,r)),r}}class Cte{constructor(e){this.id=Bte++,this.code=e,this.usedTimes=0}}function Mte(n,e,t,r,i,s,o){const a=new jS,l=new Ete,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,Y,H){const I=Y.fog,v=H.geometry,B=b.isMeshStandardMaterial?Y.environment:null,F=(b.isMeshStandardMaterial?t:e).get(b.envMap||B),P=F&&F.mapping===Fx?F.image.height:null,O=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 Q=0;v.morphAttributes.position!==void 0&&(Q=1),v.morphAttributes.normal!==void 0&&(Q=2),v.morphAttributes.color!==void 0&&(Q=3);let E,G,ee,U;if(O){const pe=jo[O];E=pe.vertexShader,G=pe.fragmentShader}else E=b.vertexShader,G=b.fragmentShader,l.update(b),ee=l.getVertexShaderID(b),U=l.getFragmentShaderID(b);const X=n.getRenderTarget(),ae=b.alphaTest>0,oe=b.clearcoat>0,de=b.iridescence>0;return{isWebGL2:c,shaderID:O,shaderName:b.type,vertexShader:E,fragmentShader:G,defines:b.defines,customVertexShaderID:ee,customFragmentShaderID:U,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:wl,map:!!b.map,matcap:!!b.matcap,envMap:!!F,envMapMode:F&&F.mapping,envMapCubeUVHeight:P,lightMap:!!b.lightMap,aoMap:!!b.aoMap,emissiveMap:!!b.emissiveMap,bumpMap:!!b.bumpMap,normalMap:!!b.normalMap,objectSpaceNormalMap:b.normalMapType===k$,tangentSpaceNormalMap:b.normalMapType===$h,decodeVideoTexture:!!b.map&&b.map.isVideoTexture===!0&&b.map.encoding===wt,clearcoat:oe,clearcoatMap:oe&&!!b.clearcoatMap,clearcoatRoughnessMap:oe&&!!b.clearcoatRoughnessMap,clearcoatNormalMap:oe&&!!b.clearcoatNormalMap,iridescence:de,iridescenceMap:de&&!!b.iridescenceMap,iridescenceThicknessMap:de&&!!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===oh,alphaMap:!!b.alphaMap,alphaTest:ae,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:Q,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===hi,flipSided:b.side===qr,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 Y=jo[M];D=WS.clone(Y.uniforms)}else D=b.uniforms;return D}function x(b,M){let D;for(let Y=0,H=A.length;Y0?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||Tte),r.length>1&&r.sort(f||cU),i.length>1&&i.sort(f||cU)}function c(){for(let u=e,f=n.length;u=s.length?(o=new uU,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function Rte(){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 ke};break;case"SpotLight":t={position:new Z,direction:new Z,color:new ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Z,color:new ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Z,skyColor:new ke,groundColor:new ke};break;case"RectAreaLight":t={color:new ke,position:new Z,halfWidth:new Z,halfHeight:new Z};break}return n[e.id]=t,t}}}function Fte(){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 Ye};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ye};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ye,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Ute=0;function Lte(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Pte(n,e){const t=new Rte,r=Fte(),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 We,a=new We;function l(c,u){let f=0,h=0,p=0;for(let Y=0;Y<9;Y++)i.probe[Y].set(0,0,0);let d=0,g=0,m=0,y=0,w=0,x=0,_=0,C=0,T=0,b=0;c.sort(Lte);const M=u!==!0?Math.PI:1;for(let Y=0,H=c.length;Y0&&(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!==T)&&(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+T-b,i.spotLightMap.length=T,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=T,i.version=Ute++)}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 fU(n,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class Ote extends Li{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=O$,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 Nte extends Li{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 kte=`void main() { +`+E)}else M!==""?console.warn("THREE.WebGLProgram: Program Info Log:",M):(O===""||Y==="")&&(I=!1);I&&(this.diagnostics={runnable:H,programLog:M,vertexShader:{log:O,prefix:g},fragmentShader:{log:Y,prefix:m}})}i.deleteShader(_),i.deleteShader(B);let T;this.getUniforms=function(){return T===void 0&&(T=new ty(i,d)),T};let b;return this.getAttributes=function(){return b===void 0&&(b=dte(i,d)),b},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(d),this.program=void 0},this.name=t.shaderName,this.id=ate++,this.cacheKey=e,this.usedTimes=1,this.program=d,this.vertexShader=_,this.fragmentShader=B,this}let Ete=0;class Cte{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 Mte(e),t.set(e,r)),r}}class Mte{constructor(e){this.id=Ete++,this.code=e,this.usedTimes=0}}function Ste(n,e,t,r,i,s,o){const a=new WS,l=new Cte,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,O,Y,H){const I=Y.fog,v=H.geometry,E=b.isMeshStandardMaterial?Y.environment:null,L=(b.isMeshStandardMaterial?t:e).get(b.envMap||E),U=L&&L.mapping===Ux?L.image.height:null,P=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,W=z!==void 0?z.length:0;let N=0;v.morphAttributes.position!==void 0&&(N=1),v.morphAttributes.normal!==void 0&&(N=2),v.morphAttributes.color!==void 0&&(N=3);let C,j,ee,F;if(P){const pe=jo[P];C=pe.vertexShader,j=pe.fragmentShader}else C=b.vertexShader,j=b.fragmentShader,l.update(b),ee=l.getVertexShaderID(b),F=l.getFragmentShaderID(b);const X=n.getRenderTarget(),ue=b.alphaTest>0,re=b.clearcoat>0,fe=b.iridescence>0;return{isWebGL2:c,shaderID:P,shaderName:b.type,vertexShader:C,fragmentShader:j,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:wl,map:!!b.map,matcap:!!b.matcap,envMap:!!L,envMapMode:L&&L.mapping,envMapCubeUVHeight:U,lightMap:!!b.lightMap,aoMap:!!b.aoMap,emissiveMap:!!b.emissiveMap,bumpMap:!!b.bumpMap,normalMap:!!b.normalMap,objectSpaceNormalMap:b.normalMapType===Q$,tangentSpaceNormalMap:b.normalMapType===$h,decodeVideoTexture:!!b.map&&b.map.isVideoTexture===!0&&b.map.encoding===wt,clearcoat:re,clearcoatMap:re&&!!b.clearcoatMap,clearcoatRoughnessMap:re&&!!b.clearcoatRoughnessMap,clearcoatNormalMap:re&&!!b.clearcoatNormalMap,iridescence:fe,iridescenceMap:fe&&!!b.iridescenceMap,iridescenceThicknessMap:fe&&!!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===oh,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:W,morphTextureStride:N,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&&O.length>0,shadowMapType:n.shadowMap.type,toneMapping:b.toneMapped?n.toneMapping:al,physicallyCorrectLights:n.physicallyCorrectLights,premultipliedAlpha:b.premultipliedAlpha,doubleSided:b.side===hi,flipSided:b.side===qr,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 O in b.defines)M.push(O),M.push(b.defines[O]);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 O;if(M){const Y=jo[M];O=KS.clone(Y.uniforms)}else O=b.uniforms;return O}function x(b,M){let O;for(let Y=0,H=A.length;Y0?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||Ite),r.length>1&&r.sort(f||uU),i.length>1&&i.sort(f||uU)}function c(){for(let u=e,f=n.length;u=s.length?(o=new fU,s.push(o)):o=s[i],o}function t(){n=new WeakMap}return{get:e,dispose:t}}function Fte(){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 ke};break;case"SpotLight":t={position:new Z,direction:new Z,color:new ke,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":t={position:new Z,color:new ke,distance:0,decay:0};break;case"HemisphereLight":t={direction:new Z,skyColor:new ke,groundColor:new ke};break;case"RectAreaLight":t={color:new ke,position:new Z,halfWidth:new Z,halfHeight:new Z};break}return n[e.id]=t,t}}}function Ute(){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 Ke};break;case"SpotLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke};break;case"PointLight":t={shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ke,shadowCameraNear:1,shadowCameraFar:1e3};break}return n[e.id]=t,t}}}let Lte=0;function Pte(n,e){return(e.castShadow?2:0)-(n.castShadow?2:0)+(e.map?1:0)-(n.map?1:0)}function Dte(n,e){const t=new Fte,r=Ute(),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 We,a=new We;function l(c,u){let f=0,h=0,p=0;for(let Y=0;Y<9;Y++)i.probe[Y].set(0,0,0);let d=0,g=0,m=0,y=0,w=0,x=0,_=0,B=0,T=0,b=0;c.sort(Pte);const M=u!==!0?Math.PI:1;for(let Y=0,H=c.length;Y0&&(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 O=i.hash;(O.directionalLength!==d||O.pointLength!==g||O.spotLength!==m||O.rectAreaLength!==y||O.hemiLength!==w||O.numDirectionalShadows!==x||O.numPointShadows!==_||O.numSpotShadows!==B||O.numSpotMaps!==T)&&(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=B,i.spotShadowMap.length=B,i.directionalShadowMatrix.length=x,i.pointShadowMatrix.length=_,i.spotLightMatrix.length=B+T-b,i.spotLightMap.length=T,i.numSpotLightShadowsWithMaps=b,O.directionalLength=d,O.pointLength=g,O.spotLength=m,O.rectAreaLength=y,O.hemiLength=w,O.numDirectionalShadows=x,O.numPointShadows=_,O.numSpotShadows=B,O.numSpotMaps=T,i.version=Lte++)}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 hU(n,e),a.push(l)):l=a[o],l}function i(){t=new WeakMap}return{get:r,dispose:i}}class Nte extends Li{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=N$,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 kte extends Li{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 Qte=`void main() { gl_Position = vec4( position, 1.0 ); -}`,Qte=`uniform sampler2D shadow_pass; +}`,Hte=`uniform sampler2D shadow_pass; uniform vec2 resolution; uniform float radius; #include @@ -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 Hte(n,e,t){let r=new KS;const i=new Ye,s=new Ye,o=new Ht,a=new Ote({depthPacking:N$}),l=new Nte,A={},c=t.maxTextureSize,u={[As]:qr,[qr]:As,[hi]:hi},f=new Mr({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ye},radius:{value:4}},vertexShader:kte,fragmentShader:Qte}),h=f.clone();h.defines.HORIZONTAL_PASS=1;const p=new Kt;p.setAttribute("position",new lt(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const d=new Cn(p,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=mH,this.render=function(x,_,C){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||x.length===0)return;const T=n.getRenderTarget(),b=n.getActiveCubeFace(),M=n.getActiveMipmapLevel(),D=n.state;D.setBlending(EA),D.buffers.color.setClear(1,1,1,1),D.buffers.depth.setTest(!0),D.setScissorTest(!1);for(let Y=0,H=x.length;Yc||i.y>c)&&(i.x>c&&(s.x=Math.floor(c/B.x),i.x=s.x*B.x,v.mapSize.x=s.x),i.y>c&&(s.y=Math.floor(c/B.y),i.y=s.y*B.y,v.mapSize.y=s.y)),v.map===null){const P=this.type!==wp?{minFilter:Xn,magFilter:Xn}:{};v.map=new da(i.x,i.y,P),v.map.texture.name=I.name+".shadowMap",v.camera.updateProjectionMatrix()}n.setRenderTarget(v.map),n.clear();const F=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 B=v[I];B===void 0&&(B=D.clone(),v[I]=B),D=B}return D.visible=_.visible,D.wireframe=_.wireframe,M===wp?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=T,D.farDistance=b),D}function w(x,_,C,T,b){if(x.visible===!1)return;if(x.layers.test(_.layers)&&(x.isMesh||x.isLine||x.isPoints)&&(x.castShadow||x.receiveShadow&&b===wp)&&(!x.frustumCulled||r.intersectsObject(x))){x.modelViewMatrix.multiplyMatrices(C.matrixWorldInverse,x.matrixWorld);const Y=e.update(x),H=x.material;if(Array.isArray(H)){const I=Y.groups;for(let v=0,B=I.length;v=1):O.indexOf("OpenGL ES")!==-1&&(P=parseFloat(/^OpenGL ES (\d)/.exec(O)[1]),F=P>=2);let z=null,K={};const Q=n.getParameter(3088),E=n.getParameter(2978),G=new Ht().fromArray(Q),ee=new Ht().fromArray(E);function U(fe,Me,Se){const Fe=new Uint8Array(4),Ve=n.createTexture();n.bindTexture(fe,Ve),n.texParameteri(fe,10241,9728),n.texParameteri(fe,10240,9728);for(let Je=0;Je"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(k,W){return m?new OffscreenCanvas(k,W):Qm("canvas")}function w(k,W,re,he){let me=1;if((k.width>he||k.height>he)&&(me=he/Math.max(k.width,k.height)),me<1||W===!0)if(typeof HTMLImageElement<"u"&&k instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&k instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&k instanceof ImageBitmap){const V=W?uw:Math.floor,R=V(me*k.width),S=V(me*k.height);d===void 0&&(d=y(R,S));const j=re?y(R,S):d;return j.width=R,j.height=S,j.getContext("2d").drawImage(k,0,0,R,S),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+k.width+"x"+k.height+") to ("+R+"x"+S+")."),j}else return"data"in k&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+k.width+"x"+k.height+")."),k;return k}function x(k){return qE(k.width)&&qE(k.height)}function _(k){return a?!1:k.wrapS!==ui||k.wrapT!==ui||k.minFilter!==Xn&&k.minFilter!==li}function C(k,W){return k.generateMipmaps&&W&&k.minFilter!==Xn&&k.minFilter!==li}function T(k){n.generateMipmap(k)}function b(k,W,re,he,me=!1){if(a===!1)return W;if(k!==null){if(n[k]!==void 0)return n[k];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+k+"'")}let V=W;return W===6403&&(re===5126&&(V=33326),re===5131&&(V=33325),re===5121&&(V=33321)),W===33319&&(re===5126&&(V=33328),re===5131&&(V=33327),re===5121&&(V=33323)),W===6408&&(re===5126&&(V=34836),re===5131&&(V=34842),re===5121&&(V=he===wt&&me===!1?35907:32856),re===32819&&(V=32854),re===32820&&(V=32855)),(V===33325||V===33326||V===33327||V===33328||V===34842||V===34836)&&e.get("EXT_color_buffer_float"),V}function M(k,W,re){return C(k,re)===!0||k.isFramebufferTexture&&k.minFilter!==Xn&&k.minFilter!==li?Math.log2(Math.max(W.width,W.height))+1:k.mipmaps!==void 0&&k.mipmaps.length>0?k.mipmaps.length:k.isCompressedTexture&&Array.isArray(k.image)?W.mipmaps.length:1}function D(k){return k===Xn||k===Aw||k===Jp?9728:9729}function Y(k){const W=k.target;W.removeEventListener("dispose",Y),I(W),W.isVideoTexture&&p.delete(W)}function H(k){const W=k.target;W.removeEventListener("dispose",H),B(W)}function I(k){const W=r.get(k);if(W.__webglInit===void 0)return;const re=k.source,he=g.get(re);if(he){const me=he[W.__cacheKey];me.usedTimes--,me.usedTimes===0&&v(k),Object.keys(he).length===0&&g.delete(re)}r.remove(k)}function v(k){const W=r.get(k);n.deleteTexture(W.__webglTexture);const re=k.source,he=g.get(re);delete he[W.__cacheKey],o.memory.textures--}function B(k){const W=k.texture,re=r.get(k),he=r.get(W);if(he.__webglTexture!==void 0&&(n.deleteTexture(he.__webglTexture),o.memory.textures--),k.depthTexture&&k.depthTexture.dispose(),k.isWebGLCubeRenderTarget)for(let me=0;me<6;me++)n.deleteFramebuffer(re.__webglFramebuffer[me]),re.__webglDepthbuffer&&n.deleteRenderbuffer(re.__webglDepthbuffer[me]);else{if(n.deleteFramebuffer(re.__webglFramebuffer),re.__webglDepthbuffer&&n.deleteRenderbuffer(re.__webglDepthbuffer),re.__webglMultisampledFramebuffer&&n.deleteFramebuffer(re.__webglMultisampledFramebuffer),re.__webglColorRenderbuffer)for(let me=0;me=l&&console.warn("THREE.WebGLTextures: Trying to use "+k+" texture units while this GPU supports only "+l),F+=1,k}function z(k){const W=[];return W.push(k.wrapS),W.push(k.wrapT),W.push(k.wrapR||0),W.push(k.magFilter),W.push(k.minFilter),W.push(k.anisotropy),W.push(k.internalFormat),W.push(k.format),W.push(k.type),W.push(k.generateMipmaps),W.push(k.premultiplyAlpha),W.push(k.flipY),W.push(k.unpackAlignment),W.push(k.encoding),W.join()}function K(k,W){const re=r.get(k);if(k.isVideoTexture&&be(k),k.isRenderTargetTexture===!1&&k.version>0&&re.__version!==k.version){const he=k.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{oe(re,k,W);return}}t.bindTexture(3553,re.__webglTexture,33984+W)}function Q(k,W){const re=r.get(k);if(k.version>0&&re.__version!==k.version){oe(re,k,W);return}t.bindTexture(35866,re.__webglTexture,33984+W)}function E(k,W){const re=r.get(k);if(k.version>0&&re.__version!==k.version){oe(re,k,W);return}t.bindTexture(32879,re.__webglTexture,33984+W)}function G(k,W){const re=r.get(k);if(k.version>0&&re.__version!==k.version){de(re,k,W);return}t.bindTexture(34067,re.__webglTexture,33984+W)}const ee={[cs]:10497,[ui]:33071,[Dm]:33648},U={[Xn]:9728,[Aw]:9984,[Jp]:9986,[li]:9729,[HS]:9985,[PA]:9987};function X(k,W,re){if(re?(n.texParameteri(k,10242,ee[W.wrapS]),n.texParameteri(k,10243,ee[W.wrapT]),(k===32879||k===35866)&&n.texParameteri(k,32882,ee[W.wrapR]),n.texParameteri(k,10240,U[W.magFilter]),n.texParameteri(k,10241,U[W.minFilter])):(n.texParameteri(k,10242,33071),n.texParameteri(k,10243,33071),(k===32879||k===35866)&&n.texParameteri(k,32882,33071),(W.wrapS!==ui||W.wrapT!==ui)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(k,10240,D(W.magFilter)),n.texParameteri(k,10241,D(W.minFilter)),W.minFilter!==Xn&&W.minFilter!==li&&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(W.magFilter===Xn||W.minFilter!==Jp&&W.minFilter!==PA||W.type===AA&&e.has("OES_texture_float_linear")===!1||a===!1&&W.type===Om&&e.has("OES_texture_half_float_linear")===!1)return;(W.anisotropy>1||r.get(W).__currentAnisotropy)&&(n.texParameterf(k,he.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(W.anisotropy,i.getMaxAnisotropy())),r.get(W).__currentAnisotropy=W.anisotropy)}}function ae(k,W){let re=!1;k.__webglInit===void 0&&(k.__webglInit=!0,W.addEventListener("dispose",Y));const he=W.source;let me=g.get(he);me===void 0&&(me={},g.set(he,me));const V=z(W);if(V!==k.__cacheKey){me[V]===void 0&&(me[V]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,re=!0),me[V].usedTimes++;const R=me[k.__cacheKey];R!==void 0&&(me[k.__cacheKey].usedTimes--,R.usedTimes===0&&v(W)),k.__cacheKey=V,k.__webglTexture=me[V].texture}return re}function oe(k,W,re){let he=3553;(W.isDataArrayTexture||W.isCompressedArrayTexture)&&(he=35866),W.isData3DTexture&&(he=32879);const me=ae(k,W),V=W.source;t.bindTexture(he,k.__webglTexture,33984+re);const R=r.get(V);if(V.version!==R.__version||me===!0){t.activeTexture(33984+re),n.pixelStorei(37440,W.flipY),n.pixelStorei(37441,W.premultiplyAlpha),n.pixelStorei(3317,W.unpackAlignment),n.pixelStorei(37443,0);const S=_(W)&&x(W.image)===!1;let j=w(W.image,S,!1,c);j=Be(W,j);const te=x(j)||a,le=s.convert(W.format,W.encoding);let ie=s.convert(W.type),Ie=b(W.internalFormat,le,ie,W.encoding,W.isVideoTexture);X(he,W,te);let Te;const Le=W.mipmaps,He=a&&W.isVideoTexture!==!0,De=R.__version===void 0||me===!0,fe=M(W,j,te);if(W.isDepthTexture)Ie=6402,a?W.type===AA?Ie=36012:W.type===bc?Ie=33190:W.type===ah?Ie=35056:Ie=33189:W.type===AA&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),W.format===Rc&&Ie===6402&&W.type!==wH&&W.type!==bc&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),W.type=bc,ie=s.convert(W.type)),W.format===Lh&&Ie===6402&&(Ie=34041,W.type!==ah&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),W.type=ah,ie=s.convert(W.type))),De&&(He?t.texStorage2D(3553,1,Ie,j.width,j.height):t.texImage2D(3553,0,Ie,j.width,j.height,0,le,ie,null));else if(W.isDataTexture)if(Le.length>0&&te){He&&De&&t.texStorage2D(3553,fe,Ie,Le[0].width,Le[0].height);for(let Me=0,Se=Le.length;Me>=1,Se>>=1}}else if(Le.length>0&&te){He&&De&&t.texStorage2D(3553,fe,Ie,Le[0].width,Le[0].height);for(let Me=0,Se=Le.length;Me0&&De++,t.texStorage2D(34067,De,Te,j[0].width,j[0].height));for(let Me=0;Me<6;Me++)if(S){Le?t.texSubImage2D(34069+Me,0,0,0,j[Me].width,j[Me].height,ie,Ie,j[Me].data):t.texImage2D(34069+Me,0,Te,j[Me].width,j[Me].height,0,ie,Ie,j[Me].data);for(let Se=0;Se=34069&&me<=34074)&&n.framebufferTexture2D(36160,he,me,r.get(re).__webglTexture,0),t.bindFramebuffer(36160,null)}function pe(k,W,re){if(n.bindRenderbuffer(36161,k),W.depthBuffer&&!W.stencilBuffer){let he=33189;if(re||ce(W)){const me=W.depthTexture;me&&me.isDepthTexture&&(me.type===AA?he=36012:me.type===bc&&(he=33190));const V=J(W);ce(W)?f.renderbufferStorageMultisampleEXT(36161,V,he,W.width,W.height):n.renderbufferStorageMultisample(36161,V,he,W.width,W.height)}else n.renderbufferStorage(36161,he,W.width,W.height);n.framebufferRenderbuffer(36160,36096,36161,k)}else if(W.depthBuffer&&W.stencilBuffer){const he=J(W);re&&ce(W)===!1?n.renderbufferStorageMultisample(36161,he,35056,W.width,W.height):ce(W)?f.renderbufferStorageMultisampleEXT(36161,he,35056,W.width,W.height):n.renderbufferStorage(36161,34041,W.width,W.height),n.framebufferRenderbuffer(36160,33306,36161,k)}else{const he=W.isWebGLMultipleRenderTargets===!0?W.texture:[W.texture];for(let me=0;me0&&ce(k)===!1){const S=V?W:[W];re.__webglMultisampledFramebuffer=n.createFramebuffer(),re.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,re.__webglMultisampledFramebuffer);for(let j=0;j0&&ce(k)===!1){const W=k.isWebGLMultipleRenderTargets?k.texture:[k.texture],re=k.width,he=k.height;let me=16384;const V=[],R=k.stencilBuffer?33306:36096,S=r.get(k),j=k.isWebGLMultipleRenderTargets===!0;if(j)for(let te=0;te0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&W.__useRenderToTexture!==!1}function be(k){const W=o.render.frame;p.get(k)!==W&&(p.set(k,W),k.update())}function Be(k,W){const re=k.encoding,he=k.format,me=k.type;return k.isCompressedTexture===!0||k.isVideoTexture===!0||k.format===JE||re!==wl&&(re===wt?a===!1?e.has("EXT_sRGB")===!0&&he===Lr?(k.format=JE,k.minFilter=li,k.generateMipmaps=!1):W=EH.sRGBToLinear(W):(he!==Lr||me!==jc)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",re)),W}this.allocateTextureUnit=O,this.resetTextureUnits=P,this.setTexture2D=K,this.setTexture2DArray=Q,this.setTexture3D=E,this.setTextureCube=G,this.rebindTextures=L,this.setupRenderTarget=ue,this.updateRenderTargetMipmap=Ae,this.updateMultisampleRenderTarget=q,this.setupDepthRenderbuffer=xe,this.setupFrameBufferTexture=se,this.useMultisampledRTT=ce}function Vte(n,e,t){const r=t.isWebGL2;function i(s,o=null){let a;if(s===jc)return 5121;if(s===w$)return 32819;if(s===x$)return 32820;if(s===g$)return 5120;if(s===v$)return 5122;if(s===wH)return 5123;if(s===y$)return 5124;if(s===bc)return 5125;if(s===AA)return 5126;if(s===Om)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===_$)return 6406;if(s===Lr)return 6408;if(s===b$)return 6409;if(s===B$)return 6410;if(s===Rc)return 6402;if(s===Lh)return 34041;if(s===JE)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===E$)return 6403;if(s===C$)return 36244;if(s===M$)return 33319;if(s===S$)return 33320;if(s===T$)return 36249;if(s===M1||s===S1||s===T1||s===I1)if(o===wt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===M1)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===S1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===T1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===I1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===M1)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===S1)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===T1)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===I1)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===AF||s===cF||s===uF||s===fF)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===AF)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===cF)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===uF)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===fF)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===I$)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===hF||s===dF)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===hF)return o===wt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===dF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===pF||s===mF||s===gF||s===vF||s===yF||s===wF||s===xF||s===_F||s===bF||s===BF||s===EF||s===CF||s===MF||s===SF)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===pF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===mF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===gF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===vF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===yF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===wF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===xF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===_F)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===bF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===BF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===EF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===CF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===MF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===SF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===R1)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===R1)return o===wt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===R$||s===TF||s===IF||s===RF)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===R1)return a.COMPRESSED_RED_RGTC1_EXT;if(s===TF)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===IF)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===RF)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 jte extends Br{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Pr extends It{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Wte={type:"move"};class rb{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Pr,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 Pr,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 Pr,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(Wte)))}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 Pr;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class DH extends Hn{constructor(e,t,r,i,s,o,a,l,A,c){if(c=c!==void 0?c:Rc,c!==Rc&&c!==Lh)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&c===Rc&&(r=bc),r===void 0&&c===Lh&&(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:Xn,this.minFilter=l!==void 0?l:Xn,this.flipY=!1,this.generateMipmaps=!1}}class Kte extends KA{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 Ht;const T=new Br;T.layers.enable(2),T.viewport=new Ht;const b=[C,T],M=new jte;M.layers.enable(1),M.layers.enable(2);let D=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(E){let G=y[E];return G===void 0&&(G=new rb,y[E]=G),G.getTargetRaySpace()},this.getControllerGrip=function(E){let G=y[E];return G===void 0&&(G=new rb,y[E]=G),G.getGripSpace()},this.getHand=function(E){let G=y[E];return G===void 0&&(G=new rb,y[E]=G),G.getHandSpace()};function H(E){const G=w.indexOf(E.inputSource);if(G===-1)return;const ee=y[G];ee!==void 0&&ee.dispatchEvent({type:E.type,data:E.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 E=0;E=0&&(w[U]=null,y[U].disconnect(ee))}for(let G=0;G=w.length){w.push(ee),U=ae;break}else if(w[ae]===null){w[ae]=ee,U=ae;break}if(U===-1)break}const X=y[U];X&&X.connect(ee)}}const B=new Z,F=new Z;function P(E,G,ee){B.setFromMatrixPosition(G.matrixWorld),F.setFromMatrixPosition(ee.matrixWorld);const U=B.distanceTo(F),X=G.projectionMatrix.elements,ae=ee.projectionMatrix.elements,oe=X[14]/(X[10]-1),de=X[14]/(X[10]+1),se=(X[9]+1)/X[5],pe=(X[9]-1)/X[5],_e=(X[8]-1)/X[0],xe=(ae[8]+1)/ae[0],L=oe*_e,ue=oe*xe,Ae=U/(-_e+xe),q=Ae*-_e;G.matrixWorld.decompose(E.position,E.quaternion,E.scale),E.translateX(q),E.translateZ(Ae),E.matrixWorld.compose(E.position,E.quaternion,E.scale),E.matrixWorldInverse.copy(E.matrixWorld).invert();const J=oe+Ae,ce=de+Ae,be=L-q,Be=ue+(U-q),k=se*de/ce*J,W=pe*de/ce*J;E.projectionMatrix.makePerspective(be,Be,k,W,J,ce)}function O(E,G){G===null?E.matrixWorld.copy(E.matrix):E.matrixWorld.multiplyMatrices(G.matrixWorld,E.matrix),E.matrixWorldInverse.copy(E.matrixWorld).invert()}this.updateCamera=function(E){if(i===null)return;M.near=T.near=C.near=E.near,M.far=T.far=C.far=E.far,(D!==M.near||Y!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),D=M.near,Y=M.far);const G=E.parent,ee=M.cameras;O(M,G);for(let X=0;XX&&(_.set(U,U.lastChangedTime),r.dispatchEvent({type:"planechanged",data:U}))}}p=null}const Q=new RH;Q.setAnimationLoop(K),this.setAnimationLoop=function(E){z=E},this.dispose=function(){}}}function Yte(n,e){function t(d,g){g.color.getRGB(d.fogColor.value,SH(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===qr&&(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===qr&&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===qr&&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 Xte(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 $te(){const n=Qm("canvas");return n.style.display="block",n}function dg(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:$te(),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=wl,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 Ht,T=new Ht;let b=null,M=e.width,D=e.height,Y=1,H=null,I=null;const v=new Ht(0,0,M,D),B=new Ht(0,0,M,D);let F=!1;const P=new KS;let O=!1,z=!1,K=null;const Q=new We,E=new Ye,G=new Z,ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function U(){return w===null?Y:1}let X=t;function ae(ne,ve){for(let Ee=0;Ee0?f=p[p.length-1]:f=null,h.pop(),h.length>0?u=h[h.length-1]:u=null};function ft(ne,ve,Ee,we){if(ne.visible===!1)return;if(ne.layers.test(ve.layers)){if(ne.isGroup)Ee=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(ve);else if(ne.isLight)f.pushLight(ne),ne.castShadow&&f.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||P.intersectsSprite(ne)){we&&G.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(Q);const st=J.update(ne),Xe=ne.material;Xe.visible&&u.push(ne,st,Xe,Ee,G.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&&G.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(Q);const st=J.update(ne),Xe=ne.material;if(Array.isArray(Xe)){const $e=st.groups;for(let gt=0,dt=$e.length;gt0&&Ct(Ce,ve,Ee),we&&se.viewport(C.copy(we)),Ce.length>0&&it(Ce,ve,Ee),ze.length>0&&it(ze,ve,Ee),st.length>0&&it(st,ve,Ee),se.buffers.depth.setTest(!0),se.buffers.depth.setMask(!0),se.buffers.color.setMask(!0),se.setPolygonOffset(!1)}function Ct(ne,ve,Ee){const we=de.isWebGL2;K===null&&(K=new da(1,1,{generateMipmaps:!0,type:oe.has("EXT_color_buffer_half_float")?Om:jc,minFilter:PA,samples:we&&s===!0?4:0})),d.getDrawingBufferSize(E),we?K.setSize(E.x,E.y):K.setSize(uw(E.x),uw(E.y));const Ce=d.getRenderTarget();d.setRenderTarget(K),d.clear();const ze=d.toneMapping;d.toneMapping=al,it(ne,ve,Ee),d.toneMapping=ze,xe.updateMultisampleRenderTarget(K),xe.updateRenderTargetMipmap(K),d.setRenderTarget(Ce)}function it(ne,ve,Ee){const we=ve.isScene===!0?ve.overrideMaterial:null;for(let Ce=0,ze=ne.length;Ce0&&xe.useMultisampledRTT(ne)===!1?Ce=_e.get(ne).__webglMultisampledFramebuffer:Ce=dt,C.copy(ne.viewport),T.copy(ne.scissor),b=ne.scissorTest}else C.copy(v).multiplyScalar(Y).floor(),T.copy(B).multiplyScalar(Y).floor(),b=F;if(se.bindFramebuffer(36160,Ce)&&de.drawBuffers&&we&&se.drawBuffers(ne,Ce),se.viewport(C),se.scissor(T),se.setScissorTest(b),ze){const $e=_e.get(ne.texture);X.framebufferTexture2D(36160,36064,34069+ve,$e.__webglTexture,Ee)}else if(st){const $e=_e.get(ne.texture),gt=ve||0;X.framebufferTextureLayer(36160,36064,$e.__webglTexture,Ee||0,gt)}x=-1},this.readRenderTargetPixels=function(ne,ve,Ee,we,Ce,ze,st){if(!(ne&&ne.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Xe=_e.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&st!==void 0&&(Xe=Xe[st]),Xe){se.bindFramebuffer(36160,Xe);try{const $e=ne.texture,gt=$e.format,dt=$e.type;if(gt!==Lr&&S.convert(gt)!==X.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ct=dt===Om&&(oe.has("EXT_color_buffer_half_float")||de.isWebGL2&&oe.has("EXT_color_buffer_float"));if(dt!==jc&&S.convert(dt)!==X.getParameter(35738)&&!(dt===AA&&(de.isWebGL2||oe.has("OES_texture_float")||oe.has("WEBGL_color_buffer_float")))&&!ct){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ve>=0&&ve<=ne.width-we&&Ee>=0&&Ee<=ne.height-Ce&&X.readPixels(ve,Ee,we,Ce,S.convert(gt),S.convert(dt),ze)}finally{const $e=w!==null?_e.get(w).__webglFramebuffer:null;se.bindFramebuffer(36160,$e)}}},this.copyFramebufferToTexture=function(ne,ve,Ee=0){const we=Math.pow(2,-Ee),Ce=Math.floor(ve.image.width*we),ze=Math.floor(ve.image.height*we);xe.setTexture2D(ve,0),X.copyTexSubImage2D(3553,Ee,0,0,ne.x,ne.y,Ce,ze),se.unbindTexture()},this.copyTextureToTexture=function(ne,ve,Ee,we=0){const Ce=ve.image.width,ze=ve.image.height,st=S.convert(Ee.format),Xe=S.convert(Ee.type);xe.setTexture2D(Ee,0),X.pixelStorei(37440,Ee.flipY),X.pixelStorei(37441,Ee.premultiplyAlpha),X.pixelStorei(3317,Ee.unpackAlignment),ve.isDataTexture?X.texSubImage2D(3553,we,ne.x,ne.y,Ce,ze,st,Xe,ve.image.data):ve.isCompressedTexture?X.compressedTexSubImage2D(3553,we,ne.x,ne.y,ve.mipmaps[0].width,ve.mipmaps[0].height,st,ve.mipmaps[0].data):X.texSubImage2D(3553,we,ne.x,ne.y,st,Xe,ve.image),we===0&&Ee.generateMipmaps&&X.generateMipmap(3553),se.unbindTexture()},this.copyTextureToTexture3D=function(ne,ve,Ee,we,Ce=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,Xe=ne.max.z-ne.min.z+1,$e=S.convert(we.format),gt=S.convert(we.type);let dt;if(we.isData3DTexture)xe.setTexture3D(we,0),dt=32879;else if(we.isDataArrayTexture)xe.setTexture2DArray(we,0),dt=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 ct=X.getParameter(3314),Wt=X.getParameter(32878),vn=X.getParameter(3316),Hr=X.getParameter(3315),ki=X.getParameter(32877),yn=Ee.isCompressedTexture?Ee.mipmaps[0]:Ee.image;X.pixelStorei(3314,yn.width),X.pixelStorei(32878,yn.height),X.pixelStorei(3316,ne.min.x),X.pixelStorei(3315,ne.min.y),X.pixelStorei(32877,ne.min.z),Ee.isDataTexture||Ee.isData3DTexture?X.texSubImage3D(dt,Ce,ve.x,ve.y,ve.z,ze,st,Xe,$e,gt,yn.data):Ee.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),X.compressedTexSubImage3D(dt,Ce,ve.x,ve.y,ve.z,ze,st,Xe,$e,yn.data)):X.texSubImage3D(dt,Ce,ve.x,ve.y,ve.z,ze,st,Xe,$e,gt,yn),X.pixelStorei(3314,ct),X.pixelStorei(32878,Wt),X.pixelStorei(3316,vn),X.pixelStorei(3315,Hr),X.pixelStorei(32877,ki),Ce===0&&we.generateMipmaps&&X.generateMipmap(dt),se.unbindTexture()},this.initTexture=function(ne){ne.isCubeTexture?xe.setTextureCube(ne,0):ne.isData3DTexture?xe.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?xe.setTexture2DArray(ne,0):xe.setTexture2D(ne,0),se.unbindTexture()},this.resetState=function(){m=0,y=0,w=null,se.reset(),j.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class Zte extends dg{}Zte.prototype.isWebGL1Renderer=!0;class fw 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 Jte{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=ZE,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Bo()}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 ine{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 Ye: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 We;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(dr(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(dr(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 Dx extends Kt{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 T=(t-e)/r;for(let b=0;b<=s;b++){const M=[],D=b/s,Y=D*(t-e)+e;for(let H=0;H<=i;H++){const I=H/i,v=I*l+a,B=Math.sin(v),F=Math.cos(v);_.x=Y*B,_.y=-D*r+g,_.z=Y*F,u.push(_.x,_.y,_.z),x.set(B,T,F).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 sb extends Li{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ke(16777215),this.specular=new ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$h,this.normalScale=new Ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Rx,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 sne extends Li{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$h,this.normalScale=new Ye(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 one extends Li{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$h,this.normalScale=new Ye(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Rx,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 kH(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function I0(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 kH(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function ane(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 MU(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 QH(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 mg{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&&kH(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()===F1,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}}wa.prototype.TimeBufferType=Float32Array;wa.prototype.ValueBufferType=Float32Array;wa.prototype.DefaultInterpolation=Wc;class ed extends wa{}ed.prototype.ValueTypeName="bool";ed.prototype.ValueBufferType=Array;ed.prototype.DefaultInterpolation=Ph;ed.prototype.InterpolantFactoryMethodLinear=void 0;ed.prototype.InterpolantFactoryMethodSmooth=void 0;class zH extends wa{}zH.prototype.ValueTypeName="color";class Nh extends wa{}Nh.prototype.ValueTypeName="number";class cne extends mg{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 pa extends wa{InterpolantFactoryMethodLinear(e){return new cne(this.times,this.values,this.getValueSize(),e)}}pa.prototype.ValueTypeName="quaternion";pa.prototype.DefaultInterpolation=Wc;pa.prototype.InterpolantFactoryMethodSmooth=void 0;class td extends wa{}td.prototype.ValueTypeName="string";td.prototype.ValueBufferType=Array;td.prototype.DefaultInterpolation=Ph;td.prototype.InterpolantFactoryMethodLinear=void 0;td.prototype.InterpolantFactoryMethodSmooth=void 0;class DA extends wa{}DA.prototype.ValueTypeName="vector";class Kc{constructor(e,t=-1,r,i=zS){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=Bo(),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(fne(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(wa.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=[];QH(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(Fa[e]!==void 0){Fa[e].push({onLoad:t,onProgress:r,onError:i});return}Fa[e]=[],Fa[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=Fa[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,T=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=>{kh.add(e,A);const c=Fa[e];delete Fa[e];for(let u=0,f=c.length;u{const c=Fa[e];if(c===void 0)throw this.manager.itemError(e),A;delete Fa[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 VH extends nd{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=kh.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Qm("img");function l(){c(),kh.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 ou extends nd{constructor(e){super(e)}load(e,t,r,i){const s=new Hn,o=new VH(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 Ox extends It{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ke(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 ob=new We,SU=new Z,TU=new Z;class JS{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ye(512,512),this.map=null,this.mapPass=null,this.matrix=new We,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new KS,this._frameExtents=new Ye(1,1),this._viewportCount=1,this._viewports=[new Ht(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;SU.setFromMatrixPosition(e.matrixWorld),t.position.copy(SU),TU.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(TU),t.updateMatrixWorld(),ob.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ob),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(ob)}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 pne extends JS{constructor(){super(new Br(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=km*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 jH extends Ox{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 pne}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 IU=new We,Qd=new Z,ab=new Z;class mne extends JS{constructor(){super(new Br(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ye(4,2),this._viewportCount=6,this._viewports=[new Ht(2,1,1,1),new Ht(0,1,1,1),new Ht(3,1,1,1),new Ht(1,1,1,1),new Ht(3,0,1,1),new Ht(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()),Qd.setFromMatrixPosition(e.matrixWorld),r.position.copy(Qd),ab.copy(r.position),ab.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(ab),r.updateMatrixWorld(),i.makeTranslation(-Qd.x,-Qd.y,-Qd.z),IU.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(IU)}}class nC extends Ox{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 mne}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 gne extends JS{constructor(){super(new Zh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class qS extends Ox{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 gne}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class WH extends Ox{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class pw{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=kh.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){kh.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 KH{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=RU(),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=RU();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function RU(){return(typeof performance>"u"?Date:performance).now()}class yne{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 eT="\\[\\]\\.:\\/",wne=new RegExp("["+eT+"]","g"),tT="[^"+eT+"]",xne="[^"+eT.replace("\\.","")+"]",_ne=/((?:WC+[\/:])*)/.source.replace("WC",tT),bne=/(WCOD+)?/.source.replace("WCOD",xne),Bne=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",tT),Ene=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",tT),Cne=new RegExp("^"+_ne+bne+Bne+Ene+"$"),Mne=["material","materials","bones","map"];class Sne{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(wne,"")}static parseTrackName(e){const t=Cne.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);Mne.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 P$:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].accumulateAdditive(a);break;case zS: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===L$;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===F$){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=zf,i.endingEnd=zf):(e?i.endingStart=this.zeroSlopeAtStart?zf:Hf:i.endingStart=cw,t?i.endingEnd=this.zeroSlopeAtEnd?zf:Hf:i.endingEnd=cw)}_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 Ine=new Float32Array(1);class Rne extends KA{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 yne(_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&&(He-=Ie),De<-Math.PI?De+=Ie:De>Math.PI&&(De-=Ie),He<=De?a.theta=Math.max(He,Math.min(De,a.theta)):a.theta=a.theta>(He+De)/2?Math.max(He,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),S.setFromSpherical(a),S.applyQuaternion(te),Le.copy(r.target).add(S),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||le.distanceToSquared(r.object.position)>o||8*(1-ie.dot(r.object.quaternion))>o?(r.dispatchEvent(DU),le.copy(r.object.position),ie.copy(r.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",re),r.domElement.removeEventListener("pointerdown",L),r.domElement.removeEventListener("pointercancel",q),r.domElement.removeEventListener("wheel",be),r.domElement.removeEventListener("pointermove",ue),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 LU,l=new LU;let A=1;const c=new Z;let u=!1;const f=new Ye,h=new Ye,p=new Ye,d=new Ye,g=new Ye,m=new Ye,y=new Ye,w=new Ye,x=new Ye,_=[],C={};function T(){return 2*Math.PI/60/60*r.autoRotateSpeed}function b(){return Math.pow(.95,r.zoomSpeed)}function M(S){l.theta-=S}function D(S){l.phi-=S}const Y=function(){const S=new Z;return function(te,le){S.setFromMatrixColumn(le,0),S.multiplyScalar(-te),c.add(S)}}(),H=function(){const S=new Z;return function(te,le){r.screenSpacePanning===!0?S.setFromMatrixColumn(le,1):(S.setFromMatrixColumn(le,0),S.crossVectors(r.object.up,S)),S.multiplyScalar(te),c.add(S)}}(),I=function(){const S=new Z;return function(te,le){const ie=r.domElement;if(r.object.isPerspectiveCamera){const Ie=r.object.position;S.copy(Ie).sub(r.target);let Te=S.length();Te*=Math.tan(r.object.fov/2*Math.PI/180),Y(2*te*Te/ie.clientHeight,r.object.matrix),H(2*le*Te/ie.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(Y(te*(r.object.right-r.object.left)/r.object.zoom/ie.clientWidth,r.object.matrix),H(le*(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(S){r.object.isPerspectiveCamera?A/=S:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*S)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function B(S){r.object.isPerspectiveCamera?A*=S:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/S)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function F(S){f.set(S.clientX,S.clientY)}function P(S){y.set(S.clientX,S.clientY)}function O(S){d.set(S.clientX,S.clientY)}function z(S){h.set(S.clientX,S.clientY),p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const j=r.domElement;M(2*Math.PI*p.x/j.clientHeight),D(2*Math.PI*p.y/j.clientHeight),f.copy(h),r.update()}function K(S){w.set(S.clientX,S.clientY),x.subVectors(w,y),x.y>0?v(b()):x.y<0&&B(b()),y.copy(w),r.update()}function Q(S){g.set(S.clientX,S.clientY),m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g),r.update()}function E(S){S.deltaY<0?B(b()):S.deltaY>0&&v(b()),r.update()}function G(S){let j=!1;switch(S.code){case r.keys.UP:S.ctrlKey||S.metaKey||S.shiftKey?D(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,r.keyPanSpeed),j=!0;break;case r.keys.BOTTOM:S.ctrlKey||S.metaKey||S.shiftKey?D(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,-r.keyPanSpeed),j=!0;break;case r.keys.LEFT:S.ctrlKey||S.metaKey||S.shiftKey?M(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(r.keyPanSpeed,0),j=!0;break;case r.keys.RIGHT:S.ctrlKey||S.metaKey||S.shiftKey?M(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(-r.keyPanSpeed,0),j=!0;break}j&&(S.preventDefault(),r.update())}function ee(){if(_.length===1)f.set(_[0].pageX,_[0].pageY);else{const S=.5*(_[0].pageX+_[1].pageX),j=.5*(_[0].pageY+_[1].pageY);f.set(S,j)}}function U(){if(_.length===1)d.set(_[0].pageX,_[0].pageY);else{const S=.5*(_[0].pageX+_[1].pageX),j=.5*(_[0].pageY+_[1].pageY);d.set(S,j)}}function X(){const S=_[0].pageX-_[1].pageX,j=_[0].pageY-_[1].pageY,te=Math.sqrt(S*S+j*j);y.set(0,te)}function ae(){r.enableZoom&&X(),r.enablePan&&U()}function oe(){r.enableZoom&&X(),r.enableRotate&&ee()}function de(S){if(_.length==1)h.set(S.pageX,S.pageY);else{const te=R(S),le=.5*(S.pageX+te.x),ie=.5*(S.pageY+te.y);h.set(le,ie)}p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const j=r.domElement;M(2*Math.PI*p.x/j.clientHeight),D(2*Math.PI*p.y/j.clientHeight),f.copy(h)}function se(S){if(_.length===1)g.set(S.pageX,S.pageY);else{const j=R(S),te=.5*(S.pageX+j.x),le=.5*(S.pageY+j.y);g.set(te,le)}m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g)}function pe(S){const j=R(S),te=S.pageX-j.x,le=S.pageY-j.y,ie=Math.sqrt(te*te+le*le);w.set(0,ie),x.set(0,Math.pow(w.y/y.y,r.zoomSpeed)),v(x.y),y.copy(w)}function _e(S){r.enableZoom&&pe(S),r.enablePan&&se(S)}function xe(S){r.enableZoom&&pe(S),r.enableRotate&&de(S)}function L(S){r.enabled!==!1&&(_.length===0&&(r.domElement.setPointerCapture(S.pointerId),r.domElement.addEventListener("pointermove",ue),r.domElement.addEventListener("pointerup",Ae)),he(S),S.pointerType==="touch"?k(S):J(S))}function ue(S){r.enabled!==!1&&(S.pointerType==="touch"?W(S):ce(S))}function Ae(S){me(S),_.length===0&&(r.domElement.releasePointerCapture(S.pointerId),r.domElement.removeEventListener("pointermove",ue),r.domElement.removeEventListener("pointerup",Ae)),r.dispatchEvent(OU),s=i.NONE}function q(S){me(S)}function J(S){let j;switch(S.button){case 0:j=r.mouseButtons.LEFT;break;case 1:j=r.mouseButtons.MIDDLE;break;case 2:j=r.mouseButtons.RIGHT;break;default:j=-1}switch(j){case vu.DOLLY:if(r.enableZoom===!1)return;P(S),s=i.DOLLY;break;case vu.ROTATE:if(S.ctrlKey||S.metaKey||S.shiftKey){if(r.enablePan===!1)return;O(S),s=i.PAN}else{if(r.enableRotate===!1)return;F(S),s=i.ROTATE}break;case vu.PAN:if(S.ctrlKey||S.metaKey||S.shiftKey){if(r.enableRotate===!1)return;F(S),s=i.ROTATE}else{if(r.enablePan===!1)return;O(S),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(lb)}function ce(S){switch(s){case i.ROTATE:if(r.enableRotate===!1)return;z(S);break;case i.DOLLY:if(r.enableZoom===!1)return;K(S);break;case i.PAN:if(r.enablePan===!1)return;Q(S);break}}function be(S){r.enabled===!1||r.enableZoom===!1||s!==i.NONE||(S.preventDefault(),r.dispatchEvent(lb),E(S),r.dispatchEvent(OU))}function Be(S){r.enabled===!1||r.enablePan===!1||G(S)}function k(S){switch(V(S),_.length){case 1:switch(r.touches.ONE){case yu.ROTATE:if(r.enableRotate===!1)return;ee(),s=i.TOUCH_ROTATE;break;case yu.PAN:if(r.enablePan===!1)return;U(),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(r.touches.TWO){case yu.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ae(),s=i.TOUCH_DOLLY_PAN;break;case yu.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;oe(),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(lb)}function W(S){switch(V(S),s){case i.TOUCH_ROTATE:if(r.enableRotate===!1)return;de(S),r.update();break;case i.TOUCH_PAN:if(r.enablePan===!1)return;se(S),r.update();break;case i.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;_e(S),r.update();break;case i.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;xe(S),r.update();break;default:s=i.NONE}}function re(S){r.enabled!==!1&&S.preventDefault()}function he(S){_.push(S)}function me(S){delete C[S.pointerId];for(let j=0;j<_.length;j++)if(_[j].pointerId==S.pointerId){_.splice(j,1);return}}function V(S){let j=C[S.pointerId];j===void 0&&(j=new Ye,C[S.pointerId]=j),j.set(S.pageX,S.pageY)}function R(S){const j=S.pointerId===_[0].pointerId?_[1]:_[0];return C[j.pointerId]}r.domElement.addEventListener("contextmenu",re),r.domElement.addEventListener("pointerdown",L),r.domElement.addEventListener("pointercancel",q),r.domElement.addEventListener("wheel",be,{passive:!1}),this.update()}}function XH(n){let e,t,r,i=0;for(let a=0;a=2.0 are supported."));return}const A=new lre(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 Lne(){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 Qt={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 Pne{constructor(e){this.parser=e,this.name=Qt.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 Wne{constructor(e){this.parser=e,this.name=Qt.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 Kne{constructor(e){this.name=Qt.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 Yne{constructor(e){this.name=Qt.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 We,g=new Z,m=new rt,y=new Z(1,1,1),w=new Px(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 are=new We;class lre{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Lne,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 ou(this.options.manager):this.textureLoader=new vne(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ZS(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:{}};zd(s,a,i),$l(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[T*l+1]),l>=3&&g.setZ(M,C[T*l+2]),l>=4&&g.setW(M,C[T*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=QU[f.magFilter]||li,c.minFilter=QU[f.minFilter]||PA,c.wrapS=HU[f.wrapS]||cs,c.wrapT=HU[f.wrapT]||cs,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 Hn(d);g.needsUpdate=!0,f(g)}),t.load(pw.resolveURL(u,s.path),p,void 0,h)})}).then(function(u){return A===!0&&a.revokeObjectURL(l),u.userData.mimeType=o.mimeType||ore(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[Qt.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[Qt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Qt.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 NH,Li.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,Li.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 Oh}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[Qt.KHR_MATERIALS_UNLIT]){const u=i[Qt.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),A.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new ke(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,wt)),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=hi);const c=s.alphaMode||cb.OPAQUE;if(c===cb.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===cb.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Mi&&(A.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ye(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}return s.occlusionTexture!==void 0&&o!==Mi&&(A.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Mi&&(a.emissive=new ke().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==Mi&&A.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,wt)),Promise.all(A).then(function(){const u=new o(a);return s.name&&(u.name=s.name),$l(u,s),t.associations.set(u,{materials:e}),s.extensions&&zd(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[Qt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return GU(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&ire(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),$l(m,s),g.extensions&&zd(i,m,g),t.assignFinalMaterial(m),u.push(m)}for(let h=0,p=u.length;h1?u=new Pr: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 Li||f instanceof Hn)&&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 Are(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=sC(lh[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 U=this.type!==wp?{minFilter:Xn,magFilter:Xn}:{};v.map=new da(i.x,i.y,U),v.map.texture.name=I.name+".shadowMap",v.camera.updateProjectionMatrix()}n.setRenderTarget(v.map),n.clear();const L=v.getViewportCount();for(let U=0;U0||_.map&&_.alphaTest>0){const H=O.uuid,I=_.uuid;let v=A[H];v===void 0&&(v={},A[H]=v);let E=v[I];E===void 0&&(E=O.clone(),v[I]=E),O=E}return O.visible=_.visible,O.wireframe=_.wireframe,M===wp?O.side=_.shadowSide!==null?_.shadowSide:_.side:O.side=_.shadowSide!==null?_.shadowSide:u[_.side],O.alphaMap=_.alphaMap,O.alphaTest=_.alphaTest,O.map=_.map,O.clipShadows=_.clipShadows,O.clippingPlanes=_.clippingPlanes,O.clipIntersection=_.clipIntersection,O.displacementMap=_.displacementMap,O.displacementScale=_.displacementScale,O.displacementBias=_.displacementBias,O.wireframeLinewidth=_.wireframeLinewidth,O.linewidth=_.linewidth,B.isPointLight===!0&&O.isMeshDistanceMaterial===!0&&(O.referencePosition.setFromMatrixPosition(B.matrixWorld),O.nearDistance=T,O.farDistance=b),O}function w(x,_,B,T,b){if(x.visible===!1)return;if(x.layers.test(_.layers)&&(x.isMesh||x.isLine||x.isPoints)&&(x.castShadow||x.receiveShadow&&b===wp)&&(!x.frustumCulled||r.intersectsObject(x))){x.modelViewMatrix.multiplyMatrices(B.matrixWorldInverse,x.matrixWorld);const Y=e.update(x),H=x.material;if(Array.isArray(H)){const I=Y.groups;for(let v=0,E=I.length;v=1):P.indexOf("OpenGL ES")!==-1&&(U=parseFloat(/^OpenGL ES (\d)/.exec(P)[1]),L=U>=2);let z=null,W={};const N=n.getParameter(3088),C=n.getParameter(2978),j=new Ht().fromArray(N),ee=new Ht().fromArray(C);function F(he,Me,Se){const Fe=new Uint8Array(4),Ve=n.createTexture();n.bindTexture(he,Ve),n.texParameteri(he,10241,9728),n.texParameteri(he,10240,9728);for(let Je=0;Je"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(Q,K){return m?new OffscreenCanvas(Q,K):Qm("canvas")}function w(Q,K,ie,de){let me=1;if((Q.width>de||Q.height>de)&&(me=de/Math.max(Q.width,Q.height)),me<1||K===!0)if(typeof HTMLImageElement<"u"&&Q instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&Q instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&Q instanceof ImageBitmap){const G=K?uw:Math.floor,R=G(me*Q.width),S=G(me*Q.height);d===void 0&&(d=y(R,S));const V=ie?y(R,S):d;return V.width=R,V.height=S,V.getContext("2d").drawImage(Q,0,0,R,S),console.warn("THREE.WebGLRenderer: Texture has been resized from ("+Q.width+"x"+Q.height+") to ("+R+"x"+S+")."),V}else return"data"in Q&&console.warn("THREE.WebGLRenderer: Image in DataTexture is too big ("+Q.width+"x"+Q.height+")."),Q;return Q}function x(Q){return eC(Q.width)&&eC(Q.height)}function _(Q){return a?!1:Q.wrapS!==ui||Q.wrapT!==ui||Q.minFilter!==Xn&&Q.minFilter!==li}function B(Q,K){return Q.generateMipmaps&&K&&Q.minFilter!==Xn&&Q.minFilter!==li}function T(Q){n.generateMipmap(Q)}function b(Q,K,ie,de,me=!1){if(a===!1)return K;if(Q!==null){if(n[Q]!==void 0)return n[Q];console.warn("THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '"+Q+"'")}let G=K;return K===6403&&(ie===5126&&(G=33326),ie===5131&&(G=33325),ie===5121&&(G=33321)),K===33319&&(ie===5126&&(G=33328),ie===5131&&(G=33327),ie===5121&&(G=33323)),K===6408&&(ie===5126&&(G=34836),ie===5131&&(G=34842),ie===5121&&(G=de===wt&&me===!1?35907:32856),ie===32819&&(G=32854),ie===32820&&(G=32855)),(G===33325||G===33326||G===33327||G===33328||G===34842||G===34836)&&e.get("EXT_color_buffer_float"),G}function M(Q,K,ie){return B(Q,ie)===!0||Q.isFramebufferTexture&&Q.minFilter!==Xn&&Q.minFilter!==li?Math.log2(Math.max(K.width,K.height))+1:Q.mipmaps!==void 0&&Q.mipmaps.length>0?Q.mipmaps.length:Q.isCompressedTexture&&Array.isArray(Q.image)?K.mipmaps.length:1}function O(Q){return Q===Xn||Q===Aw||Q===Jp?9728:9729}function Y(Q){const K=Q.target;K.removeEventListener("dispose",Y),I(K),K.isVideoTexture&&p.delete(K)}function H(Q){const K=Q.target;K.removeEventListener("dispose",H),E(K)}function I(Q){const K=r.get(Q);if(K.__webglInit===void 0)return;const ie=Q.source,de=g.get(ie);if(de){const me=de[K.__cacheKey];me.usedTimes--,me.usedTimes===0&&v(Q),Object.keys(de).length===0&&g.delete(ie)}r.remove(Q)}function v(Q){const K=r.get(Q);n.deleteTexture(K.__webglTexture);const ie=Q.source,de=g.get(ie);delete de[K.__cacheKey],o.memory.textures--}function E(Q){const K=Q.texture,ie=r.get(Q),de=r.get(K);if(de.__webglTexture!==void 0&&(n.deleteTexture(de.__webglTexture),o.memory.textures--),Q.depthTexture&&Q.depthTexture.dispose(),Q.isWebGLCubeRenderTarget)for(let me=0;me<6;me++)n.deleteFramebuffer(ie.__webglFramebuffer[me]),ie.__webglDepthbuffer&&n.deleteRenderbuffer(ie.__webglDepthbuffer[me]);else{if(n.deleteFramebuffer(ie.__webglFramebuffer),ie.__webglDepthbuffer&&n.deleteRenderbuffer(ie.__webglDepthbuffer),ie.__webglMultisampledFramebuffer&&n.deleteFramebuffer(ie.__webglMultisampledFramebuffer),ie.__webglColorRenderbuffer)for(let me=0;me=l&&console.warn("THREE.WebGLTextures: Trying to use "+Q+" texture units while this GPU supports only "+l),L+=1,Q}function z(Q){const K=[];return K.push(Q.wrapS),K.push(Q.wrapT),K.push(Q.wrapR||0),K.push(Q.magFilter),K.push(Q.minFilter),K.push(Q.anisotropy),K.push(Q.internalFormat),K.push(Q.format),K.push(Q.type),K.push(Q.generateMipmaps),K.push(Q.premultiplyAlpha),K.push(Q.flipY),K.push(Q.unpackAlignment),K.push(Q.encoding),K.join()}function W(Q,K){const ie=r.get(Q);if(Q.isVideoTexture&&be(Q),Q.isRenderTargetTexture===!1&&Q.version>0&&ie.__version!==Q.version){const de=Q.image;if(de===null)console.warn("THREE.WebGLRenderer: Texture marked for update but no image data found.");else if(de.complete===!1)console.warn("THREE.WebGLRenderer: Texture marked for update but image is incomplete");else{re(ie,Q,K);return}}t.bindTexture(3553,ie.__webglTexture,33984+K)}function N(Q,K){const ie=r.get(Q);if(Q.version>0&&ie.__version!==Q.version){re(ie,Q,K);return}t.bindTexture(35866,ie.__webglTexture,33984+K)}function C(Q,K){const ie=r.get(Q);if(Q.version>0&&ie.__version!==Q.version){re(ie,Q,K);return}t.bindTexture(32879,ie.__webglTexture,33984+K)}function j(Q,K){const ie=r.get(Q);if(Q.version>0&&ie.__version!==Q.version){fe(ie,Q,K);return}t.bindTexture(34067,ie.__webglTexture,33984+K)}const ee={[cs]:10497,[ui]:33071,[Dm]:33648},F={[Xn]:9728,[Aw]:9984,[Jp]:9986,[li]:9729,[zS]:9985,[PA]:9987};function X(Q,K,ie){if(ie?(n.texParameteri(Q,10242,ee[K.wrapS]),n.texParameteri(Q,10243,ee[K.wrapT]),(Q===32879||Q===35866)&&n.texParameteri(Q,32882,ee[K.wrapR]),n.texParameteri(Q,10240,F[K.magFilter]),n.texParameteri(Q,10241,F[K.minFilter])):(n.texParameteri(Q,10242,33071),n.texParameteri(Q,10243,33071),(Q===32879||Q===35866)&&n.texParameteri(Q,32882,33071),(K.wrapS!==ui||K.wrapT!==ui)&&console.warn("THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping."),n.texParameteri(Q,10240,O(K.magFilter)),n.texParameteri(Q,10241,O(K.minFilter)),K.minFilter!==Xn&&K.minFilter!==li&&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 de=e.get("EXT_texture_filter_anisotropic");if(K.magFilter===Xn||K.minFilter!==Jp&&K.minFilter!==PA||K.type===AA&&e.has("OES_texture_float_linear")===!1||a===!1&&K.type===Om&&e.has("OES_texture_half_float_linear")===!1)return;(K.anisotropy>1||r.get(K).__currentAnisotropy)&&(n.texParameterf(Q,de.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(K.anisotropy,i.getMaxAnisotropy())),r.get(K).__currentAnisotropy=K.anisotropy)}}function ue(Q,K){let ie=!1;Q.__webglInit===void 0&&(Q.__webglInit=!0,K.addEventListener("dispose",Y));const de=K.source;let me=g.get(de);me===void 0&&(me={},g.set(de,me));const G=z(K);if(G!==Q.__cacheKey){me[G]===void 0&&(me[G]={texture:n.createTexture(),usedTimes:0},o.memory.textures++,ie=!0),me[G].usedTimes++;const R=me[Q.__cacheKey];R!==void 0&&(me[Q.__cacheKey].usedTimes--,R.usedTimes===0&&v(K)),Q.__cacheKey=G,Q.__webglTexture=me[G].texture}return ie}function re(Q,K,ie){let de=3553;(K.isDataArrayTexture||K.isCompressedArrayTexture)&&(de=35866),K.isData3DTexture&&(de=32879);const me=ue(Q,K),G=K.source;t.bindTexture(de,Q.__webglTexture,33984+ie);const R=r.get(G);if(G.version!==R.__version||me===!0){t.activeTexture(33984+ie),n.pixelStorei(37440,K.flipY),n.pixelStorei(37441,K.premultiplyAlpha),n.pixelStorei(3317,K.unpackAlignment),n.pixelStorei(37443,0);const S=_(K)&&x(K.image)===!1;let V=w(K.image,S,!1,c);V=Be(K,V);const te=x(V)||a,ae=s.convert(K.format,K.encoding);let se=s.convert(K.type),Ie=b(K.internalFormat,ae,se,K.encoding,K.isVideoTexture);X(de,K,te);let Te;const Le=K.mipmaps,He=a&&K.isVideoTexture!==!0,De=R.__version===void 0||me===!0,he=M(K,V,te);if(K.isDepthTexture)Ie=6402,a?K.type===AA?Ie=36012:K.type===bc?Ie=33190:K.type===ah?Ie=35056:Ie=33189:K.type===AA&&console.error("WebGLRenderer: Floating point depth texture requires WebGL2."),K.format===Rc&&Ie===6402&&K.type!==xH&&K.type!==bc&&(console.warn("THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture."),K.type=bc,se=s.convert(K.type)),K.format===Lh&&Ie===6402&&(Ie=34041,K.type!==ah&&(console.warn("THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture."),K.type=ah,se=s.convert(K.type))),De&&(He?t.texStorage2D(3553,1,Ie,V.width,V.height):t.texImage2D(3553,0,Ie,V.width,V.height,0,ae,se,null));else if(K.isDataTexture)if(Le.length>0&&te){He&&De&&t.texStorage2D(3553,he,Ie,Le[0].width,Le[0].height);for(let Me=0,Se=Le.length;Me>=1,Se>>=1}}else if(Le.length>0&&te){He&&De&&t.texStorage2D(3553,he,Ie,Le[0].width,Le[0].height);for(let Me=0,Se=Le.length;Me0&&De++,t.texStorage2D(34067,De,Te,V[0].width,V[0].height));for(let Me=0;Me<6;Me++)if(S){Le?t.texSubImage2D(34069+Me,0,0,0,V[Me].width,V[Me].height,se,Ie,V[Me].data):t.texImage2D(34069+Me,0,Te,V[Me].width,V[Me].height,0,se,Ie,V[Me].data);for(let Se=0;Se=34069&&me<=34074)&&n.framebufferTexture2D(36160,de,me,r.get(ie).__webglTexture,0),t.bindFramebuffer(36160,null)}function pe(Q,K,ie){if(n.bindRenderbuffer(36161,Q),K.depthBuffer&&!K.stencilBuffer){let de=33189;if(ie||ce(K)){const me=K.depthTexture;me&&me.isDepthTexture&&(me.type===AA?de=36012:me.type===bc&&(de=33190));const G=J(K);ce(K)?f.renderbufferStorageMultisampleEXT(36161,G,de,K.width,K.height):n.renderbufferStorageMultisample(36161,G,de,K.width,K.height)}else n.renderbufferStorage(36161,de,K.width,K.height);n.framebufferRenderbuffer(36160,36096,36161,Q)}else if(K.depthBuffer&&K.stencilBuffer){const de=J(K);ie&&ce(K)===!1?n.renderbufferStorageMultisample(36161,de,35056,K.width,K.height):ce(K)?f.renderbufferStorageMultisampleEXT(36161,de,35056,K.width,K.height):n.renderbufferStorage(36161,34041,K.width,K.height),n.framebufferRenderbuffer(36160,33306,36161,Q)}else{const de=K.isWebGLMultipleRenderTargets===!0?K.texture:[K.texture];for(let me=0;me0&&ce(Q)===!1){const S=G?K:[K];ie.__webglMultisampledFramebuffer=n.createFramebuffer(),ie.__webglColorRenderbuffer=[],t.bindFramebuffer(36160,ie.__webglMultisampledFramebuffer);for(let V=0;V0&&ce(Q)===!1){const K=Q.isWebGLMultipleRenderTargets?Q.texture:[Q.texture],ie=Q.width,de=Q.height;let me=16384;const G=[],R=Q.stencilBuffer?33306:36096,S=r.get(Q),V=Q.isWebGLMultipleRenderTargets===!0;if(V)for(let te=0;te0&&e.has("WEBGL_multisampled_render_to_texture")===!0&&K.__useRenderToTexture!==!1}function be(Q){const K=o.render.frame;p.get(Q)!==K&&(p.set(Q,K),Q.update())}function Be(Q,K){const ie=Q.encoding,de=Q.format,me=Q.type;return Q.isCompressedTexture===!0||Q.isVideoTexture===!0||Q.format===qE||ie!==wl&&(ie===wt?a===!1?e.has("EXT_sRGB")===!0&&de===Lr?(Q.format=qE,Q.minFilter=li,Q.generateMipmaps=!1):K=CH.sRGBToLinear(K):(de!==Lr||me!==jc)&&console.warn("THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType."):console.error("THREE.WebGLTextures: Unsupported texture encoding:",ie)),K}this.allocateTextureUnit=P,this.resetTextureUnits=U,this.setTexture2D=W,this.setTexture2DArray=N,this.setTexture3D=C,this.setTextureCube=j,this.rebindTextures=D,this.setupRenderTarget=Ae,this.updateRenderTargetMipmap=le,this.updateMultisampleRenderTarget=q,this.setupDepthRenderbuffer=_e,this.setupFrameBufferTexture=oe,this.useMultisampledRTT=ce}function jte(n,e,t){const r=t.isWebGL2;function i(s,o=null){let a;if(s===jc)return 5121;if(s===x$)return 32819;if(s===_$)return 32820;if(s===v$)return 5120;if(s===y$)return 5122;if(s===xH)return 5123;if(s===w$)return 5124;if(s===bc)return 5125;if(s===AA)return 5126;if(s===Om)return r?5131:(a=e.get("OES_texture_half_float"),a!==null?a.HALF_FLOAT_OES:null);if(s===b$)return 6406;if(s===Lr)return 6408;if(s===B$)return 6409;if(s===E$)return 6410;if(s===Rc)return 6402;if(s===Lh)return 34041;if(s===qE)return a=e.get("EXT_sRGB"),a!==null?a.SRGB_ALPHA_EXT:null;if(s===C$)return 6403;if(s===M$)return 36244;if(s===S$)return 33319;if(s===T$)return 33320;if(s===I$)return 36249;if(s===S1||s===T1||s===I1||s===R1)if(o===wt)if(a=e.get("WEBGL_compressed_texture_s3tc_srgb"),a!==null){if(s===S1)return a.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(s===T1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(s===I1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(s===R1)return a.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(a=e.get("WEBGL_compressed_texture_s3tc"),a!==null){if(s===S1)return a.COMPRESSED_RGB_S3TC_DXT1_EXT;if(s===T1)return a.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(s===I1)return a.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(s===R1)return a.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(s===cF||s===uF||s===fF||s===hF)if(a=e.get("WEBGL_compressed_texture_pvrtc"),a!==null){if(s===cF)return a.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(s===uF)return a.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(s===fF)return a.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(s===hF)return a.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(s===R$)return a=e.get("WEBGL_compressed_texture_etc1"),a!==null?a.COMPRESSED_RGB_ETC1_WEBGL:null;if(s===dF||s===pF)if(a=e.get("WEBGL_compressed_texture_etc"),a!==null){if(s===dF)return o===wt?a.COMPRESSED_SRGB8_ETC2:a.COMPRESSED_RGB8_ETC2;if(s===pF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:a.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(s===mF||s===gF||s===vF||s===yF||s===wF||s===xF||s===_F||s===bF||s===BF||s===EF||s===CF||s===MF||s===SF||s===TF)if(a=e.get("WEBGL_compressed_texture_astc"),a!==null){if(s===mF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:a.COMPRESSED_RGBA_ASTC_4x4_KHR;if(s===gF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:a.COMPRESSED_RGBA_ASTC_5x4_KHR;if(s===vF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:a.COMPRESSED_RGBA_ASTC_5x5_KHR;if(s===yF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:a.COMPRESSED_RGBA_ASTC_6x5_KHR;if(s===wF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:a.COMPRESSED_RGBA_ASTC_6x6_KHR;if(s===xF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:a.COMPRESSED_RGBA_ASTC_8x5_KHR;if(s===_F)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:a.COMPRESSED_RGBA_ASTC_8x6_KHR;if(s===bF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:a.COMPRESSED_RGBA_ASTC_8x8_KHR;if(s===BF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:a.COMPRESSED_RGBA_ASTC_10x5_KHR;if(s===EF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:a.COMPRESSED_RGBA_ASTC_10x6_KHR;if(s===CF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:a.COMPRESSED_RGBA_ASTC_10x8_KHR;if(s===MF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:a.COMPRESSED_RGBA_ASTC_10x10_KHR;if(s===SF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:a.COMPRESSED_RGBA_ASTC_12x10_KHR;if(s===TF)return o===wt?a.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:a.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(s===F1)if(a=e.get("EXT_texture_compression_bptc"),a!==null){if(s===F1)return o===wt?a.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:a.COMPRESSED_RGBA_BPTC_UNORM_EXT}else return null;if(s===F$||s===IF||s===RF||s===FF)if(a=e.get("EXT_texture_compression_rgtc"),a!==null){if(s===F1)return a.COMPRESSED_RED_RGTC1_EXT;if(s===IF)return a.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(s===RF)return a.COMPRESSED_RED_GREEN_RGTC2_EXT;if(s===FF)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 Wte extends Er{constructor(e=[]){super(),this.isArrayCamera=!0,this.cameras=e}}class Pr extends It{constructor(){super(),this.isGroup=!0,this.type="Group"}}const Kte={type:"move"};class ib{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new Pr,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 Pr,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 Pr,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(Kte)))}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 Pr;r.matrixAutoUpdate=!1,r.visible=!1,e.joints[t.jointName]=r,e.add(r)}return e.joints[t.jointName]}}class OH extends Hn{constructor(e,t,r,i,s,o,a,l,A,c){if(c=c!==void 0?c:Rc,c!==Rc&&c!==Lh)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");r===void 0&&c===Rc&&(r=bc),r===void 0&&c===Lh&&(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:Xn,this.minFilter=l!==void 0?l:Xn,this.flipY=!1,this.generateMipmaps=!1}}class Yte extends KA{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,B=new Er;B.layers.enable(1),B.viewport=new Ht;const T=new Er;T.layers.enable(2),T.viewport=new Ht;const b=[B,T],M=new Wte;M.layers.enable(1),M.layers.enable(2);let O=null,Y=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(C){let j=y[C];return j===void 0&&(j=new ib,y[C]=j),j.getTargetRaySpace()},this.getControllerGrip=function(C){let j=y[C];return j===void 0&&(j=new ib,y[C]=j),j.getGripSpace()},this.getHand=function(C){let j=y[C];return j===void 0&&(j=new ib,y[C]=j),j.getHandSpace()};function H(C){const j=w.indexOf(C.inputSource);if(j===-1)return;const ee=y[j];ee!==void 0&&ee.dispatchEvent({type:C.type,data:C.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 C=0;C=0&&(w[F]=null,y[F].disconnect(ee))}for(let j=0;j=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,L=new Z;function U(C,j,ee){E.setFromMatrixPosition(j.matrixWorld),L.setFromMatrixPosition(ee.matrixWorld);const F=E.distanceTo(L),X=j.projectionMatrix.elements,ue=ee.projectionMatrix.elements,re=X[14]/(X[10]-1),fe=X[14]/(X[10]+1),oe=(X[9]+1)/X[5],pe=(X[9]-1)/X[5],xe=(X[8]-1)/X[0],_e=(ue[8]+1)/ue[0],D=re*xe,Ae=re*_e,le=F/(-xe+_e),q=le*-xe;j.matrixWorld.decompose(C.position,C.quaternion,C.scale),C.translateX(q),C.translateZ(le),C.matrixWorld.compose(C.position,C.quaternion,C.scale),C.matrixWorldInverse.copy(C.matrixWorld).invert();const J=re+le,ce=fe+le,be=D-q,Be=Ae+(F-q),Q=oe*fe/ce*J,K=pe*fe/ce*J;C.projectionMatrix.makePerspective(be,Be,Q,K,J,ce)}function P(C,j){j===null?C.matrixWorld.copy(C.matrix):C.matrixWorld.multiplyMatrices(j.matrixWorld,C.matrix),C.matrixWorldInverse.copy(C.matrixWorld).invert()}this.updateCamera=function(C){if(i===null)return;M.near=T.near=B.near=C.near,M.far=T.far=B.far=C.far,(O!==M.near||Y!==M.far)&&(i.updateRenderState({depthNear:M.near,depthFar:M.far}),O=M.near,Y=M.far);const j=C.parent,ee=M.cameras;P(M,j);for(let X=0;XX&&(_.set(F,F.lastChangedTime),r.dispatchEvent({type:"planechanged",data:F}))}}p=null}const N=new FH;N.setAnimationLoop(W),this.setAnimationLoop=function(C){z=C},this.dispose=function(){}}}function Xte(n,e){function t(d,g){g.color.getRGB(d.fogColor.value,TH(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===qr&&(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===qr&&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===qr&&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 B=e.render.frame;s[y.id]!==B&&(f(y),s[y.id]=B)}function c(y){const w=u();y.__bindingPointIndex=w;const x=n.createBuffer(),_=y.__size,B=y.usage;return n.bindBuffer(35345,x),n.bufferData(35345,_,B),n.bindBuffer(35345,null),n.bindBufferBase(35345,w,x),x}function u(){for(let y=0;y0){B=x%_;const H=_-B;B!==0&&H-O.boundary<0&&(x+=_-B,M.__offset=x)}x+=O.storage}return B=x%_,B>0&&(x+=_-B),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 Zte(){const n=Qm("canvas");return n.style.display="block",n}function dg(n={}){this.isWebGLRenderer=!0;const e=n.canvas!==void 0?n.canvas:Zte(),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=wl,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 B=new Ht,T=new Ht;let b=null,M=e.width,O=e.height,Y=1,H=null,I=null;const v=new Ht(0,0,M,O),E=new Ht(0,0,M,O);let L=!1;const U=new YS;let P=!1,z=!1,W=null;const N=new We,C=new Ke,j=new Z,ee={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};function F(){return w===null?Y:1}let X=t;function ue(ne,ve){for(let Ee=0;Ee0?f=p[p.length-1]:f=null,h.pop(),h.length>0?u=h[h.length-1]:u=null};function ft(ne,ve,Ee,we){if(ne.visible===!1)return;if(ne.layers.test(ve.layers)){if(ne.isGroup)Ee=ne.renderOrder;else if(ne.isLOD)ne.autoUpdate===!0&&ne.update(ve);else if(ne.isLight)f.pushLight(ne),ne.castShadow&&f.pushShadow(ne);else if(ne.isSprite){if(!ne.frustumCulled||U.intersectsSprite(ne)){we&&j.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(N);const st=J.update(ne),Xe=ne.material;Xe.visible&&u.push(ne,st,Xe,Ee,j.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||U.intersectsObject(ne))){we&&j.setFromMatrixPosition(ne.matrixWorld).applyMatrix4(N);const st=J.update(ne),Xe=ne.material;if(Array.isArray(Xe)){const $e=st.groups;for(let gt=0,dt=$e.length;gt0&&Ct(Ce,ve,Ee),we&&oe.viewport(B.copy(we)),Ce.length>0&&it(Ce,ve,Ee),ze.length>0&&it(ze,ve,Ee),st.length>0&&it(st,ve,Ee),oe.buffers.depth.setTest(!0),oe.buffers.depth.setMask(!0),oe.buffers.color.setMask(!0),oe.setPolygonOffset(!1)}function Ct(ne,ve,Ee){const we=fe.isWebGL2;W===null&&(W=new da(1,1,{generateMipmaps:!0,type:re.has("EXT_color_buffer_half_float")?Om:jc,minFilter:PA,samples:we&&s===!0?4:0})),d.getDrawingBufferSize(C),we?W.setSize(C.x,C.y):W.setSize(uw(C.x),uw(C.y));const Ce=d.getRenderTarget();d.setRenderTarget(W),d.clear();const ze=d.toneMapping;d.toneMapping=al,it(ne,ve,Ee),d.toneMapping=ze,_e.updateMultisampleRenderTarget(W),_e.updateRenderTargetMipmap(W),d.setRenderTarget(Ce)}function it(ne,ve,Ee){const we=ve.isScene===!0?ve.overrideMaterial:null;for(let Ce=0,ze=ne.length;Ce0&&_e.useMultisampledRTT(ne)===!1?Ce=xe.get(ne).__webglMultisampledFramebuffer:Ce=dt,B.copy(ne.viewport),T.copy(ne.scissor),b=ne.scissorTest}else B.copy(v).multiplyScalar(Y).floor(),T.copy(E).multiplyScalar(Y).floor(),b=L;if(oe.bindFramebuffer(36160,Ce)&&fe.drawBuffers&&we&&oe.drawBuffers(ne,Ce),oe.viewport(B),oe.scissor(T),oe.setScissorTest(b),ze){const $e=xe.get(ne.texture);X.framebufferTexture2D(36160,36064,34069+ve,$e.__webglTexture,Ee)}else if(st){const $e=xe.get(ne.texture),gt=ve||0;X.framebufferTextureLayer(36160,36064,$e.__webglTexture,Ee||0,gt)}x=-1},this.readRenderTargetPixels=function(ne,ve,Ee,we,Ce,ze,st){if(!(ne&&ne.isWebGLRenderTarget)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");return}let Xe=xe.get(ne).__webglFramebuffer;if(ne.isWebGLCubeRenderTarget&&st!==void 0&&(Xe=Xe[st]),Xe){oe.bindFramebuffer(36160,Xe);try{const $e=ne.texture,gt=$e.format,dt=$e.type;if(gt!==Lr&&S.convert(gt)!==X.getParameter(35739)){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.");return}const ct=dt===Om&&(re.has("EXT_color_buffer_half_float")||fe.isWebGL2&&re.has("EXT_color_buffer_float"));if(dt!==jc&&S.convert(dt)!==X.getParameter(35738)&&!(dt===AA&&(fe.isWebGL2||re.has("OES_texture_float")||re.has("WEBGL_color_buffer_float")))&&!ct){console.error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.");return}ve>=0&&ve<=ne.width-we&&Ee>=0&&Ee<=ne.height-Ce&&X.readPixels(ve,Ee,we,Ce,S.convert(gt),S.convert(dt),ze)}finally{const $e=w!==null?xe.get(w).__webglFramebuffer:null;oe.bindFramebuffer(36160,$e)}}},this.copyFramebufferToTexture=function(ne,ve,Ee=0){const we=Math.pow(2,-Ee),Ce=Math.floor(ve.image.width*we),ze=Math.floor(ve.image.height*we);_e.setTexture2D(ve,0),X.copyTexSubImage2D(3553,Ee,0,0,ne.x,ne.y,Ce,ze),oe.unbindTexture()},this.copyTextureToTexture=function(ne,ve,Ee,we=0){const Ce=ve.image.width,ze=ve.image.height,st=S.convert(Ee.format),Xe=S.convert(Ee.type);_e.setTexture2D(Ee,0),X.pixelStorei(37440,Ee.flipY),X.pixelStorei(37441,Ee.premultiplyAlpha),X.pixelStorei(3317,Ee.unpackAlignment),ve.isDataTexture?X.texSubImage2D(3553,we,ne.x,ne.y,Ce,ze,st,Xe,ve.image.data):ve.isCompressedTexture?X.compressedTexSubImage2D(3553,we,ne.x,ne.y,ve.mipmaps[0].width,ve.mipmaps[0].height,st,ve.mipmaps[0].data):X.texSubImage2D(3553,we,ne.x,ne.y,st,Xe,ve.image),we===0&&Ee.generateMipmaps&&X.generateMipmap(3553),oe.unbindTexture()},this.copyTextureToTexture3D=function(ne,ve,Ee,we,Ce=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,Xe=ne.max.z-ne.min.z+1,$e=S.convert(we.format),gt=S.convert(we.type);let dt;if(we.isData3DTexture)_e.setTexture3D(we,0),dt=32879;else if(we.isDataArrayTexture)_e.setTexture2DArray(we,0),dt=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 ct=X.getParameter(3314),Wt=X.getParameter(32878),vn=X.getParameter(3316),Hr=X.getParameter(3315),ki=X.getParameter(32877),yn=Ee.isCompressedTexture?Ee.mipmaps[0]:Ee.image;X.pixelStorei(3314,yn.width),X.pixelStorei(32878,yn.height),X.pixelStorei(3316,ne.min.x),X.pixelStorei(3315,ne.min.y),X.pixelStorei(32877,ne.min.z),Ee.isDataTexture||Ee.isData3DTexture?X.texSubImage3D(dt,Ce,ve.x,ve.y,ve.z,ze,st,Xe,$e,gt,yn.data):Ee.isCompressedArrayTexture?(console.warn("THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture."),X.compressedTexSubImage3D(dt,Ce,ve.x,ve.y,ve.z,ze,st,Xe,$e,yn.data)):X.texSubImage3D(dt,Ce,ve.x,ve.y,ve.z,ze,st,Xe,$e,gt,yn),X.pixelStorei(3314,ct),X.pixelStorei(32878,Wt),X.pixelStorei(3316,vn),X.pixelStorei(3315,Hr),X.pixelStorei(32877,ki),Ce===0&&we.generateMipmaps&&X.generateMipmap(dt),oe.unbindTexture()},this.initTexture=function(ne){ne.isCubeTexture?_e.setTextureCube(ne,0):ne.isData3DTexture?_e.setTexture3D(ne,0):ne.isDataArrayTexture||ne.isCompressedArrayTexture?_e.setTexture2DArray(ne,0):_e.setTexture2D(ne,0),oe.unbindTexture()},this.resetState=function(){m=0,y=0,w=null,oe.reset(),V.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}class Jte extends dg{}Jte.prototype.isWebGL1Renderer=!0;class fw 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 qte{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e!==void 0?e.length/t:0,this.usage=JE,this.updateRange={offset:0,count:-1},this.version=0,this.uuid=Bo()}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 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})}}}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 sne{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 Ke: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 We;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(dr(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(dr(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 Ox extends Kt{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 B=0;const T=(t-e)/r;for(let b=0;b<=s;b++){const M=[],O=b/s,Y=O*(t-e)+e;for(let H=0;H<=i;H++){const I=H/i,v=I*l+a,E=Math.sin(v),L=Math.cos(v);_.x=Y*E,_.y=-O*r+g,_.z=Y*L,u.push(_.x,_.y,_.z),x.set(E,T,L).normalize(),f.push(x.x,x.y,x.z),h.push(I,1-O),M.push(p++)}d.push(M)}for(let b=0;b0)&&h.push(w,x,B),(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 ob extends Li{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new ke(16777215),this.specular=new ke(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$h,this.normalScale=new Ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Fx,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 one extends Li{constructor(e){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$h,this.normalScale=new Ke(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 ane extends Li{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new ke(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new ke(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=$h,this.normalScale=new Ke(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.combine=Fx,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 QH(n)?new n.constructor(n.subarray(e,t!==void 0?t:n.length)):n.slice(e,t)}function I0(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 QH(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function lne(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 SU(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 HH(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 mg{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&&QH(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()===U1,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}}wa.prototype.TimeBufferType=Float32Array;wa.prototype.ValueBufferType=Float32Array;wa.prototype.DefaultInterpolation=Wc;class ed extends wa{}ed.prototype.ValueTypeName="bool";ed.prototype.ValueBufferType=Array;ed.prototype.DefaultInterpolation=Ph;ed.prototype.InterpolantFactoryMethodLinear=void 0;ed.prototype.InterpolantFactoryMethodSmooth=void 0;class GH extends wa{}GH.prototype.ValueTypeName="color";class Nh extends wa{}Nh.prototype.ValueTypeName="number";class une extends mg{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 pa extends wa{InterpolantFactoryMethodLinear(e){return new une(this.times,this.values,this.getValueSize(),e)}}pa.prototype.ValueTypeName="quaternion";pa.prototype.DefaultInterpolation=Wc;pa.prototype.InterpolantFactoryMethodSmooth=void 0;class td extends wa{}td.prototype.ValueTypeName="string";td.prototype.ValueBufferType=Array;td.prototype.DefaultInterpolation=Ph;td.prototype.InterpolantFactoryMethodLinear=void 0;td.prototype.InterpolantFactoryMethodSmooth=void 0;class DA extends wa{}DA.prototype.ValueTypeName="vector";class Kc{constructor(e,t=-1,r,i=GS){this.name=e,this.tracks=r,this.duration=t,this.blendMode=i,this.uuid=Bo(),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(hne(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(wa.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=[];HH(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(Fa[e]!==void 0){Fa[e].push({onLoad:t,onProgress:r,onError:i});return}Fa[e]=[],Fa[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=Fa[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 B=0,T=c.length;B{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=>{kh.add(e,A);const c=Fa[e];delete Fa[e];for(let u=0,f=c.length;u{const c=Fa[e];if(c===void 0)throw this.manager.itemError(e),A;delete Fa[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 jH extends nd{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=kh.get(e);if(o!==void 0)return s.manager.itemStart(e),setTimeout(function(){t&&t(o),s.manager.itemEnd(e)},0),o;const a=Qm("img");function l(){c(),kh.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 ou extends nd{constructor(e){super(e)}load(e,t,r,i){const s=new Hn,o=new jH(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 Nx extends It{constructor(e,t=1){super(),this.isLight=!0,this.type="Light",this.color=new ke(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 ab=new We,TU=new Z,IU=new Z;class qS{constructor(e){this.camera=e,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ke(512,512),this.map=null,this.mapPass=null,this.matrix=new We,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new YS,this._frameExtents=new Ke(1,1),this._viewportCount=1,this._viewports=[new Ht(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){const t=this.camera,r=this.matrix;TU.setFromMatrixPosition(e.matrixWorld),t.position.copy(TU),IU.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(IU),t.updateMatrixWorld(),ab.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(ab),r.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),r.multiply(ab)}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 mne extends qS{constructor(){super(new Er(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1}updateMatrices(e){const t=this.camera,r=km*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 WH extends Nx{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 mne}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 RU=new We,Qd=new Z,lb=new Z;class gne extends qS{constructor(){super(new Er(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ke(4,2),this._viewportCount=6,this._viewports=[new Ht(2,1,1,1),new Ht(0,1,1,1),new Ht(3,1,1,1),new Ht(1,1,1,1),new Ht(3,0,1,1),new Ht(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()),Qd.setFromMatrixPosition(e.matrixWorld),r.position.copy(Qd),lb.copy(r.position),lb.add(this._cubeDirections[t]),r.up.copy(this._cubeUps[t]),r.lookAt(lb),r.updateMatrixWorld(),i.makeTranslation(-Qd.x,-Qd.y,-Qd.z),RU.multiplyMatrices(r.projectionMatrix,r.matrixWorldInverse),this._frustum.setFromProjectionMatrix(RU)}}class rC extends Nx{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 gne}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 vne extends qS{constructor(){super(new Zh(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class eT extends Nx{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 vne}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}}class KH extends Nx{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type="AmbientLight"}}class pw{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=kh.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){kh.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 YH{constructor(e=!0){this.autoStart=e,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=FU(),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=FU();e=(t-this.oldTime)/1e3,this.oldTime=t,this.elapsedTime+=e}return e}}function FU(){return(typeof performance>"u"?Date:performance).now()}class wne{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 tT="\\[\\]\\.:\\/",xne=new RegExp("["+tT+"]","g"),nT="[^"+tT+"]",_ne="[^"+tT.replace("\\.","")+"]",bne=/((?:WC+[\/:])*)/.source.replace("WC",nT),Bne=/(WCOD+)?/.source.replace("WCOD",_ne),Ene=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",nT),Cne=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",nT),Mne=new RegExp("^"+bne+Bne+Ene+Cne+"$"),Sne=["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(xne,"")}static parseTrackName(e){const t=Mne.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);Sne.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 D$:for(let c=0,u=l.length;c!==u;++c)l[c].evaluate(o),A[c].accumulateAdditive(a);break;case GS: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===P$;if(e===0)return s===-1?i:o&&(s&1)===1?t-i:i;if(r===U$){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=zf,i.endingEnd=zf):(e?i.endingStart=this.zeroSlopeAtStart?zf:Hf:i.endingStart=cw,t?i.endingEnd=this.zeroSlopeAtEnd?zf:Hf:i.endingEnd=cw)}_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 Fne extends KA{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 wne(_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&&(He-=Ie),De<-Math.PI?De+=Ie:De>Math.PI&&(De-=Ie),He<=De?a.theta=Math.max(He,Math.min(De,a.theta)):a.theta=a.theta>(He+De)/2?Math.max(He,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),S.setFromSpherical(a),S.applyQuaternion(te),Le.copy(r.target).add(S),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-se.dot(r.object.quaternion))>o?(r.dispatchEvent(OU),ae.copy(r.object.position),se.copy(r.object.quaternion),u=!1,!0):!1}}(),this.dispose=function(){r.domElement.removeEventListener("contextmenu",ie),r.domElement.removeEventListener("pointerdown",D),r.domElement.removeEventListener("pointercancel",q),r.domElement.removeEventListener("wheel",be),r.domElement.removeEventListener("pointermove",Ae),r.domElement.removeEventListener("pointerup",le),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 PU,l=new PU;let A=1;const c=new Z;let u=!1;const f=new Ke,h=new Ke,p=new Ke,d=new Ke,g=new Ke,m=new Ke,y=new Ke,w=new Ke,x=new Ke,_=[],B={};function T(){return 2*Math.PI/60/60*r.autoRotateSpeed}function b(){return Math.pow(.95,r.zoomSpeed)}function M(S){l.theta-=S}function O(S){l.phi-=S}const Y=function(){const S=new Z;return function(te,ae){S.setFromMatrixColumn(ae,0),S.multiplyScalar(-te),c.add(S)}}(),H=function(){const S=new Z;return function(te,ae){r.screenSpacePanning===!0?S.setFromMatrixColumn(ae,1):(S.setFromMatrixColumn(ae,0),S.crossVectors(r.object.up,S)),S.multiplyScalar(te),c.add(S)}}(),I=function(){const S=new Z;return function(te,ae){const se=r.domElement;if(r.object.isPerspectiveCamera){const Ie=r.object.position;S.copy(Ie).sub(r.target);let Te=S.length();Te*=Math.tan(r.object.fov/2*Math.PI/180),Y(2*te*Te/se.clientHeight,r.object.matrix),H(2*ae*Te/se.clientHeight,r.object.matrix)}else r.object.isOrthographicCamera?(Y(te*(r.object.right-r.object.left)/r.object.zoom/se.clientWidth,r.object.matrix),H(ae*(r.object.top-r.object.bottom)/r.object.zoom/se.clientHeight,r.object.matrix)):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled."),r.enablePan=!1)}}();function v(S){r.object.isPerspectiveCamera?A/=S:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom*S)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function E(S){r.object.isPerspectiveCamera?A*=S:r.object.isOrthographicCamera?(r.object.zoom=Math.max(r.minZoom,Math.min(r.maxZoom,r.object.zoom/S)),r.object.updateProjectionMatrix(),u=!0):(console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled."),r.enableZoom=!1)}function L(S){f.set(S.clientX,S.clientY)}function U(S){y.set(S.clientX,S.clientY)}function P(S){d.set(S.clientX,S.clientY)}function z(S){h.set(S.clientX,S.clientY),p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const V=r.domElement;M(2*Math.PI*p.x/V.clientHeight),O(2*Math.PI*p.y/V.clientHeight),f.copy(h),r.update()}function W(S){w.set(S.clientX,S.clientY),x.subVectors(w,y),x.y>0?v(b()):x.y<0&&E(b()),y.copy(w),r.update()}function N(S){g.set(S.clientX,S.clientY),m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g),r.update()}function C(S){S.deltaY<0?E(b()):S.deltaY>0&&v(b()),r.update()}function j(S){let V=!1;switch(S.code){case r.keys.UP:S.ctrlKey||S.metaKey||S.shiftKey?O(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,r.keyPanSpeed),V=!0;break;case r.keys.BOTTOM:S.ctrlKey||S.metaKey||S.shiftKey?O(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(0,-r.keyPanSpeed),V=!0;break;case r.keys.LEFT:S.ctrlKey||S.metaKey||S.shiftKey?M(2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(r.keyPanSpeed,0),V=!0;break;case r.keys.RIGHT:S.ctrlKey||S.metaKey||S.shiftKey?M(-2*Math.PI*r.rotateSpeed/r.domElement.clientHeight):I(-r.keyPanSpeed,0),V=!0;break}V&&(S.preventDefault(),r.update())}function ee(){if(_.length===1)f.set(_[0].pageX,_[0].pageY);else{const S=.5*(_[0].pageX+_[1].pageX),V=.5*(_[0].pageY+_[1].pageY);f.set(S,V)}}function F(){if(_.length===1)d.set(_[0].pageX,_[0].pageY);else{const S=.5*(_[0].pageX+_[1].pageX),V=.5*(_[0].pageY+_[1].pageY);d.set(S,V)}}function X(){const S=_[0].pageX-_[1].pageX,V=_[0].pageY-_[1].pageY,te=Math.sqrt(S*S+V*V);y.set(0,te)}function ue(){r.enableZoom&&X(),r.enablePan&&F()}function re(){r.enableZoom&&X(),r.enableRotate&&ee()}function fe(S){if(_.length==1)h.set(S.pageX,S.pageY);else{const te=R(S),ae=.5*(S.pageX+te.x),se=.5*(S.pageY+te.y);h.set(ae,se)}p.subVectors(h,f).multiplyScalar(r.rotateSpeed);const V=r.domElement;M(2*Math.PI*p.x/V.clientHeight),O(2*Math.PI*p.y/V.clientHeight),f.copy(h)}function oe(S){if(_.length===1)g.set(S.pageX,S.pageY);else{const V=R(S),te=.5*(S.pageX+V.x),ae=.5*(S.pageY+V.y);g.set(te,ae)}m.subVectors(g,d).multiplyScalar(r.panSpeed),I(m.x,m.y),d.copy(g)}function pe(S){const V=R(S),te=S.pageX-V.x,ae=S.pageY-V.y,se=Math.sqrt(te*te+ae*ae);w.set(0,se),x.set(0,Math.pow(w.y/y.y,r.zoomSpeed)),v(x.y),y.copy(w)}function xe(S){r.enableZoom&&pe(S),r.enablePan&&oe(S)}function _e(S){r.enableZoom&&pe(S),r.enableRotate&&fe(S)}function D(S){r.enabled!==!1&&(_.length===0&&(r.domElement.setPointerCapture(S.pointerId),r.domElement.addEventListener("pointermove",Ae),r.domElement.addEventListener("pointerup",le)),de(S),S.pointerType==="touch"?Q(S):J(S))}function Ae(S){r.enabled!==!1&&(S.pointerType==="touch"?K(S):ce(S))}function le(S){me(S),_.length===0&&(r.domElement.releasePointerCapture(S.pointerId),r.domElement.removeEventListener("pointermove",Ae),r.domElement.removeEventListener("pointerup",le)),r.dispatchEvent(NU),s=i.NONE}function q(S){me(S)}function J(S){let V;switch(S.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 vu.DOLLY:if(r.enableZoom===!1)return;U(S),s=i.DOLLY;break;case vu.ROTATE:if(S.ctrlKey||S.metaKey||S.shiftKey){if(r.enablePan===!1)return;P(S),s=i.PAN}else{if(r.enableRotate===!1)return;L(S),s=i.ROTATE}break;case vu.PAN:if(S.ctrlKey||S.metaKey||S.shiftKey){if(r.enableRotate===!1)return;L(S),s=i.ROTATE}else{if(r.enablePan===!1)return;P(S),s=i.PAN}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(Ab)}function ce(S){switch(s){case i.ROTATE:if(r.enableRotate===!1)return;z(S);break;case i.DOLLY:if(r.enableZoom===!1)return;W(S);break;case i.PAN:if(r.enablePan===!1)return;N(S);break}}function be(S){r.enabled===!1||r.enableZoom===!1||s!==i.NONE||(S.preventDefault(),r.dispatchEvent(Ab),C(S),r.dispatchEvent(NU))}function Be(S){r.enabled===!1||r.enablePan===!1||j(S)}function Q(S){switch(G(S),_.length){case 1:switch(r.touches.ONE){case yu.ROTATE:if(r.enableRotate===!1)return;ee(),s=i.TOUCH_ROTATE;break;case yu.PAN:if(r.enablePan===!1)return;F(),s=i.TOUCH_PAN;break;default:s=i.NONE}break;case 2:switch(r.touches.TWO){case yu.DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;ue(),s=i.TOUCH_DOLLY_PAN;break;case yu.DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;re(),s=i.TOUCH_DOLLY_ROTATE;break;default:s=i.NONE}break;default:s=i.NONE}s!==i.NONE&&r.dispatchEvent(Ab)}function K(S){switch(G(S),s){case i.TOUCH_ROTATE:if(r.enableRotate===!1)return;fe(S),r.update();break;case i.TOUCH_PAN:if(r.enablePan===!1)return;oe(S),r.update();break;case i.TOUCH_DOLLY_PAN:if(r.enableZoom===!1&&r.enablePan===!1)return;xe(S),r.update();break;case i.TOUCH_DOLLY_ROTATE:if(r.enableZoom===!1&&r.enableRotate===!1)return;_e(S),r.update();break;default:s=i.NONE}}function ie(S){r.enabled!==!1&&S.preventDefault()}function de(S){_.push(S)}function me(S){delete B[S.pointerId];for(let V=0;V<_.length;V++)if(_[V].pointerId==S.pointerId){_.splice(V,1);return}}function G(S){let V=B[S.pointerId];V===void 0&&(V=new Ke,B[S.pointerId]=V),V.set(S.pageX,S.pageY)}function R(S){const V=S.pointerId===_[0].pointerId?_[1]:_[0];return B[V.pointerId]}r.domElement.addEventListener("contextmenu",ie),r.domElement.addEventListener("pointerdown",D),r.domElement.addEventListener("pointercancel",q),r.domElement.addEventListener("wheel",be,{passive:!1}),this.update()}}function $H(n){let e,t,r,i=0;for(let a=0;a=2.0 are supported."));return}const A=new Are(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 Pne(){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 Qt={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 Dne{constructor(e){this.parser=e,this.name=Qt.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 Kne{constructor(e){this.parser=e,this.name=Qt.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 Yne{constructor(e){this.name=Qt.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=Qt.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 We,g=new Z,m=new rt,y=new Z(1,1,1),w=new Dx(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 lre=new We;class Are{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new Pne,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 ou(this.options.manager):this.textureLoader=new yne(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new JS(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:{}};zd(s,a,i),$l(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,B[T*l+1]),l>=3&&g.setZ(M,B[T*l+2]),l>=4&&g.setW(M,B[T*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=HU[f.magFilter]||li,c.minFilter=HU[f.minFilter]||PA,c.wrapS=zU[f.wrapS]||cs,c.wrapT=zU[f.wrapT]||cs,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 Hn(d);g.needsUpdate=!0,f(g)}),t.load(pw.resolveURL(u,s.path),p,void 0,h)})}).then(function(u){return A===!0&&a.revokeObjectURL(l),u.userData.mimeType=o.mimeType||are(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[Qt.KHR_TEXTURE_TRANSFORM]){const a=r.extensions!==void 0?r.extensions[Qt.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const l=s.associations.get(o);o=s.extensions[Qt.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 kH,Li.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,Li.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 Oh}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[Qt.KHR_MATERIALS_UNLIT]){const u=i[Qt.KHR_MATERIALS_UNLIT];o=u.getMaterialType(),A.push(u.extendParams(a,s,t))}else{const u=s.pbrMetallicRoughness||{};if(a.color=new ke(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,wt)),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=hi);const c=s.alphaMode||ub.OPAQUE;if(c===ub.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,c===ub.MASK&&(a.alphaTest=s.alphaCutoff!==void 0?s.alphaCutoff:.5)),s.normalTexture!==void 0&&o!==Mi&&(A.push(t.assignTexture(a,"normalMap",s.normalTexture)),a.normalScale=new Ke(1,1),s.normalTexture.scale!==void 0)){const u=s.normalTexture.scale;a.normalScale.set(u,u)}return s.occlusionTexture!==void 0&&o!==Mi&&(A.push(t.assignTexture(a,"aoMap",s.occlusionTexture)),s.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=s.occlusionTexture.strength)),s.emissiveFactor!==void 0&&o!==Mi&&(a.emissive=new ke().fromArray(s.emissiveFactor)),s.emissiveTexture!==void 0&&o!==Mi&&A.push(t.assignTexture(a,"emissiveMap",s.emissiveTexture,wt)),Promise.all(A).then(function(){const u=new o(a);return s.name&&(u.name=s.name),$l(u,s),t.associations.set(u,{materials:e}),s.extensions&&zd(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[Qt.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,t).then(function(l){return VU(l,a,t)})}const o=[];for(let a=0,l=e.length;a0&&sre(m,s),m.name=t.createUniqueName(s.name||"mesh_"+e),$l(m,s),g.extensions&&zd(i,m,g),t.assignFinalMaterial(m),u.push(m)}for(let h=0,p=u.length;h1?u=new Pr: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 Li||f instanceof Hn)&&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 cre(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=oC(lh[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 VU=function(n){return URL.createObjectURL(new Blob([n],{type:"text/javascript"}))};try{URL.revokeObjectURL(VU(""))}catch{VU=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}var Ts=Uint8Array,cA=Uint16Array,oC=Uint32Array,qH=new Ts([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]),e5=new Ts([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]),cre=new Ts([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),t5=function(n,e){for(var t=new cA(31),r=0;r<31;++r)t[r]=e+=1<>>1|(pn&21845)<<1;Ql=(Ql&52428)>>>2|(Ql&13107)<<2,Ql=(Ql&61680)>>>4|(Ql&3855)<<4,aC[pn]=((Ql&65280)>>>8|(Ql&255)<<8)>>>1}var tm=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},gg=new Ts(288);for(var pn=0;pn<144;++pn)gg[pn]=8;for(var pn=144;pn<256;++pn)gg[pn]=9;for(var pn=256;pn<280;++pn)gg[pn]=7;for(var pn=280;pn<288;++pn)gg[pn]=8;var i5=new Ts(32);for(var pn=0;pn<32;++pn)i5[pn]=5;var dre=tm(gg,9,1),pre=tm(i5,5,1),ub=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},oo=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},fb=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},mre=function(n){return(n/8|0)+(n&7&&1)},gre=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 oC?oC:Ts)(t-e);return r.set(n.subarray(e,t)),r},vre=function(n,e,t){var r=n.length;if(!r||t&&!t.l&&r<5)return e||new Ts(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new Ts(r*3));var o=function(X){var ae=e.length;if(X>ae){var oe=new Ts(Math.max(ae*2,X));oe.set(e),e=oe}},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=oo(n,l,1);var d=oo(n,l+1,3);if(l+=3,d)if(d==1)c=dre,u=pre,f=9,h=5;else if(d==2){var w=oo(n,l,31)+257,x=oo(n,l+10,15)+4,_=w+oo(n,l+5,31)+1;l+=14;for(var C=new Ts(_),T=new Ts(19),b=0;b>>4;if(g<16)C[b++]=g;else{var I=0,v=0;for(g==16?(v=3+oo(n,l,3),l+=2,I=C[b-1]):g==17?(v=3+oo(n,l,7),l+=3):g==18&&(v=11+oo(n,l,127),l+=7);v--;)C[b++]=I}}var B=C.subarray(0,w),F=C.subarray(w);f=ub(B),h=ub(F),c=tm(B,f,1),u=tm(F,h,1)}else throw"invalid block type";else{var g=mre(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 Q=K-254;if(K>264){var b=K-257,E=qH[b];Q=oo(n,l,(1<>>4;if(!G)throw"invalid distance";l+=G&15;var F=hre[ee];if(ee>3){var E=e5[ee];F+=fb(n,l)&(1<p){if(s)throw"unexpected EOF";break}i&&o(A+131072);for(var U=A+Q;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 xre(n,e){return vre((wre(n),n.subarray(2,-4)),e)}var _re=typeof TextDecoder<"u"&&new TextDecoder,bre=0;try{_re.decode(yre,{stream:!0}),bre=1}catch{}function s5(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 Mre(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 Mt.Objects){const r=Mt.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?cs:ui,r.wrapT=a===0?cs:ui,"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=Wn.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 Hn):(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 Hn):o=this.textureLoader.load(r);return this.textureLoader.setPath(i),o}parseMaterials(e){const t=new Map;if("Material"in Mt.Objects){const r=Mt.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),!Wn.has(r))return null;const o=this.parseParameters(e,t,r);let a;switch(s.toLowerCase()){case"phong":a=new sb;break;case"lambert":a=new one;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new sb;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 ke().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new ke().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new ke().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new ke().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 ke().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new ke().fromArray(e.SpecularColor.value));const s=this;return Wn.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=wt);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=wt);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=lw,i.envMap.encoding=wt);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&(i.specularMap.encoding=wt);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 Mt.Objects&&t in Mt.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Wn.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Mt.Objects){const r=Mt.Objects.Deformer;for(const i in r){const s=r[i],o=Wn.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 We().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 sb({color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new ll(s,o),i.normalizeSkinWeights()):i=new Cn(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 qh(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=l5(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&&Wn.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=Mt.Objects.Model[i.ID];if("Lcl_Translation"in s){const o=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),wi.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];Wn.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const A=l.ID;Wn.get(A).parents.forEach(function(u){r.has(u.ID)&&r.get(u.ID).bind(new YA(o.bones),i[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in Mt.Objects){const t=Mt.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 We().fromArray(s.Matrix.a)}):e[i.Node]=new We().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in Mt&&"AmbientColor"in Mt.GlobalSettings){const e=Mt.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(t!==0||r!==0||i!==0){const s=new ke(t,r,i);wi.add(new WH(s,1))}}}}class Lre{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in Mt.Objects){const r=Mt.Objects.Geometry;for(const i in r){const s=Wn.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 Mt.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=l5(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=a5(A);return this.genGeometry(t,a,s,c)}genGeometry(e,t,r,i){const s=new Kt;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 Ux(a.weightsIndices,4)),s.setAttribute("skinWeight",new An(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const A=new xn().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=F0(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 T=_,b=m[C];x.forEach(function(M,D,Y){if(T>M){Y[D]=T,T=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=F0(p,r,h,e.normal);a.push(w[0],w[1],w[2])}e.material&&e.material.mappingType!=="AllSame"&&(d=F0(p,r,h,e.material)[0],d<0&&(f.negativeMaterialIndices=!0,d=0)),e.uv&&e.uv.forEach(function(w,x){const _=F0(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 Kc(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 di().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 DA(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 di().fromArray(i),i=new rt().setFromEuler(i)),s!==void 0&&(s=s.map(Lt.degToRad),s.push(o),s=new di().fromArray(s),s=new rt().setFromEuler(s).invert());const A=new rt,c=new di,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],zre(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=db(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=db(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=db(A);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:A},this.setCurrentProp(this.getPrevNode(),s)}}class Ore{parse(e){const t=new jU(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 o5;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=xre(new Uint8Array(e.getArrayBuffer(o))),l=new jU(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 jU{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 o5{add(e,t){this[e]=t}}function Nre(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===A5(n,0,e.length)}function kre(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 c5(n){return Math.ceil(n/4)*4}function pb(n,e=0){const t=c5(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 JU(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 Jre{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=pb(c.result),f=new DataView(new ArrayBuffer($U));f.setUint32(0,u.byteLength,!0),f.setUint32(4,Yre,!0);const h=pb(Xre(JSON.stringify(o)),32),p=new DataView(new ArrayBuffer($U));p.setUint32(0,h.byteLength,!0),p.setUint32(4,Kre,!0);const d=new ArrayBuffer(XU),g=new DataView(d);g.setUint32(0,jre,!0),g.setUint32(4,Wre,!0);const m=XU+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===en.FLOAT?A.setFloat32(c,d,!0):t===en.UNSIGNED_INT?A.setUint32(c,d,!0):t===en.UNSIGNED_SHORT?A.setUint16(c,d,!0):t===en.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===en.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=pb(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=en.FLOAT;else if(e.array.constructor===Uint32Array)a=en.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)a=en.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)a=en.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=Zre(e,r,i);let A;t!==void 0&&(A=e===t.index?en.ELEMENT_ARRAY_BUFFER:en.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=ZU();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!==Lr&&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(JU(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:ns[e.magFilter],minFilter:ns[e.minFilter],wrapS:ns[e.wrapS],wrapT:ns[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(_p(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===hi&&(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 T=this.getUID(o.index);(m[w].start!==void 0||m[w].count!==void 0)&&(T+=":"+m[w].start+":"+m[w].count),t.attributes.has(T)?_.indices=t.attributes.get(T):(_.indices=this.processAccessor(o.index,o,m[w].start,m[w].count),t.attributes.set(T,_.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=nT.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 fw;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 eie{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 tie{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 nie{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 rie{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 iie{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 sie{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 oie{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(Vre)&&!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}}nT.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 Aie(n){var e=f5(n),t=e[0],r=e[1];return(t+r)*3/4-r}function cie(n,e,t){return(e+t)*3/4-t}function uie(n){var e,t=f5(n),r=t[0],i=t[1],s=new aie(cie(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 fie(n){return Xo[n>>18&63]+Xo[n>>12&63]+Xo[n>>6&63]+Xo[n&63]}function hie(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 rT={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */rT.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)};rT.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 jU=function(n){return URL.createObjectURL(new Blob([n],{type:"text/javascript"}))};try{URL.revokeObjectURL(jU(""))}catch{jU=function(e){return"data:application/javascript;charset=UTF-8,"+encodeURI(e)}}var Ts=Uint8Array,cA=Uint16Array,aC=Uint32Array,e5=new Ts([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]),t5=new Ts([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]),ure=new Ts([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),n5=function(n,e){for(var t=new cA(31),r=0;r<31;++r)t[r]=e+=1<>>1|(pn&21845)<<1;Ql=(Ql&52428)>>>2|(Ql&13107)<<2,Ql=(Ql&61680)>>>4|(Ql&3855)<<4,lC[pn]=((Ql&65280)>>>8|(Ql&255)<<8)>>>1}var tm=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},gg=new Ts(288);for(var pn=0;pn<144;++pn)gg[pn]=8;for(var pn=144;pn<256;++pn)gg[pn]=9;for(var pn=256;pn<280;++pn)gg[pn]=7;for(var pn=280;pn<288;++pn)gg[pn]=8;var s5=new Ts(32);for(var pn=0;pn<32;++pn)s5[pn]=5;var pre=tm(gg,9,1),mre=tm(s5,5,1),fb=function(n){for(var e=n[0],t=1;te&&(e=n[t]);return e},oo=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},hb=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},gre=function(n){return(n/8|0)+(n&7&&1)},vre=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 aC?aC:Ts)(t-e);return r.set(n.subarray(e,t)),r},yre=function(n,e,t){var r=n.length;if(!r||t&&!t.l&&r<5)return e||new Ts(0);var i=!e||t,s=!t||t.i;t||(t={}),e||(e=new Ts(r*3));var o=function(X){var ue=e.length;if(X>ue){var re=new Ts(Math.max(ue*2,X));re.set(e),e=re}},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=oo(n,l,1);var d=oo(n,l+1,3);if(l+=3,d)if(d==1)c=pre,u=mre,f=9,h=5;else if(d==2){var w=oo(n,l,31)+257,x=oo(n,l+10,15)+4,_=w+oo(n,l+5,31)+1;l+=14;for(var B=new Ts(_),T=new Ts(19),b=0;b>>4;if(g<16)B[b++]=g;else{var I=0,v=0;for(g==16?(v=3+oo(n,l,3),l+=2,I=B[b-1]):g==17?(v=3+oo(n,l,7),l+=3):g==18&&(v=11+oo(n,l,127),l+=7);v--;)B[b++]=I}}var E=B.subarray(0,w),L=B.subarray(w);f=fb(E),h=fb(L),c=tm(E,f,1),u=tm(L,h,1)}else throw"invalid block type";else{var g=gre(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 U=(1<>>4;if(l+=I&15,l>p){if(s)throw"unexpected EOF";break}if(!I)throw"invalid length/literal";if(W<256)e[A++]=W;else if(W==256){z=l,c=null;break}else{var N=W-254;if(W>264){var b=W-257,C=e5[b];N=oo(n,l,(1<>>4;if(!j)throw"invalid distance";l+=j&15;var L=dre[ee];if(ee>3){var C=t5[ee];L+=hb(n,l)&(1<p){if(s)throw"unexpected EOF";break}i&&o(A+131072);for(var F=A+N;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 _re(n,e){return yre((xre(n),n.subarray(2,-4)),e)}var bre=typeof TextDecoder<"u"&&new TextDecoder,Bre=0;try{bre.decode(wre,{stream:!0}),Bre=1}catch{}function o5(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 B=w;B<=x;++B)p[h][B]=(p[f][B]-p[f][B-1])/a[y+1][m+B],g+=p[h][B]*a[m+B][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 Sre(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 Mt.Objects){const r=Mt.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?cs:ui,r.wrapT=a===0?cs:ui,"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=Wn.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 Hn):(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 Hn):o=this.textureLoader.load(r);return this.textureLoader.setPath(i),o}parseMaterials(e){const t=new Map;if("Material"in Mt.Objects){const r=Mt.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),!Wn.has(r))return null;const o=this.parseParameters(e,t,r);let a;switch(s.toLowerCase()){case"phong":a=new ob;break;case"lambert":a=new ane;break;default:console.warn('THREE.FBXLoader: unknown material type "%s". Defaulting to MeshPhongMaterial.',s),a=new ob;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 ke().fromArray(e.Diffuse.value):e.DiffuseColor&&(e.DiffuseColor.type==="Color"||e.DiffuseColor.type==="ColorRGB")&&(i.color=new ke().fromArray(e.DiffuseColor.value)),e.DisplacementFactor&&(i.displacementScale=e.DisplacementFactor.value),e.Emissive?i.emissive=new ke().fromArray(e.Emissive.value):e.EmissiveColor&&(e.EmissiveColor.type==="Color"||e.EmissiveColor.type==="ColorRGB")&&(i.emissive=new ke().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 ke().fromArray(e.Specular.value):e.SpecularColor&&e.SpecularColor.type==="Color"&&(i.specular=new ke().fromArray(e.SpecularColor.value));const s=this;return Wn.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=wt);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=wt);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=lw,i.envMap.encoding=wt);break;case"SpecularColor":i.specularMap=s.getTexture(t,o.ID),i.specularMap!==void 0&&(i.specularMap.encoding=wt);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 Mt.Objects&&t in Mt.Objects.LayeredTexture&&(console.warn("THREE.FBXLoader: layered textures are not supported in three.js. Discarding all but first layer."),t=Wn.get(t).children[0].ID),e.get(t)}parseDeformers(){const e={},t={};if("Deformer"in Mt.Objects){const r=Mt.Objects.Deformer;for(const i in r){const s=r[i],o=Wn.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 We().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 ob({color:13421772}),a.push(o)),"color"in s.attributes&&a.forEach(function(l){l.vertexColors=!0}),s.FBX_Deformer?(i=new ll(s,o),i.normalizeSkinWeights()):i=new Cn(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 qh(r,i)}getTransformData(e,t){const r={};"InheritType"in t&&(r.inheritType=parseInt(t.InheritType.value)),"RotationOrder"in t?r.eulerOrder=A5(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&&Wn.get(e.ID).children.forEach(function(i){if(i.relationship==="LookAtProperty"){const s=Mt.Objects.Model[i.ID];if("Lcl_Translation"in s){const o=s.Lcl_Translation.value;e.target!==void 0?(e.target.position.fromArray(o),wi.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];Wn.get(parseInt(o.ID)).parents.forEach(function(l){if(t.has(l.ID)){const A=l.ID;Wn.get(A).parents.forEach(function(u){r.has(u.ID)&&r.get(u.ID).bind(new YA(o.bones),i[u.ID])})}})}}parsePoseNodes(){const e={};if("Pose"in Mt.Objects){const t=Mt.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 We().fromArray(s.Matrix.a)}):e[i.Node]=new We().fromArray(i.Matrix.a)}}return e}createAmbientLight(){if("GlobalSettings"in Mt&&"AmbientColor"in Mt.GlobalSettings){const e=Mt.GlobalSettings.AmbientColor.value,t=e[0],r=e[1],i=e[2];if(t!==0||r!==0||i!==0){const s=new ke(t,r,i);wi.add(new KH(s,1))}}}}class Pre{constructor(){this.negativeMaterialIndices=!1}parse(e){const t=new Map;if("Geometry"in Mt.Objects){const r=Mt.Objects.Geometry;for(const i in r){const s=Wn.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 Mt.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=A5(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=l5(A);return this.genGeometry(t,a,s,c)}genGeometry(e,t,r,i){const s=new Kt;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 Lx(a.weightsIndices,4)),s.setAttribute("skinWeight",new An(a.vertexWeights,4)),s.FBX_Deformer=t),a.normal.length>0){const A=new xn().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=F0(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(_,B){let T=_,b=m[B];x.forEach(function(M,O,Y){if(T>M){Y[O]=T,T=M;const H=w[O];w[O]=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=F0(p,r,h,e.normal);a.push(w[0],w[1],w[2])}e.material&&e.material.mappingType!=="AllSame"&&(d=F0(p,r,h,e.material)[0],d<0&&(f.negativeMaterialIndices=!0,d=0)),e.uv&&e.uv.forEach(function(w,x){const _=F0(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 Kc(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 di().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 DA(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 di().fromArray(i),i=new rt().setFromEuler(i)),s!==void 0&&(s=s.map(Lt.degToRad),s.push(o),s=new di().fromArray(s),s=new rt().setFromEuler(s).invert());const A=new rt,c=new di,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],Gre(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=pb(s))}parseNodePropertyContinued(e){const t=this.getCurrentNode();t.a+=e,e.slice(-1)!==","&&(t.a=pb(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=pb(A);break}this.getPrevNode()[s]={type:o,type2:a,flag:l,value:A},this.setCurrentProp(this.getPrevNode(),s)}}class Nre{parse(e){const t=new WU(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 a5;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=_re(new Uint8Array(e.getArrayBuffer(o))),l=new WU(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 WU{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 a5{add(e,t){this[e]=t}}function kre(n){const e="Kaydara FBX Binary \0";return n.byteLength>=e.length&&e===c5(n,0,e.length)}function Qre(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 u5(n){return Math.ceil(n/4)*4}function mb(n,e=0){const t=u5(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 qU(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 qre{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=mb(c.result),f=new DataView(new ArrayBuffer(ZU));f.setUint32(0,u.byteLength,!0),f.setUint32(4,Xre,!0);const h=mb($re(JSON.stringify(o)),32),p=new DataView(new ArrayBuffer(ZU));p.setUint32(0,h.byteLength,!0),p.setUint32(4,Yre,!0);const d=new ArrayBuffer($U),g=new DataView(d);g.setUint32(0,Wre,!0),g.setUint32(4,Kre,!0);const m=$U+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===en.FLOAT?A.setFloat32(c,d,!0):t===en.UNSIGNED_INT?A.setUint32(c,d,!0):t===en.UNSIGNED_SHORT?A.setUint16(c,d,!0):t===en.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===en.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=mb(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=en.FLOAT;else if(e.array.constructor===Uint32Array)a=en.UNSIGNED_INT;else if(e.array.constructor===Uint16Array)a=en.UNSIGNED_SHORT;else if(e.array.constructor===Uint8Array)a=en.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=Jre(e,r,i);let A;t!==void 0&&(A=e===t.index?en.ELEMENT_ARRAY_BUFFER:en.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=JU();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!==Lr&&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(qU(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:ns[e.magFilter],minFilter:ns[e.minFilter],wrapS:ns[e.wrapS],wrapT:ns[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(_p(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===hi&&(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 B in e.morphTargetDictionary)_[e.morphTargetDictionary[B]]=B;for(let B=0;B0&&(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 T=this.getUID(o.index);(m[w].start!==void 0||m[w].count!==void 0)&&(T+=":"+m[w].start+":"+m[w].count),t.attributes.has(T)?_.indices=t.attributes.get(T):(_.indices=this.processAccessor(o.index,o,m[w].start,m[w].count),t.attributes.set(T,_.indices)),_.indices===null&&delete _.indices}const B=this.processMaterial(g[m[w].materialIndex]);B!==null&&(_.material=B),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=rT.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 fw;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 tie{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 nie{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 rie{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 iie{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 sie{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 oie{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 aie{constructor(e){this.writer=e,this.name="KHR_materials_specular"}writeMaterial(e,t){if(!e.isMeshPhysicalMaterial||e.specularIntensity===1&&e.specularColor.equals(jre)&&!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}}rT.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 cie(n){var e=h5(n),t=e[0],r=e[1];return(t+r)*3/4-r}function uie(n,e,t){return(e+t)*3/4-t}function fie(n){var e,t=h5(n),r=t[0],i=t[1],s=new lie(uie(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 hie(n){return Xo[n>>18&63]+Xo[n>>12&63]+Xo[n>>6&63]+Xo[n&63]}function die(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 iT={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */iT.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)};iT.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=Nx,t=rT,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 V=new Uint8Array(1),R={foo:function(){return 42}};return Object.setPrototypeOf(R,Uint8Array.prototype),Object.setPrototypeOf(V,R),V.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(V){if(V>i)throw new RangeError('The value "'+V+'" is invalid for option "size"');const R=new Uint8Array(V);return Object.setPrototypeOf(R,a.prototype),R}function a(V,R,S){if(typeof V=="number"){if(typeof R=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return u(V)}return l(V,R,S)}a.poolSize=8192;function l(V,R,S){if(typeof V=="string")return f(V,R);if(ArrayBuffer.isView(V))return p(V);if(V==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V);if(k(V,ArrayBuffer)||V&&k(V.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(k(V,SharedArrayBuffer)||V&&k(V.buffer,SharedArrayBuffer)))return d(V,R,S);if(typeof V=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const j=V.valueOf&&V.valueOf();if(j!=null&&j!==V)return a.from(j,R,S);const te=g(V);if(te)return te;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof V[Symbol.toPrimitive]=="function")return a.from(V[Symbol.toPrimitive]("string"),R,S);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof V)}a.from=function(V,R,S){return l(V,R,S)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function A(V){if(typeof V!="number")throw new TypeError('"size" argument must be of type number');if(V<0)throw new RangeError('The value "'+V+'" is invalid for option "size"')}function c(V,R,S){return A(V),V<=0?o(V):R!==void 0?typeof S=="string"?o(V).fill(R,S):o(V).fill(R):o(V)}a.alloc=function(V,R,S){return c(V,R,S)};function u(V){return A(V),o(V<0?0:m(V)|0)}a.allocUnsafe=function(V){return u(V)},a.allocUnsafeSlow=function(V){return u(V)};function f(V,R){if((typeof R!="string"||R==="")&&(R="utf8"),!a.isEncoding(R))throw new TypeError("Unknown encoding: "+R);const S=w(V,R)|0;let j=o(S);const te=j.write(V,R);return te!==S&&(j=j.slice(0,te)),j}function h(V){const R=V.length<0?0:m(V.length)|0,S=o(R);for(let j=0;j=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return V|0}function y(V){return+V!=V&&(V=0),a.alloc(+V)}a.isBuffer=function(R){return R!=null&&R._isBuffer===!0&&R!==a.prototype},a.compare=function(R,S){if(k(R,Uint8Array)&&(R=a.from(R,R.offset,R.byteLength)),k(S,Uint8Array)&&(S=a.from(S,S.offset,S.byteLength)),!a.isBuffer(R)||!a.isBuffer(S))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(R===S)return 0;let j=R.length,te=S.length;for(let le=0,ie=Math.min(j,te);lete.length?(a.isBuffer(ie)||(ie=a.from(ie)),ie.copy(te,le)):Uint8Array.prototype.set.call(te,ie,le);else if(a.isBuffer(ie))ie.copy(te,le);else throw new TypeError('"list" argument must be an Array of Buffers');le+=ie.length}return te};function w(V,R){if(a.isBuffer(V))return V.length;if(ArrayBuffer.isView(V)||k(V,ArrayBuffer))return V.byteLength;if(typeof V!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof V);const S=V.length,j=arguments.length>2&&arguments[2]===!0;if(!j&&S===0)return 0;let te=!1;for(;;)switch(R){case"ascii":case"latin1":case"binary":return S;case"utf8":case"utf-8":return q(V).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S*2;case"hex":return S>>>1;case"base64":return be(V).length;default:if(te)return j?-1:q(V).length;R=(""+R).toLowerCase(),te=!0}}a.byteLength=w;function x(V,R,S){let j=!1;if((R===void 0||R<0)&&(R=0),R>this.length||((S===void 0||S>this.length)&&(S=this.length),S<=0)||(S>>>=0,R>>>=0,S<=R))return"";for(V||(V="utf8");;)switch(V){case"hex":return z(this,R,S);case"utf8":case"utf-8":return v(this,R,S);case"ascii":return P(this,R,S);case"latin1":case"binary":return O(this,R,S);case"base64":return I(this,R,S);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,R,S);default:if(j)throw new TypeError("Unknown encoding: "+V);V=(V+"").toLowerCase(),j=!0}}a.prototype._isBuffer=!0;function _(V,R,S){const j=V[R];V[R]=V[S],V[S]=j}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 S=0;SS&&(R+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(R,S,j,te,le){if(k(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(S===void 0&&(S=0),j===void 0&&(j=R?R.length:0),te===void 0&&(te=0),le===void 0&&(le=this.length),S<0||j>R.length||te<0||le>this.length)throw new RangeError("out of range index");if(te>=le&&S>=j)return 0;if(te>=le)return-1;if(S>=j)return 1;if(S>>>=0,j>>>=0,te>>>=0,le>>>=0,this===R)return 0;let ie=le-te,Ie=j-S;const Te=Math.min(ie,Ie),Le=this.slice(te,le),He=R.slice(S,j);for(let De=0;De2147483647?S=2147483647:S<-2147483648&&(S=-2147483648),S=+S,W(S)&&(S=te?0:V.length-1),S<0&&(S=V.length+S),S>=V.length){if(te)return-1;S=V.length-1}else if(S<0)if(te)S=0;else return-1;if(typeof R=="string"&&(R=a.from(R,j)),a.isBuffer(R))return R.length===0?-1:T(V,R,S,j,te);if(typeof R=="number")return R=R&255,typeof Uint8Array.prototype.indexOf=="function"?te?Uint8Array.prototype.indexOf.call(V,R,S):Uint8Array.prototype.lastIndexOf.call(V,R,S):T(V,[R],S,j,te);throw new TypeError("val must be string, number or Buffer")}function T(V,R,S,j,te){let le=1,ie=V.length,Ie=R.length;if(j!==void 0&&(j=String(j).toLowerCase(),j==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(V.length<2||R.length<2)return-1;le=2,ie/=2,Ie/=2,S/=2}function Te(He,De){return le===1?He[De]:He.readUInt16BE(De*le)}let Le;if(te){let He=-1;for(Le=S;Leie&&(S=ie-Ie),Le=S;Le>=0;Le--){let He=!0;for(let De=0;Dete&&(j=te)):j=te;const le=R.length;j>le/2&&(j=le/2);let ie;for(ie=0;ie>>0,isFinite(j)?(j=j>>>0,te===void 0&&(te="utf8")):(te=j,j=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const le=this.length-S;if((j===void 0||j>le)&&(j=le),R.length>0&&(j<0||S<0)||S>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,S,j);case"utf8":case"utf-8":return M(this,R,S,j);case"ascii":case"latin1":case"binary":return D(this,R,S,j);case"base64":return Y(this,R,S,j);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,R,S,j);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(V,R,S){return R===0&&S===V.length?e.fromByteArray(V):e.fromByteArray(V.slice(R,S))}function v(V,R,S){S=Math.min(V.length,S);const j=[];let te=R;for(;te239?4:le>223?3:le>191?2:1;if(te+Ie<=S){let Te,Le,He,De;switch(Ie){case 1:le<128&&(ie=le);break;case 2:Te=V[te+1],(Te&192)===128&&(De=(le&31)<<6|Te&63,De>127&&(ie=De));break;case 3:Te=V[te+1],Le=V[te+2],(Te&192)===128&&(Le&192)===128&&(De=(le&15)<<12|(Te&63)<<6|Le&63,De>2047&&(De<55296||De>57343)&&(ie=De));break;case 4:Te=V[te+1],Le=V[te+2],He=V[te+3],(Te&192)===128&&(Le&192)===128&&(He&192)===128&&(De=(le&15)<<18|(Te&63)<<12|(Le&63)<<6|He&63,De>65535&&De<1114112&&(ie=De))}}ie===null?(ie=65533,Ie=1):ie>65535&&(ie-=65536,j.push(ie>>>10&1023|55296),ie=56320|ie&1023),j.push(ie),te+=Ie}return F(j)}const B=4096;function F(V){const R=V.length;if(R<=B)return String.fromCharCode.apply(String,V);let S="",j=0;for(;jj)&&(S=j);let te="";for(let le=R;lej&&(R=j),S<0?(S+=j,S<0&&(S=0)):S>j&&(S=j),SS)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(R,S,j){R=R>>>0,S=S>>>0,j||Q(R,S,this.length);let te=this[R],le=1,ie=0;for(;++ie>>0,S=S>>>0,j||Q(R,S,this.length);let te=this[R+--S],le=1;for(;S>0&&(le*=256);)te+=this[R+--S]*le;return te},a.prototype.readUint8=a.prototype.readUInt8=function(R,S){return R=R>>>0,S||Q(R,1,this.length),this[R]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(R,S){return R=R>>>0,S||Q(R,2,this.length),this[R]|this[R+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(R,S){return R=R>>>0,S||Q(R,2,this.length),this[R]<<8|this[R+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(R,S){return R=R>>>0,S||Q(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,S){return R=R>>>0,S||Q(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,xe(R,"offset");const S=this[R],j=this[R+7];(S===void 0||j===void 0)&&L(R,this.length-8);const te=S+this[++R]*2**8+this[++R]*2**16+this[++R]*2**24,le=this[++R]+this[++R]*2**8+this[++R]*2**16+j*2**24;return BigInt(te)+(BigInt(le)<>>0,xe(R,"offset");const S=this[R],j=this[R+7];(S===void 0||j===void 0)&&L(R,this.length-8);const te=S*2**24+this[++R]*2**16+this[++R]*2**8+this[++R],le=this[++R]*2**24+this[++R]*2**16+this[++R]*2**8+j;return(BigInt(te)<>>0,S=S>>>0,j||Q(R,S,this.length);let te=this[R],le=1,ie=0;for(;++ie=le&&(te-=Math.pow(2,8*S)),te},a.prototype.readIntBE=function(R,S,j){R=R>>>0,S=S>>>0,j||Q(R,S,this.length);let te=S,le=1,ie=this[R+--te];for(;te>0&&(le*=256);)ie+=this[R+--te]*le;return le*=128,ie>=le&&(ie-=Math.pow(2,8*S)),ie},a.prototype.readInt8=function(R,S){return R=R>>>0,S||Q(R,1,this.length),this[R]&128?(255-this[R]+1)*-1:this[R]},a.prototype.readInt16LE=function(R,S){R=R>>>0,S||Q(R,2,this.length);const j=this[R]|this[R+1]<<8;return j&32768?j|4294901760:j},a.prototype.readInt16BE=function(R,S){R=R>>>0,S||Q(R,2,this.length);const j=this[R+1]|this[R]<<8;return j&32768?j|4294901760:j},a.prototype.readInt32LE=function(R,S){return R=R>>>0,S||Q(R,4,this.length),this[R]|this[R+1]<<8|this[R+2]<<16|this[R+3]<<24},a.prototype.readInt32BE=function(R,S){return R=R>>>0,S||Q(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,xe(R,"offset");const S=this[R],j=this[R+7];(S===void 0||j===void 0)&&L(R,this.length-8);const te=this[R+4]+this[R+5]*2**8+this[R+6]*2**16+(j<<24);return(BigInt(te)<>>0,xe(R,"offset");const S=this[R],j=this[R+7];(S===void 0||j===void 0)&&L(R,this.length-8);const te=(S<<24)+this[++R]*2**16+this[++R]*2**8+this[++R];return(BigInt(te)<>>0,S||Q(R,4,this.length),t.read(this,R,!0,23,4)},a.prototype.readFloatBE=function(R,S){return R=R>>>0,S||Q(R,4,this.length),t.read(this,R,!1,23,4)},a.prototype.readDoubleLE=function(R,S){return R=R>>>0,S||Q(R,8,this.length),t.read(this,R,!0,52,8)},a.prototype.readDoubleBE=function(R,S){return R=R>>>0,S||Q(R,8,this.length),t.read(this,R,!1,52,8)};function E(V,R,S,j,te,le){if(!a.isBuffer(V))throw new TypeError('"buffer" argument must be a Buffer instance');if(R>te||RV.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(R,S,j,te){if(R=+R,S=S>>>0,j=j>>>0,!te){const Ie=Math.pow(2,8*j)-1;E(this,R,S,j,Ie,0)}let le=1,ie=0;for(this[S]=R&255;++ie>>0,j=j>>>0,!te){const Ie=Math.pow(2,8*j)-1;E(this,R,S,j,Ie,0)}let le=j-1,ie=1;for(this[S+le]=R&255;--le>=0&&(ie*=256);)this[S+le]=R/ie&255;return S+j},a.prototype.writeUint8=a.prototype.writeUInt8=function(R,S,j){return R=+R,S=S>>>0,j||E(this,R,S,1,255,0),this[S]=R&255,S+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(R,S,j){return R=+R,S=S>>>0,j||E(this,R,S,2,65535,0),this[S]=R&255,this[S+1]=R>>>8,S+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(R,S,j){return R=+R,S=S>>>0,j||E(this,R,S,2,65535,0),this[S]=R>>>8,this[S+1]=R&255,S+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(R,S,j){return R=+R,S=S>>>0,j||E(this,R,S,4,4294967295,0),this[S+3]=R>>>24,this[S+2]=R>>>16,this[S+1]=R>>>8,this[S]=R&255,S+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(R,S,j){return R=+R,S=S>>>0,j||E(this,R,S,4,4294967295,0),this[S]=R>>>24,this[S+1]=R>>>16,this[S+2]=R>>>8,this[S+3]=R&255,S+4};function G(V,R,S,j,te){_e(R,j,te,V,S,7);let le=Number(R&BigInt(4294967295));V[S++]=le,le=le>>8,V[S++]=le,le=le>>8,V[S++]=le,le=le>>8,V[S++]=le;let ie=Number(R>>BigInt(32)&BigInt(4294967295));return V[S++]=ie,ie=ie>>8,V[S++]=ie,ie=ie>>8,V[S++]=ie,ie=ie>>8,V[S++]=ie,S}function ee(V,R,S,j,te){_e(R,j,te,V,S,7);let le=Number(R&BigInt(4294967295));V[S+7]=le,le=le>>8,V[S+6]=le,le=le>>8,V[S+5]=le,le=le>>8,V[S+4]=le;let ie=Number(R>>BigInt(32)&BigInt(4294967295));return V[S+3]=ie,ie=ie>>8,V[S+2]=ie,ie=ie>>8,V[S+1]=ie,ie=ie>>8,V[S]=ie,S+8}a.prototype.writeBigUInt64LE=he(function(R,S=0){return G(this,R,S,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=he(function(R,S=0){return ee(this,R,S,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(R,S,j,te){if(R=+R,S=S>>>0,!te){const Te=Math.pow(2,8*j-1);E(this,R,S,j,Te-1,-Te)}let le=0,ie=1,Ie=0;for(this[S]=R&255;++le>0)-Ie&255;return S+j},a.prototype.writeIntBE=function(R,S,j,te){if(R=+R,S=S>>>0,!te){const Te=Math.pow(2,8*j-1);E(this,R,S,j,Te-1,-Te)}let le=j-1,ie=1,Ie=0;for(this[S+le]=R&255;--le>=0&&(ie*=256);)R<0&&Ie===0&&this[S+le+1]!==0&&(Ie=1),this[S+le]=(R/ie>>0)-Ie&255;return S+j},a.prototype.writeInt8=function(R,S,j){return R=+R,S=S>>>0,j||E(this,R,S,1,127,-128),R<0&&(R=255+R+1),this[S]=R&255,S+1},a.prototype.writeInt16LE=function(R,S,j){return R=+R,S=S>>>0,j||E(this,R,S,2,32767,-32768),this[S]=R&255,this[S+1]=R>>>8,S+2},a.prototype.writeInt16BE=function(R,S,j){return R=+R,S=S>>>0,j||E(this,R,S,2,32767,-32768),this[S]=R>>>8,this[S+1]=R&255,S+2},a.prototype.writeInt32LE=function(R,S,j){return R=+R,S=S>>>0,j||E(this,R,S,4,2147483647,-2147483648),this[S]=R&255,this[S+1]=R>>>8,this[S+2]=R>>>16,this[S+3]=R>>>24,S+4},a.prototype.writeInt32BE=function(R,S,j){return R=+R,S=S>>>0,j||E(this,R,S,4,2147483647,-2147483648),R<0&&(R=4294967295+R+1),this[S]=R>>>24,this[S+1]=R>>>16,this[S+2]=R>>>8,this[S+3]=R&255,S+4},a.prototype.writeBigInt64LE=he(function(R,S=0){return G(this,R,S,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=he(function(R,S=0){return ee(this,R,S,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function U(V,R,S,j,te,le){if(S+j>V.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("Index out of range")}function X(V,R,S,j,te){return R=+R,S=S>>>0,te||U(V,R,S,4),t.write(V,R,S,j,23,4),S+4}a.prototype.writeFloatLE=function(R,S,j){return X(this,R,S,!0,j)},a.prototype.writeFloatBE=function(R,S,j){return X(this,R,S,!1,j)};function ae(V,R,S,j,te){return R=+R,S=S>>>0,te||U(V,R,S,8),t.write(V,R,S,j,52,8),S+8}a.prototype.writeDoubleLE=function(R,S,j){return ae(this,R,S,!0,j)},a.prototype.writeDoubleBE=function(R,S,j){return ae(this,R,S,!1,j)},a.prototype.copy=function(R,S,j,te){if(!a.isBuffer(R))throw new TypeError("argument should be a Buffer");if(j||(j=0),!te&&te!==0&&(te=this.length),S>=R.length&&(S=R.length),S||(S=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-S>>0,j=j===void 0?this.length:j>>>0,R||(R=0);let le;if(typeof R=="number")for(le=S;le2**32?te=se(String(S)):typeof S=="bigint"&&(te=String(S),(S>BigInt(2)**BigInt(32)||S<-(BigInt(2)**BigInt(32)))&&(te=se(te)),te+="n"),j+=` It must be ${R}. Received ${te}`,j},RangeError);function se(V){let R="",S=V.length;const j=V[0]==="-"?1:0;for(;S>=j+4;S-=3)R=`_${V.slice(S-3,S)}${R}`;return`${V.slice(0,S)}${R}`}function pe(V,R,S){xe(R,"offset"),(V[R]===void 0||V[R+S]===void 0)&&L(R,V.length-(S+1))}function _e(V,R,S,j,te,le){if(V>S||V3?R===0||R===BigInt(0)?Ie=`>= 0${ie} and < 2${ie} ** ${(le+1)*8}${ie}`:Ie=`>= -(2${ie} ** ${(le+1)*8-1}${ie}) and < 2 ** ${(le+1)*8-1}${ie}`:Ie=`>= ${R}${ie} and <= ${S}${ie}`,new oe.ERR_OUT_OF_RANGE("value",Ie,V)}pe(j,te,le)}function xe(V,R){if(typeof V!="number")throw new oe.ERR_INVALID_ARG_TYPE(R,"number",V)}function L(V,R,S){throw Math.floor(V)!==V?(xe(V,S),new oe.ERR_OUT_OF_RANGE(S||"offset","an integer",V)):R<0?new oe.ERR_BUFFER_OUT_OF_BOUNDS:new oe.ERR_OUT_OF_RANGE(S||"offset",`>= ${S?1:0} and <= ${R}`,V)}const ue=/[^+/0-9A-Za-z-_]/g;function Ae(V){if(V=V.split("=")[0],V=V.trim().replace(ue,""),V.length<2)return"";for(;V.length%4!==0;)V=V+"=";return V}function q(V,R){R=R||1/0;let S;const j=V.length;let te=null;const le=[];for(let ie=0;ie55295&&S<57344){if(!te){if(S>56319){(R-=3)>-1&&le.push(239,191,189);continue}else if(ie+1===j){(R-=3)>-1&&le.push(239,191,189);continue}te=S;continue}if(S<56320){(R-=3)>-1&&le.push(239,191,189),te=S;continue}S=(te-55296<<10|S-56320)+65536}else te&&(R-=3)>-1&&le.push(239,191,189);if(te=null,S<128){if((R-=1)<0)break;le.push(S)}else if(S<2048){if((R-=2)<0)break;le.push(S>>6|192,S&63|128)}else if(S<65536){if((R-=3)<0)break;le.push(S>>12|224,S>>6&63|128,S&63|128)}else if(S<1114112){if((R-=4)<0)break;le.push(S>>18|240,S>>12&63|128,S>>6&63|128,S&63|128)}else throw new Error("Invalid code point")}return le}function J(V){const R=[];for(let S=0;S>8,te=S%256,le.push(te),le.push(j);return le}function be(V){return e.toByteArray(Ae(V))}function Be(V,R,S,j){let te;for(te=0;te=R.length||te>=V.length);++te)R[te+S]=V[te];return te}function k(V,R){return V instanceof R||V!=null&&V.constructor!=null&&V.constructor.name!=null&&V.constructor.name===R.name}function W(V){return V!==V}const re=function(){const V="0123456789abcdef",R=new Array(256);for(let S=0;S<16;++S){const j=S*16;for(let te=0;te<16;++te)R[j+te]=V[S]+V[te]}return R}();function he(V){return typeof BigInt>"u"?me:V}function me(){throw new Error("BigInt not supported")}})(u5);/*! + */(function(n){const e=kx,t=iT,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,S){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,S)}a.poolSize=8192;function l(G,R,S){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(Q(G,ArrayBuffer)||G&&Q(G.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Q(G,SharedArrayBuffer)||G&&Q(G.buffer,SharedArrayBuffer)))return d(G,R,S);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,S);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,S);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,S){return l(G,R,S)},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,S){return A(G),G<=0?o(G):R!==void 0?typeof S=="string"?o(G).fill(R,S):o(G).fill(R):o(G)}a.alloc=function(G,R,S){return c(G,R,S)};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 S=w(G,R)|0;let V=o(S);const te=V.write(G,R);return te!==S&&(V=V.slice(0,te)),V}function h(G){const R=G.length<0?0:m(G.length)|0,S=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,S){if(Q(R,Uint8Array)&&(R=a.from(R,R.offset,R.byteLength)),Q(S,Uint8Array)&&(S=a.from(S,S.offset,S.byteLength)),!a.isBuffer(R)||!a.isBuffer(S))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(R===S)return 0;let V=R.length,te=S.length;for(let ae=0,se=Math.min(V,te);aete.length?(a.isBuffer(se)||(se=a.from(se)),se.copy(te,ae)):Uint8Array.prototype.set.call(te,se,ae);else if(a.isBuffer(se))se.copy(te,ae);else throw new TypeError('"list" argument must be an Array of Buffers');ae+=se.length}return te};function w(G,R){if(a.isBuffer(G))return G.length;if(ArrayBuffer.isView(G)||Q(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 S=G.length,V=arguments.length>2&&arguments[2]===!0;if(!V&&S===0)return 0;let te=!1;for(;;)switch(R){case"ascii":case"latin1":case"binary":return S;case"utf8":case"utf-8":return q(G).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S*2;case"hex":return S>>>1;case"base64":return be(G).length;default:if(te)return V?-1:q(G).length;R=(""+R).toLowerCase(),te=!0}}a.byteLength=w;function x(G,R,S){let V=!1;if((R===void 0||R<0)&&(R=0),R>this.length||((S===void 0||S>this.length)&&(S=this.length),S<=0)||(S>>>=0,R>>>=0,S<=R))return"";for(G||(G="utf8");;)switch(G){case"hex":return z(this,R,S);case"utf8":case"utf-8":return v(this,R,S);case"ascii":return U(this,R,S);case"latin1":case"binary":return P(this,R,S);case"base64":return I(this,R,S);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return W(this,R,S);default:if(V)throw new TypeError("Unknown encoding: "+G);G=(G+"").toLowerCase(),V=!0}}a.prototype._isBuffer=!0;function _(G,R,S){const V=G[R];G[R]=G[S],G[S]=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 S=0;SS&&(R+=" ... "),""},r&&(a.prototype[r]=a.prototype.inspect),a.prototype.compare=function(R,S,V,te,ae){if(Q(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(S===void 0&&(S=0),V===void 0&&(V=R?R.length:0),te===void 0&&(te=0),ae===void 0&&(ae=this.length),S<0||V>R.length||te<0||ae>this.length)throw new RangeError("out of range index");if(te>=ae&&S>=V)return 0;if(te>=ae)return-1;if(S>=V)return 1;if(S>>>=0,V>>>=0,te>>>=0,ae>>>=0,this===R)return 0;let se=ae-te,Ie=V-S;const Te=Math.min(se,Ie),Le=this.slice(te,ae),He=R.slice(S,V);for(let De=0;De2147483647?S=2147483647:S<-2147483648&&(S=-2147483648),S=+S,K(S)&&(S=te?0:G.length-1),S<0&&(S=G.length+S),S>=G.length){if(te)return-1;S=G.length-1}else if(S<0)if(te)S=0;else return-1;if(typeof R=="string"&&(R=a.from(R,V)),a.isBuffer(R))return R.length===0?-1:T(G,R,S,V,te);if(typeof R=="number")return R=R&255,typeof Uint8Array.prototype.indexOf=="function"?te?Uint8Array.prototype.indexOf.call(G,R,S):Uint8Array.prototype.lastIndexOf.call(G,R,S):T(G,[R],S,V,te);throw new TypeError("val must be string, number or Buffer")}function T(G,R,S,V,te){let ae=1,se=G.length,Ie=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,se/=2,Ie/=2,S/=2}function Te(He,De){return ae===1?He[De]:He.readUInt16BE(De*ae)}let Le;if(te){let He=-1;for(Le=S;Lese&&(S=se-Ie),Le=S;Le>=0;Le--){let He=!0;for(let De=0;Dete&&(V=te)):V=te;const ae=R.length;V>ae/2&&(V=ae/2);let se;for(se=0;se>>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-S;if((V===void 0||V>ae)&&(V=ae),R.length>0&&(V<0||S<0)||S>this.length)throw new RangeError("Attempt to write outside buffer bounds");te||(te="utf8");let se=!1;for(;;)switch(te){case"hex":return b(this,R,S,V);case"utf8":case"utf-8":return M(this,R,S,V);case"ascii":case"latin1":case"binary":return O(this,R,S,V);case"base64":return Y(this,R,S,V);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,R,S,V);default:if(se)throw new TypeError("Unknown encoding: "+te);te=(""+te).toLowerCase(),se=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function I(G,R,S){return R===0&&S===G.length?e.fromByteArray(G):e.fromByteArray(G.slice(R,S))}function v(G,R,S){S=Math.min(G.length,S);const V=[];let te=R;for(;te239?4:ae>223?3:ae>191?2:1;if(te+Ie<=S){let Te,Le,He,De;switch(Ie){case 1:ae<128&&(se=ae);break;case 2:Te=G[te+1],(Te&192)===128&&(De=(ae&31)<<6|Te&63,De>127&&(se=De));break;case 3:Te=G[te+1],Le=G[te+2],(Te&192)===128&&(Le&192)===128&&(De=(ae&15)<<12|(Te&63)<<6|Le&63,De>2047&&(De<55296||De>57343)&&(se=De));break;case 4:Te=G[te+1],Le=G[te+2],He=G[te+3],(Te&192)===128&&(Le&192)===128&&(He&192)===128&&(De=(ae&15)<<18|(Te&63)<<12|(Le&63)<<6|He&63,De>65535&&De<1114112&&(se=De))}}se===null?(se=65533,Ie=1):se>65535&&(se-=65536,V.push(se>>>10&1023|55296),se=56320|se&1023),V.push(se),te+=Ie}return L(V)}const E=4096;function L(G){const R=G.length;if(R<=E)return String.fromCharCode.apply(String,G);let S="",V=0;for(;VV)&&(S=V);let te="";for(let ae=R;aeV&&(R=V),S<0?(S+=V,S<0&&(S=0)):S>V&&(S=V),SS)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(R,S,V){R=R>>>0,S=S>>>0,V||N(R,S,this.length);let te=this[R],ae=1,se=0;for(;++se>>0,S=S>>>0,V||N(R,S,this.length);let te=this[R+--S],ae=1;for(;S>0&&(ae*=256);)te+=this[R+--S]*ae;return te},a.prototype.readUint8=a.prototype.readUInt8=function(R,S){return R=R>>>0,S||N(R,1,this.length),this[R]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(R,S){return R=R>>>0,S||N(R,2,this.length),this[R]|this[R+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(R,S){return R=R>>>0,S||N(R,2,this.length),this[R]<<8|this[R+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(R,S){return R=R>>>0,S||N(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,S){return R=R>>>0,S||N(R,4,this.length),this[R]*16777216+(this[R+1]<<16|this[R+2]<<8|this[R+3])},a.prototype.readBigUInt64LE=de(function(R){R=R>>>0,_e(R,"offset");const S=this[R],V=this[R+7];(S===void 0||V===void 0)&&D(R,this.length-8);const te=S+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,_e(R,"offset");const S=this[R],V=this[R+7];(S===void 0||V===void 0)&&D(R,this.length-8);const te=S*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,S=S>>>0,V||N(R,S,this.length);let te=this[R],ae=1,se=0;for(;++se=ae&&(te-=Math.pow(2,8*S)),te},a.prototype.readIntBE=function(R,S,V){R=R>>>0,S=S>>>0,V||N(R,S,this.length);let te=S,ae=1,se=this[R+--te];for(;te>0&&(ae*=256);)se+=this[R+--te]*ae;return ae*=128,se>=ae&&(se-=Math.pow(2,8*S)),se},a.prototype.readInt8=function(R,S){return R=R>>>0,S||N(R,1,this.length),this[R]&128?(255-this[R]+1)*-1:this[R]},a.prototype.readInt16LE=function(R,S){R=R>>>0,S||N(R,2,this.length);const V=this[R]|this[R+1]<<8;return V&32768?V|4294901760:V},a.prototype.readInt16BE=function(R,S){R=R>>>0,S||N(R,2,this.length);const V=this[R+1]|this[R]<<8;return V&32768?V|4294901760:V},a.prototype.readInt32LE=function(R,S){return R=R>>>0,S||N(R,4,this.length),this[R]|this[R+1]<<8|this[R+2]<<16|this[R+3]<<24},a.prototype.readInt32BE=function(R,S){return R=R>>>0,S||N(R,4,this.length),this[R]<<24|this[R+1]<<16|this[R+2]<<8|this[R+3]},a.prototype.readBigInt64LE=de(function(R){R=R>>>0,_e(R,"offset");const S=this[R],V=this[R+7];(S===void 0||V===void 0)&&D(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,_e(R,"offset");const S=this[R],V=this[R+7];(S===void 0||V===void 0)&&D(R,this.length-8);const te=(S<<24)+this[++R]*2**16+this[++R]*2**8+this[++R];return(BigInt(te)<>>0,S||N(R,4,this.length),t.read(this,R,!0,23,4)},a.prototype.readFloatBE=function(R,S){return R=R>>>0,S||N(R,4,this.length),t.read(this,R,!1,23,4)},a.prototype.readDoubleLE=function(R,S){return R=R>>>0,S||N(R,8,this.length),t.read(this,R,!0,52,8)},a.prototype.readDoubleBE=function(R,S){return R=R>>>0,S||N(R,8,this.length),t.read(this,R,!1,52,8)};function C(G,R,S,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,S,V,te){if(R=+R,S=S>>>0,V=V>>>0,!te){const Ie=Math.pow(2,8*V)-1;C(this,R,S,V,Ie,0)}let ae=1,se=0;for(this[S]=R&255;++se>>0,V=V>>>0,!te){const Ie=Math.pow(2,8*V)-1;C(this,R,S,V,Ie,0)}let ae=V-1,se=1;for(this[S+ae]=R&255;--ae>=0&&(se*=256);)this[S+ae]=R/se&255;return S+V},a.prototype.writeUint8=a.prototype.writeUInt8=function(R,S,V){return R=+R,S=S>>>0,V||C(this,R,S,1,255,0),this[S]=R&255,S+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(R,S,V){return R=+R,S=S>>>0,V||C(this,R,S,2,65535,0),this[S]=R&255,this[S+1]=R>>>8,S+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(R,S,V){return R=+R,S=S>>>0,V||C(this,R,S,2,65535,0),this[S]=R>>>8,this[S+1]=R&255,S+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(R,S,V){return R=+R,S=S>>>0,V||C(this,R,S,4,4294967295,0),this[S+3]=R>>>24,this[S+2]=R>>>16,this[S+1]=R>>>8,this[S]=R&255,S+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(R,S,V){return R=+R,S=S>>>0,V||C(this,R,S,4,4294967295,0),this[S]=R>>>24,this[S+1]=R>>>16,this[S+2]=R>>>8,this[S+3]=R&255,S+4};function j(G,R,S,V,te){xe(R,V,te,G,S,7);let ae=Number(R&BigInt(4294967295));G[S++]=ae,ae=ae>>8,G[S++]=ae,ae=ae>>8,G[S++]=ae,ae=ae>>8,G[S++]=ae;let se=Number(R>>BigInt(32)&BigInt(4294967295));return G[S++]=se,se=se>>8,G[S++]=se,se=se>>8,G[S++]=se,se=se>>8,G[S++]=se,S}function ee(G,R,S,V,te){xe(R,V,te,G,S,7);let ae=Number(R&BigInt(4294967295));G[S+7]=ae,ae=ae>>8,G[S+6]=ae,ae=ae>>8,G[S+5]=ae,ae=ae>>8,G[S+4]=ae;let se=Number(R>>BigInt(32)&BigInt(4294967295));return G[S+3]=se,se=se>>8,G[S+2]=se,se=se>>8,G[S+1]=se,se=se>>8,G[S]=se,S+8}a.prototype.writeBigUInt64LE=de(function(R,S=0){return j(this,R,S,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=de(function(R,S=0){return ee(this,R,S,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(R,S,V,te){if(R=+R,S=S>>>0,!te){const Te=Math.pow(2,8*V-1);C(this,R,S,V,Te-1,-Te)}let ae=0,se=1,Ie=0;for(this[S]=R&255;++ae>0)-Ie&255;return S+V},a.prototype.writeIntBE=function(R,S,V,te){if(R=+R,S=S>>>0,!te){const Te=Math.pow(2,8*V-1);C(this,R,S,V,Te-1,-Te)}let ae=V-1,se=1,Ie=0;for(this[S+ae]=R&255;--ae>=0&&(se*=256);)R<0&&Ie===0&&this[S+ae+1]!==0&&(Ie=1),this[S+ae]=(R/se>>0)-Ie&255;return S+V},a.prototype.writeInt8=function(R,S,V){return R=+R,S=S>>>0,V||C(this,R,S,1,127,-128),R<0&&(R=255+R+1),this[S]=R&255,S+1},a.prototype.writeInt16LE=function(R,S,V){return R=+R,S=S>>>0,V||C(this,R,S,2,32767,-32768),this[S]=R&255,this[S+1]=R>>>8,S+2},a.prototype.writeInt16BE=function(R,S,V){return R=+R,S=S>>>0,V||C(this,R,S,2,32767,-32768),this[S]=R>>>8,this[S+1]=R&255,S+2},a.prototype.writeInt32LE=function(R,S,V){return R=+R,S=S>>>0,V||C(this,R,S,4,2147483647,-2147483648),this[S]=R&255,this[S+1]=R>>>8,this[S+2]=R>>>16,this[S+3]=R>>>24,S+4},a.prototype.writeInt32BE=function(R,S,V){return R=+R,S=S>>>0,V||C(this,R,S,4,2147483647,-2147483648),R<0&&(R=4294967295+R+1),this[S]=R>>>24,this[S+1]=R>>>16,this[S+2]=R>>>8,this[S+3]=R&255,S+4},a.prototype.writeBigInt64LE=de(function(R,S=0){return j(this,R,S,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=de(function(R,S=0){return ee(this,R,S,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function F(G,R,S,V,te,ae){if(S+V>G.length)throw new RangeError("Index out of range");if(S<0)throw new RangeError("Index out of range")}function X(G,R,S,V,te){return R=+R,S=S>>>0,te||F(G,R,S,4),t.write(G,R,S,V,23,4),S+4}a.prototype.writeFloatLE=function(R,S,V){return X(this,R,S,!0,V)},a.prototype.writeFloatBE=function(R,S,V){return X(this,R,S,!1,V)};function ue(G,R,S,V,te){return R=+R,S=S>>>0,te||F(G,R,S,8),t.write(G,R,S,V,52,8),S+8}a.prototype.writeDoubleLE=function(R,S,V){return ue(this,R,S,!0,V)},a.prototype.writeDoubleBE=function(R,S,V){return ue(this,R,S,!1,V)},a.prototype.copy=function(R,S,V,te){if(!a.isBuffer(R))throw new TypeError("argument should be a Buffer");if(V||(V=0),!te&&te!==0&&(te=this.length),S>=R.length&&(S=R.length),S||(S=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-S>>0,V=V===void 0?this.length:V>>>0,R||(R=0);let ae;if(typeof R=="number")for(ae=S;ae2**32?te=oe(String(S)):typeof S=="bigint"&&(te=String(S),(S>BigInt(2)**BigInt(32)||S<-(BigInt(2)**BigInt(32)))&&(te=oe(te)),te+="n"),V+=` It must be ${R}. Received ${te}`,V},RangeError);function oe(G){let R="",S=G.length;const V=G[0]==="-"?1:0;for(;S>=V+4;S-=3)R=`_${G.slice(S-3,S)}${R}`;return`${G.slice(0,S)}${R}`}function pe(G,R,S){_e(R,"offset"),(G[R]===void 0||G[R+S]===void 0)&&D(R,G.length-(S+1))}function xe(G,R,S,V,te,ae){if(G>S||G3?R===0||R===BigInt(0)?Ie=`>= 0${se} and < 2${se} ** ${(ae+1)*8}${se}`:Ie=`>= -(2${se} ** ${(ae+1)*8-1}${se}) and < 2 ** ${(ae+1)*8-1}${se}`:Ie=`>= ${R}${se} and <= ${S}${se}`,new re.ERR_OUT_OF_RANGE("value",Ie,G)}pe(V,te,ae)}function _e(G,R){if(typeof G!="number")throw new re.ERR_INVALID_ARG_TYPE(R,"number",G)}function D(G,R,S){throw Math.floor(G)!==G?(_e(G,S),new re.ERR_OUT_OF_RANGE(S||"offset","an integer",G)):R<0?new re.ERR_BUFFER_OUT_OF_BOUNDS:new re.ERR_OUT_OF_RANGE(S||"offset",`>= ${S?1:0} and <= ${R}`,G)}const Ae=/[^+/0-9A-Za-z-_]/g;function le(G){if(G=G.split("=")[0],G=G.trim().replace(Ae,""),G.length<2)return"";for(;G.length%4!==0;)G=G+"=";return G}function q(G,R){R=R||1/0;let S;const V=G.length;let te=null;const ae=[];for(let se=0;se55295&&S<57344){if(!te){if(S>56319){(R-=3)>-1&&ae.push(239,191,189);continue}else if(se+1===V){(R-=3)>-1&&ae.push(239,191,189);continue}te=S;continue}if(S<56320){(R-=3)>-1&&ae.push(239,191,189),te=S;continue}S=(te-55296<<10|S-56320)+65536}else te&&(R-=3)>-1&&ae.push(239,191,189);if(te=null,S<128){if((R-=1)<0)break;ae.push(S)}else if(S<2048){if((R-=2)<0)break;ae.push(S>>6|192,S&63|128)}else if(S<65536){if((R-=3)<0)break;ae.push(S>>12|224,S>>6&63|128,S&63|128)}else if(S<1114112){if((R-=4)<0)break;ae.push(S>>18|240,S>>12&63|128,S>>6&63|128,S&63|128)}else throw new Error("Invalid code point")}return ae}function J(G){const R=[];for(let S=0;S>8,te=S%256,ae.push(te),ae.push(V);return ae}function be(G){return e.toByteArray(le(G))}function Be(G,R,S,V){let te;for(te=0;te=R.length||te>=G.length);++te)R[te+S]=G[te];return te}function Q(G,R){return G instanceof R||G!=null&&G.constructor!=null&&G.constructor.name!=null&&G.constructor.name===R.name}function K(G){return G!==G}const ie=function(){const G="0123456789abcdef",R=new Array(256);for(let S=0;S<16;++S){const V=S*16;for(let te=0;te<16;++te)R[V+te]=G[S]+G[te]}return R}();function de(G){return typeof BigInt>"u"?me:G}function me(){throw new Error("BigInt not supported")}})(f5);/*! * html2canvas 1.4.1 * Copyright (c) 2022 Niklas von Hertzen * Released under MIT License @@ -3228,14 +3228,14 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var lC=function(n,e){return lC=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])},lC(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");lC(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 zi(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},qU="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",pie=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var U0=0;U0"u"?[]:new Uint8Array(256);for(var L0=0;L0>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},gie=function(n){for(var e=n.length,t=[],r=0;r>Uc,wie=1<>Uc,_ie=h5+xie,bie=_ie,Bie=32,Eie=bie+Bie,Cie=65536>>sT,Mie=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Uc],t=(t<>Uc)],t=(t<>sT),t=this.index[t],t+=e>>Uc&Sie,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var P0=0;P0rL?(i.push(!0),a-=rL):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(o),t.push(uC);if(a===Pie||a===AC){if(o===0)return r.push(o),t.push(vc);var l=t[o-1];return Gie.indexOf(l)===-1?(r.push(r[o-1]),t.push(l)):(r.push(o),t.push(vc))}if(r.push(o),a===Qie)return t.push(e==="strict"?fC:Hm);if(a===g5||a===kie)return t.push(vc);if(a===Hie)return s>=131072&&s<=196605||s>=196608&&s<=262141?t.push(Hm):t.push(vc);t.push(a)}),[r,t,i]},xb=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},cL=function(n,e){for(var t=n;t>=0;){var r=e[t];if(r===uA)t--;else return r}return 0},Wie=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===d5&&c===p5)return Tt;if(vC.indexOf(l)!==-1)return v5;if(vC.indexOf(c)!==-1||y5.indexOf(c)!==-1)return Tt;if(cL(s,e)===m5)return k0;if(gC.get(n[s])===AC||(l===O0||l===N0)&&gC.get(n[a])===AC||l===iL||c===iL||l===sL||[uA,cC,Bp].indexOf(l)===-1&&c===sL||[D0,Gd,Nie,Du,Ou].indexOf(c)!==-1||cL(s,e)===Vd||xb(yb,Vd,s,e)||xb([D0,Gd],fC,s,e)||xb(oL,oL,s,e))return Tt;if(l===uA)return k0;if(l===yb||c===yb)return Tt;if(c===uC||l===uC)return k0;if([cC,Bp,fC].indexOf(c)!==-1||l===Oie||A===pC&&Vie.indexOf(l)!==-1||l===Ou&&c===pC||c===aL||Ua.indexOf(c)!==-1&&l===Gi||Ua.indexOf(l)!==-1&&c===Gi||l===Cp&&[Hm,O0,N0].indexOf(c)!==-1||[Hm,O0,N0].indexOf(l)!==-1&&c===Ep||Ua.indexOf(l)!==-1&&lL.indexOf(c)!==-1||lL.indexOf(l)!==-1&&Ua.indexOf(c)!==-1||[Cp,Ep].indexOf(l)!==-1&&(c===Gi||[Vd,Bp].indexOf(c)!==-1&&e[a+1]===Gi)||[Vd,Bp].indexOf(l)!==-1&&c===Gi||l===Gi&&[Gi,Ou,Du].indexOf(c)!==-1)return Tt;if([Gi,Ou,Du,D0,Gd].indexOf(c)!==-1)for(var u=s;u>=0;){var f=e[u];if(f===Gi)return Tt;if([Ou,Du].indexOf(f)!==-1)u--;else break}if([Cp,Ep].indexOf(c)!==-1)for(var u=[D0,Gd].indexOf(l)!==-1?o:s;u>=0;){var f=e[u];if(f===Gi)return Tt;if([Ou,Du].indexOf(f)!==-1)u--;else break}if(mC===l&&[mC,ny,hC,dC].indexOf(c)!==-1||[ny,hC].indexOf(l)!==-1&&[ny,ry].indexOf(c)!==-1||[ry,dC].indexOf(l)!==-1&&c===ry||AL.indexOf(l)!==-1&&[aL,Ep].indexOf(c)!==-1||AL.indexOf(c)!==-1&&l===Cp||Ua.indexOf(l)!==-1&&Ua.indexOf(c)!==-1||l===Du&&Ua.indexOf(c)!==-1||Ua.concat(Gi).indexOf(l)!==-1&&c===Vd&&zie.indexOf(n[a])===-1||Ua.concat(Gi).indexOf(c)!==-1&&l===Gd)return Tt;if(l===wb&&c===wb){for(var h=t[s],p=1;h>0&&(h--,e[h]===wb);)p++;if(p%2!==0)return Tt}return l===O0&&c===N0?Tt:k0},Kie=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=jie(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[Gi,vc,g5].indexOf(a)!==-1?Hm: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]},Yie=function(){function n(e,t,r,i){this.codePoints=e,this.required=t===v5,this.start=r,this.end=i}return n.prototype.slice=function(){return jn.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),Xie=function(n,e){var t=kx(n),r=Kie(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=w5&&n<=57},Tse=function(n){return n>=55296&&n<=57343},Nu=function(n){return Wr(n)||n>=b5&&n<=E5||n>=x5&&n<=Bse},Ise=function(n){return n>=x5&&n<=Cse},Rse=function(n){return n>=b5&&n<=Sse},Fse=function(n){return Ise(n)||Rse(n)},Use=function(n){return n>=dse},V0=function(n){return n===mw||n===Jie||n===qie},gw=function(n){return Fse(n)||Use(n)||n===rse},pL=function(n){return gw(n)||Wr(n)||n===_i},Lse=function(n){return n>=vse&&n<=yse||n===wse||n>=xse&&n<=_se||n===bse},Zl=function(n,e){return n!==nm?!1:e!==mw},j0=function(n,e,t){return n===_i?gw(e)||Zl(e,t):gw(n)?!0:!!(n===nm&&Zl(n,e))},bb=function(n,e,t){return n===Bc||n===_i?Wr(e)?!0:e===zm&&Wr(t):Wr(n===zm?e:n)},Pse=function(n){var e=0,t=1;(n[e]===Bc||n[e]===_i)&&(n[e]===_i&&(t=-1),e++);for(var r=[];Wr(n[e]);)r.push(n[e++]);var i=r.length?parseInt(jn.apply(void 0,r),10):0;n[e]===zm&&e++;for(var s=[];Wr(n[e]);)s.push(n[e++]);var o=s.length,a=o?parseInt(jn.apply(void 0,s),10):0;(n[e]===B5||n[e]===_5)&&e++;var l=1;(n[e]===Bc||n[e]===_i)&&(n[e]===_i&&(l=-1),e++);for(var A=[];Wr(n[e]);)A.push(n[e++]);var c=A.length?parseInt(jn.apply(void 0,A),10):0;return t*(i+a*Math.pow(10,-o))*Math.pow(10,l*c)},Dse={type:2},Ose={type:3},Nse={type:4},kse={type:13},Qse={type:8},Hse={type:21},zse={type:9},Gse={type:10},Vse={type:11},jse={type:12},Wse={type:14},W0={type:23},Kse={type:1},Yse={type:25},Xse={type:24},$se={type:26},Zse={type:27},Jse={type:28},qse={type:29},eoe={type:31},yC={type:32},C5=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!==yC;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Q0:return this.consumeStringToken(Q0);case ese:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),i=this.peekCodePoint(2);if(pL(t)||Zl(r,i)){var s=j0(t,r,i)?Zie:$ie,o=this.consumeName();return{type:5,value:o,flags:s}}break;case tse:if(this.peekCodePoint(0)===jd)return this.consumeCodePoint(),kse;break;case H0:return this.consumeStringToken(H0);case z0:return Dse;case Wd:return Ose;case _b:if(this.peekCodePoint(0)===jd)return this.consumeCodePoint(),Wse;break;case Bc:if(bb(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case pse:return Nse;case _i:var a=e,l=this.peekCodePoint(0),A=this.peekCodePoint(1);if(bb(a,l,A))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(j0(a,l,A))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===_i&&A===ose)return this.consumeCodePoint(),this.consumeCodePoint(),Xse;break;case zm:if(bb(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case fL:if(this.peekCodePoint(0)===_b)for(this.consumeCodePoint();;){var c=this.consumeCodePoint();if(c===_b&&(c=this.consumeCodePoint(),c===fL))return this.consumeToken();if(c===Fo)return this.consumeToken()}break;case mse:return $se;case gse:return Zse;case sse:if(this.peekCodePoint(0)===ise&&this.peekCodePoint(1)===_i&&this.peekCodePoint(2)===_i)return this.consumeCodePoint(),this.consumeCodePoint(),Yse;break;case ase:var u=this.peekCodePoint(0),f=this.peekCodePoint(1),h=this.peekCodePoint(2);if(j0(u,f,h)){var o=this.consumeName();return{type:7,value:o}}break;case lse:return Jse;case nm:if(Zl(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case Ase:return qse;case cse:if(this.peekCodePoint(0)===jd)return this.consumeCodePoint(),Qse;break;case use:return Vse;case fse:return jse;case Ese:case Mse:var p=this.peekCodePoint(0),d=this.peekCodePoint(1);return p===Bc&&(Nu(d)||d===G0)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case hL:if(this.peekCodePoint(0)===jd)return this.consumeCodePoint(),zse;if(this.peekCodePoint(0)===hL)return this.consumeCodePoint(),Hse;break;case hse:if(this.peekCodePoint(0)===jd)return this.consumeCodePoint(),Gse;break;case Fo:return yC}return V0(e)?(this.consumeWhiteSpace(),eoe):Wr(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):gw(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:jn(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();Nu(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===G0&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var i=parseInt(jn.apply(void 0,e.map(function(l){return l===G0?w5:l})),16),s=parseInt(jn.apply(void 0,e.map(function(l){return l===G0?E5:l})),16);return{type:30,start:i,end:s}}var o=parseInt(jn.apply(void 0,e),16);if(this.peekCodePoint(0)===_i&&Nu(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];Nu(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var s=parseInt(jn.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)===z0?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===z0?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Fo)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===H0||t===Q0){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Fo||this.peekCodePoint(0)===Wd)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),W0)}for(;;){var i=this.consumeCodePoint();if(i===Fo||i===Wd)return{type:22,value:jn.apply(void 0,e)};if(V0(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Fo||this.peekCodePoint(0)===Wd?(this.consumeCodePoint(),{type:22,value:jn.apply(void 0,e)}):(this.consumeBadUrlRemnants(),W0);if(i===Q0||i===H0||i===z0||Lse(i))return this.consumeBadUrlRemnants(),W0;if(i===nm)if(Zl(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),W0;else e.push(i)}},n.prototype.consumeWhiteSpace=function(){for(;V0(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Wd||e===Fo)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+=jn.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===Fo||i===void 0||i===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(i===mw)return this._value.splice(0,r),Kse;if(i===nm){var s=this._value[r+1];s!==Fo&&s!==void 0&&(s===mw?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):Zl(i,s)&&(t+=this.consumeStringSlice(r),t+=jn(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=vg,r=this.peekCodePoint(0);for((r===Bc||r===_i)&&e.push(this.consumeCodePoint());Wr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(r===zm&&Wr(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=uL;Wr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),i=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===B5||r===_5)&&((i===Bc||i===_i)&&Wr(s)||Wr(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=uL;Wr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Pse(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(j0(i,s,o)){var a=this.consumeName();return{type:15,number:t,flags:r,unit:a}}return i===nse?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Nu(e)){for(var t=jn(e);Nu(this.peekCodePoint(0))&&t.length<6;)t+=jn(this.consumeCodePoint());V0(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||Tse(r)||r>1114111?dL:r}return e===Fo?dL:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(pL(t))e+=jn(t);else if(Zl(t,this.peekCodePoint(0)))e+=jn(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),M5=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new C5;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||toe(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"?yC:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),yg=function(n){return n.type===15},Qx=function(n){return n.type===17},zn=function(n){return n.type===20},wC=function(n,e){return zn(n)&&n.value===e},Hx=function(n){return n.type!==31&&n.type!==4},xa=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},toe=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},OA=function(n){return n.type===17||n.type===15},ir=function(n){return n.type===16||OA(n)},S5=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},Dr={type:17,number:0,flags:vg},oT={type:16,number:50,flags:vg},fA={type:16,number:100,flags:vg},Mp=function(n,e,t){var r=n[0],i=n[1];return[cn(r,e),cn(typeof i<"u"?i:r,t)]},cn=function(n,e){if(n.type===16)return n.number/100*e;if(yg(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},T5="deg",I5="grad",R5="rad",F5="turn",zx={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case T5:return Math.PI*e.number/180;case I5:return Math.PI/200*e.number;case R5:return e.number;case F5:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},U5=function(n){return n.type===15&&(n.unit===T5||n.unit===I5||n.unit===R5||n.unit===F5)},L5=function(n){var e=n.filter(zn).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Dr,Dr];case"to top":case"bottom":return Ps(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Dr,fA];case"to right":case"left":return Ps(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[fA,fA];case"to bottom":case"top":return Ps(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[fA,Dr];case"to left":case"right":return Ps(270)}return 0},Ps=function(n){return Math.PI*n/180},CA={name:"color",parse:function(n,e){if(e.type===18){var t=noe[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=Gm[e.value.toUpperCase()];if(typeof a<"u")return a}return Gm.TRANSPARENT}},Ah=function(n){return(255&n)===0},wr=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},mL=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},gL=function(n,e){var t=e.filter(Hx);if(t.length===3){var r=t.map(mL),i=r[0],s=r[1],o=r[2];return hA(i,s,o,1)}if(t.length===4){var a=t.map(mL),i=a[0],s=a[1],o=a[2],l=a[3];return hA(i,s,o,l)}return 0};function Bb(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 vL=function(n,e){var t=e.filter(Hx),r=t[0],i=t[1],s=t[2],o=t[3],a=(r.type===17?Ps(r.number):zx.parse(n,r))/(Math.PI*2),l=ir(i)?i.number/100:0,A=ir(s)?s.number/100:0,c=typeof o<"u"&&ir(o)?cn(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=Bb(f,u,a+1/3),p=Bb(f,u,a),d=Bb(f,u,a-1/3);return hA(h*255,p*255,d*255,c)},noe={hsl:vL,hsla:vL,rgb:gL,rgba:gL},yL=function(n,e){return CA.parse(n,M5.create(e).parseComponentValue())},Gm={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},roe={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(zn(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},ioe={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Gx=function(n,e){var t=CA.parse(n,e[0]),r=e[1];return r&&ir(r)?{color:t,stop:r}:{color:t,stop:null}},wL=function(n,e){var t=n[0],r=n[n.length-1];t.stop===null&&(t.stop=Dr),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},aoe=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(Ao(e,t),Ao(e,t-i),Ao(e-r,t),Ao(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=xL(r,i,e,t,!0),A=l[0],c=l[1];s=Ao(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(Ao(e,t),Ao(e,t-i),Ao(e-r,t),Ao(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=xL(r,i,e,t,!1),A=u[0],c=u[1];s=Ao(A-e,(c-t)/a),o=a*s}break}return Array.isArray(n.size)&&(s=cn(n.size[0],r),o=n.size.length===2?cn(n.size[1],i):s),[s,o]},loe=function(n,e){var t=Ps(180),r=[];return xa(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&o.value==="to"){t=L5(i);return}else if(U5(o)){t=zx.parse(n,o);return}}var a=Gx(n,i);r.push(a)}),{angle:t,stops:r,type:1}},K0=function(n,e){var t=Ps(180),r=[];return xa(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=L5(i);return}else if(U5(o)){t=(zx.parse(n,o)+Ps(270))%Ps(360);return}}var a=Gx(n,i);r.push(a)}),{angle:t,stops:r,type:1}},Aoe=function(n,e){var t=Ps(180),r=[],i=1,s=0,o=3,a=[];return xa(e).forEach(function(l,A){var c=l[0];if(A===0){if(zn(c)&&c.value==="linear"){i=1;return}else if(zn(c)&&c.value==="radial"){i=2;return}}if(c.type===18){if(c.name==="from"){var u=CA.parse(n,c.values[0]);r.push({stop:Dr,color:u})}else if(c.name==="to"){var u=CA.parse(n,c.values[0]);r.push({stop:fA,color:u})}else if(c.name==="color-stop"){var f=c.values.filter(Hx);if(f.length===2){var u=CA.parse(n,f[1]),h=f[0];Qx(h)&&r.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(t+Ps(180))%Ps(360),stops:r,type:i}:{size:o,shape:s,stops:r,position:a,type:i}},P5="closest-side",D5="farthest-side",O5="closest-corner",N5="farthest-corner",k5="circle",Q5="ellipse",H5="cover",z5="contain",coe=function(n,e){var t=0,r=3,i=[],s=[];return xa(e).forEach(function(o,a){var l=!0;if(a===0){var A=!1;l=o.reduce(function(u,f){if(A)if(zn(f))switch(f.value){case"center":return s.push(oT),u;case"top":case"left":return s.push(Dr),u;case"right":case"bottom":return s.push(fA),u}else(ir(f)||OA(f))&&s.push(f);else if(zn(f))switch(f.value){case k5:return t=0,!1;case Q5:return t=1,!1;case"at":return A=!0,!1;case P5:return r=0,!1;case H5:case D5:return r=1,!1;case z5:case O5:return r=2,!1;case N5:return r=3,!1}else if(OA(f)||ir(f))return Array.isArray(r)||(r=[]),r.push(f),!1;return u},l)}if(l){var c=Gx(n,o);i.push(c)}}),{size:r,shape:t,stops:i,position:s,type:2}},Y0=function(n,e){var t=0,r=3,i=[],s=[];return xa(e).forEach(function(o,a){var l=!0;if(a===0?l=o.reduce(function(c,u){if(zn(u))switch(u.value){case"center":return s.push(oT),!1;case"top":case"left":return s.push(Dr),!1;case"right":case"bottom":return s.push(fA),!1}else if(ir(u)||OA(u))return s.push(u),!1;return c},l):a===1&&(l=o.reduce(function(c,u){if(zn(u))switch(u.value){case k5:return t=0,!1;case Q5:return t=1,!1;case z5:case P5:return r=0,!1;case D5:return r=1,!1;case O5:return r=2,!1;case H5:case N5:return r=3,!1}else if(OA(u)||ir(u))return Array.isArray(r)||(r=[]),r.push(u),!1;return c},l)),l){var A=Gx(n,o);i.push(A)}}),{size:r,shape:t,stops:i,position:s,type:2}},uoe=function(n){return n.type===1},foe=function(n){return n.type===2},aT={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=G5[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 hoe(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!G5[n.name])}var G5={"linear-gradient":loe,"-moz-linear-gradient":K0,"-ms-linear-gradient":K0,"-o-linear-gradient":K0,"-webkit-linear-gradient":K0,"radial-gradient":coe,"-moz-radial-gradient":Y0,"-ms-radial-gradient":Y0,"-o-radial-gradient":Y0,"-webkit-radial-gradient":Y0,"-webkit-gradient":Aoe},doe={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 Hx(r)&&hoe(r)}).map(function(r){return aT.parse(n,r)})}},poe={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(zn(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},moe={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return xa(e).map(function(t){return t.filter(ir)}).map(S5)}},goe={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return xa(e).map(function(t){return t.filter(zn).map(function(r){return r.value}).join(" ")}).map(voe)}},voe=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}},ch;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(ch||(ch={}));var yoe={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return xa(e).map(function(t){return t.filter(woe)})}},woe=function(n){return zn(n)||ir(n)},Vx=function(n){return{name:"border-"+n+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},xoe=Vx("top"),_oe=Vx("right"),boe=Vx("bottom"),Boe=Vx("left"),jx=function(n){return{name:"border-radius-"+n,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return S5(t.filter(ir))}}},Eoe=jx("top-left"),Coe=jx("top-right"),Moe=jx("bottom-right"),Soe=jx("bottom-left"),Wx=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}}},Toe=Wx("top"),Ioe=Wx("right"),Roe=Wx("bottom"),Foe=Wx("left"),Kx=function(n){return{name:"border-"+n+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return yg(t)?t.number:0}}},Uoe=Kx("top"),Loe=Kx("right"),Poe=Kx("bottom"),Doe=Kx("left"),Ooe={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Noe={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},koe={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(zn).reduce(function(t,r){return t|Qoe(r.value)},0)}},Qoe=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},Hoe={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}},zoe={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}},vw;(function(n){n.NORMAL="normal",n.STRICT="strict"})(vw||(vw={}));var Goe={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return vw.STRICT;case"normal":default:return vw.NORMAL}}},Voe={name:"line-height",initialValue:"normal",prefix:!1,type:4},_L=function(n,e){return zn(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:ir(n)?cn(n,e):e},joe={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:aT.parse(n,e)}},Woe={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}}},Koe={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}}},Yx=function(n){return{name:"margin-"+n,initialValue:"0",prefix:!1,type:4}},Yoe=Yx("top"),Xoe=Yx("right"),$oe=Yx("bottom"),Zoe=Yx("left"),Joe={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(zn).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}})}},qoe={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"}}},Xx=function(n){return{name:"padding-"+n,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},eae=Xx("top"),tae=Xx("right"),nae=Xx("bottom"),rae=Xx("left"),iae={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}}},sae={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}},oae={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&wC(e[0],"none")?[]:xa(e).map(function(t){for(var r={color:Gm.TRANSPARENT,offsetX:Dr,offsetY:Dr,blur:Dr},i=0,s=0;s"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},Aae=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},cae=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},uae={matrix:Aae,matrix3d:cae},bL={type:16,number:50,flags:vg},fae=[bL,bL],hae={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(ir);return t.length!==2?fae:[t[0],t[1]]}},dae={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}}},rm;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(rm||(rm={}));var pae={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return rm.BREAK_ALL;case"keep-all":return rm.KEEP_ALL;case"normal":default:return rm.NORMAL}}},mae={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if(Qx(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},V5={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")}},gae={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return Qx(e)?e.number:1}},vae={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},yae={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(zn).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})}},wae={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+"'"})}},xae={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},_ae={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if(Qx(e))return e.number;if(zn(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},bae={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(zn).map(function(t){return t.value})}},Bae={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},pr=function(n,e){return(n&e)!==0},Eae={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(yg).map(function(t){return V5.parse(n,t)})}},Cae={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&wC(e[0],"none")?[]:xa(e).map(function(t){for(var r={color:255,offsetX:Dr,offsetY:Dr,blur:Dr,spread:Dr,inset:!1},i=0,s=0;s1?1:0],this.overflowWrap=qe(e,qoe,t.overflowWrap),this.paddingTop=qe(e,eae,t.paddingTop),this.paddingRight=qe(e,tae,t.paddingRight),this.paddingBottom=qe(e,nae,t.paddingBottom),this.paddingLeft=qe(e,rae,t.paddingLeft),this.paintOrder=qe(e,Mae,t.paintOrder),this.position=qe(e,sae,t.position),this.textAlign=qe(e,iae,t.textAlign),this.textDecorationColor=qe(e,vae,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=qe(e,yae,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=qe(e,oae,t.textShadow),this.textTransform=qe(e,aae,t.textTransform),this.transform=qe(e,lae,t.transform),this.transformOrigin=qe(e,hae,t.transformOrigin),this.visibility=qe(e,dae,t.visibility),this.webkitTextStrokeColor=qe(e,Sae,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=qe(e,Tae,t.webkitTextStrokeWidth),this.wordBreak=qe(e,pae,t.wordBreak),this.zIndex=qe(e,mae,t.zIndex)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return Ah(this.backgroundColor)},n.prototype.isTransformed=function(){return this.transform!==null},n.prototype.isPositioned=function(){return this.position!==0},n.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},n.prototype.isFloating=function(){return this.float!==0},n.prototype.isInlineLevel=function(){return pr(this.display,4)||pr(this.display,33554432)||pr(this.display,268435456)||pr(this.display,536870912)||pr(this.display,67108864)||pr(this.display,134217728)},n}(),qe=function(n,e,t){var r=new C5,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(i);var s=new M5(r.read());switch(e.type){case 2:var o=s.parseComponentValue();return e.parse(n,zn(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 zx.parse(n,s.parseComponentValue());case"color":return CA.parse(n,s.parseComponentValue());case"image":return aT.parse(n,s.parseComponentValue());case"length":var a=s.parseComponentValue();return OA(a)?a:Dr;case"length-percentage":var l=s.parseComponentValue();return ir(l)?l:Dr;case"time":return V5.parse(n,s.parseComponentValue())}break}},Rae="data-html2canvas-debug",Fae=function(n){var e=n.getAttribute(Rae);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},BL=function(n,e){var t=Fae(n);return t===1||e===t},_a=function(){function n(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,BL(t,3))debugger;this.styles=new Iae(e,window.getComputedStyle(t,null)),Fle(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=iT(this.context,t),BL(t,4)&&(this.flags|=16)}return n}(),Uae="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",EL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Sp=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var X0=0;X0>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},Pae=function(n){for(var e=n.length,t=[],r=0;r>Lc,Nae=1<>Lc,Qae=j5+kae,Hae=Qae,zae=32,Gae=Hae+zae,Vae=65536>>lT,jae=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Lc],t=(t<>Lc)],t=(t<>lT),t=this.index[t],t+=e>>Lc&Wae,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var $0=0;$0=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},tle=Yae(Uae),Es="×",Fb="÷",nle=function(n){return tle.get(n)},rle=function(n,e,t){var r=t-2,i=e[r],s=e[t-1],o=e[t];if(s===Mb&&o===Sb)return Es;if(s===Mb||s===Sb||s===SL||o===Mb||o===Sb||o===SL)return Fb;if(s===IL&&[IL,Tb,RL,FL].indexOf(o)!==-1||(s===RL||s===Tb)&&(o===Tb||o===Ib)||(s===FL||s===Ib)&&o===Ib||o===UL||o===TL||o===Jae||s===Zae)return Es;if(s===UL&&o===LL){for(;i===TL;)i=e[--r];if(i===LL)return Es}if(s===Rb&&o===Rb){for(var a=0;i===Rb;)a++,i=e[--r];if(a%2===0)return Es}return Fb},ile=function(n){var e=qae(n),t=e.length,r=0,i=0,s=e.map(nle);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},lle=function(){return typeof new Image().crossOrigin<"u"},Ale=function(){return typeof new XMLHttpRequest().responseType=="string"},cle=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},PL=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},ule=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=xC(t,t,0,0,i);return r.fillStyle="red",r.fillRect(0,0,t,t),DL(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",PL(l)?DL(xC(t,t,0,0,A)):Promise.reject(!1)}).then(function(a){return r.drawImage(a,0,0),PL(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},xC=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},DL=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))})},Wi={get SUPPORT_RANGE_BOUNDS(){var n=ole(document);return Object.defineProperty(Wi,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=Wi.SUPPORT_RANGE_BOUNDS&&ale(document);return Object.defineProperty(Wi,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=cle(document);return Object.defineProperty(Wi,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?ule(document):Promise.resolve(!1);return Object.defineProperty(Wi,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=lle();return Object.defineProperty(Wi,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=Ale();return Object.defineProperty(Wi,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Wi,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Wi,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},im=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),fle=function(n,e,t,r){var i=ple(e,t),s=[],o=0;return i.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(Wi.SUPPORT_RANGE_BOUNDS){var l=OL(r,o,a.length).getClientRects();if(l.length>1){var A=AT(a),c=0;A.forEach(function(f){s.push(new im(f,Yc.fromDOMRectList(n,OL(r,c+o,f.length).getClientRects()))),c+=f.length})}else s.push(new im(a,Yc.fromDOMRectList(n,l)))}else{var u=r.splitText(a.length);s.push(new im(a,hle(n,r))),r=u}else Wi.SUPPORT_RANGE_BOUNDS||(r=r.splitText(a.length));o+=a.length}),s},hle=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=iT(n,r);return r.firstChild&&i.replaceChild(r.firstChild,r),s}}return Yc.EMPTY},OL=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},AT=function(n){if(Wi.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 sle(n)},dle=function(n,e){if(Wi.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 gle(n,e)},ple=function(n,e){return e.letterSpacing!==0?AT(n):dle(n,e)},mle=[32,160,4961,65792,65793,4153,4241],gle=function(n,e){for(var t=Xie(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){mle.indexOf(A)===-1?l+=jn(A):(l.length&&r.push(l),r.push(jn(A)),l="")}),l.length&&r.push(l)}};!(i=t.next()).done;)s();return r},vle=function(){function n(e,t,r){this.text=yle(t.data,r.textTransform),this.textBounds=fle(e,this.text,r,t)}return n}(),yle=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(wle,xle);case 2:return n.toUpperCase();default:return n}},wle=/(^|\s|:|-|\(|\))([a-z])/g,xle=function(n,e,t){return n.length>0?e+t.toUpperCase():n},W5=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}(_a),K5=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}(_a),Y5=function(n){Mo(e,n);function e(t,r){var i=n.call(this,t,r)||this,s=new XMLSerializer,o=iT(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}(_a),X5=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}(_a),_C=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}(_a),_le=[{type:15,flags:0,unit:"px",number:3}],ble=[{type:16,flags:0,number:50}],Ble=function(n){return n.width>n.height?new Yc(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width0)t.textNodes.push(new vle(n,i,t.styles));else if(e6(i))if(Hle(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return iy(n,a,t,r)});else{var o=q5(n,i);o.styles.isVisible()&&(Tle(i,o,r)?o.flags|=4:Ile(o.styles)&&(o.flags|=2),Mle.indexOf(i.tagName)!==-1&&(o.flags|=8),t.elements.push(o),i.slot,i.shadowRoot?iy(n,i.shadowRoot,o,r):!n6(i)&&!t6(i)&&!r6(i)&&iy(n,i,o,r))}},q5=function(n,e){return kle(e)?new W5(n,e):Nle(e)?new K5(n,e):t6(e)?new Y5(n,e):Lle(e)?new X5(n,e):Ple(e)?new _C(n,e):Dle(e)?new cT(n,e):r6(e)?new $5(n,e):n6(e)?new Z5(n,e):Qle(e)?new J5(n,e):new _a(n,e)},Sle=function(n,e){var t=q5(n,e);return t.flags|=4,iy(n,e,t,t),t},Tle=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Ole(n)&&t.styles.isTransparent()},Ile=function(n){return n.isPositioned()||n.isFloating()},Rle=function(n){return n.nodeType===Node.TEXT_NODE},e6=function(n){return n.nodeType===Node.ELEMENT_NODE},Fle=function(n){return e6(n)&&typeof n.style<"u"&&!Ule(n)},Ule=function(n){return typeof n.className=="object"},Lle=function(n){return n.tagName==="LI"},Ple=function(n){return n.tagName==="OL"},Dle=function(n){return n.tagName==="INPUT"},t6=function(n){return n.tagName==="svg"},Ole=function(n){return n.tagName==="BODY"},Nle=function(n){return n.tagName==="CANVAS"},kle=function(n){return n.tagName==="IMG"},Qle=function(n){return n.tagName==="IFRAME"},n6=function(n){return n.tagName==="TEXTAREA"},r6=function(n){return n.tagName==="SELECT"},Hle=function(n){return n.tagName==="SLOT"},kL={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"]},QL={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},zle={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Gle={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},ku=function(n,e,t,r,i,s){return nt?uT(n,i,s.length>0):r.integers.reduce(function(o,a,l){for(;n>=a;)n-=a,o+=r.values[l];return o},"")+s},i6=function(n,e,t,r){var i="";do t||n--,i=r(n)+i,n/=e;while(n*e>=e);return i},Gn=function(n,e,t,r,i){var s=t-e+1;return(n<0?"-":"")+(i6(Math.abs(n),s,r,function(o){return jn(Math.floor(o%s)+e)})+i)},ic=function(n,e,t){t===void 0&&(t=". ");var r=e.length;return i6(Math.abs(n),r,!1,function(i){return e[Math.floor(i%r)]})+t},qu=1,Wl=2,Kl=4,Tp=8,La=function(n,e,t,r,i,s){if(n<-9999||n>9999)return uT(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&&pr(s,qu)&&a!==""?a=e[A]+a:A>1||A===1&&l===0||A===1&&l===1&&pr(s,Wl)||A===1&&l===1&&pr(s,Kl)&&n>100||A===1&&l>1&&pr(s,Tp)?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},HL="十百千萬",zL="拾佰仟萬",GL="マイナス",Ub="마이너스",uT=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=Gn(n,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return ic(n,"〇一二三四五六七八九",i);case 6:return ku(n,1,3999,kL,3,r).toLowerCase();case 7:return ku(n,1,3999,kL,3,r);case 8:return Gn(n,945,969,!1,r);case 9:return Gn(n,97,122,!1,r);case 10:return Gn(n,65,90,!1,r);case 11:return Gn(n,1632,1641,!0,r);case 12:case 49:return ku(n,1,9999,QL,3,r);case 35:return ku(n,1,9999,QL,3,r).toLowerCase();case 13:return Gn(n,2534,2543,!0,r);case 14:case 30:return Gn(n,6112,6121,!0,r);case 15:return ic(n,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return ic(n,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return La(n,"零一二三四五六七八九",HL,"負",i,Wl|Kl|Tp);case 47:return La(n,"零壹貳參肆伍陸柒捌玖",zL,"負",i,qu|Wl|Kl|Tp);case 42:return La(n,"零一二三四五六七八九",HL,"负",i,Wl|Kl|Tp);case 41:return La(n,"零壹贰叁肆伍陆柒捌玖",zL,"负",i,qu|Wl|Kl|Tp);case 26:return La(n,"〇一二三四五六七八九","十百千万",GL,i,0);case 25:return La(n,"零壱弐参四伍六七八九","拾百千万",GL,i,qu|Wl|Kl);case 31:return La(n,"영일이삼사오육칠팔구","십백천만",Ub,s,qu|Wl|Kl);case 33:return La(n,"零一二三四五六七八九","十百千萬",Ub,s,0);case 32:return La(n,"零壹貳參四五六七八九","拾百千",Ub,s,qu|Wl|Kl);case 18:return Gn(n,2406,2415,!0,r);case 20:return ku(n,1,19999,Gle,3,r);case 21:return Gn(n,2790,2799,!0,r);case 22:return Gn(n,2662,2671,!0,r);case 22:return ku(n,1,10999,zle,3,r);case 23:return ic(n,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return ic(n,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Gn(n,3302,3311,!0,r);case 28:return ic(n,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return ic(n,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return Gn(n,3792,3801,!0,r);case 37:return Gn(n,6160,6169,!0,r);case 38:return Gn(n,4160,4169,!0,r);case 39:return Gn(n,2918,2927,!0,r);case 40:return Gn(n,1776,1785,!0,r);case 43:return Gn(n,3046,3055,!0,r);case 44:return Gn(n,3174,3183,!0,r);case 45:return Gn(n,3664,3673,!0,r);case 46:return Gn(n,3872,3881,!0,r);case 3:default:return Gn(n,48,57,!0,r)}},VL;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(VL||(VL={}));var Vle=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}(),Qu=function(n,e,t){return new Ke(n.x+(e.x-n.x)*t,n.y+(e.y-n.y)*t)},Z0=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=Qu(this.start,this.startControl,e),i=Qu(this.startControl,this.endControl,e),s=Qu(this.endControl,this.end,e),o=Qu(r,i,e),a=Qu(i,s,e),l=Qu(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}(),Ss=function(n){return n.type===1},jle=function(){function n(e){var t=e.styles,r=e.bounds,i=Mp(t.borderTopLeftRadius,r.width,r.height),s=i[0],o=i[1],a=Mp(t.borderTopRightRadius,r.width,r.height),l=a[0],A=a[1],c=Mp(t.borderBottomRightRadius,r.width,r.height),u=c[0],f=c[1],h=Mp(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,T=t.borderRightWidth,b=t.borderBottomWidth,M=t.borderLeftWidth,D=cn(t.paddingTop,e.bounds.width),Y=cn(t.paddingRight,e.bounds.width),H=cn(t.paddingBottom,e.bounds.width),I=cn(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?wn(r.left+M/3,r.top+C/3,s-M/3,o-C/3,Yt.TOP_LEFT):new Ke(r.left+M/3,r.top+C/3),this.topRightBorderDoubleOuterBox=s>0||o>0?wn(r.left+y,r.top+C/3,l-T/3,A-C/3,Yt.TOP_RIGHT):new Ke(r.left+r.width-T/3,r.top+C/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?wn(r.left+x,r.top+w,u-T/3,f-b/3,Yt.BOTTOM_RIGHT):new Ke(r.left+r.width-T/3,r.top+r.height-b/3),this.bottomLeftBorderDoubleOuterBox=p>0||d>0?wn(r.left+M/3,r.top+_,p-M/3,d-b/3,Yt.BOTTOM_LEFT):new Ke(r.left+M/3,r.top+r.height-b/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?wn(r.left+M*2/3,r.top+C*2/3,s-M*2/3,o-C*2/3,Yt.TOP_LEFT):new Ke(r.left+M*2/3,r.top+C*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?wn(r.left+y,r.top+C*2/3,l-T*2/3,A-C*2/3,Yt.TOP_RIGHT):new Ke(r.left+r.width-T*2/3,r.top+C*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?wn(r.left+x,r.top+w,u-T*2/3,f-b*2/3,Yt.BOTTOM_RIGHT):new Ke(r.left+r.width-T*2/3,r.top+r.height-b*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||d>0?wn(r.left+M*2/3,r.top+_,p-M*2/3,d-b*2/3,Yt.BOTTOM_LEFT):new Ke(r.left+M*2/3,r.top+r.height-b*2/3),this.topLeftBorderStroke=s>0||o>0?wn(r.left+M/2,r.top+C/2,s-M/2,o-C/2,Yt.TOP_LEFT):new Ke(r.left+M/2,r.top+C/2),this.topRightBorderStroke=s>0||o>0?wn(r.left+y,r.top+C/2,l-T/2,A-C/2,Yt.TOP_RIGHT):new Ke(r.left+r.width-T/2,r.top+C/2),this.bottomRightBorderStroke=u>0||f>0?wn(r.left+x,r.top+w,u-T/2,f-b/2,Yt.BOTTOM_RIGHT):new Ke(r.left+r.width-T/2,r.top+r.height-b/2),this.bottomLeftBorderStroke=p>0||d>0?wn(r.left+M/2,r.top+_,p-M/2,d-b/2,Yt.BOTTOM_LEFT):new Ke(r.left+M/2,r.top+r.height-b/2),this.topLeftBorderBox=s>0||o>0?wn(r.left,r.top,s,o,Yt.TOP_LEFT):new Ke(r.left,r.top),this.topRightBorderBox=l>0||A>0?wn(r.left+y,r.top,l,A,Yt.TOP_RIGHT):new Ke(r.left+r.width,r.top),this.bottomRightBorderBox=u>0||f>0?wn(r.left+x,r.top+w,u,f,Yt.BOTTOM_RIGHT):new Ke(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=p>0||d>0?wn(r.left,r.top+_,p,d,Yt.BOTTOM_LEFT):new Ke(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||o>0?wn(r.left+M,r.top+C,Math.max(0,s-M),Math.max(0,o-C),Yt.TOP_LEFT):new Ke(r.left+M,r.top+C),this.topRightPaddingBox=l>0||A>0?wn(r.left+Math.min(y,r.width-T),r.top+C,y>r.width+T?0:Math.max(0,l-T),Math.max(0,A-C),Yt.TOP_RIGHT):new Ke(r.left+r.width-T,r.top+C),this.bottomRightPaddingBox=u>0||f>0?wn(r.left+Math.min(x,r.width-M),r.top+Math.min(w,r.height-b),Math.max(0,u-T),Math.max(0,f-b),Yt.BOTTOM_RIGHT):new Ke(r.left+r.width-T,r.top+r.height-b),this.bottomLeftPaddingBox=p>0||d>0?wn(r.left+M,r.top+Math.min(_,r.height-b),Math.max(0,p-M),Math.max(0,d-b),Yt.BOTTOM_LEFT):new Ke(r.left+M,r.top+r.height-b),this.topLeftContentBox=s>0||o>0?wn(r.left+M+I,r.top+C+D,Math.max(0,s-(M+I)),Math.max(0,o-(C+D)),Yt.TOP_LEFT):new Ke(r.left+M+I,r.top+C+D),this.topRightContentBox=l>0||A>0?wn(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),Yt.TOP_RIGHT):new Ke(r.left+r.width-(T+Y),r.top+C+D),this.bottomRightContentBox=u>0||f>0?wn(r.left+Math.min(x,r.width-(M+I)),r.top+Math.min(w,r.height+C+D),Math.max(0,u-(T+Y)),f-(b+H),Yt.BOTTOM_RIGHT):new Ke(r.left+r.width-(T+Y),r.top+r.height-(b+H)),this.bottomLeftContentBox=p>0||d>0?wn(r.left+M+I,r.top+_,Math.max(0,p-(M+I)),d-(b+H),Yt.BOTTOM_LEFT):new Ke(r.left+M+I,r.top+r.height-(b+H))}return n}(),Yt;(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"})(Yt||(Yt={}));var wn=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 Yt.TOP_LEFT:return new Z0(new Ke(n,A),new Ke(n,A-a),new Ke(l-o,e),new Ke(l,e));case Yt.TOP_RIGHT:return new Z0(new Ke(n,e),new Ke(n+o,e),new Ke(l,A-a),new Ke(l,A));case Yt.BOTTOM_RIGHT:return new Z0(new Ke(l,e),new Ke(l,e+a),new Ke(n+o,A),new Ke(n,A));case Yt.BOTTOM_LEFT:default:return new Z0(new Ke(l,A),new Ke(l-o,A),new Ke(n,e+a),new Ke(n,e))}},xw=function(n){return[n.topLeftBorderBox,n.topRightBorderBox,n.bottomRightBorderBox,n.bottomLeftBorderBox]},Wle=function(n){return[n.topLeftContentBox,n.topRightContentBox,n.bottomRightContentBox,n.bottomLeftContentBox]},_w=function(n){return[n.topLeftPaddingBox,n.topRightPaddingBox,n.bottomRightPaddingBox,n.bottomLeftPaddingBox]},Kle=function(){function n(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return n}(),J0=function(){function n(e,t){this.path=e,this.target=t,this.type=1}return n}(),Yle=function(){function n(e){this.opacity=e,this.type=2,this.target=6}return n}(),Xle=function(n){return n.type===0},s6=function(n){return n.type===1},$le=function(n){return n.type===2},jL=function(n,e){return n.length===e.length?n.some(function(t,r){return t===e[r]}):!1},Zle=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})},o6=function(){function n(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return n}(),a6=function(){function n(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new jle(this.container),this.container.styles.opacity<1&&this.effects.push(new Yle(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 Kle(r,i,s))}if(this.container.styles.overflowX!==0){var o=xw(this.curves),a=_w(this.curves);jL(o,a)?this.effects.push(new J0(o,6)):(this.effects.push(new J0(o,2)),this.effects.push(new J0(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!s6(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=xw(r.curves),a=_w(r.curves);jL(o,a)||i.unshift(new J0(a,6))}}else i.unshift.apply(i,s);r=r.parent}return i.filter(function(l){return pr(l.target,e)})},n}(),bC=function(n,e,t,r){n.container.elements.forEach(function(i){var s=pr(i.flags,4),o=pr(i.flags,2),a=new a6(i,n);pr(i.styles.display,2048)&&r.push(a);var l=pr(i.flags,8)?[]:r;if(s||o){var A=s||i.styles.isPositioned()?t:e,c=new o6(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);bC(a,c,s?c:t,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),bC(a,e,t,l);pr(i.flags,8)&&l6(i,l)})},l6=function(n,e){for(var t=n instanceof _C?n.start:1,r=n instanceof _C?n.reversed:!1,i=0;i"u"?n[0]:t},sAe=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))]}},oAe="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",KL="Hidden Text",aAe=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=oAe,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(KL)),r.appendChild(s),r.appendChild(i);var a=i.offsetTop-s.offsetTop+2;r.removeChild(s),r.appendChild(this._document.createTextNode(KL)),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}(),c6=function(){function n(e,t){this.context=e,this.options=t}return n}(),lAe=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 aAe(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(),$le(t)&&(this.ctx.globalAlpha=t.opacity),Xle(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)),s6(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 zi(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 zi(this,function(r){switch(r.label){case 0:if(pr(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,i){var s=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var o=AT(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=hAe(t.fontFamily).join(", "),s=yg(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 zi(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=wr(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=wr(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=wr(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=wr(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=bw(t),o=_w(r);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,t.intrinsicWidth,t.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return 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 zi(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,F,P))):foe(c)&&(M=Lb(t,r,[null,null,null]),D=M[0],Y=M[1],H=M[2],I=M[3],v=M[4],B=c.position.length===0?[oT]:c.position,F=cn(B[0],I),P=cn(B[B.length-1],v),O=aoe(c,F,P,I,v),z=O[0],K=O[1],z>0&&K>0&&(Q=s.ctx.createRadialGradient(Y+F,H+P,0,Y+F,H+P,z),wL(c.stops,z*2).forEach(function(ae){return Q.addColorStop(ae.stop,wr(ae.color))}),s.path(D),s.ctx.fillStyle=Q,z!==K?(E=t.bounds.left+.5*t.bounds.width,G=t.bounds.top+.5*t.bounds.height,ee=K/z,U=1/ee,s.ctx.save(),s.ctx.translate(E,G),s.ctx.transform(1,0,0,ee,0,0),s.ctx.translate(-E,-G),s.ctx.fillRect(Y,U*(H-G)+G,I,v*U),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 zi(this,function(T){return this.ctx.save(),a=tAe(s,i),l=WL(s,i),o===2&&(this.path(l),this.ctx.clip()),Ss(l[0])?(A=l[0].start.x,c=l[0].start.y):(A=l[0].x,c=l[0].y),Ss(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},eL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mie=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var U0=0;U0"u"?[]:new Uint8Array(256);for(var L0=0;L0>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},vie=function(n){for(var e=n.length,t=[],r=0;r>Uc,xie=1<>Uc,bie=d5+_ie,Bie=bie,Eie=32,Cie=Bie+Eie,Mie=65536>>oT,Sie=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Uc],t=(t<>Uc)],t=(t<>oT),t=this.index[t],t+=e>>Uc&Tie,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var P0=0;P0iL?(i.push(!0),a-=iL):i.push(!1),["normal","auto","loose"].indexOf(e)!==-1&&[8208,8211,12316,12448].indexOf(s)!==-1)return r.push(o),t.push(fC);if(a===Die||a===cC){if(o===0)return r.push(o),t.push(vc);var l=t[o-1];return Vie.indexOf(l)===-1?(r.push(r[o-1]),t.push(l)):(r.push(o),t.push(vc))}if(r.push(o),a===Hie)return t.push(e==="strict"?hC:Hm);if(a===v5||a===Qie)return t.push(vc);if(a===zie)return s>=131072&&s<=196605||s>=196608&&s<=262141?t.push(Hm):t.push(vc);t.push(a)}),[r,t,i]},_b=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},uL=function(n,e){for(var t=n;t>=0;){var r=e[t];if(r===uA)t--;else return r}return 0},Kie=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===p5&&c===m5)return Tt;if(yC.indexOf(l)!==-1)return y5;if(yC.indexOf(c)!==-1||w5.indexOf(c)!==-1)return Tt;if(uL(s,e)===g5)return k0;if(vC.get(n[s])===cC||(l===O0||l===N0)&&vC.get(n[a])===cC||l===sL||c===sL||l===oL||[uA,uC,Bp].indexOf(l)===-1&&c===oL||[D0,Gd,kie,Du,Ou].indexOf(c)!==-1||uL(s,e)===Vd||_b(wb,Vd,s,e)||_b([D0,Gd],hC,s,e)||_b(aL,aL,s,e))return Tt;if(l===uA)return k0;if(l===wb||c===wb)return Tt;if(c===fC||l===fC)return k0;if([uC,Bp,hC].indexOf(c)!==-1||l===Nie||A===mC&&jie.indexOf(l)!==-1||l===Ou&&c===mC||c===lL||Ua.indexOf(c)!==-1&&l===Gi||Ua.indexOf(l)!==-1&&c===Gi||l===Cp&&[Hm,O0,N0].indexOf(c)!==-1||[Hm,O0,N0].indexOf(l)!==-1&&c===Ep||Ua.indexOf(l)!==-1&&AL.indexOf(c)!==-1||AL.indexOf(l)!==-1&&Ua.indexOf(c)!==-1||[Cp,Ep].indexOf(l)!==-1&&(c===Gi||[Vd,Bp].indexOf(c)!==-1&&e[a+1]===Gi)||[Vd,Bp].indexOf(l)!==-1&&c===Gi||l===Gi&&[Gi,Ou,Du].indexOf(c)!==-1)return Tt;if([Gi,Ou,Du,D0,Gd].indexOf(c)!==-1)for(var u=s;u>=0;){var f=e[u];if(f===Gi)return Tt;if([Ou,Du].indexOf(f)!==-1)u--;else break}if([Cp,Ep].indexOf(c)!==-1)for(var u=[D0,Gd].indexOf(l)!==-1?o:s;u>=0;){var f=e[u];if(f===Gi)return Tt;if([Ou,Du].indexOf(f)!==-1)u--;else break}if(gC===l&&[gC,ny,dC,pC].indexOf(c)!==-1||[ny,dC].indexOf(l)!==-1&&[ny,ry].indexOf(c)!==-1||[ry,pC].indexOf(l)!==-1&&c===ry||cL.indexOf(l)!==-1&&[lL,Ep].indexOf(c)!==-1||cL.indexOf(c)!==-1&&l===Cp||Ua.indexOf(l)!==-1&&Ua.indexOf(c)!==-1||l===Du&&Ua.indexOf(c)!==-1||Ua.concat(Gi).indexOf(l)!==-1&&c===Vd&&Gie.indexOf(n[a])===-1||Ua.concat(Gi).indexOf(c)!==-1&&l===Gd)return Tt;if(l===xb&&c===xb){for(var h=t[s],p=1;h>0&&(h--,e[h]===xb);)p++;if(p%2!==0)return Tt}return l===O0&&c===N0?Tt:k0},Yie=function(n,e){e||(e={lineBreak:"normal",wordBreak:"normal"});var t=Wie(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[Gi,vc,v5].indexOf(a)!==-1?Hm: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===y5,this.start=r,this.end=i}return n.prototype.slice=function(){return jn.apply(void 0,this.codePoints.slice(this.start,this.end))},n}(),$ie=function(n,e){var t=Qx(n),r=Yie(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=x5&&n<=57},Ise=function(n){return n>=55296&&n<=57343},Nu=function(n){return Wr(n)||n>=B5&&n<=C5||n>=_5&&n<=Ese},Rse=function(n){return n>=_5&&n<=Mse},Fse=function(n){return n>=B5&&n<=Tse},Use=function(n){return Rse(n)||Fse(n)},Lse=function(n){return n>=pse},V0=function(n){return n===mw||n===qie||n===ese},gw=function(n){return Use(n)||Lse(n)||n===ise},mL=function(n){return gw(n)||Wr(n)||n===_i},Pse=function(n){return n>=yse&&n<=wse||n===xse||n>=_se&&n<=bse||n===Bse},Zl=function(n,e){return n!==nm?!1:e!==mw},j0=function(n,e,t){return n===_i?gw(e)||Zl(e,t):gw(n)?!0:!!(n===nm&&Zl(n,e))},Bb=function(n,e,t){return n===Bc||n===_i?Wr(e)?!0:e===zm&&Wr(t):Wr(n===zm?e:n)},Dse=function(n){var e=0,t=1;(n[e]===Bc||n[e]===_i)&&(n[e]===_i&&(t=-1),e++);for(var r=[];Wr(n[e]);)r.push(n[e++]);var i=r.length?parseInt(jn.apply(void 0,r),10):0;n[e]===zm&&e++;for(var s=[];Wr(n[e]);)s.push(n[e++]);var o=s.length,a=o?parseInt(jn.apply(void 0,s),10):0;(n[e]===E5||n[e]===b5)&&e++;var l=1;(n[e]===Bc||n[e]===_i)&&(n[e]===_i&&(l=-1),e++);for(var A=[];Wr(n[e]);)A.push(n[e++]);var c=A.length?parseInt(jn.apply(void 0,A),10):0;return t*(i+a*Math.pow(10,-o))*Math.pow(10,l*c)},Ose={type:2},Nse={type:3},kse={type:4},Qse={type:13},Hse={type:8},zse={type:21},Gse={type:9},Vse={type:10},jse={type:11},Wse={type:12},Kse={type:14},W0={type:23},Yse={type:1},Xse={type:25},$se={type:24},Zse={type:26},Jse={type:27},qse={type:28},eoe={type:29},toe={type:31},wC={type:32},M5=function(){function n(){this._value=[]}return n.prototype.write=function(e){this._value=this._value.concat(Qx(e))},n.prototype.read=function(){for(var e=[],t=this.consumeToken();t!==wC;)e.push(t),t=this.consumeToken();return e},n.prototype.consumeToken=function(){var e=this.consumeCodePoint();switch(e){case Q0:return this.consumeStringToken(Q0);case tse:var t=this.peekCodePoint(0),r=this.peekCodePoint(1),i=this.peekCodePoint(2);if(mL(t)||Zl(r,i)){var s=j0(t,r,i)?Jie:Zie,o=this.consumeName();return{type:5,value:o,flags:s}}break;case nse:if(this.peekCodePoint(0)===jd)return this.consumeCodePoint(),Qse;break;case H0:return this.consumeStringToken(H0);case z0:return Ose;case Wd:return Nse;case bb:if(this.peekCodePoint(0)===jd)return this.consumeCodePoint(),Kse;break;case Bc:if(Bb(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case mse:return kse;case _i:var a=e,l=this.peekCodePoint(0),A=this.peekCodePoint(1);if(Bb(a,l,A))return this.reconsumeCodePoint(e),this.consumeNumericToken();if(j0(a,l,A))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();if(l===_i&&A===ase)return this.consumeCodePoint(),this.consumeCodePoint(),$se;break;case zm:if(Bb(e,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(e),this.consumeNumericToken();break;case hL:if(this.peekCodePoint(0)===bb)for(this.consumeCodePoint();;){var c=this.consumeCodePoint();if(c===bb&&(c=this.consumeCodePoint(),c===hL))return this.consumeToken();if(c===Fo)return this.consumeToken()}break;case gse:return Zse;case vse:return Jse;case ose:if(this.peekCodePoint(0)===sse&&this.peekCodePoint(1)===_i&&this.peekCodePoint(2)===_i)return this.consumeCodePoint(),this.consumeCodePoint(),Xse;break;case lse:var u=this.peekCodePoint(0),f=this.peekCodePoint(1),h=this.peekCodePoint(2);if(j0(u,f,h)){var o=this.consumeName();return{type:7,value:o}}break;case Ase:return qse;case nm:if(Zl(e,this.peekCodePoint(0)))return this.reconsumeCodePoint(e),this.consumeIdentLikeToken();break;case cse:return eoe;case use:if(this.peekCodePoint(0)===jd)return this.consumeCodePoint(),Hse;break;case fse:return jse;case hse:return Wse;case Cse:case Sse:var p=this.peekCodePoint(0),d=this.peekCodePoint(1);return p===Bc&&(Nu(d)||d===G0)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(e),this.consumeIdentLikeToken();case dL:if(this.peekCodePoint(0)===jd)return this.consumeCodePoint(),Gse;if(this.peekCodePoint(0)===dL)return this.consumeCodePoint(),zse;break;case dse:if(this.peekCodePoint(0)===jd)return this.consumeCodePoint(),Vse;break;case Fo:return wC}return V0(e)?(this.consumeWhiteSpace(),toe):Wr(e)?(this.reconsumeCodePoint(e),this.consumeNumericToken()):gw(e)?(this.reconsumeCodePoint(e),this.consumeIdentLikeToken()):{type:6,value:jn(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();Nu(t)&&e.length<6;)e.push(t),t=this.consumeCodePoint();for(var r=!1;t===G0&&e.length<6;)e.push(t),t=this.consumeCodePoint(),r=!0;if(r){var i=parseInt(jn.apply(void 0,e.map(function(l){return l===G0?x5:l})),16),s=parseInt(jn.apply(void 0,e.map(function(l){return l===G0?C5:l})),16);return{type:30,start:i,end:s}}var o=parseInt(jn.apply(void 0,e),16);if(this.peekCodePoint(0)===_i&&Nu(this.peekCodePoint(1))){this.consumeCodePoint(),t=this.consumeCodePoint();for(var a=[];Nu(t)&&a.length<6;)a.push(t),t=this.consumeCodePoint();var s=parseInt(jn.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)===z0?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===z0?(this.consumeCodePoint(),{type:19,value:e}):{type:20,value:e}},n.prototype.consumeUrlToken=function(){var e=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Fo)return{type:22,value:""};var t=this.peekCodePoint(0);if(t===H0||t===Q0){var r=this.consumeStringToken(this.consumeCodePoint());return r.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Fo||this.peekCodePoint(0)===Wd)?(this.consumeCodePoint(),{type:22,value:r.value}):(this.consumeBadUrlRemnants(),W0)}for(;;){var i=this.consumeCodePoint();if(i===Fo||i===Wd)return{type:22,value:jn.apply(void 0,e)};if(V0(i))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Fo||this.peekCodePoint(0)===Wd?(this.consumeCodePoint(),{type:22,value:jn.apply(void 0,e)}):(this.consumeBadUrlRemnants(),W0);if(i===Q0||i===H0||i===z0||Pse(i))return this.consumeBadUrlRemnants(),W0;if(i===nm)if(Zl(i,this.peekCodePoint(0)))e.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),W0;else e.push(i)}},n.prototype.consumeWhiteSpace=function(){for(;V0(this.peekCodePoint(0));)this.consumeCodePoint()},n.prototype.consumeBadUrlRemnants=function(){for(;;){var e=this.consumeCodePoint();if(e===Wd||e===Fo)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+=jn.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===Fo||i===void 0||i===e)return t+=this.consumeStringSlice(r),{type:0,value:t};if(i===mw)return this._value.splice(0,r),Yse;if(i===nm){var s=this._value[r+1];s!==Fo&&s!==void 0&&(s===mw?(t+=this.consumeStringSlice(r),r=-1,this._value.shift()):Zl(i,s)&&(t+=this.consumeStringSlice(r),t+=jn(this.consumeEscapedCodePoint()),r=-1))}r++}while(!0)},n.prototype.consumeNumber=function(){var e=[],t=vg,r=this.peekCodePoint(0);for((r===Bc||r===_i)&&e.push(this.consumeCodePoint());Wr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0);var i=this.peekCodePoint(1);if(r===zm&&Wr(i))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=fL;Wr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());r=this.peekCodePoint(0),i=this.peekCodePoint(1);var s=this.peekCodePoint(2);if((r===E5||r===b5)&&((i===Bc||i===_i)&&Wr(s)||Wr(i)))for(e.push(this.consumeCodePoint(),this.consumeCodePoint()),t=fL;Wr(this.peekCodePoint(0));)e.push(this.consumeCodePoint());return[Dse(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(j0(i,s,o)){var a=this.consumeName();return{type:15,number:t,flags:r,unit:a}}return i===rse?(this.consumeCodePoint(),{type:16,number:t,flags:r}):{type:17,number:t,flags:r}},n.prototype.consumeEscapedCodePoint=function(){var e=this.consumeCodePoint();if(Nu(e)){for(var t=jn(e);Nu(this.peekCodePoint(0))&&t.length<6;)t+=jn(this.consumeCodePoint());V0(this.peekCodePoint(0))&&this.consumeCodePoint();var r=parseInt(t,16);return r===0||Ise(r)||r>1114111?pL:r}return e===Fo?pL:e},n.prototype.consumeName=function(){for(var e="";;){var t=this.consumeCodePoint();if(mL(t))e+=jn(t);else if(Zl(t,this.peekCodePoint(0)))e+=jn(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(t),e}},n}(),S5=function(){function n(e){this._tokens=e}return n.create=function(e){var t=new M5;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||noe(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"?wC:e},n.prototype.reconsumeToken=function(e){this._tokens.unshift(e)},n}(),yg=function(n){return n.type===15},Hx=function(n){return n.type===17},zn=function(n){return n.type===20},xC=function(n,e){return zn(n)&&n.value===e},zx=function(n){return n.type!==31&&n.type!==4},xa=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},noe=function(n,e){return e===11&&n.type===12||e===28&&n.type===29?!0:e===2&&n.type===3},OA=function(n){return n.type===17||n.type===15},ir=function(n){return n.type===16||OA(n)},T5=function(n){return n.length>1?[n[0],n[1]]:[n[0]]},Dr={type:17,number:0,flags:vg},aT={type:16,number:50,flags:vg},fA={type:16,number:100,flags:vg},Mp=function(n,e,t){var r=n[0],i=n[1];return[cn(r,e),cn(typeof i<"u"?i:r,t)]},cn=function(n,e){if(n.type===16)return n.number/100*e;if(yg(n))switch(n.unit){case"rem":case"em":return 16*n.number;case"px":default:return n.number}return n.number},I5="deg",R5="grad",F5="rad",U5="turn",Gx={name:"angle",parse:function(n,e){if(e.type===15)switch(e.unit){case I5:return Math.PI*e.number/180;case R5:return Math.PI/200*e.number;case F5:return e.number;case U5:return Math.PI*2*e.number}throw new Error("Unsupported angle type")}},L5=function(n){return n.type===15&&(n.unit===I5||n.unit===R5||n.unit===F5||n.unit===U5)},P5=function(n){var e=n.filter(zn).map(function(t){return t.value}).join(" ");switch(e){case"to bottom right":case"to right bottom":case"left top":case"top left":return[Dr,Dr];case"to top":case"bottom":return Ps(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[Dr,fA];case"to right":case"left":return Ps(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[fA,fA];case"to bottom":case"top":return Ps(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[fA,Dr];case"to left":case"right":return Ps(270)}return 0},Ps=function(n){return Math.PI*n/180},CA={name:"color",parse:function(n,e){if(e.type===18){var t=roe[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=Gm[e.value.toUpperCase()];if(typeof a<"u")return a}return Gm.TRANSPARENT}},Ah=function(n){return(255&n)===0},xr=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},gL=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},vL=function(n,e){var t=e.filter(zx);if(t.length===3){var r=t.map(gL),i=r[0],s=r[1],o=r[2];return hA(i,s,o,1)}if(t.length===4){var a=t.map(gL),i=a[0],s=a[1],o=a[2],l=a[3];return hA(i,s,o,l)}return 0};function Eb(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 yL=function(n,e){var t=e.filter(zx),r=t[0],i=t[1],s=t[2],o=t[3],a=(r.type===17?Ps(r.number):Gx.parse(n,r))/(Math.PI*2),l=ir(i)?i.number/100:0,A=ir(s)?s.number/100:0,c=typeof o<"u"&&ir(o)?cn(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=Eb(f,u,a+1/3),p=Eb(f,u,a),d=Eb(f,u,a-1/3);return hA(h*255,p*255,d*255,c)},roe={hsl:yL,hsla:yL,rgb:vL,rgba:vL},wL=function(n,e){return CA.parse(n,S5.create(e).parseComponentValue())},Gm={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},ioe={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(zn(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},soe={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},Vx=function(n,e){var t=CA.parse(n,e[0]),r=e[1];return r&&ir(r)?{color:t,stop:r}:{color:t,stop:null}},xL=function(n,e){var t=n[0],r=n[n.length-1];t.stop===null&&(t.stop=Dr),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},loe=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(Ao(e,t),Ao(e,t-i),Ao(e-r,t),Ao(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=_L(r,i,e,t,!0),A=l[0],c=l[1];s=Ao(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(Ao(e,t),Ao(e,t-i),Ao(e-r,t),Ao(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=_L(r,i,e,t,!1),A=u[0],c=u[1];s=Ao(A-e,(c-t)/a),o=a*s}break}return Array.isArray(n.size)&&(s=cn(n.size[0],r),o=n.size.length===2?cn(n.size[1],i):s),[s,o]},Aoe=function(n,e){var t=Ps(180),r=[];return xa(e).forEach(function(i,s){if(s===0){var o=i[0];if(o.type===20&&o.value==="to"){t=P5(i);return}else if(L5(o)){t=Gx.parse(n,o);return}}var a=Vx(n,i);r.push(a)}),{angle:t,stops:r,type:1}},K0=function(n,e){var t=Ps(180),r=[];return xa(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=P5(i);return}else if(L5(o)){t=(Gx.parse(n,o)+Ps(270))%Ps(360);return}}var a=Vx(n,i);r.push(a)}),{angle:t,stops:r,type:1}},coe=function(n,e){var t=Ps(180),r=[],i=1,s=0,o=3,a=[];return xa(e).forEach(function(l,A){var c=l[0];if(A===0){if(zn(c)&&c.value==="linear"){i=1;return}else if(zn(c)&&c.value==="radial"){i=2;return}}if(c.type===18){if(c.name==="from"){var u=CA.parse(n,c.values[0]);r.push({stop:Dr,color:u})}else if(c.name==="to"){var u=CA.parse(n,c.values[0]);r.push({stop:fA,color:u})}else if(c.name==="color-stop"){var f=c.values.filter(zx);if(f.length===2){var u=CA.parse(n,f[1]),h=f[0];Hx(h)&&r.push({stop:{type:16,number:h.number*100,flags:h.flags},color:u})}}}}),i===1?{angle:(t+Ps(180))%Ps(360),stops:r,type:i}:{size:o,shape:s,stops:r,position:a,type:i}},D5="closest-side",O5="farthest-side",N5="closest-corner",k5="farthest-corner",Q5="circle",H5="ellipse",z5="cover",G5="contain",uoe=function(n,e){var t=0,r=3,i=[],s=[];return xa(e).forEach(function(o,a){var l=!0;if(a===0){var A=!1;l=o.reduce(function(u,f){if(A)if(zn(f))switch(f.value){case"center":return s.push(aT),u;case"top":case"left":return s.push(Dr),u;case"right":case"bottom":return s.push(fA),u}else(ir(f)||OA(f))&&s.push(f);else if(zn(f))switch(f.value){case Q5:return t=0,!1;case H5:return t=1,!1;case"at":return A=!0,!1;case D5:return r=0,!1;case z5:case O5:return r=1,!1;case G5:case N5:return r=2,!1;case k5:return r=3,!1}else if(OA(f)||ir(f))return Array.isArray(r)||(r=[]),r.push(f),!1;return u},l)}if(l){var c=Vx(n,o);i.push(c)}}),{size:r,shape:t,stops:i,position:s,type:2}},Y0=function(n,e){var t=0,r=3,i=[],s=[];return xa(e).forEach(function(o,a){var l=!0;if(a===0?l=o.reduce(function(c,u){if(zn(u))switch(u.value){case"center":return s.push(aT),!1;case"top":case"left":return s.push(Dr),!1;case"right":case"bottom":return s.push(fA),!1}else if(ir(u)||OA(u))return s.push(u),!1;return c},l):a===1&&(l=o.reduce(function(c,u){if(zn(u))switch(u.value){case Q5:return t=0,!1;case H5:return t=1,!1;case G5:case D5:return r=0,!1;case O5:return r=1,!1;case N5:return r=2,!1;case z5:case k5:return r=3,!1}else if(OA(u)||ir(u))return Array.isArray(r)||(r=[]),r.push(u),!1;return c},l)),l){var A=Vx(n,o);i.push(A)}}),{size:r,shape:t,stops:i,position:s,type:2}},foe=function(n){return n.type===1},hoe=function(n){return n.type===2},lT={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=V5[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 doe(n){return!(n.type===20&&n.value==="none")&&(n.type!==18||!!V5[n.name])}var V5={"linear-gradient":Aoe,"-moz-linear-gradient":K0,"-ms-linear-gradient":K0,"-o-linear-gradient":K0,"-webkit-linear-gradient":K0,"radial-gradient":uoe,"-moz-radial-gradient":Y0,"-ms-radial-gradient":Y0,"-o-radial-gradient":Y0,"-webkit-radial-gradient":Y0,"-webkit-gradient":coe},poe={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 zx(r)&&doe(r)}).map(function(r){return lT.parse(n,r)})}},moe={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(n,e){return e.map(function(t){if(zn(t))switch(t.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},goe={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(n,e){return xa(e).map(function(t){return t.filter(ir)}).map(T5)}},voe={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(n,e){return xa(e).map(function(t){return t.filter(zn).map(function(r){return r.value}).join(" ")}).map(yoe)}},yoe=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}},ch;(function(n){n.AUTO="auto",n.CONTAIN="contain",n.COVER="cover"})(ch||(ch={}));var woe={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(n,e){return xa(e).map(function(t){return t.filter(xoe)})}},xoe=function(n){return zn(n)||ir(n)},jx=function(n){return{name:"border-"+n+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},_oe=jx("top"),boe=jx("right"),Boe=jx("bottom"),Eoe=jx("left"),Wx=function(n){return{name:"border-radius-"+n,initialValue:"0 0",prefix:!1,type:1,parse:function(e,t){return T5(t.filter(ir))}}},Coe=Wx("top-left"),Moe=Wx("top-right"),Soe=Wx("bottom-right"),Toe=Wx("bottom-left"),Kx=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}}},Ioe=Kx("top"),Roe=Kx("right"),Foe=Kx("bottom"),Uoe=Kx("left"),Yx=function(n){return{name:"border-"+n+"-width",initialValue:"0",type:0,prefix:!1,parse:function(e,t){return yg(t)?t.number:0}}},Loe=Yx("top"),Poe=Yx("right"),Doe=Yx("bottom"),Ooe=Yx("left"),Noe={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},koe={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(n,e){switch(e){case"rtl":return 1;case"ltr":default:return 0}}},Qoe={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(n,e){return e.filter(zn).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},zoe={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}},Goe={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}},vw;(function(n){n.NORMAL="normal",n.STRICT="strict"})(vw||(vw={}));var Voe={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"strict":return vw.STRICT;case"normal":default:return vw.NORMAL}}},joe={name:"line-height",initialValue:"normal",prefix:!1,type:4},bL=function(n,e){return zn(n)&&n.value==="normal"?1.2*e:n.type===17?e*n.number:ir(n)?cn(n,e):e},Woe={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(n,e){return e.type===20&&e.value==="none"?null:lT.parse(n,e)}},Koe={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}}},Yoe={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}}},Xx=function(n){return{name:"margin-"+n,initialValue:"0",prefix:!1,type:4}},Xoe=Xx("top"),$oe=Xx("right"),Zoe=Xx("bottom"),Joe=Xx("left"),qoe={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(n,e){return e.filter(zn).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}})}},eae={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"}}},$x=function(n){return{name:"padding-"+n,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},tae=$x("top"),nae=$x("right"),rae=$x("bottom"),iae=$x("left"),sae={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}}},oae={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}},aae={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&xC(e[0],"none")?[]:xa(e).map(function(t){for(var r={color:Gm.TRANSPARENT,offsetX:Dr,offsetY:Dr,blur:Dr},i=0,s=0;s"u")throw new Error('Attempting to parse an unsupported transform function "'+e.name+'"');return t(e.values)}return null}},cae=function(n){var e=n.filter(function(t){return t.type===17}).map(function(t){return t.number});return e.length===6?e:null},uae=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},fae={matrix:cae,matrix3d:uae},BL={type:16,number:50,flags:vg},hae=[BL,BL],dae={name:"transform-origin",initialValue:"50% 50%",prefix:!0,type:1,parse:function(n,e){var t=e.filter(ir);return t.length!==2?hae:[t[0],t[1]]}},pae={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}}},rm;(function(n){n.NORMAL="normal",n.BREAK_ALL="break-all",n.KEEP_ALL="keep-all"})(rm||(rm={}));var mae={name:"word-break",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"break-all":return rm.BREAK_ALL;case"keep-all":return rm.KEEP_ALL;case"normal":default:return rm.NORMAL}}},gae={name:"z-index",initialValue:"auto",prefix:!1,type:0,parse:function(n,e){if(e.type===20)return{auto:!0,order:0};if(Hx(e))return{auto:!1,order:e.number};throw new Error("Invalid z-index number parsed")}},j5={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")}},vae={name:"opacity",initialValue:"1",type:0,prefix:!1,parse:function(n,e){return Hx(e)?e.number:1}},yae={name:"text-decoration-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},wae={name:"text-decoration-line",initialValue:"none",prefix:!1,type:1,parse:function(n,e){return e.filter(zn).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})}},xae={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+"'"})}},_ae={name:"font-size",initialValue:"0",prefix:!1,type:3,format:"length"},bae={name:"font-weight",initialValue:"normal",type:0,prefix:!1,parse:function(n,e){if(Hx(e))return e.number;if(zn(e))switch(e.value){case"bold":return 700;case"normal":default:return 400}return 400}},Bae={name:"font-variant",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.filter(zn).map(function(t){return t.value})}},Eae={name:"font-style",initialValue:"normal",prefix:!1,type:2,parse:function(n,e){switch(e){case"oblique":return"oblique";case"italic":return"italic";case"normal":default:return"normal"}}},pr=function(n,e){return(n&e)!==0},Cae={name:"duration",initialValue:"0s",prefix:!1,type:1,parse:function(n,e){return e.filter(yg).map(function(t){return j5.parse(n,t)})}},Mae={name:"box-shadow",initialValue:"none",type:1,prefix:!1,parse:function(n,e){return e.length===1&&xC(e[0],"none")?[]:xa(e).map(function(t){for(var r={color:255,offsetX:Dr,offsetY:Dr,blur:Dr,spread:Dr,inset:!1},i=0,s=0;s1?1:0],this.overflowWrap=qe(e,eae,t.overflowWrap),this.paddingTop=qe(e,tae,t.paddingTop),this.paddingRight=qe(e,nae,t.paddingRight),this.paddingBottom=qe(e,rae,t.paddingBottom),this.paddingLeft=qe(e,iae,t.paddingLeft),this.paintOrder=qe(e,Sae,t.paintOrder),this.position=qe(e,oae,t.position),this.textAlign=qe(e,sae,t.textAlign),this.textDecorationColor=qe(e,yae,(r=t.textDecorationColor)!==null&&r!==void 0?r:t.color),this.textDecorationLine=qe(e,wae,(i=t.textDecorationLine)!==null&&i!==void 0?i:t.textDecoration),this.textShadow=qe(e,aae,t.textShadow),this.textTransform=qe(e,lae,t.textTransform),this.transform=qe(e,Aae,t.transform),this.transformOrigin=qe(e,dae,t.transformOrigin),this.visibility=qe(e,pae,t.visibility),this.webkitTextStrokeColor=qe(e,Tae,t.webkitTextStrokeColor),this.webkitTextStrokeWidth=qe(e,Iae,t.webkitTextStrokeWidth),this.wordBreak=qe(e,mae,t.wordBreak),this.zIndex=qe(e,gae,t.zIndex)}return n.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},n.prototype.isTransparent=function(){return Ah(this.backgroundColor)},n.prototype.isTransformed=function(){return this.transform!==null},n.prototype.isPositioned=function(){return this.position!==0},n.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},n.prototype.isFloating=function(){return this.float!==0},n.prototype.isInlineLevel=function(){return pr(this.display,4)||pr(this.display,33554432)||pr(this.display,268435456)||pr(this.display,536870912)||pr(this.display,67108864)||pr(this.display,134217728)},n}(),qe=function(n,e,t){var r=new M5,i=t!==null&&typeof t<"u"?t.toString():e.initialValue;r.write(i);var s=new S5(r.read());switch(e.type){case 2:var o=s.parseComponentValue();return e.parse(n,zn(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 Gx.parse(n,s.parseComponentValue());case"color":return CA.parse(n,s.parseComponentValue());case"image":return lT.parse(n,s.parseComponentValue());case"length":var a=s.parseComponentValue();return OA(a)?a:Dr;case"length-percentage":var l=s.parseComponentValue();return ir(l)?l:Dr;case"time":return j5.parse(n,s.parseComponentValue())}break}},Fae="data-html2canvas-debug",Uae=function(n){var e=n.getAttribute(Fae);switch(e){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},EL=function(n,e){var t=Uae(n);return t===1||e===t},_a=function(){function n(e,t){if(this.context=e,this.textNodes=[],this.elements=[],this.flags=0,EL(t,3))debugger;this.styles=new Rae(e,window.getComputedStyle(t,null)),Ule(t)&&(this.styles.animationDuration.some(function(r){return r>0})&&(t.style.animationDuration="0s"),this.styles.transform!==null&&(t.style.transform="none")),this.bounds=sT(this.context,t),EL(t,4)&&(this.flags|=16)}return n}(),Lae="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",CL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Sp=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var X0=0;X0>4,c[i++]=(o&15)<<4|a>>2,c[i++]=(a&3)<<6|l&63;return A},Dae=function(n){for(var e=n.length,t=[],r=0;r>Lc,kae=1<>Lc,Hae=W5+Qae,zae=Hae,Gae=32,Vae=zae+Gae,jae=65536>>AT,Wae=1<=0){if(e<55296||e>56319&&e<=65535)return t=this.index[e>>Lc],t=(t<>Lc)],t=(t<>AT),t=this.index[t],t+=e>>Lc&Kae,t=this.index[t],t=(t<"u"?[]:new Uint8Array(256);for(var $0=0;$0=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},nle=Xae(Lae),Es="×",Ub="÷",rle=function(n){return nle.get(n)},ile=function(n,e,t){var r=t-2,i=e[r],s=e[t-1],o=e[t];if(s===Sb&&o===Tb)return Es;if(s===Sb||s===Tb||s===TL||o===Sb||o===Tb||o===TL)return Ub;if(s===RL&&[RL,Ib,FL,UL].indexOf(o)!==-1||(s===FL||s===Ib)&&(o===Ib||o===Rb)||(s===UL||s===Rb)&&o===Rb||o===LL||o===IL||o===qae||s===Jae)return Es;if(s===LL&&o===PL){for(;i===IL;)i=e[--r];if(i===PL)return Es}if(s===Fb&&o===Fb){for(var a=0;i===Fb;)a++,i=e[--r];if(a%2===0)return Es}return Ub},sle=function(n){var e=ele(n),t=e.length,r=0,i=0,s=e.map(rle);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},Ale=function(){return typeof new Image().crossOrigin<"u"},cle=function(){return typeof new XMLHttpRequest().responseType=="string"},ule=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},DL=function(n){return n[0]===0&&n[1]===255&&n[2]===0&&n[3]===255},fle=function(n){var e=n.createElement("canvas"),t=100;e.width=t,e.height=t;var r=e.getContext("2d");if(!r)return Promise.reject(!1);r.fillStyle="rgb(0, 255, 0)",r.fillRect(0,0,t,t);var i=new Image,s=e.toDataURL();i.src=s;var o=_C(t,t,0,0,i);return r.fillStyle="red",r.fillRect(0,0,t,t),OL(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",DL(l)?OL(_C(t,t,0,0,A)):Promise.reject(!1)}).then(function(a){return r.drawImage(a,0,0),DL(r.getImageData(0,0,t,t).data)}).catch(function(){return!1})},_C=function(n,e,t,r,i){var s="http://www.w3.org/2000/svg",o=document.createElementNS(s,"svg"),a=document.createElementNS(s,"foreignObject");return o.setAttributeNS(null,"width",n.toString()),o.setAttributeNS(null,"height",e.toString()),a.setAttributeNS(null,"width","100%"),a.setAttributeNS(null,"height","100%"),a.setAttributeNS(null,"x",t.toString()),a.setAttributeNS(null,"y",r.toString()),a.setAttributeNS(null,"externalResourcesRequired","true"),o.appendChild(a),a.appendChild(i),o},OL=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))})},Wi={get SUPPORT_RANGE_BOUNDS(){var n=ale(document);return Object.defineProperty(Wi,"SUPPORT_RANGE_BOUNDS",{value:n}),n},get SUPPORT_WORD_BREAKING(){var n=Wi.SUPPORT_RANGE_BOUNDS&&lle(document);return Object.defineProperty(Wi,"SUPPORT_WORD_BREAKING",{value:n}),n},get SUPPORT_SVG_DRAWING(){var n=ule(document);return Object.defineProperty(Wi,"SUPPORT_SVG_DRAWING",{value:n}),n},get SUPPORT_FOREIGNOBJECT_DRAWING(){var n=typeof Array.from=="function"&&typeof window.fetch=="function"?fle(document):Promise.resolve(!1);return Object.defineProperty(Wi,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:n}),n},get SUPPORT_CORS_IMAGES(){var n=Ale();return Object.defineProperty(Wi,"SUPPORT_CORS_IMAGES",{value:n}),n},get SUPPORT_RESPONSE_TYPE(){var n=cle();return Object.defineProperty(Wi,"SUPPORT_RESPONSE_TYPE",{value:n}),n},get SUPPORT_CORS_XHR(){var n="withCredentials"in new XMLHttpRequest;return Object.defineProperty(Wi,"SUPPORT_CORS_XHR",{value:n}),n},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var n=!!(typeof Intl<"u"&&Intl.Segmenter);return Object.defineProperty(Wi,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:n}),n}},im=function(){function n(e,t){this.text=e,this.bounds=t}return n}(),hle=function(n,e,t,r){var i=mle(e,t),s=[],o=0;return i.forEach(function(a){if(t.textDecorationLine.length||a.trim().length>0)if(Wi.SUPPORT_RANGE_BOUNDS){var l=NL(r,o,a.length).getClientRects();if(l.length>1){var A=cT(a),c=0;A.forEach(function(f){s.push(new im(f,Yc.fromDOMRectList(n,NL(r,c+o,f.length).getClientRects()))),c+=f.length})}else s.push(new im(a,Yc.fromDOMRectList(n,l)))}else{var u=r.splitText(a.length);s.push(new im(a,dle(n,r))),r=u}else Wi.SUPPORT_RANGE_BOUNDS||(r=r.splitText(a.length));o+=a.length}),s},dle=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=sT(n,r);return r.firstChild&&i.replaceChild(r.firstChild,r),s}}return Yc.EMPTY},NL=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},cT=function(n){if(Wi.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 ole(n)},ple=function(n,e){if(Wi.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 vle(n,e)},mle=function(n,e){return e.letterSpacing!==0?cT(n):ple(n,e)},gle=[32,160,4961,65792,65793,4153,4241],vle=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=Qx(o),l="";a.forEach(function(A){gle.indexOf(A)===-1?l+=jn(A):(l.length&&r.push(l),r.push(jn(A)),l="")}),l.length&&r.push(l)}};!(i=t.next()).done;)s();return r},yle=function(){function n(e,t,r){this.text=wle(t.data,r.textTransform),this.textBounds=hle(e,this.text,r,t)}return n}(),wle=function(n,e){switch(e){case 1:return n.toLowerCase();case 3:return n.replace(xle,_le);case 2:return n.toUpperCase();default:return n}},xle=/(^|\s|:|-|\(|\))([a-z])/g,_le=function(n,e,t){return n.length>0?e+t.toUpperCase():n},K5=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}(_a),Y5=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}(_a),X5=function(n){Mo(e,n);function e(t,r){var i=n.call(this,t,r)||this,s=new XMLSerializer,o=sT(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}(_a),$5=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}(_a),bC=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}(_a),ble=[{type:15,flags:0,unit:"px",number:3}],Ble=[{type:16,flags:0,number:50}],Ele=function(n){return n.width>n.height?new Yc(n.left+(n.width-n.height)/2,n.top,n.height,n.height):n.width0)t.textNodes.push(new yle(n,i,t.styles));else if(t6(i))if(zle(i)&&i.assignedNodes)i.assignedNodes().forEach(function(a){return iy(n,a,t,r)});else{var o=e6(n,i);o.styles.isVisible()&&(Ile(i,o,r)?o.flags|=4:Rle(o.styles)&&(o.flags|=2),Sle.indexOf(i.tagName)!==-1&&(o.flags|=8),t.elements.push(o),i.slot,i.shadowRoot?iy(n,i.shadowRoot,o,r):!r6(i)&&!n6(i)&&!i6(i)&&iy(n,i,o,r))}},e6=function(n,e){return Qle(e)?new K5(n,e):kle(e)?new Y5(n,e):n6(e)?new X5(n,e):Ple(e)?new $5(n,e):Dle(e)?new bC(n,e):Ole(e)?new uT(n,e):i6(e)?new Z5(n,e):r6(e)?new J5(n,e):Hle(e)?new q5(n,e):new _a(n,e)},Tle=function(n,e){var t=e6(n,e);return t.flags|=4,iy(n,e,t,t),t},Ile=function(n,e,t){return e.styles.isPositionedWithZIndex()||e.styles.opacity<1||e.styles.isTransformed()||Nle(n)&&t.styles.isTransparent()},Rle=function(n){return n.isPositioned()||n.isFloating()},Fle=function(n){return n.nodeType===Node.TEXT_NODE},t6=function(n){return n.nodeType===Node.ELEMENT_NODE},Ule=function(n){return t6(n)&&typeof n.style<"u"&&!Lle(n)},Lle=function(n){return typeof n.className=="object"},Ple=function(n){return n.tagName==="LI"},Dle=function(n){return n.tagName==="OL"},Ole=function(n){return n.tagName==="INPUT"},n6=function(n){return n.tagName==="svg"},Nle=function(n){return n.tagName==="BODY"},kle=function(n){return n.tagName==="CANVAS"},Qle=function(n){return n.tagName==="IMG"},Hle=function(n){return n.tagName==="IFRAME"},r6=function(n){return n.tagName==="TEXTAREA"},i6=function(n){return n.tagName==="SELECT"},zle=function(n){return n.tagName==="SLOT"},QL={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"]},HL={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:["Ք","Փ","Ւ","Ց","Ր","Տ","Վ","Ս","Ռ","Ջ","Պ","Չ","Ո","Շ","Ն","Յ","Մ","Ճ","Ղ","Ձ","Հ","Կ","Ծ","Խ","Լ","Ի","Ժ","Թ","Ը","Է","Զ","Ե","Դ","Գ","Բ","Ա"]},Gle={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:["י׳","ט׳","ח׳","ז׳","ו׳","ה׳","ד׳","ג׳","ב׳","א׳","ת","ש","ר","ק","צ","פ","ע","ס","נ","מ","ל","כ","יט","יח","יז","טז","טו","י","ט","ח","ז","ו","ה","ד","ג","ב","א"]},Vle={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:["ჵ","ჰ","ჯ","ჴ","ხ","ჭ","წ","ძ","ც","ჩ","შ","ყ","ღ","ქ","ფ","ჳ","ტ","ს","რ","ჟ","პ","ო","ჲ","ნ","მ","ლ","კ","ი","თ","ჱ","ზ","ვ","ე","დ","გ","ბ","ა"]},ku=function(n,e,t,r,i,s){return nt?fT(n,i,s.length>0):r.integers.reduce(function(o,a,l){for(;n>=a;)n-=a,o+=r.values[l];return o},"")+s},s6=function(n,e,t,r){var i="";do t||n--,i=r(n)+i,n/=e;while(n*e>=e);return i},Gn=function(n,e,t,r,i){var s=t-e+1;return(n<0?"-":"")+(s6(Math.abs(n),s,r,function(o){return jn(Math.floor(o%s)+e)})+i)},ic=function(n,e,t){t===void 0&&(t=". ");var r=e.length;return s6(Math.abs(n),r,!1,function(i){return e[Math.floor(i%r)]})+t},qu=1,Wl=2,Kl=4,Tp=8,La=function(n,e,t,r,i,s){if(n<-9999||n>9999)return fT(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&&pr(s,qu)&&a!==""?a=e[A]+a:A>1||A===1&&l===0||A===1&&l===1&&pr(s,Wl)||A===1&&l===1&&pr(s,Kl)&&n>100||A===1&&l>1&&pr(s,Tp)?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},zL="十百千萬",GL="拾佰仟萬",VL="マイナス",Lb="마이너스",fT=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=Gn(n,48,57,!0,r);return a.length<4?"0"+a:a;case 4:return ic(n,"〇一二三四五六七八九",i);case 6:return ku(n,1,3999,QL,3,r).toLowerCase();case 7:return ku(n,1,3999,QL,3,r);case 8:return Gn(n,945,969,!1,r);case 9:return Gn(n,97,122,!1,r);case 10:return Gn(n,65,90,!1,r);case 11:return Gn(n,1632,1641,!0,r);case 12:case 49:return ku(n,1,9999,HL,3,r);case 35:return ku(n,1,9999,HL,3,r).toLowerCase();case 13:return Gn(n,2534,2543,!0,r);case 14:case 30:return Gn(n,6112,6121,!0,r);case 15:return ic(n,"子丑寅卯辰巳午未申酉戌亥",i);case 16:return ic(n,"甲乙丙丁戊己庚辛壬癸",i);case 17:case 48:return La(n,"零一二三四五六七八九",zL,"負",i,Wl|Kl|Tp);case 47:return La(n,"零壹貳參肆伍陸柒捌玖",GL,"負",i,qu|Wl|Kl|Tp);case 42:return La(n,"零一二三四五六七八九",zL,"负",i,Wl|Kl|Tp);case 41:return La(n,"零壹贰叁肆伍陆柒捌玖",GL,"负",i,qu|Wl|Kl|Tp);case 26:return La(n,"〇一二三四五六七八九","十百千万",VL,i,0);case 25:return La(n,"零壱弐参四伍六七八九","拾百千万",VL,i,qu|Wl|Kl);case 31:return La(n,"영일이삼사오육칠팔구","십백천만",Lb,s,qu|Wl|Kl);case 33:return La(n,"零一二三四五六七八九","十百千萬",Lb,s,0);case 32:return La(n,"零壹貳參四五六七八九","拾百千",Lb,s,qu|Wl|Kl);case 18:return Gn(n,2406,2415,!0,r);case 20:return ku(n,1,19999,Vle,3,r);case 21:return Gn(n,2790,2799,!0,r);case 22:return Gn(n,2662,2671,!0,r);case 22:return ku(n,1,10999,Gle,3,r);case 23:return ic(n,"あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわゐゑをん");case 24:return ic(n,"いろはにほへとちりぬるをわかよたれそつねならむうゐのおくやまけふこえてあさきゆめみしゑひもせす");case 27:return Gn(n,3302,3311,!0,r);case 28:return ic(n,"アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヰヱヲン",i);case 29:return ic(n,"イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス",i);case 34:return Gn(n,3792,3801,!0,r);case 37:return Gn(n,6160,6169,!0,r);case 38:return Gn(n,4160,4169,!0,r);case 39:return Gn(n,2918,2927,!0,r);case 40:return Gn(n,1776,1785,!0,r);case 43:return Gn(n,3046,3055,!0,r);case 44:return Gn(n,3174,3183,!0,r);case 45:return Gn(n,3664,3673,!0,r);case 46:return Gn(n,3872,3881,!0,r);case 3:default:return Gn(n,48,57,!0,r)}},jL;(function(n){n[n.BEFORE=0]="BEFORE",n[n.AFTER=1]="AFTER"})(jL||(jL={}));var jle=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}(),Ye=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}(),Qu=function(n,e,t){return new Ye(n.x+(e.x-n.x)*t,n.y+(e.y-n.y)*t)},Z0=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=Qu(this.start,this.startControl,e),i=Qu(this.startControl,this.endControl,e),s=Qu(this.endControl,this.end,e),o=Qu(r,i,e),a=Qu(i,s,e),l=Qu(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}(),Ss=function(n){return n.type===1},Wle=function(){function n(e){var t=e.styles,r=e.bounds,i=Mp(t.borderTopLeftRadius,r.width,r.height),s=i[0],o=i[1],a=Mp(t.borderTopRightRadius,r.width,r.height),l=a[0],A=a[1],c=Mp(t.borderBottomRightRadius,r.width,r.height),u=c[0],f=c[1],h=Mp(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,B=t.borderTopWidth,T=t.borderRightWidth,b=t.borderBottomWidth,M=t.borderLeftWidth,O=cn(t.paddingTop,e.bounds.width),Y=cn(t.paddingRight,e.bounds.width),H=cn(t.paddingBottom,e.bounds.width),I=cn(t.paddingLeft,e.bounds.width);this.topLeftBorderDoubleOuterBox=s>0||o>0?wn(r.left+M/3,r.top+B/3,s-M/3,o-B/3,Yt.TOP_LEFT):new Ye(r.left+M/3,r.top+B/3),this.topRightBorderDoubleOuterBox=s>0||o>0?wn(r.left+y,r.top+B/3,l-T/3,A-B/3,Yt.TOP_RIGHT):new Ye(r.left+r.width-T/3,r.top+B/3),this.bottomRightBorderDoubleOuterBox=u>0||f>0?wn(r.left+x,r.top+w,u-T/3,f-b/3,Yt.BOTTOM_RIGHT):new Ye(r.left+r.width-T/3,r.top+r.height-b/3),this.bottomLeftBorderDoubleOuterBox=p>0||d>0?wn(r.left+M/3,r.top+_,p-M/3,d-b/3,Yt.BOTTOM_LEFT):new Ye(r.left+M/3,r.top+r.height-b/3),this.topLeftBorderDoubleInnerBox=s>0||o>0?wn(r.left+M*2/3,r.top+B*2/3,s-M*2/3,o-B*2/3,Yt.TOP_LEFT):new Ye(r.left+M*2/3,r.top+B*2/3),this.topRightBorderDoubleInnerBox=s>0||o>0?wn(r.left+y,r.top+B*2/3,l-T*2/3,A-B*2/3,Yt.TOP_RIGHT):new Ye(r.left+r.width-T*2/3,r.top+B*2/3),this.bottomRightBorderDoubleInnerBox=u>0||f>0?wn(r.left+x,r.top+w,u-T*2/3,f-b*2/3,Yt.BOTTOM_RIGHT):new Ye(r.left+r.width-T*2/3,r.top+r.height-b*2/3),this.bottomLeftBorderDoubleInnerBox=p>0||d>0?wn(r.left+M*2/3,r.top+_,p-M*2/3,d-b*2/3,Yt.BOTTOM_LEFT):new Ye(r.left+M*2/3,r.top+r.height-b*2/3),this.topLeftBorderStroke=s>0||o>0?wn(r.left+M/2,r.top+B/2,s-M/2,o-B/2,Yt.TOP_LEFT):new Ye(r.left+M/2,r.top+B/2),this.topRightBorderStroke=s>0||o>0?wn(r.left+y,r.top+B/2,l-T/2,A-B/2,Yt.TOP_RIGHT):new Ye(r.left+r.width-T/2,r.top+B/2),this.bottomRightBorderStroke=u>0||f>0?wn(r.left+x,r.top+w,u-T/2,f-b/2,Yt.BOTTOM_RIGHT):new Ye(r.left+r.width-T/2,r.top+r.height-b/2),this.bottomLeftBorderStroke=p>0||d>0?wn(r.left+M/2,r.top+_,p-M/2,d-b/2,Yt.BOTTOM_LEFT):new Ye(r.left+M/2,r.top+r.height-b/2),this.topLeftBorderBox=s>0||o>0?wn(r.left,r.top,s,o,Yt.TOP_LEFT):new Ye(r.left,r.top),this.topRightBorderBox=l>0||A>0?wn(r.left+y,r.top,l,A,Yt.TOP_RIGHT):new Ye(r.left+r.width,r.top),this.bottomRightBorderBox=u>0||f>0?wn(r.left+x,r.top+w,u,f,Yt.BOTTOM_RIGHT):new Ye(r.left+r.width,r.top+r.height),this.bottomLeftBorderBox=p>0||d>0?wn(r.left,r.top+_,p,d,Yt.BOTTOM_LEFT):new Ye(r.left,r.top+r.height),this.topLeftPaddingBox=s>0||o>0?wn(r.left+M,r.top+B,Math.max(0,s-M),Math.max(0,o-B),Yt.TOP_LEFT):new Ye(r.left+M,r.top+B),this.topRightPaddingBox=l>0||A>0?wn(r.left+Math.min(y,r.width-T),r.top+B,y>r.width+T?0:Math.max(0,l-T),Math.max(0,A-B),Yt.TOP_RIGHT):new Ye(r.left+r.width-T,r.top+B),this.bottomRightPaddingBox=u>0||f>0?wn(r.left+Math.min(x,r.width-M),r.top+Math.min(w,r.height-b),Math.max(0,u-T),Math.max(0,f-b),Yt.BOTTOM_RIGHT):new Ye(r.left+r.width-T,r.top+r.height-b),this.bottomLeftPaddingBox=p>0||d>0?wn(r.left+M,r.top+Math.min(_,r.height-b),Math.max(0,p-M),Math.max(0,d-b),Yt.BOTTOM_LEFT):new Ye(r.left+M,r.top+r.height-b),this.topLeftContentBox=s>0||o>0?wn(r.left+M+I,r.top+B+O,Math.max(0,s-(M+I)),Math.max(0,o-(B+O)),Yt.TOP_LEFT):new Ye(r.left+M+I,r.top+B+O),this.topRightContentBox=l>0||A>0?wn(r.left+Math.min(y,r.width+M+I),r.top+B+O,y>r.width+M+I?0:l-M+I,A-(B+O),Yt.TOP_RIGHT):new Ye(r.left+r.width-(T+Y),r.top+B+O),this.bottomRightContentBox=u>0||f>0?wn(r.left+Math.min(x,r.width-(M+I)),r.top+Math.min(w,r.height+B+O),Math.max(0,u-(T+Y)),f-(b+H),Yt.BOTTOM_RIGHT):new Ye(r.left+r.width-(T+Y),r.top+r.height-(b+H)),this.bottomLeftContentBox=p>0||d>0?wn(r.left+M+I,r.top+_,Math.max(0,p-(M+I)),d-(b+H),Yt.BOTTOM_LEFT):new Ye(r.left+M+I,r.top+r.height-(b+H))}return n}(),Yt;(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"})(Yt||(Yt={}));var wn=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 Yt.TOP_LEFT:return new Z0(new Ye(n,A),new Ye(n,A-a),new Ye(l-o,e),new Ye(l,e));case Yt.TOP_RIGHT:return new Z0(new Ye(n,e),new Ye(n+o,e),new Ye(l,A-a),new Ye(l,A));case Yt.BOTTOM_RIGHT:return new Z0(new Ye(l,e),new Ye(l,e+a),new Ye(n+o,A),new Ye(n,A));case Yt.BOTTOM_LEFT:default:return new Z0(new Ye(l,A),new Ye(l-o,A),new Ye(n,e+a),new Ye(n,e))}},xw=function(n){return[n.topLeftBorderBox,n.topRightBorderBox,n.bottomRightBorderBox,n.bottomLeftBorderBox]},Kle=function(n){return[n.topLeftContentBox,n.topRightContentBox,n.bottomRightContentBox,n.bottomLeftContentBox]},_w=function(n){return[n.topLeftPaddingBox,n.topRightPaddingBox,n.bottomRightPaddingBox,n.bottomLeftPaddingBox]},Yle=function(){function n(e,t,r){this.offsetX=e,this.offsetY=t,this.matrix=r,this.type=0,this.target=6}return n}(),J0=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},o6=function(n){return n.type===1},Zle=function(n){return n.type===2},WL=function(n,e){return n.length===e.length?n.some(function(t,r){return t===e[r]}):!1},Jle=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})},a6=function(){function n(e){this.element=e,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return n}(),l6=function(){function n(e,t){if(this.container=e,this.parent=t,this.effects=[],this.curves=new Wle(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 Yle(r,i,s))}if(this.container.styles.overflowX!==0){var o=xw(this.curves),a=_w(this.curves);WL(o,a)?this.effects.push(new J0(o,6)):(this.effects.push(new J0(o,2)),this.effects.push(new J0(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!o6(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=xw(r.curves),a=_w(r.curves);WL(o,a)||i.unshift(new J0(a,6))}}else i.unshift.apply(i,s);r=r.parent}return i.filter(function(l){return pr(l.target,e)})},n}(),BC=function(n,e,t,r){n.container.elements.forEach(function(i){var s=pr(i.flags,4),o=pr(i.flags,2),a=new l6(i,n);pr(i.styles.display,2048)&&r.push(a);var l=pr(i.flags,8)?[]:r;if(s||o){var A=s||i.styles.isPositioned()?t:e,c=new a6(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);BC(a,c,s?c:t,l)}else i.styles.isInlineLevel()?e.inlineLevel.push(a):e.nonInlineLevel.push(a),BC(a,e,t,l);pr(i.flags,8)&&A6(i,l)})},A6=function(n,e){for(var t=n instanceof bC?n.start:1,r=n instanceof bC?n.reversed:!1,i=0;i"u"?n[0]:t},oAe=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 Ye(Math.round(r.left),Math.round(r.top+o)),new Ye(Math.round(r.left+r.width),Math.round(r.top+o)),new Ye(Math.round(r.left+r.width),Math.round(l+r.top+o)),new Ye(Math.round(r.left),Math.round(l+r.top+o))];case 3:return[new Ye(Math.round(r.left+s),Math.round(r.top)),new Ye(Math.round(r.left+s+a),Math.round(r.top)),new Ye(Math.round(r.left+s+a),Math.round(r.height+r.top)),new Ye(Math.round(r.left+s),Math.round(r.height+r.top))];case 1:return[new Ye(Math.round(r.left+s),Math.round(r.top+o)),new Ye(Math.round(r.left+s+a),Math.round(r.top+o)),new Ye(Math.round(r.left+s+a),Math.round(r.top+o+l)),new Ye(Math.round(r.left+s),Math.round(r.top+o+l))];default:return[new Ye(Math.round(i.left),Math.round(i.top)),new Ye(Math.round(i.left+i.width),Math.round(i.top)),new Ye(Math.round(i.left+i.width),Math.round(i.height+i.top)),new Ye(Math.round(i.left),Math.round(i.height+i.top))]}},aAe="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",YL="Hidden Text",lAe=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=aAe,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}(),u6=function(){function n(e,t){this.context=e,this.options=t}return n}(),AAe=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 lAe(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(),Zle(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)),o6(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 zi(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 zi(this,function(r){switch(r.label){case 0:if(pr(t.container.flags,16))debugger;return t.container.styles.isVisible()?[4,this.renderNodeBackgroundAndBorders(t)]:[3,3];case 1:return r.sent(),[4,this.renderNodeContent(t)];case 2:r.sent(),r.label=3;case 3:return[2]}})})},e.prototype.renderTextWithLetterSpacing=function(t,r,i){var s=this;if(r===0)this.ctx.fillText(t.text,t.bounds.left,t.bounds.top+i);else{var o=cT(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=dAe(t.fontFamily).join(", "),s=yg(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 zi(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=xr(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=xr(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=xr(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=xr(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=bw(t),o=_w(r);this.path(o),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(i,0,0,t.intrinsicWidth,t.intrinsicHeight,s.left,s.top,s.width,s.height),this.ctx.restore()}},e.prototype.renderNodeContent=function(t){return 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 zi(this,function(B){switch(B.label){case 0:this.applyEffects(t.getEffects(4)),r=t.container,i=t.curves,s=r.styles,o=0,a=r.textNodes,B.label=1;case 1:return o0&&v>0&&(b=s.ctx.createPattern(_,"repeat"),s.renderRepeat(O,b,L,U))):hoe(c)&&(M=Pb(t,r,[null,null,null]),O=M[0],Y=M[1],H=M[2],I=M[3],v=M[4],E=c.position.length===0?[aT]:c.position,L=cn(E[0],I),U=cn(E[E.length-1],v),P=loe(c,L,U,I,v),z=P[0],W=P[1],z>0&&W>0&&(N=s.ctx.createRadialGradient(Y+L,H+U,0,Y+L,H+U,z),xL(c.stops,z*2).forEach(function(ue){return N.addColorStop(ue.stop,xr(ue.color))}),s.path(O),s.ctx.fillStyle=N,z!==W?(C=t.bounds.left+.5*t.bounds.width,j=t.bounds.top+.5*t.bounds.height,ee=W/z,F=1/ee,s.ctx.save(),s.ctx.translate(C,j),s.ctx.transform(1,0,0,ee,0,0),s.ctx.translate(-C,-j),s.ctx.fillRect(Y,F*(H-j)+j,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,_,B,_,B;return zi(this,function(T){return this.ctx.save(),a=nAe(s,i),l=KL(s,i),o===2&&(this.path(l),this.ctx.clip()),Ss(l[0])?(A=l[0].start.x,c=l[0].start.y):(A=l[0].x,c=l[0].y),Ss(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)new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Gt=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Bw=class extends It{constructor(n){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${n}`,this.expressionName=n,this.type="VRMExpression",this.visible=!1}get overrideBlinkAmount(){return this.overrideBlink==="block"?0r.applyWeight(t))}clearAppliedWeight(){this._binds.forEach(n=>n.clearAppliedWeight())}};function u6(n,e,t){var r,i;const s=n.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const A=l.primitives.length,c=[];return t.traverse(u=>{c.length{const s=u6(n,i,r);s!=null&&t.set(i,s)}),t})}var Ur={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 f6(n){return Math.max(Math.min(n,1),0)}var Ew=class h6{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(Ur));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},t=new Set(Object.values(Ur));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 h6().copy(this)}getExpression(e){var t;return(t=this._expressionMap[e])!=null?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const t=this._expressions.indexOf(e);t===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var t;const r=this.getExpression(e);return(t=r==null?void 0:r.weight)!=null?t:null}setValue(e,t){const r=this.getExpression(e);r&&(r.weight=f6(t))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const t=this.getExpression(e);return t?`${t.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(t=>{t.clearAppliedWeight()}),this._expressions.forEach(t=>{let r=1;const i=t.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),t.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,t=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,t-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),t=Math.max(0,t),r=Math.max(0,r),{blink:e,lookAt:t,mouth:r}}},Kd={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},pAe={_Color:Kd.Color,_EmissionColor:Kd.EmissionColor,_ShadeColor:Kd.ShadeColor,_RimColor:Kd.RimColor,_OutlineColor:Kd.OutlineColor},mAe=new ke,d6=class p6{constructor({material:e,type:t,targetValue:r,targetAlpha:i}){this.material=e,this.type=t,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:t,alpha:r}=this._state;if(t!=null){const{propertyName:i,deltaValue:s}=t,o=this.material[i];o!=null&&o.add(mAe.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:t}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(t!=null){const{propertyName:r,initialValue:i}=t;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,t,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?t:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const c=i[l].clone(),u=new ke(o.r-c.r,o.g-c.g,o.b-c.b);return{propertyName:l,initialValue:c,deltaValue:u}}_initAlphaBindState(){var e,t,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?t:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const A=i[l],c=o-A;return{propertyName:l,initialValue:A,deltaValue:c}}_getPropertyNameMap(){var e,t;return(t=(e=Object.entries(p6._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?t:null}};d6._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var $L=d6,BC=class{constructor({primitives:n,index:e,weight:t}){this.primitives=n,this.index=e,this.weight=t}applyWeight(n){this.primitives.forEach(e=>{var t;((t=e.morphTargetInfluences)==null?void 0:t[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*n)})}clearAppliedWeight(){this.primitives.forEach(n=>{var e;((e=n.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(n.morphTargetInfluences[this.index]=0)})}},ZL=new Ye,m6=class g6{constructor({material:e,scale:t,offset:r}){var i,s;this.material=e,this.scale=t,this.offset=r;const o=(i=Object.entries(g6._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const A=(l=e[a])==null?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(ZL.copy(t.deltaOffset).multiplyScalar(e)),r.repeat.add(ZL.copy(t.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const t=this.material[e.name];t!==void 0&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale))})}};m6._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var JL=m6,gAe=new Set(["1.0","1.0-beta"]),v6=class y6{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return Gt(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return Gt(this,null,function*(){const t=yield this._v1Import(e);if(t)return t;const r=yield this._v0Import(e);return r||null})}_v1Import(e){return Gt(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!gAe.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(Ur)),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 Ew;return yield Promise.all(Array.from(c.entries()).map(f=>Gt(this,[f],function*([h,p]){var d,g,m,y,w,x,_;const C=new Bw(h);if(e.scene.add(C),C.isBinary=(d=p.isBinary)!=null?d:!1,C.overrideBlink=(g=p.overrideBlink)!=null?g:"none",C.overrideLookAt=(m=p.overrideLookAt)!=null?m:"none",C.overrideMouth=(y=p.overrideMouth)!=null?y:"none",(w=p.morphTargetBinds)==null||w.forEach(T=>Gt(this,null,function*(){var b;if(T.node===void 0||T.index===void 0)return;const M=yield YL(e,T.node),D=T.index;if(!M.every(Y=>Array.isArray(Y.morphTargetInfluences)&&D{const M=b.material;M&&T.push(M)}),(x=p.materialColorBinds)==null||x.forEach(b=>Gt(this,null,function*(){T.filter(D=>{var Y;const H=(Y=this.parser.associations.get(D))==null?void 0:Y.materials;return b.material===H}).forEach(D=>{C.addBind(new $L({material:D,type:b.type,targetValue:new ke().fromArray(b.targetValue),targetAlpha:b.targetValue[3]}))})})),(_=p.textureTransformBinds)==null||_.forEach(b=>Gt(this,null,function*(){T.filter(D=>{var Y;const H=(Y=this.parser.associations.get(D))==null?void 0:Y.materials;return b.material===H}).forEach(D=>{var Y,H;C.addBind(new JL({material:D,offset:new Ye().fromArray((Y=b.offset)!=null?Y:[0,0]),scale:new Ye().fromArray((H=b.scale)!=null?H:[1,1])}))})}))}u.registerExpression(C)}))),u})}_v0Import(e){return Gt(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new Ew,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(A=>Gt(this,null,function*(){var c;const u=A.presetName,f=u!=null&&y6.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 Bw(h);e.scene.add(p),p.isBinary=(c=A.isBinary)!=null?c:!1,A.binds&&A.binds.forEach(g=>Gt(this,null,function*(){var m;if(g.mesh===void 0||g.index===void 0)return;const y=[];(m=r.nodes)==null||m.forEach((x,_)=>{x.mesh===g.mesh&&y.push(_)});const w=g.index;yield Promise.all(y.map(x=>Gt(this,null,function*(){var _;const C=yield YL(e,x);if(!C.every(T=>Array.isArray(T.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 Ye(g.targetValue[0],g.targetValue[1]),C=new Ye(g.targetValue[2],g.targetValue[3]);C.y=1-C.y-_.y,p.addBind(new JL({material:w,scale:_,offset:C}));return}const x=pAe[y];if(x){p.addBind(new $L({material:w,type:x,targetValue:new ke().fromArray(g.targetValue),targetAlpha:g.targetValue[3]}));return}console.warn(y+" is not supported")})}),o.registerExpression(p)}))),o})}};v6.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var vAe=v6,fT=class tf{constructor(e,t){this._firstPersonOnlyLayer=tf.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=tf.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 tf(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=tf.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=tf.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 ll(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 FU?[]: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 Pr;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}};fT.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;fT.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var qL=fT,yAe=new Set(["1.0","1.0-beta"]),wAe=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(n){this.parser=n}afterRoot(n){return Gt(this,null,function*(){const e=n.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");n.userData.vrmFirstPerson=yield this._import(n,e)}})}_import(n,e){return Gt(this,null,function*(){if(e==null)return null;const t=yield this._v1Import(n,e);if(t)return t;const r=yield this._v0Import(n,e);return r||null})}_v1Import(n,e){return Gt(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!yAe.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson;if(!l)return null;const A=[],c=yield XL(n);return Array.from(c.entries()).forEach(([u,f])=>{var h;const p=l.meshAnnotations?l.meshAnnotations.find(d=>d.node===u):void 0;A.push({meshes:f,type:(h=p==null?void 0:p.type)!=null?h:"both"})}),new qL(e,A)})}_v0Import(n,e){return Gt(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield XL(n);return Array.from(a.entries()).forEach(([l,A])=>{const c=r.nodes[l],u=s.meshAnnotations?s.meshAnnotations.find(f=>f.mesh===c.mesh):void 0;o.push({meshes:A,type:this._convertV0FlagToV1Type(u==null?void 0:u.firstPersonFlag)})}),new qL(e,o)})}_convertV0FlagToV1Type(n){return n==="FirstPersonOnly"?"firstPersonOnly":n==="ThirdPersonOnly"?"thirdPersonOnly":n==="Auto"?"auto":"both"}},eP=new Z,tP=new Z,xAe=new rt,nP=class extends Pr{constructor(n){super(),this.vrmHumanoid=n,this._boneAxesMap=new Map,Object.values(n.humanBones).forEach(e=>{const t=new Fne(1);t.matrixAutoUpdate=!1,t.material.depthTest=!1,t.material.depthWrite=!1,this.add(t),this._boneAxesMap.set(e,t)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(n=>{n.geometry.dispose(),n.material.dispose()})}updateMatrixWorld(n){Array.from(this._boneAxesMap.entries()).forEach(([e,t])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(eP,xAe,tP);const r=eP.set(.1,.1,.1).divide(tP);t.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(n)}},Pb=["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"],Vm={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"},_Ae={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 w6(n){return n.invert?n.invert():n.inverse(),n}var sc=new Z,oc=new rt,EC=class{constructor(n){this.humanBones=n,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);r&&(sc.copy(r.position),oc.copy(r.quaternion),n[t]={position:sc.toArray(),rotation:oc.toArray()})}),n}getPose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);if(!r)return;sc.set(0,0,0),oc.identity();const i=this.restPose[t];i!=null&&i.position&&sc.fromArray(i.position).negate(),i!=null&&i.rotation&&w6(oc.fromArray(i.rotation)),sc.add(r.position),oc.premultiply(r.quaternion),n[t]={position:sc.toArray(),rotation:oc.toArray()}}),n}setPose(n){Object.entries(n).forEach(([e,t])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(t!=null&&t.position&&(i.position.fromArray(t.position),s.position&&i.position.add(sc.fromArray(s.position))),t!=null&&t.rotation&&(i.quaternion.fromArray(t.rotation),s.rotation&&i.quaternion.multiply(oc.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([n,e])=>{const t=this.getBoneNode(n);t&&(e!=null&&e.position&&t.position.fromArray(e.position),e!=null&&e.rotation&&t.quaternion.fromArray(e.rotation))})}getBone(n){var e;return(e=this.humanBones[n])!=null?e:void 0}getBoneNode(n){var e,t;return(t=(e=this.humanBones[n])==null?void 0:e.node)!=null?t:null}},Db=new Z,bAe=new rt,BAe=new Z,rP=class x6 extends EC{static _setupTransforms(e){const t=new It;t.name="VRMHumanoidRig";const r={},i={},s={};Pb.forEach(a=>{var l;const A=e.getBoneNode(a);if(A){const c=new Z,u=new rt;A.updateWorldMatrix(!0,!1),A.matrixWorld.decompose(c,u,Db),r[a]=c,i[a]=A.quaternion.clone();const f=new rt;(l=A.parent)==null||l.matrixWorld.decompose(Db,f,Db),s[a]=f}});const o={};return Pb.forEach(a=>{var l;const A=e.getBoneNode(a);if(A){const c=r[a];let u=a,f;for(;f==null&&(u=_Ae[u],u!=null);)f=r[u];const h=new It;h.name="Normalized_"+A.name,(u?(l=o[u])==null?void 0:l.node:t).add(h),h.position.copy(c),f&&h.position.sub(f),o[a]={node:h}}}),{rigBones:o,root:t,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:t,root:r,parentWorldRotations:i,boneRotations:s}=x6._setupTransforms(e);super(t),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){Pb.forEach(e=>{const t=this.original.getBoneNode(e);if(t!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=bAe.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(BAe);t.parent.updateWorldMatrix(!0,!1);const l=t.parent.matrixWorld,A=a.applyMatrix4(l.invert());t.position.copy(A)}}})}},iP=class _6{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,t){var r;this.autoUpdateHumanBones=(r=t==null?void 0:t.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new EC(e),this._normalizedHumanBones=new rP(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new EC(e.humanBones),this._normalizedHumanBones=new rP(this._rawHumanBones),this}clone(){return new _6(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()}},EAe={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"},CAe=new Set(["1.0","1.0-beta"]),sP={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},MAe=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(n){return Gt(this,null,function*(){n.userData.vrmHumanoid=yield this._import(n)})}_import(n){return Gt(this,null,function*(){const e=yield this._v1Import(n);if(e)return e;const t=yield this._v0Import(n);return t||null})}_v1Import(n){return Gt(this,null,function*(){var e,t;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(t=r.extensions)==null?void 0:t.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!CAe.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,A={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(u=>Gt(this,[u],function*([f,h]){let p=f;const d=h.node;if(l){const m=sP[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}A[p]={node:g}}))));const c=new iP(this._ensureRequiredBonesExist(A),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(c.normalizedHumanBonesRoot),this.helperRoot){const u=new nP(c);this.helperRoot.add(u),u.renderOrder=this.helperRoot.renderOrder}return c})}_v0Import(n){return Gt(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>Gt(this,null,function*(){const l=a.bone,A=a.node;if(l==null||A==null)return;const c=yield this.parser.getDependency("node",A);if(c==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${A}) does not exist`);return}const u=sP[l],f=u??l;if(s[f]!=null){console.warn(`Multiple bone entries for ${f} detected (index = ${A}), ignoring duplicated entries.`);return}s[f]={node:c}}))));const o=new iP(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new nP(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(n){const e=Object.values(EAe).filter(t=>n[t]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return n}},oP=class extends Kt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new lt(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(3*63),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,n=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let n=0;n<64;n++){const e=n/63*this._currentTheta;this._attrPos.setXYZ(n+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<63;n++)this._attrIndex.setXYZ(n*3,0,n+1,n+2);this._attrIndex.needsUpdate=!0}},SAe=class extends Kt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new Z,this._currentTail=new Z,this._attrPos=new lt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},nv=new rt,aP=new rt,Yd=new Z,lP=new Z,AP=Math.sqrt(2)/2,TAe=new rt(0,0,-AP,AP),IAe=new Z(0,1,0),RAe=class extends Pr{constructor(n){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=n;{const e=new oP;e.radius=.5;const t=new Mi({color:65280,transparent:!0,opacity:.5,side:hi,depthTest:!1,depthWrite:!1});this._meshPitch=new Cn(e,t),this.add(this._meshPitch)}{const e=new oP;e.radius=.5;const t=new Mi({color:16711680,transparent:!0,opacity:.5,side:hi,depthTest:!1,depthWrite:!1});this._meshYaw=new Cn(e,t),this.add(this._meshYaw)}{const e=new SAe;e.radius=.1;const t=new Cl({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new pg(e,t),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(n){const e=Lt.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const t=Lt.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=t,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(Yd),this.vrmLookAt.getLookAtWorldQuaternion(nv),nv.multiply(this.vrmLookAt.getFaceFrontQuaternion(aP)),this._meshYaw.position.copy(Yd),this._meshYaw.quaternion.copy(nv),this._meshPitch.position.copy(Yd),this._meshPitch.quaternion.copy(nv),this._meshPitch.quaternion.multiply(aP.setFromAxisAngle(IAe,e)),this._meshPitch.quaternion.multiply(TAe);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(lP).sub(Yd),this._lineTarget.geometry.tail.copy(lP),this._lineTarget.geometry.update(),this._lineTarget.position.copy(Yd)),super.updateMatrixWorld(n)}},FAe=new Z,UAe=new Z;function CC(n,e){return n.matrixWorld.decompose(FAe,e,UAe),e}function sy(n){return[Math.atan2(-n.z,n.x),Math.atan2(n.y,Math.sqrt(n.x*n.x+n.z*n.z))]}function cP(n){const e=Math.round(n/2/Math.PI);return n-2*Math.PI*e}var uP=new Z(0,0,1),LAe=new Z,PAe=new Z,DAe=new Z,OAe=new rt,Ob=new rt,fP=new rt,NAe=new rt,Nb=new di,b6=class B6{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 di)}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 B6(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 CC(t,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(uP)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,r]=sy(this.faceFront);return Nb.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(Nb).premultiply(NAe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(Ob),this.getFaceFrontQuaternion(fP),e.copy(uP).applyQuaternion(Ob).applyQuaternion(fP).applyEuler(this.getEuler(Nb))}lookAt(e){const t=OAe.copy(this._restHeadWorldQuaternion).multiply(w6(this.getLookAtWorldQuaternion(Ob))),r=this.getLookAtWorldPosition(PAe),i=DAe.copy(e).sub(r).applyQuaternion(t).normalize(),[s,o]=sy(this.faceFront),[a,l]=sy(i),A=cP(a-s),c=cP(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(LAe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};b6.EULER_ORDER="YXZ";var kAe=b6,QAe=new Z(0,0,1),Uo=new rt,zu=new rt,vs=new di(0,0,0,"YXZ"),oy=class{constructor(n,e,t,r,i){this.humanoid=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new Z(0,0,1),this._restQuatLeftEye=new rt,this._restQuatRightEye=new rt,this._restLeftEyeParentWorldQuat=new rt,this._restRightEyeParentWorldQuat=new rt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),CC(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),CC(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(n,e){const t=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");t&&(e<0?vs.x=-Lt.DEG2RAD*this.rangeMapVerticalDown.map(-e):vs.x=Lt.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?vs.y=-Lt.DEG2RAD*this.rangeMapHorizontalInner.map(-n):vs.y=Lt.DEG2RAD*this.rangeMapHorizontalOuter.map(n),Uo.setFromEuler(vs),this._getWorldFaceFrontQuat(zu),i.quaternion.copy(zu).multiply(Uo).multiply(zu.invert()),Uo.copy(this._restLeftEyeParentWorldQuat),t.quaternion.copy(i.quaternion).multiply(Uo).premultiply(Uo.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?vs.x=-Lt.DEG2RAD*this.rangeMapVerticalDown.map(-e):vs.x=Lt.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?vs.y=-Lt.DEG2RAD*this.rangeMapHorizontalOuter.map(-n):vs.y=Lt.DEG2RAD*this.rangeMapHorizontalInner.map(n),Uo.setFromEuler(vs),this._getWorldFaceFrontQuat(zu),s.quaternion.copy(zu).multiply(Uo).multiply(zu.invert()),Uo.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(Uo).premultiply(Uo.invert()).multiply(this._restQuatRightEye))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Lt.RAD2DEG*n.y,t=Lt.RAD2DEG*n.x;this.applyYawPitch(e,t)}_getWorldFaceFrontQuat(n){if(this.faceFront.distanceToSquared(QAe)<.01)return n.identity();const[e,t]=sy(this.faceFront);return vs.set(0,.5*Math.PI+e,t,"YZX"),n.setFromEuler(vs)}};oy.type="bone";var MC=class{constructor(n,e,t,r,i){this.expressions=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(n,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),n<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-n))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(n)))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Lt.RAD2DEG*n.y,t=Lt.RAD2DEG*n.x;this.applyYawPitch(e,t)}};MC.type="expression";var hP=class{constructor(n,e){this.inputMaxValue=n,this.outputScale=e}map(n){return this.outputScale*f6(n/this.inputMaxValue)}},HAe=new Set(["1.0","1.0-beta"]),rv=.01,zAe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(n){return Gt(this,null,function*(){const e=n.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const t=n.userData.vrmExpressionManager;if(t!==null){if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");n.userData.vrmLookAt=yield this._import(n,e,t)}})}_import(n,e,t){return Gt(this,null,function*(){if(e==null||t==null)return null;const r=yield this._v1Import(n,e,t);if(r)return r;const i=yield this._v0Import(n,e,t);return i||null})}_v1Import(n,e,t){return Gt(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const A=l.specVersion;if(!HAe.has(A))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${A}"`),null;const c=l.lookAt;if(!c)return null;const u=c.type==="expression"?1:10,f=this._v1ImportRangeMap(c.rangeMapHorizontalInner,u),h=this._v1ImportRangeMap(c.rangeMapHorizontalOuter,u),p=this._v1ImportRangeMap(c.rangeMapVerticalDown,u),d=this._v1ImportRangeMap(c.rangeMapVerticalUp,u);let g;c.type==="expression"?g=new MC(t,f,h,p,d):g=new oy(e,f,h,p,d);const m=this._importLookAt(e,g);return m.offsetFromHeadBone.fromArray((s=c.offsetFromHeadBone)!=null?s:[0,.06,0]),m})}_v1ImportRangeMap(n,e){var t,r;let i=(t=n==null?void 0:n.inputMaxValue)!=null?t:90;const s=(r=n==null?void 0:n.outputScale)!=null?r:e;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},WAe=class{constructor(n){this.scene=n.scene,this.meta=n.meta,this.humanoid=n.humanoid,this.expressionManager=n.expressionManager,this.firstPerson=n.firstPerson,this.lookAt=n.lookAt}update(n){this.humanoid.update(),this.lookAt&&this.lookAt.update(n),this.expressionManager&&this.expressionManager.update()}},KAe=class extends WAe{constructor(n){super(n),this.materials=n.materials,this.springBoneManager=n.springBoneManager,this.nodeConstraintManager=n.nodeConstraintManager}update(n){super.update(n),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(n),this.materials&&this.materials.forEach(e=>{e.update&&e.update(n)})}},YAe=Object.defineProperty,dP=Object.getOwnPropertySymbols,XAe=Object.prototype.hasOwnProperty,$Ae=Object.prototype.propertyIsEnumerable,pP=(n,e,t)=>e in n?YAe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,mP=(n,e)=>{for(var t in e||(e={}))XAe.call(e,t)&&pP(n,t,e[t]);if(dP)for(var t of dP(e))$Ae.call(e,t)&&pP(n,t,e[t]);return n},Ec=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),ZAe={"":3e3,srgb:3001};function JAe(n,e){parseInt(Gc,10)>=152?n.colorSpace=e:n.encoding=ZAe[e]}var qAe=class{get pending(){return Promise.all(this._pendings)}constructor(n,e){this._parser=n,this._materialParams=e,this._pendings=[]}assignPrimitive(n,e){e!=null&&(this._materialParams[n]=e)}assignColor(n,e,t){e!=null&&(this._materialParams[n]=new ke().fromArray(e),t&&this._materialParams[n].convertSRGBToLinear())}assignTexture(n,e,t){return Ec(this,null,function*(){const r=(()=>Ec(this,null,function*(){e!=null&&(yield this._parser.assignTexture(this._materialParams,n,e),t&&JAe(this._materialParams[n],"srgb"))}))();return this._pendings.push(r),r})}assignTextureByIndex(n,e,t){return Ec(this,null,function*(){return this.assignTexture(n,e!=null?{index:e}:void 0,t)})}},ece=`// #define PHONG + */var tv=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Gt=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Bw=class extends It{constructor(n){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${n}`,this.expressionName=n,this.type="VRMExpression",this.visible=!1}get overrideBlinkAmount(){return this.overrideBlink==="block"?0.5?1:0:this.weight}addBind(n){this._binds.push(n)}applyWeight(n){var e;let t=this.outputWeight;t*=(e=n==null?void 0:n.multiplier)!=null?e:1,this.isBinary&&t<1&&(t=0),this._binds.forEach(r=>r.applyWeight(t))}clearAppliedWeight(){this._binds.forEach(n=>n.clearAppliedWeight())}};function f6(n,e,t){var r,i;const s=n.parser.json,o=(r=s.nodes)==null?void 0:r[e];if(o==null)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${e}] of glTF but the node doesn't exist`),null;const a=o.mesh;if(a==null)return null;const l=(i=s.meshes)==null?void 0:i[a];if(l==null)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const A=l.primitives.length,c=[];return t.traverse(u=>{c.length{const s=f6(n,i,r);s!=null&&t.set(i,s)}),t})}var Ur={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 h6(n){return Math.max(Math.min(n,1),0)}var Ew=class d6{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(Ur));return Object.entries(this._expressionMap).forEach(([r,i])=>{t.has(r)&&(e[r]=i)}),e}get customExpressionMap(){const e={},t=new Set(Object.values(Ur));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 d6().copy(this)}getExpression(e){var t;return(t=this._expressionMap[e])!=null?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const t=this._expressions.indexOf(e);t===-1&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var t;const r=this.getExpression(e);return(t=r==null?void 0:r.weight)!=null?t:null}setValue(e,t){const r=this.getExpression(e);r&&(r.weight=h6(t))}resetValues(){this._expressions.forEach(e=>{e.weight=0})}getExpressionTrackName(e){const t=this.getExpression(e);return t?`${t.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach(t=>{t.clearAppliedWeight()}),this._expressions.forEach(t=>{let r=1;const i=t.expressionName;this.blinkExpressionNames.indexOf(i)!==-1&&(r*=e.blink),this.lookAtExpressionNames.indexOf(i)!==-1&&(r*=e.lookAt),this.mouthExpressionNames.indexOf(i)!==-1&&(r*=e.mouth),t.applyWeight({multiplier:r})})}_calculateWeightMultipliers(){let e=1,t=1,r=1;return this._expressions.forEach(i=>{e-=i.overrideBlinkAmount,t-=i.overrideLookAtAmount,r-=i.overrideMouthAmount}),e=Math.max(0,e),t=Math.max(0,t),r=Math.max(0,r),{blink:e,lookAt:t,mouth:r}}},Kd={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},mAe={_Color:Kd.Color,_EmissionColor:Kd.EmissionColor,_ShadeColor:Kd.ShadeColor,_RimColor:Kd.RimColor,_OutlineColor:Kd.OutlineColor},gAe=new ke,p6=class m6{constructor({material:e,type:t,targetValue:r,targetAlpha:i}){this.material=e,this.type=t,this.targetValue=r,this.targetAlpha=i??1;const s=this._initColorBindState(),o=this._initAlphaBindState();this._state={color:s,alpha:o}}applyWeight(e){const{color:t,alpha:r}=this._state;if(t!=null){const{propertyName:i,deltaValue:s}=t,o=this.material[i];o!=null&&o.add(gAe.copy(s).multiplyScalar(e))}if(r!=null){const{propertyName:i,deltaValue:s}=r;this.material[i]!=null&&(this.material[i]+=s*e)}}clearAppliedWeight(){const{color:e,alpha:t}=this._state;if(e!=null){const{propertyName:r,initialValue:i}=e,s=this.material[r];s!=null&&s.copy(i)}if(t!=null){const{propertyName:r,initialValue:i}=t;this.material[r]!=null&&(this.material[r]=i)}}_initColorBindState(){var e,t,r;const{material:i,type:s,targetValue:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[0])!=null?t:null;if(l==null)return console.warn(`Tried to add a material color bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type is not supported.`),null;const c=i[l].clone(),u=new ke(o.r-c.r,o.g-c.g,o.b-c.b);return{propertyName:l,initialValue:c,deltaValue:u}}_initAlphaBindState(){var e,t,r;const{material:i,type:s,targetAlpha:o}=this,a=this._getPropertyNameMap(),l=(t=(e=a==null?void 0:a[s])==null?void 0:e[1])!=null?t:null;if(l==null&&o!==1)return console.warn(`Tried to add a material alpha bind to the material ${(r=i.name)!=null?r:"(no name)"}, the type ${s} but the material or the type does not support alpha.`),null;if(l==null)return null;const A=i[l],c=o-A;return{propertyName:l,initialValue:A,deltaValue:c}}_getPropertyNameMap(){var e,t;return(t=(e=Object.entries(m6._propertyNameMapMap).find(([r])=>this.material[r]===!0))==null?void 0:e[1])!=null?t:null}};p6._propertyNameMapMap={isMeshStandardMaterial:{color:["color","opacity"],emissionColor:["emissive",null]},isMeshBasicMaterial:{color:["color","opacity"]},isMToonMaterial:{color:["color","opacity"],emissionColor:["emissive",null],outlineColor:["outlineColorFactor",null],matcapColor:["matcapFactor",null],rimColor:["parametricRimColorFactor",null],shadeColor:["shadeColorFactor",null]}};var ZL=p6,EC=class{constructor({primitives:n,index:e,weight:t}){this.primitives=n,this.index=e,this.weight=t}applyWeight(n){this.primitives.forEach(e=>{var t;((t=e.morphTargetInfluences)==null?void 0:t[this.index])!=null&&(e.morphTargetInfluences[this.index]+=this.weight*n)})}clearAppliedWeight(){this.primitives.forEach(n=>{var e;((e=n.morphTargetInfluences)==null?void 0:e[this.index])!=null&&(n.morphTargetInfluences[this.index]=0)})}},JL=new Ke,g6=class v6{constructor({material:e,scale:t,offset:r}){var i,s;this.material=e,this.scale=t,this.offset=r;const o=(i=Object.entries(v6._propertyNamesMap).find(([a])=>e[a]===!0))==null?void 0:i[1];o==null?(console.warn(`Tried to add a texture transform bind to the material ${(s=e.name)!=null?s:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach(a=>{var l;const A=(l=e[a])==null?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(JL.copy(t.deltaOffset).multiplyScalar(e)),r.repeat.add(JL.copy(t.deltaScale).multiplyScalar(e)))})}clearAppliedWeight(){this._properties.forEach(e=>{const t=this.material[e.name];t!==void 0&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale))})}};g6._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};var qL=g6,vAe=new Set(["1.0","1.0-beta"]),y6=class w6{get name(){return"VRMExpressionLoaderPlugin"}constructor(e){this.parser=e}afterRoot(e){return Gt(this,null,function*(){e.userData.vrmExpressionManager=yield this._import(e)})}_import(e){return Gt(this,null,function*(){const t=yield this._v1Import(e);if(t)return t;const r=yield this._v0Import(e);return r||null})}_v1Import(e){return Gt(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!vAe.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(Ur)),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 Ew;return yield Promise.all(Array.from(c.entries()).map(f=>Gt(this,[f],function*([h,p]){var d,g,m,y,w,x,_;const B=new Bw(h);if(e.scene.add(B),B.isBinary=(d=p.isBinary)!=null?d:!1,B.overrideBlink=(g=p.overrideBlink)!=null?g:"none",B.overrideLookAt=(m=p.overrideLookAt)!=null?m:"none",B.overrideMouth=(y=p.overrideMouth)!=null?y:"none",(w=p.morphTargetBinds)==null||w.forEach(T=>Gt(this,null,function*(){var b;if(T.node===void 0||T.index===void 0)return;const M=yield XL(e,T.node),O=T.index;if(!M.every(Y=>Array.isArray(Y.morphTargetInfluences)&&O{const M=b.material;M&&T.push(M)}),(x=p.materialColorBinds)==null||x.forEach(b=>Gt(this,null,function*(){T.filter(O=>{var Y;const H=(Y=this.parser.associations.get(O))==null?void 0:Y.materials;return b.material===H}).forEach(O=>{B.addBind(new ZL({material:O,type:b.type,targetValue:new ke().fromArray(b.targetValue),targetAlpha:b.targetValue[3]}))})})),(_=p.textureTransformBinds)==null||_.forEach(b=>Gt(this,null,function*(){T.filter(O=>{var Y;const H=(Y=this.parser.associations.get(O))==null?void 0:Y.materials;return b.material===H}).forEach(O=>{var Y,H;B.addBind(new qL({material:O,offset:new Ke().fromArray((Y=b.offset)!=null?Y:[0,0]),scale:new Ke().fromArray((H=b.scale)!=null?H:[1,1])}))})}))}u.registerExpression(B)}))),u})}_v0Import(e){return Gt(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.blendShapeMaster;if(!s)return null;const o=new Ew,a=s.blendShapeGroups;if(!a)return o;const l=new Set;return yield Promise.all(a.map(A=>Gt(this,null,function*(){var c;const u=A.presetName,f=u!=null&&w6.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 Bw(h);e.scene.add(p),p.isBinary=(c=A.isBinary)!=null?c:!1,A.binds&&A.binds.forEach(g=>Gt(this,null,function*(){var m;if(g.mesh===void 0||g.index===void 0)return;const y=[];(m=r.nodes)==null||m.forEach((x,_)=>{x.mesh===g.mesh&&y.push(_)});const w=g.index;yield Promise.all(y.map(x=>Gt(this,null,function*(){var _;const B=yield XL(e,x);if(!B.every(T=>Array.isArray(T.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 Ke(g.targetValue[0],g.targetValue[1]),B=new Ke(g.targetValue[2],g.targetValue[3]);B.y=1-B.y-_.y,p.addBind(new qL({material:w,scale:_,offset:B}));return}const x=mAe[y];if(x){p.addBind(new ZL({material:w,type:x,targetValue:new ke().fromArray(g.targetValue),targetAlpha:g.targetValue[3]}));return}console.warn(y+" is not supported")})}),o.registerExpression(p)}))),o})}};y6.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};var yAe=y6,hT=class tf{constructor(e,t){this._firstPersonOnlyLayer=tf.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=tf.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 tf(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=tf.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=tf.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 ll(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 UU?[]: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 Pr;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}};hT.DEFAULT_FIRSTPERSON_ONLY_LAYER=9;hT.DEFAULT_THIRDPERSON_ONLY_LAYER=10;var eP=hT,wAe=new Set(["1.0","1.0-beta"]),xAe=class{get name(){return"VRMFirstPersonLoaderPlugin"}constructor(n){this.parser=n}afterRoot(n){return Gt(this,null,function*(){const e=n.userData.vrmHumanoid;if(e!==null){if(e===void 0)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");n.userData.vrmFirstPerson=yield this._import(n,e)}})}_import(n,e){return Gt(this,null,function*(){if(e==null)return null;const t=yield this._v1Import(n,e);if(t)return t;const r=yield this._v0Import(n,e);return r||null})}_v1Import(n,e){return Gt(this,null,function*(){var t,r;const i=this.parser.json;if(!(((t=i.extensionsUsed)==null?void 0:t.indexOf("VRMC_vrm"))!==-1))return null;const o=(r=i.extensions)==null?void 0:r.VRMC_vrm;if(!o)return null;const a=o.specVersion;if(!wAe.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=o.firstPerson;if(!l)return null;const A=[],c=yield $L(n);return Array.from(c.entries()).forEach(([u,f])=>{var h;const p=l.meshAnnotations?l.meshAnnotations.find(d=>d.node===u):void 0;A.push({meshes:f,type:(h=p==null?void 0:p.type)!=null?h:"both"})}),new eP(e,A)})}_v0Import(n,e){return Gt(this,null,function*(){var t;const r=this.parser.json,i=(t=r.extensions)==null?void 0:t.VRM;if(!i)return null;const s=i.firstPerson;if(!s)return null;const o=[],a=yield $L(n);return Array.from(a.entries()).forEach(([l,A])=>{const c=r.nodes[l],u=s.meshAnnotations?s.meshAnnotations.find(f=>f.mesh===c.mesh):void 0;o.push({meshes:A,type:this._convertV0FlagToV1Type(u==null?void 0:u.firstPersonFlag)})}),new eP(e,o)})}_convertV0FlagToV1Type(n){return n==="FirstPersonOnly"?"firstPersonOnly":n==="ThirdPersonOnly"?"thirdPersonOnly":n==="Auto"?"auto":"both"}},tP=new Z,nP=new Z,_Ae=new rt,rP=class extends Pr{constructor(n){super(),this.vrmHumanoid=n,this._boneAxesMap=new Map,Object.values(n.humanBones).forEach(e=>{const t=new Une(1);t.matrixAutoUpdate=!1,t.material.depthTest=!1,t.material.depthWrite=!1,this.add(t),this._boneAxesMap.set(e,t)})}dispose(){Array.from(this._boneAxesMap.values()).forEach(n=>{n.geometry.dispose(),n.material.dispose()})}updateMatrixWorld(n){Array.from(this._boneAxesMap.entries()).forEach(([e,t])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(tP,_Ae,nP);const r=tP.set(.1,.1,.1).divide(nP);t.matrix.copy(e.node.matrixWorld).scale(r)}),super.updateMatrixWorld(n)}},Db=["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"],Vm={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"},bAe={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 x6(n){return n.invert?n.invert():n.inverse(),n}var sc=new Z,oc=new rt,CC=class{constructor(n){this.humanBones=n,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);r&&(sc.copy(r.position),oc.copy(r.quaternion),n[t]={position:sc.toArray(),rotation:oc.toArray()})}),n}getPose(){const n={};return Object.keys(this.humanBones).forEach(e=>{const t=e,r=this.getBoneNode(t);if(!r)return;sc.set(0,0,0),oc.identity();const i=this.restPose[t];i!=null&&i.position&&sc.fromArray(i.position).negate(),i!=null&&i.rotation&&x6(oc.fromArray(i.rotation)),sc.add(r.position),oc.premultiply(r.quaternion),n[t]={position:sc.toArray(),rotation:oc.toArray()}}),n}setPose(n){Object.entries(n).forEach(([e,t])=>{const r=e,i=this.getBoneNode(r);if(!i)return;const s=this.restPose[r];s&&(t!=null&&t.position&&(i.position.fromArray(t.position),s.position&&i.position.add(sc.fromArray(s.position))),t!=null&&t.rotation&&(i.quaternion.fromArray(t.rotation),s.rotation&&i.quaternion.multiply(oc.fromArray(s.rotation))))})}resetPose(){Object.entries(this.restPose).forEach(([n,e])=>{const t=this.getBoneNode(n);t&&(e!=null&&e.position&&t.position.fromArray(e.position),e!=null&&e.rotation&&t.quaternion.fromArray(e.rotation))})}getBone(n){var e;return(e=this.humanBones[n])!=null?e:void 0}getBoneNode(n){var e,t;return(t=(e=this.humanBones[n])==null?void 0:e.node)!=null?t:null}},Ob=new Z,BAe=new rt,EAe=new Z,iP=class _6 extends CC{static _setupTransforms(e){const t=new It;t.name="VRMHumanoidRig";const r={},i={},s={};Db.forEach(a=>{var l;const A=e.getBoneNode(a);if(A){const c=new Z,u=new rt;A.updateWorldMatrix(!0,!1),A.matrixWorld.decompose(c,u,Ob),r[a]=c,i[a]=A.quaternion.clone();const f=new rt;(l=A.parent)==null||l.matrixWorld.decompose(Ob,f,Ob),s[a]=f}});const o={};return Db.forEach(a=>{var l;const A=e.getBoneNode(a);if(A){const c=r[a];let u=a,f;for(;f==null&&(u=bAe[u],u!=null);)f=r[u];const h=new It;h.name="Normalized_"+A.name,(u?(l=o[u])==null?void 0:l.node:t).add(h),h.position.copy(c),f&&h.position.sub(f),o[a]={node:h}}}),{rigBones:o,root:t,parentWorldRotations:s,boneRotations:i}}constructor(e){const{rigBones:t,root:r,parentWorldRotations:i,boneRotations:s}=_6._setupTransforms(e);super(t),this.original=e,this.root=r,this._parentWorldRotations=i,this._boneRotations=s}update(){Db.forEach(e=>{const t=this.original.getBoneNode(e);if(t!=null){const r=this.getBoneNode(e),i=this._parentWorldRotations[e],s=BAe.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(EAe);t.parent.updateWorldMatrix(!0,!1);const l=t.parent.matrixWorld,A=a.applyMatrix4(l.invert());t.position.copy(A)}}})}},sP=class b6{get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}constructor(e,t){var r;this.autoUpdateHumanBones=(r=t==null?void 0:t.autoUpdateHumanBones)!=null?r:!0,this._rawHumanBones=new CC(e),this._normalizedHumanBones=new iP(this._rawHumanBones)}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new CC(e.humanBones),this._normalizedHumanBones=new iP(this._rawHumanBones),this}clone(){return new b6(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()}},CAe={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"},MAe=new Set(["1.0","1.0-beta"]),oP={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"},SAe=class{get name(){return"VRMHumanoidLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot,this.autoUpdateHumanBones=e==null?void 0:e.autoUpdateHumanBones}afterRoot(n){return Gt(this,null,function*(){n.userData.vrmHumanoid=yield this._import(n)})}_import(n){return Gt(this,null,function*(){const e=yield this._v1Import(n);if(e)return e;const t=yield this._v0Import(n);return t||null})}_v1Import(n){return Gt(this,null,function*(){var e,t;const r=this.parser.json;if(!(((e=r.extensionsUsed)==null?void 0:e.indexOf("VRMC_vrm"))!==-1))return null;const s=(t=r.extensions)==null?void 0:t.VRMC_vrm;if(!s)return null;const o=s.specVersion;if(!MAe.has(o))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${o}"`),null;const a=s.humanoid;if(!a)return null;const l=a.humanBones.leftThumbIntermediate!=null||a.humanBones.rightThumbIntermediate!=null,A={};a.humanBones!=null&&(yield Promise.all(Object.entries(a.humanBones).map(u=>Gt(this,[u],function*([f,h]){let p=f;const d=h.node;if(l){const m=oP[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}A[p]={node:g}}))));const c=new sP(this._ensureRequiredBonesExist(A),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(c.normalizedHumanBonesRoot),this.helperRoot){const u=new rP(c);this.helperRoot.add(u),u.renderOrder=this.helperRoot.renderOrder}return c})}_v0Import(n){return Gt(this,null,function*(){var e;const r=(e=this.parser.json.extensions)==null?void 0:e.VRM;if(!r)return null;const i=r.humanoid;if(!i)return null;const s={};i.humanBones!=null&&(yield Promise.all(i.humanBones.map(a=>Gt(this,null,function*(){const l=a.bone,A=a.node;if(l==null||A==null)return;const c=yield this.parser.getDependency("node",A);if(c==null){console.warn(`A glTF node bound to the humanoid bone ${l} (index = ${A}) does not exist`);return}const u=oP[l],f=u??l;if(s[f]!=null){console.warn(`Multiple bone entries for ${f} detected (index = ${A}), ignoring duplicated entries.`);return}s[f]={node:c}}))));const o=new sP(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(n.scene.add(o.normalizedHumanBonesRoot),this.helperRoot){const a=new rP(o);this.helperRoot.add(a),a.renderOrder=this.helperRoot.renderOrder}return o})}_ensureRequiredBonesExist(n){const e=Object.values(CAe).filter(t=>n[t]==null);if(e.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${e.join(", ")}`);return n}},aP=class extends Kt{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new lt(new Float32Array(65*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(3*63),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,n=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let n=0;n<64;n++){const e=n/63*this._currentTheta;this._attrPos.setXYZ(n+1,this._currentRadius*Math.sin(e),0,this._currentRadius*Math.cos(e))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<63;n++)this._attrIndex.setXYZ(n*3,0,n+1,n+2);this._attrIndex.needsUpdate=!0}},TAe=class extends Kt{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new Z,this._currentTail=new Z,this._attrPos=new lt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,n=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},nv=new rt,lP=new rt,Yd=new Z,AP=new Z,cP=Math.sqrt(2)/2,IAe=new rt(0,0,-cP,cP),RAe=new Z(0,1,0),FAe=class extends Pr{constructor(n){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=n;{const e=new aP;e.radius=.5;const t=new Mi({color:65280,transparent:!0,opacity:.5,side:hi,depthTest:!1,depthWrite:!1});this._meshPitch=new Cn(e,t),this.add(this._meshPitch)}{const e=new aP;e.radius=.5;const t=new Mi({color:16711680,transparent:!0,opacity:.5,side:hi,depthTest:!1,depthWrite:!1});this._meshYaw=new Cn(e,t),this.add(this._meshYaw)}{const e=new TAe;e.radius=.1;const t=new Cl({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new pg(e,t),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(n){const e=Lt.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=e,this._meshYaw.geometry.update();const t=Lt.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=t,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition(Yd),this.vrmLookAt.getLookAtWorldQuaternion(nv),nv.multiply(this.vrmLookAt.getFaceFrontQuaternion(lP)),this._meshYaw.position.copy(Yd),this._meshYaw.quaternion.copy(nv),this._meshPitch.position.copy(Yd),this._meshPitch.quaternion.copy(nv),this._meshPitch.quaternion.multiply(lP.setFromAxisAngle(RAe,e)),this._meshPitch.quaternion.multiply(IAe);const{target:r,autoUpdate:i}=this.vrmLookAt;r!=null&&i&&(r.getWorldPosition(AP).sub(Yd),this._lineTarget.geometry.tail.copy(AP),this._lineTarget.geometry.update(),this._lineTarget.position.copy(Yd)),super.updateMatrixWorld(n)}},UAe=new Z,LAe=new Z;function MC(n,e){return n.matrixWorld.decompose(UAe,e,LAe),e}function sy(n){return[Math.atan2(-n.z,n.x),Math.atan2(n.y,Math.sqrt(n.x*n.x+n.z*n.z))]}function uP(n){const e=Math.round(n/2/Math.PI);return n-2*Math.PI*e}var fP=new Z(0,0,1),PAe=new Z,DAe=new Z,OAe=new Z,NAe=new rt,Nb=new rt,hP=new rt,kAe=new rt,kb=new di,B6=class E6{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 di)}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 E6(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 MC(t,e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(fP)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,r]=sy(this.faceFront);return kb.set(0,.5*Math.PI+t,r,"YZX"),e.setFromEuler(kb).premultiply(kAe.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(Nb),this.getFaceFrontQuaternion(hP),e.copy(fP).applyQuaternion(Nb).applyQuaternion(hP).applyEuler(this.getEuler(kb))}lookAt(e){const t=NAe.copy(this._restHeadWorldQuaternion).multiply(x6(this.getLookAtWorldQuaternion(Nb))),r=this.getLookAtWorldPosition(DAe),i=OAe.copy(e).sub(r).applyQuaternion(t).normalize(),[s,o]=sy(this.faceFront),[a,l]=sy(i),A=uP(a-s),c=uP(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(PAe)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}};B6.EULER_ORDER="YXZ";var QAe=B6,HAe=new Z(0,0,1),Uo=new rt,zu=new rt,vs=new di(0,0,0,"YXZ"),oy=class{constructor(n,e,t,r,i){this.humanoid=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i,this.faceFront=new Z(0,0,1),this._restQuatLeftEye=new rt,this._restQuatRightEye=new rt,this._restLeftEyeParentWorldQuat=new rt,this._restRightEyeParentWorldQuat=new rt;const s=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye");s&&(this._restQuatLeftEye.copy(s.quaternion),MC(s.parent,this._restLeftEyeParentWorldQuat)),o&&(this._restQuatRightEye.copy(o.quaternion),MC(o.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(n,e){const t=this.humanoid.getRawBoneNode("leftEye"),r=this.humanoid.getRawBoneNode("rightEye"),i=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");t&&(e<0?vs.x=-Lt.DEG2RAD*this.rangeMapVerticalDown.map(-e):vs.x=Lt.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?vs.y=-Lt.DEG2RAD*this.rangeMapHorizontalInner.map(-n):vs.y=Lt.DEG2RAD*this.rangeMapHorizontalOuter.map(n),Uo.setFromEuler(vs),this._getWorldFaceFrontQuat(zu),i.quaternion.copy(zu).multiply(Uo).multiply(zu.invert()),Uo.copy(this._restLeftEyeParentWorldQuat),t.quaternion.copy(i.quaternion).multiply(Uo).premultiply(Uo.invert()).multiply(this._restQuatLeftEye)),r&&(e<0?vs.x=-Lt.DEG2RAD*this.rangeMapVerticalDown.map(-e):vs.x=Lt.DEG2RAD*this.rangeMapVerticalUp.map(e),n<0?vs.y=-Lt.DEG2RAD*this.rangeMapHorizontalOuter.map(-n):vs.y=Lt.DEG2RAD*this.rangeMapHorizontalInner.map(n),Uo.setFromEuler(vs),this._getWorldFaceFrontQuat(zu),s.quaternion.copy(zu).multiply(Uo).multiply(zu.invert()),Uo.copy(this._restRightEyeParentWorldQuat),r.quaternion.copy(s.quaternion).multiply(Uo).premultiply(Uo.invert()).multiply(this._restQuatRightEye))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Lt.RAD2DEG*n.y,t=Lt.RAD2DEG*n.x;this.applyYawPitch(e,t)}_getWorldFaceFrontQuat(n){if(this.faceFront.distanceToSquared(HAe)<.01)return n.identity();const[e,t]=sy(this.faceFront);return vs.set(0,.5*Math.PI+e,t,"YZX"),n.setFromEuler(vs)}};oy.type="bone";var SC=class{constructor(n,e,t,r,i){this.expressions=n,this.rangeMapHorizontalInner=e,this.rangeMapHorizontalOuter=t,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=i}applyYawPitch(n,e){e<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-e))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(e))),n<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-n))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(n)))}lookAt(n){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const e=Lt.RAD2DEG*n.y,t=Lt.RAD2DEG*n.x;this.applyYawPitch(e,t)}};SC.type="expression";var dP=class{constructor(n,e){this.inputMaxValue=n,this.outputScale=e}map(n){return this.outputScale*h6(n/this.inputMaxValue)}},zAe=new Set(["1.0","1.0-beta"]),rv=.01,GAe=class{get name(){return"VRMLookAtLoaderPlugin"}constructor(n,e){this.parser=n,this.helperRoot=e==null?void 0:e.helperRoot}afterRoot(n){return Gt(this,null,function*(){const e=n.userData.vrmHumanoid;if(e===null)return;if(e===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const t=n.userData.vrmExpressionManager;if(t!==null){if(t===void 0)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");n.userData.vrmLookAt=yield this._import(n,e,t)}})}_import(n,e,t){return Gt(this,null,function*(){if(e==null||t==null)return null;const r=yield this._v1Import(n,e,t);if(r)return r;const i=yield this._v0Import(n,e,t);return i||null})}_v1Import(n,e,t){return Gt(this,null,function*(){var r,i,s;const o=this.parser.json;if(!(((r=o.extensionsUsed)==null?void 0:r.indexOf("VRMC_vrm"))!==-1))return null;const l=(i=o.extensions)==null?void 0:i.VRMC_vrm;if(!l)return null;const A=l.specVersion;if(!zAe.has(A))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${A}"`),null;const c=l.lookAt;if(!c)return null;const u=c.type==="expression"?1:10,f=this._v1ImportRangeMap(c.rangeMapHorizontalInner,u),h=this._v1ImportRangeMap(c.rangeMapHorizontalOuter,u),p=this._v1ImportRangeMap(c.rangeMapVerticalDown,u),d=this._v1ImportRangeMap(c.rangeMapVerticalUp,u);let g;c.type==="expression"?g=new SC(t,f,h,p,d):g=new oy(e,f,h,p,d);const m=this._importLookAt(e,g);return m.offsetFromHeadBone.fromArray((s=c.offsetFromHeadBone)!=null?s:[0,.06,0]),m})}_v1ImportRangeMap(n,e){var t,r;let i=(t=n==null?void 0:n.inputMaxValue)!=null?t:90;const s=(r=n==null?void 0:n.outputScale)!=null?r:e;return i(console.error(o),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null))})}},KAe=class{constructor(n){this.scene=n.scene,this.meta=n.meta,this.humanoid=n.humanoid,this.expressionManager=n.expressionManager,this.firstPerson=n.firstPerson,this.lookAt=n.lookAt}update(n){this.humanoid.update(),this.lookAt&&this.lookAt.update(n),this.expressionManager&&this.expressionManager.update()}},YAe=class extends KAe{constructor(n){super(n),this.materials=n.materials,this.springBoneManager=n.springBoneManager,this.nodeConstraintManager=n.nodeConstraintManager}update(n){super.update(n),this.nodeConstraintManager&&this.nodeConstraintManager.update(),this.springBoneManager&&this.springBoneManager.update(n),this.materials&&this.materials.forEach(e=>{e.update&&e.update(n)})}},XAe=Object.defineProperty,pP=Object.getOwnPropertySymbols,$Ae=Object.prototype.hasOwnProperty,ZAe=Object.prototype.propertyIsEnumerable,mP=(n,e,t)=>e in n?XAe(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,gP=(n,e)=>{for(var t in e||(e={}))$Ae.call(e,t)&&mP(n,t,e[t]);if(pP)for(var t of pP(e))ZAe.call(e,t)&&mP(n,t,e[t]);return n},Ec=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),JAe={"":3e3,srgb:3001};function qAe(n,e){parseInt(Gc,10)>=152?n.colorSpace=e:n.encoding=JAe[e]}var ece=class{get pending(){return Promise.all(this._pendings)}constructor(n,e){this._parser=n,this._materialParams=e,this._pendings=[]}assignPrimitive(n,e){e!=null&&(this._materialParams[n]=e)}assignColor(n,e,t){e!=null&&(this._materialParams[n]=new ke().fromArray(e),t&&this._materialParams[n].convertSRGBToLinear())}assignTexture(n,e,t){return Ec(this,null,function*(){const r=(()=>Ec(this,null,function*(){e!=null&&(yield this._parser.assignTexture(this._materialParams,n,e),t&&qAe(this._materialParams[n],"srgb"))}))();return this._pendings.push(r),r})}assignTextureByIndex(n,e,t){return Ec(this,null,function*(){return this.assignTexture(n,e!=null?{index:e}:void 0,t)})}},tce=`// #define PHONG varying vec3 vViewPosition; @@ -3353,7 +3353,7 @@ void main() { #include #include -}`,tce=`// #define PHONG +}`,nce=`// #define PHONG uniform vec3 litFactor; @@ -4155,51 +4155,51 @@ void main() { gl_FragColor = vec4( col, diffuseColor.a ); postCorrection(); } -`,nce={None:"none",Normal:"normal",LitShadeRate:"litShadeRate",UV:"uv"},gP={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},rce={3e3:"",3001:"srgb"};function kb(n){return parseInt(Gc,10)>=152?n.colorSpace:rce[n.encoding]}var E6=class extends Mr{constructor(n={}){var e;super({vertexShader:ece,fragmentShader:tce}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=$h,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=nce.None,this._outlineWidthMode=gP.None,this._isOutline=!1,n.transparentWithZWrite&&(n.depthWrite=!0),delete n.transparentWithZWrite,n.fog=!0,n.lights=!0,n.clipping=!0,this.uniforms=WS.merge([Ne.common,Ne.normalmap,Ne.emissivemap,Ne.fog,Ne.lights,{litFactor:{value:new ke(1,1,1)},mapUvTransform:{value:new xn},colorAlpha:{value:1},normalMapUvTransform:{value:new xn},shadeColorFactor:{value:new ke(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new xn},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new xn},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ke(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new xn},parametricRimColorFactor:{value:new ke(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new xn},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ke(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new xn},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new xn},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ke(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new xn},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=n.uniforms)!=null?e:{}]),this.setValues(n),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([t,r])=>`${t}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${kb(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${kb(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${kb(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=t=>{const r=parseInt(Gc,10),i=Object.entries(mP(mP({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` +`,rce={None:"none",Normal:"normal",LitShadeRate:"litShadeRate",UV:"uv"},vP={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},ice={3e3:"",3001:"srgb"};function Qb(n){return parseInt(Gc,10)>=152?n.colorSpace:ice[n.encoding]}var C6=class extends gr{constructor(n={}){var e;super({vertexShader:tce,fragmentShader:nce}),this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.fog=!0,this.normalMapType=$h,this._ignoreVertexColor=!0,this._v0CompatShade=!1,this._debugMode=rce.None,this._outlineWidthMode=vP.None,this._isOutline=!1,n.transparentWithZWrite&&(n.depthWrite=!0),delete n.transparentWithZWrite,n.fog=!0,n.lights=!0,n.clipping=!0,this.uniforms=KS.merge([Ne.common,Ne.normalmap,Ne.emissivemap,Ne.fog,Ne.lights,{litFactor:{value:new ke(1,1,1)},mapUvTransform:{value:new xn},colorAlpha:{value:1},normalMapUvTransform:{value:new xn},shadeColorFactor:{value:new ke(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new xn},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new xn},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new ke(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new xn},parametricRimColorFactor:{value:new ke(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new xn},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new ke(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new xn},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new xn},outlineWidthFactor:{value:0},outlineColorFactor:{value:new ke(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new xn},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(e=n.uniforms)!=null?e:{}]),this.setValues(n),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([t,r])=>`${t}:${r}`),this.matcapTexture?`matcapTextureColorSpace:${Qb(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${Qb(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${Qb(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=t=>{const r=parseInt(Gc,10),i=Object.entries(gP(gP({},this._generateDefines()),this.defines)).filter(([s,o])=>!!o).map(([s,o])=>`#define ${s} ${o}`).join(` `)+` -`;t.vertexShader=i+t.vertexShader,t.fragmentShader=i+t.fragmentShader,r<154&&(t.fragmentShader=t.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(n){this.uniforms.litFactor.value=n}get map(){return this.uniforms.map.value}set map(n){this.uniforms.map.value=n}get normalMap(){return this.uniforms.normalMap.value}set normalMap(n){this.uniforms.normalMap.value=n}get normalScale(){return this.uniforms.normalScale.value}set normalScale(n){this.uniforms.normalScale.value=n}get emissive(){return this.uniforms.emissive.value}set emissive(n){this.uniforms.emissive.value=n}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(n){this.uniforms.emissiveIntensity.value=n}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(n){this.uniforms.emissiveMap.value=n}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(n){this.uniforms.shadeColorFactor.value=n}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(n){this.uniforms.shadeMultiplyTexture.value=n}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(n){this.uniforms.shadingShiftFactor.value=n}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(n){this.uniforms.shadingShiftTexture.value=n}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(n){this.uniforms.shadingShiftTextureScale.value=n}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(n){this.uniforms.shadingToonyFactor.value=n}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(n){this.uniforms.giEqualizationFactor.value=n}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(n){this.uniforms.matcapFactor.value=n}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(n){this.uniforms.matcapTexture.value=n}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(n){this.uniforms.parametricRimColorFactor.value=n}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(n){this.uniforms.rimMultiplyTexture.value=n}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(n){this.uniforms.rimLightingMixFactor.value=n}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(n){this.uniforms.parametricRimFresnelPowerFactor.value=n}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(n){this.uniforms.parametricRimLiftFactor.value=n}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(n){this.uniforms.outlineWidthMultiplyTexture.value=n}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(n){this.uniforms.outlineWidthFactor.value=n}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(n){this.uniforms.outlineColorFactor.value=n}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(n){this.uniforms.outlineLightingMixFactor.value=n}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(n){this.uniforms.uvAnimationMaskTexture.value=n}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(n){this.uniforms.uvAnimationScrollXOffset.value=n}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(n){this.uniforms.uvAnimationScrollYOffset.value=n}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(n){this.uniforms.uvAnimationRotationPhase.value=n}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(n){this._ignoreVertexColor=n,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(n){this._v0CompatShade=n,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(n){this._debugMode=n,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(n){this._outlineWidthMode=n,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(n){this._isOutline=n,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(n){this._uploadUniformsWorkaround(),this._updateUVAnimation(n)}copy(n){return super.copy(n),this.map=n.map,this.normalMap=n.normalMap,this.emissiveMap=n.emissiveMap,this.shadeMultiplyTexture=n.shadeMultiplyTexture,this.shadingShiftTexture=n.shadingShiftTexture,this.matcapTexture=n.matcapTexture,this.rimMultiplyTexture=n.rimMultiplyTexture,this.outlineWidthMultiplyTexture=n.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=n.uvAnimationMaskTexture,this.normalMapType=n.normalMapType,this.uvAnimationScrollXSpeedFactor=n.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=n.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=n.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=n.ignoreVertexColor,this.v0CompatShade=n.v0CompatShade,this.debugMode=n.debugMode,this.outlineWidthMode=n.outlineWidthMode,this.isOutline=n.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(n){this.uniforms.uvAnimationScrollXOffset.value+=n*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=n*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=n*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const n=parseInt(Gc,10),e=this.outlineWidthMultiplyTexture!==null,t=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:n,OUTLINE:this._isOutline,MTOON_USE_UV:e||t,MTOON_UVS_VERTEX_ONLY:e&&!t,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===gP.ScreenCoordinates}}_updateTextureMatrix(n,e){n.value&&(n.value.matrixAutoUpdate&&n.value.updateMatrix(),e.value.copy(n.value.matrix))}},ice=new Set(["1.0","1.0-beta"]),C6=class ay{get name(){return ay.EXTENSION_NAME}constructor(e,t={}){var r,i,s,o;this.parser=e,this.materialType=(r=t.materialType)!=null?r:E6,this.renderOrderOffset=(i=t.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=t.v0CompatShade)!=null?s:!1,this.debugMode=(o=t.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return Ec(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return Ec(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,t){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,t):null}loadMesh(e){return Ec(this,null,function*(){var t;const r=this.parser,s=(t=r.json.meshes)==null?void 0:t[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,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.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[ay.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!ice.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${ay.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,t){return Ec(this,null,function*(){var r;delete t.metalness,delete t.roughness;const i=new qAe(this.parser,t);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(r=e.shadingShiftTexture)==null?void 0:r.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,t){const r=this._getMToonExtension(t);if(r){const i=this._parseRenderOrder(r);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const t=e.material;if(!(t instanceof Li)||!this._shouldGenerateOutline(t))return;e.material=[t];const r=t.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=qr,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const t=e.material,r=new Set;Array.isArray(t)?t.forEach(i=>r.add(i)):r.add(t);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var t;return(e.transparentWithZWrite?0:19)+((t=e.renderQueueOffsetNumber)!=null?t:0)}};C6.EXTENSION_NAME="VRMC_materials_mtoon";var sce=C6,oce=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),M6=class SC{get name(){return SC.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,t){return oce(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;t.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[SC.EXTENSION_NAME];if(a!=null)return a}};M6.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var ace=M6,lce=Object.defineProperty,Ace=Object.defineProperties,cce=Object.getOwnPropertyDescriptors,vP=Object.getOwnPropertySymbols,uce=Object.prototype.hasOwnProperty,fce=Object.prototype.propertyIsEnumerable,yP=(n,e,t)=>e in n?lce(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Lo=(n,e)=>{for(var t in e||(e={}))uce.call(e,t)&&yP(n,t,e[t]);if(vP)for(var t of vP(e))fce.call(e,t)&&yP(n,t,e[t]);return n},wP=(n,e)=>Ace(n,cce(e)),hce=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())});function Gu(n){return Math.pow(n,2.2)}var dce=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(n){var e;this.parser=n,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const t=this.parser.json;t.extensionsUsed=(e=t.extensionsUsed)!=null?e:[],t.extensionsUsed.indexOf("KHR_texture_transform")===-1&&t.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return hce(this,null,function*(){var n;const e=this.parser.json,t=(n=e.extensions)==null?void 0:n.VRM,r=t==null?void 0:t.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const A=this._parseV0MToonProperties(i,l);e.materials[s]=A}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const A=this._parseV0UnlitProperties(i,l);e.materials[s]=A}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(n,e){var t,r,i,s,o,a,l,A,c,u,f,h,p,d,g,m,y,w,x,_,C,T,b,M,D,Y,H,I,v,B,F,P,O,z,K,Q,E,G,ee,U,X,ae,oe,de,se,pe,_e,xe,L,ue,Ae,q,J,ce,be;const Be=(r=(t=n.keywordMap)==null?void 0:t._ALPHABLEND_ON)!=null?r:!1,W=((i=n.floatProperties)==null?void 0:i._ZWrite)===1&&Be,re=this._v0ParseRenderQueue(n),he=(o=(s=n.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,me=Be?"BLEND":he?"MASK":"OPAQUE",V=he?(l=(a=n.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,S=((c=(A=n.floatProperties)==null?void 0:A._CullMode)!=null?c:2)===0,j=this._portTextureTransform(n),te=((f=(u=n.vectorProperties)==null?void 0:u._Color)!=null?f:[1,1,1,1]).map((Hr,ki)=>ki===3?Hr:Gu(Hr)),le=(h=n.textureProperties)==null?void 0:h._MainTex,ie=le!=null?{index:le,extensions:Lo({},j)}:void 0,Ie=(d=(p=n.floatProperties)==null?void 0:p._BumpScale)!=null?d:1,Te=(g=n.textureProperties)==null?void 0:g._BumpMap,Le=Te!=null?{index:Te,scale:Ie,extensions:Lo({},j)}:void 0,He=((y=(m=n.vectorProperties)==null?void 0:m._EmissionColor)!=null?y:[0,0,0,1]).map(Gu),De=(w=n.textureProperties)==null?void 0:w._EmissionMap,fe=De!=null?{index:De,extensions:Lo({},j)}:void 0,Me=((_=(x=n.vectorProperties)==null?void 0:x._ShadeColor)!=null?_:[.97,.81,.86,1]).map(Gu),Se=(C=n.textureProperties)==null?void 0:C._ShadeTexture,Fe=Se!=null?{index:Se,extensions:Lo({},j)}:void 0;let Ve=(b=(T=n.floatProperties)==null?void 0:T._ShadeShift)!=null?b:0,Je=(D=(M=n.floatProperties)==null?void 0:M._ShadeToony)!=null?D:.9;Je=Lt.lerp(Je,1,.5+.5*Ve),Ve=-Ve-(1-Je);const ft=(H=(Y=n.floatProperties)==null?void 0:Y._IndirectLightIntensity)!=null?H:.1,an=ft?1-ft:void 0,Ct=(I=n.textureProperties)==null?void 0:I._SphereAdd,it=Ct!=null?[1,1,1]:void 0,lr=Ct!=null?{index:Ct}:void 0,yt=(B=(v=n.floatProperties)==null?void 0:v._RimLightingMix)!=null?B:0,jt=(F=n.textureProperties)==null?void 0:F._RimTexture,Zs=jt!=null?{index:jt,extensions:Lo({},j)}:void 0,Zt=((O=(P=n.vectorProperties)==null?void 0:P._RimColor)!=null?O:[0,0,0,1]).map(Gu),Jt=(K=(z=n.floatProperties)==null?void 0:z._RimFresnelPower)!=null?K:1,ne=(E=(Q=n.floatProperties)==null?void 0:Q._RimLift)!=null?E:0,ve=["none","worldCoordinates","screenCoordinates"][(ee=(G=n.floatProperties)==null?void 0:G._OutlineWidthMode)!=null?ee:0];let Ee=(X=(U=n.floatProperties)==null?void 0:U._OutlineWidth)!=null?X:0;Ee=.01*Ee;const we=(ae=n.textureProperties)==null?void 0:ae._OutlineWidthTexture,Ce=we!=null?{index:we,extensions:Lo({},j)}:void 0,ze=((de=(oe=n.vectorProperties)==null?void 0:oe._OutlineColor)!=null?de:[0,0,0]).map(Gu),Xe=((pe=(se=n.floatProperties)==null?void 0:se._OutlineColorMode)!=null?pe:0)===1?(xe=(_e=n.floatProperties)==null?void 0:_e._OutlineLightingMix)!=null?xe:1:0,$e=(L=n.textureProperties)==null?void 0:L._UvAnimMaskTexture,gt=$e!=null?{index:$e,extensions:Lo({},j)}:void 0,dt=(Ae=(ue=n.floatProperties)==null?void 0:ue._UvAnimScrollX)!=null?Ae:0;let ct=(J=(q=n.floatProperties)==null?void 0:q._UvAnimScrollY)!=null?J:0;ct!=null&&(ct=-ct);const Wt=(be=(ce=n.floatProperties)==null?void 0:ce._UvAnimRotation)!=null?be:0,vn={specVersion:"1.0",transparentWithZWrite:W,renderQueueOffsetNumber:re,shadeColorFactor:Me,shadeMultiplyTexture:Fe,shadingShiftFactor:Ve,shadingToonyFactor:Je,giEqualizationFactor:an,matcapFactor:it,matcapTexture:lr,rimLightingMixFactor:yt,rimMultiplyTexture:Zs,parametricRimColorFactor:Zt,parametricRimFresnelPowerFactor:Jt,parametricRimLiftFactor:ne,outlineWidthMode:ve,outlineWidthFactor:Ee,outlineWidthMultiplyTexture:Ce,outlineColorFactor:ze,outlineLightingMixFactor:Xe,uvAnimationMaskTexture:gt,uvAnimationScrollXSpeedFactor:dt,uvAnimationScrollYSpeedFactor:ct,uvAnimationRotationSpeedFactor:Wt};return wP(Lo({},e),{pbrMetallicRoughness:{baseColorFactor:te,baseColorTexture:ie},normalTexture:Le,emissiveTexture:fe,emissiveFactor:He,alphaMode:me,alphaCutoff:V,doubleSided:S,extensions:{VRMC_materials_mtoon:vn}})}_parseV0UnlitProperties(n,e){var t,r,i,s,o;const a=n.shader==="VRM/UnlitTransparentZWrite",l=n.shader==="VRM/UnlitTransparent"||a,A=this._v0ParseRenderQueue(n),c=n.shader==="VRM/UnlitCutout",u=l?"BLEND":c?"MASK":"OPAQUE",f=c?(r=(t=n.floatProperties)==null?void 0:t._Cutoff)!=null?r:.5:void 0,h=this._portTextureTransform(n),p=((s=(i=n.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Gu),d=(o=n.textureProperties)==null?void 0:o._MainTex,g=d!=null?{index:d,extensions:Lo({},h)}:void 0,m={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:A,shadeColorFactor:p,shadeMultiplyTexture:g};return wP(Lo({},e),{pbrMetallicRoughness:{baseColorFactor:p,baseColorTexture:g},alphaMode:u,alphaCutoff:f,extensions:{VRMC_materials_mtoon:m}})}_portTextureTransform(n){var e,t,r,i,s;const o=(e=n.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(t=o==null?void 0:o[0])!=null?t:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(n){var e,t;const r=n.shader==="VRM/UnlitTransparentZWrite",i=((e=n.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||n.shader==="VRM/UnlitTransparent"||r,s=((t=n.floatProperties)==null?void 0:t._ZWrite)===1||r;let o=0;if(i){const a=n.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(n){const e=new Set,t=new Set;n.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const A=r.renderQueue;A!=null&&(l?t.add(A):e.add(A))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(t).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},xP=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Hl=new Z,Qb=class extends Pr{constructor(n){super(),this._attrPosition=new lt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(H$);const e=new Kt;e.setAttribute("position",this._attrPosition);const t=new Cl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new qh(e,t),this.add(this._line),this.constraint=n}updateMatrixWorld(n){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(n)}};function _P(n,e){return e.set(n.elements[12],n.elements[13],n.elements[14])}var pce=new Z,mce=new Z;function gce(n,e){return n.decompose(pce,e,mce),e}function Cw(n){return n.invert?n.invert():n.inverse(),n}var hT=class{constructor(n,e){this.destination=n,this.source=e,this.weight=1}},vce=new Z,yce=new Z,wce=new Z,xce=new rt,_ce=new rt,bce=new rt,Bce=class extends hT{get aimAxis(){return this._aimAxis}set aimAxis(n){this._aimAxis=n,this._v3AimAxis.set(n==="PositiveX"?1:n==="NegativeX"?-1:0,n==="PositiveY"?1:n==="NegativeY"?-1:0,n==="PositiveZ"?1:n==="NegativeZ"?-1:0)}get dependencies(){const n=new Set([this.source]);return this.destination.parent&&n.add(this.destination.parent),n}constructor(n,e){super(n,e),this._aimAxis="PositiveX",this._v3AimAxis=new Z(1,0,0),this._dstRestQuat=new rt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const n=xce.identity(),e=_ce.identity();this.destination.parent&&(gce(this.destination.parent.matrixWorld,n),Cw(e.copy(n)));const t=vce.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(n),r=_P(this.source.matrixWorld,yce).sub(_P(this.destination.matrixWorld,wce)).normalize(),i=bce.setFromUnitVectors(t,r).premultiply(e).multiply(n).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function Ece(n,e){const t=[n];let r=n.parent;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}var Cce=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(n){this._constraints.add(n);let e=this._objectConstraintsMap.get(n.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(n.destination,e)),e.add(n)}deleteConstraint(n){this._constraints.delete(n),this._objectConstraintsMap.get(n.destination).delete(n)}setInitState(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.setInitState())}update(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.update())}_processConstraint(n,e,t,r){if(t.has(n))return;if(e.has(n))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(n);const i=n.dependencies;for(const s of i)Ece(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,t,r)});r(n),t.add(n)}},Mce=new rt,Sce=new rt,Tce=class extends hT{get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._dstRestQuat=new rt,this._invSrcRestQuat=new rt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Cw(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const n=Mce.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Sce.copy(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Ice=new Z,Rce=new rt,Fce=new rt,Uce=class extends hT{get rollAxis(){return this._rollAxis}set rollAxis(n){this._rollAxis=n,this._v3RollAxis.set(n==="X"?1:0,n==="Y"?1:0,n==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._rollAxis="X",this._v3RollAxis=new Z(1,0,0),this._dstRestQuat=new rt,this._invDstRestQuat=new rt,this._invSrcRestQuatMulDstRestQuat=new rt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Cw(this._invDstRestQuat.copy(this._dstRestQuat)),Cw(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const n=Rce.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Ice.copy(this._v3RollAxis).applyQuaternion(n),r=Fce.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},Lce=new Set(["1.0","1.0-beta"]),S6=class Ip{get name(){return Ip.EXTENSION_NAME}constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}afterRoot(e){return xP(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return xP(this,null,function*(){var t;const r=this.parser.json;if(!(((t=r.extensionsUsed)==null?void 0:t.indexOf(Ip.EXTENSION_NAME))!==-1))return null;const s=new Cce,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?void 0:A[Ip.EXTENSION_NAME];if(u==null)return;const f=u.specVersion;if(!Lce.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Ip.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 Uce(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const A=new Qb(l);this.helperRoot.add(A)}return l}_importAimConstraint(e,t,r){const{source:i,aimAxis:s,weight:o}=r,a=t[i],l=new Bce(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const A=new Qb(l);this.helperRoot.add(A)}return l}_importRotationConstraint(e,t,r){const{source:i,weight:s}=r,o=t[i],a=new Tce(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new Qb(a);this.helperRoot.add(l)}return a}};S6.EXTENSION_NAME="VRMC_node_constraint";var Pce=S6,iv=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),dT=class{},Hb=new Z,ac=new Z,T6=class extends dT{get type(){return"capsule"}constructor(n){var e,t,r,i;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new Z(0,0,0),this.tail=(t=n==null?void 0:n.tail)!=null?t:new Z(0,0,0),this.radius=(r=n==null?void 0:n.radius)!=null?r:0,this.inside=(i=n==null?void 0:n.inside)!=null?i:!1}calculateCollision(n,e,t,r){Hb.copy(this.offset).applyMatrix4(n),ac.copy(this.tail).applyMatrix4(n),ac.sub(Hb);const i=ac.lengthSq();r.copy(e).sub(Hb);const s=ac.dot(r);s<=0||(i<=s||ac.multiplyScalar(s/i),r.sub(ac));const o=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),o}},zb=new Z,bP=new xn,I6=class extends dT{get type(){return"plane"}constructor(n){var e,t;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new Z(0,0,0),this.normal=(t=n==null?void 0:n.normal)!=null?t:new Z(0,0,1)}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e),bP.getNormalMatrix(n),zb.copy(this.normal).applyNormalMatrix(bP).normalize();const i=r.dot(zb)-t;return r.copy(zb),i}},R6=class extends dT{get type(){return"sphere"}constructor(n){var e,t,r;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new Z(0,0,0),this.radius=(t=n==null?void 0:n.radius)!=null?t:0,this.inside=(r=n==null?void 0:n.inside)!=null?r:!1}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e);const i=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),i}},Po=new Z,Dce=class extends Kt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._currentTail=new Z,this._shape=n,this._attrPos=new lt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0);const t=Po.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(t)>1e-10&&(this._currentTail.copy(t),n=!0),n&&this._buildPosition()}_buildPosition(){Po.copy(this._currentTail).sub(this._currentOffset);const n=Po.length()/this._currentRadius;for(let r=0;r<=16;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+r,n+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+r,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+r,n+Math.sin(i),0,Math.cos(i))}for(let r=0;r<32;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+r,n,Math.sin(i),Math.cos(i))}const e=Math.atan2(Po.y,Math.sqrt(Po.x*Po.x+Po.z*Po.z)),t=-Math.atan2(Po.z,Po.x);this.rotateZ(e),this.rotateY(t),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<34;n++){const e=(n+1)%34;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(68+n*2,34+n,34+e)}for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(136+n*2,68+n,68+e),this._attrIndex.setXY(200+n*2,100+n,100+e)}this._attrIndex.needsUpdate=!0}},Oce=class extends Kt{constructor(n){super(),this.worldScale=1,this._currentOffset=new Z,this._currentNormal=new Z,this._shape=n,this._attrPos=new lt(new Float32Array(6*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},Nce=class extends Kt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._shape=n,this._attrPos=new lt(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.needsUpdate=!0}},kce=new Z,Gb=class extends Pr{constructor(n){if(super(),this.matrixAutoUpdate=!1,this.collider=n,this.collider.shape instanceof R6)this._geometry=new Nce(this.collider.shape);else if(this.collider.shape instanceof T6)this._geometry=new Dce(this.collider.shape);else if(this.collider.shape instanceof I6)this._geometry=new Oce(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new Cl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new pg(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=kce.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},Qce=class extends Kt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new Z,this._springBone=n,this._attrPos=new lt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},Hce=new Z,zce=class extends Pr{constructor(n){super(),this.matrixAutoUpdate=!1,this.springBone=n,this._geometry=new Qce(this.springBone);const e=new Cl({color:16776960,depthTest:!1,depthWrite:!1});this._line=new pg(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=Hce.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},Vb=class extends It{constructor(n){super(),this.shape=n}},Gce=new We;function F6(n){return n.invert?n.invert():n.getInverse(Gce.copy(n)),n}var Vce=class{constructor(n){this._inverseCache=new We,this._shouldUpdateInverse=!0,this.matrix=n;const e={set:(t,r,i)=>(this._shouldUpdateInverse=!0,t[r]=i,!0)};this._originalElements=n.elements,n.elements=new Proxy(n.elements,e)}get inverse(){return this._shouldUpdateInverse&&(F6(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},jce=new We,Pa=new Z,Xd=new Z,Wce=new Z,Vu=new Z,BP=new Z,$d=new Z,EP=new rt,ju=new We,Kce=new We,Yce=class{constructor(n,e,t={},r=[]){this._currentTail=new Z,this._prevTail=new Z,this._boneAxis=new Z,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new We,this._initialLocalRotation=new rt,this._initialLocalChildPosition=new Z;var i,s,o,a,l,A;this.bone=n,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=t.hitRadius)!=null?i:0,stiffness:(s=t.stiffness)!=null?s:1,gravityPower:(o=t.gravityPower)!=null?o:0,gravityDir:(l=(a=t.gravityDir)==null?void 0:a.clone())!=null?l:new Z(0,-1,0),dragForce:(A=t.dragForce)!=null?A:.4},this.colliderGroups=r}get center(){return this._center}set center(n){var e;(e=this._center)!=null&&e.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=n,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new Vce(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:jce}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const n=this._getMatrixWorldToCenter(ju);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const n=this._getMatrixWorldToCenter(ju);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail)}update(n){if(n<=0)return;this._calcWorldSpaceBoneLength(),Vu.setFromMatrixPosition(this.bone.matrixWorld);let e=this._getMatrixWorldToCenter(ju);BP.copy(Vu).applyMatrix4(e);const t=EP.setFromRotationMatrix(e),r=Kce.copy(e).multiply(this._parentMatrixWorld),i=Xd.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(r).sub(BP).normalize(),s=Wce.copy(this.settings.gravityDir).applyQuaternion(t).normalize(),o=this._getMatrixCenterToWorld(ju);$d.copy(this._currentTail).add(Pa.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(Pa.copy(i).multiplyScalar(this.settings.stiffness*n)).add(Pa.copy(s).multiplyScalar(this.settings.gravityPower*n)).applyMatrix4(o),$d.sub(Vu).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Vu),this._collision($d),e=this._getMatrixWorldToCenter(ju),this._prevTail.copy(this._currentTail),this._currentTail.copy(Pa.copy($d).applyMatrix4(e));const a=F6(ju.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),l=EP.setFromUnitVectors(this._boneAxis,Pa.copy($d).applyMatrix4(a).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(l),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(n){this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{const r=t.shape.calculateCollision(t.matrixWorld,n,this.settings.hitRadius,Pa);r<0&&(n.add(Pa.multiplyScalar(-r)),n.sub(Vu).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Vu))})})}_calcWorldSpaceBoneLength(){Pa.setFromMatrixPosition(this.bone.matrixWorld),this.child?Xd.setFromMatrixPosition(this.child.matrixWorld):(Xd.copy(this._initialLocalChildPosition),Xd.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Pa.sub(Xd).length()}_getMatrixCenterToWorld(n){return this._center?n.copy(this._center.matrixWorld):n.identity(),n}_getMatrixWorldToCenter(n){return this._center?n.copy(this._center.userData.inverseCacheProxy.inverse):n.identity(),n}};function Xce(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function U6(n,e){n.children.forEach(t=>{e(t)||U6(t,e)})}var CP=class{constructor(){this._joints=new Set,this._hasWarnedCircularDependency=!1,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const n=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(t=>{n.add(t)})}),Array.from(n)}get colliders(){const n=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{n.add(t)})}),Array.from(n)}addJoint(n){this._joints.add(n);let e=this._objectSpringBonesMap.get(n.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(n.bone,e)),e.add(n)}addSpringBone(n){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(n)}deleteJoint(n){this._joints.delete(n),this._objectSpringBonesMap.get(n.bone).delete(n)}deleteSpringBone(n){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(n)}setInitState(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.setInitState())}reset(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.reset())}update(n){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.update(n)),U6(i.bone,s=>{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(s.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(n,e,t,r,i){if(t.has(n))return;if(e.has(n)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected while updating springbones"),this._hasWarnedCircularDependency=!0);return}e.add(n);const s=this._getDependencies(n);for(const o of s)Xce(o,a=>{const l=this._objectSpringBonesMap.get(a);if(l)for(const A of l)this._processSpringBone(A,e,t,r,i);else r.has(a)||(a.updateWorldMatrix(!1,!1),r.add(a))});n.bone.updateMatrix(),n.bone.updateWorldMatrix(!1,!1),i(n),r.add(n.bone),t.add(n)}_getDependencies(n){const e=new Set,t=n.bone.parent;return t&&e.add(t),n.colliderGroups.forEach(r=>{r.colliders.forEach(i=>{e.add(i)})}),e}},MP="VRMC_springBone_extended_collider",$ce=new Set(["1.0","1.0-beta"]),Zce=new Set(["1.0"]),L6=class nf{get name(){return nf.EXTENSION_NAME}constructor(e,t){var r;this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot,this.useExtendedColliders=(r=t==null?void 0:t.useExtendedColliders)!=null?r:!0}afterRoot(e){return iv(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return iv(this,null,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){return iv(this,null,function*(){var t,r,i,s,o;const a=e.parser.json;if(!(((t=a.extensionsUsed)==null?void 0:t.indexOf(nf.EXTENSION_NAME))!==-1))return null;const A=new CP,c=yield e.parser.getDependencies("node"),u=(r=a.extensions)==null?void 0:r[nf.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!$ce.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${nf.EXTENSION_NAME} specVersion "${f}"`),null;const h=(i=u.colliders)==null?void 0:i.map((d,g)=>{var m,y,w,x,_,C,T,b,M,D,Y,H,I,v,B;const F=c[d.node],P=d.shape,O=(m=d.extensions)==null?void 0:m[MP];if(this.useExtendedColliders&&O!=null){const z=O.specVersion;if(!Zce.has(z))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${MP} specVersion "${z}". Fallbacking to the ${nf.EXTENSION_NAME} definition`);else{const K=O.shape;if(K.sphere)return this._importSphereCollider(F,{offset:new Z().fromArray((y=K.sphere.offset)!=null?y:[0,0,0]),radius:(w=K.sphere.radius)!=null?w:0,inside:(x=K.sphere.inside)!=null?x:!1});if(K.capsule)return this._importCapsuleCollider(F,{offset:new Z().fromArray((_=K.capsule.offset)!=null?_:[0,0,0]),radius:(C=K.capsule.radius)!=null?C:0,tail:new Z().fromArray((T=K.capsule.tail)!=null?T:[0,0,0]),inside:(b=K.capsule.inside)!=null?b:!1});if(K.plane)return this._importPlaneCollider(F,{offset:new Z().fromArray((M=K.plane.offset)!=null?M:[0,0,0]),normal:new Z().fromArray((D=K.plane.normal)!=null?D:[0,0,1])})}}if(P.sphere)return this._importSphereCollider(F,{offset:new Z().fromArray((Y=P.sphere.offset)!=null?Y:[0,0,0]),radius:(H=P.sphere.radius)!=null?H:0,inside:!1});if(P.capsule)return this._importCapsuleCollider(F,{offset:new Z().fromArray((I=P.capsule.offset)!=null?I:[0,0,0]),radius:(v=P.capsule.radius)!=null?v:0,tail:new Z().fromArray((B=P.capsule.tail)!=null?B:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),p=(s=u.colliderGroups)==null?void 0:s.map((d,g)=>{var m;return{colliders:((m=d.colliders)!=null?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.forEach((d,g)=>{var m;const y=d.joints,w=(m=d.colliderGroups)==null?void 0:m.map(C=>{const T=p==null?void 0:p[C];if(T==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${C} but not found`);return T}),x=d.center!=null?c[d.center]:void 0;let _;y.forEach(C=>{if(_){const T=_.node,b=c[T],M=C.node,D=c[M],Y={hitRadius:_.hitRadius,dragForce:_.dragForce,gravityPower:_.gravityPower,stiffness:_.stiffness,gravityDir:_.gravityDir!=null?new Z().fromArray(_.gravityDir):void 0},H=this._importJoint(b,D,Y,w);x&&(H.center=x),A.addJoint(H)}_=C})}),A.setInitState(),A})}_v0Import(e){return iv(this,null,function*(){var t,r,i;const s=e.parser.json;if(!(((t=s.extensionsUsed)==null?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const A=l==null?void 0:l.boneGroups;if(!A)return null;const c=new CP,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)==null?void 0:i.map(h=>{var p;const d=u[h.node];return{colliders:((p=h.colliders)!=null?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:0,(x=m.offset.y)!=null?x:0,m.offset.z?-m.offset.z:0),this._importSphereCollider(d,{offset:C,radius:(_=m.radius)!=null?_:0,inside:!1})})}});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:0,(y=h.gravityDir.y)!=null?y:0,(w=h.gravityDir.z)!=null?w:0):C.set(0,-1,0);const T=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?void 0:x.map(D=>{const Y=f==null?void 0:f[D];if(Y==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${p} attempted to use a colliderGroup ${D} but not found`);return Y});_.traverse(D=>{var Y;const H=(Y=D.children[0])!=null?Y:null,I=this._importJoint(D,H,b,M);T&&(I.center=T),c.addJoint(I)})})}),e.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(e,t,r,i){const s=new Yce(e,t,r,i);if(this.jointHelperRoot){const o=new zce(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const r=new R6(t),i=new Vb(r);if(e.add(i),this.colliderHelperRoot){const s=new Gb(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,t){const r=new T6(t),i=new Vb(r);if(e.add(i),this.colliderHelperRoot){const s=new Gb(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,t){const r=new I6(t),i=new Vb(r);if(e.add(i),this.colliderHelperRoot){const s=new Gb(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};L6.EXTENSION_NAME="VRMC_springBone";var Jce=L6,qce=class{get name(){return"VRMLoaderPlugin"}constructor(n,e){var t,r,i,s,o,a,l,A,c,u;this.parser=n;const f=e==null?void 0:e.helperRoot,h=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(t=e==null?void 0:e.expressionPlugin)!=null?t:new vAe(n),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new wAe(n),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new MAe(n,{helperRoot:f,autoUpdateHumanBones:h}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new zAe(n,{helperRoot:f}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new jAe(n),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new sce(n),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new ace(n),this.materialsV0CompatPlugin=(A=e==null?void 0:e.materialsV0CompatPlugin)!=null?A:new dce(n),this.springBonePlugin=(c=e==null?void 0:e.springBonePlugin)!=null?c:new Jce(n,{colliderHelperRoot:f,jointHelperRoot:f}),this.nodeConstraintPlugin=(u=e==null?void 0:e.nodeConstraintPlugin)!=null?u:new Pce(n,{helperRoot:f})}beforeRoot(){return tv(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(n){return tv(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(n)})}getMaterialType(n){const e=this.mtoonMaterialPlugin.getMaterialType(n);return e??null}extendMaterialParams(n,e){return tv(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(n,e),yield this.mtoonMaterialPlugin.extendMaterialParams(n,e)})}afterRoot(n){return tv(this,null,function*(){yield this.metaPlugin.afterRoot(n),yield this.humanoidPlugin.afterRoot(n),yield this.expressionPlugin.afterRoot(n),yield this.lookAtPlugin.afterRoot(n),yield this.firstPersonPlugin.afterRoot(n),yield this.springBonePlugin.afterRoot(n),yield this.nodeConstraintPlugin.afterRoot(n),yield this.mtoonMaterialPlugin.afterRoot(n);const e=n.userData.vrmMeta,t=n.userData.vrmHumanoid;if(e&&t){const r=new KAe({scene:n.scene,expressionManager:n.userData.vrmExpressionManager,firstPerson:n.userData.vrmFirstPerson,humanoid:t,lookAt:n.userData.vrmLookAt,meta:e,materials:n.userData.vrmMToonMaterials,springBoneManager:n.userData.vrmSpringBoneManager,nodeConstraintManager:n.userData.vrmNodeConstraintManager});n.userData.vrm=r}})}};function SP(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 eue(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=>SP(i)):r&&SP(r))}function tue(n){n.traverse(eue)}function nue(n,e){var t;const r=(t=e==null?void 0:e.experimentalSameBoneCounts)!=null?t:!1,i=[];n.traverse(a=>{a.type==="SkinnedMesh"&&i.push(a)});const s=new Map;let o=0;for(const a of i){const A=a.geometry.getAttribute("skinIndex"),c=[],u=[],f={},h=A.array;for(let p=0;p{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 Kt;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?void 0:r.clone())!=null?i:null,u.boundingSphere=(o=(s=l.boundingSphere)==null?void 0:s.clone())!=null?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],h=[];{const 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 T=0;T{u.morphAttributes[d]=[];const g=l.morphAttributes[d];for(let m=0;m{for(let M=0;MT===0),u.morphAttributes[d][m]=new lt(C,x,_)}}),p&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function iue(n){var e;((e=n.meta)==null?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}var wg=class{constructor(){}};wg.deepDispose=tue;wg.removeUnnecessaryJoints=nue;wg.removeUnnecessaryVertices=rue;wg.rotateVRM0=iue;/*! - * @pixiv/three-vrm-core v3.1.3 +`;t.vertexShader=i+t.vertexShader,t.fragmentShader=i+t.fragmentShader,r<154&&(t.fragmentShader=t.fragmentShader.replace("#include ","#include "))}}get color(){return this.uniforms.litFactor.value}set color(n){this.uniforms.litFactor.value=n}get map(){return this.uniforms.map.value}set map(n){this.uniforms.map.value=n}get normalMap(){return this.uniforms.normalMap.value}set normalMap(n){this.uniforms.normalMap.value=n}get normalScale(){return this.uniforms.normalScale.value}set normalScale(n){this.uniforms.normalScale.value=n}get emissive(){return this.uniforms.emissive.value}set emissive(n){this.uniforms.emissive.value=n}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(n){this.uniforms.emissiveIntensity.value=n}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(n){this.uniforms.emissiveMap.value=n}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(n){this.uniforms.shadeColorFactor.value=n}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(n){this.uniforms.shadeMultiplyTexture.value=n}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(n){this.uniforms.shadingShiftFactor.value=n}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(n){this.uniforms.shadingShiftTexture.value=n}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(n){this.uniforms.shadingShiftTextureScale.value=n}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(n){this.uniforms.shadingToonyFactor.value=n}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(n){this.uniforms.giEqualizationFactor.value=n}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(n){this.uniforms.matcapFactor.value=n}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(n){this.uniforms.matcapTexture.value=n}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(n){this.uniforms.parametricRimColorFactor.value=n}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(n){this.uniforms.rimMultiplyTexture.value=n}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(n){this.uniforms.rimLightingMixFactor.value=n}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(n){this.uniforms.parametricRimFresnelPowerFactor.value=n}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(n){this.uniforms.parametricRimLiftFactor.value=n}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(n){this.uniforms.outlineWidthMultiplyTexture.value=n}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(n){this.uniforms.outlineWidthFactor.value=n}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(n){this.uniforms.outlineColorFactor.value=n}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(n){this.uniforms.outlineLightingMixFactor.value=n}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(n){this.uniforms.uvAnimationMaskTexture.value=n}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(n){this.uniforms.uvAnimationScrollXOffset.value=n}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(n){this.uniforms.uvAnimationScrollYOffset.value=n}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(n){this.uniforms.uvAnimationRotationPhase.value=n}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(n){this._ignoreVertexColor=n,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(n){this._v0CompatShade=n,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(n){this._debugMode=n,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(n){this._outlineWidthMode=n,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(n){this._isOutline=n,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(n){this._uploadUniformsWorkaround(),this._updateUVAnimation(n)}copy(n){return super.copy(n),this.map=n.map,this.normalMap=n.normalMap,this.emissiveMap=n.emissiveMap,this.shadeMultiplyTexture=n.shadeMultiplyTexture,this.shadingShiftTexture=n.shadingShiftTexture,this.matcapTexture=n.matcapTexture,this.rimMultiplyTexture=n.rimMultiplyTexture,this.outlineWidthMultiplyTexture=n.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=n.uvAnimationMaskTexture,this.normalMapType=n.normalMapType,this.uvAnimationScrollXSpeedFactor=n.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=n.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=n.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=n.ignoreVertexColor,this.v0CompatShade=n.v0CompatShade,this.debugMode=n.debugMode,this.outlineWidthMode=n.outlineWidthMode,this.isOutline=n.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(n){this.uniforms.uvAnimationScrollXOffset.value+=n*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=n*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=n*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){const n=parseInt(Gc,10),e=this.outlineWidthMultiplyTexture!==null,t=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:n,OUTLINE:this._isOutline,MTOON_USE_UV:e||t,MTOON_UVS_VERTEX_ONLY:e&&!t,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===vP.ScreenCoordinates}}_updateTextureMatrix(n,e){n.value&&(n.value.matrixAutoUpdate&&n.value.updateMatrix(),e.value.copy(n.value.matrix))}},sce=new Set(["1.0","1.0-beta"]),M6=class ay{get name(){return ay.EXTENSION_NAME}constructor(e,t={}){var r,i,s,o;this.parser=e,this.materialType=(r=t.materialType)!=null?r:C6,this.renderOrderOffset=(i=t.renderOrderOffset)!=null?i:0,this.v0CompatShade=(s=t.v0CompatShade)!=null?s:!1,this.debugMode=(o=t.debugMode)!=null?o:"none",this._mToonMaterialSet=new Set}beforeRoot(){return Ec(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return Ec(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,t){const r=this._getMToonExtension(e);return r?this._extendMaterialParams(r,t):null}loadMesh(e){return Ec(this,null,function*(){var t;const r=this.parser,s=(t=r.json.meshes)==null?void 0:t[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);const o=s.primitives,a=yield r.loadMesh(e);if(o.length===1){const l=a,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.KHR_materials_unlit)&&delete i.extensions.KHR_materials_unlit})}_getMToonExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[ay.EXTENSION_NAME];if(a==null)return;const l=a.specVersion;if(!sce.has(l)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${ay.EXTENSION_NAME} specVersion "${l}"`);return}return a}_extendMaterialParams(e,t){return Ec(this,null,function*(){var r;delete t.metalness,delete t.roughness;const i=new ece(this.parser,t);i.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),i.assignColor("shadeColorFactor",e.shadeColorFactor),i.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),i.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),i.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),i.assignPrimitive("shadingShiftTextureScale",(r=e.shadingShiftTexture)==null?void 0:r.scale),i.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),i.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),i.assignColor("matcapFactor",e.matcapFactor),i.assignTexture("matcapTexture",e.matcapTexture,!0),i.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),i.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),i.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),i.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),i.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),i.assignPrimitive("outlineWidthMode",e.outlineWidthMode),i.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),i.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),i.assignColor("outlineColorFactor",e.outlineColorFactor),i.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),i.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),i.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),i.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),i.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),i.assignPrimitive("v0CompatShade",this.v0CompatShade),i.assignPrimitive("debugMode",this.debugMode),yield i.pending})}_setupPrimitive(e,t){const r=this._getMToonExtension(t);if(r){const i=this._parseRenderOrder(r);e.renderOrder=i+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){const t=e.material;if(!(t instanceof Li)||!this._shouldGenerateOutline(t))return;e.material=[t];const r=t.clone();r.name+=" (Outline)",r.isOutline=!0,r.side=qr,e.material.push(r);const i=e.geometry,s=i.index?i.index.count:i.attributes.position.count/3;i.addGroup(0,s,0),i.addGroup(0,s,1)}_addToMaterialSet(e){const t=e.material,r=new Set;Array.isArray(t)?t.forEach(i=>r.add(i)):r.add(t);for(const i of r)this._mToonMaterialSet.add(i)}_parseRenderOrder(e){var t;return(e.transparentWithZWrite?0:19)+((t=e.renderQueueOffsetNumber)!=null?t:0)}};M6.EXTENSION_NAME="VRMC_materials_mtoon";var oce=M6,ace=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),S6=class TC{get name(){return TC.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,t){return ace(this,null,function*(){const r=this._getHDREmissiveMultiplierExtension(e);if(r==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const i=r.emissiveMultiplier;t.emissiveIntensity=i})}_getHDREmissiveMultiplierExtension(e){var t,r;const o=(t=this.parser.json.materials)==null?void 0:t[e];if(o==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}const a=(r=o.extensions)==null?void 0:r[TC.EXTENSION_NAME];if(a!=null)return a}};S6.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var lce=S6,Ace=Object.defineProperty,cce=Object.defineProperties,uce=Object.getOwnPropertyDescriptors,yP=Object.getOwnPropertySymbols,fce=Object.prototype.hasOwnProperty,hce=Object.prototype.propertyIsEnumerable,wP=(n,e,t)=>e in n?Ace(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,Lo=(n,e)=>{for(var t in e||(e={}))fce.call(e,t)&&wP(n,t,e[t]);if(yP)for(var t of yP(e))hce.call(e,t)&&wP(n,t,e[t]);return n},xP=(n,e)=>cce(n,uce(e)),dce=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())});function Gu(n){return Math.pow(n,2.2)}var pce=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(n){var e;this.parser=n,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const t=this.parser.json;t.extensionsUsed=(e=t.extensionsUsed)!=null?e:[],t.extensionsUsed.indexOf("KHR_texture_transform")===-1&&t.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return dce(this,null,function*(){var n;const e=this.parser.json,t=(n=e.extensions)==null?void 0:n.VRM,r=t==null?void 0:t.materialProperties;r&&(this._populateRenderQueueMap(r),r.forEach((i,s)=>{var o,a;const l=(o=e.materials)==null?void 0:o[s];if(l==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(i.shader==="VRM/MToon"){const A=this._parseV0MToonProperties(i,l);e.materials[s]=A}else if((a=i.shader)!=null&&a.startsWith("VRM/Unlit")){const A=this._parseV0UnlitProperties(i,l);e.materials[s]=A}else i.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${i.shader}`)}))})}_parseV0MToonProperties(n,e){var t,r,i,s,o,a,l,A,c,u,f,h,p,d,g,m,y,w,x,_,B,T,b,M,O,Y,H,I,v,E,L,U,P,z,W,N,C,j,ee,F,X,ue,re,fe,oe,pe,xe,_e,D,Ae,le,q,J,ce,be;const Be=(r=(t=n.keywordMap)==null?void 0:t._ALPHABLEND_ON)!=null?r:!1,K=((i=n.floatProperties)==null?void 0:i._ZWrite)===1&&Be,ie=this._v0ParseRenderQueue(n),de=(o=(s=n.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?o:!1,me=Be?"BLEND":de?"MASK":"OPAQUE",G=de?(l=(a=n.floatProperties)==null?void 0:a._Cutoff)!=null?l:.5:void 0,S=((c=(A=n.floatProperties)==null?void 0:A._CullMode)!=null?c:2)===0,V=this._portTextureTransform(n),te=((f=(u=n.vectorProperties)==null?void 0:u._Color)!=null?f:[1,1,1,1]).map((Hr,ki)=>ki===3?Hr:Gu(Hr)),ae=(h=n.textureProperties)==null?void 0:h._MainTex,se=ae!=null?{index:ae,extensions:Lo({},V)}:void 0,Ie=(d=(p=n.floatProperties)==null?void 0:p._BumpScale)!=null?d:1,Te=(g=n.textureProperties)==null?void 0:g._BumpMap,Le=Te!=null?{index:Te,scale:Ie,extensions:Lo({},V)}:void 0,He=((y=(m=n.vectorProperties)==null?void 0:m._EmissionColor)!=null?y:[0,0,0,1]).map(Gu),De=(w=n.textureProperties)==null?void 0:w._EmissionMap,he=De!=null?{index:De,extensions:Lo({},V)}:void 0,Me=((_=(x=n.vectorProperties)==null?void 0:x._ShadeColor)!=null?_:[.97,.81,.86,1]).map(Gu),Se=(B=n.textureProperties)==null?void 0:B._ShadeTexture,Fe=Se!=null?{index:Se,extensions:Lo({},V)}:void 0;let Ve=(b=(T=n.floatProperties)==null?void 0:T._ShadeShift)!=null?b:0,Je=(O=(M=n.floatProperties)==null?void 0:M._ShadeToony)!=null?O:.9;Je=Lt.lerp(Je,1,.5+.5*Ve),Ve=-Ve-(1-Je);const ft=(H=(Y=n.floatProperties)==null?void 0:Y._IndirectLightIntensity)!=null?H:.1,an=ft?1-ft:void 0,Ct=(I=n.textureProperties)==null?void 0:I._SphereAdd,it=Ct!=null?[1,1,1]:void 0,lr=Ct!=null?{index:Ct}:void 0,yt=(E=(v=n.floatProperties)==null?void 0:v._RimLightingMix)!=null?E:0,jt=(L=n.textureProperties)==null?void 0:L._RimTexture,Zs=jt!=null?{index:jt,extensions:Lo({},V)}:void 0,Zt=((P=(U=n.vectorProperties)==null?void 0:U._RimColor)!=null?P:[0,0,0,1]).map(Gu),Jt=(W=(z=n.floatProperties)==null?void 0:z._RimFresnelPower)!=null?W:1,ne=(C=(N=n.floatProperties)==null?void 0:N._RimLift)!=null?C:0,ve=["none","worldCoordinates","screenCoordinates"][(ee=(j=n.floatProperties)==null?void 0:j._OutlineWidthMode)!=null?ee:0];let Ee=(X=(F=n.floatProperties)==null?void 0:F._OutlineWidth)!=null?X:0;Ee=.01*Ee;const we=(ue=n.textureProperties)==null?void 0:ue._OutlineWidthTexture,Ce=we!=null?{index:we,extensions:Lo({},V)}:void 0,ze=((fe=(re=n.vectorProperties)==null?void 0:re._OutlineColor)!=null?fe:[0,0,0]).map(Gu),Xe=((pe=(oe=n.floatProperties)==null?void 0:oe._OutlineColorMode)!=null?pe:0)===1?(_e=(xe=n.floatProperties)==null?void 0:xe._OutlineLightingMix)!=null?_e:1:0,$e=(D=n.textureProperties)==null?void 0:D._UvAnimMaskTexture,gt=$e!=null?{index:$e,extensions:Lo({},V)}:void 0,dt=(le=(Ae=n.floatProperties)==null?void 0:Ae._UvAnimScrollX)!=null?le:0;let ct=(J=(q=n.floatProperties)==null?void 0:q._UvAnimScrollY)!=null?J:0;ct!=null&&(ct=-ct);const Wt=(be=(ce=n.floatProperties)==null?void 0:ce._UvAnimRotation)!=null?be:0,vn={specVersion:"1.0",transparentWithZWrite:K,renderQueueOffsetNumber:ie,shadeColorFactor:Me,shadeMultiplyTexture:Fe,shadingShiftFactor:Ve,shadingToonyFactor:Je,giEqualizationFactor:an,matcapFactor:it,matcapTexture:lr,rimLightingMixFactor:yt,rimMultiplyTexture:Zs,parametricRimColorFactor:Zt,parametricRimFresnelPowerFactor:Jt,parametricRimLiftFactor:ne,outlineWidthMode:ve,outlineWidthFactor:Ee,outlineWidthMultiplyTexture:Ce,outlineColorFactor:ze,outlineLightingMixFactor:Xe,uvAnimationMaskTexture:gt,uvAnimationScrollXSpeedFactor:dt,uvAnimationScrollYSpeedFactor:ct,uvAnimationRotationSpeedFactor:Wt};return xP(Lo({},e),{pbrMetallicRoughness:{baseColorFactor:te,baseColorTexture:se},normalTexture:Le,emissiveTexture:he,emissiveFactor:He,alphaMode:me,alphaCutoff:G,doubleSided:S,extensions:{VRMC_materials_mtoon:vn}})}_parseV0UnlitProperties(n,e){var t,r,i,s,o;const a=n.shader==="VRM/UnlitTransparentZWrite",l=n.shader==="VRM/UnlitTransparent"||a,A=this._v0ParseRenderQueue(n),c=n.shader==="VRM/UnlitCutout",u=l?"BLEND":c?"MASK":"OPAQUE",f=c?(r=(t=n.floatProperties)==null?void 0:t._Cutoff)!=null?r:.5:void 0,h=this._portTextureTransform(n),p=((s=(i=n.vectorProperties)==null?void 0:i._Color)!=null?s:[1,1,1,1]).map(Gu),d=(o=n.textureProperties)==null?void 0:o._MainTex,g=d!=null?{index:d,extensions:Lo({},h)}:void 0,m={specVersion:"1.0",transparentWithZWrite:a,renderQueueOffsetNumber:A,shadeColorFactor:p,shadeMultiplyTexture:g};return xP(Lo({},e),{pbrMetallicRoughness:{baseColorFactor:p,baseColorTexture:g},alphaMode:u,alphaCutoff:f,extensions:{VRMC_materials_mtoon:m}})}_portTextureTransform(n){var e,t,r,i,s;const o=(e=n.vectorProperties)==null?void 0:e._MainTex;if(o==null)return{};const a=[(t=o==null?void 0:o[0])!=null?t:0,(r=o==null?void 0:o[1])!=null?r:0],l=[(i=o==null?void 0:o[2])!=null?i:1,(s=o==null?void 0:o[3])!=null?s:1];return a[1]=1-l[1]-a[1],{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(n){var e,t;const r=n.shader==="VRM/UnlitTransparentZWrite",i=((e=n.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||n.shader==="VRM/UnlitTransparent"||r,s=((t=n.floatProperties)==null?void 0:t._ZWrite)===1||r;let o=0;if(i){const a=n.renderQueue;a!=null&&(s?o=this._renderQueueMapTransparentZWrite.get(a):o=this._renderQueueMapTransparent.get(a))}return o}_populateRenderQueueMap(n){const e=new Set,t=new Set;n.forEach(r=>{var i,s;const o=r.shader==="VRM/UnlitTransparentZWrite",a=((i=r.keywordMap)==null?void 0:i._ALPHABLEND_ON)!=null||r.shader==="VRM/UnlitTransparent"||o,l=((s=r.floatProperties)==null?void 0:s._ZWrite)===1||o;if(a){const A=r.renderQueue;A!=null&&(l?t.add(A):e.add(A))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((r,i)=>{const s=Math.min(Math.max(i-e.size+1,-9),0);this._renderQueueMapTransparent.set(r,s)}),Array.from(t).sort().forEach((r,i)=>{const s=Math.min(Math.max(i,0),9);this._renderQueueMapTransparentZWrite.set(r,s)})}},_P=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),Hl=new Z,Hb=class extends Pr{constructor(n){super(),this._attrPosition=new lt(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(z$);const e=new Kt;e.setAttribute("position",this._attrPosition);const t=new Cl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new qh(e,t),this.add(this._line),this.constraint=n}updateMatrixWorld(n){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(n)}};function bP(n,e){return e.set(n.elements[12],n.elements[13],n.elements[14])}var mce=new Z,gce=new Z;function vce(n,e){return n.decompose(mce,e,gce),e}function Cw(n){return n.invert?n.invert():n.inverse(),n}var dT=class{constructor(n,e){this.destination=n,this.source=e,this.weight=1}},yce=new Z,wce=new Z,xce=new Z,_ce=new rt,bce=new rt,Bce=new rt,Ece=class extends dT{get aimAxis(){return this._aimAxis}set aimAxis(n){this._aimAxis=n,this._v3AimAxis.set(n==="PositiveX"?1:n==="NegativeX"?-1:0,n==="PositiveY"?1:n==="NegativeY"?-1:0,n==="PositiveZ"?1:n==="NegativeZ"?-1:0)}get dependencies(){const n=new Set([this.source]);return this.destination.parent&&n.add(this.destination.parent),n}constructor(n,e){super(n,e),this._aimAxis="PositiveX",this._v3AimAxis=new Z(1,0,0),this._dstRestQuat=new rt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);const n=_ce.identity(),e=bce.identity();this.destination.parent&&(vce(this.destination.parent.matrixWorld,n),Cw(e.copy(n)));const t=yce.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(n),r=bP(this.source.matrixWorld,wce).sub(bP(this.destination.matrixWorld,xce)).normalize(),i=Bce.setFromUnitVectors(t,r).premultiply(e).multiply(n).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}};function Cce(n,e){const t=[n];let r=n.parent;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}var Mce=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(n){this._constraints.add(n);let e=this._objectConstraintsMap.get(n.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(n.destination,e)),e.add(n)}deleteConstraint(n){this._constraints.delete(n),this._objectConstraintsMap.get(n.destination).delete(n)}setInitState(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.setInitState())}update(){const n=new Set,e=new Set;for(const t of this._constraints)this._processConstraint(t,n,e,r=>r.update())}_processConstraint(n,e,t,r){if(t.has(n))return;if(e.has(n))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(n);const i=n.dependencies;for(const s of i)Cce(s,o=>{const a=this._objectConstraintsMap.get(o);if(a)for(const l of a)this._processConstraint(l,e,t,r)});r(n),t.add(n)}},Sce=new rt,Tce=new rt,Ice=class extends dT{get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._dstRestQuat=new rt,this._invSrcRestQuat=new rt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Cw(this._invSrcRestQuat.copy(this.source.quaternion))}update(){const n=Sce.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Tce.copy(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},Rce=new Z,Fce=new rt,Uce=new rt,Lce=class extends dT{get rollAxis(){return this._rollAxis}set rollAxis(n){this._rollAxis=n,this._v3RollAxis.set(n==="X"?1:0,n==="Y"?1:0,n==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(n,e){super(n,e),this._rollAxis="X",this._v3RollAxis=new Z(1,0,0),this._dstRestQuat=new rt,this._invDstRestQuat=new rt,this._invSrcRestQuatMulDstRestQuat=new rt}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Cw(this._invDstRestQuat.copy(this._dstRestQuat)),Cw(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){const n=Fce.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=Rce.copy(this._v3RollAxis).applyQuaternion(n),r=Uce.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(n);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}},Pce=new Set(["1.0","1.0-beta"]),T6=class Ip{get name(){return Ip.EXTENSION_NAME}constructor(e,t){this.parser=e,this.helperRoot=t==null?void 0:t.helperRoot}afterRoot(e){return _P(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return _P(this,null,function*(){var t;const r=this.parser.json;if(!(((t=r.extensionsUsed)==null?void 0:t.indexOf(Ip.EXTENSION_NAME))!==-1))return null;const s=new Mce,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?void 0:A[Ip.EXTENSION_NAME];if(u==null)return;const f=u.specVersion;if(!Pce.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Ip.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 Lce(e,a);if(s!=null&&(l.rollAxis=s),o!=null&&(l.weight=o),this.helperRoot){const A=new Hb(l);this.helperRoot.add(A)}return l}_importAimConstraint(e,t,r){const{source:i,aimAxis:s,weight:o}=r,a=t[i],l=new Ece(e,a);if(s!=null&&(l.aimAxis=s),o!=null&&(l.weight=o),this.helperRoot){const A=new Hb(l);this.helperRoot.add(A)}return l}_importRotationConstraint(e,t,r){const{source:i,weight:s}=r,o=t[i],a=new Ice(e,o);if(s!=null&&(a.weight=s),this.helperRoot){const l=new Hb(a);this.helperRoot.add(l)}return a}};T6.EXTENSION_NAME="VRMC_node_constraint";var Dce=T6,iv=(n,e,t)=>new Promise((r,i)=>{var s=l=>{try{a(t.next(l))}catch(A){i(A)}},o=l=>{try{a(t.throw(l))}catch(A){i(A)}},a=l=>l.done?r(l.value):Promise.resolve(l.value).then(s,o);a((t=t.apply(n,e)).next())}),pT=class{},zb=new Z,ac=new Z,I6=class extends pT{get type(){return"capsule"}constructor(n){var e,t,r,i;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new Z(0,0,0),this.tail=(t=n==null?void 0:n.tail)!=null?t:new Z(0,0,0),this.radius=(r=n==null?void 0:n.radius)!=null?r:0,this.inside=(i=n==null?void 0:n.inside)!=null?i:!1}calculateCollision(n,e,t,r){zb.copy(this.offset).applyMatrix4(n),ac.copy(this.tail).applyMatrix4(n),ac.sub(zb);const i=ac.lengthSq();r.copy(e).sub(zb);const s=ac.dot(r);s<=0||(i<=s||ac.multiplyScalar(s/i),r.sub(ac));const o=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),o}},Gb=new Z,BP=new xn,R6=class extends pT{get type(){return"plane"}constructor(n){var e,t;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new Z(0,0,0),this.normal=(t=n==null?void 0:n.normal)!=null?t:new Z(0,0,1)}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e),BP.getNormalMatrix(n),Gb.copy(this.normal).applyNormalMatrix(BP).normalize();const i=r.dot(Gb)-t;return r.copy(Gb),i}},F6=class extends pT{get type(){return"sphere"}constructor(n){var e,t,r;super(),this.offset=(e=n==null?void 0:n.offset)!=null?e:new Z(0,0,0),this.radius=(t=n==null?void 0:n.radius)!=null?t:0,this.inside=(r=n==null?void 0:n.inside)!=null?r:!1}calculateCollision(n,e,t,r){r.copy(this.offset).applyMatrix4(n),r.negate().add(e);const i=this.inside?this.radius-t-r.length():r.length()-t-this.radius;return r.normalize(),this.inside&&r.negate(),i}},Po=new Z,Oce=class extends Kt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._currentTail=new Z,this._shape=n,this._attrPos=new lt(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0);const t=Po.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(t)>1e-10&&(this._currentTail.copy(t),n=!0),n&&this._buildPosition()}_buildPosition(){Po.copy(this._currentTail).sub(this._currentOffset);const n=Po.length()/this._currentRadius;for(let r=0;r<=16;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(r,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+r,n+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+r,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+r,n+Math.sin(i),0,Math.cos(i))}for(let r=0;r<32;r++){const i=r/16*Math.PI;this._attrPos.setXYZ(68+r,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+r,n,Math.sin(i),Math.cos(i))}const e=Math.atan2(Po.y,Math.sqrt(Po.x*Po.x+Po.z*Po.z)),t=-Math.atan2(Po.z,Po.x);this.rotateZ(e),this.rotateY(t),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<34;n++){const e=(n+1)%34;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(68+n*2,34+n,34+e)}for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(136+n*2,68+n,68+e),this._attrIndex.setXY(200+n*2,100+n,100+e)}this._attrIndex.needsUpdate=!0}},Nce=class extends Kt{constructor(n){super(),this.worldScale=1,this._currentOffset=new Z,this._currentNormal=new Z,this._shape=n,this._attrPos=new lt(new Float32Array(6*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),n=!0),n&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},kce=class extends Kt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z,this._shape=n,this._attrPos=new lt(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.needsUpdate=!0}},Qce=new Z,Vb=class extends Pr{constructor(n){if(super(),this.matrixAutoUpdate=!1,this.collider=n,this.collider.shape instanceof F6)this._geometry=new kce(this.collider.shape);else if(this.collider.shape instanceof I6)this._geometry=new Oce(this.collider.shape);else if(this.collider.shape instanceof R6)this._geometry=new Nce(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");const e=new Cl({color:16711935,depthTest:!1,depthWrite:!1});this._line=new pg(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=Qce.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},Hce=class extends Kt{constructor(n){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new Z,this._springBone=n,this._attrPos=new lt(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new lt(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let n=!1;const e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,n=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),n=!0),n&&this._buildPosition()}_buildPosition(){for(let n=0;n<32;n++){const e=n/16*Math.PI;this._attrPos.setXYZ(n,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+n,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+n,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let n=0;n<32;n++){const e=(n+1)%32;this._attrIndex.setXY(n*2,n,e),this._attrIndex.setXY(64+n*2,32+n,32+e),this._attrIndex.setXY(128+n*2,64+n,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},zce=new Z,Gce=class extends Pr{constructor(n){super(),this.matrixAutoUpdate=!1,this.springBone=n,this._geometry=new Hce(this.springBone);const e=new Cl({color:16776960,depthTest:!1,depthWrite:!1});this._line=new pg(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(n){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);const e=this.matrix.elements;this._geometry.worldScale=zce.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(n)}},jb=class extends It{constructor(n){super(),this.shape=n}},Vce=new We;function U6(n){return n.invert?n.invert():n.getInverse(Vce.copy(n)),n}var jce=class{constructor(n){this._inverseCache=new We,this._shouldUpdateInverse=!0,this.matrix=n;const e={set:(t,r,i)=>(this._shouldUpdateInverse=!0,t[r]=i,!0)};this._originalElements=n.elements,n.elements=new Proxy(n.elements,e)}get inverse(){return this._shouldUpdateInverse&&(U6(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},Wce=new We,Pa=new Z,Xd=new Z,Kce=new Z,Vu=new Z,EP=new Z,$d=new Z,CP=new rt,ju=new We,Yce=new We,Xce=class{constructor(n,e,t={},r=[]){this._currentTail=new Z,this._prevTail=new Z,this._boneAxis=new Z,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new We,this._initialLocalRotation=new rt,this._initialLocalChildPosition=new Z;var i,s,o,a,l,A;this.bone=n,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(i=t.hitRadius)!=null?i:0,stiffness:(s=t.stiffness)!=null?s:1,gravityPower:(o=t.gravityPower)!=null?o:0,gravityDir:(l=(a=t.gravityDir)==null?void 0:a.clone())!=null?l:new Z(0,-1,0),dragForce:(A=t.dragForce)!=null?A:.4},this.colliderGroups=r}get center(){return this._center}set center(n){var e;(e=this._center)!=null&&e.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=n,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new jce(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:Wce}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);const n=this._getMatrixWorldToCenter(ju);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);const n=this._getMatrixWorldToCenter(ju);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(n),this._prevTail.copy(this._currentTail)}update(n){if(n<=0)return;this._calcWorldSpaceBoneLength(),Vu.setFromMatrixPosition(this.bone.matrixWorld);let e=this._getMatrixWorldToCenter(ju);EP.copy(Vu).applyMatrix4(e);const t=CP.setFromRotationMatrix(e),r=Yce.copy(e).multiply(this._parentMatrixWorld),i=Xd.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(r).sub(EP).normalize(),s=Kce.copy(this.settings.gravityDir).applyQuaternion(t).normalize(),o=this._getMatrixCenterToWorld(ju);$d.copy(this._currentTail).add(Pa.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(Pa.copy(i).multiplyScalar(this.settings.stiffness*n)).add(Pa.copy(s).multiplyScalar(this.settings.gravityPower*n)).applyMatrix4(o),$d.sub(Vu).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Vu),this._collision($d),e=this._getMatrixWorldToCenter(ju),this._prevTail.copy(this._currentTail),this._currentTail.copy(Pa.copy($d).applyMatrix4(e));const a=U6(ju.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),l=CP.setFromUnitVectors(this._boneAxis,Pa.copy($d).applyMatrix4(a).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(l),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(n){this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{const r=t.shape.calculateCollision(t.matrixWorld,n,this.settings.hitRadius,Pa);r<0&&(n.add(Pa.multiplyScalar(-r)),n.sub(Vu).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Vu))})})}_calcWorldSpaceBoneLength(){Pa.setFromMatrixPosition(this.bone.matrixWorld),this.child?Xd.setFromMatrixPosition(this.child.matrixWorld):(Xd.copy(this._initialLocalChildPosition),Xd.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Pa.sub(Xd).length()}_getMatrixCenterToWorld(n){return this._center?n.copy(this._center.matrixWorld):n.identity(),n}_getMatrixWorldToCenter(n){return this._center?n.copy(this._center.userData.inverseCacheProxy.inverse):n.identity(),n}};function $ce(n,e){const t=[];let r=n;for(;r!==null;)t.unshift(r),r=r.parent;t.forEach(i=>{e(i)})}function L6(n,e){n.children.forEach(t=>{e(t)||L6(t,e)})}var MP=class{constructor(){this._joints=new Set,this._hasWarnedCircularDependency=!1,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){const n=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(t=>{n.add(t)})}),Array.from(n)}get colliders(){const n=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(t=>{n.add(t)})}),Array.from(n)}addJoint(n){this._joints.add(n);let e=this._objectSpringBonesMap.get(n.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(n.bone,e)),e.add(n)}addSpringBone(n){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(n)}deleteJoint(n){this._joints.delete(n),this._objectSpringBonesMap.get(n.bone).delete(n)}deleteSpringBone(n){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(n)}setInitState(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.setInitState())}reset(){const n=new Set,e=new Set,t=new Set;for(const r of this._joints)this._processSpringBone(r,n,e,t,i=>i.reset())}update(n){const e=new Set,t=new Set,r=new Set;for(const i of this._joints)this._processSpringBone(i,e,t,r,s=>s.update(n)),L6(i.bone,s=>{var o,a;return((a=(o=this._objectSpringBonesMap.get(s))==null?void 0:o.size)!=null?a:0)>0?!0:(s.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(n,e,t,r,i){if(t.has(n))return;if(e.has(n)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected while updating springbones"),this._hasWarnedCircularDependency=!0);return}e.add(n);const s=this._getDependencies(n);for(const o of s)$ce(o,a=>{const l=this._objectSpringBonesMap.get(a);if(l)for(const A of l)this._processSpringBone(A,e,t,r,i);else r.has(a)||(a.updateWorldMatrix(!1,!1),r.add(a))});n.bone.updateMatrix(),n.bone.updateWorldMatrix(!1,!1),i(n),r.add(n.bone),t.add(n)}_getDependencies(n){const e=new Set,t=n.bone.parent;return t&&e.add(t),n.colliderGroups.forEach(r=>{r.colliders.forEach(i=>{e.add(i)})}),e}},SP="VRMC_springBone_extended_collider",Zce=new Set(["1.0","1.0-beta"]),Jce=new Set(["1.0"]),P6=class nf{get name(){return nf.EXTENSION_NAME}constructor(e,t){var r;this.parser=e,this.jointHelperRoot=t==null?void 0:t.jointHelperRoot,this.colliderHelperRoot=t==null?void 0:t.colliderHelperRoot,this.useExtendedColliders=(r=t==null?void 0:t.useExtendedColliders)!=null?r:!0}afterRoot(e){return iv(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return iv(this,null,function*(){const t=yield this._v1Import(e);if(t!=null)return t;const r=yield this._v0Import(e);return r??null})}_v1Import(e){return iv(this,null,function*(){var t,r,i,s,o;const a=e.parser.json;if(!(((t=a.extensionsUsed)==null?void 0:t.indexOf(nf.EXTENSION_NAME))!==-1))return null;const A=new MP,c=yield e.parser.getDependencies("node"),u=(r=a.extensions)==null?void 0:r[nf.EXTENSION_NAME];if(!u)return null;const f=u.specVersion;if(!Zce.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${nf.EXTENSION_NAME} specVersion "${f}"`),null;const h=(i=u.colliders)==null?void 0:i.map((d,g)=>{var m,y,w,x,_,B,T,b,M,O,Y,H,I,v,E;const L=c[d.node],U=d.shape,P=(m=d.extensions)==null?void 0:m[SP];if(this.useExtendedColliders&&P!=null){const z=P.specVersion;if(!Jce.has(z))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${SP} specVersion "${z}". Fallbacking to the ${nf.EXTENSION_NAME} definition`);else{const W=P.shape;if(W.sphere)return this._importSphereCollider(L,{offset:new Z().fromArray((y=W.sphere.offset)!=null?y:[0,0,0]),radius:(w=W.sphere.radius)!=null?w:0,inside:(x=W.sphere.inside)!=null?x:!1});if(W.capsule)return this._importCapsuleCollider(L,{offset:new Z().fromArray((_=W.capsule.offset)!=null?_:[0,0,0]),radius:(B=W.capsule.radius)!=null?B:0,tail:new Z().fromArray((T=W.capsule.tail)!=null?T:[0,0,0]),inside:(b=W.capsule.inside)!=null?b:!1});if(W.plane)return this._importPlaneCollider(L,{offset:new Z().fromArray((M=W.plane.offset)!=null?M:[0,0,0]),normal:new Z().fromArray((O=W.plane.normal)!=null?O:[0,0,1])})}}if(U.sphere)return this._importSphereCollider(L,{offset:new Z().fromArray((Y=U.sphere.offset)!=null?Y:[0,0,0]),radius:(H=U.sphere.radius)!=null?H:0,inside:!1});if(U.capsule)return this._importCapsuleCollider(L,{offset:new Z().fromArray((I=U.capsule.offset)!=null?I:[0,0,0]),radius:(v=U.capsule.radius)!=null?v:0,tail:new Z().fromArray((E=U.capsule.tail)!=null?E:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${g} has no valid shape`)}),p=(s=u.colliderGroups)==null?void 0:s.map((d,g)=>{var m;return{colliders:((m=d.colliders)!=null?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.forEach((d,g)=>{var m;const y=d.joints,w=(m=d.colliderGroups)==null?void 0:m.map(B=>{const T=p==null?void 0:p[B];if(T==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${g} attempted to use a colliderGroup ${B} but not found`);return T}),x=d.center!=null?c[d.center]:void 0;let _;y.forEach(B=>{if(_){const T=_.node,b=c[T],M=B.node,O=c[M],Y={hitRadius:_.hitRadius,dragForce:_.dragForce,gravityPower:_.gravityPower,stiffness:_.stiffness,gravityDir:_.gravityDir!=null?new Z().fromArray(_.gravityDir):void 0},H=this._importJoint(b,O,Y,w);x&&(H.center=x),A.addJoint(H)}_=B})}),A.setInitState(),A})}_v0Import(e){return iv(this,null,function*(){var t,r,i;const s=e.parser.json;if(!(((t=s.extensionsUsed)==null?void 0:t.indexOf("VRM"))!==-1))return null;const a=(r=s.extensions)==null?void 0:r.VRM,l=a==null?void 0:a.secondaryAnimation;if(!l)return null;const A=l==null?void 0:l.boneGroups;if(!A)return null;const c=new MP,u=yield e.parser.getDependencies("node"),f=(i=l.colliderGroups)==null?void 0:i.map(h=>{var p;const d=u[h.node];return{colliders:((p=h.colliders)!=null?p:[]).map((m,y)=>{var w,x,_;const B=new Z(0,0,0);return m.offset&&B.set((w=m.offset.x)!=null?w:0,(x=m.offset.y)!=null?x:0,m.offset.z?-m.offset.z:0),this._importSphereCollider(d,{offset:B,radius:(_=m.radius)!=null?_:0,inside:!1})})}});return A==null||A.forEach((h,p)=>{const d=h.bones;d&&d.forEach(g=>{var m,y,w,x;const _=u[g],B=new Z;h.gravityDir?B.set((m=h.gravityDir.x)!=null?m:0,(y=h.gravityDir.y)!=null?y:0,(w=h.gravityDir.z)!=null?w:0):B.set(0,-1,0);const T=h.center!=null?u[h.center]:void 0,b={hitRadius:h.hitRadius,dragForce:h.dragForce,gravityPower:h.gravityPower,stiffness:h.stiffiness,gravityDir:B},M=(x=h.colliderGroups)==null?void 0:x.map(O=>{const Y=f==null?void 0:f[O];if(Y==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${p} attempted to use a colliderGroup ${O} but not found`);return Y});_.traverse(O=>{var Y;const H=(Y=O.children[0])!=null?Y:null,I=this._importJoint(O,H,b,M);T&&(I.center=T),c.addJoint(I)})})}),e.scene.updateMatrixWorld(),c.setInitState(),c})}_importJoint(e,t,r,i){const s=new Xce(e,t,r,i);if(this.jointHelperRoot){const o=new Gce(s);this.jointHelperRoot.add(o),o.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,t){const r=new F6(t),i=new jb(r);if(e.add(i),this.colliderHelperRoot){const s=new Vb(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importCapsuleCollider(e,t){const r=new I6(t),i=new jb(r);if(e.add(i),this.colliderHelperRoot){const s=new Vb(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}_importPlaneCollider(e,t){const r=new R6(t),i=new jb(r);if(e.add(i),this.colliderHelperRoot){const s=new Vb(i);this.colliderHelperRoot.add(s),s.renderOrder=this.colliderHelperRoot.renderOrder}return i}};P6.EXTENSION_NAME="VRMC_springBone";var qce=P6,eue=class{get name(){return"VRMLoaderPlugin"}constructor(n,e){var t,r,i,s,o,a,l,A,c,u;this.parser=n;const f=e==null?void 0:e.helperRoot,h=e==null?void 0:e.autoUpdateHumanBones;this.expressionPlugin=(t=e==null?void 0:e.expressionPlugin)!=null?t:new yAe(n),this.firstPersonPlugin=(r=e==null?void 0:e.firstPersonPlugin)!=null?r:new xAe(n),this.humanoidPlugin=(i=e==null?void 0:e.humanoidPlugin)!=null?i:new SAe(n,{helperRoot:f,autoUpdateHumanBones:h}),this.lookAtPlugin=(s=e==null?void 0:e.lookAtPlugin)!=null?s:new GAe(n,{helperRoot:f}),this.metaPlugin=(o=e==null?void 0:e.metaPlugin)!=null?o:new WAe(n),this.mtoonMaterialPlugin=(a=e==null?void 0:e.mtoonMaterialPlugin)!=null?a:new oce(n),this.materialsHDREmissiveMultiplierPlugin=(l=e==null?void 0:e.materialsHDREmissiveMultiplierPlugin)!=null?l:new lce(n),this.materialsV0CompatPlugin=(A=e==null?void 0:e.materialsV0CompatPlugin)!=null?A:new pce(n),this.springBonePlugin=(c=e==null?void 0:e.springBonePlugin)!=null?c:new qce(n,{colliderHelperRoot:f,jointHelperRoot:f}),this.nodeConstraintPlugin=(u=e==null?void 0:e.nodeConstraintPlugin)!=null?u:new Dce(n,{helperRoot:f})}beforeRoot(){return tv(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(n){return tv(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(n)})}getMaterialType(n){const e=this.mtoonMaterialPlugin.getMaterialType(n);return e??null}extendMaterialParams(n,e){return tv(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(n,e),yield this.mtoonMaterialPlugin.extendMaterialParams(n,e)})}afterRoot(n){return tv(this,null,function*(){yield this.metaPlugin.afterRoot(n),yield this.humanoidPlugin.afterRoot(n),yield this.expressionPlugin.afterRoot(n),yield this.lookAtPlugin.afterRoot(n),yield this.firstPersonPlugin.afterRoot(n),yield this.springBonePlugin.afterRoot(n),yield this.nodeConstraintPlugin.afterRoot(n),yield this.mtoonMaterialPlugin.afterRoot(n);const e=n.userData.vrmMeta,t=n.userData.vrmHumanoid;if(e&&t){const r=new YAe({scene:n.scene,expressionManager:n.userData.vrmExpressionManager,firstPerson:n.userData.vrmFirstPerson,humanoid:t,lookAt:n.userData.vrmLookAt,meta:e,materials:n.userData.vrmMToonMaterials,springBoneManager:n.userData.vrmSpringBoneManager,nodeConstraintManager:n.userData.vrmNodeConstraintManager});n.userData.vrm=r}})}};function TP(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 tue(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=>TP(i)):r&&TP(r))}function nue(n){n.traverse(tue)}function rue(n,e){var t;const r=(t=e==null?void 0:e.experimentalSameBoneCounts)!=null?t:!1,i=[];n.traverse(a=>{a.type==="SkinnedMesh"&&i.push(a)});const s=new Map;let o=0;for(const a of i){const A=a.geometry.getAttribute("skinIndex"),c=[],u=[],f={},h=A.array;for(let p=0;p{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 Kt;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?void 0:r.clone())!=null?i:null,u.boundingSphere=(o=(s=l.boundingSphere)==null?void 0:s.clone())!=null?o:null,u.setDrawRange(l.drawRange.start,l.drawRange.count),u.userData=l.userData,e.set(l,u);const f=[],h=[];{const 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((_,B)=>{for(let T=0;T{u.morphAttributes[d]=[];const g=l.morphAttributes[d];for(let m=0;m{for(let M=0;MT===0),u.morphAttributes[d][m]=new lt(B,x,_)}}),p&&(u.morphAttributes={}),a.geometry=u}),Array.from(e.keys()).forEach(t=>{t.dispose()})}function sue(n){var e;((e=n.meta)==null?void 0:e.metaVersion)==="0"&&(n.scene.rotation.y=Math.PI)}var wg=class{constructor(){}};wg.deepDispose=nue;wg.removeUnnecessaryJoints=rue;wg.removeUnnecessaryVertices=iue;wg.rotateVRM0=sue;/*! + * @pixiv/three-vrm-core v3.1.4 * The implementation of core features of VRM, for @pixiv/three-vrm * * Copyright (c) 2019-2024 pixiv Inc. * @pixiv/three-vrm-core is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE *//*! - * @pixiv/three-vrm-materials-mtoon v3.1.3 + * @pixiv/three-vrm-materials-mtoon v3.1.4 * MToon (toon material) module for @pixiv/three-vrm * * Copyright (c) 2019-2024 pixiv Inc. * @pixiv/three-vrm-materials-mtoon is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE *//*! - * @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.1.3 + * @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.1.4 * Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm * * Copyright (c) 2019-2024 pixiv Inc. * @pixiv/three-vrm-materials-hdr-emissive-multiplier is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE *//*! - * @pixiv/three-vrm-materials-v0compat v3.1.3 + * @pixiv/three-vrm-materials-v0compat v3.1.4 * VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm * * Copyright (c) 2019-2024 pixiv Inc. * @pixiv/three-vrm-materials-v0compat is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE *//*! - * @pixiv/three-vrm-node-constraint v3.1.3 + * @pixiv/three-vrm-node-constraint v3.1.4 * Node constraint module for @pixiv/three-vrm * * Copyright (c) 2019-2024 pixiv Inc. * @pixiv/three-vrm-node-constraint is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE *//*! - * @pixiv/three-vrm-springbone v3.1.3 + * @pixiv/three-vrm-springbone v3.1.4 * Spring bone module for @pixiv/three-vrm * * Copyright (c) 2019-2024 pixiv Inc. * @pixiv/three-vrm-springbone is distributed under MIT License * https://github.com/pixiv/three-vrm/blob/release/LICENSE - */var er;(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"})(er||(er={}));const Mw="blend_",TP="vrmColliderSphere";class sue{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((se,pe,_e)=>_e.findIndex(xe=>xe.name===se.name.replace(" (Outline)",""))===pe).map(se=>se),p=h.map(se=>se.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(se=>se.map).map(se=>{if(!se.map)throw new Error(se.name+" map is null");return{name:se.name,imageBitmap:se.map.image}}),m=h.filter(se=>se.userData.shadeTexture).map(se=>{if(!se.userData.shadeTexture)throw new Error(se.userData.shadeTexture+" map is null");return{name:se.name+"_shade",imageBitmap:se.userData.shadeTexture.image}}),y=g.concat(m),w=cue(y,d),x=uue(w),_=fue(w),C=Aue(h,y),T=t.children.filter(se=>se.children.length>0&&se.children[0].type===Ai.Bone)[0],b=P6(T).filter(se=>se.name!==TP),M=b.map(se=>se.name),D=b.map(se=>({children:se.children.filter(pe=>pe.name!==TP).map(pe=>M.indexOf(pe.name)),name:se.name,rotation:[se.quaternion.x,se.quaternion.y,se.quaternion.z,se.quaternion.w],scale:[se.scale.x,se.scale.y,se.scale.z],translation:[se.position.x,se.position.y,se.position.z]})),Y=[],H=t.children.filter(se=>se.type===Ai.Group||se.type===Ai.SkinnedMesh),I=[];H.forEach(se=>{const pe=se.type===Ai.Group?se.children[0]:se,_e=pe.geometry.attributes;I.push(new Da(_e.position,er.FLOAT,Xt.POSITION,uo.VEC3,pe.name,void 0)),I.push(new Da(_e.normal,er.FLOAT,Xt.NORMAL,uo.VEC3,pe.name,void 0)),I.push(new Da(_e.uv,er.FLOAT,Xt.UV,uo.VEC2,pe.name,void 0)),I.push(new Da(_e.skinWeight,er.FLOAT,Xt.SKIN_WEIGHT,uo.VEC4,pe.name,void 0)),I.push(new Da(_e.skinIndex,er.UNSIGNED_SHORT,Xt.SKIN_INDEX,uo.VEC4,pe.name,void 0)),(se.type===Ai.Group?se.children.map(L=>L):[se]).forEach(L=>{if(!L.geometry.index)throw new Error(L.name+" geometry.index is null");I.push(new Da(L.geometry.index,er.UNSIGNED_INT,Xt.INDEX,uo.SCALAR,pe.name,L.name))}),pe.morphTargetDictionary||(pe.morphTargetDictionary={},pe.morphTargetInfluences=[],pe.geometry.morphAttributes={},pe.updateMorphTargets()),pe.geometry.userData.targetNames=[];for(const L in e.expressionManager.expressionMap){const ue=e.expressionManager.expressionMap[L],Ae=ue._binds.map(J=>({node:b.length,index:J.index,weight:J.weight}));let q=!1;for(const J in Ur)if(L.toLowerCase()===Ur[J].toLowerCase()){l[Ur[J]]={morphTargetBinds:Ae,isBinary:ue.isBinary,overrideBlink:ue.overrideBlink,overrideLookAt:ue.overrideLookAt,overrideMouth:ue.overrideMouth},q=!0;break}!q&&L.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:Ae,isBinary:ue.isBinary,overrideBlink:ue.overrideBlink,overrideLookAt:ue.overrideLookAt,overrideMouth:ue.overrideMouth},q=!0),q===!1&&(A[L]={morphTargetBinds:Ae,isBinary:ue.isBinary,overrideBlink:ue.overrideBlink,overrideLookAt:ue.overrideLookAt,overrideMouth:ue.overrideMouth})}for(const L in pe.morphTargetDictionary){pe.geometry.userData.targetNames.push(L);const ue=pe.morphTargetDictionary[L],Ae=pe.geometry.morphAttributes;I.push(new Da(Ae.position[ue],er.FLOAT,Xt.BLEND_POSITION,uo.VEC3,pe.name,Mw+L)),I.push(new Da(Ae.normal[ue],er.FLOAT,Xt.BLEND_NORMAL,uo.VEC3,pe.name,Mw+L))}}),Object.keys(l).length>0&&(c.preset=l),Object.keys(A).length>0&&(c.custom=A),H.forEach(se=>{const pe=se.type===Ai.Group?se.children[0]:se,_e=new Float32Array(pe.skeleton.boneInverses.map(xe=>xe.elements).flat());I.push(new Da(new lt(_e,16),er.FLOAT,Xt.BIND_MATRIX,uo.MAT4,pe.name,pe.name))}),Y.push(...I.map(se=>({bufferView:-1,byteOffset:0,componentType:se.valueType,count:se.attribute.count,max:se.max,min:se.min,normalized:!1,type:se.accessorsType})));const v=aue(H,I,p);H.forEach((se,pe)=>{D.push({mesh:pe,name:se.name,rotation:[se.quaternion.x,se.quaternion.y,se.quaternion.z,se.quaternion.w],scale:[se.scale.x,se.scale.y,se.scale.z],skin:pe,translation:[se.position.x,se.position.y,se.position.z]})});const B=lue(H,I,M),F={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 se in s.humanBones)P.humanBones[se]={node:M.indexOf(s.humanBones[se].node.name)};const O=o,z=[];z.push(...y.map(se=>({buffer:IP(se.imageBitmap),type:Xt.IMAGE}))),z.push(...I.map(se=>({buffer:se.buffer,type:se.type}))),d&&z.push({buffer:IP(d.imageBitmap),type:Xt.IMAGE});let K=0,Q=0,E=0;const G=z.map((se,pe)=>{const _e={buffer:0,byteLength:se.buffer.byteLength,byteOffset:K,target:se.type===Xt.IMAGE||se.type===Xt.BIND_MATRIX?void 0:se.type===Xt.INDEX?er.ELEMENT_ARRAY_BUFFER:er.ARRAY_BUFFER};return K+=se.buffer.byteLength,se.type===Xt.IMAGE?w[Q++].bufferView=pe:Y[E++].bufferView=pe,_e}),ee=hue(t,D),U={accessors:Y,asset:f,buffers:[{byteLength:K}],bufferViews:G,extensions:{VRMC_vrm:{expressions:c,humanoid:P,lookAt:F,meta:O,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:B,textures:_},X=new RP(IC(JSON.stringify(U,void 0,2)),"JSON"),ae=new RP(Rp(z.map(se=>se.buffer)),"BIN\0"),oe=Rp([X.buffer,ae.buffer]),de=Rp([IC("glTF"),TC(2,4),TC(oe.byteLength+12,4)]);i(Rp([de,oe]))}}function P6(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>P6(e)).flat())}function IP(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===er.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===er.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}let RP=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=Rp([TC(r.byteLength,4),IC(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===Xt.POSITION||r===Xt.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 Vf;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Vf||(Vf={}));var uo;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(uo||(uo={}));var Xt;(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"})(Xt||(Xt={}));var Ai;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(Ai||(Ai={}));const aue=(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(Xt.SKIN_INDEX),NORMAL:a.indexOf(Xt.NORMAL),POSITION:a.indexOf(Xt.POSITION),TEXCOORD_0:a.indexOf(Xt.UV),WEIGHTS_0:a.indexOf(Xt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Xt.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===Xt.BLEND_NORMAL&&c.meshName===i.name?c.name:null).indexOf(Mw+A),POSITION:e.map(c=>c.type===Xt.BLEND_POSITION&&c.meshName===i.name?c.name:null).indexOf(Mw+A)})):void 0}})}}),lue=(n,e,t)=>n.map(r=>{const i=r.type===Ai.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Xt.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)}}),Aue=(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 Vf.MeshStandardMaterial:return t.metalness;case Vf.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case Vf.MeshStandardMaterial:return t.roughness;case Vf.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}}}),cue=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),uue=n=>n.map(()=>({magFilter:er.LINEAR,minFilter:er.LINEAR,wrapS:er.REPEAT,wrapT:er.REPEAT})),fue=n=>n.map((e,t)=>({sampler:0,source:t})),hue=(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))}]},D6=0,due=1,O6=2,FP=2,jb=1.25,UP=1,ly=6*4+4+4,RC=65535,pue=Math.pow(2,-24);class sv{constructor(){}}function $o(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 LP(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 PP(n,e){e.set(n)}function DP(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 ov(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 Zd(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 mue(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 lt(i,1));for(let s=0;si-s);for(let i=0;il&&(l=T),m&&xp&&(p=x);const b=n[y+2],M=n[y+3],D=b-M,Y=b+M;DA&&(A=Y),m&&bd&&(d=b);const H=n[y+4],I=n[y+5],v=H-I,B=H+I;vc&&(c=B),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 vue(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 yue(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(Ha).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),av=new Float32Array(6);function xue(n,e,t,r,i,s){let o=-1,a=0;if(s===D6)o=LP(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===due)o=LP(n),o!==-1&&(a=_ue(t,r,i,o));else if(s===O6){const l=Zd(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)/Ha;if(i=T.candidate?ov(x,t,T.rightCacheBounds):(ov(x,t,T.leftCacheBounds),T.count++)}}for(let x=0;x=Ha&&(C=Ha-1);const T=zl[C];T.count++,ov(w,t,T.bounds)}const m=zl[Ha-1];PP(m.bounds,m.rightCacheBounds);for(let w=Ha-2;w>=0;w--){const x=zl[w],_=zl[w+1];DP(x.bounds,_.rightCacheBounds,x.rightCacheBounds)}let y=0;for(let w=0;wC&&(C=w),x>C&&(C=x);const T=(C-_)/2,b=m*2;s[h+b+0]=_+T,s[h+b+1]=T+(Math.abs(_)+T)*pue,_e[m+3]&&(e[m+3]=C)}}return s}function Bue(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=xue(m.boundingData,x,o,y,w,u);if(C.axis===-1)return t(y+w),m.offset=y,m.count=w,m;const T=yue(a,o,y,w,C);if(T===y||T===y+w)t(y+w),m.offset=y,m.count=w;else{m.splitAxis=C.axis;const b=new sv,M=y,D=T-y;m.left=b,b.boundingData=new Float32Array(6),Wb(o,M,D,b.boundingData,s),r(b,M,D,s,_+1);const Y=new sv,H=T,I=w-D;m.right=Y,Y.boundingData=new Float32Array(6),Wb(o,H,I,Y.boundingData,s),r(Y,H,I,s,_+1)}return m}mue(n,e);const i=new Float32Array(6),s=new Float32Array(6),o=bue(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=gue(n);if(g.length===1){const m=g[0],y=new sv;y.boundingData=i,vue(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 sv;y.boundingData=new Float32Array(6),Wb(o,m.offset,m.count,y.boundingData,s),r(y,m.offset,m.count,s),d.push(y)}return d}function Eue(n,e){const t=Bue(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 Cue=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}}(),pT=function(){const n=new Ye,e=new Z,t=new Z;return function(i,s,o,a){Cue(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}}}}(),Mue=function(){const n=new Z,e=new Z,t=new $a,r=new Al;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}}(),Sue=1e-15;function Wu(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 ru,this.plane=new $a,this.needsUpdate=!0}intersectsSphere(e){return Mue(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 Al;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]),pT(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 T=y[C],b=w[C];if(r.setFromPoints(b,t),T.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 T=x[C],b=_[C];if(r.setFromPoints(b,e),T.isSeparated(r))return!1}for(let C=0;C<4;C++){const T=w[C];for(let b=0;b<4;b++){const M=_[b];if(s.crossVectors(T,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 B=y[v],F=y[(v+1)%3];A.start.copy(B),A.end.copy(F),A.delta(o);const P=w?c.start:c.end,O=Wu(m.distanceToPoint(B));if(Wu(m.normal.dot(o))&&O){c.copy(A),x=2;break}if((m.intersectLine(A,P)||O)&&!Wu(P.distanceTo(F))){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,T=0;for(let v=0;v<3;v++){const B=_[v],F=_[(v+1)%3];A.start.copy(B),A.end.copy(F),A.delta(a);const P=C?u.start:u.end,O=Wu(g.distanceToPoint(B));if(Wu(g.normal.dot(a))&&O){u.copy(A),T=2;break}if((g.intersectLine(A,P)||O)&&!Wu(P.distanceTo(F))){if(T++,C)break;C=!0}}if(T===1&&this.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(T!==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),Y=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 Al,i=new Al;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}}ma.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 Al),t=new Array(12).fill().map(()=>new Al),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 Wo(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 zP(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=Wm(n),p=Km(n,a)):(h=Km(n,a),p=Wm(n));const g=Tw(h,s,r,Sw)?UC(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=Tw(p,s,r,Sw)?UC(p,e,t,r):null;return g&&y?g.distance<=y.distance?g:y:g||y||null}}const Pue=function(){let n,e;const t=[],r=new k6(()=>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=SA;for(;!nA(x,_);)w=Wm(w),x=w*2;return uh(w,C)}function h(w){let x=w*2,_=MA,C=SA;for(;!nA(x,_);)w=Km(w,C),x=w*2;return uh(w,C)+jm(x,_)}let p=s*2,d=rd,g=MA,m=SA;if(nA(p,g)){const w=uh(s,m),x=jm(p,g);return $o(s,d,n),l(w,x,!1,u,c+s,n)}else{const w=Wm(s),x=Km(s,m);let _=w,C=x,T,b,M,D;if(A&&(M=n,D=e,$o(_,d,M),$o(C,d,D),T=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 sm{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),sm.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."),sm.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 sm(t,{...r,[Kb]:!0});if(o._roots=s,r.setIndex){const a=t.getIndex();if(a===null){const l=new lt(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:D6,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[Kb]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[Kb]||(this._roots=Eue(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),IT&&(T=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]!==T||l[f+5]!==b?(l[f+0]=w,l[f+1]=x,l[f+2]=_,l[f+3]=C,l[f+4]=T,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,T=!1;e?_||(C=e.has(w),T=e.has(x),_=!C&&!T):(C=!0,T=!0);const b=_||C,M=_||T;let D=!1;b&&(D=u(m,h,_));let Y=!1;M&&(Y=u(y,h,_));const H=D||Y;if(H)for(let I=0;I<3;I++){const v=m+I,B=y+I,F=l[v],P=l[v+3],O=l[B],z=l[B+3];l[f+I]=Fz?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]===RC;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+ly/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=As){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:zP(h,p,i,A,d,g,s)}else l||(A?l=(f,h,p,d)=>zP(f,h,i,A,p,d,s):l=(f,h,p)=>p);let c=!1,u=0;for(const f of this._roots){if(Fp(f),c=Pue(0,i,a,l,o,u),uv(),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;Ku.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,T=g+m;CXb.intersectsBox(h),intersectsRange:(h,p,d,g,m,y)=>(Yb.copy(y),Yb.applyMatrix4(Ku),e.shapecast({intersectsBounds:w=>Yb.intersectsBox(w),intersectsRange:(w,x,_,C,T)=>i(h,p,w,x,g,m,C,T)}))});return Do.releasePrimitive(c),Do.releasePrimitive(u),f}intersectsBox(e,t){return lc.set(e.min,e.max,t),lc.needsUpdate=!0,this.shapecast({intersectsBounds:r=>lc.intersectsBox(r),intersectsTriangle:r=>lc.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(),lc.set(e.boundingBox.min,e.boundingBox.max,t),lc.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=fv,d=Oue,g=null,m=null;i&&(g=Nue,m=kue);let y=1/0,w=null,x=null;return Ku.copy(t).invert(),Jd.matrix.copy(Ku),this.shapecast({boundsTraverseOrder:_=>lc.distanceToBox(_),intersectsBounds:(_,C,T)=>T{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:T=>Jd.distanceToBox(T),intersectsBounds:(T,b,M)=>M{for(let M=T*3,D=(T+b)*3;M(qd.copy(e).clamp(c.min,c.max),qd.distanceToSquared(e)),intersectsBounds:(c,u,f)=>f{c.closestPointToPoint(e,qd);const f=e.distanceToSquared(qd);return f{$o(0,new Float32Array(r),GP),e.union(GP)}),e}}const $b=new fg,VP=new We,Que=Cn.prototype.raycast;function Hue(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;VP.copy(this.matrixWorld).invert(),$b.copy(n.ray).applyMatrix4(VP);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const r=HP(t.raycastFirst($b,this.material),this,n);r&&e.push(r)}else{const r=t.raycast($b,this.material);for(let i=0,s=r.length;i{const e=n.attributes.position,t=n.index,r=new Ji,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&&cy(n.userData.cancelMesh))},Q6=n=>{var e,t;n.userData.cullingClone&&(cy(n.userData.cullingClone),n.userData.cullingClone=null,cy(n.userData.cullingCloneP),n.userData.cullingCloneP=null,cy(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))},$ue=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=[];Up=n[0].parent,Up.lines!=null&&(Up.lines.forEach(i=>{i.visible=!1}),Up.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=Xue(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=Wue,a.userData.cancelMesh=o,a.material=Kue,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)})},Zue=n=>{let e=Vue,t=jue;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},Jue=(n,e,t,r,i,s,o=!1)=>{const a=[],l=Zue(s);let A=l[0],c=l[1];hv.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&&que(Zb,ep.clone().multiplyScalar(-1),hv.far,16711680,Up)}}}const u=new Uint32Array(a);return new lt(u,1,!1)};function que(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 Kt().setFromPoints(o),l=[];l.push(new ke(0)),l.push(new ke(16777215));let A=new Cl({color:r});var c=new qh(a,A);c.renderOrder=100,i.add(c),i.lines.push(c)}class mT{constructor(e,t){kt(this,"width");kt(this,"height");kt(this,"cameraRTT",null);kt(this,"sceneRTT",null);kt(this,"material",null);kt(this,"quad",null);kt(this,"renderer",null);kt(this,"rtTexture",null);this.width=e,this.height=t}render(e,t,r,i,s,o,a=!0){var c;if(e||(e=mT.createSolidColorTexture(r,i,s)),this.renderer==null){this.sceneRTT=new fw,this.cameraRTT=new Zh(-i/2,i/2,s/2,-s/2,-1e4,1e4),this.cameraRTT.position.z=100,this.sceneRTT.add(this.cameraRTT),this.material=new Mi({side:hi,transparent:!0,opacity:1,color:new ke(1,1,1)});const u=new iu(1,1);this.quad=new Cn(u,this.material),this.quad.scale.set(i,s,1),this.sceneRTT.add(this.quad),this.renderer=new dg,this.renderer.setPixelRatio(1),this.renderer.setSize(i,s),this.renderer.autoClear=!1}else this.cameraRTT&&(this.cameraRTT.left=-i/2,this.cameraRTT.right=i/2,this.cameraRTT.top=s/2,this.cameraRTT.bottom=-s/2,this.cameraRTT.updateProjectionMatrix()),(c=this.quad)==null||c.scale.set(i,s,1),this.renderer.setSize(i,s);this.rtTexture=new da(i,s),"encoding"in this.rtTexture.texture?this.rtTexture.texture.encoding=a?wt:FF:"colorSpace"in this.rtTexture.texture&&(this.rtTexture.texture.colorSpace=a?mo:FF),this.material&&(this.material.map=e,this.material.color=t.clone()),this.renderer.setClearColor(r.clone(),o?0:1),this.renderer.setRenderTarget(this.rtTexture),this.renderer.clear(),this.sceneRTT&&this.cameraRTT&&this.renderer.render(this.sceneRTT,this.cameraRTT);let l=new Uint8ClampedArray(this.rtTexture.width*this.rtTexture.height*4);return this.renderer.readRenderTargetPixels(this.rtTexture,0,0,i,s,l),new ImageData(l,i,s)}destroy(){var e,t;this.cameraRTT=null,(e=this.sceneRTT)==null||e.clear(),this.sceneRTT=null,this.material=null,this.quad=null,(t=this.renderer)==null||t.dispose(),this.renderer=null,this.rtTexture=null}static createSolidColorTexture(e,t,r){const i=t*r,s=new Uint8Array(4*i),o=Math.floor(e.r*255),a=Math.floor(e.g*255),l=Math.floor(e.b*255);for(let c=0;ctypeof window>"u"?await nfe({meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s}):await rfe({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o}),nfe=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(T=>{const b=T.material;let M=a.find(D=>D.material===b);if(!M)a.push({material:b,mesh:T});else{const{dest:D}=$x({meshes:[M.mesh,T]});M.mesh.geometry=D}});const l=Object.fromEntries(o.map(T=>[T,H6({width:s,height:s,transparent:i})])),A=Math.floor(Math.sqrt(n.length)+1),c=s/A,u=new Map(a.map((T,b)=>{const M=new Ye(b%A,Math.floor(b/A)).multiplyScalar(1/A),D=new Ye(M.x+1/A,M.y+1/A);return[T.mesh,{min:M,max:D}]})),f={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},h=[],p=[];a.forEach(T=>{const{min:b,max:M}=u.get(T.mesh);p.push(M),h.push(b)});const d=new Ye(Math.max(...p.map(T=>T.x)),Math.max(...p.map(T=>T.y))),g=new Ye(Math.min(...h.map(T=>T.x)),Math.min(...h.map(T=>T.y))),m=1/(d.x-g.x),y=1/(d.y-g.y),w=c*m,x=c*y,_=new Map(a.map(T=>{let{min:b,max:M}=u.get(T.mesh);return b.x=b.x*m,b.y=b.y*y,M.x=M.x*m,M.y=M.y*y,[T.mesh,{min:b,max:M}]}));a.forEach(T=>{const{material:b,mesh:M}=T,{min:D,max:Y}=_.get(M);o.forEach(B=>{const F=l[B];F.globalCompositeOperation="source-over";let P=PC(b,f[B].find(O=>PC(b,O)));if(P!==""&&P!==void 0)try{const O=new Uint8ClampedArray(P.data),z=new ImageData(O,w,x),K=document.createElement("canvas");K.width=w,K.height=x;const Q=K.getContext("2d");Q.putImageData(z,0,0),Q.save(),F.drawImage(K,D.x*s,D.y*s,w,x)}catch(O){console.error("error",O)}else F.fillStyle=B==="diffuse"?`#${b.color.clone().getHexString()}`:B==="normal"?"#8080ff":B==="orm"?`#${new ke(b.aoMapIntensity,b.roughness,b.metalness).getHexString()}`:"#7F7F7F",F.fillRect(D.x*s,D.y*s,w,x)});const H=M.geometry,I=H.attributes.uv;if(I)for(let B=0;B{const b=new Hn(l[T].canvas);return b.flipY=!1,[T,b]})));return{bakeObjects:a,textures:C,uvs:_}},rfe=async({backColor:n,meshes:e,atlasSize:t,mtoon:r,transparentMaterial:i,transparentTexture:s,twoSidedMaterial:o})=>{const a=t,l=r?["diffuse"]:["diffuse","orm","normal"],A=[];let c=null;e.forEach(B=>{B=B.clone();const F=B.material.length==null?B.material:B.material[0];r&&c==null&&F.type=="ShaderMaterial"&&(c=F.clone());let P=A.find(O=>{O.material});if(!P)A.push({material:F,mesh:B});else{const{dest:O}=$x({meshes:[P.mesh,B]});P.mesh.geometry=O}});const u=Object.fromEntries(l.map(B=>[B,H6({width:a,height:a,transparent:s&&B=="diffuse"})])),f=Math.floor(Math.sqrt(e.length)+1),h=a/f,p=new Map(A.map((B,F)=>{const P=new Ye(F%f,Math.floor(F/f)).multiplyScalar(1/f),O=new Ye(P.x+1/f,P.y+1/f);return[B.mesh,{min:P,max:O}]})),d={diffuse:["map"],normal:["normalMap"],orm:["ormMap","aoMap","roughnessMap","metalnessMap"]},g=[],m=[];A.forEach(B=>{const{min:F,max:P}=p.get(B.mesh);m.push(P),g.push(F)});const y=new Ye(Math.max(...m.map(B=>B.x)),Math.max(...m.map(B=>B.y))),w=new Ye(Math.min(...g.map(B=>B.x)),Math.min(...g.map(B=>B.y))),x=1/(y.x-w.x),_=1/(y.y-w.y),C=h*x,T=h*_,b=new Map(A.map(B=>{let{min:F,max:P}=p.get(B.mesh);return F.x=F.x*x,F.y=F.y*_,P.x=P.x*x,P.y=P.y*_,[B.mesh,{min:F,max:P}]}));let M=!1;const D=new mT(a,a);A.forEach(B=>{const{material:F,mesh:P}=B,{min:O,max:z}=b.get(P);l.forEach(G=>{var de;const ee=u[G];ee.globalCompositeOperation="source-over";let U,X=new ke(1,1,1);switch(G){case"diffuse":U=F.color||n,(de=F.uniforms)!=null&&de.litFactor?X=F.uniforms.litFactor.value:X=F.color;break;case"normal":U=new ke(8421631);break;case"orm":U=new ke(0,F.roughness,F.metalness);break;default:U=new ke(1,1,1);break}let ae=efe(F,d[G].find(se=>PC(F,se)));M==!1&&G=="normal"&&ae!=null&&(M=!0);const oe=D.render(ae,X,U,a,a,G=="diffuse"&&s,G!="normal");createImageBitmap(oe).then(se=>ee.drawImage(se,O.x*a,O.y*a,C,T))});const K=P.geometry.clone();P.geometry=K;const Q=K.attributes.uv.clone();if(K.attributes.uv=Q,Q)for(let G=0;G{const F=new Hn(u[B].canvas);return F.flipY=!1,[B,F]}))),H=o?hi:As;let I;const v=i?"transparent":"opaque";return r?(I=new Oh({map:Y.diffuse,transparent:i,side:H}),c==null&&(c=new E6),c.side=H,c.uniforms.map=Y.diffuse,c.uniforms.shadeMultiplyTexture=Y.diffuse,c.transparent=i,s&&!i&&(I.alphaTest=.5,c.alphaTest=.5),I.userData.vrmMaterial=c,I.userData.shadeTexture=Y.uniformColor,I.name="mToon_"+v,I.map.name=I.name):(I=new Oh({map:Y.diffuse,roughnessMap:Y.orm,metalnessMap:Y.orm,normalMap:M?Y.normal:null,transparent:i,side:H}),s&&!i&&(I.alphaTest=.5),I.name="standard_"+v,I.roughnessMap!=null&&(I.roughnessMap.name=I.name+"_orm"),I.normalMap!=null&&(I.normalMap.name=I.name+"_normal")),{bakeObjects:A,material:I}};function z6(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 YA(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function G6(n,e){const t=new Map;new Z(-1,1,-1),new We,new Z;let r=0;n.forEach(l=>{if(l.skeleton){var A=z6(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 YA(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 ife(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 sfe(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 Iw(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function lfe(n,e,t){const{scale:r,isVrm0:i,mergeAppliedMorphs:s}=t,o=[],a=[],l=Qh(n,"SkinnedMesh"),A=W6(e),c=j6(e).map(h=>h.id);l.forEach(h=>{const p=h.clone();o.push(p),Array.isArray(h.material)?a.push(...h.material):a.push(h.material)});const u=G6(o,r),f=new It;return f.name="AvatarRoot",o.forEach(h=>{var Y,H;const p=new Kt,d={};for(const I in h.geometry.attributes){const v=h.geometry.attributes[I];d[I]=v.clone()}const g={merge:new Set,keep:new Set(A),remove:new Set};if(s){if(!h.morphTargetDictionary||!h.morphTargetInfluences)return;c.forEach(I=>{const v=h.morphTargetDictionary[I];if(v!==void 0&&h.morphTargetInfluences[v]>0)g.merge.add(I);else return g.remove.add(I),null})}if((Y=h.userData)!=null&&Y.isVRM0)for(let I=0;I[I,I.morphTargetDictionary||{}])),morphTargetInfluences:new Map(l.map(I=>[I,I.morphTargetInfluences||[]])),index:null,animations:{}},{dest:y,destMorphToMerge:w}=$x({meshes:[h],scale:r,morphTargetsProcess:g},i);if(i)for(let I=0;Ih.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;hv.id);for(const v in b){const B=b[v],F=B.meshArray;if(F.length>0){const{bakeObjects:P,material:O}=await tfe({transparentColor:r,atlasSize:B.size,meshes:F,mtoon:B.isMtoon,transparentMaterial:B.transparentMaterial,transparentTexture:_,twoSidedMaterial:h}),z=P.map(ae=>ae.mesh),K=[],Q={merge:new Set,keep:new Set(Object.keys(M)),remove:new Set};z.forEach(ae=>{if(ae.type=="Mesh"&&(ae=cfe(T,ae)),K.push(ae),c){if(!ae.morphTargetDictionary||!ae.morphTargetInfluences)return;D.forEach(L=>{const ue=ae.morphTargetDictionary[L];if(ue!==void 0&&ae.morphTargetInfluences[ue]>0)Q.merge.add(L);else return Q.remove.add(L),null})}const oe=ae.geometry,de=oe.index.array,se=V6(ae.geometry.index.array),pe=[];for(let L=0;L{const oe=X.morphTargetDictionary[ae];oe!==void 0&&(X.userData.bindMorphs.new[ae]={index:oe,primitives:[X.id]})}),C.userData.atlasMaterial.push(O)}}const Y=(I=Object.values(e).find(v=>{var B;return(B=v==null?void 0:v.vrm)==null?void 0:B.expressionManager}))==null?void 0:I.vrm.expressionManager;return C.userData.expressionManagerToClone=Y,C.add(T.bones[0]),C}function j6(n){var t;return((t=Object.values(n).filter(r=>r)[0])==null?void 0:t.traitInfo.manifestData.getAllBlendShapeTraits())||[]}function W6(n){const e=Object.values(n).map(i=>i==null?void 0:i.vrm).filter(i=>!!i).map(i=>{var s;return(s=i.expressionManager)==null?void 0:s.expressionMap}),t={};let r=[];for(const i of e)if(i)for(const s of Object.values(i)){if(r.includes(s.expressionName))continue;r.push(s.expressionName);const o=s._binds;!o||o.length==0||o.forEach(a=>{function l(c){const f=a.primitives.map(h=>h.morphTargetDictionary).filter(h=>!!h).find(h=>Object.values(h).includes(c));if(f)return Object.entries(f).find(([,h])=>h==c)}const A=l(a.index);A&&(t[A[0]]={index:A[1],primitives:a.primitives.map(c=>c.id)})})}return t}function WP({meshes:n,sourceMorphTargetDictionaries:e,destMorphTargetDictionary:t}){const r=[];return Object.entries(t).map(([i,s])=>{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function ffe({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]=XH(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function KP(n){const{sourceMorphTargetDictionaries:e,morphTargetsProcess:t}=n,r=new Set;Array.from(e.values()).forEach(o=>{Object.keys(o).forEach(a=>{if(!t)r.add(a);else{if(t.remove.has(a)||t.merge.has(a))return;t.keep.has(a)&&r.add(a)}})});const s={};return Array.from(r.keys()).map((o,a)=>{s[o]=a}),s}function YP({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 lt(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 h;if(i+=f.geometry.attributes.uv.count,(h=f.userData)!=null&&h.isVRM0)for(let p=0;p[f,f.geometry.attributes])),morphAttributes:new Map(n.map(f=>[f,f.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(f=>[f,f.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(f=>[f,f.morphTargetInfluences||[]]))},o={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};o.attributes=ffe({sourceAttributes:s.attributes});const a=KP({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:(t==null?void 0:t.remove)||new Set,keep:(t==null?void 0:t.keep)||new Set,merge:(t==null?void 0:t.merge)||new Set}});o.morphTargetDictionary=a,o.morphAttributes=YP({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a,scale:e},r),o.morphTargetInfluences=WP({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a}),o.index=hfe({meshes:n});const l={morphAttributes:{},morphTargetDictionaries:{},morphTargetInfluences:null};let A=new Set((t==null?void 0:t.keep)||[]);t==null||t.merge.forEach(f=>{A.add(f)});const c=KP({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:new Set,keep:A,merge:new Set}});l.morphAttributes=YP({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:c,scale:e},r);const u=WP({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:c});return l.morphTargetInfluences=u,l.morphTargetDictionaries=c,o.animations={},{source:s,dest:o,destMorphToMerge:l}}function ut(n){return n==null?[]:Array.isArray(n)?n:[n]}function dfe(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function pfe(n,e){const r=await new ou().load(e);r.encoding=wt,r.flipY=!1,n.traverse(i=>{if(i instanceof Cn){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)})}}$ue(e)};function mfe(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var A;const l=ut(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 gfe(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{ut(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 XP(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function vfe(n,e){if(n.data!=null)return n.data[e]}function yfe(n){const e=vfe(n,"cullingMeshes");e&&(e.forEach(t=>{Q6(t)}),n.data.cullingMeshes=null)}function bn(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 wfe(n){const e=n.scene;yfe(n),e.traverse(t=>{t.material&&DC(t.material),t.geometry&&(Q6(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),wg.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&&DC(i.material)})})});for(const t in n)n[t]=null}const DC=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)},K6=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},xfe=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 Vm)h=h.charAt(0).toLowerCase()+h.slice(1),(f=e[h])!=null&&f.node&&(e[h].node.name=h)};function Y6({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),Y6({candidates:n,predicate:e}))}function X6(n,e){return Y6({candidates:[n],predicate:t=>t.name===e})}function $6({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),$6({candidates:n,predicate:e,results:t})}function Qh(n,e){return $6({candidates:[n],predicate:t=>ut(e).includes(t.type)})}function _fe(n,e){if(!n.morphTargetDictionary)return!1;for(const t of Object.keys(n.morphTargetDictionary))if(e[t])return!0;return!1}const bfe={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 Z6(n,e,t){var d;const r=Kc.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],_=bfe[w],C=e.getObjectByName(w);if(_!=null){const T=y[1];if(C.getWorldQuaternion(s).invert(),C.parent.getWorldQuaternion(o),m instanceof pa){for(let b=0;b{m.values[Y+b]=D})}i.push(new pa(`${_}.${T}`,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 DA){const b=m.values.map((M,D)=>{var Y;return(((Y=t.meta)==null?void 0:Y.metaVersion)==="0"&&D%3!==1?-M:M)*h});i.push(new DA(`${_}.${T}`,m.times,b))}}}),new Kc("vrmAnimation",r.duration,i)}const Bfe=new Fre,Efe=new $H,qb=.2,Cfe=n=>Math.floor(Math.random()*n);class $P{constructor(e,t,r,i,s,o,a){var l,A,c,u;this.mixer=new Rne(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=Z6(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 Mfe{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!=""?"/":"")+ut(e)[0];o=o==""?cl(a):o,this.currentAnimationName=o;const A=await(i?Bfe:Efe).loadAsync(a);A.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(A.animations);const c=Kc.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 $P(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=ut(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=ut(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=Cfe(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-qb)},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*qb):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*qb):this.weightOut=0)}}const Sfe={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` + */var er;(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"})(er||(er={}));const Mw="blend_",IP="vrmColliderSphere";class oue{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((oe,pe,xe)=>xe.findIndex(_e=>_e.name===oe.name.replace(" (Outline)",""))===pe).map(oe=>oe),p=h.map(oe=>oe.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(oe=>oe.map).map(oe=>{if(!oe.map)throw new Error(oe.name+" map is null");return{name:oe.name,imageBitmap:oe.map.image}}),m=h.filter(oe=>oe.userData.shadeTexture).map(oe=>{if(!oe.userData.shadeTexture)throw new Error(oe.userData.shadeTexture+" map is null");return{name:oe.name+"_shade",imageBitmap:oe.userData.shadeTexture.image}}),y=g.concat(m),w=uue(y,d),x=fue(w),_=hue(w),B=cue(h,y),T=t.children.filter(oe=>oe.children.length>0&&oe.children[0].type===Ai.Bone)[0],b=D6(T).filter(oe=>oe.name!==IP),M=b.map(oe=>oe.name),O=b.map(oe=>({children:oe.children.filter(pe=>pe.name!==IP).map(pe=>M.indexOf(pe.name)),name:oe.name,rotation:[oe.quaternion.x,oe.quaternion.y,oe.quaternion.z,oe.quaternion.w],scale:[oe.scale.x,oe.scale.y,oe.scale.z],translation:[oe.position.x,oe.position.y,oe.position.z]})),Y=[],H=t.children.filter(oe=>oe.type===Ai.Group||oe.type===Ai.SkinnedMesh),I=[];H.forEach(oe=>{const pe=oe.type===Ai.Group?oe.children[0]:oe,xe=pe.geometry.attributes;I.push(new Da(xe.position,er.FLOAT,Xt.POSITION,uo.VEC3,pe.name,void 0)),I.push(new Da(xe.normal,er.FLOAT,Xt.NORMAL,uo.VEC3,pe.name,void 0)),I.push(new Da(xe.uv,er.FLOAT,Xt.UV,uo.VEC2,pe.name,void 0)),I.push(new Da(xe.skinWeight,er.FLOAT,Xt.SKIN_WEIGHT,uo.VEC4,pe.name,void 0)),I.push(new Da(xe.skinIndex,er.UNSIGNED_SHORT,Xt.SKIN_INDEX,uo.VEC4,pe.name,void 0)),(oe.type===Ai.Group?oe.children.map(D=>D):[oe]).forEach(D=>{if(!D.geometry.index)throw new Error(D.name+" geometry.index is null");I.push(new Da(D.geometry.index,er.UNSIGNED_INT,Xt.INDEX,uo.SCALAR,pe.name,D.name))}),pe.morphTargetDictionary||(pe.morphTargetDictionary={},pe.morphTargetInfluences=[],pe.geometry.morphAttributes={},pe.updateMorphTargets()),pe.geometry.userData.targetNames=[];for(const D in e.expressionManager.expressionMap){const Ae=e.expressionManager.expressionMap[D],le=Ae._binds.map(J=>({node:b.length,index:J.index,weight:J.weight}));let q=!1;for(const J in Ur)if(D.toLowerCase()===Ur[J].toLowerCase()){l[Ur[J]]={morphTargetBinds:le,isBinary:Ae.isBinary,overrideBlink:Ae.overrideBlink,overrideLookAt:Ae.overrideLookAt,overrideMouth:Ae.overrideMouth},q=!0;break}!q&&D.toLowerCase()==="surprise"&&(l.surprised={morphTargetBinds:le,isBinary:Ae.isBinary,overrideBlink:Ae.overrideBlink,overrideLookAt:Ae.overrideLookAt,overrideMouth:Ae.overrideMouth},q=!0),q===!1&&(A[D]={morphTargetBinds:le,isBinary:Ae.isBinary,overrideBlink:Ae.overrideBlink,overrideLookAt:Ae.overrideLookAt,overrideMouth:Ae.overrideMouth})}for(const D in pe.morphTargetDictionary){pe.geometry.userData.targetNames.push(D);const Ae=pe.morphTargetDictionary[D],le=pe.geometry.morphAttributes;I.push(new Da(le.position[Ae],er.FLOAT,Xt.BLEND_POSITION,uo.VEC3,pe.name,Mw+D)),I.push(new Da(le.normal[Ae],er.FLOAT,Xt.BLEND_NORMAL,uo.VEC3,pe.name,Mw+D))}}),Object.keys(l).length>0&&(c.preset=l),Object.keys(A).length>0&&(c.custom=A),H.forEach(oe=>{const pe=oe.type===Ai.Group?oe.children[0]:oe,xe=new Float32Array(pe.skeleton.boneInverses.map(_e=>_e.elements).flat());I.push(new Da(new lt(xe,16),er.FLOAT,Xt.BIND_MATRIX,uo.MAT4,pe.name,pe.name))}),Y.push(...I.map(oe=>({bufferView:-1,byteOffset:0,componentType:oe.valueType,count:oe.attribute.count,max:oe.max,min:oe.min,normalized:!1,type:oe.accessorsType})));const v=lue(H,I,p);H.forEach((oe,pe)=>{O.push({mesh:pe,name:oe.name,rotation:[oe.quaternion.x,oe.quaternion.y,oe.quaternion.z,oe.quaternion.w],scale:[oe.scale.x,oe.scale.y,oe.scale.z],skin:pe,translation:[oe.position.x,oe.position.y,oe.position.z]})});const E=Aue(H,I,M),L={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"},U={humanBones:{}};for(const oe in s.humanBones)U.humanBones[oe]={node:M.indexOf(s.humanBones[oe].node.name)};const P=o,z=[];z.push(...y.map(oe=>({buffer:RP(oe.imageBitmap),type:Xt.IMAGE}))),z.push(...I.map(oe=>({buffer:oe.buffer,type:oe.type}))),d&&z.push({buffer:RP(d.imageBitmap),type:Xt.IMAGE});let W=0,N=0,C=0;const j=z.map((oe,pe)=>{const xe={buffer:0,byteLength:oe.buffer.byteLength,byteOffset:W,target:oe.type===Xt.IMAGE||oe.type===Xt.BIND_MATRIX?void 0:oe.type===Xt.INDEX?er.ELEMENT_ARRAY_BUFFER:er.ARRAY_BUFFER};return W+=oe.buffer.byteLength,oe.type===Xt.IMAGE?w[N++].bufferView=pe:Y[C++].bufferView=pe,xe}),ee=due(t,O),F={accessors:Y,asset:f,buffers:[{byteLength:W}],bufferViews:j,extensions:{VRMC_vrm:{expressions:c,humanoid:U,lookAt:L,meta:P,specVersion:"1.0"}},extensionsUsed:["KHR_materials_unlit","KHR_texture_transform","VRMC_materials_mtoon","VRMC_vrm"],images:w,materials:B,meshes:v,nodes:O,samplers:x,avatar:0,scenes:ee,skins:E,textures:_},X=new FP(RC(JSON.stringify(F,void 0,2)),"JSON"),ue=new FP(Rp(z.map(oe=>oe.buffer)),"BIN\0"),re=Rp([X.buffer,ue.buffer]),fe=Rp([RC("glTF"),IC(2,4),IC(re.byteLength+12,4)]);i(Rp([fe,re]))}}function D6(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>D6(e)).flat())}function RP(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===er.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===er.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}let FP=class{constructor(e,t){this.data=e,this.type=t;const r=this.data;this.buffer=Rp([IC(r.byteLength,4),RC(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===Xt.POSITION||r===Xt.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 Vf;(function(n){n.MeshBasicMaterial="MeshBasicMaterial",n.MeshStandardMaterial="MeshStandardMaterial",n.MToonMaterial="MToonMaterial"})(Vf||(Vf={}));var uo;(function(n){n.SCALAR="SCALAR",n.VEC2="VEC2",n.VEC3="VEC3",n.VEC4="VEC4",n.MAT4="MAT4"})(uo||(uo={}));var Xt;(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"})(Xt||(Xt={}));var Ai;(function(n){n.Group="Group",n.SkinnedMesh="SkinnedMesh",n.Object3D="Object3D",n.Bone="Bone"})(Ai||(Ai={}));const lue=(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(Xt.SKIN_INDEX),NORMAL:a.indexOf(Xt.NORMAL),POSITION:a.indexOf(Xt.POSITION),TEXCOORD_0:a.indexOf(Xt.UV),WEIGHTS_0:a.indexOf(Xt.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===Xt.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===Xt.BLEND_NORMAL&&c.meshName===i.name?c.name:null).indexOf(Mw+A),POSITION:e.map(c=>c.type===Xt.BLEND_POSITION&&c.meshName===i.name?c.name:null).indexOf(Mw+A)})):void 0}})}}),Aue=(n,e,t)=>n.map(r=>{const i=r.type===Ai.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===Xt.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)}}),cue=(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 Vf.MeshStandardMaterial:return t.metalness;case Vf.MeshBasicMaterial:return 0;default:return 0}})(),l=(()=>{switch(t.type){case Vf.MeshStandardMaterial:return t.roughness;case Vf.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}}}),uue=(n,e)=>(e?n.concat(e):n).filter(t=>t&&t.imageBitmap).map(t=>({bufferView:-1,mimeType:"image/png",name:t.name})),fue=n=>n.map(()=>({magFilter:er.LINEAR,minFilter:er.LINEAR,wrapS:er.REPEAT,wrapT:er.REPEAT})),hue=n=>n.map((e,t)=>({sampler:0,source:t})),due=(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))}]},O6=0,pue=1,N6=2,UP=2,Wb=1.25,LP=1,ly=6*4+4+4,FC=65535,mue=Math.pow(2,-24);class sv{constructor(){}}function $o(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 PP(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 DP(n,e){e.set(n)}function OP(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 ov(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 Zd(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 gue(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 lt(i,1));for(let s=0;si-s);for(let i=0;il&&(l=T),m&&xp&&(p=x);const b=n[y+2],M=n[y+3],O=b-M,Y=b+M;OA&&(A=Y),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 yue(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 wue(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(Ha).fill().map(()=>({count:0,bounds:new Float32Array(6),rightCacheBounds:new Float32Array(6),leftCacheBounds:new Float32Array(6),candidate:0})),av=new Float32Array(6);function _ue(n,e,t,r,i,s){let o=-1,a=0;if(s===O6)o=PP(e),o!==-1&&(a=(e[o]+e[o+3])/2);else if(s===pue)o=PP(n),o!==-1&&(a=bue(t,r,i,o));else if(s===N6){const l=Zd(n);let A=Wb*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)/Ha;if(i=T.candidate?ov(x,t,T.rightCacheBounds):(ov(x,t,T.leftCacheBounds),T.count++)}}for(let x=0;x=Ha&&(B=Ha-1);const T=zl[B];T.count++,ov(w,t,T.bounds)}const m=zl[Ha-1];DP(m.bounds,m.rightCacheBounds);for(let w=Ha-2;w>=0;w--){const x=zl[w],_=zl[w+1];OP(x.bounds,_.rightCacheBounds,x.rightCacheBounds)}let y=0;for(let w=0;wB&&(B=w),x>B&&(B=x);const T=(B-_)/2,b=m*2;s[h+b+0]=_+T,s[h+b+1]=T+(Math.abs(_)+T)*mue,_e[m+3]&&(e[m+3]=B)}}return s}function Eue(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 B=_ue(m.boundingData,x,o,y,w,u);if(B.axis===-1)return t(y+w),m.offset=y,m.count=w,m;const T=wue(a,o,y,w,B);if(T===y||T===y+w)t(y+w),m.offset=y,m.count=w;else{m.splitAxis=B.axis;const b=new sv,M=y,O=T-y;m.left=b,b.boundingData=new Float32Array(6),Kb(o,M,O,b.boundingData,s),r(b,M,O,s,_+1);const Y=new sv,H=T,I=w-O;m.right=Y,Y.boundingData=new Float32Array(6),Kb(o,H,I,Y.boundingData,s),r(Y,H,I,s,_+1)}return m}gue(n,e);const i=new Float32Array(6),s=new Float32Array(6),o=Bue(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=vue(n);if(g.length===1){const m=g[0],y=new sv;y.boundingData=i,yue(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 sv;y.boundingData=new Float32Array(6),Kb(o,m.offset,m.count,y.boundingData,s),r(y,m.offset,m.count,s),d.push(y)}return d}function Cue(n,e){const t=Eue(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 Mue=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}}(),mT=function(){const n=new Ke,e=new Z,t=new Z;return function(i,s,o,a){Mue(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}}}}(),Sue=function(){const n=new Z,e=new Z,t=new $a,r=new Al;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}}(),Tue=1e-15;function Wu(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 ru,this.plane=new $a,this.needsUpdate=!0}intersectsSphere(e){return Sue(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 Al;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]),mT(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 B=0;B<4;B++){const T=y[B],b=w[B];if(r.setFromPoints(b,t),T.isSeparated(r))return!1}const x=h.satBounds,_=h.satAxes;e[0]=this.a,e[1]=this.b,e[2]=this.c;for(let B=0;B<4;B++){const T=x[B],b=_[B];if(r.setFromPoints(b,e),T.isSeparated(r))return!1}for(let B=0;B<4;B++){const T=w[B];for(let b=0;b<4;b++){const M=_[b];if(s.crossVectors(T,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],L=y[(v+1)%3];A.start.copy(E),A.end.copy(L),A.delta(o);const U=w?c.start:c.end,P=Wu(m.distanceToPoint(E));if(Wu(m.normal.dot(o))&&P){c.copy(A),x=2;break}if((m.intersectLine(A,U)||P)&&!Wu(U.distanceTo(L))){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 B=!1,T=0;for(let v=0;v<3;v++){const E=_[v],L=_[(v+1)%3];A.start.copy(E),A.end.copy(L),A.delta(a);const U=B?u.start:u.end,P=Wu(g.distanceToPoint(E));if(Wu(g.normal.dot(a))&&P){u.copy(A),T=2;break}if((g.intersectLine(A,U)||P)&&!Wu(U.distanceTo(L))){if(T++,B)break;B=!0}}if(T===1&&this.containsPoint(u.end))return p&&(p.start.copy(u.end),p.end.copy(u.end)),!0;if(T!==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),O=u.start.dot(o),Y=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 Al,i=new Al;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}}ma.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 Al),t=new Array(12).fill().map(()=>new Al),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 Wo(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 GP(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=Wm(n),p=Km(n,a)):(h=Km(n,a),p=Wm(n));const g=Tw(h,s,r,Sw)?LC(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=Tw(p,s,r,Sw)?LC(p,e,t,r):null;return g&&y?g.distance<=y.distance?g:y:g||y||null}}const Due=function(){let n,e;const t=[],r=new Q6(()=>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,B=SA;for(;!nA(x,_);)w=Wm(w),x=w*2;return uh(w,B)}function h(w){let x=w*2,_=MA,B=SA;for(;!nA(x,_);)w=Km(w,B),x=w*2;return uh(w,B)+jm(x,_)}let p=s*2,d=rd,g=MA,m=SA;if(nA(p,g)){const w=uh(s,m),x=jm(p,g);return $o(s,d,n),l(w,x,!1,u,c+s,n)}else{const w=Wm(s),x=Km(s,m);let _=w,B=x,T,b,M,O;if(A&&(M=n,O=e,$o(_,d,M),$o(B,d,O),T=A(M),b=A(O),bi.intersectsBox(b),intersectsTriangle:b=>{b.a.applyMatrix4(A),b.b.applyMatrix4(A),b.c.applyMatrix4(A),b.needsUpdate=!0;for(let M=_*3,O=(B+_)*3;Mnew _l);class sm{static serialize(e,t={}){if(t.isBufferGeometry)return console.warn("MeshBVH.serialize: The arguments for the function have changed. See documentation for new signature."),sm.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."),sm.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 sm(t,{...r,[Yb]:!0});if(o._roots=s,r.setIndex){const a=t.getIndex();if(a===null){const l=new lt(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:O6,maxDepth:40,maxLeafTris:10,verbose:!0,useSharedArrayBuffer:!1,setBoundingBox:!0,onProgress:null,[Yb]:!1},t),t.useSharedArrayBuffer&&typeof SharedArrayBuffer>"u")throw new Error("MeshBVH: SharedArrayBuffer is not available.");this._roots=null,t[Yb]||(this._roots=Cue(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;fB&&(B=H),IT&&(T=I),v<_&&(_=v),v>b&&(b=v)}return l[f+0]!==w||l[f+1]!==x||l[f+2]!==_||l[f+3]!==B||l[f+4]!==T||l[f+5]!==b?(l[f+0]=w,l[f+1]=x,l[f+2]=_,l[f+3]=B,l[f+4]=T,l[f+5]=b,!0):!1}else{const m=f+8,y=o[f+6],w=m+h,x=y+h;let _=p,B=!1,T=!1;e?_||(B=e.has(w),T=e.has(x),_=!B&&!T):(B=!0,T=!0);const b=_||B,M=_||T;let O=!1;b&&(O=u(m,h,_));let Y=!1;M&&(Y=u(y,h,_));const H=O||Y;if(H)for(let I=0;I<3;I++){const v=m+I,E=y+I,L=l[v],U=l[v+3],P=l[E],z=l[E+3];l[f+I]=Lz?U: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]===FC;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+ly/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=As){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:GP(h,p,i,A,d,g,s)}else l||(A?l=(f,h,p,d)=>GP(f,h,i,A,p,d,s):l=(f,h,p)=>p);let c=!1,u=0;for(const f of this._roots){if(Fp(f),c=Due(0,i,a,l,o,u),uv(),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;Ku.copy(t).invert();const c=Do.getPrimitive(),u=Do.getPrimitive();if(s){let h=function(p,d,g,m,y,w,x,_){for(let B=g,T=g+m;B$b.intersectsBox(h),intersectsRange:(h,p,d,g,m,y)=>(Xb.copy(y),Xb.applyMatrix4(Ku),e.shapecast({intersectsBounds:w=>Xb.intersectsBox(w),intersectsRange:(w,x,_,B,T)=>i(h,p,w,x,g,m,B,T)}))});return Do.releasePrimitive(c),Do.releasePrimitive(u),f}intersectsBox(e,t){return lc.set(e.min,e.max,t),lc.needsUpdate=!0,this.shapecast({intersectsBounds:r=>lc.intersectsBox(r),intersectsTriangle:r=>lc.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(),lc.set(e.boundingBox.min,e.boundingBox.max,t),lc.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=fv,d=Nue,g=null,m=null;i&&(g=kue,m=Que);let y=1/0,w=null,x=null;return Ku.copy(t).invert(),Jd.matrix.copy(Ku),this.shapecast({boundsTraverseOrder:_=>lc.distanceToBox(_),intersectsBounds:(_,B,T)=>T{if(e.boundsTree)return e.boundsTree.shapecast({boundsTraverseOrder:T=>Jd.distanceToBox(T),intersectsBounds:(T,b,M)=>M{for(let M=T*3,O=(T+b)*3;M(qd.copy(e).clamp(c.min,c.max),qd.distanceToSquared(e)),intersectsBounds:(c,u,f)=>f{c.closestPointToPoint(e,qd);const f=e.distanceToSquared(qd);return f{$o(0,new Float32Array(r),VP),e.union(VP)}),e}}const Zb=new fg,jP=new We,Hue=Cn.prototype.raycast;function zue(n,e){if(this.geometry.boundsTree){if(this.material===void 0)return;jP.copy(this.matrixWorld).invert(),Zb.copy(n.ray).applyMatrix4(jP);const t=this.geometry.boundsTree;if(n.firstHitOnly===!0){const r=zP(t.raycastFirst(Zb,this.material),this,n);r&&e.push(r)}else{const r=t.raycast(Zb,this.material);for(let i=0,s=r.length;i{const e=n.attributes.position,t=n.index,r=new Ji,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&&cy(n.userData.cancelMesh))},H6=n=>{var e,t;n.userData.cullingClone&&(cy(n.userData.cullingClone),n.userData.cullingClone=null,cy(n.userData.cullingCloneP),n.userData.cullingCloneP=null,cy(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))},Zue=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=[];Up=n[0].parent,Up.lines!=null&&(Up.lines.forEach(i=>{i.visible=!1}),Up.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=$ue(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=Kue,a.userData.cancelMesh=o,a.material=Yue,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)})},Jue=n=>{let e=jue,t=Wue;return n&&(isNaN(n)?Array.isArray(n)&&(isNaN(n[0])||(e=n[0]),isNaN(n[1])||(t=n[1])):e=n),[e,t]},que=(n,e,t,r,i,s,o=!1)=>{const a=[],l=Jue(s);let A=l[0],c=l[1];hv.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&&efe(Jb,ep.clone().multiplyScalar(-1),hv.far,16711680,Up)}}}const u=new Uint32Array(a);return new lt(u,1,!1)};function efe(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 Kt().setFromPoints(o),l=[];l.push(new ke(0)),l.push(new ke(16777215));let A=new Cl({color:r});var c=new qh(a,A);c.renderOrder=100,i.add(c),i.lines.push(c)}function tfe(n,e=10){if(n<=0)return[];const t=n,r=[{w:e,h:e,x:0,y:0}];function i(o,a,l,A){if(a<=0)return;const c=o.w/2,u=[{w:c,h:c,x:l,y:A},{w:c,h:c,x:l+c,y:A},{w:c,h:c,x:l,y:A+c},{w:c,h:c,x:l+c,y:A+c}];r.push(...u);const f=r.find(m=>m.x===l&&m.y===A&&m.w===o.w&&m.h===o.h);if(r.splice(r.indexOf(f),1),n<=r.length)return;const h=Math.max(...r.map(m=>m.w)),p=r.find(m=>m.w===h),d=p.x,g=p.y;i({w:p.w,h:p.h},a-1,d,g)}if(n==1)return{squares:r,fill:1};for(i({w:e,h:e},t,0,0),r.sort((o,a)=>a.w-o.w);r.length>n;)r.pop();const s=r.reduce((o,a)=>o+a.w*a.h,0)/(e*e);return{squares:r,fill:s}}class gT{constructor(e,t){kt(this,"width");kt(this,"height");kt(this,"cameraRTT",null);kt(this,"sceneRTT",null);kt(this,"material",null);kt(this,"quad",null);kt(this,"renderer",null);kt(this,"rtTexture",null);this.width=e,this.height=t}render(e,t,r,i,s,o,a=!0){var c;if(e||(e=gT.createSolidColorTexture(r,i,s)),this.renderer==null){this.sceneRTT=new fw,this.cameraRTT=new Zh(-i/2,i/2,s/2,-s/2,-1e4,1e4),this.cameraRTT.position.z=100,this.sceneRTT.add(this.cameraRTT),this.material=new Mi({side:hi,transparent:!0,opacity:1,color:new ke(1,1,1)});const u=new iu(1,1);this.quad=new Cn(u,this.material),this.quad.scale.set(i,s,1),this.sceneRTT.add(this.quad),this.renderer=new dg,this.renderer.setPixelRatio(1),this.renderer.setSize(i,s),this.renderer.autoClear=!1}else this.cameraRTT&&(this.cameraRTT.left=-i/2,this.cameraRTT.right=i/2,this.cameraRTT.top=s/2,this.cameraRTT.bottom=-s/2,this.cameraRTT.updateProjectionMatrix()),(c=this.quad)==null||c.scale.set(i,s,1),this.renderer.setSize(i,s);this.rtTexture=new da(i,s),"encoding"in this.rtTexture.texture?this.rtTexture.texture.encoding=a?wt:UF:"colorSpace"in this.rtTexture.texture&&(this.rtTexture.texture.colorSpace=a?mo:UF),this.material&&(this.material.map=e,this.material.color=t.clone()),this.renderer.setClearColor(r.clone(),o?0:1),this.renderer.setRenderTarget(this.rtTexture),this.renderer.clear(),this.sceneRTT&&this.cameraRTT&&this.renderer.render(this.sceneRTT,this.cameraRTT);let l=new Uint8ClampedArray(this.rtTexture.width*this.rtTexture.height*4);return this.renderer.readRenderTargetPixels(this.rtTexture,0,0,i,s,l),new ImageData(l,i,s)}destroy(){var e,t;this.cameraRTT=null,(e=this.sceneRTT)==null||e.clear(),this.sceneRTT=null,this.material=null,this.quad=null,(t=this.renderer)==null||t.dispose(),this.renderer=null,this.rtTexture=null}static createSolidColorTexture(e,t,r){const i=t*r,s=new Uint8Array(4*i),o=Math.floor(e.r*255),a=Math.floor(e.g*255),l=Math.floor(e.b*255);for(let c=0;ctypeof window>"u"?await ife({meshes:e,atlasSize:r,mtoon:i,transparentMaterial:s,transparentTexture:o}):await sfe({backColor:n,meshes:e,atlasSize:r,mtoon:i,includeNonTexturedMeshesInAtlas:t,transparentMaterial:s,transparentTexture:o,twoSidedMaterial:a}),ife=async({meshes:n,atlasSize:e,mtoon:t,transparentMaterial:r,transparentTexture:i})=>{const s=e,o=["diffuse"],a=[];n.forEach(B=>{const T=B.material;let b=a.find(M=>M.material===T);if(!b)a.push({material:T,mesh:B});else{const{dest:M}=Zx({meshes:[b.mesh,B]});b.mesh.geometry=M}});const l=Object.fromEntries(o.map(B=>[B,z6({width:s,height:s,transparent:i})])),A=Math.floor(Math.sqrt(n.length)+1),c=s/A,u=new Map(a.map((B,T)=>{const b=new Ke(T%A,Math.floor(T/A)).multiplyScalar(1/A),M=new Ke(b.x+1/A,b.y+1/A);return[B.mesh,{min:b,max:M}]})),f=[],h=[];a.forEach(B=>{const{min:T,max:b}=u.get(B.mesh);h.push(b),f.push(T)});const p=new Ke(Math.max(...h.map(B=>B.x)),Math.max(...h.map(B=>B.y))),d=new Ke(Math.min(...f.map(B=>B.x)),Math.min(...f.map(B=>B.y))),g=1/(p.x-d.x),m=1/(p.y-d.y),y=c*g,w=c*m,x=new Map(a.map(B=>{let{min:T,max:b}=u.get(B.mesh);return T.x=T.x*g,T.y=T.y*m,b.x=b.x*g,b.y=b.y*m,[B.mesh,{min:T,max:b}]}));a.forEach(B=>{const{material:T,mesh:b}=B,{min:M,max:O}=x.get(b);o.forEach(v=>{const E=l[v];E.globalCompositeOperation="source-over";let L=Iw(T,DC[v].find(U=>Iw(T,U)));if(L!==""&&L!==void 0)try{const U=new Uint8ClampedArray(L.data),P=new ImageData(U,y,w),z=document.createElement("canvas");z.width=y,z.height=w;const W=z.getContext("2d");W.putImageData(P,0,0),W.save(),E.drawImage(z,M.x*s,M.y*s,y,w)}catch(U){console.error("error",U)}else E.fillStyle=v==="diffuse"?`#${T.color.clone().getHexString()}`:v==="normal"?"#8080ff":v==="orm"?`#${new ke(T.aoMapIntensity,T.roughness,T.metalness).getHexString()}`:"#7F7F7F",E.fillRect(M.x*s,M.y*s,y,w)});const Y=b.geometry,H=Y.attributes.uv;if(H)for(let v=0;v{const T=new Hn(l[B].canvas);return T.flipY=!1,[B,T]})));return{bakeObjects:a,textures:_,uvs:x}},sfe=async({backColor:n,includeNonTexturedMeshesInAtlas:e=!1,meshes:t,atlasSize:r,mtoon:i,transparentMaterial:s,transparentTexture:o,twoSidedMaterial:a})=>{const l=r,A=i?["diffuse"]:["diffuse","orm","normal"],c=[];let u=null;t.forEach(U=>{U=U.clone();const P=U.material.length==null?U.material:U.material[0];i&&u==null&&P.type=="ShaderMaterial"&&(u=P.clone());let z=c.find(W=>{W.material});if(!z)c.push({material:P,mesh:U});else{const{dest:W}=Zx({meshes:[z.mesh,U]});z.mesh.geometry=W}});const f=Object.fromEntries(A.map(U=>[U,z6({width:l,height:l,transparent:o&&U=="diffuse"})])),h=new Set,p=new Map,d=c.map(U=>{const P=U.mesh.geometry;if(e==!1){if(!U.mesh.visible)return h.add(U.mesh),[U.mesh,0];let z=!0;for(const W of A)for(const N of DC[W])if(Iw(U.material,N)&&z){z=!1;break}if(z){const W=U.material;if(W instanceof gr)return[U.mesh,2];if(p.size==0)return p.set(W,[U.mesh]),[U.mesh,1];for(let[N,C]of Array.from(p.entries()))if((()=>N.color.r.toFixed(5)==W.color.r.toFixed(5)&&N.color.g.toFixed(5)==W.color.g.toFixed(5)&&N.color.b.toFixed(5)==W.color.b.toFixed(5)&&N.emissive.equals(W.emissive)&&N.aoMapIntensity==W.aoMapIntensity&&N.metalness==W.metalness&&N.normalScale.equals(W.normalScale)&&N.roughness==W.roughness&&N.transparent==W.transparent&&N.vertexColors==W.vertexColors)())return C.push(U.mesh),[U.mesh,0];return p.set(W,[U.mesh]),[U.mesh,1]}}return[U.mesh,P.index?P.index.count/3:P.attributes.position.count/3]}).sort((U,P)=>P[1]-U[1]),g=d.filter(([,U])=>U!=0),{squares:m,fill:y}=tfe(g.length,l);console.log("squaresplit",y);const w=m.map(U=>({x:U.x,y:U.y,width:U.w,height:U.h})),x=new Map(w.map((U,P)=>[d[P][0],U]));p.forEach(U=>{if(U.length>1){const P=x.get(U[0]);U.forEach(z=>{x.set(z,P)})}});const _=new Map(Array.from(x.entries()).map(([U,P])=>{const z=new Ke(P.x,P.y),W=new Ke(P.x+P.width,P.y+P.height);return[U,{min:z,max:W}]})),B=[];Array.from(x.keys()).forEach(U=>{if(h.has(U))return;const{min:P,max:z}=_.get(U);B.push(P)});const T=new Ke(Math.min(...B.map(U=>U.x)),Math.min(...B.map(U=>U.y))),b=1/(l-T.x),M=1/(l-T.y),O=new Map(Array.from(x.keys()).map(U=>{if(h.has(U))return;let{min:P,max:z}=_.get(U);return P.x=P.x*b,P.y=P.y*M,z.x=z.x*b,z.y=z.y*M,[U,{min:P,max:z}]}).filter(U=>U));let Y=!1;const H=new gT(l,l);Array.from(x.keys()).forEach(U=>{const P=c.find(X=>X.mesh===U),{material:z}=P;let W,N;const C=O.get(U);if(C?(W=C.min,N=C.max):(W=new Ke(0,0),N=new Ke(0,0)),!h.has(P.mesh)){const X=x.get(U).width,ue=x.get(U).height;A.forEach(re=>{var D;const fe=f[re];fe.globalCompositeOperation="source-over";let oe,pe=new ke(1,1,1);switch(re){case"diffuse":oe=z.color||n,(D=z.uniforms)!=null&&D.litFactor?pe=z.uniforms.litFactor.value:pe=z.color;break;case"normal":oe=new ke(8421631);break;case"orm":oe=new ke(0,z.roughness,z.metalness);break;default:oe=new ke(1,1,1);break}let xe=nfe(z,DC[re].find(Ae=>Iw(z,Ae)));Y==!1&&re=="normal"&&xe!=null&&(Y=!0);const _e=H.render(xe,pe,oe,l,l,re=="diffuse"&&o,re!="normal");createImageBitmap(_e).then(Ae=>fe.drawImage(Ae,W.x*l,W.y*l,X,ue))})}const j=U.geometry.clone();U.geometry=j;const ee=j.attributes.uv.clone();if(j.attributes.uv=ee,ee)for(let X=0;X{const P=new Hn(f[U].canvas);return P.flipY=!1,[U,P]}))),v=a?hi:As;let E;const L=s?"transparent":"opaque";return i?(E=new Oh({map:I.diffuse,transparent:s,side:v}),u==null&&(u=new C6),u.side=v,u.uniforms.map=I.diffuse,u.uniforms.shadeMultiplyTexture=I.diffuse,u.transparent=s,o&&!s&&(E.alphaTest=.5,u.alphaTest=.5),E.userData.vrmMaterial=u,E.userData.shadeTexture=I.uniformColor,E.name="mToon_"+L,E.map.name=E.name):(E=new Oh({map:I.diffuse,roughnessMap:I.orm,metalnessMap:I.orm,normalMap:Y?I.normal:null,transparent:s,side:v}),o&&!s&&(E.alphaTest=.5),E.name="standard_"+L,E.roughnessMap!=null&&(E.roughnessMap.name=E.name+"_orm"),E.normalMap!=null&&(E.normalMap.name=E.name+"_normal")),{bakeObjects:c,material:E}};function G6(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 YA(n.skeleton.bones.map(r=>e.get(r)));return t.boneInverses=n.skeleton.boneInverses,t.pose(),t}function V6(n,e){const t=new Map;new Z(-1,1,-1),new We,new Z;let r=0;n.forEach(l=>{if(l.skeleton){var A=G6(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 YA(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 ofe(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 afe(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 Rw(n,e){const t=[];for(let s=0;ss.name===r.name);return i?t.bones.indexOf(i):-1}async function cfe(n,e,t){const{scale:r,isVrm0:i,mergeAppliedMorphs:s}=t,o=[],a=[],l=Qh(n,"SkinnedMesh"),A=K6(e),c=W6(e).map(h=>h.id);l.forEach(h=>{const p=h.clone();o.push(p),Array.isArray(h.material)?a.push(...h.material):a.push(h.material)});const u=V6(o,r),f=new It;return f.name="AvatarRoot",o.forEach(h=>{var Y,H;const p=new Kt,d={};for(const I in h.geometry.attributes){const v=h.geometry.attributes[I];d[I]=v.clone()}const g={merge:new Set,keep:new Set(A),remove:new Set};if(s){if(!h.morphTargetDictionary||!h.morphTargetInfluences)return;c.forEach(I=>{const v=h.morphTargetDictionary[I];if(v!==void 0&&h.morphTargetInfluences[v]>0)g.merge.add(I);else return g.remove.add(I),null})}if((Y=h.userData)!=null&&Y.isVRM0)for(let I=0;I[I,I.morphTargetDictionary||{}])),morphTargetInfluences:new Map(l.map(I=>[I,I.morphTargetInfluences||[]])),index:null,animations:{}},{dest:y,destMorphToMerge:w}=Zx({meshes:[h],scale:r,morphTargetsProcess:g},i);if(i)for(let I=0;Ih.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;hE.id);for(const E in M){const L=M[E],U=L.meshArray;if(U.length>0){const{bakeObjects:P,material:z}=await rfe({transparentColor:r,atlasSize:L.size,meshes:U,mtoon:L.isMtoon,includeNonTexturedMeshesInAtlas:l,transparentMaterial:L.transparentMaterial,transparentTexture:B,twoSidedMaterial:p}),W=P.map(re=>re.mesh),N=[],C={merge:new Set,keep:new Set(Object.keys(O)),remove:new Set};W.forEach(re=>{if(re.type=="Mesh"&&(re=ffe(b,re)),N.push(re),u){if(!re.morphTargetDictionary||!re.morphTargetInfluences)return;Y.forEach(Ae=>{const le=re.morphTargetDictionary[Ae];if(le!==void 0&&re.morphTargetInfluences[le]>0)C.merge.add(Ae);else return C.remove.add(Ae),null})}const fe=re.geometry,oe=fe.index.array,pe=j6(re.geometry.index.array),xe=[];for(let Ae=0;Ae{const fe=ue.morphTargetDictionary[re];fe!==void 0&&(ue.userData.bindMorphs.new[re]={index:fe,primitives:[ue.id]})}),T.userData.atlasMaterial.push(z)}}const H=(v=Object.values(e).find(E=>{var L;return(L=E==null?void 0:E.vrm)==null?void 0:L.expressionManager}))==null?void 0:v.vrm.expressionManager;return T.userData.expressionManagerToClone=H,T.add(b.bones[0]),T}function W6(n){var t;return((t=Object.values(n).filter(r=>r)[0])==null?void 0:t.traitInfo.manifestData.getAllBlendShapeTraits())||[]}function K6(n){const e=Object.values(n).map(i=>i==null?void 0:i.vrm).filter(i=>!!i).map(i=>{var s;return(s=i.expressionManager)==null?void 0:s.expressionMap}),t={};let r=[];for(const i of e)if(i)for(const s of Object.values(i)){if(r.includes(s.expressionName))continue;r.push(s.expressionName);const o=s._binds;!o||o.length==0||o.forEach(a=>{function l(c){const f=a.primitives.map(h=>h.morphTargetDictionary).filter(h=>!!h).find(h=>Object.values(h).includes(c));if(f)return Object.entries(f).find(([,h])=>h==c)}const A=l(a.index);A&&(t[A[0]]={index:A[1],primitives:a.primitives.map(c=>c.id)})})}return t}function KP({meshes:n,sourceMorphTargetDictionaries:e,destMorphTargetDictionary:t}){const r=[];return Object.entries(t).map(([i,s])=>{const o=n.find(l=>e.get(l).hasOwnProperty(i)),a=o.morphTargetDictionary[i];r[s]=o.morphTargetInfluences[a]}),r}function dfe({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]=$H(t.map(s=>s[i]).flat().filter(s=>s!==void 0))}),r}function YP(n){const{sourceMorphTargetDictionaries:e,morphTargetsProcess:t}=n,r=new Set;Array.from(e.values()).forEach(o=>{Object.keys(o).forEach(a=>{if(!t)r.add(a);else{if(t.remove.has(a)||t.merge.has(a))return;t.keep.has(a)&&r.add(a)}})});const s={};return Array.from(r.keys()).map((o,a)=>{s[o]=a}),s}function XP({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 lt(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 h;if(i+=f.geometry.attributes.uv.count,(h=f.userData)!=null&&h.isVRM0)for(let p=0;p[f,f.geometry.attributes])),morphAttributes:new Map(n.map(f=>[f,f.geometry.morphAttributes])),morphTargetDictionaries:new Map(n.map(f=>[f,f.morphTargetDictionary||{}])),morphTargetInfluences:new Map(n.map(f=>[f,f.morphTargetInfluences||[]]))},o={attributes:null,morphTargetDictionary:null,morphAttributes:null,morphTargetInfluences:null,index:null,animations:{}};o.attributes=dfe({sourceAttributes:s.attributes});const a=YP({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:(t==null?void 0:t.remove)||new Set,keep:(t==null?void 0:t.keep)||new Set,merge:(t==null?void 0:t.merge)||new Set}});o.morphTargetDictionary=a,o.morphAttributes=XP({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a,scale:e},r),o.morphTargetInfluences=KP({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:a}),o.index=pfe({meshes:n});const l={morphAttributes:{},morphTargetDictionaries:{},morphTargetInfluences:null};let A=new Set((t==null?void 0:t.keep)||[]);t==null||t.merge.forEach(f=>{A.add(f)});const c=YP({sourceMorphTargetDictionaries:s.morphTargetDictionaries,morphTargetsProcess:{remove:new Set,keep:A,merge:new Set}});l.morphAttributes=XP({meshes:n,sourceMorphAttributes:s.morphAttributes,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:c,scale:e},r);const u=KP({meshes:n,sourceMorphTargetDictionaries:s.morphTargetDictionaries,destMorphTargetDictionary:c});return l.morphTargetInfluences=u,l.morphTargetDictionaries=c,o.animations={},{source:s,dest:o,destMorphToMerge:l}}function ut(n){return n==null?[]:Array.isArray(n)?n:[n]}function mfe(n,e){let t=n.children.slice();t.forEach(r=>n.remove(r)),n.add(e),t.forEach(r=>n.add(r))}async function gfe(n,e){const r=await new ou().load(e);r.encoding=wt,r.flipY=!1,n.traverse(i=>{if(i instanceof Cn){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)})}}Zue(e)};function vfe(n){const e=[],t=[],r=[],i=[];let s=!1;return n.forEach(o=>{var A;const l=ut(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 yfe(n){const e=[],t=[],r=[],i=[],s=[],o=[];return n.forEach(a=>{ut(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 $P(n,e){n.data==null?n.data=e:n.data={...n.data,...e}}function wfe(n,e){if(n.data!=null)return n.data[e]}function xfe(n){const e=wfe(n,"cullingMeshes");e&&(e.forEach(t=>{H6(t)}),n.data.cullingMeshes=null)}function bn(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 _fe(n){const e=n.scene;xfe(n),e.traverse(t=>{t.material&&OC(t.material),t.geometry&&(H6(t),t.geometry.dispose(),t.geometry.disposeBoundsTree())}),e.parent&&e.parent.remove(e),wg.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&&OC(i.material)})})});for(const t in n)n[t]=null}const OC=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)},Y6=()=>{const n=new Date().getTime(),e=Math.random().toString(36).substr(2,9);return n+"-"+e},bfe=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 Vm)h=h.charAt(0).toLowerCase()+h.slice(1),(f=e[h])!=null&&f.node&&(e[h].node.name=h)};function X6({candidates:n,predicate:e}){if(!n.length)return null;const t=n.shift();return e(t)?t:(n=n.concat(t.children),X6({candidates:n,predicate:e}))}function $6(n,e){return X6({candidates:[n],predicate:t=>t.name===e})}function Z6({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),Z6({candidates:n,predicate:e,results:t})}function Qh(n,e){return Z6({candidates:[n],predicate:t=>ut(e).includes(t.type)})}function Bfe(n,e){if(!n.morphTargetDictionary)return!1;for(const t of Object.keys(n.morphTargetDictionary))if(e[t])return!0;return!1}const Efe={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 J6(n,e,t){var d;const r=Kc.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],_=Efe[w],B=e.getObjectByName(w);if(_!=null){const T=y[1];if(B.getWorldQuaternion(s).invert(),B.parent.getWorldQuaternion(o),m instanceof pa){for(let b=0;b{m.values[Y+b]=O})}i.push(new pa(`${_}.${T}`,m.times,m.values.map((b,M)=>{var O;return((O=t.meta)==null?void 0:O.metaVersion)==="0"&&M%2===0?-b:b})))}else if(m instanceof DA){const b=m.values.map((M,O)=>{var Y;return(((Y=t.meta)==null?void 0:Y.metaVersion)==="0"&&O%3!==1?-M:M)*h});i.push(new DA(`${_}.${T}`,m.times,b))}}}),new Kc("vrmAnimation",r.duration,i)}const Cfe=new Ure,Mfe=new ZH,eB=.2,Sfe=n=>Math.floor(Math.random()*n);class ZP{constructor(e,t,r,i,s,o,a){var l,A,c,u;this.mixer=new Fne(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=J6(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 Tfe{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!=""?"/":"")+ut(e)[0];o=o==""?cl(a):o,this.currentAnimationName=o;const A=await(i?Cfe:Mfe).loadAsync(a);A.scale.set(this.scale,this.scale,this.scale),this._scaleOffsetHips(A.animations);const c=Kc.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 ZP(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=ut(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=ut(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=Sfe(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-eB)},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*eB):this.weightIn=1,this.weightOut>0?this.weightOut-=1/(30*eB):this.weightOut=0)}}const Ife={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:` varying vec2 vUv; @@ -4222,7 +4222,7 @@ void main() { gl_FragColor.a *= opacity; - }`};class id{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 Tfe=new Zh(-1,1,1,-1,0,1),vT=new Kt;vT.setAttribute("position",new An([-1,3,0,-1,-1,0,3,-1,0],3));vT.setAttribute("uv",new An([0,2,0,0,2,0],2));class yT{constructor(e){this._mesh=new Cn(vT,e)}dispose(){this._mesh.geometry.dispose()}render(e){e.render(this._mesh,Tfe)}get material(){return this._mesh.material}set material(e){this._mesh.material=e}}class Ife extends id{constructor(e,t){super(),this.textureID=t!==void 0?t:"tDiffuse",e instanceof Mr?(this.uniforms=e.uniforms,this.material=e):e&&(this.uniforms=WS.clone(e.uniforms),this.material=new Mr({defines:Object.assign({},e.defines),uniforms:this.uniforms,vertexShader:e.vertexShader,fragmentShader:e.fragmentShader})),this.fsQuad=new yT(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 ZP extends id{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 Rfe extends id{constructor(){super(),this.needsSwap=!1}render(e){e.state.buffers.stencil.setLocked(!1),e.state.buffers.stencil.setTest(!1)}}class Ffe{constructor(e,t){if(this.renderer=e,t===void 0){const r=e.getSize(new Ye);this._pixelRatio=e.getPixelRatio(),this._width=r.width,this._height=r.height,t=new da(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 Ife(Sfe),this.clock=new KH}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 dv(n,e,t){const r=new da(n.x,n.y,t?{depthTexture:new DH(n.x,n.y),depthBuffer:!0}:void 0);return r.texture.format=e,r.texture.minFilter=Xn,r.texture.magFilter=Xn,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,r}class Pfe extends id{constructor(e){super(),this.resolution=e,this.fsQuad=new yT(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 Mr({uniforms:{tDiffuse:{value:null},resolution:{value:new Ht(this.resolution.x,this.resolution.y,1/this.resolution.x,1/this.resolution.y)}},vertexShader:` + `})}}function dv(n,e,t){const r=new da(n.x,n.y,t?{depthTexture:new OH(n.x,n.y),depthBuffer:!0}:void 0);return r.texture.format=e,r.texture.minFilter=Xn,r.texture.magFilter=Xn,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,r}class Ofe extends id{constructor(e){super(),this.resolution=e,this.fsQuad=new wT(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 gr({uniforms:{tDiffuse:{value:null},resolution:{value:new Ht(this.resolution.x,this.resolution.y,1/this.resolution.x,1/this.resolution.y)}},vertexShader:` varying vec2 vUv; void main() { vUv = uv; @@ -4309,7 +4309,7 @@ void main() { texel.rgb = pow(texel.rgb, vec3(1.0 / 2.2)); gl_FragColor = texel; } - `})}}const tp=new Z;class Dfe{constructor(e){kt(this,"camera",null);kt(this,"frameOffset",{min:.2,max:.2});kt(this,"boneOffsets");kt(this,"cameraDir",new Z);kt(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 ll){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 ll&&(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 ll){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(tp),this.camera.position.copy(tp),r.y*=.5,this.camera.lookAt(tp.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,tp.set(0,0,-1),this.cameraDir=tp.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 Rw=4096;class Ofe{constructor(e,t,r){const i=new dg({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new Ye(Rw,Rw);i.setClearColor(0,0),i.outputEncoding=wl,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 Ffe(i);a.addPass(new Ufe(e,t)),this._renderPixelPass=new Lfe(o,e,t),this._pixelPass=new Pfe(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new Ye(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){kt(this,"cameraFrameManager");this.renderer=new dg({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputEncoding=wt,this.renderer.setSize(Rw,Rw);const r=new Br(30,1,.1,1e3);this.textureLoader=new ou,this.sceneBackground=new ke(.1,.1,.1),this.sceneBackgroundAlpha=1,this.usesBackgroundImage=!1,this.backgroundMaterial=new Mi({color:16777215,transparent:!0,opacity:.5});const i=new iu(1e3,1e3),s=new Cn(i,this.backgroundMaterial);s.renderOrder=-1,this.backgroundPlane=s,this.pixelRenderer=new Ofe(t,r,20),this.cameraFrameManager=new Dfe(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 ke(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=cs,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 Hn(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=u5.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 kfe=2;class Qfe{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new KH,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=kfe,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(Ur.Blink,1-this._eyeOpen),e.expressionManager.update()})}}function J6(){return(J6=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(rp([new Uint8Array(Ir).buffer,g,p.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...h]))}var NC,kC,Kfe={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},QC=new OffscreenCanvas(128,128),t3=QC.getContext("2d",{willReadFrequently:!0}),q6=typeof document>"u";function Yfe(n){return createImageBitmap(n).then(function(e){return QC.width=e.width,QC.height=e.height,t3.drawImage(e,0,0),t3.getImageData(0,0,e.width,e.height)})}function Xfe(n,e){return e===void 0&&(e={}),Zfe().then(function(t){var r=new t.BasisEncoder;return $fe(e,r),r.setTexType(NC.cBASISTexType2D),zfe(n,ArrayBuffer)&&(n=new Blob([n])),Yfe(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,kC.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=Vfe(s);if(e.kvData){for(var A in e.kvData)l.keyValue[A]=e.kvData[A];a=Wfe(l,{keepWriter:!0})}return a})})}function $fe(n,e){n===void 0&&(n={}),(n=Hfe({},Kfe,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 eB=null;function Zfe(){return eB||(eB=new Promise(function(n,e){q6?(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)})),eB}q6&&self.addEventListener("message",function(n){Xfe(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class Jfe{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 qfe{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new Jfe(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 On;(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"})(On||(On={}));const HC="blend_",n3="vrmColliderSphere";function ehe(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 the(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function nhe(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 rhe(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 ihe{async parse(e,t,r,i,s,o,a){var Be;const l=ehe(e.meta),A=the(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((k,W,re)=>re.findIndex(he=>he.name===k.name.replace(" (Outline)",""))===W).map(k=>k),p=h.map(k=>k.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(k=>k.map).map(k=>{if(!k.map)throw new Error(k.name+" map is null");return{name:k.name,imageBitmap:k.map.image}}),m=h.filter(k=>k.userData.shadeTexture).map(k=>{if(!k.userData.shadeTexture)throw new Error(k.userData.shadeTexture+" map is null");return{name:k.name+"_shade",imageBitmap:k.userData.shadeTexture.image}}),y=h.filter(k=>k.roughnessMap).map(k=>k.roughnessMap?{name:k.name+"_orm",imageBitmap:k.roughnessMap.image}:null),w=h.filter(k=>k.roughnessMap).map(k=>k.normalMap?{name:k.name+"_normal",imageBitmap:k.normalMap.image}:null),x=[...g,...m,...y,...w].filter(k=>k!==null),_=che(x,d,s?"image/ktx2":"image/png"),C=uhe(_),T=fhe(_,s),b=Ahe(h,x),M=t.children.filter(k=>k.children.length>0&&k.children[0].type===ci.Bone)[0],D=e8(M).filter(k=>k.name!==n3),Y=D.map(k=>k.name),H=D.map(k=>{const W=k.children.filter(re=>re.name!==n3).map(re=>Y.indexOf(re.name));return{name:k.name,rotation:[k.quaternion.x,k.quaternion.y,k.quaternion.z,k.quaternion.w],scale:[k.scale.x,k.scale.y,k.scale.z],translation:[k.position.x,k.position.y,k.position.z],children:W.length>0?W:void 0}}),I=[],v=t.children.filter(k=>k.type===ci.Group||k.type===ci.SkinnedMesh),B=[];v.forEach((k,W)=>{const re=k.type===ci.Group?k.children[0]:k,he=re.geometry.attributes,me=new Gl(he.position,On.FLOAT,$t.POSITION,zo.VEC3,re.name,void 0);B.push(me);const V=B.length-1,R=he.normal.array,S=new Float32Array(R.length);for(let ie=0;ieie):[k]).forEach(ie=>{if(!ie.geometry.index)throw new Error(ie.name+" geometry.index is null");B.push(new Gl(ie.geometry.index,On.UNSIGNED_INT,$t.INDEX,zo.SCALAR,re.name,ie.name))}),re.morphTargetDictionary||(re.morphTargetDictionary={},re.morphTargetInfluences=[],re.geometry.morphAttributes={},re.updateMorphTargets()),re.geometry.userData.targetNames=[];const le=(ie,Ie,Te,Le)=>{const He=[],De=[];for(let fe=0;fe0){const fe=[...He].sort((Fe,Ve)=>Fe-Ve),Me=[];for(let Fe=0;Fe({mesh:0,index:he.index,weight:he.weight*100}));if(re.length>0){let he=!1;for(const me in Ur)if(k===Ur[me]&&k!=="surprised"){u.push({name:k,presetName:nhe(k),binds:re,isBinary:W.isBinary}),he=!0;break}he===!1&&u.push({name:k,presetName:"unknown",binds:re,isBinary:W.isBinary})}}v.forEach(k=>{const W=k.type===ci.Group?k.children[0]:k,re=new Float32Array(W.skeleton.boneInverses.map(he=>he.elements).flat());B.push(new Gl(new lt(re,16),On.FLOAT,$t.BIND_MATRIX,zo.MAT4,W.name,W.name))}),I.push(...B.map(k=>({componentType:k.valueType,count:k.attribute.count,max:k.max,min:k.min,normalized:!1,type:k.accessorsType})));const F=ahe(v,B,p);v.forEach((k,W)=>{H.push({mesh:W,name:k.name,rotation:[k.quaternion.x,k.quaternion.y,k.quaternion.z,k.quaternion.w],scale:[k.scale.x,k.scale.y,k.scale.z],skin:W,translation:[k.position.x,k.position.y,k.position.z]})});const P=lhe(v,B,Y),O={humanBones:[]};A.humanBones.forEach(k=>{Y.indexOf(k.node.name)!=-1&&O.humanBones.push({bone:rhe(k.bone),node:Y.indexOf(k.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"},Q=[];h.forEach(k=>{k.type=="ShaderMaterial"?Q.push(Object.assign({},z)):Q.push(Object.assign({},K))});const E=l;i.forEach(k=>{for(let W=0;Wk.isSkinnedMesh))==null?void 0:Be.skeleton)||null;for(let k=0;k{const me=he.sphere;re.colliders.push({radius:me.radius*o,offset:{x:me.offset[0]*o,y:me.offset[1]*o,z:me.offset[2]*o}})}),G.push(re)}}console.log("COLLIDER GROUPS",G);const U=k=>{for(let W=0;W{var V;const W=U(k.name);if(W===-1){console.warn("Spring bone "+k.name+" was removed during cleanup process. Skipping.");return}const re=[];k.colliderGroups.forEach(R=>{const S=R.colliders[0];if(S!=null){const j=S.parent,te=G.findIndex(le=>le.name===j.name);te!=-1&&(re.includes(te)||re.push(te))}});let he=U((V=k.center)==null?void 0:V.name);he==-1&&console.warn("no center bone for spring bone "+k.name);const me=k.settings;X.push({bones:[W],center:he,colliderGroups:re,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 ae={boneGroups:X,colliderGroups:G};console.log(ae),E.texture=d?_.length-1:void 0;const oe=await Promise.all(x.map(async k=>({buffer:s?await r3(k.imageBitmap):i3(k.imageBitmap),type:$t.IMAGE})));B.forEach((k,W)=>{k.buffer?oe.push({buffer:k.buffer,typeString:"",type:k.type}):k.sparse&&(oe.push({buffer:k.sparse.indices,typeString:"indices",type:k.type,count:k.sparse.count}),oe.push({buffer:k.sparse.values,typeString:"values",type:k.type})),oe.length-1}),d&&oe.push({buffer:s?await r3(d.imageBitmap):i3(d.imageBitmap),type:$t.IMAGE});let de=0,se=0,pe=0,_e=0;const xe=oe.map(k=>{const W={buffer:0,byteLength:k.buffer.byteLength,byteOffset:de,target:k.type===$t.IMAGE||k.type===$t.BIND_MATRIX||k.typeString==="indices"||k.typeString==="values"?void 0:k.type===$t.INDEX?On.ELEMENT_ARRAY_BUFFER:On.ARRAY_BUFFER};return de+=k.buffer.byteLength,k.type===$t.IMAGE?(_[se++].bufferView=_e,_e++):B[pe].sparse?(I[pe].sparse==null&&(I[pe].sparse={}),k.typeString==="indices"&&(I[pe].sparse.count=k.count,I[pe].sparse[k.typeString]={bufferView:_e,byteOffset:0,componentType:On.UNSIGNED_INT}),k.typeString==="values"&&(I[pe].sparse[k.typeString]={bufferView:_e,byteOffset:0}),k.typeString==="values"&&pe++,_e++):(B[pe].bufferIndex=_e,I[pe].bufferView=_e,pe++,_e++),W}),L=hhe(t,H);she(E);const ue=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&ue.push("KHR_texture_basisu");const Ae={accessors:I,asset:f,buffers:[{byteLength:de}],bufferViews:xe,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:Q,humanoid:O,meta:E,secondaryAnimation:ae,specVersion:"0.0"}},extensionsUsed:ue,images:_,materials:b,meshes:F,nodes:H,samplers:C,scenes:L,skins:P,textures:T};console.log("output",Ae);const q=new s3(GC(JSON.stringify(Ae,void 0,2)),"JSON"),J=new s3(Lp(oe.map(k=>k.buffer)),"BIN\0"),ce=Lp([q.buffer,J.buffer]),be=Lp([GC("glTF"),zC(2,4),zC(ce.byteLength+12,4)]);a(Lp([be,ce]))}}function she(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 e8(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>e8(e)).flat())}const ohe=new qfe;async function r3(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 ohe.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 i3(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===On.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===On.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}class s3{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Lp([zC(r.byteLength,4),GC(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 o3=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===ci.Group?r.children[0]:r,s=r.type===ci.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($t.SKIN_INDEX),NORMAL:a.indexOf($t.NORMAL),POSITION:a.indexOf($t.POSITION),TEXCOORD_0:a.indexOf($t.UV),WEIGHTS_0:a.indexOf($t.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===$t.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===$t.BLEND_NORMAL&&h.meshName===i.name?h.name:null).indexOf(HC+A),u=e.map(h=>h.type===$t.BLEND_POSITION&&h.meshName===i.name?h.name:null).indexOf(HC+A),f={};return u!==-1&&(f.POSITION=u),c!==-1&&(f.NORMAL=c),f}):void 0}})}}),lhe=(n,e,t)=>n.map(r=>{const i=r.type===ci.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===$t.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)}}),Ahe=(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 Wf.MeshStandardMaterial:return t.metalness;case Wf.MeshBasicMaterial:return 0;default:return 0}})(),p=(()=>{switch(t.type){case Wf.MeshStandardMaterial:return t.roughness;case Wf.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}),che=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),uhe=n=>n.map(()=>({magFilter:On.LINEAR,minFilter:On.LINEAR,wrapS:On.REPEAT,wrapT:On.REPEAT})),fhe=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),hhe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===ci.Object3D||r.type===ci.SkinnedMesh||r.type===ci.Group||r.type===ci.Bone).map(r=>t.indexOf(r.name))}]};function dhe(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=mhe(r),o=phe(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function phe(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(ut(b.authors)),r=r.concat(ut(b.otherLicenseUrl)),i=i.concat(ut(b.contactInformation)),s=s.concat(ut(b.references)),u=u.concat(ut(b.otherPermissionUrl)),b.allowExcessivelyViolentUsage===!1&&(o=!1),b.allowExcessivelySexualUsage===!1&&(a=!1),l=Za(yhe,l,b.commercialUsage),A=Za(t8,A,b.copyrightInformation),c=Za(whe,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(ut(b.thirdPartyLicenses)),g=Za(vhe,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"),T=[...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:T.length==0?"":T.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:A,avatarPermission:c,allowAntisocialOrHateUsage:f,allowPoliticalOrReligiousUsage:h,allowRedistribution:p,creditNotation:d,modification:g}}function mhe(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,A,c;n.forEach(g=>{e=e.concat(ut(g.author)),t=t.concat(ut(g.contactInformation)),r=r.concat(ut(g.reference)),i=i.concat(ut(g.otherPermissionUrl)),s=s.concat(ut(g.otherLicenseUrl)),o=Za(xhe,o,g.allowedUsername),a=Za(nB,a,g.violentUssageName),l=Za(nB,l,g.sexualUssageName),A=Za(nB,A,g.commercialUssageName),c=Za(t8,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:ghe(o),otherPermissionUrl:p}}function ghe(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const vhe={prohibited:0,allowModification:1,allowModificationRedistribution:2},yhe={personalNonProfit:0,personalProfit:1,corporation:2},whe={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},xhe={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},nB={Disallow:0,Allow:1},t8={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 Za(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 _he(n){const e=n8(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=z6(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 Oh,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new Pr;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function bhe(n,e,t){const r=await wT(n,t),i=await r8(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function Bhe(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;Ehe(n,e,r).then(a=>{s8(a,`${o}.vrm`),i()})})}async function Ehe(n,e,t){const r=await wT(n,e,t);return r8(r,e,t)}function wT(n,e,t){const r=n8(n);t.mergeAppliedMorphs=!0;const{createTextureAtlas:i=!0}=t;return i?ufe(r,e,t):(console.log("no atlas"),lfe(r,e,t))}async function Che(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await wT(n,t):_he(n);Mhe(s).then(o=>{if(o instanceof ArrayBuffer)s8(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);Fhe(a,`${r}.gltf`)}})}function Mhe(n){return new Promise(e=>new nT().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function She(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 Vm)if(s.bone.parent.name==Vm[o]){t.push(s);break}}),t}function The(n){const e={};return n.skeleton.bones.map(t=>{for(const r in Vm)if(Vm[r]===t.name){e[t.name]={node:t};break}}),e}function Ihe(n,e,t){const r=Qh(n,"SkinnedMesh");return{humanBones:The(r[0]),materials:n.userData.atlasMaterial,meta:Rhe(e),...t.mergeAppliedMorphs?{expressionManager:Phe(n)}:{}}}function Rhe(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 r8(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=dhe(e,s,a);return new Promise(async A=>{const c=i?new ihe:new sue,u={...Lhe(e),...Ihe(n,l,t)};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=She(e);c.parse(u,n,r,p,t.ktxCompression,o,d=>{A(d)})})}function i8(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 Fhe(n,e){i8(new Blob([n],{type:"text/plain"}),e)}function s8(n,e){i8(Uhe(n),e)}function Uhe(n){return new Blob([n],{type:"application/octet-stream"})}function Lhe(n){for(const e in n)if(n[e].vrm)return n[e].vrm}function Phe(n){const e=new Ew;let t=n.userData.expressionManagerToClone;if(!t){t=new Ew;for(const r of Object.values(Ur)){const i=new Bw(r);t.registerExpression(i)}}e.copy(t),n.userData.expressionManagerToClone=null;for(const r of n.children){if(!r.isMesh&&!r.isSkinnedMesh||!r.morphTargetDictionary)continue;const i=r.userData.bindMorphs;if(!i||!_fe(r,i.old))continue;const o=(A,c)=>{var u;return((u=A.find(f=>f.index==c))==null?void 0:u.weight)||0},a=Object.entries(Ur).flat(),l=Object.keys(i.old).filter(A=>a.includes(A));for(const A of Object.keys(t.expressionMap)){const c=t.expressionMap[A];if(!c)continue;const u=c._binds;if(!u||u.length==0){e.unregisterExpression(c);continue}for(const f of l){const h=i.new[f]||i.new[f.toLowerCase()],p=i.old[f]||i.old[f.toLowerCase()];if(h){const d=[];n.traverse(y=>{!y.isMesh&&!y.isSkinnedMesh||h.primitives.includes(y.id)&&d.push(y)}),e.unregisterExpression(c),c._binds=[];const g=o(u,p.index),m=new Bw(c.expressionName);m.copy(c),console.log("adding bind",c.expressionName),m.addBind(new BC({index:h.index,weight:g,primitives:d})),e.registerExpression(m)}else e.unregisterExpression(c)}}}return e}const Dhe=n=>{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?Ohe(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?Nhe(n):console.warn("No valid vrm file was provided")},Ohe=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=>o8(c.name,s));i!=null&&i.forEach(c=>{const u=o[c.node],f=X6(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=K6()})},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=>o8(f.name,o));i!=null&&i.forEach(f=>{const h=ut(f.colliders);let p=-1,d=null;h.forEach(g=>{if(p!=s[g].node){p=s[g].node;const m=a[p];d=X6(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=K6(),d.userData.VRMcolliders.push(m)}else console.error("no node with name "+a[p]+" was found")})})},o8=(n,e)=>{const t=_t.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},Fw=[0,400,560,2400,4800],Uw=[0,500,700,3e3,6e3],VC=[],za=[],xT=1024,a8=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=Lw.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=xT,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=Lw.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(Ur.Oh,0),this.vrm.expressionManager.setValue(Ur.Ah,0),this.vrm.expressionManager.setValue(Ur.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(Ur.Oh,i),this.vrm.expressionManager.setValue(Ur.Ah,r),this.vrm.expressionManager.setValue(Ur.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]/=za[A+1]-za[A]}for(let A=0;A0&&(s[A]+=r[c]);i[A]/=za[A+1]-za[A],s[A]=s[A]/(VC[A+1]-VC[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 rB=new Z;class khe{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new Ye,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(){rB.set(0,0,1),rB.applyQuaternion(this.camera.quaternion);const e=rB.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 iB{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:T=!0,downloadOptions:b={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=ut(o),this.requiredTraits=ut(c),this.randomTraits=ut(u),this.initialTraits=A||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=ut(f),this.lipSyncTraits=ut(h),this.blinkerTraits=ut(p),this.typeRestrictions=d,this.defaultCullingLayer=g,this.defaultCullingDistance=m,this.offset=y,this.canDownload=T,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)ut(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)}getAllBlendShapeTraits(){return this.modelTraits.map(e=>e.getCollection()).flat().map(e=>e.blendshapeTraits).flat().map(e=>e==null?void 0:e.collection).flat().filter(e=>!!e)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=ut(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 sB(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 sB(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 sB(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=[]),ut(e).forEach(r=>{this.modelTraits.push(new Qhe(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=[]),ut(e).forEach(r=>{this.textureTraits.push(new Hhe(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),ut(e).forEach(r=>{this.colorTraits.push(new zhe(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class Qhe{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=[]),ut(e).forEach(r=>{this.collection.push(new a3(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new a3(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 Hhe{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=[]),ut(e).forEach(r=>{this.collection.push(new Vhe(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 zhe{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=[]),ut(e).forEach(r=>{this.collection.push(new jhe(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 a3{constructor(e,t){kt(this,"blendshapeTraits",[]);kt(this,"blendshapeTraitsMap",new Map);const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:A=[],textureCollection:c,blendshapeTraits:u,colorCollection:f,fullDirectory:h,fullThumbnail:p}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,h)this.fullDirectory=h;else if(Array.isArray(i)){this.fullDirectory=[];for(let d=0;dnew Ghe(this,d)),this.blendshapeTraitsMap=new Map(this.blendshapeTraits.map(d=>[d.trait,d])))}isRestricted(e){if(e==null)return!1;const t=e.traitGroup.trait;if(this.traitGroup.restrictedTraits.indexOf(t)!=-1)return!0;if(this.type.length>0&&this.manifestData.restrictedTypes>0){const r=(o,a)=>{if(o==null||a==null)return!1;for(let l=0;lr(i[o],s))}return!1}getGroupBlendShapeTraits(){return this.blendshapeTraits}getBlendShapes(e){var t,r;return(r=(t=this.blendshapeTraitsMap)==null?void 0:t.get(e))==null?void 0:r.collection}getBlendShape(e,t){var r,i;return(i=(r=this.blendshapeTraitsMap)==null?void 0:r.get(e))==null?void 0:i.getTrait(t)}}class Ghe{constructor(e,t){kt(this,"trait");kt(this,"name");kt(this,"isBlendShapeGroup",!0);kt(this,"collection",[]);kt(this,"cameraTarget",null);kt(this,"collectionMap",null);const{trait:r,name:i,collection:s,cameraTarget:o=e.traitGroup.cameraTarget||{distance:3,height:1}}=t;this.modelTrait=e,this.trait=r,this.name=i,this.cameraTarget=o,this.createCollection(s)}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new l8(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 l8{constructor(e,t){kt(this,"id");kt(this,"name");kt(this,"fullThumbnail");kt(this,"isBlendShape",!0);const{id:r,name:i,fullThumbnail:s}=t;r||console.warn("BlendShapeTrait is missing id, parent trait: "+e.trait),i||console.warn("BlendShapeTrait is missing name, parent trait: "+e.trait),this.parentGroup=e,this.id=r,this.fullThumbnail=s,this.name=i}getGroupId(){return this.parentGroup.trait}}class Vhe{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{e.traverse(i=>{if(i.isMesh||i.isSkinnedMesh){const s=i;if(!s.morphTargetDictionary||!s.morphTargetInfluences)return;const o=s.morphTargetDictionary[t.id];o!=null&&(s.morphTargetInfluences[o]=r?1:0)}})});this._start(e)}async _start(e){const{parentModel:t=null,renderCamera:r=null,manifestURL:i=null}=e;this.rootModel=new It,this.characterModel=new It,this.parentModel=t,t&&t.add(this.rootModel),this.lipSync=null,this.lookAtManager=null,this.animationManager=new Mfe,this.screenshotManager=new Nfe(this,t||this.rootModel),this.blinkManager=new Qfe(.1,.1,.5,5),this.rootModel.add(this.characterModel),this.renderCamera=r,this.manifestData=null,this.manifest=null,i&&(this.loadManifest(i),this.animationManager.setScale(this.manifestData.displayScale)),this.avatar={},this.storedAvatar={},this.traitLoadManager=new Khe;const s=new Pr;s.renderOrder=1e4,this.rootModel.add(s),this.vrmHelperRoot=s}update(){this.lookAtManager!=null&&this.lookAtManager.update()}addLookAtMouse(e,t,r,i=!0){var s;this.lookAtManager=new khe(e,t,r),this.lookAtManager.enabled=!0;for(const o in this.avatar)((s=this.avatar[o])==null?void 0:s.vrm)!=null&&this.lookAtManager.addVRM(this.avatar[o].vrm)}toggleCharacterLookAtMouse(e){this.lookAtManager!=null?(this.lookAtManager.setActive(e),this.animationManager&&this.animationManager.enableMouseLook(e)):console.warn("toggleCharacterLookAtMouse() was called, but no lookAtManager exist. Make sure to set it up first with addLookArMous()")}savePortraitScreenshot(e,t,r,i=1,s=0){this.blinkManager.enableScreenshot(),this.characterModel.traverse(o=>{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(Oa)}),Oa.z+=.3,Oa.y+=s,this.screenshotManager.cameraFrameManager.setCamera(Oa,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 lt(new Uint32Array(w),1,!1)}m!=1&&c&&(y.splice(m,3),u.userData.clippedIndexGeometry=new lt(new Uint32Array(y),1,!1))}};oB.x=e,oB.y=t,i(),l3.setFromCamera(oB,this.renderCamera);const l=l3.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 uy({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 Bhe(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};Che(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getBoneTriangleCount(){let e=0,t=new Set;for(const r in this.avatar)this.avatar[r].model.traverse(i=>{i.isMesh&&(e+=i.geometry.index.array.length),i.isSkinnedMesh&&i.skeleton.bones.forEach(s=>{t.add(s.name)})});return{triangles:e/3,bones:t.size}}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getBlendShapeGroupTraits(e,t){var r;return this.manifestData?(r=this.manifestData.getModelTrait(e,t))==null?void 0:r.getGroupBlendShapeTraits():[]}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentBlendShapeTraitData(e){var t;return((t=this.avatar[e])==null?void 0:t.blendShapeTraitsInfo)||{}}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&this.screenshotManager.setScene(this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(ut(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadBlendShapeTrait(e,t,r){if(!this.avatar[e]){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(!this.manifestData){console.warn("No manifest data was found.");return}try{this._loadBlendShapeTrait(e,t,r)}catch{console.error("Error loading blendshape trait "+e,t,r)}}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(ut(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(ut(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 pfe(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 ke(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 ke(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 uy({traitGroupID:e,traitModel:null});this._addLoadedData(i),Jb(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){Jb(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new iB(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 iB(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 iB(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=ut(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(ut(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 uy({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),Jb(this.avatar)})}async _loadBlendShapeTrait(e,t,r){const i=this.avatar[e];if(!i){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(i.blendShapeTraitsInfo||(i.blendShapeTraitsInfo={}),i.blendShapeTraitsInfo[t]&&this.toggleBinaryBlendShape(i.model,i.blendShapeTraitsInfo[t],!1),r==null){delete this.avatar[e].blendShapeTraitsInfo[t];return}const s=i.traitInfo.getBlendShape(t,r);if(!s){console.warn(`Blendshape with name: ${r} was not found.`);return}this.toggleBinaryBlendShape(i.model,s,!0),this.avatar[e].blendShapeTraitsInfo[s.getGroupId()]=s}async _animationManagerSetup(e,t,r){const i=ut(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(Oa)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],A=r[1];Oa.x+=s[0],Oa.y+=s[1],Oa.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.cameraFrameManager.setCamera(Oa,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 ke(o,a,l)},r=new Mi({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(XP(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&Dhe(e),xfe(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new Lw(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",dfe(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=ut((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);XP(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&&ut(u.material).map(p=>{Yhe(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 ke(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),wfe(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,blendShapeTraitsInfo:{},textureInfo:i,colorInfo:s,name:r.name,model:A&&A.scene,vrm:A})}}class Khe{constructor(){const e=new GH;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new $H(e);t.crossOrigin="anonymous",t.register(i=>new qce(i,{autoUpdateHumanBones:!0}));const r=new ou(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(ut((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(ut((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=wt,p(d)},null,d=>{console.error("error loading texture: ",d),p(null)})}))),A=ut((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(h=>new ke(h));r[o]=new uy({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 uy{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 Yhe(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 Xhe(n){const e=new fw,t=new WH(16777215,.5);e.add(t);const r=new qS(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 Whe({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new dg({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),A=new Une(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.7,.5),f=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",f),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputEncoding=wt;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 pv(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 A8={exports:{}};/*! + `})}}const tp=new Z;class Nfe{constructor(e){kt(this,"camera",null);kt(this,"frameOffset",{min:.2,max:.2});kt(this,"boneOffsets");kt(this,"cameraDir",new Z);kt(this,"frameTarget",null);this.camera=e||new Er,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 ll){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 ll&&(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 ll){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),B=m.clone().sub(_);o.min(B),a.max(B)}}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(tp),this.camera.position.copy(tp),r.y*=.5,this.camera.lookAt(tp.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,tp.set(0,0,-1),this.cameraDir=tp.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 Fw=4096;class kfe{constructor(e,t,r){const i=new dg({preserveDrawingBuffer:!0,antialias:!1,alpha:!0});this.pixelSize=r,this.domElement=i.domElement;const s=new Ke(Fw,Fw);i.setClearColor(0,0),i.outputEncoding=wl,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 Lfe(i);a.addPass(new Pfe(e,t)),this._renderPixelPass=new Dfe(o,e,t),this._pixelPass=new Ofe(o),a.addPass(this._renderPixelPass),a.addPass(this._pixelPass),this.renderer=i,this.composer=a}setSize(e,t){let i=new Ke(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 Qfe{constructor(e,t){kt(this,"cameraFrameManager");this.renderer=new dg({preserveDrawingBuffer:!0,antialias:!0,alpha:!0}),this.renderer.setClearAlpha(0),this.renderer.premultipliedAlpha=!1,this.scene=t,this.characterManager=e,this.renderer.outputEncoding=wt,this.renderer.setSize(Fw,Fw);const r=new Er(30,1,.1,1e3);this.textureLoader=new ou,this.sceneBackground=new ke(.1,.1,.1),this.sceneBackgroundAlpha=1,this.usesBackgroundImage=!1,this.backgroundMaterial=new Mi({color:16777215,transparent:!0,opacity:.5});const i=new iu(1e3,1e3),s=new Cn(i,this.backgroundMaterial);s.renderOrder=-1,this.backgroundPlane=s,this.pixelRenderer=new kfe(t,r,20),this.cameraFrameManager=new Nfe(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 ke(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=cs,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 Hn(r);return i.needsUpdate=!0,i}getScreenshotBlob(e,t){const r=this._createImage(e,t),i=f5.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 Hfe=2;class zfe{constructor(e=.5,t=.5,r=1,i=5){this.vrmBlinkers=[],this.mode="ready",this.clock=new YH,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=Hfe,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(Ur.Blink,1-this._eyeOpen),e.expressionManager.update()})}}function q6(){return(q6=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(rp([new Uint8Array(Ir).buffer,g,p.buffer,a,s,new ArrayBuffer(f>0?f-(u+s.byteLength):0),t,...h]))}var kC,QC,Xfe={enableDebug:!1,isUASTC:!0,isKTX2File:!0,isInputSRGB:!0,generateMipmap:!0,needSupercompression:!0,isSetKTX2SRGBTransferFunc:!0},HC=new OffscreenCanvas(128,128),n3=HC.getContext("2d",{willReadFrequently:!0}),e8=typeof document>"u";function $fe(n){return createImageBitmap(n).then(function(e){return HC.width=e.width,HC.height=e.height,n3.drawImage(e,0,0),n3.getImageData(0,0,e.width,e.height)})}function Zfe(n,e){return e===void 0&&(e={}),qfe().then(function(t){var r=new t.BasisEncoder;return Jfe(e,r),r.setTexType(kC.cBASISTexType2D),Vfe(n,ArrayBuffer)&&(n=new Blob([n])),$fe(n).then(function(i){r.setSliceSourceImage(0,new Uint8Array(i.data),i.width,i.height,QC.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=Wfe(s);if(e.kvData){for(var A in e.kvData)l.keyValue[A]=e.kvData[A];a=Yfe(l,{keepWriter:!0})}return a})})}function Jfe(n,e){n===void 0&&(n={}),(n=Gfe({},Xfe,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 tB=null;function qfe(){return tB||(tB=new Promise(function(n,e){e8?(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)})),tB}e8&&self.addEventListener("message",function(n){Zfe(n.data).then(function(e){self.postMessage(e)}).catch(function(e){self.postMessage({error:e})})});class ehe{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 the{constructor(){this.ktxEncoder=null,this.libktx=null,this.init()}async init(){const t=document.createElement("canvas").getContext("webgl"),r=new ehe(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 On;(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"})(On||(On={}));const zC="blend_",r3="vrmColliderSphere";function nhe(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 rhe(n){const e=[];for(const t in n.humanBones)e.push({bone:t,node:n.humanBones[t].node});return{humanBones:e}}function ihe(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 she(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 ohe{async parse(e,t,r,i,s,o,a){var Be;const l=nhe(e.meta),A=rhe(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((Q,K,ie)=>ie.findIndex(de=>de.name===Q.name.replace(" (Outline)",""))===K).map(Q=>Q),p=h.map(Q=>Q.name),d=r?{name:"icon",imageBitmap:r.image}:null,g=h.filter(Q=>Q.map).map(Q=>{if(!Q.map)throw new Error(Q.name+" map is null");return{name:Q.name,imageBitmap:Q.map.image}}),m=h.filter(Q=>Q.userData.shadeTexture).map(Q=>{if(!Q.userData.shadeTexture)throw new Error(Q.userData.shadeTexture+" map is null");return{name:Q.name+"_shade",imageBitmap:Q.userData.shadeTexture.image}}),y=h.filter(Q=>Q.roughnessMap).map(Q=>Q.roughnessMap?{name:Q.name+"_orm",imageBitmap:Q.roughnessMap.image}:null),w=h.filter(Q=>Q.roughnessMap).map(Q=>Q.normalMap?{name:Q.name+"_normal",imageBitmap:Q.normalMap.image}:null),x=[...g,...m,...y,...w].filter(Q=>Q!==null),_=fhe(x,d,s?"image/ktx2":"image/png"),B=hhe(_),T=dhe(_,s),b=uhe(h,x),M=t.children.filter(Q=>Q.children.length>0&&Q.children[0].type===ci.Bone)[0],O=t8(M).filter(Q=>Q.name!==r3),Y=O.map(Q=>Q.name),H=O.map(Q=>{const K=Q.children.filter(ie=>ie.name!==r3).map(ie=>Y.indexOf(ie.name));return{name:Q.name,rotation:[Q.quaternion.x,Q.quaternion.y,Q.quaternion.z,Q.quaternion.w],scale:[Q.scale.x,Q.scale.y,Q.scale.z],translation:[Q.position.x,Q.position.y,Q.position.z],children:K.length>0?K:void 0}}),I=[],v=t.children.filter(Q=>Q.type===ci.Group||Q.type===ci.SkinnedMesh),E=[];v.forEach((Q,K)=>{const ie=Q.type===ci.Group?Q.children[0]:Q,de=ie.geometry.attributes,me=new Gl(de.position,On.FLOAT,$t.POSITION,zo.VEC3,ie.name,void 0);E.push(me);const G=E.length-1,R=de.normal.array,S=new Float32Array(R.length);for(let se=0;sese):[Q]).forEach(se=>{if(!se.geometry.index)throw new Error(se.name+" geometry.index is null");E.push(new Gl(se.geometry.index,On.UNSIGNED_INT,$t.INDEX,zo.SCALAR,ie.name,se.name))}),ie.morphTargetDictionary||(ie.morphTargetDictionary={},ie.morphTargetInfluences=[],ie.geometry.morphAttributes={},ie.updateMorphTargets()),ie.geometry.userData.targetNames=[];const ae=(se,Ie,Te,Le)=>{const He=[],De=[];for(let he=0;he0){const he=[...He].sort((Fe,Ve)=>Fe-Ve),Me=[];for(let Fe=0;Fe({mesh:0,index:de.index,weight:de.weight*100}));if(ie.length>0){let de=!1;for(const me in Ur)if(Q===Ur[me]&&Q!=="surprised"){u.push({name:Q,presetName:ihe(Q),binds:ie,isBinary:K.isBinary}),de=!0;break}de===!1&&u.push({name:Q,presetName:"unknown",binds:ie,isBinary:K.isBinary})}}v.forEach(Q=>{const K=Q.type===ci.Group?Q.children[0]:Q,ie=new Float32Array(K.skeleton.boneInverses.map(de=>de.elements).flat());E.push(new Gl(new lt(ie,16),On.FLOAT,$t.BIND_MATRIX,zo.MAT4,K.name,K.name))}),I.push(...E.map(Q=>({componentType:Q.valueType,count:Q.attribute.count,max:Q.max,min:Q.min,normalized:!1,type:Q.accessorsType})));const L=Ahe(v,E,p);v.forEach((Q,K)=>{H.push({mesh:K,name:Q.name,rotation:[Q.quaternion.x,Q.quaternion.y,Q.quaternion.z,Q.quaternion.w],scale:[Q.scale.x,Q.scale.y,Q.scale.z],skin:K,translation:[Q.position.x,Q.position.y,Q.position.z]})});const U=che(v,E,Y),P={humanBones:[]};A.humanBones.forEach(Q=>{Y.indexOf(Q.node.name)!=-1&&P.humanBones.push({bone:she(Q.bone),node:Y.indexOf(Q.node.name),useDefaultValues:!0})});const z={floatProperties:{_DstBlend:.5,_ShadeShift:.5,_ShadeToony:.5,_ShadingGradeRate:.5},keywordMap:{_NORMALMAP:!1,MTOON_OUTLINE_COLOR_FIXED:!0,MTOON_OUTLINE_WIDTH_WORLD:!0},name:"VRMCombinedMat",renderQueue:2e3,shader:"VRM/MToon",tagMap:{RenderType:"Opaque"},textureProperties:{_MainTex:0,_ShadeTexture:0},vectorProperties:{_Color:[1,1,1,1],_EmissionColor:[0,0,0,1],_EmissionMap:[0,0,1,1],_MainTex:[0,0,1,1],_OutlineColor:[0,0,0,1],_OutlineWidthTexture:[0,0,1,1],_ReceiveShadowTexture:[0,0,1,1],_RimColor:[0,0,0,1],_RimTexture:[0,0,1,1],_ShadeColor:[.9,.9,.9,1]}},W={name:"STDCombinedMat",shader:"VRM_USE_GLTFSHADER"},N=[];h.forEach(Q=>{Q.type=="ShaderMaterial"?N.push(Object.assign({},z)):N.push(Object.assign({},W))});const C=l;i.forEach(Q=>{for(let K=0;KQ.isSkinnedMesh))==null?void 0:Be.skeleton)||null;for(let Q=0;Q{const me=de.sphere;ie.colliders.push({radius:me.radius*o,offset:{x:me.offset[0]*o,y:me.offset[1]*o,z:me.offset[2]*o}})}),j.push(ie)}}console.log("COLLIDER GROUPS",j);const F=Q=>{for(let K=0;K{var G;const K=F(Q.name);if(K===-1){console.warn("Spring bone "+Q.name+" was removed during cleanup process. Skipping.");return}const ie=[];Q.colliderGroups.forEach(R=>{const S=R.colliders[0];if(S!=null){const V=S.parent,te=j.findIndex(ae=>ae.name===V.name);te!=-1&&(ie.includes(te)||ie.push(te))}});let de=F((G=Q.center)==null?void 0:G.name);de==-1&&console.warn("no center bone for spring bone "+Q.name);const me=Q.settings;X.push({bones:[K],center:de,colliderGroups:ie,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:j};console.log(ue),C.texture=d?_.length-1:void 0;const re=await Promise.all(x.map(async Q=>({buffer:s?await i3(Q.imageBitmap):s3(Q.imageBitmap),type:$t.IMAGE})));E.forEach((Q,K)=>{Q.buffer?re.push({buffer:Q.buffer,typeString:"",type:Q.type}):Q.sparse&&(re.push({buffer:Q.sparse.indices,typeString:"indices",type:Q.type,count:Q.sparse.count}),re.push({buffer:Q.sparse.values,typeString:"values",type:Q.type})),re.length-1}),d&&re.push({buffer:s?await i3(d.imageBitmap):s3(d.imageBitmap),type:$t.IMAGE});let fe=0,oe=0,pe=0,xe=0;const _e=re.map(Q=>{const K={buffer:0,byteLength:Q.buffer.byteLength,byteOffset:fe,target:Q.type===$t.IMAGE||Q.type===$t.BIND_MATRIX||Q.typeString==="indices"||Q.typeString==="values"?void 0:Q.type===$t.INDEX?On.ELEMENT_ARRAY_BUFFER:On.ARRAY_BUFFER};return fe+=Q.buffer.byteLength,Q.type===$t.IMAGE?(_[oe++].bufferView=xe,xe++):E[pe].sparse?(I[pe].sparse==null&&(I[pe].sparse={}),Q.typeString==="indices"&&(I[pe].sparse.count=Q.count,I[pe].sparse[Q.typeString]={bufferView:xe,byteOffset:0,componentType:On.UNSIGNED_INT}),Q.typeString==="values"&&(I[pe].sparse[Q.typeString]={bufferView:xe,byteOffset:0}),Q.typeString==="values"&&pe++,xe++):(E[pe].bufferIndex=xe,I[pe].bufferView=xe,pe++,xe++),K}),D=phe(t,H);ahe(C);const Ae=["KHR_materials_unlit","KHR_texture_transform","VRM"];s&&Ae.push("KHR_texture_basisu");const le={accessors:I,asset:f,buffers:[{byteLength:fe}],bufferViews:_e,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:N,humanoid:P,meta:C,secondaryAnimation:ue,specVersion:"0.0"}},extensionsUsed:Ae,images:_,materials:b,meshes:L,nodes:H,samplers:B,scenes:D,skins:U,textures:T};console.log("output",le);const q=new o3(VC(JSON.stringify(le,void 0,2)),"JSON"),J=new o3(Lp(re.map(Q=>Q.buffer)),"BIN\0"),ce=Lp([q.buffer,J.buffer]),be=Lp([VC("glTF"),GC(2,4),GC(ce.byteLength+12,4)]);a(Lp([be,ce]))}}function ahe(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 t8(n){return n.children.length<=0?[n]:[n].concat(n.children.map(e=>t8(e)).flat())}const lhe=new the;async function i3(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 lhe.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 s3(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===On.UNSIGNED_SHORT?o.setUint16(i,A,!0):e===On.UNSIGNED_INT?o.setUint32(i,A,!0):o.setFloat32(i,A,!0),i+=t}return s}class o3{constructor(e,t){this.data=e,this.type=t;const r=this.padBuffer(this.data,t==="JSON"?32:0);this.buffer=Lp([GC(r.byteLength,4),VC(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 a3=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===ci.Group?r.children[0]:r,s=r.type===ci.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($t.SKIN_INDEX),NORMAL:a.indexOf($t.NORMAL),POSITION:a.indexOf($t.POSITION),TEXCOORD_0:a.indexOf($t.UV),WEIGHTS_0:a.indexOf($t.SKIN_WEIGHT)},extras:{targetNames:o.geometry.userData.targetNames},indices:e.map(A=>A.type===$t.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===$t.BLEND_NORMAL&&h.meshName===i.name?h.name:null).indexOf(zC+A),u=e.map(h=>h.type===$t.BLEND_POSITION&&h.meshName===i.name?h.name:null).indexOf(zC+A),f={};return u!==-1&&(f.POSITION=u),c!==-1&&(f.NORMAL=c),f}):void 0}})}}),che=(n,e,t)=>n.map(r=>{const i=r.type===ci.Group?r.children[0]:r;return{inverseBindMatrices:e.map(s=>s.type===$t.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)}}),uhe=(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 Wf.MeshStandardMaterial:return t.metalness;case Wf.MeshBasicMaterial:return 0;default:return 0}})(),p=(()=>{switch(t.type){case Wf.MeshStandardMaterial:return t.roughness;case Wf.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}),fhe=(n,e,t)=>(e?n.concat(e):n).filter(r=>r&&r.imageBitmap).map(r=>({bufferView:-1,mimeType:t,name:r.name})),hhe=n=>n.map(()=>({magFilter:On.LINEAR,minFilter:On.LINEAR,wrapS:On.REPEAT,wrapT:On.REPEAT})),dhe=(n,e)=>e?n.map((t,r)=>({sampler:0,extensions:{KHR_texture_basisu:{source:r}}})):n.map((t,r)=>({sampler:0,source:r})),phe=(n,e)=>{const t=e.map(r=>r.name);return[{nodes:n.children.filter(r=>r.type===ci.Object3D||r.type===ci.SkinnedMesh||r.type===ci.Group||r.type===ci.Bone).map(r=>t.indexOf(r.name))}]};function mhe(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=vhe(r),o=ghe(s,i);return o.licenseUrl="https://vrm.dev/licenses/1.0/",o.name=t,o}function ghe(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(ut(b.authors)),r=r.concat(ut(b.otherLicenseUrl)),i=i.concat(ut(b.contactInformation)),s=s.concat(ut(b.references)),u=u.concat(ut(b.otherPermissionUrl)),b.allowExcessivelyViolentUsage===!1&&(o=!1),b.allowExcessivelySexualUsage===!1&&(a=!1),l=Za(xhe,l,b.commercialUsage),A=Za(n8,A,b.copyrightInformation),c=Za(_he,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(ut(b.thirdPartyLicenses)),g=Za(whe,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"),B=[...new Set(u)].filter(b=>b!=""&&b!=null&&b!="undefined"),T=[...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:B.length==0?"":B.join(", "),thirdPartyLicenses:T.length==0?"":T.join(", "),allowExcessivelyViolentUsage:o,allowExcessivelySexualUsage:a,commercialUsage:l,copyrightInformation:A,avatarPermission:c,allowAntisocialOrHateUsage:f,allowPoliticalOrReligiousUsage:h,allowRedistribution:p,creditNotation:d,modification:g}}function vhe(n){let e=[],t=[],r=[],i=[],s=[],o,a,l,A,c;n.forEach(g=>{e=e.concat(ut(g.author)),t=t.concat(ut(g.contactInformation)),r=r.concat(ut(g.reference)),i=i.concat(ut(g.otherPermissionUrl)),s=s.concat(ut(g.otherLicenseUrl)),o=Za(bhe,o,g.allowedUsername),a=Za(rB,a,g.violentUssageName),l=Za(rB,l,g.sexualUssageName),A=Za(rB,A,g.commercialUssageName),c=Za(n8,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:yhe(o),otherPermissionUrl:p}}function yhe(n){if(n=="OnlyAuthor")return"onlyAuthor";if(n=="ExplicitlyLicensedPerson")return"onlySeparatelyLicensedPerson";if(n=="Everyone")return"everyone"}const whe={prohibited:0,allowModification:1,allowModificationRedistribution:2},xhe={personalNonProfit:0,personalProfit:1,corporation:2},_he={onlyAuthor:0,onlySeparatelyLicensedPerson:1,everyone:2},bhe={OnlyAuthor:0,ExplicitlyLicensedPerson:1,Everyone:2},rB={Disallow:0,Allow:1},n8={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 Za(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 Bhe(n){const e=r8(n);let t;const r=[];e.traverse(s=>{if(!t&&s.isSkinnedMesh&&(t=G6(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 Oh,s.material.map=o[0].map}s.userData.origIndexBuffer&&s.geometry.setIndex(s.userData.origIndexBuffer)}});const i=new Pr;return r.forEach(s=>{i.add(s)}),i.add(t.bones[0]),i}async function Ehe(n,e,t){const r=await xT(n,t),i=await i8(r,e,t);return new Blob([i],{type:"model/gltf-binary"})}function Che(n,e,t,r){return new Promise(async(i,s)=>{const o=`${t&&t!==""?t:"AvatarCreatorModel"}`;Mhe(n,e,r).then(a=>{o8(a,`${o}.vrm`),i()})})}async function Mhe(n,e,t){const r=await xT(n,e,t);return i8(r,e,t)}function xT(n,e,t){const r=r8(n);t.mergeAppliedMorphs=!0;const{createTextureAtlas:i=!0}=t;return i?hfe(r,e,t):(console.log("no atlas"),cfe(r,e,t))}async function She(n,e="",t){const r=`${e&&e!==""?e:"AvatarCreatorModel"}`,{optimized:i=!0}=t,s=i?await xT(n,t):Bhe(n);The(s).then(o=>{if(o instanceof ArrayBuffer)o8(o,`${r}.glb`);else{const a=JSON.stringify(o,null,2);Lhe(a,`${r}.gltf`)}})}function The(n){return new Promise(e=>new rT().parse(n,r=>{e(r)},r=>{console.error("Error parsing",r)},{trs:!1,onlyVisible:!1,truncateDrawRange:!0,binary:!0,forcePowerOfTwoTextures:!1,maxTextureSize:1024}))}function Ihe(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 Vm)if(s.bone.parent.name==Vm[o]){t.push(s);break}}),t}function Rhe(n){const e={};return n.skeleton.bones.map(t=>{for(const r in Vm)if(Vm[r]===t.name){e[t.name]={node:t};break}}),e}function Fhe(n,e,t){const r=Qh(n,"SkinnedMesh");return{humanBones:Rhe(r[0]),materials:n.userData.atlasMaterial,meta:Uhe(e),...t.mergeAppliedMorphs?{expressionManager:Ohe(n)}:{}}}function Uhe(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 i8(n,e,t){const{screenshot:r=null,isVrm0:i=!1,vrmMeta:s=null,scale:o=1,vrmName:a="CharacterCreator"}=t,l=mhe(e,s,a);return new Promise(async A=>{const c=i?new ohe:new oue,u={...Dhe(e),...Fhe(n,l,t)};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=Ihe(e);c.parse(u,n,r,p,t.ktxCompression,o,d=>{A(d)})})}function s8(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 Lhe(n,e){s8(new Blob([n],{type:"text/plain"}),e)}function o8(n,e){s8(Phe(n),e)}function Phe(n){return new Blob([n],{type:"application/octet-stream"})}function Dhe(n){for(const e in n)if(n[e].vrm)return n[e].vrm}function Ohe(n){const e=new Ew;let t=n.userData.expressionManagerToClone;if(!t){t=new Ew;for(const r of Object.values(Ur)){const i=new Bw(r);t.registerExpression(i)}}e.copy(t),n.userData.expressionManagerToClone=null;for(const r of n.children){if(!r.isMesh&&!r.isSkinnedMesh||!r.morphTargetDictionary)continue;const i=r.userData.bindMorphs;if(!i||!Bfe(r,i.old))continue;const o=(A,c)=>{var u;return((u=A.find(f=>f.index==c))==null?void 0:u.weight)||0},a=Object.entries(Ur).flat(),l=Object.keys(i.old).filter(A=>a.includes(A));for(const A of Object.keys(t.expressionMap)){const c=t.expressionMap[A];if(!c)continue;const u=c._binds;if(!u||u.length==0){e.unregisterExpression(c);continue}for(const f of l){const h=i.new[f]||i.new[f.toLowerCase()],p=i.old[f]||i.old[f.toLowerCase()];if(h){const d=[];n.traverse(y=>{!y.isMesh&&!y.isSkinnedMesh||h.primitives.includes(y.id)&&d.push(y)}),e.unregisterExpression(c),c._binds=[];const g=o(u,p.index),m=new Bw(c.expressionName);m.copy(c),console.log("adding bind",c.expressionName),m.addBind(new EC({index:h.index,weight:g,primitives:d})),e.registerExpression(m)}else e.unregisterExpression(c)}}}return e}const Nhe=n=>{var e,t;(e=n.parser.json.extensions)!=null&&e.VRM?khe(n):(t=n.parser.json.extensions)!=null&&t.VRMC_vrm?Qhe(n):console.warn("No valid vrm file was provided")},khe=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=>a8(c.name,s));i!=null&&i.forEach(c=>{const u=o[c.node],f=$6(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=Y6()})},Qhe=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=>a8(f.name,o));i!=null&&i.forEach(f=>{const h=ut(f.colliders);let p=-1,d=null;h.forEach(g=>{if(p!=s[g].node){p=s[g].node;const m=a[p];d=$6(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=Y6(),d.userData.VRMcolliders.push(m)}else console.error("no node with name "+a[p]+" was found")})})},a8=(n,e)=>{const t=_t.sanitizeNodeName(n||"");return t in e?t+"_"+ ++e[t]:(e[t]=0,t)},Uw=[0,400,560,2400,4800],Lw=[0,500,700,3e3,6e3],jC=[],za=[],_T=1024,l8=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=Pw.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=_T,this.mediaStreamSource&&this.mediaStreamSource.stop(),this.audioContext.decodeAudioData(e).then(t=>{this.mediaStreamSource=this.audioContext.createBufferSource(),this.mediaStreamSource.buffer=t,this.meter=Pw.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(Ur.Oh,0),this.vrm.expressionManager.setValue(Ur.Ah,0),this.vrm.expressionManager.setValue(Ur.Ee,0);else{const{ah:r,oh:i,ee:s}=this.update2();this.vrm.expressionManager.setValue(Ur.Oh,i),this.vrm.expressionManager.setValue(Ur.Ah,r),this.vrm.expressionManager.setValue(Ur.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]/=za[A+1]-za[A]}for(let A=0;A0&&(s[A]+=r[c]);i[A]/=za[A+1]-za[A],s[A]=s[A]/(jC[A+1]-jC[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 iB=new Z;class Hhe{constructor(e,t,r){this.bonesInfo=[],this.curMousePos=new Ke,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(){iB.set(0,0,1),iB.applyQuaternion(this.camera.quaternion);const e=iB.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 sB{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:B,canDownload:T=!0,downloadOptions:b={}}=e;this.assetsLocation=t,this.traitsDirectory=r,this.thumbnailsDirectory=i,this.traitIconsDirectorySvg=s,this.displayScale=l||a||1,this.animationPath=ut(o),this.requiredTraits=ut(c),this.randomTraits=ut(u),this.initialTraits=A||[...new Set(this.requiredTraits.concat(this.randomTraits))],this.colliderTraits=ut(f),this.lipSyncTraits=ut(h),this.blinkerTraits=ut(p),this.typeRestrictions=d,this.defaultCullingLayer=g,this.defaultCullingDistance=m,this.offset=y,this.canDownload=T,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)ut(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(B),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)}getAllBlendShapeTraits(){return this.modelTraits.map(e=>e.getCollection()).flat().map(e=>e.blendshapeTraits).flat().map(e=>e==null?void 0:e.collection).flat().filter(e=>!!e)}isColliderRequired(e){return this.colliderTraits.indexOf(e)!=-1}isLipsyncTrait(e){return this.lipSyncTraits.indexOf(e)!=-1}async getNFTraitOptionsFromURL(e,t){const r=await this._fetchJson(e);return this.getNFTraitOptionsFromObject(r,t)}getNFTraitOptionsFromObject(e,t){const r=e.attributes;if(r){t=ut(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 oB(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 oB(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 oB(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=[]),ut(e).forEach(r=>{this.modelTraits.push(new zhe(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=[]),ut(e).forEach(r=>{this.textureTraits.push(new Ghe(this,r))}),this.textureTraitsMap=new Map(this.textureTraits.map(r=>[r.trait,r]))}createColorTraits(e,t=!1){t&&(this.colorTraits=[]),ut(e).forEach(r=>{this.colorTraits.push(new Vhe(this,r))}),this.colorTraitsMap=new Map(this.colorTraits.map(r=>[r.trait,r]))}}class zhe{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=[]),ut(e).forEach(r=>{this.collection.push(new l3(this,r))}),this.collectionMap=new Map(this.collection.map(r=>[r.id,r]))}getCustomTrait(e){return new l3(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 Ghe{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=[]),ut(e).forEach(r=>{this.collection.push(new Whe(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 Vhe{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=[]),ut(e).forEach(r=>{this.collection.push(new Khe(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 l3{constructor(e,t){kt(this,"blendshapeTraits",[]);kt(this,"blendshapeTraitsMap",new Map);const{id:r,directory:i,name:s,thumbnail:o,cullingDistance:a,cullingLayer:l,type:A=[],textureCollection:c,blendshapeTraits:u,colorCollection:f,fullDirectory:h,fullThumbnail:p}=t;if(this.manifestData=e.manifestData,this.traitGroup=e,this.id=r,this.directory=i,h)this.fullDirectory=h;else if(Array.isArray(i)){this.fullDirectory=[];for(let d=0;dnew jhe(this,d)),this.blendshapeTraitsMap=new Map(this.blendshapeTraits.map(d=>[d.trait,d])))}isRestricted(e){if(e==null)return!1;const t=e.traitGroup.trait;if(this.traitGroup.restrictedTraits.indexOf(t)!=-1)return!0;if(this.type.length>0&&this.manifestData.restrictedTypes>0){const r=(o,a)=>{if(o==null||a==null)return!1;for(let l=0;lr(i[o],s))}return!1}getGroupBlendShapeTraits(){return this.blendshapeTraits}getBlendShapes(e){var t,r;return(r=(t=this.blendshapeTraitsMap)==null?void 0:t.get(e))==null?void 0:r.collection}getBlendShape(e,t){var r,i;return(i=(r=this.blendshapeTraitsMap)==null?void 0:r.get(e))==null?void 0:i.getTrait(t)}}class jhe{constructor(e,t){kt(this,"trait");kt(this,"name");kt(this,"isBlendShapeGroup",!0);kt(this,"collection",[]);kt(this,"cameraTarget",null);kt(this,"collectionMap",null);const{trait:r,name:i,collection:s,cameraTarget:o=e.traitGroup.cameraTarget||{distance:3,height:1}}=t;this.modelTrait=e,this.trait=r,this.name=i,this.cameraTarget=o,this.createCollection(s)}createCollection(e,t=!1){t&&(this.collection=[]),ut(e).forEach(r=>{this.collection.push(new A8(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 A8{constructor(e,t){kt(this,"id");kt(this,"name");kt(this,"fullThumbnail");kt(this,"isBlendShape",!0);const{id:r,name:i,fullThumbnail:s}=t;r||console.warn("BlendShapeTrait is missing id, parent trait: "+e.trait),i||console.warn("BlendShapeTrait is missing name, parent trait: "+e.trait),this.parentGroup=e,this.id=r,this.fullThumbnail=s,this.name=i}getGroupId(){return this.parentGroup.trait}}class Whe{constructor(e,t){const{id:r,directory:i,fullDirectory:s,name:o,thumbnail:a}=t;if(this.traitGroup=e,this.id=r,this.directory=i,s)this.fullDirectory=s;else if(Array.isArray(i)){this.fullDirectory=[];for(let l=0;l{e.traverse(i=>{if(i.isMesh||i.isSkinnedMesh){const s=i;if(!s.morphTargetDictionary||!s.morphTargetInfluences)return;const o=s.morphTargetDictionary[t.id];o!=null&&(s.morphTargetInfluences[o]=r?1:0)}})});this._start(e)}async _start(e){const{parentModel:t=null,renderCamera:r=null,manifestURL:i=null}=e;this.rootModel=new It,this.characterModel=new It,this.parentModel=t,t&&t.add(this.rootModel),this.lipSync=null,this.lookAtManager=null,this.animationManager=new Tfe,this.screenshotManager=new Qfe(this,t||this.rootModel),this.blinkManager=new zfe(.1,.1,.5,5),this.rootModel.add(this.characterModel),this.renderCamera=r,this.manifestData=null,this.manifest=null,i&&(this.loadManifest(i),this.animationManager.setScale(this.manifestData.displayScale)),this.avatar={},this.storedAvatar={},this.traitLoadManager=new Xhe;const s=new Pr;s.renderOrder=1e4,this.rootModel.add(s),this.vrmHelperRoot=s}update(){this.lookAtManager!=null&&this.lookAtManager.update()}addLookAtMouse(e,t,r,i=!0){var s;this.lookAtManager=new Hhe(e,t,r),this.lookAtManager.enabled=!0;for(const o in this.avatar)((s=this.avatar[o])==null?void 0:s.vrm)!=null&&this.lookAtManager.addVRM(this.avatar[o].vrm)}toggleCharacterLookAtMouse(e){this.lookAtManager!=null?(this.lookAtManager.setActive(e),this.animationManager&&this.animationManager.enableMouseLook(e)):console.warn("toggleCharacterLookAtMouse() was called, but no lookAtManager exist. Make sure to set it up first with addLookArMous()")}savePortraitScreenshot(e,t,r,i=1,s=0){this.blinkManager.enableScreenshot(),this.characterModel.traverse(o=>{o.isSkinnedMesh&&o.skeleton.bones.filter(l=>l.name==="head")[0].getWorldPosition(Oa)}),Oa.z+=.3,Oa.y+=s,this.screenshotManager.cameraFrameManager.setCamera(Oa,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 lt(new Uint32Array(w),1,!1)}m!=1&&c&&(y.splice(m,3),u.userData.clippedIndexGeometry=new lt(new Uint32Array(y),1,!1))}};aB.x=e,aB.y=t,i(),A3.setFromCamera(aB,this.renderCamera);const l=A3.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 uy({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 Che(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};She(this.characterModel,e,r)}else console.error("Download not supported")}getAvatarSelection(){var t;var e={};for(const r in this.avatar)e[r]={name:this.avatar[r].name,id:(t=this.avatar[r].traitInfo)==null?void 0:t.id};return e}getBoneTriangleCount(){let e=0,t=new Set;for(const r in this.avatar)this.avatar[r].model.traverse(i=>{i.isMesh&&(e+=i.geometry.index.array.length),i.isSkinnedMesh&&i.skeleton.bones.forEach(s=>{t.add(s.name)})});return{triangles:e/3,bones:t.size}}getGroupTraits(){if(this.manifestData)return this.manifestData.getGroupModelTraits()}getBlendShapeGroupTraits(e,t){var r;return this.manifestData?(r=this.manifestData.getModelTrait(e,t))==null?void 0:r.getGroupBlendShapeTraits():[]}getCurrentCharacterModel(){return this.characterModel}isTraitGroupRequired(e){const t=this.manifestData.getModelGroup(e);return!!(t!=null&&t.isRequired)}getTraits(e){return this.manifestData?this.manifestData.getModelTraits(e):(console.warn("No manifest file has been loaded, please load it before trait models."),null)}getCurrentTraitID(e){var t,r;return(r=(t=this.avatar[e])==null?void 0:t.traitInfo)==null?void 0:r.id}getCurrentTraitData(e){var t;return(t=this.avatar[e])==null?void 0:t.traitInfo}getCurrentBlendShapeTraitData(e){var t;return((t=this.avatar[e])==null?void 0:t.blendShapeTraitsInfo)||{}}getCurrentTraitVRM(e){var t;return(t=this.avatar[e])==null?void 0:t.vrm}setParentModel(e){e.add(this.rootModel),this.parentModel=e,this.screenshotManager&&this.screenshotManager.setScene(this.parentModel)}setRenderCamera(e){this.renderCamera=e}loadRandomTraits(){return new Promise(async(e,t)=>{if(this.manifestData){const r=this.manifestData.getRandomTraits();await this._loadTraits(r),e()}else{const r="No manifest was loaded, random traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadRandomTrait(e){return new Promise(async(t,r)=>{if(this.manifestData){const i=this.manifestData.getRandomTrait(e);await this._loadTraits(ut(i)),t()}else{const i="No manifest was loaded, random traits cannot be loaded.";console.error(i),r(new Error(i))}})}loadTraitsFromNFT(e,t=!0,r=null){return new Promise(async(i,s)=>{try{if(this.manifestData){const o=this.manifestData.getNFTraitOptionsFromURL(e,r);await this._loadTraits(o,t),i()}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}}catch(o){s(o)}})}loadTraitsFromNFTObject(e,t=!0,r=null){return new Promise(async(i,s)=>{if(this.manifestData)try{const o=this.manifestData.getNFTraitOptionsFromObject(e,r);await this._loadTraits(o,t),i()}catch(o){console.error("Error loading traits from NFT object:",o.message),s(new Error("Failed to load traits from NFT object."))}else{const o="No manifest was loaded, NFT traits cannot be loaded.";console.error(o),s(new Error(o))}})}loadInitialTraits(){return new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getInitialTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadAllTraits(){return console.log("load all"),new Promise(async(e,t)=>{if(this.manifestData)await this._loadTraits(this.manifestData.getAllTraits()),e();else{const r="No manifest was loaded, initial traits cannot be loaded.";console.error(r),t(new Error(r))}})}loadBlendShapeTrait(e,t,r){if(!this.avatar[e]){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(!this.manifestData){console.warn("No manifest data was found.");return}try{this._loadBlendShapeTrait(e,t,r)}catch{console.error("Error loading blendshape trait "+e,t,r)}}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(ut(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(ut(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 gfe(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 ke(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 ke(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 uy({traitGroupID:e,traitModel:null});this._addLoadedData(i),qb(this.avatar)}else console.warn(`No trait with name: ${e} was found.`)}updateCullHiddenMeshes(){qb(this.avatar)}loadOptimizerManifest(){this.manifest={colliderTraits:["CUSTOM"],traits:[{name:"Custom",trait:"CUSTOM",collection:[]}]},this.manifestData=new sB(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 sB(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 sB(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=ut(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(ut(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 uy({traitGroupID:s.trait,traitModel:null}))}),r.forEach(i=>{this._addLoadedData(i)}),qb(this.avatar)})}async _loadBlendShapeTrait(e,t,r){const i=this.avatar[e];if(!i){console.warn(`Trait with name: ${e} was not found or not selected.`);return}if(i.blendShapeTraitsInfo||(i.blendShapeTraitsInfo={}),i.blendShapeTraitsInfo[t]&&this.toggleBinaryBlendShape(i.model,i.blendShapeTraitsInfo[t],!1),r==null){delete this.avatar[e].blendShapeTraitsInfo[t];return}const s=i.traitInfo.getBlendShape(t,r);if(!s){console.warn(`Blendshape with name: ${r} was not found.`);return}this.toggleBinaryBlendShape(i.model,s,!0),this.avatar[e].blendShapeTraitsInfo[s.getGroupId()]=s}async _animationManagerSetup(e,t,r){const i=ut(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(Oa)});const{screenshotResolution:r,screenshotFaceDistance:i,screenshotFaceOffset:s,screenshotBackground:o,screenshotFOV:a}=t,l=r[0],A=r[1];Oa.x+=s[0],Oa.y+=s[1],Oa.z+=s[2],this.screenshotManager.setBackground(o),this.screenshotManager.cameraFrameManager.setCamera(Oa,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 ke(o,a,l)},r=new Mi({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($P(o,{isVRM0:((a=o.meta)==null?void 0:a.metaVersion)==="0"}),this.manifestData.isColliderRequired(r)&&Nhe(e),bfe(o),this.manifestData.isLipsyncTrait(r)&&(this.lipSync=new Pw(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",mfe(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=ut((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);$P(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&&ut(u.material).map(p=>{$he(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 ke(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),_fe(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,blendShapeTraitsInfo:{},textureInfo:i,colorInfo:s,name:r.name,model:A&&A.scene,vrm:A})}}class Xhe{constructor(){const e=new VH;e.onProgress=(i,s,o)=>{this.setLoadPercentage(Math.round(s/o*100))};const t=new ZH(e);t.crossOrigin="anonymous",t.register(i=>new eue(i,{autoUpdateHumanBones:!0}));const r=new ou(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(ut((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(ut((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=wt,p(d)},null,d=>{console.error("error loading texture: ",d),p(null)})}))),A=ut((f=s==null?void 0:s.traitColor)==null?void 0:f.value).map(h=>new ke(h));r[o]=new uy({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 uy{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 $he(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 Zhe(n){const e=new fw,t=new KH(16777215,.5);e.add(t);const r=new eT(16777215,.5);r.position.set(0,1,1),e.add(r);const i=new It;e.add(i);const s=new Er(30,window.innerWidth/window.innerHeight,.1,1e3);s.position.set(0,1.3,2);const o=new Yhe({parentModel:e,createAnimationManager:!0,renderCamera:s});o.addLookAtMouse(80,n,s,!0);const a=document.getElementById(n),l=new dg({canvas:a,antialias:!0,alpha:!0,preserveDrawingBuffer:!0}),A=new Lne(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.7,.5),f=()=>{l.setSize(window.innerWidth,window.innerHeight),s.aspect=window.innerWidth/window.innerHeight,s.updateProjectionMatrix()};window.addEventListener("resize",f),l.setSize(window.innerWidth,window.innerHeight),l.setPixelRatio(window.devicePixelRatio),l.outputEncoding=wt;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 pv(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 c8={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -4319,9 +4319,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 pv=="function"&&pv;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 pv=="function"&&pv,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,T=y!==A.utf8encode,b=a.transformTo("string",y(_.name)),M=a.transformTo("string",A.utf8encode(_.name)),D=_.comment,Y=a.transformTo("string",y(D)),H=a.transformTo("string",A.utf8encode(D)),I=M.length!==_.name.length,v=H.length!==D.length,B="",F="",P="",O=_.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 Q=0;p&&(Q|=8),T||!I&&!v||(Q|=2048);var E=0,G=0;O&&(E|=16),m==="UNIX"?(G=798,E|=function(U,X){var ae=U;return U||(ae=X?16893:33204),(65535&ae)<<16}(_.unixPermissions,O)):(G=20,E|=function(U){return 63&(U||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&&(F=s(1,1)+s(c(b),4)+M,B+="up"+s(F.length,2)+F),v&&(P=s(1,1)+s(c(Y),4)+H,B+="uc"+s(P.length,2)+P);var ee="";return ee+=` -\0`,ee+=s(Q,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(B.length,2),{fileRecord:u.LOCAL_FILE_HEADER+ee+b+B,dirRecord:u.CENTRAL_FILE_HEADER+s(G,2)+ee+s(Y.length,2)+"\0\0\0\0"+s(E,4)+s(g,4)+b+B+Y}}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,T){y.push(C),d&&d(T)}).on("error",function(C){y=[],m(C)}).on("end",function(){try{var C=function(T,b,M){switch(T){case"blob":return s.newBlob(s.transformTo("arraybuffer",b),M);case"base64":return l.encode(b);default:return s.transformTo(T,b)}}(x,function(T,b){var M,D=0,Y=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,T=2*x+1,b=15,M=3,D=258,Y=D+M+1,H=42,I=113,v=1,B=2,F=3,P=4;function O(L,ue){return L.msg=c[ue],ue}function z(L){return(L<<1)-(4L.avail_out&&(Ae=L.avail_out),Ae!==0&&(o.arraySet(L.output,ue.pending_buf,ue.pending_out,Ae,L.next_out),L.next_out+=Ae,ue.pending_out+=Ae,L.total_out+=Ae,L.avail_out-=Ae,ue.pending-=Ae,ue.pending===0&&(ue.pending_out=0))}function E(L,ue){a._tr_flush_block(L,0<=L.block_start?L.block_start:-1,L.strstart-L.block_start,ue),L.block_start=L.strstart,Q(L.strm)}function G(L,ue){L.pending_buf[L.pending++]=ue}function ee(L,ue){L.pending_buf[L.pending++]=ue>>>8&255,L.pending_buf[L.pending++]=255&ue}function U(L,ue){var Ae,q,J=L.max_chain_length,ce=L.strstart,be=L.prev_length,Be=L.nice_match,k=L.strstart>L.w_size-Y?L.strstart-(L.w_size-Y):0,W=L.window,re=L.w_mask,he=L.prev,me=L.strstart+D,V=W[ce+be-1],R=W[ce+be];L.prev_length>=L.good_match&&(J>>=2),Be>L.lookahead&&(Be=L.lookahead);do if(W[(Ae=ue)+be]===R&&W[Ae+be-1]===V&&W[Ae]===W[ce]&&W[++Ae]===W[ce+1]){ce+=2,Ae++;do;while(W[++ce]===W[++Ae]&&W[++ce]===W[++Ae]&&W[++ce]===W[++Ae]&&W[++ce]===W[++Ae]&&W[++ce]===W[++Ae]&&W[++ce]===W[++Ae]&&W[++ce]===W[++Ae]&&W[++ce]===W[++Ae]&&cek&&--J!=0);return be<=L.lookahead?be:L.lookahead}function X(L){var ue,Ae,q,J,ce,be,Be,k,W,re,he=L.w_size;do{if(J=L.window_size-L.lookahead-L.strstart,L.strstart>=he+(he-Y)){for(o.arraySet(L.window,L.window,he,he,0),L.match_start-=he,L.strstart-=he,L.block_start-=he,ue=Ae=L.hash_size;q=L.head[--ue],L.head[ue]=he<=q?q-he:0,--Ae;);for(ue=Ae=he;q=L.prev[--ue],L.prev[ue]=he<=q?q-he:0,--Ae;);J+=he}if(L.strm.avail_in===0)break;if(be=L.strm,Be=L.window,k=L.strstart+L.lookahead,W=J,re=void 0,re=be.avail_in,W=M)for(ce=L.strstart-L.insert,L.ins_h=L.window[ce],L.ins_h=(L.ins_h<=M&&(L.ins_h=(L.ins_h<=M)if(q=a._tr_tally(L,L.strstart-L.match_start,L.match_length-M),L.lookahead-=L.match_length,L.match_length<=L.max_lazy_match&&L.lookahead>=M){for(L.match_length--;L.strstart++,L.ins_h=(L.ins_h<=M&&(L.ins_h=(L.ins_h<=M&&L.match_length<=L.prev_length){for(J=L.strstart+L.lookahead-M,q=a._tr_tally(L,L.strstart-1-L.prev_match,L.prev_length-M),L.lookahead-=L.prev_length-1,L.prev_length-=2;++L.strstart<=J&&(L.ins_h=(L.ins_h<L.pending_buf_size-5&&(Ae=L.pending_buf_size-5);;){if(L.lookahead<=1){if(X(L),L.lookahead===0&&ue===u)return v;if(L.lookahead===0)break}L.strstart+=L.lookahead,L.lookahead=0;var q=L.block_start+Ae;if((L.strstart===0||L.strstart>=q)&&(L.lookahead=L.strstart-q,L.strstart=q,E(L,!1),L.strm.avail_out===0)||L.strstart-L.block_start>=L.w_size-Y&&(E(L,!1),L.strm.avail_out===0))return v}return L.insert=0,ue===f?(E(L,!0),L.strm.avail_out===0?F:P):(L.strstart>L.block_start&&(E(L,!1),L.strm.avail_out),v)}),new de(4,4,8,4,ae),new de(4,5,16,8,ae),new de(4,6,32,32,ae),new de(4,4,16,16,oe),new de(8,16,32,32,oe),new de(8,16,128,128,oe),new de(8,32,128,256,oe),new de(32,128,258,1024,oe),new de(32,258,258,4096,oe)],i.deflateInit=function(L,ue){return xe(L,ue,y,15,8,0)},i.deflateInit2=xe,i.deflateReset=_e,i.deflateResetKeep=pe,i.deflateSetHeader=function(L,ue){return L&&L.state?L.state.wrap!==2?p:(L.state.gzhead=ue,h):p},i.deflate=function(L,ue){var Ae,q,J,ce;if(!L||!L.state||5>8&255),G(q,q.gzhead.time>>16&255),G(q,q.gzhead.time>>24&255),G(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),G(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(G(q,255&q.gzhead.extra.length),G(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(L.adler=A(L.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(G(q,0),G(q,0),G(q,0),G(q,0),G(q,0),G(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),G(q,3),q.status=I);else{var be=y+(q.w_bits-8<<4)<<8;be|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(be|=32),be+=31-be%31,q.status=I,ee(q,be),q.strstart!==0&&(ee(q,L.adler>>>16),ee(q,65535&L.adler)),L.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&&(L.adler=A(L.adler,q.pending_buf,q.pending-J,J)),Q(L),J=q.pending,q.pending!==q.pending_buf_size));)G(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>J&&(L.adler=A(L.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&&(L.adler=A(L.adler,q.pending_buf,q.pending-J,J)),Q(L),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(L.adler=A(L.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&&(L.adler=A(L.adler,q.pending_buf,q.pending-J,J)),Q(L),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(L.adler=A(L.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&&Q(L),q.pending+2<=q.pending_buf_size&&(G(q,255&L.adler),G(q,L.adler>>8&255),L.adler=0,q.status=I)):q.status=I),q.pending!==0){if(Q(L),L.avail_out===0)return q.last_flush=-1,h}else if(L.avail_in===0&&z(ue)<=z(Ae)&&ue!==f)return O(L,-5);if(q.status===666&&L.avail_in!==0)return O(L,-5);if(L.avail_in!==0||q.lookahead!==0||ue!==u&&q.status!==666){var Be=q.strategy===2?function(k,W){for(var re;;){if(k.lookahead===0&&(X(k),k.lookahead===0)){if(W===u)return v;break}if(k.match_length=0,re=a._tr_tally(k,0,k.window[k.strstart]),k.lookahead--,k.strstart++,re&&(E(k,!1),k.strm.avail_out===0))return v}return k.insert=0,W===f?(E(k,!0),k.strm.avail_out===0?F:P):k.last_lit&&(E(k,!1),k.strm.avail_out===0)?v:B}(q,ue):q.strategy===3?function(k,W){for(var re,he,me,V,R=k.window;;){if(k.lookahead<=D){if(X(k),k.lookahead<=D&&W===u)return v;if(k.lookahead===0)break}if(k.match_length=0,k.lookahead>=M&&0k.lookahead&&(k.match_length=k.lookahead)}if(k.match_length>=M?(re=a._tr_tally(k,1,k.match_length-M),k.lookahead-=k.match_length,k.strstart+=k.match_length,k.match_length=0):(re=a._tr_tally(k,0,k.window[k.strstart]),k.lookahead--,k.strstart++),re&&(E(k,!1),k.strm.avail_out===0))return v}return k.insert=0,W===f?(E(k,!0),k.strm.avail_out===0?F:P):k.last_lit&&(E(k,!1),k.strm.avail_out===0)?v:B}(q,ue):s[q.level].func(q,ue);if(Be!==F&&Be!==P||(q.status=666),Be===v||Be===F)return L.avail_out===0&&(q.last_flush=-1),h;if(Be===B&&(ue===1?a._tr_align(q):ue!==5&&(a._tr_stored_block(q,0,0,!1),ue===3&&(K(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),Q(L),L.avail_out===0))return q.last_flush=-1,h}return ue!==f?h:q.wrap<=0?1:(q.wrap===2?(G(q,255&L.adler),G(q,L.adler>>8&255),G(q,L.adler>>16&255),G(q,L.adler>>24&255),G(q,255&L.total_in),G(q,L.total_in>>8&255),G(q,L.total_in>>16&255),G(q,L.total_in>>24&255)):(ee(q,L.adler>>>16),ee(q,65535&L.adler)),Q(L),0=Ae.w_size&&(ce===0&&(K(Ae.head),Ae.strstart=0,Ae.block_start=0,Ae.insert=0),W=new o.Buf8(Ae.w_size),o.arraySet(W,ue,re-Ae.w_size,Ae.w_size,0),ue=W,re=Ae.w_size),be=L.avail_in,Be=L.next_in,k=L.input,L.avail_in=re,L.next_in=0,L.input=ue,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)B[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)>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,B;return H&&H.state?(B=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):(B<(F=P.wsize-P.wnext)&&(F=B),s.arraySet(P.window,I,v-B,F,P.wnext),(B-=F)?(s.arraySet(P.window,I,v-B,B,0),P.wnext=B,P.whave=P.wsize):(P.wnext+=F,P.wnext===P.wsize&&(P.wnext=0),P.whave>>8&255,v.check=a(v.check,ce,2,0),E=Q=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&Q)<<8)+(Q>>8))%31){H.msg="incorrect header check",v.mode=30;break}if((15&Q)!=8){H.msg="unknown compression method",v.mode=30;break}if(E-=4,L=8+(15&(Q>>>=4)),v.wbits===0)v.wbits=L;else if(L>v.wbits){H.msg="invalid window size",v.mode=30;break}v.dmax=1<>8&1),512&v.flags&&(ce[0]=255&Q,ce[1]=Q>>>8&255,v.check=a(v.check,ce,2,0)),E=Q=0,v.mode=3;case 3:for(;E<32;){if(z===0)break e;z--,Q+=B[P++]<>>8&255,ce[2]=Q>>>16&255,ce[3]=Q>>>24&255,v.check=a(v.check,ce,4,0)),E=Q=0,v.mode=4;case 4:for(;E<16;){if(z===0)break e;z--,Q+=B[P++]<>8),512&v.flags&&(ce[0]=255&Q,ce[1]=Q>>>8&255,v.check=a(v.check,ce,2,0)),E=Q=0,v.mode=5;case 5:if(1024&v.flags){for(;E<16;){if(z===0)break e;z--,Q+=B[P++]<>>8&255,v.check=a(v.check,ce,2,0)),E=Q=0}else v.head&&(v.head.extra=null);v.mode=6;case 6:if(1024&v.flags&&(z<(U=v.length)&&(U=z),U&&(v.head&&(L=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),s.arraySet(v.head.extra,B,P,U,L)),512&v.flags&&(v.check=a(v.check,B,U,P)),z-=U,P+=U,v.length-=U),v.length))break e;v.length=0,v.mode=7;case 7:if(2048&v.flags){if(z===0)break e;for(U=0;L=B[P+U++],v.head&&L&&v.length<65536&&(v.head.name+=String.fromCharCode(L)),L&&U>9&1,v.head.done=!0),H.adler=v.check=0,v.mode=12;break;case 10:for(;E<32;){if(z===0)break e;z--,Q+=B[P++]<>>=7&E,E-=7&E,v.mode=27;break}for(;E<3;){if(z===0)break e;z--,Q+=B[P++]<>>=1)){case 0:v.mode=14;break;case 1:if(D(v),v.mode=20,I!==6)break;Q>>>=2,E-=2;break e;case 2:v.mode=17;break;case 3:H.msg="invalid block type",v.mode=30}Q>>>=2,E-=2;break;case 14:for(Q>>>=7&E,E-=7&E;E<32;){if(z===0)break e;z--,Q+=B[P++]<>>16^65535)){H.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&Q,E=Q=0,v.mode=15,I===6)break e;case 15:v.mode=16;case 16:if(U=v.length){if(z>>=5,E-=5,v.ndist=1+(31&Q),Q>>>=5,E-=5,v.ncode=4+(15&Q),Q>>>=4,E-=4,286>>=3,E-=3}for(;v.have<19;)v.lens[be[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,Ae={bits:v.lenbits},ue=A(0,v.lens,0,19,v.lencode,0,v.work,Ae),v.lenbits=Ae.bits,ue){H.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have>>16&255,se=65535&J,!((oe=J>>>24)<=E);){if(z===0)break e;z--,Q+=B[P++]<>>=oe,E-=oe,v.lens[v.have++]=se;else{if(se===16){for(q=oe+2;E>>=oe,E-=oe,v.have===0){H.msg="invalid bit length repeat",v.mode=30;break}L=v.lens[v.have-1],U=3+(3&Q),Q>>>=2,E-=2}else if(se===17){for(q=oe+3;E>>=oe)),Q>>>=3,E-=3}else{for(q=oe+7;E>>=oe)),Q>>>=7,E-=7}if(v.have+U>v.nlen+v.ndist){H.msg="invalid bit length repeat",v.mode=30;break}for(;U--;)v.lens[v.have++]=L}}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},ue=A(c,v.lens,0,v.nlen,v.lencode,0,v.work,Ae),v.lenbits=Ae.bits,ue){H.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,Ae={bits:v.distbits},ue=A(u,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,Ae),v.distbits=Ae.bits,ue){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=O,H.avail_out=K,H.next_in=P,H.avail_in=z,v.hold=Q,v.bits=E,l(H,ee),O=H.next_out,F=H.output,K=H.avail_out,P=H.next_in,B=H.input,z=H.avail_in,Q=v.hold,E=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;de=(J=v.lencode[Q&(1<>>16&255,se=65535&J,!((oe=J>>>24)<=E);){if(z===0)break e;z--,Q+=B[P++]<>pe)])>>>16&255,se=65535&J,!(pe+(oe=J>>>24)<=E);){if(z===0)break e;z--,Q+=B[P++]<>>=pe,E-=pe,v.back+=pe}if(Q>>>=oe,E-=oe,v.back+=oe,v.length=se,de===0){v.mode=26;break}if(32&de){v.back=-1,v.mode=12;break}if(64&de){H.msg="invalid literal/length code",v.mode=30;break}v.extra=15&de,v.mode=22;case 22:if(v.extra){for(q=v.extra;E>>=v.extra,E-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;de=(J=v.distcode[Q&(1<>>16&255,se=65535&J,!((oe=J>>>24)<=E);){if(z===0)break e;z--,Q+=B[P++]<>pe)])>>>16&255,se=65535&J,!(pe+(oe=J>>>24)<=E);){if(z===0)break e;z--,Q+=B[P++]<>>=pe,E-=pe,v.back+=pe}if(Q>>>=oe,E-=oe,v.back+=oe,64&de){H.msg="invalid distance code",v.mode=30;break}v.offset=se,v.extra=15&de,v.mode=24;case 24:if(v.extra){for(q=v.extra;E>>=v.extra,E-=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(U=ee-K,v.offset>U){if((U=v.offset-U)>v.whave&&v.sane){H.msg="invalid distance too far back",v.mode=30;break}X=U>v.wnext?(U-=v.wnext,v.wsize-U):v.wnext-U,U>v.length&&(U=v.length),ae=v.window}else ae=F,X=O-v.offset,U=v.length;for(KT?(M=X[ae+g[I]],E[G+g[I]]):(M=96,0),y=1<>O)+(w-=y)]=b<<24|M<<16|D|0,w!==0;);for(y=1<>=1;if(y!==0?(Q&=y-1,Q+=y):Q=0,I++,--ee[H]==0){if(H===B)break;H=u[f+g[I]]}if(F>>7)]}function G(J,ce){J.pending_buf[J.pending++]=255&ce,J.pending_buf[J.pending++]=ce>>>8&255}function ee(J,ce,be){J.bi_valid>m-be?(J.bi_buf|=ce<>m-J.bi_valid,J.bi_valid+=be-m):(J.bi_buf|=ce<>>=1,be<<=1,0<--ce;);return be>>>1}function ae(J,ce,be){var Be,k,W=new Array(g+1),re=0;for(Be=1;Be<=g;Be++)W[Be]=re=re+be[Be-1]<<1;for(k=0;k<=ce;k++){var he=J[2*k+1];he!==0&&(J[2*k]=X(W[he]++,he))}}function oe(J){var ce;for(ce=0;ce>1;1<=be;be--)pe(J,W,be);for(k=me;be=J.heap[1],J.heap[1]=J.heap[J.heap_len--],pe(J,W,1),Be=J.heap[1],J.heap[--J.heap_max]=be,J.heap[--J.heap_max]=Be,W[2*k]=W[2*be]+W[2*Be],J.depth[k]=(J.depth[be]>=J.depth[Be]?J.depth[be]:J.depth[Be])+1,W[2*be+1]=W[2*Be+1]=k,J.heap[1]=k++,pe(J,W,1),2<=J.heap_len;);J.heap[--J.heap_max]=J.heap[1],function(R,S){var j,te,le,ie,Ie,Te,Le=S.dyn_tree,He=S.max_code,De=S.stat_desc.static_tree,fe=S.stat_desc.has_stree,Me=S.stat_desc.extra_bits,Se=S.stat_desc.extra_base,Fe=S.stat_desc.max_length,Ve=0;for(ie=0;ie<=g;ie++)R.bl_count[ie]=0;for(Le[2*R.heap[R.heap_max]+1]=0,j=R.heap_max+1;j>=7;k>>=1)if(1&V&&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,(W=J.static_len+3+7>>>3)<=k&&(k=W)):k=W=be+5,be+4<=k&&ce!==-1?q(J,ce,be,Be):J.strategy===4||W===k?(ee(J,2+(Be?1:0),3),_e(J,Y,H)):(ee(J,4+(Be?1:0),3),function(he,me,V,R){var S;for(ee(he,me-257,5),ee(he,V-1,5),ee(he,R-4,4),S=0;S>>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&be,J.last_lit++,ce===0?J.dyn_ltree[2*be]++:(J.matches++,ce--,J.dyn_ltree[2*(v[be]+u+1)]++,J.dyn_dtree[2*E(ce)]++),J.last_lit===J.lit_bufsize-1},i._tr_align=function(J){ee(J,2,3),U(J,w,Y),function(ce){ce.bi_valid===16?(G(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 T={callback:x,args:_};return h[f]=T,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 T=C.callback,b=C.args;switch(b.length){case 0:T();break;case 1:T(b[0]);break;case 2:T(b[0],b[1]);break;case 3:T(b[0],b[1],b[2]);break;default:T.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 qo<"u"?qo:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(A8);var $he=A8.exports;const Zhe=bl($he);class sd{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 Zhe;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 Jhe{constructor(e){kt(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 sd;await(async()=>{if(Array.isArray(h))for(let w=0;w{if(Array.isArray(g))for(const C of g){const{animationName:T,animationPath:b,framesNumber:M,lookAtCamera:D,expression:Y,cameraPosition:H,cameraFrame:I}=C;y++;const v=s+"/"+(T||y.toString().padStart(2,"0"));await w.animationManager.loadAnimation(m+b,!0,0);const B=gT(H);w.screenshotManager.cameraFrameManager.setCameraFrameWithName(I,B);const P=w.animationManager.getCurrentClipDuration()/M;for(let O=0;O{for(const C of d){const{traitGroup:T,cameraPosition:b="front",bottomBoneName:M,bottomBoneMaxVertex:D=!1,topBoneName:Y,topBoneMaxVertex:H=!0,groupTopOffset:I,groupBotomOffset:v,cameraFrame:B,saveOnlyIDs:F}=C;if((!M||!Y)&&(B||console.warn("missing bonename info or camera frame. Skipping")),!T){console.warn("missing trait group for thumbnail info. Skipping");continue}const P=()=>{const K=[];return ut(F).forEach(E=>{K.push({id:E})}),K},O=F==null?y.characterManager.getTraits(T):P();if(O==null){console.log("SKipping Thumbnail Generation for trait group "+T+", its not present in the character manifest.");continue}const z=gT(b);B?y.screenshotManager.cameraFrameManager.setCameraFrameWithName(B,z):y.screenshotManager.cameraFrameManager.frameShot(M,Y,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),[T,b]=ye.useState(!1);let M=!1,[D,Y]=ye.useState(!1);ye.useEffect(()=>{if(M||D)return;Y(!0),M=!0;const{scene:B,camera:F,controls:P,characterManager:O,sceneElements:z}=Xhe("editor-scene");y(F),g(B),t(O),c(z),f(O.animationManager),p(O.lookAtManager),x(P),i(new Jhe(O)),o(new qhe(O)),l(new ede(O))},[]);const H=B=>{B==null&&(B=!T),b(B),d.traverse(F=>{F.isMesh&&F.setDebugMode&&F.setDebugMode(B)})};ye.useEffect(()=>{if(_!=null&&_.defaultAnimations){const B=_.defaultAnimations.map(F=>F.location);u.storeDefaultAnimationPaths(B,"")}},[_]);const I=B=>{B?d.add(A):d.remove(A)},v=B=>{w&&(KE.to(w.target,{x:B.targetX??0,y:B.targetY??0,z:B.targetZ??0,duration:1}),KE.fromTo(w,{maxDistance:w.getDistance(),minDistance:w.getDistance(),minPolarAngle:w.getPolarAngle(),maxPolarAngle:w.getPolarAngle(),minAzimuthAngle:w.getAzimuthalAngle(),maxAzimuthAngle:w.getAzimuthalAngle()},{maxDistance:B.distance,minDistance:B.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 N.jsx(Zn.Provider,{value:{manifest:_,setManifest:C,scene:d,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:a,showEnvironmentModels:I,debugMode:T,toggleDebugMode:H,animationManager:u,lookAtManager:h,camera:m,moveCamera:v,controls:w,sceneElements:A},children:n.children})},nde={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},mt={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",SAVE:"SAVE",MINT:"MINT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},Di=$.createContext(),rde=n=>{const[e,t]=$.useState(nde.NORMAL),[r,i]=$.useState(mt.LANDING),[s,o]=$.useState(!1),[a,l]=$.useState(!1);return N.jsx(Di.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},ide="modulepreload",sde=function(n){return"/"+n},A3={},ode=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=sde(s),s in A3)return;A3[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":ide,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 Pw(){return Pw=Object.assign||function(n){for(var e=1;e=0)&&(t[i]=n[i]);return t}function lde(n){ye.useEffect(n,[])}function Ade(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=ade(t,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),h=$.useRef(null),p=$.useRef(!1),d=$.useState(null),g=d[0],m=d[1],y=$.useState(null),w=y[0],x=y[1],_=function(){typeof u=="function"&&u.call(this),p.current&&m(this.duration()*1e3),x(this)};lde(function(){return ode(()=>import("./howler-aa6636c7.js").then(D=>D.h),[]).then(function(D){if(!p.current){var Y;h.current=(Y=D.Howl)!==null&&Y!==void 0?Y:D.default.Howl,p.current=!0,new h.current(Pw({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:_},f))}}),function(){p.current=!1}}),$.useEffect(function(){h.current&&w&&x(new h.current(Pw({src:Array.isArray(n)?n:[n],volume:i,onload:_},f)))},[JSON.stringify(n)]),$.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var C=$.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]),T=$.useCallback(function(D){w&&w.stop(D)},[w]),b=$.useCallback(function(D){w&&w.pause(D)},[w]),M=[C,{sound:w,stop:T,pause:b,duration:g}];return M}const cde=[{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}],ude="/assets/sounds-3322d50e.mp3",Ys=ye.createContext(),fde=n=>{const e=i=>cde.find(s=>i.test(s.name)),[t]=Ade(ude,{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 N.jsx(Ys.Provider,{value:{playSound:r},children:n.children})};function Ns(n){"@babel/helpers - typeof";return Ns=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},Ns(n)}function Xs(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function hde(n,e){if(Ns(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(Ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function c8(n){var e=hde(n,"string");return Ns(e)=="symbol"?e:e+""}function c3(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 $s(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||mde,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 p3(n,e,t){var r=_T(n,e,Object),i=r.obj,s=r.k;i[s]=t}function yde(n,e,t,r){var i=_T(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 Dw(n,e){var t=_T(n,e),r=t.obj,i=t.k;if(r)return r[i]}function m3(n,e,t){var r=Dw(n,t);return r!==void 0?r:Dw(e,t)}function d8(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]):d8(n[r],e[r],t):n[r]=e[r]);return n}function Yu(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var wde={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function xde(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return wde[e]}):n}var Jx=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,_de=[" ",",","?","!",";"];function bde(n,e,t){e=e||"",t=t||"";var r=_de.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 g3(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 mv(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 p8(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?p8(l,A,t):void 0}i=i[r[s]]}return i}}var Cde=function(n){Zx(t,n);var e=Bde(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),Jx&&NA.call(TA(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 $s(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=Dw(this.data,c);return u||!A||typeof o!="string"?u:p8(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),p3(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=Dw(this.data,c)||{};a?d8(u,o,l):u=mv(mv({},u),o),p3(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"?mv(mv({},{}),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}(NA),m8={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 v3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function si(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 y3={},w3=function(n){Zx(t,n);var e=Mde(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Xs(this,t),i=e.call(this),Jx&&NA.call(TA(i)),vde(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,TA(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ea.create("translator"),i}return $s(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&&!bde(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(Ns(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]"],T=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 T=="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,si(si({},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 Y=_==="[object Array]",H=Y?[]:{},I=Y?x:w;for(var v in y)if(Object.prototype.hasOwnProperty.call(y,v)){var B="".concat(I).concat(A).concat(v);H[v]=this.translate(B,si(si({},s),{joinArrays:!1,ns:f})),H[v]===B&&(H[v]=y[v])}y=H}}else if(b&&typeof T=="string"&&_==="[object Array]")y=y.join(T),y&&(y=this.extendTranslation(y,i,s,o));else{var F=!1,P=!1,O=s.count!==void 0&&typeof s.count!="string",z=t.hasDefaultValue(s),K=O?this.pluralResolver.getSuffix(p,s.count,s):"",Q=s["defaultValue".concat(K)]||s.defaultValue;!this.isValidLookup(y)&&z&&(F=!0,y=Q),this.isValidLookup(y)||(P=!0,y=u);var E=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,G=E&&P?void 0:y,ee=z&&Q!==y&&this.options.updateMissing;if(P||F||ee){if(this.logger.log(ee?"updateKey":"missingKey",p,h,u,ee?Q:y),A){var U=this.resolve(u,si(si({},s),{},{keySeparator:!1}));U&&U.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=[],ae=this.languageUtils.getFallbackCodes(this.options.fallbackLng,s.lng||this.language);if(this.options.saveMissingTo==="fallback"&&ae&&ae[0])for(var oe=0;oe1&&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,!y3["".concat(w[0],"-").concat(x)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(y3["".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 T;g&&(T=s.pluralResolver.getSuffix(_,o.count,o));var b="".concat(s.options.pluralSeparator,"zero");if(g&&(C.push(p+T),m&&C.push(p+b)),y){var M="".concat(p).concat(s.options.contextSeparator).concat(o.context);C.push(M),g&&(C.push(M+T),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}(NA);function aB(n){return n.charAt(0).toUpperCase()+n.slice(1)}var x3=function(){function n(e){Xs(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ea.create("languageUtils")}return $s(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]=aB(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]=aB(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=aB(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}(),Tde=[{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}],Ide={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}},Rde=["v1","v2","v3"],_3={zero:0,one:1,two:2,few:3,many:4,other:5};function Fde(){var n={};return Tde.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:Ide[e.fc]}})}),n}var Ude=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=ea.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=Fde()}return $s(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 _3[o]-_3[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!Rde.includes(this.options.compatibilityJSON)}}]),n}();function b3(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=ea.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return $s(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:xde,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Yu(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Yu(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?Yu(r.nestingPrefix):r.nestingPrefixEscaped||Yu("$t("),this.nestingSuffix=r.nestingSuffix?Yu(r.nestingSuffix):r.nestingSuffixEscaped||Yu(")"),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=m3(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(m3(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=d3(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=d3(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 B3(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 Na(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=pde(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 Xu(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 Dde=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xs(this,n),this.logger=ea.create("formatter"),this.options=e,this.formats={number:Xu(function(t,r){var i=new Intl.NumberFormat(t,Na({},r));return function(s){return i.format(s)}}),currency:Xu(function(t,r){var i=new Intl.NumberFormat(t,Na(Na({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:Xu(function(t,r){var i=new Intl.DateTimeFormat(t,Na({},r));return function(s){return i.format(s)}}),relativetime:Xu(function(t,r){var i=new Intl.RelativeTimeFormat(t,Na({},r));return function(s){return i.format(s,r.range||"day")}}),list:Xu(function(t,r){var i=new Intl.ListFormat(t,Na({},r));return function(s){return i.format(s)}})},this.init(e)}return $s(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()]=Xu(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=Pde(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,Na(Na(Na({},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 E3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function C3(n){for(var e=1;e"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function kde(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var Qde=function(n){Zx(t,n);var e=Ode(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),Jx&&NA.call(TA(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=ea.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 $s(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){yde(u.loaded,[l],A),kde(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=C3(C3({},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}(NA);function M3(){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(Ns(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),Ns(e[2])==="object"||Ns(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 S3(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 T3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function 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 gv(){}function Gde(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var Ow=function(n){Zx(t,n);var e=Hde(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),Jx&&NA.call(TA(r)),r.options=S3(i),r.services={},r.logger=ea,r.modules={external:[]},Gde(TA(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),xg(r,TA(r));setTimeout(function(){r.init(i,s)},0)}return r}return $s(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=M3();this.options=Oo(Oo(Oo({},a),this.options),S3(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?ea.init(l(this.modules.logger),this.options):ea.init(null,this.options);var A;this.modules.formatter?A=this.modules.formatter:typeof Intl<"u"&&(A=Dde);var c=new x3(this.options);this.store=new Cde(this.options.resources,this.options);var u=this.services;u.logger=ea,u.resourceStore=this.store,u.languageUtils=c,u.pluralResolver=new Ude(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 Lde(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new Qde(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=ip(),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]:gv,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=ip();return i||(i=this.languages),s||(s=this.options.ns),o||(o=gv),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"&&m8.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=ip();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(Ns(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=ip();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=ip();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 x3(M3());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]:gv,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 w3(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 Ow(n,e)});var ni=Ow.createInstance();ni.createInstance=Ow.createInstance;ni.createInstance;ni.dir;ni.init;ni.loadResources;ni.reloadResources;ni.use;ni.changeLanguage;ni.getFixedT;ni.t;ni.exists;ni.setDefaultNamespace;ni.hasLoadedNamespace;ni.loadNamespaces;ni.loadLanguages;function Vde(){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 Wde(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return WC("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}}):jde(n,e,t)}var Kde=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Yde={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Xde=function(e){return Yde[e]},$de=function(e){return e.replace(Kde,Xde)};function F3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function U3(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};KC=U3(U3({},KC),n)}function Jde(){return KC}var g8;function qde(n){g8=n}function epe(){return g8}var tpe={type:"3rdParty",init:function(e){Zde(e.options.react),qde(e)}},npe=ye.createContext(),rpe=function(){function n(){Xs(this,n),this.usedNamespaces={}}return $s(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 ipe(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 spe(n,e){return u8(n)||ipe(n,e)||f8(n,e)||h8()}function L3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function lB(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=ye.useContext(npe)||{},i=r.i18n,s=r.defaultNS,o=t||i||epe();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new rpe),!o){WC("You will need to pass in an i18next instance by using initReactI18next");var a=function(M,D){return typeof D=="string"?D:D&&Ns(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&&WC("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var A=lB(lB(lB({},Jde()),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 Wde(b,o,A)});function p(){return o.getFixedT(null,A.nsMode==="fallback"?f:f[0],u)}var d=ye.useState(p),g=spe(d,2),m=g[0],y=g[1],w=f.join(),x=ope(w),_=ye.useRef(!0);ye.useEffect(function(){var b=A.bindI18n,M=A.bindI18nStore;_.current=!0,!h&&!c&&R3(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(Y){return o.off(Y,D)}),M&&o&&M.split(" ").forEach(function(Y){return o.store.off(Y,D)})}},[o,w]);var C=ye.useRef(!0);ye.useEffect(function(){_.current&&!C.current&&y(p),C.current=!1},[o,u]);var T=[m,o,h];if(T.t=m,T.i18n=o,T.ready=h,h||!h&&!c)return T;throw new Promise(function(b){R3(o,f,function(){b()})})}var v8=[],lpe=v8.forEach,Ape=v8.slice;function cpe(n){return lpe.call(Ape.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var P3=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,upe=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(!P3.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!P3.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},D3={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=upe(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}},sp=null,O3=function(){if(sp!==null)return sp;try{sp=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{sp=!1}return sp},dpe={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&O3()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&O3()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},op=null,N3=function(){if(op!==null)return op;try{op=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{op=!1}return op},ppe={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&N3()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&N3()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},mpe={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},gpe={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}},vpe={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}},ype={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 wpe(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var y8=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 $s(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=cpe(r,this.options||{},wpe()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(fpe),this.addDetector(hpe),this.addDetector(dpe),this.addDetector(ppe),this.addDetector(mpe),this.addDetector(gpe),this.addDetector(vpe),this.addDetector(ype)}},{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}();y8.type="languageDetector";const xpe={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!"}}},_pe={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 генерации голоса временно отключен на техническое обслуживание."}}},bpe={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暂时关闭进行维护!"}}},Bpe={en:xpe,ru:_pe,zh:bpe};ni.use(y8).use(tpe).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:Bpe});const So=ye.createContext(),Epe=n=>{const{t:e}=ape();return N.jsx(So.Provider,{value:{t:e},children:n.children})},Cpe=` +*/(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 pv=="function"&&pv;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 pv=="function"&&pv,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,B=h.compression,T=y!==A.utf8encode,b=a.transformTo("string",y(_.name)),M=a.transformTo("string",A.utf8encode(_.name)),O=_.comment,Y=a.transformTo("string",y(O)),H=a.transformTo("string",A.utf8encode(O)),I=M.length!==_.name.length,v=H.length!==O.length,E="",L="",U="",P=_.dir,z=_.date,W={crc32:0,compressedSize:0,uncompressedSize:0};p&&!d||(W.crc32=h.crc32,W.compressedSize=h.compressedSize,W.uncompressedSize=h.uncompressedSize);var N=0;p&&(N|=8),T||!I&&!v||(N|=2048);var C=0,j=0;P&&(C|=16),m==="UNIX"?(j=798,C|=function(F,X){var ue=F;return F||(ue=X?16893:33204),(65535&ue)<<16}(_.unixPermissions,P)):(j=20,C|=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&&(L=s(1,1)+s(c(b),4)+M,E+="up"+s(L.length,2)+L),v&&(U=s(1,1)+s(c(Y),4)+H,E+="uc"+s(U.length,2)+U);var ee="";return ee+=` +\0`,ee+=s(N,2),ee+=B.magic,ee+=s(w,2),ee+=s(x,2),ee+=s(W.crc32,4),ee+=s(W.compressedSize,4),ee+=s(W.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(j,2)+ee+s(Y.length,2)+"\0\0\0\0"+s(C,4)+s(g,4)+b+E+Y}}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(B,T){y.push(B),d&&d(T)}).on("error",function(B){y=[],m(B)}).on("end",function(){try{var B=function(T,b,M){switch(T){case"blob":return s.newBlob(s.transformTo("arraybuffer",b),M);case"base64":return l.encode(b);default:return s.transformTo(T,b)}}(x,function(T,b){var M,O=0,Y=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,B=19,T=2*x+1,b=15,M=3,O=258,Y=O+M+1,H=42,I=113,v=1,E=2,L=3,U=4;function P(D,Ae){return D.msg=c[Ae],Ae}function z(D){return(D<<1)-(4D.avail_out&&(le=D.avail_out),le!==0&&(o.arraySet(D.output,Ae.pending_buf,Ae.pending_out,le,D.next_out),D.next_out+=le,Ae.pending_out+=le,D.total_out+=le,D.avail_out-=le,Ae.pending-=le,Ae.pending===0&&(Ae.pending_out=0))}function C(D,Ae){a._tr_flush_block(D,0<=D.block_start?D.block_start:-1,D.strstart-D.block_start,Ae),D.block_start=D.strstart,N(D.strm)}function j(D,Ae){D.pending_buf[D.pending++]=Ae}function ee(D,Ae){D.pending_buf[D.pending++]=Ae>>>8&255,D.pending_buf[D.pending++]=255&Ae}function F(D,Ae){var le,q,J=D.max_chain_length,ce=D.strstart,be=D.prev_length,Be=D.nice_match,Q=D.strstart>D.w_size-Y?D.strstart-(D.w_size-Y):0,K=D.window,ie=D.w_mask,de=D.prev,me=D.strstart+O,G=K[ce+be-1],R=K[ce+be];D.prev_length>=D.good_match&&(J>>=2),Be>D.lookahead&&(Be=D.lookahead);do if(K[(le=Ae)+be]===R&&K[le+be-1]===G&&K[le]===K[ce]&&K[++le]===K[ce+1]){ce+=2,le++;do;while(K[++ce]===K[++le]&&K[++ce]===K[++le]&&K[++ce]===K[++le]&&K[++ce]===K[++le]&&K[++ce]===K[++le]&&K[++ce]===K[++le]&&K[++ce]===K[++le]&&K[++ce]===K[++le]&&ceQ&&--J!=0);return be<=D.lookahead?be:D.lookahead}function X(D){var Ae,le,q,J,ce,be,Be,Q,K,ie,de=D.w_size;do{if(J=D.window_size-D.lookahead-D.strstart,D.strstart>=de+(de-Y)){for(o.arraySet(D.window,D.window,de,de,0),D.match_start-=de,D.strstart-=de,D.block_start-=de,Ae=le=D.hash_size;q=D.head[--Ae],D.head[Ae]=de<=q?q-de:0,--le;);for(Ae=le=de;q=D.prev[--Ae],D.prev[Ae]=de<=q?q-de:0,--le;);J+=de}if(D.strm.avail_in===0)break;if(be=D.strm,Be=D.window,Q=D.strstart+D.lookahead,K=J,ie=void 0,ie=be.avail_in,K=M)for(ce=D.strstart-D.insert,D.ins_h=D.window[ce],D.ins_h=(D.ins_h<=M&&(D.ins_h=(D.ins_h<=M)if(q=a._tr_tally(D,D.strstart-D.match_start,D.match_length-M),D.lookahead-=D.match_length,D.match_length<=D.max_lazy_match&&D.lookahead>=M){for(D.match_length--;D.strstart++,D.ins_h=(D.ins_h<=M&&(D.ins_h=(D.ins_h<=M&&D.match_length<=D.prev_length){for(J=D.strstart+D.lookahead-M,q=a._tr_tally(D,D.strstart-1-D.prev_match,D.prev_length-M),D.lookahead-=D.prev_length-1,D.prev_length-=2;++D.strstart<=J&&(D.ins_h=(D.ins_h<D.pending_buf_size-5&&(le=D.pending_buf_size-5);;){if(D.lookahead<=1){if(X(D),D.lookahead===0&&Ae===u)return v;if(D.lookahead===0)break}D.strstart+=D.lookahead,D.lookahead=0;var q=D.block_start+le;if((D.strstart===0||D.strstart>=q)&&(D.lookahead=D.strstart-q,D.strstart=q,C(D,!1),D.strm.avail_out===0)||D.strstart-D.block_start>=D.w_size-Y&&(C(D,!1),D.strm.avail_out===0))return v}return D.insert=0,Ae===f?(C(D,!0),D.strm.avail_out===0?L:U):(D.strstart>D.block_start&&(C(D,!1),D.strm.avail_out),v)}),new fe(4,4,8,4,ue),new fe(4,5,16,8,ue),new fe(4,6,32,32,ue),new fe(4,4,16,16,re),new fe(8,16,32,32,re),new fe(8,16,128,128,re),new fe(8,32,128,256,re),new fe(32,128,258,1024,re),new fe(32,258,258,4096,re)],i.deflateInit=function(D,Ae){return _e(D,Ae,y,15,8,0)},i.deflateInit2=_e,i.deflateReset=xe,i.deflateResetKeep=pe,i.deflateSetHeader=function(D,Ae){return D&&D.state?D.state.wrap!==2?p:(D.state.gzhead=Ae,h):p},i.deflate=function(D,Ae){var le,q,J,ce;if(!D||!D.state||5>8&255),j(q,q.gzhead.time>>16&255),j(q,q.gzhead.time>>24&255),j(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),j(q,255&q.gzhead.os),q.gzhead.extra&&q.gzhead.extra.length&&(j(q,255&q.gzhead.extra.length),j(q,q.gzhead.extra.length>>8&255)),q.gzhead.hcrc&&(D.adler=A(D.adler,q.pending_buf,q.pending,0)),q.gzindex=0,q.status=69):(j(q,0),j(q,0),j(q,0),j(q,0),j(q,0),j(q,q.level===9?2:2<=q.strategy||q.level<2?4:0),j(q,3),q.status=I);else{var be=y+(q.w_bits-8<<4)<<8;be|=(2<=q.strategy||q.level<2?0:q.level<6?1:q.level===6?2:3)<<6,q.strstart!==0&&(be|=32),be+=31-be%31,q.status=I,ee(q,be),q.strstart!==0&&(ee(q,D.adler>>>16),ee(q,65535&D.adler)),D.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&&(D.adler=A(D.adler,q.pending_buf,q.pending-J,J)),N(D),J=q.pending,q.pending!==q.pending_buf_size));)j(q,255&q.gzhead.extra[q.gzindex]),q.gzindex++;q.gzhead.hcrc&&q.pending>J&&(D.adler=A(D.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&&(D.adler=A(D.adler,q.pending_buf,q.pending-J,J)),N(D),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(D.adler=A(D.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&&(D.adler=A(D.adler,q.pending_buf,q.pending-J,J)),N(D),J=q.pending,q.pending===q.pending_buf_size)){ce=1;break}ce=q.gzindexJ&&(D.adler=A(D.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&&N(D),q.pending+2<=q.pending_buf_size&&(j(q,255&D.adler),j(q,D.adler>>8&255),D.adler=0,q.status=I)):q.status=I),q.pending!==0){if(N(D),D.avail_out===0)return q.last_flush=-1,h}else if(D.avail_in===0&&z(Ae)<=z(le)&&Ae!==f)return P(D,-5);if(q.status===666&&D.avail_in!==0)return P(D,-5);if(D.avail_in!==0||q.lookahead!==0||Ae!==u&&q.status!==666){var Be=q.strategy===2?function(Q,K){for(var ie;;){if(Q.lookahead===0&&(X(Q),Q.lookahead===0)){if(K===u)return v;break}if(Q.match_length=0,ie=a._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++,ie&&(C(Q,!1),Q.strm.avail_out===0))return v}return Q.insert=0,K===f?(C(Q,!0),Q.strm.avail_out===0?L:U):Q.last_lit&&(C(Q,!1),Q.strm.avail_out===0)?v:E}(q,Ae):q.strategy===3?function(Q,K){for(var ie,de,me,G,R=Q.window;;){if(Q.lookahead<=O){if(X(Q),Q.lookahead<=O&&K===u)return v;if(Q.lookahead===0)break}if(Q.match_length=0,Q.lookahead>=M&&0Q.lookahead&&(Q.match_length=Q.lookahead)}if(Q.match_length>=M?(ie=a._tr_tally(Q,1,Q.match_length-M),Q.lookahead-=Q.match_length,Q.strstart+=Q.match_length,Q.match_length=0):(ie=a._tr_tally(Q,0,Q.window[Q.strstart]),Q.lookahead--,Q.strstart++),ie&&(C(Q,!1),Q.strm.avail_out===0))return v}return Q.insert=0,K===f?(C(Q,!0),Q.strm.avail_out===0?L:U):Q.last_lit&&(C(Q,!1),Q.strm.avail_out===0)?v:E}(q,Ae):s[q.level].func(q,Ae);if(Be!==L&&Be!==U||(q.status=666),Be===v||Be===L)return D.avail_out===0&&(q.last_flush=-1),h;if(Be===E&&(Ae===1?a._tr_align(q):Ae!==5&&(a._tr_stored_block(q,0,0,!1),Ae===3&&(W(q.head),q.lookahead===0&&(q.strstart=0,q.block_start=0,q.insert=0))),N(D),D.avail_out===0))return q.last_flush=-1,h}return Ae!==f?h:q.wrap<=0?1:(q.wrap===2?(j(q,255&D.adler),j(q,D.adler>>8&255),j(q,D.adler>>16&255),j(q,D.adler>>24&255),j(q,255&D.total_in),j(q,D.total_in>>8&255),j(q,D.total_in>>16&255),j(q,D.total_in>>24&255)):(ee(q,D.adler>>>16),ee(q,65535&D.adler)),N(D),0=le.w_size&&(ce===0&&(W(le.head),le.strstart=0,le.block_start=0,le.insert=0),K=new o.Buf8(le.w_size),o.arraySet(K,Ae,ie-le.w_size,le.w_size,0),Ae=K,ie=le.w_size),be=D.avail_in,Be=D.next_in,Q=D.input,D.avail_in=ie,D.next_in=0,D.input=Ae,X(le);le.lookahead>=M;){for(q=le.strstart,J=le.lookahead-(M-1);le.ins_h=(le.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)>3,y&=(1<<(w-=O<<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=U.wsize?(s.arraySet(U.window,I,v-U.wsize,U.wsize,0),U.wnext=0,U.whave=U.wsize):(E<(L=U.wsize-U.wnext)&&(L=E),s.arraySet(U.window,I,v-E,L,U.wnext),(E-=L)?(s.arraySet(U.window,I,v-E,E,0),U.wnext=E,U.whave=U.wsize):(U.wnext+=L,U.wnext===U.wsize&&(U.wnext=0),U.whave>>8&255,v.check=a(v.check,ce,2,0),C=N=0,v.mode=2;break}if(v.flags=0,v.head&&(v.head.done=!1),!(1&v.wrap)||(((255&N)<<8)+(N>>8))%31){H.msg="incorrect header check",v.mode=30;break}if((15&N)!=8){H.msg="unknown compression method",v.mode=30;break}if(C-=4,D=8+(15&(N>>>=4)),v.wbits===0)v.wbits=D;else if(D>v.wbits){H.msg="invalid window size",v.mode=30;break}v.dmax=1<>8&1),512&v.flags&&(ce[0]=255&N,ce[1]=N>>>8&255,v.check=a(v.check,ce,2,0)),C=N=0,v.mode=3;case 3:for(;C<32;){if(z===0)break e;z--,N+=E[U++]<>>8&255,ce[2]=N>>>16&255,ce[3]=N>>>24&255,v.check=a(v.check,ce,4,0)),C=N=0,v.mode=4;case 4:for(;C<16;){if(z===0)break e;z--,N+=E[U++]<>8),512&v.flags&&(ce[0]=255&N,ce[1]=N>>>8&255,v.check=a(v.check,ce,2,0)),C=N=0,v.mode=5;case 5:if(1024&v.flags){for(;C<16;){if(z===0)break e;z--,N+=E[U++]<>>8&255,v.check=a(v.check,ce,2,0)),C=N=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&&(D=v.head.extra_len-v.length,v.head.extra||(v.head.extra=new Array(v.head.extra_len)),s.arraySet(v.head.extra,E,U,F,D)),512&v.flags&&(v.check=a(v.check,E,F,U)),z-=F,U+=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;D=E[U+F++],v.head&&D&&v.length<65536&&(v.head.name+=String.fromCharCode(D)),D&&F>9&1,v.head.done=!0),H.adler=v.check=0,v.mode=12;break;case 10:for(;C<32;){if(z===0)break e;z--,N+=E[U++]<>>=7&C,C-=7&C,v.mode=27;break}for(;C<3;){if(z===0)break e;z--,N+=E[U++]<>>=1)){case 0:v.mode=14;break;case 1:if(O(v),v.mode=20,I!==6)break;N>>>=2,C-=2;break e;case 2:v.mode=17;break;case 3:H.msg="invalid block type",v.mode=30}N>>>=2,C-=2;break;case 14:for(N>>>=7&C,C-=7&C;C<32;){if(z===0)break e;z--,N+=E[U++]<>>16^65535)){H.msg="invalid stored block lengths",v.mode=30;break}if(v.length=65535&N,C=N=0,v.mode=15,I===6)break e;case 15:v.mode=16;case 16:if(F=v.length){if(z>>=5,C-=5,v.ndist=1+(31&N),N>>>=5,C-=5,v.ncode=4+(15&N),N>>>=4,C-=4,286>>=3,C-=3}for(;v.have<19;)v.lens[be[v.have++]]=0;if(v.lencode=v.lendyn,v.lenbits=7,le={bits:v.lenbits},Ae=A(0,v.lens,0,19,v.lencode,0,v.work,le),v.lenbits=le.bits,Ae){H.msg="invalid code lengths set",v.mode=30;break}v.have=0,v.mode=19;case 19:for(;v.have>>16&255,oe=65535&J,!((re=J>>>24)<=C);){if(z===0)break e;z--,N+=E[U++]<>>=re,C-=re,v.lens[v.have++]=oe;else{if(oe===16){for(q=re+2;C>>=re,C-=re,v.have===0){H.msg="invalid bit length repeat",v.mode=30;break}D=v.lens[v.have-1],F=3+(3&N),N>>>=2,C-=2}else if(oe===17){for(q=re+3;C>>=re)),N>>>=3,C-=3}else{for(q=re+7;C>>=re)),N>>>=7,C-=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++]=D}}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,le={bits:v.lenbits},Ae=A(c,v.lens,0,v.nlen,v.lencode,0,v.work,le),v.lenbits=le.bits,Ae){H.msg="invalid literal/lengths set",v.mode=30;break}if(v.distbits=6,v.distcode=v.distdyn,le={bits:v.distbits},Ae=A(u,v.lens,v.nlen,v.ndist,v.distcode,0,v.work,le),v.distbits=le.bits,Ae){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<=W){H.next_out=P,H.avail_out=W,H.next_in=U,H.avail_in=z,v.hold=N,v.bits=C,l(H,ee),P=H.next_out,L=H.output,W=H.avail_out,U=H.next_in,E=H.input,z=H.avail_in,N=v.hold,C=v.bits,v.mode===12&&(v.back=-1);break}for(v.back=0;fe=(J=v.lencode[N&(1<>>16&255,oe=65535&J,!((re=J>>>24)<=C);){if(z===0)break e;z--,N+=E[U++]<>pe)])>>>16&255,oe=65535&J,!(pe+(re=J>>>24)<=C);){if(z===0)break e;z--,N+=E[U++]<>>=pe,C-=pe,v.back+=pe}if(N>>>=re,C-=re,v.back+=re,v.length=oe,fe===0){v.mode=26;break}if(32&fe){v.back=-1,v.mode=12;break}if(64&fe){H.msg="invalid literal/length code",v.mode=30;break}v.extra=15&fe,v.mode=22;case 22:if(v.extra){for(q=v.extra;C>>=v.extra,C-=v.extra,v.back+=v.extra}v.was=v.length,v.mode=23;case 23:for(;fe=(J=v.distcode[N&(1<>>16&255,oe=65535&J,!((re=J>>>24)<=C);){if(z===0)break e;z--,N+=E[U++]<>pe)])>>>16&255,oe=65535&J,!(pe+(re=J>>>24)<=C);){if(z===0)break e;z--,N+=E[U++]<>>=pe,C-=pe,v.back+=pe}if(N>>>=re,C-=re,v.back+=re,64&fe){H.msg="invalid distance code",v.mode=30;break}v.offset=oe,v.extra=15&fe,v.mode=24;case 24:if(v.extra){for(q=v.extra;C>>=v.extra,C-=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(W===0)break e;if(F=ee-W,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=L,X=P-v.offset,F=v.length;for(WT?(M=X[ue+g[I]],C[j+g[I]]):(M=96,0),y=1<>P)+(w-=y)]=b<<24|M<<16|O|0,w!==0;);for(y=1<>=1;if(y!==0?(N&=y-1,N+=y):N=0,I++,--ee[H]==0){if(H===E)break;H=u[f+g[I]]}if(L>>7)]}function j(J,ce){J.pending_buf[J.pending++]=255&ce,J.pending_buf[J.pending++]=ce>>>8&255}function ee(J,ce,be){J.bi_valid>m-be?(J.bi_buf|=ce<>m-J.bi_valid,J.bi_valid+=be-m):(J.bi_buf|=ce<>>=1,be<<=1,0<--ce;);return be>>>1}function ue(J,ce,be){var Be,Q,K=new Array(g+1),ie=0;for(Be=1;Be<=g;Be++)K[Be]=ie=ie+be[Be-1]<<1;for(Q=0;Q<=ce;Q++){var de=J[2*Q+1];de!==0&&(J[2*Q]=X(K[de]++,de))}}function re(J){var ce;for(ce=0;ce>1;1<=be;be--)pe(J,K,be);for(Q=me;be=J.heap[1],J.heap[1]=J.heap[J.heap_len--],pe(J,K,1),Be=J.heap[1],J.heap[--J.heap_max]=be,J.heap[--J.heap_max]=Be,K[2*Q]=K[2*be]+K[2*Be],J.depth[Q]=(J.depth[be]>=J.depth[Be]?J.depth[be]:J.depth[Be])+1,K[2*be+1]=K[2*Be+1]=Q,J.heap[1]=Q++,pe(J,K,1),2<=J.heap_len;);J.heap[--J.heap_max]=J.heap[1],function(R,S){var V,te,ae,se,Ie,Te,Le=S.dyn_tree,He=S.max_code,De=S.stat_desc.static_tree,he=S.stat_desc.has_stree,Me=S.stat_desc.extra_bits,Se=S.stat_desc.extra_base,Fe=S.stat_desc.max_length,Ve=0;for(se=0;se<=g;se++)R.bl_count[se]=0;for(Le[2*R.heap[R.heap_max]+1]=0,V=R.heap_max+1;V>=7;Q>>=1)if(1&G&&de.dyn_ltree[2*me]!==0)return o;if(de.dyn_ltree[18]!==0||de.dyn_ltree[20]!==0||de.dyn_ltree[26]!==0)return a;for(me=32;me>>3,(K=J.static_len+3+7>>>3)<=Q&&(Q=K)):Q=K=be+5,be+4<=Q&&ce!==-1?q(J,ce,be,Be):J.strategy===4||K===Q?(ee(J,2+(Be?1:0),3),xe(J,Y,H)):(ee(J,4+(Be?1:0),3),function(de,me,G,R){var S;for(ee(de,me-257,5),ee(de,G-1,5),ee(de,R-4,4),S=0;S>>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&be,J.last_lit++,ce===0?J.dyn_ltree[2*be]++:(J.matches++,ce--,J.dyn_ltree[2*(v[be]+u+1)]++,J.dyn_dtree[2*C(ce)]++),J.last_lit===J.lit_bufsize-1},i._tr_align=function(J){ee(J,2,3),F(J,w,Y),function(ce){ce.bi_valid===16?(j(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),B=0;B<_.length;B++)_[B]=arguments[B+1];var T={callback:x,args:_};return h[f]=T,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(B){var T=B.callback,b=B.args;switch(b.length){case 0:T();break;case 1:T(b[0]);break;case 2:T(b[0],b[1]);break;case 3:T(b[0],b[1],b[2]);break;default:T.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 qo<"u"?qo:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(c8);var Jhe=c8.exports;const qhe=bl(Jhe);class sd{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 qhe;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 ede{constructor(e){kt(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 sd;await(async()=>{if(Array.isArray(h))for(let w=0;w{if(Array.isArray(g))for(const B of g){const{animationName:T,animationPath:b,framesNumber:M,lookAtCamera:O,expression:Y,cameraPosition:H,cameraFrame:I}=B;y++;const v=s+"/"+(T||y.toString().padStart(2,"0"));await w.animationManager.loadAnimation(m+b,!0,0);const E=vT(H);w.screenshotManager.cameraFrameManager.setCameraFrameWithName(I,E);const U=w.animationManager.getCurrentClipDuration()/M;for(let P=0;P{for(const B of d){const{traitGroup:T,cameraPosition:b="front",bottomBoneName:M,bottomBoneMaxVertex:O=!1,topBoneName:Y,topBoneMaxVertex:H=!0,groupTopOffset:I,groupBotomOffset:v,cameraFrame:E,saveOnlyIDs:L}=B;if((!M||!Y)&&(E||console.warn("missing bonename info or camera frame. Skipping")),!T){console.warn("missing trait group for thumbnail info. Skipping");continue}const U=()=>{const W=[];return ut(L).forEach(C=>{W.push({id:C})}),W},P=L==null?y.characterManager.getTraits(T):U();if(P==null){console.log("SKipping Thumbnail Generation for trait group "+T+", its not present in the character manifest.");continue}const z=vT(b);E?y.screenshotManager.cameraFrameManager.setCameraFrameWithName(E,z):y.screenshotManager.cameraFrameManager.frameShot(M,Y,z,O,H);for(let W=0;W{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),[_,B]=ye.useState(null),[T,b]=ye.useState(!1);let M=!1,[O,Y]=ye.useState(!1);ye.useEffect(()=>{if(M||O)return;Y(!0),M=!0;const{scene:E,camera:L,controls:U,characterManager:P,sceneElements:z}=Zhe("editor-scene");y(L),g(E),t(P),c(z),f(P.animationManager),p(P.lookAtManager),x(U),i(new ede(P)),o(new tde(P)),l(new nde(P))},[]);const H=E=>{E==null&&(E=!T),b(E),d.traverse(L=>{L.isMesh&&L.setDebugMode&&L.setDebugMode(E)})};ye.useEffect(()=>{if(_!=null&&_.defaultAnimations){const E=_.defaultAnimations.map(L=>L.location);u.storeDefaultAnimationPaths(E,"")}},[_]);const I=E=>{E?d.add(A):d.remove(A)},v=E=>{w&&(YE.to(w.target,{x:E.targetX??0,y:E.targetY??0,z:E.targetZ??0,duration:1}),YE.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(Zn.Provider,{value:{manifest:_,setManifest:B,scene:d,characterManager:e,loraDataGenerator:r,spriteAtlasGenerator:s,thumbnailsGenerator:a,showEnvironmentModels:I,debugMode:T,toggleDebugMode:H,animationManager:u,lookAtManager:h,camera:m,moveCamera:v,controls:w,sceneElements:A},children:n.children})},ide={NORMAL:"NORMAL",AR:"AR",AR_FRONT:"AR_FRONT",VR:"VR"},mt={LANDING:"LANDING",CREATE:"CREATE",CLAIM:"CLAIM",LOAD:"LOAD",APPEARANCE:"APPEARANCE",BATCHDOWNLOAD:"BATCHDOWNLOAD",SAVE:"SAVE",MINT:"MINT",OPTIMIZER:"OPTIMIZER",BATCHMANIFEST:"BATCHMANIFEST",WALLET:"WALLET"},Di=$.createContext(),sde=n=>{const[e,t]=$.useState(ide.NORMAL),[r,i]=$.useState(mt.LANDING),[s,o]=$.useState(!1),[a,l]=$.useState(!1);return k.jsx(Di.Provider,{value:{viewMode:r,setViewMode:i,isLoading:s,setIsLoading:o,mouseIsOverUI:a,setMouseIsOverUI:l,currentCameraMode:e,setCurrentCameraMode:t},children:n.children})},ode="modulepreload",ade=function(n){return"/"+n},c3={},lde=function(e,t,r){if(!t||t.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(t.map(s=>{if(s=ade(s),s in c3)return;c3[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":ode,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 Dw(){return Dw=Object.assign||function(n){for(var e=1;e=0)&&(t[i]=n[i]);return t}function cde(n){ye.useEffect(n,[])}function ude(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=Ade(t,["id","volume","playbackRate","soundEnabled","interrupt","onload"]),h=$.useRef(null),p=$.useRef(!1),d=$.useState(null),g=d[0],m=d[1],y=$.useState(null),w=y[0],x=y[1],_=function(){typeof u=="function"&&u.call(this),p.current&&m(this.duration()*1e3),x(this)};cde(function(){return lde(()=>import("./howler-86289e89.js").then(O=>O.h),[]).then(function(O){if(!p.current){var Y;h.current=(Y=O.Howl)!==null&&Y!==void 0?Y:O.default.Howl,p.current=!0,new h.current(Dw({src:Array.isArray(n)?n:[n],volume:i,rate:o,onload:_},f))}}),function(){p.current=!1}}),$.useEffect(function(){h.current&&w&&x(new h.current(Dw({src:Array.isArray(n)?n:[n],volume:i,onload:_},f)))},[JSON.stringify(n)]),$.useEffect(function(){w&&(w.volume(i),w.rate(o))},[i,o]);var B=$.useCallback(function(O){typeof O>"u"&&(O={}),!(!w||!l&&!O.forceSoundEnabled)&&(c&&w.stop(),O.playbackRate&&w.rate(O.playbackRate),w.play(O.id))},[w,l,c]),T=$.useCallback(function(O){w&&w.stop(O)},[w]),b=$.useCallback(function(O){w&&w.pause(O)},[w]),M=[B,{sound:w,stop:T,pause:b,duration:g}];return M}const fde=[{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}],hde="/assets/sounds-3322d50e.mp3",Ys=ye.createContext(),dde=n=>{const e=i=>fde.find(s=>i.test(s.name)),[t]=ude(hde,{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 Ns(n){"@babel/helpers - typeof";return Ns=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},Ns(n)}function Xs(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}function pde(n,e){if(Ns(n)!="object"||!n)return n;var t=n[Symbol.toPrimitive];if(t!==void 0){var r=t.call(n,e||"default");if(Ns(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(n)}function u8(n){var e=pde(n,"string");return Ns(e)=="symbol"?e:e+""}function u3(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 $s(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||vde,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 m3(n,e,t){var r=bT(n,e,Object),i=r.obj,s=r.k;i[s]=t}function xde(n,e,t,r){var i=bT(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 Ow(n,e){var t=bT(n,e),r=t.obj,i=t.k;if(r)return r[i]}function g3(n,e,t){var r=Ow(n,t);return r!==void 0?r:Ow(e,t)}function p8(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]):p8(n[r],e[r],t):n[r]=e[r]);return n}function Yu(n){return n.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var _de={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function bde(n){return typeof n=="string"?n.replace(/[&<>"'\/]/g,function(e){return _de[e]}):n}var qx=typeof window<"u"&&window.navigator&&typeof window.navigator.userAgentData>"u"&&window.navigator.userAgent&&window.navigator.userAgent.indexOf("MSIE")>-1,Bde=[" ",",","?","!",";"];function Ede(n,e,t){e=e||"",t=t||"";var r=Bde.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 v3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function mv(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 m8(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?m8(l,A,t):void 0}i=i[r[s]]}return i}}var Sde=function(n){Jx(t,n);var e=Cde(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),qx&&NA.call(TA(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 $s(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=Ow(this.data,c);return u||!A||typeof o!="string"?u:m8(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),m3(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=Ow(this.data,c)||{};a?p8(u,o,l):u=mv(mv({},u),o),m3(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"?mv(mv({},{}),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}(NA),g8={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 y3(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 si(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 w3={},x3=function(n){Jx(t,n);var e=Tde(t);function t(r){var i,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Xs(this,t),i=e.call(this),qx&&NA.call(TA(i)),wde(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],r,TA(i)),i.options=s,i.options.keySeparator===void 0&&(i.options.keySeparator="."),i.logger=ea.create("translator"),i}return $s(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&&!Ede(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(Ns(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),B=["[object Number]","[object Function]","[object RegExp]"],T=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&&B.indexOf(_)<0&&!(typeof T=="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 O=this.options.returnedObjectHandler?this.options.returnedObjectHandler(w,y,si(si({},s),{},{ns:f})):"key '".concat(u," (").concat(this.language,")' returned an object instead of string.");return l?(m.res=O,m):O}if(A){var Y=_==="[object Array]",H=Y?[]:{},I=Y?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,si(si({},s),{joinArrays:!1,ns:f})),H[v]===E&&(H[v]=y[v])}y=H}}else if(b&&typeof T=="string"&&_==="[object Array]")y=y.join(T),y&&(y=this.extendTranslation(y,i,s,o));else{var L=!1,U=!1,P=s.count!==void 0&&typeof s.count!="string",z=t.hasDefaultValue(s),W=P?this.pluralResolver.getSuffix(p,s.count,s):"",N=s["defaultValue".concat(W)]||s.defaultValue;!this.isValidLookup(y)&&z&&(L=!0,y=N),this.isValidLookup(y)||(U=!0,y=u);var C=s.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey,j=C&&U?void 0:y,ee=z&&N!==y&&this.options.updateMissing;if(U||L||ee){if(this.logger.log(ee?"updateKey":"missingKey",p,h,u,ee?N:y),A){var F=this.resolve(u,si(si({},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 re=0;re1&&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,!w3["".concat(w[0],"-").concat(x)]&&s.utils&&s.utils.hasLoadedNamespace&&!s.utils.hasLoadedNamespace(u)&&(w3["".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 B=[p];if(s.i18nFormat&&s.i18nFormat.addLookupKeys)s.i18nFormat.addLookupKeys(B,p,_,x,o);else{var T;g&&(T=s.pluralResolver.getSuffix(_,o.count,o));var b="".concat(s.options.pluralSeparator,"zero");if(g&&(B.push(p+T),m&&B.push(p+b)),y){var M="".concat(p).concat(s.options.contextSeparator).concat(o.context);B.push(M),g&&(B.push(M+T),m&&B.push(M+b))}}for(var O;O=B.pop();)s.isValidLookup(a)||(A=O,a=s.getResource(_,x,O,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}(NA);function lB(n){return n.charAt(0).toUpperCase()+n.slice(1)}var _3=function(){function n(e){Xs(this,n),this.options=e,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ea.create("languageUtils")}return $s(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]=lB(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]=lB(i[1].toLowerCase())),r.indexOf(i[2].toLowerCase())>-1&&(i[2]=lB(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}(),Rde=[{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}],Fde={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}},Ude=["v1","v2","v3"],b3={zero:0,one:1,two:2,few:3,many:4,other:5};function Lde(){var n={};return Rde.forEach(function(e){e.lngs.forEach(function(t){n[t]={numbers:e.nr,plurals:Fde[e.fc]}})}),n}var Pde=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=ea.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=Lde()}return $s(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 b3[o]-b3[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!Ude.includes(this.options.compatibilityJSON)}}]),n}();function B3(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=ea.create("interpolator"),this.options=e,this.format=e.interpolation&&e.interpolation.format||function(t){return t},this.init(e)}return $s(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:bde,this.escapeValue=r.escapeValue!==void 0?r.escapeValue:!0,this.useRawValueToEscape=r.useRawValueToEscape!==void 0?r.useRawValueToEscape:!1,this.prefix=r.prefix?Yu(r.prefix):r.prefixEscaped||"{{",this.suffix=r.suffix?Yu(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?Yu(r.nestingPrefix):r.nestingPrefixEscaped||Yu("$t("),this.nestingSuffix=r.nestingSuffix?Yu(r.nestingSuffix):r.nestingSuffixEscaped||Yu(")"),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=g3(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(g3(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=p3(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=p3(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 E3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function Na(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=gde(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 Xu(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 Nde=function(){function n(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Xs(this,n),this.logger=ea.create("formatter"),this.options=e,this.formats={number:Xu(function(t,r){var i=new Intl.NumberFormat(t,Na({},r));return function(s){return i.format(s)}}),currency:Xu(function(t,r){var i=new Intl.NumberFormat(t,Na(Na({},r),{},{style:"currency"}));return function(s){return i.format(s)}}),datetime:Xu(function(t,r){var i=new Intl.DateTimeFormat(t,Na({},r));return function(s){return i.format(s)}}),relativetime:Xu(function(t,r){var i=new Intl.RelativeTimeFormat(t,Na({},r));return function(s){return i.format(s,r.range||"day")}}),list:Xu(function(t,r){var i=new Intl.ListFormat(t,Na({},r));return function(s){return i.format(s)}})},this.init(e)}return $s(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()]=Xu(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=Ode(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,Na(Na(Na({},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 C3(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(n,i).enumerable})),t.push.apply(t,r)}return t}function M3(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 Hde(n,e){n.pending[e]!==void 0&&(delete n.pending[e],n.pendingCount--)}var zde=function(n){Jx(t,n);var e=kde(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),qx&&NA.call(TA(o)),o.backend=r,o.store=i,o.services=s,o.languageUtils=s.languageUtils,o.options=a,o.logger=ea.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 $s(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){xde(u.loaded,[l],A),Hde(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=M3(M3({},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}(NA);function S3(){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(Ns(e[1])==="object"&&(t=e[1]),typeof e[1]=="string"&&(t.defaultValue=e[1]),typeof e[2]=="string"&&(t.tDescription=e[2]),Ns(e[2])==="object"||Ns(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 T3(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 I3(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 gv(){}function jde(n){var e=Object.getOwnPropertyNames(Object.getPrototypeOf(n));e.forEach(function(t){typeof n[t]=="function"&&(n[t]=n[t].bind(n))})}var Nw=function(n){Jx(t,n);var e=Gde(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),qx&&NA.call(TA(r)),r.options=T3(i),r.services={},r.logger=ea,r.modules={external:[]},jde(TA(r)),s&&!r.isInitialized&&!i.isClone){if(!r.options.initImmediate)return r.init(i,s),xg(r,TA(r));setTimeout(function(){r.init(i,s)},0)}return r}return $s(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=S3();this.options=Oo(Oo(Oo({},a),this.options),T3(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?ea.init(l(this.modules.logger),this.options):ea.init(null,this.options);var A;this.modules.formatter?A=this.modules.formatter:typeof Intl<"u"&&(A=Nde);var c=new _3(this.options);this.store=new Sde(this.options.resources,this.options);var u=this.services;u.logger=ea,u.resourceStore=this.store,u.languageUtils=c,u.pluralResolver=new Pde(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 Dde(this.options),u.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},u.backendConnector=new zde(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=ip(),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]:gv,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=ip();return i||(i=this.languages),s||(s=this.options.ns),o||(o=gv),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"&&g8.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=ip();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(Ns(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=ip();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=ip();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 _3(S3());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]:gv,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 x3(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 Nw(n,e)});var ni=Nw.createInstance();ni.createInstance=Nw.createInstance;ni.createInstance;ni.dir;ni.init;ni.loadResources;ni.reloadResources;ni.use;ni.changeLanguage;ni.getFixedT;ni.t;ni.exists;ni.setDefaultNamespace;ni.hasLoadedNamespace;ni.loadNamespaces;ni.loadLanguages;function Wde(){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 Yde(n,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(!e.languages||!e.languages.length)return KC("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}}):Kde(n,e,t)}var Xde=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,$de={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},Zde=function(e){return $de[e]},Jde=function(e){return e.replace(Xde,Zde)};function U3(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 L3(n){for(var e=1;e0&&arguments[0]!==void 0?arguments[0]:{};YC=L3(L3({},YC),n)}function epe(){return YC}var v8;function tpe(n){v8=n}function npe(){return v8}var rpe={type:"3rdParty",init:function(e){qde(e.options.react),tpe(e)}},ipe=ye.createContext(),spe=function(){function n(){Xs(this,n),this.usedNamespaces={}}return $s(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 ope(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 ape(n,e){return f8(n)||ope(n,e)||h8(n,e)||d8()}function P3(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 AB(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{},t=e.i18n,r=ye.useContext(ipe)||{},i=r.i18n,s=r.defaultNS,o=t||i||npe();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new spe),!o){KC("You will need to pass in an i18next instance by using initReactI18next");var a=function(M,O){return typeof O=="string"?O:O&&Ns(O)==="object"&&typeof O.defaultValue=="string"?O.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&&KC("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");var A=AB(AB(AB({},epe()),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 Yde(b,o,A)});function p(){return o.getFixedT(null,A.nsMode==="fallback"?f:f[0],u)}var d=ye.useState(p),g=ape(d,2),m=g[0],y=g[1],w=f.join(),x=lpe(w),_=ye.useRef(!0);ye.useEffect(function(){var b=A.bindI18n,M=A.bindI18nStore;_.current=!0,!h&&!c&&F3(o,f,function(){_.current&&y(p)}),h&&x&&x!==w&&_.current&&y(p);function O(){_.current&&y(p)}return b&&o&&o.on(b,O),M&&o&&o.store.on(M,O),function(){_.current=!1,b&&o&&b.split(" ").forEach(function(Y){return o.off(Y,O)}),M&&o&&M.split(" ").forEach(function(Y){return o.store.off(Y,O)})}},[o,w]);var B=ye.useRef(!0);ye.useEffect(function(){_.current&&!B.current&&y(p),B.current=!1},[o,u]);var T=[m,o,h];if(T.t=m,T.i18n=o,T.ready=h,h||!h&&!c)return T;throw new Promise(function(b){F3(o,f,function(){b()})})}var y8=[],cpe=y8.forEach,upe=y8.slice;function fpe(n){return cpe.call(upe.call(arguments,1),function(e){if(e)for(var t in e)n[t]===void 0&&(n[t]=e[t])}),n}var D3=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,hpe=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(!D3.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!D3.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},O3={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=hpe(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}},sp=null,N3=function(){if(sp!==null)return sp;try{sp=window!=="undefined"&&window.localStorage!==null;var e="i18next.translate.boo";window.localStorage.setItem(e,"foo"),window.localStorage.removeItem(e)}catch{sp=!1}return sp},mpe={name:"localStorage",lookup:function(e){var t;if(e.lookupLocalStorage&&N3()){var r=window.localStorage.getItem(e.lookupLocalStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupLocalStorage&&N3()&&window.localStorage.setItem(t.lookupLocalStorage,e)}},op=null,k3=function(){if(op!==null)return op;try{op=window!=="undefined"&&window.sessionStorage!==null;var e="i18next.translate.boo";window.sessionStorage.setItem(e,"foo"),window.sessionStorage.removeItem(e)}catch{op=!1}return op},gpe={name:"sessionStorage",lookup:function(e){var t;if(e.lookupSessionStorage&&k3()){var r=window.sessionStorage.getItem(e.lookupSessionStorage);r&&(t=r)}return t},cacheUserLanguage:function(e,t){t.lookupSessionStorage&&k3()&&window.sessionStorage.setItem(t.lookupSessionStorage,e)}},vpe={name:"navigator",lookup:function(e){var t=[];if(typeof navigator<"u"){if(navigator.languages)for(var r=0;r0?t:void 0}},ype={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}},wpe={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}},xpe={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 _pe(){return{order:["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"],lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"]}}var w8=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 $s(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=fpe(r,this.options||{},_pe()),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(dpe),this.addDetector(ppe),this.addDetector(mpe),this.addDetector(gpe),this.addDetector(vpe),this.addDetector(ype),this.addDetector(wpe),this.addDetector(xpe)}},{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}();w8.type="languageDetector";const bpe={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!"}}},Bpe={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 генерации голоса временно отключен на техническое обслуживание."}}},Epe={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暂时关闭进行维护!"}}},Cpe={en:bpe,ru:Bpe,zh:Epe};ni.use(w8).use(rpe).init({debug:!0,fallbackLng:"en",interpolation:{escapeValue:!1},resources:Cpe});const So=ye.createContext(),Mpe=n=>{const{t:e}=Ape();return k.jsx(So.Provider,{value:{t:e},children:n.children})},Spe=` uniform vec3 cameraDir; uniform vec3 eye; @@ -4337,7 +4337,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 ); } -`,Mpe=` +`,Tpe=` uniform float switchItemDuration; uniform float switchItemTime; uniform vec3 cameraDir; @@ -4375,7 +4375,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho gl_FragColor.a *= (switchItemDuration - switchItemTime); gl_FragColor *= aura; } -`,Spe=` +`,Ipe=` uniform vec4 cameraBillboardQuaternion; attribute vec2 scales; @@ -4406,7 +4406,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,Tpe=` +`,Rpe=` varying vec2 vUv; varying float vOpacity; varying vec3 vWorldPosition; @@ -4429,7 +4429,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } gl_FragColor.a *= vOpacity; } -`,Ipe=` +`,Fpe=` attribute vec2 scales; attribute float opacity; attribute vec3 positions; @@ -4455,7 +4455,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,Rpe=` +`,Upe=` uniform float radius; varying vec2 vUv; @@ -4478,7 +4478,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; } -`,Fpe=` +`,Lpe=` uniform vec4 cameraBillboardQuaternion; varying vec2 vUv; @@ -4499,7 +4499,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho vec4 projectionPosition = projectionMatrix * viewPosition; gl_Position = projectionPosition; } -`,Upe=` +`,Ppe=` varying vec2 vUv; varying vec3 vWorldPosition; @@ -4509,7 +4509,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); } -`,Lpe=` +`,Dpe=` varying vec3 vWorldPosition; varying vec3 vSurfaceNormal; @@ -4522,7 +4522,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 ); } -`,Ppe=` +`,Ope=` uniform vec3 cameraDir; uniform vec3 eye; @@ -4544,7 +4544,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; } -`,bT=(n,e,t)=>{const r=new Kt;["position","normal","uv"].forEach(o=>{r.setAttribute(o,n.attributes[o])}),r.setIndex(n.index);const i=new Float32Array(t*3),s=new dw(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 dw(A,l))}return r},Dpe=n=>{const r=new Dx(.45,.45,5,50,50,!0),i=new Mr({uniforms:{auraTexture:{value:null}},vertexShader:Cpe,fragmentShader:Mpe,transparent:!0,blending:Vc});i.uniforms.cameraDir=n.cameraDir,i.uniforms.eye=n.eye,i.uniforms.switchItemTime=n.switchItemTime,i.uniforms.switchItemDuration=n.switchItemDuration;const s=new Cn(r,i);return s.frustumCulled=!1,s.position.y=5*.46,s},Ope=()=>{const e=[];e.push({name:"opacity",itemSize:1}),e.push({name:"scales",itemSize:2});const t=.3,r=new iu(t,t),i=bT(r,e,20),s=new Mr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:Spe,fragmentShader:Tpe,depthWrite:!1,blending:Vc}),o=new Px(i,s,20);return o.info={particleCount:20,velocity:[20]},o},Npe=n=>{const t=[];t.push({name:"opacity",itemSize:1}),t.push({name:"scales",itemSize:2});const r=.43,i=new $S(r,32,32),s=bT(i,t,10),o=new Mr({uniforms:{radius:{value:r}},vertexShader:Ipe,fragmentShader:Rpe,depthWrite:!1,blending:Vc});o.uniforms.cameraDir=n.cameraDir,o.uniforms.eye=n.eye,o.uniforms.fadeInAvatarTime=n.fadeInAvatarTime;const a=new Px(s,o,10);return a.info={particleCount:10,velocity:[10],currentIndex:0},a},kpe=n=>{const t=new iu(1,1),r=new Mr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:Fpe,fragmentShader:Upe,depthWrite:!1,blending:Vc});return new Cn(t,r)},Qpe=n=>{const t=[],s=new Dx(.645,.43,2.5,50,50,!0),o=bT(s,t,2),a=new Mr({uniforms:{opacity:{value:0}},vertexShader:Lpe,fragmentShader:Ppe,transparent:!0,blending:Vc});a.uniforms.cameraDir=n.cameraDir,a.uniforms.eye=n.eye;const l=new Px(o,a,2);return l.fadeIn=!1,l.frustumCulled=!1,l.position.y=2.5*.46,l},k3=100,Hpe=0,Nw=1.5,zpe=.1,fy=0,Q3=1,H3=.05,YC=0,Gpe=1,Vpe=.015,xi={normal:0,switchItem:1,fadeOutAvatar:2,loadingAvatar:3,fadeInAvatar:4},jpe=new ou,w8=jpe.load("./textures/beam2.png");w8.wrapS=cs;class Wpe{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=Dpe(this.globalUniforms),this.beamMesh.material.uniforms.auraTexture.value=w8,this.beamMesh.update=()=>this.updateBeam(),this.scene.add(this.beamMesh)}initPixel(){this.pixelMesh=Ope(),this.pixelMesh.update=()=>this.updatePixel(),this.scene.add(this.pixelMesh)}initRing(){this.ringMesh=Npe(this.globalUniforms),this.ringMesh.update=()=>this.updateRing(),this.scene.add(this.ringMesh)}initTeleport(){this.teleportMesh=kpe(this.globalUniforms),this.teleportMesh.update=()=>this.updateTeleport(),this.teleportMesh.visible=!1,this.scene.add(this.teleportMesh)}initSpotLight(){this.spotLight=Qpe(this.globalUniforms),this.spotLight.update=()=>this.updateSpotLight(),this.spotLight.visible=!1,this.scene.add(this.spotLight)}updateBeam(){this.beamMesh&&this.globalUniforms.transitionEffectType.value!==xi.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!==xi.fadeInAvatar&&(this.ringMesh.visible=!1)}}updateTeleport(){if(this.teleportMesh){if(this.globalUniforms.transitionEffectType.value===xi.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 x8=new ou,XC=x8.load("./textures/pixel9.png");XC.wrapS=XC.wrapT=cs;const $C=x8.load("./textures/noise3.jpg");$C.wrapS=$C.wrapT=cs;const Ut={switchItemDuration:{value:Nw},switchItemTime:{value:Nw},eye:{value:new Z},cameraDir:{value:new Z},fadeOutAvatarTime:{value:fy},fadeInAvatarTime:{value:YC},transitionEffectType:{value:xi.normal}},z3={pixelTexture:{value:XC},noiseTexture:{value:$C}};class Kpe extends EventTarget{constructor(){super();kt(this,"setTransitionEffect",t=>{this.transitionEffectType=t});kt(this,"getTransitionEffect",t=>this.transitionEffectType===t);this.cameraDir=new Z,this.frameRate=1e3/30,this.initParticle=!1,this.transitionEffectType=null,this.transitionTime=k3,this.update()}setCustomShader(t){t.vertexShader&&(t.vertexShader=t.vertexShader.replace("varying vec3 vViewPosition;",` +`,BT=(n,e,t)=>{const r=new Kt;["position","normal","uv"].forEach(o=>{r.setAttribute(o,n.attributes[o])}),r.setIndex(n.index);const i=new Float32Array(t*3),s=new dw(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 dw(A,l))}return r},Npe=n=>{const r=new Ox(.45,.45,5,50,50,!0),i=new gr({uniforms:{auraTexture:{value:null}},vertexShader:Spe,fragmentShader:Tpe,transparent:!0,blending:Vc});i.uniforms.cameraDir=n.cameraDir,i.uniforms.eye=n.eye,i.uniforms.switchItemTime=n.switchItemTime,i.uniforms.switchItemDuration=n.switchItemDuration;const s=new Cn(r,i);return s.frustumCulled=!1,s.position.y=5*.46,s},kpe=()=>{const e=[];e.push({name:"opacity",itemSize:1}),e.push({name:"scales",itemSize:2});const t=.3,r=new iu(t,t),i=BT(r,e,20),s=new gr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:Ipe,fragmentShader:Rpe,depthWrite:!1,blending:Vc}),o=new Dx(i,s,20);return o.info={particleCount:20,velocity:[20]},o},Qpe=n=>{const t=[];t.push({name:"opacity",itemSize:1}),t.push({name:"scales",itemSize:2});const r=.43,i=new ZS(r,32,32),s=BT(i,t,10),o=new gr({uniforms:{radius:{value:r}},vertexShader:Fpe,fragmentShader:Upe,depthWrite:!1,blending:Vc});o.uniforms.cameraDir=n.cameraDir,o.uniforms.eye=n.eye,o.uniforms.fadeInAvatarTime=n.fadeInAvatarTime;const a=new Dx(s,o,10);return a.info={particleCount:10,velocity:[10],currentIndex:0},a},Hpe=n=>{const t=new iu(1,1),r=new gr({uniforms:{cameraBillboardQuaternion:{value:new rt}},vertexShader:Lpe,fragmentShader:Ppe,depthWrite:!1,blending:Vc});return new Cn(t,r)},zpe=n=>{const t=[],s=new Ox(.645,.43,2.5,50,50,!0),o=BT(s,t,2),a=new gr({uniforms:{opacity:{value:0}},vertexShader:Dpe,fragmentShader:Ope,transparent:!0,blending:Vc});a.uniforms.cameraDir=n.cameraDir,a.uniforms.eye=n.eye;const l=new Dx(o,a,2);return l.fadeIn=!1,l.frustumCulled=!1,l.position.y=2.5*.46,l},Q3=100,Gpe=0,kw=1.5,Vpe=.1,fy=0,H3=1,z3=.05,XC=0,jpe=1,Wpe=.015,xi={normal:0,switchItem:1,fadeOutAvatar:2,loadingAvatar:3,fadeInAvatar:4},Kpe=new ou,x8=Kpe.load("./textures/beam2.png");x8.wrapS=cs;class Ype{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=Npe(this.globalUniforms),this.beamMesh.material.uniforms.auraTexture.value=x8,this.beamMesh.update=()=>this.updateBeam(),this.scene.add(this.beamMesh)}initPixel(){this.pixelMesh=kpe(),this.pixelMesh.update=()=>this.updatePixel(),this.scene.add(this.pixelMesh)}initRing(){this.ringMesh=Qpe(this.globalUniforms),this.ringMesh.update=()=>this.updateRing(),this.scene.add(this.ringMesh)}initTeleport(){this.teleportMesh=Hpe(this.globalUniforms),this.teleportMesh.update=()=>this.updateTeleport(),this.teleportMesh.visible=!1,this.scene.add(this.teleportMesh)}initSpotLight(){this.spotLight=zpe(this.globalUniforms),this.spotLight.update=()=>this.updateSpotLight(),this.spotLight.visible=!1,this.scene.add(this.spotLight)}updateBeam(){this.beamMesh&&this.globalUniforms.transitionEffectType.value!==xi.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!==xi.fadeInAvatar&&(this.ringMesh.visible=!1)}}updateTeleport(){if(this.teleportMesh){if(this.globalUniforms.transitionEffectType.value===xi.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 _8=new ou,$C=_8.load("./textures/pixel9.png");$C.wrapS=$C.wrapT=cs;const ZC=_8.load("./textures/noise3.jpg");ZC.wrapS=ZC.wrapT=cs;const Ut={switchItemDuration:{value:kw},switchItemTime:{value:kw},eye:{value:new Z},cameraDir:{value:new Z},fadeOutAvatarTime:{value:fy},fadeInAvatarTime:{value:XC},transitionEffectType:{value:xi.normal}},G3={pixelTexture:{value:$C},noiseTexture:{value:ZC}};class Xpe extends EventTarget{constructor(){super();kt(this,"setTransitionEffect",t=>{this.transitionEffectType=t});kt(this,"getTransitionEffect",t=>this.transitionEffectType===t);this.cameraDir=new Z,this.frameRate=1e3/30,this.initParticle=!1,this.transitionEffectType=null,this.transitionTime=Q3,this.update()}setCustomShader(t){t.vertexShader&&(t.vertexShader=t.vertexShader.replace("varying vec3 vViewPosition;",` varying vec3 vViewPosition; varying vec3 vWorldPosition; varying vec3 vSurfaceNormal; @@ -4701,13 +4701,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho } gl_FragColor = vec4( col, diffuseColor.a ); - `),t.uniforms.pixelTexture=z3.pixelTexture,t.uniforms.noiseTexture=z3.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=xi.fadeOutAvatar,this.particleEffect.emitSpotLight(),this.particleEffect.emitPixel(),this.particleEffect.emitTeleport(),this.transitionTime=this.frameRate*((Q3-fy)/H3),this.initialFadeOutTimer()}playFadeInEffect(){Ut.transitionEffectType.value=xi.fadeInAvatar,this.initialFadeInTimer()}playSwitchItemEffect(){Ut.switchItemTime.value=Hpe,Ut.transitionEffectType.value=xi.switchItem,this.transitionTime=k3}setParticle(t,r){this.particleEffect=new Wpe(t,r,Ut)}initialFadeOutTimer(){Ut.fadeOutAvatarTime.value=fy}initialFadeInTimer(){Ut.fadeInAvatarTime.value=YC}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===xi.switchItem?Ut.switchItemTime.valueQ3&&(Ut.fadeOutAvatarTime.value=fy,Ut.transitionEffectType.value=xi.loadingAvatar)):Ut.transitionEffectType.value===xi.loadingAvatar||Ut.transitionEffectType.value===xi.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+=Vpe,Ut.fadeInAvatarTime.value>Gpe&&(Ut.fadeInAvatarTime.value=YC,Ut.transitionEffectType.value=xi.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 Ype="_container_1fjfz_1",Xpe="_messageWindow_1fjfz_11",$pe="_messageTitle_1fjfz_25",Zpe="_buttonContainer_1fjfz_36",vv={container:Ype,messageWindow:Xpe,messageTitle:$pe,buttonContainer:Zpe};var _8={exports:{}};/*! + `),t.uniforms.pixelTexture=G3.pixelTexture,t.uniforms.noiseTexture=G3.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=xi.fadeOutAvatar,this.particleEffect.emitSpotLight(),this.particleEffect.emitPixel(),this.particleEffect.emitTeleport(),this.transitionTime=this.frameRate*((H3-fy)/z3),this.initialFadeOutTimer()}playFadeInEffect(){Ut.transitionEffectType.value=xi.fadeInAvatar,this.initialFadeInTimer()}playSwitchItemEffect(){Ut.switchItemTime.value=Gpe,Ut.transitionEffectType.value=xi.switchItem,this.transitionTime=Q3}setParticle(t,r){this.particleEffect=new Ype(t,r,Ut)}initialFadeOutTimer(){Ut.fadeOutAvatarTime.value=fy}initialFadeInTimer(){Ut.fadeInAvatarTime.value=XC}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===xi.switchItem?Ut.switchItemTime.valueH3&&(Ut.fadeOutAvatarTime.value=fy,Ut.transitionEffectType.value=xi.loadingAvatar)):Ut.transitionEffectType.value===xi.loadingAvatar||Ut.transitionEffectType.value===xi.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+=Wpe,Ut.fadeInAvatarTime.value>jpe&&(Ut.fadeInAvatarTime.value=XC,Ut.transitionEffectType.value=xi.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 $pe="_container_1fjfz_1",Zpe="_messageWindow_1fjfz_11",Jpe="_messageTitle_1fjfz_25",qpe="_buttonContainer_1fjfz_36",vv={container:$pe,messageWindow:Zpe,messageTitle:Jpe,buttonContainer:qpe};var b8={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 gn(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&&cme(t).then(p=>{h.current&&(h.current.innerHTML="",p&&(p.classList.add(Pn.icon),h.current.append(p)))})},[t]),o&&o==="login"?N.jsxs("div",{className:fh(r,Pn.iconButtonWrap,s&&s==="dark"?Pn.dark:Pn.light,A&&Pn.active),style:{height:e},onClick:i,onMouseEnter:l,children:[N.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:Pn.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[N.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:Pn.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),N.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:Pn.innerBackgroundColor})]}),N.jsx("span",{ref:h,className:Pn.iconWrap})]}):o&&o==="icon"?N.jsxs("div",{className:fh(r,Pn.iconButtonWrap,s&&s==="dark"?Pn.dark:Pn.light,A&&Pn.active),style:{height:e},onClick:i,onMouseEnter:l,children:[N.jsxs("svg",{className:Pn.buttonBackground,width:"69",height:"63",viewBox:"0 0 69 63",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[N.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:Pn.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),N.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:Pn.innerBackgroundColor})]}),N.jsx("span",{ref:h,className:Pn.iconWrap})]}):N.jsx("button",{className:fh(r,Pn.buttonWrap,s&&s==="dark"?Pn.dark:Pn.light),onClick:i,onMouseEnter:l,onSubmit:c,type:o,disabled:f,style:{minWidth:u?u+"px":""},children:N.jsxs("div",{className:Pn.innerWrap,style:{fontSize:e},children:[t&&N.jsx("span",{ref:h,className:Pn.buttonIconWrap,style:{height:e,width:e,opacity:f?"0.4":"1"}}),a&&a]})})}function ume(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?N.jsx("div",{className:vv.container,children:N.jsxs("div",{className:vv.messageWindow,children:[N.jsx("div",{className:vv.messageTitle,children:t}),N.jsxs("div",{className:vv.buttonContainer,children:[e&&N.jsx(gn,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),N.jsx(gn,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):N.jsx("div",{})}const fme="_backgroundImg_1yy0g_1",hme="_darkBackground_1yy0g_16",dme="_logo_1yy0g_29",yv={backgroundImg:fme,darkBackground:hme,logo:dme};function pme(){const{debugMode:n}=$.useContext(Zn);return N.jsxs("div",{className:n?yv.darkBackground:yv.backgroundImg,children:[N.jsx("div",{className:yv.backgroundBlur}),N.jsx("div",{className:yv.Background})]})}const mme="_buttonContainer_lqksm_1",gme="_buttonLeft_lqksm_10",vme="_buttonRight_lqksm_14",yme="_buttonCenter_lqksm_18",wme="_sideMenu_lqksm_33",xme="_scrollContainer_lqksm_44",_me="_scrollContainerOptions_lqksm_52",bme="_bottomLine_lqksm_60",Bme="_editorButton_lqksm_94",Eme="_editorText_lqksm_102",Cme="_selectorContainerPos_lqksm_112",Mme="_selectorButton_lqksm_137",Sme="_selectorColorPickerUI_lqksm_146",Tme="_selectorColorPickerButton_lqksm_152",Ime="_selectorColorPickerImg_lqksm_165",Rme="_uploadContainer_lqksm_171",Fme="_uploadButton_lqksm_184",Ume="_relativeBox_lqksm_204",Lme="_blendshapeGroup_lqksm_208",nn={buttonContainer:mme,buttonLeft:gme,buttonRight:vme,buttonCenter:yme,sideMenu:wme,scrollContainer:xme,scrollContainerOptions:_me,bottomLine:bme,"editor-container":"_editor-container_lqksm_87",editorButton:Bme,editorText:Eme,selectorContainerPos:Cme,"selector-container":"_selector-container_lqksm_123","selector-container-column":"_selector-container-column_lqksm_129",selectorButton:Mme,selectorColorPickerUI:Sme,selectorColorPickerButton:Tme,selectorColorPickerImg:Ime,uploadContainer:Rme,uploadButton:Fme,relativeBox:Ume,blendshapeGroup:Lme},Pme="_dropArea_1a0z4_1",Dme={dropArea:Pme};function _g({onFilesDrop:n}){const[e,t]=ye.useState(!1),[r,i]=$.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 N.jsx("div",{onDragLeave:s,className:Dme.dropArea,style:{display:e?"flex":"none"}})}const Ome="_mainTitleWrap_4fb0s_1",Nme="_mainTitle_4fb0s_1",kme="_topLine_4fb0s_18",AB={mainTitleWrap:Ome,mainTitle:Nme,topLine:kme};function va({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&&N.jsxs("div",{className:AB.mainTitleWrap,style:i,children:[N.jsx("div",{className:AB.topLine}),N.jsx("div",{className:AB.mainTitle,children:n})]})}const Qme="_ContainerPositionTop_v15ql_2",Hme="_ContainerPosition_v15ql_2",zme="_Container_v15ql_2",Gme="_topLine_v15ql_68",Vme="_traitInfoTitle_v15ql_96",jme="_flexSelect_v15ql_105",Wme="_flexButtons_v15ql_114",Kme="_flexButtonsTop_v15ql_122",Yme="_optionButtons_v15ql_131",Xme="_optionButtonsSmall_v15ql_143",qn={ContainerPositionTop:Qme,ContainerPosition:Hme,Container:zme,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:Gme,traitInfoTitle:Vme,flexSelect:jme,flexButtons:Wme,flexButtonsTop:Kme,optionButtons:Yme,optionButtonsSmall:Xme},$me="/assets/randomize-green-4388c12b.png",Zme="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=",Jme="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=",qme="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==",ege="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",tge="/assets/play-de4238c5.png",nge="/assets/reverse-e35421b8.png",rge="/assets/pause-b6381fd4.png",ige="/assets/fast-forward-0d3ffae5.png",sge="/assets/fast-backward-1f713448.png";function qx({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=ye.useContext(Zn),[a,l]=ye.useState(s.userActivated),[A,c]=$.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 N.jsxs("div",{className:qn.Container,children:[N.jsx("div",{className:qn.ContainerPositionTop,children:N.jsxs("div",{className:qn.flexButtonsTop,children:[N.jsx("div",{className:`${qn.optionButtonsSmall}`,onClick:()=>{h(-2)},children:N.jsx("img",{src:sge})}),N.jsx("div",{className:`${qn.optionButtonsSmall}`,onClick:()=>{h(-1)},children:N.jsx("img",{src:nge})}),N.jsx("div",{className:`${qn.optionButtonsSmall}`,onClick:()=>{f(!1)},children:N.jsx("img",{src:rge})}),N.jsx("div",{className:`${qn.optionButtonsSmall}`,onClick:()=>{f(!0)},children:N.jsx("img",{src:tge})}),N.jsx("div",{className:`${qn.optionButtonsSmall}`,onClick:()=>{h(2)},children:N.jsx("img",{src:ige})})]})}),N.jsxs("div",{className:qn.ContainerPosition,children:[N.jsx("div",{className:qn.topLine}),N.jsxs("div",{className:qn.flexSelect,children:[N.jsx("div",{className:`${qn["arrow-button"]} ${qn["left-button"]}`,onClick:g}),N.jsx("div",{className:qn.traitInfoTitle,style:{marginBottom:"10px"},children:A}),N.jsx("div",{className:`${qn["arrow-button"]} ${qn["right-button"]}`,onClick:d})]}),N.jsxs("div",{className:qn.flexButtons,children:[e&&N.jsx("div",{className:`${qn.optionButtons}`,onClick:e,children:N.jsx("img",{src:$me})}),N.jsx("div",{className:`${qn.optionButtons}`,onClick:p,children:N.jsx("img",{src:a?ege:qme})}),N.jsx("div",{className:`${qn.optionButtons}`,onClick:u,children:N.jsx("img",{src:i?Jme:Zme})})]})]})]})}const oge="_tokenBoxWrap_q4pvo_1",age="_mask_q4pvo_7",lge="_timer_q4pvo_31",Age="_level_q4pvo_42",cge="_mythic_q4pvo_55",uge="_epic_q4pvo_60",fge="_rare_q4pvo_65",hge="_uncommon_q4pvo_70",dge="_common_q4pvo_75",pge="_none_q4pvo_80",mge="_value_q4pvo_85",gge="_frame_q4pvo_95",vge="_emptyIcon_q4pvo_111",yge="_badge_q4pvo_123",wge="_frameActive_q4pvo_131",Vl={tokenBoxWrap:oge,mask:age,timer:lge,level:Age,mythic:cge,epic:uge,rare:fge,uncommon:hge,common:dge,none:pge,value:mge,frame:gge,emptyIcon:vge,badge:yge,frameActive:wge,default:"_default_q4pvo_159"},xge="/assets/magic-box-cd45f027.png",il=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,A]=$.useState(!1),c=()=>{A(!0)};return N.jsxs("div",{className:Vl.tokenBoxWrap,style:{width:e,height:e},onClick:r,children:[t&&N.jsx("div",{className:fh(Vl.frame,Vl.frameActive)}),N.jsx("div",{className:fh(Vl.frame,o&&Vl[o])}),N.jsx("img",{src:l?xge:s,className:Vl.emptyIcon,style:a,onError:c}),i&&N.jsxs("div",{className:fh(Vl.level,o&&Vl[o]),children:["Lv.",i]})]})},_ge="_InformationContainerPos_72ckd_2",bge="_scrollContainer_72ckd_15",Bge="_traitInfoTitle_72ckd_27",Ege="_traitInfoText_72ckd_35",Cge="_flexSelect_72ckd_62",Mge="_checked_72ckd_119",Sge="_checkmark_72ckd_123",Tge="_checkboxHolder_72ckd_136",No={InformationContainerPos:_ge,scrollContainer:bge,traitInfoTitle:Bge,traitInfoText:Ege,"input-box":"_input-box_72ckd_43",flexSelect:Cge,"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:Mge,checkmark:Sge,checkboxHolder:Tge};function BT({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=$.useContext(Di),{characterManager:i}=ye.useContext(Zn),[s,o]=ye.useState(0),[a,l]=$.useState({}),[A,c]=$.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?N.jsxs("div",{className:No.InformationContainerPos,children:[N.jsx(va,{title:"Trait Selection",width:180,right:20}),N.jsxs("div",{className:No.scrollContainer,children:[N.jsxs("div",{className:No.flexSelect,children:[(n==null?void 0:n.length)>1?N.jsx("div",{className:`${No["arrow-button"]} ${No["left-button"]}`,onClick:p}):N.jsx(N.Fragment,{}),(n[s].name||n[s].manifestName)&&N.jsx("div",{style:{textAlign:"center",flex:1},children:N.jsx("div",{className:No.traitInfoTitle,children:e?n[s].manifestName:n[s].name})}),(n==null?void 0:n.length)>1?N.jsx("div",{className:`${No["arrow-button"]} ${No["right-button"]}`,onClick:h}):N.jsx(N.Fragment,{})]}),(n[s].thumb||n[s].thumbnail)&&N.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=>N.jsx("div",{children:N.jsx("div",{className:No.traitInfoText,children:`${d.trait_type} : ${d.value}`})},`json:${d.trait_type}_${d.value}`)),e&&A.map(d=>N.jsx("div",{children:N.jsx("div",{className:No.traitInfoText,children:`${d} : ${a[d].id}`})},`val:${d}`))]})]}):N.jsx(N.Fragment,{})}const ZC="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==",Ige="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=",Rge="/assets/color-palette-71a7a2d4.png";var Is={},bg={},Fge=typeof qo=="object"&&qo&&qo.Object===Object&&qo,B8=Fge,Uge=B8,Lge=typeof self=="object"&&self&&self.Object===Object&&self,Pge=Uge||Lge||Function("return this")(),Ba=Pge,Dge=Ba,Oge=Dge.Symbol,Bg=Oge,G3=Bg,E8=Object.prototype,Nge=E8.hasOwnProperty,kge=E8.toString,ap=G3?G3.toStringTag:void 0;function Qge(n){var e=Nge.call(n,ap),t=n[ap];try{n[ap]=void 0;var r=!0}catch{}var i=kge.call(n);return r&&(e?n[ap]=t:delete n[ap]),i}var Hge=Qge,zge=Object.prototype,Gge=zge.toString;function Vge(n){return Gge.call(n)}var jge=Vge,V3=Bg,Wge=Hge,Kge=jge,Yge="[object Null]",Xge="[object Undefined]",j3=V3?V3.toStringTag:void 0;function $ge(n){return n==null?n===void 0?Xge:Yge:j3&&j3 in Object(n)?Wge(n):Kge(n)}var au=$ge,Zge=Array.isArray,To=Zge;function Jge(n){return n!=null&&typeof n=="object"}var Ml=Jge,qge=au,e0e=To,t0e=Ml,n0e="[object String]";function r0e(n){return typeof n=="string"||!e0e(n)&&t0e(n)&&qge(n)==n0e}var i0e=r0e;function s0e(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 o0e=s0e,a0e=o0e,l0e=a0e(),A0e=l0e;function c0e(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=C0e}var CT=M0e,S0e=au,T0e=CT,I0e=Ml,R0e="[object Arguments]",F0e="[object Array]",U0e="[object Boolean]",L0e="[object Date]",P0e="[object Error]",D0e="[object Function]",O0e="[object Map]",N0e="[object Number]",k0e="[object Object]",Q0e="[object RegExp]",H0e="[object Set]",z0e="[object String]",G0e="[object WeakMap]",V0e="[object ArrayBuffer]",j0e="[object DataView]",W0e="[object Float32Array]",K0e="[object Float64Array]",Y0e="[object Int8Array]",X0e="[object Int16Array]",$0e="[object Int32Array]",Z0e="[object Uint8Array]",J0e="[object Uint8ClampedArray]",q0e="[object Uint16Array]",eve="[object Uint32Array]",hn={};hn[W0e]=hn[K0e]=hn[Y0e]=hn[X0e]=hn[$0e]=hn[Z0e]=hn[J0e]=hn[q0e]=hn[eve]=!0;hn[R0e]=hn[F0e]=hn[V0e]=hn[U0e]=hn[j0e]=hn[L0e]=hn[P0e]=hn[D0e]=hn[O0e]=hn[N0e]=hn[k0e]=hn[Q0e]=hn[H0e]=hn[z0e]=hn[G0e]=!1;function tve(n){return I0e(n)&&T0e(n.length)&&!!hn[S0e(n)]}var nve=tve;function rve(n){return function(e){return n(e)}}var MT=rve,Qw={exports:{}};Qw.exports;(function(n,e){var t=B8,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})(Qw,Qw.exports);var ST=Qw.exports,ive=nve,sve=MT,K3=ST,Y3=K3&&K3.isTypedArray,ove=Y3?sve(Y3):ive,T8=ove,ave=u0e,lve=M8,Ave=To,cve=ET,uve=S8,fve=T8,hve=Object.prototype,dve=hve.hasOwnProperty;function pve(n,e){var t=Ave(n),r=!t&&lve(n),i=!t&&!r&&cve(n),s=!t&&!r&&!i&&fve(n),o=t||r||i||s,a=o?ave(n.length,String):[],l=a.length;for(var A in n)(e||dve.call(n,A))&&!(o&&(A=="length"||i&&(A=="offset"||A=="parent")||s&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||uve(A,l)))&&a.push(A);return a}var I8=pve,mve=Object.prototype;function gve(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||mve;return n===t}var TT=gve;function vve(n,e){return function(t){return n(e(t))}}var R8=vve,yve=R8,wve=yve(Object.keys,Object),xve=wve,_ve=TT,bve=xve,Bve=Object.prototype,Eve=Bve.hasOwnProperty;function Cve(n){if(!_ve(n))return bve(n);var e=[];for(var t in Object(n))Eve.call(n,t)&&t!="constructor"&&e.push(t);return e}var Mve=Cve;function Sve(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var od=Sve,Tve=au,Ive=od,Rve="[object AsyncFunction]",Fve="[object Function]",Uve="[object GeneratorFunction]",Lve="[object Proxy]";function Pve(n){if(!Ive(n))return!1;var e=Tve(n);return e==Fve||e==Uve||e==Rve||e==Lve}var F8=Pve,Dve=F8,Ove=CT;function Nve(n){return n!=null&&Ove(n.length)&&!Dve(n)}var e_=Nve,kve=I8,Qve=Mve,Hve=e_;function zve(n){return Hve(n)?kve(n):Qve(n)}var Eg=zve,Gve=A0e,Vve=Eg;function jve(n,e){return n&&Gve(n,e,Vve)}var U8=jve;function Wve(n){return n}var L8=Wve,Kve=L8;function Yve(n){return typeof n=="function"?n:Kve}var Xve=Yve,$ve=U8,Zve=Xve;function Jve(n,e){return n&&$ve(n,Zve(e))}var IT=Jve,qve=R8,eye=qve(Object.getPrototypeOf,Object),RT=eye,tye=au,nye=RT,rye=Ml,iye="[object Object]",sye=Function.prototype,oye=Object.prototype,P8=sye.toString,aye=oye.hasOwnProperty,lye=P8.call(Object);function Aye(n){if(!rye(n)||tye(n)!=iye)return!1;var e=nye(n);if(e===null)return!0;var t=aye.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&P8.call(t)==lye}var cye=Aye;function uye(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var Mye=Cye,Sye=t_;function Tye(n,e){var t=this.__data__,r=Sye(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var Iye=Tye,Rye=hye,Fye=xye,Uye=Bye,Lye=Mye,Pye=Iye;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&Kxe?new Gxe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,OBe.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,PBe.default)(r)?(0,UBe.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,RBe.default)(r)&&t.push(r)}),t};bg.default=NBe;var Cg={};function kBe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,sSe.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,rSe.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=oSe({},r[a],s[a])}),i}),r};Cg.default=aSe;var Mg={};Object.defineProperty(Mg,"__esModule",{value:!0});Mg.autoprefix=void 0;var lSe=IT,SD=cSe(lSe),ASe=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){gSe(i,r);function i(){var s,o,a,l;mSe(this,i);for(var A=arguments.length,c=Array(A),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){bSe(i,r);function i(){var s,o,a,l;_Se(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};zT.default=ESe;Object.defineProperty(Is,"__esModule",{value:!0});Is.ReactCSS=Is.loop=Is.handleActive=GT=Is.handleHover=Is.hover=void 0;var CSe=bg,MSe=fd(CSe),SSe=Cg,TSe=fd(SSe),ISe=Mg,RSe=fd(ISe),FSe=Sg,oz=fd(FSe),USe=Tg,LSe=fd(USe),PSe=zT,DSe=fd(PSe);function fd(n){return n&&n.__esModule?n:{default:n}}Is.hover=oz.default;var GT=Is.handleHover=oz.default;Is.handleActive=LSe.default;Is.loop=DSe.default;var OSe=Is.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},pB={},kSe=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},QSe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(pB[s])return pB[s];var o=kSe(e,t,r,i);return pB[s]=o,o},RD=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 gn(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&&fme(t).then(p=>{h.current&&(h.current.innerHTML="",p&&(p.classList.add(Pn.icon),h.current.append(p)))})},[t]),o&&o==="login"?k.jsxs("div",{className:fh(r,Pn.iconButtonWrap,s&&s==="dark"?Pn.dark:Pn.light,A&&Pn.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{width:"71",height:"67",viewBox:"0 0 71 67",className:Pn.buttonBackground,xmlns:"http://www.w3.org/2000/svg",children:[k.jsx("path",{d:"M2 2H68.8452L64.1437 65H2V2Z",className:Pn.buttonBackgroundColor,fill:"#D9D9D9",stroke:"#050B0E",strokeWidth:"4"}),k.jsx("path",{d:"M9 9H62L58.2676 58H9V9Z",fill:"#050B0E",className:Pn.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Pn.iconWrap})]}):o&&o==="icon"?k.jsxs("div",{className:fh(r,Pn.iconButtonWrap,s&&s==="dark"?Pn.dark:Pn.light,A&&Pn.active),style:{height:e},onClick:i,onMouseEnter:l,children:[k.jsxs("svg",{className:Pn.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:Pn.buttonBackgroundColor,stroke:"black",strokeWidth:"4"}),k.jsx("path",{d:"M8.77795 7.28503H61.7957L59.8437 54.7911H11.367L8.77795 7.28503Z",fill:"black",className:Pn.innerBackgroundColor})]}),k.jsx("span",{ref:h,className:Pn.iconWrap})]}):k.jsx("button",{className:fh(r,Pn.buttonWrap,s&&s==="dark"?Pn.dark:Pn.light),onClick:i,onMouseEnter:l,onSubmit:c,type:o,disabled:f,style:{minWidth:u?u+"px":""},children:k.jsxs("div",{className:Pn.innerWrap,style:{fontSize:e},children:[t&&k.jsx("span",{ref:h,className:Pn.buttonIconWrap,style:{height:e,width:e,opacity:f?"0.4":"1"}}),a&&a]})})}function hme(n){const{cancelOption:e=!0,confirmDialogText:t,confirmDialogWindow:r,setConfirmDialogWindow:i,confirmDialogCallback:s}=n;return r?k.jsx("div",{className:vv.container,children:k.jsxs("div",{className:vv.messageWindow,children:[k.jsx("div",{className:vv.messageTitle,children:t}),k.jsxs("div",{className:vv.buttonContainer,children:[e&&k.jsx(gn,{size:16,theme:"light",text:"Cancel",onClick:()=>{s[0](!1),i(!1)}}),k.jsx(gn,{size:16,theme:"light",text:"Continue",onClick:()=>{s[0](!0),i(!1)}})]})]})}):k.jsx("div",{})}const dme="_backgroundImg_1yy0g_1",pme="_darkBackground_1yy0g_16",mme="_logo_1yy0g_29",yv={backgroundImg:dme,darkBackground:pme,logo:mme};function gme(){const{debugMode:n}=$.useContext(Zn);return k.jsxs("div",{className:n?yv.darkBackground:yv.backgroundImg,children:[k.jsx("div",{className:yv.backgroundBlur}),k.jsx("div",{className:yv.Background})]})}const vme="_buttonContainer_lqksm_1",yme="_buttonLeft_lqksm_10",wme="_buttonRight_lqksm_14",xme="_buttonCenter_lqksm_18",_me="_sideMenu_lqksm_33",bme="_scrollContainer_lqksm_44",Bme="_scrollContainerOptions_lqksm_52",Eme="_bottomLine_lqksm_60",Cme="_editorButton_lqksm_94",Mme="_editorText_lqksm_102",Sme="_selectorContainerPos_lqksm_112",Tme="_selectorButton_lqksm_137",Ime="_selectorColorPickerUI_lqksm_146",Rme="_selectorColorPickerButton_lqksm_152",Fme="_selectorColorPickerImg_lqksm_165",Ume="_uploadContainer_lqksm_171",Lme="_uploadButton_lqksm_184",Pme="_relativeBox_lqksm_204",Dme="_blendshapeGroup_lqksm_208",nn={buttonContainer:vme,buttonLeft:yme,buttonRight:wme,buttonCenter:xme,sideMenu:_me,scrollContainer:bme,scrollContainerOptions:Bme,bottomLine:Eme,"editor-container":"_editor-container_lqksm_87",editorButton:Cme,editorText:Mme,selectorContainerPos:Sme,"selector-container":"_selector-container_lqksm_123","selector-container-column":"_selector-container-column_lqksm_129",selectorButton:Tme,selectorColorPickerUI:Ime,selectorColorPickerButton:Rme,selectorColorPickerImg:Fme,uploadContainer:Ume,uploadButton:Lme,relativeBox:Pme,blendshapeGroup:Dme},Ome="_dropArea_1a0z4_1",Nme={dropArea:Ome};function _g({onFilesDrop:n}){const[e,t]=ye.useState(!1),[r,i]=$.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:Nme.dropArea,style:{display:e?"flex":"none"}})}const kme="_mainTitleWrap_4fb0s_1",Qme="_mainTitle_4fb0s_1",Hme="_topLine_4fb0s_18",cB={mainTitleWrap:kme,mainTitle:Qme,topLine:Hme};function va({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:cB.mainTitleWrap,style:i,children:[k.jsx("div",{className:cB.topLine}),k.jsx("div",{className:cB.mainTitle,children:n})]})}const zme="_ContainerPositionTop_v15ql_2",Gme="_ContainerPosition_v15ql_2",Vme="_Container_v15ql_2",jme="_topLine_v15ql_68",Wme="_traitInfoTitle_v15ql_96",Kme="_flexSelect_v15ql_105",Yme="_flexButtons_v15ql_114",Xme="_flexButtonsTop_v15ql_122",$me="_optionButtons_v15ql_131",Zme="_optionButtonsSmall_v15ql_143",qn={ContainerPositionTop:zme,ContainerPosition:Gme,Container:Vme,"arrow-button":"_arrow-button_v15ql_39","left-button":"_left-button_v15ql_55","right-button":"_right-button_v15ql_62",topLine:jme,traitInfoTitle:Wme,flexSelect:Kme,flexButtons:Yme,flexButtonsTop:Xme,optionButtons:$me,optionButtonsSmall:Zme},Jme="/assets/randomize-green-4388c12b.png",qme="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=",ege="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=",tge="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==",nge="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",rge="/assets/play-de4238c5.png",ige="/assets/reverse-e35421b8.png",sge="/assets/pause-b6381fd4.png",oge="/assets/fast-forward-0d3ffae5.png",age="/assets/fast-backward-1f713448.png";function e_({loadedAnimationName:n,randomize:e}){const{characterManager:t,toggleDebugMode:r,debugMode:i,lookAtManager:s,animationManager:o}=ye.useContext(Zn),[a,l]=ye.useState(s.userActivated),[A,c]=$.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:qn.Container,children:[k.jsx("div",{className:qn.ContainerPositionTop,children:k.jsxs("div",{className:qn.flexButtonsTop,children:[k.jsx("div",{className:`${qn.optionButtonsSmall}`,onClick:()=>{h(-2)},children:k.jsx("img",{src:age})}),k.jsx("div",{className:`${qn.optionButtonsSmall}`,onClick:()=>{h(-1)},children:k.jsx("img",{src:ige})}),k.jsx("div",{className:`${qn.optionButtonsSmall}`,onClick:()=>{f(!1)},children:k.jsx("img",{src:sge})}),k.jsx("div",{className:`${qn.optionButtonsSmall}`,onClick:()=>{f(!0)},children:k.jsx("img",{src:rge})}),k.jsx("div",{className:`${qn.optionButtonsSmall}`,onClick:()=>{h(2)},children:k.jsx("img",{src:oge})})]})}),k.jsxs("div",{className:qn.ContainerPosition,children:[k.jsx("div",{className:qn.topLine}),k.jsxs("div",{className:qn.flexSelect,children:[k.jsx("div",{className:`${qn["arrow-button"]} ${qn["left-button"]}`,onClick:g}),k.jsx("div",{className:qn.traitInfoTitle,style:{marginBottom:"10px"},children:A}),k.jsx("div",{className:`${qn["arrow-button"]} ${qn["right-button"]}`,onClick:d})]}),k.jsxs("div",{className:qn.flexButtons,children:[e&&k.jsx("div",{className:`${qn.optionButtons}`,onClick:e,children:k.jsx("img",{src:Jme})}),k.jsx("div",{className:`${qn.optionButtons}`,onClick:p,children:k.jsx("img",{src:a?nge:tge})}),k.jsx("div",{className:`${qn.optionButtons}`,onClick:u,children:k.jsx("img",{src:i?ege:qme})})]})]})]})}const lge="_tokenBoxWrap_q4pvo_1",Age="_mask_q4pvo_7",cge="_timer_q4pvo_31",uge="_level_q4pvo_42",fge="_mythic_q4pvo_55",hge="_epic_q4pvo_60",dge="_rare_q4pvo_65",pge="_uncommon_q4pvo_70",mge="_common_q4pvo_75",gge="_none_q4pvo_80",vge="_value_q4pvo_85",yge="_frame_q4pvo_95",wge="_emptyIcon_q4pvo_111",xge="_badge_q4pvo_123",_ge="_frameActive_q4pvo_131",Vl={tokenBoxWrap:lge,mask:Age,timer:cge,level:uge,mythic:fge,epic:hge,rare:dge,uncommon:pge,common:mge,none:gge,value:vge,frame:yge,emptyIcon:wge,badge:xge,frameActive:_ge,default:"_default_q4pvo_159"},bge="/assets/magic-box-cd45f027.png",il=n=>{const{size:e,active:t,onClick:r,level:i,icon:s,rarity:o,style:a}=n,[l,A]=$.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:fh(Vl.frame,Vl.frameActive)}),k.jsx("div",{className:fh(Vl.frame,o&&Vl[o])}),k.jsx("img",{src:l?bge:s,className:Vl.emptyIcon,style:a,onError:c}),i&&k.jsxs("div",{className:fh(Vl.level,o&&Vl[o]),children:["Lv.",i]})]})},Bge="_InformationContainerPos_72ckd_2",Ege="_scrollContainer_72ckd_15",Cge="_traitInfoTitle_72ckd_27",Mge="_traitInfoText_72ckd_35",Sge="_flexSelect_72ckd_62",Tge="_checked_72ckd_119",Ige="_checkmark_72ckd_123",Rge="_checkboxHolder_72ckd_136",No={InformationContainerPos:Bge,scrollContainer:Ege,traitInfoTitle:Cge,traitInfoText:Mge,"input-box":"_input-box_72ckd_43",flexSelect:Sge,"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:Tge,checkmark:Ige,checkboxHolder:Rge};function ET({jsonSelectionArray:n,byManifest:e=!1}){const{isLoading:t,setIsLoading:r}=$.useContext(Di),{characterManager:i}=ye.useContext(Zn),[s,o]=ye.useState(0),[a,l]=$.useState({}),[A,c]=$.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(va,{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 JC="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==",Fge="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=",Uge="/assets/color-palette-71a7a2d4.png";var Is={},bg={},Lge=typeof qo=="object"&&qo&&qo.Object===Object&&qo,E8=Lge,Pge=E8,Dge=typeof self=="object"&&self&&self.Object===Object&&self,Oge=Pge||Dge||Function("return this")(),Ba=Oge,Nge=Ba,kge=Nge.Symbol,Bg=kge,V3=Bg,C8=Object.prototype,Qge=C8.hasOwnProperty,Hge=C8.toString,ap=V3?V3.toStringTag:void 0;function zge(n){var e=Qge.call(n,ap),t=n[ap];try{n[ap]=void 0;var r=!0}catch{}var i=Hge.call(n);return r&&(e?n[ap]=t:delete n[ap]),i}var Gge=zge,Vge=Object.prototype,jge=Vge.toString;function Wge(n){return jge.call(n)}var Kge=Wge,j3=Bg,Yge=Gge,Xge=Kge,$ge="[object Null]",Zge="[object Undefined]",W3=j3?j3.toStringTag:void 0;function Jge(n){return n==null?n===void 0?Zge:$ge:W3&&W3 in Object(n)?Yge(n):Xge(n)}var au=Jge,qge=Array.isArray,To=qge;function e0e(n){return n!=null&&typeof n=="object"}var Ml=e0e,t0e=au,n0e=To,r0e=Ml,i0e="[object String]";function s0e(n){return typeof n=="string"||!n0e(n)&&r0e(n)&&t0e(n)==i0e}var o0e=s0e;function a0e(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 l0e=a0e,A0e=l0e,c0e=A0e(),u0e=c0e;function f0e(n,e){for(var t=-1,r=Array(n);++t-1&&n%1==0&&n-1&&n%1==0&&n<=S0e}var MT=T0e,I0e=au,R0e=MT,F0e=Ml,U0e="[object Arguments]",L0e="[object Array]",P0e="[object Boolean]",D0e="[object Date]",O0e="[object Error]",N0e="[object Function]",k0e="[object Map]",Q0e="[object Number]",H0e="[object Object]",z0e="[object RegExp]",G0e="[object Set]",V0e="[object String]",j0e="[object WeakMap]",W0e="[object ArrayBuffer]",K0e="[object DataView]",Y0e="[object Float32Array]",X0e="[object Float64Array]",$0e="[object Int8Array]",Z0e="[object Int16Array]",J0e="[object Int32Array]",q0e="[object Uint8Array]",eve="[object Uint8ClampedArray]",tve="[object Uint16Array]",nve="[object Uint32Array]",hn={};hn[Y0e]=hn[X0e]=hn[$0e]=hn[Z0e]=hn[J0e]=hn[q0e]=hn[eve]=hn[tve]=hn[nve]=!0;hn[U0e]=hn[L0e]=hn[W0e]=hn[P0e]=hn[K0e]=hn[D0e]=hn[O0e]=hn[N0e]=hn[k0e]=hn[Q0e]=hn[H0e]=hn[z0e]=hn[G0e]=hn[V0e]=hn[j0e]=!1;function rve(n){return F0e(n)&&R0e(n.length)&&!!hn[I0e(n)]}var ive=rve;function sve(n){return function(e){return n(e)}}var ST=sve,Hw={exports:{}};Hw.exports;(function(n,e){var t=E8,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})(Hw,Hw.exports);var TT=Hw.exports,ove=ive,ave=ST,Y3=TT,X3=Y3&&Y3.isTypedArray,lve=X3?ave(X3):ove,I8=lve,Ave=h0e,cve=S8,uve=To,fve=CT,hve=T8,dve=I8,pve=Object.prototype,mve=pve.hasOwnProperty;function gve(n,e){var t=uve(n),r=!t&&cve(n),i=!t&&!r&&fve(n),s=!t&&!r&&!i&&dve(n),o=t||r||i||s,a=o?Ave(n.length,String):[],l=a.length;for(var A in n)(e||mve.call(n,A))&&!(o&&(A=="length"||i&&(A=="offset"||A=="parent")||s&&(A=="buffer"||A=="byteLength"||A=="byteOffset")||hve(A,l)))&&a.push(A);return a}var R8=gve,vve=Object.prototype;function yve(n){var e=n&&n.constructor,t=typeof e=="function"&&e.prototype||vve;return n===t}var IT=yve;function wve(n,e){return function(t){return n(e(t))}}var F8=wve,xve=F8,_ve=xve(Object.keys,Object),bve=_ve,Bve=IT,Eve=bve,Cve=Object.prototype,Mve=Cve.hasOwnProperty;function Sve(n){if(!Bve(n))return Eve(n);var e=[];for(var t in Object(n))Mve.call(n,t)&&t!="constructor"&&e.push(t);return e}var Tve=Sve;function Ive(n){var e=typeof n;return n!=null&&(e=="object"||e=="function")}var od=Ive,Rve=au,Fve=od,Uve="[object AsyncFunction]",Lve="[object Function]",Pve="[object GeneratorFunction]",Dve="[object Proxy]";function Ove(n){if(!Fve(n))return!1;var e=Rve(n);return e==Lve||e==Pve||e==Uve||e==Dve}var U8=Ove,Nve=U8,kve=MT;function Qve(n){return n!=null&&kve(n.length)&&!Nve(n)}var t_=Qve,Hve=R8,zve=Tve,Gve=t_;function Vve(n){return Gve(n)?Hve(n):zve(n)}var Eg=Vve,jve=u0e,Wve=Eg;function Kve(n,e){return n&&jve(n,e,Wve)}var L8=Kve;function Yve(n){return n}var P8=Yve,Xve=P8;function $ve(n){return typeof n=="function"?n:Xve}var Zve=$ve,Jve=L8,qve=Zve;function eye(n,e){return n&&Jve(n,qve(e))}var RT=eye,tye=F8,nye=tye(Object.getPrototypeOf,Object),FT=nye,rye=au,iye=FT,sye=Ml,oye="[object Object]",aye=Function.prototype,lye=Object.prototype,D8=aye.toString,Aye=lye.hasOwnProperty,cye=D8.call(Object);function uye(n){if(!sye(n)||rye(n)!=oye)return!1;var e=iye(n);if(e===null)return!0;var t=Aye.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&D8.call(t)==cye}var fye=uye;function hye(n,e){for(var t=-1,r=n==null?0:n.length,i=Array(r);++t-1}var Tye=Sye,Iye=n_;function Rye(n,e){var t=this.__data__,r=Iye(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}var Fye=Rye,Uye=pye,Lye=bye,Pye=Cye,Dye=Tye,Oye=Fye;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&Xxe?new jxe:void 0;for(s.set(n,e),s.set(e,n);++u0&&arguments[0]!==void 0?arguments[0]:[],t=[];return(0,kBe.default)(e,function(r){Array.isArray(r)?n(r).map(function(i){return t.push(i)}):(0,OBe.default)(r)?(0,PBe.default)(r,function(i,s){i===!0&&t.push(s),t.push(s+"-"+i)}):(0,UBe.default)(r)&&t.push(r)}),t};bg.default=QBe;var Cg={};function HBe(n,e){for(var t=-1,r=n==null?0:n.length;++t1&&arguments[1]!==void 0?arguments[1]:[],r=e.default&&(0,aSe.default)(e.default)||{};return t.map(function(i){var s=e[i];return s&&(0,sSe.default)(s,function(o,a){r[a]||(r[a]={}),r[a]=lSe({},r[a],s[a])}),i}),r};Cg.default=ASe;var Mg={};Object.defineProperty(Mg,"__esModule",{value:!0});Mg.autoprefix=void 0;var cSe=RT,TD=fSe(cSe),uSe=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){ySe(i,r);function i(){var s,o,a,l;vSe(this,i);for(var A=arguments.length,c=Array(A),u=0;u1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){ESe(i,r);function i(){var s,o,a,l;BSe(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};GT.default=MSe;Object.defineProperty(Is,"__esModule",{value:!0});Is.ReactCSS=Is.loop=Is.handleActive=VT=Is.handleHover=Is.hover=void 0;var SSe=bg,TSe=fd(SSe),ISe=Cg,RSe=fd(ISe),FSe=Mg,USe=fd(FSe),LSe=Sg,az=fd(LSe),PSe=Tg,DSe=fd(PSe),OSe=GT,NSe=fd(OSe);function fd(n){return n&&n.__esModule?n:{default:n}}Is.hover=az.default;var VT=Is.handleHover=az.default;Is.handleActive=DSe.default;Is.loop=NSe.default;var kSe=Is.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},mB={},HSe=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},zSe=function(e,t,r,i){var s=e+"-"+t+"-"+r+(i?"-server":"");if(mB[s])return mB[s];var o=HSe(e,t,r,i);return mB[s]=o,o},FD=Object.assign||function(n){for(var e=1;e-1},eTe=function(e){return Number(String(e).replace(/%/g,""))},tTe=1,Pt=function(n){XSe(e,n);function e(t){KSe(this,e);var r=YSe(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=eTe(i.target.value);if(!isNaN(s)&&qSe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===az?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-"+tTe++,r}return jSe(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 WSe({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||$Se}},{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=ht({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 $.createElement("div",{style:i.wrap},$.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?$.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(ye.PureComponent||ye.Component),nTe=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},rTe=function(){function n(e,t){for(var r=0;r-1},nTe=function(e){return Number(String(e).replace(/%/g,""))},rTe=1,Pt=function(n){ZSe(e,n);function e(t){XSe(this,e);var r=$Se(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=nTe(i.target.value);if(!isNaN(s)&&tTe(i.keyCode)){var o=r.getArrowOffset(),a=i.keyCode===lz?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-"+rTe++,r}return KSe(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 YSe({},this.props.label,r)}},{key:"getArrowOffset",value:function(){return this.props.arrowOffset||JSe}},{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=ht({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 $.createElement("div",{style:i.wrap},$.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?$.createElement("label",{htmlFor:this.inputId,style:i.label,onMouseDown:this.handleMouseDown},this.props.label):null)}}]),e}(ye.PureComponent||ye.Component),iTe=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},sTe=function(){function n(e,t){for(var r=0;r-1}function gTe(n,e){var t=this.__data__,r=A_(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function Sl(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1&&n%1==0&&n<=O2e}function pd(n){return n!=null&&YT(n.length)&&!jT(n)}function N2e(n){return QA(n)&&pd(n)}function k2e(){return!1}var vz=typeof exports=="object"&&exports&&!exports.nodeType&&exports,HD=vz&&typeof module=="object"&&module&&!module.nodeType&&module,Q2e=HD&&HD.exports===vz,zD=Q2e?Io.Buffer:void 0,H2e=zD?zD.isBuffer:void 0,z2e=H2e||k2e;const Ww=z2e;var G2e="[object Object]",V2e=Function.prototype,j2e=Object.prototype,yz=V2e.toString,W2e=j2e.hasOwnProperty,K2e=yz.call(Object);function Y2e(n){if(!QA(n)||Au(n)!=G2e)return!1;var e=mz(n);if(e===null)return!0;var t=W2e.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&yz.call(t)==K2e}var X2e="[object Arguments]",$2e="[object Array]",Z2e="[object Boolean]",J2e="[object Date]",q2e="[object Error]",eIe="[object Function]",tIe="[object Map]",nIe="[object Number]",rIe="[object Object]",iIe="[object RegExp]",sIe="[object Set]",oIe="[object String]",aIe="[object WeakMap]",lIe="[object ArrayBuffer]",AIe="[object DataView]",cIe="[object Float32Array]",uIe="[object Float64Array]",fIe="[object Int8Array]",hIe="[object Int16Array]",dIe="[object Int32Array]",pIe="[object Uint8Array]",mIe="[object Uint8ClampedArray]",gIe="[object Uint16Array]",vIe="[object Uint32Array]",dn={};dn[cIe]=dn[uIe]=dn[fIe]=dn[hIe]=dn[dIe]=dn[pIe]=dn[mIe]=dn[gIe]=dn[vIe]=!0;dn[X2e]=dn[$2e]=dn[lIe]=dn[Z2e]=dn[AIe]=dn[J2e]=dn[q2e]=dn[eIe]=dn[tIe]=dn[nIe]=dn[rIe]=dn[iIe]=dn[sIe]=dn[oIe]=dn[aIe]=!1;function yIe(n){return QA(n)&&YT(n.length)&&!!dn[Au(n)]}function wIe(n){return function(e){return n(e)}}var wz=typeof exports=="object"&&exports&&!exports.nodeType&&exports,om=wz&&typeof module=="object"&&module&&!module.nodeType&&module,xIe=om&&om.exports===wz,gB=xIe&&uz.process,_Ie=function(){try{var n=om&&om.require&&om.require("util").types;return n||gB&&gB.binding&&gB.binding("util")}catch{}}();const GD=_Ie;var VD=GD&&GD.isTypedArray,bIe=VD?wIe(VD):yIe;const XT=bIe;function iM(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}var BIe=Object.prototype,EIe=BIe.hasOwnProperty;function CIe(n,e,t){var r=n[e];(!(EIe.call(n,e)&&Ig(r,t))||t===void 0&&!(e in n))&&WT(n,e,t)}function MIe(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s-1&&n%1==0&&n0){if(++e>=VIe)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var YIe=KIe(GIe);const XIe=YIe;function $Ie(n,e){return XIe(QIe(n,e,u_),n+"")}function ZIe(n,e,t){if(!Vs(t))return!1;var r=typeof e;return(r=="number"?pd(t)&&$T(e,t.length):r=="string"&&e in t)?Ig(t[e],n):!1}function JIe(n){return $Ie(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&&ZIe(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r=e||T<0||u&&b>=s}function m(){var C=vB();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(vB())}function _(){var C=vB(),T=g(C);if(r=arguments,i=this,l=C,T){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 hRe="Expected a function";function dRe(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(hRe);return Vs(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),Bz(n,e,{leading:r,maxWait:e,trailing:i})}var pRe=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"}},mRe=function(){function n(e,t){for(var r=0;r-1}function yTe(n,e){var t=this.__data__,r=c_(t,n);return r<0?(++this.size,t.push([n,e])):t[r][1]=e,this}function Sl(n){var e=-1,t=n==null?0:n.length;for(this.clear();++e-1&&n%1==0&&n<=k2e}function pd(n){return n!=null&&XT(n.length)&&!WT(n)}function Q2e(n){return QA(n)&&pd(n)}function H2e(){return!1}var yz=typeof exports=="object"&&exports&&!exports.nodeType&&exports,zD=yz&&typeof module=="object"&&module&&!module.nodeType&&module,z2e=zD&&zD.exports===yz,GD=z2e?Io.Buffer:void 0,G2e=GD?GD.isBuffer:void 0,V2e=G2e||H2e;const Kw=V2e;var j2e="[object Object]",W2e=Function.prototype,K2e=Object.prototype,wz=W2e.toString,Y2e=K2e.hasOwnProperty,X2e=wz.call(Object);function $2e(n){if(!QA(n)||Au(n)!=j2e)return!1;var e=gz(n);if(e===null)return!0;var t=Y2e.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&wz.call(t)==X2e}var Z2e="[object Arguments]",J2e="[object Array]",q2e="[object Boolean]",eIe="[object Date]",tIe="[object Error]",nIe="[object Function]",rIe="[object Map]",iIe="[object Number]",sIe="[object Object]",oIe="[object RegExp]",aIe="[object Set]",lIe="[object String]",AIe="[object WeakMap]",cIe="[object ArrayBuffer]",uIe="[object DataView]",fIe="[object Float32Array]",hIe="[object Float64Array]",dIe="[object Int8Array]",pIe="[object Int16Array]",mIe="[object Int32Array]",gIe="[object Uint8Array]",vIe="[object Uint8ClampedArray]",yIe="[object Uint16Array]",wIe="[object Uint32Array]",dn={};dn[fIe]=dn[hIe]=dn[dIe]=dn[pIe]=dn[mIe]=dn[gIe]=dn[vIe]=dn[yIe]=dn[wIe]=!0;dn[Z2e]=dn[J2e]=dn[cIe]=dn[q2e]=dn[uIe]=dn[eIe]=dn[tIe]=dn[nIe]=dn[rIe]=dn[iIe]=dn[sIe]=dn[oIe]=dn[aIe]=dn[lIe]=dn[AIe]=!1;function xIe(n){return QA(n)&&XT(n.length)&&!!dn[Au(n)]}function _Ie(n){return function(e){return n(e)}}var xz=typeof exports=="object"&&exports&&!exports.nodeType&&exports,om=xz&&typeof module=="object"&&module&&!module.nodeType&&module,bIe=om&&om.exports===xz,vB=bIe&&fz.process,BIe=function(){try{var n=om&&om.require&&om.require("util").types;return n||vB&&vB.binding&&vB.binding("util")}catch{}}();const VD=BIe;var jD=VD&&VD.isTypedArray,EIe=jD?_Ie(jD):xIe;const $T=EIe;function sM(n,e){if(!(e==="constructor"&&typeof n[e]=="function")&&e!="__proto__")return n[e]}var CIe=Object.prototype,MIe=CIe.hasOwnProperty;function SIe(n,e,t){var r=n[e];(!(MIe.call(n,e)&&Ig(r,t))||t===void 0&&!(e in n))&&KT(n,e,t)}function TIe(n,e,t,r){var i=!t;t||(t={});for(var s=-1,o=e.length;++s-1&&n%1==0&&n0){if(++e>=WIe)return arguments[0]}else e=0;return n.apply(void 0,arguments)}}var $Ie=XIe(jIe);const ZIe=$Ie;function JIe(n,e){return ZIe(zIe(n,e,f_),n+"")}function qIe(n,e,t){if(!Vs(t))return!1;var r=typeof e;return(r=="number"?pd(t)&&ZT(e,t.length):r=="string"&&e in t)?Ig(t[e],n):!1}function eRe(n){return JIe(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&&qIe(t[0],t[1],o)&&(s=i<3?void 0:s,i=1),e=Object(e);++r=e||T<0||u&&b>=s}function m(){var B=yB();if(g(B))return y(B);a=setTimeout(m,d(B))}function y(B){return a=void 0,f&&r?h(B):(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(yB())}function _(){var B=yB(),T=g(B);if(r=arguments,i=this,l=B,T){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 pRe="Expected a function";function mRe(n,e,t){var r=!0,i=!0;if(typeof n!="function")throw new TypeError(pRe);return Vs(t)&&(r="leading"in t?!!t.leading:r,i="trailing"in t?!!t.trailing:i),Ez(n,e,{leading:r,maxWait:e,trailing:i})}var gRe=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"}},vRe=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(HRe,arguments)},brighten:function(){return this._applyModification(zRe,arguments)},darken:function(){return this._applyModification(GRe,arguments)},desaturate:function(){return this._applyModification(NRe,arguments)},saturate:function(){return this._applyModification(kRe,arguments)},greyscale:function(){return this._applyModification(QRe,arguments)},spin:function(){return this._applyModification(VRe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(KRe,arguments)},complement:function(){return this._applyCombination(jRe,arguments)},monochromatic:function(){return this._applyCombination(YRe,arguments)},splitcomplement:function(){return this._applyCombination(WRe,arguments)},triad:function(){return this._applyCombination(JD,[3])},tetrad:function(){return this._applyCombination(JD,[4])}};tt.fromRatio=function(n,e){if(Kw(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Pp(n[r]));n=t}return tt(n,e)};function URe(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=qRe(n)),Kw(n)=="object"&&(ka(n.r)&&ka(n.g)&&ka(n.b)?(e=LRe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):ka(n.h)&&ka(n.s)&&ka(n.v)?(r=Pp(n.s),i=Pp(n.v),e=DRe(n.h,r,i),o=!0,a="hsv"):ka(n.h)&&ka(n.s)&&ka(n.l)&&(r=Pp(n.s),s=Pp(n.l),e=PRe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=Cz(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 LRe(n,e,t){return{r:_n(n,255)*255,g:_n(e,255)*255,b:_n(t,255)*255}}function YD(n,e,t){n=_n(n,255),e=_n(e,255),t=_n(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 XD(n,e,t){n=_n(n,255),e=_n(e,255),t=_n(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 YRe(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=eFe(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 sM=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"},XRe=tt.hexNames=$Re(sM);function $Re(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function Cz(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function _n(n,e){ZRe(n)&&(n="100%");var t=JRe(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 d_(n){return Math.min(1,Math.max(0,n))}function Vi(n){return parseInt(n,16)}function ZRe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function JRe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function wo(n){return n.length==1?"0"+n:""+n}function Pp(n){return n<=1&&(n=n*100+"%"),n}function Mz(n){return Math.round(parseFloat(n)*255).toString(16)}function qD(n){return Vi(n)/255}var co=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 ka(n){return!!co.CSS_UNIT.exec(n)}function qRe(n){n=n.replace(RRe,"").replace(FRe,"").toLowerCase();var e=!1;if(sM[n])n=sM[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=co.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=co.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=co.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=co.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=co.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=co.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=co.hex8.exec(n))?{r:Vi(t[1]),g:Vi(t[2]),b:Vi(t[3]),a:qD(t[4]),format:e?"name":"hex8"}:(t=co.hex6.exec(n))?{r:Vi(t[1]),g:Vi(t[2]),b:Vi(t[3]),format:e?"name":"hex"}:(t=co.hex4.exec(n))?{r:Vi(t[1]+""+t[1]),g:Vi(t[2]+""+t[2]),b:Vi(t[3]+""+t[3]),a:qD(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=co.hex3.exec(n))?{r:Vi(t[1]+""+t[1]),g:Vi(t[2]+""+t[2]),b:Vi(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function eFe(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 eO=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return IRe(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},Dp=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}},XA=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()},JT=function(e){if(!e)return"#fff";var t=Dp(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"},yB=function(e,t){var r=e.replace("°","");return tt(t+" ("+r+")")._ok},Ap=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){lFe(i,r);function i(){var s,o,a,l;aFe(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&wFe?new Yw: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 _v=24,zUe=Oz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?_v:r,s=n.height,o=s===void 0?_v:s,a=n.style,l=a===void 0?{}:a,A=HUe(n,["fill","width","height","style"]);return yO.default.createElement("svg",vO({viewBox:"0 0 "+_v+" "+_v,style:vO({fill:t,width:i,height:o},l)},A),yO.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"}))},GUe=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(gO(i.s)?r.props.hsl.s:i.s),l:Number(gO(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 GUe(e,[{key:"render",value:function(){var r=this,i=ht({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=$.createElement("div",{style:i.fields,className:"flexbox-fix"},$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=$.createElement("div",{style:i.fields,className:"flexbox-fix"},$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),$.createElement("div",{style:i.alpha},$.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=$.createElement("div",{style:i.fields,className:"flexbox-fix"},$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),$.createElement("div",{style:i.alpha},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),$.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,$.createElement("div",{style:i.toggle},$.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},$.createElement(zUe,{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}($.Component);Nz.defaultProps={view:"hex"};var wO=function(){var e=ht({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 $.createElement("div",{style:e.picker})},KUe=function(){var e=ht({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return $.createElement("div",{style:e.picker})},i2=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=ht(Oi({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 $.createElement("div",{style:d.picker,className:"chrome-picker "+h},$.createElement("div",{style:d.saturation},$.createElement(h_,{style:d.Saturation,hsl:o,hsv:a,pointer:KUe,onChange:r})),$.createElement("div",{style:d.body},$.createElement("div",{style:d.controls,className:"flexbox-fix"},$.createElement("div",{style:d.color},$.createElement("div",{style:d.swatch},$.createElement("div",{style:d.active}),$.createElement(hd,{renderers:A}))),$.createElement("div",{style:d.toggles},$.createElement("div",{style:d.hue},$.createElement(dd,{style:d.Hue,hsl:o,pointer:wO,onChange:r})),$.createElement("div",{style:d.alpha},$.createElement(VT,{style:d.Alpha,rgb:s,hsl:o,pointer:wO,renderers:A,onChange:r})))),$.createElement(Nz,{rgb:s,hsl:o,hex:l,view:p,onChange:r,disableAlpha:i})))};i2.propTypes={width:Qe.oneOfType([Qe.string,Qe.number]),disableAlpha:Qe.bool,styles:Qe.object,defaultView:Qe.oneOf(["hex","rgb","hsl"])};i2.defaultProps={width:225,disableAlpha:!1,styles:{}};const YUe=Ni(i2);var XUe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=ht({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:JT(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 $.createElement(fu,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},$.createElement("div",{style:a.dot}))},$Ue=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=ht({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 $.createElement("div",{style:s.fields,className:"flexbox-fix"},$.createElement("div",{style:s.active}),$.createElement(Pt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),$.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),$.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),$.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},s2=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=ht(Oi({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?XA(p.hex)&&t({hex:p.hex,source:"hex"},d):t(p,d)};return $.createElement(Rg,{style:u.Compact,styles:l},$.createElement("div",{style:u.compact,className:"compact-picker "+c},$.createElement("div",null,hu(i,function(h){return $.createElement(XUe,{key:h,color:h,active:h.toLowerCase()===s,onClick:f,onSwatchHover:r})}),$.createElement("div",{style:u.clear})),$.createElement($Ue,{hex:s,rgb:o,onChange:f})))};s2.propTypes={colors:Qe.arrayOf(Qe.string),styles:Qe.object};s2.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:{}};Ni(s2);var ZUe=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=ht({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return $.createElement("div",{style:a.swatch},$.createElement(fu,{color:r,onClick:i,onHover:s,focusStyle:o}))};const JUe=GT(ZUe);var o2=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=ht(Oi({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 $.createElement("div",{style:u.card,className:"github-picker "+c},$.createElement("div",{style:u.triangleShadow}),$.createElement("div",{style:u.triangle}),hu(r,function(h){return $.createElement(JUe,{color:h,key:h,onClick:f,onSwatchHover:s})}))};o2.propTypes={width:Qe.oneOfType([Qe.string,Qe.number]),colors:Qe.arrayOf(Qe.string),triangle:Qe.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Qe.object};o2.defaultProps={width:200,colors:["#B80000","#DB3E00","#FCCB00","#008B02","#006B76","#1273DE","#004DCF","#5300EB","#EB9694","#FAD0C3","#FEF3BD","#C1E1C5","#BEDADC","#C4DEF6","#BED3F3","#D4C4FB"],triangle:"top-left",styles:{}};Ni(o2);var qUe=function(e){var t=e.direction,r=ht({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 $.createElement("div",{style:r.picker})},eLe=Object.assign||function(n){for(var e=1;e.5});return $.createElement("div",{style:r.picker})},iLe=function(){var e=ht({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 $.createElement("div",{style:e.pointer},$.createElement("div",{style:e.left},$.createElement("div",{style:e.leftInside})),$.createElement("div",{style:e.right},$.createElement("div",{style:e.rightInside})))},xO=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=ht({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 $.createElement("div",{style:o.button,onClick:t},r||i)},sLe=function(e){var t=e.rgb,r=e.currentColor,i=ht({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 $.createElement("div",null,$.createElement("div",{style:i.label},"new"),$.createElement("div",{style:i.swatches},$.createElement("div",{style:i.new}),$.createElement("div",{style:i.current})),$.createElement("div",{style:i.label},"current"))},oLe=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 $.createElement("div",{style:a.fields,className:"flexbox-fix"},$.createElement("div",{style:a.double},$.createElement(Pt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),$.createElement("div",{style:a.single},$.createElement(Pt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),$.createElement("div",{style:a.single},$.createElement(Pt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),$.createElement("div",{style:a.single},$.createElement(Pt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),$.createElement("div",{style:a.alpha},$.createElement(Pt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},uLe=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var bv=24,vLe=Qz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?bv:r,s=n.height,o=s===void 0?bv:s,a=n.style,l=a===void 0?{}:a,A=gLe(n,["fill","width","height","style"]);return bO.default.createElement("svg",_O({viewBox:"0 0 "+bv+" "+bv,style:_O({fill:t,width:i,height:o},l)},A),bO.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},yLe=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=ht({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:JT(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 $.createElement(fu,{color:t,style:A.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},$.createElement("div",{style:A.check},$.createElement(vLe,null)))},wLe=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=ht({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return $.createElement("div",{style:o.group},hu(i,function(a,l){return $.createElement(yLe,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},u2=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=ht(Oi({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 $.createElement("div",{style:f.picker,className:"swatches-picker "+u},$.createElement(Rg,null,$.createElement("div",{style:f.overflow},$.createElement("div",{style:f.body},hu(o,function(p){return $.createElement(wLe,{key:p.toString(),group:p,active:a,onClick:h,onSwatchHover:s})}),$.createElement("div",{style:f.clear})))))};u2.propTypes={width:Qe.oneOfType([Qe.string,Qe.number]),height:Qe.oneOfType([Qe.string,Qe.number]),colors:Qe.arrayOf(Qe.arrayOf(Qe.string)),styles:Qe.object};u2.defaultProps={width:320,height:240,colors:[[rf[900],rf[700],rf[500],rf[300],rf[100]],[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]],["#194D33",Op[700],Op[500],Op[300],Op[100]],[hf[900],hf[700],hf[500],hf[300],hf[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]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Ni(u2);var f2=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=ht(Oi({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){XA(d)&&t({hex:d,source:"hex"},g)};return $.createElement("div",{style:f.card,className:"twitter-picker "+u},$.createElement("div",{style:f.triangleShadow}),$.createElement("div",{style:f.triangle}),$.createElement("div",{style:f.body},hu(s,function(p,d){return $.createElement(fu,{key:d,color:p,hex:p,style:f.swatch,onClick:h,onHover:r,focusStyle:{boxShadow:"0 0 4px "+p}})}),$.createElement("div",{style:f.hash},"#"),$.createElement(Pt,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:h}),$.createElement("div",{style:f.clear})))};f2.propTypes={width:Qe.oneOfType([Qe.string,Qe.number]),triangle:Qe.oneOf(["hide","top-left","top-right"]),colors:Qe.arrayOf(Qe.string),styles:Qe.object};f2.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Ni(f2);var h2=function(e){var t=ht({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 $.createElement("div",{style:t.picker})};h2.propTypes={hsl:Qe.shape({h:Qe.number,s:Qe.number,l:Qe.number,a:Qe.number})};h2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var d2=function(e){var t=ht({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 $.createElement("div",{style:t.picker})};d2.propTypes={hsl:Qe.shape({h:Qe.number,s:Qe.number,l:Qe.number,a:Qe.number})};d2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var xLe=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)XA(h.hex)&&t({hex:h.hex,source:"hex"},p);else if(h.rgb){var d=h.rgb.split(",");yB(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(",");yB(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(",");yB(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=ht({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 $.createElement("div",{style:l.wrap,className:"flexbox-fix"},$.createElement("div",{style:l.fields},$.createElement("div",{style:l.double},$.createElement(Pt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),$.createElement("div",{style:l.column},$.createElement("div",{style:l.single},$.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"rgb",value:A,onChange:a})),$.createElement("div",{style:l.single},$.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),$.createElement("div",{style:l.single},$.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsl",value:c,onChange:a})))))},p2=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=ht(Oi({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 $.createElement("div",{style:h.picker,className:"google-picker "+f},$.createElement("div",{style:h.head},l),$.createElement("div",{style:h.swatch}),$.createElement("div",{style:h.saturation},$.createElement(h_,{hsl:s,hsv:o,pointer:h2,onChange:r})),$.createElement("div",{style:h.body},$.createElement("div",{style:h.controls,className:"flexbox-fix"},$.createElement("div",{style:h.hue},$.createElement(dd,{style:h.Hue,hsl:s,radius:"4px",pointer:d2,onChange:r}))),$.createElement(xLe,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};p2.propTypes={width:Qe.oneOfType([Qe.string,Qe.number]),styles:Qe.object,header:Qe.string};p2.defaultProps={width:652,styles:{},header:"Color picker"};Ni(p2);const _Le="_InformationContainerPos_1yd4c_2",bLe="_scrollContainer_1yd4c_15",xB={InformationContainerPos:_Le,scrollContainer:bLe,"options-container":"_options-container_1yd4c_24"},BLe="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=",ELe="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==",CLe="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==",MLe="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",SLe="_InformationContainerPos_1m76y_2",TLe="_scrollContainer_1m76y_15",ILe="_centerAlign_1m76y_25",RLe="_traitInfoTitle_1m76y_28",FLe="_dropdownFlex_1m76y_38",ULe="_checkboxFlex_1m76y_44",LLe="_simpleFlex_1m76y_49",PLe="_traitInfoText_1m76y_55",DLe="_dropdownBase_1m76y_64",OLe="_dropdownControl_1m76y_74",NLe="_dropdownControlSmall_1m76y_80",kLe="_flexSelect_1m76y_106",QLe="_checked_1m76y_163",HLe="_checkmark_1m76y_167",zLe="_checkboxHolder_1m76y_180",GLe="_actionButton_1m76y_189",VLe="_tabHolder_1m76y_209",jLe="_tabButton_1m76y_215",WLe="_tabButtonSelected_1m76y_235",je={InformationContainerPos:SLe,scrollContainer:TLe,centerAlign:ILe,traitInfoTitle:RLe,dropdownFlex:FLe,checkboxFlex:ULe,simpleFlex:LLe,traitInfoText:PLe,dropdownBase:DLe,dropdownControl:OLe,dropdownControlSmall:NLe,"input-box":"_input-box_1m76y_87",flexSelect:kLe,"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:QLe,checkmark:HLe,checkboxHolder:zLe,actionButton:GLe,tabHolder:VLe,tabButton:jLe,tabButtonSelected:WLe},KLe="_slider_1y6nx_1",YLe="_infoContainer_1y6nx_13",Bv={"slider-container":"_slider-container_1y6nx_1",slider:KLe,infoContainer:YLe,"input-box":"_input-box_1y6nx_18"};function Kf({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:Bv.infoContainer,children:[n,o&&N.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:Bv["input-box"],step:o})]}),N.jsx("div",{className:Bv["slider-container"],children:N.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:Bv.slider,step:s})})]})}function XLe({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=ye.useContext(Zn),[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 N.jsx("div",{children:N.jsxs("div",{className:je.InformationContainerPos,children:[N.jsx(va,{title:"Trait Information",width:180,right:20}),N.jsx("div",{className:je.scrollContainer,children:n!=null?N.jsxs(N.Fragment,{children:[N.jsx("div",{className:je.traitInfoTitle,children:"Trait ID"}),N.jsx("div",{className:je.traitInfoText,children:n==null?void 0:n.id}),N.jsx("div",{className:je.traitInfoTitle,children:"Trait Name"}),N.jsx("div",{className:je.traitInfoText,children:n==null?void 0:n.name}),N.jsx("div",{className:je.traitInfoTitle,children:"Description"}),N.jsx("div",{className:je.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),N.jsx("div",{className:je.traitInfoTitle,children:"Culling Options"}),N.jsx("br",{}),N.jsxs("div",{className:je.traitInfoText,children:["Culling Layer",N.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:f,className:je["input-box"],step:1}),N.jsx("br",{}),N.jsx("br",{}),N.jsx(Kf,{title:"Out Distance",value:i,onChange:c,min:0,max:1,step:.001,stepBox:.01}),N.jsx("br",{}),N.jsx(Kf,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),N.jsx("div",{className:je.actionButton,onClick:h,children:N.jsx("div",{children:"Update Culling "})})]})]}):N.jsx(N.Fragment,{children:N.jsx("div",{className:je.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(b8);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 T=i();if(T&&T.has(C))return T.get(C);var b={},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var D in C)if(Object.prototype.hasOwnProperty.call(C,D)){var Y=M?Object.getOwnPropertyDescriptor(C,D):null;Y&&(Y.get||Y.set)?Object.defineProperty(b,D,Y):b[D]=C[D]}return b.default=C,T&&T.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 T=1;T"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(T,[{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 Y;if(typeof M=="string")for(var H=0,I=D.length;H"u"&&(Y=M.label||M);var H=M.label||M.value||M,I=Y===this.state.selected.value||Y===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),B=(0,t.default)(v),F=Object.keys(M.data||{}).reduce(function(P,O){return A({},P,c({},"data-".concat(O),M.data[O]))},{});return e.default.createElement("div",a({key:Y,className:B,onMouseDown:this.setValue.bind(this,Y,H),onClick:this.setValue.bind(this,Y,H),role:"option","aria-selected":I?"true":"false"},F),H)}},{key:"buildMenu",value:function(){var M=this,D=this.props,Y=D.options,H=D.baseClassName,I=Y.map(function(v){if(v.type==="group"){var B=e.default.createElement("div",{className:"".concat(H,"-title")},v.name),F=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"},B,F)}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,Y,H,I,v=this.props,B=v.baseClassName,F=v.controlClassName,P=v.placeholderClassName,O=v.menuClassName,z=v.arrowClassName,K=v.arrowClosed,Q=v.arrowOpen,E=v.className,G=this.props.disabled?"Dropdown-disabled":"",ee=typeof this.state.selected=="string"?this.state.selected:this.state.selected.label,U=(0,t.default)((M={},c(M,"".concat(B,"-root"),!0),c(M,E,!!E),c(M,"is-open",this.state.isOpen),M)),X=(0,t.default)((D={},c(D,"".concat(B,"-control"),!0),c(D,F,!!F),c(D,G,!!G),D)),ae=(0,t.default)((Y={},c(Y,"".concat(B,"-placeholder"),!0),c(Y,P,!!P),c(Y,"is-selected",this.isValueSelected()),Y)),oe=(0,t.default)((H={},c(H,"".concat(B,"-menu"),!0),c(H,O,!!O),H)),de=(0,t.default)((I={},c(I,"".concat(B,"-arrow"),!0),c(I,z,!!z),I)),se=e.default.createElement("div",{className:ae},ee),pe=this.state.isOpen?e.default.createElement("div",{className:oe,"aria-expanded":"true"},this.buildMenu()):null;return e.default.createElement("div",{ref:this.dropdownRef,className:U},e.default.createElement("div",{className:X,onMouseDown:this.handleMouseDown.bind(this),onTouchEnd:this.handleMouseDown.bind(this),"aria-haspopup":"listbox"},se,e.default.createElement("div",{className:"".concat(B,"-arrow-wrapper")},Q&&K?this.state.isOpen?Q:K:e.default.createElement("span",{className:de}))),pe)}}]),T}(e.Component);x.defaultProps={baseClassName:"Dropdown"};var _=x;n.default=_})(Hz);const Jl=bl(Hz);function $Le({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=$.useContext(Zn),[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]),N.jsx("div",{children:N.jsxs("div",{className:je.InformationContainerPos,children:[N.jsx(va,{title:"Lora Creation",width:180,right:20}),N.jsxs("div",{className:je.scrollContainer,children:[N.jsx("div",{className:je.traitInfoTitle,children:"Lora Manifests"}),N.jsx(Jl,{className:je.dropdownControl,options:s,onChange:A,placeholder:"Select an option"}),";",N.jsx("div",{className:je.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&N.jsx("div",{className:je.actionButton,onClick:c,children:N.jsx("div",{children:" Create Lora Data "})})]})]})})}function ZLe({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=$.useContext(Zn),[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]),N.jsx("div",{children:N.jsxs("div",{className:je.InformationContainerPos,children:[N.jsx(va,{title:"Sprite Creation",width:180,right:20}),N.jsxs("div",{className:je.scrollContainer,children:[N.jsx("div",{className:je.traitInfoTitle,children:"Sprite Manifests"}),N.jsx(Jl,{className:je.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",N.jsx("div",{className:je.traitInfoText,children:a||""}),A!=null&&N.jsx("div",{className:je.actionButton,onClick:f,children:N.jsx("div",{children:" Create Sprite Data "})})]})]})})}const BO=4096;function JLe({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=$.useContext(Zn),[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,T]=ye.useState(.1),[b,M]=ye.useState("center"),[D,Y]=ye.useState("center"),[H,I]=ye.useState("center"),[v,B]=ye.useState("head"),[F,P]=ye.useState("chest"),[O,z]=ye.useState(!0),[K,Q]=ye.useState(!1),E=[{label:"center"},{label:"left"},{label:"right"}],G=[{label:"center"},{label:"top"},{label:"bottom"}],ee=[{label:"center"},{label:"front"},{label:"back"}],U=[{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))},ae=(Ae,q,J,ce)=>isNaN(Ae)?ce:Ae>J?J:Ae{const q=parseInt(Ae.target.value);m(ae(q,1,BO,512))},de=Ae=>{const q=parseInt(Ae.target.value);w(ae(q,1,BO,512))},se=Ae=>{const q=parseFloat(Ae.target.value);_(ae(q,0,1,.1))},pe=Ae=>{const q=parseFloat(Ae.target.value);T(ae(q,0,1,.1))},_e=Ae=>{d(Ae)},xe=async()=>{const Ae=i.parent;Ae.remove(i),await r.createThumbnails(t.thumbnails[0]),Ae.add(i)},L=(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:O,bottomBoneName:F==="upperLeg"||F==="lowerLeg"||v==="foot"?"left"+F[0].toUpperCase()+F.slice(1):F,bottomBoneMaxVertex:K,saveOnlyIDs:Ae?null:n.id}]}),ue=async(Ae=!1)=>{s.storeCurrentAvatar();const q=i.parent;q.remove(i),Ae?await r.createThumbnailsWithObjectData(L(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(L(!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]),N.jsx("div",{children:N.jsxs("div",{className:je.InformationContainerPos,children:[N.jsx(va,{title:"Thumbnail Creation",width:180,right:20}),N.jsxs("div",{className:je.scrollContainer,children:[N.jsxs("div",{className:je.tabHolder,children:[N.jsx("div",{className:je.tabButton+(p?"":" "+je.tabButtonSelected),onClick:()=>{_e(!1)},children:N.jsxs("div",{children:[" ","Custom"," "]})}),N.jsx("div",{className:je.tabButton+(p?" "+je.tabButtonSelected:""),onClick:()=>{_e(!0)},children:N.jsxs("div",{children:[" ","Manifest"," "]})})]}),N.jsx("br",{}),p?N.jsxs(N.Fragment,{children:[N.jsx("div",{className:je.traitInfoTitle+" "+je.centerAlign,children:"Thumbnail Manifests"}),N.jsx(Jl,{className:je.dropdownControl,options:o,value:c,onChange:X,placeholder:"Select an option"}),";",N.jsx("div",{className:je.traitInfoText,children:l||""}),f!=""&&N.jsx("div",{className:je.actionButton,onClick:xe,children:N.jsx("div",{children:" Create Thumbnails "})})]}):N.jsxs(N.Fragment,{children:[N.jsxs("div",{className:je.traitInfoText,children:[N.jsx("div",{className:je.traitInfoTitle+" "+je.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",N.jsx("input",{value:g,className:je["input-box"],step:1,onChange:Ae=>{m(Ae.target.value)},onBlur:oe}),N.jsx("br",{}),"Height ",N.jsx("input",{value:y,className:je["input-box"],step:1,onChange:Ae=>{w(Ae.target.value)},onBlur:de}),N.jsx("br",{}),"Top Spacing ",N.jsx("input",{value:x,className:je["input-box"],step:.1,onChange:Ae=>{_(Ae.target.value)},onBlur:se}),N.jsx("br",{}),"Bottom Spacing ",N.jsx("input",{value:C,className:je["input-box"],step:.1,onChange:Ae=>{T(Ae.target.value)},onBlur:pe}),N.jsx("br",{}),N.jsx("div",{className:je.traitInfoTitle+" "+je.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),N.jsxs("div",{className:je.dropdownFlex,children:[N.jsx("div",{className:je.traitInfoTitle,style:{margin:"0px"},children:"X"}),N.jsx(Jl,{className:je.dropdownControlSmall,options:E,onChange:Ae=>{Y(Ae.label)},value:D})]}),N.jsxs("div",{className:je.dropdownFlex,children:[N.jsx("div",{className:je.traitInfoTitle,style:{margin:"0px"},children:"Y"}),N.jsx(Jl,{className:je.dropdownControlSmall,options:G,onChange:Ae=>{I(Ae.label)},value:H})]}),N.jsxs("div",{className:je.dropdownFlex,children:[N.jsx("div",{className:je.traitInfoTitle,style:{margin:"0px"},children:"Z"}),N.jsx(Jl,{className:je.dropdownControlSmall,options:ee,onChange:Ae=>{M(Ae.label)},value:b})]}),N.jsx("div",{className:je.traitInfoTitle+" "+je.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),N.jsxs("div",{className:je.dropdownFlex,style:{justifyContent:"space-between"},children:[N.jsx("div",{className:je.traitInfoTitle,style:{margin:"0px"},children:"Top"}),N.jsx(Jl,{className:je.dropdownControlSmall,options:U,onChange:Ae=>{B(Ae.label)},value:v})]}),N.jsxs("div",{className:je.dropdownFlex,style:{justifyContent:"space-between"},children:[N.jsx("div",{className:je.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),N.jsx(Jl,{className:je.dropdownControlSmall,options:U,onChange:Ae=>{P(Ae.label)},value:F})]}),N.jsxs("div",{style:{textAlign:"left"},children:[N.jsxs("div",{className:je.checkboxFlex,style:{marginTop:"20px"},children:[N.jsx("input",{type:"checkbox",checked:O,onChange:Ae=>{z(Ae.target.checked)}}),N.jsx("div",{className:je.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${O?"uses Top":"uses Low"} Vertex`})]}),N.jsxs("div",{className:je.checkboxFlex,style:{marginTop:"10px"},children:[N.jsx("input",{type:"checkbox",checked:K,onChange:Ae=>{Q(Ae.target.checked)}}),N.jsx("div",{className:je.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${K?"uses Top":"uses Low"} Vertex`})]})]}),e==""?N.jsx("div",{className:je.traitInfoText+" "+je.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):N.jsxs(N.Fragment,{children:[N.jsx("div",{className:je.traitInfoTitle+" "+je.centerAlign,style:{marginTop:"20px"},children:"Generate"}),N.jsx("div",{className:je.traitInfoText+" "+je.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),N.jsxs("div",{className:je.simpleFlex,style:{marginTop:"0px"},children:[N.jsx("div",{className:je.actionButton,style:{margin:"0px"},onClick:()=>{ue(!1)},children:N.jsx("div",{children:" Current "})}),N.jsx("div",{className:je.actionButton,style:{margin:"0px"},onClick:()=>{ue(!0)},children:N.jsx("div",{children:" All "})})]})]})]})]})]})})}function qLe({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=$.useState(""),s=o=>{o!=r?i(o):i("")};return N.jsxs("div",{children:[r=="Information"&&N.jsx(XLe,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&N.jsx($Le,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&N.jsx(ZLe,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&N.jsx(JLe,{selectedTrait:n,traitGroupName:t}),N.jsxs("div",{className:xB.InformationContainerPos,children:[N.jsx(va,{title:"Tools",width:90,right:0}),N.jsx("div",{className:xB.scrollContainer,children:N.jsxs("div",{className:xB.optionsContainer,children:[N.jsx("div",{onClick:()=>{s("Information")},children:N.jsx(il,{size:56,icon:BLe,rarity:r=="Information"?"mythic":"none"})},"Information"),N.jsx("div",{onClick:()=>{s("LoraCreation")},children:N.jsx(il,{size:56,icon:CLe,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),N.jsx("div",{onClick:()=>{s("SpriteCreation")},children:N.jsx(il,{size:56,icon:ELe,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),N.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:N.jsx(il,{size:56,icon:MLe,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation")]})})]})]})}const Qa={TRAIT:0,BLEND_SHAPE:1};function ePe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=$.useContext(Di),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,loraDataGenerator:a,spriteAtlasGenerator:l,thumbnailsGenerator:A,sceneElements:c}=$.useContext(Zn),[u,f]=$.useState(Qa.TRAIT),{playSound:h}=$.useContext(Ys),{isMute:p}=$.useContext(Ks),{t:d}=ye.useContext(So),g=()=>{!p&&h("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(mt.CREATE),r(!1)},[m,y]=$.useState(null),[w,x]=$.useState(null),[_,C]=$.useState(""),[T,b]=$.useState(null),[M,D]=$.useState({}),[Y,H]=$.useState(null),[I,v]=$.useState(""),[B,F]=$.useState(!1),[P,O]=$.useState({background:"#ffffff"}),z=()=>{!p&&h("backNextButton"),e(mt.SAVE),r(!1)},K=()=>{t(!0),y(null),i.loadRandomTraits().then(()=>{console.log("success"),_!=""&&b(i.getCurrentTraitData(_)),t(!1)}).catch(xe=>{t(!1),console.error("Error loading random traits:",xe.message)})},Q=xe=>{O({background:xe.hex})},E=xe=>{O({background:xe.hex}),i.setTraitColor(_,xe.hex)},G=async xe=>{const L=cl(xe.name),ue=URL.createObjectURL(xe);await s.loadAnimation(ue,!1,0,!0,"",L),v(s.getCurrentAnimationName())},ee=xe=>{if(F(!1),_!=""){t(!0);const L=URL.createObjectURL(xe);i.loadCustomTexture(_,L).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},U=xe=>{if(F(!1),_!=""){t(!0);const L=URL.createObjectURL(xe);i.loadCustomTrait(_,L).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},X=xe=>{var L;if(xe.id===(T==null?void 0:T.id)){((L=xe.blendshapeTraits)==null?void 0:L.length)>0&&f(Qa.BLEND_SHAPE);return}F(!1),t(!0),i.loadTrait(xe.traitGroup.trait,xe.id).then(()=>{var ue;if(t(!1),((ue=xe.blendshapeTraits)==null?void 0:ue.length)>0){const Ae=i.getCurrentBlendShapeTraitData(xe.traitGroup.trait);D(Object.entries(Ae).reduce((q,[J,ce])=>(q[J]=ce.id,q),{})),f(Qa.BLEND_SHAPE)}b(xe)})},ae=xe=>{F(!1),i.removeTrait(xe),b(null)},oe=xe=>{F(!1),t(!0),i.loadRandomTrait(xe).then(()=>{t(!1),b(i.getCurrentTraitData(xe))})},de=xe=>{F(!1);const L=Array.from(xe),ue=[],Ae=q=>new Promise((J,ce)=>{var be;if(q&&q.name.toLowerCase().endsWith(".json")){const Be=new FileReader,k=`${(be=i.manifestData)==null?void 0:be.getAssetsDirectory()}/anata/_thumbnails/t_${q.name.split("_")[0]}.jpg`;console.log(k),Be.onload=function(W){try{const re=JSON.parse(W.target.result);re.thumb=k,ue.push(re),J()}catch(re){console.error("Error parsing the JSON file:",re),ce(re)}},Be.readAsText(q)}});Promise.all(L.map(Ae)).then(()=>{ue.length>0&&(y(ue),t(!0),i.loadTraitsFromNFTObject(ue[0]).then(()=>{t(!1)}))}).catch(q=>{console.error("Error processing files:",q)})},se=async xe=>{const L=xe[0];L&&L.name.toLowerCase().endsWith(".fbx")&&G(L),L&&(L.name.toLowerCase().endsWith(".png")||L.name.toLowerCase().endsWith(".jpg"))&&ee(L),L&&L.name.toLowerCase().endsWith(".vrm")&&U(L),L&&L.name.toLowerCase().endsWith(".json")&&de(xe)},pe=xe=>{if(!p&&h("optionClick"),F(!1),_!==xe.trait){f(Qa.TRAIT),x(i.getTraits(xe.trait)),C(xe.trait);const L=i.getCurrentTraitData(xe.trait),ue=i.getCurrentBlendShapeTraitData(xe.trait);b(L),D(Object.entries(ue).reduce((Ae,[q,J])=>(Ae[q]=J.id,Ae),{})),H(i.getCurrentTraitVRM(xe.trait)),o({targetY:xe.cameraTarget.height,distance:xe.cameraTarget.distance})}else x(null),C(""),b(null),D({}),o({targetY:.8,distance:3.2})},_e=()=>{F(!1);var xe=document.createElement("input");xe.type="file",xe.accept=".vrm",xe.onchange=L=>{var ue=L.target.files[0];if(ue.name.endsWith(".vrm")){const Ae=URL.createObjectURL(ue);t(!0),i.loadCustomTrait(_,Ae).then(()=>{t(!1)})}},xe.click()};return N.jsxs("div",{className:nn.container,children:[N.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:N.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),N.jsx("div",{className:"sectionTitle",children:d("pageTitles.chooseAppearance")}),N.jsx(_g,{onFilesDrop:se}),N.jsxs("div",{className:nn.sideMenu,children:[N.jsx(va,{title:"Appearance",left:20}),N.jsx("div",{className:nn.bottomLine}),N.jsx("div",{className:nn.scrollContainer,children:N.jsx("div",{className:nn["editor-container"],children:i.getGroupTraits().map((xe,L)=>N.jsxs("div",{className:nn.editorButton,onClick:()=>{pe(xe)},children:[N.jsx(il,{size:56,icon:xe.fullIconSvg,rarity:_!==xe.trait?"none":"mythic"}),N.jsx("div",{className:nn.editorText,children:xe.name})]},"options_"+L))})})]}),!!w&&N.jsxs("div",{className:nn.selectorContainerPos,children:[N.jsx(va,{title:_,width:130,left:20}),T&&u==Qa.TRAIT&&N.jsx("div",{className:nn.selectorColorPickerButton,onClick:()=>{F(!B)},children:N.jsx("img",{className:nn.selectorColorPickerImg,src:Rge})}),u==Qa.TRAIT&&!!B&&N.jsx("div",{draggable:!1,className:nn.selectorColorPickerUI,children:N.jsx(YUe,{draggable:!1,width:"200px",color:P.background,onChange:Q,onChangeComplete:E})}),N.jsx("div",{className:nn.bottomLine}),N.jsxs("div",{className:nn.scrollContainerOptions,children:[u==Qa.TRAIT&&N.jsxs("div",{className:nn["selector-container"],children:[N.jsx("div",{className:`${nn.selectorButton}`,onClick:()=>{oe(_)},children:N.jsx(il,{size:56,icon:Ige,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(_)?N.jsx(N.Fragment,{}):N.jsx("div",{className:`${nn.selectorButton}`,icon:ZC,onClick:()=>{ae(_)},children:N.jsx(il,{size:56,icon:ZC,rarity:T==null?"mythic":"none"})},"no-trait"),w.map(xe=>{let L=xe.id===(T==null?void 0:T.id);return N.jsx("div",{className:`${nn.selectorButton}`,onClick:()=>{X(xe)},children:N.jsx(il,{size:56,icon:xe.fullThumbnail,rarity:L?"mythic":"none"})},xe.id)})]}),u==Qa.BLEND_SHAPE&&N.jsx(tPe,{selectedTrait:T,onBack:()=>{f(Qa.TRAIT)},selectedBlendShapeTrait:M,setSelectedBlendshapeTrait:D})]}),N.jsx("div",{className:nn.uploadContainer,children:N.jsx("div",{className:nn.uploadButton,onClick:_e,children:N.jsx("div",{children:"Upload "})})})]}),N.jsx(BT,{jsonSelectionArray:m}),N.jsx(qLe,{selectedTrait:T,selectedVRM:Y,traitGroupName:_}),N.jsx(qx,{loadedAnimationName:I,randomize:K}),N.jsxs("div",{className:nn.buttonContainer,children:[N.jsx(gn,{theme:"light",text:d("callToAction.back"),size:14,className:nn.buttonLeft,onClick:g}),i.canDownload()&&N.jsx(gn,{theme:"light",text:d("callToAction.next"),size:14,className:nn.buttonRight,onClick:z})]})]})}const tPe=({selectedTrait:n,onBack:e,selectedBlendShapeTrait:t,setSelectedBlendshapeTrait:r})=>{const{characterManager:i,moveCamera:s}=$.useContext(Zn),o=i.getBlendShapeGroupTraits((n==null?void 0:n.traitGroup.trait)||"",(n==null?void 0:n.id)||""),a=l=>{if(l.id==null){const u=l.parentGroup;i.loadBlendShapeTrait((n==null?void 0:n.traitGroup.trait)||"",u.trait||"",null);return}const A=l.parentGroup;i.loadBlendShapeTrait((n==null?void 0:n.traitGroup.trait)||"",A.trait||"",(l==null?void 0:l.id)||""),s({targetY:A.cameraTarget.height,distance:A.cameraTarget.distance});const c={...t};c[A.trait||""]=l.id,r(c)};return N.jsxs("div",{className:nn["selector-container-column"],children:[N.jsx(gn,{theme:"dark",text:"Back",size:14,className:nn.buttonLeft,onClick:e}),o&&o.length>0&&o.map(l=>N.jsxs("div",{className:nn.blendshapeGroup,children:[N.jsx("div",{children:l.name}),N.jsxs("div",{className:nn["selector-container"],children:[N.jsx(EO,{src:ZC,active:!t[l.trait],blendshapeID:"cancel",select:()=>a(new l8(l,{id:null}))},"empty"),l.collection.map(A=>{let c=A.id===t[l.trait];return N.jsx(EO,{src:A.fullThumbnail||"",active:c,blendshapeID:A.id,select:()=>a(A)},A.id)})]})]},l.trait))]})},EO=({active:n,blendshapeID:e,src:t,select:r})=>N.jsx("div",{className:`${nn.selectorButton}`,onClick:r,children:N.jsx(il,{size:56,icon:t||"",rarity:n?"mythic":"none"})},e),nPe="_InformationContainerPos_rgqwy_1",rPe="_traitInfoTitle_rgqwy_13",iPe="_traitInfoText_rgqwy_21",sPe="_flexSelect_rgqwy_30",oPe="_scrollContainer_rgqwy_65",aPe="_checked_rgqwy_90",lPe="_checkmark_rgqwy_94",APe="_checkboxHolder_rgqwy_107",cPe="_buttonContainer_rgqwy_114",uPe="_buttonLeft_rgqwy_123",fPe="_buttonRight_rgqwy_127",hPe="_buttonCenter_rgqwy_131",fi={InformationContainerPos:nPe,traitInfoTitle:rPe,traitInfoText:iPe,flexSelect:sPe,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:oPe,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:aPe,checkmark:lPe,checkboxHolder:APe,buttonContainer:cPe,buttonLeft:uPe,buttonRight:fPe,buttonCenter:hPe},dPe="_InformationContainerPos_11mqa_2",pPe="_scrollContainer_11mqa_16",mPe="_traitInfoTitle_11mqa_28",gPe="_traitInfoText_11mqa_38",vPe="_flexSelect_11mqa_66",yPe="_checked_11mqa_124",wPe="_checkmark_11mqa_128",xPe="_checkboxHolder_11mqa_141",Vn={InformationContainerPos:dPe,scrollContainer:pPe,traitInfoTitle:mPe,traitInfoText:gPe,"input-box":"_input-box_11mqa_47",flexSelect:vPe,"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:yPe,checkmark:wPe,checkboxHolder:xPe};function m2({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=$.useContext(Zn),[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),[T,b]=ye.useState(0),[M,D]=ye.useState(0);return ye.useEffect(()=>{if(n!=null){const Y=Qh(n,"Mesh"),H=Qh(n,"SkinnedMesh");l(Y.length),c(H.length);const I=Y.concat(H),{stdMats:v,stdCutoutpMats:B,stdTranspMats:F,mToonMats:P,mToonCutoutMats:O,mToonTranspMats:z}=gfe(I);f(v.length),p(F.length),g(B.length),y(P.length),x(z.length),C(O.length);const{triangles:K,bones:Q}=o.getBoneTriangleCount();b(K),D(Q)}},[n]),n!=null?N.jsx("div",{children:N.jsxs("div",{className:Vn.InformationContainerPos,children:[N.jsx(va,{title:"Model Information",width:180,right:20}),N.jsxs("div",{className:Vn.scrollContainer,children:[N.jsxs("div",{className:Vn.flexSelect,children:[(t==null?void 0:t.length)>1?N.jsx("div",{className:`${Vn["arrow-button"]} ${Vn["left-button"]}`,onClick:s}):N.jsx(N.Fragment,{}),e&&N.jsx("div",{style:{textAlign:"center"},children:N.jsx("div",{className:Vn.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?N.jsx("div",{className:`${Vn["arrow-button"]} ${Vn["right-button"]}`,onClick:i}):N.jsx(N.Fragment,{})]}),N.jsx("div",{className:Vn.traitInfoTitle,children:"Geometry info:"}),N.jsxs("div",{className:Vn.traitInfoText,children:["Meshes: ",a]}),N.jsxs("div",{className:Vn.traitInfoText,children:["SkinnedMeshes: ",A]}),N.jsxs("div",{className:Vn.traitInfoText,children:["Triangles: ",T]}),N.jsxs("div",{className:Vn.traitInfoText,children:["Bones: ",M]}),N.jsx("div",{className:Vn.traitInfoTitle,children:"Standard Material Count:"}),N.jsxs("div",{className:Vn.traitInfoText,children:["opaque: ",u]}),N.jsxs("div",{className:Vn.traitInfoText,children:["cutout: ",d]}),N.jsxs("div",{className:Vn.traitInfoText,children:["transparent: ",h]}),N.jsx("div",{className:Vn.traitInfoTitle,children:"MToon Material Count:"}),N.jsxs("div",{className:Vn.traitInfoText,children:["opaque: ",m]}),N.jsxs("div",{className:Vn.traitInfoText,children:["cutout: ",_]}),N.jsxs("div",{className:Vn.traitInfoText,children:["transparent: ",w]})]})]})}):N.jsx(N.Fragment,{})}const _Pe="_InformationContainerPos_b0msk_1",bPe="_traitInfoTitle_b0msk_13",BPe="_traitInfoText_b0msk_22",EPe="_flexSelect_b0msk_33",CPe="_scrollContainer_b0msk_68",MPe="_checked_b0msk_93",SPe="_checkmark_b0msk_97",TPe="_checkboxHolder_b0msk_110",At={InformationContainerPos:_Pe,traitInfoTitle:bPe,traitInfoText:BPe,flexSelect:EPe,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:CPe,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:MPe,checkmark:SPe,checkboxHolder:TPe};function m_({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,T]=ye.useState(Oe.merge_options_ktx_compression||!1),[b,M]=ye.useState(Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas),[D,Y]=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=U=>{_(U.target.checked),Oe.mergeOptions_drop_download=U.target.checked},B=U=>{p(U.target.checked),Oe.mergeOptions_two_sided_mat=U.target.checked},F=U=>{T(U.target.checked),Oe.merge_options_ktx_compression=U.target.checked},P=U=>{M(U.target.checked),Oe.mergeOptions_create_atlas=U.target.checked},O=U=>{m(U.target.checked),Oe.mergeOptions_download_vrm=U.target.checked},z=U=>{w(U.target.checked),Oe.mergeOptions_download_vrm_preview=U.target.checked},K=U=>{Y(U.target.checked),Oe.mergeOptions_download_lora=U.target.checked},Q=U=>{I(U.target.checked),Oe.mergeOptions_download_sprites=U.target.checked},E=()=>{let U=u;u<=0?U=d.length-1:U-=1,f(U),Oe.mergeOptions_sel_option=U},G=()=>{let U=u;u>=d.length-1?U=0:U+=1,f(U),Oe.mergeOptions_sel_option=U},ee=async(U,X)=>{let ae=parseInt(U.target.value);ae>8?ae=8:ae<0&&(ae=0),(de=>{switch(X){case"standard opaque":i(de),Oe.mergeOptions_atlas_std_size=de;break;case"standard transparent":o(de),Oe.mergeOptions_atlas_std_transp_size=de;break;case"mtoon opaque":l(de),Oe.mergeOptions_atlas_mtoon_size=de;break;case"mtoon transparent":c(de),Oe.mergeOptions_atlas_mtoon_transp_size=de;break}})(ae)};return N.jsxs("div",{className:At.InformationContainerPos,children:[N.jsx(va,{title:t,width:180,left:20}),N.jsxs("div",{className:At.scrollContainer,children:[N.jsx("div",{className:At.traitInfoTitle,children:"Download Options"}),N.jsx(N.Fragment,{children:N.jsx("div",{className:At.traitInfoText,children:N.jsxs("div",{className:At.checkboxHolder,children:[N.jsx("div",{}),N.jsxs("label",{className:At["custom-checkbox"],children:[N.jsx("input",{type:"checkbox",checked:g,onChange:O}),N.jsx("div",{className:At["checkbox-container"]})]}),N.jsx("div",{}),N.jsx("div",{}),"Download VRM"]})})}),N.jsx(N.Fragment,{children:N.jsx("div",{className:At.traitInfoText,children:N.jsxs("div",{className:At.checkboxHolder,children:[N.jsx("div",{}),N.jsxs("label",{className:At["custom-checkbox"],children:[N.jsx("input",{type:"checkbox",checked:y,onChange:z}),N.jsx("div",{className:At["checkbox-container"]})]}),N.jsx("div",{}),N.jsx("div",{}),"Download VRM Preview"]})})}),N.jsx(N.Fragment,{children:N.jsx("div",{className:At.traitInfoText,children:N.jsxs("div",{className:At.checkboxHolder,children:[N.jsx("div",{}),N.jsxs("label",{className:At["custom-checkbox"],children:[N.jsx("input",{type:"checkbox",checked:D,onChange:K}),N.jsx("div",{className:At["checkbox-container"]})]}),N.jsx("div",{}),N.jsx("div",{}),"Download Lora Data"]})})}),N.jsx(N.Fragment,{children:N.jsx("div",{className:At.traitInfoText,children:N.jsxs("div",{className:At.checkboxHolder,children:[N.jsx("div",{}),N.jsxs("label",{className:At["custom-checkbox"],children:[N.jsx("input",{type:"checkbox",checked:H,onChange:Q}),N.jsx("div",{className:At["checkbox-container"]})]}),N.jsx("div",{}),N.jsx("div",{}),"Download Sprites Data"]})})}),g&&N.jsxs(N.Fragment,{children:[e&&N.jsx(N.Fragment,{children:N.jsx("div",{className:At.traitInfoText,children:N.jsxs("div",{className:At.checkboxHolder,children:[N.jsx("div",{}),N.jsxs("label",{className:At["custom-checkbox"],children:[N.jsx("input",{type:"checkbox",checked:b,onChange:P}),N.jsx("div",{className:At["checkbox-container"]})]}),N.jsx("div",{}),N.jsx("div",{}),"Create Atlas"]})})}),(e==!1||b)&&N.jsxs(N.Fragment,{children:[N.jsx("br",{}),N.jsx("div",{className:At.traitInfoTitle,children:"Merge Atlas Type"}),N.jsx("br",{}),N.jsxs("div",{className:At.flexSelect,children:[N.jsx("div",{className:`${At["arrow-button"]} ${At["left-button"]}`,onClick:E}),N.jsx("div",{className:At.traitInfoText,style:{marginBottom:"0"},children:d[u]}),N.jsx("div",{className:`${At["arrow-button"]} ${At["right-button"]}`,onClick:G})]}),N.jsx("br",{}),N.jsx("br",{}),(u===0||u==2)&&N.jsxs(N.Fragment,{children:[N.jsx("div",{className:At.traitInfoTitle,children:"Standard Atlas Size"}),N.jsx("br",{}),N.jsxs("div",{className:At.traitInfoText,children:["Opaque: ",bn(r)+" x "+bn(r)]}),N.jsx(Kf,{value:r,onChange:U=>ee(U,"standard opaque"),min:1,max:8,step:1}),N.jsx("br",{}),N.jsxs("div",{className:At.traitInfoText,children:["Transparent: ",bn(s)+" x "+bn(s)]}),N.jsx(Kf,{value:s,onChange:U=>ee(U,"standard transparent"),min:1,max:8,step:1}),N.jsx("br",{})," ",N.jsx("br",{})]}),(u===1||u==2)&&N.jsxs(N.Fragment,{children:[N.jsx("div",{className:At.traitInfoTitle,children:"MToon Atlas Size"}),N.jsx("br",{}),N.jsxs("div",{className:At.traitInfoText,children:["Opaque: ",bn(a)+" x "+bn(a)]}),N.jsx(Kf,{value:a,onChange:U=>ee(U,"mtoon opaque"),min:1,max:8,step:1}),N.jsx("br",{}),N.jsxs("div",{className:At.traitInfoText,children:["Transparent: ",bn(A)+" x "+bn(A)]}),N.jsx(Kf,{value:A,onChange:U=>ee(U,"mtoon transparent"),min:1,max:8,step:1}),N.jsx("br",{})," ",N.jsx("br",{})]}),N.jsx("div",{className:At.traitInfoTitle,children:"Options"}),N.jsx("div",{className:At.traitInfoText,children:N.jsxs("div",{className:At.checkboxHolder,children:[N.jsx("div",{}),N.jsxs("label",{className:At["custom-checkbox"],children:[N.jsx("input",{type:"checkbox",checked:h,onChange:B}),N.jsx("div",{className:At["checkbox-container"]})]}),N.jsx("div",{}),N.jsx("div",{}),"Two Sided Material"]})}),n&&N.jsx(N.Fragment,{children:N.jsx("div",{className:At.traitInfoText,children:N.jsxs("div",{className:At.checkboxHolder,children:[N.jsx("div",{}),N.jsxs("label",{className:At["custom-checkbox"],children:[N.jsx("input",{type:"checkbox",checked:x,onChange:v}),N.jsx("div",{className:At["checkbox-container"]})]}),N.jsx("div",{}),N.jsx("div",{}),"Drag Drop - Download"]})})}),N.jsx(N.Fragment,{children:N.jsx("div",{className:At.traitInfoText,children:N.jsxs("div",{className:At.checkboxHolder,children:[N.jsx("div",{}),N.jsxs("label",{className:At["custom-checkbox"],children:[N.jsx("input",{type:"checkbox",checked:C,onChange:F}),N.jsx("div",{className:At["checkbox-container"]})]}),N.jsx("div",{}),N.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}function IPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=$.useContext(Di),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=$.useContext(Zn),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=$.useState(""),{playSound:g}=$.useContext(Ys),{isMute:m}=$.useContext(Ks),[y,w]=$.useState(null),x=()=>{!m&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(mt.LANDING)},_=()=>{const I=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:bn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:bn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:bn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:bn(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 sd,O=A.parent;O.remove(A);const z=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(z===!0){const Q=r.loras.map(async E=>a.createLoraData(E,P));await Promise.all(Q)}const K=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(K===!0){const Q=r.sprites.map(async E=>l.createSpriteAtlas(E,P));await Promise.all(Q)}(z===!0||K===!0)&&P.saveZip(y[I].name),O.add(A),I{t(!0),C(0,!0)},{t:b}=ye.useContext(So),M=async I=>{if(s.getCurrentCharacterModel()){const B=cl(I.name),F=URL.createObjectURL(I);await o.loadAnimation(F,!1,0,!0,"",B),d(o.getCurrentAnimationName()),URL.revokeObjectURL(F)}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 B=cl(I.name);h(B),u(s.getCurrentCharacterModel())},Y=I=>{const v=Array.from(I),B=[],F=P=>new Promise((O,z)=>{var K;if(P&&P.name.toLowerCase().endsWith(".json")){const Q=new FileReader,E=`${(K=s.manifestData)==null?void 0:K.getAssetsDirectory()}/anata/_thumbnails/t_${P.name.split("_")[0]}.jpg`;Q.onload=function(G){try{const ee=JSON.parse(G.target.result);ee.thumb=E,B.push(ee),O()}catch(ee){console.error("Error parsing the JSON file:",ee),z(ee)}},Q.readAsText(P)}});Promise.all(v.map(F)).then(()=>{B.length>0&&(w(B),t(!0),s.loadTraitsFromNFTObject(B[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")&&Y(I)};return N.jsxs("div",{className:fi.container,children:[N.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:N.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),N.jsx("div",{className:"sectionTitle",children:"Batch Download"}),N.jsx(_g,{onFilesDrop:H}),N.jsx(m_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),N.jsx(m2,{model:c}),N.jsx(BT,{jsonSelectionArray:y}),N.jsx(qx,{loadedAnimationName:p}),N.jsxs("div",{className:fi.buttonContainer,children:[N.jsx(gn,{theme:"light",text:b("callToAction.back"),size:14,className:fi.buttonLeft,onClick:x}),(y==null?void 0:y.length)==1&&N.jsx(gn,{theme:"light",text:"Download",size:14,className:fi.buttonRight,onClick:T}),(y==null?void 0:y.length)>1&&N.jsx(gn,{theme:"light",text:"Download All",size:14,className:fi.buttonRight,onClick:T})]})]})}const Fg="abi/5.7.0",Dt=new ge(Fg),$c={};let CO={calldata:!0,memory:!0,storage:!0},RPe={calldata:!0,memory:!0};function Ev(n,e){if(n==="bytes"||n==="string"){if(CO[e])return!0}else if(n==="address"){if(e==="payable")return!0}else if((n.indexOf("[")>=0||n==="tuple")&&RPe[e])return!0;return(CO[e]||e==="payable")&&Dt.throwArgumentError("invalid modifier","name",e),!1}function FPe(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!==Vt.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===Vt.full?", ":",")+")"):t+=this.type,e!==Vt.sighash&&(this.indexed===!0&&(t+=" indexed"),e===Vt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?br.fromString(e,t):br.fromObject(e)}static fromObject(e){return br.isParamType(e)?e:new br($c,{name:e.name||null,type:xf(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(br.fromObject):null})}static fromString(e,t){function r(i){return br.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(FPe(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function $m(n,e){return PPe(n).map(t=>br.fromString(t,e))}class sl{constructor(e,t){e!==$c&&Dt.throwError("use a static from method",ge.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),dy(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return sl.isFragment(e)?e:typeof e=="string"?sl.fromString(e):sl.fromObject(e)}static fromObject(e){if(sl.isFragment(e))return e;switch(e.type){case"function":return Jo.fromObject(e);case"event":return Ja.fromObject(e);case"constructor":return Zo.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"?Ja.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?Jo.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?Zo.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 Ja extends sl{format(e){if(e||(e=Vt.sighash),Vt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Vt.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!==Vt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Vt.full?", ":",")+") ",e!==Vt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?Ja.fromString(e):Ja.fromObject(e)}static fromObject(e){if(Ja.isEventFragment(e))return e;e.type!=="event"&&Dt.throwArgumentError("invalid event object","value",e);const t={name:Zm(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(br.fromObject):[],type:"event"};return new Ja($c,t)}static fromString(e){let t=e.match(Jm);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)}}),Ja.fromObject({name:t[1].trim(),anonymous:r,inputs:$m(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function zz(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 Gz(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 Vz(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 Zo extends sl{format(e){if(e||(e=Vt.sighash),Vt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Vt.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===Vt.sighash&&Dt.throwError("cannot format a constructor for sighash",ge.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===Vt.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?Zo.fromString(e):Zo.fromObject(e)}static fromObject(e){if(Zo.isConstructorFragment(e))return e;e.type!=="constructor"&&Dt.throwArgumentError("invalid constructor object","value",e);let t=Vz(e);t.constant&&Dt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(br.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new Zo($c,r)}static fromString(e){let t={type:"constructor"};e=zz(e,t);let r=e.match(Jm);return(!r||r[1].trim()!=="constructor")&&Dt.throwArgumentError("invalid constructor string","value",e),t.inputs=$m(r[2].trim(),!1),Gz(r[3].trim(),t),Zo.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class Jo extends Zo{format(e){if(e||(e=Vt.sighash),Vt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Vt.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!==Vt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Vt.full?", ":",")+") ",e!==Vt.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"?Jo.fromString(e):Jo.fromObject(e)}static fromObject(e){if(Jo.isFunctionFragment(e))return e;e.type!=="function"&&Dt.throwArgumentError("invalid function object","value",e);let t=Vz(e);const r={type:e.type,name:Zm(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(br.fromObject):[],outputs:e.outputs?e.outputs.map(br.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new Jo($c,r)}static fromString(e){let t={type:"function"};e=zz(e,t);let r=e.split(" returns ");r.length>2&&Dt.throwArgumentError("invalid function string","value",e);let i=r[0].match(Jm);if(i||Dt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&Zm(t.name),t.inputs=$m(i[2],!1),Gz(i[3].trim(),t),r.length>1){let s=r[1].match(Jm);(s[1].trim()!=""||s[3].trim()!="")&&Dt.throwArgumentError("unexpected tokens","value",e),t.outputs=$m(s[2],!1)}else t.outputs=[];return Jo.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function MO(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 sl{format(e){if(e||(e=Vt.sighash),Vt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Vt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Vt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Vt.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:Zm(e.name),inputs:e.inputs?e.inputs.map(br.fromObject):[]};return MO(new rA($c,t))}static fromString(e){let t={type:"error"},r=e.match(Jm);return r||Dt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&Zm(t.name),t.inputs=$m(r[2],!1),MO(rA.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function xf(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const LPe=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Zm(n){return(!n||!n.match(LPe))&&Dt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const Jm=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function PPe(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&g2.throwError("value out-of-bounds",ge.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=qi([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 Xw{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):Xw.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:g2.throwError("data out-of-bounds",ge.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new Xw(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 OPe extends Il{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=Nr(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return Nr(Qn(e.readValue().toHexString(),20))}}class NPe 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 ge(Fg);function jz(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",ge.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]&&Yf.throwError("cannot encode object for signature with duplicate names",ge.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 cM(n.wordSize),s=new cM(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 Wz(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===ge.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===ge.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 kPe 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",ge.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 jz(e,this.coders,t)}decode(e){return e.coerce(this.name,Wz(e,this.coders))}}const Mv=new ge(Fg),WPe=new RegExp(/^bytes([0-9]*)$/),KPe=new RegExp(/^(u?int)([0-9]*)$/);class YPe{constructor(e){Ue(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new OPe(e.name);case"bool":return new QPe(e.name);case"string":return new jPe(e.name);case"bytes":return new HPe(e.name);case"array":return new kPe(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Cv((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new GPe(e.name)}let t=e.type.match(KPe);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&Mv.throwArgumentError("invalid "+t[1]+" bit length","param",e),new VPe(r/8,t[1]==="int",e.name)}if(t=e.type.match(WPe),t){let r=parseInt(t[1]);return(r===0||r>32)&&Mv.throwArgumentError("invalid bytes length","param",e),new zPe(r,e.name)}return Mv.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new Xw(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new cM(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(br.from(i)));return new Cv(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Mv.throwError("types/values length mismatch",ge.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(br.from(o))),i=new Cv(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(br.from(o)));return new Cv(i,"_").decode(this._getReader(at(t),r))}}const XPe=new YPe,Mn=new ge(Fg);class $Pe extends ng{}class ZPe extends ng{}class JPe extends ng{}class uM extends ng{static isIndexed(e){return!!(e&&e._isIndexed)}}const qPe={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function SO(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class TO{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Ue(this,"fragments",t.map(r=>sl.from(r)).filter(r=>r!=null)),Ue(this,"_abiCoder",es(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){Mn.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]){Mn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Ue(this,"deploy",Zo.from({payable:!1,type:"constructor"})),Ue(this,"_isInterface",!0)}format(e){e||(e=Vt.full),e===Vt.sighash&&Mn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===Vt.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return XPe}static getAddress(e){return Nr(e)}static getSighash(e){return jr(_f(e.format()),0,4)}static getEventTopic(e){return _f(e.format())}getFunction(e){if(Et(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];Mn.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?Mn.throwArgumentError("no matching function","name",r):i.length>1&&Mn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[Jo.fromString(e).format()];return t||Mn.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];Mn.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?Mn.throwArgumentError("no matching event","name",r):i.length>1&&Mn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[Ja.fromString(e).format()];return t||Mn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Et(e)){const r=es(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}Mn.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?Mn.throwArgumentError("no matching error","name",r):i.length>1&&Mn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[Jo.fromString(e).format()];return t||Mn.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 es(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),es(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)&&Mn.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(qi([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)&&Mn.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(qi([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=qPe[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 Mn.throwError("call revert exception"+s,ge.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&&Mn.throwError("too many arguments for "+e.format(),ge.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?_f(o):s.type==="bytes"?sr(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]),Qn(nt(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&Mn.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"?Mn.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&&Mn.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(_f(l));else if(o.type==="bytes")r.push(sr(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)&&Mn.throwError("fragment/topic mismatch",ge.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(br.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,qi(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 uM({_isIndexed:!0,hash:null});else if(o[h])A[h]=new uM({_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 SO(`property ${JSON.stringify(f.name)}`,p)}}):A[f.name]=p}});for(let f=0;f{throw SO(`index ${f}`,h)}})}return Object.freeze(A)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new ZPe({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 $Pe({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 JPe({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 e3e="contracts/5.7.0";var Zc=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 Kn=new ge(e3e);function $w(n,e){return Zc(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&Kn.throwArgumentError("invalid address or ENS name","name",t);try{return Nr(t)}catch{}n||Kn.throwError("a provider or signer is needed to resolve ENS names",ge.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&Kn.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function py(n,e,t){return Zc(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>py(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield $w(n,e):t.type==="tuple"?yield py(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>py(n,r,t.arrayChildren))):Promise.reject(Kn.makeError("invalid value for array",ge.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function g_(n,e,t){return Zc(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=En(t.pop())),Kn.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=tr({override:$w(n.signer,r.from),signer:n.signer.getAddress()}).then(A=>Zc(this,void 0,void 0,function*(){return Nr(A.signer)!==A.override&&Kn.throwError("Contract with a Signer cannot override from",ge.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),A.override})):r.from=n.signer.getAddress():r.from&&(r.from=$w(n.provider,r.from));const i=yield tr({args:py(n.signer||n.provider,t,e.inputs),address:n.resolvedAddress,overrides:tr(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=qc(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&&Kn.throwError(`cannot override ${l.map(A=>JSON.stringify(A)).join(",")}`,ge.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function t3e(n,e){return function(...t){return g_(n,e,t)}}function n3e(n,e){const t=n.signer||n.provider;return function(...r){return Zc(this,void 0,void 0,function*(){t||Kn.throwError("estimate require a provider or signer",ge.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield g_(n,e,r);return yield t.estimateGas(i)})}}function r3e(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=rs(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 Yz(n,e,t){const r=n.signer||n.provider;return function(...i){return Zc(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=En(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 g_(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===ge.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function i3e(n,e){return function(...t){return Zc(this,void 0,void 0,function*(){n.signer||Kn.throwError("sending a transaction requires a signer",ge.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield g_(n,e,t),i=yield n.signer.sendTransaction(r);return r3e(n,i),i})}}function IO(n,e,t){return e.constant?Yz(n,e,t):i3e(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 qm{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 s3e extends qm{constructor(){super("error",null)}}class RO extends qm{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&Kn.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=DPe(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class FO extends qm{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 o3e{constructor(e,t,r){Ue(this,"interface",es(new.target,"getInterface")(t)),r==null?(Ue(this,"provider",null),Ue(this,"signer",null)):og.isSigner(r)?(Ue(this,"provider",r.provider||null),Ue(this,"signer",r)):rg.isProvider(r)?(Ue(this,"provider",r),Ue(this,"signer",null)):Kn.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]]):Kn.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Ue(this,"_runningEvents",{}),Ue(this,"_wrappedEmits",{}),e==null&&Kn.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Ue(this,"address",e),this.provider)Ue(this,"resolvedAddress",$w(this.provider,e));else try{Ue(this,"resolvedAddress",Promise.resolve(Nr(e)))}catch{Kn.throwError("provider is required to use ENS name as contract address",ge.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]){Kn.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,IO(this,a,!0)),this.functions[o]==null&&Ue(this.functions,o,IO(this,a,!1)),this.callStatic[o]==null&&Ue(this.callStatic,o,Yz(this,a,!0)),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,t3e(this,a)),this.estimateGas[o]==null&&Ue(this.estimateGas,o,n3e(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 EN(e)}static getInterface(e){return TO.isInterface(e)?e:new TO(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"&&Kn.throwError("contract not deployed",ge.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||Kn.throwError("sending a transactions require a signer",ge.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=En(e||{});return["from","to"].forEach(function(r){t[r]!=null&&Kn.throwError("cannot override "+r,ge.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new FM(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 uM.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 s3e);if(e==="event")return this._normalizeRunningEvent(new qm("event",null));if(e==="*")return this._normalizeRunningEvent(new FO(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new RO(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 RO(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new qm(Xz(t),t))}return this._normalizeRunningEvent(new FO(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=rs(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||Kn.throwError("events require a provider or a signer with a provider",ge.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=En(i.filter);return typeof t=="string"&&Et(t,32)?(r!=null&&Kn.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 v_ extends o3e{}const a3e="0x543D43F390b7d681513045e8a85707438c463d80",Zw={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"}]},UO={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:l3e}=Object.prototype,{getPrototypeOf:v2}=Object,y_=(n=>e=>{const t=l3e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ea=n=>(n=n.toLowerCase(),e=>y_(e)===n),w_=n=>e=>typeof e===n,{isArray:md}=Array,eg=w_("undefined");function A3e(n){return n!==null&&!eg(n)&&n.constructor!==null&&!eg(n.constructor)&&ks(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Zz=Ea("ArrayBuffer");function c3e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Zz(n.buffer),e}const u3e=w_("string"),ks=w_("function"),Jz=w_("number"),x_=n=>n!==null&&typeof n=="object",f3e=n=>n===!0||n===!1,my=n=>{if(y_(n)!=="object")return!1;const e=v2(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},h3e=Ea("Date"),d3e=Ea("File"),p3e=Ea("Blob"),m3e=Ea("FileList"),g3e=n=>x_(n)&&ks(n.pipe),v3e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||ks(n.append)&&((e=y_(n))==="formdata"||e==="object"&&ks(n.toString)&&n.toString()==="[object FormData]"))},y3e=Ea("URLSearchParams"),w3e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ug(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),md(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const eG=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),tG=n=>!eg(n)&&n!==eG;function fM(){const{caseless:n}=tG(this)&&this||{},e={},t=(r,i)=>{const s=n&&qz(e,i)||i;my(e[s])&&my(r)?e[s]=fM(e[s],r):my(r)?e[s]=fM({},r):md(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(Ug(e,(i,s)=>{t&&ks(i)?n[s]=$z(i,t):n[s]=i},{allOwnKeys:r}),n),_3e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),b3e=(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)},B3e=(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&&v2(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},E3e=(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},C3e=n=>{if(!n)return null;if(md(n))return n;let e=n.length;if(!Jz(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},M3e=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&v2(Uint8Array)),S3e=(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])}},T3e=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},I3e=Ea("HTMLFormElement"),R3e=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),LO=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),F3e=Ea("RegExp"),nG=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};Ug(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},U3e=n=>{nG(n,(e,t)=>{if(ks(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(ks(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+"'")})}})},L3e=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return md(n)?r(n):r(String(n).split(e)),t},P3e=()=>{},D3e=(n,e)=>(n=+n,Number.isFinite(n)?n:e),_B="abcdefghijklmnopqrstuvwxyz",PO="0123456789",rG={DIGIT:PO,ALPHA:_B,ALPHA_DIGIT:_B+_B.toUpperCase()+PO},O3e=(n=16,e=rG.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function N3e(n){return!!(n&&ks(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const k3e=n=>{const e=new Array(10),t=(r,i)=>{if(x_(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=md(r)?[]:{};return Ug(r,(o,a)=>{const l=t(o,i+1);!eg(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},Q3e=Ea("AsyncFunction"),H3e=n=>n&&(x_(n)||ks(n))&&ks(n.then)&&ks(n.catch),Re={isArray:md,isArrayBuffer:Zz,isBuffer:A3e,isFormData:v3e,isArrayBufferView:c3e,isString:u3e,isNumber:Jz,isBoolean:f3e,isObject:x_,isPlainObject:my,isUndefined:eg,isDate:h3e,isFile:d3e,isBlob:p3e,isRegExp:F3e,isFunction:ks,isStream:g3e,isURLSearchParams:y3e,isTypedArray:M3e,isFileList:m3e,forEach:Ug,merge:fM,extend:x3e,trim:w3e,stripBOM:_3e,inherits:b3e,toFlatObject:B3e,kindOf:y_,kindOfTest:Ea,endsWith:E3e,toArray:C3e,forEachEntry:S3e,matchAll:T3e,isHTMLForm:I3e,hasOwnProperty:LO,hasOwnProp:LO,reduceDescriptors:nG,freezeMethods:U3e,toObjectSet:L3e,toCamelCase:R3e,noop:P3e,toFiniteNumber:D3e,findKey:qz,global:eG,isContextDefined:tG,ALPHABET:rG,generateString:O3e,isSpecCompliantForm:N3e,toJSONObject:k3e,isAsyncFn:Q3e,isThenable:H3e};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)}Re.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:Re.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const iG=Nt.prototype,sG={};["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=>{sG[n]={value:n}});Object.defineProperties(Nt,sG);Object.defineProperty(iG,"isAxiosError",{value:!0});Nt.from=(n,e,t,r,i,s)=>{const o=Object.create(iG);return Re.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 z3e=null;function hM(n){return Re.isPlainObject(n)||Re.isArray(n)}function oG(n){return Re.endsWith(n,"[]")?n.slice(0,-2):n}function DO(n,e,t){return n?n.concat(e).map(function(i,s){return i=oG(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function G3e(n){return Re.isArray(n)&&!n.some(hM)}const V3e=Re.toFlatObject(Re,{},null,function(e){return/^is[A-Z]/.test(e)});function __(n,e,t){if(!Re.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Re.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,g){return!Re.isUndefined(g[d])});const r=t.metaTokens,i=t.visitor||c,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Re.isSpecCompliantForm(e);if(!Re.isFunction(i))throw new TypeError("visitor must be a function");function A(p){if(p===null)return"";if(Re.isDate(p))return p.toISOString();if(!l&&Re.isBlob(p))throw new Nt("Blob is not supported. Use a Buffer instead.");return Re.isArrayBuffer(p)||Re.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(Re.endsWith(d,"{}"))d=r?d:d.slice(0,-2),p=JSON.stringify(p);else if(Re.isArray(p)&&G3e(p)||(Re.isFileList(p)||Re.endsWith(d,"[]"))&&(m=Re.toArray(p)))return d=oG(d),m.forEach(function(w,x){!(Re.isUndefined(w)||w===null)&&e.append(o===!0?DO([d],x,s):o===null?d:d+"[]",A(w))}),!1}return hM(p)?!0:(e.append(DO(g,d,s),A(p)),!1)}const u=[],f=Object.assign(V3e,{defaultVisitor:c,convertValue:A,isVisitable:hM});function h(p,d){if(!Re.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+d.join("."));u.push(p),Re.forEach(p,function(m,y){(!(Re.isUndefined(m)||m===null)&&i.call(e,m,Re.isString(y)?y.trim():y,d,f))===!0&&h(m,d?d.concat(y):[y])}),u.pop()}}if(!Re.isObject(n))throw new TypeError("data must be an object");return h(n),e}function OO(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function y2(n,e){this._pairs=[],n&&__(n,this,e)}const aG=y2.prototype;aG.append=function(e,t){this._pairs.push([e,t])};aG.toString=function(e){const t=e?function(r){return e.call(this,r,OO)}:OO;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function j3e(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function lG(n,e,t){if(!e)return n;const r=t&&t.encode||j3e,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Re.isURLSearchParams(e)?e.toString():new y2(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class W3e{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){Re.forEach(this.handlers,function(r){r!==null&&e(r)})}}const NO=W3e,AG={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},K3e=typeof URLSearchParams<"u"?URLSearchParams:y2,Y3e=typeof FormData<"u"?FormData:null,X3e=typeof Blob<"u"?Blob:null,$3e={isBrowser:!0,classes:{URLSearchParams:K3e,FormData:Y3e,Blob:X3e},protocols:["http","https","file","blob","url","data"]},cG=typeof window<"u"&&typeof document<"u",Z3e=(n=>cG&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),J3e=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),q3e=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:cG,hasStandardBrowserEnv:Z3e,hasStandardBrowserWebWorkerEnv:J3e},Symbol.toStringTag,{value:"Module"})),ta={...q3e,...$3e};function eDe(n,e){return __(n,new ta.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return ta.isNode&&Re.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function tDe(n){return Re.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function nDe(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Re.isArray(i)?i.length:o,l?(Re.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Re.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Re.isArray(i[o])&&(i[o]=nDe(i[o])),!a)}if(Re.isFormData(n)&&Re.isFunction(n.entries)){const t={};return Re.forEachEntry(n,(r,i)=>{e(tDe(r),i,t,0)}),t}return null}function rDe(n,e,t){if(Re.isString(n))try{return(e||JSON.parse)(n),Re.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const w2={transitional:AG,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Re.isObject(e);if(s&&Re.isHTMLForm(e)&&(e=new FormData(e)),Re.isFormData(e))return i?JSON.stringify(uG(e)):e;if(Re.isArrayBuffer(e)||Re.isBuffer(e)||Re.isStream(e)||Re.isFile(e)||Re.isBlob(e))return e;if(Re.isArrayBufferView(e))return e.buffer;if(Re.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 eDe(e,this.formSerializer).toString();if((a=Re.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return __(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),rDe(e)):e}],transformResponse:[function(e){const t=this.transitional||w2.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(e&&Re.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:ta.classes.FormData,Blob:ta.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Re.forEach(["delete","get","head","post","put","patch"],n=>{w2.headers[n]={}});const x2=w2,iDe=Re.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"]),sDe=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]&&iDe[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},kO=Symbol("internals");function up(n){return n&&String(n).trim().toLowerCase()}function gy(n){return n===!1||n==null?n:Re.isArray(n)?n.map(gy):String(n)}function oDe(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 aDe=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function bB(n,e,t,r,i){if(Re.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Re.isString(e)){if(Re.isString(r))return e.indexOf(r)!==-1;if(Re.isRegExp(r))return r.test(e)}}function lDe(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function ADe(n,e){const t=Re.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 b_{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,A){const c=up(l);if(!c)throw new Error("header name must be a non-empty string");const u=Re.findKey(i,c);(!u||i[u]===void 0||A===!0||A===void 0&&i[u]!==!1)&&(i[u||l]=gy(a))}const o=(a,l)=>Re.forEach(a,(A,c)=>s(A,c,l));return Re.isPlainObject(e)||e instanceof this.constructor?o(e,t):Re.isString(e)&&(e=e.trim())&&!aDe(e)?o(sDe(e),t):e!=null&&s(t,e,r),this}get(e,t){if(e=up(e),e){const r=Re.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return oDe(i);if(Re.isFunction(t))return t.call(this,i,r);if(Re.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=up(e),e){const r=Re.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||bB(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=up(o),o){const a=Re.findKey(r,o);a&&(!t||bB(r,r[a],a,t))&&(delete r[a],i=!0)}}return Re.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||bB(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Re.forEach(this,(i,s)=>{const o=Re.findKey(r,s);if(o){t[o]=gy(i),delete t[s];return}const a=e?lDe(s):String(s).trim();a!==s&&delete t[s],t[a]=gy(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Re.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Re.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[kO]=this[kO]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=up(o);r[a]||(ADe(i,o),r[a]=!0)}return Re.isArray(e)?e.forEach(s):s(e),this}}b_.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Re.reduceDescriptors(b_.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Re.freezeMethods(b_);const ul=b_;function BB(n,e){const t=this||x2,r=e||t,i=ul.from(r.headers);let s=r.data;return Re.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function fG(n){return!!(n&&n.__CANCEL__)}function Lg(n,e,t){Nt.call(this,n??"canceled",Nt.ERR_CANCELED,e,t),this.name="CanceledError"}Re.inherits(Lg,Nt,{__CANCEL__:!0});function cDe(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 uDe=ta.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Re.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Re.isString(r)&&o.push("path="+r),Re.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 fDe(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function hDe(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function hG(n,e){return n&&!fDe(e)?hDe(n,e):e}const dDe=ta.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=Re.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function pDe(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function mDe(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 gDe=typeof XMLHttpRequest<"u",vDe=gDe&&function(n){return new Promise(function(t,r){let i=n.data;const s=ul.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(Re.isFormData(i)){if(ta.hasStandardBrowserEnv||ta.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=hG(n.baseURL,n.url);u.open(n.method.toUpperCase(),lG(f,n.params,n.paramsSerializer),!0),u.timeout=n.timeout;function h(){if(!u)return;const d=ul.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};cDe(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||AG;n.timeoutErrorMessage&&(g=n.timeoutErrorMessage),r(new Nt(g,m.clarifyTimeoutError?Nt.ETIMEDOUT:Nt.ECONNABORTED,n,u)),u=null},ta.hasStandardBrowserEnv&&(a&&Re.isFunction(a)&&(a=a(n)),a||a!==!1&&dDe(f))){const d=n.xsrfHeaderName&&n.xsrfCookieName&&uDe.read(n.xsrfCookieName);d&&s.set(n.xsrfHeaderName,d)}i===void 0&&s.setContentType(null),"setRequestHeader"in u&&Re.forEach(s.toJSON(),function(g,m){u.setRequestHeader(m,g)}),Re.isUndefined(n.withCredentials)||(u.withCredentials=!!n.withCredentials),o&&o!=="json"&&(u.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&u.addEventListener("progress",QO(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",QO(n.onUploadProgress)),(n.cancelToken||n.signal)&&(l=d=>{u&&(r(!d||d.type?new Lg(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=pDe(f);if(p&&ta.protocols.indexOf(p)===-1){r(new Nt("Unsupported protocol "+p+":",Nt.ERR_BAD_REQUEST,n));return}u.send(i||null)})},dM={http:z3e,xhr:vDe};Re.forEach(dM,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const HO=n=>`- ${n}`,yDe=n=>Re.isFunction(n)||n===null||n===!1,dG={getAdapter:n=>{n=Re.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(HO).join(` -`):" "+HO(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:dM};function EB(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Lg(null,n)}function zO(n){return EB(n),n.headers=ul.from(n.headers),n.data=BB.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),dG.getAdapter(n.adapter||x2.adapter)(n).then(function(r){return EB(n),r.data=BB.call(n,n.transformResponse,r),r.headers=ul.from(r.headers),r},function(r){return fG(r)||(EB(n),r&&r.response&&(r.response.data=BB.call(n,n.transformResponse,r.response),r.response.headers=ul.from(r.response.headers))),Promise.reject(r)})}const GO=n=>n instanceof ul?{...n}:n;function Hh(n,e){e=e||{};const t={};function r(A,c,u){return Re.isPlainObject(A)&&Re.isPlainObject(c)?Re.merge.call({caseless:u},A,c):Re.isPlainObject(c)?Re.merge({},c):Re.isArray(c)?c.slice():c}function i(A,c,u){if(Re.isUndefined(c)){if(!Re.isUndefined(A))return r(void 0,A,u)}else return r(A,c,u)}function s(A,c){if(!Re.isUndefined(c))return r(void 0,c)}function o(A,c){if(Re.isUndefined(c)){if(!Re.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(GO(A),GO(c),!0)};return Re.forEach(Object.keys(Object.assign({},n,e)),function(c){const u=l[c]||i,f=u(n[c],e[c],c);Re.isUndefined(f)&&u!==a||(t[c]=f)}),t}const pG="1.6.8",_2={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{_2[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const VO={};_2.transitional=function(e,t,r){function i(s,o){return"[Axios v"+pG+"] 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&&!VO[o]&&(VO[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 wDe(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 pM={assertOptions:wDe,validators:_2},jl=pM.validators;class Jw{constructor(e){this.defaults=e,this.interceptors={request:new NO,response:new NO}}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=Hh(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&pM.assertOptions(r,{silentJSONParsing:jl.transitional(jl.boolean),forcedJSONParsing:jl.transitional(jl.boolean),clarifyTimeoutError:jl.transitional(jl.boolean)},!1),i!=null&&(Re.isFunction(i)?t.paramsSerializer={serialize:i}:pM.assertOptions(i,{encode:jl.function,serialize:jl.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Re.merge(s.common,s[t.method]);s&&Re.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),t.headers=ul.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=[zO.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 Lg(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 b2(function(i){e=i}),cancel:e}}}const xDe=b2;function _De(n){return function(t){return n.apply(null,t)}}function bDe(n){return Re.isObject(n)&&n.isAxiosError===!0}const mM={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(mM).forEach(([n,e])=>{mM[e]=n});const BDe=mM;function mG(n){const e=new vy(n),t=$z(vy.prototype.request,e);return Re.extend(t,vy.prototype,e,{allOwnKeys:!0}),Re.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return mG(Hh(n,i))},t}const ar=mG(x2);ar.Axios=vy;ar.CanceledError=Lg;ar.CancelToken=xDe;ar.isCancel=fG;ar.VERSION=pG;ar.toFormData=__;ar.AxiosError=Nt;ar.Cancel=ar.CanceledError;ar.all=function(e){return Promise.all(e)};ar.spread=_De;ar.isAxiosError=bDe;ar.mergeConfig=Hh;ar.AxiosHeaders=ul;ar.formToJSON=n=>uG(Re.isHTMLForm(n)?new FormData(n):n);ar.getAdapter=dG.getAdapter;ar.HttpStatusCode=BDe;ar.default=ar;const EDe=ar,CDe={}.VITE_OPENSEA_KEY,MDe={}.VITE_PINATA_API_KEY,SDe={}.VITE_PINATA_API_SECRET,CB="0x89";let Sv;async function TDe(){if(Sv!=null)return Sv;const n=new ak("https://polygon-rpc.com/"),t=await new v_(Zw.address,Zw.abi,n).tokenPrice();return Sv=Ge.from(t).mul(1),Sv}function IDe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":CDe}};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 B2(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(CB,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:CB}]});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:CB}]});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 MB(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 EDe.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:MDe,pinata_secret_api_key:SDe}})).data}const RDe=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 FDe(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 B2();if(s=="")return"Please Connect Wallet";if(!i||await UDe(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let y=0;y<10;y++)try{return await MB(e,a).catch(x=>{console.error(y,"---",x)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const A=await bhe(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 MB(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:RDe(n)},f=JSON.stringify(u),p=`ipfs://${(await MB(new Blob([f]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let d=await TDe();const g=new LM(window.ethereum).getSigner(),m=new v_(Zw.address,Zw.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 UDe=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=a7("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new v_(UO.address,UO.abi,t).beneficiaryBalanceOf(e,a3e,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 LDe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=$.useContext(Di),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=$.useContext(Zn),[c,u]=ye.useState(null),[f,h]=ye.useState(""),{playSound:p}=$.useContext(Ys),{isMute:d}=$.useContext(Ks);$.useState(null);const[g,m]=$.useState(null),[y,w]=$.useState(""),x=()=>{!d&&p("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(mt.LANDING)},_=()=>{const v=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:bn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:bn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:bn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:bn(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 B=g[v].manifestName;(async()=>{(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview)&&i.savePortraitScreenshot(B,512,1024,1.5,-.1),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await i.downloadVRM(B,_());const z=new sd,K=A.parent;K.remove(A);const Q=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(Q===!0){const G=r.loras.map(async ee=>a.createLoraData(ee,z));await Promise.all(G)}const E=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(E===!0){const G=r.sprites.map(async ee=>l.createSpriteAtlas(ee,z));await Promise.all(G)}(Q===!0||E===!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(F=>new Promise(P=>setTimeout(P,F)))(1),C(v)}))},b=()=>{t(!0),T(0)},{t:M}=ye.useContext(So),D=async v=>{if(i.getCurrentCharacterModel()){const F=cl(v.name),P=URL.createObjectURL(v);await s.loadAnimation(P,!1,0,!0,"",F),w(s.getCurrentAnimationName()),URL.revokeObjectURL(P)}else console.warn("Please load a vrm model to test animations.")},Y=async v=>{const B=URL.createObjectURL(v);await i.loadOptimizerCharacter(B),URL.revokeObjectURL(B);const F=cl(v.name);h(F),u(i.getCurrentCharacterModel())},H=v=>{const B=Array.from(v),F=[],P=O=>new Promise((z,K)=>{if(O&&O.name.toLowerCase().endsWith(".json")){const Q=new FileReader,E=O.name.replace(/\.[^/.]+$/,"");Q.onload=function(G){try{const ee=JSON.parse(G.target.result),U=ee.thumbnail;ee.manifestName=E,F.push(ee),z()}catch(ee){console.error("Error parsing the JSON file:",ee),K(ee)}},Q.readAsText(O)}});Promise.all(B.map(P)).then(()=>{F.length>0&&(m(F),i.setManifest(F[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(O=>{console.error("Error processing files:",O)})},I=async v=>{const B=v[0];B&&B.name.toLowerCase().endsWith(".fbx")&&D(B),B&&B.name.toLowerCase().endsWith(".vrm")&&Y(B),B&&B.name.toLowerCase().endsWith(".json")&&H(v)};return N.jsxs("div",{className:fi.container,children:[N.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:N.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),N.jsx("div",{className:"sectionTitle",children:"NFT Characters"}),N.jsx(_g,{onFilesDrop:I}),N.jsx(m_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),N.jsx(m2,{model:c}),N.jsx(BT,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&N.jsx(qx,{loadedAnimationName:y}),N.jsxs("div",{className:fi.buttonContainer,children:[N.jsx(gn,{theme:"light",text:M("callToAction.back"),size:14,className:fi.buttonLeft,onClick:x}),(g==null?void 0:g.length)==1&&N.jsx(gn,{theme:"light",text:"Download",size:14,className:fi.buttonRight,onClick:b}),(g==null?void 0:g.length)>1&&N.jsx(gn,{theme:"light",text:"Download All",size:14,className:fi.buttonRight,onClick:b})]})]})}const PDe="_classdisabled_hpzv8_1",DDe="_container_hpzv8_6",ODe="_classContainer_hpzv8_14",NDe="_icon_hpzv8_39",kDe="_name_hpzv8_70",QDe="_description_hpzv8_79",HDe="_classFrame_hpzv8_84",zDe="_frameContainer_hpzv8_104",GDe="_frame_hpzv8_104",VDe="_image_hpzv8_114",jDe="_lockedContainer_hpzv8_120",WDe="_locked_hpzv8_120",KDe="_buttonContainer_hpzv8_134",YDe="_buttonLeft_hpzv8_143",XDe="_buttonRight_hpzv8_147",$De="_buttonCenter_hpzv8_151",ZDe="_topLine_hpzv8_165",JDe="_bottomLine_hpzv8_191",ot={classdisabled:PDe,container:DDe,classContainer:ODe,class:"_class_hpzv8_1",icon:NDe,name:kDe,description:QDe,classFrame:HDe,frameContainer:zDe,frame:GDe,image:VDe,lockedContainer:jDe,locked:WDe,buttonContainer:KDe,buttonLeft:YDe,buttonRight:XDe,buttonCenter:$De,topLine:ZDe,bottomLine:JDe};function qDe(){const{t:n}=ye.useContext(So),{setViewMode:e,setIsLoading:t,isLoading:r}=$.useContext(Di),{playSound:i}=$.useContext(Ys),{isMute:s}=$.useContext(Ks),{manifest:o,characterManager:a}=$.useContext(Zn),[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(mt.LANDING),!s&&i("backNextButton")},u=async p=>{t(!0),a.loadManifest(o.characters[p].manifest).then(()=>{e(mt.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{e(mt.BATCHMANIFEST)},h=()=>{!s&&i("classMouseOver")};return N.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[N.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),N.jsx("div",{className:ot.vrmOptimizerButton}),N.jsx("div",{className:ot.topLine}),N.jsxs("div",{className:ot.classContainer,children:[l.map((p,d)=>N.jsxs("div",{className:p.disabled?ot.classdisabled:ot.class,onClick:p.disabled?null:()=>u(d),onMouseOver:p.disabled?null:()=>h(),children:[N.jsxs("div",{className:ot.classFrame,style:{backgroundImage:`url(${p.image})`},children:[N.jsx("div",{className:ot.frameContainer,children:N.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})}),N.jsx("div",{className:ot.lockedContainer,children:p.disabled&&N.jsx("img",{src:"./assets/icons/locked.svg",className:ot.locked})})]}),N.jsx("div",{className:ot.name,children:p.name}),N.jsx("div",{className:ot.description,children:p.description})]},d)),N.jsxs("div",{className:ot.class,onClick:()=>f(),onMouseOver:()=>h(),children:[N.jsx("div",{className:ot.classFrame,style:{backgroundImage:"url(./assets/media/disabled.png)"},children:N.jsx("div",{className:ot.frameContainer,children:N.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})})}),N.jsx("div",{className:ot.name,children:"Manifest"}),N.jsx("div",{className:ot.description,children:"Load by manifest"})]},"manifest-load")]}),N.jsx("div",{className:ot.bottomLine}),N.jsx("div",{className:ot.buttonContainer,children:N.jsx(gn,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}function eOe(){const{t:n}=ye.useContext(So),{setViewMode:e,setIsLoading:t,isLoading:r}=$.useContext(Di),{playSound:i}=$.useContext(Ys),{isMute:s}=$.useContext(Ks),{manifest:o,characterManager:a}=$.useContext(Zn),[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(mt.LANDING),!s&&i("backNextButton")},u=async h=>{t(!0),a.loadManifest(o.characters[h].manifest).then(()=>{e(mt.APPEARANCE),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{!s&&i("classMouseOver")};return N.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[N.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),N.jsx("div",{className:ot.vrmOptimizerButton}),N.jsx("div",{className:ot.topLine}),N.jsx("div",{className:ot.classContainer,children:l.map((h,p)=>N.jsxs("div",{className:h.disabled?ot.classdisabled:ot.class,onClick:h.disabled?null:()=>u(p),onMouseOver:h.disabled?null:()=>f(),children:[N.jsxs("div",{className:ot.classFrame,style:{backgroundImage:`url(${h.image})`},children:[N.jsx("div",{className:ot.frameContainer,children:N.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})}),N.jsx("div",{className:ot.lockedContainer,children:h.disabled&&N.jsx("img",{src:"./assets/icons/locked.svg",className:ot.locked})})]}),N.jsx("div",{className:ot.name,children:h.name}),N.jsx("div",{className:ot.description,children:h.description})]},p))}),N.jsx("div",{className:ot.bottomLine}),N.jsx("div",{className:ot.buttonContainer,children:N.jsx(gn,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}const tOe="_buttonContainer_1ueuk_1",nOe="_button_1ueuk_1",$u={buttonContainer:tOe,button:nOe},jO={}.VITE_OPENSEA_KEY;function rOe(){const{setViewMode:n}=$.useContext(Di),{playSound:e}=$.useContext(Ys),{isMute:t}=$.useContext(Ks),{characterManager:r}=$.useContext(Zn),i=()=>{n(mt.CREATE),!t&&e("backNextButton")},s=()=>{n(mt.CLAIM),!t&&e("backNextButton")},o=()=>{n(mt.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await B2()!=""&&n(mt.WALLET),!t&&e("backNextButton")};return N.jsx("div",{className:$u.container,children:N.jsxs("div",{className:$u.buttonContainer,children:[N.jsx("button",{className:$u.button,onClick:i,children:N.jsx("img",{src:"./assets/media/btn_create_character.png"})}),N.jsx("button",{className:$u.button,onClick:s,children:N.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),N.jsx("button",{className:$u.button,onClick:o,children:N.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),jO&&jO!=""&&N.jsx("button",{className:$u.button,onClick:a,children:N.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const Ac={};var E2={exports:{}},hh=typeof Reflect=="object"?Reflect:null,WO=hh&&typeof hh.apply=="function"?hh.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},yy;hh&&typeof hh.ownKeys=="function"?yy=hh.ownKeys:Object.getOwnPropertySymbols?yy=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:yy=function(e){return Object.getOwnPropertyNames(e)};function iOe(n){console&&console.warn&&console.warn(n)}var gG=Number.isNaN||function(e){return e!==e};function tn(){tn.init.call(this)}E2.exports=tn;E2.exports.once=lOe;tn.EventEmitter=tn;tn.prototype._events=void 0;tn.prototype._eventsCount=0;tn.prototype._maxListeners=void 0;var KO=10;function B_(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(tn,"defaultMaxListeners",{enumerable:!0,get:function(){return KO},set:function(n){if(typeof n!="number"||n<0||gG(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");KO=n}});tn.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};tn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||gG(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 vG(n){return n._maxListeners===void 0?tn.defaultMaxListeners:n._maxListeners}tn.prototype.getMaxListeners=function(){return vG(this)};tn.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")WO(l,this,t);else for(var A=l.length,c=bG(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,iOe(a)}return n}tn.prototype.addListener=function(e,t){return yG(this,e,t,!1)};tn.prototype.on=tn.prototype.addListener;tn.prototype.prependListener=function(e,t){return yG(this,e,t,!0)};function sOe(){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 wG(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=sOe.bind(r);return i.listener=t,r.wrapFn=i,i}tn.prototype.once=function(e,t){return B_(t),this.on(e,wG(this,e,t)),this};tn.prototype.prependOnceListener=function(e,t){return B_(t),this.prependListener(e,wG(this,e,t)),this};tn.prototype.removeListener=function(e,t){var r,i,s,o,a;if(B_(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():oOe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};tn.prototype.off=tn.prototype.removeListener;tn.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 xG(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?aOe(i):bG(i,i.length)}tn.prototype.listeners=function(e){return xG(this,e,!0)};tn.prototype.rawListeners=function(e){return xG(this,e,!1)};tn.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):_G.call(n,e)};tn.prototype.listenerCount=_G;function _G(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}tn.prototype.eventNames=function(){return this._eventsCount>0?yy(this._events):[]};function bG(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 wy(n,e,t){return hOe()?wy=Reflect.construct:wy=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&qw(A,o.prototype),A},wy.apply(null,arguments)}function dOe(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function ex(n){var e=typeof Map=="function"?new Map:void 0;return ex=function(r){if(r===null||!dOe(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 wy(r,arguments,vM(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),qw(i,r)},ex(n)}function Tv(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 Zu(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 SB=function(n){C2(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}(ex(Error)),pOe=function(n){C2(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}(ex(Error)),mOe=function(n){C2(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind(Tv(i)),i.handleChainChanged=i.handleChainChanged.bind(Tv(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind(Tv(i)),i.handleClose=i.handleClose.bind(Tv(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 gM({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 SB;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=Zu(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 pOe});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=Zu(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 SB;var s,o=Zu(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=Zu(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 SB;var s,o=Zu(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(Zu(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}(fOe);function gOe(){const{account:n,library:e,activate:t}=m7(),[r,i]=ye.useState([]),{setViewMode:s}=$.useContext(Di),{playSound:o}=$.useContext(Ys),{isMute:a}=$.useContext(Ks),l=new mOe({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 v_(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(mt.APPEARANCE)},u=()=>{s(mt.LANDING),!a&&o("backNextButton")};return N.jsxs("div",{className:Ac.container,children:[!n&&N.jsxs("div",{className:Ac.message,children:["Please connect your wallet to load your characters",N.jsx("button",{className:Ac.button,onClick:()=>A(),children:"Connect"})]}),N.jsxs("div",{className:Ac.characterContainer,children:[N.jsx("div",{className:Ac.title,children:"Load Character"}),r.map((f,h)=>N.jsx("div",{className:Ac.character,onClick:()=>{c()},children:JSON.stringify(f)},h))]}),N.jsx("button",{className:Ac.button,onClick:()=>u(),children:"Back"})]})}const vOe="_container_q73cc_1",yOe="_mintContainer_q73cc_6",wOe="_mainTitleWrap_q73cc_33",xOe="_mainTitle_q73cc_33",_Oe="_mintButtonContainer_q73cc_49",bOe="_mintButton_q73cc_49",BOe="_genesisText_q73cc_60",EOe="_required_q73cc_64",COe="_divider_q73cc_68",MOe="_bottomContainer_q73cc_75",SOe="_mintInfo_q73cc_85",TOe="_topLine_q73cc_91",IOe="_bottomLine_q73cc_104",yi={container:vOe,mintContainer:yOe,mainTitleWrap:wOe,mainTitle:xOe,mintButtonContainer:_Oe,mintButton:bOe,genesisText:BOe,required:EOe,divider:COe,bottomContainer:MOe,mintInfo:SOe,topLine:TOe,bottomLine:IOe};function ROe(){const{model:n,avatar:e}=$.useContext(Zn),{setViewMode:t}=$.useContext(Di),{playSound:r}=$.useContext(Ys),{isMute:i}=$.useContext(Ks),[s,o]=$.useState(""),[a,l]=$.useState(!1),A=()=>{t(mt.SAVE),!i&&r("backNextButton")};function c(){return N.jsxs("div",{className:yi.mainTitleWrap,children:[N.jsx("div",{className:yi.topLine}),N.jsx("div",{className:yi.mainTitle,children:"Mint"})]})}async function u(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const p=await FDe(e,null,n,{name:"XXXRestore"}.name);o(p),l(!1),console.log(p)}return N.jsxs("div",{className:yi.container,children:[N.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),N.jsxs("div",{className:yi.mintContainer,children:[N.jsx(c,{}),N.jsxs("div",{className:yi.mintButtonContainer,children:[N.jsx(gn,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:yi.mintButton,disabled:a,onClick:u,minWidth:220}),N.jsx("div",{className:yi.divider}),N.jsx(gn,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:yi.mintButton,disabled:!0,minWidth:220}),N.jsxs("span",{className:yi.genesisText,children:["(",N.jsx("span",{className:yi.required,children:"Coming Soon!"}),")"]})]}),N.jsxs("span",{className:yi.mintInfo,children:[s," "]})]}),N.jsx("div",{className:yi.bottomContainer,children:N.jsx(gn,{theme:"light",text:"Back",size:14,className:yi.buttonLeft,onClick:A})})]})}function FOe(){const{isLoading:n,setViewMode:e}=$.useContext(Di),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=$.useContext(Zn),{playSound:l}=$.useContext(Ys),{isMute:A}=$.useContext(Ks),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=ye.useState([]),[g,m]=ye.useState(0),[y,w]=$.useState("T-Pose"),x=()=>{!A&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(mt.LANDING)},_=()=>{const B=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:bn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:bn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:bn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:bn(Oe.mergeOptions_atlas_std_transp_size||6),exportStdAtlas:B===0||B==2,exportMtoonAtlas:B===1||B==2,ktxCompression:Oe.merge_options_ktx_compression||!1,twoSidedMaterial:Oe.mergeOptions_two_sided_mat||!1}},C=async()=>{for(let B=0;B{typeof B!="string"&&(B=f),await(async()=>{var G;(Oe.mergeOptions_download_vrm_preview==null?!0:Oe.mergeOptions_download_vrm_preview)&&r.savePortraitScreenshot(B+"_portrait",512,1024,1.5,-.1),(Oe.mergeOptions_download_vrm==null?!0:Oe.mergeOptions_download_vrm)&&await r.downloadVRM(B+"_merged",_());const z=new sd,K=s.parent;K.remove(s),(G=r.getCurrentOptimizerCharacterModel().data)==null||G.isVRM0;const Q=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(Q===!0){const ee=t.loras.map(async U=>o.createLoraData(U,z));await Promise.all(ee)}const E=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(E===!0){const ee=t.sprites.map(async U=>a.createSpriteAtlas(U,z));await Promise.all(ee)}(Q===!0||E===!0)&&z.saveZip(B),K.add(s)})()},{t:b}=ye.useContext(So),M=async B=>{if(r.getCurrentOptimizerCharacterModel()){const P=cl(B.name),O=URL.createObjectURL(B);await i.loadAnimation(O,!1,0,!0,"",P),w(i.getCurrentAnimationName()),URL.revokeObjectURL(O)}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 B=g-1;H(p[B]),m(B)}},Y=()=>{if(g>=p.length-1)H(p[0]),m(0);else{const B=g+1;H(p[B]),m(B)}},H=async B=>{const F=URL.createObjectURL(B);await r.loadOptimizerCharacter(F),URL.revokeObjectURL(F);const P=cl(B.name);h(P),u({...r.getCurrentCharacterModel()})},I=async B=>{H(B[0]);const F=[];for(let P=0;P{const F=B[0];F&&F.name.toLowerCase().endsWith(".fbx")&&M(F),F&&F.name.toLowerCase().endsWith(".vrm")&&I(B)};return N.jsxs("div",{className:fi.container,children:[N.jsx("div",{className:`loadingIndicator ${n?"active":""}`,children:N.jsx("img",{className:"rotate",src:"ui/loading.svg"})}),N.jsx("div",{className:"sectionTitle",children:"Optimize your character"}),N.jsx(_g,{onFilesDrop:v}),N.jsx(m_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),N.jsx(m2,{model:c,name:f,files:p,index:g,nextVrm:Y,previousVrm:D}),N.jsx(qx,{loadedAnimationName:y}),N.jsxs("div",{className:fi.buttonContainer,children:[N.jsx(gn,{theme:"light",text:b("callToAction.back"),size:14,className:fi.buttonLeft,onClick:x}),(p==null?void 0:p.length)>1!=""&&N.jsx(gn,{theme:"light",text:"Download All",size:14,className:fi.buttonRight,onClick:C}),c!=""&&N.jsx(gn,{theme:"light",text:"Download",size:14,className:fi.buttonRight,onClick:T})]})]})}const UOe="_buttonContainer_1fd4o_1",LOe="_buttonLeft_1fd4o_10",POe="_buttonRight_1fd4o_14",DOe="_buttonCenter_1fd4o_18",Iv={buttonContainer:UOe,buttonLeft:LOe,buttonRight:POe,buttonCenter:DOe},OOe="_button_13dfi_1",YO={button:OOe},NOe="Anon",kOe=()=>{ye.useContext(So);const[n]=$.useState(localStorage.getItem("name")||NOe),{model:e,characterManager:t}=ye.useContext(Zn),r=()=>{const o=Oe.mergeOptions_sel_option||0;return{createTextureAtlas:Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas,mToonAtlasSize:bn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:bn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:bn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:bn(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 N.jsxs($.Fragment,{children:[N.jsx(gn,{theme:"light",text:"GLB",icon:"download",size:14,className:YO.button,onClick:()=>{s()}}),N.jsx(gn,{theme:"light",text:"VRM",icon:"download",size:14,className:YO.button,onClick:i})]})};function QOe(){const{t:n}=ye.useContext(So),{playSound:e}=$.useContext(Ys),{isMute:t}=$.useContext(Ks),{setViewMode:r}=$.useContext(Di),i=()=>{r(mt.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(mt.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return N.jsxs("div",{className:Iv.container,children:[N.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),N.jsxs("div",{className:Iv.buttonContainer,children:[N.jsx(_g,{onFilesDrop:o}),N.jsx(gn,{theme:"light",text:n("callToAction.back"),size:14,className:Iv.buttonLeft,onClick:i}),N.jsx(m_,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),N.jsx(kOe,{}),N.jsx(gn,{theme:"light",text:"mint",size:14,className:Iv.buttonRight,onClick:s})]})]})}function HOe(){const{t:n}=ye.useContext(So),{setViewMode:e,setIsLoading:t,isLoading:r}=$.useContext(Di),{playSound:i}=$.useContext(Ys),{isMute:s}=$.useContext(Ks),{manifest:o,characterManager:a}=$.useContext(Zn);ye.useState([]);const[l,A]=ye.useState([]);ye.useEffect(()=>{c()},[]);const c=async()=>{const d=await B2();IDe(d,"the-anata-nft").then(g=>{A(g.nfts),console.log(g.nfts)})},u=()=>{e(mt.LANDING),!s&&i("backNextButton")},f=async d=>{t(!0),a.loadManifest(o[d].manifest).then(()=>{e(mt.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 N.jsxs("div",{className:`${ot.container} horizontalScroll`,children:[N.jsx("div",{className:"sectionTitle",children:n("pageTitles.chooseClass")}),N.jsx("div",{className:ot.vrmOptimizerButton}),N.jsx("div",{className:ot.topLine}),N.jsx("div",{className:ot.classContainer,children:l.map((d,g)=>N.jsxs("div",{className:ot.class,onClick:()=>f(g),onMouseOver:()=>p(),children:[N.jsx("div",{className:ot.classFrame,style:{backgroundImage:`url(${d.image_url})`},children:N.jsx("div",{className:ot.frameContainer,children:N.jsx("img",{src:"./assets/backgrounds/class-frame.svg",className:ot.frame})})}),N.jsx("div",{className:ot.name,children:d.name})]},g))}),N.jsx("div",{className:ot.bottomLine}),N.jsxs("div",{className:ot.buttonContainer,children:[N.jsx(gn,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:u}),N.jsx(gn,{theme:"light",text:"test",size:14,className:ot.buttonLeft,onClick:h})]})]})}const zOe=".//manifest.json",GOe=6,VOe=new Z(0,.8,0);new Z(-2.2367993753934425,1.1512971720174363,2.2612065299409223);async function jOe(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 WOe(){const n=await jOe(zOe),e=new Kpe;return{initialManifest:n,effectManager:e}}const KOe=()=>{let n,e;const r=WOe().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}}},YOe=KOe();function XOe(){const{initialManifest:n,effectManager:e}=YOe.read(),[t,r]=ye.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:A,showEnvironmentModels:c}=ye.useContext(Zn),{viewMode:u}=ye.useContext(Di);e.camera=i,e.scene=o;const f=()=>{e.camera&&(a({targetX:0,targetY:VOe.y,targetZ:0,distance:GOe}),s&&([mt.APPEARANCE,mt.SAVE,mt.OPTIMIZER,mt.BATCHDOWNLOAD,mt.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1))},[h,p]=ye.useState(!1),[d,g]=ye.useState(""),[m,y]=ye.useState([]),w=(C,T)=>{g(C),p(!0),y([T])},x={[mt.LANDING]:N.jsx(rOe,{}),[mt.APPEARANCE]:N.jsx(ePe,{confirmDialog:w}),[mt.OPTIMIZER]:N.jsx(FOe,{}),[mt.CREATE]:N.jsx(eOe,{}),[mt.WALLET]:N.jsx(HOe,{}),[mt.CLAIM]:N.jsx(qDe,{}),[mt.BATCHMANIFEST]:N.jsx(LDe,{}),[mt.BATCHDOWNLOAD]:N.jsx(IPe,{}),[mt.LOAD]:N.jsx(gOe,{}),[mt.MINT]:N.jsx(ROe,{}),[mt.SAVE]:N.jsx(QOe,{})};let _=0;return ye.useEffect(()=>{const C=T=>{const b=new Date().getTime(),M=b-_;M<300&&M>10&&T.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,[mt.LANDING,mt.CREATE,mt.CLAIM,mt.LOAD,mt.CLAIM,mt.CLAIM].includes(u)?c(!1):c(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[u,A]),ye.useEffect(()=>{l(n)},[n]),ye.useContext(So),N.jsxs(ye.Fragment,{children:[N.jsx("div",{className:"generalTitle",children:"Character Studio"}),N.jsx(ume,{confirmDialogText:d,confirmDialogCallback:m,confirmDialogWindow:h,setConfirmDialogWindow:p}),N.jsx(pme,{}),x[u]]})}const $Oe=n=>{const e=new LM(n);return e.pollingInterval=12e3,e};kB.createRoot(document.getElementById("root")).render(N.jsx($.StrictMode,{children:N.jsx(d7,{getLibrary:$Oe,children:N.jsx(BY,{children:N.jsx(Epe,{children:N.jsx(_Y,{children:N.jsx(rde,{children:N.jsx(tde,{children:N.jsx(fde,{children:N.jsx(ye.Suspense,{children:N.jsx(XOe,{})})})})})})})})})}));export{qo as c,bl as g}; + `),$.createElement("div",{style:c.white,className:"saturation-white"},$.createElement("div",{style:c.black,className:"saturation-black"}),$.createElement("div",{style:c.pointer},this.props.pointer?$.createElement(this.props.pointer,this.props):$.createElement("div",{style:c.circle}))))}}]),e}(ye.PureComponent||ye.Component);function _Re(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(GRe,arguments)},brighten:function(){return this._applyModification(VRe,arguments)},darken:function(){return this._applyModification(jRe,arguments)},desaturate:function(){return this._applyModification(QRe,arguments)},saturate:function(){return this._applyModification(HRe,arguments)},greyscale:function(){return this._applyModification(zRe,arguments)},spin:function(){return this._applyModification(WRe,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(XRe,arguments)},complement:function(){return this._applyCombination(KRe,arguments)},monochromatic:function(){return this._applyCombination($Re,arguments)},splitcomplement:function(){return this._applyCombination(YRe,arguments)},triad:function(){return this._applyCombination(qD,[3])},tetrad:function(){return this._applyCombination(qD,[4])}};tt.fromRatio=function(n,e){if(Yw(n)=="object"){var t={};for(var r in n)n.hasOwnProperty(r)&&(r==="a"?t[r]=n[r]:t[r]=Pp(n[r]));n=t}return tt(n,e)};function PRe(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=tFe(n)),Yw(n)=="object"&&(ka(n.r)&&ka(n.g)&&ka(n.b)?(e=DRe(n.r,n.g,n.b),o=!0,a=String(n.r).substr(-1)==="%"?"prgb":"rgb"):ka(n.h)&&ka(n.s)&&ka(n.v)?(r=Pp(n.s),i=Pp(n.v),e=NRe(n.h,r,i),o=!0,a="hsv"):ka(n.h)&&ka(n.s)&&ka(n.l)&&(r=Pp(n.s),s=Pp(n.l),e=ORe(n.h,r,s),o=!0,a="hsl"),n.hasOwnProperty("a")&&(t=n.a)),t=Mz(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 DRe(n,e,t){return{r:_n(n,255)*255,g:_n(e,255)*255,b:_n(t,255)*255}}function XD(n,e,t){n=_n(n,255),e=_n(e,255),t=_n(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 $D(n,e,t){n=_n(n,255),e=_n(e,255),t=_n(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 $Re(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=nFe(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 oM=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"},ZRe=tt.hexNames=JRe(oM);function JRe(n){var e={};for(var t in n)n.hasOwnProperty(t)&&(e[n[t]]=t);return e}function Mz(n){return n=parseFloat(n),(isNaN(n)||n<0||n>1)&&(n=1),n}function _n(n,e){qRe(n)&&(n="100%");var t=eFe(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 p_(n){return Math.min(1,Math.max(0,n))}function Vi(n){return parseInt(n,16)}function qRe(n){return typeof n=="string"&&n.indexOf(".")!=-1&&parseFloat(n)===1}function eFe(n){return typeof n=="string"&&n.indexOf("%")!=-1}function wo(n){return n.length==1?"0"+n:""+n}function Pp(n){return n<=1&&(n=n*100+"%"),n}function Sz(n){return Math.round(parseFloat(n)*255).toString(16)}function eO(n){return Vi(n)/255}var co=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 ka(n){return!!co.CSS_UNIT.exec(n)}function tFe(n){n=n.replace(URe,"").replace(LRe,"").toLowerCase();var e=!1;if(oM[n])n=oM[n],e=!0;else if(n=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var t;return(t=co.rgb.exec(n))?{r:t[1],g:t[2],b:t[3]}:(t=co.rgba.exec(n))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=co.hsl.exec(n))?{h:t[1],s:t[2],l:t[3]}:(t=co.hsla.exec(n))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=co.hsv.exec(n))?{h:t[1],s:t[2],v:t[3]}:(t=co.hsva.exec(n))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=co.hex8.exec(n))?{r:Vi(t[1]),g:Vi(t[2]),b:Vi(t[3]),a:eO(t[4]),format:e?"name":"hex8"}:(t=co.hex6.exec(n))?{r:Vi(t[1]),g:Vi(t[2]),b:Vi(t[3]),format:e?"name":"hex"}:(t=co.hex4.exec(n))?{r:Vi(t[1]+""+t[1]),g:Vi(t[2]+""+t[2]),b:Vi(t[3]+""+t[3]),a:eO(t[4]+""+t[4]),format:e?"name":"hex8"}:(t=co.hex3.exec(n))?{r:Vi(t[1]+""+t[1]),g:Vi(t[2]+""+t[2]),b:Vi(t[3]+""+t[3]),format:e?"name":"hex"}:!1}function nFe(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 tO=function(e){var t=["r","g","b","a","h","s","l","v"],r=0,i=0;return FRe(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},Dp=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}},XA=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()},qT=function(e){if(!e)return"#fff";var t=Dp(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"},wB=function(e,t){var r=e.replace("°","");return tt(t+" ("+r+")")._ok},Ap=Object.assign||function(n){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:"span";return function(r){cFe(i,r);function i(){var s,o,a,l;AFe(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&_Fe?new Xw: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 _v=24,VUe=Nz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?_v:r,s=n.height,o=s===void 0?_v:s,a=n.style,l=a===void 0?{}:a,A=GUe(n,["fill","width","height","style"]);return wO.default.createElement("svg",yO({viewBox:"0 0 "+_v+" "+_v,style:yO({fill:t,width:i,height:o},l)},A),wO.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"}))},jUe=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(vO(i.s)?r.props.hsl.s:i.s),l:Number(vO(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 jUe(e,[{key:"render",value:function(){var r=this,i=ht({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=$.createElement("div",{style:i.fields,className:"flexbox-fix"},$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"hex",value:this.props.hex,onChange:this.handleChange}))):this.state.view==="rgb"?s=$.createElement("div",{style:i.fields,className:"flexbox-fix"},$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"r",value:this.props.rgb.r,onChange:this.handleChange})),$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"g",value:this.props.rgb.g,onChange:this.handleChange})),$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"b",value:this.props.rgb.b,onChange:this.handleChange})),$.createElement("div",{style:i.alpha},$.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=$.createElement("div",{style:i.fields,className:"flexbox-fix"},$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"h",value:Math.round(this.props.hsl.h),onChange:this.handleChange})),$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"s",value:Math.round(this.props.hsl.s*100)+"%",onChange:this.handleChange})),$.createElement("div",{style:i.field},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"l",value:Math.round(this.props.hsl.l*100)+"%",onChange:this.handleChange})),$.createElement("div",{style:i.alpha},$.createElement(Pt,{style:{input:i.input,label:i.label},label:"a",value:this.props.hsl.a,arrowOffset:.01,onChange:this.handleChange})))),$.createElement("div",{style:i.wrap,className:"flexbox-fix"},s,$.createElement("div",{style:i.toggle},$.createElement("div",{style:i.icon,onClick:this.toggleViews,ref:function(a){return r.icon=a}},$.createElement(VUe,{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}($.Component);kz.defaultProps={view:"hex"};var xO=function(){var e=ht({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 $.createElement("div",{style:e.picker})},XUe=function(){var e=ht({default:{picker:{width:"12px",height:"12px",borderRadius:"6px",boxShadow:"inset 0 0 0 1px #fff",transform:"translate(-6px, -6px)"}}});return $.createElement("div",{style:e.picker})},s2=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=ht(Oi({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 $.createElement("div",{style:d.picker,className:"chrome-picker "+h},$.createElement("div",{style:d.saturation},$.createElement(d_,{style:d.Saturation,hsl:o,hsv:a,pointer:XUe,onChange:r})),$.createElement("div",{style:d.body},$.createElement("div",{style:d.controls,className:"flexbox-fix"},$.createElement("div",{style:d.color},$.createElement("div",{style:d.swatch},$.createElement("div",{style:d.active}),$.createElement(hd,{renderers:A}))),$.createElement("div",{style:d.toggles},$.createElement("div",{style:d.hue},$.createElement(dd,{style:d.Hue,hsl:o,pointer:xO,onChange:r})),$.createElement("div",{style:d.alpha},$.createElement(jT,{style:d.Alpha,rgb:s,hsl:o,pointer:xO,renderers:A,onChange:r})))),$.createElement(kz,{rgb:s,hsl:o,hex:l,view:p,onChange:r,disableAlpha:i})))};s2.propTypes={width:Qe.oneOfType([Qe.string,Qe.number]),disableAlpha:Qe.bool,styles:Qe.object,defaultView:Qe.oneOf(["hex","rgb","hsl"])};s2.defaultProps={width:225,disableAlpha:!1,styles:{}};const $Ue=Ni(s2);var ZUe=function(e){var t=e.color,r=e.onClick,i=r===void 0?function(){}:r,s=e.onSwatchHover,o=e.active,a=ht({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:qT(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 $.createElement(fu,{style:a.color,color:t,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},$.createElement("div",{style:a.dot}))},JUe=function(e){var t=e.hex,r=e.rgb,i=e.onChange,s=ht({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 $.createElement("div",{style:s.fields,className:"flexbox-fix"},$.createElement("div",{style:s.active}),$.createElement(Pt,{style:{wrap:s.HEXwrap,input:s.HEXinput,label:s.HEXlabel},label:"hex",value:t,onChange:o}),$.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"r",value:r.r,onChange:o}),$.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"g",value:r.g,onChange:o}),$.createElement(Pt,{style:{wrap:s.RGBwrap,input:s.RGBinput,label:s.RGBlabel},label:"b",value:r.b,onChange:o}))},o2=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=ht(Oi({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?XA(p.hex)&&t({hex:p.hex,source:"hex"},d):t(p,d)};return $.createElement(Rg,{style:u.Compact,styles:l},$.createElement("div",{style:u.compact,className:"compact-picker "+c},$.createElement("div",null,hu(i,function(h){return $.createElement(ZUe,{key:h,color:h,active:h.toLowerCase()===s,onClick:f,onSwatchHover:r})}),$.createElement("div",{style:u.clear})),$.createElement(JUe,{hex:s,rgb:o,onChange:f})))};o2.propTypes={colors:Qe.arrayOf(Qe.string),styles:Qe.object};o2.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:{}};Ni(o2);var qUe=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=ht({default:{swatch:{width:"25px",height:"25px",fontSize:"0"}},hover:{swatch:o}},{hover:t});return $.createElement("div",{style:a.swatch},$.createElement(fu,{color:r,onClick:i,onHover:s,focusStyle:o}))};const eLe=VT(qUe);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=ht(Oi({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 $.createElement("div",{style:u.card,className:"github-picker "+c},$.createElement("div",{style:u.triangleShadow}),$.createElement("div",{style:u.triangle}),hu(r,function(h){return $.createElement(eLe,{color:h,key:h,onClick:f,onSwatchHover:s})}))};a2.propTypes={width:Qe.oneOfType([Qe.string,Qe.number]),colors:Qe.arrayOf(Qe.string),triangle:Qe.oneOf(["hide","top-left","top-right","bottom-left","bottom-right"]),styles:Qe.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:{}};Ni(a2);var tLe=function(e){var t=e.direction,r=ht({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 $.createElement("div",{style:r.picker})},nLe=Object.assign||function(n){for(var e=1;e.5});return $.createElement("div",{style:r.picker})},oLe=function(){var e=ht({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 $.createElement("div",{style:e.pointer},$.createElement("div",{style:e.left},$.createElement("div",{style:e.leftInside})),$.createElement("div",{style:e.right},$.createElement("div",{style:e.rightInside})))},_O=function(e){var t=e.onClick,r=e.label,i=e.children,s=e.active,o=ht({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 $.createElement("div",{style:o.button,onClick:t},r||i)},aLe=function(e){var t=e.rgb,r=e.currentColor,i=ht({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 $.createElement("div",null,$.createElement("div",{style:i.label},"new"),$.createElement("div",{style:i.swatches},$.createElement("div",{style:i.new}),$.createElement("div",{style:i.current})),$.createElement("div",{style:i.label},"current"))},lLe=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 $.createElement("div",{style:a.fields,className:"flexbox-fix"},$.createElement("div",{style:a.double},$.createElement(Pt,{style:{input:a.input,label:a.label},label:"hex",value:s.replace("#",""),onChange:l})),$.createElement("div",{style:a.single},$.createElement(Pt,{style:{input:a.input,label:a.label},label:"r",value:r.r,onChange:l,dragLabel:"true",dragMax:"255"})),$.createElement("div",{style:a.single},$.createElement(Pt,{style:{input:a.input,label:a.label},label:"g",value:r.g,onChange:l,dragLabel:"true",dragMax:"255"})),$.createElement("div",{style:a.single},$.createElement(Pt,{style:{input:a.input,label:a.label},label:"b",value:r.b,onChange:l,dragLabel:"true",dragMax:"255"})),$.createElement("div",{style:a.alpha},$.createElement(Pt,{style:{input:a.input,label:a.label},label:"a",value:Math.round(r.a*100),onChange:l,dragLabel:"true",dragMax:"100"})))},hLe=Object.assign||function(n){for(var e=1;e=0||Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t}var bv=24,wLe=Hz.default=function(n){var e=n.fill,t=e===void 0?"currentColor":e,r=n.width,i=r===void 0?bv:r,s=n.height,o=s===void 0?bv:s,a=n.style,l=a===void 0?{}:a,A=yLe(n,["fill","width","height","style"]);return BO.default.createElement("svg",bO({viewBox:"0 0 "+bv+" "+bv,style:bO({fill:t,width:i,height:o},l)},A),BO.default.createElement("path",{d:"M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"}))},xLe=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=ht({default:{color:{width:"40px",height:"24px",cursor:"pointer",background:t,marginBottom:"1px"},check:{color:qT(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 $.createElement(fu,{color:t,style:A.color,onClick:i,onHover:s,focusStyle:{boxShadow:"0 0 4px "+t}},$.createElement("div",{style:A.check},$.createElement(wLe,null)))},_Le=function(e){var t=e.onClick,r=e.onSwatchHover,i=e.group,s=e.active,o=ht({default:{group:{paddingBottom:"10px",width:"40px",float:"left",marginRight:"10px"}}});return $.createElement("div",{style:o.group},hu(i,function(a,l){return $.createElement(xLe,{key:a,color:a,active:a.toLowerCase()===s,first:l===0,last:l===i.length-1,onClick:t,onSwatchHover:r})}))},f2=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=ht(Oi({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 $.createElement("div",{style:f.picker,className:"swatches-picker "+u},$.createElement(Rg,null,$.createElement("div",{style:f.overflow},$.createElement("div",{style:f.body},hu(o,function(p){return $.createElement(_Le,{key:p.toString(),group:p,active:a,onClick:h,onSwatchHover:s})}),$.createElement("div",{style:f.clear})))))};f2.propTypes={width:Qe.oneOfType([Qe.string,Qe.number]),height:Qe.oneOfType([Qe.string,Qe.number]),colors:Qe.arrayOf(Qe.arrayOf(Qe.string)),styles:Qe.object};f2.defaultProps={width:320,height:240,colors:[[rf[900],rf[700],rf[500],rf[300],rf[100]],[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]],["#194D33",Op[700],Op[500],Op[300],Op[100]],[hf[900],hf[700],hf[500],hf[300],hf[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]],["#000000","#525252","#969696","#D9D9D9","#FFFFFF"]],styles:{}};Ni(f2);var h2=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=ht(Oi({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){XA(d)&&t({hex:d,source:"hex"},g)};return $.createElement("div",{style:f.card,className:"twitter-picker "+u},$.createElement("div",{style:f.triangleShadow}),$.createElement("div",{style:f.triangle}),$.createElement("div",{style:f.body},hu(s,function(p,d){return $.createElement(fu,{key:d,color:p,hex:p,style:f.swatch,onClick:h,onHover:r,focusStyle:{boxShadow:"0 0 4px "+p}})}),$.createElement("div",{style:f.hash},"#"),$.createElement(Pt,{label:null,style:{input:f.input},value:i.replace("#",""),onChange:h}),$.createElement("div",{style:f.clear})))};h2.propTypes={width:Qe.oneOfType([Qe.string,Qe.number]),triangle:Qe.oneOf(["hide","top-left","top-right"]),colors:Qe.arrayOf(Qe.string),styles:Qe.object};h2.defaultProps={width:276,colors:["#FF6900","#FCB900","#7BDCB5","#00D084","#8ED1FC","#0693E3","#ABB8C3","#EB144C","#F78DA7","#9900EF"],triangle:"top-left",styles:{}};Ni(h2);var d2=function(e){var t=ht({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 $.createElement("div",{style:t.picker})};d2.propTypes={hsl:Qe.shape({h:Qe.number,s:Qe.number,l:Qe.number,a:Qe.number})};d2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var p2=function(e){var t=ht({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 $.createElement("div",{style:t.picker})};p2.propTypes={hsl:Qe.shape({h:Qe.number,s:Qe.number,l:Qe.number,a:Qe.number})};p2.defaultProps={hsl:{a:1,h:249.94,l:.2,s:.5}};var bLe=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)XA(h.hex)&&t({hex:h.hex,source:"hex"},p);else if(h.rgb){var d=h.rgb.split(",");wB(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(",");wB(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(",");wB(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=ht({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 $.createElement("div",{style:l.wrap,className:"flexbox-fix"},$.createElement("div",{style:l.fields},$.createElement("div",{style:l.double},$.createElement(Pt,{style:{input:l.input,label:l.label},label:"hex",value:s,onChange:a})),$.createElement("div",{style:l.column},$.createElement("div",{style:l.single},$.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"rgb",value:A,onChange:a})),$.createElement("div",{style:l.single},$.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsv",value:u,onChange:a})),$.createElement("div",{style:l.single},$.createElement(Pt,{style:{input:l.input2,label:l.label2},label:"hsl",value:c,onChange:a})))))},m2=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=ht(Oi({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 $.createElement("div",{style:h.picker,className:"google-picker "+f},$.createElement("div",{style:h.head},l),$.createElement("div",{style:h.swatch}),$.createElement("div",{style:h.saturation},$.createElement(d_,{hsl:s,hsv:o,pointer:d2,onChange:r})),$.createElement("div",{style:h.body},$.createElement("div",{style:h.controls,className:"flexbox-fix"},$.createElement("div",{style:h.hue},$.createElement(dd,{style:h.Hue,hsl:s,radius:"4px",pointer:p2,onChange:r}))),$.createElement(bLe,{rgb:i,hsl:s,hex:a,hsv:o,onChange:r})))};m2.propTypes={width:Qe.oneOfType([Qe.string,Qe.number]),styles:Qe.object,header:Qe.string};m2.defaultProps={width:652,styles:{},header:"Color picker"};Ni(m2);const BLe="_InformationContainerPos_1yd4c_2",ELe="_scrollContainer_1yd4c_15",_B={InformationContainerPos:BLe,scrollContainer:ELe,"options-container":"_options-container_1yd4c_24"},CLe="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=",MLe="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==",SLe="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==",TLe="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",ILe="_InformationContainerPos_1m76y_2",RLe="_scrollContainer_1m76y_15",FLe="_centerAlign_1m76y_25",ULe="_traitInfoTitle_1m76y_28",LLe="_dropdownFlex_1m76y_38",PLe="_checkboxFlex_1m76y_44",DLe="_simpleFlex_1m76y_49",OLe="_traitInfoText_1m76y_55",NLe="_dropdownBase_1m76y_64",kLe="_dropdownControl_1m76y_74",QLe="_dropdownControlSmall_1m76y_80",HLe="_flexSelect_1m76y_106",zLe="_checked_1m76y_163",GLe="_checkmark_1m76y_167",VLe="_checkboxHolder_1m76y_180",jLe="_actionButton_1m76y_189",WLe="_tabHolder_1m76y_209",KLe="_tabButton_1m76y_215",YLe="_tabButtonSelected_1m76y_235",je={InformationContainerPos:ILe,scrollContainer:RLe,centerAlign:FLe,traitInfoTitle:ULe,dropdownFlex:LLe,checkboxFlex:PLe,simpleFlex:DLe,traitInfoText:OLe,dropdownBase:NLe,dropdownControl:kLe,dropdownControlSmall:QLe,"input-box":"_input-box_1m76y_87",flexSelect:HLe,"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:zLe,checkmark:GLe,checkboxHolder:VLe,actionButton:jLe,tabHolder:WLe,tabButton:KLe,tabButtonSelected:YLe},XLe="_slider_1y6nx_1",$Le="_infoContainer_1y6nx_13",Bv={"slider-container":"_slider-container_1y6nx_1",slider:XLe,infoContainer:$Le,"input-box":"_input-box_1y6nx_18"};function Kf({title:n,value:e,min:t,max:r,onChange:i,step:s,stepBox:o}){return k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:Bv.infoContainer,children:[n,o&&k.jsx("input",{type:"number",min:"0",max:"100",value:e,onChange:i,className:Bv["input-box"],step:o})]}),k.jsx("div",{className:Bv["slider-container"],children:k.jsx("input",{type:"range",min:t,max:r,value:e,onChange:i,className:Bv.slider,step:s})})]})}function ZLe({selectedTrait:n,selectedVRM:e}){const{animationManager:t,characterManager:r}=ye.useContext(Zn),[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:je.InformationContainerPos,children:[k.jsx(va,{title:"Trait Information",width:180,right:20}),k.jsx("div",{className:je.scrollContainer,children:n!=null?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:je.traitInfoTitle,children:"Trait ID"}),k.jsx("div",{className:je.traitInfoText,children:n==null?void 0:n.id}),k.jsx("div",{className:je.traitInfoTitle,children:"Trait Name"}),k.jsx("div",{className:je.traitInfoText,children:n==null?void 0:n.name}),k.jsx("div",{className:je.traitInfoTitle,children:"Description"}),k.jsx("div",{className:je.traitInfoText,children:(n==null?void 0:n.description)||"A nice "+(n==null?void 0:n.name)}),k.jsx("div",{className:je.traitInfoTitle,children:"Culling Options"}),k.jsx("br",{}),k.jsxs("div",{className:je.traitInfoText,children:["Culling Layer",k.jsx("input",{type:"number",min:"0",max:"100",value:l,onChange:f,className:je["input-box"],step:1}),k.jsx("br",{}),k.jsx("br",{}),k.jsx(Kf,{title:"Out Distance",value:i,onChange:c,min:0,max:1,step:.001,stepBox:.01}),k.jsx("br",{}),k.jsx(Kf,{title:"In Distance",value:o,onChange:u,min:0,max:1,step:.001,stepBox:.01}),k.jsx("div",{className:je.actionButton,onClick:h,children:k.jsx("div",{children:"Update Culling "})})]})]}):k.jsx(k.Fragment,{children:k.jsx("div",{className:je.traitInfoTitle,children:"No Trait Selected"})})})]})})}var zz={};(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=s(ye),t=r(B8);function r(B){return B&&B.__esModule?B:{default:B}}function i(){if(typeof WeakMap!="function")return null;var B=new WeakMap;return i=function(){return B},B}function s(B){if(B&&B.__esModule)return B;if(B===null||o(B)!=="object"&&typeof B!="function")return{default:B};var T=i();if(T&&T.has(B))return T.get(B);var b={},M=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var O in B)if(Object.prototype.hasOwnProperty.call(B,O)){var Y=M?Object.getOwnPropertyDescriptor(B,O):null;Y&&(Y.get||Y.set)?Object.defineProperty(b,O,Y):b[O]=B[O]}return b.default=B,T&&T.set(B,b),b}function o(B){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(B)}function a(){return a=Object.assign||function(B){for(var T=1;T"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(T,[{key:"componentDidUpdate",value:function(M){if(this.props.value!==M.value)if(this.props.value){var O=this.parseValue(this.props.value,this.props.options);O!==this.state.selected&&this.setState({selected:O})}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,O){var Y;if(typeof M=="string")for(var H=0,I=O.length;H"u"&&(Y=M.label||M);var H=M.label||M.value||M,I=Y===this.state.selected.value||Y===this.state.selected,v=(O={},c(O,"".concat(this.props.baseClassName,"-option"),!0),c(O,M.className,!!M.className),c(O,"is-selected",I),O),E=(0,t.default)(v),L=Object.keys(M.data||{}).reduce(function(U,P){return A({},U,c({},"data-".concat(P),M.data[P]))},{});return e.default.createElement("div",a({key:Y,className:E,onMouseDown:this.setValue.bind(this,Y,H),onClick:this.setValue.bind(this,Y,H),role:"option","aria-selected":I?"true":"false"},L),H)}},{key:"buildMenu",value:function(){var M=this,O=this.props,Y=O.options,H=O.baseClassName,I=Y.map(function(v){if(v.type==="group"){var E=e.default.createElement("div",{className:"".concat(H,"-title")},v.name),L=v.items.map(function(U){return M.renderOption(U)});return e.default.createElement("div",{className:"".concat(H,"-group"),key:v.name,role:"listbox",tabIndex:"-1"},E,L)}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,O,Y,H,I,v=this.props,E=v.baseClassName,L=v.controlClassName,U=v.placeholderClassName,P=v.menuClassName,z=v.arrowClassName,W=v.arrowClosed,N=v.arrowOpen,C=v.className,j=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,C,!!C),c(M,"is-open",this.state.isOpen),M)),X=(0,t.default)((O={},c(O,"".concat(E,"-control"),!0),c(O,L,!!L),c(O,j,!!j),O)),ue=(0,t.default)((Y={},c(Y,"".concat(E,"-placeholder"),!0),c(Y,U,!!U),c(Y,"is-selected",this.isValueSelected()),Y)),re=(0,t.default)((H={},c(H,"".concat(E,"-menu"),!0),c(H,P,!!P),H)),fe=(0,t.default)((I={},c(I,"".concat(E,"-arrow"),!0),c(I,z,!!z),I)),oe=e.default.createElement("div",{className:ue},ee),pe=this.state.isOpen?e.default.createElement("div",{className:re,"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"},oe,e.default.createElement("div",{className:"".concat(E,"-arrow-wrapper")},N&&W?this.state.isOpen?N:W:e.default.createElement("span",{className:fe}))),pe)}}]),T}(e.Component);x.defaultProps={baseClassName:"Dropdown"};var _=x;n.default=_})(zz);const Jl=bl(zz);function JLe({selectedTrait:n,selectedVRM:e}){const{manifest:t,loraDataGenerator:r,sceneElements:i}=$.useContext(Zn),[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:je.InformationContainerPos,children:[k.jsx(va,{title:"Lora Creation",width:180,right:20}),k.jsxs("div",{className:je.scrollContainer,children:[k.jsx("div",{className:je.traitInfoTitle,children:"Lora Manifests"}),k.jsx(Jl,{className:je.dropdownControl,options:s,onChange:A,placeholder:"Select an option"}),";",k.jsx("div",{className:je.traitInfoText,children:(a==null?void 0:a.description)||""}),a!=null&&k.jsx("div",{className:je.actionButton,onClick:c,children:k.jsx("div",{children:" Create Lora Data "})})]})]})})}function qLe({selectedTrait:n,selectedVRM:e}){const{manifest:t,spriteAtlasGenerator:r,sceneElements:i}=$.useContext(Zn),[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:je.InformationContainerPos,children:[k.jsx(va,{title:"Sprite Creation",width:180,right:20}),k.jsxs("div",{className:je.scrollContainer,children:[k.jsx("div",{className:je.traitInfoTitle,children:"Sprite Manifests"}),k.jsx(Jl,{className:je.dropdownControl,options:s,onChange:u,placeholder:"Select an option"}),";",k.jsx("div",{className:je.traitInfoText,children:a||""}),A!=null&&k.jsx("div",{className:je.actionButton,onClick:f,children:k.jsx("div",{children:" Create Sprite Data "})})]})]})})}const EO=4096;function ePe({selectedTrait:n,traitGroupName:e}){const{manifest:t,thumbnailsGenerator:r,sceneElements:i,characterManager:s}=$.useContext(Zn),[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),[B,T]=ye.useState(.1),[b,M]=ye.useState("center"),[O,Y]=ye.useState("center"),[H,I]=ye.useState("center"),[v,E]=ye.useState("head"),[L,U]=ye.useState("chest"),[P,z]=ye.useState(!0),[W,N]=ye.useState(!1),C=[{label:"center"},{label:"left"},{label:"right"}],j=[{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=le=>{(t==null?void 0:t.thumbnails)!=null&&(A(t.thumbnails[le.value].description),h(t.thumbnails[le.value].manifest),u(t.thumbnails[le.value].name))},ue=(le,q,J,ce)=>isNaN(le)?ce:le>J?J:le{const q=parseInt(le.target.value);m(ue(q,1,EO,512))},fe=le=>{const q=parseInt(le.target.value);w(ue(q,1,EO,512))},oe=le=>{const q=parseFloat(le.target.value);_(ue(q,0,1,.1))},pe=le=>{const q=parseFloat(le.target.value);T(ue(q,0,1,.1))},xe=le=>{d(le)},_e=async()=>{const le=i.parent;le.remove(i),await r.createThumbnails(t.thumbnails[0]),le.add(i)},D=(le=!0)=>({topFrameOffset:B,bottomFrameOffset:x,thumbnailsWidth:g,thumbnailsHeight:y,backgroundColor:[0,0,0,0],thumbnailsCollection:[{traitGroup:e,cameraPosition:O+"-"+H+"-"+b,topBoneName:v==="upperLeg"||v==="lowerLeg"||v==="foot"?"left"+v[0].toUpperCase()+v.slice(1):v,topBoneMaxVertex:P,bottomBoneName:L==="upperLeg"||L==="lowerLeg"||v==="foot"?"left"+L[0].toUpperCase()+L.slice(1):L,bottomBoneMaxVertex:W,saveOnlyIDs:le?null:n.id}]}),Ae=async(le=!1)=>{s.storeCurrentAvatar();const q=i.parent;q.remove(i),le?await r.createThumbnailsWithObjectData(D(),!1,null,e+"_thumbnails"):await r.createThumbnailsWithObjectData(D(!1),!1),q.add(i),s.loadStoredAvatar()};return ye.useEffect(()=>{if((t==null?void 0:t.thumbnails)!=null){const le=t.thumbnails.map((q,J)=>({value:J,label:q.name,description:q.description,manifest:q.manifest}));a(le)}},[t]),k.jsx("div",{children:k.jsxs("div",{className:je.InformationContainerPos,children:[k.jsx(va,{title:"Thumbnail Creation",width:180,right:20}),k.jsxs("div",{className:je.scrollContainer,children:[k.jsxs("div",{className:je.tabHolder,children:[k.jsx("div",{className:je.tabButton+(p?"":" "+je.tabButtonSelected),onClick:()=>{xe(!1)},children:k.jsxs("div",{children:[" ","Custom"," "]})}),k.jsx("div",{className:je.tabButton+(p?" "+je.tabButtonSelected:""),onClick:()=>{xe(!0)},children:k.jsxs("div",{children:[" ","Manifest"," "]})})]}),k.jsx("br",{}),p?k.jsxs(k.Fragment,{children:[k.jsx("div",{className:je.traitInfoTitle+" "+je.centerAlign,children:"Thumbnail Manifests"}),k.jsx(Jl,{className:je.dropdownControl,options:o,value:c,onChange:X,placeholder:"Select an option"}),";",k.jsx("div",{className:je.traitInfoText,children:l||""}),f!=""&&k.jsx("div",{className:je.actionButton,onClick:_e,children:k.jsx("div",{children:" Create Thumbnails "})})]}):k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:je.traitInfoText,children:[k.jsx("div",{className:je.traitInfoTitle+" "+je.centerAlign,style:{margin:"10px 0px 10px"},children:"Resolution"}),"Width ",k.jsx("input",{value:g,className:je["input-box"],step:1,onChange:le=>{m(le.target.value)},onBlur:re}),k.jsx("br",{}),"Height ",k.jsx("input",{value:y,className:je["input-box"],step:1,onChange:le=>{w(le.target.value)},onBlur:fe}),k.jsx("br",{}),"Top Spacing ",k.jsx("input",{value:x,className:je["input-box"],step:.1,onChange:le=>{_(le.target.value)},onBlur:oe}),k.jsx("br",{}),"Bottom Spacing ",k.jsx("input",{value:B,className:je["input-box"],step:.1,onChange:le=>{T(le.target.value)},onBlur:pe}),k.jsx("br",{}),k.jsx("div",{className:je.traitInfoTitle+" "+je.centerAlign,style:{margin:"20px"},children:"Camera Position"})]}),k.jsxs("div",{className:je.dropdownFlex,children:[k.jsx("div",{className:je.traitInfoTitle,style:{margin:"0px"},children:"X"}),k.jsx(Jl,{className:je.dropdownControlSmall,options:C,onChange:le=>{Y(le.label)},value:O})]}),k.jsxs("div",{className:je.dropdownFlex,children:[k.jsx("div",{className:je.traitInfoTitle,style:{margin:"0px"},children:"Y"}),k.jsx(Jl,{className:je.dropdownControlSmall,options:j,onChange:le=>{I(le.label)},value:H})]}),k.jsxs("div",{className:je.dropdownFlex,children:[k.jsx("div",{className:je.traitInfoTitle,style:{margin:"0px"},children:"Z"}),k.jsx(Jl,{className:je.dropdownControlSmall,options:ee,onChange:le=>{M(le.label)},value:b})]}),k.jsx("div",{className:je.traitInfoTitle+" "+je.centerAlign,style:{margin:"30px 0px 30px"},children:"Target Bones"}),k.jsxs("div",{className:je.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:je.traitInfoTitle,style:{margin:"0px"},children:"Top"}),k.jsx(Jl,{className:je.dropdownControlSmall,options:F,onChange:le=>{E(le.label)},value:v})]}),k.jsxs("div",{className:je.dropdownFlex,style:{justifyContent:"space-between"},children:[k.jsx("div",{className:je.traitInfoTitle,style:{margin:"0px"},children:"Bottom"}),k.jsx(Jl,{className:je.dropdownControlSmall,options:F,onChange:le=>{U(le.label)},value:L})]}),k.jsxs("div",{style:{textAlign:"left"},children:[k.jsxs("div",{className:je.checkboxFlex,style:{marginTop:"20px"},children:[k.jsx("input",{type:"checkbox",checked:P,onChange:le=>{z(le.target.checked)}}),k.jsx("div",{className:je.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Top bone ${P?"uses Top":"uses Low"} Vertex`})]}),k.jsxs("div",{className:je.checkboxFlex,style:{marginTop:"10px"},children:[k.jsx("input",{type:"checkbox",checked:W,onChange:le=>{N(le.target.checked)}}),k.jsx("div",{className:je.traitInfoText,style:{margin:"0px",fontSize:"12px"},children:`Bottom bone ${W?"uses Top":"uses Low"} Vertex`})]})]}),e==""?k.jsx("div",{className:je.traitInfoText+" "+je.centerAlign,style:{marginTop:"40px"},children:"Please choose a trait category in the left side menu."}):k.jsxs(k.Fragment,{children:[k.jsx("div",{className:je.traitInfoTitle+" "+je.centerAlign,style:{marginTop:"20px"},children:"Generate"}),k.jsx("div",{className:je.traitInfoText+" "+je.centerAlign,style:{margin:"0px auto 20px"},children:"( "+e+" )"}),k.jsxs("div",{className:je.simpleFlex,style:{marginTop:"0px"},children:[k.jsx("div",{className:je.actionButton,style:{margin:"0px"},onClick:()=>{Ae(!1)},children:k.jsx("div",{children:" Current "})}),k.jsx("div",{className:je.actionButton,style:{margin:"0px"},onClick:()=>{Ae(!0)},children:k.jsx("div",{children:" All "})})]})]})]})]})]})})}function tPe({selectedTrait:n,selectedVRM:e,traitGroupName:t}){const[r,i]=$.useState(""),s=o=>{o!=r?i(o):i("")};return k.jsxs("div",{children:[r=="Information"&&k.jsx(ZLe,{selectedTrait:n,selectedVRM:e}),r=="LoraCreation"&&k.jsx(JLe,{selectedTrait:n,selectedVRM:e}),r=="SpriteCreation"&&k.jsx(qLe,{selectedTrait:n,selectedVRM:e}),r=="ThumbnailCreation"&&k.jsx(ePe,{selectedTrait:n,traitGroupName:t}),k.jsxs("div",{className:_B.InformationContainerPos,children:[k.jsx(va,{title:"Tools",width:90,right:0}),k.jsx("div",{className:_B.scrollContainer,children:k.jsxs("div",{className:_B.optionsContainer,children:[k.jsx("div",{onClick:()=>{s("Information")},children:k.jsx(il,{size:56,icon:CLe,rarity:r=="Information"?"mythic":"none"})},"Information"),k.jsx("div",{onClick:()=>{s("LoraCreation")},children:k.jsx(il,{size:56,icon:SLe,rarity:r=="LoraCreation"?"mythic":"none"})},"LoraCreation"),k.jsx("div",{onClick:()=>{s("SpriteCreation")},children:k.jsx(il,{size:56,icon:MLe,rarity:r=="SpriteCreation"?"mythic":"none"})},"SpriteCreation"),k.jsx("div",{onClick:()=>{s("ThumbnailCreation")},children:k.jsx(il,{size:56,icon:TLe,rarity:r=="ThumbnailCreation"?"mythic":"none"})},"ThumbnailCreation")]})})]})]})}const Qa={TRAIT:0,BLEND_SHAPE:1};function nPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=$.useContext(Di),{toggleDebugMode:r,characterManager:i,animationManager:s,moveCamera:o,loraDataGenerator:a,spriteAtlasGenerator:l,thumbnailsGenerator:A,sceneElements:c}=$.useContext(Zn),[u,f]=$.useState(Qa.TRAIT),{playSound:h}=$.useContext(Ys),{isMute:p}=$.useContext(Ks),{t:d}=ye.useContext(So),g=()=>{!p&&h("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),e(mt.CREATE),r(!1)},[m,y]=$.useState(null),[w,x]=$.useState(null),[_,B]=$.useState(""),[T,b]=$.useState(null),[M,O]=$.useState({}),[Y,H]=$.useState(null),[I,v]=$.useState(""),[E,L]=$.useState(!1),[U,P]=$.useState({background:"#ffffff"}),z=()=>{!p&&h("backNextButton"),e(mt.SAVE),r(!1)},W=()=>{t(!0),y(null),i.loadRandomTraits().then(()=>{console.log("success"),_!=""&&b(i.getCurrentTraitData(_)),t(!1)}).catch(_e=>{t(!1),console.error("Error loading random traits:",_e.message)})},N=_e=>{P({background:_e.hex})},C=_e=>{P({background:_e.hex}),i.setTraitColor(_,_e.hex)},j=async _e=>{const D=cl(_e.name),Ae=URL.createObjectURL(_e);await s.loadAnimation(Ae,!1,0,!0,"",D),v(s.getCurrentAnimationName())},ee=_e=>{if(L(!1),_!=""){t(!0);const D=URL.createObjectURL(_e);i.loadCustomTexture(_,D).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},F=_e=>{if(L(!1),_!=""){t(!0);const D=URL.createObjectURL(_e);i.loadCustomTrait(_,D).then(()=>{t(!1)})}else console.warn("Please select a group trait first.")},X=_e=>{var D;if(_e.id===(T==null?void 0:T.id)){((D=_e.blendshapeTraits)==null?void 0:D.length)>0&&f(Qa.BLEND_SHAPE);return}L(!1),t(!0),i.loadTrait(_e.traitGroup.trait,_e.id).then(()=>{var Ae;if(t(!1),((Ae=_e.blendshapeTraits)==null?void 0:Ae.length)>0){const le=i.getCurrentBlendShapeTraitData(_e.traitGroup.trait);O(Object.entries(le).reduce((q,[J,ce])=>(q[J]=ce.id,q),{})),f(Qa.BLEND_SHAPE)}b(_e)})},ue=_e=>{L(!1),i.removeTrait(_e),b(null)},re=_e=>{L(!1),t(!0),i.loadRandomTrait(_e).then(()=>{t(!1),b(i.getCurrentTraitData(_e))})},fe=_e=>{L(!1);const D=Array.from(_e),Ae=[],le=q=>new Promise((J,ce)=>{var be;if(q&&q.name.toLowerCase().endsWith(".json")){const Be=new FileReader,Q=`${(be=i.manifestData)==null?void 0:be.getAssetsDirectory()}/anata/_thumbnails/t_${q.name.split("_")[0]}.jpg`;console.log(Q),Be.onload=function(K){try{const ie=JSON.parse(K.target.result);ie.thumb=Q,Ae.push(ie),J()}catch(ie){console.error("Error parsing the JSON file:",ie),ce(ie)}},Be.readAsText(q)}});Promise.all(D.map(le)).then(()=>{Ae.length>0&&(y(Ae),t(!0),i.loadTraitsFromNFTObject(Ae[0]).then(()=>{t(!1)}))}).catch(q=>{console.error("Error processing files:",q)})},oe=async _e=>{const D=_e[0];D&&D.name.toLowerCase().endsWith(".fbx")&&j(D),D&&(D.name.toLowerCase().endsWith(".png")||D.name.toLowerCase().endsWith(".jpg"))&&ee(D),D&&D.name.toLowerCase().endsWith(".vrm")&&F(D),D&&D.name.toLowerCase().endsWith(".json")&&fe(_e)},pe=_e=>{if(!p&&h("optionClick"),L(!1),_!==_e.trait){f(Qa.TRAIT),x(i.getTraits(_e.trait)),B(_e.trait);const D=i.getCurrentTraitData(_e.trait),Ae=i.getCurrentBlendShapeTraitData(_e.trait);b(D),O(Object.entries(Ae).reduce((le,[q,J])=>(le[q]=J.id,le),{})),H(i.getCurrentTraitVRM(_e.trait)),o({targetY:_e.cameraTarget.height,distance:_e.cameraTarget.distance})}else x(null),B(""),b(null),O({}),o({targetY:.8,distance:3.2})},xe=()=>{L(!1);var _e=document.createElement("input");_e.type="file",_e.accept=".vrm",_e.onchange=D=>{var Ae=D.target.files[0];if(Ae.name.endsWith(".vrm")){const le=URL.createObjectURL(Ae);t(!0),i.loadCustomTrait(_,le).then(()=>{t(!1)})}},_e.click()};return k.jsxs("div",{className:nn.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:d("pageTitles.chooseAppearance")}),k.jsx(_g,{onFilesDrop:oe}),k.jsxs("div",{className:nn.sideMenu,children:[k.jsx(va,{title:"Appearance",left:20}),k.jsx("div",{className:nn.bottomLine}),k.jsx("div",{className:nn.scrollContainer,children:k.jsx("div",{className:nn["editor-container"],children:i.getGroupTraits().map((_e,D)=>k.jsxs("div",{className:nn.editorButton,onClick:()=>{pe(_e)},children:[k.jsx(il,{size:56,icon:_e.fullIconSvg,rarity:_!==_e.trait?"none":"mythic"}),k.jsx("div",{className:nn.editorText,children:_e.name})]},"options_"+D))})})]}),!!w&&k.jsxs("div",{className:nn.selectorContainerPos,children:[k.jsx(va,{title:_,width:130,left:20}),T&&u==Qa.TRAIT&&k.jsx("div",{className:nn.selectorColorPickerButton,onClick:()=>{L(!E)},children:k.jsx("img",{className:nn.selectorColorPickerImg,src:Uge})}),u==Qa.TRAIT&&!!E&&k.jsx("div",{draggable:!1,className:nn.selectorColorPickerUI,children:k.jsx($Ue,{draggable:!1,width:"200px",color:U.background,onChange:N,onChangeComplete:C})}),k.jsx("div",{className:nn.bottomLine}),k.jsxs("div",{className:nn.scrollContainerOptions,children:[u==Qa.TRAIT&&k.jsxs("div",{className:nn["selector-container"],children:[k.jsx("div",{className:`${nn.selectorButton}`,onClick:()=>{re(_)},children:k.jsx(il,{size:56,icon:Fge,rarity:"none"})},"randomize-trait"),i.isTraitGroupRequired(_)?k.jsx(k.Fragment,{}):k.jsx("div",{className:`${nn.selectorButton}`,icon:JC,onClick:()=>{ue(_)},children:k.jsx(il,{size:56,icon:JC,rarity:T==null?"mythic":"none"})},"no-trait"),w.map(_e=>{let D=_e.id===(T==null?void 0:T.id);return k.jsx("div",{className:`${nn.selectorButton}`,onClick:()=>{X(_e)},children:k.jsx(il,{size:56,icon:_e.fullThumbnail,rarity:D?"mythic":"none"})},_e.id)})]}),u==Qa.BLEND_SHAPE&&k.jsx(rPe,{selectedTrait:T,onBack:()=>{f(Qa.TRAIT)},selectedBlendShapeTrait:M,setSelectedBlendshapeTrait:O})]}),k.jsx("div",{className:nn.uploadContainer,children:k.jsx("div",{className:nn.uploadButton,onClick:xe,children:k.jsx("div",{children:"Upload "})})})]}),k.jsx(ET,{jsonSelectionArray:m}),k.jsx(tPe,{selectedTrait:T,selectedVRM:Y,traitGroupName:_}),k.jsx(e_,{loadedAnimationName:I,randomize:W}),k.jsxs("div",{className:nn.buttonContainer,children:[k.jsx(gn,{theme:"light",text:d("callToAction.back"),size:14,className:nn.buttonLeft,onClick:g}),i.canDownload()&&k.jsx(gn,{theme:"light",text:d("callToAction.next"),size:14,className:nn.buttonRight,onClick:z})]})]})}const rPe=({selectedTrait:n,onBack:e,selectedBlendShapeTrait:t,setSelectedBlendshapeTrait:r})=>{const{characterManager:i,moveCamera:s}=$.useContext(Zn),o=i.getBlendShapeGroupTraits((n==null?void 0:n.traitGroup.trait)||"",(n==null?void 0:n.id)||""),a=l=>{if(l.id==null){const u=l.parentGroup;i.loadBlendShapeTrait((n==null?void 0:n.traitGroup.trait)||"",u.trait||"",null);return}const A=l.parentGroup;i.loadBlendShapeTrait((n==null?void 0:n.traitGroup.trait)||"",A.trait||"",(l==null?void 0:l.id)||""),s({targetY:A.cameraTarget.height,distance:A.cameraTarget.distance});const c={...t};c[A.trait||""]=l.id,r(c)};return k.jsxs("div",{className:nn["selector-container-column"],children:[k.jsx(gn,{theme:"dark",text:"Back",size:14,className:nn.buttonLeft,onClick:e}),o&&o.length>0&&o.map(l=>k.jsxs("div",{className:nn.blendshapeGroup,children:[k.jsx("div",{children:l.name}),k.jsxs("div",{className:nn["selector-container"],children:[k.jsx(CO,{src:JC,active:!t[l.trait],blendshapeID:"cancel",select:()=>a(new A8(l,{id:null}))},"empty"),l.collection.map(A=>{let c=A.id===t[l.trait];return k.jsx(CO,{src:A.fullThumbnail||"",active:c,blendshapeID:A.id,select:()=>a(A)},A.id)})]})]},l.trait))]})},CO=({active:n,blendshapeID:e,src:t,select:r})=>k.jsx("div",{className:`${nn.selectorButton}`,onClick:r,children:k.jsx(il,{size:56,icon:t||"",rarity:n?"mythic":"none"})},e),iPe="_InformationContainerPos_rgqwy_1",sPe="_traitInfoTitle_rgqwy_13",oPe="_traitInfoText_rgqwy_21",aPe="_flexSelect_rgqwy_30",lPe="_scrollContainer_rgqwy_65",APe="_checked_rgqwy_90",cPe="_checkmark_rgqwy_94",uPe="_checkboxHolder_rgqwy_107",fPe="_buttonContainer_rgqwy_114",hPe="_buttonLeft_rgqwy_123",dPe="_buttonRight_rgqwy_127",pPe="_buttonCenter_rgqwy_131",fi={InformationContainerPos:iPe,traitInfoTitle:sPe,traitInfoText:oPe,flexSelect:aPe,"arrow-button":"_arrow-button_rgqwy_37","left-button":"_left-button_rgqwy_51","right-button":"_right-button_rgqwy_58",scrollContainer:lPe,"custom-checkbox":"_custom-checkbox_rgqwy_76","checkbox-container":"_checkbox-container_rgqwy_81",checked:APe,checkmark:cPe,checkboxHolder:uPe,buttonContainer:fPe,buttonLeft:hPe,buttonRight:dPe,buttonCenter:pPe},mPe="_InformationContainerPos_11mqa_2",gPe="_scrollContainer_11mqa_16",vPe="_traitInfoTitle_11mqa_28",yPe="_traitInfoText_11mqa_38",wPe="_flexSelect_11mqa_66",xPe="_checked_11mqa_124",_Pe="_checkmark_11mqa_128",bPe="_checkboxHolder_11mqa_141",Vn={InformationContainerPos:mPe,scrollContainer:gPe,traitInfoTitle:vPe,traitInfoText:yPe,"input-box":"_input-box_11mqa_47",flexSelect:wPe,"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:xPe,checkmark:_Pe,checkboxHolder:bPe};function g2({model:n,name:e,files:t,index:r,nextVrm:i,previousVrm:s}){const{characterManager:o}=$.useContext(Zn),[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),[_,B]=ye.useState(0),[T,b]=ye.useState(0),[M,O]=ye.useState(0);return ye.useEffect(()=>{if(n!=null){const Y=Qh(n,"Mesh"),H=Qh(n,"SkinnedMesh");l(Y.length),c(H.length);const I=Y.concat(H),{stdMats:v,stdCutoutpMats:E,stdTranspMats:L,mToonMats:U,mToonCutoutMats:P,mToonTranspMats:z}=yfe(I);f(v.length),p(L.length),g(E.length),y(U.length),x(z.length),B(P.length);const{triangles:W,bones:N}=o.getBoneTriangleCount();b(W),O(N)}},[n]),n!=null?k.jsx("div",{children:k.jsxs("div",{className:Vn.InformationContainerPos,children:[k.jsx(va,{title:"Model Information",width:180,right:20}),k.jsxs("div",{className:Vn.scrollContainer,children:[k.jsxs("div",{className:Vn.flexSelect,children:[(t==null?void 0:t.length)>1?k.jsx("div",{className:`${Vn["arrow-button"]} ${Vn["left-button"]}`,onClick:s}):k.jsx(k.Fragment,{}),e&&k.jsx("div",{style:{textAlign:"center"},children:k.jsx("div",{className:Vn.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:`${Vn["arrow-button"]} ${Vn["right-button"]}`,onClick:i}):k.jsx(k.Fragment,{})]}),k.jsx("div",{className:Vn.traitInfoTitle,children:"Geometry info:"}),k.jsxs("div",{className:Vn.traitInfoText,children:["Meshes: ",a]}),k.jsxs("div",{className:Vn.traitInfoText,children:["SkinnedMeshes: ",A]}),k.jsxs("div",{className:Vn.traitInfoText,children:["Triangles: ",T]}),k.jsxs("div",{className:Vn.traitInfoText,children:["Bones: ",M]}),k.jsx("div",{className:Vn.traitInfoTitle,children:"Standard Material Count:"}),k.jsxs("div",{className:Vn.traitInfoText,children:["opaque: ",u]}),k.jsxs("div",{className:Vn.traitInfoText,children:["cutout: ",d]}),k.jsxs("div",{className:Vn.traitInfoText,children:["transparent: ",h]}),k.jsx("div",{className:Vn.traitInfoTitle,children:"MToon Material Count:"}),k.jsxs("div",{className:Vn.traitInfoText,children:["opaque: ",m]}),k.jsxs("div",{className:Vn.traitInfoText,children:["cutout: ",_]}),k.jsxs("div",{className:Vn.traitInfoText,children:["transparent: ",w]})]})]})}):k.jsx(k.Fragment,{})}const BPe="_InformationContainerPos_b0msk_1",EPe="_traitInfoTitle_b0msk_13",CPe="_traitInfoText_b0msk_22",MPe="_flexSelect_b0msk_33",SPe="_scrollContainer_b0msk_68",TPe="_checked_b0msk_93",IPe="_checkmark_b0msk_97",RPe="_checkboxHolder_b0msk_110",At={InformationContainerPos:BPe,traitInfoTitle:EPe,traitInfoText:CPe,flexSelect:MPe,"arrow-button":"_arrow-button_b0msk_40","left-button":"_left-button_b0msk_54","right-button":"_right-button_b0msk_61",scrollContainer:SPe,"custom-checkbox":"_custom-checkbox_b0msk_79","checkbox-container":"_checkbox-container_b0msk_84",checked:TPe,checkmark:IPe,checkboxHolder:RPe};function g_({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),[B,T]=ye.useState(Oe.merge_options_ktx_compression||!1),[b,M]=ye.useState(Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas),[O,Y]=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},L=F=>{T(F.target.checked),Oe.merge_options_ktx_compression=F.target.checked},U=F=>{M(F.target.checked),Oe.mergeOptions_create_atlas=F.target.checked},P=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},W=F=>{Y(F.target.checked),Oe.mergeOptions_download_lora=F.target.checked},N=F=>{I(F.target.checked),Oe.mergeOptions_download_sprites=F.target.checked},C=()=>{let F=u;u<=0?F=d.length-1:F-=1,f(F),Oe.mergeOptions_sel_option=F},j=()=>{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),(fe=>{switch(X){case"standard opaque":i(fe),Oe.mergeOptions_atlas_std_size=fe;break;case"standard transparent":o(fe),Oe.mergeOptions_atlas_std_transp_size=fe;break;case"mtoon opaque":l(fe),Oe.mergeOptions_atlas_mtoon_size=fe;break;case"mtoon transparent":c(fe),Oe.mergeOptions_atlas_mtoon_transp_size=fe;break}})(ue)};return k.jsxs("div",{className:At.InformationContainerPos,children:[k.jsx(va,{title:t,width:180,left:20}),k.jsxs("div",{className:At.scrollContainer,children:[k.jsx("div",{className:At.traitInfoTitle,children:"Download Options"}),k.jsx(k.Fragment,{children:k.jsx("div",{className:At.traitInfoText,children:k.jsxs("div",{className:At.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:At["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:g,onChange:P}),k.jsx("div",{className:At["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:At.traitInfoText,children:k.jsxs("div",{className:At.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:At["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:y,onChange:z}),k.jsx("div",{className:At["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download VRM Preview"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:At.traitInfoText,children:k.jsxs("div",{className:At.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:At["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:O,onChange:W}),k.jsx("div",{className:At["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Download Lora Data"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:At.traitInfoText,children:k.jsxs("div",{className:At.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:At["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:H,onChange:N}),k.jsx("div",{className:At["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:At.traitInfoText,children:k.jsxs("div",{className:At.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:At["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:b,onChange:U}),k.jsx("div",{className:At["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:At.traitInfoTitle,children:"Merge Atlas Type"}),k.jsx("br",{}),k.jsxs("div",{className:At.flexSelect,children:[k.jsx("div",{className:`${At["arrow-button"]} ${At["left-button"]}`,onClick:C}),k.jsx("div",{className:At.traitInfoText,style:{marginBottom:"0"},children:d[u]}),k.jsx("div",{className:`${At["arrow-button"]} ${At["right-button"]}`,onClick:j})]}),k.jsx("br",{}),k.jsx("br",{}),(u===0||u==2)&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:At.traitInfoTitle,children:"Standard Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:At.traitInfoText,children:["Opaque: ",bn(r)+" x "+bn(r)]}),k.jsx(Kf,{value:r,onChange:F=>ee(F,"standard opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:At.traitInfoText,children:["Transparent: ",bn(s)+" x "+bn(s)]}),k.jsx(Kf,{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:At.traitInfoTitle,children:"MToon Atlas Size"}),k.jsx("br",{}),k.jsxs("div",{className:At.traitInfoText,children:["Opaque: ",bn(a)+" x "+bn(a)]}),k.jsx(Kf,{value:a,onChange:F=>ee(F,"mtoon opaque"),min:1,max:8,step:1}),k.jsx("br",{}),k.jsxs("div",{className:At.traitInfoText,children:["Transparent: ",bn(A)+" x "+bn(A)]}),k.jsx(Kf,{value:A,onChange:F=>ee(F,"mtoon transparent"),min:1,max:8,step:1}),k.jsx("br",{})," ",k.jsx("br",{})]}),k.jsx("div",{className:At.traitInfoTitle,children:"Options"}),k.jsx("div",{className:At.traitInfoText,children:k.jsxs("div",{className:At.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:At["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:h,onChange:E}),k.jsx("div",{className:At["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Two Sided Material"]})}),n&&k.jsx(k.Fragment,{children:k.jsx("div",{className:At.traitInfoText,children:k.jsxs("div",{className:At.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:At["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:x,onChange:v}),k.jsx("div",{className:At["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"Drag Drop - Download"]})})}),k.jsx(k.Fragment,{children:k.jsx("div",{className:At.traitInfoText,children:k.jsxs("div",{className:At.checkboxHolder,children:[k.jsx("div",{}),k.jsxs("label",{className:At["custom-checkbox"],children:[k.jsx("input",{type:"checkbox",checked:B,onChange:L}),k.jsx("div",{className:At["checkbox-container"]})]}),k.jsx("div",{}),k.jsx("div",{}),"KTX Compression"]})})})]})]})]})]})}function FPe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=$.useContext(Di),{manifest:r,toggleDebugMode:i,characterManager:s,animationManager:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=$.useContext(Zn),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=$.useState(""),{playSound:g}=$.useContext(Ys),{isMute:m}=$.useContext(Ks),[y,w]=$.useState(null),x=()=>{!m&&g("backNextButton"),s.removeCurrentCharacter(),s.removeCurrentManifest(),i(!1),e(mt.LANDING)},_=()=>{const I=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:bn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:bn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:bn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:bn(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}},B=(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 U=new sd,P=A.parent;P.remove(A);const z=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(z===!0){const N=r.loras.map(async C=>a.createLoraData(C,U));await Promise.all(N)}const W=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(W===!0){const N=r.sprites.map(async C=>l.createSpriteAtlas(C,U));await Promise.all(N)}(z===!0||W===!0)&&U.saveZip(y[I].name),P.add(A),I{t(!0),B(0,!0)},{t:b}=ye.useContext(So),M=async I=>{if(s.getCurrentCharacterModel()){const E=cl(I.name),L=URL.createObjectURL(I);await o.loadAnimation(L,!1,0,!0,"",E),d(o.getCurrentAnimationName()),URL.revokeObjectURL(L)}else console.warn("Please load a vrm model to test animations.")},O=async I=>{const v=URL.createObjectURL(I);await s.loadOptimizerCharacter(v),URL.revokeObjectURL(v);const E=cl(I.name);h(E),u(s.getCurrentCharacterModel())},Y=I=>{const v=Array.from(I),E=[],L=U=>new Promise((P,z)=>{var W;if(U&&U.name.toLowerCase().endsWith(".json")){const N=new FileReader,C=`${(W=s.manifestData)==null?void 0:W.getAssetsDirectory()}/anata/_thumbnails/t_${U.name.split("_")[0]}.jpg`;N.onload=function(j){try{const ee=JSON.parse(j.target.result);ee.thumb=C,E.push(ee),P()}catch(ee){console.error("Error parsing the JSON file:",ee),z(ee)}},N.readAsText(U)}});Promise.all(v.map(L)).then(()=>{E.length>0&&(w(E),t(!0),s.loadTraitsFromNFTObject(E[0]).then(()=>{t(!1)}))}).catch(U=>{console.error("Error processing files:",U)})},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")&&O(v),v&&v.name.toLowerCase().endsWith(".json")&&Y(I)};return k.jsxs("div",{className:fi.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(_g,{onFilesDrop:H}),k.jsx(g_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(g2,{model:c}),k.jsx(ET,{jsonSelectionArray:y}),k.jsx(e_,{loadedAnimationName:p}),k.jsxs("div",{className:fi.buttonContainer,children:[k.jsx(gn,{theme:"light",text:b("callToAction.back"),size:14,className:fi.buttonLeft,onClick:x}),(y==null?void 0:y.length)==1&&k.jsx(gn,{theme:"light",text:"Download",size:14,className:fi.buttonRight,onClick:T}),(y==null?void 0:y.length)>1&&k.jsx(gn,{theme:"light",text:"Download All",size:14,className:fi.buttonRight,onClick:T})]})]})}const Fg="abi/5.7.0",Dt=new ge(Fg),$c={};let MO={calldata:!0,memory:!0,storage:!0},UPe={calldata:!0,memory:!0};function Ev(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")&&UPe[e])return!0;return(MO[e]||e==="payable")&&Dt.throwArgumentError("invalid modifier","name",e),!1}function LPe(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!==Vt.sighash&&(t+=this.type),t+="("+this.components.map(r=>r.format(e)).join(e===Vt.full?", ":",")+")"):t+=this.type,e!==Vt.sighash&&(this.indexed===!0&&(t+=" indexed"),e===Vt.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return typeof e=="string"?Br.fromString(e,t):Br.fromObject(e)}static fromObject(e){return Br.isParamType(e)?e:new Br($c,{name:e.name||null,type:xf(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(Br.fromObject):null})}static fromString(e,t){function r(i){return Br.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return r(LPe(e,!!t))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function $m(n,e){return OPe(n).map(t=>Br.fromString(t,e))}class sl{constructor(e,t){e!==$c&&Dt.throwError("use a static from method",ge.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),dy(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return sl.isFragment(e)?e:typeof e=="string"?sl.fromString(e):sl.fromObject(e)}static fromObject(e){if(sl.isFragment(e))return e;switch(e.type){case"function":return Jo.fromObject(e);case"event":return Ja.fromObject(e);case"constructor":return Zo.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"?Ja.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?Jo.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?Zo.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 Ja extends sl{format(e){if(e||(e=Vt.sighash),Vt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Vt.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!==Vt.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Vt.full?", ":",")+") ",e!==Vt.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return typeof e=="string"?Ja.fromString(e):Ja.fromObject(e)}static fromObject(e){if(Ja.isEventFragment(e))return e;e.type!=="event"&&Dt.throwArgumentError("invalid event object","value",e);const t={name:Zm(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Br.fromObject):[],type:"event"};return new Ja($c,t)}static fromString(e){let t=e.match(Jm);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)}}),Ja.fromObject({name:t[1].trim(),anonymous:r,inputs:$m(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function Gz(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 Vz(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 jz(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 Zo extends sl{format(e){if(e||(e=Vt.sighash),Vt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Vt.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===Vt.sighash&&Dt.throwError("cannot format a constructor for sighash",ge.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map(r=>r.format(e)).join(e===Vt.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(t+=this.stateMutability+" "),t.trim()}static from(e){return typeof e=="string"?Zo.fromString(e):Zo.fromObject(e)}static fromObject(e){if(Zo.isConstructorFragment(e))return e;e.type!=="constructor"&&Dt.throwArgumentError("invalid constructor object","value",e);let t=jz(e);t.constant&&Dt.throwArgumentError("constructor cannot be constant","value",e);const r={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Br.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new Zo($c,r)}static fromString(e){let t={type:"constructor"};e=Gz(e,t);let r=e.match(Jm);return(!r||r[1].trim()!=="constructor")&&Dt.throwArgumentError("invalid constructor string","value",e),t.inputs=$m(r[2].trim(),!1),Vz(r[3].trim(),t),Zo.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class Jo extends Zo{format(e){if(e||(e=Vt.sighash),Vt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Vt.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!==Vt.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Vt.full?", ":",")+") ",e!==Vt.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"?Jo.fromString(e):Jo.fromObject(e)}static fromObject(e){if(Jo.isFunctionFragment(e))return e;e.type!=="function"&&Dt.throwArgumentError("invalid function object","value",e);let t=jz(e);const r={type:e.type,name:Zm(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(Br.fromObject):[],outputs:e.outputs?e.outputs.map(Br.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Ge.from(e.gas):null};return new Jo($c,r)}static fromString(e){let t={type:"function"};e=Gz(e,t);let r=e.split(" returns ");r.length>2&&Dt.throwArgumentError("invalid function string","value",e);let i=r[0].match(Jm);if(i||Dt.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&Zm(t.name),t.inputs=$m(i[2],!1),Vz(i[3].trim(),t),r.length>1){let s=r[1].match(Jm);(s[1].trim()!=""||s[3].trim()!="")&&Dt.throwArgumentError("unexpected tokens","value",e),t.outputs=$m(s[2],!1)}else t.outputs=[];return Jo.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function SO(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 sl{format(e){if(e||(e=Vt.sighash),Vt[e]||Dt.throwArgumentError("invalid format type","format",e),e===Vt.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});let t="";return e!==Vt.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map(r=>r.format(e)).join(e===Vt.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:Zm(e.name),inputs:e.inputs?e.inputs.map(Br.fromObject):[]};return SO(new rA($c,t))}static fromString(e){let t={type:"error"},r=e.match(Jm);return r||Dt.throwArgumentError("invalid error signature","value",e),t.name=r[1].trim(),t.name&&Zm(t.name),t.inputs=$m(r[2],!1),SO(rA.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function xf(n){return n.match(/^uint($|[^1-9])/)?n="uint256"+n.substring(4):n.match(/^int($|[^1-9])/)&&(n="int256"+n.substring(3)),n}const DPe=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Zm(n){return(!n||!n.match(DPe))&&Dt.throwArgumentError(`invalid identifier "${n}"`,"value",n),n}const Jm=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function OPe(n){n=n.trim();let e=[],t="",r=0;for(let i=0;ithis.wordSize&&v2.throwError("value out-of-bounds",ge.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=qi([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 $w{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):$w.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:v2.throwError("data out-of-bounds",ge.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new $w(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 kPe extends Il{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=Nr(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}decode(e){return Nr(Qn(e.readValue().toHexString(),20))}}class QPe 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 ge(Fg);function Wz(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",ge.errors.INVALID_ARGUMENT,{argument:"values",coder:A,value:t}),l[c]&&Yf.throwError("cannot encode object for signature with duplicate names",ge.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 uM(n.wordSize),s=new uM(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 Kz(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===ge.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===ge.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 HPe 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",ge.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 Wz(e,this.coders,t)}decode(e){return e.coerce(this.name,Kz(e,this.coders))}}const Mv=new ge(Fg),YPe=new RegExp(/^bytes([0-9]*)$/),XPe=new RegExp(/^(u?int)([0-9]*)$/);class $Pe{constructor(e){Ue(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new kPe(e.name);case"bool":return new zPe(e.name);case"string":return new KPe(e.name);case"bytes":return new GPe(e.name);case"array":return new HPe(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Cv((e.components||[]).map(r=>this._getCoder(r)),e.name);case"":return new jPe(e.name)}let t=e.type.match(XPe);if(t){let r=parseInt(t[2]||"256");return(r===0||r>256||r%8!==0)&&Mv.throwArgumentError("invalid "+t[1]+" bit length","param",e),new WPe(r/8,t[1]==="int",e.name)}if(t=e.type.match(YPe),t){let r=parseInt(t[1]);return(r===0||r>32)&&Mv.throwArgumentError("invalid bytes length","param",e),new VPe(r,e.name)}return Mv.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new $w(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new uM(this._getWordSize())}getDefaultValue(e){const t=e.map(i=>this._getCoder(Br.from(i)));return new Cv(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Mv.throwError("types/values length mismatch",ge.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const r=e.map(o=>this._getCoder(Br.from(o))),i=new Cv(r,"_"),s=this._getWriter();return i.encode(s,t),s.data}decode(e,t,r){const i=e.map(o=>this._getCoder(Br.from(o)));return new Cv(i,"_").decode(this._getReader(at(t),r))}}const ZPe=new $Pe,Mn=new ge(Fg);class JPe extends ng{}class qPe extends ng{}class e3e extends ng{}class fM extends ng{static isIndexed(e){return!!(e&&e._isIndexed)}}const t3e={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function TO(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);return t.error=e,t}class IO{constructor(e){let t=[];typeof e=="string"?t=JSON.parse(e):t=e,Ue(this,"fragments",t.map(r=>sl.from(r)).filter(r=>r!=null)),Ue(this,"_abiCoder",es(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){Mn.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]){Mn.warn("duplicate definition - "+s);return}i[s]=r}),this.deploy||Ue(this,"deploy",Zo.from({payable:!1,type:"constructor"})),Ue(this,"_isInterface",!0)}format(e){e||(e=Vt.full),e===Vt.sighash&&Mn.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map(r=>r.format(e));return e===Vt.json?JSON.stringify(t.map(r=>JSON.parse(r))):t}static getAbiCoder(){return ZPe}static getAddress(e){return Nr(e)}static getSighash(e){return jr(_f(e.format()),0,4)}static getEventTopic(e){return _f(e.format())}getFunction(e){if(Et(e)){for(const r in this.functions)if(e===this.getSighash(r))return this.functions[r];Mn.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?Mn.throwArgumentError("no matching function","name",r):i.length>1&&Mn.throwArgumentError("multiple matching functions","name",r),this.functions[i[0]]}const t=this.functions[Jo.fromString(e).format()];return t||Mn.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];Mn.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?Mn.throwArgumentError("no matching event","name",r):i.length>1&&Mn.throwArgumentError("multiple matching events","name",r),this.events[i[0]]}const t=this.events[Ja.fromString(e).format()];return t||Mn.throwArgumentError("no matching event","signature",e),t}getError(e){if(Et(e)){const r=es(this.constructor,"getSighash");for(const i in this.errors){const s=this.errors[i];if(e===r(s))return this.errors[i]}Mn.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?Mn.throwArgumentError("no matching error","name",r):i.length>1&&Mn.throwArgumentError("multiple matching errors","name",r),this.errors[i[0]]}const t=this.errors[Jo.fromString(e).format()];return t||Mn.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 es(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),es(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)&&Mn.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(qi([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)&&Mn.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(qi([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=t3e[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 Mn.throwError("call revert exception"+s,ge.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&&Mn.throwError("too many arguments for "+e.format(),ge.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let r=[];e.anonymous||r.push(this.getEventTopic(e));const i=(s,o)=>s.type==="string"?_f(o):s.type==="bytes"?sr(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]),Qn(nt(o),32));for(t.forEach((s,o)=>{let a=e.inputs[o];if(!a.indexed){s!=null&&Mn.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"?Mn.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&&Mn.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(_f(l));else if(o.type==="bytes")r.push(sr(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)&&Mn.throwError("fragment/topic mismatch",ge.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(Br.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,qi(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 fM({_isIndexed:!0,hash:null});else if(o[h])A[h]=new fM({_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 TO(`property ${JSON.stringify(f.name)}`,p)}}):A[f.name]=p}});for(let f=0;f{throw TO(`index ${f}`,h)}})}return Object.freeze(A)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new qPe({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 JPe({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 e3e({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 n3e="contracts/5.7.0";var Zc=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 Kn=new ge(n3e);function Zw(n,e){return Zc(this,void 0,void 0,function*(){const t=yield e;typeof t!="string"&&Kn.throwArgumentError("invalid address or ENS name","name",t);try{return Nr(t)}catch{}n||Kn.throwError("a provider or signer is needed to resolve ENS names",ge.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield n.resolveName(t);return r==null&&Kn.throwArgumentError("resolver or addr is not configured for ENS name","name",t),r})}function py(n,e,t){return Zc(this,void 0,void 0,function*(){return Array.isArray(t)?yield Promise.all(t.map((r,i)=>py(n,Array.isArray(e)?e[i]:e[r.name],r))):t.type==="address"?yield Zw(n,e):t.type==="tuple"?yield py(n,e,t.components):t.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(r=>py(n,r,t.arrayChildren))):Promise.reject(Kn.makeError("invalid value for array",ge.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function v_(n,e,t){return Zc(this,void 0,void 0,function*(){let r={};t.length===e.inputs.length+1&&typeof t[t.length-1]=="object"&&(r=En(t.pop())),Kn.checkArgumentCount(t.length,e.inputs.length,"passed to contract"),n.signer?r.from?r.from=tr({override:Zw(n.signer,r.from),signer:n.signer.getAddress()}).then(A=>Zc(this,void 0,void 0,function*(){return Nr(A.signer)!==A.override&&Kn.throwError("Contract with a Signer cannot override from",ge.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),A.override})):r.from=n.signer.getAddress():r.from&&(r.from=Zw(n.provider,r.from));const i=yield tr({args:py(n.signer||n.provider,t,e.inputs),address:n.resolvedAddress,overrides:tr(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=qc(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&&Kn.throwError(`cannot override ${l.map(A=>JSON.stringify(A)).join(",")}`,ge.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:l}),o})}function r3e(n,e){return function(...t){return v_(n,e,t)}}function i3e(n,e){const t=n.signer||n.provider;return function(...r){return Zc(this,void 0,void 0,function*(){t||Kn.throwError("estimate require a provider or signer",ge.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield v_(n,e,r);return yield t.estimateGas(i)})}}function s3e(n,e){const t=e.wait.bind(e);e.wait=r=>t(r).then(i=>(i.events=i.logs.map(s=>{let o=rs(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 Xz(n,e,t){const r=n.signer||n.provider;return function(...i){return Zc(this,void 0,void 0,function*(){let s;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const l=En(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 v_(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===ge.errors.CALL_EXCEPTION&&(l.address=n.address,l.args=i,l.transaction=o),l}})}}function o3e(n,e){return function(...t){return Zc(this,void 0,void 0,function*(){n.signer||Kn.throwError("sending a transaction requires a signer",ge.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),n.deployTransaction!=null&&(yield n._deployed());const r=yield v_(n,e,t),i=yield n.signer.sendTransaction(r);return s3e(n,i),i})}}function RO(n,e,t){return e.constant?Xz(n,e,t):o3e(n,e)}function $z(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 qm{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 a3e extends qm{constructor(){super("error",null)}}class FO extends qm{constructor(e,t,r,i){const s={address:e};let o=t.getEventTopic(r);i?(o!==i[0]&&Kn.throwArgumentError("topic mismatch","topics",i),s.topics=i.slice()):s.topics=[o],super($z(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=NPe(e.args);if(t.length)throw t[0].error;const r=(e.args||[]).slice();return r.push(e),r}}class UO extends qm{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 l3e{constructor(e,t,r){Ue(this,"interface",es(new.target,"getInterface")(t)),r==null?(Ue(this,"provider",null),Ue(this,"signer",null)):og.isSigner(r)?(Ue(this,"provider",r.provider||null),Ue(this,"signer",r)):rg.isProvider(r)?(Ue(this,"provider",r),Ue(this,"signer",null)):Kn.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]]):Kn.warn(`Duplicate definition of ${a} (${l.join(", ")})`)})}if(Ue(this,"_runningEvents",{}),Ue(this,"_wrappedEmits",{}),e==null&&Kn.throwArgumentError("invalid contract address or ENS name","addressOrName",e),Ue(this,"address",e),this.provider)Ue(this,"resolvedAddress",Zw(this.provider,e));else try{Ue(this,"resolvedAddress",Promise.resolve(Nr(e)))}catch{Kn.throwError("provider is required to use ENS name as contract address",ge.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]){Kn.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,RO(this,a,!0)),this.functions[o]==null&&Ue(this.functions,o,RO(this,a,!1)),this.callStatic[o]==null&&Ue(this.callStatic,o,Xz(this,a,!0)),this.populateTransaction[o]==null&&Ue(this.populateTransaction,o,r3e(this,a)),this.estimateGas[o]==null&&Ue(this.estimateGas,o,i3e(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 CN(e)}static getInterface(e){return IO.isInterface(e)?e:new IO(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"&&Kn.throwError("contract not deployed",ge.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||Kn.throwError("sending a transactions require a signer",ge.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=En(e||{});return["from","to"].forEach(function(r){t[r]!=null&&Kn.throwError("cannot override "+r,ge.errors.UNSUPPORTED_OPERATION,{operation:r})}),t.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(t))}connect(e){typeof e=="string"&&(e=new UM(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 fM.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 a3e);if(e==="event")return this._normalizeRunningEvent(new qm("event",null));if(e==="*")return this._normalizeRunningEvent(new UO(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new FO(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 FO(this.address,this.interface,i,e.topics))}catch{}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new qm($z(t),t))}return this._normalizeRunningEvent(new UO(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=rs(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||Kn.throwError("events require a provider or a signer with a provider",ge.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=En(i.filter);return typeof t=="string"&&Et(t,32)?(r!=null&&Kn.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 y_ extends l3e{}const A3e="0x543D43F390b7d681513045e8a85707438c463d80",Jw={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"}]},LO={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 Zz(n,e){return function(){return n.apply(e,arguments)}}const{toString:c3e}=Object.prototype,{getPrototypeOf:y2}=Object,w_=(n=>e=>{const t=c3e.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),Ea=n=>(n=n.toLowerCase(),e=>w_(e)===n),x_=n=>e=>typeof e===n,{isArray:md}=Array,eg=x_("undefined");function u3e(n){return n!==null&&!eg(n)&&n.constructor!==null&&!eg(n.constructor)&&ks(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Jz=Ea("ArrayBuffer");function f3e(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Jz(n.buffer),e}const h3e=x_("string"),ks=x_("function"),qz=x_("number"),__=n=>n!==null&&typeof n=="object",d3e=n=>n===!0||n===!1,my=n=>{if(w_(n)!=="object")return!1;const e=y2(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},p3e=Ea("Date"),m3e=Ea("File"),g3e=Ea("Blob"),v3e=Ea("FileList"),y3e=n=>__(n)&&ks(n.pipe),w3e=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||ks(n.append)&&((e=w_(n))==="formdata"||e==="object"&&ks(n.toString)&&n.toString()==="[object FormData]"))},x3e=Ea("URLSearchParams"),_3e=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Ug(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let r,i;if(typeof n!="object"&&(n=[n]),md(n))for(r=0,i=n.length;r0;)if(i=t[r],e===i.toLowerCase())return i;return null}const tG=(()=>typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global)(),nG=n=>!eg(n)&&n!==tG;function hM(){const{caseless:n}=nG(this)&&this||{},e={},t=(r,i)=>{const s=n&&eG(e,i)||i;my(e[s])&&my(r)?e[s]=hM(e[s],r):my(r)?e[s]=hM({},r):md(r)?e[s]=r.slice():e[s]=r};for(let r=0,i=arguments.length;r(Ug(e,(i,s)=>{t&&ks(i)?n[s]=Zz(i,t):n[s]=i},{allOwnKeys:r}),n),B3e=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),E3e=(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)},C3e=(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&&y2(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},M3e=(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},S3e=n=>{if(!n)return null;if(md(n))return n;let e=n.length;if(!qz(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},T3e=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&y2(Uint8Array)),I3e=(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])}},R3e=(n,e)=>{let t;const r=[];for(;(t=n.exec(e))!==null;)r.push(t);return r},F3e=Ea("HTMLFormElement"),U3e=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,r,i){return r.toUpperCase()+i}),PO=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),L3e=Ea("RegExp"),rG=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),r={};Ug(t,(i,s)=>{let o;(o=e(i,s,n))!==!1&&(r[s]=o||i)}),Object.defineProperties(n,r)},P3e=n=>{rG(n,(e,t)=>{if(ks(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const r=n[t];if(ks(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+"'")})}})},D3e=(n,e)=>{const t={},r=i=>{i.forEach(s=>{t[s]=!0})};return md(n)?r(n):r(String(n).split(e)),t},O3e=()=>{},N3e=(n,e)=>(n=+n,Number.isFinite(n)?n:e),bB="abcdefghijklmnopqrstuvwxyz",DO="0123456789",iG={DIGIT:DO,ALPHA:bB,ALPHA_DIGIT:bB+bB.toUpperCase()+DO},k3e=(n=16,e=iG.ALPHA_DIGIT)=>{let t="";const{length:r}=e;for(;n--;)t+=e[Math.random()*r|0];return t};function Q3e(n){return!!(n&&ks(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const H3e=n=>{const e=new Array(10),t=(r,i)=>{if(__(r)){if(e.indexOf(r)>=0)return;if(!("toJSON"in r)){e[i]=r;const s=md(r)?[]:{};return Ug(r,(o,a)=>{const l=t(o,i+1);!eg(l)&&(s[a]=l)}),e[i]=void 0,s}}return r};return t(n,0)},z3e=Ea("AsyncFunction"),G3e=n=>n&&(__(n)||ks(n))&&ks(n.then)&&ks(n.catch),Re={isArray:md,isArrayBuffer:Jz,isBuffer:u3e,isFormData:w3e,isArrayBufferView:f3e,isString:h3e,isNumber:qz,isBoolean:d3e,isObject:__,isPlainObject:my,isUndefined:eg,isDate:p3e,isFile:m3e,isBlob:g3e,isRegExp:L3e,isFunction:ks,isStream:y3e,isURLSearchParams:x3e,isTypedArray:T3e,isFileList:v3e,forEach:Ug,merge:hM,extend:b3e,trim:_3e,stripBOM:B3e,inherits:E3e,toFlatObject:C3e,kindOf:w_,kindOfTest:Ea,endsWith:M3e,toArray:S3e,forEachEntry:I3e,matchAll:R3e,isHTMLForm:F3e,hasOwnProperty:PO,hasOwnProp:PO,reduceDescriptors:rG,freezeMethods:P3e,toObjectSet:D3e,toCamelCase:U3e,noop:O3e,toFiniteNumber:N3e,findKey:eG,global:tG,isContextDefined:nG,ALPHABET:iG,generateString:k3e,isSpecCompliantForm:Q3e,toJSONObject:H3e,isAsyncFn:z3e,isThenable:G3e};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)}Re.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:Re.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const sG=Nt.prototype,oG={};["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=>{oG[n]={value:n}});Object.defineProperties(Nt,oG);Object.defineProperty(sG,"isAxiosError",{value:!0});Nt.from=(n,e,t,r,i,s)=>{const o=Object.create(sG);return Re.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 V3e=null;function dM(n){return Re.isPlainObject(n)||Re.isArray(n)}function aG(n){return Re.endsWith(n,"[]")?n.slice(0,-2):n}function OO(n,e,t){return n?n.concat(e).map(function(i,s){return i=aG(i),!t&&s?"["+i+"]":i}).join(t?".":""):e}function j3e(n){return Re.isArray(n)&&!n.some(dM)}const W3e=Re.toFlatObject(Re,{},null,function(e){return/^is[A-Z]/.test(e)});function b_(n,e,t){if(!Re.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=Re.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(d,g){return!Re.isUndefined(g[d])});const r=t.metaTokens,i=t.visitor||c,s=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&Re.isSpecCompliantForm(e);if(!Re.isFunction(i))throw new TypeError("visitor must be a function");function A(p){if(p===null)return"";if(Re.isDate(p))return p.toISOString();if(!l&&Re.isBlob(p))throw new Nt("Blob is not supported. Use a Buffer instead.");return Re.isArrayBuffer(p)||Re.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(Re.endsWith(d,"{}"))d=r?d:d.slice(0,-2),p=JSON.stringify(p);else if(Re.isArray(p)&&j3e(p)||(Re.isFileList(p)||Re.endsWith(d,"[]"))&&(m=Re.toArray(p)))return d=aG(d),m.forEach(function(w,x){!(Re.isUndefined(w)||w===null)&&e.append(o===!0?OO([d],x,s):o===null?d:d+"[]",A(w))}),!1}return dM(p)?!0:(e.append(OO(g,d,s),A(p)),!1)}const u=[],f=Object.assign(W3e,{defaultVisitor:c,convertValue:A,isVisitable:dM});function h(p,d){if(!Re.isUndefined(p)){if(u.indexOf(p)!==-1)throw Error("Circular reference detected in "+d.join("."));u.push(p),Re.forEach(p,function(m,y){(!(Re.isUndefined(m)||m===null)&&i.call(e,m,Re.isString(y)?y.trim():y,d,f))===!0&&h(m,d?d.concat(y):[y])}),u.pop()}}if(!Re.isObject(n))throw new TypeError("data must be an object");return h(n),e}function NO(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function w2(n,e){this._pairs=[],n&&b_(n,this,e)}const lG=w2.prototype;lG.append=function(e,t){this._pairs.push([e,t])};lG.toString=function(e){const t=e?function(r){return e.call(this,r,NO)}:NO;return this._pairs.map(function(i){return t(i[0])+"="+t(i[1])},"").join("&")};function K3e(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function AG(n,e,t){if(!e)return n;const r=t&&t.encode||K3e,i=t&&t.serialize;let s;if(i?s=i(e,t):s=Re.isURLSearchParams(e)?e.toString():new w2(e,t).toString(r),s){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+s}return n}class Y3e{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){Re.forEach(this.handlers,function(r){r!==null&&e(r)})}}const kO=Y3e,cG={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},X3e=typeof URLSearchParams<"u"?URLSearchParams:w2,$3e=typeof FormData<"u"?FormData:null,Z3e=typeof Blob<"u"?Blob:null,J3e={isBrowser:!0,classes:{URLSearchParams:X3e,FormData:$3e,Blob:Z3e},protocols:["http","https","file","blob","url","data"]},uG=typeof window<"u"&&typeof document<"u",q3e=(n=>uG&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),eDe=(()=>typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),tDe=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:uG,hasStandardBrowserEnv:q3e,hasStandardBrowserWebWorkerEnv:eDe},Symbol.toStringTag,{value:"Module"})),ta={...tDe,...J3e};function nDe(n,e){return b_(n,new ta.classes.URLSearchParams,Object.assign({visitor:function(t,r,i,s){return ta.isNode&&Re.isBuffer(t)?(this.append(r,t.toString("base64")),!1):s.defaultVisitor.apply(this,arguments)}},e))}function rDe(n){return Re.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function iDe(n){const e={},t=Object.keys(n);let r;const i=t.length;let s;for(r=0;r=t.length;return o=!o&&Re.isArray(i)?i.length:o,l?(Re.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!a):((!i[o]||!Re.isObject(i[o]))&&(i[o]=[]),e(t,r,i[o],s)&&Re.isArray(i[o])&&(i[o]=iDe(i[o])),!a)}if(Re.isFormData(n)&&Re.isFunction(n.entries)){const t={};return Re.forEachEntry(n,(r,i)=>{e(rDe(r),i,t,0)}),t}return null}function sDe(n,e,t){if(Re.isString(n))try{return(e||JSON.parse)(n),Re.trim(n)}catch(r){if(r.name!=="SyntaxError")throw r}return(t||JSON.stringify)(n)}const x2={transitional:cG,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,s=Re.isObject(e);if(s&&Re.isHTMLForm(e)&&(e=new FormData(e)),Re.isFormData(e))return i?JSON.stringify(fG(e)):e;if(Re.isArrayBuffer(e)||Re.isBuffer(e)||Re.isStream(e)||Re.isFile(e)||Re.isBlob(e))return e;if(Re.isArrayBufferView(e))return e.buffer;if(Re.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 nDe(e,this.formSerializer).toString();if((a=Re.isFileList(e))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return b_(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return s||i?(t.setContentType("application/json",!1),sDe(e)):e}],transformResponse:[function(e){const t=this.transitional||x2.transitional,r=t&&t.forcedJSONParsing,i=this.responseType==="json";if(e&&Re.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:ta.classes.FormData,Blob:ta.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Re.forEach(["delete","get","head","post","put","patch"],n=>{x2.headers[n]={}});const _2=x2,oDe=Re.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"]),aDe=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]&&oDe[t])&&(t==="set-cookie"?e[t]?e[t].push(r):e[t]=[r]:e[t]=e[t]?e[t]+", "+r:r)}),e},QO=Symbol("internals");function up(n){return n&&String(n).trim().toLowerCase()}function gy(n){return n===!1||n==null?n:Re.isArray(n)?n.map(gy):String(n)}function lDe(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 ADe=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function BB(n,e,t,r,i){if(Re.isFunction(r))return r.call(this,e,t);if(i&&(e=t),!!Re.isString(e)){if(Re.isString(r))return e.indexOf(r)!==-1;if(Re.isRegExp(r))return r.test(e)}}function cDe(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,r)=>t.toUpperCase()+r)}function uDe(n,e){const t=Re.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 B_{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function s(a,l,A){const c=up(l);if(!c)throw new Error("header name must be a non-empty string");const u=Re.findKey(i,c);(!u||i[u]===void 0||A===!0||A===void 0&&i[u]!==!1)&&(i[u||l]=gy(a))}const o=(a,l)=>Re.forEach(a,(A,c)=>s(A,c,l));return Re.isPlainObject(e)||e instanceof this.constructor?o(e,t):Re.isString(e)&&(e=e.trim())&&!ADe(e)?o(aDe(e),t):e!=null&&s(t,e,r),this}get(e,t){if(e=up(e),e){const r=Re.findKey(this,e);if(r){const i=this[r];if(!t)return i;if(t===!0)return lDe(i);if(Re.isFunction(t))return t.call(this,i,r);if(Re.isRegExp(t))return t.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=up(e),e){const r=Re.findKey(this,e);return!!(r&&this[r]!==void 0&&(!t||BB(this,this[r],r,t)))}return!1}delete(e,t){const r=this;let i=!1;function s(o){if(o=up(o),o){const a=Re.findKey(r,o);a&&(!t||BB(r,r[a],a,t))&&(delete r[a],i=!0)}}return Re.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||BB(this,this[s],s,e,!0))&&(delete this[s],i=!0)}return i}normalize(e){const t=this,r={};return Re.forEach(this,(i,s)=>{const o=Re.findKey(r,s);if(o){t[o]=gy(i),delete t[s];return}const a=e?cDe(s):String(s).trim();a!==s&&delete t[s],t[a]=gy(i),r[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Re.forEach(this,(r,i)=>{r!=null&&r!==!1&&(t[i]=e&&Re.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[QO]=this[QO]={accessors:{}}).accessors,i=this.prototype;function s(o){const a=up(o);r[a]||(uDe(i,o),r[a]=!0)}return Re.isArray(e)?e.forEach(s):s(e),this}}B_.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Re.reduceDescriptors(B_.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(r){this[t]=r}}});Re.freezeMethods(B_);const ul=B_;function EB(n,e){const t=this||_2,r=e||t,i=ul.from(r.headers);let s=r.data;return Re.forEach(n,function(a){s=a.call(t,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function hG(n){return!!(n&&n.__CANCEL__)}function Lg(n,e,t){Nt.call(this,n??"canceled",Nt.ERR_CANCELED,e,t),this.name="CanceledError"}Re.inherits(Lg,Nt,{__CANCEL__:!0});function fDe(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 hDe=ta.hasStandardBrowserEnv?{write(n,e,t,r,i,s){const o=[n+"="+encodeURIComponent(e)];Re.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),Re.isString(r)&&o.push("path="+r),Re.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 dDe(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function pDe(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function dG(n,e){return n&&!dDe(e)?pDe(n,e):e}const mDe=ta.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=Re.isString(o)?i(o):o;return a.protocol===r.protocol&&a.host===r.host}}():function(){return function(){return!0}}();function gDe(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function vDe(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 yDe=typeof XMLHttpRequest<"u",wDe=yDe&&function(n){return new Promise(function(t,r){let i=n.data;const s=ul.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(Re.isFormData(i)){if(ta.hasStandardBrowserEnv||ta.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=dG(n.baseURL,n.url);u.open(n.method.toUpperCase(),AG(f,n.params,n.paramsSerializer),!0),u.timeout=n.timeout;function h(){if(!u)return;const d=ul.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};fDe(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||cG;n.timeoutErrorMessage&&(g=n.timeoutErrorMessage),r(new Nt(g,m.clarifyTimeoutError?Nt.ETIMEDOUT:Nt.ECONNABORTED,n,u)),u=null},ta.hasStandardBrowserEnv&&(a&&Re.isFunction(a)&&(a=a(n)),a||a!==!1&&mDe(f))){const d=n.xsrfHeaderName&&n.xsrfCookieName&&hDe.read(n.xsrfCookieName);d&&s.set(n.xsrfHeaderName,d)}i===void 0&&s.setContentType(null),"setRequestHeader"in u&&Re.forEach(s.toJSON(),function(g,m){u.setRequestHeader(m,g)}),Re.isUndefined(n.withCredentials)||(u.withCredentials=!!n.withCredentials),o&&o!=="json"&&(u.responseType=n.responseType),typeof n.onDownloadProgress=="function"&&u.addEventListener("progress",HO(n.onDownloadProgress,!0)),typeof n.onUploadProgress=="function"&&u.upload&&u.upload.addEventListener("progress",HO(n.onUploadProgress)),(n.cancelToken||n.signal)&&(l=d=>{u&&(r(!d||d.type?new Lg(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=gDe(f);if(p&&ta.protocols.indexOf(p)===-1){r(new Nt("Unsupported protocol "+p+":",Nt.ERR_BAD_REQUEST,n));return}u.send(i||null)})},pM={http:V3e,xhr:wDe};Re.forEach(pM,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const zO=n=>`- ${n}`,xDe=n=>Re.isFunction(n)||n===null||n===!1,pG={getAdapter:n=>{n=Re.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(zO).join(` +`):" "+zO(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:pM};function CB(n){if(n.cancelToken&&n.cancelToken.throwIfRequested(),n.signal&&n.signal.aborted)throw new Lg(null,n)}function GO(n){return CB(n),n.headers=ul.from(n.headers),n.data=EB.call(n,n.transformRequest),["post","put","patch"].indexOf(n.method)!==-1&&n.headers.setContentType("application/x-www-form-urlencoded",!1),pG.getAdapter(n.adapter||_2.adapter)(n).then(function(r){return CB(n),r.data=EB.call(n,n.transformResponse,r),r.headers=ul.from(r.headers),r},function(r){return hG(r)||(CB(n),r&&r.response&&(r.response.data=EB.call(n,n.transformResponse,r.response),r.response.headers=ul.from(r.response.headers))),Promise.reject(r)})}const VO=n=>n instanceof ul?{...n}:n;function Hh(n,e){e=e||{};const t={};function r(A,c,u){return Re.isPlainObject(A)&&Re.isPlainObject(c)?Re.merge.call({caseless:u},A,c):Re.isPlainObject(c)?Re.merge({},c):Re.isArray(c)?c.slice():c}function i(A,c,u){if(Re.isUndefined(c)){if(!Re.isUndefined(A))return r(void 0,A,u)}else return r(A,c,u)}function s(A,c){if(!Re.isUndefined(c))return r(void 0,c)}function o(A,c){if(Re.isUndefined(c)){if(!Re.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(VO(A),VO(c),!0)};return Re.forEach(Object.keys(Object.assign({},n,e)),function(c){const u=l[c]||i,f=u(n[c],e[c],c);Re.isUndefined(f)&&u!==a||(t[c]=f)}),t}const mG="1.6.8",b2={};["object","boolean","number","function","string","symbol"].forEach((n,e)=>{b2[n]=function(r){return typeof r===n||"a"+(e<1?"n ":" ")+n}});const jO={};b2.transitional=function(e,t,r){function i(s,o){return"[Axios v"+mG+"] 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&&!jO[o]&&(jO[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 _De(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 mM={assertOptions:_De,validators:b2},jl=mM.validators;class qw{constructor(e){this.defaults=e,this.interceptors={request:new kO,response:new kO}}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=Hh(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:s}=t;r!==void 0&&mM.assertOptions(r,{silentJSONParsing:jl.transitional(jl.boolean),forcedJSONParsing:jl.transitional(jl.boolean),clarifyTimeoutError:jl.transitional(jl.boolean)},!1),i!=null&&(Re.isFunction(i)?t.paramsSerializer={serialize:i}:mM.assertOptions(i,{encode:jl.function,serialize:jl.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=s&&Re.merge(s.common,s[t.method]);s&&Re.forEach(["delete","get","head","post","put","patch","common"],p=>{delete s[p]}),t.headers=ul.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=[GO.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 Lg(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 B2(function(i){e=i}),cancel:e}}}const bDe=B2;function BDe(n){return function(t){return n.apply(null,t)}}function EDe(n){return Re.isObject(n)&&n.isAxiosError===!0}const gM={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(gM).forEach(([n,e])=>{gM[e]=n});const CDe=gM;function gG(n){const e=new vy(n),t=Zz(vy.prototype.request,e);return Re.extend(t,vy.prototype,e,{allOwnKeys:!0}),Re.extend(t,e,null,{allOwnKeys:!0}),t.create=function(i){return gG(Hh(n,i))},t}const ar=gG(_2);ar.Axios=vy;ar.CanceledError=Lg;ar.CancelToken=bDe;ar.isCancel=hG;ar.VERSION=mG;ar.toFormData=b_;ar.AxiosError=Nt;ar.Cancel=ar.CanceledError;ar.all=function(e){return Promise.all(e)};ar.spread=BDe;ar.isAxiosError=EDe;ar.mergeConfig=Hh;ar.AxiosHeaders=ul;ar.formToJSON=n=>fG(Re.isHTMLForm(n)?new FormData(n):n);ar.getAdapter=pG.getAdapter;ar.HttpStatusCode=CDe;ar.default=ar;const MDe=ar,SDe={}.VITE_OPENSEA_KEY,TDe={}.VITE_PINATA_API_KEY,IDe={}.VITE_PINATA_API_SECRET,MB="0x89";let Sv;async function RDe(){if(Sv!=null)return Sv;const n=new lk("https://polygon-rpc.com/"),t=await new y_(Jw.address,Jw.abi,n).tokenPrice();return Sv=Ge.from(t).mul(1),Sv}function FDe(n,e){const t={method:"GET",headers:{accept:"application/json","x-api-key":SDe}};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 E2(){if(window.ethereum)try{const n=await window.ethereum.request({method:"eth_chainId"});if(parseInt(n,16)==parseInt(MB,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:MB}]});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:MB}]});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 SB(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 MDe.post(t,r,{maxContentLength:"Infinity",maxBodyLength:"Infinity",headers:{"Content-Type":`multipart/form-data; boundary=${r._boundary}`,pinata_api_key:TDe,pinata_secret_api_key:IDe}})).data}const UDe=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 LDe(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 E2();if(s=="")return"Please Connect Wallet";if(!i||await PDe(s)){console.log("minting");let a="AvatarImage_"+Date.now()+".png",l=await(async()=>{for(let y=0;y<10;y++)try{return await SB(e,a).catch(x=>{console.error(y,"---",x)})}catch(w){return console.warn(w),w}return"Failed to upload screenshot"})();const A=await Ehe(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 SB(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:UDe(n)},f=JSON.stringify(u),p=`ipfs://${(await SB(new Blob([f]),"AvatarMetadata_"+Date.now()+".json")).IpfsHash}`;let d=await RDe();const g=new PM(window.ethereum).getSigner(),m=new y_(Jw.address,Jw.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 PDe=async n=>{if(n){const e="0x6e58309CD851A5B124E3A56768a42d12f3B6D104",t=l7("mainnet",{alchemy:{}.VITE_ALCHEMY_API_KEY}),i=await new y_(LO.address,LO.abi,t).beneficiaryBalanceOf(e,A3e,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 DDe(){const{isLoading:n,setViewMode:e,setIsLoading:t}=$.useContext(Di),{manifest:r,characterManager:i,animationManager:s,toggleDebugMode:o,loraDataGenerator:a,spriteAtlasGenerator:l,sceneElements:A}=$.useContext(Zn),[c,u]=ye.useState(null),[f,h]=ye.useState(""),{playSound:p}=$.useContext(Ys),{isMute:d}=$.useContext(Ks);$.useState(null);const[g,m]=$.useState(null),[y,w]=$.useState(""),x=()=>{!d&&p("backNextButton"),i.removeCurrentCharacter(),i.removeCurrentManifest(),o(!1),e(mt.LANDING)},_=()=>{const v=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:bn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:bn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:bn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:bn(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}},B=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 sd,W=A.parent;W.remove(A);const N=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(N===!0){const j=r.loras.map(async ee=>a.createLoraData(ee,z));await Promise.all(j)}const C=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(C===!0){const j=r.sprites.map(async ee=>l.createSpriteAtlas(ee,z));await Promise.all(j)}(N===!0||C===!0)&&z.saveZip(g[v].manifestName),W.add(A),v{v==0?(console.log(r.loras[0]),B(v)):(await i.setManifest(g[v]),t(!0),i.loadInitialTraits().then(async()=>{await(L=>new Promise(U=>setTimeout(U,L)))(1),B(v)}))},b=()=>{t(!0),T(0)},{t:M}=ye.useContext(So),O=async v=>{if(i.getCurrentCharacterModel()){const L=cl(v.name),U=URL.createObjectURL(v);await s.loadAnimation(U,!1,0,!0,"",L),w(s.getCurrentAnimationName()),URL.revokeObjectURL(U)}else console.warn("Please load a vrm model to test animations.")},Y=async v=>{const E=URL.createObjectURL(v);await i.loadOptimizerCharacter(E),URL.revokeObjectURL(E);const L=cl(v.name);h(L),u(i.getCurrentCharacterModel())},H=v=>{const E=Array.from(v),L=[],U=P=>new Promise((z,W)=>{if(P&&P.name.toLowerCase().endsWith(".json")){const N=new FileReader,C=P.name.replace(/\.[^/.]+$/,"");N.onload=function(j){try{const ee=JSON.parse(j.target.result),F=ee.thumbnail;ee.manifestName=C,L.push(ee),z()}catch(ee){console.error("Error parsing the JSON file:",ee),W(ee)}},N.readAsText(P)}});Promise.all(E.map(U)).then(()=>{L.length>0&&(m(L),i.setManifest(L[0]),t(!0),i.loadInitialTraits().then(()=>{t(!1)}))}).catch(P=>{console.error("Error processing files:",P)})},I=async v=>{const E=v[0];E&&E.name.toLowerCase().endsWith(".fbx")&&O(E),E&&E.name.toLowerCase().endsWith(".vrm")&&Y(E),E&&E.name.toLowerCase().endsWith(".json")&&H(v)};return k.jsxs("div",{className:fi.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(_g,{onFilesDrop:I}),k.jsx(g_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Download Options"}),k.jsx(g2,{model:c}),k.jsx(ET,{jsonSelectionArray:g,byManifest:!0}),(g==null?void 0:g.length)>0&&k.jsx(e_,{loadedAnimationName:y}),k.jsxs("div",{className:fi.buttonContainer,children:[k.jsx(gn,{theme:"light",text:M("callToAction.back"),size:14,className:fi.buttonLeft,onClick:x}),(g==null?void 0:g.length)==1&&k.jsx(gn,{theme:"light",text:"Download",size:14,className:fi.buttonRight,onClick:b}),(g==null?void 0:g.length)>1&&k.jsx(gn,{theme:"light",text:"Download All",size:14,className:fi.buttonRight,onClick:b})]})]})}const ODe="_classdisabled_hpzv8_1",NDe="_container_hpzv8_6",kDe="_classContainer_hpzv8_14",QDe="_icon_hpzv8_39",HDe="_name_hpzv8_70",zDe="_description_hpzv8_79",GDe="_classFrame_hpzv8_84",VDe="_frameContainer_hpzv8_104",jDe="_frame_hpzv8_104",WDe="_image_hpzv8_114",KDe="_lockedContainer_hpzv8_120",YDe="_locked_hpzv8_120",XDe="_buttonContainer_hpzv8_134",$De="_buttonLeft_hpzv8_143",ZDe="_buttonRight_hpzv8_147",JDe="_buttonCenter_hpzv8_151",qDe="_topLine_hpzv8_165",eOe="_bottomLine_hpzv8_191",ot={classdisabled:ODe,container:NDe,classContainer:kDe,class:"_class_hpzv8_1",icon:QDe,name:HDe,description:zDe,classFrame:GDe,frameContainer:VDe,frame:jDe,image:WDe,lockedContainer:KDe,locked:YDe,buttonContainer:XDe,buttonLeft:$De,buttonRight:ZDe,buttonCenter:JDe,topLine:qDe,bottomLine:eOe};function tOe(){const{t:n}=ye.useContext(So),{setViewMode:e,setIsLoading:t,isLoading:r}=$.useContext(Di),{playSound:i}=$.useContext(Ys),{isMute:s}=$.useContext(Ks),{manifest:o,characterManager:a}=$.useContext(Zn),[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(mt.LANDING),!s&&i("backNextButton")},u=async p=>{t(!0),a.loadManifest(o.characters[p].manifest).then(()=>{e(mt.BATCHDOWNLOAD),a.loadInitialTraits().then(()=>{t(!1)})}),!s&&i("classSelect")},f=()=>{e(mt.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(gn,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}function nOe(){const{t:n}=ye.useContext(So),{setViewMode:e,setIsLoading:t,isLoading:r}=$.useContext(Di),{playSound:i}=$.useContext(Ys),{isMute:s}=$.useContext(Ks),{manifest:o,characterManager:a}=$.useContext(Zn),[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(mt.LANDING),!s&&i("backNextButton")},u=async h=>{t(!0),a.loadManifest(o.characters[h].manifest).then(()=>{e(mt.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(gn,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:c})})]})}const rOe="_buttonContainer_1ueuk_1",iOe="_button_1ueuk_1",$u={buttonContainer:rOe,button:iOe},WO={}.VITE_OPENSEA_KEY;function sOe(){const{setViewMode:n}=$.useContext(Di),{playSound:e}=$.useContext(Ys),{isMute:t}=$.useContext(Ks),{characterManager:r}=$.useContext(Zn),i=()=>{n(mt.CREATE),!t&&e("backNextButton")},s=()=>{n(mt.CLAIM),!t&&e("backNextButton")},o=()=>{n(mt.OPTIMIZER),r.loadOptimizerManifest(),!t&&e("backNextButton")},a=async()=>{await E2()!=""&&n(mt.WALLET),!t&&e("backNextButton")};return k.jsx("div",{className:$u.container,children:k.jsxs("div",{className:$u.buttonContainer,children:[k.jsx("button",{className:$u.button,onClick:i,children:k.jsx("img",{src:"./assets/media/btn_create_character.png"})}),k.jsx("button",{className:$u.button,onClick:s,children:k.jsx("img",{src:"./assets/media/btn_batch_download_character.png"})}),k.jsx("button",{className:$u.button,onClick:o,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})}),WO&&WO!=""&&k.jsx("button",{className:$u.button,onClick:a,children:k.jsx("img",{src:"./assets/media/btn_optimize_character.png"})})]})})}const Ac={};var C2={exports:{}},hh=typeof Reflect=="object"?Reflect:null,KO=hh&&typeof hh.apply=="function"?hh.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},yy;hh&&typeof hh.ownKeys=="function"?yy=hh.ownKeys:Object.getOwnPropertySymbols?yy=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:yy=function(e){return Object.getOwnPropertyNames(e)};function oOe(n){console&&console.warn&&console.warn(n)}var vG=Number.isNaN||function(e){return e!==e};function tn(){tn.init.call(this)}C2.exports=tn;C2.exports.once=cOe;tn.EventEmitter=tn;tn.prototype._events=void 0;tn.prototype._eventsCount=0;tn.prototype._maxListeners=void 0;var YO=10;function E_(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(tn,"defaultMaxListeners",{enumerable:!0,get:function(){return YO},set:function(n){if(typeof n!="number"||n<0||vG(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");YO=n}});tn.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};tn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||vG(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 yG(n){return n._maxListeners===void 0?tn.defaultMaxListeners:n._maxListeners}tn.prototype.getMaxListeners=function(){return yG(this)};tn.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")KO(l,this,t);else for(var A=l.length,c=BG(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,oOe(a)}return n}tn.prototype.addListener=function(e,t){return wG(this,e,t,!1)};tn.prototype.on=tn.prototype.addListener;tn.prototype.prependListener=function(e,t){return wG(this,e,t,!0)};function aOe(){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 xG(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=aOe.bind(r);return i.listener=t,r.wrapFn=i,i}tn.prototype.once=function(e,t){return E_(t),this.on(e,xG(this,e,t)),this};tn.prototype.prependOnceListener=function(e,t){return E_(t),this.prependListener(e,xG(this,e,t)),this};tn.prototype.removeListener=function(e,t){var r,i,s,o,a;if(E_(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():lOe(r,s),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||t)}return this};tn.prototype.off=tn.prototype.removeListener;tn.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 _G(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?AOe(i):BG(i,i.length)}tn.prototype.listeners=function(e){return _G(this,e,!0)};tn.prototype.rawListeners=function(e){return _G(this,e,!1)};tn.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):bG.call(n,e)};tn.prototype.listenerCount=bG;function bG(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}tn.prototype.eventNames=function(){return this._eventsCount>0?yy(this._events):[]};function BG(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 wy(n,e,t){return pOe()?wy=Reflect.construct:wy=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),A=new l;return o&&ex(A,o.prototype),A},wy.apply(null,arguments)}function mOe(n){return Function.toString.call(n).indexOf("[native code]")!==-1}function tx(n){var e=typeof Map=="function"?new Map:void 0;return tx=function(r){if(r===null||!mOe(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 wy(r,arguments,yM(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ex(i,r)},tx(n)}function Tv(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 Zu(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 TB=function(n){M2(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}(tx(Error)),gOe=function(n){M2(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}(tx(Error)),vOe=function(n){M2(e,n);function e(r){var i;return i=n.call(this,r)||this,i.handleNetworkChanged=i.handleNetworkChanged.bind(Tv(i)),i.handleChainChanged=i.handleChainChanged.bind(Tv(i)),i.handleAccountsChanged=i.handleAccountsChanged.bind(Tv(i)),i.handleClose=i.handleClose.bind(Tv(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 vM({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 TB;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=Zu(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 gOe});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=Zu(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 TB;var s,o=Zu(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=Zu(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 TB;var s,o=Zu(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(Zu(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}(dOe);function yOe(){const{account:n,library:e,activate:t}=g7(),[r,i]=ye.useState([]),{setViewMode:s}=$.useContext(Di),{playSound:o}=$.useContext(Ys),{isMute:a}=$.useContext(Ks),l=new vOe({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 y_(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(mt.APPEARANCE)},u=()=>{s(mt.LANDING),!a&&o("backNextButton")};return k.jsxs("div",{className:Ac.container,children:[!n&&k.jsxs("div",{className:Ac.message,children:["Please connect your wallet to load your characters",k.jsx("button",{className:Ac.button,onClick:()=>A(),children:"Connect"})]}),k.jsxs("div",{className:Ac.characterContainer,children:[k.jsx("div",{className:Ac.title,children:"Load Character"}),r.map((f,h)=>k.jsx("div",{className:Ac.character,onClick:()=>{c()},children:JSON.stringify(f)},h))]}),k.jsx("button",{className:Ac.button,onClick:()=>u(),children:"Back"})]})}const wOe="_container_q73cc_1",xOe="_mintContainer_q73cc_6",_Oe="_mainTitleWrap_q73cc_33",bOe="_mainTitle_q73cc_33",BOe="_mintButtonContainer_q73cc_49",EOe="_mintButton_q73cc_49",COe="_genesisText_q73cc_60",MOe="_required_q73cc_64",SOe="_divider_q73cc_68",TOe="_bottomContainer_q73cc_75",IOe="_mintInfo_q73cc_85",ROe="_topLine_q73cc_91",FOe="_bottomLine_q73cc_104",yi={container:wOe,mintContainer:xOe,mainTitleWrap:_Oe,mainTitle:bOe,mintButtonContainer:BOe,mintButton:EOe,genesisText:COe,required:MOe,divider:SOe,bottomContainer:TOe,mintInfo:IOe,topLine:ROe,bottomLine:FOe};function UOe(){const{model:n,avatar:e}=$.useContext(Zn),{setViewMode:t}=$.useContext(Di),{playSound:r}=$.useContext(Ys),{isMute:i}=$.useContext(Ks),[s,o]=$.useState(""),[a,l]=$.useState(!1),A=()=>{t(mt.SAVE),!i&&r("backNextButton")};function c(){return k.jsxs("div",{className:yi.mainTitleWrap,children:[k.jsx("div",{className:yi.topLine}),k.jsx("div",{className:yi.mainTitle,children:"Mint"})]})}async function u(){!i&&r("backNextButton"),l(!0),o("Please check your wallet");const p=await LDe(e,null,n,{name:"XXXRestore"}.name);o(p),l(!1),console.log(p)}return k.jsxs("div",{className:yi.container,children:[k.jsx("div",{className:"sectionTitle",children:"Mint Your Character"}),k.jsxs("div",{className:yi.mintContainer,children:[k.jsx(c,{}),k.jsxs("div",{className:yi.mintButtonContainer,children:[k.jsx(gn,{size:16,theme:"light",icon:"polygon",text:a?"Minting...":"Open Edition",className:yi.mintButton,disabled:a,onClick:u,minWidth:220}),k.jsx("div",{className:yi.divider}),k.jsx(gn,{size:16,theme:"light",icon:"tokens",text:"Genesis Edition",className:yi.mintButton,disabled:!0,minWidth:220}),k.jsxs("span",{className:yi.genesisText,children:["(",k.jsx("span",{className:yi.required,children:"Coming Soon!"}),")"]})]}),k.jsxs("span",{className:yi.mintInfo,children:[s," "]})]}),k.jsx("div",{className:yi.bottomContainer,children:k.jsx(gn,{theme:"light",text:"Back",size:14,className:yi.buttonLeft,onClick:A})})]})}function LOe(){const{isLoading:n,setViewMode:e}=$.useContext(Di),{manifest:t,characterManager:r,animationManager:i,sceneElements:s,loraDataGenerator:o,spriteAtlasGenerator:a}=$.useContext(Zn),{playSound:l}=$.useContext(Ys),{isMute:A}=$.useContext(Ks),[c,u]=ye.useState(null),[f,h]=ye.useState(""),[p,d]=ye.useState([]),[g,m]=ye.useState(0),[y,w]=$.useState("T-Pose"),x=()=>{!A&&l("backNextButton"),r.removeCurrentCharacter(),r.removeCurrentManifest(),e(mt.LANDING)},_=()=>{const E=Oe.mergeOptions_sel_option||0;return{isVrm0:!0,createTextureAtlas:!0,mToonAtlasSize:bn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:bn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:bn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:bn(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}},B=async()=>{for(let E=0;E{typeof E!="string"&&(E=f),await(async()=>{var j;(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 sd,W=s.parent;W.remove(s),(j=r.getCurrentOptimizerCharacterModel().data)==null||j.isVRM0;const N=Oe.mergeOptions_download_lora==null?!0:Oe.mergeOptions_download_lora;if(N===!0){const ee=t.loras.map(async F=>o.createLoraData(F,z));await Promise.all(ee)}const C=Oe.mergeOptions_download_sprites==null?!0:Oe.mergeOptions_download_sprites;if(C===!0){const ee=t.sprites.map(async F=>a.createSpriteAtlas(F,z));await Promise.all(ee)}(N===!0||C===!0)&&z.saveZip(E),W.add(s)})()},{t:b}=ye.useContext(So),M=async E=>{if(r.getCurrentOptimizerCharacterModel()){const U=cl(E.name),P=URL.createObjectURL(E);await i.loadAnimation(P,!1,0,!0,"",U),w(i.getCurrentAnimationName()),URL.revokeObjectURL(P)}else console.warn("Please load a vrm model to test animations.")},O=()=>{if(g===0)H(p[p.length-1]),m(p.length-1);else{const E=g-1;H(p[E]),m(E)}},Y=()=>{if(g>=p.length-1)H(p[0]),m(0);else{const E=g+1;H(p[E]),m(E)}},H=async E=>{const L=URL.createObjectURL(E);await r.loadOptimizerCharacter(L),URL.revokeObjectURL(L);const U=cl(E.name);h(U),u({...r.getCurrentCharacterModel()})},I=async E=>{H(E[0]);const L=[];for(let U=0;U{const L=E[0];L&&L.name.toLowerCase().endsWith(".fbx")&&M(L),L&&L.name.toLowerCase().endsWith(".vrm")&&I(E)};return k.jsxs("div",{className:fi.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(_g,{onFilesDrop:v}),k.jsx(g_,{showDropToDownload:!0,showCreateAtlas:!1,mergeMenuTitle:"Optimizer Options"}),k.jsx(g2,{model:c,name:f,files:p,index:g,nextVrm:Y,previousVrm:O}),k.jsx(e_,{loadedAnimationName:y}),k.jsxs("div",{className:fi.buttonContainer,children:[k.jsx(gn,{theme:"light",text:b("callToAction.back"),size:14,className:fi.buttonLeft,onClick:x}),(p==null?void 0:p.length)>1!=""&&k.jsx(gn,{theme:"light",text:"Download All",size:14,className:fi.buttonRight,onClick:B}),c!=""&&k.jsx(gn,{theme:"light",text:"Download",size:14,className:fi.buttonRight,onClick:T})]})]})}const POe="_buttonContainer_1fd4o_1",DOe="_buttonLeft_1fd4o_10",OOe="_buttonRight_1fd4o_14",NOe="_buttonCenter_1fd4o_18",Iv={buttonContainer:POe,buttonLeft:DOe,buttonRight:OOe,buttonCenter:NOe},kOe="_button_13dfi_1",XO={button:kOe},QOe="Anon",HOe=()=>{ye.useContext(So);const[n]=$.useState(localStorage.getItem("name")||QOe),{model:e,characterManager:t}=ye.useContext(Zn),r=()=>{const o=Oe.mergeOptions_sel_option||0;return{createTextureAtlas:Oe.mergeOptions_create_atlas==null?!0:Oe.mergeOptions_create_atlas,mToonAtlasSize:bn(Oe.mergeOptions_atlas_mtoon_size||6),mToonAtlasSizeTransp:bn(Oe.mergeOptions_atlas_mtoon_transp_size||6),stdAtlasSize:bn(Oe.mergeOptions_atlas_std_size||6),stdAtlasSizeTransp:bn(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($.Fragment,{children:[k.jsx(gn,{theme:"light",text:"GLB",icon:"download",size:14,className:XO.button,onClick:()=>{s()}}),k.jsx(gn,{theme:"light",text:"VRM",icon:"download",size:14,className:XO.button,onClick:i})]})};function zOe(){const{t:n}=ye.useContext(So),{playSound:e}=$.useContext(Ys),{isMute:t}=$.useContext(Ks),{setViewMode:r}=$.useContext(Di),i=()=>{r(mt.APPEARANCE),!t&&e("backNextButton")},s=()=>{r(mt.MINT),!t&&e("backNextButton")},o=async a=>{const l=a[0];l&&l.name.toLowerCase().endsWith(".json")};return k.jsxs("div",{className:Iv.container,children:[k.jsx("div",{className:"sectionTitle",children:n("pageTitles.saveCharacter")}),k.jsxs("div",{className:Iv.buttonContainer,children:[k.jsx(_g,{onFilesDrop:o}),k.jsx(gn,{theme:"light",text:n("callToAction.back"),size:14,className:Iv.buttonLeft,onClick:i}),k.jsx(g_,{showCreateAtlas:!0,mergeMenuTitle:"Download Options"}),k.jsx(HOe,{}),k.jsx(gn,{theme:"light",text:"mint",size:14,className:Iv.buttonRight,onClick:s})]})]})}function GOe(){const{t:n}=ye.useContext(So),{setViewMode:e,setIsLoading:t,isLoading:r}=$.useContext(Di),{playSound:i}=$.useContext(Ys),{isMute:s}=$.useContext(Ks),{manifest:o,characterManager:a}=$.useContext(Zn);ye.useState([]);const[l,A]=ye.useState([]);ye.useEffect(()=>{c()},[]);const c=async()=>{const d=await E2();FDe(d,"the-anata-nft").then(g=>{A(g.nfts),console.log(g.nfts)})},u=()=>{e(mt.LANDING),!s&&i("backNextButton")},f=async d=>{t(!0),a.loadManifest(o[d].manifest).then(()=>{e(mt.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(gn,{theme:"light",text:n("callToAction.back"),size:14,className:ot.buttonLeft,onClick:u}),k.jsx(gn,{theme:"light",text:"test",size:14,className:ot.buttonLeft,onClick:h})]})]})}const VOe=".//manifest.json",jOe=6,WOe=new Z(0,.8,0);new Z(-2.2367993753934425,1.1512971720174363,2.2612065299409223);async function KOe(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 YOe(){const n=await KOe(VOe),e=new Xpe;return{initialManifest:n,effectManager:e}}const XOe=()=>{let n,e;const r=YOe().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}}},$Oe=XOe();function ZOe(){const{initialManifest:n,effectManager:e}=$Oe.read(),[t,r]=ye.useState(!1),{camera:i,controls:s,scene:o,moveCamera:a,setManifest:l,lookAtManager:A,showEnvironmentModels:c}=ye.useContext(Zn),{viewMode:u}=ye.useContext(Di);e.camera=i,e.scene=o;const f=()=>{e.camera&&(a({targetX:0,targetY:WOe.y,targetZ:0,distance:jOe}),s&&([mt.APPEARANCE,mt.SAVE,mt.OPTIMIZER,mt.BATCHDOWNLOAD,mt.BATCHMANIFEST].includes(u)?s.enabled=!0:s.enabled=!1))},[h,p]=ye.useState(!1),[d,g]=ye.useState(""),[m,y]=ye.useState([]),w=(B,T)=>{g(B),p(!0),y([T])},x={[mt.LANDING]:k.jsx(sOe,{}),[mt.APPEARANCE]:k.jsx(nPe,{confirmDialog:w}),[mt.OPTIMIZER]:k.jsx(LOe,{}),[mt.CREATE]:k.jsx(nOe,{}),[mt.WALLET]:k.jsx(GOe,{}),[mt.CLAIM]:k.jsx(tOe,{}),[mt.BATCHMANIFEST]:k.jsx(DDe,{}),[mt.BATCHDOWNLOAD]:k.jsx(FPe,{}),[mt.LOAD]:k.jsx(yOe,{}),[mt.MINT]:k.jsx(UOe,{}),[mt.SAVE]:k.jsx(zOe,{})};let _=0;return ye.useEffect(()=>{const B=T=>{const b=new Date().getTime(),M=b-_;M<300&&M>10&&T.target.id=="editor-scene"&&r(!t),_=b};return window.addEventListener("touchend",B),window.addEventListener("click",B),()=>{window.removeEventListener("touchend",B),window.removeEventListener("click",B)}},[t]),ye.useEffect(()=>{if(A!=null)return f(),A.enabled=!0,[mt.LANDING,mt.CREATE,mt.CLAIM,mt.LOAD,mt.CLAIM,mt.CLAIM].includes(u)?c(!1):c(!0),window.addEventListener("resize",f),()=>{window.removeEventListener("resize",f)}},[u,A]),ye.useEffect(()=>{l(n)},[n]),ye.useContext(So),k.jsxs(ye.Fragment,{children:[k.jsx("div",{className:"generalTitle",children:"Character Studio"}),k.jsx(hme,{confirmDialogText:d,confirmDialogCallback:m,confirmDialogWindow:h,setConfirmDialogWindow:p}),k.jsx(gme,{}),x[u]]})}const JOe=n=>{const e=new PM(n);return e.pollingInterval=12e3,e};QB.createRoot(document.getElementById("root")).render(k.jsx($.StrictMode,{children:k.jsx(p7,{getLibrary:JOe,children:k.jsx(EY,{children:k.jsx(Mpe,{children:k.jsx(bY,{children:k.jsx(sde,{children:k.jsx(rde,{children:k.jsx(dde,{children:k.jsx(ye.Suspense,{children:k.jsx(ZOe,{})})})})})})})})})}));export{qo as c,bl as g}; diff --git a/index.html b/index.html index c7a5252b..143235fb 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ Character Studio - +