@splinetool/loader 0.9.25 → 0.9.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/build/SplineLoader.js +132 -113
- package/build/convertCameras.d.ts +2 -0
- package/build/convertTransmission.d.ts +2 -0
- package/package.json +1 -1
package/build/SplineLoader.js
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
|
-
var zm=Object.create;var Ti=Object.defineProperty,Em=Object.defineProperties,Fm=Object.getOwnPropertyDescriptor,Rm=Object.getOwnPropertyDescriptors,Vm=Object.getOwnPropertyNames,gc=Object.getOwnPropertySymbols,Um=Object.getPrototypeOf,xc=Object.prototype.hasOwnProperty,km=Object.prototype.propertyIsEnumerable;var bc=(i,e,t)=>e in i?Ti(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,O=(i,e)=>{for(var t in e||(e={}))xc.call(e,t)&&bc(i,t,e[t]);if(gc)for(var t of gc(e))km.call(e,t)&&bc(i,t,e[t]);return i},$=(i,e)=>Em(i,Rm(e)),vc=i=>Ti(i,"__esModule",{value:!0});var Sc=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),Hm=(i,e)=>{vc(i);for(var t in e)Ti(i,t,{get:e[t],enumerable:!0})},qm=(i,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Vm(e))!xc.call(i,r)&&r!=="default"&&Ti(i,r,{get:()=>e[r],enumerable:!(t=Fm(e,r))||t.enumerable});return i},wc=i=>qm(vc(Ti(i!=null?zm(Um(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var Oh=Sc(Qs=>{"use strict";Qs.byteLength=aS;Qs.toByteArray=cS;Qs.fromByteArray=uS;var Sr=[],Yt=[],sS=typeof Uint8Array!="undefined"?Uint8Array:Array,Al="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Co=0,Mh=Al.length;Co<Mh;++Co)Sr[Co]=Al[Co],Yt[Al.charCodeAt(Co)]=Co;var Co,Mh;Yt["-".charCodeAt(0)]=62;Yt["_".charCodeAt(0)]=63;function Ph(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function aS(i){var e=Ph(i),t=e[0],r=e[1];return(t+r)*3/4-r}function lS(i,e,t){return(e+t)*3/4-t}function cS(i){var e,t=Ph(i),r=t[0],o=t[1],n=new sS(lS(i,r,o)),s=0,a=o>0?r-4:r,l;for(l=0;l<a;l+=4)e=Yt[i.charCodeAt(l)]<<18|Yt[i.charCodeAt(l+1)]<<12|Yt[i.charCodeAt(l+2)]<<6|Yt[i.charCodeAt(l+3)],n[s++]=e>>16&255,n[s++]=e>>8&255,n[s++]=e&255;return o===2&&(e=Yt[i.charCodeAt(l)]<<2|Yt[i.charCodeAt(l+1)]>>4,n[s++]=e&255),o===1&&(e=Yt[i.charCodeAt(l)]<<10|Yt[i.charCodeAt(l+1)]<<4|Yt[i.charCodeAt(l+2)]>>2,n[s++]=e>>8&255,n[s++]=e&255),n}function dS(i){return Sr[i>>18&63]+Sr[i>>12&63]+Sr[i>>6&63]+Sr[i&63]}function pS(i,e,t){for(var r,o=[],n=e;n<t;n+=3)r=(i[n]<<16&16711680)+(i[n+1]<<8&65280)+(i[n+2]&255),o.push(dS(r));return o.join("")}function uS(i){for(var e,t=i.length,r=t%3,o=[],n=16383,s=0,a=t-r;s<a;s+=n)o.push(pS(i,s,s+n>a?a:s+n));return r===1?(e=i[t-1],o.push(Sr[e>>2]+Sr[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],o.push(Sr[e>>10]+Sr[e>>4&63]+Sr[e<<2&63]+"=")),o.join("")}});var Sm=Sc((Ia,vm)=>{(function(i,e){typeof Ia=="object"&&typeof vm!="undefined"?e(Ia):typeof define=="function"&&define.amd?define(["exports"],e):e((i=typeof globalThis!="undefined"?globalThis:i||self).SVDJS={})})(Ia,function(i){"use strict";i.SVD=function(e,t,r,o,n){if(t=t===void 0||t,r=r===void 0||r,n=1e-64/(o=o||Math.pow(2,-52)),!e)throw new TypeError("Matrix a is not defined");var s,a,l,c,d,u,p,f,m,x,y,N,L=e[0].length,w=e.length;if(w<L)throw new TypeError("Invalid matrix: m < n");for(var B=[],S=[],_=[],T=t==="f"?w:L,h=x=p=0;h<w;h++)S[h]=new Array(T).fill(0);for(h=0;h<L;h++)_[h]=new Array(L).fill(0);var I,b=new Array(L).fill(0);for(h=0;h<w;h++)for(s=0;s<L;s++)S[h][s]=e[h][s];for(h=0;h<L;h++){for(B[h]=p,m=0,l=h+1,s=h;s<w;s++)m+=Math.pow(S[s][h],2);if(m<n)p=0;else for(f=(u=S[h][h])*(p=u<0?Math.sqrt(m):-Math.sqrt(m))-m,S[h][h]=u-p,s=l;s<L;s++){for(m=0,a=h;a<w;a++)m+=S[a][h]*S[a][s];for(u=m/f,a=h;a<w;a++)S[a][s]=S[a][s]+u*S[a][h]}for(b[h]=p,m=0,s=l;s<L;s++)m+=Math.pow(S[h][s],2);if(m<n)p=0;else{for(f=(u=S[h][h+1])*(p=u<0?Math.sqrt(m):-Math.sqrt(m))-m,S[h][h+1]=u-p,s=l;s<L;s++)B[s]=S[h][s]/f;for(s=l;s<w;s++){for(m=0,a=l;a<L;a++)m+=S[s][a]*S[h][a];for(a=l;a<L;a++)S[s][a]=S[s][a]+m*B[a]}}x<(y=Math.abs(b[h])+Math.abs(B[h]))&&(x=y)}if(r)for(h=L-1;0<=h;h--){if(p!==0){for(f=S[h][h+1]*p,s=l;s<L;s++)_[s][h]=S[h][s]/f;for(s=l;s<L;s++){for(m=0,a=l;a<L;a++)m+=S[h][a]*_[a][s];for(a=l;a<L;a++)_[a][s]=_[a][s]+m*_[a][h]}}for(s=l;s<L;s++)_[h][s]=0,_[s][h]=0;_[h][h]=1,p=B[h],l=h}if(t){if(t==="f")for(h=L;h<w;h++){for(s=L;s<w;s++)S[h][s]=0;S[h][h]=1}for(h=L-1;0<=h;h--){for(l=h+1,p=b[h],s=l;s<T;s++)S[h][s]=0;if(p!==0){for(f=S[h][h]*p,s=l;s<T;s++){for(m=0,a=l;a<w;a++)m+=S[a][h]*S[a][s];for(u=m/f,a=h;a<w;a++)S[a][s]=S[a][s]+u*S[a][h]}for(s=h;s<w;s++)S[s][h]=S[s][h]/p}else for(s=h;s<w;s++)S[s][h]=0;S[h][h]=S[h][h]+1}}for(o*=x,a=L-1;0<=a;a--)for(var P=0;P<50;P++){for(I=!1,l=a;0<=l;l--){if(Math.abs(B[l])<=o){I=!0;break}if(Math.abs(b[l-1])<=o)break}if(!I){for(d=0,c=l-(m=1),h=l;h<a+1&&(u=m*B[h],B[h]=d*B[h],!(Math.abs(u)<=o));h++)if(p=b[h],b[h]=Math.sqrt(u*u+p*p),d=p/(f=b[h]),m=-u/f,t)for(s=0;s<w;s++)y=S[s][c],N=S[s][h],S[s][c]=y*d+N*m,S[s][h]=-y*m+N*d}if(N=b[a],l===a){if(N<0&&(b[a]=-N,r))for(s=0;s<L;s++)_[s][a]=-_[s][a];break}for(x=b[l],u=(((y=b[a-1])-N)*(y+N)+((p=B[a-1])-(f=B[a]))*(p+f))/(2*f*y),p=Math.sqrt(u*u+1),u=((x-N)*(x+N)+f*(y/(u<0?u-p:u+p)-f))/x,h=l+(m=d=1);h<a+1;h++){if(p=B[h],y=b[h],f=m*p,p*=d,N=Math.sqrt(u*u+f*f),u=x*(d=u/(B[h-1]=N))+p*(m=f/N),p=-x*m+p*d,f=y*m,y*=d,r)for(s=0;s<L;s++)x=_[s][h-1],N=_[s][h],_[s][h-1]=x*d+N*m,_[s][h]=-x*m+N*d;if(N=Math.sqrt(u*u+f*f),u=(d=u/(b[h-1]=N))*p+(m=f/N)*y,x=-m*p+d*y,t)for(s=0;s<w;s++)y=S[s][h-1],N=S[s][h],S[s][h-1]=y*d+N*m,S[s][h]=-y*m+N*d}B[l]=0,B[a]=u,b[a]=x}for(h=0;h<L;h++)b[h]<o&&(b[h]=0);return{u:S,q:b,v:_}},i.VERSION="1.1.1",Object.defineProperty(i,"__esModule",{value:!0})})});import{FileLoader as h1,Loader as m1}from"three";function Nc(i){return Array.isArray(i)?i:[i]}var Wm=typeof global=="object"&&global&&global.Object===Object&&global,Tn=Wm;var $m=typeof self=="object"&&self&&self.Object===Object&&self,Jm=Tn||$m||Function("return this")(),et=Jm;var Km=et.Symbol,Ct=Km;var Cc=Object.prototype,Xm=Cc.hasOwnProperty,Zm=Cc.toString,Ii=Ct?Ct.toStringTag:void 0;function Qm(i){var e=Xm.call(i,Ii),t=i[Ii];try{i[Ii]=void 0;var r=!0}catch(n){}var o=Zm.call(i);return r&&(e?i[Ii]=t:delete i[Ii]),o}var Lc=Qm;var Ym=Object.prototype,ef=Ym.toString;function tf(i){return ef.call(i)}var Tc=tf;var rf="[object Null]",of="[object Undefined]",Ic=Ct?Ct.toStringTag:void 0;function nf(i){return i==null?i===void 0?of:rf:Ic&&Ic in Object(i)?Lc(i):Tc(i)}var Ft=nf;function sf(i){return i!=null&&typeof i=="object"}var vt=sf;var af="[object Symbol]";function lf(i){return typeof i=="symbol"||vt(i)&&Ft(i)==af}var _o=lf;function cf(i,e){for(var t=-1,r=i==null?0:i.length,o=Array(r);++t<r;)o[t]=e(i[t],t,i);return o}var In=cf;var df=Array.isArray,ht=df;var pf=1/0,Mc=Ct?Ct.prototype:void 0,Pc=Mc?Mc.toString:void 0;function Oc(i){if(typeof i=="string")return i;if(ht(i))return In(i,Oc)+"";if(_o(i))return Pc?Pc.call(i):"";var e=i+"";return e=="0"&&1/i==-pf?"-0":e}var Ac=Oc;function uf(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var St=uf;function hf(i){return i}var Mn=hf;var mf="[object AsyncFunction]",ff="[object Function]",yf="[object GeneratorFunction]",gf="[object Proxy]";function xf(i){if(!St(i))return!1;var e=Ft(i);return e==ff||e==yf||e==mf||e==gf}var Do=xf;var bf=et["__core-js_shared__"],Pn=bf;var jc=function(){var i=/[^.]+$/.exec(Pn&&Pn.keys&&Pn.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function vf(i){return!!jc&&jc in i}var _c=vf;var Sf=Function.prototype,wf=Sf.toString;function Nf(i){if(i!=null){try{return wf.call(i)}catch(e){}try{return i+""}catch(e){}}return""}var Pr=Nf;var Cf=/[\\^$.*+?()[\]{}|]/g,Lf=/^\[object .+?Constructor\]$/,Tf=Function.prototype,If=Object.prototype,Mf=Tf.toString,Pf=If.hasOwnProperty,Of=RegExp("^"+Mf.call(Pf).replace(Cf,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Af(i){if(!St(i)||_c(i))return!1;var e=Do(i)?Of:Lf;return e.test(Pr(i))}var Dc=Af;function jf(i,e){return i==null?void 0:i[e]}var Bc=jf;function _f(i,e){var t=Bc(i,e);return Dc(t)?t:void 0}var Ot=_f;var Df=Ot(et,"WeakMap"),On=Df;var Gc=Object.create,Bf=function(){function i(){}return function(e){if(!St(e))return{};if(Gc)return Gc(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),zc=Bf;function Gf(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2])}return i.apply(e,t)}var Ec=Gf;function zf(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var An=zf;var Ef=800,Ff=16,Rf=Date.now;function Vf(i){var e=0,t=0;return function(){var r=Rf(),o=Ff-(r-t);if(t=r,o>0){if(++e>=Ef)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var Fc=Vf;function Uf(i){return function(){return i}}var Rc=Uf;var kf=function(){try{var i=Ot(Object,"defineProperty");return i({},"",{}),i}catch(e){}}(),Bo=kf;var Hf=Bo?function(i,e){return Bo(i,"toString",{configurable:!0,enumerable:!1,value:Rc(e),writable:!0})}:Mn,Vc=Hf;var qf=Fc(Vc),jn=qf;function Wf(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var Uc=Wf;var $f=9007199254740991,Jf=/^(?:0|[1-9]\d*)$/;function Kf(i,e){var t=typeof i;return e=e==null?$f:e,!!e&&(t=="number"||t!="symbol"&&Jf.test(i))&&i>-1&&i%1==0&&i<e}var _n=Kf;function Xf(i,e,t){e=="__proto__"&&Bo?Bo(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var Go=Xf;function Zf(i,e){return i===e||i!==i&&e!==e}var qr=Zf;var Qf=Object.prototype,Yf=Qf.hasOwnProperty;function ey(i,e,t){var r=i[e];(!(Yf.call(i,e)&&qr(r,t))||t===void 0&&!(e in i))&&Go(i,e,t)}var Dn=ey;function ty(i,e,t,r){var o=!t;t||(t={});for(var n=-1,s=e.length;++n<s;){var a=e[n],l=r?r(t[a],i[a],a,t,i):void 0;l===void 0&&(l=i[a]),o?Go(t,a,l):Dn(t,a,l)}return t}var Kt=ty;var kc=Math.max;function ry(i,e,t){return e=kc(e===void 0?i.length-1:e,0),function(){for(var r=arguments,o=-1,n=kc(r.length-e,0),s=Array(n);++o<n;)s[o]=r[e+o];o=-1;for(var a=Array(e+1);++o<e;)a[o]=r[o];return a[e]=t(s),Ec(i,this,a)}}var Bn=ry;function oy(i,e){return jn(Bn(i,e,Mn),i+"")}var Hc=oy;var iy=9007199254740991;function ny(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=iy}var Gn=ny;function sy(i){return i!=null&&Gn(i.length)&&!Do(i)}var Wr=sy;function ay(i,e,t){if(!St(t))return!1;var r=typeof e;return(r=="number"?Wr(t)&&_n(e,t.length):r=="string"&&e in t)?qr(t[e],i):!1}var qc=ay;function ly(i){return Hc(function(e,t){var r=-1,o=t.length,n=o>1?t[o-1]:void 0,s=o>2?t[2]:void 0;for(n=i.length>3&&typeof n=="function"?(o--,n):void 0,s&&qc(t[0],t[1],s)&&(n=o<3?void 0:n,o=1),e=Object(e);++r<o;){var a=t[r];a&&i(e,a,r,n)}return e})}var Wc=ly;var cy=Object.prototype;function dy(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||cy;return i===t}var zo=dy;function py(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var $c=py;var uy="[object Arguments]";function hy(i){return vt(i)&&Ft(i)==uy}var Pa=hy;var Jc=Object.prototype,my=Jc.hasOwnProperty,fy=Jc.propertyIsEnumerable,yy=Pa(function(){return arguments}())?Pa:function(i){return vt(i)&&my.call(i,"callee")&&!fy.call(i,"callee")},mo=yy;function gy(){return!1}var Kc=gy;var Xc=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zc=Xc&&typeof module=="object"&&module&&!module.nodeType&&module,xy=Zc&&Zc.exports===Xc,Qc=xy?et.Buffer:void 0,by=Qc?Qc.isBuffer:void 0,vy=by||Kc,Eo=vy;var Sy="[object Arguments]",wy="[object Array]",Ny="[object Boolean]",Cy="[object Date]",Ly="[object Error]",Ty="[object Function]",Iy="[object Map]",My="[object Number]",Py="[object Object]",Oy="[object RegExp]",Ay="[object Set]",jy="[object String]",_y="[object WeakMap]",Dy="[object ArrayBuffer]",By="[object DataView]",Gy="[object Float32Array]",zy="[object Float64Array]",Ey="[object Int8Array]",Fy="[object Int16Array]",Ry="[object Int32Array]",Vy="[object Uint8Array]",Uy="[object Uint8ClampedArray]",ky="[object Uint16Array]",Hy="[object Uint32Array]",Ve={};Ve[Gy]=Ve[zy]=Ve[Ey]=Ve[Fy]=Ve[Ry]=Ve[Vy]=Ve[Uy]=Ve[ky]=Ve[Hy]=!0;Ve[Sy]=Ve[wy]=Ve[Dy]=Ve[Ny]=Ve[By]=Ve[Cy]=Ve[Ly]=Ve[Ty]=Ve[Iy]=Ve[My]=Ve[Py]=Ve[Oy]=Ve[Ay]=Ve[jy]=Ve[_y]=!1;function qy(i){return vt(i)&&Gn(i.length)&&!!Ve[Ft(i)]}var Yc=qy;function Wy(i){return function(e){return i(e)}}var Fo=Wy;var ed=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Mi=ed&&typeof module=="object"&&module&&!module.nodeType&&module,$y=Mi&&Mi.exports===ed,Oa=$y&&Tn.process,Jy=function(){try{var i=Mi&&Mi.require&&Mi.require("util").types;return i||Oa&&Oa.binding&&Oa.binding("util")}catch(e){}}(),Or=Jy;var td=Or&&Or.isTypedArray,Ky=td?Fo(td):Yc,zn=Ky;var Xy=Object.prototype,Zy=Xy.hasOwnProperty;function Qy(i,e){var t=ht(i),r=!t&&mo(i),o=!t&&!r&&Eo(i),n=!t&&!r&&!o&&zn(i),s=t||r||o||n,a=s?$c(i.length,String):[],l=a.length;for(var c in i)(e||Zy.call(i,c))&&!(s&&(c=="length"||o&&(c=="offset"||c=="parent")||n&&(c=="buffer"||c=="byteLength"||c=="byteOffset")||_n(c,l)))&&a.push(c);return a}var En=Qy;function Yy(i,e){return function(t){return i(e(t))}}var Fn=Yy;var eg=Fn(Object.keys,Object),rd=eg;var tg=Object.prototype,rg=tg.hasOwnProperty;function og(i){if(!zo(i))return rd(i);var e=[];for(var t in Object(i))rg.call(i,t)&&t!="constructor"&&e.push(t);return e}var od=og;function ig(i){return Wr(i)?En(i):od(i)}var Ro=ig;function ng(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var id=ng;var sg=Object.prototype,ag=sg.hasOwnProperty;function lg(i){if(!St(i))return id(i);var e=zo(i),t=[];for(var r in i)r=="constructor"&&(e||!ag.call(i,r))||t.push(r);return t}var nd=lg;function cg(i){return Wr(i)?En(i,!0):nd(i)}var hr=cg;var dg=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,pg=/^\w*$/;function ug(i,e){if(ht(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||_o(i)?!0:pg.test(i)||!dg.test(i)||e!=null&&i in Object(e)}var sd=ug;var hg=Ot(Object,"create"),Ar=hg;function mg(){this.__data__=Ar?Ar(null):{},this.size=0}var ad=mg;function fg(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var ld=fg;var yg="__lodash_hash_undefined__",gg=Object.prototype,xg=gg.hasOwnProperty;function bg(i){var e=this.__data__;if(Ar){var t=e[i];return t===yg?void 0:t}return xg.call(e,i)?e[i]:void 0}var cd=bg;var vg=Object.prototype,Sg=vg.hasOwnProperty;function wg(i){var e=this.__data__;return Ar?e[i]!==void 0:Sg.call(e,i)}var dd=wg;var Ng="__lodash_hash_undefined__";function Cg(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=Ar&&e===void 0?Ng:e,this}var pd=Cg;function Vo(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}Vo.prototype.clear=ad;Vo.prototype.delete=ld;Vo.prototype.get=cd;Vo.prototype.has=dd;Vo.prototype.set=pd;var Aa=Vo;function Lg(){this.__data__=[],this.size=0}var ud=Lg;function Tg(i,e){for(var t=i.length;t--;)if(qr(i[t][0],e))return t;return-1}var $r=Tg;var Ig=Array.prototype,Mg=Ig.splice;function Pg(i){var e=this.__data__,t=$r(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():Mg.call(e,t,1),--this.size,!0}var hd=Pg;function Og(i){var e=this.__data__,t=$r(e,i);return t<0?void 0:e[t][1]}var md=Og;function Ag(i){return $r(this.__data__,i)>-1}var fd=Ag;function jg(i,e){var t=this.__data__,r=$r(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var yd=jg;function Uo(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}Uo.prototype.clear=ud;Uo.prototype.delete=hd;Uo.prototype.get=md;Uo.prototype.has=fd;Uo.prototype.set=yd;var Jr=Uo;var _g=Ot(et,"Map"),Kr=_g;function Dg(){this.size=0,this.__data__={hash:new Aa,map:new(Kr||Jr),string:new Aa}}var gd=Dg;function Bg(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var xd=Bg;function Gg(i,e){var t=i.__data__;return xd(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Xr=Gg;function zg(i){var e=Xr(this,i).delete(i);return this.size-=e?1:0,e}var bd=zg;function Eg(i){return Xr(this,i).get(i)}var vd=Eg;function Fg(i){return Xr(this,i).has(i)}var Sd=Fg;function Rg(i,e){var t=Xr(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var wd=Rg;function ko(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}ko.prototype.clear=gd;ko.prototype.delete=bd;ko.prototype.get=vd;ko.prototype.has=Sd;ko.prototype.set=wd;var Pi=ko;var Vg="Expected a function";function ja(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(Vg);var t=function(){var r=arguments,o=e?e.apply(this,r):r[0],n=t.cache;if(n.has(o))return n.get(o);var s=i.apply(this,r);return t.cache=n.set(o,s)||n,s};return t.cache=new(ja.Cache||Pi),t}ja.Cache=Pi;var Nd=ja;var Ug=500;function kg(i){var e=Nd(i,function(r){return t.size===Ug&&t.clear(),r}),t=e.cache;return e}var Cd=kg;var Hg=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,qg=/\\(\\)?/g,Wg=Cd(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(Hg,function(t,r,o,n){e.push(o?n.replace(qg,"$1"):r||t)}),e}),Ld=Wg;function $g(i){return i==null?"":Ac(i)}var Td=$g;function Jg(i,e){return ht(i)?i:sd(i,e)?[i]:Ld(Td(i))}var Ho=Jg;var Kg=1/0;function Xg(i){if(typeof i=="string"||_o(i))return i;var e=i+"";return e=="0"&&1/i==-Kg?"-0":e}var Rn=Xg;function Zg(i,e){e=Ho(e,i);for(var t=0,r=e.length;i!=null&&t<r;)i=i[Rn(e[t++])];return t&&t==r?i:void 0}var Id=Zg;function Qg(i,e){for(var t=-1,r=e.length,o=i.length;++t<r;)i[o+t]=e[t];return i}var qo=Qg;var Md=Ct?Ct.isConcatSpreadable:void 0;function Yg(i){return ht(i)||mo(i)||!!(Md&&i&&i[Md])}var Pd=Yg;function Od(i,e,t,r,o){var n=-1,s=i.length;for(t||(t=Pd),o||(o=[]);++n<s;){var a=i[n];e>0&&t(a)?e>1?Od(a,e-1,t,r,o):qo(o,a):r||(o[o.length]=a)}return o}var Ad=Od;function ex(i){var e=i==null?0:i.length;return e?Ad(i,1):[]}var jd=ex;function tx(i){return jn(Bn(i,void 0,jd),i+"")}var _d=tx;var rx=Fn(Object.getPrototypeOf,Object),Wo=rx;var ox="[object Object]",ix=Function.prototype,nx=Object.prototype,Dd=ix.toString,sx=nx.hasOwnProperty,ax=Dd.call(Object);function lx(i){if(!vt(i)||Ft(i)!=ox)return!1;var e=Wo(i);if(e===null)return!0;var t=sx.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Dd.call(t)==ax}var Vn=lx;function cx(i,e,t){var r=-1,o=i.length;e<0&&(e=-e>o?0:o+e),t=t>o?o:t,t<0&&(t+=o),o=e>t?0:t-e>>>0,e>>>=0;for(var n=Array(o);++r<o;)n[r]=i[r+e];return n}var Bd=cx;function dx(){this.__data__=new Jr,this.size=0}var Gd=dx;function px(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var zd=px;function ux(i){return this.__data__.get(i)}var Ed=ux;function hx(i){return this.__data__.has(i)}var Fd=hx;var mx=200;function fx(i,e){var t=this.__data__;if(t instanceof Jr){var r=t.__data__;if(!Kr||r.length<mx-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new Pi(r)}return t.set(i,e),this.size=t.size,this}var Rd=fx;function $o(i){var e=this.__data__=new Jr(i);this.size=e.size}$o.prototype.clear=Gd;$o.prototype.delete=zd;$o.prototype.get=Ed;$o.prototype.has=Fd;$o.prototype.set=Rd;var Un=$o;function yx(i,e){return i&&Kt(e,Ro(e),i)}var Vd=yx;function gx(i,e){return i&&Kt(e,hr(e),i)}var Ud=gx;var kd=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Hd=kd&&typeof module=="object"&&module&&!module.nodeType&&module,xx=Hd&&Hd.exports===kd,qd=xx?et.Buffer:void 0,Wd=qd?qd.allocUnsafe:void 0;function bx(i,e){if(e)return i.slice();var t=i.length,r=Wd?Wd(t):new i.constructor(t);return i.copy(r),r}var kn=bx;function vx(i,e){for(var t=-1,r=i==null?0:i.length,o=0,n=[];++t<r;){var s=i[t];e(s,t,i)&&(n[o++]=s)}return n}var $d=vx;function Sx(){return[]}var Hn=Sx;var wx=Object.prototype,Nx=wx.propertyIsEnumerable,Jd=Object.getOwnPropertySymbols,Cx=Jd?function(i){return i==null?[]:(i=Object(i),$d(Jd(i),function(e){return Nx.call(i,e)}))}:Hn,Jo=Cx;function Lx(i,e){return Kt(i,Jo(i),e)}var Kd=Lx;var Tx=Object.getOwnPropertySymbols,Ix=Tx?function(i){for(var e=[];i;)qo(e,Jo(i)),i=Wo(i);return e}:Hn,qn=Ix;function Mx(i,e){return Kt(i,qn(i),e)}var Xd=Mx;function Px(i,e,t){var r=e(i);return ht(i)?r:qo(r,t(i))}var Wn=Px;function Ox(i){return Wn(i,Ro,Jo)}var Zd=Ox;function Ax(i){return Wn(i,hr,qn)}var $n=Ax;var jx=Ot(et,"DataView"),Jn=jx;var _x=Ot(et,"Promise"),Kn=_x;var Dx=Ot(et,"Set"),Xn=Dx;var Qd="[object Map]",Bx="[object Object]",Yd="[object Promise]",ep="[object Set]",tp="[object WeakMap]",rp="[object DataView]",Gx=Pr(Jn),zx=Pr(Kr),Ex=Pr(Kn),Fx=Pr(Xn),Rx=Pr(On),fo=Ft;(Jn&&fo(new Jn(new ArrayBuffer(1)))!=rp||Kr&&fo(new Kr)!=Qd||Kn&&fo(Kn.resolve())!=Yd||Xn&&fo(new Xn)!=ep||On&&fo(new On)!=tp)&&(fo=function(i){var e=Ft(i),t=e==Bx?i.constructor:void 0,r=t?Pr(t):"";if(r)switch(r){case Gx:return rp;case zx:return Qd;case Ex:return Yd;case Fx:return ep;case Rx:return tp}return e});var Ko=fo;var Vx=Object.prototype,Ux=Vx.hasOwnProperty;function kx(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&Ux.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var op=kx;var Hx=et.Uint8Array,_a=Hx;function qx(i){var e=new i.constructor(i.byteLength);return new _a(e).set(new _a(i)),e}var Xo=qx;function Wx(i,e){var t=e?Xo(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var ip=Wx;var $x=/\w*$/;function Jx(i){var e=new i.constructor(i.source,$x.exec(i));return e.lastIndex=i.lastIndex,e}var np=Jx;var sp=Ct?Ct.prototype:void 0,ap=sp?sp.valueOf:void 0;function Kx(i){return ap?Object(ap.call(i)):{}}var lp=Kx;function Xx(i,e){var t=e?Xo(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var Zn=Xx;var Zx="[object Boolean]",Qx="[object Date]",Yx="[object Map]",e0="[object Number]",t0="[object RegExp]",r0="[object Set]",o0="[object String]",i0="[object Symbol]",n0="[object ArrayBuffer]",s0="[object DataView]",a0="[object Float32Array]",l0="[object Float64Array]",c0="[object Int8Array]",d0="[object Int16Array]",p0="[object Int32Array]",u0="[object Uint8Array]",h0="[object Uint8ClampedArray]",m0="[object Uint16Array]",f0="[object Uint32Array]";function y0(i,e,t){var r=i.constructor;switch(e){case n0:return Xo(i);case Zx:case Qx:return new r(+i);case s0:return ip(i,t);case a0:case l0:case c0:case d0:case p0:case u0:case h0:case m0:case f0:return Zn(i,t);case Yx:return new r;case e0:case o0:return new r(i);case t0:return np(i);case r0:return new r;case i0:return lp(i)}}var cp=y0;function g0(i){return typeof i.constructor=="function"&&!zo(i)?zc(Wo(i)):{}}var Qn=g0;var x0="[object Map]";function b0(i){return vt(i)&&Ko(i)==x0}var dp=b0;var pp=Or&&Or.isMap,v0=pp?Fo(pp):dp,up=v0;var S0="[object Set]";function w0(i){return vt(i)&&Ko(i)==S0}var hp=w0;var mp=Or&&Or.isSet,N0=mp?Fo(mp):hp,fp=N0;var C0=1,L0=2,T0=4,yp="[object Arguments]",I0="[object Array]",M0="[object Boolean]",P0="[object Date]",O0="[object Error]",gp="[object Function]",A0="[object GeneratorFunction]",j0="[object Map]",_0="[object Number]",xp="[object Object]",D0="[object RegExp]",B0="[object Set]",G0="[object String]",z0="[object Symbol]",E0="[object WeakMap]",F0="[object ArrayBuffer]",R0="[object DataView]",V0="[object Float32Array]",U0="[object Float64Array]",k0="[object Int8Array]",H0="[object Int16Array]",q0="[object Int32Array]",W0="[object Uint8Array]",$0="[object Uint8ClampedArray]",J0="[object Uint16Array]",K0="[object Uint32Array]",Fe={};Fe[yp]=Fe[I0]=Fe[F0]=Fe[R0]=Fe[M0]=Fe[P0]=Fe[V0]=Fe[U0]=Fe[k0]=Fe[H0]=Fe[q0]=Fe[j0]=Fe[_0]=Fe[xp]=Fe[D0]=Fe[B0]=Fe[G0]=Fe[z0]=Fe[W0]=Fe[$0]=Fe[J0]=Fe[K0]=!0;Fe[O0]=Fe[gp]=Fe[E0]=!1;function Yn(i,e,t,r,o,n){var s,a=e&C0,l=e&L0,c=e&T0;if(t&&(s=o?t(i,r,o,n):t(i)),s!==void 0)return s;if(!St(i))return i;var d=ht(i);if(d){if(s=op(i),!a)return An(i,s)}else{var u=Ko(i),p=u==gp||u==A0;if(Eo(i))return kn(i,a);if(u==xp||u==yp||p&&!o){if(s=l||p?{}:Qn(i),!a)return l?Xd(i,Ud(s,i)):Kd(i,Vd(s,i))}else{if(!Fe[u])return o?i:{};s=cp(i,u,a)}}n||(n=new Un);var f=n.get(i);if(f)return f;n.set(i,s),fp(i)?i.forEach(function(y){s.add(Yn(y,e,t,y,i,n))}):up(i)&&i.forEach(function(y,N){s.set(N,Yn(y,e,t,N,i,n))});var m=c?l?$n:Zd:l?hr:Ro,x=d?void 0:m(i);return Uc(x||i,function(y,N){x&&(N=y,y=i[N]),Dn(s,N,Yn(y,e,t,N,i,n))}),s}var es=Yn;var X0=1,Z0=4;function Q0(i){return es(i,X0|Z0)}var yo=Q0;function Y0(i){return function(e,t,r){for(var o=-1,n=Object(e),s=r(e),a=s.length;a--;){var l=s[i?a:++o];if(t(n[l],l,n)===!1)break}return e}}var bp=Y0;var eb=bp(),vp=eb;function tb(i,e,t){(t!==void 0&&!qr(i[e],t)||t===void 0&&!(e in i))&&Go(i,e,t)}var Oi=tb;function rb(i){return vt(i)&&Wr(i)}var Sp=rb;function ob(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var Ai=ob;function ib(i){return Kt(i,hr(i))}var wp=ib;function nb(i,e,t,r,o,n,s){var a=Ai(i,t),l=Ai(e,t),c=s.get(l);if(c){Oi(i,t,c);return}var d=n?n(a,l,t+"",i,e,s):void 0,u=d===void 0;if(u){var p=ht(l),f=!p&&Eo(l),m=!p&&!f&&zn(l);d=l,p||f||m?ht(a)?d=a:Sp(a)?d=An(a):f?(u=!1,d=kn(l,!0)):m?(u=!1,d=Zn(l,!0)):d=[]:Vn(l)||mo(l)?(d=a,mo(a)?d=wp(a):(!St(a)||Do(a))&&(d=Qn(l))):u=!1}u&&(s.set(l,d),o(d,l,r,n,s),s.delete(l)),Oi(i,t,d)}var Np=nb;function Cp(i,e,t,r,o){i!==e&&vp(e,function(n,s){if(o||(o=new Un),St(n))Np(i,e,s,t,Cp,r,o);else{var a=r?r(Ai(i,s),n,s+"",i,e,o):void 0;a===void 0&&(a=n),Oi(i,s,a)}},hr)}var Lp=Cp;function sb(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var Tp=sb;function ab(i,e){return e.length<2?i:Id(i,Bd(e,0,-1))}var Ip=ab;var lb=Wc(function(i,e,t){Lp(i,e,t)}),go=lb;function cb(i,e){return e=Ho(e,i),i=Ip(i,e),i==null||delete i[Rn(Tp(e))]}var Mp=cb;function db(i){return Vn(i)?void 0:i}var Pp=db;var pb=1,ub=2,hb=4,mb=_d(function(i,e){var t={};if(i==null)return t;var r=!1;e=In(e,function(n){return n=Ho(n,i),r||(r=n.length>1),n}),Kt(i,$n(i),t),r&&(t=es(t,pb|ub|hb,Pp));for(var o=e.length;o--;)Mp(t,e[o]);return t}),Zo=mb;var Qo;(function(t){t.all=["PerspectiveCamera","OrthographicCamera"];function e(r){return t.all.includes(r)}t.is=e})(Qo||(Qo={}));var xo;(function(o){o.DefaultUp=[0,1,0],o.DefaultTargetOffset=1e3,o.defaultData={far:5e5,type:"OrthographicCamera",perspective:{near:5,fov:45,zoom:1},orthographic:{near:-5e5,zoom:1},up:o.DefaultUp,isUpVectorFlipped:!1,targetOffset:o.DefaultTargetOffset};function r(n){return n.type==="PerspectiveCamera"?n.perspective.zoom:n.orthographic.zoom}o.getZoom=r})(xo||(xo={}));var Yo;(function(r){r.x="x",r.y="y",r.z="z"})(Yo||(Yo={}));var Op;(function(n){n.Top="top",n.Right="right",n.Bottom="bottom",n.Left="left",n.Center="center"})(Op||(Op={}));var Ap;(function(t){function i(r,o){return r[0]===o[0]&&r[1]===o[1]}t.isEqual=i;function e(r,o,n){return[r[0]+(o[0]-r[0])*n,r[1]+(o[1]-r[1])*n]}t.lerp=e})(Ap||(Ap={}));var ei;(function(o){function i(n,s){return n[0]===s[0]&&n[1]===s[1]&&n[2]===s[2]}o.isEqual=i;function e(n,s){return[n[0]+s[0],n[1]+s[1],n[2]+s[2]]}o.add=e;function t(n,s){return[n[0]-s[0],n[1]-s[1],n[2]-s[2]]}o.sub=t;function r(n,s,a){return[n[0]+(s[0]-n[0])*a,n[1]+(s[1]-n[1])*a,n[2]+(s[2]-n[2])*a]}o.lerp=r})(ei||(ei={}));var jp;(function(t){function i(r,o){return r[0]===o[0]&&r[1]===o[1]&&r[2]===o[2]&&r[3]===o[3]}t.isEqual=i;function e(r,o,n){return[r[0]+(o[0]-r[0])*n,r[1]+(o[1]-r[1])*n,r[2]+(o[2]-r[2])*n,r[3]+(o[3]-r[3])*n]}t.lerp=e})(jp||(jp={}));var Zr;(function(n){n.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function e(s,a){for(let l=0;l<16;l++)if(s[l]!==a[l])return!1;return!0}n.isEqual=e;function t(s){return s!=null?s:n.identity}n.simplify=t;function r(s,a){let l=a.slice(0);for(var c=0,d=a.length;c<d;c+=3){let u=1/(s[3]*a[c]+s[7]*a[c+1]+s[11]*a[c+2]+s[15]);l[c]=(s[0]*a[c]+s[4]*a[c+1]+s[8]*a[c+2]+s[12])*u,l[c+1]=(s[1]*a[c]+s[5]*a[c+1]+s[9]*a[c+2]+s[13])*u,l[c+2]=(s[2]*a[c]+s[6]*a[c+1]+s[10]*a[c+2]+s[14])*u}return l}n.applyMatrix4=r;function o(s,a){let l=a.slice(0);for(var c=0,d=a.length;c<d;c+=3)l[c]=s[0]*a[c]+s[4]*a[c+1]+s[8]*a[c+2],l[c+1]=s[1]*a[c]+s[5]*a[c+1]+s[9]*a[c+2],l[c+2]=s[2]*a[c]+s[6]*a[c+1]+s[10]*a[c+2];return l}n.applyMatrix3Components=o})(Zr||(Zr={}));var Rt;(function(l){l.white={r:1,g:1,b:1},l.red={r:1,g:0,b:0},l.black={r:0,g:0,b:0};function r(c){return{r:Math.round(c.r*255),g:Math.round(c.g*255),b:Math.round(c.b*255),a:1}}l.toRgb255a1=r;function o(c){return{r:c.r,g:c.g,b:c.b}}l.clone=o;function n(c){return c=Math.floor(c),{r:(c>>16&255)/255,g:(c>>8&255)/255,b:(c&255)/255}}l.fromHex=n;function s(c,d){return c.r===d.r&&c.g===d.g&&c.b===d.b}l.equals=s;function a(c,d,u){return{r:c.r+(d.r-c.r)*u,g:c.g+(d.g-c.g)*u,b:c.b+(d.b-c.b)*u}}l.lerp=a})(Rt||(Rt={}));var mr;(function(n){n.white=$(O({},Rt.white),{a:1});function e(s){return{r:s[0],g:s[1],b:s[2],a:s[3]}}n.from0to1=e;function t(s,a){return $(O({},Rt.fromHex(s)),{a})}n.fromHexAndA=t;function r(s){return{r:Math.round(s.r*255),g:Math.round(s.g*255),b:Math.round(s.b*255),a:s.a}}n.toRgb255a1=r;function o(s,a){return Rt.equals(s,a)&&s.a===a.a}n.equals=o})(mr||(mr={}));var ts;(function(e){e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]}})(ts||(ts={}));var _p;(function(w){w[w.SKIP=0]="SKIP",w[w.ADD=1]="ADD",w[w.ALPHA=2]="ALPHA",w[w.AVERAGE=3]="AVERAGE",w[w.COLOR_BURN=4]="COLOR_BURN",w[w.COLOR_DODGE=5]="COLOR_DODGE",w[w.DARKEN=6]="DARKEN",w[w.DIFFERENCE=7]="DIFFERENCE",w[w.EXCLUSION=8]="EXCLUSION",w[w.LIGHTEN=9]="LIGHTEN",w[w.MULTIPLY=10]="MULTIPLY",w[w.DIVIDE=11]="DIVIDE",w[w.NEGATION=12]="NEGATION",w[w.NORMAL=13]="NORMAL",w[w.OVERLAY=14]="OVERLAY",w[w.REFLECT=15]="REFLECT",w[w.SCREEN=16]="SCREEN",w[w.SOFT_LIGHT=17]="SOFT_LIGHT",w[w.SUBTRACT=18]="SUBTRACT"})(_p||(_p={}));var Dp;(function(a){a[a.LINEAR=0]="LINEAR",a[a.EASE=1]="EASE",a[a.EASE_IN=2]="EASE_IN",a[a.EASE_OUT=3]="EASE_OUT",a[a.EASE_IN_OUT=4]="EASE_IN_OUT",a[a.CUBIC=5]="CUBIC",a[a.SPRING=6]="SPRING"})(Dp||(Dp={}));var Bp;(function(e){e.defaultData={mass:1,stiffness:80,damping:10,velocity:0}})(Bp||(Bp={}));var Gp;(function(e){e.defaultData={control1:[.5,.05],control2:[.1,.3]}})(Gp||(Gp={}));var rs;(function(e){function i(t,r=.1){return{type:"radial",hideBase:!1,count:3,radial:{radius:Math.max(t[0],t[1])*2,start:0,end:360,alignment:!1,axis:Yo.y,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0]},linear:{scale:[0,0,0],rotation:[0,0,0],position:[t[0]+t[0]*r,0,0]},grid:{count:[2,2,2],size:t.map(o=>o*(1+r)),useCenter:!0}}}e.defaultData=i})(rs||(rs={}));var jr;(function(e){e[e.Update=0]="Update"})(jr||(jr={}));var Xt;(function(r){r[r.Add=1]="Add",r[r.Delete=2]="Delete",r[r.Unlink=3]="Unlink"})(Xt||(Xt={}));var Vt;(function(r){r[r.Add=4]="Add",r[r.Delete=5]="Delete",r[r.Move=6]="Move"})(Vt||(Vt={}));var At;(function(r){r[r.Add=7]="Add",r[r.Delete=8]="Delete",r[r.Move=9]="Move"})(At||(At={}));var nr=class{modifyById(e,t){let r=this;if(r[e]===void 0)throw new Error("not expected");{let n=$(O({},r),{[e]:t});return Object.setPrototypeOf(n,nr.prototype),n}}add(e,t){var o;let r=this.runOp({type:Xt.Add,id:e,data:t});return(o=r==null?void 0:r.data)!=null?o:this}runOp(e){let t=this;if(e.type===Xt.Add){let r=t[e.id],o;r===void 0?o={type:Xt.Delete,id:e.id}:o={type:Xt.Add,id:e.id,data:r};let{id:n,data:s}=e,a=$(O({},t),{[n]:s});return Object.setPrototypeOf(a,nr.prototype),{data:a,actual:e,reverse:o}}else if(e.type===Xt.Delete){let{id:r}=e,o=t[r];if(o===void 0)return null;{let n=O({},t);return Object.setPrototypeOf(n,nr.prototype),delete n[r],{data:n,actual:e,reverse:{type:Xt.Add,id:r,data:o}}}}throw new Error("illegal arg")}};function ji(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let e=Object.getOwnPropertyNames(i);for(let t of e){let r=i[t];r&&typeof r=="object"&&ji(r)}return Object.freeze(i)}function zp(i,e){let t=0;for(;t<i.length&&t<e.length;){if(i[t]<e[t])return-1;if(i[t]>e[t])return 1;t+=1}return t!==e.length?-1:t!==i.length?1:0}var Da=class extends Error{};function fr(i,e,t){if(i===void 0?e===void 0?(i=0,e=10):i=e-10:e===void 0&&(e=i+10),i>e){let n=i;i=e,e=n}let r=[],o=1/(t+1);for(let n=0;n<t;n++){let s=i+(e-i)*(n+.75+Math.random()*.5)*o;r.push(s)}return r}function Ep(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function Fp(){return typeof process!="undefined"}function Rp(i,e){for(let t of i)e(t.id,t.data),Rp(t.children,e)}function Vp(i,e){e(i.id,i.data);for(let t of i.children)Vp(t,e)}var sr=class extends Array{constructor(...e){super(...e);Object.setPrototypeOf(this,sr.prototype)}deepFreeze(){let e=0;for(;e<this.length;)ji(this[e]),e++}fillCaches0(e,t){var r;if((r=this.objCaches)==null?void 0:r.has(e.id))throw new Error("duplicated item");this.objCaches.set(e.id,e),this.parentCaches.set(e.id,t);for(let o of e.children)this.fillCaches0(o,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}isDescendantOf(e,t){for(;e;){let r=this.parent(e);if(r===t)return!0;e=r}return!1}data(e){var t;return(t=this.get(e))==null?void 0:t.data}has(e){return this.childrenOf(e)!==void 0}get(e){return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){var t;return e===null?this:(t=this.get(e))==null?void 0:t.children}traverseFrom(e,t){if(e===null)this.traverse(t);else{let r=this.get(e);r&&Vp(r,t)}}traverse(e){Rp(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let o=this.parent(e),n=this.childrenArray(o),s=n.findIndex(c=>c.id===e);if(s<0)throw new Error("not expected");let a=n[s];return n=[...n],n[s]=$(O({},a),{data:t}),this.modifyArrayBy(o,n)}}modifyArrayBy(e,t){let r=e,o=t;for(;r!==null;){let s=o,a=r;if(r=this.parent(r),r===void 0)throw new Error;o=this.childrenArray(r);let l=o.findIndex(c=>c.id===a);if(l<0)throw new Error;o=[...o],o[l]=$(O({},o[l]),{children:s})}Object.setPrototypeOf(o,sr.prototype);let n=o;return n.fillCaches(),n}runOp(e){switch(e.type){case At.Add:return this.addOp(e);case At.Delete:return this.deleteOp(e);case At.Move:return this.moveOp(e)}}addOp(e){let{parent:t,fi:r,id:o,data:n,children:s}=e;if(t!==null&&this.get(t)===void 0)return null;if(this.get(o)!==void 0)return null;{let a=t,l=this.childrenArray(a),c={fi:r,id:o,data:n,children:s};return l=[...l,c],l.sort((u,p)=>u.fi-p.fi),e.localIndex=l.indexOf(c),{data:this.modifyArrayBy(a,l),actual:e,reverse:{type:At.Delete,id:o}}}}deleteOp(e){let{id:t}=e;if(this.get(t)===null)return null;{let r=this.parent(t);if(r===void 0)return null;let o=this.childrenArray(r),n=o.findIndex(l=>l.id===t);e.localIndex=n,o=[...o];let s=o.splice(n,1)[0];return{data:this.modifyArrayBy(r,o),actual:e,reverse:$(O({type:At.Add},s),{parent:r})}}}moveOp(e){let{parent:t,fi:r,id:o}=e;if(t!==null&&this.get(t)===void 0)return this.deleteOp({type:At.Delete,id:o});if(t!==null){let p=t;for(;p!==null;){if(p===void 0)throw new Error;if(p===o)throw new Da("cyclic tree");p=this.parent(p)}}let n=this.parent(o);if(n===void 0)return null;let s=n,a=this.childrenArray(n),l=a.findIndex(p=>p.id===o);a=[...a];let c=a.splice(l,1)[0],d=this.modifyArrayBy(n,a);n=t,a=d.childrenArray(n);let u=c.fi;return c=$(O({},c),{fi:r}),a=[...a,c],a.sort((p,f)=>p.fi-f.fi),e.localIndex=a.indexOf(c),d=d.modifyArrayBy(n,a),{data:d,actual:e,reverse:{type:At.Move,parent:s,fi:u,id:o}}}previous(e,t){if(t===null){let o=this.childrenArray(e);return o.length===0?null:o[o.length-1].id}let r=null;for(let o of this.childrenArray(e)){if(o.id===t)return r;r=o.id}return null}traverseSortNext(e){let t=this.parent(e);if(t!==void 0){let r=this.childrenArray(t),o=r.findIndex(n=>n.id===e)+1;if(o<r.length)return r[o].id;if(t)return this.traverseSortNext(t)}}sortNext(e){let t=this.childrenArray(e);return t.length>0?t[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}sortPrevious(e){let t=this.parent(e);if(t!==void 0){let r=this.childrenArray(t),o=r.findIndex(n=>n.id===e)-1;return o>=0?this.traverseSortPrevious(r[o].id):t}}getAllSorted(e){let t=[];for(let r of e){let o=this.getWithSortKey(r.id);o!==void 0&&t.push(O(O({},r),o))}t.sort((r,o)=>zp(r.sortKey,o.sortKey));for(let r of t)delete r.sortKey;return t}getWithSortKey(e){var t=e;let r=[],o=this.get(t),n=o;if(o!==void 0){for(;t;)r.splice(0,0,o.fi),t=this.parent(t),t!==null&&(o=this.get(t));return $(O({},n),{sortKey:r})}}insertBeforeHelper(e,t,r){return this.insertAfterHelper(e,this.previous(e,t),r)}insertAfterHelper(e,t,r){let o=this.childrenArray(e);if(t===null){if(o.length===0)return fr(0,r,r);{let n=o[0].fi;return fr(n-r,n,r)}}else{let n=this.get(t);if(n===void 0||this.parent(t)!==e)throw new Error("illegal args");let s=o.find(a=>a.fi>n.fi);if(s===void 0){let a=o[o.length-1].fi;return fr(a,a+r,r)}else return fr(n.fi,s.fi,r)}}};var os;(function(e){function i(t,r){if(Array.isArray(t)){let o=r.props,n={},s=[...t],a=!1;if(o)for(let l of Object.keys(o)){let c=parseInt(l);if(isNaN(c))throw new Error("wrong index");n[l]=s[c],s[c]=o[l],a=!0}return a?{data:s,actual:r,reverse:{type:jr.Update,props:n}}:null}else{let o=r.props,n={},s=O({},t),a=!1;if(o)for(let l of Object.keys(o))n[l]=s[l],s[l]=o[l],a=!0;return a?{data:s,actual:r,reverse:{type:jr.Update,props:n}}:null}}e.runOp=i})(os||(os={}));var Ke=class extends Array{constructor(...e){super(...e);Object.setPrototypeOf(this,Ke.prototype)}deepFreeze(){let e=0;for(;e<this.length;)ji(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){var t;return(t=this.get(e))==null?void 0:t.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let o=this,n=o.findIndex(l=>l.id===e);if(n<0)throw new Error("not expected");let s=o[n];return o=[...o],o[n]=$(O({},s),{data:t}),this.modifyArrayBy(o)}}modifyArrayBy(e){Object.setPrototypeOf(e,Ke.prototype);let t=e;return Fp()||t.fillCaches(),t}runOp(e){switch(e.type){case Vt.Add:return this.addOp(e);case Vt.Delete:return this.deleteOp(e);case Vt.Move:return this.moveOp(e)}}addOp(e){let{fi:t,id:r,data:o}=e,n=this,s={fi:t,id:r,data:o};return n=[...n,s],n.sort((l,c)=>l.fi-c.fi),e.localIndex=n.indexOf(s),{data:this.modifyArrayBy(n),actual:e,reverse:{type:Vt.Delete,id:r}}}deleteOp(e){let{id:t}=e,r=this,o=r.findIndex(a=>a.id===t);if(o===-1)return null;e.localIndex=o,r=[...r];let n=r.splice(o,1)[0];return{data:this.modifyArrayBy(r),actual:e,reverse:O({type:Vt.Add},n)}}moveOp(e){let{fi:t,id:r}=e,o=this;o=[...o];let n=o.findIndex(c=>c.id===r);if(n===-1)return null;let s=o[n].fi,a=$(O({},o[n]),{fi:t});return o[n]=a,o.sort((c,d)=>c.fi-d.fi),e.localIndex=o.indexOf(a),{data:this.modifyArrayBy(o),actual:e,reverse:{type:Vt.Move,fi:s,id:r}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let t=null;for(let r of this){if(r.id===e)return t;t=r.id}return null}insertBeforeHelper(e,t){return this.insertAfterHelper(this.previous(e),t)}insertAfterHelper(e,t){let r=this;if(e===null){if(r.length===0)return fr(0,t,t);{let o=r[0].fi;return fr(o-t,o,t)}}else{let o=this.get(e);if(o===void 0)throw new Error("illegal args");let n=r.find(s=>s.fi>o.fi);if(n===void 0){let s=r[r.length-1].fi;return fr(s,s+t,t)}else return fr(o.fi,n.fi,t)}}};var Up=Symbol(),is=Symbol(),_i=class{reportOp(e,t){let r=this;if(t===null)return;r._current=t.data;let o=[];for(;!(r instanceof Ga);){let n=r._path,s=r._current;if(n!==""&&o.splice(0,0,n),r=r._parent,r===null)return;r.update(n,s)}r.push(o,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let r=t[is];r&&r(),delete this._children[e]}}}},kp=class extends _i{constructor(e,t,r){super();this._parent=e,this._path=t,this._current=r}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=$(O({},this._current),{[e]:t})}runOp(e){this.reportOp(e,os.runOp(this._current,e))}},Hp=class extends _i{constructor(e,t,r){super();this._parent=e,this._path=t,this._current=r}update(e,t){this._current=$(O({},this._current),{[e]:t}),Object.setPrototypeOf(this._current,nr.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},qp={get(i,e){if(e===is)return()=>{i._parent=null};if(e===Up)return i._current;let{_current:t,_children:r}=i;if(e==="push"&&Array.isArray(t))throw new Error("not supported to expand array");let o=r===void 0?void 0:r[e];if(o!==void 0)return o;let n=t[e],s=ns(i,e,n);return s!==n?(r===void 0&&(r={},i._children=r),r[e]=s,s):n},has(i,e){return e in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,e){let t=i._current,r=Reflect.getOwnPropertyDescriptor(t,e);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:t[e]}}},fb=$(O({},qp),{set(i,e,t){var o;let r;if(t===void 0)throw new Error("set to undefined is not supported!");return r={type:jr.Update,props:{[e]:(o=xb(t))!=null?o:t}},i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){throw new Error("set to undefined is not supported!")}}),yb=$(O({},qp),{set(i,e,t){return t===void 0?this.deleteProperty(i,e):(i.deleteChildren(e),i.runOp({type:Xt.Add,id:e,data:t})),!0},deleteProperty(i,e){return i.runOp({type:Xt.Delete,id:e}),!0}}),Di=class extends _i{constructor(e,t,r){super();this._children={},this._parent=e,this._path=t,this._current=r,this[is]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,r)=>{e(t,this.data(t))})}data(e){var a;let{_current:t,_children:r}=this,o=r===void 0?void 0:r[e];if(o!==void 0)return o;let n=(a=t.get(e))==null?void 0:a.data,s=ns(this,e,n);return s!==n?(r===void 0&&(r={},this._children=r),r[e]=s,s):n}add(e,t,r,o,n){this.runOp({type:At.Add,parent:e,fi:t,id:r,data:o,children:n})}move(e,t,r){this.runOp({type:At.Move,parent:e,fi:t,id:r})}insertAfter(e,t,r){let o=this._current.insertAfterHelper(e,t,r.length);for(let n=0;n<r.length;n++){let s=r[n];this.add(e,o[n],s.id,s.data,s.children)}}insertBefore(e,t,r){let o=this._current.insertBeforeHelper(e,t,r.length);for(let n=0;n<r.length;n++){let s=r[n];this.add(e,o[n],s.id,s.data,s.children)}}moveAfter(e,t,r){let o=this._current.insertAfterHelper(e,t,r.length);for(let n=0;n<r.length;n++){let s=r[n];this.move(e,o[n],s)}}moveBefore(e,t,r){let o=this._current.insertBeforeHelper(e,t,r.length);for(let n=0;n<r.length;n++){let s=r[n];this.move(e,o[n],s)}}delete(e){this.deleteChildren(e),this.runOp({type:At.Delete,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},Bi=class extends _i{constructor(e,t,r){super();this._children={},this._parent=e,this._path=t,this._current=r,this[is]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let r=0;r<t;r++){let o=this._current[r].id;e(this.data(this._current[r].id),o)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return $(O({},this._current.get(e)),{data:this.data(e)})}data(e){var a;let{_current:t,_children:r}=this,o=r===void 0?void 0:r[e];if(o!==void 0)return o;let n=(a=t.get(e))==null?void 0:a.data,s=ns(this,e,n);return s!==n?(r===void 0&&(r={},this._children=r),r[e]=s,s):n}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,r){this.runOp({type:Vt.Add,fi:e,id:t,data:r})}move(e,t){this.runOp({type:Vt.Move,fi:e,id:t})}insertAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let o=0;o<t.length;o++){let n=t[o];this.add(r[o],n.id,n.data)}}insertBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let o=0;o<t.length;o++){let n=t[o];this.add(r[o],n.id,n.data)}}moveAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let o=0;o<t.length;o++){let n=t[o];this.move(r[o],n)}}moveBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let o=0;o<t.length;o++){let n=t[o];this.move(r[o],n)}}delete(e){this.deleteChildren(e),this.runOp({type:Vt.Delete,id:e})}};function Ba(i,e,t){if(i.length>0){let r=i[i.length-1];if(r.type===jr.Update&&e.type===jr.Update&&ss.equal(r.path,t)){Object.assign(r.props,e.props);return}}i.push($(O({},e),{path:t}))}var Ga=class{constructor(e){this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,r,o){Ba(this.ts,t,e),Ba(this.actual,r,e),Ba(this.reverse,o,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function ns(i,e,t){return t instanceof sr?new Di(i,e,t):t instanceof Ke?new Bi(i,e,t):t instanceof nr?new Proxy(new Hp(i,e,t),yb):t!==null&&typeof t=="object"?Ep(t)?t:new Proxy(new kp(i,e,t),fb):t}function gb(i){let e=new Ga(i);return[ns(e,"",i),e]}function za(i,e){let[t,r]=gb(i);return e(t),r.result()}function xb(i){return i instanceof Di||i instanceof Bi?i._current:i!==null&&typeof i=="object"?i[Up]:i}var ss;(function(r){function i(o,n){if(n.length===o.length)for(var s=0;s<o.length;){if(o[s]!==n[s])return!1;s+=1}else return!1;return!0}r.equal=i;function e(o,n,s){let a=t(s,o);if(a!==void 0&&typeof a=="object"&&a!==null){let l=O({},n);return Object.keys(a).forEach(c=>{delete l[c]}),l}else return n}r.removeOverridden=e;function t(o,n,s=0){if(n.length<=s)return o;if((o instanceof sr||o instanceof Di)&&typeof n[s]=="string")return t(o.data(n[s]),n,s+1);if((o instanceof Ke||o instanceof Bi)&&typeof n[s]=="string")return t(o.data(n[s]),n,s+1);if(typeof n[s]=="number"&&Array.isArray(o))return t(o[n[s]],n,s+1);if(typeof n[s]=="string"&&typeof o=="object")return t(o[n[s]],n,s+1)}r.zoom=t})(ss||(ss={}));var Ea=class{},as=class extends Ea{constructor(e){super();this.id=e}},ls=class extends Ea{constructor(e){super();this.data=e}};"use strict";var Fa;try{Fa=new TextDecoder}catch(i){}var Q,Qr,C=0;var Wp=[],Ra=Wp,Va=0,jt={},Me,Yr,Zt=0,yr=0,Ut,_r,Lt=[],Ae,$p={useRecords:!1,mapsAsObjects:!0},cs=class{},Ua=new cs;Ua.name="MessagePack 0xC1";var ti=!1,Dr=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(Q)return iu(()=>(us(),this?this.unpack(e,t):Dr.prototype.unpack.call($p,e,t)));Qr=t>-1?t:e.length,C=0,Va=0,yr=0,Yr=null,Ra=Wp,Ut=null,Q=e;try{Ae=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){throw Q=null,e instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof Dr){if(jt=this,this.structures)return Me=this.structures,ds();(!Me||Me.length>0)&&(Me=[])}else jt=$p,(!Me||Me.length>0)&&(Me=[]);return ds()}unpackMultiple(e,t){let r,o=0;try{ti=!0;let n=e.length,s=this?this.unpack(e,n):ms.unpack(e,n);if(t){for(t(s);C<n;)if(o=C,t(ds())===!1)return}else{for(r=[s];C<n;)o=C,r.push(ds());return r}}catch(n){throw n.lastPosition=o,n.values=r,n}finally{ti=!1,us()}}_mergeStructures(e,t){e=e||[];for(let r=0,o=e.length;r<o;r++){let n=e[r];n&&(n.isShared=!0,r>=32&&(n.highByte=r-32>>5))}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let o=e[r],n=t[r];n&&(o&&((e.restoreStructures||(e.restoreStructures=[]))[r]=o),e[r]=n)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function ds(){try{if(!jt.trusted&&!ti){let e=Me.sharedLength||0;e<Me.length&&(Me.length=e)}let i=Xe();if(C==Qr)Me.restoreStructures&&Jp(),Me=null,Q=null,_r&&(_r=null);else if(C>Qr){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!ti)throw new Error("Data read, but end of buffer not reached");return i}catch(i){throw Me.restoreStructures&&Jp(),us(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function Jp(){for(let i in Me.restoreStructures)Me[i]=Me.restoreStructures[i];Me.restoreStructures=null}function Xe(){let i=Q[C++];if(i<160)if(i<128){if(i<64)return i;{let e=Me[i&63]||jt.getStructures&&Xp()[i&63];return e?(e.read||(e.read=ka(e,i&63)),e.read()):i}}else if(i<144)if(i-=128,jt.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[tu()]=Xe();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(Xe(),Xe());return e}else{i-=144;let e=new Array(i);for(let t=0;t<i;t++)e[t]=Xe();return e}else if(i<192){let e=i-160;if(yr>=C)return Yr.slice(C-Zt,(C+=e)-Zt);if(yr==0&&Qr<140){let t=e<16?qa(e):Yp(e);if(t!=null)return t}return Ha(e)}else{let e;switch(i){case 192:return null;case 193:return Ut?(e=Xe(),e>0?Ut[1].slice(Ut.position1,Ut.position1+=e):Ut[0].slice(Ut.position0,Ut.position0-=e)):Ua;case 194:return!1;case 195:return!0;case 196:return Wa(Q[C++]);case 197:return e=Ae.getUint16(C),C+=2,Wa(e);case 198:return e=Ae.getUint32(C),C+=4,Wa(e);case 199:return bo(Q[C++]);case 200:return e=Ae.getUint16(C),C+=2,bo(e);case 201:return e=Ae.getUint32(C),C+=4,bo(e);case 202:if(e=Ae.getFloat32(C),jt.useFloat32>2){let t=hs[(Q[C]&127)<<1|Q[C+1]>>7];return C+=4,(t*e+(e>0?.5:-.5)>>0)/t}return C+=4,e;case 203:return e=Ae.getFloat64(C),C+=8,e;case 204:return Q[C++];case 205:return e=Ae.getUint16(C),C+=2,e;case 206:return e=Ae.getUint32(C),C+=4,e;case 207:return jt.int64AsNumber?(e=Ae.getUint32(C)*4294967296,e+=Ae.getUint32(C+4)):e=Ae.getBigUint64(C),C+=8,e;case 208:return Ae.getInt8(C++);case 209:return e=Ae.getInt16(C),C+=2,e;case 210:return e=Ae.getInt32(C),C+=4,e;case 211:return jt.int64AsNumber?(e=Ae.getInt32(C)*4294967296,e+=Ae.getUint32(C+4)):e=Ae.getBigInt64(C),C+=8,e;case 212:if(e=Q[C++],e==114)return ru(Q[C++]&63);{let t=Lt[e];if(t)return t.read?(C++,t.read(Xe())):t.noBuffer?(C++,t()):t(Q.subarray(C,++C));throw new Error("Unknown extension "+e)}case 213:return e=Q[C],e==114?(C++,ru(Q[C++]&63,Q[C++])):bo(2);case 214:return bo(4);case 215:return bo(8);case 216:return bo(16);case 217:return e=Q[C++],yr>=C?Yr.slice(C-Zt,(C+=e)-Zt):vb(e);case 218:return e=Ae.getUint16(C),C+=2,yr>=C?Yr.slice(C-Zt,(C+=e)-Zt):Sb(e);case 219:return e=Ae.getUint32(C),C+=4,yr>=C?Yr.slice(C-Zt,(C+=e)-Zt):wb(e);case 220:return e=Ae.getUint16(C),C+=2,Zp(e);case 221:return e=Ae.getUint32(C),C+=4,Zp(e);case 222:return e=Ae.getUint16(C),C+=2,Qp(e);case 223:return e=Ae.getUint32(C),C+=4,Qp(e);default:if(i>=224)return i-256;if(i===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+i)}}}var bb=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function ka(i,e){function t(){if(t.count++>2){let o=i.read=new Function("r","return function(){return {"+i.map(n=>bb.test(n)?n+":r()":"["+JSON.stringify(n)+"]:r()").join(",")+"}}")(Xe);return i.highByte===0&&(i.read=Kp(e,i.read)),o()}let r={};for(let o=0,n=i.length;o<n;o++){let s=i[o];r[s]=Xe()}return r}return t.count=0,i.highByte===0?Kp(e,t):t}var Kp=(i,e)=>function(){let t=Q[C++];if(t===0)return e();let r=i<32?-(i+(t<<5)):i+(t<<5),o=Me[r]||Xp()[r];if(!o)throw new Error("Record id is not defined for "+r);return o.read||(o.read=ka(o,i)),o.read()};function Xp(){let i=iu(()=>(Q=null,jt.getStructures()));return Me=jt._mergeStructures(i,Me)}var Ha=ps,vb=ps,Sb=ps,wb=ps;function ps(i){let e;if(i<16&&(e=qa(i)))return e;if(i>64&&Fa)return Fa.decode(Q.subarray(C,C+=i));let t=C+i,r=[];for(e="";C<t;){let o=Q[C++];if((o&128)==0)r.push(o);else if((o&224)==192){let n=Q[C++]&63;r.push((o&31)<<6|n)}else if((o&240)==224){let n=Q[C++]&63,s=Q[C++]&63;r.push((o&31)<<12|n<<6|s)}else if((o&248)==240){let n=Q[C++]&63,s=Q[C++]&63,a=Q[C++]&63,l=(o&7)<<18|n<<12|s<<6|a;l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|l&1023),r.push(l)}else r.push(o);r.length>=4096&&(e+=ct.apply(String,r),r.length=0)}return r.length>0&&(e+=ct.apply(String,r)),e}function Zp(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=Xe();return e}function Qp(i){if(jt.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[tu()]=Xe();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(Xe(),Xe());return e}}var ct=String.fromCharCode;function Yp(i){let e=C,t=new Array(i);for(let r=0;r<i;r++){let o=Q[C++];if((o&128)>0){C=e;return}t[r]=o}return ct.apply(String,t)}function qa(i){if(i<4)if(i<2){if(i===0)return"";{let e=Q[C++];if((e&128)>1){C-=1;return}return ct(e)}}else{let e=Q[C++],t=Q[C++];if((e&128)>0||(t&128)>0){C-=2;return}if(i<3)return ct(e,t);let r=Q[C++];if((r&128)>0){C-=3;return}return ct(e,t,r)}else{let e=Q[C++],t=Q[C++],r=Q[C++],o=Q[C++];if((e&128)>0||(t&128)>0||(r&128)>0||(o&128)>0){C-=4;return}if(i<6){if(i===4)return ct(e,t,r,o);{let n=Q[C++];if((n&128)>0){C-=5;return}return ct(e,t,r,o,n)}}else if(i<8){let n=Q[C++],s=Q[C++];if((n&128)>0||(s&128)>0){C-=6;return}if(i<7)return ct(e,t,r,o,n,s);let a=Q[C++];if((a&128)>0){C-=7;return}return ct(e,t,r,o,n,s,a)}else{let n=Q[C++],s=Q[C++],a=Q[C++],l=Q[C++];if((n&128)>0||(s&128)>0||(a&128)>0||(l&128)>0){C-=8;return}if(i<10){if(i===8)return ct(e,t,r,o,n,s,a,l);{let c=Q[C++];if((c&128)>0){C-=9;return}return ct(e,t,r,o,n,s,a,l,c)}}else if(i<12){let c=Q[C++],d=Q[C++];if((c&128)>0||(d&128)>0){C-=10;return}if(i<11)return ct(e,t,r,o,n,s,a,l,c,d);let u=Q[C++];if((u&128)>0){C-=11;return}return ct(e,t,r,o,n,s,a,l,c,d,u)}else{let c=Q[C++],d=Q[C++],u=Q[C++],p=Q[C++];if((c&128)>0||(d&128)>0||(u&128)>0||(p&128)>0){C-=12;return}if(i<14){if(i===12)return ct(e,t,r,o,n,s,a,l,c,d,u,p);{let f=Q[C++];if((f&128)>0){C-=13;return}return ct(e,t,r,o,n,s,a,l,c,d,u,p,f)}}else{let f=Q[C++],m=Q[C++];if((f&128)>0||(m&128)>0){C-=14;return}if(i<15)return ct(e,t,r,o,n,s,a,l,c,d,u,p,f,m);let x=Q[C++];if((x&128)>0){C-=15;return}return ct(e,t,r,o,n,s,a,l,c,d,u,p,f,m,x)}}}}}function Wa(i){return jt.copyBuffers?Uint8Array.prototype.slice.call(Q,C,C+=i):Q.subarray(C,C+=i)}function bo(i){let e=Q[C++];if(Lt[e])return Lt[e](Q.subarray(C,C+=i));throw new Error("Unknown extension type "+e)}var eu=new Array(4096);function tu(){let i=Q[C++];if(i>=160&&i<192){if(i=i-160,yr>=C)return Yr.slice(C-Zt,(C+=i)-Zt);if(!(yr==0&&Qr<180))return Ha(i)}else return C--,Xe();let e=(i<<5^(i>1?Ae.getUint16(C):i>0?Q[C]:0))&4095,t=eu[e],r=C,o=C+i-3,n,s=0;if(t&&t.bytes==i){for(;r<o;){if(n=Ae.getUint32(r),n!=t[s++]){r=1879048192;break}r+=4}for(o+=3;r<o;)if(n=Q[r++],n!=t[s++]){r=1879048192;break}if(r===o)return C=r,t.string;o-=3,r=C}for(t=[],eu[e]=t,t.bytes=i;r<o;)n=Ae.getUint32(r),t.push(n),r+=4;for(o+=3;r<o;)n=Q[r++],t.push(n);let a=i<16?qa(i):Yp(i);return a!=null?t.string=a:t.string=Ha(i)}var ru=(i,e)=>{var t=Xe();let r=i;e!==void 0&&(i=i<32?-((e<<5)+i):(e<<5)+i,t.highByte=e);let o=Me[i];return o&&o.isShared&&((Me.restoreStructures||(Me.restoreStructures=[]))[i]=o),Me[i]=t,t.read=ka(t,r),t.read()},ou=typeof self=="object"?self:global;Lt[0]=()=>{};Lt[0].noBuffer=!0;Lt[101]=()=>{let i=Xe();return(ou[i[0]]||Error)(i[1])};Lt[105]=i=>{let e=Ae.getUint32(C-4);_r||(_r=new Map);let t=Q[C],r;t>=144&&t<160||t==220||t==221?r=[]:r={};let o={target:r};_r.set(e,o);let n=Xe();return o.used?Object.assign(r,n):(o.target=n,n)};Lt[112]=i=>{let e=Ae.getUint32(C-4),t=_r.get(e);return t.used=!0,t.target};Lt[115]=()=>new Set(Xe());var $a=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array");Lt[116]=i=>{let e=i[0],t=$a[e];if(!t)throw new Error("Could not find typed array for code "+e);return new ou[t](Uint8Array.prototype.slice.call(i,1).buffer)};Lt[120]=()=>{let i=Xe();return new RegExp(i[0],i[1])};Lt[98]=i=>{let e=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],t=C;C+=e-4,Ut=[Xe(),Xe()],Ut.position0=0,Ut.position1=0;let r=C;C=t;try{return Xe()}finally{C=r}};Lt[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");function iu(i){let e=Qr,t=C,r=Va,o=Zt,n=yr,s=Yr,a=Ra,l=_r,c=Ut,d=new Uint8Array(Q.slice(0,Qr)),u=Me,p=Me.slice(0,Me.length),f=jt,m=ti,x=i();return Qr=e,C=t,Va=r,Zt=o,yr=n,Yr=s,Ra=a,_r=l,Ut=c,Q=d,ti=m,Me=u,Me.splice(0,Me.length,...p),jt=f,Ae=new DataView(Q.buffer,Q.byteOffset,Q.byteLength),x}function us(){Q=null,_r=null,Me=null}function nu(i){i.unpack?Lt[i.type]=i.unpack:Lt[i.type]=i}var hs=new Array(147);for(let i=0;i<256;i++)hs[i]=+("1e"+Math.floor(45.15-i*.30103));var ms=new Dr({useRecords:!1}),Nb=ms.unpack,Cb=ms.unpackMultiple,Lb=ms.unpack;var Tb=new Float32Array(1),ZO=new Uint8Array(Tb.buffer,0,4);"use strict";var fs;try{fs=new TextEncoder}catch(i){}var ys,Ja,gs=typeof Buffer!="undefined",Ka=gs?Buffer.allocUnsafeSlow:Uint8Array,au=gs?Buffer:Uint8Array,lu=gs?4294967296:2144337920,G,Ze,M=0,gr,xr=null,Ib=/[\u0080-\uFFFF]/,Gi=Symbol("record-id"),ri=class extends Dr{constructor(e){super(e);this.offset=0;let t,r,o,n,s,a,l=0,c=au.prototype.utf8Write?function(h,I,b){return G.utf8Write(h,I,b)}:fs&&fs.encodeInto?function(h,I){return fs.encodeInto(h,G.subarray(I)).written}:!1,d=this;e||(e={});let u=e&&e.sequential,p=e.structures||e.saveStructures,f=e.maxSharedStructures;if(f==null&&(f=p?32:0),f>8160)throw new Error("Maximum maxSharedStructure is 8160");let m=e.maxOwnStructures;m==null&&(m=p?32:64),u&&!e.saveStructures&&(this.structures=[]);let x=f>32||m+f>64,y=f+64,N=f+m+64;if(N>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let L=[],w=0,B=0;this.pack=this.encode=function(h,I){if(G||(G=new Ka(8192),Ze=new DataView(G.buffer,0,8192),M=0),gr=G.length-10,gr-M<2048?(G=new Ka(G.length),Ze=new DataView(G.buffer,0,G.length),gr=G.length-10,M=0):M=M+7&2147483640,r=M,a=d.structuredClone?new Map:null,d.bundleStrings?(xr=["",""],G[M++]=214,G[M++]=98,xr.position=M-r,M+=4):xr=null,o=d.structures,o){o.uninitialized&&(o=d._mergeStructures(d.getStructures()));let b=o.sharedLength||0;if(b>f)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+o.sharedLength);if(!o.transitions){o.transitions=Object.create(null);for(let P=0;P<b;P++){let v=o[P];if(!v)continue;let D,Z=o.transitions;for(let V=0,ie=v.length;V<ie;V++){let oe=v[V];D=Z[oe],D||(D=Z[oe]=Object.create(null)),Z=D}Z[Gi]=P+64}l=b}u||(o.nextId=b+64)}n&&(n=!1),s=o||[];try{if(S(h),xr){Ze.setUint32(xr.position+r,M-xr.position-r);let b=xr;xr=null,S(b[0]),S(b[1])}if(d.offset=M,a&&a.idsToInsert){M+=a.idsToInsert.length*6,M>gr&&T(M),d.offset=M;let b=Pb(G.subarray(r,M),a.idsToInsert);return a=null,b}return I&uu?(G.start=r,G.end=M,G):G.subarray(r,M)}finally{if(o){if(B<10&&B++,w>1e4)o.transitions=null,B=0,w=0,L.length>0&&(L=[]);else if(L.length>0&&!u){for(let b=0,P=L.length;b<P;b++)L[b][Gi]=0;L=[]}if(n&&d.saveStructures){let b=o.sharedLength||f;o.length>b&&(o=o.slice(0,b));let P=G.subarray(r,M);return d.saveStructures(o,l)===!1?(d._mergeStructures(d.getStructures()),d.pack(h)):(l=b,P)}}I&jb&&(M=r)}};let S=h=>{M>gr&&(G=T(M));var I=typeof h,b;if(I==="string"){let P=h.length;if(xr&&P>=8&&P<4096){let Z=Ib.test(h);xr[Z?0:1]+=h,G[M++]=193,S(Z?-P:P);return}let v;P<32?v=1:P<256?v=2:P<65536?v=3:v=5;let D=P*3;if(M+D>gr&&(G=T(M+D)),P<64||!c){let Z,V,ie,oe=M+v;for(Z=0;Z<P;Z++)V=h.charCodeAt(Z),V<128?G[oe++]=V:V<2048?(G[oe++]=V>>6|192,G[oe++]=V&63|128):(V&64512)==55296&&((ie=h.charCodeAt(Z+1))&64512)==56320?(V=65536+((V&1023)<<10)+(ie&1023),Z++,G[oe++]=V>>18|240,G[oe++]=V>>12&63|128,G[oe++]=V>>6&63|128,G[oe++]=V&63|128):(G[oe++]=V>>12|224,G[oe++]=V>>6&63|128,G[oe++]=V&63|128);b=oe-M-v}else b=c(h,M+v,D);b<32?G[M++]=160|b:b<256?(v<2&&G.copyWithin(M+2,M+1,M+1+b),G[M++]=217,G[M++]=b):b<65536?(v<3&&G.copyWithin(M+3,M+2,M+2+b),G[M++]=218,G[M++]=b>>8,G[M++]=b&255):(v<5&&G.copyWithin(M+5,M+3,M+3+b),G[M++]=219,Ze.setUint32(M,b),M+=4),M+=b}else if(I==="number")if(h>>>0===h)h<64?G[M++]=h:h<256?(G[M++]=204,G[M++]=h):h<65536?(G[M++]=205,G[M++]=h>>8,G[M++]=h&255):(G[M++]=206,Ze.setUint32(M,h),M+=4);else if(h>>0===h)h>=-32?G[M++]=256+h:h>=-128?(G[M++]=208,G[M++]=h+256):h>=-32768?(G[M++]=209,Ze.setInt16(M,h),M+=2):(G[M++]=210,Ze.setInt32(M,h),M+=4);else{let P;if((P=this.useFloat32)>0&&h<4294967296&&h>=-2147483648){G[M++]=202,Ze.setFloat32(M,h);let v;if(P<4||(v=h*hs[(G[M]&127)<<1|G[M+1]>>7])>>0===v){M+=4;return}else M--}G[M++]=203,Ze.setFloat64(M,h),M+=8}else if(I==="object")if(!h)G[M++]=192;else{if(a){let v=a.get(h);if(v){if(!v.id){let D=a.idsToInsert||(a.idsToInsert=[]);v.id=D.push(v)}G[M++]=214,G[M++]=112,Ze.setUint32(M,v.id),M+=4;return}else a.set(h,{offset:M-r})}let P=h.constructor;if(P===Object)_(h,!0);else if(P===Array){b=h.length,b<16?G[M++]=144|b:b<65536?(G[M++]=220,G[M++]=b>>8,G[M++]=b&255):(G[M++]=221,Ze.setUint32(M,b),M+=4);for(let v=0;v<b;v++)S(h[v])}else if(P===Map){b=h.size,b<16?G[M++]=128|b:b<65536?(G[M++]=222,G[M++]=b>>8,G[M++]=b&255):(G[M++]=223,Ze.setUint32(M,b),M+=4);for(let[v,D]of h)S(v),S(D)}else{for(let v=0,D=ys.length;v<D;v++){let Z=Ja[v];if(h instanceof Z){let V=ys[v];if(V.write){V.type&&(G[M++]=212,G[M++]=V.type,G[M++]=0),S(V.write.call(this,h));return}let ie=G,oe=Ze,ge=M;G=null;let xe;try{xe=V.pack.call(this,h,A=>(G=ie,ie=null,M+=A,M>gr&&T(M),{target:G,targetView:Ze,position:M-A}),S)}finally{ie&&(G=ie,Ze=oe,M=ge,gr=G.length-10)}xe&&(xe.length+M>gr&&T(xe.length+M),M=Mb(xe,G,M,V.type));return}}_(h,!h.hasOwnProperty)}}else if(I==="boolean")G[M++]=h?195:194;else if(I==="bigint"){if(h<BigInt(1)<<BigInt(63)&&h>=-(BigInt(1)<<BigInt(63)))G[M++]=211,Ze.setBigInt64(M,h);else if(h<BigInt(1)<<BigInt(64)&&h>0)G[M++]=207,Ze.setBigUint64(M,h);else if(this.largeBigIntToFloat)G[M++]=203,Ze.setFloat64(M,Number(h));else throw new RangeError(h+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");M+=8}else if(I==="undefined")this.encodeUndefinedAsNil?G[M++]=192:(G[M++]=212,G[M++]=0,G[M++]=0);else if(I==="function")S(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+I)},_=this.useRecords===!1?this.variableMapSize?h=>{let I=Object.keys(h),b=I.length;b<16?G[M++]=128|b:b<65536?(G[M++]=222,G[M++]=b>>8,G[M++]=b&255):(G[M++]=223,Ze.setUint32(M,b),M+=4);let P;for(let v=0;v<b;v++)S(P=I[v]),S(h[P])}:(h,I)=>{G[M++]=222;let b=M-r;M+=2;let P=0;for(let v in h)(I||h.hasOwnProperty(v))&&(S(v),S(h[v]),P++);G[b+++r]=P>>8,G[b+r]=P&255}:h=>{let I=Object.keys(h),b,P=s.transitions||(s.transitions=Object.create(null)),v=0;for(let Z=0,V=I.length;Z<V;Z++){let ie=I[Z];b=P[ie],b||(b=P[ie]=Object.create(null),v++),P=b}let D=P[Gi];if(D)D>=96&&x?(G[M++]=((D-=96)&31)+96,G[M++]=D>>5):G[M++]=D;else{D=s.nextId,D||(D=64),D<y&&this.shouldShareStructure&&!this.shouldShareStructure(I)?(D=s.nextOwnId,D<N||(D=y),s.nextOwnId=D+1):(D>=N&&(D=y),s.nextId=D+1);let Z=I.highByte=D>=96&&x?D-96>>5:-1;P[Gi]=D,s[D-64]=I,D<y?(I.isShared=!0,s.sharedLength=D-63,n=!0,Z>=0?(G[M++]=(D&31)+96,G[M++]=Z):G[M++]=D):(Z>=0?(G[M++]=213,G[M++]=114,G[M++]=(D&31)+96,G[M++]=Z):(G[M++]=212,G[M++]=114,G[M++]=D),v&&(w+=B*v),L.length>=m&&(L.shift()[Gi]=0),L.push(P),S(I))}for(let Z=0,V=I.length;Z<V;Z++)S(h[I[Z]])},T=h=>{let I;if(h>16777216){if(h-r>lu)throw new Error("Packed buffer would be larger than maximum buffer size");I=Math.min(lu,Math.round(Math.max((h-r)*(h>67108864?1.25:2),4194304)/4096)*4096)}else I=(Math.max(h-r<<2,G.length-1)>>12)+1<<12;let b=new Ka(I);return Ze=new DataView(b.buffer,0,I),G.copy?G.copy(b,0,r,h):b.set(G.slice(r,h)),M-=r,r=0,gr=b.length-10,G=b}}useBuffer(e){G=e,Ze=new DataView(G.buffer,G.byteOffset,G.byteLength),M=0}};Ja=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,cs];ys=[{pack(i,e,t){let r=i.getTime()/1e3;if((this.useTimestamp32||i.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:o,targetView:n,position:s}=e(6);o[s++]=214,o[s++]=255,n.setUint32(s,r)}else if(r>0&&r<17179869184){let{target:o,targetView:n,position:s}=e(10);o[s++]=215,o[s++]=255,n.setUint32(s,i.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),n.setUint32(s+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:o,targetView:n,position:s}=e(3);o[s++]=212,o[s++]=255,o[s++]=255}else{let{target:o,targetView:n,position:s}=e(15);o[s++]=199,o[s++]=12,o[s++]=255,n.setUint32(s,i.getMilliseconds()*1e6),n.setBigInt64(s+4,BigInt(Math.floor(r)))}}},{pack(i,e,t){let r=Array.from(i),{target:o,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(o[n++]=212,o[n++]=115,o[n++]=0),t(r)}},{pack(i,e,t){let{target:r,position:o}=e(this.structuredClone?3:0);this.structuredClone&&(r[o++]=212,r[o++]=101,r[o++]=0),t([i.name,i.message])}},{pack(i,e,t){let{target:r,position:o}=e(this.structuredClone?3:0);this.structuredClone&&(r[o++]=212,r[o++]=120,r[o++]=0),t([i.source,i.flags])}},{pack(i,e){this.structuredClone?cu(i,16,e):du(gs?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==au&&this.structuredClone?cu(i,$a.indexOf(t.name),e):du(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function cu(i,e,t,r){let o=i.byteLength;if(o+1<256){var{target:n,position:s}=t(4+o);n[s++]=199,n[s++]=o+1}else if(o+1<65536){var{target:n,position:s}=t(5+o);n[s++]=200,n[s++]=o+1>>8,n[s++]=o+1&255}else{var{target:n,position:s,targetView:a}=t(7+o);n[s++]=201,a.setUint32(s,o+1),s+=4}n[s++]=116,n[s++]=e,n.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),s)}function du(i,e){let t=i.byteLength;var r,o;if(t<256){var{target:r,position:o}=e(t+2);r[o++]=196,r[o++]=t}else if(t<65536){var{target:r,position:o}=e(t+3);r[o++]=197,r[o++]=t>>8,r[o++]=t&255}else{var{target:r,position:o,targetView:n}=e(t+5);r[o++]=198,n.setUint32(o,t),o+=4}r.set(i,o)}function Mb(i,e,t,r){let o=i.length;switch(o){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:o<256?(e[t++]=199,e[t++]=o):o<65536?(e[t++]=200,e[t++]=o>>8,e[t++]=o&255):(e[t++]=201,e[t++]=o>>24,e[t++]=o>>16&255,e[t++]=o>>8&255,e[t++]=o&255)}return e[t++]=r,e.set(i,t),t+=o,t}function Pb(i,e){let t,r=e.length*6,o=i.length-r;for(e.sort((n,s)=>n.offset>s.offset?1:-1);t=e.pop();){let n=t.offset,s=t.id;i.copyWithin(n+r,n,o),r-=6;let a=n+r;i[a++]=214,i[a++]=105,i[a++]=s>>24,i[a++]=s>>16&255,i[a++]=s>>8&255,i[a++]=s&255,o=n}return i}function vo(i){if(i.Class){if(!i.pack&&!i.write)throw new Error("Extension has no pack or write function");if(i.pack&&!i.type)throw new Error("Extension has no type (numeric code to identify the extension)");Ja.unshift(i.Class),ys.unshift(i)}nu(i)}var pu=new ri({useRecords:!1}),Ob=pu.pack,Ab=pu.pack;var uu=512,jb=1024;var hu=new ri({structuredClone:!0});vo({Class:nr.prototype.constructor,type:1,write(i){return O({},i)},read(i){return Object.setPrototypeOf(i,nr.prototype),i}});vo({Class:Ke.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Ke.prototype),i}});vo({Class:sr.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,sr.prototype),i}});vo({Class:as.prototype.constructor,type:4,write(i){return i.id},read(i){return new as(i)}});vo({Class:ls.prototype.constructor,type:5,write(i){return i.data},read(i){return new ls(i)}});function _b(i){var e=0;if(i.length===0)return e;for(let t=0;t<i.length;t++){let r=i[t];e=(e<<5)-e+r,e=e&e}return e}var xs;(function(r){function i(o){return hu.pack(o)}r.serialize=i;function e(o){return hu.unpack(o)}r.deserialize=e;function t(o){return _b(i(o)).toString()}r.checksum=t})(xs||(xs={}));var bs;(function(t){t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function e(r){return t.all.includes(r)}t.is=e})(bs||(bs={}));var vs;(function(t){function i(r){return e(r)}t.defaultData=i;function e(r){if(r==="PointLight")return{type:r,color:mr.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,depth:2500,helper:!0};if(r==="SpotLight")return{type:r,color:mr.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:2500,helper:!0};if(r==="DirectionalLight")return{type:r,color:mr.white,intensity:1,shadows:!0,size:2500,depth:2500,helper:!0};throw new Error("not implemented")}})(vs||(vs={}));var oi;(function(r){r[r.Front=0]="Front",r[r.Back=1]="Back",r[r.Double=2]="Double"})(oi||(oi={}));var Xa;(function(t){t.defaultData={castShadow:!0,receiveShadow:!0};function e(r,o){return r.castShadow===o.castShadow&&r.receiveShadow===o.receiveShadow}t.equals=e})(Xa||(Xa={}));var Za;(function(t){t.defaultData={flatShading:!1,wireframe:!1,side:0};function e(r,o){return r.flatShading===o.flatShading&&r.side===o.side&&r.wireframe===o.wireframe}t.equals=e})(Za||(Za={}));var Ss;(function(e){e.defaultData=$(O(O({},Za.defaultData),Xa.defaultData),{cloner:null})})(Ss||(Ss={}));var Tt;(function(o){o[o.Left=1]="Left",o[o.Right=2]="Right",o[o.Center=3]="Center",o[o.Justify=4]="Justify"})(Tt||(Tt={}));var Br;(function(r){r[r.Top=1]="Top",r[r.Center=2]="Center",r[r.Bottom=3]="Bottom"})(Br||(Br={}));var eo;(function(r){r[r.None=1]="None",r[r.Upper=2]="Upper",r[r.Lower=3]="Lower"})(eo||(eo={}));var ws;(function(e){e.defaultData={width:100,height:100,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.5,letterSpacing:1,text:"",textTransform:1,color:mr.fromHexAndA(6974058,1),alpha:1,font:"roboto_regular"}})(ws||(ws={}));var it;(function(o){o[o.Normal=0]="Normal",o[o.Multiply=1]="Multiply",o[o.Screen=2]="Screen",o[o.Overlay=3]="Overlay"})(it||(it={}));var ii;(function(r){r[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar"})(ii||(ii={}));var Ns;(function(r){r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping"})(Ns||(Ns={}));var Cs;(function(o){o[o.UV=0]="UV",o[o.Planar=1]="Planar",o[o.Spherical=2]="Spherical",o[o.Cylindrical=3]="Cylindrical"})(Cs||(Cs={}));var Ls;(function(n){n[n.Simplex=0]="Simplex",n[n.SimplexFractal=1]="SimplexFractal",n[n.Ashima=2]="Ashima",n[n.Fbm=3]="Fbm",n[n.Perlin=4]="Perlin"})(Ls||(Ls={}));var ni;(function(r){function i(o,n){return o==="light"&&n?e(n):t(o)}r.defaultData=i;function e(o){switch(o){case"basic":return{type:"light",category:"basic",alpha:1,visible:!0,mode:0};case"phong":return{category:"phong",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"toon":return{category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"lambert":return{category:"lambert",emissive:{r:.2,g:.2,b:.2,a:1},type:"light",alpha:1,visible:!0,mode:0};case"physical":return{category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0}}}function t(o){switch(o){case"texture":return{alpha:1,visible:!0,size:[128,128],mode:0,axis:Yo.x,type:"texture",projection:0,texture:{image:"image_0",wrapping:1001,repeat:[1,1],offset:[0,0]},crop:!0};case"color":return{type:"color",alpha:1,visible:!0,mode:0,color:Rt.fromHex(4737101)};case"depth":return{type:"depth",alpha:1,visible:!0,mode:0,gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,near:50,far:200};case"normal":return{type:"normal",alpha:1,visible:!0,mode:0,cnormal:[1,1,1]};case"gradient":return{type:"gradient",alpha:1,visible:!0,mode:0,gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{type:"noise",alpha:1,visible:!0,mode:0,size:[100,100,100],noiseType:0,scale:1,move:1,colorA:$(O({},Rt.fromHex(6710886)),{a:1}),colorB:$(O({},Rt.fromHex(6710886)),{a:1}),colorC:$(O({},Rt.fromHex(16777215)),{a:1}),colorD:$(O({},Rt.fromHex(16777215)),{a:1}),distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8]};case"fresnel":return{type:"fresnel",alpha:1,visible:!0,mode:0,color:mr.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{type:"rainbow",alpha:1,visible:!0,mode:0,filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"matcap":return{type:"matcap",alpha:1,visible:!0,mode:0,texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0]}};case"transmission":return{type:"transmission",alpha:1,visible:!0,mode:0,thickness:10,ior:1.5,roughness:1};case"displace":return{type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,visible:!0}}}})(ni||(ni={}));var si;(function(a){function i(l){return!l.layers.some(d=>{if(d.data.type==="texture"&&d.data.projection!==0||d.data.type==="depth"&&!d.data.isWorldSpace||d.data.type==="noise"||d.data.type==="displace")return!0})&&!t(l)}a.isMergable=i;function e(l){let c="";return l.layers.forEach(d=>{Object.entries(d.data).forEach(([u,p])=>{c+=`${u}${p}`,Array.isArray(p)?p.forEach(f=>c+=`${f}`):typeof p=="object"?Object.values(p).forEach(f=>{typeof f=="number"?c+=`${f.toFixed(4)}`:c+=`${f}`}):c+=`${p}`})}),c}a.getHash=e;function t(l){let c=0;for(let d of l.layers)"alpha"in d.data&&d.data.type!=="light"&&d.data.type!=="fresnel"&&(c+=(1-c)*d.data.alpha);return c<1}a.isTransparent=t;function r(){return{layers:new Ke}}a.defaultEmptyData=r;function o(l="layer1",c="layer2"){return n("phong",l,c)}a.defaultData=o;function n(l,c="layer1",d="layer2"){let u=new Ke;return u.push({fi:0,data:ni.defaultData("light",l),id:c}),u.push({fi:1,data:ni.defaultData("color"),id:d}),{layers:u}}a.defaultTwoLayerData=n;function s(l,c="basic",d="layer1",u="layer2"){let p=ni.defaultData("texture");Object.assign(p.texture,{image:l});let f=new Ke;return f.push({fi:0,data:p,id:d}),f.push({fi:1,data:ni.defaultData("light",c),id:u}),{layers:f}}a.defaultTwoLayerTextureData=s})(si||(si={}));var ai;(function(r){function i(){return{points:new Ke,roundness:0,shapeHoles:[],isClosed:!1}}r.defaultData=i;function e(o,n){let{points:s}=n;if(s){for(let a of s)if(a.data.position[0]===o[0]&&a.data.position[1]===o[1])return!0}return!1}r.isOverlappingExistingPoint=e;function t(o,n){let s=o.controlNext,a=n.controlPrevious;return o.position[0]===s.position[0]&&o.position[1]===s.position[1]&&n.position[0]===a.position[0]&&n.position[1]===a.position[1]}r.isStraightLine=t})(ai||(ai={}));var Ts;(function(e){function i(t){return t==="PolygonGeometry"||t==="RectangleGeometry"||t==="StarGeometry"||t==="TriangleGeometry"||t==="EllipseGeometry"}e.is2DParametricMesh=i})(Ts||(Ts={}));var Is;(function(e){function i(t){if(t==="RectangleGeometry")return{width:320,height:320,type:t,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};if(t==="VectorGeometry")return{width:100,height:100,type:t,subdivisions:12,shape:ai.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};throw new Error("not implemented")}e.defaultData=i})(Is||(Is={}));var zi;(function(o){o.identity=$(O({},ts.identity),{hiddenMatrix:Zr.identity});function e(n){return{position:n.position,rotation:n.rotation,scale:n.scale,hiddenMatrix:n.hiddenMatrix}}o.fromObject=e;function t(n,s){return{position:(s==null?void 0:s.position)||n.position,rotation:(s==null?void 0:s.rotation)||n.rotation,scale:(s==null?void 0:s.scale)||n.scale,hiddenMatrix:(s==null?void 0:s.hiddenMatrix)||n.hiddenMatrix}}o.merge=t;function r(n,s){return{position:ei.isEqual(n.position,s.position)?null:s.position,rotation:ei.isEqual(n.rotation,s.rotation)?null:s.rotation,scale:ei.isEqual(n.scale,s.scale)?null:s.scale,hiddenMatrix:Zr.isEqual(n.hiddenMatrix,s.hiddenMatrix)?null:s.hiddenMatrix}}o.diff=r})(zi||(zi={}));var to;(function(e){e.defaultData=O({states:new Ke,events:new Ke,visible:!0,raycastLock:!1},zi.identity)})(to||(to={}));var mu;(function(e){e.defaultData=O({type:"Empty"},to.defaultData)})(mu||(mu={}));var Qa;(function(e){e.defaultData=O(O({type:"Mesh"},to.defaultData),Ss.defaultData)})(Qa||(Qa={}));var fu;(function(e){e.defaultData=O(O({type:"TextFrame"},to.defaultData),ws.defaultData)})(fu||(fu={}));var Ms;(function(e){e.defaultData=O(O(O({},to.defaultData),zi.identity),xo.defaultData)})(Ms||(Ms={}));var yu;(function(e){function i(t){return O(O({},to.defaultData),vs.defaultData(t))}e.defaultData=i})(yu||(yu={}));var gu;(function(t){t.defaultCamera=O({position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:Zr.identity,name:"Play Camera",visible:!0,raycastLock:!1,states:new Ke,events:new Ke},xo.defaultData),t.defaultMeshObject=$(O(O({name:"Rectangle"},to.defaultData),Qa.defaultData),{geometry:Is.defaultData("RectangleGeometry"),material:si.defaultTwoLayerData("basic","layer1","layer2")})})(gu||(gu={}));var xu;(function(t){function i(r,o){if(o===void 0)return r;let n=O({},r);return"material"in n&&"material"in o&&o.material&&(n.material=za(n.material,s=>{if(typeof s!="string")for(let[a,l]of Object.entries(o.material.layers)){let c=s.layers.data(a);c&&go(c,l)}}).data),n.materials&&o.materials&&(n.materials=za(n.materials,s=>{var a,l;for(let c=0;c<n.materials.length;c++){let d=o.materials[c];if(typeof d!="string")for(let[u,p]of Object.entries(d.layers)){let f=(l=(a=s[c])==null?void 0:a.layers)==null?void 0:l.data(u);f&&go(f,p)}}}).data),n}t.patchMaterialState=i;function e(r,o){var s,a;if(o===void 0)return r;let n=O({},r);if(Object.assign(n,zi.merge(n,o)),Qo.is(r.type)){n.orthographic=O({},n.orthographic),n.perspective=O({},n.perspective);let l=o;((s=l.orthographic)==null?void 0:s.zoom)!==void 0&&(n.orthographic.zoom=l.orthographic.zoom),((a=l.perspective)==null?void 0:a.zoom)!==void 0&&(n.perspective.zoom=l.perspective.zoom)}else if(r.type==="Mesh")n.geometry=O({},n.geometry),Object.assign(n.geometry,o.geometry),n=i(n,o);else if(bs.is(r.type)){let l=o;n.intensity!==void 0&&(n.intensity=l.intensity),l.color!==void 0&&(n.color=Rt.clone(l.color))}return n}t.patch=e})(xu||(xu={}));var nt=5855577;var bu=2857471;var Ya=15711266;import{DoubleSide as Db,Mesh as Bb,MeshBasicMaterial as Gb,ShapeBufferGeometry as zb,Vector2 as Eb,Vector3 as Fb}from"three";import{FontLoader as Rb}from"three/examples/jsm/loaders/FontLoader.js";var Qe=class extends Bb{constructor({char:e,originalChar:t,fontFamily:r,letterSpacing:o,fontSize:n,LOD:s=16},a=new Gb({color:0,opacity:1,visible:!0,transparent:!0,side:Db})){let l=Qe.loadChar(e,r,s);super(l.geometry,a);this.char=e,this.originalChar=t!=null?t:e,this.fontFamily=r,this.letterSpacing=o,this.fontSize=n,this.LOD=s,this.resolution=l.resolution,this.glyphsHa=l.glyphsHa,this.localPosition=new Eb,this.charSize=0,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}static get FONTS_PATH(){return Qe._fontPath}static set FONTS_PATH(e){Qe._fontPath=e}updatePosition(e,t){this.localPosition.copy(e);let r=new Fb(this.localPosition.x,-this.localPosition.y,0);this.position.copy(r).add(t)}updateFontSize(e){let t=e/this.resolution;this.fontSize=e,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*t*this.letterSpacing}updateFontFamily(e){if(this.fontFamily===e)return;this.fontFamily=e;let t=Qe.loadChar(this.char,e,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateChar(e){if(this.char===e)return;this.char=e;let t=Qe.loadChar(e,this.fontFamily,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateLetterSpacing(e){this.letterSpacing!==e&&(this.letterSpacing=e,this.updateFontSize(this.fontSize))}updateLOD(e){if(this.LOD===e)return;this.LOD=e;let t=Qe.loadChar(this.char,this.fontFamily,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}clone(){let e={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new Qe(e).copy(this)}static loadFont(e){return new Promise(function(t,r){Qe.fontCache[e]?t(Qe.fontCache[e]):new Rb().load(Qe.FONTS_PATH+e+".json",n=>{Qe.fontCache[e]=n,t(n)},void 0,r)})}static loadChar(e,t,r){if(Qe.charCache[e]){if(Qe.charCache[e][r]&&Qe.charCache[e][r].fontFamily===t)return Qe.charCache[e][r]}else Qe.charCache[e]={};let o=Qe.fontCache[t],n=o.generateShapes(e,1);return Qe.charCache[e][r]={geometry:new zb(n,r),fontFamily:t,resolution:o.data.resolution,glyphsHa:o.data.glyphs[e].ha},Qe.charCache[e][r]}},_t=Qe;_t.charCache={},_t.fontCache={},_t._fontPath="/_assets/_fonts/";import{DoubleSide as Ta,MeshBasicMaterial as gm,Vector3 as xm,Object3D as kw}from"three";import{Mesh as vS}from"three";import{BufferGeometry as xj,ConeBufferGeometry as kb,Float32BufferAttribute as bj,Vector2 as vj,Vector3 as Sj}from"three";import{BufferGeometry as Vb,CylinderBufferGeometry as Ub,Float32BufferAttribute as el,Vector2 as ar,Vector3 as Ps}from"three";var vu=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,a,l,c,d;let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:0,cornerSegments:8,hollow:0},i.parameters),r=t.width/2,o=(a=t.radiusTop)!=null?a:r,n=(l=t.radiusBottom)!=null?l:r;return o===n?(o=r,n=r):o>n?(o=r,n=n*r/o):(o=o*r/n,n=r),{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((c=t.height)!=null?c:t.width),depth:Math.abs((d=t.depth)!=null?d:t.width),radiusTop:o,radiusBottom:n})}}static build(i){let{width:e,depth:t,height:r,radialSegments:o,heightSegments:n,openEnded:s,thetaStart:a,thetaLength:l,radiusTop:c,radiusBottom:d,cornerRadius:u,cornerSegments:p,hollow:f}=i.parameters,m;return u||f?m=new Os(c,d,r,o,n,s,a,l*Math.PI/180,u,u,p,f):m=new Ub(c,d,r,o,n,s,a,l*Math.PI/180),m.scale(1,1,t/e),Object.assign(m,{userData:$(O({},i),{type:"CylinderGeometry"})})}};function ro(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function Su(i){return new ar(i.y,-i.x)}var Os=class extends Vb{constructor(e,t,r,o,n,s,a,l,c,d,u,p,f=!1){super();this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,r=r||1,o=Math.floor(o)||8,n=Math.floor(n)||1,s=s!==void 0?s:!1,a=a!==void 0?a:0,l=l!==void 0?l:Math.PI*2,s&&(c=0,d=0);let m=[],x=[],y=[],N=[],L=0,w=r/2,B=new Ps,S=new Ps;f&&e==0&&(e=c),f&&t==0&&(t=d);let _=new ar(e,w),T=new ar(t,-w),h=null,I=null,b=null,P=null,v=_.clone().sub(T),D=0,Z=0,V=0;p>0&&(D=Math.min(e,t)*(1-p),Z=e-D,V=t-D);let ie=_.clone();ie.x-=D;let oe=Math.PI-v.angle(),ge=v.angle(),xe=Math.tan(ge/2),A=Math.tan(oe/2),j=xe+A,g=p?j:A,z=p?j:xe;if(c=Math.min(c,(e-Z)/g,v.length()/j),d=Math.min(d,(t-V)/z,v.length()/j),c>0){let E=c/xe;h=_.clone().sub(new ar(E,c)),p&&(b=h.clone(),b.x-=D-j*c),_.sub(v.clone().setLength(E))}if(d>0){let E=d/A;I=T.clone().sub(new ar(E,-d)),T.add(v.clone().setLength(E)),p&&(P=I.clone(),P.x-=D-j*d,ie.sub(v.clone().setLength(E)))}v=_.clone().sub(T);let R=v.length()<.5,U=[];for(let E=0;E<=o;E++){let H=[],k=E/o,se=k*l+a,F=new ar(Math.sin(se),Math.cos(se));P&&I?(q(H,k,F,oe,d,P,-1,!0),q(H,k,F,ge,d,I,-1,!1)):I?(W(H,F,I.x,0,-1),q(H,k,F,ge,d,I,-1,!1)):s||W(H,F,t,V,-1);let K=Su(v).normalize();if(ro(K,F,B),!R)for(let X=0;X<=n;X++){let te=X/n,he=v.clone().multiplyScalar(te).add(T);ro(he,F,S),x.push(S.x,S.y,S.z),y.push(B.x,B.y,B.z),N.push(k,.5+S.y/r),H.push(L++)}if(b&&h?(q(H,k,F,oe,c,h,1,!1),q(H,k,F,ge,c,b,1,!0)):h?(q(H,k,F,oe,c,h,1,!1),W(H,F,h.x,0,1)):s||W(H,F,e,Z,1),p&&!R){let X=Su(v).multiplyScalar(-1).normalize();ro(X,F,B);for(let te=0;te<=n;te++){let he=te/n,Y=v.clone().multiplyScalar(-he).add(ie);ro(Y,F,S),x.push(S.x,S.y,S.z),y.push(B.x,B.y,B.z),N.push(k,.5+S.y/r),H.push(L++)}}p&&!s&&H.push(H[0]),U.push(H)}for(let E=0;E<U.length-1;E++)for(let H=0;H<U[0].length-1;H++){if(s&&p&&H==n)continue;let k=U[E][H],se=U[E+1][H],F=U[E+1][H+1],K=U[E][H+1],X=x[F*3+0],te=x[F*3+2];m.push(k,se,K),(X!=0||te!=0)&&m.push(se,F,K)}l<Math.PI*2&&(J(-1,U[0],a),J(1,U[U.length-1],a+l)),this.setIndex(m),this.setAttribute("position",new el(x,3)),this.setAttribute("normal",new el(y,3)),this.setAttribute("uv",new el(N,2));function q(E,H,k,se,F,K,X,te){for(let he=0;he<u+1;he++){let Y=he/u,ne=X<0?Y:1-Y;te&&(ne-=1),ne*=se;let Se=new ar(Math.sin(ne),Math.cos(ne)*X),me=Se.clone().multiplyScalar(F).add(K);ro(me,k,S),x.push(S.x,S.y,S.z),ro(Se,k,B),y.push(B.x,B.y,B.z),N.push(H,.5+S.y/r),E.push(L++)}}function W(E,H,k,se,F){let K=new Ps,X=new ar,te=[k,se];F<0&&te.reverse();for(let he of te)X.set(he,w*F),ro(X,H,K),x.push(K.x,K.y,K.z),y.push(0,F,0),N.push(.5,.5),E.push(L++)}function J(E,H,k){let se=new ar(Math.sin(k),Math.cos(k)),F=new ar(-Math.cos(k),Math.sin(k)),K=new Ps,X=E<0?(Y,ne,Se)=>m.push(Y,ne,Se):(Y,ne,Se)=>m.push(Y,Se,ne),te=new ar((e+t+Z+V)/4,0);ro(te,se,K),x.push(K.x,K.y,K.z),y.push(F.x,0,F.y),N.push(.5,.5);let he=L++;for(let Y of H){let ne=x.slice(Y*3,Y*3+3);x.push(...ne),y.push(F.x,0,F.y);let Se=N.slice(Y*2,Y*2+2);N.push(...Se),L++}for(let Y=he+1;Y<L-1;Y++)X(he,Y,Y+1);X(he,L-1,he+1)}}};var wu=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,o,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:0,cornerRadiusBottom:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((n=t.depth)!=null?n:t.width)})}}static build(i){let{width:e,depth:t,height:r,radialSegments:o,heightSegments:n,openEnded:s,thetaStart:a,thetaLength:l,cornerRadiusTop:c,cornerRadiusBottom:d,cornerSegments:u}=i.parameters,p;return c>0||d>0||l<360?p=new Os(0,e/2,r,o,n,s,a,l*Math.PI/180,c,d,u,0,!0):p=new kb(e/2,r,o,n,s),p.scale(1,1,t/e),Object.assign(p,{userData:$(O({},i),{type:"ConeGeometry"})})}};import{BoxBufferGeometry as Hb,BufferGeometry as qb,Float32BufferAttribute as tl,Vector3 as Ei}from"three";var Nu=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,o,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((n=t.depth)!=null?n:t.width)})}}static build(i){let{width:e,height:t,depth:r,widthSegments:o,heightSegments:n,depthSegments:s,cornerRadius:a,cornerSegments:l}=i.parameters,c;return a==0?c=new Hb(e,t,r,o,n,s):c=new Cu(e,t,r,o,n,s,a,l),Object.assign(c,{userData:$(O({},i),{type:"CubeGeometry"})})}},rl=Math.PI/2,Cu=class extends qb{constructor(e=1,t=1,r=1,o=1,n=1,s=1,a=0,l=4){super();this.type="BoxBufferGeometry";let c=this;o=Math.floor(o),n=Math.floor(n),s=Math.floor(s),l=Math.floor(l),a=Math.min(a,e/2,t/2,r/2);let d=[],u=[],p=[],f=[],m=0,x=0;y("z","y","x",-1,-1,r,t,e,s,n,0),y("z","y","x",1,-1,r,t,-e,s,n,1),y("x","z","y",1,1,e,r,t,o,s,2),y("x","z","y",1,-1,e,r,-t,o,s,3),y("x","y","z",1,-1,e,t,r,o,n,4),y("x","y","z",-1,-1,e,t,-r,o,n,5),a>0&&(N("z","y","x",-1,-1,1,r,t,e,s,0),N("z","y","x",1,-1,-1,r,t,e,s,1),N("z","y","x",-1,1,-1,r,t,e,s,1),N("z","y","x",1,1,1,r,t,e,s,0),N("x","y","z",-1,-1,-1,e,t,r,o,0),N("x","y","z",1,-1,1,e,t,r,o,1),N("x","y","z",-1,1,1,e,t,r,o,0),N("x","y","z",1,1,-1,e,t,r,o,1),N("y","x","z",-1,-1,1,t,e,r,n,0),N("y","x","z",1,-1,-1,t,e,r,n,1),N("y","x","z",1,1,1,t,e,r,n,1),N("y","x","z",-1,1,-1,t,e,r,n,0),L(1,1,1),L(-1,1,1),L(1,-1,1),L(-1,-1,1),L(1,1,-1),L(-1,1,-1),L(1,-1,-1),L(-1,-1,-1)),this.setIndex(d),this.setAttribute("position",new tl(u,3)),this.setAttribute("normal",new tl(p,3)),this.setAttribute("uv",new tl(f,2));function y(w,B,S,_,T,h,I,b,P,v,D){let Z=(h-2*a)/P,V=(I-2*a)/v,ie=h/2-a,oe=I/2-a,ge=b/2,xe=P+1,A=v+1,j=0,g=0,z=new Ei;for(let R=0;R<A;R++){let U=R*V-oe;for(let q=0;q<xe;q++){let W=q*Z-ie;z[w]=W*_,z[B]=U*T,z[S]=ge,u.push(z.x,z.y,z.z),z[w]=0,z[B]=0,z[S]=b>0?1:-1,p.push(z.x,z.y,z.z),f.push(q/P),f.push(1-R/v),j+=1}}for(let R=0;R<v;R++)for(let U=0;U<P;U++){let q=m+U+xe*R,W=m+U+xe*(R+1),J=m+(U+1)+xe*(R+1),E=m+(U+1)+xe*R;d.push(q,W,E),d.push(W,J,E),g+=6}c.addGroup(x,g,D),x+=g,m+=j}function N(w,B,S,_,T,h,I,b,P,v,D){let Z=(I-2*a)/v,V=I/2-a,ie=b/2-a,oe=P/2,ge=v+1,xe=0,A=0,j=new Ei,g=new Ei;for(let z=0;z<l+1;z++){let R=z/l*rl,U=Math.sin(R)*a,q=(1-Math.cos(R))*a,W=Math.sin(R),J=Math.cos(R);j[B]=(ie+U)*T,j[S]=(oe-q)*h,g[w]=0,g[B]=W*Math.sign(j[B]),g[S]=J*Math.sign(j[S]);for(let E=0;E<ge;E++){let H=E*Z-V;j[w]=H*_,u.push(j.x,j.y,j.z),p.push(g.x,g.y,g.z),f.push(E/v),f.push(0),xe+=1}}for(let z=0;z<l;z++)for(let R=0;R<v;R++){let U=m+R+ge*z,q=m+R+ge*(z+1),W=m+(R+1)+ge*(z+1),J=m+(R+1)+ge*z;d.push(U,q,J),d.push(q,W,J),A+=6}c.addGroup(x,A,D),x+=A,m+=xe}function L(w,B,S){let _=new Ei,T=new Ei(e/2,t/2,r/2);T.subScalar(a);let h=[],I=w*B*S>0?(P,v,D)=>d.push(P,v,D):(P,v,D)=>d.push(P,D,v);for(let P=0;P<=l;P++){let v=[],D=rl*(1-P/l),Z=Math.cos(D),V=Math.sin(D),ie=0;for(let oe=0;oe<=P;oe++){let ge=Math.cos(ie),xe=Math.sin(ie);_.x=Z*ge,_.y=V,_.z=Z*xe;let A=T.clone().addScaledVector(_,a);u.push(w*A.x,B*A.y,S*A.z),p.push(w*_.x,B*_.y,S*_.z),f.push(0,0),v.push(m++),ie+=rl/P}h.push(v)}let b=h.length-1;for(let P=0;P<b;P++){let v=h[P],D=h[P+1],Z=v.length-1;I(v[0],D[1],D[0]);for(let V=1;V<=Z;V++)I(v[V-1],v[V],D[V]),I(v[V],D[V+1],D[V])}}}};import{BufferGeometry as Wb,Float32BufferAttribute as ol,Triangle as $b,Vector3 as Gr,Vector2 as il}from"three";var So=class extends Wb{constructor(e=[],t=[],r="",o=1,n=.2,s=4){super();this.type="PolyhedronGeometryRound";let a=[],l=[],c=[];d(),u(),this.setAttribute("position",new ol(a,3)),this.setAttribute("normal",new ol(c,3)),this.setAttribute("uv",new ol(l,2));return;function d(){var xe;n=Math.min(1-1e-5,n),n==0&&(s=0);let f={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],m=new Gr,x=m.clone(),y=new $b,N=n*o,L=o-N,w=s+1,B=new Gr,S=(A,j)=>B.subVectors(A,j).normalize(),_=(A,j)=>Array(A).fill(void 0).map(j),T=_(e.length/3,(A,j)=>new Gr().fromArray(e,j*3).setLength(o)),h=[],I=1e6;for(let A=0;A<T.length;A++){let j=T[A],g=[],z,R,U,q=1e10,W=-1;for(;(W=t.indexOf(A,W+1))!=-1;){let k=W-W%3;z=t[k+(W+1)%3],R=t[k+(W+2)%3],U=j.distanceToSquared(T[z]),q=Math.min(q,U),g.push([z,R,U])}q+=1e-6;let J=[],E=0,H=g.length;for(let k=0;k<H;k++){[z,R,U]=g[E];let se=((xe=h[z])==null?void 0:xe.includes(A))==!0;U<=q&&J.push(z+ +se*I),E=g.findIndex(F=>F[0]==R)}h.push(J)}let b=[];{let A=0,j=0,g,z,R=f==3;for(let U=0;U<=s;U++){g=U*(U+1)/2,z=(U+1)*(U+2)/2;for(let q=0;q<s-U;q++)[A,j]=[g+q+U+2,z+q+U+3],b.push(g,z,...R?[j,g]:[A,z],j,A),[g,z]=[A,j];b.push(g,z,g+s+2)}}let P=m.clone(),v=m.clone(),D=m.clone(),Z=m.clone(),V=m.clone(),ie=[],oe=_(T.length,()=>_(f,()=>m.clone()));for(let A=0;A<T.length;A++){m.copy(T[A]).normalize(),P.copy(m).multiplyScalar(L);let j=h[A];for(let J=0;J<j.length;J++){let E=j[J],H=j[(J+1)%f];y.setFromPointsAndIndices(T,A,E%I,H%I),y.b.sub(y.a).setLength(1e10).add(y.a),y.c.sub(y.a).setLength(1e10).add(y.a),y.closestPointToPoint(P,oe[A][J])}let g=[],z=[],R=[],U=new Gr;s==0&&[...oe[A]].reduce((J,E)=>J.add(E),U).multiplyScalar(1/f);for(let J=0;J<f;J++){let E=[],H=(J-1+f)%f,k=oe[A][H],se=oe[A][J];m.copy(k).sub(P),x.copy(se).sub(P);let F=P.angleTo(m),K=m.angleTo(x),X=Math.cos(F)*N;s==0?v.copy(U):v.copy(P).setLength(L+X),z.push(X);let te=[v,k,se];for(let he=0;he<2;he++){let Y=te[he],ne=te[he+1];Z.subVectors(Y,P),V.subVectors(ne,P),D.crossVectors(Z,V).normalize();for(let Se=0;Se<w;Se++){let me=[F,K][he]*Se/w;m.copy(Z).applyAxisAngle(D,me).add(P),g.push(m.clone()),he&&(S(m,P),E.push([Se==0?Y:m.clone(),B.clone()]))}he&&(S(ne,P),E.push([ne,B.clone()]))}R.push(E)}ie.push(R);let q=2*w,W=2;for(let J=0;J<f;J++){let E=q*J,H=q*((J+1)%f),k=[g[E]];for(let F=1;F<w;F++){Z=g[E+F],V=g[H+F],k.push(Z);for(let K=1,X=F-W+1;K<=X;K++)m.lerpVectors(Z,V,K/(X+1)),m.sub(P).setLength(z[J]).add(P),k.push(m.clone());k.push(V)}for(let F=0;F<w;F++)k.push(g[F+w+E]);k.push(g[H+w]);let se=b.map(F=>k[F]);a.push(...se.map(F=>[F.x,F.y,F.z]).flat()),c.push(...se.map(F=>(S(F,P),[B.x,B.y,B.z])).flat())}}let ge=[];for(let A=0;A<h.length;A++)for(let j=0;j<f;j++){let g=h[A][j];if(g<I){let z=h[g].findIndex(q=>q%I==A),R=ie[A][j],U=ie[g][z];for(let q=0;q<w;q++){let W=R[q],J=U[w-q],E=R[q+1],H=U[w-(q+1)];[W,J,E,E,J,H].forEach(k=>{a.push(k[0].x,k[0].y,k[0].z),c.push(k[1].x,k[1].y,k[1].z)})}ge.push(R[0][0],U[w][0],R[w][0],U[0][0])}}for(;ge.length;){let A,j,g,z;[A,j]=ge.splice(0,2);let R=[A];for(;A!=j;)R.push(j),g=ge.indexOf(j),z=g%2,j=ge.splice(g-z,2)[1-z];B.subVectors(R[0],R[1]).cross(m.subVectors(R[0],R[2])).normalize();let U=B.dot(R[0])<0;U&&B.negate();for(let q=1;q<=R.length-2;q++)[R[q+ +U],R[q+1-+U],R[0]].forEach(W=>{a.push(W.x,W.y,W.z),c.push(B.x,B.y,B.z)})}}function u(){let p=new Gr;for(let T=0;T<a.length;T+=3){p.x=a[T+0],p.y=a[T+1],p.z=a[T+2];let h=S(p)/2/Math.PI+.5,I=_(p)/Math.PI+.5;l.push(h,1-I)}let f=new Gr,m=new Gr,x=new Gr,y=new Gr,N=new il,L=new il,w=new il,B=(T,h,I,b)=>{b<0&&T.x===1&&(l[h]=T.x-1),I.x===0&&I.z===0&&(l[h]=b/2/Math.PI+.5)};for(let T=0,h=0;T<a.length;T+=9,h+=6){f.set(a[T+0],a[T+1],a[T+2]),m.set(a[T+3],a[T+4],a[T+5]),x.set(a[T+6],a[T+7],a[T+8]),N.set(l[h+0],l[h+1]),L.set(l[h+2],l[h+3]),w.set(l[h+4],l[h+5]),y.copy(f).add(m).add(x).divideScalar(3);let I=S(y);B(N,h+0,f,I),B(L,h+2,m,I),B(w,h+4,x,I)}for(let T=0;T<l.length;T+=6){let h=l[T+0],I=l[T+2],b=l[T+4],P=Math.max(h,I,b),v=Math.min(h,I,b);P>.9&&v<.1&&(h<.2&&(l[T+0]+=1),I<.2&&(l[T+2]+=1),b<.2&&(l[T+4]+=1))}function S(T){return Math.atan2(T.z,-T.x)}function _(T){return Math.atan2(-T.y,Math.sqrt(T.x*T.x+T.z*T.z))}}}static fromJSON(e){return new So(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}};import{DodecahedronBufferGeometry as Jb}from"three";var Lu=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,o,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((n=t.depth)!=null?n:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:o,corner:n,cornerSides:s}=i.parameters,a=o===0&&n!==0?new As(e*.5,n,s):new Jb(e*.5,o);return a.scale(1,t/e,r/e),Object.assign(a,{userData:$(O({},i),{type:"DodecahedronGeometry"})})}},As=class extends So{constructor(e=1,t=.2,r=4){let o=(1+Math.sqrt(5))/2,n=1/o,s=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-n,-o,0,-n,o,0,n,-o,0,n,o,-n,-o,0,-n,o,0,n,-o,0,n,o,0,-o,0,-n,o,0,-n,-o,0,n,o,0,n],a=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],l="DodecahedronGeometry";super(s,a,l,e,t,r);this.type=l}static fromJSON(e){return new As(e.radius,e.corner,e.cornerSides)}};import{EventDispatcher as nv,Plane as sv,Shape as zu,Vector2 as zr,Vector3 as av,MathUtils as pl,LineCurve as ul,QuadraticBezierCurve as Eu,CubicBezierCurve as Ds}from"three";import{CubicBezierCurve as js,EllipseCurve as Kb,LineCurve as _s,LineCurve3 as Xb,MathUtils as Zb,QuadraticBezierCurve as nl,SplineCurve as Qb,Vector2 as lr,Vector3 as Tu}from"three";var Fi=1e-12,Ri=class{constructor(e){this.position=new lr;this.startPosition=new lr;this.uuid=Zb.generateUUID();this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new Ri(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Vi=class extends Ri{constructor(e){super(e.position);this.parent=e}copy(e){return super.copy(e),this}clone(){return new Vi(this.parent).copy(this)}},br=class extends Ri{constructor(e,t){super(t);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=e,this.controls.push(new Vi(this),new Vi(this))}static create(e,t){let r=new br(e,new lr(...t.position));return r.controls[0].position.set(...t.controlPrevious.position),r.controls[1].position.set(...t.controlNext.position),r.roundness=t.roundness,r.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,r}getOppositeControl(e){let t=this.controls.indexOf(e);return t===0?this.controls[1]:t===1?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let r=0,o=this.controls.length;r<o;r++){let n=this.controls[r];this.position.distanceTo(n.position)<=t?n.position.copy(this.position):n.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new br(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}},sl=i=>i,Ui=new lr,al=new lr,Yb=new lr,ev=new lr,tv=new lr,rv=new lr,Iu=new Tu,Mu=new Tu;function Pu(i){let e=new lr;e.addVectors(i.v0,Ui.subVectors(i.v1,i.v0).multiplyScalar(2/3));let t=new lr;return t.addVectors(i.v2,al.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new js(i.v0,e,t,i.v2)}function ki(i,e,t=Number.EPSILON){return Math.abs(i-e)<t}function ov(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function iv(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function ll(i,e,t){let r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),o=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),n=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2));return Math.acos((o*o+r*r-n*n)/(2*o*r))}function Ou(i,e,t,r,o){let n=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),s=(i.y+e.y)/2,a=(i.x+e.x)/2,l=Math.sqrt(Math.pow(t,2)-Math.pow(n/2,2))*(i.y-e.y)/n,c=Math.sqrt(Math.pow(t,2)-Math.pow(n/2,2))*(e.x-i.x)/n;return r.set(a+l,s+c),o.set(a-l,s-c),[r,o]}function Au(i,e,t){let r=i.distanceTo(t),o=e.distanceTo(t);return r<o?e:i}function ju(i,e,t,r,o,n){let s=e.x-i.x,a=e.y-i.y,l=t.x-i.x,c=t.y-i.y,d=Math.sqrt((s+l)*(s+l)+(a+c)*(a+c)),u;return ll(e,i,t)>Math.PI&&(d*=-1),ki(c,a)?u=(a+c)*(r/d-.5)*8/3/(s-l):u=(s+l)*(r/d-.5)*8/3/(c-a),o.set(e.x-u*a,e.y+u*s),n.set(t.x+u*c,t.y-u*l),[o,n]}function cl(i,e){return i.position.equals(i.controls[1].position)&&e.position.equals(e.controls[0].position)}function _u(i,e,t,r,o=.5){let n=Ui.subVectors(e,i).multiplyScalar(o).add(i),s=al.subVectors(t,e).multiplyScalar(o).add(e),a=Yb.subVectors(r,t).multiplyScalar(o).add(t),l=n,c=ev.subVectors(s,n).multiplyScalar(o).add(n),d=tv.subVectors(a,s).multiplyScalar(o).add(s),u=a,p=rv.subVectors(d,c).multiplyScalar(o).add(c);return[i.x,i.y,l.x,l.y,c.x,c.y,p.x,p.y,d.x,d.y,u.x,u.y,r.x,r.y]}function Du(i,e,t=12,r=!0){let o=Mu.set(0,0,0),n,s=0,a=[];for(let l=0;l<e.length;l++){let c=sl(e[l]),d=Ui,u=oo(c,t);a.push(u);for(let p=0;p<=u;p++)if(c instanceof js||c instanceof nl||c instanceof _s){if(c.getPoint(p/u,d),o.set(d.x,d.y,0),n!==void 0&&iv(n,o))continue;n===void 0&&(n=Iu),n.copy(o),i.setXYZ(s,o.x,o.y,o.z),s++}}return r&&s>1&&!(i.getX(s-1)===i.getX(0)&&i.getY(s-1)===i.getY(0)&&i.getZ(s-1)===i.getZ(0))&&(i.setXYZ(s,i.getX(0),i.getY(0),i.getZ(0)),s++),i}function Bu(i,e,t,r=12,o=!0){let n=Mu.set(0,0,0),s=0,a=[];for(let l=0;l<e.length;l++){if(t[l]===!1)continue;let c,d=sl(e[l]),u=Ui,p=oo(d,r);a.push(p);for(let f=0;f<=p;f++)if(d instanceof js||d instanceof nl||d instanceof _s){if(d.getPoint(f/p,u),n.set(u.x,u.y,0),c==null?void 0:c.equals(n))continue;c===void 0?c=Iu:(i.setXYZ(s,c.x,c.y,c.z),s++,i.setXYZ(s,n.x,n.y,n.z),s++),c.copy(n)}}return o&&s>1&&!(i.getX(s-1)===i.getX(0)&&i.getY(s-1)===i.getY(0)&&i.getZ(s-1)===i.getZ(0))&&(i.setXYZ(s,i.getX(0),i.getY(0),i.getZ(0)),s++),a}function dl(i,e=12,t=!1){let r=[];for(let o=0,n=i.length;o<n;o++){let s=i[o],a=0;if(t&&s.roundedCurveCorner!==void 0){let l=oo(s.roundedCurveCorner,e)*.5;o>0&&(r[o-1]+=l),a+=l}s.curveAfter!==void 0&&(a+=oo(s.curveAfter,e)),r.push(a)}return i.length>0&&t&&i[0].roundedCurveCorner!==void 0&&(r[i.length-1]+=oo(i[0].roundedCurveCorner,e)*.5),r}function oo(i,e=12){return i&&i instanceof Kb?e*2:i&&(i instanceof _s||i instanceof Xb)?1:i&&i instanceof Qb?e*i.points.length:e}function Gu(i,e,t=12,r=!0){let o,n=0;for(let s=0;s<e.length;s++){let a=sl(e[s]),l=oo(a,t),c=Ui;for(let d=0;d<=l;d++)if(a instanceof js||a instanceof nl||a instanceof _s){if(a.getPoint(d/l,c),o!==void 0&&ov(o,c,Fi))continue;o===void 0&&(o=al),o.copy(c),i.push(c.x,c.y),n++}}return ki(i[0],i[i.length-2],Fi)&&ki(i[1],i[i.length-1],Fi)&&(i.pop(),i.pop()),r&&n>1&&!(ki(i[n-1],i[1],Fi)&&ki(i[n-2],i[0],Fi))&&(i.push(i[0],i[1]),n++),i}var hl=new zr,lv=new zr,cv=new zr,dv=new zr,pv=new zr,uv=new zr,Pe=class extends zu{constructor(e=100,t=100){super();this.points=[];this.shapeHoles=[];this.eventDispatcher=new nv;this.plane=new sv(new av(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=pl.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=e,this._height=t}static createFromState(e,t,r){let o=new Pe;return o.isClosed=e.isClosed,o.points=e.points.map(n=>br.create(n.id,n.data)),typeof e.roundness=="number"&&(o.roundness=e.roundness),o.shapeHoles=e.shapeHoles.map(n=>Pe.createFromState(n)),t!==void 0&&r!==void 0&&o.applySize(t,r),o.update(),o}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,r=this.points.length;t<r;t++)this.points[t].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(t=>this.getPointIndexById(t)).filter(t=>t>=0)}getPointIndexById(e){return this.points.findIndex(t=>t.uuid===e)}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0)for(let t=0,r=this.shapeHoles.length;t<r;t++){let o=this.shapeHoles[t],n=e-this.points.length;if(n<=o.points.length-1)return o.points[n]}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let t=this.points.indexOf(e);if(t>=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let r=0,o=this.shapeHoles.length;r<o;r++){let n=this.shapeHoles[r],s=n.points.indexOf(e);if(s>=0)return t+s;t+=n.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(t=>t.points));return[...this.points,...e]}applySize(e,t){e===0&&(e=.001),t===0&&(t=.001),this._width=e,this._height=t}applyScale(e,t){let r=hl.set(e,t);for(let o=0,n=this.points.length;o<n;o++){let s=this.points[o];s.position.multiply(r),s.controls[0].position.multiply(r),s.controls[1].position.multiply(r)}for(let o=0,n=this.shapeHoles.length;o<n;o++)this.shapeHoles[o].applyScale(e,t);this._update(!1)}createPoint(e,t=0,r=pl.generateUUID()){let o;e instanceof zr?o=e:o=new zr(e,t);let n=new br(r,o);return n.roundness=this.roundness,n}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let t=0,r=this.points.length;t<r;t++){let o=this.points[t];if(o.uuid===e)return o}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let t=this.points.indexOf(e);t>=0&&this.points.splice(t,1),this.needsUpdate=!0}removePointById(e){let t=this.points.find(r=>r.uuid===e);t&&this.removePoint(t)}update(e=!0){for(let t=0,r=this.shapeHoles.length;t<r;t++)this.shapeHoles[t].update(!1);this._update(e)}extractShapePointsToBuffer(e,t=12,r=!1){this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t);let o=r?this.roundedCurveDivisions:this.curveDivisions;return Du(e,r?this.roundedCurves:this.curves,t,this.autoClose),o.reduce((n,s)=>n+s,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=dl(this.points,e,!1),this.roundedCurveDivisions=dl(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,r=12){return Bu(e,this.curves,t,r,this.autoClose).reduce((n,s)=>n+s,0)*2}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t),Gu(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let r=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let o=t?this.roundedCurveDivisions:this.curveDivisions,n=0;t&&this.points[0].roundedCurveCorner!==void 0&&(n=oo(this.points[0].roundedCurveCorner,this.subdivision)*.5);let s=e-n;s<0&&(s+=o.reduce((a,l)=>a+l,0));for(let a=0,l=o.length;a<l;a++){let c=o[a];if(s<r+c)return[a,(s-r+1)/c];r+=c}return[0,1]}getCurveT(e,t,r){let o=this.points[e],n=this.points[e>=this.points.length-1?0:e+1],s=this.curveDivisions,a=s[e];if(cl(o,n)){let d=o.position.distanceTo(n.position);return o.position.distanceTo(hl.set(r.x,r.y))/d}let l=0;for(let d=0;d<e;d++)l+=s[d];return(t-l)/a}dispose(){this.eventDispatcher=null}_applyCurveForPoint(e,t){cl(t,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(t.controls[1].position.x,t.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let r=this.curves[this.curves.length-1];e.curveBefore=r,t.curveAfter=r;let o=r.clone();e.roundedCurveBefore=o,t.roundedCurveAfter=o,e.roundedCurveCorner=void 0,this.roundedCurves.push(o)}_update(e=!0){var r;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let o=0,n=this.points.length;o<n;o++){let s=this.points[o];if(o===0)this.moveTo(s.position.x,s.position.y);else{let a=this.points[o-1];this._applyCurveForPoint(s,a)}}let t=this.getLastPoint();if((t==null?void 0:t.curveAfter)&&(t.curveAfter=void 0),this.isClosed){let o=this.points[0],n=this.points[this.points.length-1];this._applyCurveForPoint(o,n)}if(this.points.length>2){let o=0;for(let n=0,s=this.points.length;n<s;n++){let a=this.points[n],l=a.roundness;if(!a.controlsMoved()&&l>0){let c=a.curveBefore,d=a.curveAfter;if(c===void 0||d===void 0)continue;let u=a.roundedCurveBefore,p=a.roundedCurveAfter,f=c.getLength(),m=d.getLength(),x=Math.min(l,f*.499),y=Math.min(l,m*.499),N=Math.min(x,y),L=1-N/f,w=N/m,B=c.getPointAt(L,hl),S=d.getPointAt(w,lv);this._subSplitCurve(c,u,L,B,void 0),this._subSplitCurve(d,p,w,void 0,S);let _;if(this.useCubicForRoundedCorners){let T=ll(B,a.position,S)/2,h=Math.tan(T)*B.distanceTo(a.position),[I,b]=Ou(B,S,h,cv,dv),P=Au(I,b,a.position),[v,D]=ju(P,B,S,h,pv,uv);_=new Ds(B.clone(),v.clone(),D.clone(),S.clone())}else _=new Eu(B.clone(),a.position.clone(),S.clone());a.roundedCurveCorner=_,this.roundedCurves.splice(n+o,0,_),o++}}}e&&((r=this.eventDispatcher)==null||r.dispatchEvent({type:"update"}))}_subSplitCurve(e,t,r,o,n){if(e instanceof ul)o!==void 0&&t.v2.copy(o),n!==void 0&&t.v1.copy(n);else{let s=e,a=t,l=s.getUtoTmapping(r,0),c=_u(s.v0,s.v1,s.v2,s.v3,l);return o!==void 0&&(a.v0.set(c[0],c[1]),a.v1.set(c[2],c[3]),a.v2.set(c[4],c[5]),a.v3.set(c[6],c[7])),n!==void 0&&(a.v0.set(c[6],c[7]),a.v1.set(c[8],c[9]),a.v2.set(c[10],c[11]),a.v3.set(c[12],c[13])),a}return t}clone(){let e=new Pe(this._width,this._height);return e.points=this.points.map(t=>t.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(t=>t.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){var r;this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let o=0;o<t;o++){let n=o*7,s=e.points[n+0],a=e.points[n+1],l=e.points[n+2],c=e.points[n+3],d=e.points[n+4],u=e.points[n+5],p=e.points[n+6],f=new br(pl.generateUUID(),new zr(s,a));f.controls[0].position.set(l,c),f.controls[1].position.set(d,u),f.roundness=p,this.points.push(f)}return this.shapeHoles=((r=e.shapeHoles)==null?void 0:r.length)?e.shapeHoles.map(o=>{let n=new Pe;return n.fromJSON(o),n}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e){let t=(o,n)=>{n instanceof Ds&&n.v3.equals(o.position)&&o.controls[0].position.copy(n.v2)},r=o=>{let n=[],s,a;for(s=0,a=o.length;s<a;s++)o[s]instanceof Eu&&(o[s]=Pu(o[s]));for(s=0,a=o.length;s<a;s++){let d=o[s],u=s>0?o[s-1]:null,p;d instanceof Ds?(p=this.createPoint(d.v0),p.controls[1].position.copy(d.v1)):d instanceof ul&&(p=this.createPoint(d.v1)),p!==void 0&&(u!==null&&t(p,u),n.push(p))}let l=o[o.length-1],c=!1;return l instanceof Ds?l.v3.equals(n[0].position)&&(n[0].controls[0].position.copy(l.v2),c=!0):l instanceof ul&&l.v2.equals(n[0].position)&&(c=!0),this.isClosed=c,n};return this.points=r(e.curves),e instanceof zu&&(this.shapeHoles=e.holes.map(o=>{let n=new Pe;return n.fromShape(o),n})),this.update(),this}};var ml=Math.PI*2;function fl({x:i,y:e},t,r,o,n){return{x:i*t+o,y:e*r+n}}function hv(i,e){let t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:4/3*Math.tan(e/4),r=Math.cos(i),o=Math.sin(i),n=Math.cos(i+e),s=Math.sin(i+e);return[{x:r-o*t,y:o+r*t},{x:n+s*t,y:s-n*t},{x:n,y:s}]}function Fu(i,e,t,r){let o=i*r-e*t<0?-1:1,n=Math.min(1,Math.max(-1,i*t+e*r));return o*Math.acos(n)}function mv(i,e,t,r,o,n,s,a,l,c){let d=Math.pow(o,2),u=Math.pow(n,2),p=Math.pow(s,2),f=Math.pow(a,2),m=d*u-d*f-u*p;m<0&&(m=0),m/=d*f+u*p,m=Math.sqrt(m)*(l===c?-1:1);let x=m*o/n*a,y=m*-n/o*s,N=x+(i+t)/2,L=y+(e+r)/2,w=(s-x)/o,B=(a-y)/n,S=(-s-x)/o,_=(-a-y)/n,T=Fu(1,0,w,B),h=Fu(w,B,S,_);return!c&&h>0&&(h-=ml),c&&h<0&&(h+=ml),{centerx:N,centery:L,ang1:T,ang2:h}}function Ru({px:i,py:e,cx:t,cy:r,rx:o,ry:n,largeArcFlag:s,sweepFlag:a}){let l=[];if(o===0||n===0)return[];let c=(i-t)/2,d=(e-r)/2;if(c===0&&d===0)return[];o=Math.abs(o),n=Math.abs(n);let u=Math.pow(c,2)/Math.pow(o,2)+Math.pow(d,2)/Math.pow(n,2);u>1&&(o*=Math.sqrt(u),n*=Math.sqrt(u));let p=mv(i,e,t,r,o,n,c,d,s,a),{ang1:f,ang2:m}=p,{centerx:x,centery:y}=p,N=Math.abs(m)/(ml/4);Math.abs(1-N)<1e-7&&(N=1);let L=Math.max(Math.ceil(N),1);m/=L;for(let w=0;w<L;w++)l.push(hv(f,m)),f+=m;return l.map(w=>{let{x:B,y:S}=fl(w[0],o,n,x,y),{x:_,y:T}=fl(w[1],o,n,x,y),{x:h,y:I}=fl(w[2],o,n,x,y);return{x1:B,y1:S,x2:_,y2:T,x:h,y:I}})}import{BufferAttribute as Gs,BufferGeometry as bv}from"three";var $e;(function(i){i[i.ODD=0]="ODD",i[i.NONZERO=1]="NONZERO",i[i.POSITIVE=2]="POSITIVE",i[i.NEGATIVE=3]="NEGATIVE",i[i.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})($e||($e={}));var st;(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(st||(st={}));function ce(i,e){if(!i)throw e||"Assertion Failed!"}var ae=function(){function i(){}return i.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},i.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},i.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},i.edgeGoesLeft=function(e){return i.vertLeq(e.Dst,e.Org)},i.edgeGoesRight=function(e){return i.vertLeq(e.Org,e.Dst)},i.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},i.edgeEval=function(e,t,r){ce(i.vertLeq(e,t)&&i.vertLeq(t,r));var o=t.s-e.s,n=r.s-t.s;return o+n>0?o<n?t.t-e.t+(e.t-r.t)*(o/(o+n)):t.t-r.t+(r.t-e.t)*(n/(o+n)):0},i.edgeSign=function(e,t,r){ce(i.vertLeq(e,t)&&i.vertLeq(t,r));var o=t.s-e.s,n=r.s-t.s;return o+n>0?(t.t-r.t)*o+(t.t-e.t)*n:0},i.transEval=function(e,t,r){ce(i.transLeq(e,t)&&i.transLeq(t,r));var o=t.t-e.t,n=r.t-t.t;return o+n>0?o<n?t.s-e.s+(e.s-r.s)*(o/(o+n)):t.s-r.s+(r.s-e.s)*(n/(o+n)):0},i.transSign=function(e,t,r){ce(i.transLeq(e,t)&&i.transLeq(t,r));var o=t.t-e.t,n=r.t-t.t;return o+n>0?(t.s-r.s)*o+(t.s-e.s)*n:0},i.vertCCW=function(e,t,r){return e.s*(t.t-r.t)+t.s*(r.t-e.t)+r.s*(e.t-t.t)>=0},i.interpolate=function(e,t,r,o){return e=e<0?0:e,r=r<0?0:r,e<=r?r===0?(t+o)/2:t+(o-t)*(e/(e+r)):o+(t-o)*(r/(e+r))},i.intersect=function(e,t,r,o,n){var s,a,l;i.vertLeq(e,t)||(l=e,e=t,t=l),i.vertLeq(r,o)||(l=r,r=o,o=l),i.vertLeq(e,r)||(l=e,e=r,r=l,l=t,t=o,o=l),i.vertLeq(r,t)?i.vertLeq(t,o)?(s=i.edgeEval(e,r,t),a=i.edgeEval(r,t,o),s+a<0&&(s=-s,a=-a),n.s=i.interpolate(s,r.s,a,t.s)):(s=i.edgeSign(e,r,t),a=-i.edgeSign(e,o,t),s+a<0&&(s=-s,a=-a),n.s=i.interpolate(s,r.s,a,o.s)):n.s=(r.s+t.s)/2,i.transLeq(e,t)||(l=e,e=t,t=l),i.transLeq(r,o)||(l=r,r=o,o=l),i.transLeq(e,r)||(l=e,e=r,r=l,l=t,t=o,o=l),i.transLeq(r,t)?i.transLeq(t,o)?(s=i.transEval(e,r,t),a=i.transEval(r,t,o),s+a<0&&(s=-s,a=-a),n.t=i.interpolate(s,r.t,a,t.t)):(s=i.transSign(e,r,t),a=-i.transSign(e,o,t),s+a<0&&(s=-s,a=-a),n.t=i.interpolate(s,r.t,a,o.t)):n.t=(r.t+t.t)/2},i}(),Hi=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return i}(),Bs=function(){function i(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(i.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),i}(),li=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return i}(),Vu=function(){function i(){var e=new li,t=new Hi,r=new Bs(0),o=new Bs(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,r.next=r,r.Sym=o,o.next=o,o.Sym=r,this.vHead=e,this.fHead=t,this.eHead=r,this.eHeadSym=o}return i.prototype.makeEdge_=function(e){var t=new Bs(0),r=new Bs(1);e.Sym.side<e.side&&(e=e.Sym);var o=e.Sym.next;return r.next=o,o.Sym.next=t,t.next=e,e.Sym.next=r,t.Sym=r,t.Onext=t,t.Lnext=r,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,r.Sym=t,r.Onext=r,r.Lnext=t,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,t},i.prototype.splice_=function(e,t){var r=e.Onext,o=t.Onext;r.Sym.Lnext=t,o.Sym.Lnext=e,e.Onext=o,t.Onext=r},i.prototype.makeVertex_=function(e,t,r){var o=e;ce(o,"Vertex can't be null!");var n=r.prev;o.prev=n,n.next=o,o.next=r,r.prev=o,o.anEdge=t;var s=t;do s.Org=o,s=s.Onext;while(s!==t)},i.prototype.makeFace_=function(e,t,r){var o=e;ce(o,"Face can't be null");var n=r.prev;o.prev=n,n.next=o,o.next=r,r.prev=o,o.anEdge=t,o.trail=null,o.marked=!1,o.inside=r.inside;var s=t;do s.Lface=o,s=s.Lnext;while(s!==t)},i.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,r=e.Sym.next;t.Sym.next=r,r.Sym.next=t},i.prototype.killVertex_=function(e,t){var r=e.anEdge,o=r;do o.Org=t,o=o.Onext;while(o!==r);var n=e.prev,s=e.next;s.prev=n,n.next=s},i.prototype.killFace_=function(e,t){var r=e.anEdge,o=r;do o.Lface=t,o=o.Lnext;while(o!==r);var n=e.prev,s=e.next;s.prev=n,n.next=s},i.prototype.makeEdge=function(){var e=new li,t=new li,r=new Hi,o=this.makeEdge_(this.eHead);return this.makeVertex_(e,o,this.vHead),this.makeVertex_(t,o.Sym,this.vHead),this.makeFace_(r,o,this.fHead),o},i.prototype.splice=function(e,t){var r=!1,o=!1;if(e!==t){if(t.Org!==e.Org&&(o=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!o){var n=new li;this.makeVertex_(n,t,e.Org),e.Org.anEdge=e}if(!r){var s=new Hi;this.makeFace_(s,t,e.Lface),e.Lface.anEdge=e}}},i.prototype.delete=function(e){var t=e.Sym,r=!1;if(e.Lface!==e.Rface&&(r=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!r){var o=new Hi;this.makeFace_(o,e,e.Lface)}t.Onext===t?(this.killVertex_(t.Org,null),this.killFace_(t.Lface,null)):(e.Lface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),this.killEdge_(e)},i.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),r=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var o=new li;return this.makeVertex_(o,r,t.Org),t.Lface=r.Lface=e.Lface,t},i.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e),r=t.Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,r),e.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=e.Rface,r.winding=e.winding,r.Sym.winding=e.Sym.winding,r.idx=e.idx,r.Sym.idx=e.Sym.idx,r},i.prototype.connect=function(e,t){var r=!1,o=this.makeEdge_(e),n=o.Sym;if(t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(o,e.Lnext),this.splice_(n,t),o.Org=e.Dst,n.Org=t.Org,o.Lface=n.Lface=e.Lface,e.Lface.anEdge=n,!r){var s=new Hi;this.makeFace_(s,o,e.Lface)}return o},i.prototype.zapFace=function(e){var t=e.anEdge,r,o,n,s,a;o=t.Lnext;do r=o,o=r.Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),n=r.Sym,n.Onext===n?this.killVertex_(n.Org,null):(n.Org.anEdge=n.Onext,this.splice_(n,n.Oprev)),this.killEdge_(r));while(r!=t);s=e.prev,a=e.next,a.prev=s,s.next=a},i.prototype.countFaceVerts_=function(e){var t=e.anEdge,r=0;do r++,t=t.Lnext;while(t!==e.anEdge);return r},i.prototype.mergeConvexFaces=function(e){var t,r,o,n,s,a,l;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(!!t.inside)for(r=t.anEdge,s=r.Org;o=r.Lnext,n=r.Sym,n&&n.Lface&&n.Lface.inside&&(a=this.countFaceVerts_(t),l=this.countFaceVerts_(n.Lface),a+l-2<=e&&ae.vertCCW(r.Lprev.Org,r.Org,n.Lnext.Lnext.Org)&&ae.vertCCW(n.Lprev.Org,n.Org,r.Lnext.Lnext.Org)&&(o=n.Lnext,this.delete(n),r=null,n=null)),!(r&&r.Lnext.Org===s);)r=o;return!0},i.prototype.check=function(){var e=this.fHead,t=this.vHead,r=this.eHead,o,n,s,a,l,c;for(n=e,n=e;(o=n.next)!==e;n=o){ce(o.prev===n),l=o.anEdge;do ce(l.Sym!==l),ce(l.Sym.Sym===l),ce(l.Lnext.Onext.Sym===l),ce(l.Onext.Sym.Lnext===l),ce(l.Lface===o),l=l.Lnext;while(l!==o.anEdge)}for(ce(o.prev===n&&o.anEdge===null),a=t,a=t;(s=a.next)!==t;a=s){ce(s.prev===a),l=s.anEdge;do ce(l.Sym!==l),ce(l.Sym.Sym===l),ce(l.Lnext.Onext.Sym===l),ce(l.Onext.Sym.Lnext===l),ce(l.Org===s),l=l.Onext;while(l!==s.anEdge)}for(ce(s.prev===a&&s.anEdge===null),c=r,c=r;(l=c.next)!==r;c=l)ce(l.Sym.next===c.Sym),ce(l.Sym!==l),ce(l.Sym.Sym===l),ce(l.Org!==null),ce(l.Dst!==null),ce(l.Lnext.Onext.Sym===l),ce(l.Onext.Sym.Lnext===l);ce(l.Sym.next===c.Sym&&l.Sym===this.eHeadSym&&l.Sym.Sym===l&&l.Org===null&&l.Dst===null&&l.Lface===null&&l.Rface===null)},i}(),Uu=function(){function i(){this.handle=null}return i}(),ku=function(){function i(){this.key=null,this.node=0}return i}(),fv=function(){function i(e,t){this.leq=t,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var r=0;r<e+1;r++)this.nodes[r]=new Uu,this.handles[r]=new ku;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(e){var t=this.nodes,r=this.handles,o,n,s;for(o=t[e].handle;;){if(s=e<<1,s<this.size&&this.leq(r[t[s+1].handle].key,r[t[s].handle].key)&&++s,ce(s<=this.max),n=t[s].handle,s>this.size||this.leq(r[o].key,r[n].key)){t[e].handle=o,r[o].node=e;break}t[e].handle=n,r[n].node=e,e=s}},i.prototype.floatUp_=function(e){var t=this.nodes,r=this.handles,o,n,s;for(o=t[e].handle;;){if(s=e>>1,n=t[s].handle,s===0||this.leq(r[n].key,r[o].key)){t[e].handle=o,r[o].node=e;break}t[e].handle=n,r[n].node=e,e=s}},i.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(e){var t,r;if(t=++this.size,t*2>this.max){this.max*=2;var o,n;for(n=this.nodes.length,this.nodes.length=this.max+1,o=n;o<this.nodes.length;o++)this.nodes[o]=new Uu;for(n=this.handles.length,this.handles.length=this.max+1,o=n;o<this.handles.length;o++)this.handles[o]=new ku}return this.freeList===0?r=t:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[t].handle=r,this.handles[r].node=t,this.handles[r].key=e,this.initialized&&this.floatUp_(t),r},i.prototype.extractMin=function(){var e=this.nodes,t=this.handles,r=e[1].handle,o=t[r].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[r].key=null,t[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),o},i.prototype.delete=function(e){var t=this.nodes,r=this.handles,o;ce(e>=1&&e<=this.max&&r[e].key!==null),o=r[e].node,t[o].handle=t[this.size].handle,r[t[o].handle].node=o,--this.size,o<=this.size&&(o<=1||this.leq(r[t[o>>1].handle].key,r[t[o].handle].key)?this.floatDown_(o):this.floatUp_(o)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},i}(),yl=function(){function i(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return i}(),Hu=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),yv=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new Hu,this.head.next=this.head,this.head.prev=this.head}return i.prototype.min=function(){return this.head.next},i.prototype.max=function(){return this.head.prev},i.prototype.insert=function(e){return this.insertBefore(this.head,e)},i.prototype.search=function(e){var t=this.head;do t=t.next;while(t.key!==null&&!this.leq(this.frame,e,t.key));return t},i.prototype.insertBefore=function(e,t){do e=e.prev;while(e.key!==null&&!this.leq(this.frame,e.key,t));var r=new Hu;return r.key=t,r.next=e.next,e.next.prev=r,r.prev=e,e.next=r,r},i.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},i}(),gv=function(){function i(){}return i.regionBelow=function(e){return e.nodeUp.prev.key},i.regionAbove=function(e){return e.nodeUp.next.key},i.debugEvent=function(e){},i.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.edgeLeq=function(e,t,r){var o=e.event,n=t.eUp,s=r.eUp;if(n.Dst===o)return s.Dst===o?ae.vertLeq(n.Org,s.Org)?ae.edgeSign(s.Dst,n.Org,s.Org)<=0:ae.edgeSign(n.Dst,s.Org,n.Org)>=0:ae.edgeSign(s.Dst,o,s.Org)<=0;if(s.Dst===o)return ae.edgeSign(n.Dst,o,n.Org)>=0;var a=ae.edgeEval(n.Dst,o,n.Org),l=ae.edgeEval(s.Dst,o,s.Org);return a>=l},i.deleteRegion=function(e,t){t.fixUpperEdge&&ce(t.eUp.winding===0),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},i.fixUpperEdge=function(e,t,r){ce(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=r,r.activeRegion=t},i.topLeftRegion=function(e,t){var r=t.eUp.Org,o;do t=i.regionAbove(t);while(t.eUp.Org===r);if(t.fixUpperEdge){if(o=e.mesh.connect(i.regionBelow(t).eUp.Sym,t.eUp.Lnext),o===null)return null;i.fixUpperEdge(e,t,o),t=i.regionAbove(t)}return t},i.topRightRegion=function(e){var t=e.eUp.Dst;do e=i.regionAbove(e);while(e.eUp.Dst===t);return e},i.addRegionBelow=function(e,t,r){var o=new yl;return o.eUp=r,o.nodeUp=e.dict.insertBefore(t.nodeUp,o),o.fixUpperEdge=!1,o.sentinel=!1,o.dirty=!1,r.activeRegion=o,o},i.isWindingInside=function(e,t){switch(e.windingRule){case $e.ODD:return(t&1)!=0;case $e.NONZERO:return t!==0;case $e.POSITIVE:return t>0;case $e.NEGATIVE:return t<0;case $e.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(e,t){t.windingNumber=i.regionAbove(t).windingNumber+t.eUp.winding,t.inside=i.isWindingInside(e,t.windingNumber)},i.finishRegion=function(e,t){var r=t.eUp,o=r.Lface;o.inside=t.inside,o.anEdge=r,i.deleteRegion(e,t)},i.finishLeftRegions=function(e,t,r){for(var o,n=null,s=t,a=t.eUp;s!==r;){if(s.fixUpperEdge=!1,n=i.regionBelow(s),o=n.eUp,o.Org!=a.Org){if(!n.fixUpperEdge){i.finishRegion(e,s);break}o=e.mesh.connect(a.Lprev,o.Sym),i.fixUpperEdge(e,n,o)}a.Onext!==o&&(e.mesh.splice(o.Oprev,o),e.mesh.splice(a,o)),i.finishRegion(e,s),a=n.eUp,s=n}return a},i.addRightEdges=function(e,t,r,o,n,s){var a,l,c,d,u=!0;c=r;do ce(ae.vertLeq(c.Org,c.Dst)),i.addRegionBelow(e,t,c.Sym),c=c.Onext;while(c!==o);for(n===null&&(n=i.regionBelow(t).eUp.Rprev),l=t,d=n;a=i.regionBelow(l),c=a.eUp.Sym,c.Org===d.Org;)c.Onext!==d&&(e.mesh.splice(c.Oprev,c),e.mesh.splice(d.Oprev,c)),a.windingNumber=l.windingNumber-c.winding,a.inside=i.isWindingInside(e,a.windingNumber),l.dirty=!0,!u&&i.checkForRightSplice(e,l)&&(i.addWinding(c,d),i.deleteRegion(e,l),e.mesh.delete(d)),u=!1,l=a,d=c;l.dirty=!0,ce(l.windingNumber-c.winding===a.windingNumber),s&&i.walkDirtyRegions(e,l)},i.spliceMergeVertices=function(e,t,r){e.mesh.splice(t,r)},i.vertexWeights=function(e,t,r){var o=ae.vertL1dist(t,e),n=ae.vertL1dist(r,e),s=.5*n/(o+n),a=.5*o/(o+n);e.coords[0]+=s*t.coords[0]+a*r.coords[0],e.coords[1]+=s*t.coords[1]+a*r.coords[1],e.coords[2]+=s*t.coords[2]+a*r.coords[2]},i.getIntersectData=function(e,t,r,o,n,s){t.coords[0]=t.coords[1]=t.coords[2]=0,t.idx=-1,i.vertexWeights(t,r,o),i.vertexWeights(t,n,s)},i.checkForRightSplice=function(e,t){var r=i.regionBelow(t),o=t.eUp,n=r.eUp;if(ae.vertLeq(o.Org,n.Org)){if(ae.edgeSign(n.Dst,o.Org,n.Org)>0)return!1;ae.vertEq(o.Org,n.Org)?o.Org!==n.Org&&(e.pq.delete(o.Org.pqHandle),i.spliceMergeVertices(e,n.Oprev,o)):(e.mesh.splitEdge(n.Sym),e.mesh.splice(o,n.Oprev),t.dirty=r.dirty=!0)}else{if(ae.edgeSign(o.Dst,n.Org,o.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(o.Sym),e.mesh.splice(n.Oprev,o)}return!0},i.checkForLeftSplice=function(e,t){var r=i.regionBelow(t),o=t.eUp,n=r.eUp,s;if(ce(!ae.vertEq(o.Dst,n.Dst)),ae.vertLeq(o.Dst,n.Dst)){if(ae.edgeSign(o.Dst,n.Dst,o.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,s=e.mesh.splitEdge(o),e.mesh.splice(n.Sym,s),s.Lface.inside=t.inside}else{if(ae.edgeSign(n.Dst,o.Dst,n.Org)>0)return!1;t.dirty=r.dirty=!0,s=e.mesh.splitEdge(n),e.mesh.splice(o.Lnext,n.Sym),s.Rface.inside=t.inside}return!0},i.checkForIntersect=function(e,t){var r=i.regionBelow(t),o=t.eUp,n=r.eUp,s=o.Org,a=n.Org,l=o.Dst,c=n.Dst,d,u,p=new li,f,m;if(ce(!ae.vertEq(c,l)),ce(ae.edgeSign(l,e.event,s)<=0),ce(ae.edgeSign(c,e.event,a)>=0),ce(s!==e.event&&a!==e.event),ce(!t.fixUpperEdge&&!r.fixUpperEdge),s===a||(d=Math.min(s.t,l.t),u=Math.max(a.t,c.t),d>u))return!1;if(ae.vertLeq(s,a)){if(ae.edgeSign(c,s,a)>0)return!1}else if(ae.edgeSign(l,a,s)<0)return!1;return i.debugEvent(e),ae.intersect(l,s,c,a,p),ce(Math.min(s.t,l.t)<=p.t),ce(p.t<=Math.max(a.t,c.t)),ce(Math.min(c.s,l.s)<=p.s),ce(p.s<=Math.max(a.s,s.s)),ae.vertLeq(p,e.event)&&(p.s=e.event.s,p.t=e.event.t),f=ae.vertLeq(s,a)?s:a,ae.vertLeq(f,p)&&(p.s=f.s,p.t=f.t),ae.vertEq(p,s)||ae.vertEq(p,a)?(i.checkForRightSplice(e,t),!1):!ae.vertEq(l,e.event)&&ae.edgeSign(l,e.event,p)>=0||!ae.vertEq(c,e.event)&&ae.edgeSign(c,e.event,p)<=0?c===e.event?(e.mesh.splitEdge(o.Sym),e.mesh.splice(n.Sym,o),t=i.topLeftRegion(e,t),o=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),r),i.addRightEdges(e,t,o.Oprev,o,o,!0),!0):l===e.event?(e.mesh.splitEdge(n.Sym),e.mesh.splice(o.Lnext,n.Oprev),r=t,t=i.topRightRegion(t),m=i.regionBelow(t).eUp.Rprev,r.eUp=n.Oprev,n=i.finishLeftRegions(e,r,null),i.addRightEdges(e,t,n.Onext,o.Rprev,m,!0),!0):(ae.edgeSign(l,e.event,p)>=0&&(i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(o.Sym),o.Org.s=e.event.s,o.Org.t=e.event.t),ae.edgeSign(c,e.event,p)<=0&&(t.dirty=r.dirty=!0,e.mesh.splitEdge(n.Sym),n.Org.s=e.event.s,n.Org.t=e.event.t),!1):(e.mesh.splitEdge(o.Sym),e.mesh.splitEdge(n.Sym),e.mesh.splice(n.Oprev,o),o.Org.s=p.s,o.Org.t=p.t,o.Org.pqHandle=e.pq.insert(o.Org),i.getIntersectData(e,o.Org,s,l,a,c),i.regionAbove(t).dirty=t.dirty=r.dirty=!0,!1)},i.walkDirtyRegions=function(e,t){for(var r=i.regionBelow(t),o,n;;){for(;r.dirty;)t=r,r=i.regionBelow(r);if(!t.dirty&&(r=t,t=i.regionAbove(t),t===null||!t.dirty))return;if(t.dirty=!1,o=t.eUp,n=r.eUp,o.Dst!==n.Dst&&i.checkForLeftSplice(e,t)&&(r.fixUpperEdge?(i.deleteRegion(e,r),e.mesh.delete(n),r=i.regionBelow(t),n=r.eUp):t.fixUpperEdge&&(i.deleteRegion(e,t),e.mesh.delete(o),t=i.regionAbove(r),o=t.eUp)),o.Org!==n.Org)if(o.Dst!==n.Dst&&!t.fixUpperEdge&&!r.fixUpperEdge&&(o.Dst===e.event||n.Dst===e.event)){if(i.checkForIntersect(e,t))return}else i.checkForRightSplice(e,t);o.Org===n.Org&&o.Dst===n.Dst&&(i.addWinding(n,o),i.deleteRegion(e,t),e.mesh.delete(o),t=i.regionAbove(r))}},i.connectRightVertex=function(e,t,r){var o,n=r.Onext,s=i.regionBelow(t),a=t.eUp,l=s.eUp,c=!1;if(a.Dst!==l.Dst&&i.checkForIntersect(e,t),ae.vertEq(a.Org,e.event)&&(e.mesh.splice(n.Oprev,a),t=i.topLeftRegion(e,t),n=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),s),c=!0),ae.vertEq(l.Org,e.event)&&(e.mesh.splice(r,l.Oprev),r=i.finishLeftRegions(e,s,null),c=!0),c){i.addRightEdges(e,t,r.Onext,n,n,!0);return}ae.vertLeq(l.Org,a.Org)?o=l.Oprev:o=a,o=e.mesh.connect(r.Lprev,o),i.addRightEdges(e,t,o,o.Onext,o.Onext,!1),o.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(e,t)},i.connectLeftDegenerate=function(e,t,r){var o,n,s,a,l;if(o=t.eUp,ae.vertEq(o.Org,r)){ce(!1),i.spliceMergeVertices(e,o,r.anEdge);return}if(!ae.vertEq(o.Dst,r)){e.mesh.splitEdge(o.Sym),t.fixUpperEdge&&(e.mesh.delete(o.Onext),t.fixUpperEdge=!1),e.mesh.splice(r.anEdge,o),i.sweepEvent(e,r);return}ce(!1),t=i.topRightRegion(t),l=i.regionBelow(t),s=l.eUp.Sym,n=a=s.Onext,l.fixUpperEdge&&(ce(n!==s),i.deleteRegion(e,l),e.mesh.delete(s),s=n.Oprev),e.mesh.splice(r.anEdge,s),ae.edgeGoesLeft(n)||(n=null),i.addRightEdges(e,t,s.Onext,a,n,!0)},i.connectLeftVertex=function(e,t){var r,o,n,s,a,l,c=new yl;if(c.eUp=t.anEdge.Sym,r=e.dict.search(c).key,o=i.regionBelow(r),!!o){if(s=r.eUp,a=o.eUp,ae.edgeSign(s.Dst,t,s.Org)===0){i.connectLeftDegenerate(e,r,t);return}if(n=ae.vertLeq(a.Dst,s.Dst)?r:o,r.inside||n.fixUpperEdge){if(n===r)l=e.mesh.connect(t.anEdge.Sym,s.Lnext);else{var d=e.mesh.connect(a.Dnext,t.anEdge);l=d.Sym}n.fixUpperEdge?i.fixUpperEdge(e,n,l):i.computeWinding(e,i.addRegionBelow(e,r,l)),i.sweepEvent(e,t)}else i.addRightEdges(e,r,t.anEdge,t.anEdge,null,!0)}},i.sweepEvent=function(e,t){e.event=t,i.debugEvent(e);for(var r=t.anEdge;r.activeRegion===null;)if(r=r.Onext,r===t.anEdge){i.connectLeftVertex(e,t);return}var o=i.topLeftRegion(e,r.activeRegion);ce(o!==null);var n=i.regionBelow(o),s=n.eUp,a=i.finishLeftRegions(e,n,null);a.Onext===s?i.connectRightVertex(e,o,a):i.addRightEdges(e,o,a.Onext,s,s,!0)},i.addSentinel=function(e,t,r,o){var n=new yl,s=e.mesh.makeEdge();s.Org.s=r,s.Org.t=o,s.Dst.s=t,s.Dst.t=o,e.event=s.Dst,n.eUp=s,n.windingNumber=0,n.inside=!1,n.fixUpperEdge=!1,n.sentinel=!0,n.dirty=!1,n.nodeUp=e.dict.insert(n)},i.initEdgeDict=function(e){e.dict=new yv(e,i.edgeLeq);var t=e.bmax[0]-e.bmin[0],r=e.bmax[1]-e.bmin[1],o=e.bmin[0]-t,n=e.bmax[0]+t,s=e.bmin[1]-r,a=e.bmax[1]+r;i.addSentinel(e,o,n,s),i.addSentinel(e,o,n,a)},i.doneEdgeDict=function(e){for(var t,r=0;(t=e.dict.min().key)!==null;)t.sentinel||(ce(t.fixUpperEdge),ce(++r==1)),ce(t.windingNumber===0),i.deleteRegion(e,t)},i.removeDegenerateEdges=function(e){var t,r,o,n=e.mesh.eHead;for(t=n.next;t!==n;t=r)r=t.next,o=t.Lnext,ae.vertEq(t.Org,t.Dst)&&t.Lnext.Lnext!==t&&(i.spliceMergeVertices(e,o,t),e.mesh.delete(t),t=o,o=t.Lnext),o.Lnext===t&&(o!==t&&((o===r||o===r.Sym)&&(r=r.next),e.mesh.delete(o)),(t===r||t===r.Sym)&&(r=r.next),e.mesh.delete(t))},i.initPriorityQ=function(e){var t,r,o,n=0;for(o=e.mesh.vHead,r=o.next;r!==o;r=r.next)n++;for(n+=8,t=e.pq=new fv(n,ae.vertLeq),o=e.mesh.vHead,r=o.next;r!==o;r=r.next)r.pqHandle=t.insert(r);return r!==o?!1:(t.init(),!0)},i.donePriorityQ=function(e){e.pq=null},i.removeDegenerateFaces=function(e,t){var r,o,n;for(r=t.fHead.next;r!==t.fHead;r=o)o=r.next,n=r.anEdge,ce(n.Lnext!==n),n.Lnext.Lnext===n&&(i.addWinding(n.Onext,n),e.mesh.delete(n));return!0},i.computeInterior=function(e,t){t===void 0&&(t=!0);var r,o;if(i.removeDegenerateEdges(e),!i.initPriorityQ(e))return!1;for(i.initEdgeDict(e);(r=e.pq.extractMin())!==null;){for(;o=e.pq.min(),!(o===null||!ae.vertEq(o,r));)o=e.pq.extractMin(),i.spliceMergeVertices(e,r.anEdge,o.anEdge);i.sweepEvent(e,r)}return e.event=e.dict.min().key.eUp.Org,i.debugEvent(e),i.doneEdgeDict(e),i.donePriorityQ(e),i.removeDegenerateFaces(e,e.mesh)?(t&&e.mesh.check(),!0):!1},i}(),xv=function(){function i(){this.mesh=new Vu,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=$e.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return i.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},i.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},i.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},i.prototype.computeNormal_=function(e){var t,r,o,n,s,a,l=[0,0,0],c=[0,0,0],d=[0,0,0],u=[0,0,0],p=[0,0,0],f=[null,null,null],m=[null,null,null],x=this.mesh.vHead;t=x.next;for(var y=0;y<3;++y)n=t.coords[y],c[y]=n,m[y]=t,l[y]=n,f[y]=t;for(t=x.next;t!==x;t=t.next)for(var N=0;N<3;++N)n=t.coords[N],n<c[N]&&(c[N]=n,m[N]=t),n>l[N]&&(l[N]=n,f[N]=t);var L=0;if(l[1]-c[1]>l[0]-c[0]&&(L=1),l[2]-c[2]>l[L]-c[L]&&(L=2),c[L]>=l[L]){e[0]=0,e[1]=0,e[2]=1;return}for(a=0,r=m[L],o=f[L],d[0]=r.coords[0]-o.coords[0],d[1]=r.coords[1]-o.coords[1],d[2]=r.coords[2]-o.coords[2],t=x.next;t!==x;t=t.next)u[0]=t.coords[0]-o.coords[0],u[1]=t.coords[1]-o.coords[1],u[2]=t.coords[2]-o.coords[2],p[0]=d[1]*u[2]-d[2]*u[1],p[1]=d[2]*u[0]-d[0]*u[2],p[2]=d[0]*u[1]-d[1]*u[0],s=p[0]*p[0]+p[1]*p[1]+p[2]*p[2],s>a&&(a=s,e[0]=p[0],e[1]=p[1],e[2]=p[2]);a<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(d)]=1)},i.prototype.checkOrientation_=function(){for(var e=this.mesh.fHead,t,r=this.mesh.vHead,o,n=0,s=e.next;s!==e;s=s.next)if(o=s.anEdge,!(o.winding<=0))do n+=(o.Org.s-o.Dst.s)*(o.Org.t+o.Dst.t),o=o.Lnext;while(o!==s.anEdge);if(n<0){for(t=r.next;t!==r;t=t.next)t.t=-t.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},i.prototype.projectPolygon_=function(){var e=this.mesh.vHead,t=[0,0,0],r,o,n=!1;t[0]=this.normal[0],t[1]=this.normal[1],t[2]=this.normal[2],!t[0]&&!t[1]&&!t[2]&&(this.computeNormal_(t),n=!0),r=this.sUnit,o=this.tUnit;var s=this.longAxis_(t);r[s]=0,r[(s+1)%3]=1,r[(s+2)%3]=0,o[s]=0,o[(s+1)%3]=0,o[(s+2)%3]=t[s]>0?1:-1;for(var a=e.next;a!==e;a=a.next)a.s=this.dot_(a.coords,r),a.t=this.dot_(a.coords,o);n&&this.checkOrientation_();for(var l=!0,c=e.next;c!==e;c=c.next)l?(this.bmin[0]=this.bmax[0]=c.s,this.bmin[1]=this.bmax[1]=c.t,l=!1):(c.s<this.bmin[0]&&(this.bmin[0]=c.s),c.s>this.bmax[0]&&(this.bmax[0]=c.s),c.t<this.bmin[1]&&(this.bmin[1]=c.t),c.t>this.bmax[1]&&(this.bmax[1]=c.t))},i.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.prototype.tessellateMonoRegion_=function(e,t){var r,o;if(r=t.anEdge,!(r.Lnext!==r&&r.Lnext.Lnext!==r))throw"Mono region invalid";for(;ae.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;ae.vertLeq(r.Org,r.Dst);r=r.Lnext);o=r.Lprev;for(var n=void 0;r.Lnext!==o;)if(ae.vertLeq(r.Dst,o.Org)){for(;o.Lnext!==r&&(ae.edgeGoesLeft(o.Lnext)||ae.edgeSign(o.Org,o.Dst,o.Lnext.Dst)<=0);)n=e.connect(o.Lnext,o),o=n.Sym;o=o.Lprev}else{for(;o.Lnext!==r&&(ae.edgeGoesRight(r.Lprev)||ae.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)n=e.connect(r,r.Lprev),r=n.Sym;r=r.Lnext}if(o.Lnext===r)throw"Mono region invalid";for(;o.Lnext.Lnext!==r;)n=e.connect(o.Lnext,o),o=n.Sym;return!0},i.prototype.tessellateInterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)if(t=r.next,r.inside&&!this.tessellateMonoRegion_(e,r))return!1;return!0},i.prototype.discardExterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)t=r.next,r.inside||e.zapFace(r)},i.prototype.setWindingNumber_=function(e,t,r){for(var o,n=e.eHead.next;n!==e.eHead;n=o)o=n.next,n.Rface.inside!==n.Lface.inside?n.winding=n.Lface.inside?t:-t:r?e.delete(n):n.winding=0},i.prototype.getNeighbourFace_=function(e){return!e.Rface||!e.Rface.inside?-1:e.Rface.n},i.prototype.outputPolymesh_=function(e,t,r,o){var n,s=0,a=0,l;r>3&&e.mergeConvexFaces(r);for(var c=e.vHead.next;c!==e.vHead;c=c.next)c.n=-1;for(var d=e.fHead.next;d!==e.fHead;d=d.next)if(d.n=-1,!!d.inside){n=d.anEdge,l=0;do{var c=n.Org;c.n===-1&&(c.n=a,a++),l++,n=n.Lnext}while(n!==d.anEdge);if(l>r)throw"Face vertex greater that support polygon";d.n=s,++s}this.elementCount=s,t===st.CONNECTED_POLYGONS&&(s*=2),this.elements=[],this.elements.length=s*r,this.vertexCount=a,this.vertices=[],this.vertices.length=a*o,this.vertexIndices=[],this.vertexIndices.length=a;for(var c=e.vHead.next;c!==e.vHead;c=c.next)if(c.n!==-1){var u=c.n*o;this.vertices[u+0]=c.coords[0],this.vertices[u+1]=c.coords[1],o>2&&(this.vertices[u+2]=c.coords[2]),this.vertexIndices[c.n]=c.idx}for(var p=0,d=e.fHead.next;d!==e.fHead;d=d.next)if(!!d.inside){n=d.anEdge,l=0;do{var c=n.Org;this.elements[p++]=c.n,l++,n=n.Lnext}while(n!==d.anEdge);for(var f=l;f<r;++f)this.elements[p++]=-1;if(t===st.CONNECTED_POLYGONS){n=d.anEdge;do this.elements[p++]=this.getNeighbourFace_(n),n=n.Lnext;while(n!==d.anEdge);for(var m=l;m<r;++m)this.elements[p++]=-1}}},i.prototype.outputContours_=function(e,t){var r,o,n=0,s=0;this.vertexCount=0,this.elementCount=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){o=r=a.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==o);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*t,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var l=0,c=0,d=0;n=0;for(var a=e.fHead.next;a!==e.fHead;a=a.next)if(!!a.inside){s=0,o=r=a.anEdge;do this.vertices[l++]=r.Org.coords[0],this.vertices[l++]=r.Org.coords[1],t>2&&(this.vertices[l++]=r.Org.coords[2]),this.vertexIndices[c++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,s++,r=r.Lnext;while(r!==o);this.elements[d++]=n,this.elements[d++]=s,n+=s}},i.prototype.addContour=function(e,t){this.mesh===null&&(this.mesh=new Vu),e<2&&(e=2),e>3&&(e=3);for(var r=null,o=0;o<t.length;o+=e)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=t[o+0],r.Org.coords[1]=t[o+1],e>2?r.Org.coords[2]=t[o+2]:r.Org.coords[2]=0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},i.prototype.tesselate=function(e,t,r,o,n,s){if(e===void 0&&(e=$e.ODD),t===void 0&&(t=st.POLYGONS),s===void 0&&(s=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,n&&(this.normal[0]=n[0],this.normal[1]=n[1],this.normal[2]=n[2]),this.windingRule=e,o<2&&(o=2),o>3&&(o=3),!this.mesh)return!1;this.projectPolygon_(),gv.computeInterior(this,s);var a=this.mesh;return t===st.BOUNDARY_CONTOURS?this.setWindingNumber_(a,1,!0):this.tessellateInterior_(a),s&&a.check(),t===st.BOUNDARY_CONTOURS?this.outputContours_(a,o):this.outputPolymesh_(a,t,r,o),!0},i}();function wo(i){var e=i.windingRule,t=e===void 0?$e.ODD:e,r=i.elementType,o=r===void 0?st.POLYGONS:r,n=i.polySize,s=n===void 0?3:n,a=i.vertexSize,l=a===void 0?2:a,c=i.normal,d=c===void 0?[0,0,1]:c,u=i.contours,p=u===void 0?[]:u,f=i.strict,m=f===void 0?!0:f,x=i.debug,y=x===void 0?!1:x;if(!p&&m)throw new Error("Contours can't be empty");if(!!p){var N=new xv;i.edgeCreateCallback&&(N.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(N.vertexIdCallback=i.vertexIdCallback);for(var L=0;L<p.length;L++)N.addContour(l||2,p[L]);return N.tesselate(t,o,s,l,d,m),{vertices:N.vertices,vertexIndices:N.vertexIndices,vertexCount:N.vertexCount,elements:N.elements,elementCount:N.elementCount,mesh:y?N.mesh:void 0}}}var Uj=$e.ODD,kj=$e.NONZERO,Hj=$e.POSITIVE,qj=$e.NEGATIVE,Wj=$e.ABS_GEQ_TWO,$j=st.POLYGONS,Jj=st.CONNECTED_POLYGONS,Kj=st.BOUNDARY_CONTOURS;var No=class extends bv{constructor(e,t=12,r=100,o={}){super();this.type="ShapeGeometry";this.windingRule=$e.ODD;this.elementType=st.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._drawCount=0,this._shape=e,this._curveSegments=t,this._maxCount=r,this._maxDrawCount=r*3,this._triangulationOptions=Object.assign({windingRule:$e.ODD,elementType:st.POLYGONS,polySize:3,vertexSize:2,strict:!0},o),this._positionAttribute=new Gs(new Float32Array(r*3),3),this._normalAttribute=new Gs(new Float32Array(r*3),3),this._uvAttribute=new Gs(new Float32Array(r*2),2),this._indexAttribute=new Gs(new Uint32Array(r*3),1),this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.updateFromShape()}copy(e){return this._drawCount=e.drawCount,this._maxDrawCount=e._maxDrawCount,this._maxCount=e.maxCount,super.copy(e)}get curveSegments(){return this._curveSegments}set curveSegments(e){this._curveSegments=e,this.updateFromShape()}get drawCount(){return this._drawCount}get maxDrawCount(){return this._maxDrawCount}get maxCount(){return this._maxCount}updateFromShape(){let e=this._shape.extractShapePointsToFlatArray([],this._curveSegments),t=this._shape.shapeHoles.map(l=>l.extractShapePointsToFlatArray([],this._curveSegments)),r,o=!0,n=!0,s,a;for(let l=0,c=e.length/2;l<c;l++){let d=l*2,u=e[d+0],p=e[d+1];if(s!==void 0&&u!==s&&(o=!1),a!==void 0&&p!==a&&(n=!1),s=u,a=p,!o&&!n)break}if(!o&&!n&&(r=wo({contours:[e,...t],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})),this._positionAttribute.array.fill(0),this._normalAttribute.array.fill(0),this._uvAttribute.array.fill(0),this._indexAttribute.array.fill(0),this._drawCount=0,r){let l=1/0,c=-1/0,d=1/0,u=-1/0;for(let m=0,x=r.vertexCount;m<x;m++){let y=m*2,N=r.vertices[y+0],L=r.vertices[y+1];N<l&&(l=N),N>c&&(c=N),L<d&&(d=L),L>u&&(u=L)}let p=c-l,f=u-d;for(let m=0,x=r.vertexCount;m<x;m++){let y=m*2,N=r.vertices[y+0],L=r.vertices[y+1],w=(N-l)/p,B=(L-d)/f;this._positionAttribute.setXYZ(m,N,L,0),this._normalAttribute.setXYZ(m,0,0,1),this._uvAttribute.setXY(m,w,B)}for(let m=0,x=r.elementCount;m<x;m++){let y=m*3,N=r.elements[y+0],L=r.elements[y+1],w=r.elements[y+2];this._indexAttribute.setX(y+0,N),this._indexAttribute.setX(y+1,L),this._indexAttribute.setX(y+2,w),this._drawCount+=3}}return this._positionAttribute.needsUpdate=!0,this._normalAttribute.needsUpdate=!0,this._uvAttribute.needsUpdate=!0,this._indexAttribute.needsUpdate=!0,this.setDrawRange(0,this._drawCount),this._drawCount>this._maxDrawCount}clone(){let e=new No(this._shape,this._curveSegments,this._maxCount);return e.userData=yo(this.userData),e}};import{BufferAttribute as Fs,BufferGeometry as vv}from"three";var Es=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let r=e*Es.eSize;this.buffer=new ArrayBuffer(r);let o=Float32Array.BYTES_PER_ELEMENT,n=0;this.positions=new Float32Array(this.buffer,n*o,3*e),n+=3*e,this.normals=new Float32Array(this.buffer,n*o,3*e),n+=3*e,this.uvs=new Float32Array(this.buffer,n*o,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${e}`);let r=e*Es.eSize,o=new ArrayBuffer(r),n=Float32Array.BYTES_PER_ELEMENT,s=0,a=new Float32Array(o,s*n,3*e);s+=3*e;let l=new Float32Array(o,s*n,3*e);s+=3*e;let c=new Float32Array(o,s*n,2*e);a.set(this.positions.slice(0,this.size*3)),l.set(this.normals.slice(0,this.size*3)),c.set(this.uvs.slice(0,this.size*2)),this.buffer=o,this.positions=a,this.normals=l,this.uvs=c,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let o=this.capacity;for(;t>o;)o*=2;this.realloc(o)}let r=this.size;return this.size=t,r}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},zs=Es;zs.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var gl=(i,e)=>([t,r])=>(r<t&&(r+=e),(i>=t?i:i+e)<=r),qi=class extends vv{constructor(e,t,r=0,o=12,n=3){super();this.type="ShapeGeometry";this.vertexCache={};this._shape=e,this._depth=t,this._bevel=r,this._curveSegments=o,this._bevelSegmentsInput=n,r<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(r,t/2-1e-12),this._bevelSegments=Math.floor(n));let s=this._shape.extractShapePointsToFlatArray([],o),a=this._shape.shapeHoles.map(_=>{let T=_.extractShapePointsToFlatArray([],o),h=[];for(let I=T.length-1;I>=1;I-=2){let b=T[I-1],P=T[I-0];h.push(b,P)}return h}),l=wo({windingRule:$e.ODD,elementType:st.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[s]}),c=wo({windingRule:$e.ODD,elementType:st.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...a]});if(!l)throw new Error("error generating geometry");let d=l.elementCount;if(c){l.elementCount+=c.elementCount;for(let _=0;_<c.elements.length;_++){let T=c.elements[_],h=_%2==0?l.vertexCount:0;l.elements.push(T+h)}for(let _=0;_<c.vertexIndices.length;_++){let T=c.vertexIndices[_],h=l.vertexCount;l.vertexIndices.push(T+h)}for(let _=0;_<c.vertices.length;_++){let T=c.vertices[_];l.vertices.push(T)}}let u=1/0,p=-1/0,f=1/0,m=-1/0;for(let _=0,T=l.vertexCount;_<T;_++){let h=_*2,I=l.vertices[h+0],b=l.vertices[h+1];I<u&&(u=I),I>p&&(p=I),b<f&&(f=b),b>m&&(m=b)}this._minX=u,this._minY=f,this._width=p-u,this._height=m-f;let x=l.vertexCount*2*(2+this._bevelSegments);this._buffer=new zs(x);let y=[],N=[];for(let _=l.elementCount-1;_>=0;_--){let T=_>=d,h=_*2,I=l.elements[h+0],b=l.elements[h+1],P=I+b,v={start:I,count:b,normals:[],continuous:[],concave:[]},D=I,Z=P-1,V=I+1,ie=this._shape.roundedCurves.length;do{let A=D-I,j=l.vertices[Z*2+0],g=l.vertices[Z*2+1],z=l.vertices[D*2+0],R=l.vertices[D*2+1],U=l.vertices[V*2+0],q=l.vertices[V*2+1],W=z-j,J=R-g,E=Math.sqrt(W*W+J*J);W/=E,J/=E;let H=z-U,k=R-q,se=Math.sqrt(H*H+k*k);H/=se,k/=se,v.normals[A*2+0]=-k,v.normals[A*2+1]=H,v.concave[A]=W*k-J*H>0;let F=l.vertexIndices[D];if(Array.isArray(F))v.continuous[A]=!1;else{let[K,X]=this._shape.getCurveIndexFromVertexId(F-1,!0);if(X>0&&X<1)v.continuous[A]=!0;else{let te=X===1?K+1:K-1;te=(te+ie)%ie;let he=X===1?0:1,Y=this._shape.roundedCurves[K].getTangent(X),ne=this._shape.roundedCurves[te].getTangent(he);v.continuous[A]=Y.dot(ne)>.95}}T&&(v.normals[A*2+0]*=-1,v.normals[A*2+1]*=-1),[Z,D,V]=[D,V,V+1],V>=P&&(V-=b)}while(V!==I+1);let oe=[];oe.push({bevelI:0,angle:0,size:0,boundary:{vertices:l.vertices.slice(I*2,P*2),vertexCount:b,vertexIndices:new Array(b).fill(!0).map((A,j)=>[j,j]),elements:[0,b],elementCount:1,mesh:null},reverseMap:[],insetPoints:l.vertices.slice(I*2,P*2)});for(let A=1;A<=this._bevelSegments;A++){let j=A/this._bevelSegments*Math.PI/2,g=(1-Math.cos(j))*this._bevelSize,z=[],R=[],U=[],q=[],W=0;for(let E=0;E<b;E++){let H=E*2,k=(E-1+b)%b*2,se=l.vertices[v.start*2+H+0],F=l.vertices[v.start*2+H+1],K=-v.normals[k+0]*g,X=-v.normals[k+1]*g,te=-v.normals[H+0]*g,he=-v.normals[H+1]*g;if(v.concave[E]||!v.concave[E]&&T){let Y=Math.atan2(X,K),ne=Math.atan2(he,te);ne>Y&&(ne-=Math.PI*2);let Se=ne-Y;if(v.continuous[E]||T){let me=Y+Se/2,Oe=Math.cos(me)*g,He=Math.sin(me)*g;z[2*W+0]=se+Oe*(T?-1:1),z[2*W+1]=F+He*(T?-1:1),q[W]=E,W++}else{let me=Math.max(1,Math.floor(o/4*Math.abs(Se)/Math.PI));for(let Oe=0;Oe<=me;Oe++){let He=Y+Se*(Oe/me),rt=Math.cos(He)*g,pt=Math.sin(He)*g;z[2*W+0]=se+rt,z[2*W+1]=F+pt,q[W]=E,W++}}}else z[2*W+0]=se+K,z[2*W+1]=F+X,q[W]=E,R[E]=W,W++,z[2*W+0]=se,z[2*W+1]=F,q[W]=E,W++,z[2*W+0]=se+te,z[2*W+1]=F+he,q[W]=E,U[E]=W,W++}let J=wo({windingRule:$e.POSITIVE,elementType:st.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[z],edgeCreateCallback:E=>{let k=E.Org.idx,se=q[k],F=q[(k+1)%q.length];E.idx=[se,F],E.Sym.idx=[F,se]},vertexIdCallback:E=>{let H=E.Lprev.idx;return[H?H[1]:0,E.idx[0]]}});if(!J)throw console.log("Error"),new Error(`error generating bevel geometry for ${A}'th loop`);if(!J.vertexCount)break;for(let E=0;E<J.vertexIndices.length;E++){let[H,k]=J.vertexIndices[E];if(H===k)continue;let se=k;k<H&&(se+=b);for(let F=H;F<se;F++){let K=F%b,X=(F+1)%b;if(!v.continuous[K]||!v.continuous[X]){J.vertexIndices[E]=[H,K],J.vertexIndices.splice(E+1,0,[X,k]),J.vertices.splice((E+1)*2,0,J.vertices[E*2],J.vertices[E*2+1]);break}}}oe.push({bevelI:A,angle:j,size:g,boundary:J,reverseMap:q,insetPoints:z})}let ge=(A,j,g)=>{let z=0,R=A.boundary.vertexIndices.length;for(;z<R&&g(A.boundary.vertexIndices[j]);)j=(j+1)%R,z++;return z},xe=y.length;for(let A=1;A<oe.length;A++){let j=oe[A-1],g=oe[A],z=j.boundary.vertexIndices.length,R=g.boundary.vertexIndices.length;if(!z||!R)break;let U=v.concave.length,q=0,W=gl(q,b);for(;!j.boundary.vertexIndices.filter(W).length||!g.boundary.vertexIndices.filter(W).length;)q++,W=gl(q,b);let J=j.boundary.vertexIndices.findIndex(W),E=g.boundary.vertexIndices.findIndex(W);do J=(J+1)%z;while(W(j.boundary.vertexIndices[J]));do E=(E+1)%R;while(W(g.boundary.vertexIndices[E]));q=(q+1)%b;let H=q,k=this.buildBevelVert(v,j,(J-1+z)%z),se=this.buildBevelVert(v,g,(E-1+R)%R),F=k,K=se,X,te,he=!1;do{W=gl(q,b);let Y=ge(j,J,W),ne=ge(g,E,W),Se=he;if(he=!1,Y&&!ne){for(let me=0;me<Y;me++)X=this.buildBevelVert(v,j,(J+me)%z,me/(Y-1)),y.push(F.topN,X.topP,K.topN),y.push(X.bottomP,F.bottomN,K.bottomN),F=X;he=!0}else if(!Y&&ne)for(let me=0;me<ne;me++)te=this.buildBevelVert(v,g,(E+me)%R,me/(ne-1)),y.push(K.topN,F.topP,te.topP),y.push(F.bottomP,K.bottomN,te.bottomP),K=te;else if(Y&&ne)if(X=this.buildBevelVert(v,j,J,0),te=this.buildBevelVert(v,g,E,0),Se?(y.push(F.topN,te.topP,K.topN),y.push(F.topN,X.topP,te.topP),y.push(te.bottomP,F.bottomN,K.bottomN),y.push(X.bottomP,F.bottomN,te.bottomP)):(y.push(F.topN,X.topP,K.topN),y.push(K.topN,X.topP,te.topP),y.push(X.bottomP,F.bottomN,K.bottomN),y.push(X.bottomP,K.bottomN,te.bottomP)),F=X,K=te,Y===ne)for(let me=1;me<Y;me++)X=this.buildBevelVert(v,j,(J+me)%z,me/(Y-1)),te=this.buildBevelVert(v,g,(E+me)%R,me/(ne-1)),y.push(F.topN,X.topP,K.topN),y.push(K.topN,X.topP,te.topP),y.push(X.bottomP,F.bottomN,K.bottomN),y.push(X.bottomP,K.bottomN,te.bottomP),F=X,K=te;else if(Y>ne){let me=Y/ne,Oe=0;for(let He=1;He<Y;He++)X=this.buildBevelVert(v,j,(J+He)%z,He/(Y-1)),y.push(F.topN,X.topP,K.topN),y.push(X.bottomP,F.bottomN,K.bottomN),F=X,He>(Oe+1)*me&&(Oe++,te=this.buildBevelVert(v,g,(E+Oe)%R,Oe/(ne-1)),y.push(K.topN,X.topP,te.topP),y.push(X.bottomP,K.bottomN,te.bottomP),K=te)}else{let me=ne/Y,Oe=0;for(let He=1;He<ne;He++)te=this.buildBevelVert(v,g,(E+He)%R,He/(ne-1)),y.push(K.topN,X.topP,te.topP),y.push(X.bottomP,K.bottomN,te.bottomP),K=te,He>(Oe+1)*me&&(Oe++,X=this.buildBevelVert(v,j,(J+Oe)%z,Oe/(Y-1)),y.push(F.topN,X.topP,K.topN),y.push(X.bottomP,F.bottomN,K.bottomN),F=X)}J=(J+Y)%z,E=(E+ne)%R,q=(q+1)%U}while(q!==H)}{let A=oe[0];for(let j=0,g=A.boundary.vertexCount;j<g;j++){let z=this.buildBevelVert(v,A,j),R=this.buildBevelVert(v,A,(j+1)%g);y.push(R.topP,z.topN,z.bottomN),y.push(R.topP,z.bottomN,R.bottomP)}}if(T){let A=[];for(let j=y.length-1;j>=xe+2;j-=3){let g=y[j-2],z=y[j-1],R=y[j-0];A.push(R,z,g)}y.splice(xe,y.length-xe,...A)}if(T){let A=[];for(let j=oe[oe.length-1].boundary.vertices.length-1;j>=1;j-=2){let g=oe[oe.length-1].boundary.vertices[j-1],z=oe[oe.length-1].boundary.vertices[j-0];A.push(g,z)}N.push(A)}if(!T){let A=oe[oe.length-1],j=wo({windingRule:oe.length>1?$e.POSITIVE:$e.ODD,elementType:st.POLYGONS,vertexSize:2,strict:!0,contours:[A.insetPoints,...N]});if(!j)throw new Error("Error generating geometry for surface");for(let g=0;g<j.elementCount*3;g+=3){let z=this.buildSurfaceVert(j,j.elements[g+0]),R=this.buildSurfaceVert(j,j.elements[g+1]),U=this.buildSurfaceVert(j,j.elements[g+2]);y.push(z.top,R.top,U.top),y.push(U.bottom,R.bottom,z.bottom)}}this.vertexCache={}}this._buffer.shrink();let L=new Fs(Uint32Array.from(y),1),w=new Fs(this._buffer.positions,3),B=new Fs(this._buffer.normals,3),S=new Fs(this._buffer.uvs,2);w.needsUpdate=!0,B.needsUpdate=!0,S.needsUpdate=!0,L.needsUpdate=!0,this.setAttribute("position",w),this.setAttribute("normal",B),this.setAttribute("uv",S),this.setIndex(L)}buildSurfaceVert(e,t){let r=t.toString();if(r in this.vertexCache)return this.vertexCache[r];let o=e.vertices[t*2+0],n=e.vertices[t*2+1],s=(o-this._minX)/this._width,a=(n-this._minY)/this._height,l=this._buffer.get(2),c=l*3,d=l*2,u={top:l+0,bottom:l+1};return this._buffer.positions[c+0]=o,this._buffer.positions[c+1]=n,this._buffer.positions[c+2]=this._depth,this._buffer.normals[c+0]=0,this._buffer.normals[c+1]=0,this._buffer.normals[c+2]=1,this._buffer.uvs[d+0]=s,this._buffer.uvs[d+1]=a,this._buffer.positions[c+3]=o,this._buffer.positions[c+4]=n,this._buffer.positions[c+5]=0,this._buffer.normals[c+3]=0,this._buffer.normals[c+4]=0,this._buffer.normals[c+5]=-1,this._buffer.uvs[d+2]=s,this._buffer.uvs[d+3]=a,this.vertexCache[r]=u,u}buildBevelVert(e,t,r,o=1){let n=`${t.bevelI}:${r}`;if(n in this.vertexCache)return this.vertexCache[n];let[s,a]=t.boundary.vertexIndices[r],l,c,d,u;s!==a?(c=s,l=a,u=!1,d=e.continuous[c]&&e.continuous[l]):(l=s,c=(l-1+e.count)%e.count,u=e.concave[l]&&t.bevelI>0,d=e.continuous[l]||u);let p=Math.cos(t.angle),f=Math.sin(t.angle),m=r*2,x=l*2,y=c*2,N=t.boundary.vertices[m+0],L=t.boundary.vertices[m+1],w=(1-f)*this._bevelSize,B=(N-this._minX)/this._width,S=(L-this._minY)/this._height,_=e.normals[x+0],T=e.normals[x+1],h=e.normals[y+0],I=e.normals[y+1];if(u){let Z=h-_,V=I-T;_=_+Z*(1-o),T=T+V*(1-o);let ie=Math.sqrt(_*_+T*T);_/=ie,T/=ie}let b=this._buffer.get(d?2:4),P=b*3,v=b*2,D={i:r,fi:l,topP:b+0,topN:b+0,bottomP:b+1,bottomN:b+1};return this._buffer.positions[P+0]=N,this._buffer.positions[P+1]=L,this._buffer.positions[P+2]=this._depth-w,this._buffer.normals[P+0]=_*p,this._buffer.normals[P+1]=T*p,this._buffer.normals[P+2]=f,this._buffer.uvs[v+0]=B,this._buffer.uvs[v+1]=S,this._buffer.positions[P+3]=N,this._buffer.positions[P+4]=L,this._buffer.positions[P+5]=w,this._buffer.normals[P+3]=_*p,this._buffer.normals[P+4]=T*p,this._buffer.normals[P+5]=-f,this._buffer.uvs[v+2]=S,this._buffer.uvs[v+3]=B,d||(b+=2,P+=6,v+=4,D.topP=b+0,D.bottomP=b+1,this._buffer.positions[P+0]=N,this._buffer.positions[P+1]=L,this._buffer.positions[P+2]=this._depth-w,this._buffer.normals[P+0]=h*p,this._buffer.normals[P+1]=I*p,this._buffer.normals[P+2]=f,this._buffer.uvs[v+0]=B,this._buffer.uvs[v+1]=S,this._buffer.positions[P+3]=N,this._buffer.positions[P+4]=L,this._buffer.positions[P+5]=w,this._buffer.normals[P+3]=h*p,this._buffer.normals[P+4]=I*p,this._buffer.normals[P+5]=-f,this._buffer.uvs[v+2]=S,this._buffer.uvs[v+3]=B),this.vertexCache[n]=D,D}clone(){let e=new qi(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=yo(this.userData),e}};var mt=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var c,d,u,p,f,m,x;let t=Object.assign({},(c=e==null?void 0:e.parameters)!=null?c:{width:100,subdivisions:40,roundness:0,extrudeDepth:0,surfaceMaxCount:100,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),r=Math.abs(t.width),o=Math.abs((d=t.height)!=null?d:t.width),n=Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(u=t.depth)!=null?u:0),s=(p=i.shape)!=null?p:e==null?void 0:e.shape,a=(f=s==null?void 0:s.roundness)!=null?f:t.roundness;s!==void 0&&(s instanceof Pe?(s.width!==r||s.height!==o)&&s.applySize(r,o):s=new Pe(r,o).fromJSON(s),((m=i.parameters)==null?void 0:m.roundness)!==void 0&&((x=i.parameters)==null?void 0:x.roundness)>0&&s.update(!1));let l=s!=null?s:new Pe(r,o);return{parameters:Object.assign(t,{width:r,height:o,depth:n,extrudeDepth:n,roundness:a}),shape:l}}static build(i){let{extrudeDepth:e,extrudeBevelSize:t,extrudeBevelSegments:r,subdivisions:o,roundness:n,surfaceMaxCount:s}=i.parameters;i.shape.roundness=n;let a;return e<=0?a=new No(i.shape,o,s):a=new qi(i.shape,e,t,o,r),Object.assign(a,{userData:$(O({},i),{type:"VectorGeometry"})})}};import{MathUtils as qu,Vector2 as Wu}from"three";var $u=Math.PI*2,Ju=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,n,s;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1e3},i.parameters);return{shape:i.shape&&i.shape instanceof Pe?i.shape:new Pe,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(s=t.depth)!=null?s:0)})}}static build(i){let{width:e,height:t,spikes:r,angle:o,innerRadius:n,depth:s,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=i.parameters,d=i.shape,u=e*.5,p=t*.5,f=Sv(d,u,p,o*Math.PI/180,r,n);d.isClosed=!0,d.update();let m=mt.create({shape:d,parameters:{subdivisions:f,surfaceMaxCount:c,depth:s,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(m,{userData:$(O({},i),{type:"EllipseGeometry"})})}};function Sv(i,e,t,r,o,n){if(r>=$u)return o>30||o%4==0?(Nv(i,e,t,n),Math.round(o/4)):Ku(i,r,o,e,t,n);let s={x:0,y:t},a=r+Math.PI*.5,l={x:Math.cos(a)*e,y:Math.sin(a)*t},c=Ru({px:s.x,py:s.y,cx:l.x,cy:l.y,rx:e,ry:t,largeArcFlag:r>Math.PI,sweepFlag:!0});return o>30||o%c.length==0?wv(i,s.x,s.y,c,o,e,t,n):Ku(i,r,o,e,t,n)}function wv(i,e,t,r,o,n,s,a){let l=Math.round(o/r.length);i.addPoint(ci(e,t));for(let c=0,d=r.length;c<d;c++){let u=r[c],p=i.points[c],f=ci(u.x,u.y);p.controls[1].position.set(u.x1,u.y1),f.controls[0].position.set(u.x2,u.y2),i.addPoint(f)}return a>0?Xu(i,n,s,a):i.addPoint(ci(0,0)),l}function Ku(i,e,t,r,o,n){let s=-e/t;for(let a=0;a<=t;a++){let l=s*a,c=Math.sin(l)*r,d=Math.cos(l)*o;i.addPoint(ci(c,d))}return e<$u?n>0?Xu(i,r,o,n):i.addPoint(ci(0,0)):(i.removePoint(i.points[i.points.length-1]),n>0&&Zu(i,r,o,n)),1}function Nv(i,e,t,r=0,o=0,n=0){let s=.5522847498,a=e*s,l=t*s;i.addPoint(Rs(o-e,n,o-e,n-l,o-e,n+l)),i.addPoint(Rs(o,n+t,o-a,n+t,o+a,n+t)),i.addPoint(Rs(o+e,n,o+e,n+l,o+e,n-l)),i.addPoint(Rs(o,n-t,o+a,n-t,o-a,n-t)),r>0&&Zu(i,e,t,r)}function ci(i,e){return new br(qu.generateUUID(),new Wu(i,e))}function Rs(i,e,t,r,o,n){let s=ci(i,e);return s.controls[0].position.set(t,r),s.controls[1].position.set(o,n),s}function Xu(i,e,t,r){Qu(i,e,t,r).forEach(n=>i.addPoint(n))}function Zu(i,e,t,r){let o=Qu(i,e,t,r),n=new Pe;o.forEach(s=>n.addPoint(s)),n.isClosed=!0,i.shapeHoles.push(n)}function Qu(i,e,t,r){let o=r*e/100,n=o*(Math.abs(t)/Math.abs(e)),s=new Wu(o/e,n/t),a=i.points.map(l=>{let c=l.clone();return c.uuid=qu.generateUUID(),c}).reverse();return a.forEach(l=>{l.position.multiply(s);let c=l.controls[0].position.clone().multiply(s),d=l.controls[1].position.clone().multiply(s);l.controls[0].position.copy(d),l.controls[1].position.copy(c)}),a}import{BufferGeometry as Cv,Float32BufferAttribute as xl,Vector3 as Yu}from"three";var eh=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var a,l,c;let t=Object.assign({},(a=e==null?void 0:e.parameters)!=null?a:{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),r=Math.abs(t.width),o=Math.abs((l=t.height)!=null?l:r),n=Math.abs((c=t.depth)!=null?c:r),s=Math.abs(Math.min(r,n))/2;return{parameters:Object.assign(t,{width:r,height:o,depth:n,radius:s,segments:Math.round(t.segments),pathSegments:Math.round(t.pathSegments),cornerSegments:Math.round(t.cornerSegments)})}}static build(i){let{width:e,height:t,depth:r,radius:o,revolutions:n,segments:s,pathRadius:a,pathType:l,pathSegments:c,cornerRadius:d,cornerSegments:u}=i.parameters,p=new Vs(!1,e,t,r,o,n,s,a,l,c,d,u);return Object.assign(p,{userData:$(O({},i),{type:"HelixGeometry"})})}},Vs=class extends Cv{constructor(e=!0,t=1,r=1,o=1,n=1,s=1,a=1,l=1,c=1,d=1,u=1,p=1){super();let f=e&&s===1;f&&(p=0),u>100&&(u=100);let m=()=>new Yu,x=new Yu,y=m(),N=m(),L=m(),w,B,S,_,T,h,I,b,P=m(),v=m(),D=m(),Z=m(),V=m(),ie=m(),oe=m(),ge=m(),xe=r-2*l+.001,A=xe/s,j=Math.ceil(a*s),g=j+1,z=xe/j,R=-xe/2,U=d+1,q=2*Math.PI/d,W=Math.PI/2/p,J=.01,E=Math.min((1-u/100)*l,l-J),H=l-E,k=0,se=2,F=p*se+se,K=U*F/se,X=K+U*g,te=U*(g+F),[he,Y,ne]=[3,3,2].map(qe=>Array(te*qe).fill(0)),Se=[],me=n-l;function Oe(qe,bt){let Et=Math.PI/2;h=bt*z,b=2*Math.PI*(h%A)/A+Et,h+=R,I=Math.sin(b)*me,T=Math.cos(b)*me,e?qe.set(T,I,h):qe.set(T,h,I)}Oe(x,-1e-10),Oe(y,0),P.copy(x),Oe(x,1);let He=x.distanceTo(y),rt=H+E,pt=He*j+2*rt,zt=E,Tr=pt-rt;for(let qe=0;qe<=j;qe++){Oe(N,qe),ge.subVectors(N,P).normalize(),P.copy(N),ie.copy(N).setComponent(+e+1,0).normalize(),oe.crossVectors(ge,ie).normalize();let bt=qe===0,Et=qe===j,bn=bt?3*Math.PI/2:W,vn=bt?zt:Tr,Sn=bt?U:X,wn=bt?0:te-U,Nn=ge.clone().multiplyScalar(bt?-H:H).add(N),Cn=ge.clone().multiplyScalar(bt?-1:1).normalize();for(let $t=0;$t<U;$t++){let Li=$t*q;if(v.addVectors(x.copy(ie).multiplyScalar(l*Math.cos(Li)),y.copy(oe).multiplyScalar(l*Math.sin(Li))),D.copy(v).normalize(),bt||Et){f||(k=wn+$t,[0,1,2].forEach(ut=>{he[k*3+ut]=Nn.getComponent(ut),Y[k*3+ut]=Cn.getComponent(ut)}),ne[k*2]=+Et,ne[k*2+1]=$t/d),y.copy(D).multiplyScalar(E),L.addVectors(N,y);for(let ut=0;ut<p;ut++){let jo=ut*W+bn;Z.addVectors(x.copy(ge).multiplyScalar(H*Math.sin(jo)),y.copy(D).multiplyScalar(H*Math.cos(jo))),V.copy(Z).normalize(),y.addVectors(L,Z),Z.normalize(),k=Sn+ut*U+$t,[0,1,2].forEach(ye=>{he[k*3+ye]=y.getComponent(ye),Y[k*3+ye]=V.getComponent(ye)});let Ln=+bt+Math.sin(jo);ne[k*2]=(vn+H*Ln)/pt,ne[k*2+1]=$t/d}}y.addVectors(N,v),k=K+qe*U+$t,[0,1,2].forEach(ut=>{he[k*3+ut]=y.getComponent(ut),Y[k*3+ut]=D.getComponent(ut)}),ne[k*2]=(rt+qe*He)/pt,ne[k*2+1]=$t/d}}let xt=g+2*p+se,Ir=1,[uo,ho]=f?[Ir,Ir+g-1]:[0,xt-1];for(let qe=uo;qe<=ho-1;qe++){let bt=f&&qe===ho-1;for(let Et=0;Et<U-1;Et++)w=qe*U+Et,B=w+1,S=(bt?Et:w)+U,_=(bt?Et+1:B)+U,qe===0?Se.push(B,_,S):qe===xt-2?Se.push(w,B,S):Se.push(w,B,S,B,_,S)}this.setIndex(Se),this.setAttribute("position",new xl(he,3)),this.setAttribute("normal",new xl(Y,3)),this.setAttribute("uv",new xl(ne,2))}};import{IcosahedronBufferGeometry as Lv}from"three";var th=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,o,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((n=t.depth)!=null?n:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:o,corner:n,cornerSides:s}=i.parameters,a=o===0&&n!==0?new Us(e*.5,n,s):new Lv(e*.5,o);return a.scale(1,t/e,r/e),Object.assign(a,{userData:$(O({},i),{type:"IcosahedronGeometry"})})}},Us=class extends So{constructor(e=1,t=.2,r=4){let o=(1+Math.sqrt(5))/2,n=[-1,o,0,1,o,0,-1,-o,0,1,-o,0,0,-1,o,0,1,o,0,-1,-o,0,1,-o,o,0,-1,o,0,1,-o,0,-1,-o,0,1],s=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],a="IcosahedronGeometry";super(n,s,a,e,t,r);this.type=a}static fromJSON(e){return new Us(e.radius,e.corner,e.cornerSides)}};import{LatheBufferGeometry as Tv,Shape as Iv}from"three";var rh=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,o,n,s,a;((o=(r=i.parameters)==null?void 0:r.points)!=null?o:[]).forEach(l=>{Array.isArray(l)&&(l.x=l[0],l.y=l[1])});let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs((a=t.depth)!=null?a:t.width)})}}static build(i){let{points:e,segments:t,verticalSegments:r}=i.parameters,o=new Iv;o.moveTo(e[0].x,e[0].y),o.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let n=new Tv(o.extractPoints(r).shape,t);return n.rotateZ(Math.PI),Object.assign(n,{userData:$(O({},i),{type:"LatheGeometry"})})}};import{BufferGeometry as ih,BufferGeometryLoader as Dv,Vector3 as Bv,BoxBufferGeometry as nh}from"three";import{BufferGeometry as Mv,Vector2 as bl,Vector3 as oh}from"three";import{Geometry as Pv,Face3 as Ov}from"three/examples/jsm/deprecated/Geometry.js";var Av=["a","b","c"];function jv(i,e){switch(e){case"c":return i.c;case"b":return i.b;case"a":default:return i.a}}function vl(i,e,t){let r=Math.min(i,e),o=Math.max(i,e),n=r+"_"+o;return t.get(n)}function Sl(i,e,t,r,o,n){let s=Math.min(i,e),a=Math.max(i,e),l=s+"_"+a,c;if(r.has(l))c=r.get(l);else{let d=t[s],u=t[a];c={a:d,b:u,newEdge:null,faces:[]},r.set(l,c)}c.faces.push(o),n[i].edges.push(c),n[e].edges.push(c)}function _v(i,e,t,r){let o,n,s;for(o=0,n=i.length;o<n;o++)t[o]={edges:[]};for(o=0,n=e.length;o<n;o++)s=e[o],Sl(s.a,s.b,i,r,s,t),Sl(s.b,s.c,i,r,s,t),Sl(s.c,s.a,i,r,s,t)}function ks(i,e,t,r,o){i.push(new Ov(e,t,r,void 0,void 0,o))}function di(i,e){return Math.abs(e-i)/2+Math.min(i,e)}function Hs(i,e,t,r){i.push([e.clone(),t.clone(),r.clone()])}var wl=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof Mv?e=new Pv().fromBufferGeometry(e):e=e.clone(),e.mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t=new oh,r,o,n,s,a,l=e.vertices,c=e.faces,d=e.faceVertexUvs[0],u=d!==void 0&&d.length>0,p=[],f=new Map;_v(l,c,p,f);let m=[],x,y,N,L,w,B,S;for(let J of Array.from(f.keys())){for(y=f.get(J),N=new oh,w=3/8,B=1/8,S=y.faces.length,S!=2&&(w=.5,B=0,S!=1),N.addVectors(y.a,y.b).multiplyScalar(w),t.set(0,0,0),s=0;s<S;s++){for(L=y.faces[s],a=0;a<3&&(x=l[jv(L,Av[a])],!(x!==y.a&&x!==y.b));a++);x&&t.add(x)}t.multiplyScalar(B),N.add(t),y.newEdge=m.length,m.push(N)}let _,T,h,I,b,P,v,D=[];for(o=0,n=l.length;o<n;o++){for(P=l[o],b=p[o].edges,r=b.length,r==3?_=3/16:r>3&&(_=3/(8*r)),T=1-r*Number(_),h=_,r<=2&&(r==2?(T=3/4,h=1/8):r==1||r==0),v=P.clone().multiplyScalar(T),t.set(0,0,0),s=0;s<r;s++)I=b[s],x=I.a!==P?I.a:I.b,t.add(x);t.multiplyScalar(Number(h)),v.add(t),D.push(v)}let Z=D.concat(m),V=D.length,ie,oe,ge,xe=[],A=[],j,g,z,R,U=new bl,q=new bl,W=new bl;for(o=0,n=c.length;o<n;o++)L=c[o],ie=Number(vl(L.a,L.b,f).newEdge)+V,oe=Number(vl(L.b,L.c,f).newEdge)+V,ge=Number(vl(L.c,L.a,f).newEdge)+V,ks(xe,ie,oe,ge,L.materialIndex),ks(xe,L.a,ie,ge,L.materialIndex),ks(xe,L.b,oe,ie,L.materialIndex),ks(xe,L.c,ge,oe,L.materialIndex),u&&(j=d[o],g=j[0],z=j[1],R=j[2],U.set(di(g.x,z.x),di(g.y,z.y)),q.set(di(z.x,R.x),di(z.y,R.y)),W.set(di(g.x,R.x),di(g.y,R.y)),Hs(A,U,q,W),Hs(A,g,U,W),Hs(A,z,q,U),Hs(A,R,W,q));e.vertices=Z,e.faces=xe,u&&(e.faceVertexUvs[0]=A)}};var at=new Bv,qs=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s;let t=(s=(n=i.geometry)!=null?n:e==null?void 0:e.geometry)!=null?s:new ih().copy(new nh(100,100,100)),r;e===void 0?(t.computeBoundingBox(),t.boundingBox.getSize(at),r={width:at.x,height:at.y,depth:at.z,subdivisions:0}):r=e.parameters;let o=O(O({},r),i.parameters);return{parameters:{width:Math.abs(o.width),height:Math.abs(o.height),depth:Math.abs(o.depth),subdivisions:Math.abs(o.subdivisions)},geometry:t}}static build(i){var l;let{width:e,height:t,depth:r,subdivisions:o}=i.parameters,n=(l=i.geometry)!=null?l:new ih().copy(new nh(100,100,100)),s=n.userData.parameters;s===void 0?(n.computeBoundingBox(),n.boundingBox.getSize(at)):at.set(s.width,s.height,s.depth),(e!==at.x||t!==at.y||r!==at.z)&&n.scale(at.x===0?1:e/at.x,at.y===0?1:t/at.y,at.z===0?1:r/at.z);let a=n.originalGeometry;return o>0?(a===void 0||(s==null?void 0:s.subdivisions)!==o)&&(a===void 0&&(a=n),n=new wl(o).modify(a).toBufferGeometry()):(a!==void 0&&(n=a),a=void 0,n.getAttribute("normal")===void 0&&n.computeVertexNormals()),a!==void 0&&Object.assign(n,{originalGeometry:a}),delete i.geometry,Object.assign(n,{userData:$(O({},i),{type:"NonParametricGeometry"})})}static loadFromUrl(i,e,t){new Dv(t).load(i,o=>{let n=this.normalizeInputs({geometry:o});o.boundingBox.getSize(at);let s=100/at.x;Object.assign(n.parameters,{width:100,height:at.y*s,depth:at.z*s}),e(this.build(n))})}};var sh=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,n,s,a;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof Pe?i.shape:new Pe,parameters:Object.assign(t,{surfaceMaxCount:((n=t.surfaceMaxCount)!=null?n:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(i){let{width:e,height:t,spikes:r,cornerRadius:o,depth:n,extrudeBevelSize:s,extrudeBevelSegments:a,surfaceMaxCount:l}=i.parameters,c=i.shape,d=e*.5,u=t*.5,p=0,f=0,m=2*Math.PI/r;for(let y=0;y<r;y++){let N=m*y,L=p+Math.sin(N)*d,w=f+Math.cos(N)*u;c.addPoint(c.createPoint(L,w))}c.isClosed=!0;for(let y=0,N=c.points.length;y<N;y++)c.points[y].roundness=o;c.roundness=o,c.update();let x=mt.create({shape:c,parameters:{surfaceMaxCount:l,roundness:o,depth:n,extrudeBevelSize:s,extrudeBevelSegments:a}});return Object.assign(x,{userData:$(O({},i),{type:"PolygonGeometry"})})}};import{BufferGeometry as Gv,Float32BufferAttribute as Nl,Vector2 as vr,Vector3 as dt}from"three";var ah=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,o,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((n=t.depth)!=null?n:t.width)})}}static build(i){let{width:e,height:t,depth:r,radialSegments:o,heightSegments:n,openEnded:s,cornerRadius:a,cornerSegments:l}=i.parameters,c=new lh(e*.5,t,o,n,s,a,l);return c.scale(1,1,r/e),Object.assign(c,{userData:$(O({},i),{type:"PyramidGeometry"})})}};function Wi(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function Cl(i,e,t,r,o,n){let s=e.clone().sub(i),a=t.clone().sub(i),l=s.angleTo(a);if(s.normalize(),a.normalize(),r===o){let c=s.add(a).normalize();n.copy(i).addScaledVector(c,r/Math.sin(l/2))}else{let c=s.angleTo(a);n.copy(i),n.addScaledVector(s,o/Math.sin(c)),n.addScaledVector(a,r/Math.sin(c))}}function zv(i,e,t){let r=i.clone().sub(e),o=t.clone().sub(e);return r.projectOnVector(o),r.add(e)}var lh=class extends Gv{constructor(e=.5,t=1,r=4,o=1,n=!1,s=0,a=4){super();r=Math.floor(Math.max(3,r)),o=Math.floor(o),a=Math.floor(a);let l=[],c=[],d=[],u=[],p=0,f=t/2,m=Math.PI/r,x=e*Math.cos(Math.PI/r),y=2*Math.PI/r,N=(r-2)*Math.PI/r,L=Math.PI-N,w=new dt(0,-f,0),B=new dt(0,f,0),S=new vr(e,-f),_=new vr(x,-f),T=new vr(0,B.y).sub(_),h=new vr(0,B.y).sub(S),I=new vr(T.y,-T.x).normalize(),b=new vr(h.y,-h.x).normalize(),v=e*Math.cos(Math.PI/r)*Math.tan((Math.PI-T.angle())/2)-1e-8;s=Math.min(s,v);let D;{let A=new dt(I.x,I.y,0),j=new dt(Math.cos(y)*A.x,A.y,Math.sin(y)*A.x);D=A.angleTo(j)}let Z=s/Math.tan((Math.PI-T.angle())/2),V=s/Math.tan((Math.PI-D)/2),ie=new dt;if(!n){c.push(w.x,w.y,w.z),d.push(0,-1,0),u.push(0,0);let A=p++,j=[],g=S.clone(),z=Z/Math.cos(Math.PI/r);g.x-=z;for(let R=0;R<r;R++){let U=R/r*Math.PI*2+m,q=new vr(Math.sin(U),Math.cos(U));Wi(g,q,ie),c.push(ie.x,ie.y,ie.z),d.push(0,-1,0),u.push(0,0),j.push(p++)}for(let R=0;R<j.length;R++)l.push(j[R],A,j[(R+1)%j.length])}let oe=[];{let A=new dt,j=new dt,g=new dt,z=new dt,R=new dt,U=new dt;for(let q=0;q<r;q++){let W=q/r*Math.PI*2+m,J=(q+.5)/r*Math.PI*2+m,E=(q+1)/r*Math.PI*2+m,H=new vr(Math.sin(W),Math.cos(W)),k=new vr(Math.sin(J),Math.cos(J)),se=new vr(Math.sin(E),Math.cos(E));Wi(S,H,j),Wi(S,se,g),Wi(I,k,A),Cl(B,j,g,V,V,z),c.push(z.x,z.y,z.z),Cl(j,B,g,V,Z,R),c.push(R.x,R.y,R.z),Cl(g,j,B,Z,V,U),c.push(U.x,U.y,U.z),d.push(A.x,A.y,A.z),d.push(A.x,A.y,A.z),d.push(A.x,A.y,A.z),u.push(0,0),u.push(0,0),u.push(0,0);let F=p++,K=p++,X=p++;if(l.push(F,K,X),s>0){{let Y=j.clone().add(g).multiplyScalar(.5),ne=B.clone().sub(Y).normalize(),me=w.clone().sub(Y).normalize().add(ne).normalize().multiplyScalar(-1),Oe=U.clone().sub(R);ge(Y,Oe,me,T.angle())}let te,he;{let Y=new dt;Wi(b,se,Y);let ne=U.clone().add(z).multiplyScalar(.5);ne=zv(ne,g,B);let Se=U.clone().sub(z);[te,he]=ge(ne,Se,Y,D,z.y)}{let Y=te,ne=Y.clone().setY(0).normalize(),Se=new dt(0,-1,0),me=ne.clone().cross(Se);xe(Y,ne,Se,me)}oe.concat(he);{let Y=T.angle(),ne=Math.PI-Y,Se=B.clone();Se.y-=s/Math.sin(Y-Math.PI/2);let me=new dt,Oe=[];for(let rt=0;rt<a;rt++){let pt=[],zt=Math.PI/2-ne*rt/a,Tr=Math.cos(zt),xt=Math.sin(zt),Ir=J;for(let uo=0;uo<=rt;uo++){let ho=Math.cos(Ir),qe=Math.sin(Ir);A.x=Tr*qe,A.y=xt,A.z=Tr*ho,me.copy(Se).addScaledVector(A,s),c.push(me.x,me.y,me.z),d.push(A.x,A.y,A.z),u.push(0,0),pt.push(p++),Ir+=Math.PI*2/rt/r}Oe.push(pt)}he.reverse(),Oe.push(he);let He=Oe.length-1;for(let rt=0;rt<He;rt++){let pt=Oe[rt],zt=Oe[rt+1],Tr=pt.length-1;l.push(zt[1],pt[0],zt[0]);for(let xt=1;xt<=Tr;xt++)l.push(pt[xt],pt[xt-1],zt[xt]),l.push(zt[xt+1],pt[xt],zt[xt])}}}}}this.setIndex(l),this.setAttribute("position",new Nl(c,3)),this.setAttribute("normal",new Nl(d,3)),this.setAttribute("uv",new Nl(u,2));function ge(A,j,g,z,R){let U=-z/2,q=(Math.PI-z)/2,W=j.clone().normalize().cross(g);A.addScaledVector(g,-s/Math.sin(q));let J=new dt,E=new dt,H=1,k=p,se=[];for(let F=0;F<=a;F++){let K=U+F/a*z;E.set(0,0,0),E.addScaledVector(W,Math.sin(K)),E.addScaledVector(g,Math.cos(K));for(let X=0;X<=H;X++){let te=X/H-.5;if(J.copy(A),J.addScaledVector(j,te),J.addScaledVector(E,s),R!=null){let he=Math.max(0,J.y-R);J.addScaledVector(j,-he/j.y)}c.push(J.x,J.y,J.z),d.push(E.x,E.y,E.z),u.push(0,0),X===0&&se.push(p),p++}}for(let F=0;F<a;F++)for(let K=0;K<H;K++){let X=k+K+(H+1)*F,te=X+(H+1),he=te+1,Y=X+1;l.push(X,te,Y),l.push(te,he,Y)}return[A.clone().addScaledVector(j,.5),se]}function xe(A,j,g,z){let R=Math.PI/2,U=h.angle()-R,q=[],W=new dt,J=new dt;for(let H=0;H<=a;H++){let k=[],se=H/a;for(let F=0;F<=H;F++){let X=((H?F/H:0)-.5)*L,te=Math.cos(X),he=Math.sin(X),Y=Math.atan(Math.tan(U)*te),ne=(R+Y)*se,Se=Math.cos(ne),me=Math.sin(ne);W.set(0,0,0),W.addScaledVector(j,me*te),W.addScaledVector(g,Se),W.addScaledVector(z,me*he),J.copy(A).addScaledVector(W,s),c.push(J.x,J.y,J.z),d.push(W.x,W.y,W.z),u.push(0,0),k.push(p++)}q.push(k)}let E=q.length-1;for(let H=0;H<E;H++){let k=q[H],se=q[H+1],F=k.length-1;l.push(k[0],se[1],se[0]);for(let K=1;K<=F;K++)l.push(k[K-1],k[K],se[K]),l.push(k[K],se[K+1],se[K])}}}};var Ws=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,a,l,c,d;let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters),r=Object.assign((a=e==null?void 0:e.ui)!=null?a:{enabledIndieCorners:!1},i.ui),o=t.cornerRadius.reduce((u,p)=>u+p,0);return{shape:i.shape&&i.shape instanceof Pe?i.shape:new Pe,parameters:Object.assign(t,{surfaceMaxCount:((l=t.surfaceMaxCount)!=null?l:o>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((c=t.height)!=null?c:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(d=t.depth)!=null?d:0)}),ui:r}}static build(i){let e=i.shape,{width:t,height:r,cornerRadius:o,cornerType:n,depth:s,extrudeBevelSize:a,extrudeBevelSegments:l,surfaceMaxCount:c}=i.parameters,d={x:t*.5,y:r*.5},u={x:-d.x,y:-d.y},p={x:d.x,y:d.y};function f(S,_,T){return _>t&&T>r?Math.min(S*t/_,S*r/T):_>t?S*t/_:T>r?S*r/T:S}let m=[];m[0]=o[0]===0?0:f(o[0],o[0]+o[3],o[0]+o[1]),m[1]=o[1]===0?0:f(o[1],o[1]+o[2],o[1]+o[0]),m[2]=o[2]===0?0:f(o[2],o[2]+o[1],o[2]+o[3]),m[3]=o[3]===0?0:f(o[3],o[3]+o[0],o[3]+o[2]);let x=u.x,y=p.x,N=p.y,L=u.y;e.addPoint(e.createPoint(x,N)),e.addPoint(e.createPoint(y,N)),e.addPoint(e.createPoint(y,L)),e.addPoint(e.createPoint(x,L)),e.isClosed=!0;let w=!0;for(let S=0,_=e.points.length;S<_;S++)e.points[S].roundness=m[S],S>0&&m[S]!==m[S-1]&&(w=!1);w&&(e.roundness=m[0]),e.useCubicForRoundedCorners=n!==1,e.update();let B=mt.create({shape:e,parameters:{surfaceMaxCount:c,depth:s,extrudeBevelSize:a,extrudeBevelSegments:l}});return Object.assign(B,{userData:$(O({},i),{type:"RectangleGeometry"})})}};import{SphereBufferGeometry as Ev}from"three";var ch=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,o,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:Math.PI},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((n=t.depth)!=null?n:t.width)})}}static build(i){let{width:e=100,height:t=e,depth:r=e,widthSegments:o=64,heightSegments:n=64,phiStart:s,phiLength:a,thetaStart:l,thetaLength:c}=i.parameters,d=new Ev(.5*e,o,n,s,a,l,c);return d.scale(1,t/e,r/e),Object.assign(d,{userData:$(O({},i),{type:"SphereGeometry"})})}};import{PlaneBufferGeometry as Fv}from"three";var dh=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,o;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0,widthSegments:8,heightSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:0})}}static build(i){let{width:e=100,height:t=e,widthSegments:r=8,heightSegments:o=8}=i.parameters,n=new Fv(e,t,r,o);return n.scale(1,1,1),Object.assign(n,{userData:$(O({},i),{type:"PlaneGeometry"})})}};var ph=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,n,s,a;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof Pe?i.shape:new Pe,parameters:Object.assign(t,{surfaceMaxCount:((n=t.surfaceMaxCount)!=null?n:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(i){let{width:e,height:t,innerRadiusPercent:r,spikes:o,cornerRadius:n,angle:s,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c,surfaceMaxCount:d}=i.parameters,u=i.shape,p=e*.5,f=t*.5,m=0,x=0,y=s*Math.PI/360/o,N=Math.PI/2*3*-1,L=p*r/100,w=f*r/100;if(o==3&&r==50){y=2*Math.PI/o;for(let S=0;S<o;S++){let _=y*S,T=m+Math.sin(_)*p,h=x+Math.cos(_)*f;u.addPoint(u.createPoint(T,h))}}else for(let S=0;S<o;S++){let _=m+Math.cos(N)*p,T=x+Math.sin(N)*f;u.addPoint(u.createPoint(_,T)),N+=y,_=m+Math.cos(N)*L,T=x+Math.sin(N)*w,S<=o,u.addPoint(u.createPoint(_,T)),N+=y}u.isClosed=!0;for(let S=0,_=u.points.length;S<_;S++)u.points[S].roundness=n;u.roundness=n,u.update();let B=mt.create({shape:u,parameters:{surfaceMaxCount:d,roundness:n,depth:a,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(B,{userData:$(O({},i),{type:"StarGeometry"})})}};import{PlaneBufferGeometry as Rv}from"three";var $s=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,o,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((n=t.depth)!=null?n:0)})}}static build(i){let{width:e,height:t}=i.parameters,r=new Rv(e,t);return Object.assign(r,{userData:$(O({},i),{type:"TextFrameGeometry"})})}};var uh=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,a,l;let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,radialSegments:32,tubularSegments:64,arc:Math.PI*2,cornerRadius:30,cornerSegments:8},i.parameters),r=Math.abs(t.width),o=Math.abs((a=t.height)!=null?a:t.width),n=Math.abs((l=t.depth)!=null?l:t.width*.25);return{parameters:Object.assign(t,{width:r,height:o,depth:n})}}static build(i){let{width:e,height:t,depth:r,radialSegments:o,tubularSegments:n,arc:s,cornerRadius:a,cornerSegments:l}=i.parameters,c=Vv(e,t,r,e*.5,s,n,0,0,o,a,l);return c.scale(1,t/e,1),Object.assign(c,{userData:$(O({},i),{type:"TorusGeometry"})})}};function Vv(i,e,t,r,o,n,s,a,l,c,d){return[e,t]=[t,e],s=e/2,o/=2*Math.PI,o==1&&(c=0),new Vs(!0,i,e,t,r,o,n,s,a,l,c,d)}import{TorusKnotBufferGeometry as Uv}from"three";var hh=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,o,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((o=t.height)!=null?o:t.width),depth:Math.abs((n=t.depth)!=null?n:t.width),tube:(s=t.tube)!=null?s:t.width*.125})}}static build(i){let{width:e,tube:t,tubularSegments:r,radialSegments:o,p:n,q:s}=i.parameters,a=e*.5;a!==t&&(a-=t);let l=new Uv(a,t,r,o,n,s);return Object.assign(l,{userData:$(O({},i),{type:"TorusKnotGeometry"})})}};var mh=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var o,n,s,a;let t=Object.assign({},(o=e==null?void 0:e.parameters)!=null?o:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof Pe?i.shape:new Pe,parameters:Object.assign(t,{surfaceMaxCount:((n=t.surfaceMaxCount)!=null?n:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width*(t.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(a=t.depth)!=null?a:0)})}}static build(i){let{width:e=100,height:t,cornerRadius:r,depth:o,extrudeBevelSize:n,extrudeBevelSegments:s,isRect:a,surfaceMaxCount:l}=i.parameters,c=i.shape,d=e*.5,u=t*.5;a?(c.addPoint(c.createPoint(-d,u)),c.addPoint(c.createPoint(d,-u)),c.addPoint(c.createPoint(-d,-u))):(c.addPoint(c.createPoint(0,u)),c.addPoint(c.createPoint(d,-u)),c.addPoint(c.createPoint(-d,-u))),c.isClosed=!0;for(let f=0,m=c.points.length;f<m;f++)c.points[f].roundness=r;c.roundness=r,c.update();let p=mt.create({shape:c,parameters:{surfaceMaxCount:l,roundness:r,depth:o,extrudeBevelSize:n,extrudeBevelSegments:s}});return Object.assign(p,{userData:$(O({},i),{type:"TriangleGeometry"})})}};var $i={};Hm($i,{addBarycentricAttribute:()=>$v,fixUvs:()=>Kv,loadFromUrl:()=>Jv,resizeGeometry:()=>Wv,roundShapePolygon:()=>qv});import{BufferGeometryLoader as kv,Float32BufferAttribute as Hv,Vector3 as Ll}from"three";var fh=function(i,e){let t=e.x-i.x,r=e.y-i.y,o=Math.sqrt(t*t+r*r),n=t/o,s=r/o,a=Math.atan2(s,n);return{x:t,y:r,len:o,nx:n,ny:s,ang:a}},qv=(i,e,t)=>{let r,o,n,s,a,l,c,d,u,p,f,m,x,y,N=e.length;for(s=e[N-2],i.curves=[],r=1;r<N-1;r++){a=e[r%N],l=e[(r+1)%N];let L=fh(a,s),w=fh(a,l);c=L.nx*w.ny-L.ny*w.nx,d=L.nx*w.nx-L.ny*-w.ny,f=Math.asin(c),u=1,p=!1,d<0?f<0?f=Math.PI+f:(f=Math.PI-f,u=-1,p=!0):f>0&&(u=-1,p=!0),m=f/2,y=Math.abs(Math.cos(m)*t/Math.sin(m)),y>Math.min(L.len/2,w.len/2)?(y=Math.min(L.len/2,w.len/2),x=Math.abs(y*Math.sin(m)/Math.cos(m))):x=t,o=a.x+w.nx*y,n=a.y+w.ny*y,o+=-w.ny*x*u,n+=w.nx*x*u,i.absarc(o,n,x,L.ang+Math.PI/2*u,w.ang-Math.PI/2*u,p),s=a,a=l}i.closePath()},Wv=(i,{width:e,height:t,depth:r})=>{e=Math.abs(e),t=Math.abs(t),r=Math.abs(r);let o=i.userData.parameters,n,s,a;e===0?(e=o.width,n=1):n=e/o.width,t===0?(t=o.height,s=1):s=t/o.height,r===0?(r=o.depth,a=1):a=r/o.depth,i.scale(n,s,a),o.width=e,o.height=t,o.depth=r},$v=(i,e)=>{let t=[new Ll(1,0,0),new Ll(0,1,0),new Ll(0,0,1)],r=i.attributes.position,o=new Float32Array(r.count*3);for(let n=0,s=r.count;n<s;n++)t[n%3].toArray(o,n*3);i.setAttribute(e,new Hv(o,3))},Jv=i=>new Promise(e=>{new kv().load(i,r=>e(r))}),Kv=(i,e,t)=>{let r=i.getAttribute("uv");if(r)for(let o=0;o<r.count;o++){let n=r.getX(o),s=r.getY(o);r.setXY(o,(n+e/2)/e,1-(s-t/2)/t*-1)}};import{BufferGeometry as yh,BufferAttribute as gh,Uint32BufferAttribute as Tl,Float32BufferAttribute as Il,Matrix4 as Zv}from"three";import{mergeVertices as Qv}from"three/examples/jsm/utils/BufferGeometryUtils.js";var Xv,Js=new Promise(i=>{Xv=i});var de;Js.then(i=>{de=i});var xh=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),bh=new Uint32Array([0,1,2,3]),vh=new Uint8Array([4]),kt=class{static build(i,e,t,r,o){let n,s,a;if(i===void 0)n=kt.allocate(o,t),de.set_destination_refinement_level(n,0),s=kt.buildLevel(n,!0,r);else if(i.positionWASM!==void 0){e&&e!==0&&(de.free_bvh(e),de.free_subdivision_surface(e));try{n=kt.allocate(o,void 0,i)}catch(l){console.error(l,i),n=kt.allocate(o,void 0,{positionWASM:xh,indexWASM:bh,verticesPerFaceWASM:vh})}de.set_destination_refinement_level(n,0),s=kt.buildLevel(n,!0,r)}else n=e;if(i!==void 0&&i.subdivisions!==void 0){let l=Yv(i.subdivisions,i.positionWASM.length);de.set_destination_refinement_level(n,l),l>0?a=kt.buildLevel(n,!1,r):a=null}return{subdivPointer:n,originalGeometry:s,subdividedGeometry:a}}static allocate(i,e,t){var S;let r,o,n,s=[],a=[];if(t)t.positionWASM&&t.positionWASM.length>0?(r=t.positionWASM,o=t.indexWASM,n=t.verticesPerFaceWASM):(r=xh,o=bh,n=vh);else{e.deleteAttribute("normal"),e.deleteAttribute("uv");let _=Qv(e);r=_.attributes.position.array;let T=_.getIndex().array,h=T.length;switch(e.userData.type==="TorusGeometry"&&(e==null?void 0:e.userData.parameters.arc)===Math.PI*2&&(e.userData.type="ClosedTorusGeometry"),e.userData.type){case"ClosedTorusGeometry":case"PlaneGeometry":case"TorusKnotGeometry":case"CubeGeometry":o=new Uint32Array(h/3*2),n=new Uint8Array(h/6).fill(4);for(let V=0,ie=0;V<h;V+=6)o[ie++]=T[V],o[ie++]=T[V+1],o[ie++]=T[V+4],o[ie++]=T[V+5];break;case"TorusGeometry":case"SphereGeometry":case"HelixGeometry":case"CylinderGeometry":case"ConeGeometry":let I,b,P;if(e.userData.type==="SphereGeometry")b=e.parameters.heightSegments,I=e.parameters.widthSegments,e.parameters.thetaLength!==Math.PI&&(P=!0);else if(e.userData.type==="CylinderGeometry")b=e.parameters.heightSegments+2,I=e.parameters.radialSegments;else if(e.userData.type==="ConeGeometry")b=e.parameters.heightSegments+1,I=e.parameters.radialSegments;else if(e.userData.type==="TorusGeometry"){let V=e.userData.parameters;b=Math.ceil(V.tubularSegments*V.arc/(2*Math.PI))+2,I=V.radialSegments}else{let{pathSegments:V,segments:ie,revolutions:oe}=e.userData.parameters;b=Math.ceil(ie*oe)+2,I=V}P?(o=new Uint32Array(1*I*3+(b-1)*I*4),n=new Uint8Array(1*I+(b-1)*I)):(o=new Uint32Array(2*I*3+(b-2)*I*4),n=new Uint8Array(2*I+(b-2)*I));let v=0,D=0,Z=0;if(e.userData.type==="SphereGeometry"||e.userData.type==="HelixGeometry"||e.userData.type==="TorusGeometry"){for(;D<3*I;)o[D++]=T[v++],o[D++]=T[v++],o[D++]=T[v++],n[Z++]=3;let V=P?o.length:3*I+4*(b-2)*I;for(;D<V;v+=6)o[D++]=T[v],o[D++]=T[v+1],o[D++]=T[v+4],o[D++]=T[v+5],n[Z++]=4}else for(;D<4*(b-2)*I;v+=6)o[D++]=T[v],o[D++]=T[v+1],o[D++]=T[v+4],o[D++]=T[v+5],n[Z++]=4;for(;D<o.length;)o[D++]=T[v++],o[D++]=T[v++],o[D++]=T[v++],n[Z++]=3;break;default:o=T,n=new Uint8Array(h/3).fill(3);break}}let l=r.length,c=o.length,d=n.length,u=r.length+s.length+a.length,p=o.length+n.length,f=u*Float32Array.BYTES_PER_ELEMENT+p*Uint32Array.BYTES_PER_ELEMENT,m=u*Float32Array.BYTES_PER_ELEMENT,x=p*Uint32Array.BYTES_PER_ELEMENT,y=de._malloc(f),N=new Float32Array(de.HEAPF32.buffer,y,u),L=new Uint32Array(de.HEAPU32.buffer,y+m,p);N.set(r,0),N.set(s,r.length),N.set(a,r.length+s.length),L.set(o,0),L.set(n,o.length);let w;((S=t==null?void 0:t.scaleBaked)==null?void 0:S.some(_=>_!==1))&&(w=new Zv().makeScale(...t.scaleBaked)),i&&(w?w.premultiply(i):w=i);let B=w?de.alloc_subdivision_surface2(y,l,y+m,c,y+m+o.length*Uint32Array.BYTES_PER_ELEMENT,d,w.elements):de.alloc_subdivision_surface(y,l,y+m,c,y+m+o.length*Uint32Array.BYTES_PER_ELEMENT,d);return de._free(y),B}static buildLevel(i,e,t,r,o){let n=o?de.get_mesh_data2(i,e?de.Level.CONTROL:de.Level.REFINED,t!=null?t:!e,o.elements):de.get_mesh_data(i,e?de.Level.CONTROL:de.Level.REFINED,t!=null?t:!e),s=8,a=de.HEAPU32.subarray(n>>2,(n>>2)+s),l=a.subarray(4,4+4),c=0,d=de.HEAPU32[a[c]>>2],u=de.HEAPF32.subarray(d>>2,(d>>2)+l[c]);c++;let p=de.HEAPU32[a[c]>>2],f=de.HEAPF32.subarray(p>>2,(p>>2)+l[c]);c++;let m=de.HEAPU32[a[c]>>2],x=de.HEAPU32.subarray(m>>2,(m>>2)+l[c]);c++;let y=de.HEAPU32[a[c]>>2],N=de.HEAPU32.subarray(y>>2,(y>>2)+l[c]);if(c++,r===void 0){let L=new yh;if(L.setIndex(new Tl(N,1)),L.setAttribute("position",new Il(u,3)),L.setAttribute("normal",new Il(f,3)),e){L.setAttribute("faceMap",new Tl(x,1));let w=new Float32Array(f.length/3*4).fill(0);L.setAttribute("color",new gh(w,4))}return de.free_mesh_data(n),L.userData.type="SubdivGeometry",L}r.getAttribute("position").copyArray(u),r.getAttribute("normal").copyArray(f),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,de.free_mesh_data(n)}static buildControlCageWireframe(i,e,t){let r=de.get_wireframe_data_for_base_level(i),o=4,n=de.HEAPU32.subarray(r>>2,(r>>2)+o),s=n.subarray(2,2+2),a=0,l=de.HEAPU32[n[a]>>2],c=de.HEAPF32.subarray(l>>2,(l>>2)+s[a]);a++;let d=de.HEAPU32[n[a]>>2],u=de.HEAPU32.subarray(d>>2,(d>>2)+s[a]);if(e===void 0){let p=new yh;p.setAttribute("position",new Il(c,3));let f=new Float32Array(c.length);for(let m=0,x=c.length;m<x;)f[m++]=t.r,f[m++]=t.g,f[m++]=t.b;return p.setAttribute("color",new gh(f,3)),p.setIndex(new Tl(u,1)),de.free_wireframe_data_for_base_level(r),p}e.getAttribute("position").copyArray(c),e.attributes.position.needsUpdate=!0,de.free_wireframe_data_for_base_level(r)}static updateCollabMesh(i,e,t){e||de.set_destination_refinement_level(i,1);let r=t?de.get_topological_data2(i,e?de.Level.CONTROL:de.Level.REFINED,t.elements):de.get_topological_data(i,e?de.Level.CONTROL:de.Level.REFINED),o=6,n=de.HEAPU32.subarray(r>>2,(r>>2)+o),s=n.subarray(3,3+3),a=0,l=de.HEAPU32[n[a]>>2],c=new Float32Array(de.HEAPF32.subarray(l>>2,(l>>2)+s[a]));a++;let d=de.HEAPU32[n[a]>>2],u=new Uint32Array(de.HEAPU32.subarray(d>>2,(d>>2)+s[a]));a++;let p=de.HEAPU32[n[a]>>2],f=new Uint8Array(de.HEAPU32.subarray(p>>2,(p>>2)+s[a]));return de.free_topological_data(r),{positions:c,indices:u,verticesPerFace:f}}};function Yv(i,e){let t=i;return t=Math.min(t,3-Math.ceil(Math.log(e/172e3)/Math.log(4))),Math.max(t,0)}var Ml={ConeGeometry:wu,CubeGeometry:Nu,CylinderGeometry:vu,DodecahedronGeometry:Lu,EllipseGeometry:Ju,HelixGeometry:eh,IcosahedronGeometry:th,LatheGeometry:rh,NonParametricGeometry:qs,PolygonGeometry:sh,PyramidGeometry:ah,RectangleGeometry:Ws,SphereGeometry:ch,PlaneGeometry:dh,StarGeometry:ph,TextFrameGeometry:$s,TorusGeometry:uh,TorusKnotGeometry:hh,TriangleGeometry:mh,VectorGeometry:mt},Ji=i=>Ml[i.type].create(i);import{Matrix4 as _l}from"three";import{Box3 as Ch,Line3 as Qt,Matrix4 as Pl,Vector3 as Re}from"three";import{HemisphereLight as Sh}from"three";import{Color as eS}from"three";var Ht=class extends eS{constructor(e,t,r,o){super(e,t,r);this.a=o}setRGBA(e,t,r,o){super.setRGB(e,t,r),this.a=o}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}};function Ye(i,e){let t;if(typeof i=="string"){let r=e==null?void 0:e.getColor(i);r?t=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new Ht(0,0,0,0))}else return"a"in i?new Ht(i.r,i.g,i.b,i.a):new Ht(i.r,i.g,i.b,1);return t}var Ks=i=>"isEntity"in i,Xs=i=>"isAbstractMesh"in i;var Er=i=>"objectHelper"in i;function tS(i,e){var r;let t=!1;e.position&&(i.position.fromArray(e.position),t=!0),e.rotation&&(i.rotation.fromArray(e.rotation),t=!0),e.scale&&(t=!0,i.scale.fromArray(e.scale)),e.hiddenMatrix!==void 0&&"hiddenMatrix"in i&&(t=!0,i.hiddenMatrix.fromArray((r=e.hiddenMatrix)!=null?r:Zr.identity)),t&&i.updateMatrix(),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&i.updateWorldMatrix(!1,!0),i.objectType==="CombinedCamera"&&(e.isUpVectorFlipped!==void 0&&(i.isUpVectorFlipped=e.isUpVectorFlipped),i.updateUp())}function rS(i,e){tS(i,e),e.name!==void 0&&(i.name=e.name),e.visible!==void 0&&(i.isEntity?i.visibility=e.visible:i.visible=e.visible)}function wh(i,e,t){rS(i,e),e.color!==void 0&&(i.color=Ye(e.color,t)),e.intensity!==void 0&&(i.intensity=e.intensity),e.shadows!==void 0&&!(i instanceof Sh)&&(i.castShadow=e.shadows),i.shadow&&!(i instanceof Sh)&&e.depth!==void 0&&(i.shadow.camera.far=e.depth,i.shadow.needsUpdate=!0),e.helper!==void 0&&Er(i)&&(i.enableHelper=e.helper,i.gizmos.shadowmap.visible=e.helper)}function Nh(i,e){i.shadow.camera.right=e/2,i.shadow.camera.left=-e/2,i.shadow.camera.top=e/2,i.shadow.camera.bottom=-e/2,i.shadow.needsUpdate=!0}var pi=new Ch,ft=new Re,le=new Re,tt=new Pl;function oS(i,e,t=0,r=e.count){let o=1/0,n=1/0,s=1/0,a=-1/0,l=-1/0,c=-1/0;for(let d=t;d<r;d++){let u=e.getX(d),p=e.getY(d),f=e.getZ(d);u<o&&(o=u),p<n&&(n=p),f<s&&(s=f),u>a&&(a=u),p>l&&(l=p),f>c&&(c=f)}return i.min.set(o,n,s),i.max.set(a,l,c),i}var Lh=(i,e,t,r)=>{var o;if(Xs(i)){let n=i.geometry.userData.parameters,s=i.geometry.getAttribute("position");i.geometry.userData.type==="SubdivGeometry"?ft.copy(i.originalGeometry.boundingSphere.center):(oS(pi,s,i.geometry.drawRange.start,i.geometry.drawRange.count<1/0?i.geometry.drawRange.count:s.count),pi.getCenter(ft)),i.forceComputeSize?pi.getSize(le).multiplyScalar(.5):le.set(n.width,n.height,(o=n.depth)!=null?o:0).multiplyScalar(.5)}else if(Er(i)&&r===!0){let n=i.geometryHelper.getAttribute("position");pi.setFromArray(n.array),pi.getCenter(ft),pi.getSize(le).multiplyScalar(.5)}else ft.setScalar(0),le.setScalar(0);tt.copy(e).multiply(i.matrixWorld),le.x===0&&le.y===0&&le.z===0?t.push(new Re(ft.x,ft.y,ft.z).applyMatrix4(tt)):t.push(new Re(-le.x,le.y,le.z).add(ft).applyMatrix4(tt),new Re(-le.x,-le.y,le.z).add(ft).applyMatrix4(tt),new Re(le.x,-le.y,le.z).add(ft).applyMatrix4(tt),new Re(le.x,le.y,le.z).add(ft).applyMatrix4(tt),new Re(-le.x,le.y,-le.z).add(ft).applyMatrix4(tt),new Re(-le.x,-le.y,-le.z).add(ft).applyMatrix4(tt),new Re(le.x,-le.y,-le.z).add(ft).applyMatrix4(tt),new Re(le.x,le.y,-le.z).add(ft).applyMatrix4(tt))},Zs=class extends Ch{constructor(){super(...arguments);this.matrix=new Pl;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(t=>t.clone()),this.faces=e.faces.map(t=>t.clone()),this.edges=e.edges.map(t=>t.clone()),this.centerEdges=e.centerEdges.map(t=>t.clone()),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let r=new Pl().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,r,t)}expandByObjectSize(e,t,r=!1){let o=[];return r===!0?e.traverseEntity(n=>Lh(n,t,o,e.enableHelper===!0)):Lh(e,t,o,e.enableHelper===!0),this.setFromPoints(o)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4(tt.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(le).multiplyScalar(.5),this.getCenter(ft),tt.copy(this.matrix).setPosition(ft),this.vertices=[new Re(-le.x,le.y,le.z).applyMatrix4(tt),new Re(-le.x,-le.y,le.z).applyMatrix4(tt),new Re(le.x,-le.y,le.z).applyMatrix4(tt),new Re(le.x,le.y,le.z).applyMatrix4(tt),new Re(-le.x,le.y,-le.z).applyMatrix4(tt),new Re(-le.x,-le.y,-le.z).applyMatrix4(tt),new Re(le.x,-le.y,-le.z).applyMatrix4(tt),new Re(le.x,le.y,-le.z).applyMatrix4(tt)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new Qt(this.vertices[0],this.vertices[3]),new Qt(this.vertices[1],this.vertices[2]),new Qt(this.vertices[5],this.vertices[6]),new Qt(this.vertices[4],this.vertices[7]),new Qt(this.vertices[0],this.vertices[1]),new Qt(this.vertices[3],this.vertices[2]),new Qt(this.vertices[7],this.vertices[6]),new Qt(this.vertices[4],this.vertices[5]),new Qt(this.vertices[0],this.vertices[4]),new Qt(this.vertices[1],this.vertices[5]),new Qt(this.vertices[2],this.vertices[6]),new Qt(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(e=>e.getCenter(new Re))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new Re().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new Re().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new Re().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new Re().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new Re().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new Re().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};import{Object3D as yS,Matrix4 as gS,Light as xS}from"three";import{Group as hS,Mesh as Ah,MeshStandardMaterial as jh}from"three";import{BufferGeometry as iS,Float32BufferAttribute as Ol}from"three";function Th(i){var s;let e=[],t=i.groups,r=i.getAttribute("position").array,o=i.getAttribute("normal").array,n=(s=i.getAttribute("uv"))==null?void 0:s.array;return t.forEach(a=>{let l=a.count,c=new iS,d=new Float32Array(l*3),u=new Float32Array(l*3),p=new Float32Array(l*2);for(let f=0;f<l;f++){let m=3*(a.start+f),x=3*f;if(d[x]=r[m],d[x+1]=r[m+1],d[x+2]=r[m+2],u[x]=o[m],u[x+1]=o[m+1],u[x+2]=o[m+2],n){let y=2*(a.start+f),N=2*f;p[N]=n[y],p[N+1]=n[y+1]}}c.setAttribute("position",new Ol(d,3)),c.setAttribute("normal",new Ol(u,3)),n&&c.setAttribute("uv",new Ol(p,2)),e.push(c)}),e}import{GLTFExporter as mS}from"three/examples/jsm/exporters/GLTFExporter.js";var nS,Ih=new Promise(i=>{nS=i});var _h=wc(Oh());var Ys={isPublish:!1,gltfQueue:[]};function jl(i,e,t){return i[e.uuid]===void 0&&(i[e.uuid]=e.toJSON(t)),e.uuid}var fS=new mS;function Dh(i,e,t){if(i[e.uuid]===void 0)if(e.userData.type==="NonParametricGeometry"||e.userData.type==="SubdivGeometry"){if(e.userData.type==="SubdivGeometry")if(Ys.isPublish)e=qs.create({geometry:e.clone()}),e.userData.parameters.subdivisions===0&&(delete e.attributes.color,delete e.attributes.faceMap,delete e.attributes.positionWASM,delete e.attributes.indexWASM,delete e.attributes.verticesPerFaceWASM);else{let o=e.originalGeometry;if(o){let n=e.userData;e=o.clone(),e.userData=n}else e=e.clone();delete e.attributes.color,delete e.attributes.faceMap,delete e.attributes.position,delete e.attributes.normal,e.index=null}let r=e.originalGeometry;if(r!==void 0){let o=e.userData;e=r,e.userData=o}if(!Ys.isPublish)i[e.uuid]=e.toJSON();else{let o={type:"NonParametricGeometry",uuid:e.uuid,userData:{}};e.name!==""&&(o.name=e.name),Object.keys(e.userData).length>0&&(o.userData=O({},e.userData));let n=e.index===null,s=new hS;if(Array.isArray(t))Th(e).forEach((l,c)=>{let d=new Ah(l,new jh);s.add(d),l.userData.groupIndex=c,l.userData.materialIndex=e.groups[c].materialIndex,l.index===null&&(n=!0)});else{let a=new Ah(e,new jh);s.add(a)}Ys.gltfQueue.push(new Promise(async a=>{await Promise.all(Ys.gltfQueue),fS.parse(s,async l=>{let{gltfTransform:c,DracoMeshCompressionExtension:d,addIndex:u}=await Ih,p=c.readJSON({json:yo(l),resources:{}});p.createExtension(d).setRequired(!0).setEncoderOptions({quantizationVolume:"scene"}),n&&await p.transform(u);try{let{json:f,resources:m}=c.writeJSON(p),x=_h.default.fromByteArray(new Uint8Array(m[".bin"]));f.buffers[0].uri=`data:application/octet-stream;base64,${x}`,a()}catch(f){a()}},{})})),i[e.uuid]=o}}else{let r=e.userData;if(r.type==="VectorGeometry"){let o=e.userData.shape;r=Object.assign({},r,{shape:o.toJSON()})}i[e.uuid]={uuid:e.uuid,userData:r}}return e.uuid}function ui(i){let e=[];for(let t in i){let r=i[t];delete r.metadata,e.push(r)}return e}function Bh(i){let e=[];for(let t in i)e.push(i[t]);return e}var ea=i=>class extends i{hasEntityChild(){return this.children.some(t=>Ks(t))}isDescendantOf(t){t instanceof yS&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let o=new gS().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),o.multiply(t.parent.matrixWorld)),Ks(t)?t.hiddenMatrix.premultiply(o):t.applyMatrix4(o),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let o=0;o<t.children.length;o++){let n=t.children[o];this.add(n.clone())}return this}toJSON(t){let r=t===void 0,o={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},o.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let n={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(n.name=this.name),n.matrix=this.matrix.toArray(),this.castShadow===!0&&(n.castShadow=!0),this.receiveShadow===!0&&(n.receiveShadow=!0),this.visible===!1&&(n.visible=!1),this.frustumCulled===!1&&(n.frustumCulled=!1),this.renderOrder!==0&&(n.renderOrder=this.renderOrder),n.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(n.userData=this.userData),this.children.length>0){n.children=[];for(let s of this.children)(Ks(s)||s instanceof xS)&&n.children.push(s.toJSON(t).object)}if(r){let s=ui(t.geometries),a=ui(t.materials),l=ui(t.textures),c=ui(t.images),d=ui(t.interactionStates),u=Bh(t.nodes);s.length>0&&(o.geometries=s),a.length>0&&(o.materials=a),l.length>0&&(o.textures=l),c.length>0&&(o.images=c),d.length>0&&(o.interactionStates=d),u.length>0&&(o.nodes=u)}return o.object=n,o}fromJSON(t){return this.uuid=t.uuid,t.name!==void 0&&(this.name=t.name),t.matrix!==void 0?(this.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=t.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(t.position!==void 0&&this.position.fromArray(t.position),t.rotation!==void 0&&this.rotation.fromArray(t.rotation),t.quaternion!==void 0&&this.quaternion.fromArray(t.quaternion),t.scale!==void 0&&this.scale.fromArray(t.scale)),this.castShadow=t.castShadow!==void 0,this.receiveShadow=t.receiveShadow!==void 0,t.visible!==void 0&&(this.visible=t.visible),t.frustumCulled!==void 0&&(this.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(this.renderOrder=t.renderOrder),t.layers!==void 0&&(this.layers.mask=t.layers),t.userData!==void 0&&(this.userData=t.userData),this}};var er=i=>"isEntity"in i;var tr=i=>class extends ea(i){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new _l;this._singleBBox=new Zs;this._recursiveBBox=new Zs;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(t){this.visible=t;for(let r of this.children)er(r)&&r.traverseEntity(o=>{Er(o)&&o.visible&&(o.objectHelper.visible=t)})}get visibility(){return this.visible}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(t=>{er(t)&&(t.singleBBoxNeedsUpdate=!0,t.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(t=>{t.singleBBoxNeedsUpdate=!0,t.recursiveBBoxNeedsUpdate=!0})}traverseEntity(t){t(this);for(let r of this.children)er(r)&&r.traverseEntity(t)}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);for(let r of this.children)r.updateMatrixWorld(t)}updateWorldMatrix(t,r){let o=this.parent;if(t&&o!==null&&o.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),r)for(let n of this.children)n.updateWorldMatrix(!1,!0)}shallowClone(t){return new this.constructor().shallowCopy(this,t)}shallowCopy(t,r=!0){if(super.copy(t,!1),this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),r===!0)for(let o of t.children)er(o)&&this.add(o.shallowClone());return this}clone(t){return new this.constructor().copy(this,t)}copy(t,r=!0){if(super.copy(t,!1),this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),r===!0)for(let o of t.children)er(o)&&this.add(o.clone());return this}keepChildrenMatrixWorld(){let t=new _l,r=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),t.copy(this.matrixWorld).invert(),t.multiply(r);for(let o of this.children)er(o)&&o.hiddenMatrix.premultiply(t)}toJSON(t){let r=super.toJSON(t),o=r.object;return this.raycastLock===!0&&(o.raycastLock=!0),this.scaleLock===!0&&(o.scaleLock=!0),o.hiddenMatrix=this.hiddenMatrix.toArray(),r}fromJSON(t){return super.fromJSON(t),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.scaleLock!==void 0&&(this.scaleLock=t.scaleLock),this.hiddenMatrix.fromArray(t.hiddenMatrix),this}fromObject3D(t){let r=t.children;return t.children=[],Object.assign(t,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new _l}),this.copy(t),t.children=r,this}toObjectTransformState(t=[]){this.updateWorldMatrix(!0,!1);let r={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return Zo(r,t)}fromObjectTransformState(t){return t.position&&this.position.fromArray(t.position),t.rotation&&this.rotation.fromArray(t.rotation),t.scale&&this.scale.fromArray(t.scale),t.hiddenMatrix&&this.hiddenMatrix.fromArray(t.hiddenMatrix),this.updateMatrix(),this}toState(t=[]){let r=O({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(t));return Zo(r,t)}fromState(t,r){return t.name&&(this.name=t.name),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.type!=="OrthographicCamera"&&t.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),t.visible!==void 0&&(this.visibility=t.visible),this.fromObjectTransformState(t),this}};import{Object3D as bS,Vector3 as Ki,Euler as Gh,MathUtils as io}from"three";var ta=class extends bS{constructor(e,t={}){super();this.object=e;let r=e.recursiveBBox.getSize(new Ki),o=.1;this.parameters=rs.defaultData(r.toArray(),o),go(this.parameters,t),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let e of this.children)e.material=this.object.material}setHideBase(e){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let t of this.object.material)t.visible=!0;if(e){let t=this.object.material.map(r=>r.clone());for(let r of this.children)r.material=t}else for(let t of this.children)t.material=this.object.material}for(let t of this.object.material)t.visible=!e}else{if(this.children.length>0)if(this.object.material.visible=!0,e){let t=this.object.material.clone();for(let r of this.children)r.material=t}else for(let t of this.children)t.material=this.object.material;this.object.material.visible=!e}this.parameters.hideBase=e}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}this.children.forEach(e=>e.updateMatrix())}_updateCount(){let e=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==e)if(this.children.length<e)for(let t=0,r=e-this.children.length;t<r;++t){let o=this.object.shallowClone(!1);o.visible=!0,this.add(o),this.parameters.hideBase&&this.setHideBase(!0)}else for(let t=0,r=this.children.length-e;t<r;++t)this.remove(this.children[0])}_updateRadial(e){let t=e.radial,r=t.start*io.DEG2RAD,o=t.end*io.DEG2RAD,n=r-o,s=new Gh(t.rotation[0]*io.DEG2RAD,t.rotation[1]*io.DEG2RAD,t.rotation[2]*io.DEG2RAD),a;switch(t.axis){case"z":a=new Ki(0,0,1);break;case"y":a=new Ki(0,1,0);break;default:case"x":a=new Ki(1,0,0);break}for(let[l,c]of this.children.entries()){c.hiddenMatrix.identity(),c.scale.x=t.scale[0]+1,c.scale.y=t.scale[1]+1,c.scale.z=t.scale[2]+1,c.position.setScalar(0);let d=n/e.count*l-r;switch(t.axis){case"x":c.rotation.set(0,d,0);break;case"y":c.rotation.set(0,0,d);break;case"z":c.rotation.set(d,0,0);break}c.translateOnAxis(a,t.radius),c.position.x+=t.position[0],c.position.y+=t.position[1],c.position.z+=t.position[2],t.alignment===!0?(c.rotation.x+=s.x,c.rotation.y+=s.y,c.rotation.z+=s.z):c.rotation.copy(s)}}_updateLinear(e){if(e.type!=="linear")throw new Error;let t=e.linear,r=new Gh(t.rotation[0]*io.DEG2RAD,t.rotation[1]*io.DEG2RAD,t.rotation[2]*io.DEG2RAD);for(let[o,n]of this.children.entries())n.hiddenMatrix.identity(),n.scale.x=t.scale[0]*o+1,n.scale.y=t.scale[1]*o+1,n.scale.z=t.scale[2]*o+1,n.rotation.x=r.x*o,n.rotation.y=r.y*o,n.rotation.z=r.z*o,n.position.x=t.position[0]*o,n.position.y=t.position[1]*o,n.position.z=t.position[2]*o}_updateGrid(e){let t=0,r=e.grid;if(r.useCenter===!0){let o={x:r.count[0]%2==0?2:1,y:r.count[1]%2==0?2:1,z:r.count[2]%2==0?2:1},n=new Ki(r.size[0]*(r.count[0]-o.x)*.5,r.size[1]*(r.count[1]-o.y)*.5,r.size[2]*(r.count[2]-o.z)*.5);for(let s=0;s<r.count[0];s++)for(let a=0;a<r.count[1];a++)for(let l=0;l<r.count[2];l++){let c=this.children[t++];c.hiddenMatrix.identity(),c.scale.setScalar(1),c.rotation.set(0,0,0),c.position.x=r.size[0]*s-n.x,c.position.y=r.size[1]*a-n.y,c.position.z=r.size[2]*l-n.z}}else for(let o=0;o<r.count[0];o++)for(let n=0;n<r.count[1];n++)for(let s=0;s<r.count[2];s++){let a=this.children[t++];a.hiddenMatrix.identity(),a.scale.setScalar(1),a.rotation.set(0,0,0),a.position.x=r.size[0]*o,a.position.y=-r.size[1]*n,a.position.z=-r.size[2]*s}}fromJSON(e){return this}toJSON(){return{}}fromClonerState(e){return e.hideBase!==void 0&&this.setHideBase(e.hideBase),go(this.parameters,e),this.update(),this}};var yt=class extends tr(vS){constructor(e,t){super(e,t);this.isAbstractMesh=!0;Array.isArray(t)&&(this.selectedMaterial=0,e.groups.length===0&&e.addGroup(0,e.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(e){this._cloner&&this.remove(this._cloner),e&&this.add(e),this._cloner=e}getSelectedMaterial(e){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=e!=null?e:0),this.material[e!=null?e:this.selectedMaterial]):this.material}setSelectedMaterial(e,t){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t!=null?t:0),t=t!=null?t:this.selectedMaterial,this.material[t].dispose(),this.material[t]=e):(this.material.dispose(),this.material=e)}updateGeometry(e){let t=this.geometry,r=Ml[t.userData.type],o=this.objectType==="NonParametric"?Object.assign({},t.userData,{geometry:t}):t.userData,n=r.build(r.normalizeInputs(e,o)),s=t.uuid;if(this.geometry.dispose(),this.geometry=n,this.geometry.uuid=s,this.geometry.computeBoundingSphere(),this.cloner)for(let a of this.cloner.children)a.geometry=this.geometry}resizeGeometry(e,t,r){$i.resizeGeometry(this.geometry,{width:e,height:t,depth:r})}shallowClone(e){return new this.constructor(this.geometry,this.material).shallowCopy(this,e)}clone(e){let t=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,r=Ji(t),o=Array.isArray(this.material)?this.material.map(n=>n.clone()):this.material.clone();return new this.constructor(r,o).copy(this,e)}copy(e,t=!0){return super.copy(e,t),e.cloner&&(this.cloner=new ta(e,e.cloner.parameters),this.add(this.cloner)),this}toJSON(e){let t=super.toJSON(e),r=t.object;if(r.geometry=Dh(e.geometries,this.geometry,this.material),Array.isArray(this.material)){let o=[];for(let n=0,s=this.material.length;n<s;n++)o.push(jl(e.materials,this.material[n],e));r.material=o}else r.material=jl(e.materials,this.material,e);return t}fromJSON(e){return super.fromJSON(e),e.selectedMaterial!==void 0&&(this.selectedMaterial=e.selectedMaterial),this}setFromClonerState(e){e===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new ta(this)),this.cloner.fromClonerState(e))}fromState(e,t){var r,o;return super.fromState(e),e.type==="Mesh"&&(this.setFromClonerState(e.cloner),this.castShadow=(r=e.castShadow)!=null?r:!0,this.receiveShadow=(o=e.receiveShadow)!=null?o:!0),this}};import{NormalBlending as US,ShaderMaterial as kS,FrontSide as HS}from"three";import{CubeReflectionMapping as jS,CubeRefractionMapping as _S,CubeUVReflectionMapping as DS,CubeUVRefractionMapping as BS,LinearEncoding as Uh,sRGBEncoding as GS}from"three";var ra=class{constructor(e){e=e!=null?e:{},this.name=e.name,this.type=e.type,this.node=e.node,this.size=e.size,this.needsUpdate=e.needsUpdate}get value(){return this.node.value}set value(e){this.node.value=e}};import{MathUtils as SS}from"three";var pe=class{constructor(e){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=SS.generateUUID(),this.type=e,this.name="",this.userData={}}analyze(e,t){t=t!=null?t:{},e.analyzing=!0,this.build(e.addFlow(t.slot,t.cache,t.context),"v4"),e.clearVertexNodeCode(),e.clearFragmentNodeCode(),e.removeFlow(),e.analyzing=!1}analyzeAndFlow(e,t,r){return r=r!=null?r:{},this.analyze(e,r),this.flow(e,t,r)}flow(e,t,r){r=r!=null?r:{},e.addFlow(r.slot,r.cache,r.context);let o={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),o}build(e,t,r){t=t!=null?t:this.getType(e,t);let o=e.getNodeData(r!=null?r:this);return e.analyzing&&this.appendDepsNode(e,o,t),e.nodes.indexOf(this)===-1&&e.nodes.push(this),this.updateFrame!==void 0&&e.updaters.indexOf(this)===-1&&e.updaters.push(this),this.generate(e,t,r)}updateFrame(e){}generateReadonly(e,t,r,o,n,s){return""}generate(e,t,r,o,n){return""}parse(e,t,r,o){}appendDepsNode(e,t,r){t.deps=(t.deps||0)+1;let o=e.getTypeLength(r);(o>(t.outputMax||0)||this.getType(e,r))&&(t.outputMax=o,t.output=r)}setName(e){this.name=e}getName(){return this.name}getType(e,t){return t==="sampler2D"||t==="samplerCube"?t:this.type}getJSONNode(e){if((e==null?void 0:e.materials)&&(e==null?void 0:e.materials[this.uuid])!==void 0)return e.materials[this.uuid]}getHash(){let e="{",t,r;for(t in this)r=this[t],r instanceof pe&&(e+='"'+t+'":'+r.getHash()+",");if(this.hashProperties)for(let o=0;o<this.hashProperties.length;o++)t=this.hashProperties[o],r=this[t],e+='"'+t+'":"'+String(r)+'",';return e+='"id":"'+this.uuid+'"}',e}copy(e){return this.name=e.name,e.type&&(this.type=e.type),e.frameId&&(this.frameId=e.frameId),e.hashProperties&&(this.hashProperties=e.hashProperties.map(t=>t)),this.userData=JSON.parse(JSON.stringify(e.userData)),this.shortcuts=JSON.parse(JSON.stringify(e.shortcuts)),this}clone(){return new this.constructor().copy(this)}createJSONNode(e){let t=e===void 0||typeof e=="string";if(typeof this.type!="string")throw new Error("Node does not allow serialization.");let r={};return r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),!t&&e&&(e.nodes[this.uuid]=r),r}toJSON(e){var t;return(t=this.getJSONNode(e))!=null?t:this.createJSONNode(e)}fromJSON(e,t){return this.uuid=e.uuid,this.type=e.type,e.name&&(this.name=e.name),e.userData&&(this.userData=e.userData),this}};var zh=class{constructor(){this.nodes={};this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,r){r=r!==void 0?r:!0,this.keywords[e]={callback:t,cache:r}}remove(e){delete this.nodes[e.name]}removeKeyword(e){delete this.keywords[e]}get(e){return this.nodes[e]}getKeyword(e,t){return this.keywords[e].callback(t)}getKeywordData(e){return this.keywords[e]}contains(e){return this.nodes[e]!==void 0}containsKeyword(e){return this.keywords[e]!==void 0}},lt=new zh;import{Vector2 as Eh}from"three";import{MathUtils as wS}from"three";var ue=class extends pe{constructor(e,t){super(e);this.scope="";t=t!=null?t:{},this.shared=t.shared!==void 0?t.shared:!0,this.unique=t.unique!==void 0?t.unique:!1}build(e,t,r,o){if(t=t!=null?t:this.getType(e),this.getShared(e,t)){let n=this.getUnique(e,t);n&&this.uuid===void 0&&(this.uuid=wS.generateUUID()),r=e.getUUID(r!=null?r:this.getUUID(),!n);let s=e.getNodeData(r),a=s.output||this.getType(e);if(e.analyzing)return(s.deps||0)>0||this.getLabel()?(this.appendDepsNode(e,s,t),this.generate(e,t,r)):super.build(e,t,r);if(n)return s.name=s.name||super.build(e,t,r),s.name;if(!this.getLabel()&&(!this.getShared(e,a)||e.context.ignoreCache||s.deps===1))return super.build(e,t,r);r=this.getUUID(!1);let l=this.getTemp(e,r);if(l)return e.format(l,a,t);{l=super.generate(e,t,r,s.output,o);let c=this.generate(e,a,r);return e.addNodeCode(l+" = "+c+";"),e.format(l,a,t)}}return super.build(e,t,r)}getShared(e,t){return t!=="sampler2D"&&t!=="samplerCube"&&this.shared}getUnique(e,t){return this.unique}setLabel(e){return this.label=e,this}getLabel(){return this.label}getUUID(e){let t=this.uuid;return typeof this.scope=="string"&&(t=this.scope+"-"+t),t}getTemp(e,t){t=t||this.uuid;let r=e.getVars()[t];return r?r.name:void 0}generate(e,t,r,o,n){return this.getShared(e,t)||console.error("TempNode is not shared"),r=r!=null?r:this.uuid,e.getTempVar(r,o!=null?o:this.getType(e),n,this.getLabel()).name}};var Ue=class extends ue{constructor(e,t){t=t!=null?t:{},t.shared=t.shared!==void 0?t.shared:!1;super(e,t);this.readonly=!1}setReadonly(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(e){let t=super.createJSONNode(e);return this.readonly===!0&&(t.readonly=this.readonly),t}fromJSON(e,t){return super.fromJSON(e,t),e.readonly!==void 0&&this.setReadonly(e.readonly),this}generate(e,t,r,o,n,s){r=e.getUUID(r!=null?r:this.getUUID()),o=o!=null?o:this.getType(e);let a=e.getNodeData(r);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(e,t,r,o,n,s):e.isShader("vertex")?(a.vertex||(a.vertex=e.createVertexUniform(o,this,n,s,this.getLabel())),e.format(a.vertex.name,o,t)):(a.fragment||(a.fragment=e.createFragmentUniform(o,this,n,s,this.getLabel())),e.format(a.fragment.name,o,t))}copy(e){return super.copy(e),this.readonly=e.readonly,this}};var It=class extends Ue{constructor(e=0,t){super("v2");this.nodeType="Vector2";this.value=e instanceof Eh?e:new Eh(e,t)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}generateReadonly(e,t,r,o,n,s){return e.format("vec2("+this.value.x+", "+this.value.y+")",o,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}};import{Vector3 as Fh}from"three";var Mt=class extends Ue{constructor(e=0,t,r){super("v3");this.nodeType="Vector3";this.value=e instanceof Fh?e:new Fh(e,t,r)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}get z(){return this.value.z}set z(e){this.value.z=e}generateReadonly(e,t,r,o,n,s){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",o,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}};var no=class extends Ue{constructor(e){super("v4");this.nodeType="Vector4";this.value=e instanceof Ht?e:new Ht(e.r,e.g,e.b,e.a)}generateReadonly(e,t,r,o,n,s){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",o,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}};var NS=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,Rh=/[a-z_0-9]+/gi,re=class extends ue{constructor(e,t,r,o,n){super(n);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=n===void 0,this.isInterface=!1,this.parse(e,t,r,o)}getShared(e,t){return!this.isMethod}getType(e){return e.getTypeByFormat(this.type)}getInputByName(e){if(this.inputs){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}}getIncludeByName(e){if(this.includes){let t=this.includes.length;for(;t--;)if(this.includes[t].name===e)return this.includes[t]}}generate(e,t,r,o,n){let s,a=0,l=this.src;if(this.includes)for(let d=0;d<this.includes.length;d++)e.include(this.includes[d],this);for(let d in this.extensions)e.extensions[d]=!0;let c=[];for(;s=Rh.exec(this.src);)c.push(s);for(let d=0;d<c.length;d++){let u=c[d],p=u[0],f=this.isMethod?!this.getInputByName(p):!0,m=p;if(this.keywords[p]||this.useKeywords&&f&<.containsKeyword(p)){let x=this.keywords[p];if(!x){let y=lt.getKeywordData(p);y.cache&&(x=e.keywords[p]),x=x||lt.getKeyword(p,e),y.cache&&(e.keywords[p]=x)}m=x.build(e)}p!==m&&(l=l.substring(0,u.index+a)+m+l.substring(u.index+p.length+a),a+=m.length-p.length),this.getIncludeByName(m)===void 0&<.contains(m)&&e.include(lt.get(m))}return t==="source"?l:this.isMethod?(this.isInterface||e.include(this,void 0,l),this.name):e.format("( "+l+" )",this.getType(e),t)}parse(e,t,r,o){if(this.src=e||"",this.includes=t!=null?t:[],this.extensions=r!=null?r:{},this.keywords=o!=null?o:{},this.isMethod){let n=NS.exec(this.src);if(this.inputs=[],n&&n.length==4){this.type=n[1],this.name=n[2];let s=n[3].match(Rh);if(s){let a=0;for(;a<s.length;){let l=s[a++],c;l==="in"||l==="out"||l==="inout"?c=s[a++]:(c=l,l="");let d=s[a++];this.inputs.push({name:d,type:c,qualifier:l})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}copy(e){return super.copy(e),this.isMethod=e.isMethod,this.useKeywords=e.useKeywords,e.type!==void 0&&(this.type=e.type),this.parse(e.src,e.includes,e.extensions,e.keywords),this}toJSON(e){var r;let t=this.getJSONNode(e);if(!t){t=this.createJSONNode(e),t.src=this.src,t.isMethod=this.isMethod,t.useKeywords=this.useKeywords,this.isMethod||(t.type=this.type),t.extensions=JSON.parse(JSON.stringify(this.extensions));let o={};for(let n in this.keywords)o[n]=this.keywords[n].toJSON(e).uuid;if(t.keywords=o,(r=this.includes)==null?void 0:r.length){let n=[];for(let s=0;s<this.includes.length;s++)n.push(this.includes[s].toJSON(e).uuid);t.includes=n}t.isMethod=this.isMethod,t.inputs=this.inputs}return t.nodeType=this.nodeType,t}fromJSON(e,t){if(super.fromJSON(e,t),e.inputs!==void 0&&(this.inputs=e.inputs),e.isMethod!==void 0&&(this.isMethod=e.isMethod),e.src&&(this.src=e.src),e.isMethod&&(this.isMethod=e.isMethod),e.useKeywords&&(this.useKeywords=e.useKeywords),e.type&&(this.type=e.type),e.extensions&&(this.extensions=e.extensions),e.keywords&&t){this.keywords={};for(let r in e.keywords)this.keywords[r]=t.getNode(e.keywords[r])}return e.includes&&t&&(this.includes=e.includes.map(r=>t.getNode(r))),this}};var CS=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,Dl=class extends ue{constructor(e="",t){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(e||Dl.PI,void 0,void 0,void 0,t)}getType(e){return e.getTypeByFormat(this.type)}parse(e,t,r,o,n){this.src=e||"";let s,a,l="",c=CS.exec(e);this.useDefine=n!=null?n:this.src.charAt(0)==="#",c&&c.length>1?(a=c[1],s=c[2],l=c[3]):(s=this.src,a="f"),this.name=s,this.type=a,this.value=l}build(e,t){if(t==="source"){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return e.include(this),e.format(this.name,this.getType(e),t)}generate(e,t,r,o,n){return e.format(this.name,this.getType(e),t)}copy(e){return super.copy(e),this.parse(e.src,void 0,void 0,void 0,e.useDefine),this}},Ie=Dl;Ie.PI="PI",Ie.PI2="PI2",Ie.RECIPROCAL_PI="RECIPROCAL_PI",Ie.RECIPROCAL_PI2="RECIPROCAL_PI2",Ie.LOG2="LOG2",Ie.EPSILON="EPSILON";var LS=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
2
|
-
|
|
3
|
-
`)),sRGBToLinear:new re(["vec4 sRGBToLinear( in vec4 value ) {"," return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );","}"].join(`
|
|
4
|
-
|
|
5
|
-
`))},Dt.LINEAR_TO_LINEAR="LinearToLinear",Dt.SRGB_TO_LINEAR="sRGBToLinear",Dt.LINEAR_TO_SRGB="LinearTosRGB";var Be=class extends re{constructor(e="",t,r,o,n){super(e,n,o,r,t);this.nodeType="Expression"}};import{Texture as PS}from"three";var Fr=class extends PS{toJSON(e){let t=super.toJSON(e),r=e===void 0||typeof e=="string";if(this.image!==void 0&&!r){let o=this.image;if(Array.isArray(o)){e.images[o.uuid].url=[];for(let n=0;n<o.length;n++)e.images[o.uuid].url[n]=Vh(o[n])}else e.images[o.uuid].url=Vh(o)}return t}};function Vh(i){return typeof HTMLImageElement!="undefined"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&i instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&i instanceof ImageBitmap?OS(i):(console.warn("THREE.Texture: Unable to serialize Texture."),"")}var hi;function OS(i){if(/^data:/i.test(i.src))return i.src;let e;if(i instanceof HTMLCanvasElement)e=i;else{hi===void 0&&(hi=document.createElement("canvas")),hi.width=i.width,hi.height=i.height;let r=hi.getContext("2d");i instanceof ImageData?r.putImageData(i,0,0):r.drawImage(i,0,0,i.width,i.height),e=hi}let t=i.src.startsWith("blob:")?i.fileName:i.src;return/\.jpe?g$/i.test(t)?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}var Bt=class extends Ue{constructor(e=new Fr,t,r,o){super("v4",{shared:!0});this.nodeType="Texture";this.value=e,this.uv=t!=null?t:new Zi,this.bias=r,this.project=o!==void 0?o:!1}getTexture(e,t){return super.generate(e,t,this.value.uuid,"t")}generate(e,t){var d;if(t==="sampler2D")return this.getTexture(e,t);let r=this.getTexture(e,t),o=this.uv.build(e,this.project?"v4":"v2"),n=this.bias?this.bias.build(e,"f"):void 0;n===void 0&&e.context.bias&&(n=e.context.bias.setTexture(this).build(e,"f"));let s,a;this.project?s="texture2DProj":s=n?"tex2DBias":"tex2D",n?a=s+"( "+r+", "+o+", "+n+" )":a=s+"( "+r+", "+o+" )";let l={include:e.isShader("vertex"),ignoreCache:!0},c=this.getType(e);return e.addContext(l),this.colorSpace=(d=this.colorSpace)!=null?d:new Dt(new Be("",c)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(a),a=this.colorSpace.build(e,c),e.removeContext(),e.format(a,c,t)}copy(e){return super.copy(e),e.value.isRenderTargetTexture?this.value=e.value:this.value.copy(e.value),this.uv.copy(e.uv),e.bias?this.bias?this.bias.copy(e.bias):this.bias=e.bias.clone():this.bias=void 0,e.colorSpace?this.colorSpace?this.colorSpace.copy(e.colorSpace):this.colorSpace=e.colorSpace.clone():this.colorSpace=void 0,this.project=e.project,e.value.isRenderTargetTexture||(this.value.updateMatrix(),this.value.needsUpdate=!0),this}};var ee=class extends Ue{constructor(e){super("f");this.nodeType="Float";this.value=e!=null?e:0}generateReadonly(e,t,r,o,n,s){return e.format(this.value+(this.value%1?"":".0"),o,t)}copy(e){return super.copy(e),this.value=e.value,this}};var oa=class extends ue{constructor(e,t){super();this.inputs=[];this.nodeType="FunctionCall";this.value=e,this.inputs=t!=null?t:[]}getFunction(){return this.value}getType(e){return this.value.getType(e)}generate(e,t,r,o,n){o=this.getType(e);let s=this.value,a=s.build(e,t)+"( ",l=[];if(s.inputs){for(let c=0;c<s.inputs.length;c++){let d=s.inputs[c],u=this.inputs[c]||this.inputs[d.name];l.push(u.build(e,e.getTypeByFormat(d.type)))}a+=l.join(", ")+" )"}return e.format(a,o,t)}copy(e){return super.copy(e),this.value.copy(e.value),this.inputs=e.inputs.map(t=>t.clone()),this}toJSON(e){var r;let t=this.getJSONNode(e);if(!t){let o=this.value;if(t=this.createJSONNode(e),t.value=this.value.toJSON(e).uuid,(r=o.inputs)==null?void 0:r.length){t.inputs={};for(let n=0;n<o.inputs.length;n++){let s=o.inputs[n],a=this.inputs[n];t.inputs[s.name]=a.toJSON(e).uuid}}}return t}};var mi;(function(o){o.ADD="+",o.SUB="-",o.MUL="*",o.DIV="/"})(mi||(mi={}));var Bl=class extends ue{constructor(e=new pe,t=new pe,r=Bl.ADD){super();this.nodeType="Operator";this.type=e.type,this.a=e,this.b=t,this.op=r}getType(e){let t=this.a.getType(e),r=this.b.getType(e);return e.isTypeMatrix(t)?"v4":e.getTypeLength(r)>e.getTypeLength(t)?r:t}generate(e,t){let r=this.getType(e);this.type=r;let o=this.a.build(e,r),n=this.b.build(e,r);return e.format("( "+o+" "+this.op+" "+n+" )",r,t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b.copy(e.b),this.op=e.op,this}},qt=Bl;qt.ADD=mi.ADD,qt.SUB=mi.SUB,qt.MUL=mi.MUL,qt.DIV=mi.DIV;var be;(function(g){g.RAD="radians",g.DEG="degrees",g.EXP="exp",g.EXP2="exp2",g.LOG="log",g.LOG2="log2",g.SQRT="sqrt",g.INV_SQRT="inversesqrt",g.FLOOR="floor",g.CEIL="ceil",g.NORMALIZE="normalize",g.FRACT="fract",g.SATURATE="saturate",g.SIN="sin",g.COS="cos",g.TAN="tan",g.ASIN="asin",g.ACOS="acos",g.ARCTAN="atan",g.ABS="abs",g.SIGN="sign",g.LENGTH="length",g.NEGATE="negate",g.INVERT="invert",g.MIN="min",g.MAX="max",g.MOD="mod",g.STEP="step",g.REFLECT="reflect",g.DISTANCE="distance",g.DOT="dot",g.CROSS="cross",g.POW="pow",g.MIX="mix",g.CLAMP="clamp",g.REFRACT="refract",g.SMOOTHSTEP="smoothstep",g.FACEFORWARD="faceforward"})(be||(be={}));var je=class extends ue{constructor(e=new pe,t=je.ABS,r,o){super();this.nodeType="Math";this.a=e,typeof t!="string"?this.b=t:o=t,typeof r!="string"?this.c=r:o=r,this.method=o,this.hashProperties=["method"]}getNumInputs(e){switch(this.method){case je.MIX:case je.CLAMP:case je.REFRACT:case je.SMOOTHSTEP:case je.FACEFORWARD:return 3;case je.MIN:case je.MAX:case je.MOD:case je.STEP:case je.REFLECT:case je.DISTANCE:case je.DOT:case je.CROSS:case je.POW:return 2;default:return 1}}getInputType(e){let t=e.getTypeLength(this.a.getType(e)),r=this.b?e.getTypeLength(this.b.getType(e)):0,o=this.c?e.getTypeLength(this.c.getType(e)):0;return t>r&&t>o?this.a.getType(e):r>o?this.b.getType(e):this.c.getType(e)}getType(e){switch(this.method){case je.LENGTH:case je.DISTANCE:case je.DOT:return"f";case je.CROSS:return"v3"}return this.getInputType(e)}generate(e,t){let r,o,n,s=this.a?e.getTypeLength(this.a.getType(e)):0,a=this.b?e.getTypeLength(this.b.getType(e)):0,l=this.c?e.getTypeLength(this.c.getType(e)):0,c=this.getInputType(e),d=this.getType(e);switch(this.type=d,this.method){case je.NEGATE:return e.format("( -"+this.a.build(e,c)+" )",c,t);case je.INVERT:return e.format("( 1.0 - "+this.a.build(e,c)+" )",c,t);case je.CROSS:r=this.a.build(e,"v3"),o=this.b.build(e,"v3");break;case je.STEP:r=this.a.build(e,s===1?"f":c),o=this.b.build(e,c);break;case je.MIN:case je.MAX:case je.MOD:r=this.a.build(e,c),o=this.b.build(e,a===1?"f":c);break;case je.REFRACT:r=this.a.build(e,c),o=this.b.build(e,c),n=this.c.build(e,"f");break;case je.MIX:r=this.a.build(e,c),o=this.b.build(e,c),n=this.c.build(e,l===1?"f":c);break;default:r=this.a.build(e,c),this.b&&(o=this.b.build(e,c)),this.c&&(n=this.c.build(e,c));break}let u=[];u.push(r),o&&u.push(o),n&&u.push(n);let p=this.getNumInputs(e);if(u.length!==p)throw Error(`Arguments not match used in "${this.method}". Require ${p}, currently ${u.length}.`);return e.format(this.method+"( "+u.join(", ")+" )",d,t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b=e.b instanceof pe?e.b.clone():e.b,this.c=e.c instanceof pe?e.c.clone():e.c,this.method=e.method,this}},fe=je;fe.RAD=be.RAD,fe.DEG=be.DEG,fe.EXP=be.EXP,fe.EXP2=be.EXP2,fe.LOG=be.LOG,fe.LOG2=be.LOG2,fe.SQRT=be.SQRT,fe.INV_SQRT=be.INV_SQRT,fe.FLOOR=be.FLOOR,fe.CEIL=be.CEIL,fe.NORMALIZE=be.NORMALIZE,fe.FRACT=be.FRACT,fe.SATURATE=be.SATURATE,fe.SIN=be.SIN,fe.COS=be.COS,fe.TAN=be.TAN,fe.ASIN=be.ASIN,fe.ACOS=be.ACOS,fe.ARCTAN=be.ARCTAN,fe.ABS=be.ABS,fe.SIGN=be.SIGN,fe.LENGTH=be.LENGTH,fe.NEGATE=be.NEGATE,fe.INVERT=be.INVERT,fe.MIN=be.MIN,fe.MAX=be.MAX,fe.MOD=be.MOD,fe.STEP=be.STEP,fe.REFLECT=be.REFLECT,fe.DISTANCE=be.DISTANCE,fe.DOT=be.DOT,fe.CROSS=be.CROSS,fe.POW=be.POW,fe.MIX=be.MIX,fe.CLAMP=be.CLAMP,fe.REFRACT=be.REFRACT,fe.SMOOTHSTEP=be.SMOOTHSTEP,fe.FACEFORWARD=be.FACEFORWARD;var fi=class extends ue{constructor(e=new pe,t=new pe,r=new pe){super("v4");this.nodeType="TextureCubeUV";this.value=e,this.uv=t,this.bias=r}bilinearCubeUV(e,t,r,o){var l,c,d,u;let n=new oa(fi.Nodes.bilinearCubeUV,[t,r,o]);this.colorSpaceTL=(l=this.colorSpaceTL)!=null?l:new Dt(new Be("","v4")),this.colorSpaceTL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(n.build(e)+".tl"),this.colorSpaceTR=(c=this.colorSpaceTR)!=null?c:new Dt(new Be("","v4")),this.colorSpaceTR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(n.build(e)+".tr"),this.colorSpaceBL=(d=this.colorSpaceBL)!=null?d:new Dt(new Be("","v4")),this.colorSpaceBL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(n.build(e)+".bl"),this.colorSpaceBR=(u=this.colorSpaceBR)!=null?u:new Dt(new Be("","v4")),this.colorSpaceBR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(n.build(e)+".br");let s={include:e.isShader("vertex"),ignoreCache:!0};e.addContext(s),this.colorSpaceTLExp=new Be(this.colorSpaceTL.build(e,"v4"),"v4"),this.colorSpaceTRExp=new Be(this.colorSpaceTR.build(e,"v4"),"v4"),this.colorSpaceBLExp=new Be(this.colorSpaceBL.build(e,"v4"),"v4"),this.colorSpaceBRExp=new Be(this.colorSpaceBR.build(e,"v4"),"v4"),e.removeContext();let a=new Be("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return a.keywords.cubeUV_TL=this.colorSpaceTLExp,a.keywords.cubeUV_TR=this.colorSpaceTRExp,a.keywords.cubeUV_BL=this.colorSpaceBLExp,a.keywords.cubeUV_BR=this.colorSpaceBRExp,a.keywords.cubeUV=n,a}generate(e,t){if(e.isShader("fragment")){let r=this.uv,o=this.bias||e.context.roughness,n=new oa(fi.Nodes.roughnessToMip,[o]),s=new fe(n,fi.Nodes.m0,fi.Nodes.cubeUV_maxMipLevel,fe.CLAMP),a=new fe(s,fe.FLOOR),l=new fe(s,fe.FRACT),c=this.bilinearCubeUV(e,this.value,r,a),d=this.bilinearCubeUV(e,this.value,r,new qt(a,new ee(1).setReadonly(!0),qt.ADD)),u=new fe(c,d,l,fe.MIX);return e.format(u.build(e),"v4",t)}else return console.warn("TextureCubeUVNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.uv.copy(e.uv),this.bias.copy(e.bias),this.value.copy(e.value),e.colorSpaceTL?this.colorSpaceTL?this.colorSpaceTL.copy(e.colorSpaceTL):this.colorSpaceTL=e.colorSpaceTL.clone():this.colorSpaceTL=void 0,e.colorSpaceTR?this.colorSpaceTR?this.colorSpaceTR.copy(e.colorSpaceTR):this.colorSpaceTR=e.colorSpaceTR.clone():this.colorSpaceTR=void 0,e.colorSpaceBL?this.colorSpaceBL?this.colorSpaceBL.copy(e.colorSpaceBL):this.colorSpaceBL=e.colorSpaceBL.clone():this.colorSpaceBL=void 0,e.colorSpaceBR?this.colorSpaceBR?this.colorSpaceBR.copy(e.colorSpaceBR):this.colorSpaceBR=e.colorSpaceBR.clone():this.colorSpaceBR=void 0,e.colorSpaceTLExp?this.colorSpaceTLExp?this.colorSpaceTLExp.copy(e.colorSpaceTLExp):this.colorSpaceTLExp=e.colorSpaceTLExp.clone():this.colorSpaceTLExp=void 0,e.colorSpaceTRExp?this.colorSpaceTRExp?this.colorSpaceTRExp.copy(e.colorSpaceTRExp):this.colorSpaceTRExp=e.colorSpaceTRExp.clone():this.colorSpaceTRExp=void 0,e.colorSpaceBLExp?this.colorSpaceBLExp?this.colorSpaceBLExp.copy(e.colorSpaceBLExp):this.colorSpaceBLExp=e.colorSpaceBLExp.clone():this.colorSpaceBLExp=void 0,e.colorSpaceBRExp?this.colorSpaceBRExp?this.colorSpaceBRExp.copy(e.colorSpaceBRExp):this.colorSpaceBRExp=e.colorSpaceBRExp.clone():this.colorSpaceBRExp=void 0,this}},Qi=fi;Qi.Nodes=function(){let e=new Xi(`struct TextureCubeUVData {
|
|
1
|
+
var J_=Object.create;var sa=Object.defineProperty,K_=Object.defineProperties,X_=Object.getOwnPropertyDescriptor,Z_=Object.getOwnPropertyDescriptors,Y_=Object.getOwnPropertyNames,dg=Object.getOwnPropertySymbols,Q_=Object.getPrototypeOf,pg=Object.prototype.hasOwnProperty,eT=Object.prototype.propertyIsEnumerable;var mg=(i,e,t)=>e in i?sa(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,U=(i,e)=>{for(var t in e||(e={}))pg.call(e,t)&&mg(i,t,e[t]);if(dg)for(var t of dg(e))eT.call(e,t)&&mg(i,t,e[t]);return i},fe=(i,e)=>K_(i,Z_(e)),gg=i=>sa(i,"__esModule",{value:!0});var th=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),tT=(i,e)=>{gg(i);for(var t in e)sa(i,t,{get:e[t],enumerable:!0})},rT=(i,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Y_(e))!pg.call(i,r)&&r!=="default"&&sa(i,r,{get:()=>e[r],enumerable:!(t=X_(e,r))||t.enumerable});return i},rh=i=>rT(gg(sa(i!=null?J_(Q_(i)):{},"default",i&&i.__esModule&&"default"in i?{get:()=>i.default,enumerable:!0}:{value:i,enumerable:!0})),i);var Cv=th(du=>{"use strict";du.byteLength=yD;du.toByteArray=vD;du.fromByteArray=wD;var Yn=[],yn=[],gD=typeof Uint8Array!="undefined"?Uint8Array:Array,od="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Lo=0,wv=od.length;Lo<wv;++Lo)Yn[Lo]=od[Lo],yn[od.charCodeAt(Lo)]=Lo;var Lo,wv;yn["-".charCodeAt(0)]=62;yn["_".charCodeAt(0)]=63;function Nv(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function yD(i){var e=Nv(i),t=e[0],r=e[1];return(t+r)*3/4-r}function xD(i,e,t){return(e+t)*3/4-t}function vD(i){var e,t=Nv(i),r=t[0],n=t[1],s=new gD(xD(i,r,n)),l=0,c=n>0?r-4:r,f;for(f=0;f<c;f+=4)e=yn[i.charCodeAt(f)]<<18|yn[i.charCodeAt(f+1)]<<12|yn[i.charCodeAt(f+2)]<<6|yn[i.charCodeAt(f+3)],s[l++]=e>>16&255,s[l++]=e>>8&255,s[l++]=e&255;return n===2&&(e=yn[i.charCodeAt(f)]<<2|yn[i.charCodeAt(f+1)]>>4,s[l++]=e&255),n===1&&(e=yn[i.charCodeAt(f)]<<10|yn[i.charCodeAt(f+1)]<<4|yn[i.charCodeAt(f+2)]>>2,s[l++]=e>>8&255,s[l++]=e&255),s}function bD(i){return Yn[i>>18&63]+Yn[i>>12&63]+Yn[i>>6&63]+Yn[i&63]}function SD(i,e,t){for(var r,n=[],s=e;s<t;s+=3)r=(i[s]<<16&16711680)+(i[s+1]<<8&65280)+(i[s+2]&255),n.push(bD(r));return n.join("")}function wD(i){for(var e,t=i.length,r=t%3,n=[],s=16383,l=0,c=t-r;l<c;l+=s)n.push(SD(i,l,l+s>c?c:l+s));return r===1?(e=i[t-1],n.push(Yn[e>>2]+Yn[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(Yn[e>>10]+Yn[e>>4&63]+Yn[e<<2&63]+"=")),n.join("")}});var mb=th((Uu,pb)=>{(function(i,e){typeof Uu=="object"&&typeof pb!="undefined"?e(Uu):typeof define=="function"&&define.amd?define(["exports"],e):e((i=typeof globalThis!="undefined"?globalThis:i||self).SVDJS={})})(Uu,function(i){"use strict";i.SVD=function(e,t,r,n,s){if(t=t===void 0||t,r=r===void 0||r,s=1e-64/(n=n||Math.pow(2,-52)),!e)throw new TypeError("Matrix a is not defined");var l,c,f,h,p,y,g,w,S,T,C,B,G=e[0].length,D=e.length;if(D<G)throw new TypeError("Invalid matrix: m < n");for(var W=[],A=[],q=[],E=t==="f"?D:G,b=T=g=0;b<D;b++)A[b]=new Array(E).fill(0);for(b=0;b<G;b++)q[b]=new Array(G).fill(0);var R,I=new Array(G).fill(0);for(b=0;b<D;b++)for(l=0;l<G;l++)A[b][l]=e[b][l];for(b=0;b<G;b++){for(W[b]=g,S=0,f=b+1,l=b;l<D;l++)S+=Math.pow(A[l][b],2);if(S<s)g=0;else for(w=(y=A[b][b])*(g=y<0?Math.sqrt(S):-Math.sqrt(S))-S,A[b][b]=y-g,l=f;l<G;l++){for(S=0,c=b;c<D;c++)S+=A[c][b]*A[c][l];for(y=S/w,c=b;c<D;c++)A[c][l]=A[c][l]+y*A[c][b]}for(I[b]=g,S=0,l=f;l<G;l++)S+=Math.pow(A[b][l],2);if(S<s)g=0;else{for(w=(y=A[b][b+1])*(g=y<0?Math.sqrt(S):-Math.sqrt(S))-S,A[b][b+1]=y-g,l=f;l<G;l++)W[l]=A[b][l]/w;for(l=f;l<D;l++){for(S=0,c=f;c<G;c++)S+=A[l][c]*A[b][c];for(c=f;c<G;c++)A[l][c]=A[l][c]+S*W[c]}}T<(C=Math.abs(I[b])+Math.abs(W[b]))&&(T=C)}if(r)for(b=G-1;0<=b;b--){if(g!==0){for(w=A[b][b+1]*g,l=f;l<G;l++)q[l][b]=A[b][l]/w;for(l=f;l<G;l++){for(S=0,c=f;c<G;c++)S+=A[b][c]*q[c][l];for(c=f;c<G;c++)q[c][l]=q[c][l]+S*q[c][b]}}for(l=f;l<G;l++)q[b][l]=0,q[l][b]=0;q[b][b]=1,g=W[b],f=b}if(t){if(t==="f")for(b=G;b<D;b++){for(l=G;l<D;l++)A[b][l]=0;A[b][b]=1}for(b=G-1;0<=b;b--){for(f=b+1,g=I[b],l=f;l<E;l++)A[b][l]=0;if(g!==0){for(w=A[b][b]*g,l=f;l<E;l++){for(S=0,c=f;c<D;c++)S+=A[c][b]*A[c][l];for(y=S/w,c=b;c<D;c++)A[c][l]=A[c][l]+y*A[c][b]}for(l=b;l<D;l++)A[l][b]=A[l][b]/g}else for(l=b;l<D;l++)A[l][b]=0;A[b][b]=A[b][b]+1}}for(n*=T,c=G-1;0<=c;c--)for(var z=0;z<50;z++){for(R=!1,f=c;0<=f;f--){if(Math.abs(W[f])<=n){R=!0;break}if(Math.abs(I[f-1])<=n)break}if(!R){for(p=0,h=f-(S=1),b=f;b<c+1&&(y=S*W[b],W[b]=p*W[b],!(Math.abs(y)<=n));b++)if(g=I[b],I[b]=Math.sqrt(y*y+g*g),p=g/(w=I[b]),S=-y/w,t)for(l=0;l<D;l++)C=A[l][h],B=A[l][b],A[l][h]=C*p+B*S,A[l][b]=-C*S+B*p}if(B=I[c],f===c){if(B<0&&(I[c]=-B,r))for(l=0;l<G;l++)q[l][c]=-q[l][c];break}for(T=I[f],y=(((C=I[c-1])-B)*(C+B)+((g=W[c-1])-(w=W[c]))*(g+w))/(2*w*C),g=Math.sqrt(y*y+1),y=((T-B)*(T+B)+w*(C/(y<0?y-g:y+g)-w))/T,b=f+(S=p=1);b<c+1;b++){if(g=W[b],C=I[b],w=S*g,g*=p,B=Math.sqrt(y*y+w*w),y=T*(p=y/(W[b-1]=B))+g*(S=w/B),g=-T*S+g*p,w=C*S,C*=p,r)for(l=0;l<G;l++)T=q[l][b-1],B=q[l][b],q[l][b-1]=T*p+B*S,q[l][b]=-T*S+B*p;if(B=Math.sqrt(y*y+w*w),y=(p=y/(I[b-1]=B))*g+(S=w/B)*C,T=-S*g+p*C,t)for(l=0;l<D;l++)C=A[l][b-1],B=A[l][b],A[l][b-1]=C*p+B*S,A[l][b]=-C*S+B*p}W[f]=0,W[c]=y,I[c]=T}for(b=0;b<G;b++)I[b]<n&&(I[b]=0);return{u:A,q:I,v:q}},i.VERSION="1.1.1",Object.defineProperty(i,"__esModule",{value:!0})})});var Ab=th((Hs,Ya)=>{(function(){var i,e="4.17.20",t=200,r="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",n="Expected a function",s="__lodash_hash_undefined__",l=500,c="__lodash_placeholder__",f=1,h=2,p=4,y=1,g=2,w=1,S=2,T=4,C=8,B=16,G=32,D=64,W=128,A=256,q=512,E=30,b="...",R=800,I=16,z=1,O=2,$=3,he=1/0,re=9007199254740991,Ne=17976931348623157e292,ye=0/0,Me=4294967295,Fe=Me-1,k=Me>>>1,H=[["ary",W],["bind",w],["bindKey",S],["curry",C],["curryRight",B],["flip",q],["partial",G],["partialRight",D],["rearg",A]],_="[object Arguments]",J="[object Array]",ee="[object AsyncFunction]",oe="[object Boolean]",se="[object Date]",ce="[object DOMException]",ue="[object Error]",K="[object Function]",ae="[object GeneratorFunction]",ne="[object Map]",Ce="[object Number]",Y="[object Null]",le="[object Object]",de="[object Promise]",xe="[object Proxy]",_e="[object RegExp]",pe="[object Set]",we="[object String]",Ve="[object Symbol]",Ge="[object Undefined]",Qe="[object WeakMap]",bt="[object WeakSet]",Lt="[object ArrayBuffer]",At="[object DataView]",sr="[object Float32Array]",Ur="[object Float64Array]",Ht="[object Int8Array]",kr="[object Int16Array]",Nn="[object Int32Array]",Cn="[object Uint8Array]",pt="[object Uint8ClampedArray]",Wt="[object Uint16Array]",ar="[object Uint32Array]",Do=/\b__p \+= '';/g,Bo=/\b(__p \+=) '' \+/g,Go=/(__e\(.*?\)|\b__t\)) \+\n'';/g,ro=/&(?:amp|lt|gt|quot|#39);/g,no=/[&<>"']/g,jo=RegExp(ro.source),Mr=RegExp(no.source),io=/<%-([\s\S]+?)%>/g,Jt=/<%([\s\S]+?)%>/g,ni=/<%=([\s\S]+?)%>/g,Eo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Ee=/^\w*$/,Xe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,He=/[\\^$.*+?()[\]{}|]/g,$e=RegExp(He.source),tt=/^\s+|\s+$/g,at=/^\s+/,mt=/\s+$/,gt=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ct=/\{\n\/\* \[wrapped with (.+)\] \*/,St=/,? & /,Rt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Ar=/\\(\\)?/g,Ln=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,_n=/\w*$/,zn=/^[-+]0x[0-9a-f]+$/i,Qa=/^0b[01]+$/i,jb=/^\[object .+?Constructor\]$/,Eb=/^0o[0-7]+$/i,Rb=/^(?:0|[1-9]\d*)$/,zb=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,el=/($^)/,Fb=/['\n\r\u2028\u2029\\]/g,tl="\\ud800-\\udfff",Vb="\\u0300-\\u036f",Ub="\\ufe20-\\ufe2f",kb="\\u20d0-\\u20ff",Hd=Vb+Ub+kb,Wd="\\u2700-\\u27bf",qd="a-z\\xdf-\\xf6\\xf8-\\xff",Hb="\\xac\\xb1\\xd7\\xf7",Wb="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",qb="\\u2000-\\u206f",$b=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",$d="A-Z\\xc0-\\xd6\\xd8-\\xde",Jd="\\ufe0e\\ufe0f",Kd=Hb+Wb+qb+$b,Hu="['\u2019]",Jb="["+tl+"]",Xd="["+Kd+"]",rl="["+Hd+"]",Zd="\\d+",Kb="["+Wd+"]",Yd="["+qd+"]",Qd="[^"+tl+Kd+Zd+Wd+qd+$d+"]",Wu="\\ud83c[\\udffb-\\udfff]",Xb="(?:"+rl+"|"+Wu+")",ep="[^"+tl+"]",qu="(?:\\ud83c[\\udde6-\\uddff]){2}",$u="[\\ud800-\\udbff][\\udc00-\\udfff]",Ro="["+$d+"]",tp="\\u200d",rp="(?:"+Yd+"|"+Qd+")",Zb="(?:"+Ro+"|"+Qd+")",np="(?:"+Hu+"(?:d|ll|m|re|s|t|ve))?",ip="(?:"+Hu+"(?:D|LL|M|RE|S|T|VE))?",op=Xb+"?",sp="["+Jd+"]?",Yb="(?:"+tp+"(?:"+[ep,qu,$u].join("|")+")"+sp+op+")*",Qb="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",eS="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",ap=sp+op+Yb,tS="(?:"+[Kb,qu,$u].join("|")+")"+ap,rS="(?:"+[ep+rl+"?",rl,qu,$u,Jb].join("|")+")",nS=RegExp(Hu,"g"),iS=RegExp(rl,"g"),Ju=RegExp(Wu+"(?="+Wu+")|"+rS+ap,"g"),oS=RegExp([Ro+"?"+Yd+"+"+np+"(?="+[Xd,Ro,"$"].join("|")+")",Zb+"+"+ip+"(?="+[Xd,Ro+rp,"$"].join("|")+")",Ro+"?"+rp+"+"+np,Ro+"+"+ip,eS,Qb,Zd,tS].join("|"),"g"),sS=RegExp("["+tp+tl+Hd+Jd+"]"),aS=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,lS=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],cS=-1,_t={};_t[sr]=_t[Ur]=_t[Ht]=_t[kr]=_t[Nn]=_t[Cn]=_t[pt]=_t[Wt]=_t[ar]=!0,_t[_]=_t[J]=_t[Lt]=_t[oe]=_t[At]=_t[se]=_t[ue]=_t[K]=_t[ne]=_t[Ce]=_t[le]=_t[_e]=_t[pe]=_t[we]=_t[Qe]=!1;var wt={};wt[_]=wt[J]=wt[Lt]=wt[At]=wt[oe]=wt[se]=wt[sr]=wt[Ur]=wt[Ht]=wt[kr]=wt[Nn]=wt[ne]=wt[Ce]=wt[le]=wt[_e]=wt[pe]=wt[we]=wt[Ve]=wt[Cn]=wt[pt]=wt[Wt]=wt[ar]=!0,wt[ue]=wt[K]=wt[Qe]=!1;var uS={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},fS={"&":"&","<":"<",">":">",'"':""","'":"'"},hS={"&":"&","<":"<",">":">",""":'"',"'":"'"},dS={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},pS=parseFloat,mS=parseInt,lp=typeof global=="object"&&global&&global.Object===Object&&global,gS=typeof self=="object"&&self&&self.Object===Object&&self,rr=lp||gS||Function("return this")(),Ku=typeof Hs=="object"&&Hs&&!Hs.nodeType&&Hs,oo=Ku&&typeof Ya=="object"&&Ya&&!Ya.nodeType&&Ya,cp=oo&&oo.exports===Ku,Xu=cp&&lp.process,on=function(){try{var P=oo&&oo.require&&oo.require("util").types;return P||Xu&&Xu.binding&&Xu.binding("util")}catch(X){}}(),up=on&&on.isArrayBuffer,fp=on&&on.isDate,hp=on&&on.isMap,dp=on&&on.isRegExp,pp=on&&on.isSet,mp=on&&on.isTypedArray;function Hr(P,X,V){switch(V.length){case 0:return P.call(X);case 1:return P.call(X,V[0]);case 2:return P.call(X,V[0],V[1]);case 3:return P.call(X,V[0],V[1],V[2])}return P.apply(X,V)}function yS(P,X,V,be){for(var Ue=-1,lt=P==null?0:P.length;++Ue<lt;){var Kt=P[Ue];X(be,Kt,V(Kt),P)}return be}function sn(P,X){for(var V=-1,be=P==null?0:P.length;++V<be&&X(P[V],V,P)!==!1;);return P}function xS(P,X){for(var V=P==null?0:P.length;V--&&X(P[V],V,P)!==!1;);return P}function gp(P,X){for(var V=-1,be=P==null?0:P.length;++V<be;)if(!X(P[V],V,P))return!1;return!0}function _i(P,X){for(var V=-1,be=P==null?0:P.length,Ue=0,lt=[];++V<be;){var Kt=P[V];X(Kt,V,P)&&(lt[Ue++]=Kt)}return lt}function nl(P,X){var V=P==null?0:P.length;return!!V&&zo(P,X,0)>-1}function Zu(P,X,V){for(var be=-1,Ue=P==null?0:P.length;++be<Ue;)if(V(X,P[be]))return!0;return!1}function Ot(P,X){for(var V=-1,be=P==null?0:P.length,Ue=Array(be);++V<be;)Ue[V]=X(P[V],V,P);return Ue}function Ti(P,X){for(var V=-1,be=X.length,Ue=P.length;++V<be;)P[Ue+V]=X[V];return P}function Yu(P,X,V,be){var Ue=-1,lt=P==null?0:P.length;for(be&<&&(V=P[++Ue]);++Ue<lt;)V=X(V,P[Ue],Ue,P);return V}function vS(P,X,V,be){var Ue=P==null?0:P.length;for(be&&Ue&&(V=P[--Ue]);Ue--;)V=X(V,P[Ue],Ue,P);return V}function Qu(P,X){for(var V=-1,be=P==null?0:P.length;++V<be;)if(X(P[V],V,P))return!0;return!1}var bS=ef("length");function SS(P){return P.split("")}function wS(P){return P.match(Rt)||[]}function yp(P,X,V){var be;return V(P,function(Ue,lt,Kt){if(X(Ue,lt,Kt))return be=lt,!1}),be}function il(P,X,V,be){for(var Ue=P.length,lt=V+(be?1:-1);be?lt--:++lt<Ue;)if(X(P[lt],lt,P))return lt;return-1}function zo(P,X,V){return X===X?BS(P,X,V):il(P,xp,V)}function NS(P,X,V,be){for(var Ue=V-1,lt=P.length;++Ue<lt;)if(be(P[Ue],X))return Ue;return-1}function xp(P){return P!==P}function vp(P,X){var V=P==null?0:P.length;return V?rf(P,X)/V:ye}function ef(P){return function(X){return X==null?i:X[P]}}function tf(P){return function(X){return P==null?i:P[X]}}function bp(P,X,V,be,Ue){return Ue(P,function(lt,Kt,yt){V=be?(be=!1,lt):X(V,lt,Kt,yt)}),V}function CS(P,X){var V=P.length;for(P.sort(X);V--;)P[V]=P[V].value;return P}function rf(P,X){for(var V,be=-1,Ue=P.length;++be<Ue;){var lt=X(P[be]);lt!==i&&(V=V===i?lt:V+lt)}return V}function nf(P,X){for(var V=-1,be=Array(P);++V<P;)be[V]=X(V);return be}function LS(P,X){return Ot(X,function(V){return[V,P[V]]})}function Wr(P){return function(X){return P(X)}}function of(P,X){return Ot(X,function(V){return P[V]})}function Ws(P,X){return P.has(X)}function Sp(P,X){for(var V=-1,be=P.length;++V<be&&zo(X,P[V],0)>-1;);return V}function wp(P,X){for(var V=P.length;V--&&zo(X,P[V],0)>-1;);return V}function _S(P,X){for(var V=P.length,be=0;V--;)P[V]===X&&++be;return be}var TS=tf(uS),IS=tf(fS);function MS(P){return"\\"+dS[P]}function AS(P,X){return P==null?i:P[X]}function Fo(P){return sS.test(P)}function OS(P){return aS.test(P)}function PS(P){for(var X,V=[];!(X=P.next()).done;)V.push(X.value);return V}function sf(P){var X=-1,V=Array(P.size);return P.forEach(function(be,Ue){V[++X]=[Ue,be]}),V}function Np(P,X){return function(V){return P(X(V))}}function Ii(P,X){for(var V=-1,be=P.length,Ue=0,lt=[];++V<be;){var Kt=P[V];(Kt===X||Kt===c)&&(P[V]=c,lt[Ue++]=V)}return lt}function ol(P){var X=-1,V=Array(P.size);return P.forEach(function(be){V[++X]=be}),V}function DS(P){var X=-1,V=Array(P.size);return P.forEach(function(be){V[++X]=[be,be]}),V}function BS(P,X,V){for(var be=V-1,Ue=P.length;++be<Ue;)if(P[be]===X)return be;return-1}function GS(P,X,V){for(var be=V+1;be--;)if(P[be]===X)return be;return be}function Vo(P){return Fo(P)?ES(P):bS(P)}function Tn(P){return Fo(P)?RS(P):SS(P)}var jS=tf(hS);function ES(P){for(var X=Ju.lastIndex=0;Ju.test(P);)++X;return X}function RS(P){return P.match(Ju)||[]}function zS(P){return P.match(oS)||[]}var FS=function P(X){X=X==null?rr:Mi.defaults(rr.Object(),X,Mi.pick(rr,lS));var V=X.Array,be=X.Date,Ue=X.Error,lt=X.Function,Kt=X.Math,yt=X.Object,af=X.RegExp,VS=X.String,an=X.TypeError,sl=V.prototype,US=lt.prototype,Uo=yt.prototype,al=X["__core-js_shared__"],ll=US.toString,dt=Uo.hasOwnProperty,kS=0,Cp=function(){var o=/[^.]+$/.exec(al&&al.keys&&al.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),cl=Uo.toString,HS=ll.call(yt),WS=rr._,qS=af("^"+ll.call(dt).replace(He,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ul=cp?X.Buffer:i,Ai=X.Symbol,fl=X.Uint8Array,Lp=ul?ul.allocUnsafe:i,hl=Np(yt.getPrototypeOf,yt),_p=yt.create,Tp=Uo.propertyIsEnumerable,dl=sl.splice,Ip=Ai?Ai.isConcatSpreadable:i,qs=Ai?Ai.iterator:i,so=Ai?Ai.toStringTag:i,pl=function(){try{var o=fo(yt,"defineProperty");return o({},"",{}),o}catch(a){}}(),$S=X.clearTimeout!==rr.clearTimeout&&X.clearTimeout,JS=be&&be.now!==rr.Date.now&&be.now,KS=X.setTimeout!==rr.setTimeout&&X.setTimeout,ml=Kt.ceil,gl=Kt.floor,lf=yt.getOwnPropertySymbols,XS=ul?ul.isBuffer:i,Mp=X.isFinite,ZS=sl.join,YS=Np(yt.keys,yt),Xt=Kt.max,pr=Kt.min,QS=be.now,ew=X.parseInt,Ap=Kt.random,tw=sl.reverse,cf=fo(X,"DataView"),$s=fo(X,"Map"),uf=fo(X,"Promise"),ko=fo(X,"Set"),Js=fo(X,"WeakMap"),Ks=fo(yt,"create"),yl=Js&&new Js,Ho={},rw=ho(cf),nw=ho($s),iw=ho(uf),ow=ho(ko),sw=ho(Js),xl=Ai?Ai.prototype:i,Xs=xl?xl.valueOf:i,Op=xl?xl.toString:i;function x(o){if(Gt(o)&&!ke(o)&&!(o instanceof rt)){if(o instanceof ln)return o;if(dt.call(o,"__wrapped__"))return Pm(o)}return new ln(o)}var Wo=function(){function o(){}return function(a){if(!Dt(a))return{};if(_p)return _p(a);o.prototype=a;var u=new o;return o.prototype=i,u}}();function vl(){}function ln(o,a){this.__wrapped__=o,this.__actions__=[],this.__chain__=!!a,this.__index__=0,this.__values__=i}x.templateSettings={escape:io,evaluate:Jt,interpolate:ni,variable:"",imports:{_:x}},x.prototype=vl.prototype,x.prototype.constructor=x,ln.prototype=Wo(vl.prototype),ln.prototype.constructor=ln;function rt(o){this.__wrapped__=o,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Me,this.__views__=[]}function aw(){var o=new rt(this.__wrapped__);return o.__actions__=Or(this.__actions__),o.__dir__=this.__dir__,o.__filtered__=this.__filtered__,o.__iteratees__=Or(this.__iteratees__),o.__takeCount__=this.__takeCount__,o.__views__=Or(this.__views__),o}function lw(){if(this.__filtered__){var o=new rt(this);o.__dir__=-1,o.__filtered__=!0}else o=this.clone(),o.__dir__*=-1;return o}function cw(){var o=this.__wrapped__.value(),a=this.__dir__,u=ke(o),d=a<0,m=u?o.length:0,v=S1(0,m,this.__views__),N=v.start,L=v.end,M=L-N,Q=d?L:N-1,te=this.__iteratees__,ie=te.length,me=0,Le=pr(M,this.__takeCount__);if(!u||!d&&m==M&&Le==M)return tm(o,this.__actions__);var Re=[];e:for(;M--&&me<Le;){Q+=a;for(var Je=-1,je=o[Q];++Je<ie;){var et=te[Je],nt=et.iteratee,Jr=et.type,wr=nt(je);if(Jr==O)je=wr;else if(!wr){if(Jr==z)continue e;break e}}Re[me++]=je}return Re}rt.prototype=Wo(vl.prototype),rt.prototype.constructor=rt;function ao(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var d=o[a];this.set(d[0],d[1])}}function uw(){this.__data__=Ks?Ks(null):{},this.size=0}function fw(o){var a=this.has(o)&&delete this.__data__[o];return this.size-=a?1:0,a}function hw(o){var a=this.__data__;if(Ks){var u=a[o];return u===s?i:u}return dt.call(a,o)?a[o]:i}function dw(o){var a=this.__data__;return Ks?a[o]!==i:dt.call(a,o)}function pw(o,a){var u=this.__data__;return this.size+=this.has(o)?0:1,u[o]=Ks&&a===i?s:a,this}ao.prototype.clear=uw,ao.prototype.delete=fw,ao.prototype.get=hw,ao.prototype.has=dw,ao.prototype.set=pw;function ii(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var d=o[a];this.set(d[0],d[1])}}function mw(){this.__data__=[],this.size=0}function gw(o){var a=this.__data__,u=bl(a,o);if(u<0)return!1;var d=a.length-1;return u==d?a.pop():dl.call(a,u,1),--this.size,!0}function yw(o){var a=this.__data__,u=bl(a,o);return u<0?i:a[u][1]}function xw(o){return bl(this.__data__,o)>-1}function vw(o,a){var u=this.__data__,d=bl(u,o);return d<0?(++this.size,u.push([o,a])):u[d][1]=a,this}ii.prototype.clear=mw,ii.prototype.delete=gw,ii.prototype.get=yw,ii.prototype.has=xw,ii.prototype.set=vw;function oi(o){var a=-1,u=o==null?0:o.length;for(this.clear();++a<u;){var d=o[a];this.set(d[0],d[1])}}function bw(){this.size=0,this.__data__={hash:new ao,map:new($s||ii),string:new ao}}function Sw(o){var a=Pl(this,o).delete(o);return this.size-=a?1:0,a}function ww(o){return Pl(this,o).get(o)}function Nw(o){return Pl(this,o).has(o)}function Cw(o,a){var u=Pl(this,o),d=u.size;return u.set(o,a),this.size+=u.size==d?0:1,this}oi.prototype.clear=bw,oi.prototype.delete=Sw,oi.prototype.get=ww,oi.prototype.has=Nw,oi.prototype.set=Cw;function lo(o){var a=-1,u=o==null?0:o.length;for(this.__data__=new oi;++a<u;)this.add(o[a])}function Lw(o){return this.__data__.set(o,s),this}function _w(o){return this.__data__.has(o)}lo.prototype.add=lo.prototype.push=Lw,lo.prototype.has=_w;function In(o){var a=this.__data__=new ii(o);this.size=a.size}function Tw(){this.__data__=new ii,this.size=0}function Iw(o){var a=this.__data__,u=a.delete(o);return this.size=a.size,u}function Mw(o){return this.__data__.get(o)}function Aw(o){return this.__data__.has(o)}function Ow(o,a){var u=this.__data__;if(u instanceof ii){var d=u.__data__;if(!$s||d.length<t-1)return d.push([o,a]),this.size=++u.size,this;u=this.__data__=new oi(d)}return u.set(o,a),this.size=u.size,this}In.prototype.clear=Tw,In.prototype.delete=Iw,In.prototype.get=Mw,In.prototype.has=Aw,In.prototype.set=Ow;function Pp(o,a){var u=ke(o),d=!u&&po(o),m=!u&&!d&&Gi(o),v=!u&&!d&&!m&&Ko(o),N=u||d||m||v,L=N?nf(o.length,VS):[],M=L.length;for(var Q in o)(a||dt.call(o,Q))&&!(N&&(Q=="length"||m&&(Q=="offset"||Q=="parent")||v&&(Q=="buffer"||Q=="byteLength"||Q=="byteOffset")||ci(Q,M)))&&L.push(Q);return L}function Dp(o){var a=o.length;return a?o[Sf(0,a-1)]:i}function Pw(o,a){return Dl(Or(o),co(a,0,o.length))}function Dw(o){return Dl(Or(o))}function ff(o,a,u){(u!==i&&!Mn(o[a],u)||u===i&&!(a in o))&&si(o,a,u)}function Zs(o,a,u){var d=o[a];(!(dt.call(o,a)&&Mn(d,u))||u===i&&!(a in o))&&si(o,a,u)}function bl(o,a){for(var u=o.length;u--;)if(Mn(o[u][0],a))return u;return-1}function Bw(o,a,u,d){return Oi(o,function(m,v,N){a(d,m,u(m),N)}),d}function Bp(o,a){return o&&Vn(a,nr(a),o)}function Gw(o,a){return o&&Vn(a,Dr(a),o)}function si(o,a,u){a=="__proto__"&&pl?pl(o,a,{configurable:!0,enumerable:!0,value:u,writable:!0}):o[a]=u}function hf(o,a){for(var u=-1,d=a.length,m=V(d),v=o==null;++u<d;)m[u]=v?i:qf(o,a[u]);return m}function co(o,a,u){return o===o&&(u!==i&&(o=o<=u?o:u),a!==i&&(o=o>=a?o:a)),o}function cn(o,a,u,d,m,v){var N,L=a&f,M=a&h,Q=a&p;if(u&&(N=m?u(o,d,m,v):u(o)),N!==i)return N;if(!Dt(o))return o;var te=ke(o);if(te){if(N=N1(o),!L)return Or(o,N)}else{var ie=mr(o),me=ie==K||ie==ae;if(Gi(o))return im(o,L);if(ie==le||ie==_||me&&!m){if(N=M||me?{}:Nm(o),!L)return M?h1(o,Gw(N,o)):f1(o,Bp(N,o))}else{if(!wt[ie])return m?o:{};N=C1(o,ie,L)}}v||(v=new In);var Le=v.get(o);if(Le)return Le;v.set(o,N),Ym(o)?o.forEach(function(je){N.add(cn(je,a,u,je,o,v))}):Xm(o)&&o.forEach(function(je,et){N.set(et,cn(je,a,u,et,o,v))});var Re=Q?M?Pf:Of:M?Dr:nr,Je=te?i:Re(o);return sn(Je||o,function(je,et){Je&&(et=je,je=o[et]),Zs(N,et,cn(je,a,u,et,o,v))}),N}function jw(o){var a=nr(o);return function(u){return Gp(u,o,a)}}function Gp(o,a,u){var d=u.length;if(o==null)return!d;for(o=yt(o);d--;){var m=u[d],v=a[m],N=o[m];if(N===i&&!(m in o)||!v(N))return!1}return!0}function jp(o,a,u){if(typeof o!="function")throw new an(n);return ia(function(){o.apply(i,u)},a)}function Ys(o,a,u,d){var m=-1,v=nl,N=!0,L=o.length,M=[],Q=a.length;if(!L)return M;u&&(a=Ot(a,Wr(u))),d?(v=Zu,N=!1):a.length>=t&&(v=Ws,N=!1,a=new lo(a));e:for(;++m<L;){var te=o[m],ie=u==null?te:u(te);if(te=d||te!==0?te:0,N&&ie===ie){for(var me=Q;me--;)if(a[me]===ie)continue e;M.push(te)}else v(a,ie,d)||M.push(te)}return M}var Oi=cm(Fn),Ep=cm(pf,!0);function Ew(o,a){var u=!0;return Oi(o,function(d,m,v){return u=!!a(d,m,v),u}),u}function Sl(o,a,u){for(var d=-1,m=o.length;++d<m;){var v=o[d],N=a(v);if(N!=null&&(L===i?N===N&&!$r(N):u(N,L)))var L=N,M=v}return M}function Rw(o,a,u,d){var m=o.length;for(u=We(u),u<0&&(u=-u>m?0:m+u),d=d===i||d>m?m:We(d),d<0&&(d+=m),d=u>d?0:eg(d);u<d;)o[u++]=a;return o}function Rp(o,a){var u=[];return Oi(o,function(d,m,v){a(d,m,v)&&u.push(d)}),u}function lr(o,a,u,d,m){var v=-1,N=o.length;for(u||(u=_1),m||(m=[]);++v<N;){var L=o[v];a>0&&u(L)?a>1?lr(L,a-1,u,d,m):Ti(m,L):d||(m[m.length]=L)}return m}var df=um(),zp=um(!0);function Fn(o,a){return o&&df(o,a,nr)}function pf(o,a){return o&&zp(o,a,nr)}function wl(o,a){return _i(a,function(u){return ui(o[u])})}function uo(o,a){a=Di(a,o);for(var u=0,d=a.length;o!=null&&u<d;)o=o[Un(a[u++])];return u&&u==d?o:i}function Fp(o,a,u){var d=a(o);return ke(o)?d:Ti(d,u(o))}function br(o){return o==null?o===i?Ge:Y:so&&so in yt(o)?b1(o):D1(o)}function mf(o,a){return o>a}function zw(o,a){return o!=null&&dt.call(o,a)}function Fw(o,a){return o!=null&&a in yt(o)}function Vw(o,a,u){return o>=pr(a,u)&&o<Xt(a,u)}function gf(o,a,u){for(var d=u?Zu:nl,m=o[0].length,v=o.length,N=v,L=V(v),M=1/0,Q=[];N--;){var te=o[N];N&&a&&(te=Ot(te,Wr(a))),M=pr(te.length,M),L[N]=!u&&(a||m>=120&&te.length>=120)?new lo(N&&te):i}te=o[0];var ie=-1,me=L[0];e:for(;++ie<m&&Q.length<M;){var Le=te[ie],Re=a?a(Le):Le;if(Le=u||Le!==0?Le:0,!(me?Ws(me,Re):d(Q,Re,u))){for(N=v;--N;){var Je=L[N];if(!(Je?Ws(Je,Re):d(o[N],Re,u)))continue e}me&&me.push(Re),Q.push(Le)}}return Q}function Uw(o,a,u,d){return Fn(o,function(m,v,N){a(d,u(m),v,N)}),d}function Qs(o,a,u){a=Di(a,o),o=Tm(o,a);var d=o==null?o:o[Un(fn(a))];return d==null?i:Hr(d,o,u)}function Vp(o){return Gt(o)&&br(o)==_}function kw(o){return Gt(o)&&br(o)==Lt}function Hw(o){return Gt(o)&&br(o)==se}function ea(o,a,u,d,m){return o===a?!0:o==null||a==null||!Gt(o)&&!Gt(a)?o!==o&&a!==a:Ww(o,a,u,d,ea,m)}function Ww(o,a,u,d,m,v){var N=ke(o),L=ke(a),M=N?J:mr(o),Q=L?J:mr(a);M=M==_?le:M,Q=Q==_?le:Q;var te=M==le,ie=Q==le,me=M==Q;if(me&&Gi(o)){if(!Gi(a))return!1;N=!0,te=!1}if(me&&!te)return v||(v=new In),N||Ko(o)?bm(o,a,u,d,m,v):x1(o,a,M,u,d,m,v);if(!(u&y)){var Le=te&&dt.call(o,"__wrapped__"),Re=ie&&dt.call(a,"__wrapped__");if(Le||Re){var Je=Le?o.value():o,je=Re?a.value():a;return v||(v=new In),m(Je,je,u,d,v)}}return me?(v||(v=new In),v1(o,a,u,d,m,v)):!1}function qw(o){return Gt(o)&&mr(o)==ne}function yf(o,a,u,d){var m=u.length,v=m,N=!d;if(o==null)return!v;for(o=yt(o);m--;){var L=u[m];if(N&&L[2]?L[1]!==o[L[0]]:!(L[0]in o))return!1}for(;++m<v;){L=u[m];var M=L[0],Q=o[M],te=L[1];if(N&&L[2]){if(Q===i&&!(M in o))return!1}else{var ie=new In;if(d)var me=d(Q,te,M,o,a,ie);if(!(me===i?ea(te,Q,y|g,d,ie):me))return!1}}return!0}function Up(o){if(!Dt(o)||I1(o))return!1;var a=ui(o)?qS:jb;return a.test(ho(o))}function $w(o){return Gt(o)&&br(o)==_e}function Jw(o){return Gt(o)&&mr(o)==pe}function Kw(o){return Gt(o)&&zl(o.length)&&!!_t[br(o)]}function kp(o){return typeof o=="function"?o:o==null?Br:typeof o=="object"?ke(o)?qp(o[0],o[1]):Wp(o):fg(o)}function xf(o){if(!na(o))return YS(o);var a=[];for(var u in yt(o))dt.call(o,u)&&u!="constructor"&&a.push(u);return a}function Xw(o){if(!Dt(o))return P1(o);var a=na(o),u=[];for(var d in o)d=="constructor"&&(a||!dt.call(o,d))||u.push(d);return u}function vf(o,a){return o<a}function Hp(o,a){var u=-1,d=Pr(o)?V(o.length):[];return Oi(o,function(m,v,N){d[++u]=a(m,v,N)}),d}function Wp(o){var a=Bf(o);return a.length==1&&a[0][2]?Lm(a[0][0],a[0][1]):function(u){return u===o||yf(u,o,a)}}function qp(o,a){return jf(o)&&Cm(a)?Lm(Un(o),a):function(u){var d=qf(u,o);return d===i&&d===a?$f(u,o):ea(a,d,y|g)}}function Nl(o,a,u,d,m){o!==a&&df(a,function(v,N){if(m||(m=new In),Dt(v))Zw(o,a,N,u,Nl,d,m);else{var L=d?d(Rf(o,N),v,N+"",o,a,m):i;L===i&&(L=v),ff(o,N,L)}},Dr)}function Zw(o,a,u,d,m,v,N){var L=Rf(o,u),M=Rf(a,u),Q=N.get(M);if(Q){ff(o,u,Q);return}var te=v?v(L,M,u+"",o,a,N):i,ie=te===i;if(ie){var me=ke(M),Le=!me&&Gi(M),Re=!me&&!Le&&Ko(M);te=M,me||Le||Re?ke(L)?te=L:zt(L)?te=Or(L):Le?(ie=!1,te=im(M,!0)):Re?(ie=!1,te=om(M,!0)):te=[]:oa(M)||po(M)?(te=L,po(L)?te=tg(L):(!Dt(L)||ui(L))&&(te=Nm(M))):ie=!1}ie&&(N.set(M,te),m(te,M,d,v,N),N.delete(M)),ff(o,u,te)}function $p(o,a){var u=o.length;if(!!u)return a+=a<0?u:0,ci(a,u)?o[a]:i}function Jp(o,a,u){a.length?a=Ot(a,function(v){return ke(v)?function(N){return uo(N,v.length===1?v[0]:v)}:v}):a=[Br];var d=-1;a=Ot(a,Wr(De()));var m=Hp(o,function(v,N,L){var M=Ot(a,function(Q){return Q(v)});return{criteria:M,index:++d,value:v}});return CS(m,function(v,N){return u1(v,N,u)})}function Yw(o,a){return Kp(o,a,function(u,d){return $f(o,d)})}function Kp(o,a,u){for(var d=-1,m=a.length,v={};++d<m;){var N=a[d],L=uo(o,N);u(L,N)&&ta(v,Di(N,o),L)}return v}function Qw(o){return function(a){return uo(a,o)}}function bf(o,a,u,d){var m=d?NS:zo,v=-1,N=a.length,L=o;for(o===a&&(a=Or(a)),u&&(L=Ot(o,Wr(u)));++v<N;)for(var M=0,Q=a[v],te=u?u(Q):Q;(M=m(L,te,M,d))>-1;)L!==o&&dl.call(L,M,1),dl.call(o,M,1);return o}function Xp(o,a){for(var u=o?a.length:0,d=u-1;u--;){var m=a[u];if(u==d||m!==v){var v=m;ci(m)?dl.call(o,m,1):Cf(o,m)}}return o}function Sf(o,a){return o+gl(Ap()*(a-o+1))}function e1(o,a,u,d){for(var m=-1,v=Xt(ml((a-o)/(u||1)),0),N=V(v);v--;)N[d?v:++m]=o,o+=u;return N}function wf(o,a){var u="";if(!o||a<1||a>re)return u;do a%2&&(u+=o),a=gl(a/2),a&&(o+=o);while(a);return u}function Ze(o,a){return zf(_m(o,a,Br),o+"")}function t1(o){return Dp(Xo(o))}function r1(o,a){var u=Xo(o);return Dl(u,co(a,0,u.length))}function ta(o,a,u,d){if(!Dt(o))return o;a=Di(a,o);for(var m=-1,v=a.length,N=v-1,L=o;L!=null&&++m<v;){var M=Un(a[m]),Q=u;if(M==="__proto__"||M==="constructor"||M==="prototype")return o;if(m!=N){var te=L[M];Q=d?d(te,M,L):i,Q===i&&(Q=Dt(te)?te:ci(a[m+1])?[]:{})}Zs(L,M,Q),L=L[M]}return o}var Zp=yl?function(o,a){return yl.set(o,a),o}:Br,n1=pl?function(o,a){return pl(o,"toString",{configurable:!0,enumerable:!1,value:Kf(a),writable:!0})}:Br;function i1(o){return Dl(Xo(o))}function un(o,a,u){var d=-1,m=o.length;a<0&&(a=-a>m?0:m+a),u=u>m?m:u,u<0&&(u+=m),m=a>u?0:u-a>>>0,a>>>=0;for(var v=V(m);++d<m;)v[d]=o[d+a];return v}function o1(o,a){var u;return Oi(o,function(d,m,v){return u=a(d,m,v),!u}),!!u}function Cl(o,a,u){var d=0,m=o==null?d:o.length;if(typeof a=="number"&&a===a&&m<=k){for(;d<m;){var v=d+m>>>1,N=o[v];N!==null&&!$r(N)&&(u?N<=a:N<a)?d=v+1:m=v}return m}return Nf(o,a,Br,u)}function Nf(o,a,u,d){var m=0,v=o==null?0:o.length;if(v===0)return 0;a=u(a);for(var N=a!==a,L=a===null,M=$r(a),Q=a===i;m<v;){var te=gl((m+v)/2),ie=u(o[te]),me=ie!==i,Le=ie===null,Re=ie===ie,Je=$r(ie);if(N)var je=d||Re;else Q?je=Re&&(d||me):L?je=Re&&me&&(d||!Le):M?je=Re&&me&&!Le&&(d||!Je):Le||Je?je=!1:je=d?ie<=a:ie<a;je?m=te+1:v=te}return pr(v,Fe)}function Yp(o,a){for(var u=-1,d=o.length,m=0,v=[];++u<d;){var N=o[u],L=a?a(N):N;if(!u||!Mn(L,M)){var M=L;v[m++]=N===0?0:N}}return v}function Qp(o){return typeof o=="number"?o:$r(o)?ye:+o}function qr(o){if(typeof o=="string")return o;if(ke(o))return Ot(o,qr)+"";if($r(o))return Op?Op.call(o):"";var a=o+"";return a=="0"&&1/o==-he?"-0":a}function Pi(o,a,u){var d=-1,m=nl,v=o.length,N=!0,L=[],M=L;if(u)N=!1,m=Zu;else if(v>=t){var Q=a?null:g1(o);if(Q)return ol(Q);N=!1,m=Ws,M=new lo}else M=a?[]:L;e:for(;++d<v;){var te=o[d],ie=a?a(te):te;if(te=u||te!==0?te:0,N&&ie===ie){for(var me=M.length;me--;)if(M[me]===ie)continue e;a&&M.push(ie),L.push(te)}else m(M,ie,u)||(M!==L&&M.push(ie),L.push(te))}return L}function Cf(o,a){return a=Di(a,o),o=Tm(o,a),o==null||delete o[Un(fn(a))]}function em(o,a,u,d){return ta(o,a,u(uo(o,a)),d)}function Ll(o,a,u,d){for(var m=o.length,v=d?m:-1;(d?v--:++v<m)&&a(o[v],v,o););return u?un(o,d?0:v,d?v+1:m):un(o,d?v+1:0,d?m:v)}function tm(o,a){var u=o;return u instanceof rt&&(u=u.value()),Yu(a,function(d,m){return m.func.apply(m.thisArg,Ti([d],m.args))},u)}function Lf(o,a,u){var d=o.length;if(d<2)return d?Pi(o[0]):[];for(var m=-1,v=V(d);++m<d;)for(var N=o[m],L=-1;++L<d;)L!=m&&(v[m]=Ys(v[m]||N,o[L],a,u));return Pi(lr(v,1),a,u)}function rm(o,a,u){for(var d=-1,m=o.length,v=a.length,N={};++d<m;){var L=d<v?a[d]:i;u(N,o[d],L)}return N}function _f(o){return zt(o)?o:[]}function Tf(o){return typeof o=="function"?o:Br}function Di(o,a){return ke(o)?o:jf(o,a)?[o]:Om(ut(o))}var s1=Ze;function Bi(o,a,u){var d=o.length;return u=u===i?d:u,!a&&u>=d?o:un(o,a,u)}var nm=$S||function(o){return rr.clearTimeout(o)};function im(o,a){if(a)return o.slice();var u=o.length,d=Lp?Lp(u):new o.constructor(u);return o.copy(d),d}function If(o){var a=new o.constructor(o.byteLength);return new fl(a).set(new fl(o)),a}function a1(o,a){var u=a?If(o.buffer):o.buffer;return new o.constructor(u,o.byteOffset,o.byteLength)}function l1(o){var a=new o.constructor(o.source,_n.exec(o));return a.lastIndex=o.lastIndex,a}function c1(o){return Xs?yt(Xs.call(o)):{}}function om(o,a){var u=a?If(o.buffer):o.buffer;return new o.constructor(u,o.byteOffset,o.length)}function sm(o,a){if(o!==a){var u=o!==i,d=o===null,m=o===o,v=$r(o),N=a!==i,L=a===null,M=a===a,Q=$r(a);if(!L&&!Q&&!v&&o>a||v&&N&&M&&!L&&!Q||d&&N&&M||!u&&M||!m)return 1;if(!d&&!v&&!Q&&o<a||Q&&u&&m&&!d&&!v||L&&u&&m||!N&&m||!M)return-1}return 0}function u1(o,a,u){for(var d=-1,m=o.criteria,v=a.criteria,N=m.length,L=u.length;++d<N;){var M=sm(m[d],v[d]);if(M){if(d>=L)return M;var Q=u[d];return M*(Q=="desc"?-1:1)}}return o.index-a.index}function am(o,a,u,d){for(var m=-1,v=o.length,N=u.length,L=-1,M=a.length,Q=Xt(v-N,0),te=V(M+Q),ie=!d;++L<M;)te[L]=a[L];for(;++m<N;)(ie||m<v)&&(te[u[m]]=o[m]);for(;Q--;)te[L++]=o[m++];return te}function lm(o,a,u,d){for(var m=-1,v=o.length,N=-1,L=u.length,M=-1,Q=a.length,te=Xt(v-L,0),ie=V(te+Q),me=!d;++m<te;)ie[m]=o[m];for(var Le=m;++M<Q;)ie[Le+M]=a[M];for(;++N<L;)(me||m<v)&&(ie[Le+u[N]]=o[m++]);return ie}function Or(o,a){var u=-1,d=o.length;for(a||(a=V(d));++u<d;)a[u]=o[u];return a}function Vn(o,a,u,d){var m=!u;u||(u={});for(var v=-1,N=a.length;++v<N;){var L=a[v],M=d?d(u[L],o[L],L,u,o):i;M===i&&(M=o[L]),m?si(u,L,M):Zs(u,L,M)}return u}function f1(o,a){return Vn(o,Gf(o),a)}function h1(o,a){return Vn(o,Sm(o),a)}function _l(o,a){return function(u,d){var m=ke(u)?yS:Bw,v=a?a():{};return m(u,o,De(d,2),v)}}function qo(o){return Ze(function(a,u){var d=-1,m=u.length,v=m>1?u[m-1]:i,N=m>2?u[2]:i;for(v=o.length>3&&typeof v=="function"?(m--,v):i,N&&Sr(u[0],u[1],N)&&(v=m<3?i:v,m=1),a=yt(a);++d<m;){var L=u[d];L&&o(a,L,d,v)}return a})}function cm(o,a){return function(u,d){if(u==null)return u;if(!Pr(u))return o(u,d);for(var m=u.length,v=a?m:-1,N=yt(u);(a?v--:++v<m)&&d(N[v],v,N)!==!1;);return u}}function um(o){return function(a,u,d){for(var m=-1,v=yt(a),N=d(a),L=N.length;L--;){var M=N[o?L:++m];if(u(v[M],M,v)===!1)break}return a}}function d1(o,a,u){var d=a&w,m=ra(o);function v(){var N=this&&this!==rr&&this instanceof v?m:o;return N.apply(d?u:this,arguments)}return v}function fm(o){return function(a){a=ut(a);var u=Fo(a)?Tn(a):i,d=u?u[0]:a.charAt(0),m=u?Bi(u,1).join(""):a.slice(1);return d[o]()+m}}function $o(o){return function(a){return Yu(cg(lg(a).replace(nS,"")),o,"")}}function ra(o){return function(){var a=arguments;switch(a.length){case 0:return new o;case 1:return new o(a[0]);case 2:return new o(a[0],a[1]);case 3:return new o(a[0],a[1],a[2]);case 4:return new o(a[0],a[1],a[2],a[3]);case 5:return new o(a[0],a[1],a[2],a[3],a[4]);case 6:return new o(a[0],a[1],a[2],a[3],a[4],a[5]);case 7:return new o(a[0],a[1],a[2],a[3],a[4],a[5],a[6])}var u=Wo(o.prototype),d=o.apply(u,a);return Dt(d)?d:u}}function p1(o,a,u){var d=ra(o);function m(){for(var v=arguments.length,N=V(v),L=v,M=Jo(m);L--;)N[L]=arguments[L];var Q=v<3&&N[0]!==M&&N[v-1]!==M?[]:Ii(N,M);if(v-=Q.length,v<u)return gm(o,a,Tl,m.placeholder,i,N,Q,i,i,u-v);var te=this&&this!==rr&&this instanceof m?d:o;return Hr(te,this,N)}return m}function hm(o){return function(a,u,d){var m=yt(a);if(!Pr(a)){var v=De(u,3);a=nr(a),u=function(L){return v(m[L],L,m)}}var N=o(a,u,d);return N>-1?m[v?a[N]:N]:i}}function dm(o){return li(function(a){var u=a.length,d=u,m=ln.prototype.thru;for(o&&a.reverse();d--;){var v=a[d];if(typeof v!="function")throw new an(n);if(m&&!N&&Ol(v)=="wrapper")var N=new ln([],!0)}for(d=N?d:u;++d<u;){v=a[d];var L=Ol(v),M=L=="wrapper"?Df(v):i;M&&Ef(M[0])&&M[1]==(W|C|G|A)&&!M[4].length&&M[9]==1?N=N[Ol(M[0])].apply(N,M[3]):N=v.length==1&&Ef(v)?N[L]():N.thru(v)}return function(){var Q=arguments,te=Q[0];if(N&&Q.length==1&&ke(te))return N.plant(te).value();for(var ie=0,me=u?a[ie].apply(this,Q):te;++ie<u;)me=a[ie].call(this,me);return me}})}function Tl(o,a,u,d,m,v,N,L,M,Q){var te=a&W,ie=a&w,me=a&S,Le=a&(C|B),Re=a&q,Je=me?i:ra(o);function je(){for(var et=arguments.length,nt=V(et),Jr=et;Jr--;)nt[Jr]=arguments[Jr];if(Le)var wr=Jo(je),Kr=_S(nt,wr);if(d&&(nt=am(nt,d,m,Le)),v&&(nt=lm(nt,v,N,Le)),et-=Kr,Le&&et<Q){var Ft=Ii(nt,wr);return gm(o,a,Tl,je.placeholder,u,nt,Ft,L,M,Q-et)}var An=ie?u:this,hi=me?An[o]:o;return et=nt.length,L?nt=B1(nt,L):Re&&et>1&&nt.reverse(),te&&M<et&&(nt.length=M),this&&this!==rr&&this instanceof je&&(hi=Je||ra(hi)),hi.apply(An,nt)}return je}function pm(o,a){return function(u,d){return Uw(u,o,a(d),{})}}function Il(o,a){return function(u,d){var m;if(u===i&&d===i)return a;if(u!==i&&(m=u),d!==i){if(m===i)return d;typeof u=="string"||typeof d=="string"?(u=qr(u),d=qr(d)):(u=Qp(u),d=Qp(d)),m=o(u,d)}return m}}function Mf(o){return li(function(a){return a=Ot(a,Wr(De())),Ze(function(u){var d=this;return o(a,function(m){return Hr(m,d,u)})})})}function Ml(o,a){a=a===i?" ":qr(a);var u=a.length;if(u<2)return u?wf(a,o):a;var d=wf(a,ml(o/Vo(a)));return Fo(a)?Bi(Tn(d),0,o).join(""):d.slice(0,o)}function m1(o,a,u,d){var m=a&w,v=ra(o);function N(){for(var L=-1,M=arguments.length,Q=-1,te=d.length,ie=V(te+M),me=this&&this!==rr&&this instanceof N?v:o;++Q<te;)ie[Q]=d[Q];for(;M--;)ie[Q++]=arguments[++L];return Hr(me,m?u:this,ie)}return N}function mm(o){return function(a,u,d){return d&&typeof d!="number"&&Sr(a,u,d)&&(u=d=i),a=fi(a),u===i?(u=a,a=0):u=fi(u),d=d===i?a<u?1:-1:fi(d),e1(a,u,d,o)}}function Al(o){return function(a,u){return typeof a=="string"&&typeof u=="string"||(a=hn(a),u=hn(u)),o(a,u)}}function gm(o,a,u,d,m,v,N,L,M,Q){var te=a&C,ie=te?N:i,me=te?i:N,Le=te?v:i,Re=te?i:v;a|=te?G:D,a&=~(te?D:G),a&T||(a&=~(w|S));var Je=[o,a,m,Le,ie,Re,me,L,M,Q],je=u.apply(i,Je);return Ef(o)&&Im(je,Je),je.placeholder=d,Mm(je,o,a)}function Af(o){var a=Kt[o];return function(u,d){if(u=hn(u),d=d==null?0:pr(We(d),292),d&&Mp(u)){var m=(ut(u)+"e").split("e"),v=a(m[0]+"e"+(+m[1]+d));return m=(ut(v)+"e").split("e"),+(m[0]+"e"+(+m[1]-d))}return a(u)}}var g1=ko&&1/ol(new ko([,-0]))[1]==he?function(o){return new ko(o)}:Yf;function ym(o){return function(a){var u=mr(a);return u==ne?sf(a):u==pe?DS(a):LS(a,o(a))}}function ai(o,a,u,d,m,v,N,L){var M=a&S;if(!M&&typeof o!="function")throw new an(n);var Q=d?d.length:0;if(Q||(a&=~(G|D),d=m=i),N=N===i?N:Xt(We(N),0),L=L===i?L:We(L),Q-=m?m.length:0,a&D){var te=d,ie=m;d=m=i}var me=M?i:Df(o),Le=[o,a,u,d,m,te,ie,v,N,L];if(me&&O1(Le,me),o=Le[0],a=Le[1],u=Le[2],d=Le[3],m=Le[4],L=Le[9]=Le[9]===i?M?0:o.length:Xt(Le[9]-Q,0),!L&&a&(C|B)&&(a&=~(C|B)),!a||a==w)var Re=d1(o,a,u);else a==C||a==B?Re=p1(o,a,L):(a==G||a==(w|G))&&!m.length?Re=m1(o,a,u,d):Re=Tl.apply(i,Le);var Je=me?Zp:Im;return Mm(Je(Re,Le),o,a)}function xm(o,a,u,d){return o===i||Mn(o,Uo[u])&&!dt.call(d,u)?a:o}function vm(o,a,u,d,m,v){return Dt(o)&&Dt(a)&&(v.set(a,o),Nl(o,a,i,vm,v),v.delete(a)),o}function y1(o){return oa(o)?i:o}function bm(o,a,u,d,m,v){var N=u&y,L=o.length,M=a.length;if(L!=M&&!(N&&M>L))return!1;var Q=v.get(o),te=v.get(a);if(Q&&te)return Q==a&&te==o;var ie=-1,me=!0,Le=u&g?new lo:i;for(v.set(o,a),v.set(a,o);++ie<L;){var Re=o[ie],Je=a[ie];if(d)var je=N?d(Je,Re,ie,a,o,v):d(Re,Je,ie,o,a,v);if(je!==i){if(je)continue;me=!1;break}if(Le){if(!Qu(a,function(et,nt){if(!Ws(Le,nt)&&(Re===et||m(Re,et,u,d,v)))return Le.push(nt)})){me=!1;break}}else if(!(Re===Je||m(Re,Je,u,d,v))){me=!1;break}}return v.delete(o),v.delete(a),me}function x1(o,a,u,d,m,v,N){switch(u){case At:if(o.byteLength!=a.byteLength||o.byteOffset!=a.byteOffset)return!1;o=o.buffer,a=a.buffer;case Lt:return!(o.byteLength!=a.byteLength||!v(new fl(o),new fl(a)));case oe:case se:case Ce:return Mn(+o,+a);case ue:return o.name==a.name&&o.message==a.message;case _e:case we:return o==a+"";case ne:var L=sf;case pe:var M=d&y;if(L||(L=ol),o.size!=a.size&&!M)return!1;var Q=N.get(o);if(Q)return Q==a;d|=g,N.set(o,a);var te=bm(L(o),L(a),d,m,v,N);return N.delete(o),te;case Ve:if(Xs)return Xs.call(o)==Xs.call(a)}return!1}function v1(o,a,u,d,m,v){var N=u&y,L=Of(o),M=L.length,Q=Of(a),te=Q.length;if(M!=te&&!N)return!1;for(var ie=M;ie--;){var me=L[ie];if(!(N?me in a:dt.call(a,me)))return!1}var Le=v.get(o),Re=v.get(a);if(Le&&Re)return Le==a&&Re==o;var Je=!0;v.set(o,a),v.set(a,o);for(var je=N;++ie<M;){me=L[ie];var et=o[me],nt=a[me];if(d)var Jr=N?d(nt,et,me,a,o,v):d(et,nt,me,o,a,v);if(!(Jr===i?et===nt||m(et,nt,u,d,v):Jr)){Je=!1;break}je||(je=me=="constructor")}if(Je&&!je){var wr=o.constructor,Kr=a.constructor;wr!=Kr&&"constructor"in o&&"constructor"in a&&!(typeof wr=="function"&&wr instanceof wr&&typeof Kr=="function"&&Kr instanceof Kr)&&(Je=!1)}return v.delete(o),v.delete(a),Je}function li(o){return zf(_m(o,i,Gm),o+"")}function Of(o){return Fp(o,nr,Gf)}function Pf(o){return Fp(o,Dr,Sm)}var Df=yl?function(o){return yl.get(o)}:Yf;function Ol(o){for(var a=o.name+"",u=Ho[a],d=dt.call(Ho,a)?u.length:0;d--;){var m=u[d],v=m.func;if(v==null||v==o)return m.name}return a}function Jo(o){var a=dt.call(x,"placeholder")?x:o;return a.placeholder}function De(){var o=x.iteratee||Xf;return o=o===Xf?kp:o,arguments.length?o(arguments[0],arguments[1]):o}function Pl(o,a){var u=o.__data__;return T1(a)?u[typeof a=="string"?"string":"hash"]:u.map}function Bf(o){for(var a=nr(o),u=a.length;u--;){var d=a[u],m=o[d];a[u]=[d,m,Cm(m)]}return a}function fo(o,a){var u=AS(o,a);return Up(u)?u:i}function b1(o){var a=dt.call(o,so),u=o[so];try{o[so]=i;var d=!0}catch(v){}var m=cl.call(o);return d&&(a?o[so]=u:delete o[so]),m}var Gf=lf?function(o){return o==null?[]:(o=yt(o),_i(lf(o),function(a){return Tp.call(o,a)}))}:Qf,Sm=lf?function(o){for(var a=[];o;)Ti(a,Gf(o)),o=hl(o);return a}:Qf,mr=br;(cf&&mr(new cf(new ArrayBuffer(1)))!=At||$s&&mr(new $s)!=ne||uf&&mr(uf.resolve())!=de||ko&&mr(new ko)!=pe||Js&&mr(new Js)!=Qe)&&(mr=function(o){var a=br(o),u=a==le?o.constructor:i,d=u?ho(u):"";if(d)switch(d){case rw:return At;case nw:return ne;case iw:return de;case ow:return pe;case sw:return Qe}return a});function S1(o,a,u){for(var d=-1,m=u.length;++d<m;){var v=u[d],N=v.size;switch(v.type){case"drop":o+=N;break;case"dropRight":a-=N;break;case"take":a=pr(a,o+N);break;case"takeRight":o=Xt(o,a-N);break}}return{start:o,end:a}}function w1(o){var a=o.match(ct);return a?a[1].split(St):[]}function wm(o,a,u){a=Di(a,o);for(var d=-1,m=a.length,v=!1;++d<m;){var N=Un(a[d]);if(!(v=o!=null&&u(o,N)))break;o=o[N]}return v||++d!=m?v:(m=o==null?0:o.length,!!m&&zl(m)&&ci(N,m)&&(ke(o)||po(o)))}function N1(o){var a=o.length,u=new o.constructor(a);return a&&typeof o[0]=="string"&&dt.call(o,"index")&&(u.index=o.index,u.input=o.input),u}function Nm(o){return typeof o.constructor=="function"&&!na(o)?Wo(hl(o)):{}}function C1(o,a,u){var d=o.constructor;switch(a){case Lt:return If(o);case oe:case se:return new d(+o);case At:return a1(o,u);case sr:case Ur:case Ht:case kr:case Nn:case Cn:case pt:case Wt:case ar:return om(o,u);case ne:return new d;case Ce:case we:return new d(o);case _e:return l1(o);case pe:return new d;case Ve:return c1(o)}}function L1(o,a){var u=a.length;if(!u)return o;var d=u-1;return a[d]=(u>1?"& ":"")+a[d],a=a.join(u>2?", ":" "),o.replace(gt,`{
|
|
2
|
+
/* [wrapped with `+a+`] */
|
|
3
|
+
`)}function _1(o){return ke(o)||po(o)||!!(Ip&&o&&o[Ip])}function ci(o,a){var u=typeof o;return a=a==null?re:a,!!a&&(u=="number"||u!="symbol"&&Rb.test(o))&&o>-1&&o%1==0&&o<a}function Sr(o,a,u){if(!Dt(u))return!1;var d=typeof a;return(d=="number"?Pr(u)&&ci(a,u.length):d=="string"&&a in u)?Mn(u[a],o):!1}function jf(o,a){if(ke(o))return!1;var u=typeof o;return u=="number"||u=="symbol"||u=="boolean"||o==null||$r(o)?!0:Ee.test(o)||!Eo.test(o)||a!=null&&o in yt(a)}function T1(o){var a=typeof o;return a=="string"||a=="number"||a=="symbol"||a=="boolean"?o!=="__proto__":o===null}function Ef(o){var a=Ol(o),u=x[a];if(typeof u!="function"||!(a in rt.prototype))return!1;if(o===u)return!0;var d=Df(u);return!!d&&o===d[0]}function I1(o){return!!Cp&&Cp in o}var M1=al?ui:eh;function na(o){var a=o&&o.constructor,u=typeof a=="function"&&a.prototype||Uo;return o===u}function Cm(o){return o===o&&!Dt(o)}function Lm(o,a){return function(u){return u==null?!1:u[o]===a&&(a!==i||o in yt(u))}}function A1(o){var a=El(o,function(d){return u.size===l&&u.clear(),d}),u=a.cache;return a}function O1(o,a){var u=o[1],d=a[1],m=u|d,v=m<(w|S|W),N=d==W&&u==C||d==W&&u==A&&o[7].length<=a[8]||d==(W|A)&&a[7].length<=a[8]&&u==C;if(!(v||N))return o;d&w&&(o[2]=a[2],m|=u&w?0:T);var L=a[3];if(L){var M=o[3];o[3]=M?am(M,L,a[4]):L,o[4]=M?Ii(o[3],c):a[4]}return L=a[5],L&&(M=o[5],o[5]=M?lm(M,L,a[6]):L,o[6]=M?Ii(o[5],c):a[6]),L=a[7],L&&(o[7]=L),d&W&&(o[8]=o[8]==null?a[8]:pr(o[8],a[8])),o[9]==null&&(o[9]=a[9]),o[0]=a[0],o[1]=m,o}function P1(o){var a=[];if(o!=null)for(var u in yt(o))a.push(u);return a}function D1(o){return cl.call(o)}function _m(o,a,u){return a=Xt(a===i?o.length-1:a,0),function(){for(var d=arguments,m=-1,v=Xt(d.length-a,0),N=V(v);++m<v;)N[m]=d[a+m];m=-1;for(var L=V(a+1);++m<a;)L[m]=d[m];return L[a]=u(N),Hr(o,this,L)}}function Tm(o,a){return a.length<2?o:uo(o,un(a,0,-1))}function B1(o,a){for(var u=o.length,d=pr(a.length,u),m=Or(o);d--;){var v=a[d];o[d]=ci(v,u)?m[v]:i}return o}function Rf(o,a){if(!(a==="constructor"&&typeof o[a]=="function")&&a!="__proto__")return o[a]}var Im=Am(Zp),ia=KS||function(o,a){return rr.setTimeout(o,a)},zf=Am(n1);function Mm(o,a,u){var d=a+"";return zf(o,L1(d,G1(w1(d),u)))}function Am(o){var a=0,u=0;return function(){var d=QS(),m=I-(d-u);if(u=d,m>0){if(++a>=R)return arguments[0]}else a=0;return o.apply(i,arguments)}}function Dl(o,a){var u=-1,d=o.length,m=d-1;for(a=a===i?d:a;++u<a;){var v=Sf(u,m),N=o[v];o[v]=o[u],o[u]=N}return o.length=a,o}var Om=A1(function(o){var a=[];return o.charCodeAt(0)===46&&a.push(""),o.replace(Xe,function(u,d,m,v){a.push(m?v.replace(Ar,"$1"):d||u)}),a});function Un(o){if(typeof o=="string"||$r(o))return o;var a=o+"";return a=="0"&&1/o==-he?"-0":a}function ho(o){if(o!=null){try{return ll.call(o)}catch(a){}try{return o+""}catch(a){}}return""}function G1(o,a){return sn(H,function(u){var d="_."+u[0];a&u[1]&&!nl(o,d)&&o.push(d)}),o.sort()}function Pm(o){if(o instanceof rt)return o.clone();var a=new ln(o.__wrapped__,o.__chain__);return a.__actions__=Or(o.__actions__),a.__index__=o.__index__,a.__values__=o.__values__,a}function j1(o,a,u){(u?Sr(o,a,u):a===i)?a=1:a=Xt(We(a),0);var d=o==null?0:o.length;if(!d||a<1)return[];for(var m=0,v=0,N=V(ml(d/a));m<d;)N[v++]=un(o,m,m+=a);return N}function E1(o){for(var a=-1,u=o==null?0:o.length,d=0,m=[];++a<u;){var v=o[a];v&&(m[d++]=v)}return m}function R1(){var o=arguments.length;if(!o)return[];for(var a=V(o-1),u=arguments[0],d=o;d--;)a[d-1]=arguments[d];return Ti(ke(u)?Or(u):[u],lr(a,1))}var z1=Ze(function(o,a){return zt(o)?Ys(o,lr(a,1,zt,!0)):[]}),F1=Ze(function(o,a){var u=fn(a);return zt(u)&&(u=i),zt(o)?Ys(o,lr(a,1,zt,!0),De(u,2)):[]}),V1=Ze(function(o,a){var u=fn(a);return zt(u)&&(u=i),zt(o)?Ys(o,lr(a,1,zt,!0),i,u):[]});function U1(o,a,u){var d=o==null?0:o.length;return d?(a=u||a===i?1:We(a),un(o,a<0?0:a,d)):[]}function k1(o,a,u){var d=o==null?0:o.length;return d?(a=u||a===i?1:We(a),a=d-a,un(o,0,a<0?0:a)):[]}function H1(o,a){return o&&o.length?Ll(o,De(a,3),!0,!0):[]}function W1(o,a){return o&&o.length?Ll(o,De(a,3),!0):[]}function q1(o,a,u,d){var m=o==null?0:o.length;return m?(u&&typeof u!="number"&&Sr(o,a,u)&&(u=0,d=m),Rw(o,a,u,d)):[]}function Dm(o,a,u){var d=o==null?0:o.length;if(!d)return-1;var m=u==null?0:We(u);return m<0&&(m=Xt(d+m,0)),il(o,De(a,3),m)}function Bm(o,a,u){var d=o==null?0:o.length;if(!d)return-1;var m=d-1;return u!==i&&(m=We(u),m=u<0?Xt(d+m,0):pr(m,d-1)),il(o,De(a,3),m,!0)}function Gm(o){var a=o==null?0:o.length;return a?lr(o,1):[]}function $1(o){var a=o==null?0:o.length;return a?lr(o,he):[]}function J1(o,a){var u=o==null?0:o.length;return u?(a=a===i?1:We(a),lr(o,a)):[]}function K1(o){for(var a=-1,u=o==null?0:o.length,d={};++a<u;){var m=o[a];d[m[0]]=m[1]}return d}function jm(o){return o&&o.length?o[0]:i}function X1(o,a,u){var d=o==null?0:o.length;if(!d)return-1;var m=u==null?0:We(u);return m<0&&(m=Xt(d+m,0)),zo(o,a,m)}function Z1(o){var a=o==null?0:o.length;return a?un(o,0,-1):[]}var Y1=Ze(function(o){var a=Ot(o,_f);return a.length&&a[0]===o[0]?gf(a):[]}),Q1=Ze(function(o){var a=fn(o),u=Ot(o,_f);return a===fn(u)?a=i:u.pop(),u.length&&u[0]===o[0]?gf(u,De(a,2)):[]}),eN=Ze(function(o){var a=fn(o),u=Ot(o,_f);return a=typeof a=="function"?a:i,a&&u.pop(),u.length&&u[0]===o[0]?gf(u,i,a):[]});function tN(o,a){return o==null?"":ZS.call(o,a)}function fn(o){var a=o==null?0:o.length;return a?o[a-1]:i}function rN(o,a,u){var d=o==null?0:o.length;if(!d)return-1;var m=d;return u!==i&&(m=We(u),m=m<0?Xt(d+m,0):pr(m,d-1)),a===a?GS(o,a,m):il(o,xp,m,!0)}function nN(o,a){return o&&o.length?$p(o,We(a)):i}var iN=Ze(Em);function Em(o,a){return o&&o.length&&a&&a.length?bf(o,a):o}function oN(o,a,u){return o&&o.length&&a&&a.length?bf(o,a,De(u,2)):o}function sN(o,a,u){return o&&o.length&&a&&a.length?bf(o,a,i,u):o}var aN=li(function(o,a){var u=o==null?0:o.length,d=hf(o,a);return Xp(o,Ot(a,function(m){return ci(m,u)?+m:m}).sort(sm)),d});function lN(o,a){var u=[];if(!(o&&o.length))return u;var d=-1,m=[],v=o.length;for(a=De(a,3);++d<v;){var N=o[d];a(N,d,o)&&(u.push(N),m.push(d))}return Xp(o,m),u}function Ff(o){return o==null?o:tw.call(o)}function cN(o,a,u){var d=o==null?0:o.length;return d?(u&&typeof u!="number"&&Sr(o,a,u)?(a=0,u=d):(a=a==null?0:We(a),u=u===i?d:We(u)),un(o,a,u)):[]}function uN(o,a){return Cl(o,a)}function fN(o,a,u){return Nf(o,a,De(u,2))}function hN(o,a){var u=o==null?0:o.length;if(u){var d=Cl(o,a);if(d<u&&Mn(o[d],a))return d}return-1}function dN(o,a){return Cl(o,a,!0)}function pN(o,a,u){return Nf(o,a,De(u,2),!0)}function mN(o,a){var u=o==null?0:o.length;if(u){var d=Cl(o,a,!0)-1;if(Mn(o[d],a))return d}return-1}function gN(o){return o&&o.length?Yp(o):[]}function yN(o,a){return o&&o.length?Yp(o,De(a,2)):[]}function xN(o){var a=o==null?0:o.length;return a?un(o,1,a):[]}function vN(o,a,u){return o&&o.length?(a=u||a===i?1:We(a),un(o,0,a<0?0:a)):[]}function bN(o,a,u){var d=o==null?0:o.length;return d?(a=u||a===i?1:We(a),a=d-a,un(o,a<0?0:a,d)):[]}function SN(o,a){return o&&o.length?Ll(o,De(a,3),!1,!0):[]}function wN(o,a){return o&&o.length?Ll(o,De(a,3)):[]}var NN=Ze(function(o){return Pi(lr(o,1,zt,!0))}),CN=Ze(function(o){var a=fn(o);return zt(a)&&(a=i),Pi(lr(o,1,zt,!0),De(a,2))}),LN=Ze(function(o){var a=fn(o);return a=typeof a=="function"?a:i,Pi(lr(o,1,zt,!0),i,a)});function _N(o){return o&&o.length?Pi(o):[]}function TN(o,a){return o&&o.length?Pi(o,De(a,2)):[]}function IN(o,a){return a=typeof a=="function"?a:i,o&&o.length?Pi(o,i,a):[]}function Vf(o){if(!(o&&o.length))return[];var a=0;return o=_i(o,function(u){if(zt(u))return a=Xt(u.length,a),!0}),nf(a,function(u){return Ot(o,ef(u))})}function Rm(o,a){if(!(o&&o.length))return[];var u=Vf(o);return a==null?u:Ot(u,function(d){return Hr(a,i,d)})}var MN=Ze(function(o,a){return zt(o)?Ys(o,a):[]}),AN=Ze(function(o){return Lf(_i(o,zt))}),ON=Ze(function(o){var a=fn(o);return zt(a)&&(a=i),Lf(_i(o,zt),De(a,2))}),PN=Ze(function(o){var a=fn(o);return a=typeof a=="function"?a:i,Lf(_i(o,zt),i,a)}),DN=Ze(Vf);function BN(o,a){return rm(o||[],a||[],Zs)}function GN(o,a){return rm(o||[],a||[],ta)}var jN=Ze(function(o){var a=o.length,u=a>1?o[a-1]:i;return u=typeof u=="function"?(o.pop(),u):i,Rm(o,u)});function zm(o){var a=x(o);return a.__chain__=!0,a}function EN(o,a){return a(o),o}function Bl(o,a){return a(o)}var RN=li(function(o){var a=o.length,u=a?o[0]:0,d=this.__wrapped__,m=function(v){return hf(v,o)};return a>1||this.__actions__.length||!(d instanceof rt)||!ci(u)?this.thru(m):(d=d.slice(u,+u+(a?1:0)),d.__actions__.push({func:Bl,args:[m],thisArg:i}),new ln(d,this.__chain__).thru(function(v){return a&&!v.length&&v.push(i),v}))});function zN(){return zm(this)}function FN(){return new ln(this.value(),this.__chain__)}function VN(){this.__values__===i&&(this.__values__=Qm(this.value()));var o=this.__index__>=this.__values__.length,a=o?i:this.__values__[this.__index__++];return{done:o,value:a}}function UN(){return this}function kN(o){for(var a,u=this;u instanceof vl;){var d=Pm(u);d.__index__=0,d.__values__=i,a?m.__wrapped__=d:a=d;var m=d;u=u.__wrapped__}return m.__wrapped__=o,a}function HN(){var o=this.__wrapped__;if(o instanceof rt){var a=o;return this.__actions__.length&&(a=new rt(this)),a=a.reverse(),a.__actions__.push({func:Bl,args:[Ff],thisArg:i}),new ln(a,this.__chain__)}return this.thru(Ff)}function WN(){return tm(this.__wrapped__,this.__actions__)}var qN=_l(function(o,a,u){dt.call(o,u)?++o[u]:si(o,u,1)});function $N(o,a,u){var d=ke(o)?gp:Ew;return u&&Sr(o,a,u)&&(a=i),d(o,De(a,3))}function JN(o,a){var u=ke(o)?_i:Rp;return u(o,De(a,3))}var KN=hm(Dm),XN=hm(Bm);function ZN(o,a){return lr(Gl(o,a),1)}function YN(o,a){return lr(Gl(o,a),he)}function QN(o,a,u){return u=u===i?1:We(u),lr(Gl(o,a),u)}function Fm(o,a){var u=ke(o)?sn:Oi;return u(o,De(a,3))}function Vm(o,a){var u=ke(o)?xS:Ep;return u(o,De(a,3))}var eC=_l(function(o,a,u){dt.call(o,u)?o[u].push(a):si(o,u,[a])});function tC(o,a,u,d){o=Pr(o)?o:Xo(o),u=u&&!d?We(u):0;var m=o.length;return u<0&&(u=Xt(m+u,0)),Fl(o)?u<=m&&o.indexOf(a,u)>-1:!!m&&zo(o,a,u)>-1}var rC=Ze(function(o,a,u){var d=-1,m=typeof a=="function",v=Pr(o)?V(o.length):[];return Oi(o,function(N){v[++d]=m?Hr(a,N,u):Qs(N,a,u)}),v}),nC=_l(function(o,a,u){si(o,u,a)});function Gl(o,a){var u=ke(o)?Ot:Hp;return u(o,De(a,3))}function iC(o,a,u,d){return o==null?[]:(ke(a)||(a=a==null?[]:[a]),u=d?i:u,ke(u)||(u=u==null?[]:[u]),Jp(o,a,u))}var oC=_l(function(o,a,u){o[u?0:1].push(a)},function(){return[[],[]]});function sC(o,a,u){var d=ke(o)?Yu:bp,m=arguments.length<3;return d(o,De(a,4),u,m,Oi)}function aC(o,a,u){var d=ke(o)?vS:bp,m=arguments.length<3;return d(o,De(a,4),u,m,Ep)}function lC(o,a){var u=ke(o)?_i:Rp;return u(o,Rl(De(a,3)))}function cC(o){var a=ke(o)?Dp:t1;return a(o)}function uC(o,a,u){(u?Sr(o,a,u):a===i)?a=1:a=We(a);var d=ke(o)?Pw:r1;return d(o,a)}function fC(o){var a=ke(o)?Dw:i1;return a(o)}function hC(o){if(o==null)return 0;if(Pr(o))return Fl(o)?Vo(o):o.length;var a=mr(o);return a==ne||a==pe?o.size:xf(o).length}function dC(o,a,u){var d=ke(o)?Qu:o1;return u&&Sr(o,a,u)&&(a=i),d(o,De(a,3))}var pC=Ze(function(o,a){if(o==null)return[];var u=a.length;return u>1&&Sr(o,a[0],a[1])?a=[]:u>2&&Sr(a[0],a[1],a[2])&&(a=[a[0]]),Jp(o,lr(a,1),[])}),jl=JS||function(){return rr.Date.now()};function mC(o,a){if(typeof a!="function")throw new an(n);return o=We(o),function(){if(--o<1)return a.apply(this,arguments)}}function Um(o,a,u){return a=u?i:a,a=o&&a==null?o.length:a,ai(o,W,i,i,i,i,a)}function km(o,a){var u;if(typeof a!="function")throw new an(n);return o=We(o),function(){return--o>0&&(u=a.apply(this,arguments)),o<=1&&(a=i),u}}var Uf=Ze(function(o,a,u){var d=w;if(u.length){var m=Ii(u,Jo(Uf));d|=G}return ai(o,d,a,u,m)}),Hm=Ze(function(o,a,u){var d=w|S;if(u.length){var m=Ii(u,Jo(Hm));d|=G}return ai(a,d,o,u,m)});function Wm(o,a,u){a=u?i:a;var d=ai(o,C,i,i,i,i,i,a);return d.placeholder=Wm.placeholder,d}function qm(o,a,u){a=u?i:a;var d=ai(o,B,i,i,i,i,i,a);return d.placeholder=qm.placeholder,d}function $m(o,a,u){var d,m,v,N,L,M,Q=0,te=!1,ie=!1,me=!0;if(typeof o!="function")throw new an(n);a=hn(a)||0,Dt(u)&&(te=!!u.leading,ie="maxWait"in u,v=ie?Xt(hn(u.maxWait)||0,a):v,me="trailing"in u?!!u.trailing:me);function Le(Ft){var An=d,hi=m;return d=m=i,Q=Ft,N=o.apply(hi,An),N}function Re(Ft){return Q=Ft,L=ia(et,a),te?Le(Ft):N}function Je(Ft){var An=Ft-M,hi=Ft-Q,hg=a-An;return ie?pr(hg,v-hi):hg}function je(Ft){var An=Ft-M,hi=Ft-Q;return M===i||An>=a||An<0||ie&&hi>=v}function et(){var Ft=jl();if(je(Ft))return nt(Ft);L=ia(et,Je(Ft))}function nt(Ft){return L=i,me&&d?Le(Ft):(d=m=i,N)}function Jr(){L!==i&&nm(L),Q=0,d=M=m=L=i}function wr(){return L===i?N:nt(jl())}function Kr(){var Ft=jl(),An=je(Ft);if(d=arguments,m=this,M=Ft,An){if(L===i)return Re(M);if(ie)return nm(L),L=ia(et,a),Le(M)}return L===i&&(L=ia(et,a)),N}return Kr.cancel=Jr,Kr.flush=wr,Kr}var gC=Ze(function(o,a){return jp(o,1,a)}),yC=Ze(function(o,a,u){return jp(o,hn(a)||0,u)});function xC(o){return ai(o,q)}function El(o,a){if(typeof o!="function"||a!=null&&typeof a!="function")throw new an(n);var u=function(){var d=arguments,m=a?a.apply(this,d):d[0],v=u.cache;if(v.has(m))return v.get(m);var N=o.apply(this,d);return u.cache=v.set(m,N)||v,N};return u.cache=new(El.Cache||oi),u}El.Cache=oi;function Rl(o){if(typeof o!="function")throw new an(n);return function(){var a=arguments;switch(a.length){case 0:return!o.call(this);case 1:return!o.call(this,a[0]);case 2:return!o.call(this,a[0],a[1]);case 3:return!o.call(this,a[0],a[1],a[2])}return!o.apply(this,a)}}function vC(o){return km(2,o)}var bC=s1(function(o,a){a=a.length==1&&ke(a[0])?Ot(a[0],Wr(De())):Ot(lr(a,1),Wr(De()));var u=a.length;return Ze(function(d){for(var m=-1,v=pr(d.length,u);++m<v;)d[m]=a[m].call(this,d[m]);return Hr(o,this,d)})}),kf=Ze(function(o,a){var u=Ii(a,Jo(kf));return ai(o,G,i,a,u)}),Jm=Ze(function(o,a){var u=Ii(a,Jo(Jm));return ai(o,D,i,a,u)}),SC=li(function(o,a){return ai(o,A,i,i,i,a)});function wC(o,a){if(typeof o!="function")throw new an(n);return a=a===i?a:We(a),Ze(o,a)}function NC(o,a){if(typeof o!="function")throw new an(n);return a=a==null?0:Xt(We(a),0),Ze(function(u){var d=u[a],m=Bi(u,0,a);return d&&Ti(m,d),Hr(o,this,m)})}function CC(o,a,u){var d=!0,m=!0;if(typeof o!="function")throw new an(n);return Dt(u)&&(d="leading"in u?!!u.leading:d,m="trailing"in u?!!u.trailing:m),$m(o,a,{leading:d,maxWait:a,trailing:m})}function LC(o){return Um(o,1)}function _C(o,a){return kf(Tf(a),o)}function TC(){if(!arguments.length)return[];var o=arguments[0];return ke(o)?o:[o]}function IC(o){return cn(o,p)}function MC(o,a){return a=typeof a=="function"?a:i,cn(o,p,a)}function AC(o){return cn(o,f|p)}function OC(o,a){return a=typeof a=="function"?a:i,cn(o,f|p,a)}function PC(o,a){return a==null||Gp(o,a,nr(a))}function Mn(o,a){return o===a||o!==o&&a!==a}var DC=Al(mf),BC=Al(function(o,a){return o>=a}),po=Vp(function(){return arguments}())?Vp:function(o){return Gt(o)&&dt.call(o,"callee")&&!Tp.call(o,"callee")},ke=V.isArray,GC=up?Wr(up):kw;function Pr(o){return o!=null&&zl(o.length)&&!ui(o)}function zt(o){return Gt(o)&&Pr(o)}function jC(o){return o===!0||o===!1||Gt(o)&&br(o)==oe}var Gi=XS||eh,EC=fp?Wr(fp):Hw;function RC(o){return Gt(o)&&o.nodeType===1&&!oa(o)}function zC(o){if(o==null)return!0;if(Pr(o)&&(ke(o)||typeof o=="string"||typeof o.splice=="function"||Gi(o)||Ko(o)||po(o)))return!o.length;var a=mr(o);if(a==ne||a==pe)return!o.size;if(na(o))return!xf(o).length;for(var u in o)if(dt.call(o,u))return!1;return!0}function FC(o,a){return ea(o,a)}function VC(o,a,u){u=typeof u=="function"?u:i;var d=u?u(o,a):i;return d===i?ea(o,a,i,u):!!d}function Hf(o){if(!Gt(o))return!1;var a=br(o);return a==ue||a==ce||typeof o.message=="string"&&typeof o.name=="string"&&!oa(o)}function UC(o){return typeof o=="number"&&Mp(o)}function ui(o){if(!Dt(o))return!1;var a=br(o);return a==K||a==ae||a==ee||a==xe}function Km(o){return typeof o=="number"&&o==We(o)}function zl(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=re}function Dt(o){var a=typeof o;return o!=null&&(a=="object"||a=="function")}function Gt(o){return o!=null&&typeof o=="object"}var Xm=hp?Wr(hp):qw;function kC(o,a){return o===a||yf(o,a,Bf(a))}function HC(o,a,u){return u=typeof u=="function"?u:i,yf(o,a,Bf(a),u)}function WC(o){return Zm(o)&&o!=+o}function qC(o){if(M1(o))throw new Ue(r);return Up(o)}function $C(o){return o===null}function JC(o){return o==null}function Zm(o){return typeof o=="number"||Gt(o)&&br(o)==Ce}function oa(o){if(!Gt(o)||br(o)!=le)return!1;var a=hl(o);if(a===null)return!0;var u=dt.call(a,"constructor")&&a.constructor;return typeof u=="function"&&u instanceof u&&ll.call(u)==HS}var Wf=dp?Wr(dp):$w;function KC(o){return Km(o)&&o>=-re&&o<=re}var Ym=pp?Wr(pp):Jw;function Fl(o){return typeof o=="string"||!ke(o)&&Gt(o)&&br(o)==we}function $r(o){return typeof o=="symbol"||Gt(o)&&br(o)==Ve}var Ko=mp?Wr(mp):Kw;function XC(o){return o===i}function ZC(o){return Gt(o)&&mr(o)==Qe}function YC(o){return Gt(o)&&br(o)==bt}var QC=Al(vf),eL=Al(function(o,a){return o<=a});function Qm(o){if(!o)return[];if(Pr(o))return Fl(o)?Tn(o):Or(o);if(qs&&o[qs])return PS(o[qs]());var a=mr(o),u=a==ne?sf:a==pe?ol:Xo;return u(o)}function fi(o){if(!o)return o===0?o:0;if(o=hn(o),o===he||o===-he){var a=o<0?-1:1;return a*Ne}return o===o?o:0}function We(o){var a=fi(o),u=a%1;return a===a?u?a-u:a:0}function eg(o){return o?co(We(o),0,Me):0}function hn(o){if(typeof o=="number")return o;if($r(o))return ye;if(Dt(o)){var a=typeof o.valueOf=="function"?o.valueOf():o;o=Dt(a)?a+"":a}if(typeof o!="string")return o===0?o:+o;o=o.replace(tt,"");var u=Qa.test(o);return u||Eb.test(o)?mS(o.slice(2),u?2:8):zn.test(o)?ye:+o}function tg(o){return Vn(o,Dr(o))}function tL(o){return o?co(We(o),-re,re):o===0?o:0}function ut(o){return o==null?"":qr(o)}var rL=qo(function(o,a){if(na(a)||Pr(a)){Vn(a,nr(a),o);return}for(var u in a)dt.call(a,u)&&Zs(o,u,a[u])}),rg=qo(function(o,a){Vn(a,Dr(a),o)}),Vl=qo(function(o,a,u,d){Vn(a,Dr(a),o,d)}),nL=qo(function(o,a,u,d){Vn(a,nr(a),o,d)}),iL=li(hf);function oL(o,a){var u=Wo(o);return a==null?u:Bp(u,a)}var sL=Ze(function(o,a){o=yt(o);var u=-1,d=a.length,m=d>2?a[2]:i;for(m&&Sr(a[0],a[1],m)&&(d=1);++u<d;)for(var v=a[u],N=Dr(v),L=-1,M=N.length;++L<M;){var Q=N[L],te=o[Q];(te===i||Mn(te,Uo[Q])&&!dt.call(o,Q))&&(o[Q]=v[Q])}return o}),aL=Ze(function(o){return o.push(i,vm),Hr(ng,i,o)});function lL(o,a){return yp(o,De(a,3),Fn)}function cL(o,a){return yp(o,De(a,3),pf)}function uL(o,a){return o==null?o:df(o,De(a,3),Dr)}function fL(o,a){return o==null?o:zp(o,De(a,3),Dr)}function hL(o,a){return o&&Fn(o,De(a,3))}function dL(o,a){return o&&pf(o,De(a,3))}function pL(o){return o==null?[]:wl(o,nr(o))}function mL(o){return o==null?[]:wl(o,Dr(o))}function qf(o,a,u){var d=o==null?i:uo(o,a);return d===i?u:d}function gL(o,a){return o!=null&&wm(o,a,zw)}function $f(o,a){return o!=null&&wm(o,a,Fw)}var yL=pm(function(o,a,u){a!=null&&typeof a.toString!="function"&&(a=cl.call(a)),o[a]=u},Kf(Br)),xL=pm(function(o,a,u){a!=null&&typeof a.toString!="function"&&(a=cl.call(a)),dt.call(o,a)?o[a].push(u):o[a]=[u]},De),vL=Ze(Qs);function nr(o){return Pr(o)?Pp(o):xf(o)}function Dr(o){return Pr(o)?Pp(o,!0):Xw(o)}function bL(o,a){var u={};return a=De(a,3),Fn(o,function(d,m,v){si(u,a(d,m,v),d)}),u}function SL(o,a){var u={};return a=De(a,3),Fn(o,function(d,m,v){si(u,m,a(d,m,v))}),u}var wL=qo(function(o,a,u){Nl(o,a,u)}),ng=qo(function(o,a,u,d){Nl(o,a,u,d)}),NL=li(function(o,a){var u={};if(o==null)return u;var d=!1;a=Ot(a,function(v){return v=Di(v,o),d||(d=v.length>1),v}),Vn(o,Pf(o),u),d&&(u=cn(u,f|h|p,y1));for(var m=a.length;m--;)Cf(u,a[m]);return u});function CL(o,a){return ig(o,Rl(De(a)))}var LL=li(function(o,a){return o==null?{}:Yw(o,a)});function ig(o,a){if(o==null)return{};var u=Ot(Pf(o),function(d){return[d]});return a=De(a),Kp(o,u,function(d,m){return a(d,m[0])})}function _L(o,a,u){a=Di(a,o);var d=-1,m=a.length;for(m||(m=1,o=i);++d<m;){var v=o==null?i:o[Un(a[d])];v===i&&(d=m,v=u),o=ui(v)?v.call(o):v}return o}function TL(o,a,u){return o==null?o:ta(o,a,u)}function IL(o,a,u,d){return d=typeof d=="function"?d:i,o==null?o:ta(o,a,u,d)}var og=ym(nr),sg=ym(Dr);function ML(o,a,u){var d=ke(o),m=d||Gi(o)||Ko(o);if(a=De(a,4),u==null){var v=o&&o.constructor;m?u=d?new v:[]:Dt(o)?u=ui(v)?Wo(hl(o)):{}:u={}}return(m?sn:Fn)(o,function(N,L,M){return a(u,N,L,M)}),u}function AL(o,a){return o==null?!0:Cf(o,a)}function OL(o,a,u){return o==null?o:em(o,a,Tf(u))}function PL(o,a,u,d){return d=typeof d=="function"?d:i,o==null?o:em(o,a,Tf(u),d)}function Xo(o){return o==null?[]:of(o,nr(o))}function DL(o){return o==null?[]:of(o,Dr(o))}function BL(o,a,u){return u===i&&(u=a,a=i),u!==i&&(u=hn(u),u=u===u?u:0),a!==i&&(a=hn(a),a=a===a?a:0),co(hn(o),a,u)}function GL(o,a,u){return a=fi(a),u===i?(u=a,a=0):u=fi(u),o=hn(o),Vw(o,a,u)}function jL(o,a,u){if(u&&typeof u!="boolean"&&Sr(o,a,u)&&(a=u=i),u===i&&(typeof a=="boolean"?(u=a,a=i):typeof o=="boolean"&&(u=o,o=i)),o===i&&a===i?(o=0,a=1):(o=fi(o),a===i?(a=o,o=0):a=fi(a)),o>a){var d=o;o=a,a=d}if(u||o%1||a%1){var m=Ap();return pr(o+m*(a-o+pS("1e-"+((m+"").length-1))),a)}return Sf(o,a)}var EL=$o(function(o,a,u){return a=a.toLowerCase(),o+(u?ag(a):a)});function ag(o){return Jf(ut(o).toLowerCase())}function lg(o){return o=ut(o),o&&o.replace(zb,TS).replace(iS,"")}function RL(o,a,u){o=ut(o),a=qr(a);var d=o.length;u=u===i?d:co(We(u),0,d);var m=u;return u-=a.length,u>=0&&o.slice(u,m)==a}function zL(o){return o=ut(o),o&&Mr.test(o)?o.replace(no,IS):o}function FL(o){return o=ut(o),o&&$e.test(o)?o.replace(He,"\\$&"):o}var VL=$o(function(o,a,u){return o+(u?"-":"")+a.toLowerCase()}),UL=$o(function(o,a,u){return o+(u?" ":"")+a.toLowerCase()}),kL=fm("toLowerCase");function HL(o,a,u){o=ut(o),a=We(a);var d=a?Vo(o):0;if(!a||d>=a)return o;var m=(a-d)/2;return Ml(gl(m),u)+o+Ml(ml(m),u)}function WL(o,a,u){o=ut(o),a=We(a);var d=a?Vo(o):0;return a&&d<a?o+Ml(a-d,u):o}function qL(o,a,u){o=ut(o),a=We(a);var d=a?Vo(o):0;return a&&d<a?Ml(a-d,u)+o:o}function $L(o,a,u){return u||a==null?a=0:a&&(a=+a),ew(ut(o).replace(at,""),a||0)}function JL(o,a,u){return(u?Sr(o,a,u):a===i)?a=1:a=We(a),wf(ut(o),a)}function KL(){var o=arguments,a=ut(o[0]);return o.length<3?a:a.replace(o[1],o[2])}var XL=$o(function(o,a,u){return o+(u?"_":"")+a.toLowerCase()});function ZL(o,a,u){return u&&typeof u!="number"&&Sr(o,a,u)&&(a=u=i),u=u===i?Me:u>>>0,u?(o=ut(o),o&&(typeof a=="string"||a!=null&&!Wf(a))&&(a=qr(a),!a&&Fo(o))?Bi(Tn(o),0,u):o.split(a,u)):[]}var YL=$o(function(o,a,u){return o+(u?" ":"")+Jf(a)});function QL(o,a,u){return o=ut(o),u=u==null?0:co(We(u),0,o.length),a=qr(a),o.slice(u,u+a.length)==a}function e_(o,a,u){var d=x.templateSettings;u&&Sr(o,a,u)&&(a=i),o=ut(o),a=Vl({},a,d,xm);var m=Vl({},a.imports,d.imports,xm),v=nr(m),N=of(m,v),L,M,Q=0,te=a.interpolate||el,ie="__p += '",me=af((a.escape||el).source+"|"+te.source+"|"+(te===ni?Ln:el).source+"|"+(a.evaluate||el).source+"|$","g"),Le="//# sourceURL="+(dt.call(a,"sourceURL")?(a.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++cS+"]")+`
|
|
4
|
+
`;o.replace(me,function(je,et,nt,Jr,wr,Kr){return nt||(nt=Jr),ie+=o.slice(Q,Kr).replace(Fb,MS),et&&(L=!0,ie+=`' +
|
|
5
|
+
__e(`+et+`) +
|
|
6
|
+
'`),wr&&(M=!0,ie+=`';
|
|
7
|
+
`+wr+`;
|
|
8
|
+
__p += '`),nt&&(ie+=`' +
|
|
9
|
+
((__t = (`+nt+`)) == null ? '' : __t) +
|
|
10
|
+
'`),Q=Kr+je.length,je}),ie+=`';
|
|
11
|
+
`;var Re=dt.call(a,"variable")&&a.variable;Re||(ie=`with (obj) {
|
|
12
|
+
`+ie+`
|
|
13
|
+
}
|
|
14
|
+
`),ie=(M?ie.replace(Do,""):ie).replace(Bo,"$1").replace(Go,"$1;"),ie="function("+(Re||"obj")+`) {
|
|
15
|
+
`+(Re?"":`obj || (obj = {});
|
|
16
|
+
`)+"var __t, __p = ''"+(L?", __e = _.escape":"")+(M?`, __j = Array.prototype.join;
|
|
17
|
+
function print() { __p += __j.call(arguments, '') }
|
|
18
|
+
`:`;
|
|
19
|
+
`)+ie+`return __p
|
|
20
|
+
}`;var Je=ug(function(){return lt(v,Le+"return "+ie).apply(i,N)});if(Je.source=ie,Hf(Je))throw Je;return Je}function t_(o){return ut(o).toLowerCase()}function r_(o){return ut(o).toUpperCase()}function n_(o,a,u){if(o=ut(o),o&&(u||a===i))return o.replace(tt,"");if(!o||!(a=qr(a)))return o;var d=Tn(o),m=Tn(a),v=Sp(d,m),N=wp(d,m)+1;return Bi(d,v,N).join("")}function i_(o,a,u){if(o=ut(o),o&&(u||a===i))return o.replace(mt,"");if(!o||!(a=qr(a)))return o;var d=Tn(o),m=wp(d,Tn(a))+1;return Bi(d,0,m).join("")}function o_(o,a,u){if(o=ut(o),o&&(u||a===i))return o.replace(at,"");if(!o||!(a=qr(a)))return o;var d=Tn(o),m=Sp(d,Tn(a));return Bi(d,m).join("")}function s_(o,a){var u=E,d=b;if(Dt(a)){var m="separator"in a?a.separator:m;u="length"in a?We(a.length):u,d="omission"in a?qr(a.omission):d}o=ut(o);var v=o.length;if(Fo(o)){var N=Tn(o);v=N.length}if(u>=v)return o;var L=u-Vo(d);if(L<1)return d;var M=N?Bi(N,0,L).join(""):o.slice(0,L);if(m===i)return M+d;if(N&&(L+=M.length-L),Wf(m)){if(o.slice(L).search(m)){var Q,te=M;for(m.global||(m=af(m.source,ut(_n.exec(m))+"g")),m.lastIndex=0;Q=m.exec(te);)var ie=Q.index;M=M.slice(0,ie===i?L:ie)}}else if(o.indexOf(qr(m),L)!=L){var me=M.lastIndexOf(m);me>-1&&(M=M.slice(0,me))}return M+d}function a_(o){return o=ut(o),o&&jo.test(o)?o.replace(ro,jS):o}var l_=$o(function(o,a,u){return o+(u?" ":"")+a.toUpperCase()}),Jf=fm("toUpperCase");function cg(o,a,u){return o=ut(o),a=u?i:a,a===i?OS(o)?zS(o):wS(o):o.match(a)||[]}var ug=Ze(function(o,a){try{return Hr(o,i,a)}catch(u){return Hf(u)?u:new Ue(u)}}),c_=li(function(o,a){return sn(a,function(u){u=Un(u),si(o,u,Uf(o[u],o))}),o});function u_(o){var a=o==null?0:o.length,u=De();return o=a?Ot(o,function(d){if(typeof d[1]!="function")throw new an(n);return[u(d[0]),d[1]]}):[],Ze(function(d){for(var m=-1;++m<a;){var v=o[m];if(Hr(v[0],this,d))return Hr(v[1],this,d)}})}function f_(o){return jw(cn(o,f))}function Kf(o){return function(){return o}}function h_(o,a){return o==null||o!==o?a:o}var d_=dm(),p_=dm(!0);function Br(o){return o}function Xf(o){return kp(typeof o=="function"?o:cn(o,f))}function m_(o){return Wp(cn(o,f))}function g_(o,a){return qp(o,cn(a,f))}var y_=Ze(function(o,a){return function(u){return Qs(u,o,a)}}),x_=Ze(function(o,a){return function(u){return Qs(o,u,a)}});function Zf(o,a,u){var d=nr(a),m=wl(a,d);u==null&&!(Dt(a)&&(m.length||!d.length))&&(u=a,a=o,o=this,m=wl(a,nr(a)));var v=!(Dt(u)&&"chain"in u)||!!u.chain,N=ui(o);return sn(m,function(L){var M=a[L];o[L]=M,N&&(o.prototype[L]=function(){var Q=this.__chain__;if(v||Q){var te=o(this.__wrapped__),ie=te.__actions__=Or(this.__actions__);return ie.push({func:M,args:arguments,thisArg:o}),te.__chain__=Q,te}return M.apply(o,Ti([this.value()],arguments))})}),o}function v_(){return rr._===this&&(rr._=WS),this}function Yf(){}function b_(o){return o=We(o),Ze(function(a){return $p(a,o)})}var S_=Mf(Ot),w_=Mf(gp),N_=Mf(Qu);function fg(o){return jf(o)?ef(Un(o)):Qw(o)}function C_(o){return function(a){return o==null?i:uo(o,a)}}var L_=mm(),__=mm(!0);function Qf(){return[]}function eh(){return!1}function T_(){return{}}function I_(){return""}function M_(){return!0}function A_(o,a){if(o=We(o),o<1||o>re)return[];var u=Me,d=pr(o,Me);a=De(a),o-=Me;for(var m=nf(d,a);++u<o;)a(u);return m}function O_(o){return ke(o)?Ot(o,Un):$r(o)?[o]:Or(Om(ut(o)))}function P_(o){var a=++kS;return ut(o)+a}var D_=Il(function(o,a){return o+a},0),B_=Af("ceil"),G_=Il(function(o,a){return o/a},1),j_=Af("floor");function E_(o){return o&&o.length?Sl(o,Br,mf):i}function R_(o,a){return o&&o.length?Sl(o,De(a,2),mf):i}function z_(o){return vp(o,Br)}function F_(o,a){return vp(o,De(a,2))}function V_(o){return o&&o.length?Sl(o,Br,vf):i}function U_(o,a){return o&&o.length?Sl(o,De(a,2),vf):i}var k_=Il(function(o,a){return o*a},1),H_=Af("round"),W_=Il(function(o,a){return o-a},0);function q_(o){return o&&o.length?rf(o,Br):0}function $_(o,a){return o&&o.length?rf(o,De(a,2)):0}return x.after=mC,x.ary=Um,x.assign=rL,x.assignIn=rg,x.assignInWith=Vl,x.assignWith=nL,x.at=iL,x.before=km,x.bind=Uf,x.bindAll=c_,x.bindKey=Hm,x.castArray=TC,x.chain=zm,x.chunk=j1,x.compact=E1,x.concat=R1,x.cond=u_,x.conforms=f_,x.constant=Kf,x.countBy=qN,x.create=oL,x.curry=Wm,x.curryRight=qm,x.debounce=$m,x.defaults=sL,x.defaultsDeep=aL,x.defer=gC,x.delay=yC,x.difference=z1,x.differenceBy=F1,x.differenceWith=V1,x.drop=U1,x.dropRight=k1,x.dropRightWhile=H1,x.dropWhile=W1,x.fill=q1,x.filter=JN,x.flatMap=ZN,x.flatMapDeep=YN,x.flatMapDepth=QN,x.flatten=Gm,x.flattenDeep=$1,x.flattenDepth=J1,x.flip=xC,x.flow=d_,x.flowRight=p_,x.fromPairs=K1,x.functions=pL,x.functionsIn=mL,x.groupBy=eC,x.initial=Z1,x.intersection=Y1,x.intersectionBy=Q1,x.intersectionWith=eN,x.invert=yL,x.invertBy=xL,x.invokeMap=rC,x.iteratee=Xf,x.keyBy=nC,x.keys=nr,x.keysIn=Dr,x.map=Gl,x.mapKeys=bL,x.mapValues=SL,x.matches=m_,x.matchesProperty=g_,x.memoize=El,x.merge=wL,x.mergeWith=ng,x.method=y_,x.methodOf=x_,x.mixin=Zf,x.negate=Rl,x.nthArg=b_,x.omit=NL,x.omitBy=CL,x.once=vC,x.orderBy=iC,x.over=S_,x.overArgs=bC,x.overEvery=w_,x.overSome=N_,x.partial=kf,x.partialRight=Jm,x.partition=oC,x.pick=LL,x.pickBy=ig,x.property=fg,x.propertyOf=C_,x.pull=iN,x.pullAll=Em,x.pullAllBy=oN,x.pullAllWith=sN,x.pullAt=aN,x.range=L_,x.rangeRight=__,x.rearg=SC,x.reject=lC,x.remove=lN,x.rest=wC,x.reverse=Ff,x.sampleSize=uC,x.set=TL,x.setWith=IL,x.shuffle=fC,x.slice=cN,x.sortBy=pC,x.sortedUniq=gN,x.sortedUniqBy=yN,x.split=ZL,x.spread=NC,x.tail=xN,x.take=vN,x.takeRight=bN,x.takeRightWhile=SN,x.takeWhile=wN,x.tap=EN,x.throttle=CC,x.thru=Bl,x.toArray=Qm,x.toPairs=og,x.toPairsIn=sg,x.toPath=O_,x.toPlainObject=tg,x.transform=ML,x.unary=LC,x.union=NN,x.unionBy=CN,x.unionWith=LN,x.uniq=_N,x.uniqBy=TN,x.uniqWith=IN,x.unset=AL,x.unzip=Vf,x.unzipWith=Rm,x.update=OL,x.updateWith=PL,x.values=Xo,x.valuesIn=DL,x.without=MN,x.words=cg,x.wrap=_C,x.xor=AN,x.xorBy=ON,x.xorWith=PN,x.zip=DN,x.zipObject=BN,x.zipObjectDeep=GN,x.zipWith=jN,x.entries=og,x.entriesIn=sg,x.extend=rg,x.extendWith=Vl,Zf(x,x),x.add=D_,x.attempt=ug,x.camelCase=EL,x.capitalize=ag,x.ceil=B_,x.clamp=BL,x.clone=IC,x.cloneDeep=AC,x.cloneDeepWith=OC,x.cloneWith=MC,x.conformsTo=PC,x.deburr=lg,x.defaultTo=h_,x.divide=G_,x.endsWith=RL,x.eq=Mn,x.escape=zL,x.escapeRegExp=FL,x.every=$N,x.find=KN,x.findIndex=Dm,x.findKey=lL,x.findLast=XN,x.findLastIndex=Bm,x.findLastKey=cL,x.floor=j_,x.forEach=Fm,x.forEachRight=Vm,x.forIn=uL,x.forInRight=fL,x.forOwn=hL,x.forOwnRight=dL,x.get=qf,x.gt=DC,x.gte=BC,x.has=gL,x.hasIn=$f,x.head=jm,x.identity=Br,x.includes=tC,x.indexOf=X1,x.inRange=GL,x.invoke=vL,x.isArguments=po,x.isArray=ke,x.isArrayBuffer=GC,x.isArrayLike=Pr,x.isArrayLikeObject=zt,x.isBoolean=jC,x.isBuffer=Gi,x.isDate=EC,x.isElement=RC,x.isEmpty=zC,x.isEqual=FC,x.isEqualWith=VC,x.isError=Hf,x.isFinite=UC,x.isFunction=ui,x.isInteger=Km,x.isLength=zl,x.isMap=Xm,x.isMatch=kC,x.isMatchWith=HC,x.isNaN=WC,x.isNative=qC,x.isNil=JC,x.isNull=$C,x.isNumber=Zm,x.isObject=Dt,x.isObjectLike=Gt,x.isPlainObject=oa,x.isRegExp=Wf,x.isSafeInteger=KC,x.isSet=Ym,x.isString=Fl,x.isSymbol=$r,x.isTypedArray=Ko,x.isUndefined=XC,x.isWeakMap=ZC,x.isWeakSet=YC,x.join=tN,x.kebabCase=VL,x.last=fn,x.lastIndexOf=rN,x.lowerCase=UL,x.lowerFirst=kL,x.lt=QC,x.lte=eL,x.max=E_,x.maxBy=R_,x.mean=z_,x.meanBy=F_,x.min=V_,x.minBy=U_,x.stubArray=Qf,x.stubFalse=eh,x.stubObject=T_,x.stubString=I_,x.stubTrue=M_,x.multiply=k_,x.nth=nN,x.noConflict=v_,x.noop=Yf,x.now=jl,x.pad=HL,x.padEnd=WL,x.padStart=qL,x.parseInt=$L,x.random=jL,x.reduce=sC,x.reduceRight=aC,x.repeat=JL,x.replace=KL,x.result=_L,x.round=H_,x.runInContext=P,x.sample=cC,x.size=hC,x.snakeCase=XL,x.some=dC,x.sortedIndex=uN,x.sortedIndexBy=fN,x.sortedIndexOf=hN,x.sortedLastIndex=dN,x.sortedLastIndexBy=pN,x.sortedLastIndexOf=mN,x.startCase=YL,x.startsWith=QL,x.subtract=W_,x.sum=q_,x.sumBy=$_,x.template=e_,x.times=A_,x.toFinite=fi,x.toInteger=We,x.toLength=eg,x.toLower=t_,x.toNumber=hn,x.toSafeInteger=tL,x.toString=ut,x.toUpper=r_,x.trim=n_,x.trimEnd=i_,x.trimStart=o_,x.truncate=s_,x.unescape=a_,x.uniqueId=P_,x.upperCase=l_,x.upperFirst=Jf,x.each=Fm,x.eachRight=Vm,x.first=jm,Zf(x,function(){var o={};return Fn(x,function(a,u){dt.call(x.prototype,u)||(o[u]=a)}),o}(),{chain:!1}),x.VERSION=e,sn(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){x[o].placeholder=x}),sn(["drop","take"],function(o,a){rt.prototype[o]=function(u){u=u===i?1:Xt(We(u),0);var d=this.__filtered__&&!a?new rt(this):this.clone();return d.__filtered__?d.__takeCount__=pr(u,d.__takeCount__):d.__views__.push({size:pr(u,Me),type:o+(d.__dir__<0?"Right":"")}),d},rt.prototype[o+"Right"]=function(u){return this.reverse()[o](u).reverse()}}),sn(["filter","map","takeWhile"],function(o,a){var u=a+1,d=u==z||u==$;rt.prototype[o]=function(m){var v=this.clone();return v.__iteratees__.push({iteratee:De(m,3),type:u}),v.__filtered__=v.__filtered__||d,v}}),sn(["head","last"],function(o,a){var u="take"+(a?"Right":"");rt.prototype[o]=function(){return this[u](1).value()[0]}}),sn(["initial","tail"],function(o,a){var u="drop"+(a?"":"Right");rt.prototype[o]=function(){return this.__filtered__?new rt(this):this[u](1)}}),rt.prototype.compact=function(){return this.filter(Br)},rt.prototype.find=function(o){return this.filter(o).head()},rt.prototype.findLast=function(o){return this.reverse().find(o)},rt.prototype.invokeMap=Ze(function(o,a){return typeof o=="function"?new rt(this):this.map(function(u){return Qs(u,o,a)})}),rt.prototype.reject=function(o){return this.filter(Rl(De(o)))},rt.prototype.slice=function(o,a){o=We(o);var u=this;return u.__filtered__&&(o>0||a<0)?new rt(u):(o<0?u=u.takeRight(-o):o&&(u=u.drop(o)),a!==i&&(a=We(a),u=a<0?u.dropRight(-a):u.take(a-o)),u)},rt.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},rt.prototype.toArray=function(){return this.take(Me)},Fn(rt.prototype,function(o,a){var u=/^(?:filter|find|map|reject)|While$/.test(a),d=/^(?:head|last)$/.test(a),m=x[d?"take"+(a=="last"?"Right":""):a],v=d||/^find/.test(a);!m||(x.prototype[a]=function(){var N=this.__wrapped__,L=d?[1]:arguments,M=N instanceof rt,Q=L[0],te=M||ke(N),ie=function(et){var nt=m.apply(x,Ti([et],L));return d&&me?nt[0]:nt};te&&u&&typeof Q=="function"&&Q.length!=1&&(M=te=!1);var me=this.__chain__,Le=!!this.__actions__.length,Re=v&&!me,Je=M&&!Le;if(!v&&te){N=Je?N:new rt(this);var je=o.apply(N,L);return je.__actions__.push({func:Bl,args:[ie],thisArg:i}),new ln(je,me)}return Re&&Je?o.apply(this,L):(je=this.thru(ie),Re?d?je.value()[0]:je.value():je)})}),sn(["pop","push","shift","sort","splice","unshift"],function(o){var a=sl[o],u=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",d=/^(?:pop|shift)$/.test(o);x.prototype[o]=function(){var m=arguments;if(d&&!this.__chain__){var v=this.value();return a.apply(ke(v)?v:[],m)}return this[u](function(N){return a.apply(ke(N)?N:[],m)})}}),Fn(rt.prototype,function(o,a){var u=x[a];if(u){var d=u.name+"";dt.call(Ho,d)||(Ho[d]=[]),Ho[d].push({name:a,func:u})}}),Ho[Tl(i,S).name]=[{name:"wrapper",func:i}],rt.prototype.clone=aw,rt.prototype.reverse=lw,rt.prototype.value=cw,x.prototype.at=RN,x.prototype.chain=zN,x.prototype.commit=FN,x.prototype.next=VN,x.prototype.plant=kN,x.prototype.reverse=HN,x.prototype.toJSON=x.prototype.valueOf=x.prototype.value=WN,x.prototype.first=x.prototype.head,qs&&(x.prototype[qs]=UN),x},Mi=FS();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(rr._=Mi,define(function(){return Mi})):oo?((oo.exports=Mi)._=Mi,Ku._=Mi):rr._=Mi}).call(Hs)});import{FileLoader as _B,Loader as TB}from"three";function yg(i){return Array.isArray(i)?i:[i]}var nT=typeof global=="object"&&global&&global.Object===Object&&global,Ul=nT;var iT=typeof self=="object"&&self&&self.Object===Object&&self,oT=Ul||iT||Function("return this")(),qt=oT;var sT=qt.Symbol,Nr=sT;var xg=Object.prototype,aT=xg.hasOwnProperty,lT=xg.toString,aa=Nr?Nr.toStringTag:void 0;function cT(i){var e=aT.call(i,aa),t=i[aa];try{i[aa]=void 0;var r=!0}catch(s){}var n=lT.call(i);return r&&(e?i[aa]=t:delete i[aa]),n}var vg=cT;var uT=Object.prototype,fT=uT.toString;function hT(i){return fT.call(i)}var bg=hT;var dT="[object Null]",pT="[object Undefined]",Sg=Nr?Nr.toStringTag:void 0;function mT(i){return i==null?i===void 0?pT:dT:Sg&&Sg in Object(i)?vg(i):bg(i)}var Xr=mT;function gT(i){return i!=null&&typeof i=="object"}var gr=gT;var yT="[object Symbol]";function xT(i){return typeof i=="symbol"||gr(i)&&Xr(i)==yT}var Zo=xT;function vT(i,e){for(var t=-1,r=i==null?0:i.length,n=Array(r);++t<r;)n[t]=e(i[t],t,i);return n}var kl=vT;var bT=Array.isArray,cr=bT;var ST=1/0,wg=Nr?Nr.prototype:void 0,Ng=wg?wg.toString:void 0;function Cg(i){if(typeof i=="string")return i;if(cr(i))return kl(i,Cg)+"";if(Zo(i))return Ng?Ng.call(i):"";var e=i+"";return e=="0"&&1/i==-ST?"-0":e}var Lg=Cg;function wT(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}var yr=wT;function NT(i){return i}var Hl=NT;var CT="[object AsyncFunction]",LT="[object Function]",_T="[object GeneratorFunction]",TT="[object Proxy]";function IT(i){if(!yr(i))return!1;var e=Xr(i);return e==LT||e==_T||e==CT||e==TT}var Yo=IT;var MT=qt["__core-js_shared__"],Wl=MT;var _g=function(){var i=/[^.]+$/.exec(Wl&&Wl.keys&&Wl.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}();function AT(i){return!!_g&&_g in i}var Tg=AT;var OT=Function.prototype,PT=OT.toString;function DT(i){if(i!=null){try{return PT.call(i)}catch(e){}try{return i+""}catch(e){}}return""}var di=DT;var BT=/[\\^$.*+?()[\]{}|]/g,GT=/^\[object .+?Constructor\]$/,jT=Function.prototype,ET=Object.prototype,RT=jT.toString,zT=ET.hasOwnProperty,FT=RegExp("^"+RT.call(zT).replace(BT,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function VT(i){if(!yr(i)||Tg(i))return!1;var e=Yo(i)?FT:GT;return e.test(di(i))}var Ig=VT;function UT(i,e){return i==null?void 0:i[e]}var Mg=UT;function kT(i,e){var t=Mg(i,e);return Ig(t)?t:void 0}var Gr=kT;var HT=Gr(qt,"WeakMap"),ql=HT;var Ag=Object.create,WT=function(){function i(){}return function(e){if(!yr(e))return{};if(Ag)return Ag(e);i.prototype=e;var t=new i;return i.prototype=void 0,t}}(),Og=WT;function qT(i,e,t){switch(t.length){case 0:return i.call(e);case 1:return i.call(e,t[0]);case 2:return i.call(e,t[0],t[1]);case 3:return i.call(e,t[0],t[1],t[2])}return i.apply(e,t)}var Pg=qT;function $T(i,e){var t=-1,r=i.length;for(e||(e=Array(r));++t<r;)e[t]=i[t];return e}var $l=$T;var JT=800,KT=16,XT=Date.now;function ZT(i){var e=0,t=0;return function(){var r=XT(),n=KT-(r-t);if(t=r,n>0){if(++e>=JT)return arguments[0]}else e=0;return i.apply(void 0,arguments)}}var Dg=ZT;function YT(i){return function(){return i}}var Bg=YT;var QT=function(){try{var i=Gr(Object,"defineProperty");return i({},"",{}),i}catch(e){}}(),Qo=QT;var eI=Qo?function(i,e){return Qo(i,"toString",{configurable:!0,enumerable:!1,value:Bg(e),writable:!0})}:Hl,Gg=eI;var tI=Dg(Gg),Jl=tI;function rI(i,e){for(var t=-1,r=i==null?0:i.length;++t<r&&e(i[t],t,i)!==!1;);return i}var jg=rI;var nI=9007199254740991,iI=/^(?:0|[1-9]\d*)$/;function oI(i,e){var t=typeof i;return e=e==null?nI:e,!!e&&(t=="number"||t!="symbol"&&iI.test(i))&&i>-1&&i%1==0&&i<e}var Kl=oI;function sI(i,e,t){e=="__proto__"&&Qo?Qo(i,e,{configurable:!0,enumerable:!0,value:t,writable:!0}):i[e]=t}var es=sI;function aI(i,e){return i===e||i!==i&&e!==e}var ji=aI;var lI=Object.prototype,cI=lI.hasOwnProperty;function uI(i,e,t){var r=i[e];(!(cI.call(i,e)&&ji(r,t))||t===void 0&&!(e in i))&&es(i,e,t)}var Xl=uI;function fI(i,e,t,r){var n=!t;t||(t={});for(var s=-1,l=e.length;++s<l;){var c=e[s],f=r?r(t[c],i[c],c,t,i):void 0;f===void 0&&(f=i[c]),n?es(t,c,f):Xl(t,c,f)}return t}var dn=fI;var Eg=Math.max;function hI(i,e,t){return e=Eg(e===void 0?i.length-1:e,0),function(){for(var r=arguments,n=-1,s=Eg(r.length-e,0),l=Array(s);++n<s;)l[n]=r[e+n];n=-1;for(var c=Array(e+1);++n<e;)c[n]=r[n];return c[e]=t(l),Pg(i,this,c)}}var Zl=hI;function dI(i,e){return Jl(Zl(i,e,Hl),i+"")}var Rg=dI;var pI=9007199254740991;function mI(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=pI}var Yl=mI;function gI(i){return i!=null&&Yl(i.length)&&!Yo(i)}var Ei=gI;function yI(i,e,t){if(!yr(t))return!1;var r=typeof e;return(r=="number"?Ei(t)&&Kl(e,t.length):r=="string"&&e in t)?ji(t[e],i):!1}var zg=yI;function xI(i){return Rg(function(e,t){var r=-1,n=t.length,s=n>1?t[n-1]:void 0,l=n>2?t[2]:void 0;for(s=i.length>3&&typeof s=="function"?(n--,s):void 0,l&&zg(t[0],t[1],l)&&(s=n<3?void 0:s,n=1),e=Object(e);++r<n;){var c=t[r];c&&i(e,c,r,s)}return e})}var Fg=xI;var vI=Object.prototype;function bI(i){var e=i&&i.constructor,t=typeof e=="function"&&e.prototype||vI;return i===t}var ts=bI;function SI(i,e){for(var t=-1,r=Array(i);++t<i;)r[t]=e(t);return r}var Vg=SI;var wI="[object Arguments]";function NI(i){return gr(i)&&Xr(i)==wI}var nh=NI;var Ug=Object.prototype,CI=Ug.hasOwnProperty,LI=Ug.propertyIsEnumerable,_I=nh(function(){return arguments}())?nh:function(i){return gr(i)&&CI.call(i,"callee")&&!LI.call(i,"callee")},mo=_I;function TI(){return!1}var kg=TI;var Hg=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Wg=Hg&&typeof module=="object"&&module&&!module.nodeType&&module,II=Wg&&Wg.exports===Hg,qg=II?qt.Buffer:void 0,MI=qg?qg.isBuffer:void 0,AI=MI||kg,rs=AI;var OI="[object Arguments]",PI="[object Array]",DI="[object Boolean]",BI="[object Date]",GI="[object Error]",jI="[object Function]",EI="[object Map]",RI="[object Number]",zI="[object Object]",FI="[object RegExp]",VI="[object Set]",UI="[object String]",kI="[object WeakMap]",HI="[object ArrayBuffer]",WI="[object DataView]",qI="[object Float32Array]",$I="[object Float64Array]",JI="[object Int8Array]",KI="[object Int16Array]",XI="[object Int32Array]",ZI="[object Uint8Array]",YI="[object Uint8ClampedArray]",QI="[object Uint16Array]",eM="[object Uint32Array]",Tt={};Tt[qI]=Tt[$I]=Tt[JI]=Tt[KI]=Tt[XI]=Tt[ZI]=Tt[YI]=Tt[QI]=Tt[eM]=!0;Tt[OI]=Tt[PI]=Tt[HI]=Tt[DI]=Tt[WI]=Tt[BI]=Tt[GI]=Tt[jI]=Tt[EI]=Tt[RI]=Tt[zI]=Tt[FI]=Tt[VI]=Tt[UI]=Tt[kI]=!1;function tM(i){return gr(i)&&Yl(i.length)&&!!Tt[Xr(i)]}var $g=tM;function rM(i){return function(e){return i(e)}}var ns=rM;var Jg=typeof exports=="object"&&exports&&!exports.nodeType&&exports,la=Jg&&typeof module=="object"&&module&&!module.nodeType&&module,nM=la&&la.exports===Jg,ih=nM&&Ul.process,iM=function(){try{var i=la&&la.require&&la.require("util").types;return i||ih&&ih.binding&&ih.binding("util")}catch(e){}}(),pi=iM;var Kg=pi&&pi.isTypedArray,oM=Kg?ns(Kg):$g,Ql=oM;var sM=Object.prototype,aM=sM.hasOwnProperty;function lM(i,e){var t=cr(i),r=!t&&mo(i),n=!t&&!r&&rs(i),s=!t&&!r&&!n&&Ql(i),l=t||r||n||s,c=l?Vg(i.length,String):[],f=c.length;for(var h in i)(e||aM.call(i,h))&&!(l&&(h=="length"||n&&(h=="offset"||h=="parent")||s&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||Kl(h,f)))&&c.push(h);return c}var ec=lM;function cM(i,e){return function(t){return i(e(t))}}var tc=cM;var uM=tc(Object.keys,Object),Xg=uM;var fM=Object.prototype,hM=fM.hasOwnProperty;function dM(i){if(!ts(i))return Xg(i);var e=[];for(var t in Object(i))hM.call(i,t)&&t!="constructor"&&e.push(t);return e}var Zg=dM;function pM(i){return Ei(i)?ec(i):Zg(i)}var is=pM;function mM(i){var e=[];if(i!=null)for(var t in Object(i))e.push(t);return e}var Yg=mM;var gM=Object.prototype,yM=gM.hasOwnProperty;function xM(i){if(!yr(i))return Yg(i);var e=ts(i),t=[];for(var r in i)r=="constructor"&&(e||!yM.call(i,r))||t.push(r);return t}var Qg=xM;function vM(i){return Ei(i)?ec(i,!0):Qg(i)}var kn=vM;var bM=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,SM=/^\w*$/;function wM(i,e){if(cr(i))return!1;var t=typeof i;return t=="number"||t=="symbol"||t=="boolean"||i==null||Zo(i)?!0:SM.test(i)||!bM.test(i)||e!=null&&i in Object(e)}var ey=wM;var NM=Gr(Object,"create"),mi=NM;function CM(){this.__data__=mi?mi(null):{},this.size=0}var ty=CM;function LM(i){var e=this.has(i)&&delete this.__data__[i];return this.size-=e?1:0,e}var ry=LM;var _M="__lodash_hash_undefined__",TM=Object.prototype,IM=TM.hasOwnProperty;function MM(i){var e=this.__data__;if(mi){var t=e[i];return t===_M?void 0:t}return IM.call(e,i)?e[i]:void 0}var ny=MM;var AM=Object.prototype,OM=AM.hasOwnProperty;function PM(i){var e=this.__data__;return mi?e[i]!==void 0:OM.call(e,i)}var iy=PM;var DM="__lodash_hash_undefined__";function BM(i,e){var t=this.__data__;return this.size+=this.has(i)?0:1,t[i]=mi&&e===void 0?DM:e,this}var oy=BM;function os(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}os.prototype.clear=ty;os.prototype.delete=ry;os.prototype.get=ny;os.prototype.has=iy;os.prototype.set=oy;var oh=os;function GM(){this.__data__=[],this.size=0}var sy=GM;function jM(i,e){for(var t=i.length;t--;)if(ji(i[t][0],e))return t;return-1}var Ri=jM;var EM=Array.prototype,RM=EM.splice;function zM(i){var e=this.__data__,t=Ri(e,i);if(t<0)return!1;var r=e.length-1;return t==r?e.pop():RM.call(e,t,1),--this.size,!0}var ay=zM;function FM(i){var e=this.__data__,t=Ri(e,i);return t<0?void 0:e[t][1]}var ly=FM;function VM(i){return Ri(this.__data__,i)>-1}var cy=VM;function UM(i,e){var t=this.__data__,r=Ri(t,i);return r<0?(++this.size,t.push([i,e])):t[r][1]=e,this}var uy=UM;function ss(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}ss.prototype.clear=sy;ss.prototype.delete=ay;ss.prototype.get=ly;ss.prototype.has=cy;ss.prototype.set=uy;var zi=ss;var kM=Gr(qt,"Map"),Fi=kM;function HM(){this.size=0,this.__data__={hash:new oh,map:new(Fi||zi),string:new oh}}var fy=HM;function WM(i){var e=typeof i;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?i!=="__proto__":i===null}var hy=WM;function qM(i,e){var t=i.__data__;return hy(e)?t[typeof e=="string"?"string":"hash"]:t.map}var Vi=qM;function $M(i){var e=Vi(this,i).delete(i);return this.size-=e?1:0,e}var dy=$M;function JM(i){return Vi(this,i).get(i)}var py=JM;function KM(i){return Vi(this,i).has(i)}var my=KM;function XM(i,e){var t=Vi(this,i),r=t.size;return t.set(i,e),this.size+=t.size==r?0:1,this}var gy=XM;function as(i){var e=-1,t=i==null?0:i.length;for(this.clear();++e<t;){var r=i[e];this.set(r[0],r[1])}}as.prototype.clear=fy;as.prototype.delete=dy;as.prototype.get=py;as.prototype.has=my;as.prototype.set=gy;var ca=as;var ZM="Expected a function";function sh(i,e){if(typeof i!="function"||e!=null&&typeof e!="function")throw new TypeError(ZM);var t=function(){var r=arguments,n=e?e.apply(this,r):r[0],s=t.cache;if(s.has(n))return s.get(n);var l=i.apply(this,r);return t.cache=s.set(n,l)||s,l};return t.cache=new(sh.Cache||ca),t}sh.Cache=ca;var yy=sh;var YM=500;function QM(i){var e=yy(i,function(r){return t.size===YM&&t.clear(),r}),t=e.cache;return e}var xy=QM;var eA=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,tA=/\\(\\)?/g,rA=xy(function(i){var e=[];return i.charCodeAt(0)===46&&e.push(""),i.replace(eA,function(t,r,n,s){e.push(n?s.replace(tA,"$1"):r||t)}),e}),vy=rA;function nA(i){return i==null?"":Lg(i)}var by=nA;function iA(i,e){return cr(i)?i:ey(i,e)?[i]:vy(by(i))}var ls=iA;var oA=1/0;function sA(i){if(typeof i=="string"||Zo(i))return i;var e=i+"";return e=="0"&&1/i==-oA?"-0":e}var rc=sA;function aA(i,e){e=ls(e,i);for(var t=0,r=e.length;i!=null&&t<r;)i=i[rc(e[t++])];return t&&t==r?i:void 0}var Sy=aA;function lA(i,e){for(var t=-1,r=e.length,n=i.length;++t<r;)i[n+t]=e[t];return i}var cs=lA;var wy=Nr?Nr.isConcatSpreadable:void 0;function cA(i){return cr(i)||mo(i)||!!(wy&&i&&i[wy])}var Ny=cA;function Cy(i,e,t,r,n){var s=-1,l=i.length;for(t||(t=Ny),n||(n=[]);++s<l;){var c=i[s];e>0&&t(c)?e>1?Cy(c,e-1,t,r,n):cs(n,c):r||(n[n.length]=c)}return n}var Ly=Cy;function uA(i){var e=i==null?0:i.length;return e?Ly(i,1):[]}var _y=uA;function fA(i){return Jl(Zl(i,void 0,_y),i+"")}var Ty=fA;var hA=tc(Object.getPrototypeOf,Object),us=hA;var dA="[object Object]",pA=Function.prototype,mA=Object.prototype,Iy=pA.toString,gA=mA.hasOwnProperty,yA=Iy.call(Object);function xA(i){if(!gr(i)||Xr(i)!=dA)return!1;var e=us(i);if(e===null)return!0;var t=gA.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Iy.call(t)==yA}var nc=xA;function vA(i,e,t){var r=-1,n=i.length;e<0&&(e=-e>n?0:n+e),t=t>n?n:t,t<0&&(t+=n),n=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(n);++r<n;)s[r]=i[r+e];return s}var My=vA;function bA(){this.__data__=new zi,this.size=0}var Ay=bA;function SA(i){var e=this.__data__,t=e.delete(i);return this.size=e.size,t}var Oy=SA;function wA(i){return this.__data__.get(i)}var Py=wA;function NA(i){return this.__data__.has(i)}var Dy=NA;var CA=200;function LA(i,e){var t=this.__data__;if(t instanceof zi){var r=t.__data__;if(!Fi||r.length<CA-1)return r.push([i,e]),this.size=++t.size,this;t=this.__data__=new ca(r)}return t.set(i,e),this.size=t.size,this}var By=LA;function fs(i){var e=this.__data__=new zi(i);this.size=e.size}fs.prototype.clear=Ay;fs.prototype.delete=Oy;fs.prototype.get=Py;fs.prototype.has=Dy;fs.prototype.set=By;var ic=fs;function _A(i,e){return i&&dn(e,is(e),i)}var Gy=_A;function TA(i,e){return i&&dn(e,kn(e),i)}var jy=TA;var Ey=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Ry=Ey&&typeof module=="object"&&module&&!module.nodeType&&module,IA=Ry&&Ry.exports===Ey,zy=IA?qt.Buffer:void 0,Fy=zy?zy.allocUnsafe:void 0;function MA(i,e){if(e)return i.slice();var t=i.length,r=Fy?Fy(t):new i.constructor(t);return i.copy(r),r}var oc=MA;function AA(i,e){for(var t=-1,r=i==null?0:i.length,n=0,s=[];++t<r;){var l=i[t];e(l,t,i)&&(s[n++]=l)}return s}var Vy=AA;function OA(){return[]}var sc=OA;var PA=Object.prototype,DA=PA.propertyIsEnumerable,Uy=Object.getOwnPropertySymbols,BA=Uy?function(i){return i==null?[]:(i=Object(i),Vy(Uy(i),function(e){return DA.call(i,e)}))}:sc,hs=BA;function GA(i,e){return dn(i,hs(i),e)}var ky=GA;var jA=Object.getOwnPropertySymbols,EA=jA?function(i){for(var e=[];i;)cs(e,hs(i)),i=us(i);return e}:sc,ac=EA;function RA(i,e){return dn(i,ac(i),e)}var Hy=RA;function zA(i,e,t){var r=e(i);return cr(i)?r:cs(r,t(i))}var lc=zA;function FA(i){return lc(i,is,hs)}var Wy=FA;function VA(i){return lc(i,kn,ac)}var cc=VA;var UA=Gr(qt,"DataView"),uc=UA;var kA=Gr(qt,"Promise"),fc=kA;var HA=Gr(qt,"Set"),hc=HA;var qy="[object Map]",WA="[object Object]",$y="[object Promise]",Jy="[object Set]",Ky="[object WeakMap]",Xy="[object DataView]",qA=di(uc),$A=di(Fi),JA=di(fc),KA=di(hc),XA=di(ql),go=Xr;(uc&&go(new uc(new ArrayBuffer(1)))!=Xy||Fi&&go(new Fi)!=qy||fc&&go(fc.resolve())!=$y||hc&&go(new hc)!=Jy||ql&&go(new ql)!=Ky)&&(go=function(i){var e=Xr(i),t=e==WA?i.constructor:void 0,r=t?di(t):"";if(r)switch(r){case qA:return Xy;case $A:return qy;case JA:return $y;case KA:return Jy;case XA:return Ky}return e});var ds=go;var ZA=Object.prototype,YA=ZA.hasOwnProperty;function QA(i){var e=i.length,t=new i.constructor(e);return e&&typeof i[0]=="string"&&YA.call(i,"index")&&(t.index=i.index,t.input=i.input),t}var Zy=QA;var eO=qt.Uint8Array,ah=eO;function tO(i){var e=new i.constructor(i.byteLength);return new ah(e).set(new ah(i)),e}var ps=tO;function rO(i,e){var t=e?ps(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.byteLength)}var Yy=rO;var nO=/\w*$/;function iO(i){var e=new i.constructor(i.source,nO.exec(i));return e.lastIndex=i.lastIndex,e}var Qy=iO;var ex=Nr?Nr.prototype:void 0,tx=ex?ex.valueOf:void 0;function oO(i){return tx?Object(tx.call(i)):{}}var rx=oO;function sO(i,e){var t=e?ps(i.buffer):i.buffer;return new i.constructor(t,i.byteOffset,i.length)}var dc=sO;var aO="[object Boolean]",lO="[object Date]",cO="[object Map]",uO="[object Number]",fO="[object RegExp]",hO="[object Set]",dO="[object String]",pO="[object Symbol]",mO="[object ArrayBuffer]",gO="[object DataView]",yO="[object Float32Array]",xO="[object Float64Array]",vO="[object Int8Array]",bO="[object Int16Array]",SO="[object Int32Array]",wO="[object Uint8Array]",NO="[object Uint8ClampedArray]",CO="[object Uint16Array]",LO="[object Uint32Array]";function _O(i,e,t){var r=i.constructor;switch(e){case mO:return ps(i);case aO:case lO:return new r(+i);case gO:return Yy(i,t);case yO:case xO:case vO:case bO:case SO:case wO:case NO:case CO:case LO:return dc(i,t);case cO:return new r;case uO:case dO:return new r(i);case fO:return Qy(i);case hO:return new r;case pO:return rx(i)}}var nx=_O;function TO(i){return typeof i.constructor=="function"&&!ts(i)?Og(us(i)):{}}var pc=TO;var IO="[object Map]";function MO(i){return gr(i)&&ds(i)==IO}var ix=MO;var ox=pi&&pi.isMap,AO=ox?ns(ox):ix,sx=AO;var OO="[object Set]";function PO(i){return gr(i)&&ds(i)==OO}var ax=PO;var lx=pi&&pi.isSet,DO=lx?ns(lx):ax,cx=DO;var BO=1,GO=2,jO=4,ux="[object Arguments]",EO="[object Array]",RO="[object Boolean]",zO="[object Date]",FO="[object Error]",fx="[object Function]",VO="[object GeneratorFunction]",UO="[object Map]",kO="[object Number]",hx="[object Object]",HO="[object RegExp]",WO="[object Set]",qO="[object String]",$O="[object Symbol]",JO="[object WeakMap]",KO="[object ArrayBuffer]",XO="[object DataView]",ZO="[object Float32Array]",YO="[object Float64Array]",QO="[object Int8Array]",eP="[object Int16Array]",tP="[object Int32Array]",rP="[object Uint8Array]",nP="[object Uint8ClampedArray]",iP="[object Uint16Array]",oP="[object Uint32Array]",Nt={};Nt[ux]=Nt[EO]=Nt[KO]=Nt[XO]=Nt[RO]=Nt[zO]=Nt[ZO]=Nt[YO]=Nt[QO]=Nt[eP]=Nt[tP]=Nt[UO]=Nt[kO]=Nt[hx]=Nt[HO]=Nt[WO]=Nt[qO]=Nt[$O]=Nt[rP]=Nt[nP]=Nt[iP]=Nt[oP]=!0;Nt[FO]=Nt[fx]=Nt[JO]=!1;function mc(i,e,t,r,n,s){var l,c=e&BO,f=e&GO,h=e&jO;if(t&&(l=n?t(i,r,n,s):t(i)),l!==void 0)return l;if(!yr(i))return i;var p=cr(i);if(p){if(l=Zy(i),!c)return $l(i,l)}else{var y=ds(i),g=y==fx||y==VO;if(rs(i))return oc(i,c);if(y==hx||y==ux||g&&!n){if(l=f||g?{}:pc(i),!c)return f?Hy(i,jy(l,i)):ky(i,Gy(l,i))}else{if(!Nt[y])return n?i:{};l=nx(i,y,c)}}s||(s=new ic);var w=s.get(i);if(w)return w;s.set(i,l),cx(i)?i.forEach(function(C){l.add(mc(C,e,t,C,i,s))}):sx(i)&&i.forEach(function(C,B){l.set(B,mc(C,e,t,B,i,s))});var S=h?f?cc:Wy:f?kn:is,T=p?void 0:S(i);return jg(T||i,function(C,B){T&&(B=C,C=i[B]),Xl(l,B,mc(C,e,t,B,i,s))}),l}var gc=mc;var sP=1,aP=4;function lP(i){return gc(i,sP|aP)}var yo=lP;function cP(i){return function(e,t,r){for(var n=-1,s=Object(e),l=r(e),c=l.length;c--;){var f=l[i?c:++n];if(t(s[f],f,s)===!1)break}return e}}var dx=cP;var uP=dx(),px=uP;function fP(i,e,t){(t!==void 0&&!ji(i[e],t)||t===void 0&&!(e in i))&&es(i,e,t)}var ua=fP;function hP(i){return gr(i)&&Ei(i)}var mx=hP;function dP(i,e){if(!(e==="constructor"&&typeof i[e]=="function")&&e!="__proto__")return i[e]}var fa=dP;function pP(i){return dn(i,kn(i))}var gx=pP;function mP(i,e,t,r,n,s,l){var c=fa(i,t),f=fa(e,t),h=l.get(f);if(h){ua(i,t,h);return}var p=s?s(c,f,t+"",i,e,l):void 0,y=p===void 0;if(y){var g=cr(f),w=!g&&rs(f),S=!g&&!w&&Ql(f);p=f,g||w||S?cr(c)?p=c:mx(c)?p=$l(c):w?(y=!1,p=oc(f,!0)):S?(y=!1,p=dc(f,!0)):p=[]:nc(f)||mo(f)?(p=c,mo(c)?p=gx(c):(!yr(c)||Yo(c))&&(p=pc(f))):y=!1}y&&(l.set(f,p),n(p,f,r,s,l),l.delete(f)),ua(i,t,p)}var yx=mP;function xx(i,e,t,r,n){i!==e&&px(e,function(s,l){if(n||(n=new ic),yr(s))yx(i,e,l,t,xx,r,n);else{var c=r?r(fa(i,l),s,l+"",i,e,n):void 0;c===void 0&&(c=s),ua(i,l,c)}},kn)}var vx=xx;function gP(i){var e=i==null?0:i.length;return e?i[e-1]:void 0}var bx=gP;function yP(i,e){return e.length<2?i:Sy(i,My(e,0,-1))}var Sx=yP;var xP=Fg(function(i,e,t){vx(i,e,t)}),xo=xP;function vP(i,e){return e=ls(e,i),i=Sx(i,e),i==null||delete i[rc(bx(e))]}var wx=vP;function bP(i){return nc(i)?void 0:i}var Nx=bP;var SP=1,wP=2,NP=4,CP=Ty(function(i,e){var t={};if(i==null)return t;var r=!1;e=kl(e,function(s){return s=ls(s,i),r||(r=s.length>1),s}),dn(i,cc(i),t),r&&(t=gc(t,SP|wP|NP,Nx));for(var n=e.length;n--;)wx(t,e[n]);return t}),ms=CP;var gs;(function(t){t.all=["PerspectiveCamera","OrthographicCamera"];function e(r){return t.all.includes(r)}t.is=e})(gs||(gs={}));var vo;(function(n){n.DefaultUp=[0,1,0],n.DefaultTargetOffset=1e3,n.defaultData={far:5e5,type:"OrthographicCamera",perspective:{near:5,fov:45,zoom:1},orthographic:{near:-5e5,zoom:1},up:n.DefaultUp,isUpVectorFlipped:!1,targetOffset:n.DefaultTargetOffset};function r(s){return s.type==="PerspectiveCamera"?s.perspective.zoom:s.orthographic.zoom}n.getZoom=r})(vo||(vo={}));var ys;(function(r){r.x="x",r.y="y",r.z="z"})(ys||(ys={}));var Cx;(function(s){s.Top="top",s.Right="right",s.Bottom="bottom",s.Left="left",s.Center="center"})(Cx||(Cx={}));var Lx;(function(t){function i(r,n){return r[0]===n[0]&&r[1]===n[1]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s]}t.lerp=e})(Lx||(Lx={}));var xs;(function(n){function i(s,l){return s[0]===l[0]&&s[1]===l[1]&&s[2]===l[2]}n.isEqual=i;function e(s,l){return[s[0]+l[0],s[1]+l[1],s[2]+l[2]]}n.add=e;function t(s,l){return[s[0]-l[0],s[1]-l[1],s[2]-l[2]]}n.sub=t;function r(s,l,c){return[s[0]+(l[0]-s[0])*c,s[1]+(l[1]-s[1])*c,s[2]+(l[2]-s[2])*c]}n.lerp=r})(xs||(xs={}));var _x;(function(t){function i(r,n){return r[0]===n[0]&&r[1]===n[1]&&r[2]===n[2]&&r[3]===n[3]}t.isEqual=i;function e(r,n,s){return[r[0]+(n[0]-r[0])*s,r[1]+(n[1]-r[1])*s,r[2]+(n[2]-r[2])*s,r[3]+(n[3]-r[3])*s]}t.lerp=e})(_x||(_x={}));var Ui;(function(s){s.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function e(l,c){for(let f=0;f<16;f++)if(l[f]!==c[f])return!1;return!0}s.isEqual=e;function t(l){return l!=null?l:s.identity}s.simplify=t;function r(l,c){let f=c.slice(0);for(var h=0,p=c.length;h<p;h+=3){let y=1/(l[3]*c[h]+l[7]*c[h+1]+l[11]*c[h+2]+l[15]);f[h]=(l[0]*c[h]+l[4]*c[h+1]+l[8]*c[h+2]+l[12])*y,f[h+1]=(l[1]*c[h]+l[5]*c[h+1]+l[9]*c[h+2]+l[13])*y,f[h+2]=(l[2]*c[h]+l[6]*c[h+1]+l[10]*c[h+2]+l[14])*y}return f}s.applyMatrix4=r;function n(l,c){let f=c.slice(0);for(var h=0,p=c.length;h<p;h+=3)f[h]=l[0]*c[h]+l[4]*c[h+1]+l[8]*c[h+2],f[h+1]=l[1]*c[h]+l[5]*c[h+1]+l[9]*c[h+2],f[h+2]=l[2]*c[h]+l[6]*c[h+1]+l[10]*c[h+2];return f}s.applyMatrix3Components=n})(Ui||(Ui={}));var Zr;(function(f){f.white={r:1,g:1,b:1},f.red={r:1,g:0,b:0},f.black={r:0,g:0,b:0};function r(h){return{r:Math.round(h.r*255),g:Math.round(h.g*255),b:Math.round(h.b*255),a:1}}f.toRgb255a1=r;function n(h){return{r:h.r,g:h.g,b:h.b}}f.clone=n;function s(h){return h=Math.floor(h),{r:(h>>16&255)/255,g:(h>>8&255)/255,b:(h&255)/255}}f.fromHex=s;function l(h,p){return h.r===p.r&&h.g===p.g&&h.b===p.b}f.equals=l;function c(h,p,y){return{r:h.r+(p.r-h.r)*y,g:h.g+(p.g-h.g)*y,b:h.b+(p.b-h.b)*y}}f.lerp=c})(Zr||(Zr={}));var Hn;(function(s){s.white=fe(U({},Zr.white),{a:1});function e(l){return{r:l[0],g:l[1],b:l[2],a:l[3]}}s.from0to1=e;function t(l,c){return fe(U({},Zr.fromHex(l)),{a:c})}s.fromHexAndA=t;function r(l){return{r:Math.round(l.r*255),g:Math.round(l.g*255),b:Math.round(l.b*255),a:l.a}}s.toRgb255a1=r;function n(l,c){return Zr.equals(l,c)&&l.a===c.a}s.equals=n})(Hn||(Hn={}));var yc;(function(e){e.identity={position:[0,0,0],rotation:[0,0,0],scale:[1,1,1]}})(yc||(yc={}));var Tx;(function(D){D[D.SKIP=0]="SKIP",D[D.ADD=1]="ADD",D[D.ALPHA=2]="ALPHA",D[D.AVERAGE=3]="AVERAGE",D[D.COLOR_BURN=4]="COLOR_BURN",D[D.COLOR_DODGE=5]="COLOR_DODGE",D[D.DARKEN=6]="DARKEN",D[D.DIFFERENCE=7]="DIFFERENCE",D[D.EXCLUSION=8]="EXCLUSION",D[D.LIGHTEN=9]="LIGHTEN",D[D.MULTIPLY=10]="MULTIPLY",D[D.DIVIDE=11]="DIVIDE",D[D.NEGATION=12]="NEGATION",D[D.NORMAL=13]="NORMAL",D[D.OVERLAY=14]="OVERLAY",D[D.REFLECT=15]="REFLECT",D[D.SCREEN=16]="SCREEN",D[D.SOFT_LIGHT=17]="SOFT_LIGHT",D[D.SUBTRACT=18]="SUBTRACT"})(Tx||(Tx={}));var Ix;(function(c){c[c.LINEAR=0]="LINEAR",c[c.EASE=1]="EASE",c[c.EASE_IN=2]="EASE_IN",c[c.EASE_OUT=3]="EASE_OUT",c[c.EASE_IN_OUT=4]="EASE_IN_OUT",c[c.CUBIC=5]="CUBIC",c[c.SPRING=6]="SPRING"})(Ix||(Ix={}));var Mx;(function(e){e.defaultData={mass:1,stiffness:80,damping:10,velocity:0}})(Mx||(Mx={}));var Ax;(function(e){e.defaultData={control1:[.5,.05],control2:[.1,.3]}})(Ax||(Ax={}));var xc;(function(e){function i(t,r=.1){return{type:"radial",hideBase:!1,count:3,radial:{radius:Math.max(t[0],t[1])*2,start:0,end:360,alignment:!1,axis:ys.y,scale:[0,0,0],rotation:[0,0,0],position:[0,0,0]},linear:{scale:[0,0,0],rotation:[0,0,0],position:[t[0]+t[0]*r,0,0]},grid:{count:[2,2,2],size:t.map(n=>n*(1+r)),useCenter:!0}}}e.defaultData=i})(xc||(xc={}));var Wn;(function(e){e[e.Update=0]="Update"})(Wn||(Wn={}));var pn;(function(r){r[r.Add=1]="Add",r[r.Delete=2]="Delete",r[r.Unlink=3]="Unlink"})(pn||(pn={}));var Yr;(function(r){r[r.Add=4]="Add",r[r.Delete=5]="Delete",r[r.Move=6]="Move"})(Yr||(Yr={}));var jr;(function(r){r[r.Add=7]="Add",r[r.Delete=8]="Delete",r[r.Move=9]="Move"})(jr||(jr={}));var On=class{modifyById(e,t){let r=this;if(r[e]===void 0)throw new Error("not expected");{let s=fe(U({},r),{[e]:t});return Object.setPrototypeOf(s,On.prototype),s}}add(e,t){var n;let r=this.runOp({type:pn.Add,id:e,data:t});return(n=r==null?void 0:r.data)!=null?n:this}runOp(e){let t=this;if(e.type===pn.Add){let r=t[e.id],n;r===void 0?n={type:pn.Delete,id:e.id}:n={type:pn.Add,id:e.id,data:r};let{id:s,data:l}=e,c=fe(U({},t),{[s]:l});return Object.setPrototypeOf(c,On.prototype),{data:c,actual:e,reverse:n}}else if(e.type===pn.Delete){let{id:r}=e,n=t[r];if(n===void 0)return null;{let s=U({},t);return Object.setPrototypeOf(s,On.prototype),delete s[r],{data:s,actual:e,reverse:{type:pn.Add,id:r,data:n}}}}throw new Error("illegal arg")}};function ha(i){if(i.deepFreeze!==void 0){i.deepFreeze(i);return}let e=Object.getOwnPropertyNames(i);for(let t of e){let r=i[t];r&&typeof r=="object"&&ha(r)}return Object.freeze(i)}function Ox(i,e){let t=0;for(;t<i.length&&t<e.length;){if(i[t]<e[t])return-1;if(i[t]>e[t])return 1;t+=1}return t!==e.length?-1:t!==i.length?1:0}var lh=class extends Error{};function qn(i,e,t){if(i===void 0?e===void 0?(i=0,e=10):i=e-10:e===void 0&&(e=i+10),i>e){let s=i;i=e,e=s}let r=[],n=1/(t+1);for(let s=0;s<t;s++){let l=i+(e-i)*(s+.75+Math.random()*.5)*n;r.push(l)}return r}function Px(i){return i instanceof Uint8Array||i instanceof Uint16Array||i instanceof Uint32Array||i instanceof Int8Array||i instanceof Int16Array||i instanceof Int32Array||i instanceof Float32Array||i instanceof Float64Array}function Dx(){return typeof process!="undefined"}function Bx(i,e){for(let t of i)e(t.id,t.data),Bx(t.children,e)}function Gx(i,e){e(i.id,i.data);for(let t of i.children)Gx(t,e)}var Pn=class extends Array{constructor(...e){super(...e);Object.setPrototypeOf(this,Pn.prototype)}deepFreeze(){let e=0;for(;e<this.length;)ha(this[e]),e++}fillCaches0(e,t){var r;if((r=this.objCaches)==null?void 0:r.has(e.id))throw new Error("duplicated item");this.objCaches.set(e.id,e),this.parentCaches.set(e.id,t);for(let n of e.children)this.fillCaches0(n,e.id)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,this.parentCaches=new Map;for(let e of this)this.fillCaches0(e,null)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}isDescendantOf(e,t){for(;e;){let r=this.parent(e);if(r===t)return!0;e=r}return!1}data(e){var t;return(t=this.get(e))==null?void 0:t.data}has(e){return this.childrenOf(e)!==void 0}get(e){return this.fillCaches(),this.objCaches.get(e)}childrenOf(e){var t;return e===null?this:(t=this.get(e))==null?void 0:t.children}traverseFrom(e,t){if(e===null)this.traverse(t);else{let r=this.get(e);r&&Gx(r,t)}}traverse(e){Bx(this,e)}totalSize(){return this.fillCaches(),this.objCaches.size}parent(e){return this.fillCaches(),this.parentCaches.get(e)}childrenArray(e){return e===null?this:this.get(e).children}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let n=this.parent(e),s=this.childrenArray(n),l=s.findIndex(h=>h.id===e);if(l<0)throw new Error("not expected");let c=s[l];return s=[...s],s[l]=fe(U({},c),{data:t}),this.modifyArrayBy(n,s)}}modifyArrayBy(e,t){let r=e,n=t;for(;r!==null;){let l=n,c=r;if(r=this.parent(r),r===void 0)throw new Error;n=this.childrenArray(r);let f=n.findIndex(h=>h.id===c);if(f<0)throw new Error;n=[...n],n[f]=fe(U({},n[f]),{children:l})}Object.setPrototypeOf(n,Pn.prototype);let s=n;return s.fillCaches(),s}runOp(e){switch(e.type){case jr.Add:return this.addOp(e);case jr.Delete:return this.deleteOp(e);case jr.Move:return this.moveOp(e)}}addOp(e){let{parent:t,fi:r,id:n,data:s,children:l}=e;if(t!==null&&this.get(t)===void 0)return null;if(this.get(n)!==void 0)return null;{let c=t,f=this.childrenArray(c),h={fi:r,id:n,data:s,children:l};return f=[...f,h],f.sort((y,g)=>y.fi-g.fi),e.localIndex=f.indexOf(h),{data:this.modifyArrayBy(c,f),actual:e,reverse:{type:jr.Delete,id:n}}}}deleteOp(e){let{id:t}=e;if(this.get(t)===null)return null;{let r=this.parent(t);if(r===void 0)return null;let n=this.childrenArray(r),s=n.findIndex(f=>f.id===t);e.localIndex=s,n=[...n];let l=n.splice(s,1)[0];return{data:this.modifyArrayBy(r,n),actual:e,reverse:fe(U({type:jr.Add},l),{parent:r})}}}moveOp(e){let{parent:t,fi:r,id:n}=e;if(t!==null&&this.get(t)===void 0)return this.deleteOp({type:jr.Delete,id:n});if(t!==null){let g=t;for(;g!==null;){if(g===void 0)throw new Error;if(g===n)throw new lh("cyclic tree");g=this.parent(g)}}let s=this.parent(n);if(s===void 0)return null;let l=s,c=this.childrenArray(s),f=c.findIndex(g=>g.id===n);c=[...c];let h=c.splice(f,1)[0],p=this.modifyArrayBy(s,c);s=t,c=p.childrenArray(s);let y=h.fi;return h=fe(U({},h),{fi:r}),c=[...c,h],c.sort((g,w)=>g.fi-w.fi),e.localIndex=c.indexOf(h),p=p.modifyArrayBy(s,c),{data:p,actual:e,reverse:{type:jr.Move,parent:l,fi:y,id:n}}}previous(e,t){if(t===null){let n=this.childrenArray(e);return n.length===0?null:n[n.length-1].id}let r=null;for(let n of this.childrenArray(e)){if(n.id===t)return r;r=n.id}return null}traverseSortNext(e){let t=this.parent(e);if(t!==void 0){let r=this.childrenArray(t),n=r.findIndex(s=>s.id===e)+1;if(n<r.length)return r[n].id;if(t)return this.traverseSortNext(t)}}sortNext(e){let t=this.childrenArray(e);return t.length>0?t[0].id:this.traverseSortNext(e)}traverseSortPrevious(e){let t=this.childrenArray(e);return t.length>0?this.traverseSortPrevious(t[t.length-1].id):e}sortPrevious(e){let t=this.parent(e);if(t!==void 0){let r=this.childrenArray(t),n=r.findIndex(s=>s.id===e)-1;return n>=0?this.traverseSortPrevious(r[n].id):t}}getAllSorted(e){let t=[];for(let r of e){let n=this.getWithSortKey(r.id);n!==void 0&&t.push(U(U({},r),n))}t.sort((r,n)=>Ox(r.sortKey,n.sortKey));for(let r of t)delete r.sortKey;return t}getWithSortKey(e){var t=e;let r=[],n=this.get(t),s=n;if(n!==void 0){for(;t;)r.splice(0,0,n.fi),t=this.parent(t),t!==null&&(n=this.get(t));return fe(U({},s),{sortKey:r})}}insertBeforeHelper(e,t,r){return this.insertAfterHelper(e,this.previous(e,t),r)}insertAfterHelper(e,t,r){let n=this.childrenArray(e);if(t===null){if(n.length===0)return qn(0,r,r);{let s=n[0].fi;return qn(s-r,s,r)}}else{let s=this.get(t);if(s===void 0||this.parent(t)!==e)throw new Error("illegal args");let l=n.find(c=>c.fi>s.fi);if(l===void 0){let c=n[n.length-1].fi;return qn(c,c+r,r)}else return qn(s.fi,l.fi,r)}}};var vc;(function(e){function i(t,r){if(Array.isArray(t)){let n=r.props,s={},l=[...t],c=!1;if(n)for(let f of Object.keys(n)){let h=parseInt(f);if(isNaN(h))throw new Error("wrong index");s[f]=l[h],l[h]=n[f],c=!0}return c?{data:l,actual:r,reverse:{type:Wn.Update,props:s}}:null}else{let n=r.props,s={},l=U({},t),c=!1;if(n)for(let f of Object.keys(n)){s[f]=l[f];let h=n[f];h===void 0?delete l[f]:l[f]=h,c=!0}return c?{data:l,actual:r,reverse:{type:Wn.Update,props:s}}:null}}e.runOp=i})(vc||(vc={}));var jt=class extends Array{constructor(...e){super(...e);Object.setPrototypeOf(this,jt.prototype)}deepFreeze(){let e=0;for(;e<this.length;)ha(this[e]),e++}fillCaches0(e){this.objCaches.set(e.id,e)}fillCaches(){if(this.objCaches===void 0){this.objCaches=new Map,Object.getOwnPropertyDescriptor(this,"objCaches").enumerable=!1;for(let e of this)this.fillCaches0(e)}}randomId(){this.fillCaches();let e=Array.from(this.objCaches.keys());if(e.length!==0)return e[Math.max(0,Math.floor(Math.random()*e.length)-1)]}data(e){var t;return(t=this.get(e))==null?void 0:t.data}get(e){return this.fillCaches(),this.objCaches.get(e)}modifyById(e,t){if(this.get(e)===void 0)throw new Error("not expected");{let n=this,s=n.findIndex(f=>f.id===e);if(s<0)throw new Error("not expected");let l=n[s];return n=[...n],n[s]=fe(U({},l),{data:t}),this.modifyArrayBy(n)}}modifyArrayBy(e){Object.setPrototypeOf(e,jt.prototype);let t=e;return Dx()||t.fillCaches(),t}runOp(e){switch(e.type){case Yr.Add:return this.addOp(e);case Yr.Delete:return this.deleteOp(e);case Yr.Move:return this.moveOp(e)}}addOp(e){let{fi:t,id:r,data:n}=e,s=this,l={fi:t,id:r,data:n};return s=[...s,l],s.sort((f,h)=>f.fi-h.fi),e.localIndex=s.indexOf(l),{data:this.modifyArrayBy(s),actual:e,reverse:{type:Yr.Delete,id:r}}}deleteOp(e){let{id:t}=e,r=this,n=r.findIndex(c=>c.id===t);if(n===-1)return null;e.localIndex=n,r=[...r];let s=r.splice(n,1)[0];return{data:this.modifyArrayBy(r),actual:e,reverse:U({type:Yr.Add},s)}}moveOp(e){let{fi:t,id:r}=e,n=this;n=[...n];let s=n.findIndex(h=>h.id===r);if(s===-1)return null;let l=n[s].fi,c=fe(U({},n[s]),{fi:t});return n[s]=c,n.sort((h,p)=>h.fi-p.fi),e.localIndex=n.indexOf(c),{data:this.modifyArrayBy(n),actual:e,reverse:{type:Yr.Move,fi:l,id:r}}}previous(e){if(e===null)return this.length===0?null:this[this.length-1].id;let t=null;for(let r of this){if(r.id===e)return t;t=r.id}return null}insertBeforeHelper(e,t){return this.insertAfterHelper(this.previous(e),t)}insertAfterHelper(e,t){let r=this;if(e===null){if(r.length===0)return qn(0,t,t);{let n=r[0].fi;return qn(n-t,n,t)}}else{let n=this.get(e);if(n===void 0)throw new Error("illegal args");let s=r.find(l=>l.fi>n.fi);if(s===void 0){let l=r[r.length-1].fi;return qn(l,l+t,t)}else return qn(n.fi,s.fi,t)}}};var jx=Symbol(),bc=Symbol(),da=class{reportOp(e,t){let r=this;if(t===null)return;r._current=t.data;let n=[];for(;!(r instanceof uh);){let s=r._path,l=r._current;if(s!==""&&n.splice(0,0,s),r=r._parent,r===null)return;r.update(s,l)}r.push(n,e,t.actual,t.reverse)}deleteChildren(e){if(this._children){let t=this._children[e];if(t){let r=t[bc];r&&r(),delete this._children[e]}}}},Ex=class extends da{constructor(e,t,r){super();this._parent=e,this._path=t,this._current=r}update(e,t){if(Array.isArray(this._current)){if(typeof e=="string"&&(e=parseInt(e),isNaN(e)))throw new Error("Invalid path");this._current=[...this._current],this._current[e]=t}else this._current=fe(U({},this._current),{[e]:t})}runOp(e){this.reportOp(e,vc.runOp(this._current,e))}},Rx=class extends da{constructor(e,t,r){super();this._parent=e,this._path=t,this._current=r}update(e,t){this._current=fe(U({},this._current),{[e]:t}),Object.setPrototypeOf(this._current,On.prototype)}runOp(e){this.reportOp(e,this._current.runOp(e))}},zx={get(i,e){if(e===bc)return()=>{i._parent=null};if(e===jx)return i._current;let{_current:t,_children:r}=i;if(e==="push"&&Array.isArray(t))throw new Error("not supported to expand array");let n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=t[e],l=Sc(i,e,s);return l!==s?(r===void 0&&(r={},i._children=r),r[e]=l,l):s},has(i,e){return e in i._current},ownKeys(i){return Reflect.ownKeys(i._current)},defineProperty(){throw Error("not supported")},getPrototypeOf(i){return Object.getPrototypeOf(i._current)},setPrototypeOf(){throw Error("not supported")},getOwnPropertyDescriptor(i,e){let t=i._current,r=Reflect.getOwnPropertyDescriptor(t,e);return r&&{writable:!0,configurable:!0,enumerable:r.enumerable,value:t[e]}}},LP=fe(U({},zx),{set(i,e,t){var n;let r={type:Wn.Update,props:{[e]:(n=IP(t))!=null?n:t}};return i.deleteChildren(e),i.runOp(r),!0},deleteProperty(i,e){let t={type:Wn.Update,props:{[e]:void 0}};return i.deleteChildren(e),i.runOp(t),!0}}),_P=fe(U({},zx),{set(i,e,t){return t===void 0?this.deleteProperty(i,e):(i.deleteChildren(e),i.runOp({type:pn.Add,id:e,data:t})),!0},deleteProperty(i,e){return i.runOp({type:pn.Delete,id:e}),!0}}),pa=class extends da{constructor(e,t,r){super();this._children={},this._parent=e,this._path=t,this._current=r,this[bc]=()=>{this._parent=null}}unproxy(){return this._current}update(e,t){this._current=this._current.modifyById(e,t)}runOp(e){this.reportOp(e,this._current.runOp(e))}randomId(){return this._current.randomId()}isDescendantOf(e,t){return this._current.isDescendantOf(e,t)}childrenOf(e){return this._current.childrenOf(e)}traverse(e){return this._current.traverse(e)}get(e){return this._current.get(e)}parent(e){return this._current.parent(e)}traverse(e){this._current.traverse((t,r)=>{e(t,this.data(t))})}data(e){var c;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(c=t.get(e))==null?void 0:c.data,l=Sc(this,e,s);return l!==s?(r===void 0&&(r={},this._children=r),r[e]=l,l):s}add(e,t,r,n,s){this.runOp({type:jr.Add,parent:e,fi:t,id:r,data:n,children:s})}move(e,t,r){this.runOp({type:jr.Move,parent:e,fi:t,id:r})}insertAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let l=r[s];this.add(e,n[s],l.id,l.data,l.children)}}insertBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let l=r[s];this.add(e,n[s],l.id,l.data,l.children)}}moveAfter(e,t,r){let n=this._current.insertAfterHelper(e,t,r.length);for(let s=0;s<r.length;s++){let l=r[s];this.move(e,n[s],l)}}moveBefore(e,t,r){let n=this._current.insertBeforeHelper(e,t,r.length);for(let s=0;s<r.length;s++){let l=r[s];this.move(e,n[s],l)}}delete(e){this.deleteChildren(e),this.runOp({type:jr.Delete,id:e})}sortNext(e){return this._current.sortNext(e)}sortPrevious(e){return this._current.sortPrevious(e)}getAllSorted(e){return this._current.getAllSorted(e)}},ma=class extends da{constructor(e,t,r){super();this._children={},this._parent=e,this._path=t,this._current=r,this[bc]=()=>{this._parent=null}}unproxy(){return this._current}get length(){return this._current.length}forEach(e){let t=this.length;for(let r=0;r<t;r++){let n=this._current[r].id;e(this.data(this._current[r].id),n)}}update(e,t){this._current=this._current.modifyById(e,t)}randomId(){return this._current.randomId()}get(e){return fe(U({},this._current.get(e)),{data:this.data(e)})}data(e){var c;let{_current:t,_children:r}=this,n=r===void 0?void 0:r[e];if(n!==void 0)return n;let s=(c=t.get(e))==null?void 0:c.data,l=Sc(this,e,s);return l!==s?(r===void 0&&(r={},this._children=r),r[e]=l,l):s}runOp(e){this.reportOp(e,this._current.runOp(e))}add(e,t,r){this.runOp({type:Yr.Add,fi:e,id:t,data:r})}move(e,t){this.runOp({type:Yr.Move,fi:e,id:t})}insertAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}insertBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.add(r[n],s.id,s.data)}}moveAfter(e,t){let r=this._current.insertAfterHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}moveBefore(e,t){let r=this._current.insertBeforeHelper(e,t.length);for(let n=0;n<t.length;n++){let s=t[n];this.move(r[n],s)}}delete(e){this.deleteChildren(e),this.runOp({type:Yr.Delete,id:e})}};function ch(i,e,t){if(i.length>0){let r=i[i.length-1];if(r.type===Wn.Update&&e.type===Wn.Update&&wc.equal(r.path,t)){Object.assign(r.props,e.props);return}}i.push(fe(U({},e),{path:t}))}var uh=class{constructor(e){this.ts=[],this.actual=[],this.reverse=[],this._current=e}update(e,t){if(e!=="")throw new Error("");this._current=t}push(e,t,r,n){ch(this.ts,t,e),ch(this.actual,r,e),ch(this.reverse,n,e)}result(){return{data:this._current,ts:this.ts,actual:this.actual,reverse:this.reverse.reverse()}}};function Sc(i,e,t){return t instanceof Pn?new pa(i,e,t):t instanceof jt?new ma(i,e,t):t instanceof On?new Proxy(new Rx(i,e,t),_P):t!==null&&typeof t=="object"?Px(t)?t:new Proxy(new Ex(i,e,t),LP):t}function TP(i){let e=new uh(i);return[Sc(e,"",i),e]}function fh(i,e){let[t,r]=TP(i);return e(t),r.result()}function IP(i){return i instanceof pa||i instanceof ma?i._current:i!==null&&typeof i=="object"?i[jx]:i}var wc;(function(r){function i(n,s){if(s.length===n.length)for(var l=0;l<n.length;){if(n[l]!==s[l])return!1;l+=1}else return!1;return!0}r.equal=i;function e(n,s,l){let c=t(l,n);if(c!==void 0&&typeof c=="object"&&c!==null){let f=U({},s);return Object.keys(c).forEach(h=>{delete f[h]}),f}else return s}r.removeOverridden=e;function t(n,s,l=0){if(s.length<=l)return n;if((n instanceof Pn||n instanceof pa)&&typeof s[l]=="string")return t(n.data(s[l]),s,l+1);if((n instanceof jt||n instanceof ma)&&typeof s[l]=="string")return t(n.data(s[l]),s,l+1);if(typeof s[l]=="number"&&Array.isArray(n))return t(n[s[l]],s,l+1);if(typeof s[l]=="string"&&typeof n=="object")return t(n[s[l]],s,l+1)}r.zoom=t})(wc||(wc={}));var hh=class{},Nc=class extends hh{constructor(e){super();this.id=e}},Cc=class extends hh{constructor(e){super();this.data=e}};"use strict";var dh;try{dh=new TextDecoder}catch(i){}var ge,ki,j=0;var Fx=[],ph=Fx,mh=0,Er={},ot,Hi,mn=0,$n=0,Qr,gi,Cr=[],ft,Vx={useRecords:!1,mapsAsObjects:!0},Lc=class{},gh=new Lc;gh.name="MessagePack 0xC1";var vs=!1,yi=class{constructor(e){e&&(e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.structures?e.structures.sharedLength=e.structures.length:e.getStructures&&((e.structures=[]).uninitialized=!0,e.structures.sharedLength=0)),Object.assign(this,e)}unpack(e,t){if(ge)return Yx(()=>(Ic(),this?this.unpack(e,t):yi.prototype.unpack.call(Vx,e,t)));ki=t>-1?t:e.length,j=0,mh=0,$n=0,Hi=null,ph=Fx,Qr=null,ge=e;try{ft=e.dataView||(e.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength))}catch(r){throw ge=null,e instanceof Uint8Array?r:new Error("Source must be a Uint8Array or Buffer but was a "+(e&&typeof e=="object"?e.constructor.name:typeof e))}if(this instanceof yi){if(Er=this,this.structures)return ot=this.structures,_c();(!ot||ot.length>0)&&(ot=[])}else Er=Vx,(!ot||ot.length>0)&&(ot=[]);return _c()}unpackMultiple(e,t){let r,n=0;try{vs=!0;let s=e.length,l=this?this.unpack(e,s):Ac.unpack(e,s);if(t){for(t(l);j<s;)if(n=j,t(_c())===!1)return}else{for(r=[l];j<s;)n=j,r.push(_c());return r}}catch(s){throw s.lastPosition=n,s.values=r,s}finally{vs=!1,Ic()}}_mergeStructures(e,t){e=e||[];for(let r=0,n=e.length;r<n;r++){let s=e[r];s&&(s.isShared=!0,r>=32&&(s.highByte=r-32>>5))}e.sharedLength=e.length;for(let r in t||[])if(r>=0){let n=e[r],s=t[r];s&&(n&&((e.restoreStructures||(e.restoreStructures=[]))[r]=n),e[r]=s)}return this.structures=e}decode(e,t){return this.unpack(e,t)}};function _c(){try{if(!Er.trusted&&!vs){let e=ot.sharedLength||0;e<ot.length&&(ot.length=e)}let i=Et();if(j==ki)ot.restoreStructures&&Ux(),ot=null,ge=null,gi&&(gi=null);else if(j>ki){let e=new Error("Unexpected end of MessagePack data");throw e.incomplete=!0,e}else if(!vs)throw new Error("Data read, but end of buffer not reached");return i}catch(i){throw ot.restoreStructures&&Ux(),Ic(),(i instanceof RangeError||i.message.startsWith("Unexpected end of buffer"))&&(i.incomplete=!0),i}}function Ux(){for(let i in ot.restoreStructures)ot[i]=ot.restoreStructures[i];ot.restoreStructures=null}function Et(){let i=ge[j++];if(i<160)if(i<128){if(i<64)return i;{let e=ot[i&63]||Er.getStructures&&Hx()[i&63];return e?(e.read||(e.read=yh(e,i&63)),e.read()):i}}else if(i<144)if(i-=128,Er.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[Kx()]=Et();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(Et(),Et());return e}else{i-=144;let e=new Array(i);for(let t=0;t<i;t++)e[t]=Et();return e}else if(i<192){let e=i-160;if($n>=j)return Hi.slice(j-mn,(j+=e)-mn);if($n==0&&ki<140){let t=e<16?vh(e):$x(e);if(t!=null)return t}return xh(e)}else{let e;switch(i){case 192:return null;case 193:return Qr?(e=Et(),e>0?Qr[1].slice(Qr.position1,Qr.position1+=e):Qr[0].slice(Qr.position0,Qr.position0-=e)):gh;case 194:return!1;case 195:return!0;case 196:return bh(ge[j++]);case 197:return e=ft.getUint16(j),j+=2,bh(e);case 198:return e=ft.getUint32(j),j+=4,bh(e);case 199:return bo(ge[j++]);case 200:return e=ft.getUint16(j),j+=2,bo(e);case 201:return e=ft.getUint32(j),j+=4,bo(e);case 202:if(e=ft.getFloat32(j),Er.useFloat32>2){let t=Mc[(ge[j]&127)<<1|ge[j+1]>>7];return j+=4,(t*e+(e>0?.5:-.5)>>0)/t}return j+=4,e;case 203:return e=ft.getFloat64(j),j+=8,e;case 204:return ge[j++];case 205:return e=ft.getUint16(j),j+=2,e;case 206:return e=ft.getUint32(j),j+=4,e;case 207:return Er.int64AsNumber?(e=ft.getUint32(j)*4294967296,e+=ft.getUint32(j+4)):e=ft.getBigUint64(j),j+=8,e;case 208:return ft.getInt8(j++);case 209:return e=ft.getInt16(j),j+=2,e;case 210:return e=ft.getInt32(j),j+=4,e;case 211:return Er.int64AsNumber?(e=ft.getInt32(j)*4294967296,e+=ft.getUint32(j+4)):e=ft.getBigInt64(j),j+=8,e;case 212:if(e=ge[j++],e==114)return Xx(ge[j++]&63);{let t=Cr[e];if(t)return t.read?(j++,t.read(Et())):t.noBuffer?(j++,t()):t(ge.subarray(j,++j));throw new Error("Unknown extension "+e)}case 213:return e=ge[j],e==114?(j++,Xx(ge[j++]&63,ge[j++])):bo(2);case 214:return bo(4);case 215:return bo(8);case 216:return bo(16);case 217:return e=ge[j++],$n>=j?Hi.slice(j-mn,(j+=e)-mn):AP(e);case 218:return e=ft.getUint16(j),j+=2,$n>=j?Hi.slice(j-mn,(j+=e)-mn):OP(e);case 219:return e=ft.getUint32(j),j+=4,$n>=j?Hi.slice(j-mn,(j+=e)-mn):PP(e);case 220:return e=ft.getUint16(j),j+=2,Wx(e);case 221:return e=ft.getUint32(j),j+=4,Wx(e);case 222:return e=ft.getUint16(j),j+=2,qx(e);case 223:return e=ft.getUint32(j),j+=4,qx(e);default:if(i>=224)return i-256;if(i===void 0){let t=new Error("Unexpected end of MessagePack data");throw t.incomplete=!0,t}throw new Error("Unknown MessagePack token "+i)}}}var MP=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function yh(i,e){function t(){if(t.count++>2){let n=i.read=new Function("r","return function(){return {"+i.map(s=>MP.test(s)?s+":r()":"["+JSON.stringify(s)+"]:r()").join(",")+"}}")(Et);return i.highByte===0&&(i.read=kx(e,i.read)),n()}let r={};for(let n=0,s=i.length;n<s;n++){let l=i[n];r[l]=Et()}return r}return t.count=0,i.highByte===0?kx(e,t):t}var kx=(i,e)=>function(){let t=ge[j++];if(t===0)return e();let r=i<32?-(i+(t<<5)):i+(t<<5),n=ot[r]||Hx()[r];if(!n)throw new Error("Record id is not defined for "+r);return n.read||(n.read=yh(n,i)),n.read()};function Hx(){let i=Yx(()=>(ge=null,Er.getStructures()));return ot=Er._mergeStructures(i,ot)}var xh=Tc,AP=Tc,OP=Tc,PP=Tc;function Tc(i){let e;if(i<16&&(e=vh(i)))return e;if(i>64&&dh)return dh.decode(ge.subarray(j,j+=i));let t=j+i,r=[];for(e="";j<t;){let n=ge[j++];if((n&128)==0)r.push(n);else if((n&224)==192){let s=ge[j++]&63;r.push((n&31)<<6|s)}else if((n&240)==224){let s=ge[j++]&63,l=ge[j++]&63;r.push((n&31)<<12|s<<6|l)}else if((n&248)==240){let s=ge[j++]&63,l=ge[j++]&63,c=ge[j++]&63,f=(n&7)<<18|s<<12|l<<6|c;f>65535&&(f-=65536,r.push(f>>>10&1023|55296),f=56320|f&1023),r.push(f)}else r.push(n);r.length>=4096&&(e+=ir.apply(String,r),r.length=0)}return r.length>0&&(e+=ir.apply(String,r)),e}function Wx(i){let e=new Array(i);for(let t=0;t<i;t++)e[t]=Et();return e}function qx(i){if(Er.mapsAsObjects){let e={};for(let t=0;t<i;t++)e[Kx()]=Et();return e}else{let e=new Map;for(let t=0;t<i;t++)e.set(Et(),Et());return e}}var ir=String.fromCharCode;function $x(i){let e=j,t=new Array(i);for(let r=0;r<i;r++){let n=ge[j++];if((n&128)>0){j=e;return}t[r]=n}return ir.apply(String,t)}function vh(i){if(i<4)if(i<2){if(i===0)return"";{let e=ge[j++];if((e&128)>1){j-=1;return}return ir(e)}}else{let e=ge[j++],t=ge[j++];if((e&128)>0||(t&128)>0){j-=2;return}if(i<3)return ir(e,t);let r=ge[j++];if((r&128)>0){j-=3;return}return ir(e,t,r)}else{let e=ge[j++],t=ge[j++],r=ge[j++],n=ge[j++];if((e&128)>0||(t&128)>0||(r&128)>0||(n&128)>0){j-=4;return}if(i<6){if(i===4)return ir(e,t,r,n);{let s=ge[j++];if((s&128)>0){j-=5;return}return ir(e,t,r,n,s)}}else if(i<8){let s=ge[j++],l=ge[j++];if((s&128)>0||(l&128)>0){j-=6;return}if(i<7)return ir(e,t,r,n,s,l);let c=ge[j++];if((c&128)>0){j-=7;return}return ir(e,t,r,n,s,l,c)}else{let s=ge[j++],l=ge[j++],c=ge[j++],f=ge[j++];if((s&128)>0||(l&128)>0||(c&128)>0||(f&128)>0){j-=8;return}if(i<10){if(i===8)return ir(e,t,r,n,s,l,c,f);{let h=ge[j++];if((h&128)>0){j-=9;return}return ir(e,t,r,n,s,l,c,f,h)}}else if(i<12){let h=ge[j++],p=ge[j++];if((h&128)>0||(p&128)>0){j-=10;return}if(i<11)return ir(e,t,r,n,s,l,c,f,h,p);let y=ge[j++];if((y&128)>0){j-=11;return}return ir(e,t,r,n,s,l,c,f,h,p,y)}else{let h=ge[j++],p=ge[j++],y=ge[j++],g=ge[j++];if((h&128)>0||(p&128)>0||(y&128)>0||(g&128)>0){j-=12;return}if(i<14){if(i===12)return ir(e,t,r,n,s,l,c,f,h,p,y,g);{let w=ge[j++];if((w&128)>0){j-=13;return}return ir(e,t,r,n,s,l,c,f,h,p,y,g,w)}}else{let w=ge[j++],S=ge[j++];if((w&128)>0||(S&128)>0){j-=14;return}if(i<15)return ir(e,t,r,n,s,l,c,f,h,p,y,g,w,S);let T=ge[j++];if((T&128)>0){j-=15;return}return ir(e,t,r,n,s,l,c,f,h,p,y,g,w,S,T)}}}}}function bh(i){return Er.copyBuffers?Uint8Array.prototype.slice.call(ge,j,j+=i):ge.subarray(j,j+=i)}function bo(i){let e=ge[j++];if(Cr[e])return Cr[e](ge.subarray(j,j+=i));throw new Error("Unknown extension type "+e)}var Jx=new Array(4096);function Kx(){let i=ge[j++];if(i>=160&&i<192){if(i=i-160,$n>=j)return Hi.slice(j-mn,(j+=i)-mn);if(!($n==0&&ki<180))return xh(i)}else return j--,Et();let e=(i<<5^(i>1?ft.getUint16(j):i>0?ge[j]:0))&4095,t=Jx[e],r=j,n=j+i-3,s,l=0;if(t&&t.bytes==i){for(;r<n;){if(s=ft.getUint32(r),s!=t[l++]){r=1879048192;break}r+=4}for(n+=3;r<n;)if(s=ge[r++],s!=t[l++]){r=1879048192;break}if(r===n)return j=r,t.string;n-=3,r=j}for(t=[],Jx[e]=t,t.bytes=i;r<n;)s=ft.getUint32(r),t.push(s),r+=4;for(n+=3;r<n;)s=ge[r++],t.push(s);let c=i<16?vh(i):$x(i);return c!=null?t.string=c:t.string=xh(i)}var Xx=(i,e)=>{var t=Et();let r=i;e!==void 0&&(i=i<32?-((e<<5)+i):(e<<5)+i,t.highByte=e);let n=ot[i];return n&&n.isShared&&((ot.restoreStructures||(ot.restoreStructures=[]))[i]=n),ot[i]=t,t.read=yh(t,r),t.read()},Zx=typeof self=="object"?self:global;Cr[0]=()=>{};Cr[0].noBuffer=!0;Cr[101]=()=>{let i=Et();return(Zx[i[0]]||Error)(i[1])};Cr[105]=i=>{let e=ft.getUint32(j-4);gi||(gi=new Map);let t=ge[j],r;t>=144&&t<160||t==220||t==221?r=[]:r={};let n={target:r};gi.set(e,n);let s=Et();return n.used?Object.assign(r,s):(n.target=s,s)};Cr[112]=i=>{let e=ft.getUint32(j-4),t=gi.get(e);return t.used=!0,t.target};Cr[115]=()=>new Set(Et());var Sh=["Int8","Uint8","Uint8Clamped","Int16","Uint16","Int32","Uint32","Float32","Float64","BigInt64","BigUint64"].map(i=>i+"Array");Cr[116]=i=>{let e=i[0],t=Sh[e];if(!t)throw new Error("Could not find typed array for code "+e);return new Zx[t](Uint8Array.prototype.slice.call(i,1).buffer)};Cr[120]=()=>{let i=Et();return new RegExp(i[0],i[1])};Cr[98]=i=>{let e=(i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3],t=j;j+=e-4,Qr=[Et(),Et()],Qr.position0=0,Qr.position1=0;let r=j;j=t;try{return Et()}finally{j=r}};Cr[255]=i=>i.length==4?new Date((i[0]*16777216+(i[1]<<16)+(i[2]<<8)+i[3])*1e3):i.length==8?new Date(((i[0]<<22)+(i[1]<<14)+(i[2]<<6)+(i[3]>>2))/1e6+((i[3]&3)*4294967296+i[4]*16777216+(i[5]<<16)+(i[6]<<8)+i[7])*1e3):i.length==12?new Date(((i[0]<<24)+(i[1]<<16)+(i[2]<<8)+i[3])/1e6+((i[4]&128?-281474976710656:0)+i[6]*1099511627776+i[7]*4294967296+i[8]*16777216+(i[9]<<16)+(i[10]<<8)+i[11])*1e3):new Date("invalid");function Yx(i){let e=ki,t=j,r=mh,n=mn,s=$n,l=Hi,c=ph,f=gi,h=Qr,p=new Uint8Array(ge.slice(0,ki)),y=ot,g=ot.slice(0,ot.length),w=Er,S=vs,T=i();return ki=e,j=t,mh=r,mn=n,$n=s,Hi=l,ph=c,gi=f,Qr=h,ge=p,vs=S,ot=y,ot.splice(0,ot.length,...g),Er=w,ft=new DataView(ge.buffer,ge.byteOffset,ge.byteLength),T}function Ic(){ge=null,gi=null,ot=null}function Qx(i){i.unpack?Cr[i.type]=i.unpack:Cr[i.type]=i}var Mc=new Array(147);for(let i=0;i<256;i++)Mc[i]=+("1e"+Math.floor(45.15-i*.30103));var Ac=new yi({useRecords:!1}),DP=Ac.unpack,BP=Ac.unpackMultiple,GP=Ac.unpack;var jP=new Float32Array(1),u4=new Uint8Array(jP.buffer,0,4);"use strict";var Oc;try{Oc=new TextEncoder}catch(i){}var Pc,wh,Dc=typeof Buffer!="undefined",Nh=Dc?Buffer.allocUnsafeSlow:Uint8Array,t0=Dc?Buffer:Uint8Array,r0=Dc?4294967296:2144337920,Z,Vt,F=0,Jn,Kn=null,EP=/[\u0080-\uFFFF]/,ga=Symbol("record-id"),bs=class extends yi{constructor(e){super(e);this.offset=0;let t,r,n,s,l,c,f=0,h=t0.prototype.utf8Write?function(b,R,I){return Z.utf8Write(b,R,I)}:Oc&&Oc.encodeInto?function(b,R){return Oc.encodeInto(b,Z.subarray(R)).written}:!1,p=this;e||(e={});let y=e&&e.sequential,g=e.structures||e.saveStructures,w=e.maxSharedStructures;if(w==null&&(w=g?32:0),w>8160)throw new Error("Maximum maxSharedStructure is 8160");let S=e.maxOwnStructures;S==null&&(S=g?32:64),y&&!e.saveStructures&&(this.structures=[]);let T=w>32||S+w>64,C=w+64,B=w+S+64;if(B>8256)throw new Error("Maximum maxSharedStructure + maxOwnStructure is 8192");let G=[],D=0,W=0;this.pack=this.encode=function(b,R){if(Z||(Z=new Nh(8192),Vt=new DataView(Z.buffer,0,8192),F=0),Jn=Z.length-10,Jn-F<2048?(Z=new Nh(Z.length),Vt=new DataView(Z.buffer,0,Z.length),Jn=Z.length-10,F=0):F=F+7&2147483640,r=F,c=p.structuredClone?new Map:null,p.bundleStrings?(Kn=["",""],Z[F++]=214,Z[F++]=98,Kn.position=F-r,F+=4):Kn=null,n=p.structures,n){n.uninitialized&&(n=p._mergeStructures(p.getStructures()));let I=n.sharedLength||0;if(I>w)throw new Error("Shared structures is larger than maximum shared structures, try increasing maxSharedStructures to "+n.sharedLength);if(!n.transitions){n.transitions=Object.create(null);for(let z=0;z<I;z++){let O=n[z];if(!O)continue;let $,he=n.transitions;for(let re=0,Ne=O.length;re<Ne;re++){let ye=O[re];$=he[ye],$||($=he[ye]=Object.create(null)),he=$}he[ga]=z+64}f=I}y||(n.nextId=I+64)}s&&(s=!1),l=n||[];try{if(A(b),Kn){Vt.setUint32(Kn.position+r,F-Kn.position-r);let I=Kn;Kn=null,A(I[0]),A(I[1])}if(p.offset=F,c&&c.idsToInsert){F+=c.idsToInsert.length*6,F>Jn&&E(F),p.offset=F;let I=zP(Z.subarray(r,F),c.idsToInsert);return c=null,I}return R&s0?(Z.start=r,Z.end=F,Z):Z.subarray(r,F)}finally{if(n){if(W<10&&W++,D>1e4)n.transitions=null,W=0,D=0,G.length>0&&(G=[]);else if(G.length>0&&!y){for(let I=0,z=G.length;I<z;I++)G[I][ga]=0;G=[]}if(s&&p.saveStructures){let I=n.sharedLength||w;n.length>I&&(n=n.slice(0,I));let z=Z.subarray(r,F);return p.saveStructures(n,f)===!1?(p._mergeStructures(p.getStructures()),p.pack(b)):(f=I,z)}}R&UP&&(F=r)}};let A=b=>{F>Jn&&(Z=E(F));var R=typeof b,I;if(R==="string"){let z=b.length;if(Kn&&z>=8&&z<4096){let he=EP.test(b);Kn[he?0:1]+=b,Z[F++]=193,A(he?-z:z);return}let O;z<32?O=1:z<256?O=2:z<65536?O=3:O=5;let $=z*3;if(F+$>Jn&&(Z=E(F+$)),z<64||!h){let he,re,Ne,ye=F+O;for(he=0;he<z;he++)re=b.charCodeAt(he),re<128?Z[ye++]=re:re<2048?(Z[ye++]=re>>6|192,Z[ye++]=re&63|128):(re&64512)==55296&&((Ne=b.charCodeAt(he+1))&64512)==56320?(re=65536+((re&1023)<<10)+(Ne&1023),he++,Z[ye++]=re>>18|240,Z[ye++]=re>>12&63|128,Z[ye++]=re>>6&63|128,Z[ye++]=re&63|128):(Z[ye++]=re>>12|224,Z[ye++]=re>>6&63|128,Z[ye++]=re&63|128);I=ye-F-O}else I=h(b,F+O,$);I<32?Z[F++]=160|I:I<256?(O<2&&Z.copyWithin(F+2,F+1,F+1+I),Z[F++]=217,Z[F++]=I):I<65536?(O<3&&Z.copyWithin(F+3,F+2,F+2+I),Z[F++]=218,Z[F++]=I>>8,Z[F++]=I&255):(O<5&&Z.copyWithin(F+5,F+3,F+3+I),Z[F++]=219,Vt.setUint32(F,I),F+=4),F+=I}else if(R==="number")if(b>>>0===b)b<64?Z[F++]=b:b<256?(Z[F++]=204,Z[F++]=b):b<65536?(Z[F++]=205,Z[F++]=b>>8,Z[F++]=b&255):(Z[F++]=206,Vt.setUint32(F,b),F+=4);else if(b>>0===b)b>=-32?Z[F++]=256+b:b>=-128?(Z[F++]=208,Z[F++]=b+256):b>=-32768?(Z[F++]=209,Vt.setInt16(F,b),F+=2):(Z[F++]=210,Vt.setInt32(F,b),F+=4);else{let z;if((z=this.useFloat32)>0&&b<4294967296&&b>=-2147483648){Z[F++]=202,Vt.setFloat32(F,b);let O;if(z<4||(O=b*Mc[(Z[F]&127)<<1|Z[F+1]>>7])>>0===O){F+=4;return}else F--}Z[F++]=203,Vt.setFloat64(F,b),F+=8}else if(R==="object")if(!b)Z[F++]=192;else{if(c){let O=c.get(b);if(O){if(!O.id){let $=c.idsToInsert||(c.idsToInsert=[]);O.id=$.push(O)}Z[F++]=214,Z[F++]=112,Vt.setUint32(F,O.id),F+=4;return}else c.set(b,{offset:F-r})}let z=b.constructor;if(z===Object)q(b,!0);else if(z===Array){I=b.length,I<16?Z[F++]=144|I:I<65536?(Z[F++]=220,Z[F++]=I>>8,Z[F++]=I&255):(Z[F++]=221,Vt.setUint32(F,I),F+=4);for(let O=0;O<I;O++)A(b[O])}else if(z===Map){I=b.size,I<16?Z[F++]=128|I:I<65536?(Z[F++]=222,Z[F++]=I>>8,Z[F++]=I&255):(Z[F++]=223,Vt.setUint32(F,I),F+=4);for(let[O,$]of b)A(O),A($)}else{for(let O=0,$=Pc.length;O<$;O++){let he=wh[O];if(b instanceof he){let re=Pc[O];if(re.write){re.type&&(Z[F++]=212,Z[F++]=re.type,Z[F++]=0),A(re.write.call(this,b));return}let Ne=Z,ye=Vt,Me=F;Z=null;let Fe;try{Fe=re.pack.call(this,b,k=>(Z=Ne,Ne=null,F+=k,F>Jn&&E(F),{target:Z,targetView:Vt,position:F-k}),A)}finally{Ne&&(Z=Ne,Vt=ye,F=Me,Jn=Z.length-10)}Fe&&(Fe.length+F>Jn&&E(Fe.length+F),F=RP(Fe,Z,F,re.type));return}}q(b,!b.hasOwnProperty)}}else if(R==="boolean")Z[F++]=b?195:194;else if(R==="bigint"){if(b<BigInt(1)<<BigInt(63)&&b>=-(BigInt(1)<<BigInt(63)))Z[F++]=211,Vt.setBigInt64(F,b);else if(b<BigInt(1)<<BigInt(64)&&b>0)Z[F++]=207,Vt.setBigUint64(F,b);else if(this.largeBigIntToFloat)Z[F++]=203,Vt.setFloat64(F,Number(b));else throw new RangeError(b+" was too large to fit in MessagePack 64-bit integer format, set largeBigIntToFloat to convert to float-64");F+=8}else if(R==="undefined")this.encodeUndefinedAsNil?Z[F++]=192:(Z[F++]=212,Z[F++]=0,Z[F++]=0);else if(R==="function")A(this.writeFunction&&this.writeFunction());else throw new Error("Unknown type: "+R)},q=this.useRecords===!1?this.variableMapSize?b=>{let R=Object.keys(b),I=R.length;I<16?Z[F++]=128|I:I<65536?(Z[F++]=222,Z[F++]=I>>8,Z[F++]=I&255):(Z[F++]=223,Vt.setUint32(F,I),F+=4);let z;for(let O=0;O<I;O++)A(z=R[O]),A(b[z])}:(b,R)=>{Z[F++]=222;let I=F-r;F+=2;let z=0;for(let O in b)(R||b.hasOwnProperty(O))&&(A(O),A(b[O]),z++);Z[I+++r]=z>>8,Z[I+r]=z&255}:b=>{let R=Object.keys(b),I,z=l.transitions||(l.transitions=Object.create(null)),O=0;for(let he=0,re=R.length;he<re;he++){let Ne=R[he];I=z[Ne],I||(I=z[Ne]=Object.create(null),O++),z=I}let $=z[ga];if($)$>=96&&T?(Z[F++]=(($-=96)&31)+96,Z[F++]=$>>5):Z[F++]=$;else{$=l.nextId,$||($=64),$<C&&this.shouldShareStructure&&!this.shouldShareStructure(R)?($=l.nextOwnId,$<B||($=C),l.nextOwnId=$+1):($>=B&&($=C),l.nextId=$+1);let he=R.highByte=$>=96&&T?$-96>>5:-1;z[ga]=$,l[$-64]=R,$<C?(R.isShared=!0,l.sharedLength=$-63,s=!0,he>=0?(Z[F++]=($&31)+96,Z[F++]=he):Z[F++]=$):(he>=0?(Z[F++]=213,Z[F++]=114,Z[F++]=($&31)+96,Z[F++]=he):(Z[F++]=212,Z[F++]=114,Z[F++]=$),O&&(D+=W*O),G.length>=S&&(G.shift()[ga]=0),G.push(z),A(R))}for(let he=0,re=R.length;he<re;he++)A(b[R[he]])},E=b=>{let R;if(b>16777216){if(b-r>r0)throw new Error("Packed buffer would be larger than maximum buffer size");R=Math.min(r0,Math.round(Math.max((b-r)*(b>67108864?1.25:2),4194304)/4096)*4096)}else R=(Math.max(b-r<<2,Z.length-1)>>12)+1<<12;let I=new Nh(R);return Vt=new DataView(I.buffer,0,R),Z.copy?Z.copy(I,0,r,b):I.set(Z.slice(r,b)),F-=r,r=0,Jn=I.length-10,Z=I}}useBuffer(e){Z=e,Vt=new DataView(Z.buffer,Z.byteOffset,Z.byteLength),F=0}};wh=[Date,Set,Error,RegExp,ArrayBuffer,Object.getPrototypeOf(Uint8Array.prototype).constructor,Lc];Pc=[{pack(i,e,t){let r=i.getTime()/1e3;if((this.useTimestamp32||i.getMilliseconds()===0)&&r>=0&&r<4294967296){let{target:n,targetView:s,position:l}=e(6);n[l++]=214,n[l++]=255,s.setUint32(l,r)}else if(r>0&&r<17179869184){let{target:n,targetView:s,position:l}=e(10);n[l++]=215,n[l++]=255,s.setUint32(l,i.getMilliseconds()*4e6+(r/1e3/4294967296>>0)),s.setUint32(l+4,r)}else if(isNaN(r)){if(this.onInvalidDate)return e(0),t(this.onInvalidDate());let{target:n,targetView:s,position:l}=e(3);n[l++]=212,n[l++]=255,n[l++]=255}else{let{target:n,targetView:s,position:l}=e(15);n[l++]=199,n[l++]=12,n[l++]=255,s.setUint32(l,i.getMilliseconds()*1e6),s.setBigInt64(l+4,BigInt(Math.floor(r)))}}},{pack(i,e,t){let r=Array.from(i),{target:n,position:s}=e(this.structuredClone?3:0);this.structuredClone&&(n[s++]=212,n[s++]=115,n[s++]=0),t(r)}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=101,r[n++]=0),t([i.name,i.message])}},{pack(i,e,t){let{target:r,position:n}=e(this.structuredClone?3:0);this.structuredClone&&(r[n++]=212,r[n++]=120,r[n++]=0),t([i.source,i.flags])}},{pack(i,e){this.structuredClone?n0(i,16,e):i0(Dc?Buffer.from(i):new Uint8Array(i),e)}},{pack(i,e){let t=i.constructor;t!==t0&&this.structuredClone?n0(i,Sh.indexOf(t.name),e):i0(i,e)}},{pack(i,e){let{target:t,position:r}=e(1);t[r]=193}}];function n0(i,e,t,r){let n=i.byteLength;if(n+1<256){var{target:s,position:l}=t(4+n);s[l++]=199,s[l++]=n+1}else if(n+1<65536){var{target:s,position:l}=t(5+n);s[l++]=200,s[l++]=n+1>>8,s[l++]=n+1&255}else{var{target:s,position:l,targetView:c}=t(7+n);s[l++]=201,c.setUint32(l,n+1),l+=4}s[l++]=116,s[l++]=e,s.set(new Uint8Array(i.buffer,i.byteOffset,i.byteLength),l)}function i0(i,e){let t=i.byteLength;var r,n;if(t<256){var{target:r,position:n}=e(t+2);r[n++]=196,r[n++]=t}else if(t<65536){var{target:r,position:n}=e(t+3);r[n++]=197,r[n++]=t>>8,r[n++]=t&255}else{var{target:r,position:n,targetView:s}=e(t+5);r[n++]=198,s.setUint32(n,t),n+=4}r.set(i,n)}function RP(i,e,t,r){let n=i.length;switch(n){case 1:e[t++]=212;break;case 2:e[t++]=213;break;case 4:e[t++]=214;break;case 8:e[t++]=215;break;case 16:e[t++]=216;break;default:n<256?(e[t++]=199,e[t++]=n):n<65536?(e[t++]=200,e[t++]=n>>8,e[t++]=n&255):(e[t++]=201,e[t++]=n>>24,e[t++]=n>>16&255,e[t++]=n>>8&255,e[t++]=n&255)}return e[t++]=r,e.set(i,t),t+=n,t}function zP(i,e){let t,r=e.length*6,n=i.length-r;for(e.sort((s,l)=>s.offset>l.offset?1:-1);t=e.pop();){let s=t.offset,l=t.id;i.copyWithin(s+r,s,n),r-=6;let c=s+r;i[c++]=214,i[c++]=105,i[c++]=l>>24,i[c++]=l>>16&255,i[c++]=l>>8&255,i[c++]=l&255,n=s}return i}function So(i){if(i.Class){if(!i.pack&&!i.write)throw new Error("Extension has no pack or write function");if(i.pack&&!i.type)throw new Error("Extension has no type (numeric code to identify the extension)");wh.unshift(i.Class),Pc.unshift(i)}Qx(i)}var o0=new bs({useRecords:!1}),FP=o0.pack,VP=o0.pack;var s0=512,UP=1024;var a0=new bs({structuredClone:!0});So({Class:On.prototype.constructor,type:1,write(i){return U({},i)},read(i){return Object.setPrototypeOf(i,On.prototype),i}});So({Class:jt.prototype.constructor,type:2,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,jt.prototype),i}});So({Class:Pn.prototype.constructor,type:3,write(i){return[...i]},read(i){return Object.setPrototypeOf(i,Pn.prototype),i}});So({Class:Nc.prototype.constructor,type:4,write(i){return i.id},read(i){return new Nc(i)}});So({Class:Cc.prototype.constructor,type:5,write(i){return i.data},read(i){return new Cc(i)}});function kP(i){var e=0;if(i.length===0)return e;for(let t=0;t<i.length;t++){let r=i[t];e=(e<<5)-e+r,e=e&e}return e}var Bc;(function(r){function i(n){return a0.pack(n)}r.serialize=i;function e(n){return a0.unpack(n)}r.deserialize=e;function t(n){return kP(i(n)).toString()}r.checksum=t})(Bc||(Bc={}));var Gc;(function(t){t.all=["PointLight","SpotLight","DirectionalLight","HemisphereLight"];function e(r){return t.all.includes(r)}t.is=e})(Gc||(Gc={}));var jc;(function(t){function i(r){return e(r)}t.defaultData=i;function e(r){if(r==="PointLight")return{type:r,color:Hn.white,intensity:1,distance:2e3,decay:1,shadows:!0,shadowResolution:1024,shadowRadius:1,depth:2500,helper:!0};if(r==="SpotLight")return{type:r,color:Hn.white,intensity:1,distance:2e3,decay:1,shadows:!0,penumbra:0,angle:30/180*Math.PI,depth:2500,helper:!0};if(r==="DirectionalLight")return{type:r,color:Hn.white,intensity:1,shadows:!0,size:2500,depth:2500,helper:!0};throw new Error("not implemented")}})(jc||(jc={}));var Ss;(function(r){r[r.Front=0]="Front",r[r.Back=1]="Back",r[r.Double=2]="Double"})(Ss||(Ss={}));var Ch;(function(t){t.defaultData={castShadow:!0,receiveShadow:!0};function e(r,n){return r.castShadow===n.castShadow&&r.receiveShadow===n.receiveShadow}t.equals=e})(Ch||(Ch={}));var Lh;(function(t){t.defaultData={flatShading:!1,wireframe:!1,side:0};function e(r,n){return r.flatShading===n.flatShading&&r.side===n.side&&r.wireframe===n.wireframe}t.equals=e})(Lh||(Lh={}));var Ec;(function(e){e.defaultData=fe(U(U({},Lh.defaultData),Ch.defaultData),{cloner:null})})(Ec||(Ec={}));var Lr;(function(n){n[n.Left=1]="Left",n[n.Right=2]="Right",n[n.Center=3]="Center",n[n.Justify=4]="Justify"})(Lr||(Lr={}));var xi;(function(r){r[r.Top=1]="Top",r[r.Center=2]="Center",r[r.Bottom=3]="Bottom"})(xi||(xi={}));var Wi;(function(r){r[r.None=1]="None",r[r.Upper=2]="Upper",r[r.Lower=3]="Lower"})(Wi||(Wi={}));var Rc;(function(e){e.defaultData={width:100,height:100,horizontalAlign:1,verticalAlign:1,fontSize:16,lineHeight:1.5,letterSpacing:1,text:"",textTransform:1,color:Hn.fromHexAndA(6974058,1),alpha:1,font:"roboto_regular"}})(Rc||(Rc={}));var Zt;(function(n){n[n.Normal=0]="Normal",n[n.Multiply=1]="Multiply",n[n.Screen=2]="Screen",n[n.Overlay=3]="Overlay"})(Zt||(Zt={}));var ws;(function(r){r[r.Linear=0]="Linear",r[r.Radial=1]="Radial",r[r.Polar=2]="Polar"})(ws||(ws={}));var zc;(function(r){r[r.RepeatWrapping=1e3]="RepeatWrapping",r[r.ClampToEdgeWrapping=1001]="ClampToEdgeWrapping",r[r.MirroredRepeatWrapping=1002]="MirroredRepeatWrapping"})(zc||(zc={}));var Fc;(function(n){n[n.UV=0]="UV",n[n.Planar=1]="Planar",n[n.Spherical=2]="Spherical",n[n.Cylindrical=3]="Cylindrical"})(Fc||(Fc={}));var Vc;(function(s){s[s.Simplex=0]="Simplex",s[s.SimplexFractal=1]="SimplexFractal",s[s.Ashima=2]="Ashima",s[s.Fbm=3]="Fbm",s[s.Perlin=4]="Perlin"})(Vc||(Vc={}));var Ns;(function(r){function i(n,s){return n==="light"&&s?e(s):t(n)}r.defaultData=i;function e(n){switch(n){case"basic":return{type:"light",category:"basic",alpha:1,visible:!0,mode:0};case"phong":return{category:"phong",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"toon":return{category:"toon",specular:{r:.2,g:.2,b:.2},shininess:10,type:"light",alpha:1,visible:!0,mode:0};case"lambert":return{category:"lambert",emissive:{r:.2,g:.2,b:.2,a:1},type:"light",alpha:1,visible:!0,mode:0};case"physical":return{category:"physical",roughness:.2,metalness:.2,reflectivity:.2,type:"light",alpha:1,visible:!0,mode:0}}}function t(n){switch(n){case"texture":return{alpha:1,visible:!0,size:[128,128],mode:0,axis:ys.x,type:"texture",projection:0,texture:{image:"image_0",wrapping:1001,repeat:[1,1],offset:[0,0]},crop:!0};case"color":return{type:"color",alpha:1,visible:!0,mode:0,color:Zr.fromHex(4737101)};case"depth":return{type:"depth",alpha:1,visible:!0,mode:0,gradientType:1,smooth:!1,isVector:!0,isWorldSpace:!1,origin:[0,0,0],direction:[1,0,0],colors:[[1,1,1,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,near:50,far:200};case"normal":return{type:"normal",alpha:1,visible:!0,mode:0,cnormal:[1,1,1]};case"gradient":return{type:"gradient",alpha:1,visible:!0,mode:0,gradientType:0,smooth:!1,colors:[[0,0,0,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]],steps:[0,1,1,1,1,1,1,1,1,1],num:2,angle:0,offset:[0,0],morph:[0,0]};case"noise":return{type:"noise",alpha:1,visible:!0,mode:0,size:[100,100,100],noiseType:0,scale:1,move:1,colorA:fe(U({},Zr.fromHex(6710886)),{a:1}),colorB:fe(U({},Zr.fromHex(6710886)),{a:1}),colorC:fe(U({},Zr.fromHex(16777215)),{a:1}),colorD:fe(U({},Zr.fromHex(16777215)),{a:1}),distortion:[1,1],fA:[1.7,9.2],fB:[8.3,2.8]};case"fresnel":return{type:"fresnel",alpha:1,visible:!0,mode:0,color:Hn.fromHexAndA(16777215,1),bias:.1,scale:1,intensity:2,factor:1};case"rainbow":return{type:"rainbow",alpha:1,visible:!0,mode:0,filmThickness:30,movement:0,wavelengths:[0,0,0],noiseStrength:0,noiseScale:1,offset:[0,0,0]};case"matcap":return{type:"matcap",alpha:1,visible:!0,mode:0,texture:{image:"matcap_0",wrapping:1001,repeat:[1,1],offset:[0,0]}};case"transmission":return{type:"transmission",alpha:1,visible:!0,mode:0,thickness:10,ior:1.5,roughness:1};case"displace":return{type:"displace",displacementType:"noise",noiseType:0,scale:10,movement:1,offset:[0,0,0],intensity:8,visible:!0}}}})(Ns||(Ns={}));var Cs;(function(c){function i(f){return!f.layers.some(p=>{if(p.data.type==="texture"&&p.data.projection!==0||p.data.type==="depth"&&!p.data.isWorldSpace||p.data.type==="noise"||p.data.type==="displace")return!0})&&!t(f)}c.isMergable=i;function e(f){let h="";return f.layers.forEach(p=>{Object.entries(p.data).forEach(([y,g])=>{h+=`${y}${g}`,Array.isArray(g)?g.forEach(w=>h+=`${w}`):typeof g=="object"?Object.values(g).forEach(w=>{typeof w=="number"?h+=`${w.toFixed(4)}`:h+=`${w}`}):h+=`${g}`})}),h}c.getHash=e;function t(f){let h=0;for(let p of f.layers)"alpha"in p.data&&p.data.type!=="light"&&p.data.type!=="fresnel"&&(h+=(1-h)*p.data.alpha);return h<1}c.isTransparent=t;function r(){return{layers:new jt}}c.defaultEmptyData=r;function n(f="layer1",h="layer2"){return s("phong",f,h)}c.defaultData=n;function s(f,h="layer1",p="layer2"){let y=new jt;return y.push({fi:0,data:Ns.defaultData("light",f),id:h}),y.push({fi:1,data:Ns.defaultData("color"),id:p}),{layers:y}}c.defaultTwoLayerData=s;function l(f,h="basic",p="layer1",y="layer2"){let g=Ns.defaultData("texture");Object.assign(g.texture,{image:f});let w=new jt;return w.push({fi:0,data:g,id:p}),w.push({fi:1,data:Ns.defaultData("light",h),id:y}),{layers:w}}c.defaultTwoLayerTextureData=l})(Cs||(Cs={}));var Ls;(function(r){function i(){return{points:new jt,roundness:0,shapeHoles:[],isClosed:!1}}r.defaultData=i;function e(n,s){let{points:l}=s;if(l){for(let c of l)if(c.data.position[0]===n[0]&&c.data.position[1]===n[1])return!0}return!1}r.isOverlappingExistingPoint=e;function t(n,s){let l=n.controlNext,c=s.controlPrevious;return n.position[0]===l.position[0]&&n.position[1]===l.position[1]&&s.position[0]===c.position[0]&&s.position[1]===c.position[1]}r.isStraightLine=t})(Ls||(Ls={}));var Uc;(function(e){function i(t){return t==="PolygonGeometry"||t==="RectangleGeometry"||t==="StarGeometry"||t==="TriangleGeometry"||t==="EllipseGeometry"}e.is2DParametricMesh=i})(Uc||(Uc={}));var kc;(function(e){function i(t){if(t==="RectangleGeometry")return{width:320,height:320,type:t,cornerRadius:[0,0,0,0],cornerType:0,depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};if(t==="VectorGeometry")return{width:100,height:100,type:t,subdivisions:12,shape:Ls.defaultData(),depth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1};throw new Error("not implemented")}e.defaultData=i})(kc||(kc={}));var ya;(function(n){n.identity=fe(U({},yc.identity),{hiddenMatrix:Ui.identity});function e(s){return{position:s.position,rotation:s.rotation,scale:s.scale,hiddenMatrix:s.hiddenMatrix}}n.fromObject=e;function t(s,l){return{position:(l==null?void 0:l.position)||s.position,rotation:(l==null?void 0:l.rotation)||s.rotation,scale:(l==null?void 0:l.scale)||s.scale,hiddenMatrix:(l==null?void 0:l.hiddenMatrix)||s.hiddenMatrix}}n.merge=t;function r(s,l){return{position:xs.isEqual(s.position,l.position)?null:l.position,rotation:xs.isEqual(s.rotation,l.rotation)?null:l.rotation,scale:xs.isEqual(s.scale,l.scale)?null:l.scale,hiddenMatrix:Ui.isEqual(s.hiddenMatrix,l.hiddenMatrix)?null:l.hiddenMatrix}}n.diff=r})(ya||(ya={}));var qi;(function(e){e.defaultData=U({states:new jt,events:new jt,visible:!0,raycastLock:!1},ya.identity)})(qi||(qi={}));var l0;(function(e){e.defaultData=U({type:"Empty"},qi.defaultData)})(l0||(l0={}));var _h;(function(e){e.defaultData=U(U({type:"Mesh"},qi.defaultData),Ec.defaultData)})(_h||(_h={}));var c0;(function(e){e.defaultData=U(U({type:"TextFrame"},qi.defaultData),Rc.defaultData)})(c0||(c0={}));var Hc;(function(e){e.defaultData=U(U(U({},qi.defaultData),ya.identity),vo.defaultData)})(Hc||(Hc={}));var u0;(function(e){function i(t){return U(U({},qi.defaultData),jc.defaultData(t))}e.defaultData=i})(u0||(u0={}));var f0;(function(t){t.defaultCamera=U({position:[0,0,1e3],scale:[1,1,1],rotation:[0,0,0],hiddenMatrix:Ui.identity,name:"Play Camera",visible:!0,raycastLock:!1,states:new jt,events:new jt},vo.defaultData),t.defaultMeshObject=fe(U(U({name:"Rectangle"},qi.defaultData),_h.defaultData),{geometry:kc.defaultData("RectangleGeometry"),material:Cs.defaultTwoLayerData("basic","layer1","layer2")})})(f0||(f0={}));var h0;(function(t){function i(r,n){if(n===void 0)return r;let s=U({},r);return"material"in s&&"material"in n&&n.material&&(s.material=fh(s.material,l=>{if(typeof l!="string")for(let[c,f]of Object.entries(n.material.layers)){let h=l.layers.data(c);h&&xo(h,f)}}).data),s.materials&&n.materials&&(s.materials=fh(s.materials,l=>{var c,f;for(let h=0;h<s.materials.length;h++){let p=n.materials[h];if(typeof p!="string")for(let[y,g]of Object.entries(p.layers)){let w=(f=(c=l[h])==null?void 0:c.layers)==null?void 0:f.data(y);w&&xo(w,g)}}}).data),s}t.patchMaterialState=i;function e(r,n){var l,c;if(n===void 0)return r;let s=U({},r);if(Object.assign(s,ya.merge(s,n)),gs.is(r.type)){s.orthographic=U({},s.orthographic),s.perspective=U({},s.perspective);let f=n;((l=f.orthographic)==null?void 0:l.zoom)!==void 0&&(s.orthographic.zoom=f.orthographic.zoom),((c=f.perspective)==null?void 0:c.zoom)!==void 0&&(s.perspective.zoom=f.perspective.zoom)}else if(r.type==="Mesh")s.geometry=U({},s.geometry),Object.assign(s.geometry,n.geometry),s=i(s,n);else if(Gc.is(r.type)){let f=n;s.intensity!==void 0&&(s.intensity=f.intensity),f.color!==void 0&&(typeof f.color=="string"?s.color=f.color:s.color=Zr.clone(f.color))}return s}t.patch=e})(h0||(h0={}));var Yt=5855577;var d0=2857471;var Th=15711266;import{DoubleSide as HP,Mesh as WP,MeshBasicMaterial as qP,ShapeBufferGeometry as $P,Vector2 as JP,Vector3 as KP}from"three";import{FontLoader as XP}from"three/examples/jsm/loaders/FontLoader.js";var Ut=class extends WP{constructor({char:e,originalChar:t,fontFamily:r,letterSpacing:n,fontSize:s,LOD:l=16},c=new qP({color:0,opacity:1,visible:!0,transparent:!0,side:HP})){let f=Ut.loadChar(e,r,l);super(f.geometry,c);this.char=e,this.originalChar=t!=null?t:e,this.fontFamily=r,this.letterSpacing=n,this.fontSize=s,this.LOD=l,this.resolution=f.resolution,this.glyphsHa=f.glyphsHa,this.localPosition=new JP,this.charSize=0,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}static get FONTS_PATH(){return Ut._fontPath}static set FONTS_PATH(e){Ut._fontPath=e}updatePosition(e,t){this.localPosition.copy(e);let r=new KP(this.localPosition.x,-this.localPosition.y,0);this.position.copy(r).add(t)}updateFontSize(e){let t=e/this.resolution;this.fontSize=e,this.scale.set(this.fontSize,this.fontSize,1),this.charSize=this.glyphsHa*t*this.letterSpacing}updateFontFamily(e){if(this.fontFamily===e)return;this.fontFamily=e;let t=Ut.loadChar(this.char,e,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateChar(e){if(this.char===e)return;this.char=e;let t=Ut.loadChar(e,this.fontFamily,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}updateLetterSpacing(e){this.letterSpacing!==e&&(this.letterSpacing=e,this.updateFontSize(this.fontSize))}updateLOD(e){if(this.LOD===e)return;this.LOD=e;let t=Ut.loadChar(this.char,this.fontFamily,this.LOD);this.geometry=t.geometry,this.resolution=t.resolution,this.glyphsHa=t.glyphsHa,this.geometry.userData={type:"CharacterGeometry",parameters:{char:this.char,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,lod:this.LOD,resolution:this.resolution,charSize:this.charSize,localPosition:this.localPosition}},this.updateFontSize(this.fontSize)}clone(){let e={char:this.char,originalChar:this.originalChar,fontFamily:this.fontFamily,letterSpacing:this.letterSpacing,fontSize:this.fontSize,LOD:this.LOD};return new Ut(e).copy(this)}static loadFont(e){return new Promise(function(t,r){Ut.fontCache[e]?t(Ut.fontCache[e]):new XP().load(Ut.FONTS_PATH+e+".json",s=>{Ut.fontCache[e]=s,t(s)},void 0,r)})}static loadChar(e,t,r){if(Ut.charCache[e]){if(Ut.charCache[e][r]&&Ut.charCache[e][r].fontFamily===t)return Ut.charCache[e][r]}else Ut.charCache[e]={};let n=Ut.fontCache[t],s=n.generateShapes(e,1);return Ut.charCache[e][r]={geometry:new $P(s,r),fontFamily:t,resolution:n.data.resolution,glyphsHa:n.data.glyphs[e].ha},Ut.charCache[e][r]}},Rr=Ut;Rr.charCache={},Rr.fontCache={},Rr._fontPath="/_assets/_fonts/";import{DoubleSide as Vu,MeshBasicMaterial as fb,Vector3 as hb,Object3D as Q3}from"three";import{Mesh as AD}from"three";import{BufferGeometry as Dk,ConeBufferGeometry as QP,Float32BufferAttribute as Bk,Vector2 as Gk,Vector3 as jk}from"three";import{BufferGeometry as ZP,CylinderBufferGeometry as YP,Float32BufferAttribute as Ih,Vector2 as Dn,Vector3 as Wc}from"three";var p0=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var l,c,f,h,p;let t=Object.assign({},(l=e==null?void 0:e.parameters)!=null?l:{width:100,radialSegments:64,heightSegments:1,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadius:0,cornerSegments:8,hollow:0},i.parameters),r=t.width/2,n=(c=t.radiusTop)!=null?c:r,s=(f=t.radiusBottom)!=null?f:r;return n===s?(n=r,s=r):n>s?(n=r,s=s*r/n):(n=n*r/s,s=r),{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((h=t.height)!=null?h:t.width),depth:Math.abs((p=t.depth)!=null?p:t.width),radiusTop:n,radiusBottom:s})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:l,thetaStart:c,thetaLength:f,radiusTop:h,radiusBottom:p,cornerRadius:y,cornerSegments:g,hollow:w}=i.parameters,S;return y||w?S=new qc(h,p,r,n,s,l,c,f*Math.PI/180,y,y,g,w):S=new YP(h,p,r,n,s,l,c,f*Math.PI/180),S.scale(1,1,t/e),Object.assign(S,{userData:fe(U({},i),{type:"CylinderGeometry"})})}};function $i(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function m0(i){return new Dn(i.y,-i.x)}var qc=class extends ZP{constructor(e,t,r,n,s,l,c,f,h,p,y,g,w=!1){super();this.type="RoundedCylinderBufferGeometry",e=e!==void 0?e:1,t=t!==void 0?t:1,r=r||1,n=Math.floor(n)||8,s=Math.floor(s)||1,l=l!==void 0?l:!1,c=c!==void 0?c:0,f=f!==void 0?f:Math.PI*2,l&&(h=0,p=0);let S=[],T=[],C=[],B=[],G=0,D=r/2,W=new Wc,A=new Wc;w&&e==0&&(e=h),w&&t==0&&(t=p);let q=new Dn(e,D),E=new Dn(t,-D),b=null,R=null,I=null,z=null,O=q.clone().sub(E),$=0,he=0,re=0;g>0&&($=Math.min(e,t)*(1-g),he=e-$,re=t-$);let Ne=q.clone();Ne.x-=$;let ye=Math.PI-O.angle(),Me=O.angle(),Fe=Math.tan(Me/2),k=Math.tan(ye/2),H=Fe+k,_=g?H:k,J=g?H:Fe;if(h=Math.min(h,(e-he)/_,O.length()/H),p=Math.min(p,(t-re)/J,O.length()/H),h>0){let K=h/Fe;b=q.clone().sub(new Dn(K,h)),g&&(I=b.clone(),I.x-=$-H*h),q.sub(O.clone().setLength(K))}if(p>0){let K=p/k;R=E.clone().sub(new Dn(K,-p)),E.add(O.clone().setLength(K)),g&&(z=R.clone(),z.x-=$-H*p,Ne.sub(O.clone().setLength(K)))}O=q.clone().sub(E);let ee=O.length()<.5,oe=[];for(let K=0;K<=n;K++){let ae=[],ne=K/n,Ce=ne*f+c,Y=new Dn(Math.sin(Ce),Math.cos(Ce));z&&R?(se(ae,ne,Y,ye,p,z,-1,!0),se(ae,ne,Y,Me,p,R,-1,!1)):R?(ce(ae,Y,R.x,0,-1),se(ae,ne,Y,Me,p,R,-1,!1)):l||ce(ae,Y,t,re,-1);let le=m0(O).normalize();if($i(le,Y,W),!ee)for(let de=0;de<=s;de++){let xe=de/s,_e=O.clone().multiplyScalar(xe).add(E);$i(_e,Y,A),T.push(A.x,A.y,A.z),C.push(W.x,W.y,W.z),B.push(ne,.5+A.y/r),ae.push(G++)}if(I&&b?(se(ae,ne,Y,ye,h,b,1,!1),se(ae,ne,Y,Me,h,I,1,!0)):b?(se(ae,ne,Y,ye,h,b,1,!1),ce(ae,Y,b.x,0,1)):l||ce(ae,Y,e,he,1),g&&!ee){let de=m0(O).multiplyScalar(-1).normalize();$i(de,Y,W);for(let xe=0;xe<=s;xe++){let _e=xe/s,pe=O.clone().multiplyScalar(-_e).add(Ne);$i(pe,Y,A),T.push(A.x,A.y,A.z),C.push(W.x,W.y,W.z),B.push(ne,.5+A.y/r),ae.push(G++)}}g&&!l&&ae.push(ae[0]),oe.push(ae)}for(let K=0;K<oe.length-1;K++)for(let ae=0;ae<oe[0].length-1;ae++){if(l&&g&&ae==s)continue;let ne=oe[K][ae],Ce=oe[K+1][ae],Y=oe[K+1][ae+1],le=oe[K][ae+1],de=T[Y*3+0],xe=T[Y*3+2];S.push(ne,Ce,le),(de!=0||xe!=0)&&S.push(Ce,Y,le)}f<Math.PI*2&&(ue(-1,oe[0],c),ue(1,oe[oe.length-1],c+f)),this.setIndex(S),this.setAttribute("position",new Ih(T,3)),this.setAttribute("normal",new Ih(C,3)),this.setAttribute("uv",new Ih(B,2));function se(K,ae,ne,Ce,Y,le,de,xe){for(let _e=0;_e<y+1;_e++){let pe=_e/y,we=de<0?pe:1-pe;xe&&(we-=1),we*=Ce;let Ve=new Dn(Math.sin(we),Math.cos(we)*de),Ge=Ve.clone().multiplyScalar(Y).add(le);$i(Ge,ne,A),T.push(A.x,A.y,A.z),$i(Ve,ne,W),C.push(W.x,W.y,W.z),B.push(ae,.5+A.y/r),K.push(G++)}}function ce(K,ae,ne,Ce,Y){let le=new Wc,de=new Dn,xe=[ne,Ce];Y<0&&xe.reverse();for(let _e of xe)de.set(_e,D*Y),$i(de,ae,le),T.push(le.x,le.y,le.z),C.push(0,Y,0),B.push(.5,.5),K.push(G++)}function ue(K,ae,ne){let Ce=new Dn(Math.sin(ne),Math.cos(ne)),Y=new Dn(-Math.cos(ne),Math.sin(ne)),le=new Wc,de=K<0?(pe,we,Ve)=>S.push(pe,we,Ve):(pe,we,Ve)=>S.push(pe,Ve,we),xe=new Dn((e+t+he+re)/4,0);$i(xe,Ce,le),T.push(le.x,le.y,le.z),C.push(Y.x,0,Y.y),B.push(.5,.5);let _e=G++;for(let pe of ae){let we=T.slice(pe*3,pe*3+3);T.push(...we),C.push(Y.x,0,Y.y);let Ve=B.slice(pe*2,pe*2+2);B.push(...Ve),G++}for(let pe=_e+1;pe<G-1;pe++)de(_e,pe,pe+1);de(_e,G-1,_e+1)}}};var g0=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:32,heightSegments:8,openEnded:!1,thetaStart:0,thetaLength:360,cornerRadiusTop:0,cornerRadiusBottom:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,depth:t,height:r,radialSegments:n,heightSegments:s,openEnded:l,thetaStart:c,thetaLength:f,cornerRadiusTop:h,cornerRadiusBottom:p,cornerSegments:y}=i.parameters,g;return h>0||p>0||f<360?g=new qc(0,e/2,r,n,s,l,c,f*Math.PI/180,h,p,y,0,!0):g=new QP(e/2,r,n,s,l),g.scale(1,1,t/e),Object.assign(g,{userData:fe(U({},i),{type:"ConeGeometry"})})}};import{BoxBufferGeometry as e2,BufferGeometry as t2,Float32BufferAttribute as Mh,Vector3 as xa}from"three";var y0=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:1,heightSegments:1,depthSegments:1,cornerRadius:0,cornerSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,widthSegments:n,heightSegments:s,depthSegments:l,cornerRadius:c,cornerSegments:f}=i.parameters,h;return c==0?h=new e2(e,t,r,n,s,l):h=new x0(e,t,r,n,s,l,c,f),Object.assign(h,{userData:fe(U({},i),{type:"CubeGeometry"})})}},Ah=Math.PI/2,x0=class extends t2{constructor(e=1,t=1,r=1,n=1,s=1,l=1,c=0,f=4){super();this.type="BoxBufferGeometry";let h=this;n=Math.floor(n),s=Math.floor(s),l=Math.floor(l),f=Math.floor(f),c=Math.min(c,e/2,t/2,r/2);let p=[],y=[],g=[],w=[],S=0,T=0;C("z","y","x",-1,-1,r,t,e,l,s,0),C("z","y","x",1,-1,r,t,-e,l,s,1),C("x","z","y",1,1,e,r,t,n,l,2),C("x","z","y",1,-1,e,r,-t,n,l,3),C("x","y","z",1,-1,e,t,r,n,s,4),C("x","y","z",-1,-1,e,t,-r,n,s,5),c>0&&(B("z","y","x",-1,-1,1,r,t,e,l,0),B("z","y","x",1,-1,-1,r,t,e,l,1),B("z","y","x",-1,1,-1,r,t,e,l,1),B("z","y","x",1,1,1,r,t,e,l,0),B("x","y","z",-1,-1,-1,e,t,r,n,0),B("x","y","z",1,-1,1,e,t,r,n,1),B("x","y","z",-1,1,1,e,t,r,n,0),B("x","y","z",1,1,-1,e,t,r,n,1),B("y","x","z",-1,-1,1,t,e,r,s,0),B("y","x","z",1,-1,-1,t,e,r,s,1),B("y","x","z",1,1,1,t,e,r,s,1),B("y","x","z",-1,1,-1,t,e,r,s,0),G(1,1,1),G(-1,1,1),G(1,-1,1),G(-1,-1,1),G(1,1,-1),G(-1,1,-1),G(1,-1,-1),G(-1,-1,-1)),this.setIndex(p),this.setAttribute("position",new Mh(y,3)),this.setAttribute("normal",new Mh(g,3)),this.setAttribute("uv",new Mh(w,2));function C(D,W,A,q,E,b,R,I,z,O,$){let he=(b-2*c)/z,re=(R-2*c)/O,Ne=b/2-c,ye=R/2-c,Me=I/2,Fe=z+1,k=O+1,H=0,_=0,J=new xa;for(let ee=0;ee<k;ee++){let oe=ee*re-ye;for(let se=0;se<Fe;se++){let ce=se*he-Ne;J[D]=ce*q,J[W]=oe*E,J[A]=Me,y.push(J.x,J.y,J.z),J[D]=0,J[W]=0,J[A]=I>0?1:-1,g.push(J.x,J.y,J.z),w.push(se/z),w.push(1-ee/O),H+=1}}for(let ee=0;ee<O;ee++)for(let oe=0;oe<z;oe++){let se=S+oe+Fe*ee,ce=S+oe+Fe*(ee+1),ue=S+(oe+1)+Fe*(ee+1),K=S+(oe+1)+Fe*ee;p.push(se,ce,K),p.push(ce,ue,K),_+=6}h.addGroup(T,_,$),T+=_,S+=H}function B(D,W,A,q,E,b,R,I,z,O,$){let he=(R-2*c)/O,re=R/2-c,Ne=I/2-c,ye=z/2,Me=O+1,Fe=0,k=0,H=new xa,_=new xa;for(let J=0;J<f+1;J++){let ee=J/f*Ah,oe=Math.sin(ee)*c,se=(1-Math.cos(ee))*c,ce=Math.sin(ee),ue=Math.cos(ee);H[W]=(Ne+oe)*E,H[A]=(ye-se)*b,_[D]=0,_[W]=ce*Math.sign(H[W]),_[A]=ue*Math.sign(H[A]);for(let K=0;K<Me;K++){let ae=K*he-re;H[D]=ae*q,y.push(H.x,H.y,H.z),g.push(_.x,_.y,_.z),w.push(K/O),w.push(0),Fe+=1}}for(let J=0;J<f;J++)for(let ee=0;ee<O;ee++){let oe=S+ee+Me*J,se=S+ee+Me*(J+1),ce=S+(ee+1)+Me*(J+1),ue=S+(ee+1)+Me*J;p.push(oe,se,ue),p.push(se,ce,ue),k+=6}h.addGroup(T,k,$),T+=k,S+=Fe}function G(D,W,A){let q=new xa,E=new xa(e/2,t/2,r/2);E.subScalar(c);let b=[],R=D*W*A>0?(z,O,$)=>p.push(z,O,$):(z,O,$)=>p.push(z,$,O);for(let z=0;z<=f;z++){let O=[],$=Ah*(1-z/f),he=Math.cos($),re=Math.sin($),Ne=0;for(let ye=0;ye<=z;ye++){let Me=Math.cos(Ne),Fe=Math.sin(Ne);q.x=he*Me,q.y=re,q.z=he*Fe;let k=E.clone().addScaledVector(q,c);y.push(D*k.x,W*k.y,A*k.z),g.push(D*q.x,W*q.y,A*q.z),w.push(0,0),O.push(S++),Ne+=Ah/z}b.push(O)}let I=b.length-1;for(let z=0;z<I;z++){let O=b[z],$=b[z+1],he=O.length-1;R(O[0],$[1],$[0]);for(let re=1;re<=he;re++)R(O[re-1],O[re],$[re]),R(O[re],$[re+1],$[re])}}}};import{BufferGeometry as r2,Float32BufferAttribute as Oh,Triangle as n2,Vector3 as vi,Vector2 as Ph}from"three";var wo=class extends r2{constructor(e=[],t=[],r="",n=1,s=.2,l=4){super();this.type="PolyhedronGeometryRound";let c=[],f=[],h=[];p(),y(),this.setAttribute("position",new Oh(c,3)),this.setAttribute("normal",new Oh(h,3)),this.setAttribute("uv",new Oh(f,2));return;function p(){var Fe;s=Math.min(1-1e-5,s),s==0&&(l=0);let w={IcosahedronGeometry:5,DodecahedronGeometry:3,HexahedronGeometry:3,OctahedronGeometry:4,TetrahedronGeometry:3}[r],S=new vi,T=S.clone(),C=new n2,B=s*n,G=n-B,D=l+1,W=new vi,A=(k,H)=>W.subVectors(k,H).normalize(),q=(k,H)=>Array(k).fill(void 0).map(H),E=q(e.length/3,(k,H)=>new vi().fromArray(e,H*3).setLength(n)),b=[],R=1e6;for(let k=0;k<E.length;k++){let H=E[k],_=[],J,ee,oe,se=1e10,ce=-1;for(;(ce=t.indexOf(k,ce+1))!=-1;){let ne=ce-ce%3;J=t[ne+(ce+1)%3],ee=t[ne+(ce+2)%3],oe=H.distanceToSquared(E[J]),se=Math.min(se,oe),_.push([J,ee,oe])}se+=1e-6;let ue=[],K=0,ae=_.length;for(let ne=0;ne<ae;ne++){[J,ee,oe]=_[K];let Ce=((Fe=b[J])==null?void 0:Fe.includes(k))==!0;oe<=se&&ue.push(J+ +Ce*R),K=_.findIndex(Y=>Y[0]==ee)}b.push(ue)}let I=[];{let k=0,H=0,_,J,ee=w==3;for(let oe=0;oe<=l;oe++){_=oe*(oe+1)/2,J=(oe+1)*(oe+2)/2;for(let se=0;se<l-oe;se++)[k,H]=[_+se+oe+2,J+se+oe+3],I.push(_,J,...ee?[H,_]:[k,J],H,k),[_,J]=[k,H];I.push(_,J,_+l+2)}}let z=S.clone(),O=S.clone(),$=S.clone(),he=S.clone(),re=S.clone(),Ne=[],ye=q(E.length,()=>q(w,()=>S.clone()));for(let k=0;k<E.length;k++){S.copy(E[k]).normalize(),z.copy(S).multiplyScalar(G);let H=b[k];for(let ue=0;ue<H.length;ue++){let K=H[ue],ae=H[(ue+1)%w];C.setFromPointsAndIndices(E,k,K%R,ae%R),C.b.sub(C.a).setLength(1e10).add(C.a),C.c.sub(C.a).setLength(1e10).add(C.a),C.closestPointToPoint(z,ye[k][ue])}let _=[],J=[],ee=[],oe=new vi;l==0&&[...ye[k]].reduce((ue,K)=>ue.add(K),oe).multiplyScalar(1/w);for(let ue=0;ue<w;ue++){let K=[],ae=(ue-1+w)%w,ne=ye[k][ae],Ce=ye[k][ue];S.copy(ne).sub(z),T.copy(Ce).sub(z);let Y=z.angleTo(S),le=S.angleTo(T),de=Math.cos(Y)*B;l==0?O.copy(oe):O.copy(z).setLength(G+de),J.push(de);let xe=[O,ne,Ce];for(let _e=0;_e<2;_e++){let pe=xe[_e],we=xe[_e+1];he.subVectors(pe,z),re.subVectors(we,z),$.crossVectors(he,re).normalize();for(let Ve=0;Ve<D;Ve++){let Ge=[Y,le][_e]*Ve/D;S.copy(he).applyAxisAngle($,Ge).add(z),_.push(S.clone()),_e&&(A(S,z),K.push([Ve==0?pe:S.clone(),W.clone()]))}_e&&(A(we,z),K.push([we,W.clone()]))}ee.push(K)}Ne.push(ee);let se=2*D,ce=2;for(let ue=0;ue<w;ue++){let K=se*ue,ae=se*((ue+1)%w),ne=[_[K]];for(let Y=1;Y<D;Y++){he=_[K+Y],re=_[ae+Y],ne.push(he);for(let le=1,de=Y-ce+1;le<=de;le++)S.lerpVectors(he,re,le/(de+1)),S.sub(z).setLength(J[ue]).add(z),ne.push(S.clone());ne.push(re)}for(let Y=0;Y<D;Y++)ne.push(_[Y+D+K]);ne.push(_[ae+D]);let Ce=I.map(Y=>ne[Y]);c.push(...Ce.map(Y=>[Y.x,Y.y,Y.z]).flat()),h.push(...Ce.map(Y=>(A(Y,z),[W.x,W.y,W.z])).flat())}}let Me=[];for(let k=0;k<b.length;k++)for(let H=0;H<w;H++){let _=b[k][H];if(_<R){let J=b[_].findIndex(se=>se%R==k),ee=Ne[k][H],oe=Ne[_][J];for(let se=0;se<D;se++){let ce=ee[se],ue=oe[D-se],K=ee[se+1],ae=oe[D-(se+1)];[ce,ue,K,K,ue,ae].forEach(ne=>{c.push(ne[0].x,ne[0].y,ne[0].z),h.push(ne[1].x,ne[1].y,ne[1].z)})}Me.push(ee[0][0],oe[D][0],ee[D][0],oe[0][0])}}for(;Me.length;){let k,H,_,J;[k,H]=Me.splice(0,2);let ee=[k];for(;k!=H;)ee.push(H),_=Me.indexOf(H),J=_%2,H=Me.splice(_-J,2)[1-J];W.subVectors(ee[0],ee[1]).cross(S.subVectors(ee[0],ee[2])).normalize();let oe=W.dot(ee[0])<0;oe&&W.negate();for(let se=1;se<=ee.length-2;se++)[ee[se+ +oe],ee[se+1-+oe],ee[0]].forEach(ce=>{c.push(ce.x,ce.y,ce.z),h.push(W.x,W.y,W.z)})}}function y(){let g=new vi;for(let E=0;E<c.length;E+=3){g.x=c[E+0],g.y=c[E+1],g.z=c[E+2];let b=A(g)/2/Math.PI+.5,R=q(g)/Math.PI+.5;f.push(b,1-R)}let w=new vi,S=new vi,T=new vi,C=new vi,B=new Ph,G=new Ph,D=new Ph,W=(E,b,R,I)=>{I<0&&E.x===1&&(f[b]=E.x-1),R.x===0&&R.z===0&&(f[b]=I/2/Math.PI+.5)};for(let E=0,b=0;E<c.length;E+=9,b+=6){w.set(c[E+0],c[E+1],c[E+2]),S.set(c[E+3],c[E+4],c[E+5]),T.set(c[E+6],c[E+7],c[E+8]),B.set(f[b+0],f[b+1]),G.set(f[b+2],f[b+3]),D.set(f[b+4],f[b+5]),C.copy(w).add(S).add(T).divideScalar(3);let R=A(C);W(B,b+0,w,R),W(G,b+2,S,R),W(D,b+4,T,R)}for(let E=0;E<f.length;E+=6){let b=f[E+0],R=f[E+2],I=f[E+4],z=Math.max(b,R,I),O=Math.min(b,R,I);z>.9&&O<.1&&(b<.2&&(f[E+0]+=1),R<.2&&(f[E+2]+=1),I<.2&&(f[E+4]+=1))}function A(E){return Math.atan2(E.z,-E.x)}function q(E){return Math.atan2(-E.y,Math.sqrt(E.x*E.x+E.z*E.z))}}}static fromJSON(e){return new wo(e.vertices,e.indices,e.radius,e.corner,e.cornerSides)}};import{DodecahedronBufferGeometry as i2}from"three";var v0=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:l}=i.parameters,c=n===0&&s!==0?new $c(e*.5,s,l):new i2(e*.5,n);return c.scale(1,t/e,r/e),Object.assign(c,{userData:fe(U({},i),{type:"DodecahedronGeometry"})})}},$c=class extends wo{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=1/n,l=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-s,-n,0,-s,n,0,s,-n,0,s,n,-s,-n,0,-s,n,0,s,-n,0,s,n,0,-n,0,-s,n,0,-s,-n,0,s,n,0,s],c=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9],f="DodecahedronGeometry";super(l,c,f,e,t,r);this.type=f}static fromJSON(e){return new $c(e.radius,e.corner,e.cornerSides)}};import{EventDispatcher as m2,Plane as g2,Shape as O0,Vector2 as bi,Vector3 as y2,MathUtils as zh,LineCurve as Fh,QuadraticBezierCurve as P0,CubicBezierCurve as Xc}from"three";import{CubicBezierCurve as Jc,EllipseCurve as o2,LineCurve as Kc,LineCurve3 as s2,MathUtils as a2,QuadraticBezierCurve as Dh,SplineCurve as l2,Vector2 as Bn,Vector3 as b0}from"three";var va=1e-12,ba=class{constructor(e){this.position=new Bn;this.startPosition=new Bn;this.uuid=a2.generateUUID();this.position=e.clone()}start(){this.reset()}reset(){this.startPosition.copy(this.position)}applyOffset(e){this.position.copy(this.startPosition).add(e)}copy(e){return this.position.copy(e.position),this.startPosition.copy(e.startPosition),this}clone(){return new ba(this.position).copy(this)}toJSON(){return[this.position.x,this.position.y]}},Sa=class extends ba{constructor(e){super(e.position);this.parent=e}copy(e){return super.copy(e),this}clone(){return new Sa(this.parent).copy(this)}},Xn=class extends ba{constructor(e,t){super(t);this.controls=[];this.roundness=0;this.areControlsDirectionsMirrored=!0;this.uuid=e,this.controls.push(new Sa(this),new Sa(this))}static create(e,t){let r=new Xn(e,new Bn(...t.position));return r.controls[0].position.set(...t.controlPrevious.position),r.controls[1].position.set(...t.controlNext.position),r.roundness=t.roundness,r.areControlsDirectionsMirrored=t.areControlsDirectionsMirrored,r}getOppositeControl(e){let t=this.controls.indexOf(e);return t===0?this.controls[1]:t===1?this.controls[0]:null}applyOffsetToControls(e,t=1){for(let r=0,n=this.controls.length;r<n;r++){let s=this.controls[r];this.position.distanceTo(s.position)<=t?s.position.copy(this.position):s.applyOffset(e)}}controlsMoved(){return!(this.position.equals(this.controls[0].position)&&this.position.equals(this.controls[1].position))}copy(e){return super.copy(e),this.controls[0].copy(e.controls[0]),this.controls[1].copy(e.controls[1]),this.roundness=e.roundness,this.uuid=e.uuid,this}clone(){return new Xn(this.uuid,this.position).copy(this)}toJSON(){return super.toJSON().concat(this.controls[0].toJSON(),this.controls[1].toJSON(),[this.roundness])}},Bh=i=>i,wa=new Bn,Gh=new Bn,c2=new Bn,u2=new Bn,f2=new Bn,h2=new Bn,S0=new b0,w0=new b0;function N0(i){let e=new Bn;e.addVectors(i.v0,wa.subVectors(i.v1,i.v0).multiplyScalar(2/3));let t=new Bn;return t.addVectors(i.v2,Gh.subVectors(i.v1,i.v2).multiplyScalar(2/3)),new Jc(i.v0,e,t,i.v2)}function Na(i,e,t=Number.EPSILON){return Math.abs(i-e)<t}function d2(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function p2(i,e,t=Number.EPSILON){return i.distanceTo(e)<t}function jh(i,e,t){let r=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),n=Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),s=Math.sqrt(Math.pow(t.x-i.x,2)+Math.pow(t.y-i.y,2));return Math.acos((n*n+r*r-s*s)/(2*n*r))}function C0(i,e,t,r,n){let s=Math.sqrt(Math.pow(e.x-i.x,2)+Math.pow(e.y-i.y,2)),l=(i.y+e.y)/2,c=(i.x+e.x)/2,f=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(i.y-e.y)/s,h=Math.sqrt(Math.pow(t,2)-Math.pow(s/2,2))*(e.x-i.x)/s;return r.set(c+f,l+h),n.set(c-f,l-h),[r,n]}function L0(i,e,t){let r=i.distanceTo(t),n=e.distanceTo(t);return r<n?e:i}function _0(i,e,t,r,n,s){let l=e.x-i.x,c=e.y-i.y,f=t.x-i.x,h=t.y-i.y,p=Math.sqrt((l+f)*(l+f)+(c+h)*(c+h)),y;return jh(e,i,t)>Math.PI&&(p*=-1),Na(h,c)?y=(c+h)*(r/p-.5)*8/3/(l-f):y=(l+f)*(r/p-.5)*8/3/(h-c),n.set(e.x-y*c,e.y+y*l),s.set(t.x+y*h,t.y-y*f),[n,s]}function Eh(i,e){return i.position.equals(i.controls[1].position)&&e.position.equals(e.controls[0].position)}function T0(i,e,t,r,n=.5){let s=wa.subVectors(e,i).multiplyScalar(n).add(i),l=Gh.subVectors(t,e).multiplyScalar(n).add(e),c=c2.subVectors(r,t).multiplyScalar(n).add(t),f=s,h=u2.subVectors(l,s).multiplyScalar(n).add(s),p=f2.subVectors(c,l).multiplyScalar(n).add(l),y=c,g=h2.subVectors(p,h).multiplyScalar(n).add(h);return[i.x,i.y,f.x,f.y,h.x,h.y,g.x,g.y,p.x,p.y,y.x,y.y,r.x,r.y]}function I0(i,e,t=12,r=!0){let n=w0.set(0,0,0),s,l=0,c=[];for(let f=0;f<e.length;f++){let h=Bh(e[f]),p=wa,y=Ji(h,t);c.push(y);for(let g=0;g<=y;g++)if(h instanceof Jc||h instanceof Dh||h instanceof Kc){if(h.getPoint(g/y,p),n.set(p.x,p.y,0),s!==void 0&&p2(s,n))continue;s===void 0&&(s=S0),s.copy(n),i.setXYZ(l,n.x,n.y,n.z),l++}}return r&&l>1&&!(i.getX(l-1)===i.getX(0)&&i.getY(l-1)===i.getY(0)&&i.getZ(l-1)===i.getZ(0))&&(i.setXYZ(l,i.getX(0),i.getY(0),i.getZ(0)),l++),i}function M0(i,e,t,r=12,n=!0){let s=w0.set(0,0,0),l=0,c=[];for(let f=0;f<e.length;f++){if(t[f]===!1)continue;let h,p=Bh(e[f]),y=wa,g=Ji(p,r);c.push(g);for(let w=0;w<=g;w++)if(p instanceof Jc||p instanceof Dh||p instanceof Kc){if(p.getPoint(w/g,y),s.set(y.x,y.y,0),h==null?void 0:h.equals(s))continue;h===void 0?h=S0:(i.setXYZ(l,h.x,h.y,h.z),l++,i.setXYZ(l,s.x,s.y,s.z),l++),h.copy(s)}}return n&&l>1&&!(i.getX(l-1)===i.getX(0)&&i.getY(l-1)===i.getY(0)&&i.getZ(l-1)===i.getZ(0))&&(i.setXYZ(l,i.getX(0),i.getY(0),i.getZ(0)),l++),c}function Rh(i,e=12,t=!1){let r=[];for(let n=0,s=i.length;n<s;n++){let l=i[n],c=0;if(t&&l.roundedCurveCorner!==void 0){let f=Ji(l.roundedCurveCorner,e)*.5;n>0&&(r[n-1]+=f),c+=f}l.curveAfter!==void 0&&(c+=Ji(l.curveAfter,e)),r.push(c)}return i.length>0&&t&&i[0].roundedCurveCorner!==void 0&&(r[i.length-1]+=Ji(i[0].roundedCurveCorner,e)*.5),r}function Ji(i,e=12){return i&&i instanceof o2?e*2:i&&(i instanceof Kc||i instanceof s2)?1:i&&i instanceof l2?e*i.points.length:e}function A0(i,e,t=12,r=!0){let n,s=0;for(let l=0;l<e.length;l++){let c=Bh(e[l]),f=Ji(c,t),h=wa;for(let p=0;p<=f;p++)if(c instanceof Jc||c instanceof Dh||c instanceof Kc){if(c.getPoint(p/f,h),n!==void 0&&d2(n,h,va))continue;n===void 0&&(n=Gh),n.copy(h),i.push(h.x,h.y),s++}}return Na(i[0],i[i.length-2],va)&&Na(i[1],i[i.length-1],va)&&(i.pop(),i.pop()),r&&s>1&&!(Na(i[s-1],i[1],va)&&Na(i[s-2],i[0],va))&&(i.push(i[0],i[1]),s++),i}var Vh=new bi,x2=new bi,v2=new bi,b2=new bi,S2=new bi,w2=new bi,st=class extends O0{constructor(e=100,t=100){super();this.points=[];this.shapeHoles=[];this.eventDispatcher=new m2;this.plane=new g2(new y2(0,0,-1));this.subdivision=0;this.controlSnapDistance=4;this.pointIDs=0;this.isMesh2D=!1;this._roundness=0;this.isClosed=!1;this.useCubicForRoundedCorners=!0;this.uuid=zh.generateUUID();this.needsUpdate=!1;this.roundedCurves=[];this._width=e,this._height=t}static createFromState(e,t,r){let n=new st;return n.isClosed=e.isClosed,n.points=e.points.map(s=>Xn.create(s.id,s.data)),typeof e.roundness=="number"&&(n.roundness=e.roundness),n.shapeHoles=e.shapeHoles.map(s=>st.createFromState(s)),t!==void 0&&r!==void 0&&n.applySize(t,r),n.update(),n}get width(){return this._width}get height(){return this._height}get roundness(){return this._roundness}set roundness(e){if(this._roundness!==e){this._roundness=e;for(let t=0,r=this.points.length;t<r;t++)this.points[t].roundness=e;this.needsUpdate=!0}}getPointsIndexesByIds(e){return e.map(t=>this.getPointIndexById(t)).filter(t=>t>=0)}getPointIndexById(e){return this.points.findIndex(t=>t.uuid===e)}getLineIndexById(e){return this.getPointIndexById(e)}getBezierPoint(e){if(e<=this.points.length-1)return this.points[e];if(this.shapeHoles.length>0)for(let t=0,r=this.shapeHoles.length;t<r;t++){let n=this.shapeHoles[t],s=e-this.points.length;if(s<=n.points.length-1)return n.points[s]}throw new Error("This shape does not have a point for this index: "+e)}getBezierPointIndex(e){let t=this.points.indexOf(e);if(t>=0)return t;if(t=this.points.length,this.shapeHoles.length>0)for(let r=0,n=this.shapeHoles.length;r<n;r++){let s=this.shapeHoles[r],l=s.points.indexOf(e);if(l>=0)return t+l;t+=s.points.length}return-1}getAllPoints(){let e=[].concat(...this.shapeHoles.map(t=>t.points));return[...this.points,...e]}applySize(e,t){e===0&&(e=.001),t===0&&(t=.001),this._width=e,this._height=t}applyScale(e,t){let r=Vh.set(e,t);for(let n=0,s=this.points.length;n<s;n++){let l=this.points[n];l.position.multiply(r),l.controls[0].position.multiply(r),l.controls[1].position.multiply(r)}for(let n=0,s=this.shapeHoles.length;n<s;n++)this.shapeHoles[n].applyScale(e,t);this._update(!1)}createPoint(e,t=0,r=zh.generateUUID()){let n;e instanceof bi?n=e:n=new bi(e,t);let s=new Xn(r,n);return s.roundness=this.roundness,s}addPoint(e){this.points.push(e),this.needsUpdate=!0}addPointAt(e,t){this.points.splice(t,0,e),this.needsUpdate=!0}getPointByUuid(e){for(let t=0,r=this.points.length;t<r;t++){let n=this.points[t];if(n.uuid===e)return n}}getFirstPoint(){return this.points[0]}getLastPoint(){return this.points[this.points.length-1]}removePoint(e){let t=this.points.indexOf(e);t>=0&&this.points.splice(t,1),this.needsUpdate=!0}removePointById(e){let t=this.points.find(r=>r.uuid===e);t&&this.removePoint(t)}update(e=!0){for(let t=0,r=this.shapeHoles.length;t<r;t++)this.shapeHoles[t].update(!1);this._update(e)}extractShapePointsToBuffer(e,t=12,r=!1){this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t);let n=r?this.roundedCurveDivisions:this.curveDivisions;return I0(e,r?this.roundedCurves:this.curves,t,this.autoClose),n.reduce((s,l)=>s+l,0)+1}computeCurveDivisions(e=12){return this.curveDivisions=Rh(this.points,e,!1),this.roundedCurveDivisions=Rh(this.points,e,!0),this.curveDivisions}extractFilteredShapePointsToBuffer(e,t,r=12){return M0(e,this.curves,t,r,this.autoClose).reduce((s,l)=>s+l,0)*2}extractShapePointsToFlatArray(e,t=12){return this.subdivision=t,this.curveDivisions===void 0&&this.computeCurveDivisions(t),A0(e,this.roundedCurves,t,this.autoClose)}getCurveIndexFromVertexId(e,t=!1){let r=0;this.curveDivisions===void 0&&this.computeCurveDivisions(this.subdivision);let n=t?this.roundedCurveDivisions:this.curveDivisions,s=0;t&&this.points[0].roundedCurveCorner!==void 0&&(s=Ji(this.points[0].roundedCurveCorner,this.subdivision)*.5);let l=e-s;l<0&&(l+=n.reduce((c,f)=>c+f,0));for(let c=0,f=n.length;c<f;c++){let h=n[c];if(l<r+h)return[c,(l-r+1)/h];r+=h}return[0,1]}getCurveT(e,t,r){let n=this.points[e],s=this.points[e>=this.points.length-1?0:e+1],l=this.curveDivisions,c=l[e];if(Eh(n,s)){let p=n.position.distanceTo(s.position);return n.position.distanceTo(Vh.set(r.x,r.y))/p}let f=0;for(let p=0;p<e;p++)f+=l[p];return(t-f)/c}dispose(){this.eventDispatcher=null}_applyCurveForPoint(e,t){Eh(t,e)?this.lineTo(e.position.x,e.position.y):this.bezierCurveTo(t.controls[1].position.x,t.controls[1].position.y,e.controls[0].position.x,e.controls[0].position.y,e.position.x,e.position.y);let r=this.curves[this.curves.length-1];e.curveBefore=r,t.curveAfter=r;let n=r.clone();e.roundedCurveBefore=n,t.roundedCurveAfter=n,e.roundedCurveCorner=void 0,this.roundedCurves.push(n)}_update(e=!0){var r;if(this.curves=[],this.roundedCurves=[],!this.points.length)return;for(let n=0,s=this.points.length;n<s;n++){let l=this.points[n];if(n===0)this.moveTo(l.position.x,l.position.y);else{let c=this.points[n-1];this._applyCurveForPoint(l,c)}}let t=this.getLastPoint();if((t==null?void 0:t.curveAfter)&&(t.curveAfter=void 0),this.isClosed){let n=this.points[0],s=this.points[this.points.length-1];this._applyCurveForPoint(n,s)}if(this.points.length>2){let n=0;for(let s=0,l=this.points.length;s<l;s++){let c=this.points[s],f=c.roundness;if(!c.controlsMoved()&&f>0){let h=c.curveBefore,p=c.curveAfter;if(h===void 0||p===void 0)continue;let y=c.roundedCurveBefore,g=c.roundedCurveAfter,w=h.getLength(),S=p.getLength(),T=Math.min(f,w*.499),C=Math.min(f,S*.499),B=Math.min(T,C),G=1-B/w,D=B/S,W=h.getPointAt(G,Vh),A=p.getPointAt(D,x2);this._subSplitCurve(h,y,G,W,void 0),this._subSplitCurve(p,g,D,void 0,A);let q;if(this.useCubicForRoundedCorners){let E=jh(W,c.position,A)/2,b=Math.tan(E)*W.distanceTo(c.position),[R,I]=C0(W,A,b,v2,b2),z=L0(R,I,c.position),[O,$]=_0(z,W,A,b,S2,w2);q=new Xc(W.clone(),O.clone(),$.clone(),A.clone())}else q=new P0(W.clone(),c.position.clone(),A.clone());c.roundedCurveCorner=q,this.roundedCurves.splice(s+n,0,q),n++}}}e&&((r=this.eventDispatcher)==null||r.dispatchEvent({type:"update"}))}_subSplitCurve(e,t,r,n,s){if(e instanceof Fh)n!==void 0&&t.v2.copy(n),s!==void 0&&t.v1.copy(s);else{let l=e,c=t,f=l.getUtoTmapping(r,0),h=T0(l.v0,l.v1,l.v2,l.v3,f);return n!==void 0&&(c.v0.set(h[0],h[1]),c.v1.set(h[2],h[3]),c.v2.set(h[4],h[5]),c.v3.set(h[6],h[7])),s!==void 0&&(c.v0.set(h[6],h[7]),c.v1.set(h[8],h[9]),c.v2.set(h[10],h[11]),c.v3.set(h[12],h[13])),c}return t}clone(){let e=new st(this._width,this._height);return e.points=this.points.map(t=>t.clone()),e.isClosed=this.isClosed,e.roundness=this.roundness,e.isMesh2D=this.isMesh2D,e.shapeHoles=this.shapeHoles.map(t=>t.clone()),e}toJSON(){return{points:this.points.reduce((e,t)=>e.concat(t.toJSON()),[]),shapeHoles:this.shapeHoles.map(e=>e.toJSON()),isClosed:this.isClosed,roundness:this.roundness}}fromJSON(e){var r;this.points=[],this.pointIDs=0;let t=e.points.length/7;for(let n=0;n<t;n++){let s=n*7,l=e.points[s+0],c=e.points[s+1],f=e.points[s+2],h=e.points[s+3],p=e.points[s+4],y=e.points[s+5],g=e.points[s+6],w=new Xn(zh.generateUUID(),new bi(l,c));w.controls[0].position.set(f,h),w.controls[1].position.set(p,y),w.roundness=g,this.points.push(w)}return this.shapeHoles=((r=e.shapeHoles)==null?void 0:r.length)?e.shapeHoles.map(n=>{let s=new st;return s.fromJSON(n),s}):[],this.isClosed=e.isClosed,this._roundness=e.roundness,this._update(),this}fromShape(e){let t=(n,s)=>{s instanceof Xc&&s.v3.equals(n.position)&&n.controls[0].position.copy(s.v2)},r=n=>{let s=[],l,c;for(l=0,c=n.length;l<c;l++)n[l]instanceof P0&&(n[l]=N0(n[l]));for(l=0,c=n.length;l<c;l++){let p=n[l],y=l>0?n[l-1]:null,g;p instanceof Xc?(g=this.createPoint(p.v0),g.controls[1].position.copy(p.v1)):p instanceof Fh&&(g=this.createPoint(p.v1)),g!==void 0&&(y!==null&&t(g,y),s.push(g))}let f=n[n.length-1],h=!1;return f instanceof Xc?f.v3.equals(s[0].position)&&(s[0].controls[0].position.copy(f.v2),h=!0):f instanceof Fh&&f.v2.equals(s[0].position)&&(h=!0),this.isClosed=h,s};return this.points=r(e.curves),e instanceof O0&&(this.shapeHoles=e.holes.map(n=>{let s=new st;return s.fromShape(n),s})),this.update(),this}};var Uh=Math.PI*2;function kh({x:i,y:e},t,r,n,s){return{x:i*t+n,y:e*r+s}}function N2(i,e){let t=e===1.5707963267948966?.551915024494:e===-1.5707963267948966?-.551915024494:4/3*Math.tan(e/4),r=Math.cos(i),n=Math.sin(i),s=Math.cos(i+e),l=Math.sin(i+e);return[{x:r-n*t,y:n+r*t},{x:s+l*t,y:l-s*t},{x:s,y:l}]}function D0(i,e,t,r){let n=i*r-e*t<0?-1:1,s=Math.min(1,Math.max(-1,i*t+e*r));return n*Math.acos(s)}function C2(i,e,t,r,n,s,l,c,f,h){let p=Math.pow(n,2),y=Math.pow(s,2),g=Math.pow(l,2),w=Math.pow(c,2),S=p*y-p*w-y*g;S<0&&(S=0),S/=p*w+y*g,S=Math.sqrt(S)*(f===h?-1:1);let T=S*n/s*c,C=S*-s/n*l,B=T+(i+t)/2,G=C+(e+r)/2,D=(l-T)/n,W=(c-C)/s,A=(-l-T)/n,q=(-c-C)/s,E=D0(1,0,D,W),b=D0(D,W,A,q);return!h&&b>0&&(b-=Uh),h&&b<0&&(b+=Uh),{centerx:B,centery:G,ang1:E,ang2:b}}function B0({px:i,py:e,cx:t,cy:r,rx:n,ry:s,largeArcFlag:l,sweepFlag:c}){let f=[];if(n===0||s===0)return[];let h=(i-t)/2,p=(e-r)/2;if(h===0&&p===0)return[];n=Math.abs(n),s=Math.abs(s);let y=Math.pow(h,2)/Math.pow(n,2)+Math.pow(p,2)/Math.pow(s,2);y>1&&(n*=Math.sqrt(y),s*=Math.sqrt(y));let g=C2(i,e,t,r,n,s,h,p,l,c),{ang1:w,ang2:S}=g,{centerx:T,centery:C}=g,B=Math.abs(S)/(Uh/4);Math.abs(1-B)<1e-7&&(B=1);let G=Math.max(Math.ceil(B),1);S/=G;for(let D=0;D<G;D++)f.push(N2(w,S)),w+=S;return f.map(D=>{let{x:W,y:A}=kh(D[0],n,s,T,C),{x:q,y:E}=kh(D[1],n,s,T,C),{x:b,y:R}=kh(D[2],n,s,T,C);return{x1:W,y1:A,x2:q,y2:E,x:b,y:R}})}import{BufferAttribute as Yc,BufferGeometry as M2}from"three";var Pt;(function(i){i[i.ODD=0]="ODD",i[i.NONZERO=1]="NONZERO",i[i.POSITIVE=2]="POSITIVE",i[i.NEGATIVE=3]="NEGATIVE",i[i.ABS_GEQ_TWO=4]="ABS_GEQ_TWO"})(Pt||(Pt={}));var Qt;(function(i){i[i.POLYGONS=0]="POLYGONS",i[i.CONNECTED_POLYGONS=1]="CONNECTED_POLYGONS",i[i.BOUNDARY_CONTOURS=2]="BOUNDARY_CONTOURS"})(Qt||(Qt={}));function Ae(i,e){if(!i)throw e||"Assertion Failed!"}var Te=function(){function i(){}return i.vertEq=function(e,t){return e.s===t.s&&e.t===t.t},i.vertLeq=function(e,t){return e.s<t.s||e.s===t.s&&e.t<=t.t},i.transLeq=function(e,t){return e.t<t.t||e.t===t.t&&e.s<=t.s},i.edgeGoesLeft=function(e){return i.vertLeq(e.Dst,e.Org)},i.edgeGoesRight=function(e){return i.vertLeq(e.Org,e.Dst)},i.vertL1dist=function(e,t){return Math.abs(e.s-t.s)+Math.abs(e.t-t.t)},i.edgeEval=function(e,t,r){Ae(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?n<s?t.t-e.t+(e.t-r.t)*(n/(n+s)):t.t-r.t+(r.t-e.t)*(s/(n+s)):0},i.edgeSign=function(e,t,r){Ae(i.vertLeq(e,t)&&i.vertLeq(t,r));var n=t.s-e.s,s=r.s-t.s;return n+s>0?(t.t-r.t)*n+(t.t-e.t)*s:0},i.transEval=function(e,t,r){Ae(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?n<s?t.s-e.s+(e.s-r.s)*(n/(n+s)):t.s-r.s+(r.s-e.s)*(s/(n+s)):0},i.transSign=function(e,t,r){Ae(i.transLeq(e,t)&&i.transLeq(t,r));var n=t.t-e.t,s=r.t-t.t;return n+s>0?(t.s-r.s)*n+(t.s-e.s)*s:0},i.vertCCW=function(e,t,r){return e.s*(t.t-r.t)+t.s*(r.t-e.t)+r.s*(e.t-t.t)>=0},i.interpolate=function(e,t,r,n){return e=e<0?0:e,r=r<0?0:r,e<=r?r===0?(t+n)/2:t+(n-t)*(e/(e+r)):n+(t-n)*(r/(e+r))},i.intersect=function(e,t,r,n,s){var l,c,f;i.vertLeq(e,t)||(f=e,e=t,t=f),i.vertLeq(r,n)||(f=r,r=n,n=f),i.vertLeq(e,r)||(f=e,e=r,r=f,f=t,t=n,n=f),i.vertLeq(r,t)?i.vertLeq(t,n)?(l=i.edgeEval(e,r,t),c=i.edgeEval(r,t,n),l+c<0&&(l=-l,c=-c),s.s=i.interpolate(l,r.s,c,t.s)):(l=i.edgeSign(e,r,t),c=-i.edgeSign(e,n,t),l+c<0&&(l=-l,c=-c),s.s=i.interpolate(l,r.s,c,n.s)):s.s=(r.s+t.s)/2,i.transLeq(e,t)||(f=e,e=t,t=f),i.transLeq(r,n)||(f=r,r=n,n=f),i.transLeq(e,r)||(f=e,e=r,r=f,f=t,t=n,n=f),i.transLeq(r,t)?i.transLeq(t,n)?(l=i.transEval(e,r,t),c=i.transEval(r,t,n),l+c<0&&(l=-l,c=-c),s.t=i.interpolate(l,r.t,c,t.t)):(l=i.transSign(e,r,t),c=-i.transSign(e,n,t),l+c<0&&(l=-l,c=-c),s.t=i.interpolate(l,r.t,c,n.t)):s.t=(r.t+t.t)/2},i}(),Ca=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}return i}(),Zc=function(){function i(e){this.side=e,this.next=null,this.Org=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Lface=null,this.activeRegion=null,this.winding=0}return Object.defineProperty(i.prototype,"Rface",{get:function(){return this.Sym.Lface},set:function(e){this.Sym.Lface=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dst",{get:function(){return this.Sym.Org},set:function(e){this.Sym.Org=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Oprev",{get:function(){return this.Sym.Lnext},set:function(e){this.Sym.Lnext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Lprev",{get:function(){return this.Onext.Sym},set:function(e){this.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dprev",{get:function(){return this.Lnext.Sym},set:function(e){this.Lnext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rprev",{get:function(){return this.Sym.Onext},set:function(e){this.Sym.Onext=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Dnext",{get:function(){return this.Sym.Onext.Sym},set:function(e){this.Sym.Onext.Sym=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"Rnext",{get:function(){return this.Sym.Lnext.Sym},set:function(e){this.Sym.Lnext.Sym=e},enumerable:!0,configurable:!0}),i}(),_s=function(){function i(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}return i}(),G0=function(){function i(){var e=new _s,t=new Ca,r=new Zc(0),n=new Zc(1);e.next=e.prev=e,e.anEdge=null,t.next=t.prev=t,r.next=r,r.Sym=n,n.next=n,n.Sym=r,this.vHead=e,this.fHead=t,this.eHead=r,this.eHeadSym=n}return i.prototype.makeEdge_=function(e){var t=new Zc(0),r=new Zc(1);e.Sym.side<e.side&&(e=e.Sym);var n=e.Sym.next;return r.next=n,n.Sym.next=t,t.next=e,e.Sym.next=r,t.Sym=r,t.Onext=t,t.Lnext=r,t.Org=null,t.Lface=null,t.winding=0,t.activeRegion=null,r.Sym=t,r.Onext=r,r.Lnext=t,r.Org=null,r.Lface=null,r.winding=0,r.activeRegion=null,t},i.prototype.splice_=function(e,t){var r=e.Onext,n=t.Onext;r.Sym.Lnext=t,n.Sym.Lnext=e,e.Onext=n,t.Onext=r},i.prototype.makeVertex_=function(e,t,r){var n=e;Ae(n,"Vertex can't be null!");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t;var l=t;do l.Org=n,l=l.Onext;while(l!==t)},i.prototype.makeFace_=function(e,t,r){var n=e;Ae(n,"Face can't be null");var s=r.prev;n.prev=s,s.next=n,n.next=r,r.prev=n,n.anEdge=t,n.trail=null,n.marked=!1,n.inside=r.inside;var l=t;do l.Lface=n,l=l.Lnext;while(l!==t)},i.prototype.killEdge_=function(e){e.Sym.side<e.side&&(e=e.Sym);var t=e.next,r=e.Sym.next;t.Sym.next=r,r.Sym.next=t},i.prototype.killVertex_=function(e,t){var r=e.anEdge,n=r;do n.Org=t,n=n.Onext;while(n!==r);var s=e.prev,l=e.next;l.prev=s,s.next=l},i.prototype.killFace_=function(e,t){var r=e.anEdge,n=r;do n.Lface=t,n=n.Lnext;while(n!==r);var s=e.prev,l=e.next;l.prev=s,s.next=l},i.prototype.makeEdge=function(){var e=new _s,t=new _s,r=new Ca,n=this.makeEdge_(this.eHead);return this.makeVertex_(e,n,this.vHead),this.makeVertex_(t,n.Sym,this.vHead),this.makeFace_(r,n,this.fHead),n},i.prototype.splice=function(e,t){var r=!1,n=!1;if(e!==t){if(t.Org!==e.Org&&(n=!0,this.killVertex_(t.Org,e.Org)),t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(t,e),!n){var s=new _s;this.makeVertex_(s,t,e.Org),e.Org.anEdge=e}if(!r){var l=new Ca;this.makeFace_(l,t,e.Lface),e.Lface.anEdge=e}}},i.prototype.delete=function(e){var t=e.Sym,r=!1;if(e.Lface!==e.Rface&&(r=!0,this.killFace_(e.Lface,e.Rface)),e.Onext===e)this.killVertex_(e.Org,null);else if(e.Rface.anEdge=e.Oprev,e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev),!r){var n=new Ca;this.makeFace_(n,e,e.Lface)}t.Onext===t?(this.killVertex_(t.Org,null),this.killFace_(t.Lface,null)):(e.Lface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev)),this.killEdge_(e)},i.prototype.addEdgeVertex=function(e){var t=this.makeEdge_(e),r=t.Sym;this.splice_(t,e.Lnext),t.Org=e.Dst;var n=new _s;return this.makeVertex_(n,r,t.Org),t.Lface=r.Lface=e.Lface,t},i.prototype.splitEdge=function(e){var t=this.addEdgeVertex(e),r=t.Sym;return this.splice_(e.Sym,e.Sym.Oprev),this.splice_(e.Sym,r),e.Dst=r.Org,r.Dst.anEdge=r.Sym,r.Rface=e.Rface,r.winding=e.winding,r.Sym.winding=e.Sym.winding,r.idx=e.idx,r.Sym.idx=e.Sym.idx,r},i.prototype.connect=function(e,t){var r=!1,n=this.makeEdge_(e),s=n.Sym;if(t.Lface!==e.Lface&&(r=!0,this.killFace_(t.Lface,e.Lface)),this.splice_(n,e.Lnext),this.splice_(s,t),n.Org=e.Dst,s.Org=t.Org,n.Lface=s.Lface=e.Lface,e.Lface.anEdge=s,!r){var l=new Ca;this.makeFace_(l,n,e.Lface)}return n},i.prototype.zapFace=function(e){var t=e.anEdge,r,n,s,l,c;n=t.Lnext;do r=n,n=r.Lnext,r.Lface=null,r.Rface===null&&(r.Onext===r?this.killVertex_(r.Org,null):(r.Org.anEdge=r.Onext,this.splice_(r,r.Oprev)),s=r.Sym,s.Onext===s?this.killVertex_(s.Org,null):(s.Org.anEdge=s.Onext,this.splice_(s,s.Oprev)),this.killEdge_(r));while(r!=t);l=e.prev,c=e.next,c.prev=l,l.next=c},i.prototype.countFaceVerts_=function(e){var t=e.anEdge,r=0;do r++,t=t.Lnext;while(t!==e.anEdge);return r},i.prototype.mergeConvexFaces=function(e){var t,r,n,s,l,c,f;for(t=this.fHead.next;t!==this.fHead;t=t.next)if(!!t.inside)for(r=t.anEdge,l=r.Org;n=r.Lnext,s=r.Sym,s&&s.Lface&&s.Lface.inside&&(c=this.countFaceVerts_(t),f=this.countFaceVerts_(s.Lface),c+f-2<=e&&Te.vertCCW(r.Lprev.Org,r.Org,s.Lnext.Lnext.Org)&&Te.vertCCW(s.Lprev.Org,s.Org,r.Lnext.Lnext.Org)&&(n=s.Lnext,this.delete(s),r=null,s=null)),!(r&&r.Lnext.Org===l);)r=n;return!0},i.prototype.check=function(){var e=this.fHead,t=this.vHead,r=this.eHead,n,s,l,c,f,h;for(s=e,s=e;(n=s.next)!==e;s=n){Ae(n.prev===s),f=n.anEdge;do Ae(f.Sym!==f),Ae(f.Sym.Sym===f),Ae(f.Lnext.Onext.Sym===f),Ae(f.Onext.Sym.Lnext===f),Ae(f.Lface===n),f=f.Lnext;while(f!==n.anEdge)}for(Ae(n.prev===s&&n.anEdge===null),c=t,c=t;(l=c.next)!==t;c=l){Ae(l.prev===c),f=l.anEdge;do Ae(f.Sym!==f),Ae(f.Sym.Sym===f),Ae(f.Lnext.Onext.Sym===f),Ae(f.Onext.Sym.Lnext===f),Ae(f.Org===l),f=f.Onext;while(f!==l.anEdge)}for(Ae(l.prev===c&&l.anEdge===null),h=r,h=r;(f=h.next)!==r;h=f)Ae(f.Sym.next===h.Sym),Ae(f.Sym!==f),Ae(f.Sym.Sym===f),Ae(f.Org!==null),Ae(f.Dst!==null),Ae(f.Lnext.Onext.Sym===f),Ae(f.Onext.Sym.Lnext===f);Ae(f.Sym.next===h.Sym&&f.Sym===this.eHeadSym&&f.Sym.Sym===f&&f.Org===null&&f.Dst===null&&f.Lface===null&&f.Rface===null)},i}(),j0=function(){function i(){this.handle=null}return i}(),E0=function(){function i(){this.key=null,this.node=0}return i}(),L2=function(){function i(e,t){this.leq=t,this.max=0,this.nodes=[],this.handles=[],this.initialized=!1,this.freeList=0,this.size=0,this.max=e,this.nodes=[],this.handles=[];for(var r=0;r<e+1;r++)this.nodes[r]=new j0,this.handles[r]=new E0;this.initialized=!1,this.nodes[1].handle=1,this.handles[1].key=null}return i.prototype.floatDown_=function(e){var t=this.nodes,r=this.handles,n,s,l;for(n=t[e].handle;;){if(l=e<<1,l<this.size&&this.leq(r[t[l+1].handle].key,r[t[l].handle].key)&&++l,Ae(l<=this.max),s=t[l].handle,l>this.size||this.leq(r[n].key,r[s].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=l}},i.prototype.floatUp_=function(e){var t=this.nodes,r=this.handles,n,s,l;for(n=t[e].handle;;){if(l=e>>1,s=t[l].handle,l===0||this.leq(r[s].key,r[n].key)){t[e].handle=n,r[n].node=e;break}t[e].handle=s,r[s].node=e,e=l}},i.prototype.init=function(){for(var e=this.size;e>=1;--e)this.floatDown_(e);this.initialized=!0},i.prototype.min=function(){return this.handles[this.nodes[1].handle].key},i.prototype.insert=function(e){var t,r;if(t=++this.size,t*2>this.max){this.max*=2;var n,s;for(s=this.nodes.length,this.nodes.length=this.max+1,n=s;n<this.nodes.length;n++)this.nodes[n]=new j0;for(s=this.handles.length,this.handles.length=this.max+1,n=s;n<this.handles.length;n++)this.handles[n]=new E0}return this.freeList===0?r=t:(r=this.freeList,this.freeList=this.handles[r].node),this.nodes[t].handle=r,this.handles[r].node=t,this.handles[r].key=e,this.initialized&&this.floatUp_(t),r},i.prototype.extractMin=function(){var e=this.nodes,t=this.handles,r=e[1].handle,n=t[r].key;return this.size>0&&(e[1].handle=e[this.size].handle,t[e[1].handle].node=1,t[r].key=null,t[r].node=this.freeList,this.freeList=r,--this.size,this.size>0&&this.floatDown_(1)),n},i.prototype.delete=function(e){var t=this.nodes,r=this.handles,n;Ae(e>=1&&e<=this.max&&r[e].key!==null),n=r[e].node,t[n].handle=t[this.size].handle,r[t[n].handle].node=n,--this.size,n<=this.size&&(n<=1||this.leq(r[t[n>>1].handle].key,r[t[n].handle].key)?this.floatDown_(n):this.floatUp_(n)),r[e].key=null,r[e].node=this.freeList,this.freeList=e},i}(),Hh=function(){function i(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}return i}(),R0=function(){function i(){this.key=null,this.next=null,this.prev=null}return i}(),_2=function(){function i(e,t){this.frame=e,this.leq=t,this.head=new R0,this.head.next=this.head,this.head.prev=this.head}return i.prototype.min=function(){return this.head.next},i.prototype.max=function(){return this.head.prev},i.prototype.insert=function(e){return this.insertBefore(this.head,e)},i.prototype.search=function(e){var t=this.head;do t=t.next;while(t.key!==null&&!this.leq(this.frame,e,t.key));return t},i.prototype.insertBefore=function(e,t){do e=e.prev;while(e.key!==null&&!this.leq(this.frame,e.key,t));var r=new R0;return r.key=t,r.next=e.next,e.next.prev=r,r.prev=e,e.next=r,r},i.prototype.delete=function(e){e.next.prev=e.prev,e.prev.next=e.next},i}(),T2=function(){function i(){}return i.regionBelow=function(e){return e.nodeUp.prev.key},i.regionAbove=function(e){return e.nodeUp.next.key},i.debugEvent=function(e){},i.addWinding=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.edgeLeq=function(e,t,r){var n=e.event,s=t.eUp,l=r.eUp;if(s.Dst===n)return l.Dst===n?Te.vertLeq(s.Org,l.Org)?Te.edgeSign(l.Dst,s.Org,l.Org)<=0:Te.edgeSign(s.Dst,l.Org,s.Org)>=0:Te.edgeSign(l.Dst,n,l.Org)<=0;if(l.Dst===n)return Te.edgeSign(s.Dst,n,s.Org)>=0;var c=Te.edgeEval(s.Dst,n,s.Org),f=Te.edgeEval(l.Dst,n,l.Org);return c>=f},i.deleteRegion=function(e,t){t.fixUpperEdge&&Ae(t.eUp.winding===0),t.eUp.activeRegion=null,e.dict.delete(t.nodeUp)},i.fixUpperEdge=function(e,t,r){Ae(t.fixUpperEdge),e.mesh.delete(t.eUp),t.fixUpperEdge=!1,t.eUp=r,r.activeRegion=t},i.topLeftRegion=function(e,t){var r=t.eUp.Org,n;do t=i.regionAbove(t);while(t.eUp.Org===r);if(t.fixUpperEdge){if(n=e.mesh.connect(i.regionBelow(t).eUp.Sym,t.eUp.Lnext),n===null)return null;i.fixUpperEdge(e,t,n),t=i.regionAbove(t)}return t},i.topRightRegion=function(e){var t=e.eUp.Dst;do e=i.regionAbove(e);while(e.eUp.Dst===t);return e},i.addRegionBelow=function(e,t,r){var n=new Hh;return n.eUp=r,n.nodeUp=e.dict.insertBefore(t.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,r.activeRegion=n,n},i.isWindingInside=function(e,t){switch(e.windingRule){case Pt.ODD:return(t&1)!=0;case Pt.NONZERO:return t!==0;case Pt.POSITIVE:return t>0;case Pt.NEGATIVE:return t<0;case Pt.ABS_GEQ_TWO:return t>=2||t<=-2}throw new Error("Invalid winding rulle")},i.computeWinding=function(e,t){t.windingNumber=i.regionAbove(t).windingNumber+t.eUp.winding,t.inside=i.isWindingInside(e,t.windingNumber)},i.finishRegion=function(e,t){var r=t.eUp,n=r.Lface;n.inside=t.inside,n.anEdge=r,i.deleteRegion(e,t)},i.finishLeftRegions=function(e,t,r){for(var n,s=null,l=t,c=t.eUp;l!==r;){if(l.fixUpperEdge=!1,s=i.regionBelow(l),n=s.eUp,n.Org!=c.Org){if(!s.fixUpperEdge){i.finishRegion(e,l);break}n=e.mesh.connect(c.Lprev,n.Sym),i.fixUpperEdge(e,s,n)}c.Onext!==n&&(e.mesh.splice(n.Oprev,n),e.mesh.splice(c,n)),i.finishRegion(e,l),c=s.eUp,l=s}return c},i.addRightEdges=function(e,t,r,n,s,l){var c,f,h,p,y=!0;h=r;do Ae(Te.vertLeq(h.Org,h.Dst)),i.addRegionBelow(e,t,h.Sym),h=h.Onext;while(h!==n);for(s===null&&(s=i.regionBelow(t).eUp.Rprev),f=t,p=s;c=i.regionBelow(f),h=c.eUp.Sym,h.Org===p.Org;)h.Onext!==p&&(e.mesh.splice(h.Oprev,h),e.mesh.splice(p.Oprev,h)),c.windingNumber=f.windingNumber-h.winding,c.inside=i.isWindingInside(e,c.windingNumber),f.dirty=!0,!y&&i.checkForRightSplice(e,f)&&(i.addWinding(h,p),i.deleteRegion(e,f),e.mesh.delete(p)),y=!1,f=c,p=h;f.dirty=!0,Ae(f.windingNumber-h.winding===c.windingNumber),l&&i.walkDirtyRegions(e,f)},i.spliceMergeVertices=function(e,t,r){e.mesh.splice(t,r)},i.vertexWeights=function(e,t,r){var n=Te.vertL1dist(t,e),s=Te.vertL1dist(r,e),l=.5*s/(n+s),c=.5*n/(n+s);e.coords[0]+=l*t.coords[0]+c*r.coords[0],e.coords[1]+=l*t.coords[1]+c*r.coords[1],e.coords[2]+=l*t.coords[2]+c*r.coords[2]},i.getIntersectData=function(e,t,r,n,s,l){t.coords[0]=t.coords[1]=t.coords[2]=0,t.idx=-1,i.vertexWeights(t,r,n),i.vertexWeights(t,s,l)},i.checkForRightSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp;if(Te.vertLeq(n.Org,s.Org)){if(Te.edgeSign(s.Dst,n.Org,s.Org)>0)return!1;Te.vertEq(n.Org,s.Org)?n.Org!==s.Org&&(e.pq.delete(n.Org.pqHandle),i.spliceMergeVertices(e,s.Oprev,n)):(e.mesh.splitEdge(s.Sym),e.mesh.splice(n,s.Oprev),t.dirty=r.dirty=!0)}else{if(Te.edgeSign(n.Dst,s.Org,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Oprev,n)}return!0},i.checkForLeftSplice=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,l;if(Ae(!Te.vertEq(n.Dst,s.Dst)),Te.vertLeq(n.Dst,s.Dst)){if(Te.edgeSign(n.Dst,s.Dst,n.Org)<0)return!1;i.regionAbove(t).dirty=t.dirty=!0,l=e.mesh.splitEdge(n),e.mesh.splice(s.Sym,l),l.Lface.inside=t.inside}else{if(Te.edgeSign(s.Dst,n.Dst,s.Org)>0)return!1;t.dirty=r.dirty=!0,l=e.mesh.splitEdge(s),e.mesh.splice(n.Lnext,s.Sym),l.Rface.inside=t.inside}return!0},i.checkForIntersect=function(e,t){var r=i.regionBelow(t),n=t.eUp,s=r.eUp,l=n.Org,c=s.Org,f=n.Dst,h=s.Dst,p,y,g=new _s,w,S;if(Ae(!Te.vertEq(h,f)),Ae(Te.edgeSign(f,e.event,l)<=0),Ae(Te.edgeSign(h,e.event,c)>=0),Ae(l!==e.event&&c!==e.event),Ae(!t.fixUpperEdge&&!r.fixUpperEdge),l===c||(p=Math.min(l.t,f.t),y=Math.max(c.t,h.t),p>y))return!1;if(Te.vertLeq(l,c)){if(Te.edgeSign(h,l,c)>0)return!1}else if(Te.edgeSign(f,c,l)<0)return!1;return i.debugEvent(e),Te.intersect(f,l,h,c,g),Ae(Math.min(l.t,f.t)<=g.t),Ae(g.t<=Math.max(c.t,h.t)),Ae(Math.min(h.s,f.s)<=g.s),Ae(g.s<=Math.max(c.s,l.s)),Te.vertLeq(g,e.event)&&(g.s=e.event.s,g.t=e.event.t),w=Te.vertLeq(l,c)?l:c,Te.vertLeq(w,g)&&(g.s=w.s,g.t=w.t),Te.vertEq(g,l)||Te.vertEq(g,c)?(i.checkForRightSplice(e,t),!1):!Te.vertEq(f,e.event)&&Te.edgeSign(f,e.event,g)>=0||!Te.vertEq(h,e.event)&&Te.edgeSign(h,e.event,g)<=0?h===e.event?(e.mesh.splitEdge(n.Sym),e.mesh.splice(s.Sym,n),t=i.topLeftRegion(e,t),n=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),r),i.addRightEdges(e,t,n.Oprev,n,n,!0),!0):f===e.event?(e.mesh.splitEdge(s.Sym),e.mesh.splice(n.Lnext,s.Oprev),r=t,t=i.topRightRegion(t),S=i.regionBelow(t).eUp.Rprev,r.eUp=s.Oprev,s=i.finishLeftRegions(e,r,null),i.addRightEdges(e,t,s.Onext,n.Rprev,S,!0),!0):(Te.edgeSign(f,e.event,g)>=0&&(i.regionAbove(t).dirty=t.dirty=!0,e.mesh.splitEdge(n.Sym),n.Org.s=e.event.s,n.Org.t=e.event.t),Te.edgeSign(h,e.event,g)<=0&&(t.dirty=r.dirty=!0,e.mesh.splitEdge(s.Sym),s.Org.s=e.event.s,s.Org.t=e.event.t),!1):(e.mesh.splitEdge(n.Sym),e.mesh.splitEdge(s.Sym),e.mesh.splice(s.Oprev,n),n.Org.s=g.s,n.Org.t=g.t,n.Org.pqHandle=e.pq.insert(n.Org),i.getIntersectData(e,n.Org,l,f,c,h),i.regionAbove(t).dirty=t.dirty=r.dirty=!0,!1)},i.walkDirtyRegions=function(e,t){for(var r=i.regionBelow(t),n,s;;){for(;r.dirty;)t=r,r=i.regionBelow(r);if(!t.dirty&&(r=t,t=i.regionAbove(t),t===null||!t.dirty))return;if(t.dirty=!1,n=t.eUp,s=r.eUp,n.Dst!==s.Dst&&i.checkForLeftSplice(e,t)&&(r.fixUpperEdge?(i.deleteRegion(e,r),e.mesh.delete(s),r=i.regionBelow(t),s=r.eUp):t.fixUpperEdge&&(i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r),n=t.eUp)),n.Org!==s.Org)if(n.Dst!==s.Dst&&!t.fixUpperEdge&&!r.fixUpperEdge&&(n.Dst===e.event||s.Dst===e.event)){if(i.checkForIntersect(e,t))return}else i.checkForRightSplice(e,t);n.Org===s.Org&&n.Dst===s.Dst&&(i.addWinding(s,n),i.deleteRegion(e,t),e.mesh.delete(n),t=i.regionAbove(r))}},i.connectRightVertex=function(e,t,r){var n,s=r.Onext,l=i.regionBelow(t),c=t.eUp,f=l.eUp,h=!1;if(c.Dst!==f.Dst&&i.checkForIntersect(e,t),Te.vertEq(c.Org,e.event)&&(e.mesh.splice(s.Oprev,c),t=i.topLeftRegion(e,t),s=i.regionBelow(t).eUp,i.finishLeftRegions(e,i.regionBelow(t),l),h=!0),Te.vertEq(f.Org,e.event)&&(e.mesh.splice(r,f.Oprev),r=i.finishLeftRegions(e,l,null),h=!0),h){i.addRightEdges(e,t,r.Onext,s,s,!0);return}Te.vertLeq(f.Org,c.Org)?n=f.Oprev:n=c,n=e.mesh.connect(r.Lprev,n),i.addRightEdges(e,t,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,i.walkDirtyRegions(e,t)},i.connectLeftDegenerate=function(e,t,r){var n,s,l,c,f;if(n=t.eUp,Te.vertEq(n.Org,r)){Ae(!1),i.spliceMergeVertices(e,n,r.anEdge);return}if(!Te.vertEq(n.Dst,r)){e.mesh.splitEdge(n.Sym),t.fixUpperEdge&&(e.mesh.delete(n.Onext),t.fixUpperEdge=!1),e.mesh.splice(r.anEdge,n),i.sweepEvent(e,r);return}Ae(!1),t=i.topRightRegion(t),f=i.regionBelow(t),l=f.eUp.Sym,s=c=l.Onext,f.fixUpperEdge&&(Ae(s!==l),i.deleteRegion(e,f),e.mesh.delete(l),l=s.Oprev),e.mesh.splice(r.anEdge,l),Te.edgeGoesLeft(s)||(s=null),i.addRightEdges(e,t,l.Onext,c,s,!0)},i.connectLeftVertex=function(e,t){var r,n,s,l,c,f,h=new Hh;if(h.eUp=t.anEdge.Sym,r=e.dict.search(h).key,n=i.regionBelow(r),!!n){if(l=r.eUp,c=n.eUp,Te.edgeSign(l.Dst,t,l.Org)===0){i.connectLeftDegenerate(e,r,t);return}if(s=Te.vertLeq(c.Dst,l.Dst)?r:n,r.inside||s.fixUpperEdge){if(s===r)f=e.mesh.connect(t.anEdge.Sym,l.Lnext);else{var p=e.mesh.connect(c.Dnext,t.anEdge);f=p.Sym}s.fixUpperEdge?i.fixUpperEdge(e,s,f):i.computeWinding(e,i.addRegionBelow(e,r,f)),i.sweepEvent(e,t)}else i.addRightEdges(e,r,t.anEdge,t.anEdge,null,!0)}},i.sweepEvent=function(e,t){e.event=t,i.debugEvent(e);for(var r=t.anEdge;r.activeRegion===null;)if(r=r.Onext,r===t.anEdge){i.connectLeftVertex(e,t);return}var n=i.topLeftRegion(e,r.activeRegion);Ae(n!==null);var s=i.regionBelow(n),l=s.eUp,c=i.finishLeftRegions(e,s,null);c.Onext===l?i.connectRightVertex(e,n,c):i.addRightEdges(e,n,c.Onext,l,l,!0)},i.addSentinel=function(e,t,r,n){var s=new Hh,l=e.mesh.makeEdge();l.Org.s=r,l.Org.t=n,l.Dst.s=t,l.Dst.t=n,e.event=l.Dst,s.eUp=l,s.windingNumber=0,s.inside=!1,s.fixUpperEdge=!1,s.sentinel=!0,s.dirty=!1,s.nodeUp=e.dict.insert(s)},i.initEdgeDict=function(e){e.dict=new _2(e,i.edgeLeq);var t=e.bmax[0]-e.bmin[0],r=e.bmax[1]-e.bmin[1],n=e.bmin[0]-t,s=e.bmax[0]+t,l=e.bmin[1]-r,c=e.bmax[1]+r;i.addSentinel(e,n,s,l),i.addSentinel(e,n,s,c)},i.doneEdgeDict=function(e){for(var t,r=0;(t=e.dict.min().key)!==null;)t.sentinel||(Ae(t.fixUpperEdge),Ae(++r==1)),Ae(t.windingNumber===0),i.deleteRegion(e,t)},i.removeDegenerateEdges=function(e){var t,r,n,s=e.mesh.eHead;for(t=s.next;t!==s;t=r)r=t.next,n=t.Lnext,Te.vertEq(t.Org,t.Dst)&&t.Lnext.Lnext!==t&&(i.spliceMergeVertices(e,n,t),e.mesh.delete(t),t=n,n=t.Lnext),n.Lnext===t&&(n!==t&&((n===r||n===r.Sym)&&(r=r.next),e.mesh.delete(n)),(t===r||t===r.Sym)&&(r=r.next),e.mesh.delete(t))},i.initPriorityQ=function(e){var t,r,n,s=0;for(n=e.mesh.vHead,r=n.next;r!==n;r=r.next)s++;for(s+=8,t=e.pq=new L2(s,Te.vertLeq),n=e.mesh.vHead,r=n.next;r!==n;r=r.next)r.pqHandle=t.insert(r);return r!==n?!1:(t.init(),!0)},i.donePriorityQ=function(e){e.pq=null},i.removeDegenerateFaces=function(e,t){var r,n,s;for(r=t.fHead.next;r!==t.fHead;r=n)n=r.next,s=r.anEdge,Ae(s.Lnext!==s),s.Lnext.Lnext===s&&(i.addWinding(s.Onext,s),e.mesh.delete(s));return!0},i.computeInterior=function(e,t){t===void 0&&(t=!0);var r,n;if(i.removeDegenerateEdges(e),!i.initPriorityQ(e))return!1;for(i.initEdgeDict(e);(r=e.pq.extractMin())!==null;){for(;n=e.pq.min(),!(n===null||!Te.vertEq(n,r));)n=e.pq.extractMin(),i.spliceMergeVertices(e,r.anEdge,n.anEdge);i.sweepEvent(e,r)}return e.event=e.dict.min().key.eUp.Org,i.debugEvent(e),i.doneEdgeDict(e),i.donePriorityQ(e),i.removeDegenerateFaces(e,e.mesh)?(t&&e.mesh.check(),!0):!1},i}(),I2=function(){function i(){this.mesh=new G0,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Pt.ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}return i.prototype.dot_=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},i.prototype.normalize_=function(e){var t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2];if(!t)throw"Zero-size vector!";t=Math.sqrt(t),e[0]/=t,e[1]/=t,e[2]/=t},i.prototype.longAxis_=function(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t},i.prototype.computeNormal_=function(e){var t,r,n,s,l,c,f=[0,0,0],h=[0,0,0],p=[0,0,0],y=[0,0,0],g=[0,0,0],w=[null,null,null],S=[null,null,null],T=this.mesh.vHead;t=T.next;for(var C=0;C<3;++C)s=t.coords[C],h[C]=s,S[C]=t,f[C]=s,w[C]=t;for(t=T.next;t!==T;t=t.next)for(var B=0;B<3;++B)s=t.coords[B],s<h[B]&&(h[B]=s,S[B]=t),s>f[B]&&(f[B]=s,w[B]=t);var G=0;if(f[1]-h[1]>f[0]-h[0]&&(G=1),f[2]-h[2]>f[G]-h[G]&&(G=2),h[G]>=f[G]){e[0]=0,e[1]=0,e[2]=1;return}for(c=0,r=S[G],n=w[G],p[0]=r.coords[0]-n.coords[0],p[1]=r.coords[1]-n.coords[1],p[2]=r.coords[2]-n.coords[2],t=T.next;t!==T;t=t.next)y[0]=t.coords[0]-n.coords[0],y[1]=t.coords[1]-n.coords[1],y[2]=t.coords[2]-n.coords[2],g[0]=p[1]*y[2]-p[2]*y[1],g[1]=p[2]*y[0]-p[0]*y[2],g[2]=p[0]*y[1]-p[1]*y[0],l=g[0]*g[0]+g[1]*g[1]+g[2]*g[2],l>c&&(c=l,e[0]=g[0],e[1]=g[1],e[2]=g[2]);c<=0&&(e[0]=e[1]=e[2]=0,e[this.longAxis_(p)]=1)},i.prototype.checkOrientation_=function(){for(var e=this.mesh.fHead,t,r=this.mesh.vHead,n,s=0,l=e.next;l!==e;l=l.next)if(n=l.anEdge,!(n.winding<=0))do s+=(n.Org.s-n.Dst.s)*(n.Org.t+n.Dst.t),n=n.Lnext;while(n!==l.anEdge);if(s<0){for(t=r.next;t!==r;t=t.next)t.t=-t.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},i.prototype.projectPolygon_=function(){var e=this.mesh.vHead,t=[0,0,0],r,n,s=!1;t[0]=this.normal[0],t[1]=this.normal[1],t[2]=this.normal[2],!t[0]&&!t[1]&&!t[2]&&(this.computeNormal_(t),s=!0),r=this.sUnit,n=this.tUnit;var l=this.longAxis_(t);r[l]=0,r[(l+1)%3]=1,r[(l+2)%3]=0,n[l]=0,n[(l+1)%3]=0,n[(l+2)%3]=t[l]>0?1:-1;for(var c=e.next;c!==e;c=c.next)c.s=this.dot_(c.coords,r),c.t=this.dot_(c.coords,n);s&&this.checkOrientation_();for(var f=!0,h=e.next;h!==e;h=h.next)f?(this.bmin[0]=this.bmax[0]=h.s,this.bmin[1]=this.bmax[1]=h.t,f=!1):(h.s<this.bmin[0]&&(this.bmin[0]=h.s),h.s>this.bmax[0]&&(this.bmax[0]=h.s),h.t<this.bmin[1]&&(this.bmin[1]=h.t),h.t>this.bmax[1]&&(this.bmax[1]=h.t))},i.prototype.addWinding_=function(e,t){e.winding+=t.winding,e.Sym.winding+=t.Sym.winding},i.prototype.tessellateMonoRegion_=function(e,t){var r,n;if(r=t.anEdge,!(r.Lnext!==r&&r.Lnext.Lnext!==r))throw"Mono region invalid";for(;Te.vertLeq(r.Dst,r.Org);r=r.Lprev);for(;Te.vertLeq(r.Org,r.Dst);r=r.Lnext);n=r.Lprev;for(var s=void 0;r.Lnext!==n;)if(Te.vertLeq(r.Dst,n.Org)){for(;n.Lnext!==r&&(Te.edgeGoesLeft(n.Lnext)||Te.edgeSign(n.Org,n.Dst,n.Lnext.Dst)<=0);)s=e.connect(n.Lnext,n),n=s.Sym;n=n.Lprev}else{for(;n.Lnext!==r&&(Te.edgeGoesRight(r.Lprev)||Te.edgeSign(r.Dst,r.Org,r.Lprev.Org)>=0);)s=e.connect(r,r.Lprev),r=s.Sym;r=r.Lnext}if(n.Lnext===r)throw"Mono region invalid";for(;n.Lnext.Lnext!==r;)s=e.connect(n.Lnext,n),n=s.Sym;return!0},i.prototype.tessellateInterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)if(t=r.next,r.inside&&!this.tessellateMonoRegion_(e,r))return!1;return!0},i.prototype.discardExterior_=function(e){for(var t,r=e.fHead.next;r!==e.fHead;r=t)t=r.next,r.inside||e.zapFace(r)},i.prototype.setWindingNumber_=function(e,t,r){for(var n,s=e.eHead.next;s!==e.eHead;s=n)n=s.next,s.Rface.inside!==s.Lface.inside?s.winding=s.Lface.inside?t:-t:r?e.delete(s):s.winding=0},i.prototype.getNeighbourFace_=function(e){return!e.Rface||!e.Rface.inside?-1:e.Rface.n},i.prototype.outputPolymesh_=function(e,t,r,n){var s,l=0,c=0,f;r>3&&e.mergeConvexFaces(r);for(var h=e.vHead.next;h!==e.vHead;h=h.next)h.n=-1;for(var p=e.fHead.next;p!==e.fHead;p=p.next)if(p.n=-1,!!p.inside){s=p.anEdge,f=0;do{var h=s.Org;h.n===-1&&(h.n=c,c++),f++,s=s.Lnext}while(s!==p.anEdge);if(f>r)throw"Face vertex greater that support polygon";p.n=l,++l}this.elementCount=l,t===Qt.CONNECTED_POLYGONS&&(l*=2),this.elements=[],this.elements.length=l*r,this.vertexCount=c,this.vertices=[],this.vertices.length=c*n,this.vertexIndices=[],this.vertexIndices.length=c;for(var h=e.vHead.next;h!==e.vHead;h=h.next)if(h.n!==-1){var y=h.n*n;this.vertices[y+0]=h.coords[0],this.vertices[y+1]=h.coords[1],n>2&&(this.vertices[y+2]=h.coords[2]),this.vertexIndices[h.n]=h.idx}for(var g=0,p=e.fHead.next;p!==e.fHead;p=p.next)if(!!p.inside){s=p.anEdge,f=0;do{var h=s.Org;this.elements[g++]=h.n,f++,s=s.Lnext}while(s!==p.anEdge);for(var w=f;w<r;++w)this.elements[g++]=-1;if(t===Qt.CONNECTED_POLYGONS){s=p.anEdge;do this.elements[g++]=this.getNeighbourFace_(s),s=s.Lnext;while(s!==p.anEdge);for(var S=f;S<r;++S)this.elements[g++]=-1}}},i.prototype.outputContours_=function(e,t){var r,n,s=0,l=0;this.vertexCount=0,this.elementCount=0;for(var c=e.fHead.next;c!==e.fHead;c=c.next)if(!!c.inside){n=r=c.anEdge;do this.vertexCount++,r=r.Lnext;while(r!==n);this.elementCount++}this.elements=[],this.elements.length=this.elementCount*2,this.vertices=[],this.vertices.length=this.vertexCount*t,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;var f=0,h=0,p=0;s=0;for(var c=e.fHead.next;c!==e.fHead;c=c.next)if(!!c.inside){l=0,n=r=c.anEdge;do this.vertices[f++]=r.Org.coords[0],this.vertices[f++]=r.Org.coords[1],t>2&&(this.vertices[f++]=r.Org.coords[2]),this.vertexIndices[h++]=this.vertexIdCallback?this.vertexIdCallback(r):r.Org.idx,l++,r=r.Lnext;while(r!==n);this.elements[p++]=s,this.elements[p++]=l,s+=l}},i.prototype.addContour=function(e,t){this.mesh===null&&(this.mesh=new G0),e<2&&(e=2),e>3&&(e=3);for(var r=null,n=0;n<t.length;n+=e)r===null?(r=this.mesh.makeEdge(),this.mesh.splice(r,r.Sym)):(this.mesh.splitEdge(r),r=r.Lnext),r.Org.coords[0]=t[n+0],r.Org.coords[1]=t[n+1],e>2?r.Org.coords[2]=t[n+2]:r.Org.coords[2]=0,r.Org.idx=this.vertexIndexCounter++,this.edgeCreateCallback&&this.edgeCreateCallback(r),r.winding=1,r.Sym.winding=-1},i.prototype.tesselate=function(e,t,r,n,s,l){if(e===void 0&&(e=Pt.ODD),t===void 0&&(t=Qt.POLYGONS),l===void 0&&(l=!0),this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,s&&(this.normal[0]=s[0],this.normal[1]=s[1],this.normal[2]=s[2]),this.windingRule=e,n<2&&(n=2),n>3&&(n=3),!this.mesh)return!1;this.projectPolygon_(),T2.computeInterior(this,l);var c=this.mesh;return t===Qt.BOUNDARY_CONTOURS?this.setWindingNumber_(c,1,!0):this.tessellateInterior_(c),l&&c.check(),t===Qt.BOUNDARY_CONTOURS?this.outputContours_(c,n):this.outputPolymesh_(c,t,r,n),!0},i}();function No(i){var e=i.windingRule,t=e===void 0?Pt.ODD:e,r=i.elementType,n=r===void 0?Qt.POLYGONS:r,s=i.polySize,l=s===void 0?3:s,c=i.vertexSize,f=c===void 0?2:c,h=i.normal,p=h===void 0?[0,0,1]:h,y=i.contours,g=y===void 0?[]:y,w=i.strict,S=w===void 0?!0:w,T=i.debug,C=T===void 0?!1:T;if(!g&&S)throw new Error("Contours can't be empty");if(!!g){var B=new I2;i.edgeCreateCallback&&(B.edgeCreateCallback=i.edgeCreateCallback),i.vertexIdCallback&&(B.vertexIdCallback=i.vertexIdCallback);for(var G=0;G<g.length;G++)B.addContour(f||2,g[G]);return B.tesselate(t,n,l,f,p,S),{vertices:B.vertices,vertexIndices:B.vertexIndices,vertexCount:B.vertexCount,elements:B.elements,elementCount:B.elementCount,mesh:C?B.mesh:void 0}}}var nH=Pt.ODD,iH=Pt.NONZERO,oH=Pt.POSITIVE,sH=Pt.NEGATIVE,aH=Pt.ABS_GEQ_TWO,lH=Qt.POLYGONS,cH=Qt.CONNECTED_POLYGONS,uH=Qt.BOUNDARY_CONTOURS;var Co=class extends M2{constructor(e,t=12,r=100,n={}){super();this.type="ShapeGeometry";this.windingRule=Pt.ODD;this.elementType=Qt.POLYGONS;this.polySize=3;this.vertexSize=2;this.strict=!0;this._drawCount=0,this._shape=e,this._curveSegments=t,this._maxCount=r,this._maxDrawCount=r*3,this._triangulationOptions=Object.assign({windingRule:Pt.ODD,elementType:Qt.POLYGONS,polySize:3,vertexSize:2,strict:!0},n),this._positionAttribute=new Yc(new Float32Array(r*3),3),this._normalAttribute=new Yc(new Float32Array(r*3),3),this._uvAttribute=new Yc(new Float32Array(r*2),2),this._indexAttribute=new Yc(new Uint32Array(r*3),1),this.setAttribute("position",this._positionAttribute),this.setAttribute("normal",this._normalAttribute),this.setAttribute("uv",this._uvAttribute),this.setIndex(this._indexAttribute),this.updateFromShape()}copy(e){return this._drawCount=e.drawCount,this._maxDrawCount=e._maxDrawCount,this._maxCount=e.maxCount,super.copy(e)}get curveSegments(){return this._curveSegments}set curveSegments(e){this._curveSegments=e,this.updateFromShape()}get drawCount(){return this._drawCount}get maxDrawCount(){return this._maxDrawCount}get maxCount(){return this._maxCount}updateFromShape(){let e=this._shape.extractShapePointsToFlatArray([],this._curveSegments),t=this._shape.shapeHoles.map(f=>f.extractShapePointsToFlatArray([],this._curveSegments)),r,n=!0,s=!0,l,c;for(let f=0,h=e.length/2;f<h;f++){let p=f*2,y=e[p+0],g=e[p+1];if(l!==void 0&&y!==l&&(n=!1),c!==void 0&&g!==c&&(s=!1),l=y,c=g,!n&&!s)break}if(!n&&!s&&(r=No({contours:[e,...t],windingRule:this._triangulationOptions.windingRule,elementType:this._triangulationOptions.elementType,polySize:this._triangulationOptions.polySize,vertexSize:this._triangulationOptions.vertexSize,strict:this._triangulationOptions.strict})),this._positionAttribute.array.fill(0),this._normalAttribute.array.fill(0),this._uvAttribute.array.fill(0),this._indexAttribute.array.fill(0),this._drawCount=0,r){let f=1/0,h=-1/0,p=1/0,y=-1/0;for(let S=0,T=r.vertexCount;S<T;S++){let C=S*2,B=r.vertices[C+0],G=r.vertices[C+1];B<f&&(f=B),B>h&&(h=B),G<p&&(p=G),G>y&&(y=G)}let g=h-f,w=y-p;for(let S=0,T=r.vertexCount;S<T;S++){let C=S*2,B=r.vertices[C+0],G=r.vertices[C+1],D=(B-f)/g,W=(G-p)/w;this._positionAttribute.setXYZ(S,B,G,0),this._normalAttribute.setXYZ(S,0,0,1),this._uvAttribute.setXY(S,D,W)}for(let S=0,T=r.elementCount;S<T;S++){let C=S*3,B=r.elements[C+0],G=r.elements[C+1],D=r.elements[C+2];this._indexAttribute.setX(C+0,B),this._indexAttribute.setX(C+1,G),this._indexAttribute.setX(C+2,D),this._drawCount+=3}}return this._positionAttribute.needsUpdate=!0,this._normalAttribute.needsUpdate=!0,this._uvAttribute.needsUpdate=!0,this._indexAttribute.needsUpdate=!0,this.setDrawRange(0,this._drawCount),this._drawCount>this._maxDrawCount}clone(){let e=new Co(this._shape,this._curveSegments,this._maxCount);return e.userData=yo(this.userData),e}};import{BufferAttribute as tu,BufferGeometry as A2}from"three";var eu=class{constructor(e=256,t=!1){this.capacity=e,this.size=0,this.debug=t,this.debug&&console.log(`allocating with cap ${e}`);let r=e*eu.eSize;this.buffer=new ArrayBuffer(r);let n=Float32Array.BYTES_PER_ELEMENT,s=0;this.positions=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.normals=new Float32Array(this.buffer,s*n,3*e),s+=3*e,this.uvs=new Float32Array(this.buffer,s*n,2*e)}realloc(e,t=!1){if(e<this.size)throw Error("cannot shrink buffer");if(e<=this.capacity&&!t)return;this.debug&&console.log(`resizing from ${this.capacity} \u2192 ${e}`);let r=e*eu.eSize,n=new ArrayBuffer(r),s=Float32Array.BYTES_PER_ELEMENT,l=0,c=new Float32Array(n,l*s,3*e);l+=3*e;let f=new Float32Array(n,l*s,3*e);l+=3*e;let h=new Float32Array(n,l*s,2*e);c.set(this.positions.slice(0,this.size*3)),f.set(this.normals.slice(0,this.size*3)),h.set(this.uvs.slice(0,this.size*2)),this.buffer=n,this.positions=c,this.normals=f,this.uvs=h,this.capacity=e}get(e=1){let t=this.size+e;if(t>this.capacity){let n=this.capacity;for(;t>n;)n*=2;this.realloc(n)}let r=this.size;return this.size=t,r}reserve(e){let t=this.size+e;t>this.capacity&&this.realloc(t)}shrink(){this.debug&&console.log(`shrinking ${this.capacity} \u2192 ${this.size}`),this.realloc(this.size,!0)}},Qc=eu;Qc.eSize=(3+3+2)*Float32Array.BYTES_PER_ELEMENT;var Wh=(i,e)=>([t,r])=>(r<t&&(r+=e),(i>=t?i:i+e)<=r),La=class extends A2{constructor(e,t,r=0,n=12,s=3){super();this.type="ShapeGeometry";this.vertexCache={};this._shape=e,this._depth=t,this._bevel=r,this._curveSegments=n,this._bevelSegmentsInput=s,r<=0?(this._bevelSize=0,this._bevelSegments=0):(this._bevelSize=Math.min(r,t/2-1e-12),this._bevelSegments=Math.floor(s));let l=this._shape.extractShapePointsToFlatArray([],n),c=this._shape.shapeHoles.map(q=>{let E=q.extractShapePointsToFlatArray([],n),b=[];for(let R=E.length-1;R>=1;R-=2){let I=E[R-1],z=E[R-0];b.push(I,z)}return b}),f=No({windingRule:Pt.ODD,elementType:Qt.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[l]}),h=No({windingRule:Pt.ODD,elementType:Qt.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[...c]});if(!f)throw new Error("error generating geometry");let p=f.elementCount;if(h){f.elementCount+=h.elementCount;for(let q=0;q<h.elements.length;q++){let E=h.elements[q],b=q%2==0?f.vertexCount:0;f.elements.push(E+b)}for(let q=0;q<h.vertexIndices.length;q++){let E=h.vertexIndices[q],b=f.vertexCount;f.vertexIndices.push(E+b)}for(let q=0;q<h.vertices.length;q++){let E=h.vertices[q];f.vertices.push(E)}}let y=1/0,g=-1/0,w=1/0,S=-1/0;for(let q=0,E=f.vertexCount;q<E;q++){let b=q*2,R=f.vertices[b+0],I=f.vertices[b+1];R<y&&(y=R),R>g&&(g=R),I<w&&(w=I),I>S&&(S=I)}this._minX=y,this._minY=w,this._width=g-y,this._height=S-w;let T=f.vertexCount*2*(2+this._bevelSegments);this._buffer=new Qc(T);let C=[],B=[];for(let q=f.elementCount-1;q>=0;q--){let E=q>=p,b=q*2,R=f.elements[b+0],I=f.elements[b+1],z=R+I,O={start:R,count:I,normals:[],continuous:[],concave:[]},$=R,he=z-1,re=R+1,Ne=this._shape.roundedCurves.length;do{let k=$-R,H=f.vertices[he*2+0],_=f.vertices[he*2+1],J=f.vertices[$*2+0],ee=f.vertices[$*2+1],oe=f.vertices[re*2+0],se=f.vertices[re*2+1],ce=J-H,ue=ee-_,K=Math.sqrt(ce*ce+ue*ue);ce/=K,ue/=K;let ae=J-oe,ne=ee-se,Ce=Math.sqrt(ae*ae+ne*ne);ae/=Ce,ne/=Ce,O.normals[k*2+0]=-ne,O.normals[k*2+1]=ae,O.concave[k]=ce*ne-ue*ae>0;let Y=f.vertexIndices[$];if(Array.isArray(Y))O.continuous[k]=!1;else{let[le,de]=this._shape.getCurveIndexFromVertexId(Y-1,!0);if(de>0&&de<1)O.continuous[k]=!0;else{let xe=de===1?le+1:le-1;xe=(xe+Ne)%Ne;let _e=de===1?0:1,pe=this._shape.roundedCurves[le].getTangent(de),we=this._shape.roundedCurves[xe].getTangent(_e);O.continuous[k]=pe.dot(we)>.95}}E&&(O.normals[k*2+0]*=-1,O.normals[k*2+1]*=-1),[he,$,re]=[$,re,re+1],re>=z&&(re-=I)}while(re!==R+1);let ye=[];ye.push({bevelI:0,angle:0,size:0,boundary:{vertices:f.vertices.slice(R*2,z*2),vertexCount:I,vertexIndices:new Array(I).fill(!0).map((k,H)=>[H,H]),elements:[0,I],elementCount:1,mesh:null},reverseMap:[],insetPoints:f.vertices.slice(R*2,z*2)});for(let k=1;k<=this._bevelSegments;k++){let H=k/this._bevelSegments*Math.PI/2,_=(1-Math.cos(H))*this._bevelSize,J=[],ee=[],oe=[],se=[],ce=0;for(let K=0;K<I;K++){let ae=K*2,ne=(K-1+I)%I*2,Ce=f.vertices[O.start*2+ae+0],Y=f.vertices[O.start*2+ae+1],le=-O.normals[ne+0]*_,de=-O.normals[ne+1]*_,xe=-O.normals[ae+0]*_,_e=-O.normals[ae+1]*_;if(O.concave[K]||!O.concave[K]&&E){let pe=Math.atan2(de,le),we=Math.atan2(_e,xe);we>pe&&(we-=Math.PI*2);let Ve=we-pe;if(O.continuous[K]||E){let Ge=pe+Ve/2,Qe=Math.cos(Ge)*_,bt=Math.sin(Ge)*_;J[2*ce+0]=Ce+Qe*(E?-1:1),J[2*ce+1]=Y+bt*(E?-1:1),se[ce]=K,ce++}else{let Ge=Math.max(1,Math.floor(n/4*Math.abs(Ve)/Math.PI));for(let Qe=0;Qe<=Ge;Qe++){let bt=pe+Ve*(Qe/Ge),Lt=Math.cos(bt)*_,At=Math.sin(bt)*_;J[2*ce+0]=Ce+Lt,J[2*ce+1]=Y+At,se[ce]=K,ce++}}}else J[2*ce+0]=Ce+le,J[2*ce+1]=Y+de,se[ce]=K,ee[K]=ce,ce++,J[2*ce+0]=Ce,J[2*ce+1]=Y,se[ce]=K,ce++,J[2*ce+0]=Ce+xe,J[2*ce+1]=Y+_e,se[ce]=K,oe[K]=ce,ce++}let ue=No({windingRule:Pt.POSITIVE,elementType:Qt.BOUNDARY_CONTOURS,vertexSize:2,strict:!0,contours:[J],edgeCreateCallback:K=>{let ne=K.Org.idx,Ce=se[ne],Y=se[(ne+1)%se.length];K.idx=[Ce,Y],K.Sym.idx=[Y,Ce]},vertexIdCallback:K=>{let ae=K.Lprev.idx;return[ae?ae[1]:0,K.idx[0]]}});if(!ue)throw console.log("Error"),new Error(`error generating bevel geometry for ${k}'th loop`);if(!ue.vertexCount)break;for(let K=0;K<ue.vertexIndices.length;K++){let[ae,ne]=ue.vertexIndices[K];if(ae===ne)continue;let Ce=ne;ne<ae&&(Ce+=I);for(let Y=ae;Y<Ce;Y++){let le=Y%I,de=(Y+1)%I;if(!O.continuous[le]||!O.continuous[de]){ue.vertexIndices[K]=[ae,le],ue.vertexIndices.splice(K+1,0,[de,ne]),ue.vertices.splice((K+1)*2,0,ue.vertices[K*2],ue.vertices[K*2+1]);break}}}ye.push({bevelI:k,angle:H,size:_,boundary:ue,reverseMap:se,insetPoints:J})}let Me=(k,H,_)=>{let J=0,ee=k.boundary.vertexIndices.length;for(;J<ee&&_(k.boundary.vertexIndices[H]);)H=(H+1)%ee,J++;return J},Fe=C.length;for(let k=1;k<ye.length;k++){let H=ye[k-1],_=ye[k],J=H.boundary.vertexIndices.length,ee=_.boundary.vertexIndices.length;if(!J||!ee)break;let oe=O.concave.length,se=0,ce=Wh(se,I);for(;!H.boundary.vertexIndices.filter(ce).length||!_.boundary.vertexIndices.filter(ce).length;)se++,ce=Wh(se,I);let ue=H.boundary.vertexIndices.findIndex(ce),K=_.boundary.vertexIndices.findIndex(ce);do ue=(ue+1)%J;while(ce(H.boundary.vertexIndices[ue]));do K=(K+1)%ee;while(ce(_.boundary.vertexIndices[K]));se=(se+1)%I;let ae=se,ne=this.buildBevelVert(O,H,(ue-1+J)%J),Ce=this.buildBevelVert(O,_,(K-1+ee)%ee),Y=ne,le=Ce,de,xe,_e=!1;do{ce=Wh(se,I);let pe=Me(H,ue,ce),we=Me(_,K,ce),Ve=_e;if(_e=!1,pe&&!we){for(let Ge=0;Ge<pe;Ge++)de=this.buildBevelVert(O,H,(ue+Ge)%J,Ge/(pe-1)),C.push(Y.topN,de.topP,le.topN),C.push(de.bottomP,Y.bottomN,le.bottomN),Y=de;_e=!0}else if(!pe&&we)for(let Ge=0;Ge<we;Ge++)xe=this.buildBevelVert(O,_,(K+Ge)%ee,Ge/(we-1)),C.push(le.topN,Y.topP,xe.topP),C.push(Y.bottomP,le.bottomN,xe.bottomP),le=xe;else if(pe&&we)if(de=this.buildBevelVert(O,H,ue,0),xe=this.buildBevelVert(O,_,K,0),Ve?(C.push(Y.topN,xe.topP,le.topN),C.push(Y.topN,de.topP,xe.topP),C.push(xe.bottomP,Y.bottomN,le.bottomN),C.push(de.bottomP,Y.bottomN,xe.bottomP)):(C.push(Y.topN,de.topP,le.topN),C.push(le.topN,de.topP,xe.topP),C.push(de.bottomP,Y.bottomN,le.bottomN),C.push(de.bottomP,le.bottomN,xe.bottomP)),Y=de,le=xe,pe===we)for(let Ge=1;Ge<pe;Ge++)de=this.buildBevelVert(O,H,(ue+Ge)%J,Ge/(pe-1)),xe=this.buildBevelVert(O,_,(K+Ge)%ee,Ge/(we-1)),C.push(Y.topN,de.topP,le.topN),C.push(le.topN,de.topP,xe.topP),C.push(de.bottomP,Y.bottomN,le.bottomN),C.push(de.bottomP,le.bottomN,xe.bottomP),Y=de,le=xe;else if(pe>we){let Ge=pe/we,Qe=0;for(let bt=1;bt<pe;bt++)de=this.buildBevelVert(O,H,(ue+bt)%J,bt/(pe-1)),C.push(Y.topN,de.topP,le.topN),C.push(de.bottomP,Y.bottomN,le.bottomN),Y=de,bt>(Qe+1)*Ge&&(Qe++,xe=this.buildBevelVert(O,_,(K+Qe)%ee,Qe/(we-1)),C.push(le.topN,de.topP,xe.topP),C.push(de.bottomP,le.bottomN,xe.bottomP),le=xe)}else{let Ge=we/pe,Qe=0;for(let bt=1;bt<we;bt++)xe=this.buildBevelVert(O,_,(K+bt)%ee,bt/(we-1)),C.push(le.topN,de.topP,xe.topP),C.push(de.bottomP,le.bottomN,xe.bottomP),le=xe,bt>(Qe+1)*Ge&&(Qe++,de=this.buildBevelVert(O,H,(ue+Qe)%J,Qe/(pe-1)),C.push(Y.topN,de.topP,le.topN),C.push(de.bottomP,Y.bottomN,le.bottomN),Y=de)}ue=(ue+pe)%J,K=(K+we)%ee,se=(se+1)%oe}while(se!==ae)}{let k=ye[0];for(let H=0,_=k.boundary.vertexCount;H<_;H++){let J=this.buildBevelVert(O,k,H),ee=this.buildBevelVert(O,k,(H+1)%_);C.push(ee.topP,J.topN,J.bottomN),C.push(ee.topP,J.bottomN,ee.bottomP)}}if(E){let k=[];for(let H=C.length-1;H>=Fe+2;H-=3){let _=C[H-2],J=C[H-1],ee=C[H-0];k.push(ee,J,_)}C.splice(Fe,C.length-Fe,...k)}if(E){let k=[];for(let H=ye[ye.length-1].boundary.vertices.length-1;H>=1;H-=2){let _=ye[ye.length-1].boundary.vertices[H-1],J=ye[ye.length-1].boundary.vertices[H-0];k.push(_,J)}B.push(k)}if(!E){let k=ye[ye.length-1],H=No({windingRule:ye.length>1?Pt.POSITIVE:Pt.ODD,elementType:Qt.POLYGONS,vertexSize:2,strict:!0,contours:[k.insetPoints,...B]});if(!H)throw new Error("Error generating geometry for surface");for(let _=0;_<H.elementCount*3;_+=3){let J=this.buildSurfaceVert(H,H.elements[_+0]),ee=this.buildSurfaceVert(H,H.elements[_+1]),oe=this.buildSurfaceVert(H,H.elements[_+2]);C.push(J.top,ee.top,oe.top),C.push(oe.bottom,ee.bottom,J.bottom)}}this.vertexCache={}}this._buffer.shrink();let G=new tu(Uint32Array.from(C),1),D=new tu(this._buffer.positions,3),W=new tu(this._buffer.normals,3),A=new tu(this._buffer.uvs,2);D.needsUpdate=!0,W.needsUpdate=!0,A.needsUpdate=!0,G.needsUpdate=!0,this.setAttribute("position",D),this.setAttribute("normal",W),this.setAttribute("uv",A),this.setIndex(G)}buildSurfaceVert(e,t){let r=t.toString();if(r in this.vertexCache)return this.vertexCache[r];let n=e.vertices[t*2+0],s=e.vertices[t*2+1],l=(n-this._minX)/this._width,c=(s-this._minY)/this._height,f=this._buffer.get(2),h=f*3,p=f*2,y={top:f+0,bottom:f+1};return this._buffer.positions[h+0]=n,this._buffer.positions[h+1]=s,this._buffer.positions[h+2]=this._depth,this._buffer.normals[h+0]=0,this._buffer.normals[h+1]=0,this._buffer.normals[h+2]=1,this._buffer.uvs[p+0]=l,this._buffer.uvs[p+1]=c,this._buffer.positions[h+3]=n,this._buffer.positions[h+4]=s,this._buffer.positions[h+5]=0,this._buffer.normals[h+3]=0,this._buffer.normals[h+4]=0,this._buffer.normals[h+5]=-1,this._buffer.uvs[p+2]=l,this._buffer.uvs[p+3]=c,this.vertexCache[r]=y,y}buildBevelVert(e,t,r,n=1){let s=`${t.bevelI}:${r}`;if(s in this.vertexCache)return this.vertexCache[s];let[l,c]=t.boundary.vertexIndices[r],f,h,p,y;l!==c?(h=l,f=c,y=!1,p=e.continuous[h]&&e.continuous[f]):(f=l,h=(f-1+e.count)%e.count,y=e.concave[f]&&t.bevelI>0,p=e.continuous[f]||y);let g=Math.cos(t.angle),w=Math.sin(t.angle),S=r*2,T=f*2,C=h*2,B=t.boundary.vertices[S+0],G=t.boundary.vertices[S+1],D=(1-w)*this._bevelSize,W=(B-this._minX)/this._width,A=(G-this._minY)/this._height,q=e.normals[T+0],E=e.normals[T+1],b=e.normals[C+0],R=e.normals[C+1];if(y){let he=b-q,re=R-E;q=q+he*(1-n),E=E+re*(1-n);let Ne=Math.sqrt(q*q+E*E);q/=Ne,E/=Ne}let I=this._buffer.get(p?2:4),z=I*3,O=I*2,$={i:r,fi:f,topP:I+0,topN:I+0,bottomP:I+1,bottomN:I+1};return this._buffer.positions[z+0]=B,this._buffer.positions[z+1]=G,this._buffer.positions[z+2]=this._depth-D,this._buffer.normals[z+0]=q*g,this._buffer.normals[z+1]=E*g,this._buffer.normals[z+2]=w,this._buffer.uvs[O+0]=W,this._buffer.uvs[O+1]=A,this._buffer.positions[z+3]=B,this._buffer.positions[z+4]=G,this._buffer.positions[z+5]=D,this._buffer.normals[z+3]=q*g,this._buffer.normals[z+4]=E*g,this._buffer.normals[z+5]=-w,this._buffer.uvs[O+2]=A,this._buffer.uvs[O+3]=W,p||(I+=2,z+=6,O+=4,$.topP=I+0,$.bottomP=I+1,this._buffer.positions[z+0]=B,this._buffer.positions[z+1]=G,this._buffer.positions[z+2]=this._depth-D,this._buffer.normals[z+0]=b*g,this._buffer.normals[z+1]=R*g,this._buffer.normals[z+2]=w,this._buffer.uvs[O+0]=W,this._buffer.uvs[O+1]=A,this._buffer.positions[z+3]=B,this._buffer.positions[z+4]=G,this._buffer.positions[z+5]=D,this._buffer.normals[z+3]=b*g,this._buffer.normals[z+4]=R*g,this._buffer.normals[z+5]=-w,this._buffer.uvs[O+2]=A,this._buffer.uvs[O+3]=W),this.vertexCache[s]=$,$}clone(){let e=new La(this._shape,this._depth,this._bevel,this._curveSegments,this._bevelSegmentsInput);return e.userData=yo(this.userData),e}};var ur=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var h,p,y,g,w,S,T;let t=Object.assign({},(h=e==null?void 0:e.parameters)!=null?h:{width:100,subdivisions:40,roundness:0,extrudeDepth:0,surfaceMaxCount:100,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters),r=Math.abs(t.width),n=Math.abs((p=t.height)!=null?p:t.width),s=Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(y=t.depth)!=null?y:0),l=(g=i.shape)!=null?g:e==null?void 0:e.shape,c=(w=l==null?void 0:l.roundness)!=null?w:t.roundness;l!==void 0&&(l instanceof st?(l.width!==r||l.height!==n)&&l.applySize(r,n):l=new st(r,n).fromJSON(l),((S=i.parameters)==null?void 0:S.roundness)!==void 0&&((T=i.parameters)==null?void 0:T.roundness)>0&&l.update(!1));let f=l!=null?l:new st(r,n);return{parameters:Object.assign(t,{width:r,height:n,depth:s,extrudeDepth:s,roundness:c}),shape:f}}static build(i){let{extrudeDepth:e,extrudeBevelSize:t,extrudeBevelSegments:r,subdivisions:n,roundness:s,surfaceMaxCount:l}=i.parameters;i.shape.roundness=s;let c;return e<=0?c=new Co(i.shape,n,l):c=new La(i.shape,e,t,n,r),Object.assign(c,{userData:fe(U({},i),{type:"VectorGeometry"})})}};import{MathUtils as z0,Vector2 as F0}from"three";var V0=Math.PI*2,U0=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,l;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:64,angle:360,innerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,surfaceMaxCount:1e3},i.parameters);return{shape:i.shape&&i.shape instanceof st?i.shape:new st,parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((s=t.height)!=null?s:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(l=t.depth)!=null?l:0)})}}static build(i){let{width:e,height:t,spikes:r,angle:n,innerRadius:s,depth:l,extrudeBevelSize:c,extrudeBevelSegments:f,surfaceMaxCount:h}=i.parameters,p=i.shape,y=e*.5,g=t*.5,w=O2(p,y,g,n*Math.PI/180,r,s);p.isClosed=!0,p.update();let S=ur.create({shape:p,parameters:{subdivisions:w,surfaceMaxCount:h,depth:l,extrudeBevelSize:c,extrudeBevelSegments:f}});return Object.assign(S,{userData:fe(U({},i),{type:"EllipseGeometry"})})}};function O2(i,e,t,r,n,s){if(r>=V0)return n>30||n%4==0?(D2(i,e,t,s),Math.round(n/4)):k0(i,r,n,e,t,s);let l={x:0,y:t},c=r+Math.PI*.5,f={x:Math.cos(c)*e,y:Math.sin(c)*t},h=B0({px:l.x,py:l.y,cx:f.x,cy:f.y,rx:e,ry:t,largeArcFlag:r>Math.PI,sweepFlag:!0});return n>30||n%h.length==0?P2(i,l.x,l.y,h,n,e,t,s):k0(i,r,n,e,t,s)}function P2(i,e,t,r,n,s,l,c){let f=Math.round(n/r.length);i.addPoint(Ts(e,t));for(let h=0,p=r.length;h<p;h++){let y=r[h],g=i.points[h],w=Ts(y.x,y.y);g.controls[1].position.set(y.x1,y.y1),w.controls[0].position.set(y.x2,y.y2),i.addPoint(w)}return c>0?H0(i,s,l,c):i.addPoint(Ts(0,0)),f}function k0(i,e,t,r,n,s){let l=-e/t;for(let c=0;c<=t;c++){let f=l*c,h=Math.sin(f)*r,p=Math.cos(f)*n;i.addPoint(Ts(h,p))}return e<V0?s>0?H0(i,r,n,s):i.addPoint(Ts(0,0)):(i.removePoint(i.points[i.points.length-1]),s>0&&W0(i,r,n,s)),1}function D2(i,e,t,r=0,n=0,s=0){let l=.5522847498,c=e*l,f=t*l;i.addPoint(ru(n-e,s,n-e,s-f,n-e,s+f)),i.addPoint(ru(n,s+t,n-c,s+t,n+c,s+t)),i.addPoint(ru(n+e,s,n+e,s+f,n+e,s-f)),i.addPoint(ru(n,s-t,n+c,s-t,n-c,s-t)),r>0&&W0(i,e,t,r)}function Ts(i,e){return new Xn(z0.generateUUID(),new F0(i,e))}function ru(i,e,t,r,n,s){let l=Ts(i,e);return l.controls[0].position.set(t,r),l.controls[1].position.set(n,s),l}function H0(i,e,t,r){q0(i,e,t,r).forEach(s=>i.addPoint(s))}function W0(i,e,t,r){let n=q0(i,e,t,r),s=new st;n.forEach(l=>s.addPoint(l)),s.isClosed=!0,i.shapeHoles.push(s)}function q0(i,e,t,r){let n=r*e/100,s=n*(Math.abs(t)/Math.abs(e)),l=new F0(n/e,s/t),c=i.points.map(f=>{let h=f.clone();return h.uuid=z0.generateUUID(),h}).reverse();return c.forEach(f=>{f.position.multiply(l);let h=f.controls[0].position.clone().multiply(l),p=f.controls[1].position.clone().multiply(l);f.controls[0].position.copy(p),f.controls[1].position.copy(h)}),c}import{BufferGeometry as B2,Float32BufferAttribute as qh,Vector3 as $0}from"three";var J0=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var c,f,h;let t=Object.assign({},(c=e==null?void 0:e.parameters)!=null?c:{width:100,revolutions:2,segments:40,pathRadius:10,pathType:0,pathSegments:30,cornerRadius:30,cornerSegments:4},i.parameters),r=Math.abs(t.width),n=Math.abs((f=t.height)!=null?f:r),s=Math.abs((h=t.depth)!=null?h:r),l=Math.abs(Math.min(r,s))/2;return{parameters:Object.assign(t,{width:r,height:n,depth:s,radius:l,segments:Math.round(t.segments),pathSegments:Math.round(t.pathSegments),cornerSegments:Math.round(t.cornerSegments)})}}static build(i){let{width:e,height:t,depth:r,radius:n,revolutions:s,segments:l,pathRadius:c,pathType:f,pathSegments:h,cornerRadius:p,cornerSegments:y}=i.parameters,g=new nu(!1,e,t,r,n,s,l,c,f,h,p,y);return Object.assign(g,{userData:fe(U({},i),{type:"HelixGeometry"})})}},nu=class extends B2{constructor(e=!0,t=1,r=1,n=1,s=1,l=1,c=1,f=1,h=1,p=1,y=1,g=1){super();let w=e&&l===1;w&&(g=0),y>100&&(y=100);let S=()=>new $0,T=new $0,C=S(),B=S(),G=S(),D,W,A,q,E,b,R,I,z=S(),O=S(),$=S(),he=S(),re=S(),Ne=S(),ye=S(),Me=S(),Fe=r-2*f+.001,k=Fe/l,H=Math.ceil(c*l),_=H+1,J=Fe/H,ee=-Fe/2,oe=p+1,se=2*Math.PI/p,ce=Math.PI/2/g,ue=.01,K=Math.min((1-y/100)*f,f-ue),ae=f-K,ne=0,Ce=2,Y=g*Ce+Ce,le=oe*Y/Ce,de=le+oe*_,xe=oe*(_+Y),[_e,pe,we]=[3,3,2].map(pt=>Array(xe*pt).fill(0)),Ve=[],Ge=s-f;function Qe(pt,Wt){let ar=Math.PI/2;b=Wt*J,I=2*Math.PI*(b%k)/k+ar,b+=ee,R=Math.sin(I)*Ge,E=Math.cos(I)*Ge,e?pt.set(E,R,b):pt.set(E,b,R)}Qe(T,-1e-10),Qe(C,0),z.copy(T),Qe(T,1);let bt=T.distanceTo(C),Lt=ae+K,At=bt*H+2*Lt,sr=K,Ur=At-Lt;for(let pt=0;pt<=H;pt++){Qe(B,pt),Me.subVectors(B,z).normalize(),z.copy(B),Ne.copy(B).setComponent(+e+1,0).normalize(),ye.crossVectors(Me,Ne).normalize();let Wt=pt===0,ar=pt===H,Do=Wt?3*Math.PI/2:ce,Bo=Wt?sr:Ur,Go=Wt?oe:de,ro=Wt?0:xe-oe,no=Me.clone().multiplyScalar(Wt?-ae:ae).add(B),jo=Me.clone().multiplyScalar(Wt?-1:1).normalize();for(let Mr=0;Mr<oe;Mr++){let io=Mr*se;if(O.addVectors(T.copy(Ne).multiplyScalar(f*Math.cos(io)),C.copy(ye).multiplyScalar(f*Math.sin(io))),$.copy(O).normalize(),Wt||ar){w||(ne=ro+Mr,[0,1,2].forEach(Jt=>{_e[ne*3+Jt]=no.getComponent(Jt),pe[ne*3+Jt]=jo.getComponent(Jt)}),we[ne*2]=+ar,we[ne*2+1]=Mr/p),C.copy($).multiplyScalar(K),G.addVectors(B,C);for(let Jt=0;Jt<g;Jt++){let ni=Jt*ce+Do;he.addVectors(T.copy(Me).multiplyScalar(ae*Math.sin(ni)),C.copy($).multiplyScalar(ae*Math.cos(ni))),re.copy(he).normalize(),C.addVectors(G,he),he.normalize(),ne=Go+Jt*oe+Mr,[0,1,2].forEach(Ee=>{_e[ne*3+Ee]=C.getComponent(Ee),pe[ne*3+Ee]=re.getComponent(Ee)});let Eo=+Wt+Math.sin(ni);we[ne*2]=(Bo+ae*Eo)/At,we[ne*2+1]=Mr/p}}C.addVectors(B,O),ne=le+pt*oe+Mr,[0,1,2].forEach(Jt=>{_e[ne*3+Jt]=C.getComponent(Jt),pe[ne*3+Jt]=$.getComponent(Jt)}),we[ne*2]=(Lt+pt*bt)/At,we[ne*2+1]=Mr/p}}let Ht=_+2*g+Ce,kr=1,[Nn,Cn]=w?[kr,kr+_-1]:[0,Ht-1];for(let pt=Nn;pt<=Cn-1;pt++){let Wt=w&&pt===Cn-1;for(let ar=0;ar<oe-1;ar++)D=pt*oe+ar,W=D+1,A=(Wt?ar:D)+oe,q=(Wt?ar+1:W)+oe,pt===0?Ve.push(W,q,A):pt===Ht-2?Ve.push(D,W,A):Ve.push(D,W,A,W,q,A)}this.setIndex(Ve),this.setAttribute("position",new qh(_e,3)),this.setAttribute("normal",new qh(pe,3)),this.setAttribute("uv",new qh(we,2))}};import{IcosahedronBufferGeometry as G2}from"three";var K0=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,detail:0,corner:0,cornerSides:4},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,detail:n,corner:s,cornerSides:l}=i.parameters,c=n===0&&s!==0?new iu(e*.5,s,l):new G2(e*.5,n);return c.scale(1,t/e,r/e),Object.assign(c,{userData:fe(U({},i),{type:"IcosahedronGeometry"})})}},iu=class extends wo{constructor(e=1,t=.2,r=4){let n=(1+Math.sqrt(5))/2,s=[-1,n,0,1,n,0,-1,-n,0,1,-n,0,0,-1,n,0,1,n,0,-1,-n,0,1,-n,n,0,-1,n,0,1,-n,0,-1,-n,0,1],l=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1],c="IcosahedronGeometry";super(s,l,c,e,t,r);this.type=c}static fromJSON(e){return new iu(e.radius,e.corner,e.cornerSides)}};import{LatheBufferGeometry as j2,Shape as E2}from"three";var X0=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,l,c;((n=(r=i.parameters)==null?void 0:r.points)!=null?n:[]).forEach(f=>{Array.isArray(f)&&(f.x=f[0],f.y=f[1])});let t=Object.assign({},(s=e==null?void 0:e.parameters)!=null?s:{width:100,segments:64,verticalSegments:64,points:[{x:0,y:-50,id:0},{x:50,y:-50,id:1},{x:50,y:50,id:2},{x:0,y:50,id:3}]},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((l=t.height)!=null?l:t.width),depth:Math.abs((c=t.depth)!=null?c:t.width)})}}static build(i){let{points:e,segments:t,verticalSegments:r}=i.parameters,n=new E2;n.moveTo(e[0].x,e[0].y),n.bezierCurveTo(e[1].x,e[1].y,e[2].x,e[2].y,e[3].x,e[3].y);let s=new j2(n.extractPoints(r).shape,t);return s.rotateZ(Math.PI),Object.assign(s,{userData:fe(U({},i),{type:"LatheGeometry"})})}};import{BufferGeometry as Y0,BufferGeometryLoader as H2,Vector3 as W2,BoxBufferGeometry as Q0}from"three";import{BufferGeometry as R2,Vector2 as $h,Vector3 as Z0}from"three";import{Geometry as z2,Face3 as F2}from"three/examples/jsm/deprecated/Geometry.js";var V2=["a","b","c"];function U2(i,e){switch(e){case"c":return i.c;case"b":return i.b;case"a":default:return i.a}}function Jh(i,e,t){let r=Math.min(i,e),n=Math.max(i,e),s=r+"_"+n;return t.get(s)}function Kh(i,e,t,r,n,s){let l=Math.min(i,e),c=Math.max(i,e),f=l+"_"+c,h;if(r.has(f))h=r.get(f);else{let p=t[l],y=t[c];h={a:p,b:y,newEdge:null,faces:[]},r.set(f,h)}h.faces.push(n),s[i].edges.push(h),s[e].edges.push(h)}function k2(i,e,t,r){let n,s,l;for(n=0,s=i.length;n<s;n++)t[n]={edges:[]};for(n=0,s=e.length;n<s;n++)l=e[n],Kh(l.a,l.b,i,r,l,t),Kh(l.b,l.c,i,r,l,t),Kh(l.c,l.a,i,r,l,t)}function ou(i,e,t,r,n){i.push(new F2(e,t,r,void 0,void 0,n))}function Is(i,e){return Math.abs(e-i)/2+Math.min(i,e)}function su(i,e,t,r){i.push([e.clone(),t.clone(),r.clone()])}var Xh=class{constructor(e=1){this.subdivisions=e}modify(e){e instanceof R2?e=new z2().fromBufferGeometry(e):e=e.clone(),e.mergeVertices();let t=this.subdivisions;for(;t-- >0;)this._smooth(e);return e.computeFaceNormals(),e.computeVertexNormals(),e}_smooth(e){let t=new Z0,r,n,s,l,c,f=e.vertices,h=e.faces,p=e.faceVertexUvs[0],y=p!==void 0&&p.length>0,g=[],w=new Map;k2(f,h,g,w);let S=[],T,C,B,G,D,W,A;for(let ue of Array.from(w.keys())){for(C=w.get(ue),B=new Z0,D=3/8,W=1/8,A=C.faces.length,A!=2&&(D=.5,W=0,A!=1),B.addVectors(C.a,C.b).multiplyScalar(D),t.set(0,0,0),l=0;l<A;l++){for(G=C.faces[l],c=0;c<3&&(T=f[U2(G,V2[c])],!(T!==C.a&&T!==C.b));c++);T&&t.add(T)}t.multiplyScalar(W),B.add(t),C.newEdge=S.length,S.push(B)}let q,E,b,R,I,z,O,$=[];for(n=0,s=f.length;n<s;n++){for(z=f[n],I=g[n].edges,r=I.length,r==3?q=3/16:r>3&&(q=3/(8*r)),E=1-r*Number(q),b=q,r<=2&&(r==2?(E=3/4,b=1/8):r==1||r==0),O=z.clone().multiplyScalar(E),t.set(0,0,0),l=0;l<r;l++)R=I[l],T=R.a!==z?R.a:R.b,t.add(T);t.multiplyScalar(Number(b)),O.add(t),$.push(O)}let he=$.concat(S),re=$.length,Ne,ye,Me,Fe=[],k=[],H,_,J,ee,oe=new $h,se=new $h,ce=new $h;for(n=0,s=h.length;n<s;n++)G=h[n],Ne=Number(Jh(G.a,G.b,w).newEdge)+re,ye=Number(Jh(G.b,G.c,w).newEdge)+re,Me=Number(Jh(G.c,G.a,w).newEdge)+re,ou(Fe,Ne,ye,Me,G.materialIndex),ou(Fe,G.a,Ne,Me,G.materialIndex),ou(Fe,G.b,ye,Ne,G.materialIndex),ou(Fe,G.c,Me,ye,G.materialIndex),y&&(H=p[n],_=H[0],J=H[1],ee=H[2],oe.set(Is(_.x,J.x),Is(_.y,J.y)),se.set(Is(J.x,ee.x),Is(J.y,ee.y)),ce.set(Is(_.x,ee.x),Is(_.y,ee.y)),su(k,oe,se,ce),su(k,_,oe,ce),su(k,J,se,oe),su(k,ee,ce,se));e.vertices=he,e.faces=Fe,y&&(e.faceVertexUvs[0]=k)}};var er=new W2,au=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var s,l;let t=(l=(s=i.geometry)!=null?s:e==null?void 0:e.geometry)!=null?l:new Y0().copy(new Q0(100,100,100)),r;e===void 0?(t.computeBoundingBox(),t.boundingBox.getSize(er),r={width:er.x,height:er.y,depth:er.z,subdivisions:0}):r=e.parameters;let n=U(U({},r),i.parameters);return{parameters:{width:Math.abs(n.width),height:Math.abs(n.height),depth:Math.abs(n.depth),subdivisions:Math.abs(n.subdivisions)},geometry:t}}static build(i){var f;let{width:e,height:t,depth:r,subdivisions:n}=i.parameters,s=(f=i.geometry)!=null?f:new Y0().copy(new Q0(100,100,100)),l=s.userData.parameters;l===void 0?(s.computeBoundingBox(),s.boundingBox.getSize(er)):er.set(l.width,l.height,l.depth),(e!==er.x||t!==er.y||r!==er.z)&&s.scale(er.x===0?1:e/er.x,er.y===0?1:t/er.y,er.z===0?1:r/er.z);let c=s.originalGeometry;return n>0?(c===void 0||(l==null?void 0:l.subdivisions)!==n)&&(c===void 0&&(c=s),s=new Xh(n).modify(c).toBufferGeometry()):(c!==void 0&&(s=c),c=void 0,s.getAttribute("normal")===void 0&&s.computeVertexNormals()),c!==void 0&&Object.assign(s,{originalGeometry:c}),delete i.geometry,Object.assign(s,{userData:fe(U({},i),{type:"NonParametricGeometry"})})}static loadFromUrl(i,e,t){new H2(t).load(i,n=>{let s=this.normalizeInputs({geometry:n});n.boundingBox.getSize(er);let l=100/er.x;Object.assign(s.parameters,{width:100,height:er.y*l,depth:er.z*l}),e(this.build(s))})}};var ev=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,l,c;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:3},i.parameters);return{shape:i.shape&&i.shape instanceof st?i.shape:new st,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((l=t.height)!=null?l:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(c=t.depth)!=null?c:0)})}}static build(i){let{width:e,height:t,spikes:r,cornerRadius:n,depth:s,extrudeBevelSize:l,extrudeBevelSegments:c,surfaceMaxCount:f}=i.parameters,h=i.shape,p=e*.5,y=t*.5,g=0,w=0,S=2*Math.PI/r;for(let C=0;C<r;C++){let B=S*C,G=g+Math.sin(B)*p,D=w+Math.cos(B)*y;h.addPoint(h.createPoint(G,D))}h.isClosed=!0;for(let C=0,B=h.points.length;C<B;C++)h.points[C].roundness=n;h.roundness=n,h.update();let T=ur.create({shape:h,parameters:{surfaceMaxCount:f,roundness:n,depth:s,extrudeBevelSize:l,extrudeBevelSegments:c}});return Object.assign(T,{userData:fe(U({},i),{type:"PolygonGeometry"})})}};import{BufferGeometry as q2,Float32BufferAttribute as Zh,Vector2 as Zn,Vector3 as or}from"three";var tv=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,radialSegments:4,heightSegments:1,cornerRadius:0,cornerSegments:8,openEnded:!1},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,heightSegments:s,openEnded:l,cornerRadius:c,cornerSegments:f}=i.parameters,h=new rv(e*.5,t,n,s,l,c,f);return h.scale(1,1,r/e),Object.assign(h,{userData:fe(U({},i),{type:"PyramidGeometry"})})}};function _a(i,e,t){t.x=i.x*e.x,t.y=i.y,t.z=i.x*e.y}function Yh(i,e,t,r,n,s){let l=e.clone().sub(i),c=t.clone().sub(i),f=l.angleTo(c);if(l.normalize(),c.normalize(),r===n){let h=l.add(c).normalize();s.copy(i).addScaledVector(h,r/Math.sin(f/2))}else{let h=l.angleTo(c);s.copy(i),s.addScaledVector(l,n/Math.sin(h)),s.addScaledVector(c,r/Math.sin(h))}}function $2(i,e,t){let r=i.clone().sub(e),n=t.clone().sub(e);return r.projectOnVector(n),r.add(e)}var rv=class extends q2{constructor(e=.5,t=1,r=4,n=1,s=!1,l=0,c=4){super();r=Math.floor(Math.max(3,r)),n=Math.floor(n),c=Math.floor(c);let f=[],h=[],p=[],y=[],g=0,w=t/2,S=Math.PI/r,T=e*Math.cos(Math.PI/r),C=2*Math.PI/r,B=(r-2)*Math.PI/r,G=Math.PI-B,D=new or(0,-w,0),W=new or(0,w,0),A=new Zn(e,-w),q=new Zn(T,-w),E=new Zn(0,W.y).sub(q),b=new Zn(0,W.y).sub(A),R=new Zn(E.y,-E.x).normalize(),I=new Zn(b.y,-b.x).normalize(),O=e*Math.cos(Math.PI/r)*Math.tan((Math.PI-E.angle())/2)-1e-8;l=Math.min(l,O);let $;{let k=new or(R.x,R.y,0),H=new or(Math.cos(C)*k.x,k.y,Math.sin(C)*k.x);$=k.angleTo(H)}let he=l/Math.tan((Math.PI-E.angle())/2),re=l/Math.tan((Math.PI-$)/2),Ne=new or;if(!s){h.push(D.x,D.y,D.z),p.push(0,-1,0),y.push(0,0);let k=g++,H=[],_=A.clone(),J=he/Math.cos(Math.PI/r);_.x-=J;for(let ee=0;ee<r;ee++){let oe=ee/r*Math.PI*2+S,se=new Zn(Math.sin(oe),Math.cos(oe));_a(_,se,Ne),h.push(Ne.x,Ne.y,Ne.z),p.push(0,-1,0),y.push(0,0),H.push(g++)}for(let ee=0;ee<H.length;ee++)f.push(H[ee],k,H[(ee+1)%H.length])}let ye=[];{let k=new or,H=new or,_=new or,J=new or,ee=new or,oe=new or;for(let se=0;se<r;se++){let ce=se/r*Math.PI*2+S,ue=(se+.5)/r*Math.PI*2+S,K=(se+1)/r*Math.PI*2+S,ae=new Zn(Math.sin(ce),Math.cos(ce)),ne=new Zn(Math.sin(ue),Math.cos(ue)),Ce=new Zn(Math.sin(K),Math.cos(K));_a(A,ae,H),_a(A,Ce,_),_a(R,ne,k),Yh(W,H,_,re,re,J),h.push(J.x,J.y,J.z),Yh(H,W,_,re,he,ee),h.push(ee.x,ee.y,ee.z),Yh(_,H,W,he,re,oe),h.push(oe.x,oe.y,oe.z),p.push(k.x,k.y,k.z),p.push(k.x,k.y,k.z),p.push(k.x,k.y,k.z),y.push(0,0),y.push(0,0),y.push(0,0);let Y=g++,le=g++,de=g++;if(f.push(Y,le,de),l>0){{let pe=H.clone().add(_).multiplyScalar(.5),we=W.clone().sub(pe).normalize(),Ge=D.clone().sub(pe).normalize().add(we).normalize().multiplyScalar(-1),Qe=oe.clone().sub(ee);Me(pe,Qe,Ge,E.angle())}let xe,_e;{let pe=new or;_a(I,Ce,pe);let we=oe.clone().add(J).multiplyScalar(.5);we=$2(we,_,W);let Ve=oe.clone().sub(J);[xe,_e]=Me(we,Ve,pe,$,J.y)}{let pe=xe,we=pe.clone().setY(0).normalize(),Ve=new or(0,-1,0),Ge=we.clone().cross(Ve);Fe(pe,we,Ve,Ge)}ye.concat(_e);{let pe=E.angle(),we=Math.PI-pe,Ve=W.clone();Ve.y-=l/Math.sin(pe-Math.PI/2);let Ge=new or,Qe=[];for(let Lt=0;Lt<c;Lt++){let At=[],sr=Math.PI/2-we*Lt/c,Ur=Math.cos(sr),Ht=Math.sin(sr),kr=ue;for(let Nn=0;Nn<=Lt;Nn++){let Cn=Math.cos(kr),pt=Math.sin(kr);k.x=Ur*pt,k.y=Ht,k.z=Ur*Cn,Ge.copy(Ve).addScaledVector(k,l),h.push(Ge.x,Ge.y,Ge.z),p.push(k.x,k.y,k.z),y.push(0,0),At.push(g++),kr+=Math.PI*2/Lt/r}Qe.push(At)}_e.reverse(),Qe.push(_e);let bt=Qe.length-1;for(let Lt=0;Lt<bt;Lt++){let At=Qe[Lt],sr=Qe[Lt+1],Ur=At.length-1;f.push(sr[1],At[0],sr[0]);for(let Ht=1;Ht<=Ur;Ht++)f.push(At[Ht],At[Ht-1],sr[Ht]),f.push(sr[Ht+1],At[Ht],sr[Ht])}}}}}this.setIndex(f),this.setAttribute("position",new Zh(h,3)),this.setAttribute("normal",new Zh(p,3)),this.setAttribute("uv",new Zh(y,2));function Me(k,H,_,J,ee){let oe=-J/2,se=(Math.PI-J)/2,ce=H.clone().normalize().cross(_);k.addScaledVector(_,-l/Math.sin(se));let ue=new or,K=new or,ae=1,ne=g,Ce=[];for(let Y=0;Y<=c;Y++){let le=oe+Y/c*J;K.set(0,0,0),K.addScaledVector(ce,Math.sin(le)),K.addScaledVector(_,Math.cos(le));for(let de=0;de<=ae;de++){let xe=de/ae-.5;if(ue.copy(k),ue.addScaledVector(H,xe),ue.addScaledVector(K,l),ee!=null){let _e=Math.max(0,ue.y-ee);ue.addScaledVector(H,-_e/H.y)}h.push(ue.x,ue.y,ue.z),p.push(K.x,K.y,K.z),y.push(0,0),de===0&&Ce.push(g),g++}}for(let Y=0;Y<c;Y++)for(let le=0;le<ae;le++){let de=ne+le+(ae+1)*Y,xe=de+(ae+1),_e=xe+1,pe=de+1;f.push(de,xe,pe),f.push(xe,_e,pe)}return[k.clone().addScaledVector(H,.5),Ce]}function Fe(k,H,_,J){let ee=Math.PI/2,oe=b.angle()-ee,se=[],ce=new or,ue=new or;for(let ae=0;ae<=c;ae++){let ne=[],Ce=ae/c;for(let Y=0;Y<=ae;Y++){let de=((ae?Y/ae:0)-.5)*G,xe=Math.cos(de),_e=Math.sin(de),pe=Math.atan(Math.tan(oe)*xe),we=(ee+pe)*Ce,Ve=Math.cos(we),Ge=Math.sin(we);ce.set(0,0,0),ce.addScaledVector(H,Ge*xe),ce.addScaledVector(_,Ve),ce.addScaledVector(J,Ge*_e),ue.copy(k).addScaledVector(ce,l),h.push(ue.x,ue.y,ue.z),p.push(ce.x,ce.y,ce.z),y.push(0,0),ne.push(g++)}se.push(ne)}let K=se.length-1;for(let ae=0;ae<K;ae++){let ne=se[ae],Ce=se[ae+1],Y=ne.length-1;f.push(ne[0],Ce[1],Ce[0]);for(let le=1;le<=Y;le++)f.push(ne[le-1],ne[le],Ce[le]),f.push(ne[le],Ce[le+1],Ce[le])}}}};var lu=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var l,c,f,h,p;let t=Object.assign({},(l=e==null?void 0:e.parameters)!=null?l:{width:100,depth:0,cornerRadius:[0,0,0,0],cornerType:1,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters),r=Object.assign((c=e==null?void 0:e.ui)!=null?c:{enabledIndieCorners:!1},i.ui),n=t.cornerRadius.reduce((y,g)=>y+g,0);return{shape:i.shape&&i.shape instanceof st?i.shape:new st,parameters:Object.assign(t,{surfaceMaxCount:((f=t.surfaceMaxCount)!=null?f:n>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((h=t.height)!=null?h:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(p=t.depth)!=null?p:0)}),ui:r}}static build(i){let e=i.shape,{width:t,height:r,cornerRadius:n,cornerType:s,depth:l,extrudeBevelSize:c,extrudeBevelSegments:f,surfaceMaxCount:h}=i.parameters,p={x:t*.5,y:r*.5},y={x:-p.x,y:-p.y},g={x:p.x,y:p.y};function w(A,q,E){return q>t&&E>r?Math.min(A*t/q,A*r/E):q>t?A*t/q:E>r?A*r/E:A}let S=[];S[0]=n[0]===0?0:w(n[0],n[0]+n[3],n[0]+n[1]),S[1]=n[1]===0?0:w(n[1],n[1]+n[2],n[1]+n[0]),S[2]=n[2]===0?0:w(n[2],n[2]+n[1],n[2]+n[3]),S[3]=n[3]===0?0:w(n[3],n[3]+n[0],n[3]+n[2]);let T=y.x,C=g.x,B=g.y,G=y.y;e.addPoint(e.createPoint(T,B)),e.addPoint(e.createPoint(C,B)),e.addPoint(e.createPoint(C,G)),e.addPoint(e.createPoint(T,G)),e.isClosed=!0;let D=!0;for(let A=0,q=e.points.length;A<q;A++)e.points[A].roundness=S[A],A>0&&S[A]!==S[A-1]&&(D=!1);D&&(e.roundness=S[0]),e.useCubicForRoundedCorners=s!==1,e.update();let W=ur.create({shape:e,parameters:{surfaceMaxCount:h,depth:l,extrudeBevelSize:c,extrudeBevelSegments:f}});return Object.assign(W,{userData:fe(U({},i),{type:"RectangleGeometry"})})}};import{SphereBufferGeometry as J2}from"three";var nv=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,widthSegments:64,heightSegments:64,phiStart:0,phiLength:2*Math.PI,thetaStart:0,thetaLength:Math.PI},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width)})}}static build(i){let{width:e=100,height:t=e,depth:r=e,widthSegments:n=64,heightSegments:s=64,phiStart:l,phiLength:c,thetaStart:f,thetaLength:h}=i.parameters,p=new J2(.5*e,n,s,l,c,f,h);return p.scale(1,t/e,r/e),Object.assign(p,{userData:fe(U({},i),{type:"SphereGeometry"})})}};import{PlaneBufferGeometry as K2}from"three";var iv=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0,widthSegments:8,heightSegments:8},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:0})}}static build(i){let{width:e=100,height:t=e,widthSegments:r=8,heightSegments:n=8}=i.parameters,s=new K2(e,t,r,n);return s.scale(1,1,1),Object.assign(s,{userData:fe(U({},i),{type:"PlaneGeometry"})})}};var ov=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,l,c;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,innerRadiusPercent:38.19,spikes:5,cornerRadius:0,angle:360,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1},i.parameters);return{shape:i.shape&&i.shape instanceof st?i.shape:new st,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((l=t.height)!=null?l:t.width),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(c=t.depth)!=null?c:0)})}}static build(i){let{width:e,height:t,innerRadiusPercent:r,spikes:n,cornerRadius:s,angle:l,depth:c,extrudeBevelSize:f,extrudeBevelSegments:h,surfaceMaxCount:p}=i.parameters,y=i.shape,g=e*.5,w=t*.5,S=0,T=0,C=l*Math.PI/360/n,B=Math.PI/2*3*-1,G=g*r/100,D=w*r/100;if(n==3&&r==50){C=2*Math.PI/n;for(let A=0;A<n;A++){let q=C*A,E=S+Math.sin(q)*g,b=T+Math.cos(q)*w;y.addPoint(y.createPoint(E,b))}}else for(let A=0;A<n;A++){let q=S+Math.cos(B)*g,E=T+Math.sin(B)*w;y.addPoint(y.createPoint(q,E)),B+=C,q=S+Math.cos(B)*G,E=T+Math.sin(B)*D,A<=n,y.addPoint(y.createPoint(q,E)),B+=C}y.isClosed=!0;for(let A=0,q=y.points.length;A<q;A++)y.points[A].roundness=s;y.roundness=s,y.update();let W=ur.create({shape:y,parameters:{surfaceMaxCount:p,roundness:s,depth:c,extrudeBevelSize:f,extrudeBevelSegments:h}});return Object.assign(W,{userData:fe(U({},i),{type:"StarGeometry"})})}};import{PlaneBufferGeometry as X2}from"three";var cu=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,depth:0},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:0)})}}static build(i){let{width:e,height:t}=i.parameters,r=new X2(e,t);return Object.assign(r,{userData:fe(U({},i),{type:"TextFrameGeometry"})})}};var sv=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var l,c,f;let t=Object.assign({},(l=e==null?void 0:e.parameters)!=null?l:{width:100,radialSegments:32,tubularSegments:64,arc:Math.PI*2,cornerRadius:30,cornerSegments:8},i.parameters),r=Math.abs(t.width),n=Math.abs((c=t.height)!=null?c:t.width),s=Math.abs((f=t.depth)!=null?f:t.width*.25);return{parameters:Object.assign(t,{width:r,height:n,depth:s})}}static build(i){let{width:e,height:t,depth:r,radialSegments:n,tubularSegments:s,arc:l,cornerRadius:c,cornerSegments:f}=i.parameters,h=Z2(e,t,r,e*.5,l,s,0,0,n,c,f);return h.scale(1,t/e,1),Object.assign(h,{userData:fe(U({},i),{type:"TorusGeometry"})})}};function Z2(i,e,t,r,n,s,l,c,f,h,p){return[e,t]=[t,e],l=e/2,n/=2*Math.PI,n==1&&(h=0),new nu(!0,i,e,t,r,n,s,l,c,f,h,p)}import{TorusKnotBufferGeometry as Y2}from"three";var av=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var r,n,s,l;let t=Object.assign({},(r=e==null?void 0:e.parameters)!=null?r:{width:100,tubularSegments:64,radialSegments:32,p:2,q:3},i.parameters);return{parameters:Object.assign(t,{width:Math.abs(t.width),height:Math.abs((n=t.height)!=null?n:t.width),depth:Math.abs((s=t.depth)!=null?s:t.width),tube:(l=t.tube)!=null?l:t.width*.125})}}static build(i){let{width:e,tube:t,tubularSegments:r,radialSegments:n,p:s,q:l}=i.parameters,c=e*.5;c!==t&&(c-=t);let f=new Y2(c,t,r,n,s,l);return Object.assign(f,{userData:fe(U({},i),{type:"TorusKnotGeometry"})})}};var lv=class{static create(i){return this.build(this.normalizeInputs(i))}static normalizeInputs(i,e){var n,s,l,c;let t=Object.assign({},(n=e==null?void 0:e.parameters)!=null?n:{width:100,depth:0,spikes:5,cornerRadius:0,extrudeDepth:0,extrudeBevelSize:0,extrudeBevelSegments:1,isRect:!1},i.parameters);return{shape:i.shape&&i.shape instanceof st?i.shape:new st,parameters:Object.assign(t,{surfaceMaxCount:((s=t.surfaceMaxCount)!=null?s:t.cornerRadius>0)?1e3:100,width:Math.abs(t.width),height:Math.abs((l=t.height)!=null?l:t.width*(t.isRect?1:Math.sqrt(3)/2)),depth:Math.abs(t.depth!==void 0&&t.depth===0&&t.extrudeDepth>0?t.extrudeDepth:(c=t.depth)!=null?c:0)})}}static build(i){let{width:e=100,height:t,cornerRadius:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:l,isRect:c,surfaceMaxCount:f}=i.parameters,h=i.shape,p=e*.5,y=t*.5;c?(h.addPoint(h.createPoint(-p,y)),h.addPoint(h.createPoint(p,-y)),h.addPoint(h.createPoint(-p,-y))):(h.addPoint(h.createPoint(0,y)),h.addPoint(h.createPoint(p,-y)),h.addPoint(h.createPoint(-p,-y))),h.isClosed=!0;for(let w=0,S=h.points.length;w<S;w++)h.points[w].roundness=r;h.roundness=r,h.update();let g=ur.create({shape:h,parameters:{surfaceMaxCount:f,roundness:r,depth:n,extrudeBevelSize:s,extrudeBevelSegments:l}});return Object.assign(g,{userData:fe(U({},i),{type:"TriangleGeometry"})})}};var Ta={};tT(Ta,{addBarycentricAttribute:()=>nD,fixUvs:()=>oD,loadFromUrl:()=>iD,resizeGeometry:()=>rD,roundShapePolygon:()=>tD});import{BufferGeometryLoader as Q2,Float32BufferAttribute as eD,Vector3 as Qh}from"three";var cv=function(i,e){let t=e.x-i.x,r=e.y-i.y,n=Math.sqrt(t*t+r*r),s=t/n,l=r/n,c=Math.atan2(l,s);return{x:t,y:r,len:n,nx:s,ny:l,ang:c}},tD=(i,e,t)=>{let r,n,s,l,c,f,h,p,y,g,w,S,T,C,B=e.length;for(l=e[B-2],i.curves=[],r=1;r<B-1;r++){c=e[r%B],f=e[(r+1)%B];let G=cv(c,l),D=cv(c,f);h=G.nx*D.ny-G.ny*D.nx,p=G.nx*D.nx-G.ny*-D.ny,w=Math.asin(h),y=1,g=!1,p<0?w<0?w=Math.PI+w:(w=Math.PI-w,y=-1,g=!0):w>0&&(y=-1,g=!0),S=w/2,C=Math.abs(Math.cos(S)*t/Math.sin(S)),C>Math.min(G.len/2,D.len/2)?(C=Math.min(G.len/2,D.len/2),T=Math.abs(C*Math.sin(S)/Math.cos(S))):T=t,n=c.x+D.nx*C,s=c.y+D.ny*C,n+=-D.ny*T*y,s+=D.nx*T*y,i.absarc(n,s,T,G.ang+Math.PI/2*y,D.ang-Math.PI/2*y,g),l=c,c=f}i.closePath()},rD=(i,{width:e,height:t,depth:r})=>{e=Math.abs(e),t=Math.abs(t),r=Math.abs(r);let n=i.userData.parameters,s,l,c;e===0?(e=n.width,s=1):s=e/n.width,t===0?(t=n.height,l=1):l=t/n.height,r===0?(r=n.depth,c=1):c=r/n.depth,i.scale(s,l,c),n.width=e,n.height=t,n.depth=r},nD=(i,e)=>{let t=[new Qh(1,0,0),new Qh(0,1,0),new Qh(0,0,1)],r=i.attributes.position,n=new Float32Array(r.count*3);for(let s=0,l=r.count;s<l;s++)t[s%3].toArray(n,s*3);i.setAttribute(e,new eD(n,3))},iD=i=>new Promise(e=>{new Q2().load(i,r=>e(r))}),oD=(i,e,t)=>{let r=i.getAttribute("uv");if(r)for(let n=0;n<r.count;n++){let s=r.getX(n),l=r.getY(n);r.setXY(n,(s+e/2)/e,1-(l-t/2)/t*-1)}};import{BufferGeometry as uv,BufferAttribute as fv,Uint32BufferAttribute as ed,Float32BufferAttribute as td,Matrix4 as aD}from"three";import{mergeVertices as lD}from"three/examples/jsm/utils/BufferGeometryUtils.js";var sD,uu=new Promise(i=>{sD=i});var Oe;uu.then(i=>{Oe=i});var hv=new Float32Array([10,10,0,-10,10,0,-10,-10,0,10,-10,0]),dv=new Uint32Array([0,1,2,3]),pv=new Uint8Array([4]),en=class{static build(i,e,t,r,n){let s,l,c;if(i===void 0)s=en.allocate(n,t),Oe.set_destination_refinement_level(s,0),l=en.buildLevel(s,!0,r);else if(i.positionWASM!==void 0){e&&e!==0&&(Oe.free_bvh(e),Oe.free_subdivision_surface(e));try{s=en.allocate(n,void 0,i)}catch(f){console.error(f,i),s=en.allocate(n,void 0,{positionWASM:hv,indexWASM:dv,verticesPerFaceWASM:pv})}Oe.set_destination_refinement_level(s,0),l=en.buildLevel(s,!0,r)}else s=e;if(i!==void 0&&i.subdivisions!==void 0){let f=cD(i.subdivisions,i.positionWASM.length);Oe.set_destination_refinement_level(s,f),f>0?c=en.buildLevel(s,!1,r):c=null}return{subdivPointer:s,originalGeometry:l,subdividedGeometry:c}}static allocate(i,e,t){var A;let r,n,s,l=[],c=[];if(t)t.positionWASM&&t.positionWASM.length>0?(r=t.positionWASM,n=t.indexWASM,s=t.verticesPerFaceWASM):(r=hv,n=dv,s=pv);else{e.deleteAttribute("normal"),e.deleteAttribute("uv");let q=lD(e);r=q.attributes.position.array;let E=q.getIndex().array,b=E.length;switch(e.userData.type==="TorusGeometry"&&(e==null?void 0:e.userData.parameters.arc)===Math.PI*2&&(e.userData.type="ClosedTorusGeometry"),e.userData.type){case"ClosedTorusGeometry":case"PlaneGeometry":case"TorusKnotGeometry":case"CubeGeometry":n=new Uint32Array(b/3*2),s=new Uint8Array(b/6).fill(4);for(let re=0,Ne=0;re<b;re+=6)n[Ne++]=E[re],n[Ne++]=E[re+1],n[Ne++]=E[re+4],n[Ne++]=E[re+5];break;case"TorusGeometry":case"SphereGeometry":case"HelixGeometry":case"CylinderGeometry":case"ConeGeometry":let R,I,z;if(e.userData.type==="SphereGeometry")I=e.parameters.heightSegments,R=e.parameters.widthSegments,e.parameters.thetaLength!==Math.PI&&(z=!0);else if(e.userData.type==="CylinderGeometry")I=e.parameters.heightSegments+2,R=e.parameters.radialSegments;else if(e.userData.type==="ConeGeometry")I=e.parameters.heightSegments+1,R=e.parameters.radialSegments;else if(e.userData.type==="TorusGeometry"){let re=e.userData.parameters;I=Math.ceil(re.tubularSegments*re.arc/(2*Math.PI))+2,R=re.radialSegments}else{let{pathSegments:re,segments:Ne,revolutions:ye}=e.userData.parameters;I=Math.ceil(Ne*ye)+2,R=re}z?(n=new Uint32Array(1*R*3+(I-1)*R*4),s=new Uint8Array(1*R+(I-1)*R)):(n=new Uint32Array(2*R*3+(I-2)*R*4),s=new Uint8Array(2*R+(I-2)*R));let O=0,$=0,he=0;if(e.userData.type==="SphereGeometry"||e.userData.type==="HelixGeometry"||e.userData.type==="TorusGeometry"){for(;$<3*R;)n[$++]=E[O++],n[$++]=E[O++],n[$++]=E[O++],s[he++]=3;let re=z?n.length:3*R+4*(I-2)*R;for(;$<re;O+=6)n[$++]=E[O],n[$++]=E[O+1],n[$++]=E[O+4],n[$++]=E[O+5],s[he++]=4}else for(;$<4*(I-2)*R;O+=6)n[$++]=E[O],n[$++]=E[O+1],n[$++]=E[O+4],n[$++]=E[O+5],s[he++]=4;for(;$<n.length;)n[$++]=E[O++],n[$++]=E[O++],n[$++]=E[O++],s[he++]=3;break;default:n=E,s=new Uint8Array(b/3).fill(3);break}}let f=r.length,h=n.length,p=s.length,y=r.length+l.length+c.length,g=n.length+s.length,w=y*Float32Array.BYTES_PER_ELEMENT+g*Uint32Array.BYTES_PER_ELEMENT,S=y*Float32Array.BYTES_PER_ELEMENT,T=g*Uint32Array.BYTES_PER_ELEMENT,C=Oe._malloc(w),B=new Float32Array(Oe.HEAPF32.buffer,C,y),G=new Uint32Array(Oe.HEAPU32.buffer,C+S,g);B.set(r,0),B.set(l,r.length),B.set(c,r.length+l.length),G.set(n,0),G.set(s,n.length);let D;((A=t==null?void 0:t.scaleBaked)==null?void 0:A.some(q=>q!==1))&&(D=new aD().makeScale(...t.scaleBaked)),i&&(D?D.premultiply(i):D=i);let W=D?Oe.alloc_subdivision_surface2(C,f,C+S,h,C+S+n.length*Uint32Array.BYTES_PER_ELEMENT,p,D.elements):Oe.alloc_subdivision_surface(C,f,C+S,h,C+S+n.length*Uint32Array.BYTES_PER_ELEMENT,p);return Oe._free(C),W}static buildLevel(i,e,t,r,n){let s=n?Oe.get_mesh_data2(i,e?Oe.Level.CONTROL:Oe.Level.REFINED,t!=null?t:!e,n.elements):Oe.get_mesh_data(i,e?Oe.Level.CONTROL:Oe.Level.REFINED,t!=null?t:!e),l=8,c=Oe.HEAPU32.subarray(s>>2,(s>>2)+l),f=c.subarray(4,4+4),h=0,p=Oe.HEAPU32[c[h]>>2],y=Oe.HEAPF32.subarray(p>>2,(p>>2)+f[h]);h++;let g=Oe.HEAPU32[c[h]>>2],w=Oe.HEAPF32.subarray(g>>2,(g>>2)+f[h]);h++;let S=Oe.HEAPU32[c[h]>>2],T=Oe.HEAPU32.subarray(S>>2,(S>>2)+f[h]);h++;let C=Oe.HEAPU32[c[h]>>2],B=Oe.HEAPU32.subarray(C>>2,(C>>2)+f[h]);if(h++,r===void 0){let G=new uv;if(G.setIndex(new ed(B,1)),G.setAttribute("position",new td(y,3)),G.setAttribute("normal",new td(w,3)),e){G.setAttribute("faceMap",new ed(T,1));let D=new Float32Array(w.length/3*4).fill(0);G.setAttribute("color",new fv(D,4))}return Oe.free_mesh_data(s),G.userData.type="SubdivGeometry",G}r.getAttribute("position").copyArray(y),r.getAttribute("normal").copyArray(w),r.attributes.position.needsUpdate=!0,r.attributes.normal.needsUpdate=!0,Oe.free_mesh_data(s)}static buildControlCageWireframe(i,e,t){let r=Oe.get_wireframe_data_for_base_level(i),n=4,s=Oe.HEAPU32.subarray(r>>2,(r>>2)+n),l=s.subarray(2,2+2),c=0,f=Oe.HEAPU32[s[c]>>2],h=Oe.HEAPF32.subarray(f>>2,(f>>2)+l[c]);c++;let p=Oe.HEAPU32[s[c]>>2],y=Oe.HEAPU32.subarray(p>>2,(p>>2)+l[c]);if(e===void 0){let g=new uv;g.setAttribute("position",new td(h,3));let w=new Float32Array(h.length);for(let S=0,T=h.length;S<T;)w[S++]=t.r,w[S++]=t.g,w[S++]=t.b;return g.setAttribute("color",new fv(w,3)),g.setIndex(new ed(y,1)),Oe.free_wireframe_data_for_base_level(r),g}e.getAttribute("position").copyArray(h),e.attributes.position.needsUpdate=!0,Oe.free_wireframe_data_for_base_level(r)}static updateCollabMesh(i,e,t){e||Oe.set_destination_refinement_level(i,1);let r=t?Oe.get_topological_data2(i,e?Oe.Level.CONTROL:Oe.Level.REFINED,t.elements):Oe.get_topological_data(i,e?Oe.Level.CONTROL:Oe.Level.REFINED),n=6,s=Oe.HEAPU32.subarray(r>>2,(r>>2)+n),l=s.subarray(3,3+3),c=0,f=Oe.HEAPU32[s[c]>>2],h=new Float32Array(Oe.HEAPF32.subarray(f>>2,(f>>2)+l[c]));c++;let p=Oe.HEAPU32[s[c]>>2],y=new Uint32Array(Oe.HEAPU32.subarray(p>>2,(p>>2)+l[c]));c++;let g=Oe.HEAPU32[s[c]>>2],w=new Uint8Array(Oe.HEAPU32.subarray(g>>2,(g>>2)+l[c]));return Oe.free_topological_data(r),{positions:h,indices:y,verticesPerFace:w}}};function cD(i,e){let t=i;return t=Math.min(t,3-Math.ceil(Math.log(e/172e3)/Math.log(4))),Math.max(t,0)}var rd={ConeGeometry:g0,CubeGeometry:y0,CylinderGeometry:p0,DodecahedronGeometry:v0,EllipseGeometry:U0,HelixGeometry:J0,IcosahedronGeometry:K0,LatheGeometry:X0,NonParametricGeometry:au,PolygonGeometry:ev,PyramidGeometry:tv,RectangleGeometry:lu,SphereGeometry:nv,PlaneGeometry:iv,StarGeometry:ov,TextFrameGeometry:cu,TorusGeometry:sv,TorusKnotGeometry:av,TriangleGeometry:lv,VectorGeometry:ur},Ia=i=>rd[i.type].create(i);import{Matrix4 as ad}from"three";import{Box3 as xv,Line3 as gn,Matrix4 as nd,Vector3 as Ct}from"three";import{HemisphereLight as mv}from"three";import{Color as uD}from"three";var tn=class extends uD{constructor(e,t,r,n){super(e,t,r);this.a=n}setRGBA(e,t,r,n){super.setRGB(e,t,r),this.a=n}get x(){return this.r}get y(){return this.g}get z(){return this.b}get w(){return this.a}set x(e){this.r=e}set y(e){this.g=e}set z(e){this.b=e}set w(e){this.a=e}};function kt(i,e){let t;if(typeof i=="string"){let r=e==null?void 0:e.getColor(i);r?t=r:(console.warn("Tried to create color layer params with a color key that does not exist in the assets manager"),t=new tn(0,0,0,0))}else return"a"in i?new tn(i.r,i.g,i.b,i.a):new tn(i.r,i.g,i.b,1);return t}var fu=i=>"isEntity"in i,Ms=i=>"isAbstractMesh"in i;var Si=i=>"objectHelper"in i;function fD(i,e){var r;let t=!1;e.position&&(i.position.fromArray(e.position),t=!0),e.rotation&&(i.rotation.fromArray(e.rotation),t=!0),e.scale&&(t=!0,i.scale.fromArray(e.scale)),e.hiddenMatrix!==void 0&&"hiddenMatrix"in i&&(t=!0,i.hiddenMatrix.fromArray((r=e.hiddenMatrix)!=null?r:Ui.identity)),t&&i.updateMatrix(),e.position&&e.rotation&&e.scale&&e.hiddenMatrix!==void 0&&i.updateWorldMatrix(!1,!0),i.objectType==="CombinedCamera"&&(e.isUpVectorFlipped!==void 0&&(i.isUpVectorFlipped=e.isUpVectorFlipped),i.updateUp())}function hD(i,e){fD(i,e),e.name!==void 0&&(i.name=e.name),e.visible!==void 0&&(i.isEntity?i.visibility=e.visible:i.visible=e.visible)}function gv(i,e,t){hD(i,e),e.color!==void 0&&(i.color=kt(e.color,t)),e.intensity!==void 0&&(i.intensity=e.intensity),e.shadows!==void 0&&!(i instanceof mv)&&(i.castShadow=e.shadows),i.shadow&&!(i instanceof mv)&&e.depth!==void 0&&(i.shadow.camera.far=e.depth,i.shadow.needsUpdate=!0),e.helper!==void 0&&Si(i)&&(i.enableHelper=e.helper,i.gizmos.shadowmap.visible=e.helper)}function yv(i,e){i.shadow.camera.right=e/2,i.shadow.camera.left=-e/2,i.shadow.camera.top=e/2,i.shadow.camera.bottom=-e/2,i.shadow.needsUpdate=!0}var As=new xv,fr=new Ct,Ie=new Ct,$t=new nd;function dD(i,e,t=0,r=e.count){let n=1/0,s=1/0,l=1/0,c=-1/0,f=-1/0,h=-1/0;for(let p=t;p<r;p++){let y=e.getX(p),g=e.getY(p),w=e.getZ(p);y<n&&(n=y),g<s&&(s=g),w<l&&(l=w),y>c&&(c=y),g>f&&(f=g),w>h&&(h=w)}return i.min.set(n,s,l),i.max.set(c,f,h),i}var vv=(i,e,t,r)=>{var n;if(Ms(i)){let s=i.geometry.userData.parameters,l=i.geometry.getAttribute("position");i.geometry.userData.type==="SubdivGeometry"?fr.copy(i.originalGeometry.boundingSphere.center):(dD(As,l,i.geometry.drawRange.start,i.geometry.drawRange.count<1/0?i.geometry.drawRange.count:l.count),As.getCenter(fr)),i.forceComputeSize?As.getSize(Ie).multiplyScalar(.5):Ie.set(s.width,s.height,(n=s.depth)!=null?n:0).multiplyScalar(.5)}else if(Si(i)&&r===!0){let s=i.geometryHelper.getAttribute("position");As.setFromArray(s.array),As.getCenter(fr),As.getSize(Ie).multiplyScalar(.5)}else fr.setScalar(0),Ie.setScalar(0);$t.copy(e).multiply(i.matrixWorld),Ie.x===0&&Ie.y===0&&Ie.z===0?t.push(new Ct(fr.x,fr.y,fr.z).applyMatrix4($t)):t.push(new Ct(-Ie.x,Ie.y,Ie.z).add(fr).applyMatrix4($t),new Ct(-Ie.x,-Ie.y,Ie.z).add(fr).applyMatrix4($t),new Ct(Ie.x,-Ie.y,Ie.z).add(fr).applyMatrix4($t),new Ct(Ie.x,Ie.y,Ie.z).add(fr).applyMatrix4($t),new Ct(-Ie.x,Ie.y,-Ie.z).add(fr).applyMatrix4($t),new Ct(-Ie.x,-Ie.y,-Ie.z).add(fr).applyMatrix4($t),new Ct(Ie.x,-Ie.y,-Ie.z).add(fr).applyMatrix4($t),new Ct(Ie.x,Ie.y,-Ie.z).add(fr).applyMatrix4($t))},hu=class extends xv{constructor(){super(...arguments);this.matrix=new nd;this.vertices=[];this.faces=[];this.edges=[];this.centerEdges=[]}copy(e){return super.copy(e),this.matrix.copy(e.matrix),this.vertices=e.vertices.map(t=>t.clone()),this.faces=e.faces.map(t=>t.clone()),this.edges=e.edges.map(t=>t.clone()),this.centerEdges=e.centerEdges.map(t=>t.clone()),this}setFromObjectSize(e,t=!1){e.updateWorldMatrix(!1,t),this.makeEmpty(),this.matrix.copy(e.matrixWorld);let r=new nd().copy(e.matrixWorld).invert();return this.expandByObjectSize(e,r,t)}expandByObjectSize(e,t,r=!1){let n=[];return r===!0?e.traverseEntity(s=>vv(s,t,n,e.enableHelper===!0)):vv(e,t,n,e.enableHelper===!0),this.setFromPoints(n)}getCenter(e){return e=super.getCenter(e),e.applyMatrix4(this.matrix),e}getPositionToCenter(e){return e=super.getCenter(e),e.applyMatrix4($t.copy(this.matrix).setPosition(0,0,0)),e}computeVertices(){this.getSize(Ie).multiplyScalar(.5),this.getCenter(fr),$t.copy(this.matrix).setPosition(fr),this.vertices=[new Ct(-Ie.x,Ie.y,Ie.z).applyMatrix4($t),new Ct(-Ie.x,-Ie.y,Ie.z).applyMatrix4($t),new Ct(Ie.x,-Ie.y,Ie.z).applyMatrix4($t),new Ct(Ie.x,Ie.y,Ie.z).applyMatrix4($t),new Ct(-Ie.x,Ie.y,-Ie.z).applyMatrix4($t),new Ct(-Ie.x,-Ie.y,-Ie.z).applyMatrix4($t),new Ct(Ie.x,-Ie.y,-Ie.z).applyMatrix4($t),new Ct(Ie.x,Ie.y,-Ie.z).applyMatrix4($t)]}computeEdges(){this.vertices.length>0&&this.computeVertices(),this.edges=[new gn(this.vertices[0],this.vertices[3]),new gn(this.vertices[1],this.vertices[2]),new gn(this.vertices[5],this.vertices[6]),new gn(this.vertices[4],this.vertices[7]),new gn(this.vertices[0],this.vertices[1]),new gn(this.vertices[3],this.vertices[2]),new gn(this.vertices[7],this.vertices[6]),new gn(this.vertices[4],this.vertices[5]),new gn(this.vertices[0],this.vertices[4]),new gn(this.vertices[1],this.vertices[5]),new gn(this.vertices[2],this.vertices[6]),new gn(this.vertices[3],this.vertices[7])],this.centerEdges=this.edges.map(e=>e.getCenter(new Ct))}computeFaces(){this.vertices.length>0&&this.computeVertices(),this.faces=[new Ct().copy(this.vertices[0]).sub(this.vertices[2]).multiplyScalar(.5).add(this.vertices[2]),new Ct().copy(this.vertices[7]).sub(this.vertices[5]).multiplyScalar(.5).add(this.vertices[5]),new Ct().copy(this.vertices[4]).sub(this.vertices[1]).multiplyScalar(.5).add(this.vertices[1]),new Ct().copy(this.vertices[3]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6]),new Ct().copy(this.vertices[4]).sub(this.vertices[3]).multiplyScalar(.5).add(this.vertices[3]),new Ct().copy(this.vertices[1]).sub(this.vertices[6]).multiplyScalar(.5).add(this.vertices[6])]}};import{Object3D as _D,Matrix4 as TD,Light as ID}from"three";import{Group as ND,Mesh as Lv,MeshStandardMaterial as _v}from"three";import{BufferGeometry as pD,Float32BufferAttribute as id}from"three";function bv(i){var l;let e=[],t=i.groups,r=i.getAttribute("position").array,n=i.getAttribute("normal").array,s=(l=i.getAttribute("uv"))==null?void 0:l.array;return t.forEach(c=>{let f=c.count,h=new pD,p=new Float32Array(f*3),y=new Float32Array(f*3),g=new Float32Array(f*2);for(let w=0;w<f;w++){let S=3*(c.start+w),T=3*w;if(p[T]=r[S],p[T+1]=r[S+1],p[T+2]=r[S+2],y[T]=n[S],y[T+1]=n[S+1],y[T+2]=n[S+2],s){let C=2*(c.start+w),B=2*w;g[B]=s[C],g[B+1]=s[C+1]}}h.setAttribute("position",new id(p,3)),h.setAttribute("normal",new id(y,3)),s&&h.setAttribute("uv",new id(g,2)),e.push(h)}),e}import{GLTFExporter as CD}from"three/examples/jsm/exporters/GLTFExporter.js";var mD,Sv=new Promise(i=>{mD=i});var Tv=rh(Cv());var pu={isPublish:!1,gltfQueue:[]};function sd(i,e,t){return i[e.uuid]===void 0&&(i[e.uuid]=e.toJSON(t)),e.uuid}var LD=new CD;function Iv(i,e,t){if(i[e.uuid]===void 0)if(e.userData.type==="NonParametricGeometry"||e.userData.type==="SubdivGeometry"){if(e.userData.type==="SubdivGeometry")if(pu.isPublish)e=au.create({geometry:e.clone()}),e.userData.parameters.subdivisions===0&&(delete e.attributes.color,delete e.attributes.faceMap,delete e.attributes.positionWASM,delete e.attributes.indexWASM,delete e.attributes.verticesPerFaceWASM);else{let n=e.originalGeometry;if(n){let s=e.userData;e=n.clone(),e.userData=s}else e=e.clone();delete e.attributes.color,delete e.attributes.faceMap,delete e.attributes.position,delete e.attributes.normal,e.index=null}let r=e.originalGeometry;if(r!==void 0){let n=e.userData;e=r,e.userData=n}if(!pu.isPublish)i[e.uuid]=e.toJSON();else{let n={type:"NonParametricGeometry",uuid:e.uuid,userData:{}};e.name!==""&&(n.name=e.name),Object.keys(e.userData).length>0&&(n.userData=U({},e.userData));let s=e.index===null,l=new ND;if(Array.isArray(t))bv(e).forEach((f,h)=>{let p=new Lv(f,new _v);l.add(p),f.userData.groupIndex=h,f.userData.materialIndex=e.groups[h].materialIndex,f.index===null&&(s=!0)});else{let c=new Lv(e,new _v);l.add(c)}pu.gltfQueue.push(new Promise(async c=>{await Promise.all(pu.gltfQueue),LD.parse(l,async f=>{let{gltfTransform:h,DracoMeshCompressionExtension:p,addIndex:y}=await Sv,g=h.readJSON({json:yo(f),resources:{}});g.createExtension(p).setRequired(!0).setEncoderOptions({quantizationVolume:"scene"}),s&&await g.transform(y);try{let{json:w,resources:S}=h.writeJSON(g),T=Tv.default.fromByteArray(new Uint8Array(S[".bin"]));w.buffers[0].uri=`data:application/octet-stream;base64,${T}`,c()}catch(w){c()}},{})})),i[e.uuid]=n}}else{let r=e.userData;if(r.type==="VectorGeometry"){let n=e.userData.shape;r=Object.assign({},r,{shape:n.toJSON()})}i[e.uuid]={uuid:e.uuid,userData:r}}return e.uuid}function Os(i){let e=[];for(let t in i){let r=i[t];delete r.metadata,e.push(r)}return e}function Mv(i){let e=[];for(let t in i)e.push(i[t]);return e}var mu=i=>class extends i{hasEntityChild(){return this.children.some(t=>fu(t))}isDescendantOf(t){t instanceof _D&&(t=t.uuid);let r=this;for(;r.parent;){if(r.parent.uuid===t)return!0;r=r.parent}return!1}attach(t,r){this.updateWorldMatrix(!0,!1);let n=new TD().copy(this.matrixWorld).invert();return t.parent!==null&&(t.parent.updateWorldMatrix(!0,!1),n.multiply(t.parent.matrixWorld)),fu(t)?t.hiddenMatrix.premultiply(n):t.applyMatrix4(n),t.updateWorldMatrix(!1,!1),this.add(t),r!==void 0&&(this.children.pop(),this.children.splice(r,0,t)),this}copy(t,r=!0){if(this.name=t.name,this.up.copy(t.up),this.position.copy(t.position),this.rotation.order=t.rotation.order,this.quaternion.copy(t.quaternion),this.scale.copy(t.scale),this.matrix.copy(t.matrix),this.matrixWorld.copy(t.matrixWorld),this.matrixAutoUpdate=t.matrixAutoUpdate,this.matrixWorldNeedsUpdate=t.matrixWorldNeedsUpdate,this.layers.mask=t.layers.mask,this.visible=t.visible,this.castShadow=t.castShadow,this.receiveShadow=t.receiveShadow,this.frustumCulled=t.frustumCulled,this.renderOrder=t.renderOrder,this.userData=JSON.parse(JSON.stringify(t.userData)),r===!0)for(let n=0;n<t.children.length;n++){let s=t.children[n];this.add(s.clone())}return this}toJSON(t){let r=t===void 0,n={object:{uuid:"",objectType:""}};t===void 0&&(t={geometries:{},materials:{},textures:{},images:{},interactionStates:{},nodes:{}},n.metadata={version:1.5,type:"Object",generator:"Object3D.toJSON"});let s={uuid:this.uuid,objectType:this.type};if(this.name!==""&&(s.name=this.name),s.matrix=this.matrix.toArray(),this.castShadow===!0&&(s.castShadow=!0),this.receiveShadow===!0&&(s.receiveShadow=!0),this.visible===!1&&(s.visible=!1),this.frustumCulled===!1&&(s.frustumCulled=!1),this.renderOrder!==0&&(s.renderOrder=this.renderOrder),s.layers=this.layers.mask,JSON.stringify(this.userData)!=="{}"&&(s.userData=this.userData),this.children.length>0){s.children=[];for(let l of this.children)(fu(l)||l instanceof ID)&&s.children.push(l.toJSON(t).object)}if(r){let l=Os(t.geometries),c=Os(t.materials),f=Os(t.textures),h=Os(t.images),p=Os(t.interactionStates),y=Mv(t.nodes);l.length>0&&(n.geometries=l),c.length>0&&(n.materials=c),f.length>0&&(n.textures=f),h.length>0&&(n.images=h),p.length>0&&(n.interactionStates=p),y.length>0&&(n.nodes=y)}return n.object=s,n}fromJSON(t){return this.uuid=t.uuid,t.name!==void 0&&(this.name=t.name),t.matrix!==void 0?(this.matrix.fromArray(t.matrix),t.matrixAutoUpdate!==void 0&&(this.matrixAutoUpdate=t.matrixAutoUpdate),this.matrixAutoUpdate&&this.matrix.decompose(this.position,this.quaternion,this.scale)):(t.position!==void 0&&this.position.fromArray(t.position),t.rotation!==void 0&&this.rotation.fromArray(t.rotation),t.quaternion!==void 0&&this.quaternion.fromArray(t.quaternion),t.scale!==void 0&&this.scale.fromArray(t.scale)),this.castShadow=t.castShadow!==void 0,this.receiveShadow=t.receiveShadow!==void 0,t.visible!==void 0&&(this.visible=t.visible),t.frustumCulled!==void 0&&(this.frustumCulled=t.frustumCulled),t.renderOrder!==void 0&&(this.renderOrder=t.renderOrder),t.layers!==void 0&&(this.layers.mask=t.layers),t.userData!==void 0&&(this.userData=t.userData),this}};var xn=i=>"isEntity"in i;var vn=i=>class extends mu(i){constructor(){super(...arguments);this.objectType="";this.isEntity=!0;this.raycastLock=!1;this.scaleLock=!1;this.hiddenMatrix=new ad;this._singleBBox=new hu;this._recursiveBBox=new hu;this.singleBBoxNeedsUpdate=!0;this.recursiveBBoxNeedsUpdate=!0;this.forceComputeSize=!1}set visibility(t){this.visible=t;for(let r of this.children)xn(r)&&r.traverseEntity(n=>{Si(n)&&n.visible&&(n.objectHelper.visible=t)})}get visibility(){return this.visible}get singleBBox(){return this.singleBBoxNeedsUpdate&&(this.singleBBoxNeedsUpdate=!1,this._singleBBox.setFromObjectSize(this,!1),this._singleBBox.computeVertices(),this._singleBBox.computeEdges(),this._singleBBox.computeFaces()),this._singleBBox}get recursiveBBox(){return this.recursiveBBoxNeedsUpdate&&(this.recursiveBBoxNeedsUpdate=!1,this._recursiveBBox.setFromObjectSize(this,!0),this._recursiveBBox.computeVertices(),this._recursiveBBox.computeEdges(),this._recursiveBBox.computeFaces()),this._recursiveBBox}resetBBoxNeedsUpdate(){this.singleBBoxNeedsUpdate=!0,this.recursiveBBoxNeedsUpdate=!0,this.traverseAncestors(t=>{xn(t)&&(t.singleBBoxNeedsUpdate=!0,t.recursiveBBoxNeedsUpdate=!0)}),this.traverseEntity(t=>{t.singleBBoxNeedsUpdate=!0,t.recursiveBBoxNeedsUpdate=!0})}traverseEntity(t){t(this);for(let r of this.children)xn(r)&&r.traverseEntity(t)}updateMatrixWorld(t){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||t)&&(this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,t=!0);for(let r of this.children)r.updateMatrixWorld(t)}updateWorldMatrix(t,r){let n=this.parent;if(t&&n!==null&&n.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.parent===null?this.matrixWorld.multiplyMatrices(this.hiddenMatrix,this.matrix):(this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.hiddenMatrix),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.matrix)),r)for(let s of this.children)s.updateWorldMatrix(!1,!0)}shallowClone(t){return new this.constructor().shallowCopy(this,t)}shallowCopy(t,r=!0){if(super.copy(t,!1),this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),r===!0)for(let n of t.children)xn(n)&&this.add(n.shallowClone());return this}clone(t){return new this.constructor().copy(this,t)}copy(t,r=!0){if(super.copy(t,!1),this.raycastLock=t.raycastLock,this.scaleLock=t.scaleLock,this.hiddenMatrix.copy(t.hiddenMatrix),r===!0)for(let n of t.children)xn(n)&&this.add(n.clone());return this}keepChildrenMatrixWorld(){let t=new ad,r=this.matrixWorld.clone();this.updateWorldMatrix(!1,!1),t.copy(this.matrixWorld).invert(),t.multiply(r);for(let n of this.children)xn(n)&&n.hiddenMatrix.premultiply(t)}toJSON(t){let r=super.toJSON(t),n=r.object;return this.raycastLock===!0&&(n.raycastLock=!0),this.scaleLock===!0&&(n.scaleLock=!0),n.hiddenMatrix=this.hiddenMatrix.toArray(),r}fromJSON(t){return super.fromJSON(t),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.scaleLock!==void 0&&(this.scaleLock=t.scaleLock),this.hiddenMatrix.fromArray(t.hiddenMatrix),this}fromObject3D(t){let r=t.children;return t.children=[],Object.assign(t,{raycastLock:!1,scaleLock:!1,hiddenMatrix:new ad}),this.copy(t),t.children=r,this}toObjectTransformState(t=[]){this.updateWorldMatrix(!0,!1);let r={position:this.position.toArray(),rotation:[this.rotation.x,this.rotation.y,this.rotation.z],scale:this.scale.toArray(),hiddenMatrix:this.hiddenMatrix.toArray()};return ms(r,t)}fromObjectTransformState(t){return t.position&&this.position.fromArray(t.position),t.rotation&&this.rotation.fromArray(t.rotation),t.scale&&this.scale.fromArray(t.scale),t.hiddenMatrix&&this.hiddenMatrix.fromArray(t.hiddenMatrix),this.updateMatrix(),this}toState(t=[]){let r=U({name:this.name,visible:this.visible,raycastLock:this.raycastLock},this.toObjectTransformState(t));return ms(r,t)}fromState(t,r){return t.name&&(this.name=t.name),t.raycastLock!==void 0&&(this.raycastLock=t.raycastLock),t.type!=="OrthographicCamera"&&t.type!=="PerspectiveCamera"&&(this.matrixAutoUpdate=!1),t.visible!==void 0&&(this.visibility=t.visible),this.fromObjectTransformState(t),this}};import{Object3D as MD,Vector3 as Ma,Euler as Av,MathUtils as Ki}from"three";var gu=class extends MD{constructor(e,t={}){super();this.object=e;let r=e.recursiveBBox.getSize(new Ma),n=.1;this.parameters=xc.defaultData(r.toArray(),n),xo(this.parameters,t),this.update(),this.setHideBase(this.parameters.hideBase)}refreshMaterial(){if("material"in this.object)for(let e of this.children)e.material=this.object.material}setHideBase(e){if("material"in this.object){if(Array.isArray(this.object.material)){if(this.children.length>0){for(let t of this.object.material)t.visible=!0;if(e){let t=this.object.material.map(r=>r.clone());for(let r of this.children)r.material=t}else for(let t of this.children)t.material=this.object.material}for(let t of this.object.material)t.visible=!e}else{if(this.children.length>0)if(this.object.material.visible=!0,e){let t=this.object.material.clone();for(let r of this.children)r.material=t}else for(let t of this.children)t.material=this.object.material;this.object.material.visible=!e}this.parameters.hideBase=e}}update(){switch(this._updateCount(),this.parameters.type){case"radial":this._updateRadial(this.parameters);break;case"linear":this._updateLinear(this.parameters);break;case"grid":this._updateGrid(this.parameters)}this.children.forEach(e=>e.updateMatrix())}_updateCount(){let e=this.parameters.type==="grid"?this.parameters.grid.count[0]*this.parameters.grid.count[1]*this.parameters.grid.count[2]:this.parameters.count;if(this.children.length!==e)if(this.children.length<e)for(let t=0,r=e-this.children.length;t<r;++t){let n=this.object.shallowClone(!1);n.visible=!0,this.add(n),this.parameters.hideBase&&this.setHideBase(!0)}else for(let t=0,r=this.children.length-e;t<r;++t)this.remove(this.children[0])}_updateRadial(e){let t=e.radial,r=t.start*Ki.DEG2RAD,n=t.end*Ki.DEG2RAD,s=r-n,l=new Av(t.rotation[0]*Ki.DEG2RAD,t.rotation[1]*Ki.DEG2RAD,t.rotation[2]*Ki.DEG2RAD),c;switch(t.axis){case"z":c=new Ma(0,0,1);break;case"y":c=new Ma(0,1,0);break;default:case"x":c=new Ma(1,0,0);break}for(let[f,h]of this.children.entries()){h.hiddenMatrix.identity(),h.scale.x=t.scale[0]+1,h.scale.y=t.scale[1]+1,h.scale.z=t.scale[2]+1,h.position.setScalar(0);let p=s/e.count*f-r;switch(t.axis){case"x":h.rotation.set(0,p,0);break;case"y":h.rotation.set(0,0,p);break;case"z":h.rotation.set(p,0,0);break}h.translateOnAxis(c,t.radius),h.position.x+=t.position[0],h.position.y+=t.position[1],h.position.z+=t.position[2],t.alignment===!0?(h.rotation.x+=l.x,h.rotation.y+=l.y,h.rotation.z+=l.z):h.rotation.copy(l)}}_updateLinear(e){if(e.type!=="linear")throw new Error;let t=e.linear,r=new Av(t.rotation[0]*Ki.DEG2RAD,t.rotation[1]*Ki.DEG2RAD,t.rotation[2]*Ki.DEG2RAD);for(let[n,s]of this.children.entries())s.hiddenMatrix.identity(),s.scale.x=t.scale[0]*n+1,s.scale.y=t.scale[1]*n+1,s.scale.z=t.scale[2]*n+1,s.rotation.x=r.x*n,s.rotation.y=r.y*n,s.rotation.z=r.z*n,s.position.x=t.position[0]*n,s.position.y=t.position[1]*n,s.position.z=t.position[2]*n}_updateGrid(e){let t=0,r=e.grid;if(r.useCenter===!0){let n={x:r.count[0]%2==0?2:1,y:r.count[1]%2==0?2:1,z:r.count[2]%2==0?2:1},s=new Ma(r.size[0]*(r.count[0]-n.x)*.5,r.size[1]*(r.count[1]-n.y)*.5,r.size[2]*(r.count[2]-n.z)*.5);for(let l=0;l<r.count[0];l++)for(let c=0;c<r.count[1];c++)for(let f=0;f<r.count[2];f++){let h=this.children[t++];h.hiddenMatrix.identity(),h.scale.setScalar(1),h.rotation.set(0,0,0),h.position.x=r.size[0]*l-s.x,h.position.y=r.size[1]*c-s.y,h.position.z=r.size[2]*f-s.z}}else for(let n=0;n<r.count[0];n++)for(let s=0;s<r.count[1];s++)for(let l=0;l<r.count[2];l++){let c=this.children[t++];c.hiddenMatrix.identity(),c.scale.setScalar(1),c.rotation.set(0,0,0),c.position.x=r.size[0]*n,c.position.y=-r.size[1]*s,c.position.z=-r.size[2]*l}}fromJSON(e){return this}toJSON(){return{}}fromClonerState(e){return e.hideBase!==void 0&&this.setHideBase(e.hideBase),xo(this.parameters,e),this.update(),this}};var hr=class extends vn(AD){constructor(e,t){super(e,t);this.isAbstractMesh=!0;Array.isArray(t)&&(this.selectedMaterial=0,e.groups.length===0&&e.addGroup(0,e.getAttribute("position").count,0))}get cloner(){return this._cloner}set cloner(e){this._cloner&&this.remove(this._cloner),e&&this.add(e),this._cloner=e}getSelectedMaterial(e){return Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=e!=null?e:0),this.material[e!=null?e:this.selectedMaterial]):this.material}setSelectedMaterial(e,t){Array.isArray(this.material)?(this.selectedMaterial===void 0&&(this.selectedMaterial=t!=null?t:0),t=t!=null?t:this.selectedMaterial,this.material[t].dispose(),this.material[t]=e):(this.material.dispose(),this.material=e)}updateGeometry(e){let t=this.geometry,r=rd[t.userData.type],n=this.objectType==="NonParametric"?Object.assign({},t.userData,{geometry:t}):t.userData,s=r.build(r.normalizeInputs(e,n)),l=t.uuid;if(this.geometry.dispose(),this.geometry=s,this.geometry.uuid=l,this.geometry.computeBoundingSphere(),this.cloner)for(let c of this.cloner.children)c.geometry=this.geometry}resizeGeometry(e,t,r){Ta.resizeGeometry(this.geometry,{width:e,height:t,depth:r})}shallowClone(e){return new this.constructor(this.geometry,this.material).shallowCopy(this,e)}clone(e){let t=this.objectType==="NonParametric"?Object.assign({},this.geometry.userData,{geometry:this.geometry.clone()}):this.geometry.userData,r=Ia(t),n=Array.isArray(this.material)?this.material.map(s=>s.clone()):this.material.clone();return new this.constructor(r,n).copy(this,e)}copy(e,t=!0){return super.copy(e,t),e.cloner&&(this.cloner=new gu(e,e.cloner.parameters),this.add(this.cloner)),this}toJSON(e){let t=super.toJSON(e),r=t.object;if(r.geometry=Iv(e.geometries,this.geometry,this.material),Array.isArray(this.material)){let n=[];for(let s=0,l=this.material.length;s<l;s++)n.push(sd(e.materials,this.material[s],e));r.material=n}else r.material=sd(e.materials,this.material,e);return t}fromJSON(e){return super.fromJSON(e),e.selectedMaterial!==void 0&&(this.selectedMaterial=e.selectedMaterial),this}setFromClonerState(e){e===null?this.cloner=void 0:(this.cloner===void 0&&(this.cloner=new gu(this)),this.cloner.fromClonerState(e))}fromState(e,t){var r,n;return super.fromState(e),e.type==="Mesh"&&(this.setFromClonerState(e.cloner),this.castShadow=(r=e.castShadow)!=null?r:!0,this.receiveShadow=(n=e.receiveShadow)!=null?n:!0),this}};import{NormalBlending as YD,ShaderMaterial as QD,FrontSide as e3}from"three";import{CubeReflectionMapping as UD,CubeRefractionMapping as kD,CubeUVReflectionMapping as HD,CubeUVRefractionMapping as WD,LinearEncoding as jv,sRGBEncoding as qD}from"three";var yu=class{constructor(e){e=e!=null?e:{},this.name=e.name,this.type=e.type,this.node=e.node,this.size=e.size,this.needsUpdate=e.needsUpdate}get value(){return this.node.value}set value(e){this.node.value=e}};import{MathUtils as OD}from"three";var Pe=class{constructor(e){this.hashProperties=void 0;this.isNode=!0;this.shortcuts={};this.uuid=OD.generateUUID(),this.type=e,this.name="",this.userData={}}analyze(e,t){t=t!=null?t:{},e.analyzing=!0,this.build(e.addFlow(t.slot,t.cache,t.context),"v4"),e.clearVertexNodeCode(),e.clearFragmentNodeCode(),e.removeFlow(),e.analyzing=!1}analyzeAndFlow(e,t,r){return r=r!=null?r:{},this.analyze(e,r),this.flow(e,t,r)}flow(e,t,r){r=r!=null?r:{},e.addFlow(r.slot,r.cache,r.context);let n={result:this.build(e,t),code:e.clearNodeCode(),extra:e.context.extra};return e.removeFlow(),n}build(e,t,r){t=t!=null?t:this.getType(e,t);let n=e.getNodeData(r!=null?r:this);return e.analyzing&&this.appendDepsNode(e,n,t),e.nodes.indexOf(this)===-1&&e.nodes.push(this),this.updateFrame!==void 0&&e.updaters.indexOf(this)===-1&&e.updaters.push(this),this.generate(e,t,r)}updateFrame(e){}generateReadonly(e,t,r,n,s,l){return""}generate(e,t,r,n,s){return""}parse(e,t,r,n){}appendDepsNode(e,t,r){t.deps=(t.deps||0)+1;let n=e.getTypeLength(r);(n>(t.outputMax||0)||this.getType(e,r))&&(t.outputMax=n,t.output=r)}setName(e){this.name=e}getName(){return this.name}getType(e,t){return t==="sampler2D"||t==="samplerCube"?t:this.type}getJSONNode(e){if((e==null?void 0:e.materials)&&(e==null?void 0:e.materials[this.uuid])!==void 0)return e.materials[this.uuid]}getHash(){let e="{",t,r;for(t in this)r=this[t],r instanceof Pe&&(e+='"'+t+'":'+r.getHash()+",");if(this.hashProperties)for(let n=0;n<this.hashProperties.length;n++)t=this.hashProperties[n],r=this[t],e+='"'+t+'":"'+String(r)+'",';return e+='"id":"'+this.uuid+'"}',e}copy(e){return this.name=e.name,e.type&&(this.type=e.type),e.frameId&&(this.frameId=e.frameId),e.hashProperties&&(this.hashProperties=e.hashProperties.map(t=>t)),this.userData=JSON.parse(JSON.stringify(e.userData)),this.shortcuts=JSON.parse(JSON.stringify(e.shortcuts)),this}clone(){return new this.constructor().copy(this)}createJSONNode(e){let t=e===void 0||typeof e=="string";if(typeof this.type!="string")throw new Error("Node does not allow serialization.");let r={};return r.uuid=this.uuid,r.type=this.type,this.name!==""&&(r.name=this.name),JSON.stringify(this.userData)!=="{}"&&(r.userData=this.userData),!t&&e&&(e.nodes[this.uuid]=r),r}toJSON(e){var t;return(t=this.getJSONNode(e))!=null?t:this.createJSONNode(e)}fromJSON(e,t){return this.uuid=e.uuid,this.type=e.type,e.name&&(this.name=e.name),e.userData&&(this.userData=e.userData),this}};var Ov=class{constructor(){this.nodes={};this.keywords={}}add(e){this.nodes[e.name]=e}addKeyword(e,t,r){r=r!==void 0?r:!0,this.keywords[e]={callback:t,cache:r}}remove(e){delete this.nodes[e.name]}removeKeyword(e){delete this.keywords[e]}get(e){return this.nodes[e]}getKeyword(e,t){return this.keywords[e].callback(t)}getKeywordData(e){return this.keywords[e]}contains(e){return this.nodes[e]!==void 0}containsKeyword(e){return this.keywords[e]!==void 0}},tr=new Ov;import{Vector2 as Pv}from"three";import{MathUtils as PD}from"three";var Be=class extends Pe{constructor(e,t){super(e);this.scope="";t=t!=null?t:{},this.shared=t.shared!==void 0?t.shared:!0,this.unique=t.unique!==void 0?t.unique:!1}build(e,t,r,n){if(t=t!=null?t:this.getType(e),this.getShared(e,t)){let s=this.getUnique(e,t);s&&this.uuid===void 0&&(this.uuid=PD.generateUUID()),r=e.getUUID(r!=null?r:this.getUUID(),!s);let l=e.getNodeData(r),c=l.output||this.getType(e);if(e.analyzing)return(l.deps||0)>0||this.getLabel()?(this.appendDepsNode(e,l,t),this.generate(e,t,r)):super.build(e,t,r);if(s)return l.name=l.name||super.build(e,t,r),l.name;if(!this.getLabel()&&(!this.getShared(e,c)||e.context.ignoreCache||l.deps===1))return super.build(e,t,r);r=this.getUUID(!1);let f=this.getTemp(e,r);if(f)return e.format(f,c,t);{f=super.generate(e,t,r,l.output,n);let h=this.generate(e,c,r);return e.addNodeCode(f+" = "+h+";"),e.format(f,c,t)}}return super.build(e,t,r)}getShared(e,t){return t!=="sampler2D"&&t!=="samplerCube"&&this.shared}getUnique(e,t){return this.unique}setLabel(e){return this.label=e,this}getLabel(){return this.label}getUUID(e){let t=this.uuid;return typeof this.scope=="string"&&(t=this.scope+"-"+t),t}getTemp(e,t){t=t||this.uuid;let r=e.getVars()[t];return r?r.name:void 0}generate(e,t,r,n,s){return this.getShared(e,t)||console.error("TempNode is not shared"),r=r!=null?r:this.uuid,e.getTempVar(r,n!=null?n:this.getType(e),s,this.getLabel()).name}};var It=class extends Be{constructor(e,t){t=t!=null?t:{},t.shared=t.shared!==void 0?t.shared:!1;super(e,t);this.readonly=!1}setReadonly(e){return this.readonly=e,this.hashProperties=this.readonly?["value"]:void 0,this}getReadonly(){return this.readonly}createJSONNode(e){let t=super.createJSONNode(e);return this.readonly===!0&&(t.readonly=this.readonly),t}fromJSON(e,t){return super.fromJSON(e,t),e.readonly!==void 0&&this.setReadonly(e.readonly),this}generate(e,t,r,n,s,l){r=e.getUUID(r!=null?r:this.getUUID()),n=n!=null?n:this.getType(e);let c=e.getNodeData(r);return this.getReadonly()&&this.generateReadonly!==void 0?this.generateReadonly(e,t,r,n,s,l):e.isShader("vertex")?(c.vertex||(c.vertex=e.createVertexUniform(n,this,s,l,this.getLabel())),e.format(c.vertex.name,n,t)):(c.fragment||(c.fragment=e.createFragmentUniform(n,this,s,l,this.getLabel())),e.format(c.fragment.name,n,t))}copy(e){return super.copy(e),this.readonly=e.readonly,this}};var _r=class extends It{constructor(e=0,t){super("v2");this.nodeType="Vector2";this.value=e instanceof Pv?e:new Pv(e,t)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}generateReadonly(e,t,r,n,s,l){return e.format("vec2("+this.value.x+", "+this.value.y+")",n,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}};import{Vector3 as Dv}from"three";var Tr=class extends It{constructor(e=0,t,r){super("v3");this.nodeType="Vector3";this.value=e instanceof Dv?e:new Dv(e,t,r)}get x(){return this.value.x}set x(e){this.value.x=e}get y(){return this.value.y}set y(e){this.value.y=e}get z(){return this.value.z}set z(e){this.value.z=e}generateReadonly(e,t,r,n,s,l){return e.format("vec3("+this.value.x+", "+this.value.y+", "+this.value.z+")",n,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}};var Xi=class extends It{constructor(e){super("v4");this.nodeType="Vector4";this.value=e instanceof tn?e:new tn(e.r,e.g,e.b,e.a)}generateReadonly(e,t,r,n,s,l){return e.format("vec4("+this.value.r+", "+this.value.g+", "+this.value.b+", "+this.value.a+")",n,t)}copy(e){return super.copy(e),this.value.copy(e.value),this}};var DD=/^\s*([a-z_0-9]+)\s([a-z_0-9]+)\s*\((.*?)\)/i,Bv=/[a-z_0-9]+/gi,Se=class extends Be{constructor(e,t,r,n,s){super(s);this.src="";this.nodeType="Function";this.useKeywords=!0;this.includes=[];this.extensions={};this.keywords={};this.isMethod=s===void 0,this.isInterface=!1,this.parse(e,t,r,n)}getShared(e,t){return!this.isMethod}getType(e){return e.getTypeByFormat(this.type)}getInputByName(e){if(this.inputs){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}}getIncludeByName(e){if(this.includes){let t=this.includes.length;for(;t--;)if(this.includes[t].name===e)return this.includes[t]}}generate(e,t,r,n,s){let l,c=0,f=this.src;if(this.includes)for(let p=0;p<this.includes.length;p++)e.include(this.includes[p],this);for(let p in this.extensions)e.extensions[p]=!0;let h=[];for(;l=Bv.exec(this.src);)h.push(l);for(let p=0;p<h.length;p++){let y=h[p],g=y[0],w=this.isMethod?!this.getInputByName(g):!0,S=g;if(this.keywords[g]||this.useKeywords&&w&&tr.containsKeyword(g)){let T=this.keywords[g];if(!T){let C=tr.getKeywordData(g);C.cache&&(T=e.keywords[g]),T=T||tr.getKeyword(g,e),C.cache&&(e.keywords[g]=T)}S=T.build(e)}g!==S&&(f=f.substring(0,y.index+c)+S+f.substring(y.index+g.length+c),c+=S.length-g.length),this.getIncludeByName(S)===void 0&&tr.contains(S)&&e.include(tr.get(S))}return t==="source"?f:this.isMethod?(this.isInterface||e.include(this,void 0,f),this.name):e.format("( "+f+" )",this.getType(e),t)}parse(e,t,r,n){if(this.src=e||"",this.includes=t!=null?t:[],this.extensions=r!=null?r:{},this.keywords=n!=null?n:{},this.isMethod){let s=DD.exec(this.src);if(this.inputs=[],s&&s.length==4){this.type=s[1],this.name=s[2];let l=s[3].match(Bv);if(l){let c=0;for(;c<l.length;){let f=l[c++],h;f==="in"||f==="out"||f==="inout"?h=l[c++]:(h=f,f="");let p=l[c++];this.inputs.push({name:p,type:h,qualifier:f})}}this.isInterface=this.src.indexOf("{")===-1}else this.type="",this.name=""}}copy(e){return super.copy(e),this.isMethod=e.isMethod,this.useKeywords=e.useKeywords,e.type!==void 0&&(this.type=e.type),this.parse(e.src,e.includes,e.extensions,e.keywords),this}toJSON(e){var r;let t=this.getJSONNode(e);if(!t){t=this.createJSONNode(e),t.src=this.src,t.isMethod=this.isMethod,t.useKeywords=this.useKeywords,this.isMethod||(t.type=this.type),t.extensions=JSON.parse(JSON.stringify(this.extensions));let n={};for(let s in this.keywords)n[s]=this.keywords[s].toJSON(e).uuid;if(t.keywords=n,(r=this.includes)==null?void 0:r.length){let s=[];for(let l=0;l<this.includes.length;l++)s.push(this.includes[l].toJSON(e).uuid);t.includes=s}t.isMethod=this.isMethod,t.inputs=this.inputs}return t.nodeType=this.nodeType,t}fromJSON(e,t){if(super.fromJSON(e,t),e.inputs!==void 0&&(this.inputs=e.inputs),e.isMethod!==void 0&&(this.isMethod=e.isMethod),e.src&&(this.src=e.src),e.isMethod&&(this.isMethod=e.isMethod),e.useKeywords&&(this.useKeywords=e.useKeywords),e.type&&(this.type=e.type),e.extensions&&(this.extensions=e.extensions),e.keywords&&t){this.keywords={};for(let r in e.keywords)this.keywords[r]=t.getNode(e.keywords[r])}return e.includes&&t&&(this.includes=e.includes.map(r=>t.getNode(r))),this}};var BD=/^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=?\s?(.*?)(\;|$)/i,ld=class extends Be{constructor(e="",t){super();this.src="";this.useDefine=!1;this.nodeType="Const";this.parse(e||ld.PI,void 0,void 0,void 0,t)}getType(e){return e.getTypeByFormat(this.type)}parse(e,t,r,n,s){this.src=e||"";let l,c,f="",h=BD.exec(e);this.useDefine=s!=null?s:this.src.charAt(0)==="#",h&&h.length>1?(c=h[1],l=h[2],f=h[3]):(l=this.src,c="f"),this.name=l,this.type=c,this.value=f}build(e,t){if(t==="source"){if(this.value)return this.useDefine?"#define "+this.name+" "+this.value:"const "+this.type+" "+this.name+" = "+this.value+";";if(this.useDefine)return this.src}return e.include(this),e.format(this.name,this.getType(e),t)}generate(e,t,r,n,s){return e.format(this.name,this.getType(e),t)}copy(e){return super.copy(e),this.parse(e.src,void 0,void 0,void 0,e.useDefine),this}},it=ld;it.PI="PI",it.PI2="PI2",it.RECIPROCAL_PI="RECIPROCAL_PI",it.RECIPROCAL_PI2="RECIPROCAL_PI2",it.LOG2="LOG2",it.EPSILON="EPSILON";var GD=new RegExp(`^structs*([a-z_0-9]+)s*{s*((.|
|
|
21
|
+
)*?)}`,"gim"),jD=new RegExp("s*(w*?)s*(w*?)(=|;)","gim"),Aa=class extends Be{constructor(e=""){super();this.inputs=[];this.src="";this.nodeType="Struct";this.parse(e)}getType(e){return e.getTypeByFormat(this.name)}getInputByName(e){let t=this.inputs.length;for(;t--;)if(this.inputs[t].name===e)return this.inputs[t]}generate(e,t,r,n,s){return t==="source"?this.src+";":e.format("( "+this.src+" )",this.getType(e),t)}parse(e=""){this.src=e,this.inputs=[];let t=GD.exec(e);if(t){let r=t[2],n;for(;n=jD.exec(r);)this.inputs.push({type:n[1],name:n[2]});this.name=t[1]}else this.name="";this.type=this.name}};var Oa=class extends Be{constructor(e){super("v2",{shared:!1});this.nodeType="UV";this.index=e!=null?e:0}generate(e,t){e.requires.uv[this.index]=!0;let r=this.index>0?this.index+1:"",n=e.isShader("vertex")?"uv"+r:"vUv"+r;return e.format(n,this.getType(e),t)}copy(e){return super.copy(e),this.index=e.index,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.index=this.index),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.index&&(this.index=e.index),this}};tr.addKeyword("uv",function(){return new Oa});tr.addKeyword("uv2",function(){return new Oa(1)});import{LinearEncoding as ED,sRGBEncoding as RD}from"three";var _o=class extends Be{constructor(e=new Pe,t){super("v4");this.nodeType="ColorSpace";this.factor=new Pe;this.input=e,this.method=t!=null?t:_o.LINEAR_TO_LINEAR,this.hashProperties=["method"]}static getEncodingComponents(e){switch(e){case ED:return["Linear"];case RD:return["sRGB"];default:return[]}}generate(e,t){var c;let r=this.input.build(e,"v4"),n=this.getType(e),s=_o.Nodes[this.method],l=e.include(s);if(l===_o.LINEAR_TO_LINEAR)return e.format(r,n,t);if(((c=s.inputs)==null?void 0:c.length)===2){let f=this.factor.build(e,"f");return e.format(l+"( "+r+", "+f+" )",n,t)}else return e.format(l+"( "+r+" )",n,t)}fromEncoding(e){let t=_o.getEncodingComponents(e);this.method="LinearTo"+t[0],this.factor=t[1]}fromDecoding(e){let t=_o.getEncodingComponents(e);this.method=t[0]+"ToLinear",this.factor=t[1]}copy(e){return super.copy(e),this.input.copy(e.input),this.method=e.method,this.factor.copy(e.factor),this}},zr=_o;zr.Nodes={LinearToLinear:new Se(["vec4 LinearToLinear( in vec4 value ) {"," return value;","}"].join(`
|
|
22
|
+
`)),sRGBToLinear:new Se(["vec4 sRGBToLinear( in vec4 value ) {"," return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );","}"].join(`
|
|
23
|
+
`)),LinearTosRGB:new Se(["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.w );","}"].join(`
|
|
24
|
+
`))},zr.LINEAR_TO_LINEAR="LinearToLinear",zr.SRGB_TO_LINEAR="sRGBToLinear",zr.LINEAR_TO_SRGB="LinearTosRGB";var xt=class extends Se{constructor(e="",t,r,n,s){super(e,s,n,r,t);this.nodeType="Expression"}};import{Texture as zD}from"three";var wi=class extends zD{toJSON(e){let t=super.toJSON(e),r=e===void 0||typeof e=="string";if(this.image!==void 0&&!r){let n=this.image;if(Array.isArray(n)){e.images[n.uuid].url=[];for(let s=0;s<n.length;s++)e.images[n.uuid].url[s]=Gv(n[s])}else e.images[n.uuid].url=Gv(n)}return t}};function Gv(i){return typeof HTMLImageElement!="undefined"&&i instanceof HTMLImageElement||typeof HTMLCanvasElement!="undefined"&&i instanceof HTMLCanvasElement||typeof ImageBitmap!="undefined"&&i instanceof ImageBitmap?FD(i):(console.warn("THREE.Texture: Unable to serialize Texture."),"")}var Ps;function FD(i){if(/^data:/i.test(i.src))return i.src;let e;if(i instanceof HTMLCanvasElement)e=i;else{Ps===void 0&&(Ps=document.createElement("canvas")),Ps.width=i.width,Ps.height=i.height;let r=Ps.getContext("2d");i instanceof ImageData?r.putImageData(i,0,0):r.drawImage(i,0,0,i.width,i.height),e=Ps}let t=i.src.startsWith("blob:")?i.fileName:i.src;return/\.jpe?g$/i.test(t)?e.toDataURL("image/jpeg",.6):e.toDataURL("image/png")}var Fr=class extends It{constructor(e=new wi,t,r,n){super("v4",{shared:!0});this.nodeType="Texture";this.value=e,this.uv=t!=null?t:new Oa,this.bias=r,this.project=n!==void 0?n:!1}getTexture(e,t){return super.generate(e,t,this.value.uuid,"t")}generate(e,t){var p;if(t==="sampler2D")return this.getTexture(e,t);let r=this.getTexture(e,t),n=this.uv.build(e,this.project?"v4":"v2"),s=this.bias?this.bias.build(e,"f"):void 0;s===void 0&&e.context.bias&&(s=e.context.bias.setTexture(this).build(e,"f"));let l,c;this.project?l="texture2DProj":l=s?"tex2DBias":"tex2D",s?c=l+"( "+r+", "+n+", "+s+" )":c=l+"( "+r+", "+n+" )";let f={include:e.isShader("vertex"),ignoreCache:!0},h=this.getType(e);return e.addContext(f),this.colorSpace=(p=this.colorSpace)!=null?p:new zr(new xt("",h)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(c),c=this.colorSpace.build(e,h),e.removeContext(),e.format(c,h,t)}copy(e){return super.copy(e),e.value.isRenderTargetTexture?this.value=e.value:this.value.copy(e.value),this.uv.copy(e.uv),e.bias?this.bias?this.bias.copy(e.bias):this.bias=e.bias.clone():this.bias=void 0,e.colorSpace?this.colorSpace?this.colorSpace.copy(e.colorSpace):this.colorSpace=e.colorSpace.clone():this.colorSpace=void 0,this.project=e.project,e.value.isRenderTargetTexture||(this.value.updateMatrix(),this.value.needsUpdate=!0),this}};var ve=class extends It{constructor(e){super("f");this.nodeType="Float";this.value=e!=null?e:0}generateReadonly(e,t,r,n,s,l){return e.format(this.value+(this.value%1?"":".0"),n,t)}copy(e){return super.copy(e),this.value=e.value,this}};var xu=class extends Be{constructor(e,t){super();this.inputs=[];this.nodeType="FunctionCall";this.value=e,this.inputs=t!=null?t:[]}getFunction(){return this.value}getType(e){return this.value.getType(e)}generate(e,t,r,n,s){n=this.getType(e);let l=this.value,c=l.build(e,t)+"( ",f=[];if(l.inputs){for(let h=0;h<l.inputs.length;h++){let p=l.inputs[h],y=this.inputs[h]||this.inputs[p.name];f.push(y.build(e,e.getTypeByFormat(p.type)))}c+=f.join(", ")+" )"}return e.format(c,n,t)}copy(e){return super.copy(e),this.value.copy(e.value),this.inputs=e.inputs.map(t=>t.clone()),this}toJSON(e){var r;let t=this.getJSONNode(e);if(!t){let n=this.value;if(t=this.createJSONNode(e),t.value=this.value.toJSON(e).uuid,(r=n.inputs)==null?void 0:r.length){t.inputs={};for(let s=0;s<n.inputs.length;s++){let l=n.inputs[s],c=this.inputs[s];t.inputs[l.name]=c.toJSON(e).uuid}}}return t}};var Ds;(function(n){n.ADD="+",n.SUB="-",n.MUL="*",n.DIV="/"})(Ds||(Ds={}));var cd=class extends Be{constructor(e=new Pe,t=new Pe,r=cd.ADD){super();this.nodeType="Operator";this.type=e.type,this.a=e,this.b=t,this.op=r}getType(e){let t=this.a.getType(e),r=this.b.getType(e);return e.isTypeMatrix(t)?"v4":e.getTypeLength(r)>e.getTypeLength(t)?r:t}generate(e,t){let r=this.getType(e);this.type=r;let n=this.a.build(e,r),s=this.b.build(e,r);return e.format("( "+n+" "+this.op+" "+s+" )",r,t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b.copy(e.b),this.op=e.op,this}},rn=cd;rn.ADD=Ds.ADD,rn.SUB=Ds.SUB,rn.MUL=Ds.MUL,rn.DIV=Ds.DIV;var Ke;(function(_){_.RAD="radians",_.DEG="degrees",_.EXP="exp",_.EXP2="exp2",_.LOG="log",_.LOG2="log2",_.SQRT="sqrt",_.INV_SQRT="inversesqrt",_.FLOOR="floor",_.CEIL="ceil",_.NORMALIZE="normalize",_.FRACT="fract",_.SATURATE="saturate",_.SIN="sin",_.COS="cos",_.TAN="tan",_.ASIN="asin",_.ACOS="acos",_.ARCTAN="atan",_.ABS="abs",_.SIGN="sign",_.LENGTH="length",_.NEGATE="negate",_.INVERT="invert",_.MIN="min",_.MAX="max",_.MOD="mod",_.STEP="step",_.REFLECT="reflect",_.DISTANCE="distance",_.DOT="dot",_.CROSS="cross",_.POW="pow",_.MIX="mix",_.CLAMP="clamp",_.REFRACT="refract",_.SMOOTHSTEP="smoothstep",_.FACEFORWARD="faceforward"})(Ke||(Ke={}));var ht=class extends Be{constructor(e=new Pe,t=ht.ABS,r,n){super();this.nodeType="Math";this.a=e,typeof t!="string"?this.b=t:n=t,typeof r!="string"?this.c=r:n=r,this.method=n,this.hashProperties=["method"]}getNumInputs(e){switch(this.method){case ht.MIX:case ht.CLAMP:case ht.REFRACT:case ht.SMOOTHSTEP:case ht.FACEFORWARD:return 3;case ht.MIN:case ht.MAX:case ht.MOD:case ht.STEP:case ht.REFLECT:case ht.DISTANCE:case ht.DOT:case ht.CROSS:case ht.POW:return 2;default:return 1}}getInputType(e){let t=e.getTypeLength(this.a.getType(e)),r=this.b?e.getTypeLength(this.b.getType(e)):0,n=this.c?e.getTypeLength(this.c.getType(e)):0;return t>r&&t>n?this.a.getType(e):r>n?this.b.getType(e):this.c.getType(e)}getType(e){switch(this.method){case ht.LENGTH:case ht.DISTANCE:case ht.DOT:return"f";case ht.CROSS:return"v3"}return this.getInputType(e)}generate(e,t){let r,n,s,l=this.a?e.getTypeLength(this.a.getType(e)):0,c=this.b?e.getTypeLength(this.b.getType(e)):0,f=this.c?e.getTypeLength(this.c.getType(e)):0,h=this.getInputType(e),p=this.getType(e);switch(this.type=p,this.method){case ht.NEGATE:return e.format("( -"+this.a.build(e,h)+" )",h,t);case ht.INVERT:return e.format("( 1.0 - "+this.a.build(e,h)+" )",h,t);case ht.CROSS:r=this.a.build(e,"v3"),n=this.b.build(e,"v3");break;case ht.STEP:r=this.a.build(e,l===1?"f":h),n=this.b.build(e,h);break;case ht.MIN:case ht.MAX:case ht.MOD:r=this.a.build(e,h),n=this.b.build(e,c===1?"f":h);break;case ht.REFRACT:r=this.a.build(e,h),n=this.b.build(e,h),s=this.c.build(e,"f");break;case ht.MIX:r=this.a.build(e,h),n=this.b.build(e,h),s=this.c.build(e,f===1?"f":h);break;default:r=this.a.build(e,h),this.b&&(n=this.b.build(e,h)),this.c&&(s=this.c.build(e,h));break}let y=[];y.push(r),n&&y.push(n),s&&y.push(s);let g=this.getNumInputs(e);if(y.length!==g)throw Error(`Arguments not match used in "${this.method}". Require ${g}, currently ${y.length}.`);return e.format(this.method+"( "+y.join(", ")+" )",p,t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b=e.b instanceof Pe?e.b.clone():e.b,this.c=e.c instanceof Pe?e.c.clone():e.c,this.method=e.method,this}},ze=ht;ze.RAD=Ke.RAD,ze.DEG=Ke.DEG,ze.EXP=Ke.EXP,ze.EXP2=Ke.EXP2,ze.LOG=Ke.LOG,ze.LOG2=Ke.LOG2,ze.SQRT=Ke.SQRT,ze.INV_SQRT=Ke.INV_SQRT,ze.FLOOR=Ke.FLOOR,ze.CEIL=Ke.CEIL,ze.NORMALIZE=Ke.NORMALIZE,ze.FRACT=Ke.FRACT,ze.SATURATE=Ke.SATURATE,ze.SIN=Ke.SIN,ze.COS=Ke.COS,ze.TAN=Ke.TAN,ze.ASIN=Ke.ASIN,ze.ACOS=Ke.ACOS,ze.ARCTAN=Ke.ARCTAN,ze.ABS=Ke.ABS,ze.SIGN=Ke.SIGN,ze.LENGTH=Ke.LENGTH,ze.NEGATE=Ke.NEGATE,ze.INVERT=Ke.INVERT,ze.MIN=Ke.MIN,ze.MAX=Ke.MAX,ze.MOD=Ke.MOD,ze.STEP=Ke.STEP,ze.REFLECT=Ke.REFLECT,ze.DISTANCE=Ke.DISTANCE,ze.DOT=Ke.DOT,ze.CROSS=Ke.CROSS,ze.POW=Ke.POW,ze.MIX=Ke.MIX,ze.CLAMP=Ke.CLAMP,ze.REFRACT=Ke.REFRACT,ze.SMOOTHSTEP=Ke.SMOOTHSTEP,ze.FACEFORWARD=Ke.FACEFORWARD;var Bs=class extends Be{constructor(e=new Pe,t=new Pe,r=new Pe){super("v4");this.nodeType="TextureCubeUV";this.value=e,this.uv=t,this.bias=r}bilinearCubeUV(e,t,r,n){var f,h,p,y;let s=new xu(Bs.Nodes.bilinearCubeUV,[t,r,n]);this.colorSpaceTL=(f=this.colorSpaceTL)!=null?f:new zr(new xt("","v4")),this.colorSpaceTL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTL.input.parse(s.build(e)+".tl"),this.colorSpaceTR=(h=this.colorSpaceTR)!=null?h:new zr(new xt("","v4")),this.colorSpaceTR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceTR.input.parse(s.build(e)+".tr"),this.colorSpaceBL=(p=this.colorSpaceBL)!=null?p:new zr(new xt("","v4")),this.colorSpaceBL.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBL.input.parse(s.build(e)+".bl"),this.colorSpaceBR=(y=this.colorSpaceBR)!=null?y:new zr(new xt("","v4")),this.colorSpaceBR.fromDecoding(e.getTextureEncodingFromMap(this.value.value)),this.colorSpaceBR.input.parse(s.build(e)+".br");let l={include:e.isShader("vertex"),ignoreCache:!0};e.addContext(l),this.colorSpaceTLExp=new xt(this.colorSpaceTL.build(e,"v4"),"v4"),this.colorSpaceTRExp=new xt(this.colorSpaceTR.build(e,"v4"),"v4"),this.colorSpaceBLExp=new xt(this.colorSpaceBL.build(e,"v4"),"v4"),this.colorSpaceBRExp=new xt(this.colorSpaceBR.build(e,"v4"),"v4"),e.removeContext();let c=new xt("mix( mix( cubeUV_TL, cubeUV_TR, cubeUV.f.x ), mix( cubeUV_BL, cubeUV_BR, cubeUV.f.x ), cubeUV.f.y )","v4");return c.keywords.cubeUV_TL=this.colorSpaceTLExp,c.keywords.cubeUV_TR=this.colorSpaceTRExp,c.keywords.cubeUV_BL=this.colorSpaceBLExp,c.keywords.cubeUV_BR=this.colorSpaceBRExp,c.keywords.cubeUV=s,c}generate(e,t){if(e.isShader("fragment")){let r=this.uv,n=this.bias||e.context.roughness,s=new xu(Bs.Nodes.roughnessToMip,[n]),l=new ze(s,Bs.Nodes.m0,Bs.Nodes.cubeUV_maxMipLevel,ze.CLAMP),c=new ze(l,ze.FLOOR),f=new ze(l,ze.FRACT),h=this.bilinearCubeUV(e,this.value,r,c),p=this.bilinearCubeUV(e,this.value,r,new rn(c,new ve(1).setReadonly(!0),rn.ADD)),y=new ze(h,p,f,ze.MIX);return e.format(y.build(e),"v4",t)}else return console.warn("TextureCubeUVNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.uv.copy(e.uv),this.bias.copy(e.bias),this.value.copy(e.value),e.colorSpaceTL?this.colorSpaceTL?this.colorSpaceTL.copy(e.colorSpaceTL):this.colorSpaceTL=e.colorSpaceTL.clone():this.colorSpaceTL=void 0,e.colorSpaceTR?this.colorSpaceTR?this.colorSpaceTR.copy(e.colorSpaceTR):this.colorSpaceTR=e.colorSpaceTR.clone():this.colorSpaceTR=void 0,e.colorSpaceBL?this.colorSpaceBL?this.colorSpaceBL.copy(e.colorSpaceBL):this.colorSpaceBL=e.colorSpaceBL.clone():this.colorSpaceBL=void 0,e.colorSpaceBR?this.colorSpaceBR?this.colorSpaceBR.copy(e.colorSpaceBR):this.colorSpaceBR=e.colorSpaceBR.clone():this.colorSpaceBR=void 0,e.colorSpaceTLExp?this.colorSpaceTLExp?this.colorSpaceTLExp.copy(e.colorSpaceTLExp):this.colorSpaceTLExp=e.colorSpaceTLExp.clone():this.colorSpaceTLExp=void 0,e.colorSpaceTRExp?this.colorSpaceTRExp?this.colorSpaceTRExp.copy(e.colorSpaceTRExp):this.colorSpaceTRExp=e.colorSpaceTRExp.clone():this.colorSpaceTRExp=void 0,e.colorSpaceBLExp?this.colorSpaceBLExp?this.colorSpaceBLExp.copy(e.colorSpaceBLExp):this.colorSpaceBLExp=e.colorSpaceBLExp.clone():this.colorSpaceBLExp=void 0,e.colorSpaceBRExp?this.colorSpaceBRExp?this.colorSpaceBRExp.copy(e.colorSpaceBRExp):this.colorSpaceBRExp=e.colorSpaceBRExp.clone():this.colorSpaceBRExp=void 0,this}},Pa=Bs;Pa.Nodes=function(){let e=new Aa(`struct TextureCubeUVData {
|
|
6
25
|
vec4 tl;
|
|
7
26
|
vec4 tr;
|
|
8
27
|
vec4 br;
|
|
9
28
|
vec4 bl;
|
|
10
29
|
vec2 f;
|
|
11
|
-
}`),t=new
|
|
30
|
+
}`),t=new it("float cubeUV_maxMipLevel 8.0",!0),r=new it("float cubeUV_minMipLevel 4.0",!0),n=new it("float cubeUV_maxTileSize 256.0",!0),s=new it("float cubeUV_minTileSize 16.0",!0),l=new Se(`float getFace(vec3 direction) {
|
|
12
31
|
vec3 absDirection = abs(direction);
|
|
13
32
|
float face = -1.0;
|
|
14
33
|
if (absDirection.x > absDirection.z) {
|
|
@@ -23,7 +42,7 @@ var zm=Object.create;var Ti=Object.defineProperty,Em=Object.defineProperties,Fm=
|
|
|
23
42
|
face = direction.y > 0.0 ? 1.0 : 4.0;
|
|
24
43
|
}
|
|
25
44
|
return face;
|
|
26
|
-
}`);
|
|
45
|
+
}`);l.useKeywords=!1;let c=new Se(`vec2 getUV(vec3 direction, float face) {
|
|
27
46
|
vec2 uv;
|
|
28
47
|
if (face == 0.0) {
|
|
29
48
|
uv = vec2(direction.z, direction.y) / abs(direction.x); // pos x
|
|
@@ -39,7 +58,7 @@ var zm=Object.create;var Ti=Object.defineProperty,Em=Object.defineProperties,Fm=
|
|
|
39
58
|
uv = vec2(direction.x, direction.y) / abs(direction.z); // neg z
|
|
40
59
|
}
|
|
41
60
|
return 0.5 * (uv + 1.0);
|
|
42
|
-
}`);
|
|
61
|
+
}`);c.useKeywords=!1;let f=new Se(`TextureCubeUVData bilinearCubeUV(sampler2D envMap, vec3 direction, float mipInt) {
|
|
43
62
|
float face = getFace(direction);
|
|
44
63
|
float filterInt = max(cubeUV_minMipLevel - mipInt, 0.0);
|
|
45
64
|
mipInt = max(mipInt, cubeUV_minMipLevel);
|
|
@@ -67,7 +86,7 @@ var zm=Object.create;var Ti=Object.defineProperty,Em=Object.defineProperties,Fm=
|
|
|
67
86
|
uv.x -= texelSize;
|
|
68
87
|
vec4 bl = texture2D(envMap, uv);
|
|
69
88
|
return TextureCubeUVData( tl, tr, br, bl, f );
|
|
70
|
-
}`,[e,
|
|
89
|
+
}`,[e,l,c,t,r,n,s]);f.useKeywords=!1;let h=new it("float r0 1.0",!0),p=new it("float v0 0.339",!0),y=new it("float m0 -2.0",!0),g=new it("float r1 0.8",!0),w=new it("float v1 0.276",!0),S=new it("float m1 -1.0",!0),T=new it("float r4 0.4",!0),C=new it("float v4 0.046",!0),B=new it("float m4 2.0",!0),G=new it("float r5 0.305",!0),D=new it("float v5 0.016",!0),W=new it("float m5 3.0",!0),A=new it("float r6 0.21",!0),q=new it("float v6 0.0038",!0),E=new it("float m6 4.0",!0),b=[h,p,y,g,w,S,T,C,B,G,D,W,A,q,E],R=new Se(`float roughnessToMip(float roughness) {
|
|
71
90
|
float mip = 0.0;
|
|
72
91
|
if (roughness >= r1) {
|
|
73
92
|
mip = (r0 - roughness) * (m1 - m0) / (r0 - r1) + m0;
|
|
@@ -81,8 +100,8 @@ var zm=Object.create;var Ti=Object.defineProperty,Em=Object.defineProperties,Fm=
|
|
|
81
100
|
mip = -2.0 * log2(1.16 * roughness);// 1.16 = 1.79^0.25
|
|
82
101
|
}
|
|
83
102
|
return mip;
|
|
84
|
-
}`,
|
|
85
|
-
`);return
|
|
103
|
+
}`,b);return{bilinearCubeUV:f,roughnessToMip:R,m0:y,cubeUV_maxMipLevel:t}}();var To=class extends Be{constructor(e){super("v3");this.nodeType="Normal";this.scope=e!=null?e:To.VIEW}getShared(){return this.scope===To.WORLD}build(e,t,r,n){let s=e.context[this.scope+"Normal"];return s?s.build(e,t,r,n):super.build(e,t,r)}generate(e,t,r,n,s){let l;switch(this.scope){case To.VIEW:e.isShader("vertex")?l="transformedNormal":l="geometryNormal";break;case To.LOCAL:e.isShader("vertex")?l="objectNormal":(e.requires.normal=!0,l="vObjectNormal");break;case To.WORLD:e.isShader("vertex")?l="inverseTransformDirection( transformedNormal, viewMatrix ).xyz":(e.requires.worldNormal=!0,l="vWNormal");break}return e.format(l,this.getType(e),t)}copy(e){return super.copy(e),this.scope=e.scope,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.scope=this.scope),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.scope&&(this.scope=e.scope),this}},dr=To;dr.LOCAL="local",dr.WORLD="world",dr.VIEW="view",dr.NORMAL="normal";tr.addKeyword("viewNormal",function(){return new dr(dr.VIEW)});tr.addKeyword("localNormal",function(){return new dr(dr.NORMAL)});tr.addKeyword("worldNormal",function(){return new dr(dr.WORLD)});var Qn=class extends Be{constructor(e){super("v3");this.nodeType="Position";this.scope=e!=null?e:Qn.LOCAL}getType(){switch(this.scope){case Qn.PROJECTION:return"v4"}return this.type}getShader(){switch(this.scope){case Qn.LOCAL:case Qn.WORLD:return!1}return!0}generate(e,t,r,n,s){let l;switch(this.scope){case Qn.LOCAL:e.isShader("vertex")?l="transformed":(e.requires.position=!0,l="vPosition");break;case Qn.WORLD:if(e.isShader("vertex"))return"( modelMatrix * vec4( transformed, 1.0 ) ).xyz";e.requires.worldPosition=!0,l="vWPosition";break;case Qn.VIEW:l=e.isShader("vertex")?"-mvPosition.xyz":"vViewPosition";break;case Qn.PROJECTION:l=e.isShader("vertex")?"( projectionMatrix * modelViewMatrix * vec4( position, 1.0 ) )":"vec4( 0.0 )";break}return e.format(l,this.getType(),t)}copy(e){return super.copy(e),this.scope=e.scope,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.scope=this.scope),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.scope&&(this.scope=e.scope),this}},xr=Qn;xr.LOCAL="local",xr.WORLD="world",xr.VIEW="view",xr.PROJECTION="projection";tr.addKeyword("position",function(){return new xr});tr.addKeyword("worldPosition",function(){return new xr(xr.WORLD)});tr.addKeyword("viewPosition",function(){return new xr(xr.VIEW)});var Gn=class extends Be{constructor(e){super("v3");this.nodeType="Reflect";this.scope=e!=null?e:Gn.CUBE}getUnique(e){return!e.context.viewNormal}getType(){switch(this.scope){case Gn.SPHERE:return"v2"}return this.type}generate(e,t){let r=this.getUnique(e);if(e.isShader("fragment")){let n;switch(this.scope){case Gn.VECTOR:{let s=new dr(dr.VIEW),l=e.context.roughness,c=s.build(e,"v3"),f=new xr(xr.VIEW).build(e,"v3"),h=l?l.build(e,"f"):void 0,p=`reflect( -normalize( ${f} ), ${c} )`;h&&(p=`normalize( mix( ${p}, ${c}, ${h} * ${h} ) )`);let y=`inverseTransformDirection( ${p}, viewMatrix )`;r?(e.addNodeCode(`vec3 reflectVec = ${y};`),n="reflectVec"):n=y;break}case Gn.CUBE:{let s=new Gn(Gn.VECTOR).build(e,"v3"),l="vec3( -"+s+".x, "+s+".yz )";r?(e.addNodeCode(`vec3 reflectCubeVec = ${l};`),n="reflectCubeVec"):n=l;break}case Gn.SPHERE:{let s=new Gn(Gn.VECTOR).build(e,"v3"),l="normalize( ( viewMatrix * vec4( "+s+", 0.0 ) ).xyz + vec3( 0.0, 0.0, 1.0 ) ).xy * 0.5 + 0.5";r?(e.addNodeCode(`vec2 reflectSphereVec = ${l};`),n="reflectSphereVec"):n=l;break}}return e.format(n,this.getType(),t)}else return console.warn("ReflectNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.type,t)}copy(e){return super.copy(e),this.scope=e.scope,this}toJSON(e){let t=this.getJSONNode(e);return t||(t=this.createJSONNode(e),t.scope=this.scope),t.nodeType=this.nodeType,t}fromJSON(e,t){return super.fromJSON(e,t),e.scope&&(this.scope=e.scope),this}},Ni=Gn;Ni.CUBE="cube",Ni.SPHERE="sphere",Ni.VECTOR="vector";var ud=class extends Be{constructor(e=new Fr,t,r){super("v4");this.nodeType="TextureCube";this.value=e,this.radianceNode=new Pa(this.value,t!=null?t:new Ni(Ni.VECTOR),r),this.irradianceNode=new Pa(this.value,new dr(dr.WORLD),new ve(1).setReadonly(!0))}generate(e,t){return e.isShader("fragment")?(e.require("irradiance"),e.context.bias&&e.context.bias.setTexture(this.value),(e.slot==="irradiance"?this.irradianceNode:this.radianceNode).build(e,t)):(console.warn("TextureCubeNode is not compatible with "+e.shader+" shader."),e.format("vec4( 0.0 )",this.getType(e),t))}copy(e){return super.copy(e),this.value.copy(e.value),this.radianceNode.copy(e.radianceNode),this.irradianceNode.copy(e.irradianceNode),this}};import{CubeTexture as VD}from"three";var fd=class extends It{constructor(e=new VD,t,r){super("v4",{shared:!0});this.nodeType="CubeTexture";this.value=e,this.uv=t!=null?t:new Ni,this.bias=r}getTexture(e,t){return super.generate(e,t,this.value.uuid,"tc")}generate(e,t){var h,p;if(t==="samplerCube")return this.getTexture(e,t);let r=this.getTexture(e,t),n=(h=this.uv)==null?void 0:h.build(e,"v3"),s=this.bias?this.bias.build(e,"f"):void 0;s===void 0&&e.context.bias&&(s=e.context.bias.setTexture(this).build(e,"f"));let l;s?l="texCubeBias( "+r+", "+n+", "+s+" )":l="texCube( "+r+", "+n+" )";let c={include:e.isShader("vertex"),ignoreCache:!0},f=this.getType(e);return e.addContext(c),this.colorSpace=(p=this.colorSpace)!=null?p:new zr(new xt("",f)),this.colorSpace.fromDecoding(e.getTextureEncodingFromMap(this.value)),this.colorSpace.input.parse(l),l=this.colorSpace.build(e,f),e.removeContext(),e.format(l,f,t)}copy(e){return super.copy(e),this.value.copy(e.value),e.uv?this.uv?this.uv.copy(e.uv):this.uv=e.uv.clone():this.uv=void 0,e.bias?this.bias?this.bias.copy(e.bias):this.bias=e.bias.clone():this.bias=void 0,this}};var Ev=["x","y","z","w"],$D=["float","vec2","vec3","vec4"],JD={float:"f",vec2:"v2",vec3:"v3",vec4:"v4",mat4:"v4",int:"i",bool:"b","float[]":"f[]","vec4[]":"v4[]"},KD={t:"sampler2D",tc:"samplerCube",b:"bool",i:"int",f:"float",c:"vec3",v2:"vec2",v3:"vec3",v4:"vec4",m3:"mat3",m4:"mat4","f[]":"float[]","v4[]":"vec4[]"},hd=class{constructor(){this.includes={consts:{},functions:{},structs:{}};this.cache="";this.slot="";this.shader="";this.context={};this.getIncludesCode=function(){function e(t,r){return t.deps.length-r.deps.length}return function(r,n){let s=this.getIncludes(r,n);if(!s)return"";let l="";s=s.sort(e);for(let c=0;c<s.length;c++)s[c].src&&(l+=s[c].src+`
|
|
104
|
+
`);return l}}();this.slots=[],this.caches=[],this.contexts=[],this.keywords={},this.nodeData={},this.fragmentVariables={},this.requires={uv:[],color:[],lights:!1,fog:!1,transparent:!1,irradiance:!1,position:!1,worldPosition:!1,normal:!1,worldNormal:!1,vWorldViewDir:!1,modelMatrix:!1,viewMatrix:!1,projectionMatrix:!1},this.includes={consts:[],functions:[],structs:[]},this.attributes={},this.prefixCode=["#ifdef TEXTURE_LOD_EXT"," #define texCube(a, b) textureCube(a, b)"," #define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)"," #define tex2D(a, b) texture2D(a, b)"," #define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)","#else"," #define texCube(a, b) textureCube(a, b)"," #define texCubeBias(a, b, c) textureCube(a, b, c)"," #define tex2D(a, b) texture2D(a, b)"," #define tex2DBias(a, b, c) texture2D(a, b, c)","#endif",`
|
|
86
105
|
// NOTE: Include Spline's blending modes. This could be part of BlendNode
|
|
87
106
|
#define SPE_BLENDING_NORMAL 0
|
|
88
107
|
#define SPE_BLENDING_MULTIPLY 1
|
|
@@ -119,15 +138,15 @@ var zm=Object.create;var Ti=Object.defineProperty,Em=Object.defineProperties,Fm=
|
|
|
119
138
|
`),fragment:["float accumAlpha = 0.0;",`void accumulateAlpha(float alpha) {
|
|
120
139
|
accumAlpha += (1.0 - accumAlpha) * alpha;
|
|
121
140
|
}`,""].join(`
|
|
122
|
-
`)},this.code={vertex:"",fragment:""},this.nodeCode={vertex:"",fragment:""},this.resultCode={vertex:"",fragment:""},this.finalCode={vertex:"",fragment:""},this.inputs={uniforms:{list:[],vertex:[],fragment:[]},arrayUniforms:{list:[],vertex:[],fragment:[]},vars:{varying:[],vertex:[],fragment:[]}},this.defines={},this.uniforms={},this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.updaters=[],this.nodes=[],this.analyzing=!1}build(e,t){this.buildShader("vertex",e),this.buildShader("fragment",t);for(let r=0;r<this.requires.uv.length;r++)if(this.requires.uv[r]){let
|
|
141
|
+
`)},this.code={vertex:"",fragment:""},this.nodeCode={vertex:"",fragment:""},this.resultCode={vertex:"",fragment:""},this.finalCode={vertex:"",fragment:""},this.inputs={uniforms:{list:[],vertex:[],fragment:[]},arrayUniforms:{list:[],vertex:[],fragment:[]},vars:{varying:[],vertex:[],fragment:[]}},this.defines={},this.uniforms={},this.extensions={derivatives:!1,fragDepth:!1,drawBuffers:!1,shaderTextureLOD:!1},this.updaters=[],this.nodes=[],this.analyzing=!1}build(e,t){this.buildShader("vertex",e),this.buildShader("fragment",t);for(let r=0;r<this.requires.uv.length;r++)if(this.requires.uv[r]){let n=r>0?r+1:"";this.addVaryCode("varying vec2 vUv"+n+";"),r>0&&this.addVertexParsCode("attribute vec2 uv"+n+";"),this.addVertexFinalCode("vUv"+n+" = uv"+n+";")}return this.requires.color[0]&&(this.addVaryCode("varying vec4 vColor;"),this.addVertexParsCode("attribute vec4 color;"),this.addVertexFinalCode("vColor = color;")),this.requires.color[1]&&(this.addVaryCode("varying vec4 vColor2;"),this.addVertexParsCode("attribute vec4 color2;"),this.addVertexFinalCode("vColor2 = color2;")),this.requires.position&&(this.addVaryCode("varying vec3 vPosition;"),this.addVertexFinalCode("vPosition = transformed;")),this.requires.worldPosition&&(this.addVaryCode("varying vec3 vWPosition;"),this.addVertexFinalCode("vWPosition = ( modelMatrix * vec4( transformed, 1.0 ) ).xyz;")),this.requires.normal&&(this.addVaryCode("varying vec3 vObjectNormal;"),this.addVertexFinalCode("vObjectNormal = normal;")),this.requires.modelMatrix&&this.addFragmentParsCode("uniform mat4 modelMatrix;"),this.requires.viewMatrix&&this.addFragmentParsCode("uniform mat4 viewMatrix;"),this.requires.projectionMatrix&&this.addFragmentParsCode("uniform mat4 projectionMatrix;"),this.requires.worldNormal&&(this.addVaryCode("varying vec3 vWNormal;"),this.addVertexFinalCode("vWNormal = inverseTransformDirection( transformedNormal, viewMatrix ).xyz;")),this.requires.vWorldViewDir&&(this.addVaryCode("varying vec3 vWorldViewDir;"),this.addVertexFinalCode("vWorldViewDir = isPerspectiveMatrix( projectionMatrix ) ? ( (modelMatrix * vec4(position, 1.0)).xyz - cameraPosition ) : vec3( -viewMatrix[0][2], -viewMatrix[1][2], -viewMatrix[2][2] );")),this}buildShader(e,t){this.resultCode[e]=t.build(this.setShader(e),"v4")}setMaterial(e,t){return this.material=e,this.renderer=t,this.requires.lights=e.lights,this.requires.fog=e.fog,this.mergeDefines(e.defines),this}addFlow(e,t,r){return this.addSlot(e).addCache(t).addContext(r)}removeFlow(){return this.removeSlot().removeCache().removeContext()}addCache(e){return this.cache=e!=null?e:"",this.caches.push(this.cache),this}removeCache(){return this.caches.pop(),this.cache=this.caches[this.caches.length-1]||"",this}addContext(e){return this.context=Object.assign({},this.context,e),this.context.extra=this.context.extra||{},this.contexts.push(this.context),this}removeContext(){return this.contexts.pop(),this.context=this.contexts[this.contexts.length-1]||{},this}addSlot(e){return this.slot=e||"",this.slots.push(this.slot),this}removeSlot(){return this.slots.pop(),this.slot=this.slots[this.slots.length-1]||"",this}addFragmentVariable(e,t){this.fragmentVariables[e]===void 0&&(this.addFragmentCode(`${t} ${e};`),this.fragmentVariables[e]="")}addVertexCode(e){this.addCode(e,"vertex")}addFragmentCode(e){this.addCode(e,"fragment")}addCode(e,t){this.code[t!=null?t:this.shader]+=e+`
|
|
123
142
|
`}addVertexNodeCode(e){this.addNodeCode(e,"vertex")}addFragmentNodeCode(e){this.addNodeCode(e,"fragment")}addNodeCode(e,t){this.nodeCode[t!=null?t:this.shader]+=e+`
|
|
124
143
|
`}clearNodeCode(e){e=e!=null?e:this.shader;let t=this.nodeCode[e];return this.nodeCode[e]="",t}clearVertexNodeCode(){return this.clearNodeCode("vertex")}clearFragmentNodeCode(){return this.clearNodeCode("fragment")}addVertexFinalCode(e){this.addFinalCode(e,"vertex")}addFragmentFinalCode(e){this.addFinalCode(e,"fragment")}addFinalCode(e,t){this.finalCode[t!=null?t:this.shader]+=e+`
|
|
125
144
|
`}addVertexParsCode(e){this.addParsCode(e,"vertex")}addFragmentParsCode(e){this.addParsCode(e,"fragment")}addParsCode(e,t){this.parsCode[t!=null?t:this.shader]+=e+`
|
|
126
|
-
`}addVaryCode(e){this.addVertexParsCode(e),this.addFragmentParsCode(e)}isCache(e){return this.caches.indexOf(e)!==-1}isSlot(e){return this.slots.indexOf(e)!==-1}define(e,t){this.defines[e]=t===void 0?1:t}require(e){this.requires[e]=!0}isDefined(e){return this.defines[e]!==void 0}getVar(e,t,r,
|
|
127
|
-
`)}getVarListCode(e,t){t=t!=null?t:"";let r="";for(let
|
|
128
|
-
`:r+=t+" "+
|
|
129
|
-
`}return r}getVars(e){return this.inputs.vars[e!=null?e:this.shader]}getNodeData(e){let t=e instanceof
|
|
130
|
-
`;return e.isShader("vertex")?r+="gl_Position = "+t.result+";":r+="gl_FragColor = "+t.result+";",r}copy(e){return super.copy(e),this.value.copy(e.value),this}};var
|
|
145
|
+
`}addVaryCode(e){this.addVertexParsCode(e),this.addFragmentParsCode(e)}isCache(e){return this.caches.indexOf(e)!==-1}isSlot(e){return this.slots.indexOf(e)!==-1}define(e,t){this.defines[e]=t===void 0?1:t}require(e){this.requires[e]=!0}isDefined(e){return this.defines[e]!==void 0}getVar(e,t,r,n="varying",s="V",l=""){let c=this.getVars(n),f=c[e];if(!f){let h=c.length;f={name:r||"node"+s+h+(l?"_"+l:""),type:t},c.push(f),c[e]=f}return f}getTempVar(e,t,r,n){return this.getVar(e,t,r,this.shader,"T",n)}getAttribute(e,t){if(!this.attributes[e]){let r=this.getVar(e,t);this.addVertexParsCode("attribute "+t+" "+e+";"),this.addVertexFinalCode(r.name+" = "+e+";"),this.attributes[e]={varying:r,name:e,type:t}}return this.attributes[e]}getCode(e){return[this.prefixCode,this.parsCode[e],this.getVarListCode(this.getVars("varying"),"varying"),this.getVarListCode(this.inputs.uniforms[e],"uniform"),this.getVarListCode(this.inputs.arrayUniforms[e],"uniform"),this.getIncludesCode("consts",e),this.getIncludesCode("structs",e),this.getIncludesCode("functions",e),"void main() {",this.getVarListCode(this.getVars(e)),this.code[e],this.resultCode[e],this.finalCode[e],"}"].join(`
|
|
146
|
+
`)}getVarListCode(e,t){t=t!=null?t:"";let r="";for(let n=0,s=e.length;n<s;++n){let l=e[n],c=l.type,f=l.name,h=l.size,p=this.getFormatByType(c);if(p===void 0)throw new Error("Node pars "+p+" not found.");p.includes("[]")?r+=t+" "+p.substring(0,p.length-2)+" "+f+`[${h}];
|
|
147
|
+
`:r+=t+" "+p+" "+f+`;
|
|
148
|
+
`}return r}getVars(e){return this.inputs.vars[e!=null?e:this.shader]}getNodeData(e){let t=e instanceof Pe?e.uuid:e;return this.nodeData[t]=this.nodeData[t]||{}}createUniform(e,t,r,n,s,l){if(t.includes("[]")){let c=this.inputs.arrayUniforms,f=c.list.length,h=new yu({type:t,size:r.size,name:n||"nodeUA"+f+(l?"_"+l:""),node:r,needsUpdate:s});return c.list.push(h),c[e].push(h),c[e][h.name]=h,this.uniforms[h.name]=h,h}else{let c=this.inputs.uniforms,f=c.list.length,h=new yu({type:t,name:n||"nodeU"+f+(l?"_"+l:""),node:r,needsUpdate:s});return c.list.push(h),c[e].push(h),c[e][h.name]=h,this.uniforms[h.name]=h,h}}createVertexUniform(e,t,r,n,s){return this.createUniform("vertex",e,t,r,n,s)}createFragmentUniform(e,t,r,n,s){return this.createUniform("fragment",e,t,r,n,s)}include(e,t,r){var l;let n;if(e=typeof e=="string"?tr.get(e):e,this.context.include===!1)return e.name;e instanceof Se?n=this.includes.functions:e instanceof it?n=this.includes.consts:e instanceof Aa&&(n=this.includes.structs);let s=n[this.shader]=n[this.shader]||[];if(e){let c=s[e.name];if(c||(c=s[e.name]={node:e,deps:[]},s.push(c),c.src=e.build(this,"source")),e instanceof Se&&t&&s[t.name]&&s[t.name].deps.indexOf(e)===-1&&(s[t.name].deps.push(e),(l=e.includes)==null?void 0:l.length)){let f=0;do this.include(e.includes[f++],t);while(f<e.includes.length)}return r&&(c.src=r),e.name}else throw new Error("Include not found.")}colorToVectorProperties(e){return e.replace("r","x").replace("g","y").replace("b","z").replace("a","w")}colorToVector(e){return e.replace(/c/g,"v3")}getIncludes(e,t){return this.includes[e][t||this.shader]}getConstructorFromLength(e){return $D[e-1]}isTypeMatrix(e){return/^m/.test(e)}getTypeLength(e){return e==="f"?1:parseInt(this.colorToVector(e).substr(1))}getTypeFromLength(e){return e===1?"f":"v"+e}findNode(...e){for(let t=0;t<arguments.length;t++){let r=e[t];if(r==null?void 0:r.isNode)return r}}resolve(...e){for(let t=0;t<arguments.length;t++){let r=e[t];if(r!==void 0){if(r.isNode)return r;if(r.isTexture)switch(r.mapping){case UD:case kD:return new fd(r);case HD:case WD:return new ud(new Fr(r));default:return new Fr(r)}else{if(r.isVector2)return new _r(r);if(r.isVector3)return new Tr(r);if(r.isVector4)return new Xi(r)}}}}format(e,t,r){switch(this.colorToVector(r+" <- "+t)){case"f <- v2":return e+".x";case"f <- v3":return e+".x";case"f <- v4":return e+".x";case"f <- i":case"f <- b":return"float( "+e+" )";case"v2 <- f":return"vec2( "+e+" )";case"v2 <- v3":return e+".xy";case"v2 <- v4":return e+".xy";case"v2 <- i":case"v2 <- b":return"vec2( float( "+e+" ) )";case"v3 <- f":return"vec3( "+e+" )";case"v3 <- v2":return"vec3( "+e+", 0.0 )";case"v3 <- v4":return e+".xyz";case"v3 <- i":case"v3 <- b":return"vec2( float( "+e+" ) )";case"v4 <- f":return"vec4( "+e+" )";case"v4 <- v2":return"vec4( "+e+", 0.0, 1.0 )";case"v4 <- v3":return"vec4( "+e+", 1.0 )";case"v4 <- i":case"v4 <- b":return"vec4( float( "+e+" ) )";case"i <- f":case"i <- b":return"int( "+e+" )";case"i <- v2":return"int( "+e+".x )";case"i <- v3":return"int( "+e+".x )";case"i <- v4":return"int( "+e+".x )";case"b <- f":return"( "+e+" != 0.0 )";case"b <- v2":return"( "+e+" != vec2( 0.0 ) )";case"b <- v3":return"( "+e+" != vec3( 0.0 ) )";case"b <- v4":return"( "+e+" != vec4( 0.0 ) )";case"b <- i":return"( "+e+" != 0 )"}return e}getTypeByFormat(e){return JD[e]||e}getFormatByType(e){return KD[e]||e}getUUID(e,t){return t=t!==void 0?t:!0,t&&this.cache&&(e=this.cache+"-"+e),e}getElementByIndex(e){return Ev[e]}getIndexByElement(e){return Ev.indexOf(e)}isShader(e){return this.shader===e}setShader(e){return this.shader=e,this}mergeDefines(e){for(let t in e)this.defines[t]=e[t];return this.defines}mergeUniform(e){for(let t in e)this.uniforms[t]=e[t];return this.uniforms}getTextureEncodingFromMap(e){let t;return e?e.isTexture&&(t=e.encoding):t=jv,t===jv&&this.context.gamma&&(t=qD),t}};var vu=class extends Pe{constructor(e=new Pe){super("v4");this.nodeType="Raw";this.value=e}generate(e){let t=this.value.analyzeAndFlow(e,this.type),r=t.code+`
|
|
149
|
+
`;return e.isShader("vertex")?r+="gl_Position = "+t.result+";":r+="gl_FragColor = "+t.result+";",r}copy(e){return super.copy(e),this.value.copy(e.value),this}};var vt=class extends It{constructor(e=0,t,r,n){super("c");this.nodeType="Color";this.value=e instanceof tn?e:new tn(e||0,t,r,n)}setRGBA(e){this.value.setRGBA(e.r,e.g,e.b,e.a)}generate(e,t,r,n,s,l){r=e.getUUID(r!=null?r:this.getUUID()),n=n!=null?n:this.getType(e);let c=e.getNodeData(r),f=this.getReadonly()&&this.generateReadonly!==void 0;if(this.alpha){let h=this.alpha.build(e,"f");e.addFragmentNodeCode(`accumAlpha += ( 1.0 - accumAlpha ) * ${h};`)}return f?this.generateReadonly(e,t,r,n,s,l):e.isShader("vertex")?(c.vertex||(c.vertex=e.createVertexUniform(n,this,s,l,this.getLabel())),e.format(c.vertex.name,n,t)):(c.fragment||(c.fragment=e.createFragmentUniform(n,this,s,l,this.getLabel())),e.format(c.fragment.name,n,t))}generateReadonly(e,t,r,n,s,l){return e.format("vec3("+this.value.r+", "+this.value.g+", "+this.value.b+")",n,t)}};import{MathUtils as Ci,Vector2 as Zi,Vector3 as Yi,Vector4 as Ou}from"three";import{Texture as XD}from"three";var Ye=class extends It{constructor(e){super("i");this.nodeType="Int";this.value=Math.floor(e!=null?e:0)}generateReadonly(e,t,r,n,s,l){return e.format(this.value.toString(),n,t)}copy(e){return super.copy(e),this.value=e.value,this}};var qe;(function(T){T.POSITION="position",T.LIGHTING="light",T.COLOR="color",T.GRADIENT="gradient",T.NORMAL="normal",T.DEPTH="depth",T.TEXTURE="texture",T.NOISE="noise",T.FRESNEL="fresnel",T.RAINBOW="rainbow",T.TRANSMISSION="transmission",T.POINTS="points",T.MATCAP="matcap",T.LINES="lines",T.DISPLACE="displace"})(qe||(qe={}));var Mt;(function(r){r.POSITION="position",r.LIGHTING="light",r.COLOR="color"})(Mt||(Mt={}));var Bt=class{constructor(e,t,r,n){this.next=void 0;this.uniforms={};this.textures={};this.defines={};if(this.id=e,this.uuid=t,r){this.type=r.type;for(let s in r)s!=="type"&&s!=="calpha"&&(this.uniforms[`f${this.id}_${s}`]=r[s]);for(let s in n)this.defines[s]=n[s]}}copy(e){this.id=e.id,this.type=e.type,this.defines=U({},e.defines);for(let t in e.uniforms)this.getName(t)==="transmissionSamplerMap"||this.getName(t)==="transmissionDepthMap"||(this.uniforms[t]?this.uniforms[t].copy(e.uniforms[t]):this.uniforms[t]=e.uniforms[t].clone());return this}clone(){return new Bt(this.id).copy(this)}fromJSON(e,t){this.id=e.id,this.defines=U({},e.defines);for(let r in e.uniforms)this.uniforms[r]=t.getNode(e.uniforms[r]);if(e.type===qe.TEXTURE){if(!(`f${this.id}_textureSize`in this.uniforms)){let r=this.uniforms[`f${this.id}_texture`].value.image;this.uniforms[`f${e.id}_textureSize`]=new Tr(r.width,r.height)}`f${this.id}_size`in this.uniforms||(this.uniforms[`f${e.id}_size`]=new _r(200,200)),`f${e.id}_axis`in this.uniforms||(this.uniforms[`f${e.id}_axis`]=new Ye(0)),`f${e.id}_projection`in this.uniforms||(this.uniforms[`f${e.id}_projection`]=new Ye(0))}else e.type===qe.NOISE?(`f${e.id}_noiseType`in this.uniforms||(this.uniforms[`f${e.id}_noiseType`]=new Ye(0)),`f${e.id}_size`in this.uniforms||(this.uniforms[`f${e.id}_size`]=new Tr(-1,-1,-1))):e.type===qe.DEPTH&&(`f${e.id}_isWorldSpace`in this.uniforms||(this.uniforms[`f${e.id}_isWorldSpace`]=new ve(1)));return this}toJSON(e){let t={};for(let n in this.uniforms)t[n]=this.uniforms[n].toJSON(e).uuid;return{id:this.id,type:this.type,defines:JSON.parse(JSON.stringify(this.defines)),uniforms:t,next:this.next==null?void 0:this.next.toJSON(e)}}copyUniforms(e){for(let t in this.uniforms){let r=this.getName(t);r!==void 0&&e.uniforms[`f${e.id}_${r}`]&&r!=="transmissionDepthMap"&&r!=="transmissionSamplerMap"&&this.uniforms[t].copy(e.uniforms[`f${e.id}_${r}`])}return this}hasValueByKey(e){return this.uniforms[e]!==void 0}hasValue(e){return this.hasValueByKey(`f${this.id}_${e}`)}setValue(e,t){let r=`f${this.id}_${e}`;this.hasValueByKey(r)&&t!==void 0&&(this.uniforms[r].value=t)}getValue(e){let t=`f${this.id}_${e}`;if(this.hasValueByKey(t))return this.uniforms[t].value}getValues(){let e={type:this.type};for(let t in this.uniforms){let r=this.getName(t);if(r===void 0)continue;let s=this.uniforms[`f${this.id}_${r}`].value;s!==void 0&&(Array.isArray(s)?e[r]=s.map(l=>l.clone?l.clone():l):e[r]=s.clone?s.clone():s)}return e}getName(e){let r=/f\d+_(.*)/.exec(e);if(r&&r.length>1)return r[1];console.log(`Layer.getName: error ${e}`)}getNames(){let e=[];for(let t in this.uniforms){let r=this.getName(t);r&&e.push(r)}return e}isEqual(e){for(let t in e.uniforms){let r=e.getName(t);if(!r)return!1;let n=this.getValue(r),s=e.uniforms[t].value;if(s.value instanceof XD){if(n.image!==s.image)return!1}else if(Array.isArray(s)){let l=n;for(let c=0,f=l.length;c<f;++c)if(l[c]!==s[c])return!1}else{let l=n;if(l.equals){if(!l.equals(s))return!1}else if(n!==s)return!1}}return!0}dispose(){}};function Rv(i){let e=i instanceof Bt?i.type:i;return e==="texture"||e==="displace_map"||e==="matcap"}var bu=class extends It{constructor(e){super("b");this.nodeType="Bool";this.value=e!=null?e:!1}generateReadonly(e,t,r,n){return e.format(this.value?"true":"false",n,t)}copy(e){return super.copy(e),this.value=e.value,this}};import{Vector4 as zv}from"three";var Gs=class extends It{constructor(e=1,t){super("v4[]");this.nodeType="Vector4Array";this.size=e,this.value=Array.isArray(t)?t:t instanceof zv?new Array(e).fill(t):new Array(e).fill(new zv(0))}copy(e){return super.copy(e),this.value=e.value.map(t=>t.clone()),this}};var js=class extends It{constructor(e=1,t){super("f[]");this.nodeType="FloatArray";this.size=e,this.value=Array.isArray(t)?t:typeof t=="number"?new Array(e).fill(t):new Array(e).fill(0)}copy(e){return super.copy(e),this.size=e.size,this.value=[...e.value],this}};import{Matrix3 as ZD}from"three";var Da=class extends It{constructor(e){super("m3");this.nodeType="Matrix3";this.value=e!=null?e:new ZD}generateReadonly(e,t,r,n,s,l){return e.format("mat3("+this.value.elements.join(", ")+")",n,t)}copy(e){return super.copy(e),this.elements=e.elements,this}get elements(){return this.value.elements}set elements(e){this.value.fromArray(e)}};var Es;(function(n){n[n.UV=0]="UV",n[n.PLANAR=1]="PLANAR",n[n.SPHERICAL=2]="SPHERICAL",n[n.CYLINDRICAL=3]="CYLINDRICAL"})(Es||(Es={}));var Ba=class extends Be{constructor(e=new Fr,t,r,n,s,l,c,f){super("v3");this.nodeType="CustomTexture";this.firstTime=!0,this.texture=e,this.textureSize=t,this.crop=r,this.projection=n,this.axis=s,this.size=l,this.mat=new Da(this.texture.value.matrix),this.alpha=c,this.mode=f,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){e.require("position"),e.require("uv"),e.requires.uv=[!0],e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0;let r;switch(this.projection.value){case 3:r=e.include(Ba.Nodes.cylindrical);break;case 2:r=e.include(Ba.Nodes.spherical);break;case 1:let s=new Se(`
|
|
131
150
|
vec3 g${this.uuid.toString().replace(/-/g,"")}_planarTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
|
|
132
151
|
|
|
133
152
|
vec2 uvs = ( mat * vec3( (g${this.uuid.toString().replace(/-/g,"")}_vCustomUv * 2. - 1.) / (size * .5), 1. ) / 2. + 0.5 ).xy;
|
|
@@ -144,25 +163,25 @@ var zm=Object.create;var Ti=Object.defineProperty,Em=Object.defineProperties,Fm=
|
|
|
144
163
|
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
|
|
145
164
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
146
165
|
return col;
|
|
147
|
-
}`);r=e.include(
|
|
148
|
-
vec3 ${
|
|
166
|
+
}`);r=e.include(s);break;default:r=e.include(Ba.Nodes.uv);break}if(this.projection.value===1&&this.firstTime){let s=`g${this.uuid.toString().replace(/-/g,"")}`;e.addVertexParsCode(`varying vec2 ${s}_vCustomUv;`),e.addFragmentParsCode(`varying vec2 ${s}_vCustomUv;`),e.addVertexFinalCode(`
|
|
167
|
+
vec3 ${s}_posN = transformed;
|
|
149
168
|
${this.axis.value===0?`
|
|
150
|
-
float ${
|
|
151
|
-
float ${
|
|
169
|
+
float ${s}_u = (1. + (${s}_posN.z)) / 2.;
|
|
170
|
+
float ${s}_v = (1. + (${s}_posN.y)) / 2.;
|
|
152
171
|
`:""}
|
|
153
172
|
|
|
154
173
|
${this.axis.value===1?`
|
|
155
|
-
float ${
|
|
156
|
-
float ${
|
|
174
|
+
float ${s}_u = (1. + (${s}_posN.x)) / 2.;
|
|
175
|
+
float ${s}_v = (1. - (${s}_posN.z)) / 2.;
|
|
157
176
|
`:""}
|
|
158
177
|
|
|
159
178
|
${this.axis.value===2?`
|
|
160
|
-
float ${
|
|
161
|
-
float ${
|
|
179
|
+
float ${s}_u = (1. + (${s}_posN.x)) / 2.;
|
|
180
|
+
float ${s}_v = (1. + (${s}_posN.y)) / 2.;
|
|
162
181
|
`:""}
|
|
163
182
|
|
|
164
|
-
${
|
|
165
|
-
`)}e.addFragmentVariable(this.calpha,"float");let
|
|
183
|
+
${s}_vCustomUv = vec2(${s}_u, ${s}_v);
|
|
184
|
+
`)}e.addFragmentVariable(this.calpha,"float");let n=[];return n.push(this.texture.getTexture(e,"t")),n.push(this.textureSize.build(e,"v2")),n.push(this.crop.build(e,"f")),n.push(this.mat.build(e,"mat3")),n.push(this.size.build(e,"v2")),n.push(this.alpha.build(e,"f")),n.push(this.mode.build(e,"i")),n.push(this.calpha),this.firstTime=!this.firstTime,e.format(r+"("+n.join(",")+")",this.getType(e),t)}copy(e){return super.copy(e),this.texture.copy(e.texture),this.textureSize=e.textureSize.clone(),this.crop=e.crop.clone(),this.projection=e.projection.clone(),this.axis=e.axis.clone(),this.size=e.size.clone(),this.alpha=e.alpha.clone(),this.mode=e.mode.clone(),this}},Su=Ba;Su.Nodes=function(){let e=new Se(`
|
|
166
185
|
vec3 cylindricalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
|
|
167
186
|
vec3 posN = normalize(position);
|
|
168
187
|
float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);
|
|
@@ -192,7 +211,7 @@ vec3 cylindricalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, v
|
|
|
192
211
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
193
212
|
return col;
|
|
194
213
|
}
|
|
195
|
-
`),t=new
|
|
214
|
+
`),t=new Se(`
|
|
196
215
|
vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
|
|
197
216
|
vec3 posN = normalize(vPosition);
|
|
198
217
|
float u = 0.5 + atan(posN.z, posN.x) / (2.*3.1415);
|
|
@@ -220,7 +239,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
220
239
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
221
240
|
return col;
|
|
222
241
|
}
|
|
223
|
-
`),r=new
|
|
242
|
+
`),r=new Se(`vec3 uvTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec2 size, float alpha, int mode, out float calpha) {
|
|
224
243
|
|
|
225
244
|
vec2 uvs = ( mat * vec3( vUv * 2. - 1., 1. ) / 2. + 0.5 ).xy;
|
|
226
245
|
vec4 tmp = texture2D( tex, uvs );
|
|
@@ -236,14 +255,14 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
236
255
|
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
|
|
237
256
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
238
257
|
return col;
|
|
239
|
-
}`);return{cylindrical:e,spherical:t,uv:r}}();var
|
|
258
|
+
}`);return{cylindrical:e,spherical:t,uv:r}}();var dd=class extends Be{constructor(e,t,r,n,s,l,c){super("v3");this.nodeType="Fresnel";this.color=e,this.bias=t,this.scale=r,this.intensity=n,this.factor=s,this.alpha=l,this.mode=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");let r=e.include(dd.Nodes.fresnel),n=[];return n.push(this.color.build(e,"c")),n.push(this.bias.build(e,"f")),n.push(this.scale.build(e,"f")),n.push(this.intensity.build(e,"f")),n.push(this.factor.build(e,"f")),n.push(this.alpha.build(e,"f")),n.push(this.mode.build(e,"i")),n.push(this.calpha),e.format(r+"("+n.join(",")+")",this.getType(e),t)}else return console.warn("FresnelNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.color=e.color.clone(),this.bias=e.bias.clone(),this.scale=e.scale.clone(),this.intensity=e.intensity.clone(),this.factor=e.factor.clone(),this.alpha=e.alpha.clone(),this.mode=e.mode.clone(),this.calpha=e.calpha,this}},wu=dd;wu.Nodes=function(){return{fresnel:new Se(`vec3 fresnel(vec3 color, float bias, float scale, float intensity, float factor, float alpha, int mode, out float calpha) {
|
|
240
259
|
float fresnel = bias + scale * pow( abs( factor + dot( normalize( vWorldViewDir ), normalize( vWNormal ) ) ), intensity );
|
|
241
260
|
|
|
242
261
|
float lalpha = clamp( fresnel, 0.0, 1.0 ) * alpha;
|
|
243
262
|
calpha = lalpha / clamp(lalpha + accumAlpha, 0.001, 1.0);
|
|
244
263
|
accumAlpha += (1.0 - accumAlpha) * lalpha;
|
|
245
264
|
return color;
|
|
246
|
-
}`)}}();var
|
|
265
|
+
}`)}}();var Rs;(function(s){s.SIMPLEX="simplex3d",s.SIMPLEX_FRACTAL="simplex3dFractal",s.ASHIMA="simplexAshima",s.FBM="fbm",s.PERLIN="perlin"})(Rs||(Rs={}));var Vr=function(){let i=5,e=new Se(`vec3 random3(vec3 c) {
|
|
247
266
|
float j = 4096.0*sin(dot(c,vec3(17.0, 59.4, 15.0)));
|
|
248
267
|
vec3 r;
|
|
249
268
|
r.z = fract(512.0*j);
|
|
@@ -252,7 +271,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
252
271
|
j *= .125;
|
|
253
272
|
r.y = fract(512.0*j);
|
|
254
273
|
return r-0.5;
|
|
255
|
-
}`),t=new
|
|
274
|
+
}`),t=new Se(`float simplex3d(vec3 p) {
|
|
256
275
|
vec3 s = floor(p + dot(p, vec3(F3)));
|
|
257
276
|
vec3 x = p - s + dot(s, vec3(G3));
|
|
258
277
|
|
|
@@ -283,7 +302,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
283
302
|
d *= w;
|
|
284
303
|
|
|
285
304
|
return dot(d, vec4(52.0));
|
|
286
|
-
}`,[e]);t.keywords.F3=new
|
|
305
|
+
}`,[e]);t.keywords.F3=new it("float F3 0.3333333"),t.keywords.G3=new it("float G3 0.1666667");let r=new Se(`float simplex3dFractal(vec3 m) {
|
|
287
306
|
mat3 rot1 = mat3(-0.37, 0.36, 0.85,-0.14,-0.93, 0.34,0.92, 0.01,0.4);
|
|
288
307
|
mat3 rot2 = mat3(-0.55,-0.39, 0.74, 0.33,-0.91,-0.24,0.77, 0.12,0.63);
|
|
289
308
|
mat3 rot3 = mat3(-0.71, 0.52,-0.47,-0.08,-0.72,-0.68,-0.7,-0.45,0.56);
|
|
@@ -291,7 +310,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
291
310
|
+ 0.2666667 * simplex3d(2.0 * m * rot2)
|
|
292
311
|
+ 0.1333333 * simplex3d(4.0 * m * rot3)
|
|
293
312
|
+ 0.0666667 * simplex3d(8.0 * m);
|
|
294
|
-
}`,[t]),
|
|
313
|
+
}`,[t]),n=new Se("vec4 permute(vec4 x){return mod(((x*34.0)+1.0)*x, 289.0);}"),s=new Se("vec4 taylorInvSqrt(vec4 r){return 1.79284291400159 - 0.85373472095314 * r;}"),l=new Se(`float simplexAshima(vec3 v) {
|
|
295
314
|
const vec2 C = vec2(1.0/6.0, 1.0/3.0) ;
|
|
296
315
|
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
|
|
297
316
|
vec3 i = floor(v + dot(v, C.yyy) );
|
|
@@ -336,7 +355,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
336
355
|
m = m * m;
|
|
337
356
|
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),
|
|
338
357
|
dot(p2,x2), dot(p3,x3) ) );
|
|
339
|
-
}`,[
|
|
358
|
+
}`,[n,s]),c=new Se("vec4 mod289(vec4 x){return x - floor(x * (1.0 / 289.0)) * 289.0;}"),f=new Se("vec4 perm(vec4 x){return mod289(((x * 34.0) + 1.0) * x);}",[c]),h=new Se(`float noise(vec3 p){
|
|
340
359
|
vec3 a = floor(p);
|
|
341
360
|
vec3 d = p - a;
|
|
342
361
|
d = d * d * (3.0 - 2.0 * d);
|
|
@@ -351,7 +370,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
351
370
|
vec4 o3 = o2 * d.z + o1 * (1.0 - d.z);
|
|
352
371
|
vec2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);
|
|
353
372
|
return o4.y * d.y + o4.x * (1.0 - d.y);
|
|
354
|
-
}`,[
|
|
373
|
+
}`,[f]),p=new Se(`float fbm(vec3 x) {
|
|
355
374
|
float v = 0.0;
|
|
356
375
|
float a = 0.5;
|
|
357
376
|
vec3 shift = vec3(100);
|
|
@@ -361,7 +380,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
361
380
|
a *= 0.5;
|
|
362
381
|
}
|
|
363
382
|
return v;
|
|
364
|
-
}`,[
|
|
383
|
+
}`,[h]);p.keywords.NUM_OCTAVES=new it(`int NUM_OCTAVES ${i}`);let y=new Se("vec3 fade(vec3 t) {return t*t*t*(t*(t*6.0-15.0)+10.0);}"),g=new Se(`float perlin(vec3 P){
|
|
365
384
|
vec3 Pi0 = floor(P);
|
|
366
385
|
vec3 Pi1 = Pi0 + vec3(1.0);
|
|
367
386
|
Pi0 = mod(Pi0, 289.0);
|
|
@@ -420,7 +439,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
420
439
|
vec2 n_yz = mix(n_z.xy, n_z.zw, fade_xyz.y);
|
|
421
440
|
float n_xyz = mix(n_yz.x, n_yz.y, fade_xyz.x);
|
|
422
441
|
return 2.2 * n_xyz;
|
|
423
|
-
}`,[
|
|
442
|
+
}`,[n,s,y]);return{simplex:t,simplexFractal:r,simplexAshima:l,fbm:p,perlin:g}}();var pd=class extends Be{constructor(e,t,r,n,s,l,c){super("v3");this.nodeType="Rainbow";this.filmThickness=e,this.movement=t,this.wavelengths=r,this.noiseStrength=n,this.noiseScale=s,this.offset=l,this.alpha=c,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.require("vWorldViewDir"),e.require("worldNormal"),e.isShader("fragment")){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let r=e.include(pd.Nodes.rainbow),n=[];return n.push(this.filmThickness.build(e,"f")),n.push(this.movement.build(e,"f")),n.push(this.wavelengths.build(e,"v3")),n.push(this.noiseStrength.build(e,"f")),n.push(this.noiseScale.build(e,"f")),n.push(this.offset.build(e,"v3")),n.push(this.alpha.build(e,"f")),n.push(this.calpha),e.format(r+"("+n.join(",")+")",this.getType(e),t)}else return console.warn("RainbowNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.filmThickness=e.filmThickness.clone(),this.movement=e.movement.clone(),this.wavelengths=e.wavelengths.clone(),this.noiseStrength=e.noiseStrength.clone(),this.noiseScale=e.noiseScale.clone(),this.offset=e.offset.clone(),this.alpha=e.alpha.clone(),this.calpha=e.calpha,this}},Nu=pd;Nu.Nodes=function(){let e=new Se(`vec3 attenuation(vec3 wavelengths, float filmThickness, float movement, float noiseStrength, float noiseScale, vec3 offset) {
|
|
424
443
|
vec3 st = position / noiseScale;
|
|
425
444
|
vec3 q = vec3(simplex3d(st),
|
|
426
445
|
simplex3d(st + vec3(1.0)),
|
|
@@ -433,7 +452,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
433
452
|
float noise = simplex3d(st + r);
|
|
434
453
|
|
|
435
454
|
return .5 + .5 * cos((((filmThickness + (noise * noiseStrength)) / (vec3(wavelengths.r * 1.0, wavelengths.g * 0.8, wavelengths.b * 0.6) + 1.0)) * dot(normalize(vWorldViewDir + (offset * -0.001)), normalize(vWNormal))) + movement);
|
|
436
|
-
}`,[
|
|
455
|
+
}`,[Vr.simplex]);return{rainbow:new Se(`vec3 rainbow(float filmThickness, float movement, vec3 wavelengths, float noiseStrength, float noiseScale, vec3 offset, float alpha, out float calpha) {
|
|
437
456
|
vec3 res = clamp(attenuation(wavelengths, filmThickness, movement, noiseStrength, noiseScale, offset), 0.0, 2.0);
|
|
438
457
|
|
|
439
458
|
float rainbowContribution = clamp(res.r + res.g + res.b, 0.0, 1.0);
|
|
@@ -442,11 +461,11 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
442
461
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
443
462
|
|
|
444
463
|
return res;
|
|
445
|
-
}`,[e])}}();var
|
|
464
|
+
}`,[e])}}();var md=class extends Be{constructor(e,t,r,n,s,l,c,f){super("v3");this.nodeType="Transmission";this.thickness=e,this.ior=t,this.roughness=r,this.transmissionSamplerSize=n,this.transmissionSamplerMap=s,this.transmissionDepthMap=l,this.aspectRatio=c,this.alpha=f,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.extensions.shaderTextureLOD=!0,e.extensions.derivatives=!0,e.isShader("fragment")){e.define("NUM_SAMPLES",30),e.require("worldPosition"),e.requires.worldNormal=!0,e.requires.modelMatrix=!0,e.requires.projectionMatrix=!0,e.addFragmentVariable(this.calpha,"float");let r=e.include(md.Nodes.transmission),n=[];return n.push(this.thickness.build(e,"f")),n.push(this.ior.build(e,"f")),n.push(this.roughness.build(e,"f")),n.push(this.transmissionSamplerSize.build(e,"v2")),n.push(this.transmissionSamplerMap.getTexture(e,"t")),n.push(this.transmissionDepthMap.getTexture(e,"t")),n.push(this.aspectRatio.build(e,"v2")),n.push("normal"),n.push(this.alpha.build(e,"f")),n.push(this.calpha),e.format(r+"("+n.join(",")+")",this.getType(e),t)}else return console.warn("TransmissionNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(this),this.thickness=e.thickness.clone(),this.ior=e.ior.clone(),this.roughness=e.roughness.clone(),this.transmissionSamplerSize=e.transmissionSamplerSize.clone(),this.transmissionSamplerMap=e.transmissionSamplerMap,this.transmissionDepthMap=e.transmissionDepthMap,this.alpha=e.alpha.clone(),this.calpha=e.calpha,this}},Cu=md;Cu.Nodes=function(){let e=new Se(`
|
|
446
465
|
float gaussian(vec2 i) {
|
|
447
466
|
const float sigma = float(NUM_SAMPLES) * .25;
|
|
448
467
|
return exp( -.5* dot(i/=sigma,i) ) / ( 6.28 * sigma*sigma );
|
|
449
|
-
}`),t=new
|
|
468
|
+
}`),t=new Se(`
|
|
450
469
|
vec4 blur(sampler2D sp, vec2 U, vec2 scale, float lod, sampler2D dm, vec2 unrefractedU, vec2 aspectRatio) {
|
|
451
470
|
// Slightly modified version of this:
|
|
452
471
|
// https://www.shadertoy.com/view/ltScRG
|
|
@@ -473,7 +492,7 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
473
492
|
#endif
|
|
474
493
|
}
|
|
475
494
|
return O / O.a;
|
|
476
|
-
}`,[e]),r=new
|
|
495
|
+
}`,[e]),r=new Se(`
|
|
477
496
|
vec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {
|
|
478
497
|
// Direction of refracted light.
|
|
479
498
|
vec3 refractionVector = refract( -v, n, 1.0 / ior );
|
|
@@ -484,18 +503,18 @@ vec3 sphericalTexture(sampler2D tex, vec2 textureSize, float crop, mat3 mat, vec
|
|
|
484
503
|
modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
|
|
485
504
|
// The thickness is specified in local space.
|
|
486
505
|
return normalize( refractionVector ) * thickness * modelScale;
|
|
487
|
-
}`),
|
|
506
|
+
}`),n=new Se(`
|
|
488
507
|
float applyIorToRoughness( float roughness, float ior ) {
|
|
489
508
|
// Scale roughness with IOR so that an IOR of 1.0 results in no microfacet refraction and
|
|
490
509
|
// an IOR of 1.5 results in the default amount of microfacet refraction.
|
|
491
510
|
return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
|
|
492
|
-
} `),
|
|
511
|
+
} `),s=new Se(`
|
|
493
512
|
vec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 unrefractedCoords, vec2 aspectRatio) {
|
|
494
513
|
float framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
|
|
495
514
|
float lod = applyIorToRoughness(roughness, ior);
|
|
496
515
|
|
|
497
516
|
return blur(transmissionSamplerMap, fragCoord, vec2(lod / (transmissionSamplerSize.x / 2.)), min(framebufferLod / 5.5, 8.5), transmissionDepthMap, unrefractedCoords, aspectRatio);
|
|
498
|
-
}`,[
|
|
517
|
+
}`,[n,t]),l=new Se(`
|
|
499
518
|
vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio ) {
|
|
500
519
|
vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
|
|
501
520
|
vec3 refractedRayExit = position + transmissionRay;
|
|
@@ -515,7 +534,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
515
534
|
vec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior, transmissionSamplerSize, transmissionSamplerMap, transmissionDepthMap, unrefractedCoords, aspectRatio );
|
|
516
535
|
// Get the specular component.
|
|
517
536
|
return vec4( ( 1.0 ) * transmittedLight.rgb, transmittedLight.a );
|
|
518
|
-
}`,[
|
|
537
|
+
}`,[s,r]);return{transmission:new Se(`
|
|
519
538
|
vec3 transmission(float thickness, float ior, float roughness, vec2 transmissionSamplerSize, sampler2D transmissionSamplerMap, sampler2D transmissionDepthMap, vec2 aspectRatio, vec3 normal, float alpha, out float calpha) {
|
|
520
539
|
vec3 v = vec3(0.);
|
|
521
540
|
if (isOrthographic) {
|
|
@@ -529,14 +548,14 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
529
548
|
calpha = lalpha / clamp( lalpha + accumAlpha, 0.00001, 1.0 );
|
|
530
549
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
531
550
|
return transmission.rgb;
|
|
532
|
-
}`,[
|
|
551
|
+
}`,[l])}}();var gd=class extends Be{constructor(e,t){super("v3");this.nodeType="CustomNormal";this.cnormal=e,this.alpha=t}generate(e,t){if(e.isShader("fragment")){let r=e.include(gd.Nodes.customNormal),n=[];return n.push(this.cnormal.build(e,"v3")),n.push("normal"),n.push(this.alpha.build(e,"f")),e.format(r+"("+n.join(",")+")",this.getType(e),t)}else return console.warn("CustomNormalNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.cnormal.copy(e.cnormal),this.alpha.copy(e.alpha),this}},Lu=gd;Lu.Nodes=function(){return{customNormal:new Se(`vec3 customNormal(vec3 cnormal, vec3 norm, float alpha) {
|
|
533
552
|
vec3 normal = packNormalToRGB( norm ).rgb;
|
|
534
553
|
normal *= step( vec3(0.5), cnormal );
|
|
535
554
|
|
|
536
555
|
accumAlpha += ( 1.0 - accumAlpha ) * alpha;
|
|
537
556
|
|
|
538
557
|
return normal;
|
|
539
|
-
}`)}}();var
|
|
558
|
+
}`)}}();var yd=class extends Be{constructor(e,t,r,n,s,l,c,f){super("v3");this.nodeType="Gradient";this.gradientType=e,this.smooth=t,this.colors=r,this.steps=n,this.offset=s,this.morph=l,this.angle=c,this.alpha=f,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.define("GRAD_MAX",10),e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let r=e.include(yd.Nodes.gradient),n=[];return n.push(this.gradientType.build(e,"i")),n.push(this.smooth.build(e,"b")),n.push(this.colors.build(e,"v4[]")),n.push(this.steps.build(e,"f[]")),n.push(this.offset.build(e,"v2")),n.push(this.morph.build(e,"v2")),n.push(this.angle.build(e,"f")),n.push(this.alpha.build(e,"f")),n.push(this.calpha),e.format(r+"("+n.join(",")+")",this.getType(e),t)}else return console.warn("GradientNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.gradientType=e.gradientType.clone(),this.smooth=e.smooth.clone(),this.colors=e.colors.clone(),this.steps=e.steps.clone(),this.offset=e.offset.clone(),this.morph=e.morph.clone(),this.angle=e.angle.clone(),this.alpha=e.alpha.clone(),this.calpha=e.calpha,this}},_u=yd;_u.Nodes=function(){return{gradient:new Se(`vec3 gradient(int gradientType, bool smoothed, vec4 colors[GRAD_MAX], float steps[GRAD_MAX], vec2 offset, vec2 morph, float angle, float alpha, out float calpha) {
|
|
540
559
|
vec4 color = colors[0];
|
|
541
560
|
vec2 m = morph / vUv.xy;
|
|
542
561
|
vec2 rot = vec2( 0.5 + m.x, m.y );
|
|
@@ -578,11 +597,11 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
578
597
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
579
598
|
|
|
580
599
|
return color.xyz;
|
|
581
|
-
}`)}}();var Io;(function(t){t.NOISE="noise",t.MAP="map"})(Io||(Io={}));var
|
|
600
|
+
}`)}}();var Io;(function(t){t.NOISE="noise",t.MAP="map"})(Io||(Io={}));var xd=class extends Be{constructor(e=new Ye(0),t,r,n,s,l){super("v3");this.nodeType="VertexDisplacement";this.displacementTypeIndex=e,this.intensity=t,this.movementOrTexture=r,Object.values(Io)[this.displacementTypeIndex.value]===Io.MAP&&(this.mat=new Da(this.movementOrTexture.value.matrix)),this.cropOrOffset=n,this.scale=s,this.noiseFunctionIndex=l}generate(e,t){if(e.isShader("vertex")){e.define("USE_LAYER_DISPLACE");let r,n=[];switch(n.push("displaced_position"),n.push("displaced_normal"),Object.values(Io)[this.displacementTypeIndex.value]){case Io.MAP:{r=e.include(xd.Nodes.map),n.push(this.movementOrTexture.getTexture(e,"t")),n.push("uv"),n.push(this.cropOrOffset.build(e,"f")),this.mat&&n.push(this.mat.build(e,"mat3"));break}case Io.NOISE:{let l=Object.values(Rs)[this.noiseFunctionIndex.value],c=new Se(`vec3 orthogonal(vec3 v) {
|
|
582
601
|
return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));
|
|
583
|
-
}`),
|
|
584
|
-
return p + n * ${
|
|
585
|
-
}`,[
|
|
602
|
+
}`),f=new Se(`vec3 distorted(vec3 p, vec3 n, float scale, float intensity, vec3 offset, float neighbour_offset, float movement) {
|
|
603
|
+
return p + n * ${l}((p + offset) * scale * 0.001 + neighbour_offset + (movement * 0.1)) * intensity;
|
|
604
|
+
}`,[Vr.simplex,Vr.simplexFractal,Vr.simplexAshima,Vr.fbm,Vr.perlin]),h=new Se(`vec3 vertexDisplacementNoise(vec3 position, vec3 normal, float scale, vec3 offset, float movement, float intensity, out vec3 displaced_normal) {
|
|
586
605
|
vec3 displaced_position = distorted(position, normal, scale, intensity, offset, neighbor_offset, movement);
|
|
587
606
|
vec3 tangent1 = orthogonal(normal);
|
|
588
607
|
vec3 tangent2 = normalize(cross(normal, tangent1));
|
|
@@ -598,9 +617,9 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
598
617
|
vec3 distorted2 = distorted(nearby2, normal, scale, intensity, offset, neighbor_offset, movement);
|
|
599
618
|
displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
|
|
600
619
|
return displaced_position;
|
|
601
|
-
}`,[
|
|
620
|
+
}`,[f,c]);r=e.include(h),n.push(this.scale.build(e,"f")),n.push(this.cropOrOffset.build(e,"v3")),n.push(this.movementOrTexture.build(e,"f"));break}}return n.push(this.intensity.build(e,"f")),n.push("displaced_normal"),e.format(r+"("+n.join(",")+")",this.getType(e),t)}else return console.warn("VertexDisplacementNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){var t,r;return super.copy(e),this.noiseFunctionIndex=(t=e.noiseFunctionIndex)==null?void 0:t.clone(),this.scale=(r=e.scale)==null?void 0:r.clone(),this.cropOrOffset=e.cropOrOffset.clone(),this.intensity=e.intensity.clone(),this.movementOrTexture=e.movementOrTexture.clone(),this}},Ga=xd;Ga.Nodes=function(){let e=new Se(`vec3 orthogonal(vec3 v) {
|
|
602
621
|
return normalize(abs(v.x) > abs(v.z) ? vec3(-v.y, v.x, 0.0) : vec3(0.0, -v.z, v.y));
|
|
603
|
-
}`),t=new
|
|
622
|
+
}`),t=new Se(`float displacementMapTexture(sampler2D tex, float crop, vec2 uv, mat3 mat, vec2 offset) {
|
|
604
623
|
vec2 uvs = (mat * vec3(uv * 2.0 - 1.0, 1.0) / 2.0 + 0.5).xy + offset;
|
|
605
624
|
vec4 tmp = texture2D(tex, uvs);
|
|
606
625
|
vec3 col = tmp.rgb;
|
|
@@ -610,7 +629,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
610
629
|
}
|
|
611
630
|
}
|
|
612
631
|
return col.r;
|
|
613
|
-
}`);return{map:new
|
|
632
|
+
}`);return{map:new Se(`vec3 vertexDisplacementMap(vec3 position, vec3 normal, sampler2D tex, vec2 uv, float crop, mat3 mat, float intensity, out vec3 displaced_normal) {
|
|
614
633
|
vec3 displaced_position = position + normal * displacementMapTexture(tex, crop, uv, mat, vec2(0.0)) * intensity;
|
|
615
634
|
vec3 tangent1 = normalize(orthogonal(normal));
|
|
616
635
|
vec3 tangent2 = normalize(cross(normal, tangent1));
|
|
@@ -620,16 +639,16 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
620
639
|
vec3 distorted2 = nearby2 + normal * displacementMapTexture(tex, crop, uv, mat, vec2(neighbor_offset)) * intensity;
|
|
621
640
|
displaced_normal = normalize(cross(distorted1 - displaced_position, distorted2 - displaced_position));
|
|
622
641
|
return displaced_position;
|
|
623
|
-
}`,[e,t])}}();var
|
|
642
|
+
}`,[e,t])}}();var Tu=class extends Be{constructor(e=new Pe,t=new Pe,r=new Pe,n=new Pe,s=new Pe,l=new Pe,c=new Pe,f=new Pe,h=new Pe,p=new Pe,y=new Pe,g=new Pe){super("v3");this.nodeType="Noise";this.scale=e,this.size=t,this.move=r,this.fA=n,this.fB=s,this.distortion=l,this.colorA=c,this.colorB=f,this.colorC=h,this.colorD=p,this.alpha=y,this.noiseType=g,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t,r,n,s){e.require("uv"),e.requires.uv=[!0],e.addFragmentVariable(this.calpha,"float");let l=Object.values(Rs)[this.noiseType.value],c=new Se(`vec3 ${l}customNoise(float scale, vec3 size, float move, vec2 fA, vec2 fB, vec2 distortion, vec4 colorA, vec4 colorB, vec4 colorC, vec4 colorD, float alpha, out float calpha) {
|
|
624
643
|
vec3 st = position / size;
|
|
625
644
|
st /= scale;
|
|
626
|
-
vec3 q = vec3(${
|
|
627
|
-
${
|
|
628
|
-
${
|
|
629
|
-
vec3 r = vec3(${
|
|
630
|
-
${
|
|
631
|
-
${
|
|
632
|
-
float f = ${
|
|
645
|
+
vec3 q = vec3(${l}(st),
|
|
646
|
+
${l}(st + vec3(1.0)),
|
|
647
|
+
${l}(st + vec3(1.0)));
|
|
648
|
+
vec3 r = vec3(${l}(st + vec3(distortion, 1.0) * q + vec3(fA, 1.0) + move),
|
|
649
|
+
${l}(st + vec3(distortion, 1.0) * q + vec3(fB, 1.0) + move),
|
|
650
|
+
${l}(st * q));
|
|
651
|
+
float f = ${l}(st + r);
|
|
633
652
|
vec4 color;
|
|
634
653
|
color = mix(colorA, colorB, clamp((f * f) * 4.0, 0.0, 1.0));
|
|
635
654
|
color = mix(color, colorC, clamp(length(q), 0.0, 1.0));
|
|
@@ -640,7 +659,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
640
659
|
|
|
641
660
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
642
661
|
return clamp(color, 0.0, 1.0).rgb;
|
|
643
|
-
}`,[
|
|
662
|
+
}`,[Vr.simplex,Vr.simplexFractal,Vr.simplexAshima,Vr.fbm,Vr.perlin]),f=e.include(c),h=[];return h.push(this.scale.build(e,"f")),h.push(this.size.build(e,"v3")),h.push(this.move.build(e,"f")),h.push(this.fA.build(e,"v2")),h.push(this.fB.build(e,"v2")),h.push(this.distortion.build(e,"v2")),h.push(this.colorA.build(e,"v4")),h.push(this.colorB.build(e,"v4")),h.push(this.colorC.build(e,"v4")),h.push(this.colorD.build(e,"v4")),h.push(this.alpha.build(e,"f")),h.push(this.calpha),e.format(f+"("+h.join(",")+")",this.getType(e),t)}copy(e){return super.copy(e),this.scale.copy(e.scale),this.size.copy(e.size),this.move.copy(e.move),this.fA.copy(e.fA),this.fB.copy(e.fB),this.distortion.copy(e.distortion),this.colorA.copy(e.colorA),this.colorB.copy(e.colorB),this.colorC.copy(e.colorC),this.colorD.copy(e.colorD),this.alpha.copy(e.alpha),this.calpha=e.calpha,this.noiseType.copy(e.noiseType),this}};Tu.numOctaves=5;var Iu=class extends Be{constructor(e=new Pe,t=new Pe,r=new Pe,n=new Pe){super("v3");this.nodeType="Blend";this.a=e,this.b=t,this.alpha=r,this.mode=n}generate(e,t){if(e.isShader("fragment")){let r=[];return r.push(this.a.build(e,"c")),r.push(this.b.build(e,"c")),r.push(this.alpha.build(e,"f")),r.push(this.mode.build(e,"i")),e.format("spe_blend("+r.join(",")+")",this.getType(e),t)}else return console.warn("BlendNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.a.copy(e.a),this.b.copy(e.b),this.alpha.copy(e.alpha),this.mode.copy(e.mode),this}};var zs=class extends Be{constructor(e,t,r,n,s,l,c,f,h,p,y,g){super("v3");this.nodeType="Depth";this.gradientType=e,this.smooth=t,this.near=r,this.far=n,this.isVector=s,this.isWorldSpace=l,this.origin=c,this.direction=f,this.colors=h,this.steps=p,this.num=y,this.alpha=g,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){let r=`g${this.uuid.toString().replace(/-/g,"")}`,n=new Se(`vec3 ${r}_sdepth(float near, float far, vec3 origin, vec3 direction, vec4 colors[${r}_MAX_COLORS], float steps[10], float alpha, out float calpha) {
|
|
644
663
|
vec4 color = colors[0];
|
|
645
664
|
#ifdef ${r}_IS_VECTOR
|
|
646
665
|
#ifdef ${r}_LINEAR
|
|
@@ -680,21 +699,21 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
680
699
|
|
|
681
700
|
accumAlpha += ( 1.0 - accumAlpha ) * lalpha;
|
|
682
701
|
return color.rgb;
|
|
683
|
-
}`,[
|
|
702
|
+
}`,[zs.Nodes.vectorLinearWorldSpaceDepth,zs.Nodes.vectorLinearObjectSpaceDepth,zs.Nodes.vectorSphericalObjectSpaceDepth,zs.Nodes.vectorSphericalWorldSpaceDepth]);if(e.isShader("fragment")){e.define(`${r}_MAX_COLORS`,this.num.value+1),this.smooth.value&&e.define(`${r}_SMOOTH`),this.isVector.value>.5&&e.define(`${r}_IS_VECTOR`),this.gradientType.value===ws.Linear&&e.define(`${r}_LINEAR`),this.isWorldSpace.value>.5&&e.define(`${r}_WORLDSPACE`),e.require("worldPosition"),e.addFragmentVariable(this.calpha,"float");let s=e.include(n),l=[];return l.push(this.near.build(e,"f")),l.push(this.far.build(e,"f")),l.push(this.origin.build(e,"v3")),l.push(this.direction.build(e,"v3")),l.push(this.colors.build(e,"v4[]")),l.push(this.steps.build(e,"f[]")),l.push(this.alpha.build(e,"f")),l.push(this.calpha),e.format(s+"("+l.join(",")+")",this.getType(e),t)}else return console.warn("DepthNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.gradientType=e.gradientType.clone(),this.smooth=e.smooth.clone(),this.near=e.near.clone(),this.far=e.far.clone(),this.isVector=e.isVector.clone(),this.isWorldSpace=e.isWorldSpace.clone(),this.origin=e.origin.clone(),this.direction=e.direction.clone(),this.colors=e.colors.clone(),this.steps=e.steps.clone(),this.alpha=e.alpha.clone(),this.calpha=e.calpha,this}},Mu=zs;Mu.Nodes=function(){let e=new Se(`float vectorLinearWorldSpaceDepth(vec3 direction, vec3 origin, float near, float far) {
|
|
684
703
|
vec3 n = normalize(direction);
|
|
685
704
|
float dist = (n.x*(vWPosition.x - origin.x) + n.y*(vWPosition.y - origin.y) + n.z*(vWPosition.z - origin.z));
|
|
686
705
|
return ( dist - near ) / ( far - near );
|
|
687
|
-
}`),t=new
|
|
706
|
+
}`),t=new Se(`float vectorLinearObjectSpaceDepth(vec3 direction, vec3 origin, float near, float far) {
|
|
688
707
|
vec3 n = normalize(direction);
|
|
689
708
|
float dist = (n.x*(position.x - origin.x) + n.y*(position.y - origin.y) + n.z*(position.z - origin.z));
|
|
690
709
|
return ( dist - near ) / ( far - near );
|
|
691
|
-
}`),r=new
|
|
710
|
+
}`),r=new Se(`float vectorSphericalWorldSpaceDepth(vec3 origin, float near, float far) {
|
|
692
711
|
float dist = length(vWPosition - origin);
|
|
693
712
|
return ( dist - near ) / ( far - near );
|
|
694
|
-
}`),
|
|
713
|
+
}`),n=new Se(`float vectorSphericalObjectSpaceDepth(vec3 origin, float near, float far) {
|
|
695
714
|
float dist = length(position - origin);
|
|
696
715
|
return ( dist - near ) / ( far - near );
|
|
697
|
-
}`);return{vectorLinearWorldSpaceDepth:e,vectorLinearObjectSpaceDepth:t,vectorSphericalWorldSpaceDepth:r,vectorSphericalObjectSpaceDepth:
|
|
716
|
+
}`);return{vectorLinearWorldSpaceDepth:e,vectorLinearObjectSpaceDepth:t,vectorSphericalWorldSpaceDepth:r,vectorSphericalObjectSpaceDepth:n}}();var vd=class extends Be{constructor(e,t,r){super("v3");this.nodeType="Matcap";this.texture=e,this.alpha=t,this.mode=r,this.calpha=`g${this.uuid.toString().replace(/-/g,"")}_calpha`}generate(e,t){if(e.isShader("fragment")){e.addFragmentVariable(this.calpha,"float");let r=e.include(vd.Nodes.matcap);e.require("normal"),e.requires.normal=!0;let n=[];return n.push(this.texture.getTexture(e,"t")),n.push("normal"),n.push(this.alpha.build(e,"f")),n.push(this.mode.build(e,"i")),n.push(this.calpha),e.format(r+"("+n.join(",")+")",this.getType(e),t)}else return console.warn("MatcapNode is not compatible with "+e.shader+" shader."),e.format("vec3( 0.0 )",this.getType(e),t)}copy(e){return super.copy(e),this.texture=e.texture.clone(),this.alpha=e.alpha.clone(),this.mode=e.mode.clone(),this.calpha=e.calpha,this}},Au=vd;Au.Nodes=function(){return{matcap:new Se(`vec3 matcap(sampler2D matcapTex, vec3 normal, float alpha, int mode, out float calpha) {
|
|
698
717
|
vec3 viewDir = normalize( vViewPosition );
|
|
699
718
|
vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
|
|
700
719
|
vec3 y = cross( viewDir, x );
|
|
@@ -706,8 +725,8 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
706
725
|
|
|
707
726
|
return matcapColor.rgb;
|
|
708
727
|
}
|
|
709
|
-
`)}}();var Pt=class{constructor(e){this.id=2,this.layerCount=2,this.uuid=Vr.generateUUID(),this.needsUpdate=!1,this._material=e,this._layerNodes=[];let t=this._createLayer({id:0,type:Le.COLOR});this._material.color=t.color,this._material.alpha===void 0&&(this._material.alpha=new ee(1));let r=new ee(1),o=new ve(0);"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=r,this._material.shadingBlend=o),this._layerNodes.push({id:0,type:ke.COLOR,color:t.color,alpha:t.alpha,mode:t.mode}),this._layerNodes.push({id:1,type:ke.LIGHTING,alpha:r,mode:o}),this.head=t.layer,this.head.next=new Je(1,void 0,{type:Le.LIGHTING,alpha:r,mode:o}),this.attachLightNodes(this.getLightLayer())}get material(){return this._material}set material(e){var n;this._material=e;let t,r,o=this.head;for(;o!==void 0;){if(o.type===Le.LIGHTING){t=o.uniforms[`f${o.id}_alpha`],r=o.uniforms[`f${o.id}_mode`];break}o=o.next}"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=t,this._material.shadingBlend=r),this.attachLightNodes((n=e.userData.layers)==null?void 0:n.getLightLayer()),this.blendColors(),this.blendAfterColors(),this.blendPositions()}getLayersOfType(e){let t=[],r=this.head;for(;r;)r.type===e&&t.push(r),r=r.next;return t}addLayer(e){var o;if(e.id=(o=e.id)!=null?o:++this.id,this.layerCount++,e.type===Le.LIGHTING){let n=this.createLightLayer(e);return this.uuid=Vr.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),n}let t=this._createLayer(e),r=t.layer;if(this.head===void 0)this.head=r;else{let n=this.head;for(;n.next!=null;)n=n.next;n.next=r}return t.color&&this._layerNodes.push({id:r.id,type:ke.COLOR,color:t.color,alpha:t.alpha,mode:t.mode}),t.position&&this._layerNodes.push({id:r.id,type:ke.POSITION,position:t.position}),this.uuid=Vr.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),r}addLayerBeforeAt(e,t){var a;let r=this.head;e.id=(a=e.id)!=null?a:++this.id,this.layerCount++;let o=this._createLayer(e),n=o.layer;n.next=t;let s=0;if(r===t)this.head=n,o.color&&this._layerNodes.splice(0,0,{id:n.id,type:ke.COLOR,color:o.color,alpha:o.alpha,mode:o.mode}),o.position&&this._layerNodes.splice(0,0,{id:n.id,type:ke.POSITION,position:o.position});else{for(s=1;(r==null?void 0:r.next)!==t;)r=r==null?void 0:r.next,s++;r.next=n,o.color&&this._layerNodes.splice(s,0,{id:n.id,type:ke.COLOR,color:o.color,alpha:o.alpha,mode:o.mode}),o.position&&this._layerNodes.splice(s,0,{id:n.id,type:ke.POSITION,position:o.position})}return this.uuid=Vr.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),n}addLayerAt(e,t){var n;t.id=(n=t.id)!=null?n:++this.id,this.layerCount++;let r=this._createLayer(t),o=r.layer;if(r.color&&this._layerNodes.splice(e,0,{id:o.id,type:ke.COLOR,color:r.color,alpha:r.alpha,mode:r.mode}),r.position&&this._layerNodes.splice(e,0,{id:o.id,type:ke.POSITION,position:r.position}),e==0)o.next=this.head,this.head=o;else{let s=this.head,a=this.head.next;for(let l=0;l<e-1;l++)s=a,a=a.next;o.next=a,s.next=o}return this.uuid=Vr.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),o}removeLayer(e){let t=this.head,r,o=0;if((t==null?void 0:t.id)==e)this.head=t.next;else for(o=1,r=t,t=t==null?void 0:t.next;t!=null;){if(t.id==e){r.next=t.next;break}o++,r=t,t=t.next}return this.cleanupChangedLayer(t),this.blendColors(),this.blendAfterColors(),this.blendPositions(),this.uuid=Vr.generateUUID(),this.layerCount--,o}changeLayer(e,t){let r,o=this.head,n;if((o==null?void 0:o.id)==e){let s=this._createLayer(O({id:e,uuid:o.uuid},t));n=s.layer,n.next=o.next,this.head=n,s.color&&(this._layerNodes[0]={id:n.id,type:ke.COLOR,color:s.color,alpha:s.alpha,mode:s.mode}),s.position&&(this._layerNodes[0]={id:n.id,type:ke.POSITION,position:s.position}),n.uniforms[`f${e}_mode`].value=o.uniforms[`f${e}_mode`].value,n.uniforms[`f${e}_alpha`].value=o.uniforms[`f${e}_alpha`].value}else{r=o,o=o.next;let s=1;for(;o!=null;){if(o.id==e){let a=this._createLayer(O({id:e,uuid:o.uuid},t));n=a.layer,r.next=n,n.next=o.next,a.color&&(this._layerNodes[s]={id:e,type:ke.COLOR,color:a.color,alpha:a.alpha,mode:a.mode}),a.position&&(this._layerNodes[s]={id:e,type:ke.POSITION,position:a.position}),n.uniforms[`f${e}_mode`].value=o.uniforms[`f${e}_mode`].value,n.uniforms[`f${e}_alpha`].value=o.uniforms[`f${e}_alpha`].value;break}r=o,o=o.next,s++}}return this.uuid=Vr.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),n}getLayer(e){let t=this.head;for(;t!=null&&t.id!=e;)t=t.next;return t}getLayerByUuid(e){let t=this.head;for(;t!==void 0;){if(t.uuid===e)return t;t=t.next}}getLayers(){let e=[],t=this.head;for(;t!=null;)e.push(t),t=t.next;return e}getLayerPosition(e){let t=this.head,r=0;for(;t!==void 0&&t.id!=e;)r++,t=t.next;return r}getDefines(){}getBeforeProgram(){}getLightingProgram(){}getAfterProgram(){}getVarPrograms(){}getUniforms(){}moveLayer(e,t){let r,o=this.head,n;if(e==0)r=this.head,this.head=r.next;else{for(let a=0;a<e;a++)n=o,o=o.next;n.next=o.next,r=o}if(o=this.head,n=void 0,t==0)r.next=this.head,this.head=r;else{for(let a=0;a<t-1;a++)o=o.next;r.next=o==null?void 0:o.next,o.next=r}let s=this._layerNodes.splice(e,1)[0];this._layerNodes.splice(t,0,s),this.uuid=Vr.generateUUID(),this.blendColors(),this.blendAfterColors()}updateLayerUniform(){this.uuid=Vr.generateUUID(),this.blendColors(),this.blendAfterColors()}copy(e){this.needsUpdate=!1,this.layerCount=e.layerCount,this._layerNodes=[],this.layerCount=0,this.head=void 0,this.rebuildLayerNodes(this.head,e.head);let t=e.head,r=this.head;for(;t.next!=null;)this.rebuildLayerNodes(r,t.next),r=r.next,t=t.next;return this.id=e.id,this.uuid=e.uuid,this.blendColors(),this.blendAfterColors(),this.blendPositions(),this}createLightLayer(e){let t=new ee(e.alpha),r=new ve(e.mode);this._material.shadingAlpha=t,this._material.shadingBlend=r,this._layerNodes.push({id:e.id,type:ke.LIGHTING,alpha:t,mode:r});let o=new Je(e.id,void 0,{type:Le.LIGHTING,alpha:t,mode:r});if(this.head===void 0)this.head=o;else{let n=this.head;for(;n.next!=null;)n=n.next;n.next=o}return this.attachLightNodes(this.getLightLayer()),o}rebuildLayerNodes(e,t,r=!1){if(t.type===Le.LIGHTING){let o=r?t.uniforms[`f${t.id}_alpha`]:new ee(t.uniforms[`f${t.id}_alpha`].value),n=r?t.uniforms[`f${t.id}_mode`]:new ve(t.uniforms[`f${t.id}_mode`].value);this._material.shadingAlpha=o,this._material.shadingBlend=n,this._layerNodes.push({id:t.id,type:ke.LIGHTING,alpha:o,mode:n}),this.head===void 0?this.head=new Je(t.id,t.uuid,{type:Le.LIGHTING,alpha:o,mode:n}):e&&(e.next=new Je(t.id,t.uuid,{type:Le.LIGHTING,alpha:o,mode:n})),this.attachLightNodes(t)}else{let o={type:t.type,id:t.id};for(let n in t.uniforms){let s=t.getName(n);if(!s)continue;let a=`f${t.id}_${s}`;if(Array.isArray(t.uniforms[a].value))o[s]=t.uniforms[a].value.map(l=>l.clone&&!r?l.clone():l);else{let l=t.uniforms[a].value;if(s==="transmissionDepthMap"){o[s]=l;continue}l!=null&&(o[s]=l.clone&&!r&&!l.isRenderTargetTexture?l.clone():l)}}this.addLayer(o)}}attachLightNodes(e){var o,n,s,a,l,c,d,u,p,f,m;let t={},r=this.getLightLayer();switch(this._material.userData.category){case"Lambert":t.emissive=new Ge((n=(o=e==null?void 0:e.getValue("emissive"))==null?void 0:o.clone())!=null?n:0);break;case"Phong":t.shininess=new ee((s=e==null?void 0:e.getValue("shininess"))!=null?s:30),t.specular=new Ge((l=(a=e==null?void 0:e.getValue("specular"))==null?void 0:a.clone())!=null?l:1118481);break;case"Toon":t.shininess=new ee((c=e==null?void 0:e.getValue("shininess"))!=null?c:30),t.specular=new Ge((u=(d=e==null?void 0:e.getValue("specular"))==null?void 0:d.clone())!=null?u:1118481);break;case"Physical":t.roughness=new ee((p=e==null?void 0:e.getValue("roughness"))!=null?p:.3),t.metalness=new ee((f=e==null?void 0:e.getValue("metalness"))!=null?f:0),t.reflectivity=new ee((m=e==null?void 0:e.getValue("reflectivity"))!=null?m:.5);break;default:break}Object.keys(t).forEach(x=>{this._material[x]=t[x],r.uniforms[`f${r.id}_${x}`]=t[x]})}clone(e){return new Pt(e).copy(this)}toJSON(e){return{id:this.id,uuid:this.uuid,head:this.head.toJSON(e)}}fromJSON(e,t,r){let o=new Je(e.head.id,void 0,{type:e.head.type}).fromJSON(e.head,t),n=e.head.next,s=o;for(;n!=null;)s.next=new Je(n.id,void 0,{type:n.type}).fromJSON(n,t),n=n.next,s=s.next;this._layerNodes=[],this.head=void 0,this.rebuildLayerNodes(this.head,o,!0);let a=o;for(s=this.head;a.next!=null;)this.rebuildLayerNodes(s,a.next,!0),s=s.next,a=a.next;return this._material=r,this.id=e.id,this.uuid=e.uuid,this.blendColors(),this.blendAfterColors(),this.blendPositions(),this}getLightLayer(){var t;let e=this.head;for(;e!==void 0&&e.type!=="light";)e=(t=e.next)!=null?t:e;return e}dispose(){let e=this.head;for(this._layerNodes=[],this.layerCount=0;e!==void 0;)e.hasOwnProperty("dispose")===!0&&e.dispose(),e=e.next;this.head=void 0}_createLayer(e){var r,o,n,s,a,l,c,d,u,p,f,m,x,y,N,L,w,B,S,_,T,h,I,b,P,v,D,Z,V,ie,oe,ge,xe,A,j,g,z,R,U,q,W,J,E,H,k,se,F,K,X,te,he,Y,ne,Se,me,Oe,He,rt,pt,zt,Tr,xt,Ir,uo,ho,qe,bt,Et,bn,vn,Sn,wn,Nn,Cn,$t,Li,ut,jo,Ln;let t=e.type;switch(t){case Le.COLOR:{let ye=new Ge((r=e.color)!=null?r:nt),Ce=new ee((o=e.alpha)!=null?o:1),we=new Be("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");we.keywords.alpha=Ce;let Ne=new ve((n=e.mode)!=null?n:0);return ye.alpha=Ce,{layer:new Je(e.id,e.uuid,{type:t,color:ye,alpha:Ce,calpha:we,mode:Ne}),color:ye,alpha:we,mode:Ne}}case Le.TEXTURE:{let ye=(s=e.texture)!=null?s:new Fr,Ce=ye.matrix;e.mat&&Ce.copy(e.mat),ye.needsUpdate=!0;let we=new ee((a=e.crop)!=null?a:0),Ne=new ve((l=e.projection)!=null?l:0),Te=new ve((c=e.axis)!=null?c:0),_e=new It(e.size?new so(e.size[0],e.size[1]):new so(100,100)),ze=new ee((d=e.alpha)!=null?d:1),Ee=new ve((u=e.mode)!=null?u:0),De=new Bt(ye),We=new Mt((p=e.textureSize)!=null?p:new ao(ye.image?ye.image.width:0,ye.image?ye.image.height:0)),ot=new sa(De,We,we,Ne,Te,_e,ze,Ee),Jt=new Be(ot.calpha,"f");return{layer:new Je(e.id,e.uuid,{type:t,texture:De,textureSize:We,crop:we,projection:Ne,axis:Te,size:_e,mat:ot.mat,alpha:ze,calpha:Jt,mode:Ee}),color:ot,alpha:Jt,mode:Ee}}case Le.MATCAP:{let ye=(f=e.texture)!=null?f:new Fr;ye.needsUpdate=!0;let Ce=new ee((m=e.alpha)!=null?m:1),we=new Bt(ye),Ne=new ve((x=e.mode)!=null?x:0),Te=new fa(we,Ce,Ne),_e=new Be(Te.calpha,"f");return{layer:new Je(e.id,e.uuid,{type:t,texture:we,alpha:Ce,calpha:_e,mode:Ne}),color:Te,alpha:_e,mode:Ne}}case Le.FRESNEL:{let ye=new Ge((y=e.color)!=null?y:16777215),Ce=new ee((N=e.bias)!=null?N:.1),we=new ee((L=e.scale)!=null?L:1),Ne=new ee((w=e.intensity)!=null?w:2),Te=new ee((B=e.factor)!=null?B:1),_e=new ee((S=e.alpha)!=null?S:1),ze=new ve((_=e.mode)!=null?_:0),Ee=new aa(ye,Ce,we,Ne,Te,_e,ze),De=new Be(Ee.calpha,"f");return{layer:new Je(e.id,e.uuid,{type:t,color:ye,bias:Ce,scale:we,intensity:Ne,factor:Te,alpha:_e,calpha:De,mode:ze}),color:Ee,alpha:De,mode:ze}}case Le.RAINBOW:{let ye=new ee((T=e.filmThickness)!=null?T:30),Ce=new ee((h=e.movement)!=null?h:0),we=new Mt((I=e.wavelengths)!=null?I:new ao(0,0,0)),Ne=new ee((b=e.noiseStrength)!=null?b:0),Te=new ee((P=e.noiseScale)!=null?P:1),_e=new Mt((v=e.offset)!=null?v:new ao(0,0,0)),ze=new ee((D=e.alpha)!=null?D:1),Ee=new la(ye,Ce,we,Ne,Te,_e,ze),De=new Be(Ee.calpha,"f"),We=new ve((Z=e.mode)!=null?Z:0);return{layer:new Je(e.id,e.uuid,{type:t,filmThickness:ye,movement:Ce,wavelengths:we,noiseStrength:Ne,noiseScale:Te,offset:_e,alpha:ze,calpha:De,mode:We}),color:Ee,alpha:De,mode:We}}case Le.TRANSMISSION:{let ye=new ee((V=e.thickness)!=null?V:10),Ce=new ee((ie=e.ior)!=null?ie:1.5),we=new ee((oe=e.roughness)!=null?oe:.5),Ne=new It((ge=e.transmissionSamplerSize)!=null?ge:new so(2048,2048)),Te=(xe=e.transmissionSamplerMap)!=null?xe:new Fr,_e=(A=e.transmissionDepthMap)!=null?A:new Fr,ze=new Bt(Te),Ee=new Bt(_e),De=window.innerWidth,We=window.innerHeight,ot=De>=We?new It(We/De,1):new It(1,De/We),Jt=new ee((j=e.alpha)!=null?j:1),Mr=new ca(ye,Ce,we,Ne,ze,Ee,ot,Jt),kr=new Be(Mr.calpha,"f"),Hr=new ve((g=e.mode)!=null?g:0);return{layer:new Je(e.id,e.uuid,{type:t,thickness:ye,ior:Ce,roughness:we,transmissionSamplerSize:Ne,transmissionSamplerMap:ze,transmissionDepthMap:Ee,aspectRatio:ot,alpha:Jt,calpha:kr,mode:Hr}),color:Mr,alpha:kr,mode:Hr}}case Le.DEPTH:{let ye=new ve((z=e.gradientType)!=null?z:0),Ce=new na((R=e.smooth)!=null?R:!1),we=new ee((U=e.near)!=null?U:50),Ne=new ee((q=e.far)!=null?q:200),Te=new ee((W=e.isVector)!=null?W:1),_e=new ee((J=e.isWorldSpace)!=null?J:0),ze=new Mt((E=e.origin)!=null?E:new ao),Ee=new Mt((H=e.direction)!=null?H:new ao),De=new ve((k=e.num)!=null?k:0),We;e.colors?We=new yi(De.value+1,e.colors):(We=new yi(De.value+1,new ya(0,0,0,1)),We.value[1]=new ya(1,1,1,1));let ot;e.steps?ot=new gi(e.steps.length,e.steps):(ot=new gi(10,1),ot.value[0]=0);let Jt=new ee((se=e.alpha)!=null?se:1),Mr=new ve((F=e.mode)!=null?F:0),kr=new ma(ye,Ce,we,Ne,Te,_e,ze,Ee,We,ot,De,Jt),Hr=new Be(kr.calpha,"f");return{layer:new Je(e.id,e.uuid,{type:t,gradientType:ye,smooth:Ce,near:we,far:Ne,isVector:Te,isWorldSpace:_e,origin:ze,direction:Ee,colors:We,steps:ot,num:De,alpha:Jt,calpha:Hr,mode:Mr}),color:kr,alpha:Hr,mode:Mr}}case Le.NOISE:{let ye=new ee((K=e.scale)!=null?K:1),Ce=new Mt((X=e.size)!=null?X:new ao(100,100,100)),we=new ee((te=e.move)!=null?te:1),Ne=new It((he=e.fA)!=null?he:new so(1.7,9.2)),Te=new It((Y=e.fB)!=null?Y:new so(8.3,2.8)),_e=new It((ne=e.distortion)!=null?ne:new so(1,1)),ze=new no(e.colorA),Ee=new no(e.colorB),De=new no(e.colorC),We=new no(e.colorD),ot=new ee((Se=e.alpha)!=null?Se:1),Jt=new ve((me=e.mode)!=null?me:0),Mr=new ve((Oe=e.noiseType)!=null?Oe:0),kr=new ua(ye,Ce,we,Ne,Te,_e,ze,Ee,De,We,ot,Mr),Hr=new Be(kr.calpha,"f");return{layer:new Je(e.id,e.uuid,{type:t,scale:ye,size:Ce,move:we,fA:Ne,fB:Te,distortion:_e,colorA:ze,colorB:Ee,colorC:De,colorD:We,alpha:ot,calpha:Hr,mode:Jt,noiseType:Mr}),color:kr,alpha:Hr,mode:Jt}}case Le.NORMAL:{let ye=new Mt((He=e.cnormal)!=null?He:new ao(1,1,1)),Ce=new ee((rt=e.alpha)!=null?rt:1),we=new ve((pt=e.mode)!=null?pt:0),Ne=new da(ye,Ce),Te=new Be("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");return Te.keywords.alpha=Ce,{layer:new Je(e.id,e.uuid,{type:t,cnormal:ye,alpha:Ce,calpha:Te,mode:we}),color:Ne,alpha:Te,mode:we}}case Le.GRADIENT:{let ye=new ve((zt=e.gradientType)!=null?zt:0),Ce=new na((Tr=e.smooth)!=null?Tr:!1),we;e.colors?we=new yi(e.colors.length,e.colors):(we=new yi(10,new ya(0,0,0,1)),we.value[1]=new ya(1,1,1,1));let Ne;e.steps?Ne=new gi(e.steps.length,e.steps):(Ne=new gi(10,1),Ne.value[0]=0);let Te=new It((xt=e.offset)!=null?xt:new so(0,0)),_e=new It((Ir=e.morph)!=null?Ir:new so(0,0)),ze=new ee((uo=e.angle)!=null?uo:0),Ee=new ee((ho=e.alpha)!=null?ho:1),De=new ve((qe=e.mode)!=null?qe:0),We=new pa(ye,Ce,we,Ne,Te,_e,ze,Ee),ot=new Be(We.calpha,"f");return{layer:new Je(e.id,e.uuid,{type:t,gradientType:ye,smooth:Ce,colors:we,steps:Ne,offset:Te,morph:_e,angle:ze,alpha:Ee,calpha:ot,mode:De}),color:We,alpha:ot,mode:De}}case Le.DISPLACE:{let ye=new ve((bt=e.displacementType)!=null?bt:0);if(ye.value===0){let Ce=new Mt((Et=e.offset)!=null?Et:new ao(0,0,0)),we=new ee((bn=e.scale)!=null?bn:10),Ne=new ee((vn=e.intensity)!=null?vn:8),Te=new ee((Sn=e.movement)!=null?Sn:1),_e=new ee((wn=e.alpha)!=null?wn:1),ze=new ve((Nn=e.mode)!=null?Nn:0),Ee=new ve((Cn=e.noiseType)!=null?Cn:0),De=new tn(ye,Ne,Te,Ce,we,Ee);return{layer:new Je(e.id,e.uuid,{displacementType:ye,type:t,offset:Ce,scale:we,intensity:Ne,movement:Te,alpha:_e,mode:ze,noiseType:Ee}),position:De}}else if(ye.value===1){let Ce=($t=e.texture)!=null?$t:new Fr,we=Ce.matrix;e.mat&&we.copy(e.mat),Ce.needsUpdate=!0;let Ne=new ee((Li=e.intensity)!=null?Li:8),Te=new Bt(Ce),_e=new ee((ut=e.crop)!=null?ut:0),ze=new ee((jo=e.alpha)!=null?jo:1),Ee=new ve((Ln=e.mode)!=null?Ln:0),De=new tn(ye,Ne,Te,_e);return{layer:new Je(e.id,e.uuid,{displacementType:ye,type:t,intensity:Ne,texture:Te,crop:_e,mat:De.mat,alpha:ze,mode:Ee}),position:De}}return{}}}return{}}blendColors(){let e=this._layerNodes.findIndex(r=>r.type===ke.COLOR),t=this._layerNodes.findIndex(r=>r.type===ke.LIGHTING);if(e!==-1&&e<t){let r=this._layerNodes[e].color;for(let o=e+1;o<t;++o){let n=this._layerNodes[o];n.type===ke.COLOR&&(r=new ha(r,n.color,n.alpha,n.mode))}this._material.color=r}else this._material.color=void 0}blendAfterColors(){let e=new Be("outgoingLight","f"),t=this._layerNodes.findIndex(r=>r.type===ke.LIGHTING);if(this._layerNodes.length>t+1){for(let r=t+1;r<this._layerNodes.length;++r){let o=this._layerNodes[r];o.type===ke.COLOR&&(e=new ha(e,o.color,o.alpha,o.mode))}"afterColor"in this._material&&(this._material.afterColor=e)}else"afterColor"in this._material&&(this._material.afterColor=void 0)}blendPositions(){let e=this._layerNodes.filter(t=>t.type===ke.POSITION);if(e.length>0){let t=e[0].position;for(let r=1;r<e.length;++r)e[r]&&(t=new qt(t,e[r].position,qt.ADD),t=new qt(t,new ee(.5).setReadonly(!0),qt.MUL));this._material.position=t}else this._material.position=void 0}cleanupChangedLayer(e){switch(this._layerNodes=this._layerNodes.filter(t=>t.id!==e.id),e.type){case Le.DISPLACE:{this.blendPositions();break}default:{this.blendColors(),this.blendAfterColors();break}}}};var rr=class extends kS{constructor(e,t,r){super(r);this.isNodeMaterial=!0;this.type="NodeMaterial";this.wireframeLinecap="";this.wireframeLinejoin="";this.uniformsBackup={};this.userData={type:"",category:"",nodeType:""};this.fog=!0,this.vertex=e!=null?e:new ia(new wt(wt.PROJECTION)),this.fragment=t!=null?t:new ia(new Ge(nt)),this.updaters=[],this.isDetached=!0,this.dithering=!0,this.onBeforeCompile=this._onBeforeCompile}getDefines(){return this.defines}getUniforms(){return this.uniforms}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}_onBeforeCompile(e,t){this.build({renderer:t}),e.defines=this.defines,e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.extensionDerivatives=this.extensions.derivatives===!0,e.extensionFragDepth=this.extensions.fragDepth===!0,e.extensionDrawBuffers=this.extensions.drawBuffers===!0,e.extensionShaderTextureLOD=this.extensions.shaderTextureLOD===!0}_getLayerStack(e){let t=new Pt(this);return e&&(async()=>{for(;e.image===void 0;)await new Promise(r=>requestAnimationFrame(r));t.addLayerAt(1,{type:Le.TEXTURE,texture:e}),this.dispose()})(),t}clampUniformsForPreview(e,t){let r=(o,n,s)=>Math.min(Math.max(o,n),s);if(this.userData.layers){for(let o of this.userData.layers.getLayers())if(o.type==Le.DISPLACE){this.uniformsBackup[`f${o.id}_intensity`]=o.uniforms[`f${o.id}_intensity`].value;let n=r(o.uniforms[`f${o.id}_intensity`].value,e,t);o.uniforms[`f${o.id}_intensity`].value=n}}}restoreClampedUniforms(){if(this.userData.layers)for(let e of this.userData.layers.getLayers())e.type==Le.DISPLACE&&(e.uniforms[`f${e.id}_intensity`].value=this.uniformsBackup[`f${e.id}_intensity`])}customProgramCacheKey(){return this.getHash()}updateFrame(e){for(let t=0;t<this.updaters.length;++t)e.updateNode(this.updaters[t])}build(e){var r;e=e!=null?e:{};let t=(r=e.builder)!=null?r:new El;return t.setMaterial(this,e.renderer),t.build(this.vertex,this.fragment),this.vertexShader=t.getCode("vertex"),this.fragmentShader=t.getCode("fragment"),this.defines=t.defines,this.uniforms=t.uniforms,this.extensions=t.extensions,this.updaters=t.updaters,this.fog=t.requires.fog,this.lights=t.requires.lights,this.transparent=t.requires.transparent||this.blending>US,this}getHash(){let e="{";return e+='"vertex":'+this.vertex.getHash()+",",e+='"fragment":'+this.fragment.getHash(),e+="}",e}copy(e){let t=this.uuid;for(let r in e)this[r]=e[r];return this.uuid=t,e.userData!==void 0&&(this.userData=JSON.parse(JSON.stringify(e.userData))),this}toJSON(e){let t=this.userData.layers;this.userData.layers=void 0;let r=super.toJSON(e);return r.type="ShaderMaterial",r.userData={type:this.userData.type,category:this.userData.category,nodeType:this.type,layers:t.toJSON(e)},r.vertex=this.vertex.toJSON(e).uuid,r.fragment=this.fragment.toJSON(e).uuid,delete r.vertexShader,delete r.fragmentShader,delete r.color,delete r.shininess,delete r.specular,delete r.roughness,delete r.metalness,delete r.uniforms,e&&!e.materials[this.uuid]&&(e.materials[this.uuid]=r),this.userData.layers=t,r}fromJSON(e,t){var r;this.defines=(r=e.defines)!=null?r:{},this.depthFunc=e.depthFunc,this.depthWrite=e.depthWrite,this.side=e.side!==void 0?e.side:HS,this.transparent=e.transparent,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.wireframe=e.wireframe,this.userData.layers.fromJSON(e.userData.layers,t,this)}};Object.defineProperties(rr.prototype,{properties:{get:function(){return this.fragment.properties}},needsUpdate:{set:function(i){i===!0&&this.version++,this.needsCompile=i},get:function(){return this.needsCompile}}});import{UniformsLib as qS,UniformsUtils as WS}from"three";var Wl=class extends pe{constructor(){super("basic");this.nodeType="Basic";this.color=new Ge(nt)}generate(e){let t;if(e.isShader("vertex")){let r=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(WS.merge([qS.fog])),e.addParsCode(["varying vec3 vViewPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>"].join(`
|
|
710
|
-
`));let
|
|
728
|
+
`)}}();var Ir=class{constructor(e){this.id=2,this.layerCount=2,this.uuid=Ci.generateUUID(),this.needsUpdate=!1,this._material=e,this._layerNodes=[];let t=this._createLayer({id:0,type:qe.COLOR});this._material.color=t.color,this._material.alpha===void 0&&(this._material.alpha=new ve(1));let r=new ve(1),n=new Ye(0);"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=r,this._material.shadingBlend=n),this._layerNodes.push({id:0,type:Mt.COLOR,color:t.color,alpha:t.alpha,mode:t.mode}),this._layerNodes.push({id:1,type:Mt.LIGHTING,alpha:r,mode:n}),this.head=t.layer,this.head.next=new Bt(1,void 0,{type:qe.LIGHTING,alpha:r,mode:n}),this.attachLightNodes(this.getLightLayer())}get material(){return this._material}set material(e){var s;this._material=e;let t,r,n=this.head;for(;n!==void 0;){if(n.type===qe.LIGHTING){t=n.uniforms[`f${n.id}_alpha`],r=n.uniforms[`f${n.id}_mode`];break}n=n.next}"shadingAlpha"in this._material&&"shadingBlend"in this._material&&(this._material.shadingAlpha=t,this._material.shadingBlend=r),this.attachLightNodes((s=e.userData.layers)==null?void 0:s.getLightLayer()),this.blendColors(),this.blendAfterColors(),this.blendPositions()}getLayersOfType(e){let t=[],r=this.head;for(;r;)r.type===e&&t.push(r),r=r.next;return t}addLayer(e){var n;if(e.id=(n=e.id)!=null?n:++this.id,this.layerCount++,e.type===qe.LIGHTING){let s=this.createLightLayer(e);return this.uuid=Ci.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),s}let t=this._createLayer(e),r=t.layer;if(this.head===void 0)this.head=r;else{let s=this.head;for(;s.next!=null;)s=s.next;s.next=r}return t.color&&this._layerNodes.push({id:r.id,type:Mt.COLOR,color:t.color,alpha:t.alpha,mode:t.mode}),t.position&&this._layerNodes.push({id:r.id,type:Mt.POSITION,position:t.position}),this.uuid=Ci.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),r}addLayerBeforeAt(e,t){var c;let r=this.head;e.id=(c=e.id)!=null?c:++this.id,this.layerCount++;let n=this._createLayer(e),s=n.layer;s.next=t;let l=0;if(r===t)this.head=s,n.color&&this._layerNodes.splice(0,0,{id:s.id,type:Mt.COLOR,color:n.color,alpha:n.alpha,mode:n.mode}),n.position&&this._layerNodes.splice(0,0,{id:s.id,type:Mt.POSITION,position:n.position});else{for(l=1;(r==null?void 0:r.next)!==t;)r=r==null?void 0:r.next,l++;r.next=s,n.color&&this._layerNodes.splice(l,0,{id:s.id,type:Mt.COLOR,color:n.color,alpha:n.alpha,mode:n.mode}),n.position&&this._layerNodes.splice(l,0,{id:s.id,type:Mt.POSITION,position:n.position})}return this.uuid=Ci.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),s}addLayerAt(e,t){var s;t.id=(s=t.id)!=null?s:++this.id,this.layerCount++;let r=this._createLayer(t),n=r.layer;if(r.color&&this._layerNodes.splice(e,0,{id:n.id,type:Mt.COLOR,color:r.color,alpha:r.alpha,mode:r.mode}),r.position&&this._layerNodes.splice(e,0,{id:n.id,type:Mt.POSITION,position:r.position}),e==0)n.next=this.head,this.head=n;else{let l=this.head,c=this.head.next;for(let f=0;f<e-1;f++)l=c,c=c.next;n.next=c,l.next=n}return this.uuid=Ci.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),n}removeLayer(e){let t=this.head,r,n=0;if((t==null?void 0:t.id)==e)this.head=t.next;else for(n=1,r=t,t=t==null?void 0:t.next;t!=null;){if(t.id==e){r.next=t.next;break}n++,r=t,t=t.next}return this.cleanupChangedLayer(t),this.blendColors(),this.blendAfterColors(),this.blendPositions(),this.uuid=Ci.generateUUID(),this.layerCount--,n}changeLayer(e,t){let r,n=this.head,s;if((n==null?void 0:n.id)==e){let l=this._createLayer(U({id:e,uuid:n.uuid},t));s=l.layer,s.next=n.next,this.head=s,l.color&&(this._layerNodes[0]={id:s.id,type:Mt.COLOR,color:l.color,alpha:l.alpha,mode:l.mode}),l.position&&(this._layerNodes[0]={id:s.id,type:Mt.POSITION,position:l.position}),s.uniforms[`f${e}_mode`].value=n.uniforms[`f${e}_mode`].value,s.uniforms[`f${e}_alpha`].value=n.uniforms[`f${e}_alpha`].value}else{r=n,n=n.next;let l=1;for(;n!=null;){if(n.id==e){let c=this._createLayer(U({id:e,uuid:n.uuid},t));s=c.layer,r.next=s,s.next=n.next,c.color&&(this._layerNodes[l]={id:e,type:Mt.COLOR,color:c.color,alpha:c.alpha,mode:c.mode}),c.position&&(this._layerNodes[l]={id:e,type:Mt.POSITION,position:c.position}),s.uniforms[`f${e}_mode`].value=n.uniforms[`f${e}_mode`].value,s.uniforms[`f${e}_alpha`].value=n.uniforms[`f${e}_alpha`].value;break}r=n,n=n.next,l++}}return this.uuid=Ci.generateUUID(),this.blendColors(),this.blendAfterColors(),this.blendPositions(),s}getLayer(e){let t=this.head;for(;t!=null&&t.id!=e;)t=t.next;return t}getLayerByUuid(e){let t=this.head;for(;t!==void 0;){if(t.uuid===e)return t;t=t.next}}getLayers(){let e=[],t=this.head;for(;t!=null;)e.push(t),t=t.next;return e}getLayerPosition(e){let t=this.head,r=0;for(;t!==void 0&&t.id!=e;)r++,t=t.next;return r}getDefines(){}getBeforeProgram(){}getLightingProgram(){}getAfterProgram(){}getVarPrograms(){}getUniforms(){}moveLayer(e,t){let r,n=this.head,s;if(e==0)r=this.head,this.head=r.next;else{for(let c=0;c<e;c++)s=n,n=n.next;s.next=n.next,r=n}if(n=this.head,s=void 0,t==0)r.next=this.head,this.head=r;else{for(let c=0;c<t-1;c++)n=n.next;r.next=n==null?void 0:n.next,n.next=r}let l=this._layerNodes.splice(e,1)[0];this._layerNodes.splice(t,0,l),this.uuid=Ci.generateUUID(),this.blendColors(),this.blendAfterColors()}updateLayerUniform(){this.uuid=Ci.generateUUID(),this.blendColors(),this.blendAfterColors()}copy(e){this.needsUpdate=!1,this.layerCount=e.layerCount,this._layerNodes=[],this.layerCount=0,this.head=void 0,this.rebuildLayerNodes(this.head,e.head);let t=e.head,r=this.head;for(;t.next!=null;)this.rebuildLayerNodes(r,t.next),r=r.next,t=t.next;return this.id=e.id,this.uuid=e.uuid,this.blendColors(),this.blendAfterColors(),this.blendPositions(),this}createLightLayer(e){let t=new ve(e.alpha),r=new Ye(e.mode);this._material.shadingAlpha=t,this._material.shadingBlend=r,this._layerNodes.push({id:e.id,type:Mt.LIGHTING,alpha:t,mode:r});let n=new Bt(e.id,void 0,{type:qe.LIGHTING,alpha:t,mode:r});if(this.head===void 0)this.head=n;else{let s=this.head;for(;s.next!=null;)s=s.next;s.next=n}return this.attachLightNodes(this.getLightLayer()),n}rebuildLayerNodes(e,t,r=!1){if(t.type===qe.LIGHTING){let n=r?t.uniforms[`f${t.id}_alpha`]:new ve(t.uniforms[`f${t.id}_alpha`].value),s=r?t.uniforms[`f${t.id}_mode`]:new Ye(t.uniforms[`f${t.id}_mode`].value);this._material.shadingAlpha=n,this._material.shadingBlend=s,this._layerNodes.push({id:t.id,type:Mt.LIGHTING,alpha:n,mode:s}),this.head===void 0?this.head=new Bt(t.id,t.uuid,{type:qe.LIGHTING,alpha:n,mode:s}):e&&(e.next=new Bt(t.id,t.uuid,{type:qe.LIGHTING,alpha:n,mode:s})),this.attachLightNodes(t)}else{let n={type:t.type,id:t.id};for(let s in t.uniforms){let l=t.getName(s);if(!l)continue;let c=`f${t.id}_${l}`;if(Array.isArray(t.uniforms[c].value))n[l]=t.uniforms[c].value.map(f=>f.clone&&!r?f.clone():f);else{let f=t.uniforms[c].value;if(l==="transmissionDepthMap"){n[l]=f;continue}f!=null&&(n[l]=f.clone&&!r&&!f.isRenderTargetTexture?f.clone():f)}}this.addLayer(n)}}attachLightNodes(e){var n,s,l,c,f,h,p,y,g,w,S;let t={},r=this.getLightLayer();switch(this._material.userData.category){case"Lambert":t.emissive=new vt((s=(n=e==null?void 0:e.getValue("emissive"))==null?void 0:n.clone())!=null?s:0);break;case"Phong":t.shininess=new ve((l=e==null?void 0:e.getValue("shininess"))!=null?l:30),t.specular=new vt((f=(c=e==null?void 0:e.getValue("specular"))==null?void 0:c.clone())!=null?f:1118481);break;case"Toon":t.shininess=new ve((h=e==null?void 0:e.getValue("shininess"))!=null?h:30),t.specular=new vt((y=(p=e==null?void 0:e.getValue("specular"))==null?void 0:p.clone())!=null?y:1118481);break;case"Physical":t.roughness=new ve((g=e==null?void 0:e.getValue("roughness"))!=null?g:.3),t.metalness=new ve((w=e==null?void 0:e.getValue("metalness"))!=null?w:0),t.reflectivity=new ve((S=e==null?void 0:e.getValue("reflectivity"))!=null?S:.5);break;default:break}Object.keys(t).forEach(T=>{this._material[T]=t[T],r.uniforms[`f${r.id}_${T}`]=t[T]})}clone(e){return new Ir(e).copy(this)}toJSON(e){return{id:this.id,uuid:this.uuid,head:this.head.toJSON(e)}}fromJSON(e,t,r){let n=new Bt(e.head.id,void 0,{type:e.head.type}).fromJSON(e.head,t),s=e.head.next,l=n;for(;s!=null;)l.next=new Bt(s.id,void 0,{type:s.type}).fromJSON(s,t),s=s.next,l=l.next;this._layerNodes=[],this.head=void 0,this.rebuildLayerNodes(this.head,n,!0);let c=n;for(l=this.head;c.next!=null;)this.rebuildLayerNodes(l,c.next,!0),l=l.next,c=c.next;return this._material=r,this.id=e.id,this.uuid=e.uuid,this.blendColors(),this.blendAfterColors(),this.blendPositions(),this}getLightLayer(){var t;let e=this.head;for(;e!==void 0&&e.type!=="light";)e=(t=e.next)!=null?t:e;return e}dispose(){let e=this.head;for(this._layerNodes=[],this.layerCount=0;e!==void 0;)e.hasOwnProperty("dispose")===!0&&e.dispose(),e=e.next;this.head=void 0}_createLayer(e){var r,n,s,l,c,f,h,p,y,g,w,S,T,C,B,G,D,W,A,q,E,b,R,I,z,O,$,he,re,Ne,ye,Me,Fe,k,H,_,J,ee,oe,se,ce,ue,K,ae,ne,Ce,Y,le,de,xe,_e,pe,we,Ve,Ge,Qe,bt,Lt,At,sr,Ur,Ht,kr,Nn,Cn,pt,Wt,ar,Do,Bo,Go,ro,no,jo,Mr,io,Jt,ni,Eo;let t=e.type;switch(t){case qe.COLOR:{let Ee=new vt((r=e.color)!=null?r:Yt),Xe=new ve((n=e.alpha)!=null?n:1),He=new xt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");He.keywords.alpha=Xe;let $e=new Ye((s=e.mode)!=null?s:0);return Ee.alpha=Xe,{layer:new Bt(e.id,e.uuid,{type:t,color:Ee,alpha:Xe,calpha:He,mode:$e}),color:Ee,alpha:He,mode:$e}}case qe.TEXTURE:{let Ee=(l=e.texture)!=null?l:new wi,Xe=Ee.matrix;e.mat&&Xe.copy(e.mat),Ee.needsUpdate=!0;let He=new ve((c=e.crop)!=null?c:0),$e=new Ye((f=e.projection)!=null?f:0),tt=new Ye((h=e.axis)!=null?h:0),at=new _r(e.size?new Zi(e.size[0],e.size[1]):new Zi(100,100)),mt=new ve((p=e.alpha)!=null?p:1),gt=new Ye((y=e.mode)!=null?y:0),ct=new Fr(Ee),St=new Tr((g=e.textureSize)!=null?g:new Yi(Ee.image?Ee.image.width:0,Ee.image?Ee.image.height:0)),Rt=new Su(ct,St,He,$e,tt,at,mt,gt),Ar=new xt(Rt.calpha,"f");return{layer:new Bt(e.id,e.uuid,{type:t,texture:ct,textureSize:St,crop:He,projection:$e,axis:tt,size:at,mat:Rt.mat,alpha:mt,calpha:Ar,mode:gt}),color:Rt,alpha:Ar,mode:gt}}case qe.MATCAP:{let Ee=(w=e.texture)!=null?w:new wi;Ee.needsUpdate=!0;let Xe=new ve((S=e.alpha)!=null?S:1),He=new Fr(Ee),$e=new Ye((T=e.mode)!=null?T:0),tt=new Au(He,Xe,$e),at=new xt(tt.calpha,"f");return{layer:new Bt(e.id,e.uuid,{type:t,texture:He,alpha:Xe,calpha:at,mode:$e}),color:tt,alpha:at,mode:$e}}case qe.FRESNEL:{let Ee=new vt((C=e.color)!=null?C:16777215),Xe=new ve((B=e.bias)!=null?B:.1),He=new ve((G=e.scale)!=null?G:1),$e=new ve((D=e.intensity)!=null?D:2),tt=new ve((W=e.factor)!=null?W:1),at=new ve((A=e.alpha)!=null?A:1),mt=new Ye((q=e.mode)!=null?q:0),gt=new wu(Ee,Xe,He,$e,tt,at,mt),ct=new xt(gt.calpha,"f");return{layer:new Bt(e.id,e.uuid,{type:t,color:Ee,bias:Xe,scale:He,intensity:$e,factor:tt,alpha:at,calpha:ct,mode:mt}),color:gt,alpha:ct,mode:mt}}case qe.RAINBOW:{let Ee=new ve((E=e.filmThickness)!=null?E:30),Xe=new ve((b=e.movement)!=null?b:0),He=new Tr((R=e.wavelengths)!=null?R:new Yi(0,0,0)),$e=new ve((I=e.noiseStrength)!=null?I:0),tt=new ve((z=e.noiseScale)!=null?z:1),at=new Tr((O=e.offset)!=null?O:new Yi(0,0,0)),mt=new ve(($=e.alpha)!=null?$:1),gt=new Nu(Ee,Xe,He,$e,tt,at,mt),ct=new xt(gt.calpha,"f"),St=new Ye((he=e.mode)!=null?he:0);return{layer:new Bt(e.id,e.uuid,{type:t,filmThickness:Ee,movement:Xe,wavelengths:He,noiseStrength:$e,noiseScale:tt,offset:at,alpha:mt,calpha:ct,mode:St}),color:gt,alpha:ct,mode:St}}case qe.TRANSMISSION:{let Ee=new ve((re=e.thickness)!=null?re:10),Xe=new ve((Ne=e.ior)!=null?Ne:1.5),He=new ve((ye=e.roughness)!=null?ye:.5),$e=new _r((Me=e.transmissionSamplerSize)!=null?Me:new Zi(2048,2048)),tt=(Fe=e.transmissionSamplerMap)!=null?Fe:new wi,at=(k=e.transmissionDepthMap)!=null?k:new wi,mt=new Fr(tt),gt=new Fr(at),ct=window.innerWidth,St=window.innerHeight,Rt=ct>=St?new _r(St/ct,1):new _r(1,ct/St),Ar=new ve((H=e.alpha)!=null?H:1),Ln=new Cu(Ee,Xe,He,$e,mt,gt,Rt,Ar),_n=new xt(Ln.calpha,"f"),zn=new Ye((_=e.mode)!=null?_:0);return{layer:new Bt(e.id,e.uuid,{type:t,thickness:Ee,ior:Xe,roughness:He,transmissionSamplerSize:$e,transmissionSamplerMap:mt,transmissionDepthMap:gt,aspectRatio:Rt,alpha:Ar,calpha:_n,mode:zn}),color:Ln,alpha:_n,mode:zn}}case qe.DEPTH:{let Ee=new Ye((J=e.gradientType)!=null?J:0),Xe=new bu((ee=e.smooth)!=null?ee:!1),He=new ve((oe=e.near)!=null?oe:50),$e=new ve((se=e.far)!=null?se:200),tt=new ve((ce=e.isVector)!=null?ce:1),at=new ve((ue=e.isWorldSpace)!=null?ue:0),mt=new Tr((K=e.origin)!=null?K:new Yi),gt=new Tr((ae=e.direction)!=null?ae:new Yi),ct=new Ye((ne=e.num)!=null?ne:0),St;e.colors?St=new Gs(ct.value+1,e.colors):(St=new Gs(ct.value+1,new Ou(0,0,0,1)),St.value[1]=new Ou(1,1,1,1));let Rt;e.steps?Rt=new js(e.steps.length,e.steps):(Rt=new js(10,1),Rt.value[0]=0);let Ar=new ve((Ce=e.alpha)!=null?Ce:1),Ln=new Ye((Y=e.mode)!=null?Y:0),_n=new Mu(Ee,Xe,He,$e,tt,at,mt,gt,St,Rt,ct,Ar),zn=new xt(_n.calpha,"f");return{layer:new Bt(e.id,e.uuid,{type:t,gradientType:Ee,smooth:Xe,near:He,far:$e,isVector:tt,isWorldSpace:at,origin:mt,direction:gt,colors:St,steps:Rt,num:ct,alpha:Ar,calpha:zn,mode:Ln}),color:_n,alpha:zn,mode:Ln}}case qe.NOISE:{let Ee=new ve((le=e.scale)!=null?le:1),Xe=new Tr((de=e.size)!=null?de:new Yi(100,100,100)),He=new ve((xe=e.move)!=null?xe:1),$e=new _r((_e=e.fA)!=null?_e:new Zi(1.7,9.2)),tt=new _r((pe=e.fB)!=null?pe:new Zi(8.3,2.8)),at=new _r((we=e.distortion)!=null?we:new Zi(1,1)),mt=new Xi(e.colorA),gt=new Xi(e.colorB),ct=new Xi(e.colorC),St=new Xi(e.colorD),Rt=new ve((Ve=e.alpha)!=null?Ve:1),Ar=new Ye((Ge=e.mode)!=null?Ge:0),Ln=new Ye((Qe=e.noiseType)!=null?Qe:0),_n=new Tu(Ee,Xe,He,$e,tt,at,mt,gt,ct,St,Rt,Ln),zn=new xt(_n.calpha,"f");return{layer:new Bt(e.id,e.uuid,{type:t,scale:Ee,size:Xe,move:He,fA:$e,fB:tt,distortion:at,colorA:mt,colorB:gt,colorC:ct,colorD:St,alpha:Rt,calpha:zn,mode:Ar,noiseType:Ln}),color:_n,alpha:zn,mode:Ar}}case qe.NORMAL:{let Ee=new Tr((bt=e.cnormal)!=null?bt:new Yi(1,1,1)),Xe=new ve((Lt=e.alpha)!=null?Lt:1),He=new Ye((At=e.mode)!=null?At:0),$e=new Lu(Ee,Xe),tt=new xt("alpha / clamp(alpha + accumAlpha, 0.00001, 1.0 )","f");return tt.keywords.alpha=Xe,{layer:new Bt(e.id,e.uuid,{type:t,cnormal:Ee,alpha:Xe,calpha:tt,mode:He}),color:$e,alpha:tt,mode:He}}case qe.GRADIENT:{let Ee=new Ye((sr=e.gradientType)!=null?sr:0),Xe=new bu((Ur=e.smooth)!=null?Ur:!1),He;e.colors?He=new Gs(e.colors.length,e.colors):(He=new Gs(10,new Ou(0,0,0,1)),He.value[1]=new Ou(1,1,1,1));let $e;e.steps?$e=new js(e.steps.length,e.steps):($e=new js(10,1),$e.value[0]=0);let tt=new _r((Ht=e.offset)!=null?Ht:new Zi(0,0)),at=new _r((kr=e.morph)!=null?kr:new Zi(0,0)),mt=new ve((Nn=e.angle)!=null?Nn:0),gt=new ve((Cn=e.alpha)!=null?Cn:1),ct=new Ye((pt=e.mode)!=null?pt:0),St=new _u(Ee,Xe,He,$e,tt,at,mt,gt),Rt=new xt(St.calpha,"f");return{layer:new Bt(e.id,e.uuid,{type:t,gradientType:Ee,smooth:Xe,colors:He,steps:$e,offset:tt,morph:at,angle:mt,alpha:gt,calpha:Rt,mode:ct}),color:St,alpha:Rt,mode:ct}}case qe.DISPLACE:{let Ee=new Ye((Wt=e.displacementType)!=null?Wt:0);if(Ee.value===0){let Xe=new Tr((ar=e.offset)!=null?ar:new Yi(0,0,0)),He=new ve((Do=e.scale)!=null?Do:10),$e=new ve((Bo=e.intensity)!=null?Bo:8),tt=new ve((Go=e.movement)!=null?Go:1),at=new ve((ro=e.alpha)!=null?ro:1),mt=new Ye((no=e.mode)!=null?no:0),gt=new Ye((jo=e.noiseType)!=null?jo:0),ct=new Ga(Ee,$e,tt,Xe,He,gt);return{layer:new Bt(e.id,e.uuid,{displacementType:Ee,type:t,offset:Xe,scale:He,intensity:$e,movement:tt,alpha:at,mode:mt,noiseType:gt}),position:ct}}else if(Ee.value===1){let Xe=(Mr=e.texture)!=null?Mr:new wi,He=Xe.matrix;e.mat&&He.copy(e.mat),Xe.needsUpdate=!0;let $e=new ve((io=e.intensity)!=null?io:8),tt=new Fr(Xe),at=new ve((Jt=e.crop)!=null?Jt:0),mt=new ve((ni=e.alpha)!=null?ni:1),gt=new Ye((Eo=e.mode)!=null?Eo:0),ct=new Ga(Ee,$e,tt,at);return{layer:new Bt(e.id,e.uuid,{displacementType:Ee,type:t,intensity:$e,texture:tt,crop:at,mat:ct.mat,alpha:mt,mode:gt}),position:ct}}return{}}}return{}}blendColors(){let e=this._layerNodes.findIndex(r=>r.type===Mt.COLOR),t=this._layerNodes.findIndex(r=>r.type===Mt.LIGHTING);if(e!==-1&&e<t){let r=this._layerNodes[e].color;for(let n=e+1;n<t;++n){let s=this._layerNodes[n];s.type===Mt.COLOR&&(r=new Iu(r,s.color,s.alpha,s.mode))}this._material.color=r}else this._material.color=void 0}blendAfterColors(){let e=new xt("outgoingLight","f"),t=this._layerNodes.findIndex(r=>r.type===Mt.LIGHTING);if(this._layerNodes.length>t+1){for(let r=t+1;r<this._layerNodes.length;++r){let n=this._layerNodes[r];n.type===Mt.COLOR&&(e=new Iu(e,n.color,n.alpha,n.mode))}"afterColor"in this._material&&(this._material.afterColor=e)}else"afterColor"in this._material&&(this._material.afterColor=void 0)}blendPositions(){let e=this._layerNodes.filter(t=>t.type===Mt.POSITION);if(e.length>0){let t=e[0].position;for(let r=1;r<e.length;++r)e[r]&&(t=new rn(t,e[r].position,rn.ADD),t=new rn(t,new ve(.5).setReadonly(!0),rn.MUL));this._material.position=t}else this._material.position=void 0}cleanupChangedLayer(e){switch(this._layerNodes=this._layerNodes.filter(t=>t.id!==e.id),e.type){case qe.DISPLACE:{this.blendPositions();break}default:{this.blendColors(),this.blendAfterColors();break}}}};var bn=class extends QD{constructor(e,t,r){super(r);this.isNodeMaterial=!0;this.type="NodeMaterial";this.wireframeLinecap="";this.wireframeLinejoin="";this.uniformsBackup={};this.userData={type:"",category:"",nodeType:""};this.fog=!0,this.vertex=e!=null?e:new vu(new xr(xr.PROJECTION)),this.fragment=t!=null?t:new vu(new vt(Yt)),this.updaters=[],this.isDetached=!0,this.dithering=!0,this.onBeforeCompile=this._onBeforeCompile}getDefines(){return this.defines}getUniforms(){return this.uniforms}getVertexShader(){return this.vertexShader}getFragmentShader(){return this.fragmentShader}_onBeforeCompile(e,t){this.build({renderer:t}),e.defines=this.defines,e.uniforms=this.uniforms,e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.extensionDerivatives=this.extensions.derivatives===!0,e.extensionFragDepth=this.extensions.fragDepth===!0,e.extensionDrawBuffers=this.extensions.drawBuffers===!0,e.extensionShaderTextureLOD=this.extensions.shaderTextureLOD===!0}_getLayerStack(e){let t=new Ir(this);return e&&(async()=>{for(;e.image===void 0;)await new Promise(r=>requestAnimationFrame(r));t.addLayerAt(1,{type:qe.TEXTURE,texture:e}),this.dispose()})(),t}clampUniformsForPreview(e,t){let r=(n,s,l)=>Math.min(Math.max(n,s),l);if(this.userData.layers){for(let n of this.userData.layers.getLayers())if(n.type==qe.DISPLACE){this.uniformsBackup[`f${n.id}_intensity`]=n.uniforms[`f${n.id}_intensity`].value;let s=r(n.uniforms[`f${n.id}_intensity`].value,e,t);n.uniforms[`f${n.id}_intensity`].value=s}}}restoreClampedUniforms(){if(this.userData.layers)for(let e of this.userData.layers.getLayers())e.type==qe.DISPLACE&&(e.uniforms[`f${e.id}_intensity`].value=this.uniformsBackup[`f${e.id}_intensity`])}customProgramCacheKey(){return this.getHash()}updateFrame(e){for(let t=0;t<this.updaters.length;++t)e.updateNode(this.updaters[t])}build(e){var r;e=e!=null?e:{};let t=(r=e.builder)!=null?r:new hd;return t.setMaterial(this,e.renderer),t.build(this.vertex,this.fragment),this.vertexShader=t.getCode("vertex"),this.fragmentShader=t.getCode("fragment"),this.defines=t.defines,this.uniforms=t.uniforms,this.extensions=t.extensions,this.updaters=t.updaters,this.fog=t.requires.fog,this.lights=t.requires.lights,this.transparent=t.requires.transparent||this.blending>YD,this}getHash(){let e="{";return e+='"vertex":'+this.vertex.getHash()+",",e+='"fragment":'+this.fragment.getHash(),e+="}",e}copy(e){let t=this.uuid;for(let r in e)this[r]=e[r];return this.uuid=t,e.userData!==void 0&&(this.userData=JSON.parse(JSON.stringify(e.userData))),this}toJSON(e){let t=this.userData.layers;this.userData.layers=void 0;let r=super.toJSON(e);return r.type="ShaderMaterial",r.userData={type:this.userData.type,category:this.userData.category,nodeType:this.type,layers:t.toJSON(e)},r.vertex=this.vertex.toJSON(e).uuid,r.fragment=this.fragment.toJSON(e).uuid,delete r.vertexShader,delete r.fragmentShader,delete r.color,delete r.shininess,delete r.specular,delete r.roughness,delete r.metalness,delete r.uniforms,e&&!e.materials[this.uuid]&&(e.materials[this.uuid]=r),this.userData.layers=t,r}fromJSON(e,t){var r;this.defines=(r=e.defines)!=null?r:{},this.depthFunc=e.depthFunc,this.depthWrite=e.depthWrite,this.side=e.side!==void 0?e.side:e3,this.transparent=e.transparent,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.wireframe=e.wireframe,this.userData.layers.fromJSON(e.userData.layers,t,this)}};Object.defineProperties(bn.prototype,{properties:{get:function(){return this.fragment.properties}},needsUpdate:{set:function(i){i===!0&&this.version++,this.needsCompile=i},get:function(){return this.needsCompile}}});import{UniformsLib as t3,UniformsUtils as r3}from"three";var bd=class extends Pe{constructor(){super("basic");this.nodeType="Basic";this.color=new vt(Yt)}generate(e){let t;if(e.isShader("vertex")){let r=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(r3.merge([t3.fog])),e.addParsCode(["varying vec3 vViewPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>"].join(`
|
|
729
|
+
`));let n=["#include <beginnormal_vertex>",`
|
|
711
730
|
#if !defined( USE_LAYER_DISPLACE )
|
|
712
731
|
#include <defaultnormal_vertex>
|
|
713
732
|
#endif
|
|
@@ -723,11 +742,11 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
723
742
|
#if !defined( USE_LAYER_DISPLACE )
|
|
724
743
|
#include <begin_vertex>
|
|
725
744
|
#endif /* !USE_LAYER_DISPLACE */
|
|
726
|
-
`];r&&
|
|
727
|
-
`)}else{this.color===void 0&&(this.color=new
|
|
728
|
-
`));let
|
|
729
|
-
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),e.position&&(this.position=e.position.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}};var
|
|
730
|
-
`));let
|
|
745
|
+
`];r&&n.push(r.code,r.result?"displaced_position = "+r.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>"),t=n.join(`
|
|
746
|
+
`)}else{this.color===void 0&&(this.color=new vt(Yt)),this.color.analyze(e,{slot:"color"}),this.alpha&&this.alpha.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"});let r=this.color.flow(e,"c",{slot:"color"}),n=this.alpha?this.alpha.flow(e,"f"):void 0,s=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0;e.requires.transparent=n!==void 0,e.addParsCode(["#include <fog_pars_fragment>","#include <dithering_pars_fragment>","varying vec3 vViewPosition;","#include <normal_pars_fragment>"].join(`
|
|
747
|
+
`));let l=["#include <normal_fragment_begin>",r.code];n&&l.push(n.code,"#ifdef ALPHATEST"," if ( "+n.result+" <= ALPHATEST ) discard;","#endif"),s?l.push(s.code,`vec3 outgoingLight = ${r.result};`,`vec3 finalColor = spe_blend(outgoingLight, ${s.result}, 1.0, SPE_BLENDING_NORMAL);`):l.push(`vec3 finalColor = ${r.result};`),n?l.push(`gl_FragColor = vec4( finalColor, accumAlpha * ${n.result} );`):l.push("gl_FragColor = vec4("+r.result+", 1.0 );"),l.push("#include <fog_fragment>","#include <dithering_fragment>"),t=l.join(`
|
|
748
|
+
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),e.position&&(this.position=e.position.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}};var Sd=class extends bn{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}constructor(e=new bd,t){super(e,e,t);this.type="BasicNodeMaterial",this.fragment=e}};var vr=class extends Sd{constructor(e,t,r){super(t,e);this.userData.type="BasicMaterial",this.userData.category="Basic",this.userData.layers=r!=null?r:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Ir){let t=e.userData.layers,r=e.fragment;super.copy(e);let n=r.clone();this.fragment=n,this.vertex=n;let s=t.clone(this);this.userData.layers=s}else super.copy(e);return this}static fromJSON(e,t,r){let n=r.getNode(t.vertex),s=new vr(void 0,n);return s.fromJSON(t,r),s}static fromMaterial(e){let t=new vr(e.map?{map:e.map}:{}),r=t.fragment;return r.color.value.copy(e.color),r.alpha.value=e.opacity,t}dispose(){super.dispose()}};import{UniformsLib as Fv,UniformsUtils as n3}from"three";var wd=class extends Pe{constructor(){super("phong");this.nodeType="Phong";this.color=new vt(Yt),this.specular=new vt(1118481),this.shininess=new ve(30),this.shadingAlpha=new ve(1),this.shadingBlend=new Ye(0)}build(e){let t;if(e.define("PHONG"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let r=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(n3.merge([Fv.fog,Fv.lights])),e.addParsCode(["varying vec3 vViewPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
|
|
749
|
+
`));let n=["#include <beginnormal_vertex>",`
|
|
731
750
|
#ifndef USE_LAYER_DISPLACE
|
|
732
751
|
#include <defaultnormal_vertex>
|
|
733
752
|
#endif
|
|
@@ -743,9 +762,9 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
743
762
|
#ifndef USE_LAYER_DISPLACE
|
|
744
763
|
#include <begin_vertex>
|
|
745
764
|
#endif
|
|
746
|
-
`];r&&
|
|
747
|
-
`)}else{this.color===void 0&&(this.color=new
|
|
748
|
-
`));let
|
|
765
|
+
`];r&&n.push(r.code,r.result?"displaced_position = "+r.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push(" #include <project_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>"," #include <shadowmap_vertex>"," #include <fog_vertex>"),t=n.join(`
|
|
766
|
+
`)}else{this.color===void 0&&(this.color=new vt(Yt)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let r=this.color.flow(e,"c",{slot:"color"}),n=this.specular.flow(e,"c"),s=this.shininess.flow(e,"f"),l=this.shadingAlpha.flow(e,"f"),c=this.shadingBlend.flow(e,"i"),f=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(e,"f"):void 0;e.requires.transparent=h!==void 0,e.addParsCode(["uniform vec3 emissive;","#include <normal_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_phong_pars_fragment>","#include <shadowmap_pars_fragment>","#include <dithering_pars_fragment>"].join(`
|
|
767
|
+
`));let p=["#include <normal_fragment_begin>",`
|
|
749
768
|
// NOTE: gl_FrontFacing alternative using face normal estimation.
|
|
750
769
|
vec3 viewdx = dFdx(vViewPosition);
|
|
751
770
|
vec3 viewdy = dFdy(vViewPosition);
|
|
@@ -753,15 +772,15 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
753
772
|
if (dot(normal, faceNormal) < 0.0) {
|
|
754
773
|
normal *= -1.0;
|
|
755
774
|
}
|
|
756
|
-
`," BlinnPhongMaterial material;"];
|
|
775
|
+
`," BlinnPhongMaterial material;"];p.push(r.code," vec3 diffuseColor = "+r.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"," vec3 totalEmissiveRadiance = emissive;",n.code," vec3 specular = "+n.result+";",s.code," float shininess = max( 0.0001, "+s.result+" );"," float specularStrength = 1.0;"),h&&p.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),p.push("material.diffuseColor = diffuseColor;"),p.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),p.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;"),p.push(`
|
|
757
776
|
if (outgoingLight != diffuseColor) {
|
|
758
777
|
float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
|
|
759
|
-
accumAlpha += ( 1.0 - accumAlpha ) * ${
|
|
760
|
-
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${
|
|
778
|
+
accumAlpha += ( 1.0 - accumAlpha ) * ${l.result} * lightAccu;
|
|
779
|
+
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${l.result}, ${c.result} );
|
|
761
780
|
}
|
|
762
|
-
`),
|
|
763
|
-
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.specular=e.specular.clone(),this.shininess=e.shininess.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}};var
|
|
764
|
-
`));let
|
|
781
|
+
`),f&&p.push(f.code,`outgoingLight = spe_blend(outgoingLight, ${f.result}, 1.0, SPE_BLENDING_NORMAL);`),h?p.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result} );`):p.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),p.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=p.join(`
|
|
782
|
+
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.specular=e.specular.clone(),this.shininess=e.shininess.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}};var Nd=class extends bn{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get specular(){return this.fragment.specular}set specular(e){this.fragment.specular=e}get shininess(){return this.fragment.shininess}set shininess(e){this.fragment.shininess=e}constructor(e=new wd,t){super(e,e,t);this.type="PhongNodeMaterial",this.fragment=e}};var Sn=class extends Nd{constructor(e,t,r){super(t,e);this.userData.type="PhongMaterial",this.userData.category="Phong",this.userData.layers=r!=null?r:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Ir){let t=e.userData.layers,r=e.fragment;super.copy(e);let n=r.clone();this.fragment=n,this.vertex=n;let s=t.clone(this);this.userData.layers=s,n.shadingAlpha.value=r.shadingAlpha.value,n.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){let n=r.getNode(t.vertex),s=new Sn(void 0,n);return s.fromJSON(t,r),s}static fromMaterial(e){let t=new Sn(e.map?{map:e.map}:{}),r=t.fragment;return r.color.value.copy(e.color),r.alpha.value=e.opacity,t}dispose(){super.dispose()}};import{UniformsLib as Vv,UniformsUtils as i3}from"three";var Cd=class extends Pe{constructor(){super("lambert");this.nodeType="Lambert";this.color=new vt(Yt),this.emissive=new vt(0),this.emissiveIntensity=new ve(1),this.shadingAlpha=new ve(1),this.shadingBlend=new Ye(0)}build(e){let t;if(e.define("LAMBERT"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let r=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(i3.merge([Vv.fog,Vv.lights])),e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;"," varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <color_pars_vertex>","#include <fog_pars_vertex>","#include <normal_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
|
|
783
|
+
`));let n=["#include <beginnormal_vertex>",`
|
|
765
784
|
#ifndef USE_LAYER_DISPLACE
|
|
766
785
|
#include <defaultnormal_vertex>
|
|
767
786
|
#endif
|
|
@@ -777,7 +796,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
777
796
|
#ifndef USE_LAYER_DISPLACE
|
|
778
797
|
#include <begin_vertex>
|
|
779
798
|
#endif
|
|
780
|
-
`];r&&
|
|
799
|
+
`];r&&n.push(r.code,r.result?"displaced_position = "+r.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push(" #include <project_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>",`
|
|
781
800
|
vec3 diffuse = vec3( 1.0 );
|
|
782
801
|
GeometricContext geometry;
|
|
783
802
|
geometry.position = mvPosition.xyz;
|
|
@@ -851,23 +870,23 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
851
870
|
}
|
|
852
871
|
#pragma unroll_loop_end
|
|
853
872
|
#endif
|
|
854
|
-
`," #include <shadowmap_vertex>"," #include <fog_vertex>"),t=
|
|
855
|
-
`)}else{this.color===void 0&&(this.color=new
|
|
856
|
-
`));let
|
|
873
|
+
`," #include <shadowmap_vertex>"," #include <fog_vertex>"),t=n.join(`
|
|
874
|
+
`)}else{this.color===void 0&&(this.color=new vt(Yt)),this.color.analyze(e,{slot:"color"}),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let r=this.color.flow(e,"c",{slot:"color"}),n=this.emissive.flow(e,"c",{slot:"emissive"}),s=this.emissiveIntensity.flow(e,"f",{slot:"emissive"}),l=this.shadingAlpha.flow(e,"f"),c=this.shadingBlend.flow(e,"i"),f=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(e,"f"):void 0;e.requires.transparent=h!==void 0,e.addParsCode(["varying vec3 vViewPosition;","varying vec3 vLightFront;","varying vec3 vIndirectFront;","#ifndef DOUBLE_SIDED"," #define DOUBLE_SIDED","#endif","#include <normal_pars_fragment>","#ifdef DOUBLE_SIDED"," varying vec3 vLightBack;"," varying vec3 vIndirectBack;","#endif","#include <bsdfs>","#include <lights_pars_begin>","#include <fog_pars_fragment>","#include <shadowmap_pars_fragment>","#include <shadowmask_pars_fragment>","#include <clipping_planes_pars_fragment>","#include <dithering_pars_fragment>"].join(`
|
|
875
|
+
`));let p=["#include <normal_fragment_begin>",`
|
|
857
876
|
// NOTE: gl_FrontFacing alternative using face normal estimation.
|
|
858
877
|
vec3 viewdx = dFdx(vViewPosition);
|
|
859
878
|
vec3 viewdy = dFdy(vViewPosition);
|
|
860
879
|
vec3 faceNormal = normalize(cross(viewdx, viewdy));
|
|
861
880
|
bool isFrontFacing = (dot(normal, faceNormal) >= 0.0);
|
|
862
|
-
`,"#include <clipping_planes_fragment>"];
|
|
881
|
+
`,"#include <clipping_planes_fragment>"];p.push(r.code,"vec3 diffuseColor = "+r.result+";","ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );"),h&&p.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),p.push("#ifdef DOUBLE_SIDED"," reflectedLight.indirectDiffuse += ( isFrontFacing ) ? vIndirectFront : vIndirectBack;","#else"," reflectedLight.indirectDiffuse += vIndirectFront;","#endif","#include <lightmap_fragment>","reflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );","#ifdef DOUBLE_SIDED"," reflectedLight.directDiffuse = ( isFrontFacing ) ? vLightFront : vLightBack;","#else"," reflectedLight.directDiffuse = vLightFront;","#endif","reflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();"),n&&p.push(n.code,"reflectedLight.directDiffuse += "+n.result+" * "+s.result+";"),p.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;"),p.push(`
|
|
863
882
|
if (outgoingLight != diffuseColor) {
|
|
864
883
|
float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
|
|
865
|
-
accumAlpha += ( 1.0 - accumAlpha ) * ${
|
|
866
|
-
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${
|
|
884
|
+
accumAlpha += ( 1.0 - accumAlpha ) * ${l.result} * lightAccu;
|
|
885
|
+
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${l.result}, ${c.result} );
|
|
867
886
|
}
|
|
868
|
-
`),
|
|
869
|
-
`)}return t}copy(e){return super.copy(e),this.emissiveIntensity=e.emissiveIntensity.clone(),e.color&&(this.color=e.color.clone()),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),e.emissive&&(this.emissive=e.emissive.clone()),this}};var
|
|
870
|
-
`));let
|
|
887
|
+
`),f&&p.push(f.code,`outgoingLight = spe_blend(outgoingLight, ${f.result}, 1.0, SPE_BLENDING_NORMAL);`),h?p.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result} );`):p.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),p.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=p.join(`
|
|
888
|
+
`)}return t}copy(e){return super.copy(e),this.emissiveIntensity=e.emissiveIntensity.clone(),e.color&&(this.color=e.color.clone()),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),e.emissive&&(this.emissive=e.emissive.clone()),this}};var Ld=class extends bn{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get emissive(){return this.fragment.emissive}set emissive(e){this.fragment.emissive=e}get emissiveIntensity(){return this.fragment.emissiveIntensity}set emissiveIntensity(e){this.fragment.emissiveIntensity=e}constructor(e=new Cd,t){super(e,e,t);this.type="LambertNodeMaterial",this.fragment=e}};var ja=class extends Ld{constructor(e,t,r){super(t,e);this.userData.type="LambertMaterial",this.userData.category="Lambert",this.userData.layers=r!=null?r:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Ir){let t=e.userData.layers,r=e.fragment;super.copy(e);let n=r.clone();this.fragment=n,this.vertex=n;let s=t.clone(this);this.userData.layers=s,n.shadingAlpha.value=r.shadingAlpha.value,n.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){let n=r.getNode(t.vertex),s=new ja(void 0,n);return s.fromJSON(t,r),s}dispose(){super.dispose()}};import{UniformsLib as Uv,UniformsUtils as o3}from"three";var _d=class extends Pe{constructor(){super("toon");this.nodeType="Toon";this.color=new vt(Yt),this.specular=new vt(1118481),this.shininess=new ve(30),this.shadingAlpha=new ve(1),this.shadingBlend=new Ye(0)}build(e){let t;if(e.define("TOON"),e.requires.lights=!0,e.extensions.derivatives=!0,e.isShader("vertex")){let r=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(o3.merge([Uv.fog,Uv.lights])),e.addParsCode(["varying vec3 vViewPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
|
|
889
|
+
`));let n=["#include <beginnormal_vertex>",`
|
|
871
890
|
#ifndef USE_LAYER_DISPLACE
|
|
872
891
|
#include <defaultnormal_vertex>
|
|
873
892
|
#endif
|
|
@@ -883,8 +902,8 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
883
902
|
#ifndef USE_LAYER_DISPLACE
|
|
884
903
|
#include <begin_vertex>
|
|
885
904
|
#endif
|
|
886
|
-
`];r&&
|
|
887
|
-
`)}else{this.color===void 0&&(this.color=new
|
|
905
|
+
`];r&&n.push(r.code,r.result?"displaced_position = "+r.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push(" #include <project_vertex>"," #include <fog_vertex>"," #include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;"," #include <worldpos_vertex>"," #include <shadowmap_vertex>"," #include <fog_vertex>"),t=n.join(`
|
|
906
|
+
`)}else{this.color===void 0&&(this.color=new vt(Yt)),this.color.analyze(e,{slot:"color"}),this.specular.analyze(e),this.shininess.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e);let r=this.color.flow(e,"c",{slot:"color"}),n=this.specular.flow(e,"c"),s=this.shininess.flow(e,"f"),l=this.shadingAlpha.flow(e,"f"),c=this.shadingBlend.flow(e,"i"),f=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,h=this.alpha?this.alpha.flow(e,"f"):void 0;e.requires.transparent=h!==void 0,e.addParsCode(["#include <normal_pars_fragment>","#include <gradientmap_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <dithering_pars_fragment>",`
|
|
888
907
|
varying vec3 vViewPosition;
|
|
889
908
|
struct ToonMaterial {
|
|
890
909
|
vec3 diffuseColor;
|
|
@@ -905,7 +924,7 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
905
924
|
#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon
|
|
906
925
|
#define Material_LightProbeLOD( material ) (0)
|
|
907
926
|
`,"#include <shadowmap_pars_fragment>","#include <bumpmap_pars_fragment>","#include <normalmap_pars_fragment>"].join(`
|
|
908
|
-
`));let
|
|
927
|
+
`));let p=["#include <normal_fragment_begin>",`
|
|
909
928
|
// NOTE: gl_FrontFacing alternative using face normal estimation.
|
|
910
929
|
vec3 viewdx = dFdx(vViewPosition);
|
|
911
930
|
vec3 viewdy = dFdy(vViewPosition);
|
|
@@ -913,15 +932,15 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
913
932
|
if (dot(normal, faceNormal) < 0.0) {
|
|
914
933
|
normal *= -1.0;
|
|
915
934
|
}
|
|
916
|
-
`," ToonMaterial material;"];
|
|
935
|
+
`," ToonMaterial material;"];p.push(r.code," vec3 diffuseColor = "+r.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",n.code," vec3 specular = "+n.result+";",s.code," float shininess = max( 0.0001, "+s.result+" );"," float specularStrength = 1.0;"),h&&p.push(h.code,"#ifdef ALPHATEST","if ( "+h.result+" <= ALPHATEST ) discard;","#endif"),p.push("material.diffuseColor = diffuseColor;"),p.push("material.specularColor = specular;","material.specularShininess = shininess;","material.specularStrength = specularStrength;","#include <lights_fragment_begin>","#include <lights_fragment_end>"),p.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular;"),p.push(`
|
|
917
936
|
if (outgoingLight != diffuseColor) {
|
|
918
937
|
float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
|
|
919
|
-
accumAlpha += ( 1.0 - accumAlpha ) * ${
|
|
920
|
-
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${
|
|
938
|
+
accumAlpha += ( 1.0 - accumAlpha ) * ${l.result} * lightAccu;
|
|
939
|
+
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${l.result}, ${c.result} );
|
|
921
940
|
}
|
|
922
|
-
`),
|
|
923
|
-
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.specular=e.specular.clone(),this.shininess=e.shininess.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}};var
|
|
924
|
-
`));let
|
|
941
|
+
`),f&&p.push(f.code,`outgoingLight = spe_blend(outgoingLight, ${f.result}, 1.0, SPE_BLENDING_NORMAL);`),h?p.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${h.result} );`):p.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),p.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=p.join(`
|
|
942
|
+
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.specular=e.specular.clone(),this.shininess=e.shininess.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}};var Td=class extends bn{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get specular(){return this.fragment.specular}set specular(e){this.fragment.specular=e}get shininess(){return this.fragment.shininess}set shininess(e){this.fragment.shininess=e}constructor(e=new _d,t){super(e,e,t);this.type="ToonNodeMaterial",this.fragment=e}};var Ea=class extends Td{constructor(e,t,r){super(t,e);this.userData.type="ToonMaterial",this.userData.category="Toon",this.userData.layers=r!=null?r:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Ir){let t=e.userData.layers,r=e.fragment;super.copy(e);let n=r.clone();this.fragment=n,this.vertex=n;let s=t.clone(this);this.userData.layers=s,n.shadingAlpha.value=r.shadingAlpha.value,n.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){let n=r.getNode(t.vertex),s=new Ea(void 0,n);return s.fromJSON(t,r),s}dispose(){super.dispose()}};import{UniformsLib as Id,UniformsUtils as s3}from"three";var Md=class extends Pe{constructor(){super("standard");this.nodeType="Standard";this.color=new vt(Yt),this.roughness=new ve(.3),this.metalness=new ve(0),this.reflectivity=new ve(.5),this.shadingAlpha=new ve(1),this.shadingBlend=new Ye(0)}build(e){let t;if(e.define("STANDARD"),e.requires.lights=!0,e.extensions.derivatives=!0,e.extensions.shaderTextureLOD=!0,e.isShader("vertex")){let r=this.position?this.position.analyzeAndFlow(e,"v3",{cache:"position"}):void 0;e.mergeUniform(s3.merge([Id.fog,Id.lights])),Id.LTC_1&&(e.uniforms.ltc_1={value:void 0},e.uniforms.ltc_2={value:void 0}),e.addParsCode(["varying vec3 vViewPosition;","#include <fog_pars_vertex>","#include <normal_pars_vertex>","#include <shadowmap_pars_vertex>","#include <clipping_planes_pars_vertex>"].join(`
|
|
943
|
+
`));let n=["#include <beginnormal_vertex>",`
|
|
925
944
|
#if !defined( USE_LAYER_DISPLACE )
|
|
926
945
|
#include <defaultnormal_vertex>
|
|
927
946
|
#endif
|
|
@@ -937,9 +956,9 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
937
956
|
#if !defined( USE_LAYER_DISPLACE )
|
|
938
957
|
#include <begin_vertex>
|
|
939
958
|
#endif /* !USE_LAYER_DISPLACE */
|
|
940
|
-
`];r&&
|
|
941
|
-
`)}else{let r={gamma:!0};this.color===void 0&&(this.color=new
|
|
942
|
-
`));let
|
|
959
|
+
`];r&&n.push(r.code,r.result?"displaced_position = "+r.result+";":""),n.push("transformed = displaced_position;","transformedNormal = normalMatrix * displaced_normal;","#ifndef FLAT_SHADED"," vNormal = transformedNormal;","#endif"),n.push("#include <project_vertex>","#include <fog_vertex>","#include <clipping_planes_vertex>"," vViewPosition = - mvPosition.xyz;","#include <worldpos_vertex>","#include <shadowmap_vertex>"),t=n.join(`
|
|
960
|
+
`)}else{let r={gamma:!0};this.color===void 0&&(this.color=new vt(Yt)),this.color.analyze(e,{slot:"color",context:r}),this.roughness.analyze(e),this.metalness.analyze(e),this.shadingAlpha.analyze(e),this.shadingBlend.analyze(e),this.afterColor&&this.afterColor.analyze(e,{slot:"afterColor"}),this.alpha&&this.alpha.analyze(e),this.reflectivity&&this.reflectivity.analyze(e);let n=this.color.flow(e,"c",{slot:"color",context:r}),s=this.roughness.flow(e,"f"),l=this.metalness.flow(e,"f"),c=this.shadingAlpha.flow(e,"f"),f=this.shadingBlend.flow(e,"i"),h=this.afterColor?this.afterColor.flow(e,"c",{slot:"afterColor"}):void 0,p=this.alpha?this.alpha.flow(e,"f"):void 0,y=this.reflectivity?this.reflectivity.flow(e,"f"):void 0;e.requires.transparent=p!==void 0,e.addParsCode(["varying vec3 vViewPosition;","#include <normal_pars_fragment>","#include <dithering_pars_fragment>","#include <fog_pars_fragment>","#include <bsdfs>","#include <lights_pars_begin>","#include <lights_physical_pars_fragment>","#include <shadowmap_pars_fragment>"].join(`
|
|
961
|
+
`));let g=["#include <clipping_planes_fragment>"," #include <normal_fragment_begin>",`
|
|
943
962
|
// NOTE: gl_FrontFacing alternative using face normal estimation.
|
|
944
963
|
vec3 viewdx = dFdx(vViewPosition);
|
|
945
964
|
vec3 viewdy = dFdy(vViewPosition);
|
|
@@ -947,12 +966,12 @@ vec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 position, mat
|
|
|
947
966
|
if (dot(normal, faceNormal) < 0.0) {
|
|
948
967
|
normal *= -1.0;
|
|
949
968
|
}
|
|
950
|
-
`," PhysicalMaterial material;"," material.diffuseColor = vec3( 1.0 );"];
|
|
969
|
+
`," PhysicalMaterial material;"," material.diffuseColor = vec3( 1.0 );"];g.push(n.code," vec3 diffuseColor = "+n.result+";"," ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );",s.code," float roughnessFactor = "+s.result+";",l.code," float metalnessFactor = "+l.result+";"),p&&g.push(p.code,"#ifdef ALPHATEST"," if ( "+p.result+" <= ALPHATEST ) discard;","#endif"),g.push("vec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );","float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );"),g.push("material.diffuseColor = diffuseColor * ( 1.0 - metalnessFactor );","material.roughness = max( roughnessFactor, 0.0525 );","material.roughness += geometryRoughness;","material.roughness = min( material.roughness, 1.0 );","material.roughness = clamp( roughnessFactor, 0.04, 1.0 );"),y?g.push(y.code,"material.specularColor = mix( vec3( 0.16 * pow2( "+y.result+" ) ), diffuseColor, metalnessFactor );"):g.push("material.specularColor = mix( vec3( 0.04 ), diffuseColor, metalnessFactor );"),g.push("#include <lights_fragment_begin>"),g.push("#include <lights_fragment_end>"),g.push("vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular;"),g.push(`
|
|
951
970
|
if (outgoingLight != diffuseColor) {
|
|
952
971
|
float lightAccu = clamp( length( reflectedLight.directSpecular + reflectedLight.indirectSpecular ), 0.0, 1.0 );
|
|
953
|
-
accumAlpha += ( 1.0 - accumAlpha ) * ${
|
|
954
|
-
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${
|
|
972
|
+
accumAlpha += ( 1.0 - accumAlpha ) * ${c.result} * lightAccu;
|
|
973
|
+
outgoingLight = spe_blend( diffuseColor, outgoingLight, ${c.result}, ${f.result} );
|
|
955
974
|
}
|
|
956
|
-
`),
|
|
957
|
-
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.roughness=e.roughness.clone(),this.metalness=e.metalness.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.reflectivity&&(this.reflectivity=e.reflectivity.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}};var rc=class extends rr{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get roughness(){return this.fragment.roughness}set roughness(e){this.fragment.roughness=e}get metalness(){return this.fragment.metalness}set metalness(e){this.fragment.metalness=e}get reflectivity(){return this.fragment.reflectivity}set reflectivity(e){this.fragment.reflectivity=e}constructor(e=new tc,t){super(e,e,t);this.type="StandardNodeMaterial",this.fragment=e}};var nn=class extends rc{constructor(e,t,r){super(t,e);this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=r!=null?r:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Pt){let t=e.userData.layers,r=e.fragment;super.copy(e);let o=r.clone();this.fragment=o,this.vertex=o;let n=t.clone(this);this.userData.layers=n,o.shadingAlpha.value=r.shadingAlpha.value,o.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){let o=r.getNode(t.vertex),n=new nn(void 0,o);return n.fromJSON(t,r),n}dispose(){super.dispose()}};import{Color as ic}from"three";import{Matrix3 as Kh,Texture as oc,Vector2 as sn,Vector3 as Mo,Vector4 as Xh}from"three";function Zh(i,e){switch(i.data.type){case"light":return dr(i);case"fresnel":return QS(i,e);case"gradient":return YS(i);case"depth":return ew(i);case"normal":return tw(i);case"noise":return rw(i,e);case"texture":return ow(i,e);case"rainbow":return iw(i);case"transmission":return nw(i,e);case"matcap":return sw(i,e);case"displace":return aw(i);case"color":default:return ZS(i,e)}}function Qh(i){return{type:i.data.type}}function dr(i){let{alpha:e,mode:t}=i.data;return $(O({},Qh(i)),{alpha:e,mode:t})}function ZS(i,e){return $(O({},dr(i)),{color:Ye(i.data.color,e)})}function QS(i,e){let{bias:t,scale:r,intensity:o,factor:n,color:s}=i.data;return $(O({},dr(i)),{color:Ye(s,e),bias:t,scale:r,intensity:o,factor:n})}function YS(i){let{gradientType:e,smooth:t,colors:r,steps:o,angle:n,offset:s,morph:a}=i.data;return $(O({},dr(i)),{gradientType:e,smooth:t,colors:r.map(l=>new Xh(l[0],l[1],l[2],l[3])),num:r.length,steps:o,offset:new sn(...s),morph:new sn(...a),angle:n})}function ew(i){let{gradientType:e,near:t,far:r,isVector:o,isWorldSpace:n,origin:s,direction:a,colors:l,steps:c,smooth:d,num:u}=i.data;return $(O({},dr(i)),{gradientType:e,near:t,far:r,isVector:o,isWorldSpace:n,origin:new Mo(...s),direction:a?new Mo(...a):new Mo(1,0,0),num:u,colors:l.map(p=>new Xh(p[0],p[1],p[2],p[3])),steps:c,smooth:d})}function tw(i){let{cnormal:e}=i.data;return $(O({},dr(i)),{cnormal:new Mo(e[0],e[1],e[2])})}function rw(i,e){let{data:t}=i;return $(O({},dr(i)),{scale:t.scale,move:t.move,fA:new sn(...t.fA),fB:new sn(...t.fB),distortion:new sn(...t.distortion),colorA:Ye(t.colorA,e),colorB:Ye(t.colorB,e),colorC:Ye(t.colorC,e),colorD:Ye(t.colorD,e),noiseType:t.noiseType})}function ow(i,e){let{projection:t,axis:r,crop:o,size:n}=i.data,{image:s,wrapping:a,repeat:l,offset:c}=i.data.texture,d=new oc,u;if(typeof s=="string")u=e==null?void 0:e.getImage(s);else{let p=new Image;p.src=s.data,p.onload=()=>{(e==null?void 0:e.onImageLoad)&&(e==null||e.onImageLoad(s.data))},u=p}return d.image=u,d.wrapS=d.wrapT=a,$(O({},dr(i)),{texture:d,mat:new Kh().setUvTransform(c[0],c[1],l[0],l[1],0,0,0),crop:o,projection:t,axis:["x","y","z"].indexOf(r),size:n})}function iw(i){let{data:e}=i;return $(O({},dr(i)),{filmThickness:e.filmThickness,movement:e.movement,wavelengths:new Mo(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new Mo(...e.offset)})}function nw(i,e){let{data:t}=i;return $(O({},dr(i)),{thickness:t.thickness,ior:t.ior,roughness:t.roughness,transmissionSamplerMap:e.transmissionSamplerMap,transmissionDepthMap:e.transmissionDepthMap})}function sw(i,e){let t=new oc,{image:r}=i.data.texture,o;if(typeof r=="string")o=e==null?void 0:e.getImage(r);else{let s=new Image;s.src=r.data,s.onload=()=>{(e==null?void 0:e.onImageLoad)&&(e==null||e.onImageLoad(r.data))},o=s}t.image=o;let n=16777215;return $(O({},dr(i)),{color:n,texture:t})}function aw(i){let{data:e}=i,t=$(O({},Qh(i)),{intensity:e.intensity});if(e.displacementType==="noise")return $(O({},t),{offset:new Mo(...e.offset),scale:e.scale,movement:e.movement,noiseType:e.noiseType});{let r=new oc,o=new Kh().setUvTransform(0,0,1,1,0,0,0);return $(O({},t),{texture:r,mat:o,crop:e.crop})}}function Yh(i,e,t){if(t.type==="displace"&&(i==="intensity"||i==="visible")){let r=e.uniforms[`f${e.id}_intensity`];return r?(r.value=t.intensity*(t.visible?1:0),r):void 0}if(t.type!=="displace"&&(i==="alpha"||i==="visible")){let r=e.uniforms[`f${e.id}_alpha`];return r?(r.value=t.alpha*(t.visible?1:0),r):void 0}}import{Color as em,Vector4 as lw}from"three";var Si;(function(e){function i(t){return new em(t.x,t.y,t.z).getHex()}e.getHex=i})(Si||(Si={}));var tm;(function(e){function i(t){return new lw(t.r,t.g,t.b,t.a)}e.getThreeVector4=i})(tm||(tm={}));var rm;(function(t){function i(r,o){r.setRGB(o.r,o.g,o.b)}t.setThreeColor=i;function e(r){return new em(r.r,r.g,r.b).getHex()}t.getHex=e})(rm||(rm={}));function an(i,e){return typeof i=="string"?e.getMaterialOrDeletedPlaceholder(i):nc(i,e)}function om(i,e){return i.map(t=>an(t,e))}function nc(i,e){var s,a;let t=(s=i.layers)!=null?s:si.defaultTwoLayerData("phong").layers,r=cw(t),o;switch(r.category){case"basic":o=new Nt;break;case"lambert":{o=new rn;break}case"toon":{o=new on;break}case"physical":o=new nn;break;case"phong":default:{o=new or;break}}o.name=(a=i.name)!=null?a:"Untitled Material";let n=o.userData.layers;dw(n);for(let l=t.length-1;l>=0;l--)pw(n,t[l],e);switch(r.category){case"basic":break;case"lambert":{let d=o,p=Ye(r.emissive,e);p instanceof ic?d.emissive.value=p:d.emissive.value.setHex(Si.getHex(p));break}case"toon":{let d=o,u=r;d.shininess.value=u.shininess;let p=Ye(u.specular,e);p instanceof ic?d.specular.value=p:d.specular.value.setHex(Si.getHex(p));break}case"physical":let l=o,c=r;l.metalness.value=c.metalness,l.roughness.value=c.roughness,l.reflectivity.value=c.reflectivity;break;case"phong":default:{let d=o,u=r;d.shininess.value=u.shininess;let p=Ye(u.specular,e);p instanceof ic?d.specular.value=p:d.specular.value.setHex(Si.getHex(p));break}}return n.blendColors(),n.blendAfterColors(),n.blendPositions(),o}function cw(i){for(let e of i)if(e.data.type==="light")return e.data;return{type:"light",category:"basic",visible:!0,alpha:1,mode:it.Normal}}function dw(i){for(let e of i.getLayers())i.removeLayer(e.id)}function pw(i,e,t){let r=Zh(e,t);r.type==="transmission"&&(r.transmissionSamplerMap=t==null?void 0:t.transmissionSamplerMap,r.transmissionDepthMap=t==null?void 0:t.transmissionDepthMap);let o=i.addLayer(r);o.uuid=e.id;for(let n in e.data)Yh(n,o,e.data)}import{Vector2 as im}from"three";var ga=new im,Po=class{constructor(e,t,r){this.message=[];this.endLine=!0;this.yLinePos=e,this.lineHeight=t,this.maxCharSize=r,this.nextChar3DPos=new im(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=Tt.Left}addChar3D(e,t,r=this.message.length){this.message.splice(r,0,e),e.fontSize>this.maxCharSize?(this.maxCharSize=e.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(t)):(e.updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=e.charSize)}deleteChar3D(e=this.message.length-1){let t=this.message[e];if(t)return this.message.splice(e,1),this.nextChar3DPos.x-=t.charSize,t}isEndLine(e){this.endLine=e}fullUpdate(e,t=0){this.nextChar3DPos.x=0;for(let r=t,o=this.message.length;r<o;r+=1)this.message[r].updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(e){let t,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){t=this.message[r];break}r-=1}return!!(r>=0&&t&&t.localPosition.x+t.charSize>e)}containSpaceOverFlow(e=this.message.length-1){for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}containSpace(e=this.message.length-1){if(this.endLine)return!0;for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}popWord(e=this.message.length-1){let t=[],r=!0,o;for(o=e;o>=0;o-=1)if(this.message[o].char===" "){r=!1,t.length===0&&(o-=1,t.splice(0,0,this.message[o]));break}else t.splice(0,0,this.message[o]);return r?t=[]:this.message.splice(o+1,t.length),t}getWord(e=0,t=1){let r=[],o=e;for(o=e;;o+=t){if(!this.message[o]||this.message[o].char===" "){r.length===0&&this.message[o]&&(r.push(this.message[o]),this.message.splice(o,1));break}t>0?(r.push(this.message[o]),this.message.splice(o,1),o-=t):(r.splice(0,0,this.message[o]),this.message.splice(o,1))}return r}getWordAtIndex(e){let t=[];for(let r=e;r<this.message.length&&this.message[r].char!==" ";r++)t.push(this.message[r]);for(let r=e-1;r>=0&&this.message[r].char!==" ";r--)t.splice(0,0,this.message[r]);return t}wordSize(e=0,t=-1){let r=0,o=e;for(;o>=0&&o<this.message.length;){if(this.message[o].char===" "){r===0&&(r=this.message[o].charSize);break}r+=this.message[o].charSize,o+=t}return(o<0||o>=this.message.length)&&!this.endLine?this.message[e]?this.message[e].charSize:999999999:r===0?999999999:r}spaceLeft(e){return e-this.nextChar3DPos.x}popChar(e=this.message.length-1){return this.nextChar3DPos.x-=this.message[e].charSize,this.message.splice(e,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(e){this.yLinePos=e,this.updateNextCharPosY()}updatelineHeight(e){this.lineHeight=e,this.updateNextCharPosY()}updateFontSize(e,t=0,r=this.message.length-1){for(let o=t;o<=r;o+=1)this.message[o].updateFontSize(e);this.maxCharSize=e,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let e=0;for(let t=0;t<this.message.length;t++)this.message[t].char===" "&&(e+=1);return e}alignText(e,t,r,o,n){switch(r){case Tt.Left:this.leftAlign(e,n);break;case Tt.Center:this.centerAlign(this.spaceLeft(t),e,n);break;case Tt.Right:this.rightAlign(this.spaceLeft(t),e,n);break;case Tt.Justify:this.justifyAlign(this.spaceLeft(t),e,n);break}}offsetCharacters(e,t,r){ga.set(t,r);let o=this.message.length;for(let n=0;n<o;n++)this.message[n].updatePosition(this.message[n].localPosition.add(ga),e)}leftAlign(e,t){this.align=Tt.Left,this.offsetCharacters(e,0,t)}centerAlign(e,t,r){this.align=Tt.Center,this.offsetCharacters(t,e/2,r)}rightAlign(e,t,r){this.align=Tt.Right,this.offsetCharacters(t,e,r)}justifyAlign(e,t,r){if(this.align=Tt.Justify,this.endLine){this.offsetCharacters(t,0,r);return}let o=this.countSpaces();if(o===0){this.offsetCharacters(t,0,r);return}let n=e/o,s=0;for(let a=0;a<this.message.length;a++)this.message[a].char===" "&&(s+=n),ga.set(s,r),this.message[a].updatePosition(this.message[a].localPosition.add(ga),t)}clone(){let e=new Po(this.yLinePos,this.lineHeight,this.maxCharSize);e.nextChar3DPos=this.nextChar3DPos.clone(),e.align=this.align,e.endLine=this.endLine;for(let t=0;t<this.message.length;t++)e.message.push(this.message[t].clone());return e}};import{DoubleSide as uw,EventDispatcher as hw,Matrix3 as mw,Vector3 as sc}from"three";var fw=new sc(0,0,1),nm=new sc,sm=new sc,am=new mw,Oo=class extends yt{constructor(e=mt.create({}),t=new Nt({side:uw})){super(e,t);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new hw;this._onShapeUpdate=()=>{if(this.geometry instanceof No){if(this.geometry.updateFromShape()){let e=this.geometry.drawCount,t=this.geometry.userData;this.updateGeometry(Object.assign(this.geometry.userData,{parameters:Object.assign(t.parameters,{surfaceMaxCount:e+1e3})}))}}else this.updateGeometry({});this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};var r;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,(r=this.shape.eventDispatcher)==null||r.addEventListener("update",this._onShapeUpdate)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="VectorObject",t}fromState(e){return super.fromState(e),this.shape.update(),this}setHelperVisibility(){}updateGeometry(e){if(super.updateGeometry(e),"userData"in this.geometry){let t=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:t})}}setShape(e){var t,r;this.shape&&((t=this.shape.eventDispatcher)==null||t.removeEventListener("update",this._onShapeUpdate)),this.shape=e,(r=this.shape.eventDispatcher)==null||r.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),am.getNormalMatrix(this.matrixWorld),nm.copy(fw).applyMatrix3(am).normalize(),sm.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(nm,sm)}clone(e){let t=this.shape.clone(),r=this.material.clone(),o=this.geometry.userData,n=mt.create(Object.assign({},o,{shape:t})),s=new Oo(n,r).copy(this,e);return s.shape=t,t.update(),s}raycast(e,t){yt.prototype.raycast.call(this,e,t)}};import{Camera as Ow,OrthographicCamera as Aw,PerspectiveCamera as jw,Vector3 as Wt,Object3D as pm,Quaternion as _w}from"three";import{BoxBufferGeometry as yw}from"three";var Nr=i=>{var e;return e=class extends i{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new yw(30,30,30),e};import{Camera as vw,LineSegments as Sw,BufferGeometry as ww,LineBasicMaterial as Nw,Color as lc,Vector3 as Cw,Float32BufferAttribute as cm}from"three";import{Ray as gw,Sphere as xw,Matrix4 as bw,Vector3 as Ur}from"three";var xa=new gw,ac=new xw,lm=new bw,Cr=(i,e,t,r,o=!1)=>{let n=e,s=i.matrixWorld;if(n.boundingSphere===null&&n.computeBoundingSphere(),ac.copy(n.boundingSphere),ac.applyMatrix4(s),t.ray.intersectsSphere(ac)===!1||(lm.copy(s).invert(),xa.copy(t.ray).applyMatrix4(lm),n.boundingBox!==null&&xa.intersectsBox(n.boundingBox)===!1))return;let a,l,c,d,u=n.index,p=n.attributes.position,f=n.drawRange,m,x;if(o===!1){let N=Math.max(0,f.start),L=Math.min(u.count,f.start+f.count);for(m=N,x=L;m<x;m+=3)if(l=u.getX(m),c=u.getX(m+1),d=u.getX(m+2),a=y(i,t,xa,p,l,c,d),a){a.faceIndex=Math.floor(m/3),r.push(a);return}}else{let L=n.attributes.position,w=new Ur,B=new Ur,S=new Ur,_=new Ur,T=2,I=1/((i.scale.x+i.scale.y+i.scale.z)/3),b=I*I,P=Math.max(0,f.start),v=Math.min(L.count,f.start+f.count);for(let D=P,Z=v-1;D<Z;D+=T){if(w.fromBufferAttribute(L,D),B.fromBufferAttribute(L,D+1),xa.distanceSqToSegment(w,B,_,S)>b)continue;_.applyMatrix4(i.matrixWorld);let ie=t.ray.origin.distanceTo(_);ie<t.near||ie>t.far||r.push({distance:ie,point:S.clone().applyMatrix4(i.matrixWorld),object:i})}}function y(N,L,w,B,S,_,T){let h=new Ur,I=new Ur,b=new Ur,P=new Ur,v=new Ur;if(h.fromBufferAttribute(B,S),I.fromBufferAttribute(B,_),b.fromBufferAttribute(B,T),w.intersectTriangle(h,I,b,!1,P)===null)return null;v.copy(P),v.applyMatrix4(N.matrixWorld);let Z=L.ray.origin.distanceTo(v);return Z<L.near||Z>L.far?null:{faceIndex:1,distance:Z,point:v.clone(),object:N}}};var ba=new Cw,ir=new vw,dm=class extends Sw{constructor(e){let t=new ww,r=new Nw({color:16777215,vertexColors:!0,toneMapped:!1}),o=[],n=[],s={},a=new lc(Ya),l=new lc(Ya),c=new lc(bu);d("n1","n2",a),d("n2","n4",a),d("n4","n3",a),d("n3","n1",a),d("f1","f2",a),d("f2","f4",a),d("f4","f3",a),d("f3","f1",a),d("n1","f1",a),d("n2","f2",a),d("n3","f3",a),d("n4","f4",a),d("p","n1",l),d("p","n2",l),d("p","n3",l),d("p","n4",l),d("u1","u2",c),d("u2","u3",c),d("u3","u1",c);function d(p,f,m){u(p,m),u(f,m)}function u(p,f){o.push(0,0,0),n.push(f.r,f.g,f.b),s[p]===void 0&&(s[p]=[]),s[p].push(o.length/3-1)}t.setAttribute("position",new cm(o,3)),t.setAttribute("color",new cm(n,3));super(t,r);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=s,this.update()}update(){let e=this.geometry,t=this.pointMap,r=!0;ir.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let o=1,n=1,s=r?.8:1e-4;pr("n1",t,e,ir,-o,-n,s),pr("n2",t,e,ir,o,-n,s),pr("n3",t,e,ir,-o,n,s),pr("n4",t,e,ir,o,n,s);let a=s;pr("f1",t,e,ir,-o,-n,a),pr("f2",t,e,ir,o,-n,a),pr("f3",t,e,ir,-o,n,a),pr("f4",t,e,ir,o,n,a);let l=a,c=.5;pr("u1",t,e,ir,o*.7*c,n*1.1,l),pr("u2",t,e,ir,-o*.7*c,n*1.1,l),pr("u3",t,e,ir,0,n*(1.1+.9*c),l),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function pr(i,e,t,r,o,n,s){ba.set(o,n,s).unproject(r);let a=e[i];if(a!==void 0){let l=t.getAttribute("position");for(let c=0,d=a.length;c<d;c++)l.setXYZ(a[c],ba.x,ba.y,ba.z)}}var cc=class extends Nr(dm){constructor(e){super(e);this.object=e;this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){Cr(this.object,this.geometry,e,t,!0)}};import{DirectionalLightHelper as Lw}from"three";var ln=class extends Nr(Lw){constructor(e,t=15,r=10066329){super(e,t,r);this.object=e;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){Cr(this.object,ln.geometryHelper,e,t)}};import{AxesHelper as Tw}from"three";var cn=class extends Nr(Tw){constructor(e,t=15){super(t);this.object=e;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}raycast(e,t){Cr(this.object,cn.geometryHelper,e,t)}update(){}};import{PointLightHelper as Iw}from"three";var dn=class extends Nr(Iw){constructor(e,t=15,r=6710886){super(e,t,r);this.object=e;this.name=`PointLightHelper: ${e.uuid}`}raycast(e,t){Cr(this.object,dn.geometryHelper,e,t)}};import{SpotLightHelper as Mw,Vector3 as Pw}from"three";var Sa=class extends Nr(Mw){constructor(e,t=6710886){super(e,t);this.object=e;this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){Cr(this.object,Sa.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=Sa._vector,t=this.object.distance?this.object.distance:1e3,r=t*Math.tan(this.object.angle);this.cone.scale.set(r,r,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let o=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let n=0,s=this.cone.material.length;n<s;n++)this.cone.material[n].color.set(o);else this.cone.material.color.set(o)}}},va=Sa;va._vector=new Pw;var Lr=(i,e)=>class extends i{constructor(){super(...arguments);this.objectHelper=new e(this);this.enableHelper=!1}set visibility(r){this.visible=r,this.setHelperVisibility(r),this.setHelperChildrenVisibility(r)}get visibility(){return this.visible}get geometryHelper(){return e.geometryHelper}setHelperVisibility(r){this.objectHelper.visible=r}setHelperChildrenVisibility(r){for(let o of this.children)er(o)&&o.traverseEntity(n=>{Er(n)&&n.visible&&(n.objectHelper.visible=r)})}raycast(r,o){this.objectHelper.raycast(r,o)}copy(r,o=!0){return super.copy(r,o),r.enableHelper!==void 0&&(this.enableHelper=r.enableHelper),r.objectHelper!==void 0&&(this.objectHelper.visible=r.objectHelper.visible),this}toJSON(r){let o=super.toJSON(r),n=o.object;return n.enableHelper=this.enableHelper,o}fromJSON(r){return super.fromJSON(r),r.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(r,o){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let n=this;r.color!==void 0&&(n.color=Ye(r.color,o)),r.intensity!==void 0&&(n.intensity=r.intensity),r.depth!==void 0&&(n.shadow.camera.far=r.depth,n.shadow.needsUpdate=!0),r.shadows!==void 0&&(this.castShadow=r.shadows),r.helper!==void 0&&(this.enableHelper=r.helper,n.gizmos.shadowmap.visible=r.helper)}return this}};var wi=new Wt,dc=new Wt,lo=class extends Lr(tr(Ow),cc){constructor(e=window.innerWidth,t=window.innerHeight,r=45,o,n=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=xo.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=e,this.height=t,this.orthoCamera=new Aw(e*-.5,e*.5,t*.5,t*-.5,o!=null?o:-5e4,n),this.perspCamera=new jw(r,e/t,o!=null?o:50,n),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic(!0)}static createFromState(e,t){let r=new lo().fromState(t);return r.enableHelper=!0,r.objectHelper.update(),r.uuid=e,r}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(e,t){e==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e){super.lookAt(e),this.getWorldPosition(wi),this.targetOffset=wi.distanceTo(e)}getTarget(e=new Wt){return this.getWorldDirection(dc),this.getWorldPosition(wi),dc.multiplyScalar(this.targetOffset),e.copy(wi).add(dc),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(wi),wi.distanceTo(e)}updateUp(){let e=this.getWorldQuaternion(new _w),t=new Wt(0,0,1).applyQuaternion(e),r=new Wt().copy(pm.DefaultUp);this.isUpVectorFlipped&&r.negate(),r.applyQuaternion(e);let o=new Wt().copy(pm.DefaultUp).projectOnPlane(t),n=new Wt().crossVectors(o,r).dot(t)>=0?1:-1;this.angleOffsetFromUp=o.angleTo(r)*n}getViewFrontToObject(e){let t=e.getWorldPosition(new Wt),o=e.getWorldDirection(new Wt).multiplyScalar(this.targetOffset);return{position:t.clone().add(o),target:t}}getViewToObject(e){let t=e.getWorldPosition(new Wt),o=this.getWorldDirection(new Wt).multiplyScalar(this.targetOffset);return{position:t.clone().sub(o),target:t}}setViewplaneSize(e,t){this.left=-e*.5,this.right=e*.5,this.top=t*.5,this.bottom=-t*.5,this.aspect=e/t,this.updateProjectionMatrix()}toOrthographic(e){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",(this.enableHelper===!0||e===!0)&&this.objectHelper.update()}toPerspective(e){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",(this.enableHelper===!0||e===!0)&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,r,o,n,s){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,r,o,n,s):this.orthoCamera.setViewOffset(e,t,r,o,n,s)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(e){this._cameraType==="PerspectiveCamera"?this.toPerspective(e):this._cameraType==="OrthographicCamera"&&this.toOrthographic(e)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(e){let t={near:this.orthoCamera.near,far:this.orthoCamera.far},r={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(e),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=t.near,this.orthoCamera.far=t.far,this.perspCamera.near=r.near,this.perspCamera.far=r.far,this.updateProjectionMatrix(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="CombinedCamera",r.cameraType=this.cameraType,r.targetOffset=this.targetOffset,r.isUpVectorFlipped=this.isUpVectorFlipped,r.angleOffsetFromUp=this.angleOffsetFromUp,r.left=this.left,r.right=this.right,r.top=this.top,r.bottom=this.bottom,this.view!==null&&(r.view=Object.assign({},this.view)),r.zoomOrtho=this.orthoCamera.zoom,r.nearOrtho=this.orthoCamera.near,r.far=this.far,r.aspect=this.aspect,r.fov=this.fov,r.focus=this.focus,r.filmGauge=this.filmGauge,r.filmOffset=this.filmOffset,r.zoomPersp=this.perspCamera.zoom,r.nearPersp=this.perspCamera.near,t}fromJSON(e){var t;if(super.fromJSON(e),this.cameraType=e.cameraType,e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.orbitControlsTarget!==void 0){let r=this.getWorldPosition(new Wt),o=new Wt().fromArray(e.orbitControlsTarget);this.targetOffset=o.distanceTo(r)}else e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=(t=e.angleOffsetFromUp)!=null?t:0,e.left!==void 0&&(this.left=e.left),e.right!==void 0&&(this.right=e.right),e.top!==void 0&&(this.top=e.top),e.bottom!==void 0&&(this.bottom=e.bottom),e.view!==void 0&&(this.view=Object.assign({},e.view)),e.zoomOrtho!==void 0&&(this.orthoCamera.zoom=e.zoomOrtho),e.nearOrtho!==void 0&&(this.orthoCamera.near=e.nearOrtho),e.far!==void 0&&(this.far=e.far),e.aspect!==void 0&&(this.aspect=e.aspect),e.fov!==void 0&&(this.fov=e.fov),e.focus!==void 0&&(this.focus=e.focus),e.filmGauge!==void 0&&(this.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(this.filmOffset=e.filmOffset),e.zoomPersp!==void 0&&(this.perspCamera.zoom=e.zoomPersp),e.nearPersp!==void 0&&(this.perspCamera.near=e.nearPersp),this.updateProjectionMatrix(),this}toCameraState(e=[]){let t={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return Zo(t,e)}fromCameraState(e){let{orthographic:t,perspective:r}=e;return e.type!==void 0&&(this.cameraType=e.type),e.far!==void 0&&(this.far=e.far),t!==void 0&&(t.near!==void 0&&(this.orthoCamera.near=t.near),t.zoom!==void 0&&(this.orthoCamera.zoom=t.zoom)),r!==void 0&&(r.near!==void 0&&(this.perspCamera.near=r.near),r.fov!==void 0&&(this.perspCamera.fov=r.fov),r.zoom!==void 0&&(this.perspCamera.zoom=r.zoom)),e.up!==void 0&&this.up.fromArray(e.up),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(e){return $(O(O({},super.toState(e)),this.toCameraState(e)),{type:this.cameraType})}fromState(e){return super.fromState(e),this.fromCameraState(e),this}};import{Group as Dw}from"three";var co=class extends Lr(tr(Dw),cn){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(e,t){let r=new co().fromState(t);return r.uuid=e,r.enableHelper=!0,r.objectHelper.update(),r}toJSON(e){let t=super.toJSON(e);return t.object.objectType="EmptyObject",t}};import{DirectionalLight as Bw,CameraHelper as wa}from"three";var pn=class extends Lr(tr(Bw),ln){constructor(...e){super(...e);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=1,r.far=2500;let o=new wa(this.shadow.camera);o.visible=!1,this._gizmos.shadowmap=o,this.update()}static createFromState(e,t,r){let o=new pn().fromState(t,r);return o.uuid=e,o}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof wa&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof wa&&(t.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let t=this._gizmos[e];t instanceof wa&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightDirectional",r.color=this.color.getHex(),r.intensity=this.intensity,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var o;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.shadow.normalBias=(o=e.shadow.normalBias)!=null?o:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.left=r.left,t.right=r.right,t.top=r.top,t.bottom=r.bottom,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromDirectionalLightState(e,t){let r=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;return super.fromLightState(e,t),e.size!==void 0&&Nh(this,e.size),r&&this.update(),this}fromState(e,t){return super.fromState(e),this.fromDirectionalLightState(e,t),this}};import{PointLight as Gw,Vector3 as Na,Box3 as zw,Box3Helper as Ca,Color as Ew}from"three";var un=class extends Lr(tr(Gw),dn){constructor(...e){super(...e);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.fov=90,r.aspect=1,r.near=100,r.far=2500;let o=new Na(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),n=new Na(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z),s=new zw(o,n),a=new Ca(s,new Ew(16755200));a.visible=!1,this._gizmos.shadowmap=a,this.update()}static createFromState(e,t,r){let o=new un().fromState(t,r);return o.uuid=e,o}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof Ca&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof Ca&&(t.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let e in this._gizmos){let t=this._gizmos[e];if(t instanceof Ca){let r=this.shadow.camera,o=new Na(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),n=new Na(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z);t.box.set(o,n),t.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightPoint",r.color=this.color.getHex(),r.intensity=this.intensity,r.distance=this.distance,r.decay=this.decay,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var o,n;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow.normalBias=(o=e.shadow.normalBias)!=null?o:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray((n=e.shadow.mapSize)!=null?n:[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.fov=r.fov,t.focus=r.focus,t.aspect=r.aspect,t.filmGauge=r.filmGauge,t.filmOffset=r.filmOffset,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromPointLightState(e,t){return super.fromLightState(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,t){return super.fromState(e),this.fromPointLightState(e,t),this}};import{SpotLight as Fw,CameraHelper as La,MathUtils as Rw,Vector3 as um,Quaternion as Vw}from"three";var hm=new um,mm=new um,fm=new Vw,hn=class extends Lr(tr(Fw),va){constructor(...e){super(...e);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.fov=Rw.RAD2DEG*2*this.angle,r.aspect=1,r.near=100,r.far=2500;let o=new La(this.shadow.camera);o.visible=!1,this._gizmos.shadowmap=o,this.update()}static createFromState(e,t,r){let o=new hn().fromState(t,r);return o.uuid=e,o}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof La&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof La&&(t.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let t=this._gizmos[e];t instanceof La&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),mm.setFromMatrixPosition(this.matrixWorld),fm.setFromRotationMatrix(this.matrixWorld),hm.copy(this.up).applyQuaternion(fm).negate().multiplyScalar(this.distance),this.target.position.copy(mm).add(hm),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,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}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightSpot",r.color=this.color.getHex(),r.intensity=this.intensity,r.distance=this.distance,r.angle=this.angle,r.decay=this.decay,r.penumbra=this.penumbra,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var o;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.decay=e.decay,this.penumbra=e.penumbra,this.shadow.normalBias=(o=e.shadow.normalBias)!=null?o:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.fov=r.fov,t.focus=r.focus,t.aspect=r.aspect,t.filmGauge=r.filmGauge,t.filmOffset=r.filmOffset,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromSpotLightState(e,t){return super.fromLightState(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),this}fromState(e,t){return super.fromState(e),this.fromSpotLightState(e,t),this}};import{VideoTexture as Uw}from"three";var ym=i=>i.tagName==="VIDEO",Ni=class{static resize(e,t,r){let o=e/t,n;if(!r.image)return;let s=r.image;ym(s)?n=s.videoWidth/s.videoHeight:n=s.width/s.height,o>n&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*n/o):r.repeat.set(1,1*n/o)),o<n&&(r.imageType=="WEBCAM"?r.repeat.set(1*o/n*-1,1):r.repeat.set(1*o/n,1)),o==n&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let o=e/t,n=r.image!==void 0?r.image.width/r.image.height:1,s;o>n?s={x:1,y:n/o}:o<n?s={x:o/n,y:1}:s={x:1,y:1},r.repeat.set(s.x,s.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let o=r.userData.layers,n=o.getLayers();for(let s=0;s<n.length;s++){let a=n[s];Hh(a)&&(Ni.resizeTextureLayer(e,t,a.uniforms[`f${a.id}_texture`].value),o.updateLayerUniform())}}static resizeComplex(e,t,r,o){let n=e/t,s,a=r.image;ym(a)?s=a.videoWidth/a.videoHeight:s=a.width/a.height,o.geometry.type.includes("Shape")?(n>s&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*s/n):r.repeat.set(1/e,1/t*s/n)),n<s&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*n/s*-1,1/t):r.repeat.set(1/e*n/s,1/t)),n==s&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(n>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/n):r.repeat.set(1,1*s/n)),n<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*n/s*-1,1):r.repeat.set(1*n/s,1)),n==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var mn=class extends yt{constructor(e,t=new Nt){super(e,t);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e){super.updateGeometry(e),this.material.userData.layers&&Ni.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(e,t){super.resizeGeometry(e,t,0),this.material.userData.layers&&Ni.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="Mesh2D",t}clone(){let e=super.clone();return e.updateGeometry({}),e}static fromTexture(e){let t,r;if(e instanceof Uw){let s=e.image;t=s.videoWidth*.5,r=s.videoHeight*.5}else{let s=e.image;t=s.width*.5,r=s.height*.5}let o=Ws.create({parameters:{width:t,height:r}}),n=new Nt;return n.layersList.changeLayer(0,{type:Le.TEXTURE,texture:e}),n.layersList.moveLayer(0,1),n.dispose(),new mn(o,n)}};var fn=class extends yt{constructor(e,t=new or){super(e,t);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(e){let t=super.toJSON(e);return t.object.objectType="Mesh3D",t}};var yn=class extends fn{constructor(e,t=new or){super(e,t);this.objectType="NonParametric"}toJSON(e){let t=super.toJSON(e);return t.object.objectType="NonParametric",t}};var gn;(function(t){t[t.TO_RIGHT=1]="TO_RIGHT",t[t.TO_LEFT=-1]="TO_LEFT"})(gn||(gn={}));var pc=class extends yt{constructor(e,t=new Nt({transparent:!0,opacity:1,visible:!1,side:Ta})){super(e,t);this.objectType="TextFrame";this.charContainer=new kw,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=e.userData,this.userData.textFrame={hexColor:null,opacity:1,visible:!0,text:"",fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:eo.None,horizontalAlignment:1,verticalAlignment:Br.Top,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new xm(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(e,t,r){let o=$s.create({parameters:{width:t.width,height:t.height}}),n=new pc(o).fromState(t,r);return n.uuid=e,n}async updateText(e){this.clearText();let t=this.userData.textFrame,r=t.fontFamily;await _t.loadFont(r),t.text=e;let o=t.textOrigin,n=new gm({visible:t.visible,transparent:!0,side:Ta}),s=e.split(`
|
|
958
|
-
`),a=0;this.userData.textFrame.textLines=s.map((l,c)=>{let d=new Po(a,t.lineHeight,t.fontSize);return d.message=l.split("").map(u=>{let p={char:u,fontFamily:r,letterSpacing:t.letterSpacing,fontSize:t.fontSize,LOD:16},f=n.clone();f.color=t.hexColor,f.opacity=t.opacity;let m=new _t(p,f);return d.addChar3D(m,o),this.charContainer.add(m),m}),a+=d.maxCharSize*d.lineHeight,d}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let e=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let t=this.charContainer.children[0];this.charContainer.remove(t)}for(;e.length;)e.pop()}raycast(e,t){let r=[];if(super.raycast(e,r),r.length>0){t.push(r[0]);return}let o=[];for(let n=0,s=this.charContainer.children.length;n<s;++n)if(this.charContainer.children[n]instanceof _t&&(e.intersectObject(this.charContainer.children[n],!1,o),o.length>0)){o[0].object=this,t.push(o[0]);return}}updateGeometry(e){var c,d,u,p;let t=this.userData,r=this.geometry.userData,o=r.parameters.width,n=r.parameters.height,s=(d=(c=e.parameters)==null?void 0:c.width)!=null?d:o,a=(p=(u=e.parameters)==null?void 0:u.height)!=null?p:n,l=t.textFrame;super.updateGeometry(e),l.maxLineSize=s,l.textOrigin.set(-.5*s,.5*a,0),a!==n?(this.checkOverFlow(),this.checkCapacity()):s!==o&&(o<s?this.checkCapacity():o>s&&this.checkOverFlow())}checkOverFlow(e=0){let t=this.userData,r=t.textFrame.textOrigin,o=t.textFrame.textLines;for(let n=e;n<o.length;n++){o[n].updateYLinePos(this.getNewLinePosition(n)),o[n].fullUpdate(r);let s=[];for(;o[n].checkOverFlow(t.textFrame.maxLineSize);)o[n].containSpaceOverFlow()?s.unshift(o[n].getWord(o[n].message.length-1,-1)):s.unshift(o[n].popChar());if(s.length>0){o[n+1]===void 0?(o[n].isEndLine(!1),this.createTextLine()):o[n].endLine&&(this.createTextLine(n+1),o[n].isEndLine(!1),o[n+1].isEndLine(!0));let a=0;for(let l=0;l<s.length;l+=1)for(let c=0;c<s[l].length;c+=1)o[n+1].addChar3D(s[l][c],r,a),a+=1;o[n+1].fullUpdate(r)}o[n].fullUpdate(r)}this.textFullUpdate(e)}checkCapacity(e=0){let t=this.userData,r=t.textFrame.textOrigin,o=t.textFrame.maxLineSize,n=t.textFrame.textLines;for(let s=e;s<n.length;s+=1)if(n[s].updateYLinePos(this.getNewLinePosition(s)),n[s].fullUpdate(r),!!n[s-1])for(;!n[s-1].endLine;){let a,l=n[s-1].spaceLeft(o);if(n[s].wordSize(0,1)<=l){n[s].containSpace()?a=n[s].getWord(0,1):a=n[s].popChar(0);for(let c=0;c<a.length;c+=1)a[c]&&n[s-1].addChar3D(a[c],r)}else{n[s].isEmpty()?(n[s].endLine&&n[s-1].isEndLine(!0),n.splice(s,1),s-=1):(n[s].updateYLinePos(this.getNewLinePosition(s)),n[s].fullUpdate(r));break}}this.textFullUpdate(e)}createTextLine(e=this.userData.textFrame.textLines.length){let r=this.userData.textFrame;r.textLines.splice(e,0,new Po(this.getNewLinePosition(e),r.lineHeight,r.fontSize))}textFullUpdate(e=0){let r=this.userData.textFrame,o=r.textLines,n=this.getVerticalAlignmentOffSet();for(let s=e;s<o.length;s++)o[s].updateYLinePos(this.getNewLinePosition(s)),o[s].fullUpdate(r.textOrigin),o[s].alignText(r.textOrigin,r.maxLineSize,r.horizontalAlignment,r.verticalAlignment,n)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case Br.Top:return 0;case Br.Center:return this.getRemainingVerticalSpace()/2;case Br.Bottom:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let t=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(t.length)}getNewLinePosition(e){let r=this.userData.textFrame.textLines,o=0;for(let n=0;n<e;n+=1)o+=r[n].maxCharSize*r[n].lineHeight;return o}updateColor(e){var o;let t=this.userData;t.textFrame.hexColor=e;let r=t.textFrame.textLines;for(let n=0;n<r.length;n++){let s=r[n].message;for(let a=0;a<s.length;a++){let l=s[a].material;((o=l.color)==null?void 0:o.isColor)&&(l.color=e)}}}updateOpacity(e){let t=this.userData;t.textFrame.opacity=e;let r=t.textFrame.textLines;for(let o=0;o<r.length;o++){let n=r[o].message;for(let s=0;s<n.length;s++){let a=n[s].material;a.opacity=e}}}updateVisible(e){let t=this.userData;t.textFrame.visible=e;let r=t.textFrame.textLines;for(let o=0;o<r.length;o++){let n=r[o].message;for(let s=0;s<n.length;s++){let a=n[s].material;a.visible=e}}}async updateFontFamily(e){await _t.loadFont(e);let r=this.userData.textFrame,o=r.textLines;r.fontFamily=e;for(let n=0;n<o.length;n++){let s=o[n].message;for(let a=0;a<s.length;a++)s[a].updateFontFamily(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(e){let r=this.userData.textFrame,o=r.textLines,n=r.fontSize;r.fontSize=e;for(let s=0;s<o.length;s++)o[s].updateFontSize(e);this.textFullUpdate(),e>n?this.checkOverFlow():e<n&&this.checkCapacity()}async updateTextTransform(e){let r=this.userData.textFrame;await _t.loadFont(r.fontFamily);let o=r.textLines;switch(r.textTransform=e,e){case eo.Upper:for(let n=0;n<o.length;n++){let s=o[n].message;for(let a=0;a<s.length;a++)o[n].message[a].updateChar(s[a].char.toUpperCase())}break;case eo.Lower:for(let n=0;n<o.length;n++){let s=o[n].message;for(let a=0;a<s.length;a++)o[n].message[a].updateChar(s[a].char.toLowerCase())}break;default:for(let n=0;n<o.length;n++){let s=o[n].message;for(let a=0;a<s.length;a++)o[n].message[a].updateChar(s[a].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(e){let t=this.userData,r=t.textFrame.textLines;t.textFrame.letterSpacing=e;for(let o=0;o<r.length;o++){let n=r[o].message;for(let s=0;s<n.length;s++)n[s].updateLetterSpacing(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(e){let t=this.userData;t.textFrame.LOD=e;let r=t.textFrame.textLines;for(let o=0;o<r.length;o++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(e){let t=this.userData,r=t.textFrame.textLines;t.textFrame.lineHeight=e;for(let o=0;o<r.length;o++)r[o].updatelineHeight(e);this.textFullUpdate()}updateVerticalAlignment(e){let t=this.userData;t.textFrame.verticalAlignment=e,this.textFullUpdate()}updateHorizontalAlignment(e){let t=this.userData;t.textFrame.horizontalAlignment=e,this.textFullUpdate()}toJSON(e){let t=super.toJSON(e),r=t.object;r.objectType="TextFrame";let n=this.userData.textFrame.textLines.map(s=>{let a=s.message.map(l=>({char:l.char,originalChar:l.originalChar,fontFamily:l.fontFamily,letterSpacing:l.letterSpacing,fontSize:l.fontSize,LOD:l.LOD}));return{align:s.align,endLine:s.endLine,lineHeight:s.lineHeight,maxCharSize:s.maxCharSize,yLinePos:s.yLinePos,message:a}});return r.userData.textFrame.textLinesData=n,t}async fromJSONasync(e){if(super.fromJSON(e),e.userData!==void 0){let t=e.userData.textFrame;await _t.loadFont(t.fontFamily),t.textOrigin=new xm(t.textOrigin.x,t.textOrigin.y,t.textOrigin.z);let r=new gm({color:t.hexColor,opacity:t.opacity,visible:t.visible,transparent:!0,side:Ta});t.textLinesData&&(t.textLines=t.textLinesData.map((o,n)=>{let s=new Po(Number(o.yLinePos),Number(o.lineHeight),Number(o.maxCharSize)),a=o.message.map((l,c)=>{if(l.char===void 0){let p=t.textLines[n].message[c];if("geometries"in p){let f=p.geometries[0].userData.parameters;Object.assign(l,{LOD:f.lod,char:f.char,fontFamily:f.fontFamily,fontSize:f.fontSize,letterSpacing:f.letterSpacing,originalChar:f.char})}}let d={char:l.char,fontFamily:l.fontFamily,letterSpacing:Number(l.letterSpacing),fontSize:Number(l.fontSize),LOD:l.LOD},u=new _t(d,r.clone());return s.addChar3D(u,t.textOrigin),this.charContainer.add(u),u});return s.message=a,s}),this.userData.textFrame=t),this.textFullUpdate()}return this}fromTextFrameData(e,t){if(e.color!==void 0){let r=Ye(e.color,t);this.updateColor(r),this.updateOpacity(r.a)}e.alpha!==void 0&&this.updateOpacity(e.alpha),e.font!==void 0&&this.updateFontFamily(e.font),e.horizontalAlign!==void 0&&this.updateHorizontalAlignment(e.horizontalAlign),e.verticalAlign!==void 0&&this.updateVerticalAlignment(e.verticalAlign),e.textTransform!==void 0&&this.updateTextTransform(e.textTransform),e.fontSize!==void 0&&this.updateFontSize(e.fontSize),e.lineHeight!==void 0&&this.updateLineHeight(e.lineHeight),e.letterSpacing!==void 0&&this.updateLetterSpacing(e.letterSpacing),e.text!==void 0&&e.text!==""&&this.updateText(e.text),(e.width!==void 0||e.height!==void 0)&&this.updateGeometry({parameters:{width:e.width,height:e.height}})}fromState(e,t){return super.fromState(e),this.fromTextFrameData(e,t),this}convertToVector(){let{fontFamily:e,hexColor:t}=this.userData.textFrame,r=new co;r.name="Text Shape";let o=_t.fontCache[e];for(let n of this.charContainer.children)n instanceof _t&&o.generateShapes(n.char,1).forEach(s=>{let a=new Pe().fromShape(s);a.applyScale(n.scale.x,n.scale.y);let l=mt.create({shape:a}),c=new Nt({side:Ta});c.color=t;let d=new Oo(l,c);d.name=n.char,d.position.copy(n.position),d.rotation.copy(n.rotation),r.attach(d)});return r}},Ci=pc;Ci.VerticalAlign=Br,Ci.HorizontalAlign=Tt,Ci.TextTransform=eo;import{HemisphereLight as i1,Scene as n1,Vector3 as s1,Color as jm,Fog as a1,Box3 as l1}from"three";import{BufferGeometryLoader as Hw}from"three";function bm(i,e){return qw(i)}function qw(i){let e={parameters:i,type:i.type};if(i.type==="VectorGeometry"){let r=Pe.createFromState(i.shape,i.width,i.height);e.shape=r}else i.type==="NonParametricGeometry"&&(i.data.groups&&i.data.groups.forEach(r=>{var o;return r.materialIndex=Math.max((o=r.materialIndex)!=null?o:0,0)}),e.geometry=new Hw().parse(i));let t;try{t=Ji(e)}catch(r){console.error(r)}if(!t){let r=Pe.createFromState(ai.defaultData(),100,100);e.shape=r,t=Ji(e)}return t}import{Box3 as Ww,Matrix4 as Ao,Sphere as wm,Vector3 as $w}from"three";var Nm=wc(Sm());var uc;Js.then(i=>{uc=i});var Cm=new Ao,Jw=new Ao,Kw=new Ao,ur=new Ww,po=new $w,Xw=new Ao,Zw=new Ao,xn=class extends yt{constructor(e,t,r,o=new or){super(r!=null?r:t,o);this.subdivPointer=e;this.originalGeometry=t;this.subdividedGeometry=r;this.objectType="SubdivObject";this.hiddenMatrixOld=new Ao;this.smoothShading=!0;this.matrixWorldRigid=new Ao;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(e,t,r){let{subdivPointer:o,originalGeometry:n,subdividedGeometry:s}=kt.build(t.geometry,void 0,void 0,!t.flatShading),a=an(t.material,r),l=new xn(o,n,s||void 0,a);return l.calcBoundingBox(),l.freeSubdivPointer(),l.uuid=e,l.fromState(t),l}shallowClone(e){return new yn(this.geometry,this.material).shallowCopy(this,e)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="SubdivObject",t}buildFromStore(e){var n,s,a;let{originalGeometry:t,subdividedGeometry:r,subdivPointer:o}=kt.build(e,this.subdivPointer,void 0,this.smoothShading,this.shearScale);if(this.subdivPointer=o,t!==void 0&&((n=this.originalGeometry)==null||n.dispose(),this.originalGeometry=t),r!==void 0&&((s=this.subdividedGeometry)==null||s.dispose(),this.subdividedGeometry=r!=null?r:void 0),this.geometry=(a=this.subdividedGeometry)!=null?a:this.originalGeometry,this.cloner)for(let l of this.cloner.children)l.geometry=this.geometry;e.width&&(this.geometry.userData.parameters={width:e.width,height:e.height,depth:e.depth})}updateMesh(e=!1){kt.buildLevel(this.subdivPointer,!0,this.smoothShading,this.originalGeometry,e?this.shearScaleInv:void 0),this.subdividedGeometry&&kt.buildLevel(this.subdivPointer,!1,this.smoothShading,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){var e;this.originalGeometry.dispose(),this.originalGeometry=kt.buildLevel(this.subdivPointer,!0,this.smoothShading),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=kt.buildLevel(this.subdivPointer,!1,this.smoothShading)),this.geometry=(e=this.subdividedGeometry)!=null?e:this.originalGeometry}raycast(e,t){var r;this.geometry=this.originalGeometry,yt.prototype.raycast.call(this,e,t),this.geometry=(r=this.subdividedGeometry)!=null?r:this.originalGeometry}updateMatrixWorldSVD(){let e=this.matrixWorld.elements,t=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],{u:r,v:o,q:n}=(0,Nm.SVD)(t),s=Cm.set(r[0][0],r[0][1],r[0][2],0,r[1][0],r[1][1],r[1][2],0,r[2][0],r[2][1],r[2][2],0,0,0,0,1),a=Jw.set(o[0][0],o[0][1],o[0][2],0,o[1][0],o[1][1],o[1][2],0,o[2][0],o[2][1],o[2][2],0,0,0,0,1),l=Kw.copy(a).transpose();this.shearScale=Xw.makeScale(n[0],n[1],n[2]).multiply(l).premultiply(a),this.shearScaleInv=Zw.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(s,l),n.every(c=>Math.abs(n[0]-c)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new wm);let t=e.attributes.position,r=e.boundingSphere.center;ur.setFromBufferAttribute(t),ur.getCenter(r),e.boundingSphere.radius=r.distanceTo(ur.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ur.getSize(po);let o={width:po.x,height:po.y,depth:po.z};return this.geometry.userData.parameters=o,o}updateBoundingBox(e){let t=this.originalGeometry;ur.min.set(e[0],e[2],e[4]),ur.max.set(e[1],e[3],e[5]),this.shearScaleInv&&(ur.min.applyMatrix4(this.shearScaleInv),ur.max.applyMatrix4(this.shearScaleInv)),t.boundingSphere===null&&(t.boundingSphere=new wm);let r=t.boundingSphere.center;ur.getCenter(r),t.boundingSphere.radius=r.distanceTo(ur.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),ur.getSize(po);let o={width:po.x,height:po.y,depth:po.z};return this.geometry.userData.parameters=o,o}freeSubdivPointer(){this.subdivPointer&&(uc.free_bvh(this.subdivPointer),uc.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(e){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:e.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:e.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:e.parameters.depth/this.geometry.userData.parameters.depth,Lm(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(Lm(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters=O({},e.parameters)}};function Lm(i,e,t,r){let o=i.position.array,n=i.normal.array,s=Cm.makeScale(e,t,r).invert().elements,a,l,c;for(var d=0,u=o.length;d<u;d+=3)o[d]*=e,o[d+1]*=t,o[d+2]*=r,a=n[d],l=n[d+1],c=n[d+2],n[d]=s[0]*a+s[4]*l+s[8]*c,n[d+1]=s[1]*a+s[5]*l+s[9]*c,n[d+2]=s[2]*a+s[6]*l+s[10]*c}import{BackSide as Qw,DoubleSide as Yw,FrontSide as e1}from"three";function Tm(i,e){e.flatShading!==void 0&&(i.flatShading=e.flatShading,i.needsUpdate=!0),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.side!==void 0&&(e.side===oi.Front?i.side=e1:e.side===oi.Back?i.side=Qw:i.side=Yw)}function t1(i,e){if(Array.isArray(i.material))for(let t of i.material)Tm(t,e);else{let t=i.material;Tm(t,e)}i.objectType==="SubdivObject"&&e.flatShading!==void 0&&(i.material.flatShading=!1,i.smoothShading=!e.flatShading,i.updateMesh())}function Im(i,e,t){let r;if(e.geometry.type==="SubdivGeometry")r=xn.createFromState(i,e,t);else{let o=bm(e.geometry,t),n="materials"in e?om(e.materials,t):an(e.material,t);Ts.is2DParametricMesh(o.userData.type)?r=new mn(o,n):(o==null?void 0:o.userData.type)==="VectorGeometry"?r=new Oo(o,n):e.geometry.type==="NonParametricGeometry"?r=new yn(o,n):r=new fn(o,n),r.uuid=i,r.fromState(e)}return t1(r,e),r}function Mm(i,e,t){return e.type==="Mesh"?Im(i,e,t):e.type==="TextFrame"?Ci.createFromState(i,e,t):e.type==="Empty"?co.createFromState(i,e):e.type==="PointLight"?un.createFromState(i,e,t):e.type==="SpotLight"?hn.createFromState(i,e,t):e.type==="DirectionalLight"?pn.createFromState(i,e,t):Qo.is(e.type)?lo.createFromState(i,e):(console.error(e),new co)}function r1(i,e){e.uniforms[`f${e.id}_transmissionSamplerMap`].value=i.texture,e.uniforms[`f${e.id}_transmissionDepthMap`].value=i.depthTexture}function Pm(i,e,t){if(!t.userData.layers)return!1;let r=!1,o=t.userData.layers.getLayersOfType(Le.TRANSMISSION);return o.length>0?(e.layers.set(3),r=!0,i!==void 0&&o.forEach(n=>r1(i,n))):e.layers.set(0),r}function Om(i,e){let t=!1;return e.traverseEntity(r=>{if(r instanceof yt)if(Array.isArray(r.material))for(let o=0;o<r.material.length;o++)Pm(i,r,r.material[o])&&(t=!0);else Pm(i,r,r.material)&&(t=!0)}),t}function Am(i,e){"material"in i&&o1(i.material,e),"geometry"in i&&i.geometry.dispose()}function o1(i,e){Nc(i).forEach(t=>{e.isSharedMaterial(t)||t.dispose()})}var _m=new s1,hc=class extends ea(n1){constructor(e,t){super();this.objectType="Scene";this.alpha=1;this.backupFog=new a1(16777215,.1,2e3);this.fogUseBGColor=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this._needsTransmission=!1;this._color=new jm(1,0,0);this.bgColor=new jm(1,1,1);this.entityByUuid={};this.ambientLight=new i1(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.sharedAssetManager=t,this.init(e,t)}needsTransmission(e){return this.needsTransmissionDirty&&(this._needsTransmission=Om(e,this),e!==void 0&&(this.needsTransmissionDirty=!1)),this._needsTransmission}find(e){if(e===""||e===void 0)return;let t=this.entityByUuid[e];return t===void 0?this.getObjectByProperty("uuid",e):t}get color(){return this._color}set color(e){this.fogUseBGColor===!0&&this.backupFog.color.copy(e),this._color.copy(e)}get enableFog(){return this.fog!==null}set enableFog(e){this.fog=e===!0?this.backupFog:null}init(e,t){if(this.createChildrenObjects(e.objects,this,t),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(Ye(e.backgroundColor,t)),this.updateFog(e.fog,t),this.updateAmbientLight(e.environment.ambientLight,t),this.activeCamera=this.personalCamera,e.publish.playCamera!==null){let r=this.find(e.publish.playCamera);r instanceof lo&&this.switchActiveCamera(r)}}clearScene(e){this.traverseEntity(t=>{Am(t,e)});for(let t of this.children)er(t)&&t.removeFromParent()}resetAfterClear(e,t){this.init(e,t)}createPersonalCamera(){let e=lo.createFromState(hc.PERSONAL_CAMERA_ID,$(O({},Ms.defaultData),{name:"Personal Camera"}));return e.enableHelper=!1,e.objectHelper.visible=!1,delete e.isEntity,this.registerObjectCreatedInLegacy(e),e}raycast(e){let t=[],r=o=>{for(let n of o.children)er(n)&&!n.raycastLock&&n.visible&&((Xs(n)||Er(n)&&n.enableHelper&&n.objectHelper.parent)&&e.intersectObject(n,!1,t),r(n))};return r(this),t}traverseEntity(e){for(let t of this.children)er(t)&&t.traverseEntity(e)}updateFog(e,t){this.enableFog=e.enabled,this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=Ye(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far}toJSON(e){return{}}fromJSON(e){return this}dispose(){this.clearScene(this.sharedAssetManager),this.sharedAssetManager.dispose()}updateAmbientLight(e,t){wh(this.ambientLight,e,t),e.groundColor!==void 0&&(this.ambientLight.groundColor=Ye(e.groundColor,t)),e.enabled!==void 0&&(this.ambientLight.visible=e.enabled)}switchActiveCamera(e){this.activeCamera!==this.personalCamera&&(this.activeCamera.enableHelper=!0),this.activeCamera=e,e.enableHelper=!1}setBackgroundColor(e){this.bgColor=e,this.alpha=e.a}createChildrenObjects(e,t,r){for(let o of e)this.createChildObject(o.id,o.data,o.children,t,r)}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let t of e.children)this.unregisterObject(t)}createChildObject(e,t,r,o,n){let s=Mm(e,t,n);return s&&(this.entityByUuid[e]=s,o.add(s),this.createChildrenObjects(r,s,n)),s}getCenter(e){let t=[];for(let o=0,n=e.length;o<n;++o){let{id:s,recursive:a}=e[o],l=this.find(s),c=a?l.recursiveBBox:l.singleBBox;t.push(...c.vertices)}let r=new l1;return r.setFromPoints(t),r.getCenter(_m),_m}copyMatrixWorld(e,t){if(e===null){t.identity();return}let r=this.find(e);r?t.copy(r.matrixWorld):t.identity()}copyParentMatrixWorld(e,t){var o;if(e===null){t.identity();return}let r=(o=this.find(e))==null?void 0:o.parent;r?t.copy(r.matrixWorld):t.identity()}traverseMaterial(e){this.traverseEntity(t=>{if(t instanceof yt)if(Array.isArray(t.material))for(let r=0;r<t.material.length;r++)e(t.material[r]);else e(t.material)})}updateCanvasSize(e,t){this.activeCamera.setViewplaneSize(e,t);let r,o;e>=t?(r=t/e,o=1):(r=1,o=e/t),this.traverseMaterial(n=>{n.layersList.getLayersOfType(Le.TRANSMISSION).forEach(a=>{a.uniforms[`f${a.id}_aspectRatio`].value.x=r,a.uniforms[`f${a.id}_aspectRatio`].value.y=o})})}},Ma=hc;Ma.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";import{WebGLRenderTarget as c1,LinearMipmapLinearFilter as d1,LinearFilter as p1,ClampToEdgeWrapping as Dm,DepthTexture as u1}from"three";var Bm=new Nt,mc=class extends Ht{},fc=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new c1(2048,2048,{generateMipmaps:!0,minFilter:d1,magFilter:p1,wrapS:Dm,wrapT:Dm}),this.transmissionRenderTarget.depthTexture=new u1(2048,2048),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,nc(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===Bm}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){var t;return(t=this.materials[e])!=null?t:Bm}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e].src=t,!0;{let r=new Image;return r.src=t,r.onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new mc(t.r,t.g,t.b,t.a):this.colors[e]=new mc(t.r,t.g,t.b,1),!1)}updateColor(e,t){var r,o,n,s;if(this.colors[e]){let a=this.colors[e];return this.colors[e].r=(r=t.r)!=null?r:a.r,this.colors[e].g=(o=t.g)!=null?o:a.g,this.colors[e].b=(n=t.b)!=null?n:a.b,this.colors[e].a=(s=t.a)!=null?s:a.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};var Gm=class extends m1{load(e,t,r,o=console.error){let n=new h1(this.manager);n.setPath(this.path),n.setResponseType("arraybuffer"),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(e,s=>{try{if(typeof s=="string")throw new Error("The .spline file is not binary!");t(this.parse(s))}catch(a){o(a)}},r,o)}parse(e){let t=xs.deserialize(new Uint8Array(e)),r=new fc(t.shared);return new Ma(t.scene,r)}};export{Gm as default};
|
|
975
|
+
`),h&&g.push(h.code,`outgoingLight = spe_blend(outgoingLight, ${h.result}, 1.0, SPE_BLENDING_NORMAL);`),p?g.push(`gl_FragColor = vec4( outgoingLight, accumAlpha * ${p.result} );`):g.push("gl_FragColor = vec4( outgoingLight, 1.0 );"),g.push("#include <encodings_fragment>","#include <fog_fragment>","#include <dithering_fragment>"),t=g.join(`
|
|
976
|
+
`)}return t}copy(e){return super.copy(e),e.color&&(this.color=e.color.clone()),this.roughness=e.roughness.clone(),this.metalness=e.metalness.clone(),e.position&&(this.position=e.position.clone()),e.afterColor&&(this.afterColor=e.afterColor.clone()),e.alpha&&(this.alpha=e.alpha.clone()),e.reflectivity&&(this.reflectivity=e.reflectivity.clone()),e.shadingAlpha&&(this.shadingAlpha=e.shadingAlpha.clone()),e.shadingBlend&&(this.shadingBlend=e.shadingBlend.clone()),this}};var Ad=class extends bn{get color(){return this.fragment.color}set color(e){this.fragment.color=e}get afterColor(){return this.fragment.afterColor}set afterColor(e){this.fragment.afterColor=e}get alpha(){return this.fragment.alpha}set alpha(e){this.fragment.alpha=e}get shadingAlpha(){return this.fragment.shadingAlpha}set shadingAlpha(e){this.fragment.shadingAlpha=e}get shadingBlend(){return this.fragment.shadingBlend}set shadingBlend(e){this.fragment.shadingBlend=e}get position(){return this.fragment.position}set position(e){this.fragment.position=e}get roughness(){return this.fragment.roughness}set roughness(e){this.fragment.roughness=e}get metalness(){return this.fragment.metalness}set metalness(e){this.fragment.metalness=e}get reflectivity(){return this.fragment.reflectivity}set reflectivity(e){this.fragment.reflectivity=e}constructor(e=new Md,t){super(e,e,t);this.type="StandardNodeMaterial",this.fragment=e}};var Ra=class extends Ad{constructor(e,t,r){super(t,e);this.userData.type="PhysicalMaterial",this.userData.category="Physical",this.userData.layers=r!=null?r:this._getLayerStack(e==null?void 0:e.map)}get layersList(){return this.userData.layers}set layersList(e){this.userData.layers=e}equals(e){return this.userData.type===e.userData.type&&this.userData.layers.uuid==e.userData.layers.uuid}copy(e){if(e.userData.layers!==void 0&&e.userData.layers instanceof Ir){let t=e.userData.layers,r=e.fragment;super.copy(e);let n=r.clone();this.fragment=n,this.vertex=n;let s=t.clone(this);this.userData.layers=s,n.shadingAlpha.value=r.shadingAlpha.value,n.shadingBlend.value=r.shadingBlend.value}else super.copy(e);return this}static fromJSON(e,t,r){let n=r.getNode(t.vertex),s=new Ra(void 0,n);return s.fromJSON(t,r),s}dispose(){super.dispose()}};import{Color as Pd}from"three";import{Matrix3 as kv,Texture as Od,Vector2 as za,Vector3 as Mo,Vector4 as Hv}from"three";function Wv(i,e){switch(i.data.type){case"light":return jn(i);case"fresnel":return l3(i,e);case"gradient":return c3(i);case"depth":return u3(i);case"normal":return f3(i);case"noise":return h3(i,e);case"texture":return d3(i,e);case"rainbow":return p3(i);case"transmission":return m3(i,e);case"matcap":return g3(i,e);case"displace":return y3(i);case"color":default:return a3(i,e)}}function qv(i){return{type:i.data.type}}function jn(i){let{alpha:e,mode:t}=i.data;return fe(U({},qv(i)),{alpha:e,mode:t})}function a3(i,e){return fe(U({},jn(i)),{color:kt(i.data.color,e)})}function l3(i,e){let{bias:t,scale:r,intensity:n,factor:s,color:l}=i.data;return fe(U({},jn(i)),{color:kt(l,e),bias:t,scale:r,intensity:n,factor:s})}function c3(i){let{gradientType:e,smooth:t,colors:r,steps:n,angle:s,offset:l,morph:c}=i.data;return fe(U({},jn(i)),{gradientType:e,smooth:t,colors:r.map(f=>new Hv(f[0],f[1],f[2],f[3])),num:r.length,steps:n,offset:new za(...l),morph:new za(...c),angle:s})}function u3(i){let{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:l,direction:c,colors:f,steps:h,smooth:p,num:y}=i.data;return fe(U({},jn(i)),{gradientType:e,near:t,far:r,isVector:n,isWorldSpace:s,origin:new Mo(...l),direction:c?new Mo(...c):new Mo(1,0,0),num:y,colors:f.map(g=>new Hv(g[0],g[1],g[2],g[3])),steps:h,smooth:p})}function f3(i){let{cnormal:e}=i.data;return fe(U({},jn(i)),{cnormal:new Mo(e[0],e[1],e[2])})}function h3(i,e){let{data:t}=i;return fe(U({},jn(i)),{scale:t.scale,move:t.move,fA:new za(...t.fA),fB:new za(...t.fB),distortion:new za(...t.distortion),colorA:kt(t.colorA,e),colorB:kt(t.colorB,e),colorC:kt(t.colorC,e),colorD:kt(t.colorD,e),noiseType:t.noiseType})}function d3(i,e){let{projection:t,axis:r,crop:n,size:s}=i.data,{image:l,wrapping:c,repeat:f,offset:h}=i.data.texture,p=new Od,y;if(typeof l=="string")y=e==null?void 0:e.getImage(l);else{let g=new Image;g.src=l.data,g.onload=()=>{(e==null?void 0:e.onImageLoad)&&(e==null||e.onImageLoad(l.data))},y=g}return p.image=y,p.repeat.set(f[0],f[1]),p.offset.set(h[0],h[1]),p.wrapS=p.wrapT=c,fe(U({},jn(i)),{texture:p,mat:new kv().setUvTransform(h[0],h[1],f[0],f[1],0,0,0),crop:n,projection:t,axis:["x","y","z"].indexOf(r),size:s})}function p3(i){let{data:e}=i;return fe(U({},jn(i)),{filmThickness:e.filmThickness,movement:e.movement,wavelengths:new Mo(...e.wavelengths),noiseStrength:e.noiseStrength,noiseScale:e.noiseScale,offset:new Mo(...e.offset)})}function m3(i,e){let{data:t}=i;return fe(U({},jn(i)),{thickness:t.thickness,ior:t.ior,roughness:t.roughness,transmissionSamplerMap:e.transmissionSamplerMap,transmissionDepthMap:e.transmissionDepthMap})}function g3(i,e){let t=new Od,{image:r}=i.data.texture,n;if(typeof r=="string")n=e==null?void 0:e.getImage(r);else{let l=new Image;l.src=r.data,l.onload=()=>{(e==null?void 0:e.onImageLoad)&&(e==null||e.onImageLoad(r.data))},n=l}t.image=n;let s=16777215;return fe(U({},jn(i)),{color:s,texture:t})}function y3(i){let{data:e}=i,t=fe(U({},qv(i)),{intensity:e.intensity});if(e.displacementType==="noise")return fe(U({},t),{offset:new Mo(...e.offset),scale:e.scale,movement:e.movement,noiseType:e.noiseType});{let r=new Od,n=new kv().setUvTransform(0,0,1,1,0,0,0);return fe(U({},t),{texture:r,mat:n,crop:e.crop})}}function $v(i,e,t){if(t.type==="displace"&&(i==="intensity"||i==="visible")){let r=e.uniforms[`f${e.id}_intensity`];return r?(r.value=t.intensity*(t.visible?1:0),r):void 0}if(t.type!=="displace"&&(i==="alpha"||i==="visible")){let r=e.uniforms[`f${e.id}_alpha`];return r?(r.value=t.alpha*(t.visible?1:0),r):void 0}}import{Color as Jv,Vector4 as x3}from"three";var Fs;(function(e){function i(t){return new Jv(t.x,t.y,t.z).getHex()}e.getHex=i})(Fs||(Fs={}));var Kv;(function(e){function i(t){return new x3(t.r,t.g,t.b,t.a)}e.getThreeVector4=i})(Kv||(Kv={}));var Xv;(function(t){function i(r,n){r.setRGB(n.r,n.g,n.b)}t.setThreeColor=i;function e(r){return new Jv(r.r,r.g,r.b).getHex()}t.getHex=e})(Xv||(Xv={}));function Fa(i,e){return typeof i=="string"?e.getMaterialOrDeletedPlaceholder(i):Dd(i,e)}function Zv(i,e){return i.map(t=>Fa(t,e))}function Dd(i,e){var l,c;let t=(l=i.layers)!=null?l:Cs.defaultTwoLayerData("phong").layers,r=v3(t),n;switch(r.category){case"basic":n=new vr;break;case"lambert":{n=new ja;break}case"toon":{n=new Ea;break}case"physical":n=new Ra;break;case"phong":default:{n=new Sn;break}}n.name=(c=i.name)!=null?c:"Untitled Material";let s=n.userData.layers;b3(s);for(let f=t.length-1;f>=0;f--)S3(s,t[f],e);switch(r.category){case"basic":break;case"lambert":{let p=n,g=kt(r.emissive,e);g instanceof Pd?p.emissive.value=g:p.emissive.value.setHex(Fs.getHex(g));break}case"toon":{let p=n,y=r;p.shininess.value=y.shininess;let g=kt(y.specular,e);g instanceof Pd?p.specular.value=g:p.specular.value.setHex(Fs.getHex(g));break}case"physical":let f=n,h=r;f.metalness.value=h.metalness,f.roughness.value=h.roughness,f.reflectivity.value=h.reflectivity;break;case"phong":default:{let p=n,y=r;p.shininess.value=y.shininess;let g=kt(y.specular,e);g instanceof Pd?p.specular.value=g:p.specular.value.setHex(Fs.getHex(g));break}}return s.blendColors(),s.blendAfterColors(),s.blendPositions(),n}function v3(i){for(let e of i)if(e.data.type==="light")return e.data;return{type:"light",category:"basic",visible:!0,alpha:1,mode:Zt.Normal}}function b3(i){for(let e of i.getLayers())i.removeLayer(e.id)}function S3(i,e,t){let r=Wv(e,t);r.type==="transmission"&&(r.transmissionSamplerMap=t==null?void 0:t.transmissionSamplerMap,r.transmissionDepthMap=t==null?void 0:t.transmissionDepthMap);let n=i.addLayer(r);n.uuid=e.id;for(let s in e.data)$v(s,n,e.data)}import{Vector2 as Yv}from"three";var Pu=new Yv,Ao=class{constructor(e,t,r){this.message=[];this.endLine=!0;this.yLinePos=e,this.lineHeight=t,this.maxCharSize=r,this.nextChar3DPos=new Yv(0,this.yLinePos+this.maxCharSize*this.lineHeight),this.align=Lr.Left}addChar3D(e,t,r=this.message.length){this.message.splice(r,0,e),e.fontSize>this.maxCharSize?(this.maxCharSize=e.fontSize,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight,this.fullUpdate(t)):(e.updatePosition(this.nextChar3DPos,t),this.nextChar3DPos.x+=e.charSize)}deleteChar3D(e=this.message.length-1){let t=this.message[e];if(t)return this.message.splice(e,1),this.nextChar3DPos.x-=t.charSize,t}isEndLine(e){this.endLine=e}fullUpdate(e,t=0){this.nextChar3DPos.x=0;for(let r=t,n=this.message.length;r<n;r+=1)this.message[r].updatePosition(this.nextChar3DPos,e),this.nextChar3DPos.x+=this.message[r].charSize}checkOverFlow(e){let t,r=this.message.length-1;if(r<=0)return!1;for(;r>=0;){if(this.message[r].char!==" "){t=this.message[r];break}r-=1}return!!(r>=0&&t&&t.localPosition.x+t.charSize>e)}containSpaceOverFlow(e=this.message.length-1){for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}containSpace(e=this.message.length-1){if(this.endLine)return!0;for(let t=e;t>=0;t-=1)if(this.message[t].char===" ")return!0;return!1}popWord(e=this.message.length-1){let t=[],r=!0,n;for(n=e;n>=0;n-=1)if(this.message[n].char===" "){r=!1,t.length===0&&(n-=1,t.splice(0,0,this.message[n]));break}else t.splice(0,0,this.message[n]);return r?t=[]:this.message.splice(n+1,t.length),t}getWord(e=0,t=1){let r=[],n=e;for(n=e;;n+=t){if(!this.message[n]||this.message[n].char===" "){r.length===0&&this.message[n]&&(r.push(this.message[n]),this.message.splice(n,1));break}t>0?(r.push(this.message[n]),this.message.splice(n,1),n-=t):(r.splice(0,0,this.message[n]),this.message.splice(n,1))}return r}getWordAtIndex(e){let t=[];for(let r=e;r<this.message.length&&this.message[r].char!==" ";r++)t.push(this.message[r]);for(let r=e-1;r>=0&&this.message[r].char!==" ";r--)t.splice(0,0,this.message[r]);return t}wordSize(e=0,t=-1){let r=0,n=e;for(;n>=0&&n<this.message.length;){if(this.message[n].char===" "){r===0&&(r=this.message[n].charSize);break}r+=this.message[n].charSize,n+=t}return(n<0||n>=this.message.length)&&!this.endLine?this.message[e]?this.message[e].charSize:999999999:r===0?999999999:r}spaceLeft(e){return e-this.nextChar3DPos.x}popChar(e=this.message.length-1){return this.nextChar3DPos.x-=this.message[e].charSize,this.message.splice(e,1)}isEmpty(){return!this.message.length}updateNextCharPosY(){this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}updateYLinePos(e){this.yLinePos=e,this.updateNextCharPosY()}updatelineHeight(e){this.lineHeight=e,this.updateNextCharPosY()}updateFontSize(e,t=0,r=this.message.length-1){for(let n=t;n<=r;n+=1)this.message[n].updateFontSize(e);this.maxCharSize=e,this.nextChar3DPos.y=this.yLinePos+this.maxCharSize*this.lineHeight}countSpaces(){let e=0;for(let t=0;t<this.message.length;t++)this.message[t].char===" "&&(e+=1);return e}alignText(e,t,r,n,s){switch(r){case Lr.Left:this.leftAlign(e,s);break;case Lr.Center:this.centerAlign(this.spaceLeft(t),e,s);break;case Lr.Right:this.rightAlign(this.spaceLeft(t),e,s);break;case Lr.Justify:this.justifyAlign(this.spaceLeft(t),e,s);break}}offsetCharacters(e,t,r){Pu.set(t,r);let n=this.message.length;for(let s=0;s<n;s++)this.message[s].updatePosition(this.message[s].localPosition.add(Pu),e)}leftAlign(e,t){this.align=Lr.Left,this.offsetCharacters(e,0,t)}centerAlign(e,t,r){this.align=Lr.Center,this.offsetCharacters(t,e/2,r)}rightAlign(e,t,r){this.align=Lr.Right,this.offsetCharacters(t,e,r)}justifyAlign(e,t,r){if(this.align=Lr.Justify,this.endLine){this.offsetCharacters(t,0,r);return}let n=this.countSpaces();if(n===0){this.offsetCharacters(t,0,r);return}let s=e/n,l=0;for(let c=0;c<this.message.length;c++)this.message[c].char===" "&&(l+=s),Pu.set(l,r),this.message[c].updatePosition(this.message[c].localPosition.add(Pu),t)}clone(){let e=new Ao(this.yLinePos,this.lineHeight,this.maxCharSize);e.nextChar3DPos=this.nextChar3DPos.clone(),e.align=this.align,e.endLine=this.endLine;for(let t=0;t<this.message.length;t++)e.message.push(this.message[t].clone());return e}};import{DoubleSide as w3,EventDispatcher as N3,Matrix3 as C3,Vector3 as Bd}from"three";var L3=new Bd(0,0,1),Qv=new Bd,eb=new Bd,tb=new C3,Oo=class extends hr{constructor(e=ur.create({}),t=new vr({side:w3})){super(e,t);this.recursiveSelection=!1;this.objectType="VectorObject";this.eventDispatcher=new N3;this._onShapeUpdate=()=>{if(this.geometry instanceof Co){if(this.geometry.updateFromShape()){let e=this.geometry.drawCount,t=this.geometry.userData;this.updateGeometry(Object.assign(this.geometry.userData,{parameters:Object.assign(t.parameters,{surfaceMaxCount:e+1e3})}))}}else this.updateGeometry({});this.geometry.computeBoundingSphere(),this.geometry.computeBoundingBox()};var r;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!0,this.shape=e.userData.shape,(r=this.shape.eventDispatcher)==null||r.addEventListener("update",this._onShapeUpdate)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="VectorObject",t}fromState(e){return super.fromState(e),this.shape.update(),this}setHelperVisibility(){}updateGeometry(e){if(super.updateGeometry(e),"userData"in this.geometry){let t=this.geometry.userData.parameters;this.eventDispatcher.dispatchEvent({type:"geometryUpdate",parameters:t})}}setShape(e){var t,r;this.shape&&((t=this.shape.eventDispatcher)==null||t.removeEventListener("update",this._onShapeUpdate)),this.shape=e,(r=this.shape.eventDispatcher)==null||r.addEventListener("update",this._onShapeUpdate)}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),tb.getNormalMatrix(this.matrixWorld),Qv.copy(L3).applyMatrix3(tb).normalize(),eb.setFromMatrixPosition(this.matrixWorld),this.shape.plane.setFromNormalAndCoplanarPoint(Qv,eb)}clone(e){let t=this.shape.clone(),r=this.material.clone(),n=this.geometry.userData,s=ur.create(Object.assign({},n,{shape:t})),l=new Oo(s,r).copy(this,e);return l.shape=t,t.update(),l}raycast(e,t){hr.prototype.raycast.call(this,e,t)}};import{Camera as F3,OrthographicCamera as V3,PerspectiveCamera as U3,Vector3 as nn,Object3D as ob,Quaternion as k3}from"three";import{BoxBufferGeometry as _3}from"three";var ei=i=>{var e;return e=class extends i{constructor(){super(...arguments);this.isObjectHelper=!0}},e.geometryHelper=new _3(30,30,30),e};import{Camera as A3,LineSegments as O3,BufferGeometry as P3,LineBasicMaterial as D3,Color as jd,Vector3 as B3,Float32BufferAttribute as nb}from"three";import{Ray as T3,Sphere as I3,Matrix4 as M3,Vector3 as Li}from"three";var Du=new T3,Gd=new I3,rb=new M3,ti=(i,e,t,r,n=!1)=>{let s=e,l=i.matrixWorld;if(s.boundingSphere===null&&s.computeBoundingSphere(),Gd.copy(s.boundingSphere),Gd.applyMatrix4(l),t.ray.intersectsSphere(Gd)===!1||(rb.copy(l).invert(),Du.copy(t.ray).applyMatrix4(rb),s.boundingBox!==null&&Du.intersectsBox(s.boundingBox)===!1))return;let c,f,h,p,y=s.index,g=s.attributes.position,w=s.drawRange,S,T;if(n===!1){let B=Math.max(0,w.start),G=Math.min(y.count,w.start+w.count);for(S=B,T=G;S<T;S+=3)if(f=y.getX(S),h=y.getX(S+1),p=y.getX(S+2),c=C(i,t,Du,g,f,h,p),c){c.faceIndex=Math.floor(S/3),r.push(c);return}}else{let G=s.attributes.position,D=new Li,W=new Li,A=new Li,q=new Li,E=2,R=1/((i.scale.x+i.scale.y+i.scale.z)/3),I=R*R,z=Math.max(0,w.start),O=Math.min(G.count,w.start+w.count);for(let $=z,he=O-1;$<he;$+=E){if(D.fromBufferAttribute(G,$),W.fromBufferAttribute(G,$+1),Du.distanceSqToSegment(D,W,q,A)>I)continue;q.applyMatrix4(i.matrixWorld);let Ne=t.ray.origin.distanceTo(q);Ne<t.near||Ne>t.far||r.push({distance:Ne,point:A.clone().applyMatrix4(i.matrixWorld),object:i})}}function C(B,G,D,W,A,q,E){let b=new Li,R=new Li,I=new Li,z=new Li,O=new Li;if(b.fromBufferAttribute(W,A),R.fromBufferAttribute(W,q),I.fromBufferAttribute(W,E),D.intersectTriangle(b,R,I,!1,z)===null)return null;O.copy(z),O.applyMatrix4(B.matrixWorld);let he=G.ray.origin.distanceTo(O);return he<G.near||he>G.far?null:{faceIndex:1,distance:he,point:O.clone(),object:B}}};var Bu=new B3,wn=new A3,ib=class extends O3{constructor(e){let t=new P3,r=new D3({color:16777215,vertexColors:!0,toneMapped:!1}),n=[],s=[],l={},c=new jd(Th),f=new jd(Th),h=new jd(d0);p("n1","n2",c),p("n2","n4",c),p("n4","n3",c),p("n3","n1",c),p("f1","f2",c),p("f2","f4",c),p("f4","f3",c),p("f3","f1",c),p("n1","f1",c),p("n2","f2",c),p("n3","f3",c),p("n4","f4",c),p("p","n1",f),p("p","n2",f),p("p","n3",f),p("p","n4",f),p("u1","u2",h),p("u2","u3",h),p("u3","u1",h);function p(g,w,S){y(g,S),y(w,S)}function y(g,w){n.push(0,0,0),s.push(w.r,w.g,w.b),l[g]===void 0&&(l[g]=[]),l[g].push(n.length/3-1)}t.setAttribute("position",new nb(n,3)),t.setAttribute("color",new nb(s,3));super(t,r);this.type="CameraHelper",this.camera=e,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=l,this.update()}update(){let e=this.geometry,t=this.pointMap,r=!0;wn.projectionMatrixInverse.elements=[.5112609807824982,-0,-0,-0,-0,.41421356237309503,-0,-0,-0,-0,-0,-.099999,-0,-0,-1.0000000000000002,.100001];let n=1,s=1,l=r?.8:1e-4;En("n1",t,e,wn,-n,-s,l),En("n2",t,e,wn,n,-s,l),En("n3",t,e,wn,-n,s,l),En("n4",t,e,wn,n,s,l);let c=l;En("f1",t,e,wn,-n,-s,c),En("f2",t,e,wn,n,-s,c),En("f3",t,e,wn,-n,s,c),En("f4",t,e,wn,n,s,c);let f=c,h=.5;En("u1",t,e,wn,n*.7*h,s*1.1,f),En("u2",t,e,wn,-n*.7*h,s*1.1,f),En("u3",t,e,wn,0,s*(1.1+.9*h),f),e.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}};function En(i,e,t,r,n,s,l){Bu.set(n,s,l).unproject(r);let c=e[i];if(c!==void 0){let f=t.getAttribute("position");for(let h=0,p=c.length;h<p;h++)f.setXYZ(c[h],Bu.x,Bu.y,Bu.z)}}var Ed=class extends ei(ib){constructor(e){super(e);this.object=e;this.object=e,this.name=`CombinedCameraHelper: ${e.uuid}`}updateMatrixWorld(e){super.updateMatrixWorld(e),this.updateTarget()}updateTarget(){let e=this.object.getTarget();this.updateWorldMatrix(!0,!1),this.worldToLocal(e)}raycast(e,t){ti(this.object,this.geometry,e,t,!0)}};import{DirectionalLightHelper as G3}from"three";var Va=class extends ei(G3){constructor(e,t=15,r=10066329){super(e,t,r);this.object=e;this.name=`DirectionalLightHelper: ${e.uuid}`}raycast(e,t){ti(this.object,Va.geometryHelper,e,t)}};import{AxesHelper as j3}from"three";var Ua=class extends ei(j3){constructor(e,t=15){super(t);this.object=e;this.object.updateMatrixWorld(),this.name=`EmptyObjectHelper: ${e.uuid}`,this.matrix=e.matrixWorld,this.matrixAutoUpdate=!1}raycast(e,t){ti(this.object,Ua.geometryHelper,e,t)}update(){}};import{PointLightHelper as E3}from"three";var ka=class extends ei(E3){constructor(e,t=15,r=6710886){super(e,t,r);this.object=e;this.name=`PointLightHelper: ${e.uuid}`}raycast(e,t){ti(this.object,ka.geometryHelper,e,t)}};import{SpotLightHelper as R3,Vector3 as z3}from"three";var ju=class extends ei(R3){constructor(e,t=6710886){super(e,t);this.object=e;this.name=`SpotLightHelper: ${e.uuid}`}raycast(e,t){ti(this.object,ju.geometryHelper,e,t)}update(){if(this.object!==void 0){let e=ju._vector,t=this.object.distance?this.object.distance:1e3,r=t*Math.tan(this.object.angle);this.cone.scale.set(r,r,t),e.setFromMatrixPosition(this.object.target.matrixWorld),this.cone.lookAt(e);let n=this.color!==void 0?this.color:this.light.color;if(this.cone.material instanceof Array)for(let s=0,l=this.cone.material.length;s<l;s++)this.cone.material[s].color.set(n);else this.cone.material.color.set(n)}}},Gu=ju;Gu._vector=new z3;var ri=(i,e)=>class extends i{constructor(){super(...arguments);this.objectHelper=new e(this);this.enableHelper=!1}set visibility(r){this.visible=r,this.setHelperVisibility(r),this.setHelperChildrenVisibility(r)}get visibility(){return this.visible}get geometryHelper(){return e.geometryHelper}setHelperVisibility(r){this.objectHelper.visible=r}setHelperChildrenVisibility(r){for(let n of this.children)xn(n)&&n.traverseEntity(s=>{Si(s)&&s.visible&&(s.objectHelper.visible=r)})}raycast(r,n){this.objectHelper.raycast(r,n)}copy(r,n=!0){return super.copy(r,n),r.enableHelper!==void 0&&(this.enableHelper=r.enableHelper),r.objectHelper!==void 0&&(this.objectHelper.visible=r.objectHelper.visible),this}toJSON(r){let n=super.toJSON(r),s=n.object;return s.enableHelper=this.enableHelper,n}fromJSON(r){return super.fromJSON(r),r.enableHelper!==void 0&&(this.enableHelper=!0),this}fromLightState(r,n){if(this.objectType==="LightDirectional"||this.objectType==="LightPoint"||this.objectType==="LightSpot"){let s=this;r.color!==void 0&&(s.color=kt(r.color,n)),r.intensity!==void 0&&(s.intensity=r.intensity),r.depth!==void 0&&(s.shadow.camera.far=r.depth,s.shadow.needsUpdate=!0),r.shadows!==void 0&&(this.castShadow=r.shadows),r.helper!==void 0&&(this.enableHelper=r.helper,s.gizmos.shadowmap.visible=r.helper)}return this}};var Vs=new nn,Rd=new nn,Qi=class extends ri(vn(F3),Ed){constructor(e=window.innerWidth,t=window.innerHeight,r=45,n,s=1e5){super();this.objectType="CombinedCamera";this._cameraType="OrthographicCamera";this.targetOffset=vo.DefaultTargetOffset;this.isUpVectorFlipped=!1;this.angleOffsetFromUp=0;this.width=e,this.height=t,this.orthoCamera=new V3(e*-.5,e*.5,t*.5,t*-.5,n!=null?n:-5e4,s),this.perspCamera=new U3(r,e/t,n!=null?n:50,s),this.left=this.orthoCamera.left,this.right=this.orthoCamera.right,this.top=this.orthoCamera.top,this.bottom=this.orthoCamera.bottom,this.far=this.orthoCamera.far,this.view=this.orthoCamera.view,this.aspect=this.perspCamera.aspect,this.fov=this.perspCamera.fov,this.focus=this.perspCamera.focus,this.filmGauge=this.perspCamera.filmGauge,this.filmOffset=this.perspCamera.filmOffset,this.toOrthographic(!0)}static createFromState(e,t){let r=new Qi().fromState(t);return r.enableHelper=!0,r.objectHelper.update(),r.uuid=e,r}get isPerspectiveCamera(){return this.cameraType==="PerspectiveCamera"}get isOrthographicCamera(){return!this.isPerspectiveCamera}get cameraType(){return this._cameraType}setNear(e,t){e==="PerspectiveCamera"?this.perspCamera.near=t:this.orthoCamera.near=t}setZoom(e,t){t>=0&&(e==="PerspectiveCamera"?this.perspCamera.zoom=t:this.orthoCamera.zoom=t)}set cameraType(e){e==="PerspectiveCamera"?this.toPerspective():e==="OrthographicCamera"&&this.toOrthographic()}get near(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.near:this.orthoCamera.near}set near(e){this._cameraType==="PerspectiveCamera"?this.perspCamera.near=e:this.orthoCamera.near=e}get zoom(){return this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom:this.orthoCamera.zoom}set zoom(e){e>=0&&(this._cameraType==="PerspectiveCamera"?this.perspCamera.zoom=e:this.orthoCamera.zoom=e)}lookAt(e){super.lookAt(e),this.getWorldPosition(Vs),this.targetOffset=Vs.distanceTo(e)}getTarget(e=new nn){return this.getWorldDirection(Rd),this.getWorldPosition(Vs),Rd.multiplyScalar(this.targetOffset),e.copy(Vs).add(Rd),e}getDistanceToTarget(){let e=this.getTarget();return this.getWorldPosition(Vs),Vs.distanceTo(e)}updateUp(){let e=this.getWorldQuaternion(new k3),t=new nn(0,0,1).applyQuaternion(e),r=new nn().copy(ob.DefaultUp);this.isUpVectorFlipped&&r.negate(),r.applyQuaternion(e);let n=new nn().copy(ob.DefaultUp).projectOnPlane(t),s=new nn().crossVectors(n,r).dot(t)>=0?1:-1;this.angleOffsetFromUp=n.angleTo(r)*s}getViewFrontToObject(e){let t=e.getWorldPosition(new nn),n=e.getWorldDirection(new nn).multiplyScalar(this.targetOffset);return{position:t.clone().add(n),target:t}}getViewToObject(e){let t=e.getWorldPosition(new nn),n=this.getWorldDirection(new nn).multiplyScalar(this.targetOffset);return{position:t.clone().sub(n),target:t}}setViewplaneSize(e,t){this.left=-e*.5,this.right=e*.5,this.top=t*.5,this.bottom=-t*.5,this.aspect=e/t,this.updateProjectionMatrix()}toOrthographic(e){this.orthoCamera.left=this.left,this.orthoCamera.right=this.right,this.orthoCamera.top=this.top,this.orthoCamera.bottom=this.bottom,this.orthoCamera.view=this.view,this.orthoCamera.far=this.far,this.orthoCamera.updateProjectionMatrix(),this.projectionMatrix=this.orthoCamera.projectionMatrix,this.projectionMatrixInverse=this.orthoCamera.projectionMatrixInverse,this._cameraType="OrthographicCamera",(this.enableHelper===!0||e===!0)&&this.objectHelper.update()}toPerspective(e){this.perspCamera.aspect=this.aspect,this.perspCamera.fov=this.fov,this.perspCamera.view=this.view,this.perspCamera.far=this.far,this.perspCamera.updateProjectionMatrix(),this.projectionMatrix=this.perspCamera.projectionMatrix,this.projectionMatrixInverse=this.perspCamera.projectionMatrixInverse,this._cameraType="PerspectiveCamera",(this.enableHelper===!0||e===!0)&&this.objectHelper.update()}setFocalLength(e){this.perspCamera.setFocalLength(e),this.toPerspective()}getFocalLength(){return this.perspCamera.getFocalLength()}getEffectiveFOV(){return this.perspCamera.getEffectiveFOV()}getFilmWidth(){return this.perspCamera.getFilmWidth()}getFilmHeight(){return this.perspCamera.getFilmHeight()}setViewOffset(e,t,r,n,s,l){this._cameraType==="PerspectiveCamera"?this.perspCamera.setViewOffset(e,t,r,n,s,l):this.orthoCamera.setViewOffset(e,t,r,n,s,l)}clearViewOffset(){this._cameraType==="PerspectiveCamera"?(this.perspCamera.clearViewOffset(),this.toPerspective()):(this.orthoCamera.clearViewOffset(),this.toOrthographic())}updateProjectionMatrix(e){this._cameraType==="PerspectiveCamera"?this.toPerspective(e):this._cameraType==="OrthographicCamera"&&this.toOrthographic(e)}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}copy(e,t){return super.copy(e,t),this.orthoCamera.copy(e.orthoCamera),this.perspCamera.copy(e.perspCamera),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.far=e.far,this.view=e.view===null?null:Object.assign({},e.view),this._cameraType=e._cameraType,this.aspect=e.aspect,this.fov=e.fov,this.focus=e.focus,this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this.targetOffset=e.targetOffset,this.updateProjectionMatrix(),this}fromCameraRender(e){let t={near:this.orthoCamera.near,far:this.orthoCamera.far},r={near:this.perspCamera.near,far:this.perspCamera.far};return this.copy(e),this.name="",this.enableHelper=!0,this.objectHelper.visible=!0,this.orthoCamera.near=t.near,this.orthoCamera.far=t.far,this.perspCamera.near=r.near,this.perspCamera.far=r.far,this.updateProjectionMatrix(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="CombinedCamera",r.cameraType=this.cameraType,r.targetOffset=this.targetOffset,r.isUpVectorFlipped=this.isUpVectorFlipped,r.angleOffsetFromUp=this.angleOffsetFromUp,r.left=this.left,r.right=this.right,r.top=this.top,r.bottom=this.bottom,this.view!==null&&(r.view=Object.assign({},this.view)),r.zoomOrtho=this.orthoCamera.zoom,r.nearOrtho=this.orthoCamera.near,r.far=this.far,r.aspect=this.aspect,r.fov=this.fov,r.focus=this.focus,r.filmGauge=this.filmGauge,r.filmOffset=this.filmOffset,r.zoomPersp=this.perspCamera.zoom,r.nearPersp=this.perspCamera.near,t}fromJSON(e){var t;if(super.fromJSON(e),this.cameraType=e.cameraType,e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.orbitControlsTarget!==void 0){let r=this.getWorldPosition(new nn),n=new nn().fromArray(e.orbitControlsTarget);this.targetOffset=n.distanceTo(r)}else e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset);return this.isUpVectorFlipped=!1,this.angleOffsetFromUp=(t=e.angleOffsetFromUp)!=null?t:0,e.left!==void 0&&(this.left=e.left),e.right!==void 0&&(this.right=e.right),e.top!==void 0&&(this.top=e.top),e.bottom!==void 0&&(this.bottom=e.bottom),e.view!==void 0&&(this.view=Object.assign({},e.view)),e.zoomOrtho!==void 0&&(this.orthoCamera.zoom=e.zoomOrtho),e.nearOrtho!==void 0&&(this.orthoCamera.near=e.nearOrtho),e.far!==void 0&&(this.far=e.far),e.aspect!==void 0&&(this.aspect=e.aspect),e.fov!==void 0&&(this.fov=e.fov),e.focus!==void 0&&(this.focus=e.focus),e.filmGauge!==void 0&&(this.filmGauge=e.filmGauge),e.filmOffset!==void 0&&(this.filmOffset=e.filmOffset),e.zoomPersp!==void 0&&(this.perspCamera.zoom=e.zoomPersp),e.nearPersp!==void 0&&(this.perspCamera.near=e.nearPersp),this.updateProjectionMatrix(),this}toCameraState(e=[]){let t={type:this.cameraType,far:this.far,orthographic:{near:this.orthoCamera.near,zoom:this.orthoCamera.zoom},perspective:{near:this.perspCamera.near,fov:this.perspCamera.fov,zoom:this.perspCamera.zoom},up:this.up.toArray(),targetOffset:this.targetOffset,isUpVectorFlipped:this.isUpVectorFlipped};return ms(t,e)}fromCameraState(e){let{orthographic:t,perspective:r}=e;return e.type!==void 0&&(this.cameraType=e.type),e.far!==void 0&&(this.far=e.far),t!==void 0&&(t.near!==void 0&&(this.orthoCamera.near=t.near),t.zoom!==void 0&&(this.orthoCamera.zoom=t.zoom)),r!==void 0&&(r.near!==void 0&&(this.perspCamera.near=r.near),r.fov!==void 0&&(this.perspCamera.fov=r.fov),r.zoom!==void 0&&(this.perspCamera.zoom=r.zoom)),e.up!==void 0&&this.up.fromArray(e.up),e.targetOffset!==void 0&&(this.targetOffset=e.targetOffset),e.isUpVectorFlipped!==void 0&&(this.isUpVectorFlipped=e.isUpVectorFlipped),this.updateProjectionMatrix(),this}toState(e){return fe(U(U({},super.toState(e)),this.toCameraState(e)),{type:this.cameraType})}fromState(e){return super.fromState(e),this.fromCameraState(e),this}};import{Group as H3}from"three";var eo=class extends ri(vn(H3),Ua){constructor(){super(...arguments);this.objectType="EmptyObject"}static createFromState(e,t){let r=new eo().fromState(t);return r.uuid=e,r.enableHelper=!0,r.objectHelper.update(),r}toJSON(e){let t=super.toJSON(e);return t.object.objectType="EmptyObject",t}};import{DirectionalLight as W3,CameraHelper as Eu}from"three";var Ha=class extends ri(vn(W3),Va){constructor(...e){super(...e);this.objectType="LightDirectional";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.top=1250,r.bottom=-1250,r.right=1250,r.left=-1250,r.near=1,r.far=2500;let n=new Eu(this.shadow.camera);n.visible=!1,this._gizmos.shadowmap=n,this.update()}static createFromState(e,t,r){let n=new Ha().fromState(t,r);return n.uuid=e,n}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof Eu&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof Eu&&(t.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let t=this._gizmos[e];t instanceof Eu&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightDirectional",r.color=this.color.getHex(),r.intensity=this.intensity,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var n;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.shadow.normalBias=(n=e.shadow.normalBias)!=null?n:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.left=r.left,t.right=r.right,t.top=r.top,t.bottom=r.bottom,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromDirectionalLightState(e,t){let r=e.depth!==void 0&&e.depth!==this.shadow.camera.far||e.size!==void 0&&e.size/2!==this.shadow.camera.right;return super.fromLightState(e,t),e.size!==void 0&&yv(this,e.size),r&&this.update(),this}fromState(e,t){return super.fromState(e),this.fromDirectionalLightState(e,t),this}};import{PointLight as q3,Vector3 as Ru,Box3 as $3,Box3Helper as zu,Color as J3}from"three";var Wa=class extends ri(vn(q3),ka){constructor(...e){super(...e);this.objectType="LightPoint";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.fov=90,r.aspect=1,r.near=100,r.far=2500;let n=new Ru(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),s=new Ru(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z),l=new $3(n,s),c=new zu(l,new J3(16755200));c.visible=!1,this._gizmos.shadowmap=c,this.update()}static createFromState(e,t,r){let n=new Wa().fromState(t,r);return n.uuid=e,n}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof zu&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof zu&&(t.visible=!1)}}update(){if(this.shadow&&(this.shadow.camera.updateProjectionMatrix(),this._gizmos))for(let e in this._gizmos){let t=this._gizmos[e];if(t instanceof zu){let r=this.shadow.camera,n=new Ru(-r.far+this.position.x,-r.far+this.position.y,-r.far+this.position.z),s=new Ru(r.far+this.position.x,r.far+this.position.y,r.far+this.position.z);t.box.set(n,s),t.updateMatrixWorld(!0)}}}updateMatrixWorld(e){super.updateMatrixWorld(e),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightPoint",r.color=this.color.getHex(),r.intensity=this.intensity,r.distance=this.distance,r.decay=this.decay,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var n,s;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.decay=e.decay,this.shadow.normalBias=(n=e.shadow.normalBias)!=null?n:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray((s=e.shadow.mapSize)!=null?s:[512,512]),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.fov=r.fov,t.focus=r.focus,t.aspect=r.aspect,t.filmGauge=r.filmGauge,t.filmOffset=r.filmOffset,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromPointLightState(e,t){return super.fromLightState(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.shadowRadius!==void 0&&(this.shadow.radius=e.shadowRadius),e.shadowResolution!==void 0&&(this.shadow.mapSize.set(e.shadowResolution,e.shadowResolution),this.shadow.map&&(this.shadow.map.dispose(),this.shadow.map=null)),this}fromState(e,t){return super.fromState(e),this.fromPointLightState(e,t),this}};import{SpotLight as K3,CameraHelper as Fu,MathUtils as X3,Vector3 as sb,Quaternion as Z3}from"three";var ab=new sb,lb=new sb,cb=new Z3,qa=class extends ri(vn(K3),Gu){constructor(...e){super(...e);this.objectType="LightSpot";this._gizmos={};this.castShadow=!0,this.shadow.mapSize.width=1024,this.shadow.mapSize.height=1024;let r=this.shadow.camera;r.fov=X3.RAD2DEG*2*this.angle,r.aspect=1,r.near=100,r.far=2500;let n=new Fu(this.shadow.camera);n.visible=!1,this._gizmos.shadowmap=n,this.update()}static createFromState(e,t,r){let n=new qa().fromState(t,r);return n.uuid=e,n}get gizmos(){return this._gizmos}showGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof Fu&&(t.visible=!0)}}hideGizmos(){for(let e in this._gizmos){let t=this._gizmos[e];t instanceof Fu&&(t.visible=!1)}}update(){this.shadow.camera.updateProjectionMatrix();for(let e in this._gizmos){let t=this._gizmos[e];t instanceof Fu&&t.update()}}updateMatrixWorld(e){super.updateMatrixWorld(e),lb.setFromMatrixPosition(this.matrixWorld),cb.setFromRotationMatrix(this.matrixWorld),ab.copy(this.up).applyQuaternion(cb).negate().multiplyScalar(this.distance),this.target.position.copy(lb).add(ab),this.target.updateMatrixWorld(),this.enableHelper===!0&&this.objectHelper.visible===!0&&this.objectHelper.update()}copy(e,t=!0){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,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}toJSON(e){let t=super.toJSON(e),r=t.object;return r.objectType="LightSpot",r.color=this.color.getHex(),r.intensity=this.intensity,r.distance=this.distance,r.angle=this.angle,r.decay=this.decay,r.penumbra=this.penumbra,r.shadow=this.shadow.toJSON(),t}fromJSON(e){var n;super.fromJSON(e),this.color.set(e.color),this.intensity=e.intensity,this.distance=e.distance,this.angle=e.angle,this.decay=e.decay,this.penumbra=e.penumbra,this.shadow.normalBias=(n=e.shadow.normalBias)!=null?n:0,this.shadow.radius=e.shadow.radius,this.shadow.mapSize.fromArray(e.shadow.mapSize);let t=this.shadow.camera,r=e.shadow.camera;return t.near=r.near,t.far=r.far,t.zoom=r.zoom,t.fov=r.fov,t.focus=r.focus,t.aspect=r.aspect,t.filmGauge=r.filmGauge,t.filmOffset=r.filmOffset,r.view!==void 0&&(t.view=Object.assign({},r.view)),this}fromSpotLightState(e,t){return super.fromLightState(e,t),e.distance!==void 0&&(this.distance=e.distance),e.decay!==void 0&&(this.decay=e.decay),e.angle!==void 0&&(this.angle=e.angle),e.penumbra!==void 0&&(this.penumbra=e.penumbra),this}fromState(e,t){return super.fromState(e),this.fromSpotLightState(e,t),this}};import{VideoTexture as Y3}from"three";var ub=i=>i.tagName==="VIDEO",Us=class{static resize(e,t,r){let n=e/t,s;if(!r.image)return;let l=r.image;ub(l)?s=l.videoWidth/l.videoHeight:s=l.width/l.height,n>s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*s/n):r.repeat.set(1,1*s/n)),n<s&&(r.imageType=="WEBCAM"?r.repeat.set(1*n/s*-1,1):r.repeat.set(1*n/s,1)),n==s&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1))}static resizeTextureLayer(e,t,r){let n=e/t,s=r.image!==void 0?r.image.width/r.image.height:1,l;n>s?l={x:1,y:s/n}:n<s?l={x:n/s,y:1}:l={x:1,y:1},r.repeat.set(l.x,l.y),r.updateMatrix()}static resizeTextureLayers(e,t,r){let n=r.userData.layers,s=n.getLayers();for(let l=0;l<s.length;l++){let c=s[l];Rv(c)&&(Us.resizeTextureLayer(e,t,c.uniforms[`f${c.id}_texture`].value),n.updateLayerUniform())}}static resizeComplex(e,t,r,n){let s=e/t,l,c=r.image;ub(c)?l=c.videoWidth/c.videoHeight:l=c.width/c.height,n.geometry.type.includes("Shape")?(s>l&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t*l/s):r.repeat.set(1/e,1/t*l/s)),s<l&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*s/l*-1,1/t):r.repeat.set(1/e*s/l,1/t)),s==l&&(r.imageType=="WEBCAM"?r.repeat.set(1/e*-1,1/t):r.repeat.set(1/e,1/t))):(s>l&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1*l/s):r.repeat.set(1,1*l/s)),s<l&&(r.imageType=="WEBCAM"?r.repeat.set(1*s/l*-1,1):r.repeat.set(1*s/l,1)),s==l&&(r.imageType=="WEBCAM"?r.repeat.set(-1,1):r.repeat.set(1,1)))}};var $a=class extends hr{constructor(e,t=new vr){super(e,t);this.objectType="Mesh2D";this.castShadow=!0,this.receiveShadow=!0}updateGeometry(e){super.updateGeometry(e),this.material.userData.layers&&Us.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}resizeGeometry(e,t){super.resizeGeometry(e,t,0),this.material.userData.layers&&Us.resizeTextureLayers(this.geometry.userData.parameters.width,this.geometry.userData.parameters.height,this.material)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="Mesh2D",t}clone(){let e=super.clone();return e.updateGeometry({}),e}static fromTexture(e){let t,r;if(e instanceof Y3){let l=e.image;t=l.videoWidth*.5,r=l.videoHeight*.5}else{let l=e.image;t=l.width*.5,r=l.height*.5}let n=lu.create({parameters:{width:t,height:r}}),s=new vr;return s.layersList.changeLayer(0,{type:qe.TEXTURE,texture:e}),s.layersList.moveLayer(0,1),s.dispose(),new $a(n,s)}};var Ja=class extends hr{constructor(e,t=new Sn){super(e,t);this.objectType="Mesh3D";this.castShadow=!0,this.receiveShadow=!0}toJSON(e){let t=super.toJSON(e);return t.object.objectType="Mesh3D",t}};var Ka=class extends Ja{constructor(e,t=new Sn){super(e,t);this.objectType="NonParametric"}toJSON(e){let t=super.toJSON(e);return t.object.objectType="NonParametric",t}};var Xa;(function(t){t[t.TO_RIGHT=1]="TO_RIGHT",t[t.TO_LEFT=-1]="TO_LEFT"})(Xa||(Xa={}));var zd=class extends hr{constructor(e,t=new vr({transparent:!0,opacity:1,visible:!1,side:Vu})){super(e,t);this.objectType="TextFrame";this.charContainer=new Q3,this.add(this.charContainer),this.material.visible=!1,this._geometryUserData=e.userData,this.userData.textFrame={hexColor:null,opacity:1,visible:!0,text:"",fontSize:16,lineHeight:1.5,letterSpacing:1,fontFamily:"roboto_regular",textTransform:Wi.None,horizontalAlignment:1,verticalAlignment:xi.Top,LOD:16,maxLineSize:this._geometryUserData.parameters.width,textOrigin:new hb(this._geometryUserData.parameters.width*-.5,this._geometryUserData.parameters.height*.5,0),textLines:[]},this.createTextLine()}static createFromState(e,t,r){let n=cu.create({parameters:{width:t.width,height:t.height}}),s=new zd(n).fromState(t,r);return s.uuid=e,s}async updateText(e){this.clearText();let t=this.userData.textFrame,r=t.fontFamily;await Rr.loadFont(r),t.text=e;let n=t.textOrigin,s=new fb({visible:t.visible,transparent:!0,side:Vu}),l=e.split(`
|
|
977
|
+
`),c=0;this.userData.textFrame.textLines=l.map((f,h)=>{let p=new Ao(c,t.lineHeight,t.fontSize);return p.message=f.split("").map(y=>{let g={char:y,fontFamily:r,letterSpacing:t.letterSpacing,fontSize:t.fontSize,LOD:16},w=s.clone();w.color=t.hexColor,w.opacity=t.opacity;let S=new Rr(g,w);return p.addChar3D(S,n),this.charContainer.add(S),S}),c+=p.maxCharSize*p.lineHeight,p}),this.textFullUpdate(),this.checkOverFlow()}clearText(){let e=this.userData.textFrame.textLines;for(;this.charContainer.children.length;){let t=this.charContainer.children[0];this.charContainer.remove(t)}for(;e.length;)e.pop()}raycast(e,t){let r=[];if(super.raycast(e,r),r.length>0){t.push(r[0]);return}let n=[];for(let s=0,l=this.charContainer.children.length;s<l;++s)if(this.charContainer.children[s]instanceof Rr&&(e.intersectObject(this.charContainer.children[s],!1,n),n.length>0)){n[0].object=this,t.push(n[0]);return}}updateGeometry(e){var h,p,y,g;let t=this.userData,r=this.geometry.userData,n=r.parameters.width,s=r.parameters.height,l=(p=(h=e.parameters)==null?void 0:h.width)!=null?p:n,c=(g=(y=e.parameters)==null?void 0:y.height)!=null?g:s,f=t.textFrame;super.updateGeometry(e),f.maxLineSize=l,f.textOrigin.set(-.5*l,.5*c,0),c!==s?(this.checkOverFlow(),this.checkCapacity()):l!==n&&(n<l?this.checkCapacity():n>l&&this.checkOverFlow())}checkOverFlow(e=0){let t=this.userData,r=t.textFrame.textOrigin,n=t.textFrame.textLines;for(let s=e;s<n.length;s++){n[s].updateYLinePos(this.getNewLinePosition(s)),n[s].fullUpdate(r);let l=[];for(;n[s].checkOverFlow(t.textFrame.maxLineSize);)n[s].containSpaceOverFlow()?l.unshift(n[s].getWord(n[s].message.length-1,-1)):l.unshift(n[s].popChar());if(l.length>0){n[s+1]===void 0?(n[s].isEndLine(!1),this.createTextLine()):n[s].endLine&&(this.createTextLine(s+1),n[s].isEndLine(!1),n[s+1].isEndLine(!0));let c=0;for(let f=0;f<l.length;f+=1)for(let h=0;h<l[f].length;h+=1)n[s+1].addChar3D(l[f][h],r,c),c+=1;n[s+1].fullUpdate(r)}n[s].fullUpdate(r)}this.textFullUpdate(e)}checkCapacity(e=0){let t=this.userData,r=t.textFrame.textOrigin,n=t.textFrame.maxLineSize,s=t.textFrame.textLines;for(let l=e;l<s.length;l+=1)if(s[l].updateYLinePos(this.getNewLinePosition(l)),s[l].fullUpdate(r),!!s[l-1])for(;!s[l-1].endLine;){let c,f=s[l-1].spaceLeft(n);if(s[l].wordSize(0,1)<=f){s[l].containSpace()?c=s[l].getWord(0,1):c=s[l].popChar(0);for(let h=0;h<c.length;h+=1)c[h]&&s[l-1].addChar3D(c[h],r)}else{s[l].isEmpty()?(s[l].endLine&&s[l-1].isEndLine(!0),s.splice(l,1),l-=1):(s[l].updateYLinePos(this.getNewLinePosition(l)),s[l].fullUpdate(r));break}}this.textFullUpdate(e)}createTextLine(e=this.userData.textFrame.textLines.length){let r=this.userData.textFrame;r.textLines.splice(e,0,new Ao(this.getNewLinePosition(e),r.lineHeight,r.fontSize))}textFullUpdate(e=0){let r=this.userData.textFrame,n=r.textLines,s=this.getVerticalAlignmentOffSet();for(let l=e;l<n.length;l++)n[l].updateYLinePos(this.getNewLinePosition(l)),n[l].fullUpdate(r.textOrigin),n[l].alignText(r.textOrigin,r.maxLineSize,r.horizontalAlignment,r.verticalAlignment,s)}getVerticalAlignmentOffSet(){switch(this.userData.textFrame.verticalAlignment){case xi.Top:return 0;case xi.Center:return this.getRemainingVerticalSpace()/2;case xi.Bottom:return this.getRemainingVerticalSpace();default:return 0}}getRemainingVerticalSpace(){let t=this.userData.textFrame.textLines;return this.geometry.userData.parameters.height-this.getNewLinePosition(t.length)}getNewLinePosition(e){let r=this.userData.textFrame.textLines,n=0;for(let s=0;s<e;s+=1)n+=r[s].maxCharSize*r[s].lineHeight;return n}updateColor(e){var n;let t=this.userData;t.textFrame.hexColor=e;let r=t.textFrame.textLines;for(let s=0;s<r.length;s++){let l=r[s].message;for(let c=0;c<l.length;c++){let f=l[c].material;((n=f.color)==null?void 0:n.isColor)&&(f.color=e)}}}updateOpacity(e){let t=this.userData;t.textFrame.opacity=e;let r=t.textFrame.textLines;for(let n=0;n<r.length;n++){let s=r[n].message;for(let l=0;l<s.length;l++){let c=s[l].material;c.opacity=e}}}updateVisible(e){let t=this.userData;t.textFrame.visible=e;let r=t.textFrame.textLines;for(let n=0;n<r.length;n++){let s=r[n].message;for(let l=0;l<s.length;l++){let c=s[l].material;c.visible=e}}}async updateFontFamily(e){await Rr.loadFont(e);let r=this.userData.textFrame,n=r.textLines;r.fontFamily=e;for(let s=0;s<n.length;s++){let l=n[s].message;for(let c=0;c<l.length;c++)l[c].updateFontFamily(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateFontSize(e){let r=this.userData.textFrame,n=r.textLines,s=r.fontSize;r.fontSize=e;for(let l=0;l<n.length;l++)n[l].updateFontSize(e);this.textFullUpdate(),e>s?this.checkOverFlow():e<s&&this.checkCapacity()}async updateTextTransform(e){let r=this.userData.textFrame;await Rr.loadFont(r.fontFamily);let n=r.textLines;switch(r.textTransform=e,e){case Wi.Upper:for(let s=0;s<n.length;s++){let l=n[s].message;for(let c=0;c<l.length;c++)n[s].message[c].updateChar(l[c].char.toUpperCase())}break;case Wi.Lower:for(let s=0;s<n.length;s++){let l=n[s].message;for(let c=0;c<l.length;c++)n[s].message[c].updateChar(l[c].char.toLowerCase())}break;default:for(let s=0;s<n.length;s++){let l=n[s].message;for(let c=0;c<l.length;c++)n[s].message[c].updateChar(l[c].originalChar)}}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLetterSpacing(e){let t=this.userData,r=t.textFrame.textLines;t.textFrame.letterSpacing=e;for(let n=0;n<r.length;n++){let s=r[n].message;for(let l=0;l<s.length;l++)s[l].updateLetterSpacing(e)}this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLOD(e){let t=this.userData;t.textFrame.LOD=e;let r=t.textFrame.textLines;for(let n=0;n<r.length;n++);this.textFullUpdate(),this.checkOverFlow(),this.checkCapacity()}updateLineHeight(e){let t=this.userData,r=t.textFrame.textLines;t.textFrame.lineHeight=e;for(let n=0;n<r.length;n++)r[n].updatelineHeight(e);this.textFullUpdate()}updateVerticalAlignment(e){let t=this.userData;t.textFrame.verticalAlignment=e,this.textFullUpdate()}updateHorizontalAlignment(e){let t=this.userData;t.textFrame.horizontalAlignment=e,this.textFullUpdate()}toJSON(e){let t=super.toJSON(e),r=t.object;r.objectType="TextFrame";let s=this.userData.textFrame.textLines.map(l=>{let c=l.message.map(f=>({char:f.char,originalChar:f.originalChar,fontFamily:f.fontFamily,letterSpacing:f.letterSpacing,fontSize:f.fontSize,LOD:f.LOD}));return{align:l.align,endLine:l.endLine,lineHeight:l.lineHeight,maxCharSize:l.maxCharSize,yLinePos:l.yLinePos,message:c}});return r.userData.textFrame.textLinesData=s,t}async fromJSONasync(e){if(super.fromJSON(e),e.userData!==void 0){let t=e.userData.textFrame;await Rr.loadFont(t.fontFamily),t.textOrigin=new hb(t.textOrigin.x,t.textOrigin.y,t.textOrigin.z);let r=new fb({color:t.hexColor,opacity:t.opacity,visible:t.visible,transparent:!0,side:Vu});t.textLinesData&&(t.textLines=t.textLinesData.map((n,s)=>{let l=new Ao(Number(n.yLinePos),Number(n.lineHeight),Number(n.maxCharSize)),c=n.message.map((f,h)=>{if(f.char===void 0){let g=t.textLines[s].message[h];if("geometries"in g){let w=g.geometries[0].userData.parameters;Object.assign(f,{LOD:w.lod,char:w.char,fontFamily:w.fontFamily,fontSize:w.fontSize,letterSpacing:w.letterSpacing,originalChar:w.char})}}let p={char:f.char,fontFamily:f.fontFamily,letterSpacing:Number(f.letterSpacing),fontSize:Number(f.fontSize),LOD:f.LOD},y=new Rr(p,r.clone());return l.addChar3D(y,t.textOrigin),this.charContainer.add(y),y});return l.message=c,l}),this.userData.textFrame=t),this.textFullUpdate()}return this}fromTextFrameData(e,t){if(e.color!==void 0){let r=kt(e.color,t);this.updateColor(r),this.updateOpacity(r.a)}e.alpha!==void 0&&this.updateOpacity(e.alpha),e.font!==void 0&&this.updateFontFamily(e.font),e.horizontalAlign!==void 0&&this.updateHorizontalAlignment(e.horizontalAlign),e.verticalAlign!==void 0&&this.updateVerticalAlignment(e.verticalAlign),e.textTransform!==void 0&&this.updateTextTransform(e.textTransform),e.fontSize!==void 0&&this.updateFontSize(e.fontSize),e.lineHeight!==void 0&&this.updateLineHeight(e.lineHeight),e.letterSpacing!==void 0&&this.updateLetterSpacing(e.letterSpacing),e.text!==void 0&&e.text!==""&&this.updateText(e.text),(e.width!==void 0||e.height!==void 0)&&this.updateGeometry({parameters:{width:e.width,height:e.height}})}fromState(e,t){return super.fromState(e),this.fromTextFrameData(e,t),this}convertToVector(){let{fontFamily:e,hexColor:t}=this.userData.textFrame,r=new eo;r.name="Text Shape";let n=Rr.fontCache[e];for(let s of this.charContainer.children)s instanceof Rr&&n.generateShapes(s.char,1).forEach(l=>{let c=new st().fromShape(l);c.applyScale(s.scale.x,s.scale.y);let f=ur.create({shape:c}),h=new vr({side:Vu});h.color=t;let p=new Oo(f,h);p.name=s.char,p.position.copy(s.position),p.rotation.copy(s.rotation),r.attach(p)});return r}},ks=zd;ks.VerticalAlign=xi,ks.HorizontalAlign=Lr,ks.TextTransform=Wi;import{HemisphereLight as pB,Scene as mB,Vector3 as gB,Color as _b,Fog as yB,Box3 as xB}from"three";import{BufferGeometryLoader as eB}from"three";function db(i,e){return tB(i)}function tB(i){let e={parameters:i,type:i.type};if(i.type==="VectorGeometry"){let r=st.createFromState(i.shape,i.width,i.height);e.shape=r}else i.type==="NonParametricGeometry"&&(i.data.groups&&i.data.groups.forEach(r=>{var n;return r.materialIndex=Math.max((n=r.materialIndex)!=null?n:0,0)}),e.geometry=new eB().parse(i));let t;try{t=Ia(e)}catch(r){console.error(r)}if(!t){let r=st.createFromState(Ls.defaultData(),100,100);e.shape=r,t=Ia(e)}return t}import{Box3 as rB,Matrix4 as Po,Sphere as gb,Vector3 as nB}from"three";var yb=rh(mb());var Fd;uu.then(i=>{Fd=i});var xb=new Po,iB=new Po,oB=new Po,Rn=new rB,to=new nB,sB=new Po,aB=new Po,Za=class extends hr{constructor(e,t,r,n=new Sn){super(r!=null?r:t,n);this.subdivPointer=e;this.originalGeometry=t;this.subdividedGeometry=r;this.objectType="SubdivObject";this.hiddenMatrixOld=new Po;this.smoothShading=!0;this.matrixWorldRigid=new Po;this.castShadow=!0,this.receiveShadow=!0,this.forceComputeSize=!1}static createFromState(e,t,r){let{subdivPointer:n,originalGeometry:s,subdividedGeometry:l}=en.build(t.geometry,void 0,void 0,!t.flatShading),c=Fa(t.material,r),f=new Za(n,s,l||void 0,c);return f.calcBoundingBox(),f.freeSubdivPointer(),f.uuid=e,f.fromState(t),f}shallowClone(e){return new Ka(this.geometry,this.material).shallowCopy(this,e)}toJSON(e){let t=super.toJSON(e);return t.object.objectType="SubdivObject",t}buildFromStore(e){var s,l,c;let{originalGeometry:t,subdividedGeometry:r,subdivPointer:n}=en.build(e,this.subdivPointer,void 0,this.smoothShading,this.shearScale);if(this.subdivPointer=n,t!==void 0&&((s=this.originalGeometry)==null||s.dispose(),this.originalGeometry=t),r!==void 0&&((l=this.subdividedGeometry)==null||l.dispose(),this.subdividedGeometry=r!=null?r:void 0),this.geometry=(c=this.subdividedGeometry)!=null?c:this.originalGeometry,this.cloner)for(let f of this.cloner.children)f.geometry=this.geometry;e.width&&(this.geometry.userData.parameters={width:e.width,height:e.height,depth:e.depth})}updateMesh(e=!1){en.buildLevel(this.subdivPointer,!0,this.smoothShading,this.originalGeometry,e?this.shearScaleInv:void 0),this.subdividedGeometry&&en.buildLevel(this.subdivPointer,!1,this.smoothShading,this.subdividedGeometry,e?this.shearScaleInv:void 0)}updateTopology(){var e;this.originalGeometry.dispose(),this.originalGeometry=en.buildLevel(this.subdivPointer,!0,this.smoothShading),this.subdividedGeometry&&(this.subdividedGeometry.dispose(),this.subdividedGeometry=en.buildLevel(this.subdivPointer,!1,this.smoothShading)),this.geometry=(e=this.subdividedGeometry)!=null?e:this.originalGeometry}raycast(e,t){var r;this.geometry=this.originalGeometry,hr.prototype.raycast.call(this,e,t),this.geometry=(r=this.subdividedGeometry)!=null?r:this.originalGeometry}updateMatrixWorldSVD(){let e=this.matrixWorld.elements,t=[[e[0],e[4],e[8]],[e[1],e[5],e[9]],[e[2],e[6],e[10]]],{u:r,v:n,q:s}=(0,yb.SVD)(t),l=xb.set(r[0][0],r[0][1],r[0][2],0,r[1][0],r[1][1],r[1][2],0,r[2][0],r[2][1],r[2][2],0,0,0,0,1),c=iB.set(n[0][0],n[0][1],n[0][2],0,n[1][0],n[1][1],n[1][2],0,n[2][0],n[2][1],n[2][2],0,0,0,0,1),f=oB.copy(c).transpose();this.shearScale=sB.makeScale(s[0],s[1],s[2]).multiply(f).premultiply(c),this.shearScaleInv=aB.copy(this.shearScale).invert(),this.matrixWorldRigid.multiplyMatrices(l,f),s.every(h=>Math.abs(s[0]-h)<.01)&&(this.shearScale=void 0,this.shearScaleInv=void 0)}activateSVDCompensation(){this.shearScale!==void 0&&(this.matrixAutoUpdate=!1,this.matrix.copy(this.matrixWorldRigid).copyPosition(this.matrixWorld),this.hiddenMatrixOld.copy(this.hiddenMatrix),this.hiddenMatrix.copy(this.parent.matrixWorld).invert())}deactivateSVDCompensation(){this.shearScale!==void 0&&(this.shearScale=void 0,this.shearScaleInv=void 0,this.matrixAutoUpdate=!0,this.hiddenMatrix.copy(this.hiddenMatrixOld))}calcBoundingBox(){let e=this.originalGeometry;e.boundingSphere===null&&(e.boundingSphere=new gb);let t=e.attributes.position,r=e.boundingSphere.center;Rn.setFromBufferAttribute(t),Rn.getCenter(r),e.boundingSphere.radius=r.distanceTo(Rn.max),isNaN(e.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Rn.getSize(to);let n={width:to.x,height:to.y,depth:to.z};return this.geometry.userData.parameters=n,n}updateBoundingBox(e){let t=this.originalGeometry;Rn.min.set(e[0],e[2],e[4]),Rn.max.set(e[1],e[3],e[5]),this.shearScaleInv&&(Rn.min.applyMatrix4(this.shearScaleInv),Rn.max.applyMatrix4(this.shearScaleInv)),t.boundingSphere===null&&(t.boundingSphere=new gb);let r=t.boundingSphere.center;Rn.getCenter(r),t.boundingSphere.radius=r.distanceTo(Rn.max),isNaN(t.boundingSphere.radius)&&console.error('THREE.BufferGeometry.computeBoundingSphere(): Computed radius is NaN. The "position" attribute is likely to have NaN values.',this),Rn.getSize(to);let n={width:to.x,height:to.y,depth:to.z};return this.geometry.userData.parameters=n,n}freeSubdivPointer(){this.subdivPointer&&(Fd.free_bvh(this.subdivPointer),Fd.free_subdivision_surface(this.subdivPointer),this.subdivPointer=0)}updateGeometry(e){this.geometry.userData.scale||(this.geometry.userData.scale=Array(3)),this.geometry.userData.scale[0]=this.geometry.userData.parameters.width===0?1:e.parameters.width/this.geometry.userData.parameters.width,this.geometry.userData.scale[1]=this.geometry.userData.parameters.height===0?1:e.parameters.height/this.geometry.userData.parameters.height,this.geometry.userData.scale[2]=this.geometry.userData.parameters.depth===0?1:e.parameters.depth/this.geometry.userData.parameters.depth,vb(this.originalGeometry.attributes,...this.geometry.userData.scale),this.originalGeometry.attributes.position.needsUpdate=!0,this.originalGeometry.attributes.normal.needsUpdate=!0,this.subdividedGeometry&&(vb(this.subdividedGeometry.attributes,...this.subdividedGeometry.userData.scale),this.subdividedGeometry.attributes.position.needsUpdate=!0,this.subdividedGeometry.attributes.normal.needsUpdate=!0),this.geometry.userData.parameters=U({},e.parameters)}};function vb(i,e,t,r){let n=i.position.array,s=i.normal.array,l=xb.makeScale(e,t,r).invert().elements,c,f,h;for(var p=0,y=n.length;p<y;p+=3)n[p]*=e,n[p+1]*=t,n[p+2]*=r,c=s[p],f=s[p+1],h=s[p+2],s[p]=l[0]*c+l[4]*f+l[8]*h,s[p+1]=l[1]*c+l[5]*f+l[9]*h,s[p+2]=l[2]*c+l[6]*f+l[10]*h}import{BackSide as lB,DoubleSide as cB,FrontSide as uB}from"three";function bb(i,e){e.flatShading!==void 0&&(i.flatShading=e.flatShading,i.needsUpdate=!0),e.wireframe!==void 0&&(i.wireframe=e.wireframe),e.side!==void 0&&(e.side===Ss.Front?i.side=uB:e.side===Ss.Back?i.side=lB:i.side=cB)}function fB(i,e){if(Array.isArray(i.material))for(let t of i.material)bb(t,e);else{let t=i.material;bb(t,e)}i.objectType==="SubdivObject"&&e.flatShading!==void 0&&(i.material.flatShading=!1,i.smoothShading=!e.flatShading,i.updateMesh())}function Sb(i,e,t){let r;if(e.geometry.type==="SubdivGeometry")r=Za.createFromState(i,e,t);else{let n=db(e.geometry,t),s="materials"in e?Zv(e.materials,t):Fa(e.material,t);Uc.is2DParametricMesh(n.userData.type)?r=new $a(n,s):(n==null?void 0:n.userData.type)==="VectorGeometry"?r=new Oo(n,s):e.geometry.type==="NonParametricGeometry"?r=new Ka(n,s):r=new Ja(n,s),r.uuid=i,r.fromState(e)}return fB(r,e),r}function wb(i,e,t){return e.type==="Mesh"?Sb(i,e,t):e.type==="TextFrame"?ks.createFromState(i,e,t):e.type==="Empty"?eo.createFromState(i,e):e.type==="PointLight"?Wa.createFromState(i,e,t):e.type==="SpotLight"?qa.createFromState(i,e,t):e.type==="DirectionalLight"?Ha.createFromState(i,e,t):gs.is(e.type)?Qi.createFromState(i,e):(console.error(e),new eo)}function hB(i,e){e.uniforms[`f${e.id}_transmissionSamplerMap`].value=i.texture,e.uniforms[`f${e.id}_transmissionDepthMap`].value=i.depthTexture}function Nb(i,e,t){if(!t.userData.layers)return!1;let r=!1,n=t.userData.layers.getLayersOfType(qe.TRANSMISSION);return n.length>0?(e.layers.set(3),r=!0,i!==void 0&&n.forEach(s=>hB(i,s))):e.layers.set(0),r}function Cb(i,e){let t=!1;return e.traverseEntity(r=>{if(r instanceof hr)if(Array.isArray(r.material))for(let n=0;n<r.material.length;n++)Nb(i,r,r.material[n])&&(t=!0);else Nb(i,r,r.material)&&(t=!0)}),t}function Lb(i,e){"material"in i&&dB(i.material,e),"geometry"in i&&i.geometry.dispose()}function dB(i,e){yg(i).forEach(t=>{e.isSharedMaterial(t)||t.dispose()})}var Tb=new gB,Vd=class extends mu(mB){constructor(e,t){super();this.objectType="Scene";this.alpha=1;this.backupFog=new yB(16777215,.1,2e3);this.fogUseBGColor=!1;this.wireframeState=!1;this.needsTransmissionDirty=!0;this._needsTransmission=!1;this._color=new _b(1,0,0);this.bgColor=new _b(1,1,1);this.entityByUuid={};this.ambientLight=new pB(13882323,8553090,.75),this.ambientLight.name="Default Ambient Light",this.personalCamera=this.createPersonalCamera(),this.activeCamera=this.personalCamera,this.sharedAssetManager=t,this.init(e,t)}needsTransmission(e){return this.needsTransmissionDirty&&(this._needsTransmission=Cb(e,this),e!==void 0&&(this.needsTransmissionDirty=!1)),this._needsTransmission}find(e){if(e===""||e===void 0)return;let t=this.entityByUuid[e];return t===void 0?this.getObjectByProperty("uuid",e):t}get color(){return this._color}set color(e){this.fogUseBGColor===!0&&this.backupFog.color.copy(e),this._color.copy(e)}get enableFog(){return this.fog!==null}set enableFog(e){this.fog=e===!0?this.backupFog:null}init(e,t){if(this.createChildrenObjects(e.objects,this,t),this.personalCamera.removeFromParent(),this.add(this.personalCamera),this.ambientLight.removeFromParent(),this.add(this.ambientLight),this.setBackgroundColor(kt(e.backgroundColor,t)),this.updateFog(e.fog,t),this.updateAmbientLight(e.environment.ambientLight,t),this.activeCamera=this.personalCamera,e.publish.playCamera!==null){let r=this.find(e.publish.playCamera);r instanceof Qi&&this.switchActiveCamera(r)}}clearScene(e){this.traverseEntity(t=>{Lb(t,e)});for(let t of this.children)xn(t)&&t.removeFromParent()}resetAfterClear(e,t){this.init(e,t)}createPersonalCamera(){let e=Qi.createFromState(Vd.PERSONAL_CAMERA_ID,fe(U({},Hc.defaultData),{name:"Personal Camera"}));return e.enableHelper=!1,e.objectHelper.visible=!1,delete e.isEntity,this.registerObjectCreatedInLegacy(e),e}raycast(e){let t=[],r=n=>{for(let s of n.children)xn(s)&&!s.raycastLock&&s.visible&&((Ms(s)||Si(s)&&s.enableHelper&&s.objectHelper.parent)&&e.intersectObject(s,!1,t),r(s))};return r(this),t}traverseEntity(e){for(let t of this.children)xn(t)&&t.traverseEntity(e)}updateFog(e,t){this.enableFog=e.enabled,this.fogUseBGColor=e.useBackgroundColor,e.useBackgroundColor?this.backupFog.color.set(this.bgColor):this.backupFog.color=kt(e.color,t),this.backupFog.near=e.near,this.backupFog.far=e.far}toJSON(e){return{}}fromJSON(e){return this}dispose(){this.clearScene(this.sharedAssetManager),this.sharedAssetManager.dispose()}updateAmbientLight(e,t){gv(this.ambientLight,e,t),e.groundColor!==void 0&&(this.ambientLight.groundColor=kt(e.groundColor,t)),e.enabled!==void 0&&(this.ambientLight.visible=e.enabled)}switchActiveCamera(e){this.activeCamera!==this.personalCamera&&(this.activeCamera.enableHelper=!0),this.activeCamera=e,e.enableHelper=!1}setBackgroundColor(e){this.bgColor=e,this.alpha=e.a}createChildrenObjects(e,t,r){for(let n of e)this.createChildObject(n.id,n.data,n.children,t,r)}registerObjectCreatedInLegacy(e){this.entityByUuid[e.uuid]=e}unregisterObject(e){delete this.entityByUuid[e.uuid];for(let t of e.children)this.unregisterObject(t)}createChildObject(e,t,r,n,s){let l=wb(e,t,s);return l&&(this.entityByUuid[e]=l,n.add(l),this.createChildrenObjects(r,l,s)),l}getCenter(e){let t=[];for(let n=0,s=e.length;n<s;++n){let{id:l,recursive:c}=e[n],f=this.find(l),h=c?f.recursiveBBox:f.singleBBox;t.push(...h.vertices)}let r=new xB;return r.setFromPoints(t),r.getCenter(Tb),Tb}copyMatrixWorld(e,t){if(e===null){t.identity();return}let r=this.find(e);r?t.copy(r.matrixWorld):t.identity()}copyParentMatrixWorld(e,t){var n;if(e===null){t.identity();return}let r=(n=this.find(e))==null?void 0:n.parent;r?t.copy(r.matrixWorld):t.identity()}traverseMaterial(e){this.traverseEntity(t=>{if(t instanceof hr)if(Array.isArray(t.material))for(let r=0;r<t.material.length;r++)e(t.material[r]);else e(t.material)})}updateCanvasSize(e,t){this.activeCamera.setViewplaneSize(e,t);let r,n;e>=t?(r=t/e,n=1):(r=1,n=e/t),this.traverseMaterial(s=>{s.layersList.getLayersOfType(qe.TRANSMISSION).forEach(c=>{c.uniforms[`f${c.id}_aspectRatio`].value.x=r,c.uniforms[`f${c.id}_aspectRatio`].value.y=n})})}},ku=Vd;ku.PERSONAL_CAMERA_ID="f23858d0-4a3b-4bd8-8173-66ed0af7f6fb-personalCamera";import{WebGLRenderTarget as vB,LinearMipmapLinearFilter as bB,LinearFilter as SB,ClampToEdgeWrapping as Ib,DepthTexture as wB}from"three";var Mb=new vr,Ud=class extends tn{},kd=class{constructor(e){this.materials={};this.images={};this.colors={};this.transmissionRenderTarget=new vB(2048,2048,{generateMipmaps:!0,minFilter:bB,magFilter:SB,wrapS:Ib,wrapT:Ib}),this.transmissionRenderTarget.depthTexture=new wB(2048,2048),this.reset(e)}reset(e){for(let[t,r]of Object.entries(e.images))this.addImage(t,r.data);for(let[t,r]of Object.entries(e.colors))this.addColor(t,r);for(let[t,r]of Object.entries(e.materials))this.addMaterial(t,Dd(r,this))}get transmissionSamplerMap(){return this.transmissionRenderTarget.texture}get transmissionDepthMap(){return this.transmissionRenderTarget.depthTexture}addMaterial(e,t){t.uuid=e,this.materials[e]=t}deleteMaterial(e){this.materials[e]&&(this.materials[e].dispose(),delete this.materials[e])}isSharedMaterial(e){return e.uuid in this.materials||e===Mb}getMaterial(e){let t=this.materials[e];return t}getMaterialOrDeletedPlaceholder(e){var t;return(t=this.materials[e])!=null?t:Mb}getMaterials(){return this.materials}addImage(e,t){if(this.images[e])return this.images[e].onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e].src=t,!0;{let r=new Image;return r.src=t,r.onload=()=>{this.onImageLoad&&this.onImageLoad(e)},this.images[e]=r,!1}}deleteImage(e){this.images[e]&&delete this.images[e]}getDefaultImage(){return this.images.image_0}getImage(e){return this.images[e]}getImages(){return this.images}addColor(e,t){return this.colors[e]?("a"in t?this.colors[e].setRGBA(t.r,t.g,t.b,t.a):this.colors[e].setRGBA(t.r,t.g,t.b,1),!0):("a"in t?this.colors[e]=new Ud(t.r,t.g,t.b,t.a):this.colors[e]=new Ud(t.r,t.g,t.b,1),!1)}updateColor(e,t){var r,n,s,l;if(this.colors[e]){let c=this.colors[e];return this.colors[e].r=(r=t.r)!=null?r:c.r,this.colors[e].g=(n=t.g)!=null?n:c.g,this.colors[e].b=(s=t.b)!=null?s:c.b,this.colors[e].a=(l=t.a)!=null?l:c.a,!0}return!1}deleteColor(e){this.colors[e]&&delete this.colors[e]}getColor(e){return this.colors[e]}dispose(){Object.keys(this.materials).forEach(t=>this.deleteMaterial(t)),this.transmissionRenderTarget.depthTexture.dispose(),this.transmissionRenderTarget.dispose(),this.onImageLoad=void 0}};import{Color as Ob,ShaderLib as NB}from"three";var Pb=rh(Ab());function Db(i){let e=new Set;return i.traverse(t=>{if(Ms(t))if((0,Pb.isArray)(t.material))t.material.forEach(r=>{let n=r;e.has(n)||e.add(n)});else{let r=t.material;e.has(r)||e.add(r)}}),e.forEach(t=>{let r=t.onBeforeCompile.bind(t);CB(t)?(Object.assign(t,{isMeshStandardMaterial:!0,isMeshPhysicalMaterial:!0,transmission:1,attenuationColor:new Ob,specularColor:new Ob}),t.onBeforeCompile=(n,s)=>{r&&r(n,s),n.uniforms=Object.assign(NB.physical.uniforms,n.uniforms),t.userData.layers.getLayersOfType(qe.TRANSMISSION).forEach(l=>{n.uniforms.transmissionSamplerMap.value&&(l.uniforms["f"+l.id+"_transmissionSamplerMap"].value=n.uniforms.transmissionSamplerMap.value,l.uniforms["f"+l.id+"_transmissionSamplerSize"].value=n.uniforms.transmissionSamplerSize.value)})}):LB(t)||(t.onBeforeCompile=(n,s)=>{r&&r(n,s),t.transparent=!1})}),i}function CB(i){return i.userData.layers.getLayersOfType(qe.TRANSMISSION).length>0}function LB(i){let e=i.userData.layers.head,t=0;for(;e!==void 0;){if(e.type!==qe.LIGHTING&&e.type!==qe.FRESNEL){let r=e.uniforms["f"+e.id+"_alpha"];r&&(t+=(1-t)*r.value)}e=e.next}return t<1}function Bb(i){return i.traverse(e=>{if(e.type==="Camera"){let t=e;t.type=t.cameraType}}),i}var Gb=class extends TB{load(e,t,r,n=console.error){let s=new _B(this.manager);s.setPath(this.path),s.setResponseType("arraybuffer"),s.setRequestHeader(this.requestHeader),s.setWithCredentials(this.withCredentials),s.load(e,l=>{try{if(typeof l=="string")throw new Error("The .spline file is not binary!");t(this.parse(l))}catch(c){n(c)}},r,n)}parse(e){let t=Bc.deserialize(new Uint8Array(e)),r=new kd(t.shared),n=new ku(t.scene,r);return Bb(Db(n))}};export{Gb as default};
|